metaforce/Runtime/Character/CPASAnimState.hpp

35 lines
1.2 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-10 04:49:02 +00:00
#include <utility>
#include <vector>
#include "Runtime/IOStreams.hpp"
#include "Runtime/Character/CPASAnimInfo.hpp"
#include "Runtime/Character/CPASParmInfo.hpp"
2016-04-10 04:49:02 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
class CRandom16;
class CPASAnimParmData;
2018-12-08 05:30:43 +00:00
class CPASAnimState {
s32 x0_id;
std::vector<CPASParmInfo> x4_parms;
std::vector<CPASAnimInfo> x14_anims;
mutable std::vector<s32> x24_selectionCache;
2018-12-08 05:30:43 +00:00
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;
2016-04-10 04:49:02 +00:00
public:
explicit CPASAnimState(CInputStream& in);
explicit CPASAnimState(int stateId);
2018-12-08 05:30:43 +00:00
s32 GetStateId() const { return x0_id; }
s32 GetNumAnims() const { return x14_anims.size(); }
CPASAnimParm GetAnimParmData(s32 animId, u32 parmIdx) const;
2018-12-08 05:30:43 +00:00
s32 PickRandomAnimation(CRandom16& rand) const;
std::pair<float, s32> FindBestAnimation(const rstl::reserved_vector<CPASAnimParm, 8>& parms, CRandom16& rand,
s32 ignoreAnim) const;
2016-04-10 04:49:02 +00:00
};
2018-12-08 05:30:43 +00:00
} // namespace urde