From b62d38046dbc6618b5eb433a0a29560e02bf43a9 Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Sat, 8 Jul 2023 18:49:18 -0700 Subject: Sign player anim data (#296) * Sign player anim data * Add comment * better way of getting negative values --- ZAPD/ZPlayerAnimationData.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'ZAPD/ZPlayerAnimationData.cpp') 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) { -- cgit v1.2.3