summaryrefslogtreecommitdiff
path: root/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-09-13 11:29:46 -0300
committerGitHub <noreply@github.com>2021-09-13 10:29:46 -0400
commit4d051c0fa036d245027a211bc7fd6a4afdce207f (patch)
treeeb1697990e40e60343971b777cbfe99c6eee548c /ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
parent90662f3cbade844c8edc3943ab8252e334b6166a (diff)
ZRoom cleaning 3 (#140)
* Remove redundant scene member * altheaders clean * it is broken and I don't know why * fix VTXs * Fix the stuff I broke in SetRoomList * Add RoomAltHeader and SceneAltHeader * fix syotes again and set the size of each ZRoomCommand * Add SCENE_CMD_UNK_09 todo * Nuke HintSystem * run format * Remove `canHaveInner` from ZRoom since the HintSystem doesn't exists anymore * Remove sourceOutput member from ZResource * Update docs * run format * Add non 64-bits aligned textures warning * remove unused json library * Update SCENE_CMD_UNK_09 * Fix merge issues * run format * Clean up actorlist output * Fix merge conflicts * format * Fix actorlist extraction * Unify AltHeader * fix merge conflicts * Run formatter * minor style changes * fix using wrong symbols for extracted vtxs from overlays * format * fix makefile stuff * fix merge issue
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp')
-rw-r--r--ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp b/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
index 35bd20c..4f5461f 100644
--- a/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
+++ b/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
@@ -23,8 +23,14 @@ void SetAlternateHeaders::ParseRawDataLate()
int32_t address = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset + (i * 4));
headers.push_back(address);
- if (address != 0)
- zRoom->commandSets.push_back(CommandSet(address));
+ if (address != 0 && parent->GetDeclaration(GETSEGOFFSET(address)) == nullptr)
+ {
+ ZRoom* altheader = new ZRoom(parent);
+ altheader->ExtractFromBinary(GETSEGOFFSET(address), zRoom->GetResourceType());
+ altheader->DeclareReferences(parent->GetName());
+
+ parent->resources.push_back(altheader);
+ }
}
}
@@ -36,19 +42,16 @@ void SetAlternateHeaders::DeclareReferencesLate(const std::string& prefix)
for (size_t i = 0; i < headers.size(); i++)
{
- if (headers.at(i) == 0)
- declaration += StringHelper::Sprintf("\tNULL,");
- else
- declaration +=
- StringHelper::Sprintf("\t%sSet%04X,", prefix.c_str(), GETSEGOFFSET(headers[i]));
+ declaration += StringHelper::Sprintf(
+ "\t%s,", parent->GetDeclarationPtrName(headers.at(i)).c_str());
if (i + 1 < headers.size())
declaration += "\n";
}
parent->AddDeclarationArray(
- segmentOffset, DeclarationAlignment::None, headers.size() * 4, "SceneCmd*",
- StringHelper::Sprintf("%sAlternateHeaders0x%06X", prefix.c_str(), segmentOffset), 0,
+ segmentOffset, DeclarationAlignment::Align4, headers.size() * 4, "SceneCmd*",
+ StringHelper::Sprintf("%sAltHeader_%06X", prefix.c_str(), segmentOffset), 0,
declaration);
}
}