diff --git a/Runtime/Character/CPASAnimInfo.cpp b/Runtime/Character/CPASAnimInfo.cpp index 222094958..6a11905b1 100644 --- a/Runtime/Character/CPASAnimInfo.cpp +++ b/Runtime/Character/CPASAnimInfo.cpp @@ -5,15 +5,18 @@ namespace urde { CPASAnimInfo::CPASAnimInfo(u32 id, rstl::reserved_vector&& parms) : x0_id(id), x4_parms(std::move(parms)) {} -CPASAnimParm::UParmValue CPASAnimInfo::GetAnimParmValue(u32 idx) const { - if (idx >= x4_parms.size()) +CPASAnimParm::UParmValue CPASAnimInfo::GetAnimParmValue(size_t idx) const { + if (idx >= x4_parms.size()) { return CPASAnimParm::UParmValue{}; + } return x4_parms[idx]; } -CPASAnimParm CPASAnimInfo::GetAnimParmData(u32 idx, CPASAnimParm::EParmType type) const { - if (idx >= x4_parms.size()) +CPASAnimParm CPASAnimInfo::GetAnimParmData(size_t idx, CPASAnimParm::EParmType type) const { + if (idx >= x4_parms.size()) { return CPASAnimParm::NoParameter(); + } + const CPASAnimParm::UParmValue& parm = x4_parms[idx]; switch (type) { diff --git a/Runtime/Character/CPASAnimInfo.hpp b/Runtime/Character/CPASAnimInfo.hpp index 186f9afed..a679f71f7 100644 --- a/Runtime/Character/CPASAnimInfo.hpp +++ b/Runtime/Character/CPASAnimInfo.hpp @@ -14,8 +14,8 @@ public: explicit CPASAnimInfo(u32 id) : x0_id(id) {} explicit CPASAnimInfo(u32 id, rstl::reserved_vector&& parms); u32 GetAnimId() const { return x0_id; } - CPASAnimParm::UParmValue GetAnimParmValue(u32 idx) const; - CPASAnimParm GetAnimParmData(u32, CPASAnimParm::EParmType) const; + CPASAnimParm::UParmValue GetAnimParmValue(size_t idx) const; + CPASAnimParm GetAnimParmData(size_t idx, CPASAnimParm::EParmType type) const; }; } // namespace urde diff --git a/Runtime/Character/CPASAnimState.cpp b/Runtime/Character/CPASAnimState.cpp index f0996e973..8089601ea 100644 --- a/Runtime/Character/CPASAnimState.cpp +++ b/Runtime/Character/CPASAnimState.cpp @@ -100,7 +100,7 @@ std::pair CPASAnimState::FindBestAnimation(const rstl::reserved_vect u32 unweightedCount = 0; - for (u32 i = 0; i < x4_parms.size(); ++i) { + for (size_t i = 0; i < x4_parms.size(); ++i) { CPASAnimParm::UParmValue val = info.GetAnimParmValue(i); const CPASParmInfo& parmInfo = x4_parms[i]; float parmWeight = parmInfo.GetParameterWeight(); @@ -142,7 +142,7 @@ std::pair CPASAnimState::FindBestAnimation(const rstl::reserved_vect return {weight, PickRandomAnimation(rand)}; } -float CPASAnimState::ComputeExactMatchWeight(u32, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const { +float CPASAnimState::ComputeExactMatchWeight(size_t, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const { switch (parm.GetParameterType()) { case CPASAnimParm::EParmType::Int32: return (parm.GetInt32Value() == parmVal.m_int ? 1.f : 0.f); @@ -161,7 +161,7 @@ float CPASAnimState::ComputeExactMatchWeight(u32, const CPASAnimParm& parm, CPAS return 0.f; } -float CPASAnimState::ComputePercentErrorWeight(u32 idx, const CPASAnimParm& parm, +float CPASAnimState::ComputePercentErrorWeight(size_t idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const { float range = 0.f; float val = 0.f; @@ -205,7 +205,7 @@ float CPASAnimState::ComputePercentErrorWeight(u32 idx, const CPASAnimParm& parm return (val < FLT_EPSILON ? 1.f : 0.f); } -float CPASAnimState::ComputeAngularPercentErrorWeight(u32 idx, const CPASAnimParm& parm, +float CPASAnimState::ComputeAngularPercentErrorWeight(size_t idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const { float range = 0.f; float val = 0.f; diff --git a/Runtime/Character/CPASAnimState.hpp b/Runtime/Character/CPASAnimState.hpp index e3cb7be84..d0a8b0107 100644 --- a/Runtime/Character/CPASAnimState.hpp +++ b/Runtime/Character/CPASAnimState.hpp @@ -16,9 +16,9 @@ class CPASAnimState { std::vector x14_anims; mutable std::vector x24_selectionCache; - float ComputeExactMatchWeight(u32 idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const; - float ComputePercentErrorWeight(u32 idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const; - float ComputeAngularPercentErrorWeight(u32 idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const; + float ComputeExactMatchWeight(size_t idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const; + float ComputePercentErrorWeight(size_t idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const; + float ComputeAngularPercentErrorWeight(size_t idx, const CPASAnimParm& parm, CPASAnimParm::UParmValue parmVal) const; public: explicit CPASAnimState(CInputStream& in);