summaryrefslogtreecommitdiff
path: root/ZAPD/ZTextureAnimation.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-10-05 13:55:55 -0300
committerGitHub <noreply@github.com>2021-10-05 12:55:55 -0400
commit4994e732406ffa2942f9c9ea6ff14c424cd0b896 (patch)
tree0b40b20db17139c58f5c205643940494c20cbc43 /ZAPD/ZTextureAnimation.cpp
parent17fca1e0cdda5476c4158940ca405b7eb250ec72 (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/ZTextureAnimation.cpp')
-rw-r--r--ZAPD/ZTextureAnimation.cpp58
1 files changed, 7 insertions, 51 deletions
diff --git a/ZAPD/ZTextureAnimation.cpp b/ZAPD/ZTextureAnimation.cpp
index deee4e3..cd2ca1b 100644
--- a/ZAPD/ZTextureAnimation.cpp
+++ b/ZAPD/ZTextureAnimation.cpp
@@ -125,32 +125,6 @@ ZTextureAnimationParams::GetDefaultName([[maybe_unused]] const std::string& pref
return "ShouldNotBeVIsible";
}
-void ZTextureAnimationParams::DeclareVar(const std::string& prefix,
- const std::string& bodyStr) const
-{
- std::string auxName = name;
-
- if (name == "")
- auxName = GetDefaultName(prefix);
-
- parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
- GetSourceTypeName(), auxName, bodyStr);
-}
-
-std::string ZTextureAnimationParams::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 "";
-}
-
ZResourceType ZTextureAnimationParams::GetResourceType() const
{
return ZResourceType::TextureAnimationParams;
@@ -197,15 +171,16 @@ size_t TextureScrollingParams::GetRawDataSize() const
/**
* Overrides the parent version to declare an array of the params rather than just one entry.
*/
-void TextureScrollingParams::DeclareVar(const std::string& prefix, const std::string& bodyStr) const
+Declaration* TextureScrollingParams::DeclareVar(const std::string& prefix,
+ const std::string& bodyStr)
{
std::string auxName = name;
if (name == "")
auxName = GetDefaultName(prefix);
- parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
- GetSourceTypeName(), auxName, count, bodyStr);
+ return parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(),
+ GetSourceTypeName(), auxName, count, bodyStr);
}
std::string TextureScrollingParams::GetBodySourceCode() const
@@ -537,12 +512,6 @@ ZTextureAnimation::ZTextureAnimation(ZFile* nParent) : ZResource(nParent)
{
}
-void ZTextureAnimation::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
-{
- ZResource::ExtractFromXML(reader, nRawDataIndex);
- DeclareVar("", "");
-}
-
/**
* Builds the array of params
*/
@@ -688,7 +657,7 @@ std::string ZTextureAnimation::GetDefaultName(const std::string& prefix) const
return StringHelper::Sprintf("%sTexAnim_%06X", prefix.c_str(), rawDataIndex);
}
-void ZTextureAnimation::DeclareVar(const std::string& prefix, const std::string& bodyStr) const
+Declaration* ZTextureAnimation::DeclareVar(const std::string& prefix, const std::string& bodyStr)
{
std::string auxName = name;
@@ -696,9 +665,10 @@ void ZTextureAnimation::DeclareVar(const std::string& prefix, const std::string&
auxName = GetDefaultName(prefix);
Declaration* decl =
- parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
+ parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(),
GetSourceTypeName(), auxName, entries.size(), bodyStr);
decl->staticConf = staticConf;
+ return decl;
}
std::string ZTextureAnimation::GetBodySourceCode() const
@@ -715,17 +685,3 @@ std::string ZTextureAnimation::GetBodySourceCode() const
return bodyStr;
}
-
-std::string ZTextureAnimation::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 "";
-}