diff options
| author | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2023-10-17 22:04:12 -0400 |
|---|---|---|
| committer | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2023-10-17 22:04:12 -0400 |
| commit | e9f4fc638ed904cc0dcdac24ea7708c9a220a702 (patch) | |
| tree | 114c3d432697e04831741e623ae2340f6239bbe9 /ZAPD/ZAnimation.cpp | |
| parent | dcf56d93ecbd4db3bfd8a4832d7f991467964b98 (diff) | |
update to latest version used by SoH
Diffstat (limited to 'ZAPD/ZAnimation.cpp')
| -rw-r--r-- | ZAPD/ZAnimation.cpp | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/ZAPD/ZAnimation.cpp b/ZAPD/ZAnimation.cpp index 74b520b..1998514 100644 --- a/ZAPD/ZAnimation.cpp +++ b/ZAPD/ZAnimation.cpp @@ -4,7 +4,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/File.h" +#include <Utils/DiskFile.h> #include "Utils/StringHelper.h" #include "WarningHandler.h" #include "ZFile.h" @@ -17,6 +17,7 @@ REGISTER_ZFILENODE(LegacyAnimation, ZLegacyAnimation); ZAnimation::ZAnimation(ZFile* nParent) : ZResource(nParent) { frameCount = 0; + genOTRDef = true; } void ZAnimation::ParseRawData() @@ -26,6 +27,21 @@ void ZAnimation::ParseRawData() frameCount = BitConverter::ToInt16BE(parent->GetRawData(), rawDataIndex + 0); } +/* +std::string ZAnimation::GetSourceOutputHeader(const std::string& prefix) +{ + if (Globals::Instance->otrMode) + { + std::string str = ""; + str += StringHelper::Sprintf("#define %s \"__OTR__%s/%s\"", name.c_str(), parent->GetOutName().c_str(), name.c_str()); + + return str; + } + else + return ZResource::GetSourceOutputHeader(prefix); +} +*/ + ZResourceType ZAnimation::GetResourceType() const { return ZResourceType::Animation; @@ -96,12 +112,15 @@ void ZNormalAnimation::DeclareReferences(const std::string& prefix) const uint8_t lineLength = 14; const uint8_t offset = 0; - for (size_t i = 0; i < rotationValues.size(); i++) + if (!Globals::Instance->otrMode) { - valuesStr += StringHelper::Sprintf("0x%04X, ", rotationValues[i]); + for (size_t i = 0; i < rotationValues.size(); i++) + { + valuesStr += StringHelper::Sprintf("0x%04X, ", rotationValues[i]); - if ((i - offset + 1) % lineLength == 0) - valuesStr += "\n "; + if ((i - offset + 1) % lineLength == 0) + valuesStr += "\n "; + } } parent->AddDeclarationArray(rotationValuesOffset, DeclarationAlignment::Align4, @@ -109,13 +128,17 @@ void ZNormalAnimation::DeclareReferences(const std::string& prefix) StringHelper::Sprintf("%sFrameData", defaultPrefix.c_str()), rotationValues.size(), valuesStr); - for (size_t i = 0; i < rotationIndices.size(); i++) + if (!Globals::Instance->otrMode) { - indicesStr += StringHelper::Sprintf(" { 0x%04X, 0x%04X, 0x%04X },", rotationIndices[i].x, - rotationIndices[i].y, rotationIndices[i].z); + for (size_t i = 0; i < rotationIndices.size(); i++) + { + indicesStr += + StringHelper::Sprintf(" { 0x%04X, 0x%04X, 0x%04X },", rotationIndices[i].x, + rotationIndices[i].y, rotationIndices[i].z); - if (i != (rotationIndices.size() - 1)) - indicesStr += "\n"; + if (i != (rotationIndices.size() - 1)) + indicesStr += "\n"; + } } parent->AddDeclarationArray(rotationIndicesOffset, DeclarationAlignment::Align4, @@ -127,10 +150,11 @@ void ZNormalAnimation::DeclareReferences(const std::string& prefix) std::string ZNormalAnimation::GetBodySourceCode() const { std::string frameDataName; - Globals::Instance->GetSegmentedPtrName(rotationValuesSeg, parent, "s16", frameDataName); + Globals::Instance->GetSegmentedPtrName(rotationValuesSeg, parent, "s16", frameDataName, + parent->workerID); std::string jointIndicesName; Globals::Instance->GetSegmentedPtrName(rotationIndicesSeg, parent, "JointIndex", - jointIndicesName); + jointIndicesName, parent->workerID); std::string headerStr = StringHelper::Sprintf("\n\t{ %i }, %s,\n", frameCount, frameDataName.c_str()); @@ -167,7 +191,7 @@ void ZLinkAnimation::ParseRawData() std::string ZLinkAnimation::GetBodySourceCode() const { std::string segSymbol; - Globals::Instance->GetSegmentedPtrName(segmentAddress, parent, "", segSymbol); + Globals::Instance->GetSegmentedPtrName(segmentAddress, parent, "", segSymbol, parent->workerID); return StringHelper::Sprintf("\n\t{ %i }, %s\n", frameCount, segSymbol.c_str()); } @@ -367,12 +391,13 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix) std::string ZCurveAnimation::GetBodySourceCode() const { std::string refIndexStr; - Globals::Instance->GetSegmentedPtrName(refIndex, parent, "u8", refIndexStr); + Globals::Instance->GetSegmentedPtrName(refIndex, parent, "u8", refIndexStr, parent->workerID); std::string transformDataStr; Globals::Instance->GetSegmentedPtrName(transformData, parent, "TransformData", - transformDataStr); + transformDataStr, parent->workerID); std::string copyValuesStr; - Globals::Instance->GetSegmentedPtrName(copyValues, parent, "s16", copyValuesStr); + Globals::Instance->GetSegmentedPtrName(copyValues, parent, "s16", copyValuesStr, + parent->workerID); return StringHelper::Sprintf("\n\t%s,\n\t%s,\n\t%s,\n\t%i, %i\n", refIndexStr.c_str(), transformDataStr.c_str(), copyValuesStr.c_str(), unk_0C, unk_10); @@ -494,8 +519,10 @@ std::string ZLegacyAnimation::GetBodySourceCode() const std::string frameDataName; std::string jointKeyName; - Globals::Instance->GetSegmentedPtrName(frameData, parent, "s16", frameDataName); - Globals::Instance->GetSegmentedPtrName(jointKey, parent, "JointKey", jointKeyName); + Globals::Instance->GetSegmentedPtrName(frameData, parent, "s16", frameDataName, + parent->workerID); + Globals::Instance->GetSegmentedPtrName(jointKey, parent, "JointKey", jointKeyName, + parent->workerID); body += StringHelper::Sprintf("\t%i, %i,\n", frameCount, limbCount); body += StringHelper::Sprintf("\t%s,\n", frameDataName.c_str()); |
