summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2023-07-08 18:49:18 -0700
committerGitHub <noreply@github.com>2023-07-08 21:49:18 -0400
commitb62d38046dbc6618b5eb433a0a29560e02bf43a9 (patch)
tree6317e49433bdd6b154c935584511879f390de4cf
parentbd87285d719e738a8baee8f11d4d6ffce0ab24a0 (diff)
Sign player anim data (#296)
* Sign player anim data * Add comment * better way of getting negative values
-rw-r--r--ZAPD/ZPlayerAnimationData.cpp13
-rw-r--r--ZAPD/ZPlayerAnimationData.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/ZAPD/ZPlayerAnimationData.cpp b/ZAPD/ZPlayerAnimationData.cpp
index a96604f..ce5425d 100644
--- a/ZAPD/ZPlayerAnimationData.cpp
+++ b/ZAPD/ZPlayerAnimationData.cpp
@@ -32,7 +32,7 @@ void ZPlayerAnimationData::ParseRawData()
for (size_t i = 0; i < totalSize; i += 2)
{
- limbRotData.push_back(BitConverter::ToUInt16BE(rawData, rawDataIndex + i));
+ limbRotData.push_back(BitConverter::ToInt16BE(rawData, rawDataIndex + i));
}
}
@@ -55,14 +55,21 @@ std::string ZPlayerAnimationData::GetBodySourceCode() const
std::string declaration = "";
size_t index = 0;
- for (const auto& entry : limbRotData)
+ for (const auto entry : limbRotData)
{
if (index % 8 == 0)
{
declaration += "\t";
}
- declaration += StringHelper::Sprintf("0x%04X, ", entry);
+ if (entry < 0)
+ {
+ declaration += StringHelper::Sprintf("-0x%04X, ", -entry);
+ }
+ else
+ {
+ declaration += StringHelper::Sprintf("0x%04X, ", entry);
+ }
if ((index + 1) % 8 == 0)
{
diff --git a/ZAPD/ZPlayerAnimationData.h b/ZAPD/ZPlayerAnimationData.h
index 20835f2..2923117 100644
--- a/ZAPD/ZPlayerAnimationData.h
+++ b/ZAPD/ZPlayerAnimationData.h
@@ -9,7 +9,7 @@ class ZPlayerAnimationData : public ZResource
{
public:
int16_t frameCount = 0;
- std::vector<uint16_t> limbRotData;
+ std::vector<int16_t> limbRotData;
ZPlayerAnimationData(ZFile* nParent);