Major refactor of serialization system

This commit is contained in:
Aruki
2018-09-04 13:27:27 -06:00
parent 91650a2924
commit 5182f436b8
54 changed files with 1105 additions and 831 deletions

View File

@@ -15,6 +15,7 @@ CAnimationParameters::CAnimationParameters()
CAnimationParameters::CAnimationParameters(EGame Game)
: mGame(Game)
, mCharacterID( CAssetID::InvalidID(Game) )
, mCharIndex(0)
, mAnimIndex(0)
, mUnknown2(0)
@@ -141,17 +142,17 @@ void CAnimationParameters::Serialize(IArchive& rArc)
if (rArc.IsReader())
mGame = rArc.Game();
rArc << SERIAL("AnimationSetAsset", mCharacterID);
rArc << SerialParameter("AnimationSetAsset", mCharacterID);
if (mGame <= eEchoes)
rArc << SERIAL("CharacterID", mCharIndex);
rArc << SerialParameter("CharacterID", mCharIndex);
rArc << SERIAL("AnimationID", mAnimIndex);
rArc << SerialParameter("AnimationID", mAnimIndex);
if (mGame >= eReturns)
{
rArc << SERIAL("Unknown0", mUnknown2)
<< SERIAL("Unknown1", mUnknown3);
rArc << SerialParameter("Unknown0", mUnknown2)
<< SerialParameter("Unknown1", mUnknown3);
}
}

View File

@@ -35,11 +35,36 @@ public:
inline void SetCharIndex(u32 Index) { mCharIndex = Index; }
inline void SetAnimIndex(u32 Index) { mAnimIndex = Index; }
inline void SetGame(EGame Game)
{
mGame = Game;
if (!mCharacterID.IsValid())
{
mCharacterID = CAssetID::InvalidID(mGame);
}
else
{
ASSERT( mCharacterID.Length() == CAssetID::GameIDLength(mGame) );
}
}
u32 Unknown(u32 Index);
void SetResource(const CAssetID& rkID);
void SetUnknown(u32 Index, u32 Value);
// Operators
inline CAnimationParameters& operator=(const CAnimationParameters& rkOther)
{
mGame = rkOther.mGame;
mCharacterID = rkOther.mCharacterID;
mCharIndex = rkOther.mCharIndex;
mAnimIndex = rkOther.mAnimIndex;
mUnknown2 = rkOther.mUnknown2;
mUnknown3 = rkOther.mUnknown3;
return *this;
}
inline bool operator==(const CAnimationParameters& rkOther) const
{
return ( (mGame == rkOther.mGame) &&