diff --git a/configure.py b/configure.py index 95c01d26..2679b011 100755 --- a/configure.py +++ b/configure.py @@ -493,7 +493,7 @@ LIBS = [ "Kyoto/Animation/CMetaTransSnap", "Kyoto/Animation/CMetaTransTrans", "Kyoto/Animation/CPASAnimInfo", - "Kyoto/Animation/CPASAnimParm", + ["Kyoto/Animation/CPASAnimParm", True], "Kyoto/Animation/CPASAnimState", "Kyoto/Animation/CPASDatabase", "Kyoto/Animation/CPASParmInfo", diff --git a/include/Kyoto/Animation/CPASAnimParm.hpp b/include/Kyoto/Animation/CPASAnimParm.hpp new file mode 100644 index 00000000..8f6f3893 --- /dev/null +++ b/include/Kyoto/Animation/CPASAnimParm.hpp @@ -0,0 +1,44 @@ +#ifndef _CPASANIMPARM +#define _CPASANIMPARM + +#include "types.h" + +class CPASAnimParm { +public: + enum EParmType { + kPT_None = -1, + kPT_Int32 = 0, + kPT_UInt32 = 1, + kPT_Float = 2, + kPT_Bool = 3, + kPT_Enum = 4, + + }; + union UParmValue { + int m_int; + uint m_uint; + float m_float; + bool m_bool; + }; + + CPASAnimParm(UParmValue value, EParmType type); + + static CPASAnimParm NoParameter(); + static CPASAnimParm FromInt32(int value); + static CPASAnimParm FromUint32(uint value); + static CPASAnimParm FromReal32(float value); + static CPASAnimParm FromBool(bool val); + static CPASAnimParm FromEnum(int value); + + int GetInt32Value() const; + uint GetUint32Value() const; + float GetReal32Value() const; + bool GetBoolValue() const; + int GetEnumValue() const; + +private: + UParmValue x0_value; + EParmType x4_type; +}; + +#endif // _CPASANIMPARM diff --git a/include/Kyoto/Animation/CPASAnimState.hpp b/include/Kyoto/Animation/CPASAnimState.hpp index e521090e..c3fa6d14 100644 --- a/include/Kyoto/Animation/CPASAnimState.hpp +++ b/include/Kyoto/Animation/CPASAnimState.hpp @@ -4,45 +4,11 @@ #include "types.h" #include "Kyoto/Animation/CharacterCommon.hpp" +#include "Kyoto/Animation/CPASAnimParm.hpp" #include "rstl/reserved_vector.hpp" #include "rstl/vector.hpp" -class CPASAnimParm { -public: - enum EParmType { - kPT_None = -1, - kPT_Int32 = 0, - kPT_UInt32 = 1, - kPT_Float = 2, - kPT_Bool = 3, - kPT_Enum = 4, - }; - union UParmValue { - int m_int; - uint m_uint; - float m_float; - bool m_bool; - }; - CPASAnimParm(const CPASAnimParm& other) : x0_value(other.x0_value), x4_type(other.x4_type) {} - - static CPASAnimParm FromEnum(int val); - static CPASAnimParm FromBool(bool val); - static CPASAnimParm FromReal32(float val); - static CPASAnimParm FromUint32(uint val); - static CPASAnimParm FromInt32(int val); - static CPASAnimParm NoParameter(); - - int GetEnumValue() const; // { return x0_value.m_int; } - int GetInt32Value() const; - float GetReal32Value() const; - bool GetBoolValue() const; - -private: - UParmValue x0_value; - EParmType x4_type; -}; - class CPASParmInfo { public: enum EWeightFunction { diff --git a/src/Kyoto/Animation/CPASAnimParm.cpp b/src/Kyoto/Animation/CPASAnimParm.cpp new file mode 100644 index 00000000..85992e25 --- /dev/null +++ b/src/Kyoto/Animation/CPASAnimParm.cpp @@ -0,0 +1,49 @@ +#include "Kyoto/Animation/CPASAnimParm.hpp" + +CPASAnimParm::CPASAnimParm(UParmValue value, EParmType type) : x0_value(value), x4_type(type) {} + +CPASAnimParm CPASAnimParm::NoParameter() { + UParmValue valin; + valin.m_int = -1; + return CPASAnimParm(valin, kPT_None); +} + +CPASAnimParm CPASAnimParm::FromInt32(int value) { + UParmValue valin; + valin.m_int = value; + return CPASAnimParm(valin, kPT_Int32); +} + +CPASAnimParm CPASAnimParm::FromUint32(uint value) { + UParmValue valin; + valin.m_uint = value; + return CPASAnimParm(valin, kPT_UInt32); +} + +CPASAnimParm CPASAnimParm::FromReal32(float value) { + UParmValue valin; + valin.m_float = value; + return CPASAnimParm(valin, kPT_Float); +} + +CPASAnimParm CPASAnimParm::FromBool(bool value) { + UParmValue valin; + valin.m_bool = value; + return CPASAnimParm(valin, kPT_Bool); +} + +CPASAnimParm CPASAnimParm::FromEnum(int value) { + UParmValue valin; + valin.m_int = value; + return CPASAnimParm(valin, kPT_Enum); +} + +int CPASAnimParm::GetInt32Value() const { return x0_value.m_int; } + +uint CPASAnimParm::GetUint32Value() const { return x0_value.m_uint; } + +float CPASAnimParm::GetReal32Value() const { return x0_value.m_float; } + +bool CPASAnimParm::GetBoolValue() const { return x0_value.m_bool; } + +int CPASAnimParm::GetEnumValue() const { return x0_value.m_int; }