diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-09-13 11:29:46 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-13 10:29:46 -0400 |
| commit | 4d051c0fa036d245027a211bc7fd6a4afdce207f (patch) | |
| tree | eb1697990e40e60343971b777cbfe99c6eee548c /ZAPD/ZFile.cpp | |
| parent | 90662f3cbade844c8edc3943ab8252e334b6166a (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/ZFile.cpp')
| -rw-r--r-- | ZAPD/ZFile.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp index 7d461b8..3709771 100644 --- a/ZAPD/ZFile.cpp +++ b/ZAPD/ZFile.cpp @@ -276,8 +276,10 @@ void ZFile::ExtractResources() if (!Directory::Exists(GetSourceOutputFolderPath().string())) Directory::CreateDirectory(GetSourceOutputFolderPath().string()); - for (ZResource* res : resources) - res->PreGenSourceFiles(); + for (size_t i = 0; i < resources.size(); i++) + resources[i]->ParseRawDataLate(); + for (size_t i = 0; i < resources.size(); i++) + resources[i]->DeclareReferencesLate(name); if (Globals::Instance->genSourceFile) GenerateSourceFiles(Globals::Instance->outputPath); @@ -375,12 +377,8 @@ Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment a size_t size, std::string varType, std::string varName, size_t arrayItemCnt, std::string body) { - assert(GETSEGNUM(address) == 0); - AddDeclarationDebugChecks(address); - - declarations[address] = - new Declaration(alignment, size, varType, varName, true, arrayItemCnt, body); - return declarations[address]; + return AddDeclarationArray(address, alignment, DeclarationPadding::None, size, varType, varName, + arrayItemCnt, body); } Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, @@ -396,18 +394,6 @@ Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment a } Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, - size_t size, std::string varType, std::string varName, - size_t arrayItemCnt, std::string body, bool isExternal) -{ - assert(GETSEGNUM(address) == 0); - AddDeclarationDebugChecks(address); - - declarations[address] = - new Declaration(alignment, size, varType, varName, true, arrayItemCnt, body, isExternal); - return declarations[address]; -} - -Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, DeclarationPadding padding, size_t size, std::string varType, std::string varName, size_t arrayItemCnt, std::string body) @@ -415,9 +401,28 @@ Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment a assert(GETSEGNUM(address) == 0); AddDeclarationDebugChecks(address); - declarations[address] = - new Declaration(alignment, padding, size, varType, varName, true, arrayItemCnt, body); - return declarations[address]; + Declaration* decl = GetDeclaration(address); + if (decl == nullptr) + { + decl = + new Declaration(alignment, padding, size, varType, varName, true, arrayItemCnt, body); + declarations[address] = decl; + } + else + { + if (decl->isPlaceholder) + decl->varName = varName; + decl->alignment = alignment; + decl->padding = padding; + decl->size = size; + decl->varType = varType; + decl->isArray = true; + decl->arrayItemCnt = arrayItemCnt; + if (body != "" && decl->text == "") + decl->text = body; + } + + return decl; } Declaration* ZFile::AddDeclarationPlaceholder(uint32_t address) |
