metaforce/Runtime/Character/CPASAnimState.hpp

38 lines
1.4 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"
2020-04-22 09:08:02 +00:00
#include "Runtime/Character/CharacterCommon.hpp"
#include "Runtime/Character/CPASAnimInfo.hpp"
#include "Runtime/Character/CPASParmInfo.hpp"
2016-04-10 04:49:02 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
class CRandom16;
class CPASAnimParmData;
2018-12-08 05:30:43 +00:00
class CPASAnimState {
2020-04-22 09:08:02 +00:00
pas::EAnimationState x0_id;
2018-12-08 05:30:43 +00:00
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(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;
s32 PickRandomAnimation(CRandom16& rand) const;
2016-04-10 04:49:02 +00:00
public:
explicit CPASAnimState(CInputStream& in);
2020-04-22 09:08:02 +00:00
explicit CPASAnimState(pas::EAnimationState stateId);
pas::EAnimationState GetStateId() const { return x0_id; }
size_t GetNumAnims() const { return x14_anims.size(); }
bool HasAnims() const { return !x14_anims.empty(); }
CPASAnimParm GetAnimParmData(s32 animId, size_t parmIdx) 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
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce