Skip to content

Commit

Permalink
Merge pull request #5 from Rozelette/master
Browse files Browse the repository at this point in the history
Fixed OTRExporter exporting the wrong amount of actors in some circumstances
  • Loading branch information
NEstelami authored Feb 3, 2022
2 parents 8c9a00d + 2a053d3 commit 6ac8db6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions OTRExporter/OTRExporter/RoomExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite
{
SetActorList* cmdSetActorList = (SetActorList*)cmd;

writer->Write((uint32_t)cmdSetActorList->actors.size());
// There are instance of the amount of actors in the file differing from the size listed in the command.
// This can cause issues if we export actors with garbage data, so let's trust the command size
writer->Write((uint32_t)cmdSetActorList->numActors);

for (const ActorSpawnEntry& entry : cmdSetActorList->actors)
for (int i = 0; i < cmdSetActorList->numActors; i++)
{
const ActorSpawnEntry& entry = cmdSetActorList->actors[i];

writer->Write(entry.actorNum);
writer->Write(entry.posX);
writer->Write(entry.posY);
Expand Down

0 comments on commit 6ac8db6

Please sign in to comment.