From 09bd30846f6e93ce3ad4031d62e2f35b22654bf4 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 22 Aug 2016 17:52:51 -0700 Subject: [PATCH] Fix CPASAnimState::FindBestAnimation derp --- Runtime/CGameState.cpp | 2 +- Runtime/CGameState.hpp | 17 +++++++++++++---- Runtime/Character/CPASAnimState.cpp | 9 +++++---- Runtime/Character/CPASParmInfo.hpp | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index 8ce3c57bb..2743a5f88 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -33,7 +33,7 @@ CGameState::CGameState(CBitStreamReader& stream) float currentHealth = tmpPlayer.GetHealthInfo().GetHP(); } -void CGameState::SetCurrentWorldId(unsigned int id, const std::string& name) +void CGameState::SetCurrentWorldId(unsigned int id) { } diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 9a15f203b..8ec174268 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -5,8 +5,9 @@ #include "CBasics.hpp" #include "CPlayerState.hpp" #include "CGameOptions.hpp" +#include "CRelayTracker.hpp" #include "World/CWorldTransManager.hpp" - +#include "AutoMapper/CMapWorldInfo.hpp" namespace urde { @@ -14,10 +15,16 @@ class CWorldState { ResId x0_mlvlId; TAreaId x4_areaId; + std::shared_ptr x8_relayTracker; + std::shared_ptr xc_mapWorldInfo; + /* std::shared_ptr<> x14_ */ public: CWorldState(ResId id) : x0_mlvlId(id) {} ResId GetWorldAssetId() const {return x0_mlvlId;} void SetAreaId(TAreaId aid) { x4_areaId = aid; } + const TAreaId& GetCurrentAreaId() const { return x4_areaId; } + std::shared_ptr RelayTracker() { return x8_relayTracker; } + std::shared_ptr MapWorldInfo() { return xc_mapWorldInfo; } }; class CGameState @@ -25,14 +32,16 @@ class CGameState friend class CStateManager; bool x0_[128] = {}; - int m_stateFlag = -1; ResId x84_mlvlId = -1; std::vector x88_worldStates; std::shared_ptr x98_playerState; std::shared_ptr x9c_transManager; - float m_gameTime = 0.0; CGameOptions m_gameOpts; double xa0_playTime; + u32 xa4_; + + /* x17c_ */ + /* x1f8_ */ union { @@ -46,7 +55,7 @@ class CGameState public: CGameState(); CGameState(CBitStreamReader& stream); - void SetCurrentWorldId(unsigned int id, const std::string& name); + void SetCurrentWorldId(unsigned int id); std::shared_ptr GetPlayerState() {return x98_playerState;} std::shared_ptr GetWorldTransitionManager() {return x9c_transManager;} void SetTotalPlayTime(float time); diff --git a/Runtime/Character/CPASAnimState.cpp b/Runtime/Character/CPASAnimState.cpp index 0ff5ce976..7c609abcb 100644 --- a/Runtime/Character/CPASAnimState.cpp +++ b/Runtime/Character/CPASAnimState.cpp @@ -99,7 +99,7 @@ std::pair CPASAnimState::FindBestAnimation(const rstl::reserved_vect if (x4_parms.size() > 0) calcWeight = 0.f; - u32 r23 = 0 ; + u32 unweightedCount = 0 ; u32 i = 0; for (; i CPASAnimState::FindBestAnimation(const rstl::reserved_vect computedWeight = ComputeExactMatchWeight(i, parms[i], val); else if (parmInfo.GetWeightFunction() == CPASParmInfo::EWeightFunction::PercentError) computedWeight = ComputePercentErrorWeight(i, parms[i], val); - else if (parmInfo.GetWeightFunction() == CPASParmInfo::EWeightFunction::Three) - r23++; + else if (parmInfo.GetWeightFunction() == CPASParmInfo::EWeightFunction::NoWeight) + unweightedCount++; calcWeight = parmWeight * calcWeight + computedWeight; } - if (r23 == x4_parms.size()) + if (unweightedCount == x4_parms.size()) calcWeight = 1.0f; if (calcWeight < weight) @@ -132,6 +132,7 @@ std::pair CPASAnimState::FindBestAnimation(const rstl::reserved_vect if (search == x24_selectionCache.cend()) const_cast*>(&x24_selectionCache)->push_back(info.GetAnimId()); + weight = calcWeight; } } return {weight, PickRandomAnimation(rand)}; diff --git a/Runtime/Character/CPASParmInfo.hpp b/Runtime/Character/CPASParmInfo.hpp index 2de76c6be..6856f507c 100644 --- a/Runtime/Character/CPASParmInfo.hpp +++ b/Runtime/Character/CPASParmInfo.hpp @@ -15,7 +15,7 @@ public: ExactMatch, PercentError, AngularPercent, - Three + NoWeight }; CPASAnimParm::EParmType x0_type;