metaforce/Runtime/Character/CPASAnimInfo.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

#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)) {}
CPASAnimParm::UParmValue CPASAnimInfo::GetAnimParmValue(size_t idx) const {
if (idx >= x4_parms.size()) {
2018-12-08 05:30:43 +00:00
return CPASAnimParm::UParmValue{};
}
2018-12-08 05:30:43 +00:00
return x4_parms[idx];
}
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();
}
2018-12-08 05:30:43 +00:00
const CPASAnimParm::UParmValue& parm = x4_parms[idx];
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-10 04:49:02 +00:00
2021-04-10 08:42:06 +00:00
} // namespace metaforce