2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/IOStreams.hpp"
|
2020-04-22 09:08:02 +00:00
|
|
|
#include "Runtime/Character/CharacterCommon.hpp"
|
2019-09-28 02:53:03 +00:00
|
|
|
#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 {
|
2016-04-27 19:59:38 +00:00
|
|
|
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;
|
2020-02-28 09:33:39 +00:00
|
|
|
mutable std::vector<s32> x24_selectionCache;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-04-06 17:02:18 +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;
|
2020-04-06 16:56:26 +00:00
|
|
|
|
2020-04-06 17:06:29 +00:00
|
|
|
s32 PickRandomAnimation(CRandom16& rand) const;
|
|
|
|
|
2016-04-10 04:49:02 +00:00
|
|
|
public:
|
2020-02-28 09:35:50 +00:00
|
|
|
explicit CPASAnimState(CInputStream& in);
|
2020-04-22 09:08:02 +00:00
|
|
|
explicit CPASAnimState(pas::EAnimationState stateId);
|
|
|
|
pas::EAnimationState GetStateId() const { return x0_id; }
|
2020-04-06 17:15:09 +00:00
|
|
|
size_t GetNumAnims() const { return x14_anims.size(); }
|
|
|
|
bool HasAnims() const { return !x14_anims.empty(); }
|
2020-04-06 17:09:11 +00:00
|
|
|
CPASAnimParm GetAnimParmData(s32 animId, size_t parmIdx) const;
|
2020-04-06 16:56:26 +00:00
|
|
|
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
|