summaryrefslogtreecommitdiff
path: root/ZAPD/ZRoom/Commands/SetActorList.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-04-15 07:49:28 -0400
committerGitHub <noreply@github.com>2021-04-15 07:49:28 -0400
commit179af7d11fd27b046edfb1bbadade865033583d7 (patch)
tree316a55e5c0857e26184d6758a324483e029e8849 /ZAPD/ZRoom/Commands/SetActorList.cpp
parent96ffc1e62720f0f43eb4885e6e7dbaf76a2f6cd2 (diff)
Rename "Prerender" to "Background", properly extract PolygonType1 multi format and change some structs used. (#107)
* Extract BgImage Signed-off-by: angie <angheloalf95@gmail.com> * improve the output a bit Signed-off-by: angie <angheloalf95@gmail.com> * extract backgrounds for multipoly Signed-off-by: angie <angheloalf95@gmail.com> * Extract the dlists of PolygonDlist Signed-off-by: angie <angheloalf95@gmail.com> * commands in the next line Signed-off-by: angie <angheloalf95@gmail.com> * Move a lot of repeated code into a class Signed-off-by: angie <angheloalf95@gmail.com> * Use PolygonDlist instead of MeshEntry0 Signed-off-by: angie <angheloalf95@gmail.com> * Rename prerender to background Signed-off-by: angie <angheloalf95@gmail.com> * format Signed-off-by: angie <angheloalf95@gmail.com> * last cleanup Signed-off-by: angie <angheloalf95@gmail.com> * Handle jpg padding Signed-off-by: angie <angheloalf95@gmail.com> * Add a few checks and warnings for jpeg validity Signed-off-by: Angie <angheloalf95@gmail.com> * typo Signed-off-by: Angie <angheloalf95@gmail.com> * fix merge error Signed-off-by: angie <angheloalf95@gmail.com> * Fix background extraction that somehow was broken Signed-off-by: angie <angheloalf95@gmail.com> * re-add the trailling line feed Signed-off-by: angie <angheloalf95@gmail.com> * add trailing line feed again Signed-off-by: angie <angheloalf95@gmail.com> * fix an already fixed warning Signed-off-by: angie <angheloalf95@gmail.com> * fix crash when no config file is provided * run format
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetActorList.cpp')
-rw-r--r--ZAPD/ZRoom/Commands/SetActorList.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/ZAPD/ZRoom/Commands/SetActorList.cpp b/ZAPD/ZRoom/Commands/SetActorList.cpp
index 745616a..5ce8586 100644
--- a/ZAPD/ZRoom/Commands/SetActorList.cpp
+++ b/ZAPD/ZRoom/Commands/SetActorList.cpp
@@ -55,9 +55,9 @@ 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);
+ StringHelper::Sprintf("\n %s 0x%02X, (u32)%sActorList0x%06X \n};",
+ ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(),
+ numActors, roomName.c_str(), segmentOffset);
// zRoom->parent->AddDeclaration(segmentOffset, DeclarationAlignment::None,
// DeclarationPadding::None, GetRawDataSize(), "SCmdActorList",
@@ -73,20 +73,21 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress)
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",
+ " { %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));
+ (entry->rotZ >> 7) & 0b111111111, entry->rotZ & 0b1111111, (uint16_t)entry->initVar,
+ segmentOffset + (index * 16));
}
else
{
- 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));
+ 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";
@@ -103,8 +104,8 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress)
padding = DeclarationPadding::None;
zRoom->parent->AddDeclarationArray(
- segmentOffset, DeclarationAlignment::None, padding, actors.size() * 16,
- "ActorEntry", StringHelper::Sprintf("%sActorList0x%06X", roomName.c_str(), segmentOffset),
+ segmentOffset, DeclarationAlignment::None, padding, actors.size() * 16, "ActorEntry",
+ StringHelper::Sprintf("%sActorList0x%06X", roomName.c_str(), segmentOffset),
GetActorListArraySize(), declaration);
return sourceOutput;
@@ -141,7 +142,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()