mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-12 06:45:12 +00:00
CAnimSet: Make use of size_t where applicable
This commit is contained in:
@@ -175,7 +175,7 @@ public:
|
||||
return pTree;
|
||||
}
|
||||
|
||||
CAnimation* FindAnimationAsset(uint32 AnimID) const
|
||||
CAnimation* FindAnimationAsset(size_t AnimID) const
|
||||
{
|
||||
if (AnimID < mAnimPrimitives.size())
|
||||
{
|
||||
@@ -192,29 +192,29 @@ public:
|
||||
}
|
||||
|
||||
// Accessors
|
||||
uint32 NumCharacters() const { return mCharacters.size(); }
|
||||
uint32 NumAnimations() const { return mAnimations.size(); }
|
||||
size_t NumCharacters() const { return mCharacters.size(); }
|
||||
size_t NumAnimations() const { return mAnimations.size(); }
|
||||
|
||||
const SSetCharacter* Character(uint32 Index) const
|
||||
const SSetCharacter* Character(size_t Index) const
|
||||
{
|
||||
ASSERT(Index < NumCharacters());
|
||||
return &mCharacters[Index];
|
||||
}
|
||||
|
||||
const SAnimation* Animation(uint32 Index) const
|
||||
const SAnimation* Animation(size_t Index) const
|
||||
{
|
||||
ASSERT(Index < NumAnimations());
|
||||
return &mAnimations[Index];
|
||||
}
|
||||
|
||||
CAnimEventData* AnimationEventData(uint32 Index) const
|
||||
CAnimEventData* AnimationEventData(size_t Index) const
|
||||
{
|
||||
ASSERT(Index < NumAnimations());
|
||||
|
||||
if (Game() <= EGame::Prime)
|
||||
{
|
||||
const CAnimPrimitive& rkPrim = mAnimPrimitives[Index];
|
||||
return rkPrim.Animation() ? rkPrim.Animation()->EventData() : nullptr;
|
||||
return rkPrim.Animation() != nullptr ? rkPrim.Animation()->EventData() : nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -139,36 +139,36 @@ void CAnimationParameters::Serialize(IArchive& rArc)
|
||||
}
|
||||
}
|
||||
|
||||
const SSetCharacter* CAnimationParameters::GetCurrentSetCharacter(int32 NodeIndex /*= -1*/)
|
||||
const SSetCharacter* CAnimationParameters::GetCurrentSetCharacter(int32 NodeIndex) const
|
||||
{
|
||||
CAnimSet *pSet = AnimSet();
|
||||
const CAnimSet *pSet = AnimSet();
|
||||
|
||||
if (pSet && (pSet->Type() == EResourceType::AnimSet || pSet->Type() == EResourceType::Character))
|
||||
if (pSet != nullptr && (pSet->Type() == EResourceType::AnimSet || pSet->Type() == EResourceType::Character))
|
||||
{
|
||||
if (NodeIndex == -1)
|
||||
NodeIndex = mCharIndex;
|
||||
|
||||
if (mCharIndex != -1 && pSet->NumCharacters() > (uint32) NodeIndex)
|
||||
if (mCharIndex != UINT32_MAX && pSet->NumCharacters() > static_cast<uint32>(NodeIndex))
|
||||
return pSet->Character(NodeIndex);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CModel* CAnimationParameters::GetCurrentModel(int32 NodeIndex /*= -1*/)
|
||||
CModel* CAnimationParameters::GetCurrentModel(int32 NodeIndex)
|
||||
{
|
||||
const SSetCharacter *pkChar = GetCurrentSetCharacter(NodeIndex);
|
||||
return pkChar ? pkChar->pModel : nullptr;
|
||||
return pkChar != nullptr ? pkChar->pModel : nullptr;
|
||||
}
|
||||
|
||||
TString CAnimationParameters::GetCurrentCharacterName(int32 NodeIndex /*= -1*/)
|
||||
TString CAnimationParameters::GetCurrentCharacterName(int32 NodeIndex) const
|
||||
{
|
||||
const SSetCharacter *pkChar = GetCurrentSetCharacter(NodeIndex);
|
||||
return pkChar ? pkChar->Name : "";
|
||||
return pkChar != nullptr ? pkChar->Name : "";
|
||||
}
|
||||
|
||||
// ************ ACCESSORS ************
|
||||
uint32 CAnimationParameters::Unknown(uint32 Index)
|
||||
uint32 CAnimationParameters::Unknown(uint32 Index) const
|
||||
{
|
||||
// mAnimIndex isn't unknown, but I'm too lazy to move it because there's a lot
|
||||
// of UI stuff that depends on these functions atm for accessing and editing parameters.
|
||||
|
||||
@@ -27,9 +27,9 @@ public:
|
||||
void Write(IOutputStream& rSCLY);
|
||||
void Serialize(IArchive& rArc);
|
||||
|
||||
const SSetCharacter* GetCurrentSetCharacter(int32 NodeIndex = -1);
|
||||
const SSetCharacter* GetCurrentSetCharacter(int32 NodeIndex = -1) const;
|
||||
CModel* GetCurrentModel(int32 NodeIndex = -1);
|
||||
TString GetCurrentCharacterName(int32 NodeIndex = -1);
|
||||
TString GetCurrentCharacterName(int32 NodeIndex = -1) const;
|
||||
|
||||
// Accessors
|
||||
EGame Version() const { return mGame; }
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Unknown(uint32 Index);
|
||||
uint32 Unknown(uint32 Index) const;
|
||||
void SetResource(const CAssetID& rkID);
|
||||
void SetUnknown(uint32 Index, uint32 Value);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, uint32& rOutCh
|
||||
|
||||
if (pRes != nullptr)
|
||||
{
|
||||
const uint32 MaxNumChars = static_cast<const CAnimSet*>(pRes)->NumCharacters();
|
||||
const size_t MaxNumChars = static_cast<const CAnimSet*>(pRes)->NumCharacters();
|
||||
rOutCharIndex = (asset.ForceNodeIndex >= 0 && asset.ForceNodeIndex < static_cast<int32>(MaxNumChars) ? asset.ForceNodeIndex : Params.CharacterIndex());
|
||||
rOutAnimIndex = Params.AnimIndex();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user