metaforce/Runtime/Character/CPASAnimInfo.cpp

36 lines
1.1 KiB
C++
Raw Normal View History

2016-04-10 04:49:02 +00:00
#include "CPASAnimInfo.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
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)) {}
2018-12-08 05:30:43 +00:00
CPASAnimParm::UParmValue CPASAnimInfo::GetAnimParmValue(u32 idx) const {
if (idx >= x4_parms.size())
return CPASAnimParm::UParmValue{};
return x4_parms[idx];
}
2018-12-08 05:30:43 +00:00
CPASAnimParm CPASAnimInfo::GetAnimParmData(u32 idx, CPASAnimParm::EParmType type) const {
if (idx >= x4_parms.size())
return CPASAnimParm::NoParameter();
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
2018-12-08 05:30:43 +00:00
} // namespace urde