diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-10-05 13:55:55 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-05 12:55:55 -0400 |
| commit | 4994e732406ffa2942f9c9ea6ff14c424cd0b896 (patch) | |
| tree | 0b40b20db17139c58f5c205643940494c20cbc43 /ZAPD/ZMtx.cpp | |
| parent | 17fca1e0cdda5476c4158940ca405b7eb250ec72 (diff) | |
ZResource cleanup (#178)
* Add some general use methods to ZResource
* change zarray
* adapt ztexture
* Clean up ZCollision, ZPath, ZScalar and ZVector
* cleanup background
* cleanup zmtx
* Clean up skeleton and limb
* mark GetSourceTypeName as abstract
* Remove redundant ExtractFromXML
* Reorder stuff to minimize changes in github
* remove extra ZDisplayList constructor
* Remove using namespace tinyxml2;
* run formatter
* Add some brief descriptions, and remove some methods
* Remove trivials GetSourceOutputCode and a bit of cleanup
* Add more descriptions to methods
* Fix blob build
* improve descriptions a bit
* Run formatter
* Now builds
* Add attributes and fix some warnings
* format
* fix merge issues
* fix merge issues and some clang warnings
* format
* Run formatter
* Fix merge issues
* Format
* add SEGMENTED_NULL
* Fix merge issues
* Run format
* dumb fix
* whoops
* format
* whoops
Diffstat (limited to 'ZAPD/ZMtx.cpp')
| -rw-r--r-- | ZAPD/ZMtx.cpp | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/ZAPD/ZMtx.cpp b/ZAPD/ZMtx.cpp index 7febfaf..b9ca3f2 100644 --- a/ZAPD/ZMtx.cpp +++ b/ZAPD/ZMtx.cpp @@ -1,4 +1,5 @@ #include "ZMtx.h" + #include "Utils/BitConverter.h" #include "Utils/StringHelper.h" #include "ZFile.h" @@ -9,13 +10,6 @@ ZMtx::ZMtx(ZFile* nParent) : ZResource(nParent) { } -ZMtx::ZMtx(const std::string& prefix, uint32_t nRawDataIndex, ZFile* nParent) : ZResource(nParent) -{ - name = GetDefaultName(prefix.c_str(), rawDataIndex); - ExtractFromFile(nRawDataIndex); - DeclareVar("", ""); -} - void ZMtx::ParseRawData() { ZResource::ParseRawData(); @@ -26,30 +20,11 @@ void ZMtx::ParseRawData() mtx[i][j] = BitConverter::ToInt32BE(rawData, rawDataIndex + (i * 4 + j) * 4); } -void ZMtx::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) -{ - ZResource::ExtractFromXML(reader, nRawDataIndex); - DeclareVar("", ""); -} - size_t ZMtx::GetRawDataSize() const { return 64; } -void ZMtx::DeclareVar(const std::string& prefix, const std::string& bodyStr) const -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix, rawDataIndex); - - Declaration* decl = - parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align8, GetRawDataSize(), - GetSourceTypeName(), auxName, bodyStr); - decl->staticConf = staticConf; -} - std::string ZMtx::GetBodySourceCode() const { std::string bodyStr = "\n"; @@ -67,25 +42,6 @@ std::string ZMtx::GetBodySourceCode() const return bodyStr; } -std::string ZMtx::GetSourceOutputCode(const std::string& prefix) -{ - std::string bodyStr = GetBodySourceCode(); - - Declaration* decl = parent->GetDeclaration(rawDataIndex); - - if (decl == nullptr) - DeclareVar(prefix, bodyStr); - else - decl->text = bodyStr; - - return ""; -} - -std::string ZMtx::GetDefaultName(const std::string& prefix, uint32_t address) -{ - return StringHelper::Sprintf("%sMtx_%06X", prefix.c_str(), address); -} - std::string ZMtx::GetSourceTypeName() const { return "Mtx"; @@ -95,3 +51,8 @@ ZResourceType ZMtx::GetResourceType() const { return ZResourceType::Mtx; } + +DeclarationAlignment ZMtx::GetDeclarationAlignment() const +{ + return DeclarationAlignment::Align8; +} |
