2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/Character/CPASAnimInfo.hpp"
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-04-10 04:49:02 +00:00
|
|
|
|
|
|
|
CPASAnimInfo::CPASAnimInfo(u32 id, rstl::reserved_vector<CPASAnimParm::UParmValue, 8>&& parms)
|
2018-12-08 05:30:43 +00:00
|
|
|
: x0_id(id), x4_parms(std::move(parms)) {}
|
2016-04-27 19:59:38 +00:00
|
|
|
|
2020-04-06 17:02:18 +00:00
|
|
|
CPASAnimParm::UParmValue CPASAnimInfo::GetAnimParmValue(size_t idx) const {
|
|
|
|
if (idx >= x4_parms.size()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return CPASAnimParm::UParmValue{};
|
2020-04-06 17:02:18 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
return x4_parms[idx];
|
2016-04-27 19:59:38 +00:00
|
|
|
}
|
|
|
|
|
2020-04-06 17:02:18 +00:00
|
|
|
CPASAnimParm CPASAnimInfo::GetAnimParmData(size_t idx, CPASAnimParm::EParmType type) const {
|
|
|
|
if (idx >= x4_parms.size()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return CPASAnimParm::NoParameter();
|
2020-04-06 17:02:18 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
const CPASAnimParm::UParmValue& parm = x4_parms[idx];
|
2016-04-27 19:59:38 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
switch (type) {
|
|
|
|
case CPASAnimParm::EParmType::Int32:
|
|
|
|
return CPASAnimParm::FromInt32(parm.m_int);
|
|
|
|
case CPASAnimParm::EParmType::UInt32:
|
|
|
|
return CPASAnimParm::FromUint32(parm.m_uint);
|
|
|
|
case CPASAnimParm::EParmType::Float:
|
|
|
|
return CPASAnimParm::FromReal32(parm.m_float);
|
|
|
|
case CPASAnimParm::EParmType::Bool:
|
|
|
|
return CPASAnimParm::FromBool(parm.m_bool);
|
|
|
|
case CPASAnimParm::EParmType::Enum:
|
|
|
|
return CPASAnimParm::FromEnum(parm.m_int);
|
|
|
|
default:
|
|
|
|
return CPASAnimParm::NoParameter();
|
|
|
|
}
|
2016-04-27 19:59:38 +00:00
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|