summaryrefslogtreecommitdiff
path: root/ZAPD/ZString.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/ZString.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/ZString.cpp')
-rw-r--r--ZAPD/ZString.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/ZAPD/ZString.cpp b/ZAPD/ZString.cpp
index 502bb54..965d4d6 100644
--- a/ZAPD/ZString.cpp
+++ b/ZAPD/ZString.cpp
@@ -29,19 +29,23 @@ void ZString::ParseRawData()
strData.assign(dataStart, dataStart + size);
}
-std::string ZString::GetBodySourceCode() const
+Declaration* ZString::DeclareVar(const std::string& prefix, const std::string& bodyStr)
{
- return StringHelper::Sprintf("\t\"%s\"", strData.data());
-}
+ std::string auxName = name;
+
+ if (name == "")
+ auxName = GetDefaultName(prefix);
-std::string ZString::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
-{
Declaration* decl =
- parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
- GetSourceTypeName(), name, 0, GetBodySourceCode());
+ parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(),
+ GetSourceTypeName(), auxName, 0, bodyStr);
decl->staticConf = staticConf;
+ return decl;
+}
- return "";
+std::string ZString::GetBodySourceCode() const
+{
+ return StringHelper::Sprintf("\t\"%s\"", strData.data());
}
std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)