summaryrefslogtreecommitdiff
path: root/ZAPD/ZAnimation.cpp
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2021-05-08 12:27:38 -0400
committerGitHub <noreply@github.com>2021-05-08 12:27:38 -0400
commita357277e412b5e8f0f2f0578c7d7d213e8744c8d (patch)
tree353e7aa38aef392c6f337d6a1a04d3438f00def5 /ZAPD/ZAnimation.cpp
parent547c9b200d1dff745dee694c20a9f9e8e409a11d (diff)
Add const to most functions that need it and remove all "using namespace std" (#132)
* started on basic type errors * Done. For now * remove libgfxd binary * const * no more namespace std * revert alloca * re add a few missing consts
Diffstat (limited to 'ZAPD/ZAnimation.cpp')
-rw-r--r--ZAPD/ZAnimation.cpp65
1 files changed, 32 insertions, 33 deletions
diff --git a/ZAPD/ZAnimation.cpp b/ZAPD/ZAnimation.cpp
index 3274cb3..1270e86 100644
--- a/ZAPD/ZAnimation.cpp
+++ b/ZAPD/ZAnimation.cpp
@@ -7,8 +7,6 @@
#include "StringHelper.h"
#include "ZFile.h"
-using namespace std;
-
REGISTER_ZFILENODE(Animation, ZNormalAnimation);
REGISTER_ZFILENODE(PlayerAnimation, ZLinkAnimation);
REGISTER_ZFILENODE(CurveAnimation, ZCurveAnimation);
@@ -31,7 +29,7 @@ void ZAnimation::Save(const fs::path& outFolder)
if (Globals::Instance->testMode)
{
HLAnimationIntermediette* anim = HLAnimationIntermediette::FromZAnimation(this);
- string xml = anim->OutputXML();
+ std::string xml = anim->OutputXML();
File::WriteAllText(outFolder / (name + ".anmi"), xml);
delete anim;
@@ -43,20 +41,20 @@ void ZAnimation::ParseXML(tinyxml2::XMLElement* reader)
ZResource::ParseXML(reader);
}
-string ZAnimation::GetSourceOutputCode(const std::string& prefix)
+std::string ZAnimation::GetSourceOutputCode(const std::string& prefix)
{
return "";
}
-ZResourceType ZAnimation::GetResourceType()
+ZResourceType ZAnimation::GetResourceType() const
{
return ZResourceType::Animation;
}
ZNormalAnimation::ZNormalAnimation(ZFile* nParent) : ZAnimation(nParent)
{
- rotationValues = vector<uint16_t>();
- rotationIndices = vector<RotationIndex>();
+ rotationValues = std::vector<uint16_t>();
+ rotationIndices = std::vector<RotationIndex>();
limit = 0;
}
@@ -64,10 +62,10 @@ std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix)
{
if (parent != nullptr)
{
- string defaultPrefix = name.c_str();
+ std::string defaultPrefix = name.c_str();
defaultPrefix.replace(0, 1, "s"); // replace g prefix with s for local variables
- string headerStr = StringHelper::Sprintf("\n\t{ %i },\n", frameCount);
+ std::string headerStr = StringHelper::Sprintf("\n\t{ %i },\n", frameCount);
headerStr += StringHelper::Sprintf("\t%sFrameData,\n", defaultPrefix.c_str());
headerStr += StringHelper::Sprintf("\t%sJointIndices,\n", defaultPrefix.c_str());
headerStr += StringHelper::Sprintf("\t%i\n", limit);
@@ -75,8 +73,8 @@ std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix)
GetSourceTypeName(), StringHelper::Sprintf("%s", name.c_str()),
headerStr);
- string indicesStr = "";
- string valuesStr = " ";
+ std::string indicesStr = "";
+ std::string valuesStr = " ";
const uint8_t lineLength = 14;
const uint8_t offset = 0;
@@ -112,12 +110,12 @@ std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix)
return "";
}
-size_t ZNormalAnimation::GetRawDataSize()
+size_t ZNormalAnimation::GetRawDataSize() const
{
return 16;
}
-std::string ZNormalAnimation::GetSourceTypeName()
+std::string ZNormalAnimation::GetSourceTypeName() const
{
return "AnimationHeader";
}
@@ -172,12 +170,13 @@ std::string ZLinkAnimation::GetSourceOutputCode(const std::string& prefix)
{
if (parent != nullptr)
{
- string segSymbol = segmentAddress == 0 ?
- "NULL" :
- parent->GetDeclarationName(
- segmentAddress, StringHelper::Sprintf("%sSeg%06X", name.c_str(),
- segmentAddress));
- string headerStr =
+ std::string segSymbol =
+ segmentAddress == 0 ?
+ "NULL" :
+ parent->GetDeclarationName(
+ segmentAddress,
+ StringHelper::Sprintf("%sSeg%06X", name.c_str(), segmentAddress));
+ std::string headerStr =
StringHelper::Sprintf("\n\t{ %i },\n\t0x%08X\n", frameCount, segmentAddress);
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(),
GetSourceTypeName(), StringHelper::Sprintf("%s", name.c_str()),
@@ -187,12 +186,12 @@ std::string ZLinkAnimation::GetSourceOutputCode(const std::string& prefix)
return "";
}
-size_t ZLinkAnimation::GetRawDataSize()
+size_t ZLinkAnimation::GetRawDataSize() const
{
return 8;
}
-std::string ZLinkAnimation::GetSourceTypeName()
+std::string ZLinkAnimation::GetSourceTypeName() const
{
return "LinkAnimationHeader";
}
@@ -342,10 +341,10 @@ void ZCurveAnimation::PreGenValues(const std::string& prefix)
if (refIndex != 0)
{
uint32_t refIndexOffset = Seg2Filespace(refIndex, parent->baseAddress);
- string refIndexStr =
+ std::string refIndexStr =
StringHelper::Sprintf("%sCurveAnime_%s_%06X", prefix.c_str(), "Ref", refIndexOffset);
- string entryStr = " ";
+ std::string entryStr = " ";
uint16_t arrayItemCnt = refIndexArr.size();
size_t i = 0;
@@ -370,11 +369,11 @@ void ZCurveAnimation::PreGenValues(const std::string& prefix)
if (transformData != 0)
{
uint32_t transformDataOffset = Seg2Filespace(transformData, parent->baseAddress);
- string transformDataStr =
+ std::string transformDataStr =
StringHelper::Sprintf("%sCurveAnime_%s_%06X", prefix.c_str(),
TransformData::GetSourceTypeName().c_str(), transformDataOffset);
- string entryStr = "";
+ std::string entryStr = "";
uint16_t arrayItemCnt = transformDataArr.size();
size_t i = 0;
@@ -401,10 +400,10 @@ void ZCurveAnimation::PreGenValues(const std::string& prefix)
if (copyValues != 0)
{
uint32_t copyValuesOffset = Seg2Filespace(copyValues, parent->baseAddress);
- string copyValuesStr =
+ std::string copyValuesStr =
StringHelper::Sprintf("%sCurveAnime_%s_%06X", prefix.c_str(), "Copy", copyValuesOffset);
- string entryStr = " ";
+ std::string entryStr = " ";
uint16_t arrayItemCnt = copyValuesArr.size();
size_t i = 0;
@@ -427,19 +426,19 @@ void ZCurveAnimation::PreGenValues(const std::string& prefix)
}
}
-size_t ZCurveAnimation::GetRawDataSize()
+size_t ZCurveAnimation::GetRawDataSize() const
{
return 0x10;
}
std::string ZCurveAnimation::GetSourceOutputCode(const std::string& prefix)
{
- string bodyStr = "";
+ std::string bodyStr = "";
uint32_t address = Seg2Filespace(rawDataIndex, parent->baseAddress);
PreGenValues(prefix);
- string refIndexStr = "NULL";
+ std::string refIndexStr = "NULL";
if (refIndex != 0)
{
uint32_t refIndexOffset = Seg2Filespace(refIndex, parent->baseAddress);
@@ -455,7 +454,7 @@ std::string ZCurveAnimation::GetSourceOutputCode(const std::string& prefix)
}
}
- string transformDataStr = "NULL";
+ std::string transformDataStr = "NULL";
if (transformData != 0)
{
uint32_t transformDataOffset = Seg2Filespace(transformData, parent->baseAddress);
@@ -472,7 +471,7 @@ std::string ZCurveAnimation::GetSourceOutputCode(const std::string& prefix)
}
}
- string copyValuesStr = "NULL";
+ std::string copyValuesStr = "NULL";
if (copyValues != 0)
{
uint32_t copyValuesOffset = Seg2Filespace(copyValues, parent->baseAddress);
@@ -506,7 +505,7 @@ std::string ZCurveAnimation::GetSourceOutputCode(const std::string& prefix)
return "";
}
-std::string ZCurveAnimation::GetSourceTypeName()
+std::string ZCurveAnimation::GetSourceTypeName() const
{
return "TransformUpdateIndex";
}