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 "Runtime/RetroTypes.hpp"
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CPASAnimParm {
|
2016-04-10 04:49:02 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EParmType { None = -1, Int32 = 0, UInt32 = 1, Float = 2, Bool = 3, Enum = 4 };
|
|
|
|
union UParmValue {
|
|
|
|
s32 m_int;
|
|
|
|
u32 m_uint;
|
|
|
|
float m_float;
|
|
|
|
bool m_bool;
|
|
|
|
};
|
2016-04-10 04:49:02 +00:00
|
|
|
|
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
UParmValue x0_value;
|
|
|
|
EParmType x4_type;
|
|
|
|
|
2016-04-10 04:49:02 +00:00
|
|
|
public:
|
2020-04-06 06:55:02 +00:00
|
|
|
constexpr CPASAnimParm(UParmValue val, EParmType tp) : x0_value(val), x4_type(tp) {}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] constexpr EParmType GetParameterType() const { return x4_type; }
|
|
|
|
[[nodiscard]] constexpr s32 GetEnumValue() const { return x0_value.m_int; }
|
|
|
|
[[nodiscard]] constexpr bool GetBoolValue() const { return x0_value.m_bool; }
|
|
|
|
[[nodiscard]] constexpr float GetReal32Value() const { return x0_value.m_float; }
|
|
|
|
[[nodiscard]] constexpr u32 GetUint32Value() const { return x0_value.m_uint; }
|
|
|
|
[[nodiscard]] constexpr s32 GetInt32Value() const { return x0_value.m_int; }
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] static constexpr CPASAnimParm FromEnum(s32 val) {
|
|
|
|
UParmValue valin{};
|
2018-12-08 05:30:43 +00:00
|
|
|
valin.m_int = val;
|
|
|
|
return CPASAnimParm(valin, EParmType::Enum);
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] static constexpr CPASAnimParm FromBool(bool val) {
|
|
|
|
UParmValue valin{};
|
2018-12-08 05:30:43 +00:00
|
|
|
valin.m_bool = val;
|
|
|
|
return CPASAnimParm(valin, EParmType::Bool);
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] static constexpr CPASAnimParm FromReal32(float val) {
|
|
|
|
UParmValue valin{};
|
2018-12-08 05:30:43 +00:00
|
|
|
valin.m_float = val;
|
|
|
|
return CPASAnimParm(valin, EParmType::Float);
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] static constexpr CPASAnimParm FromUint32(u32 val) {
|
|
|
|
UParmValue valin{};
|
2018-12-08 05:30:43 +00:00
|
|
|
valin.m_uint = val;
|
|
|
|
return CPASAnimParm(valin, EParmType::UInt32);
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] static constexpr CPASAnimParm FromInt32(s32 val) {
|
|
|
|
UParmValue valin{};
|
2018-12-08 05:30:43 +00:00
|
|
|
valin.m_int = val;
|
|
|
|
return CPASAnimParm(valin, EParmType::Int32);
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
|
2020-04-06 06:55:02 +00:00
|
|
|
[[nodiscard]] static constexpr CPASAnimParm NoParameter() {
|
|
|
|
UParmValue valin{};
|
2018-12-08 05:30:43 +00:00
|
|
|
valin.m_int = -1;
|
|
|
|
return CPASAnimParm(valin, EParmType::None);
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|