diff options
| author | Rozelette <Rozelette@users.noreply.github.com> | 2021-04-07 08:42:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-07 09:42:37 -0400 |
| commit | 95bf5fc0080135f20f3ab17082f79b9e539e80a5 (patch) | |
| tree | 92f5190dc89172df719d82092ae2d2fb086205ba /ZAPD/ZRoom/Commands/SetActorList.cpp | |
| parent | 19c2ea3d474de1b74781417f4b58782396c0aa50 (diff) | |
Add MM scene support (#109)
* Enough to get 1 scene OK
* More MM progress
* Fixes for scenes. 376/401 match
* Fix last of MM scenes
* Add SetWorldMapVisited
* Cleanup
* Hopefully fix OOT build
* Address feedback
* Add macro for rotation flags in MM
* remove Align2
* Cleanup
* Conditionally use looser alignment only in MM
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetActorList.cpp')
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetActorList.cpp | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/ZAPD/ZRoom/Commands/SetActorList.cpp b/ZAPD/ZRoom/Commands/SetActorList.cpp index 1b6fba9..5f395d8 100644 --- a/ZAPD/ZRoom/Commands/SetActorList.cpp +++ b/ZAPD/ZRoom/Commands/SetActorList.cpp @@ -3,7 +3,7 @@ #include "../../Globals.h" #include "../../StringHelper.h" #include "../../ZFile.h" -#include "../ActorList.h" +#include "../ZNames.h" #include "../ZRoom.h" using namespace std; @@ -56,8 +56,8 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress) sourceOutput += StringHelper::Sprintf("%s 0x%02X, (u32)%sActorList0x%06X };", - ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), - numActors, roomName.c_str(), segmentOffset); + ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), + numActors, roomName.c_str(), segmentOffset); // zRoom->parent->AddDeclaration(segmentOffset, DeclarationAlignment::None, // DeclarationPadding::None, GetRawDataSize(), "SCmdActorList", @@ -70,10 +70,20 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress) { uint16_t actorNum = entry->actorNum; + if (Globals::Instance->game == ZGame::MM_RETAIL) + { + declaration += StringHelper::Sprintf( + " { %s, %i, %i, %i, SPAWN_ROT_FLAGS(%i, 0x%04X), SPAWN_ROT_FLAGS(%i, 0x%04X), SPAWN_ROT_FLAGS(%i, 0x%04X), 0x%04X }, //0x%06X", + ZNames::GetActorName(actorNum).c_str(), entry->posX, entry->posY, entry->posZ, + (entry->rotX >> 7) & 0b111111111, entry->rotX & 0b1111111, + (entry->rotY >> 7) & 0b111111111, entry->rotY & 0b1111111, + (entry->rotZ >> 7) & 0b111111111, entry->rotZ & 0b1111111, + (uint16_t)entry->initVar, segmentOffset + (index * 16)); + } // SW97 Actor 0x22 was removed, so we want to not output a working actor. - if (actorNum == 0x22 && Globals::Instance->game == ZGame::OOT_SW97) + else if (actorNum == 0x22 && Globals::Instance->game == ZGame::OOT_SW97) declaration += StringHelper::Sprintf( - "\t//{ %s, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", + " //{ %s, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", /*StringHelper::Sprintf("SW_REMOVED_0x%04X", actorNum).c_str()*/ "ACTOR_DUNGEON_KEEP", entry->posX, entry->posY, entry->posZ, entry->rotX, entry->rotY, entry->rotZ, (uint16_t)entry->initVar, segmentOffset + (index * 16)); @@ -84,27 +94,25 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress) if (Globals::Instance->game == ZGame::OOT_SW97 && actorNum >= 0x23) actorNum--; - if (actorNum < sizeof(ActorList) / sizeof(ActorList[0])) - declaration += - StringHelper::Sprintf("\t{ %s, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", - ActorList[actorNum].c_str(), entry->posX, entry->posY, - entry->posZ, entry->rotX, entry->rotY, entry->rotZ, - (uint16_t)entry->initVar, segmentOffset + (index * 16)); - else - declaration += StringHelper::Sprintf( - "\t{ 0x%04X, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", actorNum, entry->posX, - entry->posY, entry->posZ, entry->rotX, entry->rotY, entry->rotZ, - (uint16_t)entry->initVar, segmentOffset + (index * 16)); - - if (index < actors.size() - 1) - declaration += "\n"; + declaration += + StringHelper::Sprintf(" { %s, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", + ZNames::GetActorName(actorNum).c_str(), entry->posX, entry->posY, + entry->posZ, entry->rotX, entry->rotY, entry->rotZ, + (uint16_t)entry->initVar, segmentOffset + (index * 16)); } + if (index < actors.size() - 1) + declaration += "\n"; + index++; } + DeclarationPadding padding = DeclarationPadding::Pad16; + if (Globals::Instance->game == ZGame::MM_RETAIL) + padding = DeclarationPadding::None; + zRoom->parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, actors.size() * 16, + segmentOffset, DeclarationAlignment::None, padding, actors.size() * 16, "ActorEntry", StringHelper::Sprintf("%sActorList0x%06X", roomName.c_str(), segmentOffset), GetActorListArraySize(), declaration); @@ -142,7 +150,7 @@ size_t SetActorList::GetActorListArraySize() string SetActorList::GenerateExterns() { return StringHelper::Sprintf("extern ActorEntry %sActorList0x%06X[%i];\n", - zRoom->GetName().c_str(), segmentOffset, GetActorListArraySize()); + zRoom->GetName().c_str(), segmentOffset, GetActorListArraySize()); } string SetActorList::GetCommandCName() |
