mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-14 15:46:17 +00:00
Refactor so PWE compiles with the newly externalized LibCommon
This commit is contained in:
@@ -55,7 +55,7 @@ void CGameTemplate::Load(const TString& kFilePath)
|
||||
|
||||
void CGameTemplate::Save()
|
||||
{
|
||||
Log::Write("Saving game template: " + mSourceFile);
|
||||
debugf("Saving game template: %s", *mSourceFile);
|
||||
CXMLWriter Writer(mSourceFile, "Game", 0, mGame);
|
||||
ASSERT(Writer.IsValid());
|
||||
Serialize(Writer);
|
||||
@@ -109,7 +109,7 @@ void CGameTemplate::SaveGameTemplates(bool ForceAll /*= false*/)
|
||||
const TString kOutPath = kGameDir + Path.Path;
|
||||
FileUtil::MakeDirectory( kOutPath.GetFileDirectory() );
|
||||
|
||||
Log::Write("Saving property template: " + kOutPath);
|
||||
debugf("Saving property template: %s", *kOutPath);
|
||||
CXMLWriter Writer(kOutPath, "PropertyTemplate", 0, Game());
|
||||
ASSERT(Writer.IsValid());
|
||||
|
||||
@@ -120,12 +120,12 @@ void CGameTemplate::SaveGameTemplates(bool ForceAll /*= false*/)
|
||||
}
|
||||
}
|
||||
|
||||
u32 CGameTemplate::GameVersion(TString VersionName)
|
||||
uint32 CGameTemplate::GameVersion(TString VersionName)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
CScriptTemplate* CGameTemplate::TemplateByID(u32 ObjectID)
|
||||
CScriptTemplate* CGameTemplate::TemplateByID(uint32 ObjectID)
|
||||
{
|
||||
auto it = mScriptTemplates.find(ObjectID);
|
||||
|
||||
@@ -140,13 +140,13 @@ CScriptTemplate* CGameTemplate::TemplateByID(const CFourCC& ObjectID)
|
||||
return TemplateByID(ObjectID.ToLong());
|
||||
}
|
||||
|
||||
CScriptTemplate* CGameTemplate::TemplateByIndex(u32 Index)
|
||||
CScriptTemplate* CGameTemplate::TemplateByIndex(uint32 Index)
|
||||
{
|
||||
auto it = mScriptTemplates.begin();
|
||||
return (std::next(it, Index))->second.pTemplate.get();
|
||||
}
|
||||
|
||||
SState CGameTemplate::StateByID(u32 StateID)
|
||||
SState CGameTemplate::StateByID(uint32 StateID)
|
||||
{
|
||||
auto Iter = mStates.find(StateID);
|
||||
|
||||
@@ -161,14 +161,14 @@ SState CGameTemplate::StateByID(const CFourCC& State)
|
||||
return StateByID(State.ToLong());
|
||||
}
|
||||
|
||||
SState CGameTemplate::StateByIndex(u32 Index)
|
||||
SState CGameTemplate::StateByIndex(uint32 Index)
|
||||
{
|
||||
auto Iter = mStates.begin();
|
||||
Iter = std::next(Iter, Index);
|
||||
return SState(Iter->first, Iter->second);
|
||||
}
|
||||
|
||||
SMessage CGameTemplate::MessageByID(u32 MessageID)
|
||||
SMessage CGameTemplate::MessageByID(uint32 MessageID)
|
||||
{
|
||||
auto Iter = mMessages.find(MessageID);
|
||||
|
||||
@@ -183,7 +183,7 @@ SMessage CGameTemplate::MessageByID(const CFourCC& MessageID)
|
||||
return MessageByID(MessageID.ToLong());
|
||||
}
|
||||
|
||||
SMessage CGameTemplate::MessageByIndex(u32 Index)
|
||||
SMessage CGameTemplate::MessageByIndex(uint32 Index)
|
||||
{
|
||||
auto Iter = mMessages.begin();
|
||||
Iter = std::next(Iter, Index);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "CLink.h"
|
||||
#include "CScriptTemplate.h"
|
||||
#include "Core/Resource/Script/Property/Properties.h"
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/EGame.h>
|
||||
#include <Common/types.h>
|
||||
#include <map>
|
||||
|
||||
/** Serialization aid
|
||||
@@ -15,15 +15,15 @@
|
||||
struct SObjId
|
||||
{
|
||||
union {
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
CFourCC ID_4CC;
|
||||
};
|
||||
|
||||
inline SObjId() {}
|
||||
inline SObjId(u32 InID) : ID(InID) {}
|
||||
inline SObjId(uint32 InID) : ID(InID) {}
|
||||
inline SObjId(CFourCC InID) : ID_4CC(InID) {}
|
||||
|
||||
inline operator u32() const { return ID; }
|
||||
inline operator uint32() const { return ID; }
|
||||
inline operator CFourCC() const { return ID_4CC; }
|
||||
|
||||
void Serialize(IArchive& Arc)
|
||||
@@ -117,27 +117,27 @@ public:
|
||||
void Save();
|
||||
void SaveGameTemplates(bool ForceAll = false);
|
||||
|
||||
u32 GameVersion(TString VersionName);
|
||||
CScriptTemplate* TemplateByID(u32 ObjectID);
|
||||
uint32 GameVersion(TString VersionName);
|
||||
CScriptTemplate* TemplateByID(uint32 ObjectID);
|
||||
CScriptTemplate* TemplateByID(const CFourCC& ObjectID);
|
||||
CScriptTemplate* TemplateByIndex(u32 Index);
|
||||
SState StateByID(u32 StateID);
|
||||
CScriptTemplate* TemplateByIndex(uint32 Index);
|
||||
SState StateByID(uint32 StateID);
|
||||
SState StateByID(const CFourCC& StateID);
|
||||
SState StateByIndex(u32 Index);
|
||||
SMessage MessageByID(u32 MessageID);
|
||||
SState StateByIndex(uint32 Index);
|
||||
SMessage MessageByID(uint32 MessageID);
|
||||
SMessage MessageByID(const CFourCC& MessageID);
|
||||
SMessage MessageByIndex(u32 Index);
|
||||
SMessage MessageByIndex(uint32 Index);
|
||||
IProperty* FindPropertyArchetype(const TString& kTypeName);
|
||||
TString GetPropertyArchetypeFilePath(const TString& kTypeName);
|
||||
bool RenamePropertyArchetype(const TString& kTypeName, const TString& kNewTypeName);
|
||||
TString GetGameDirectory() const;
|
||||
|
||||
// Inline Accessors
|
||||
inline EGame Game() const { return mGame; }
|
||||
inline u32 NumScriptTemplates() const { return mScriptTemplates.size(); }
|
||||
inline u32 NumStates() const { return mStates.size(); }
|
||||
inline u32 NumMessages() const { return mMessages.size(); }
|
||||
inline bool IsLoadedSuccessfully() { return mFullyLoaded; }
|
||||
inline EGame Game() const { return mGame; }
|
||||
inline uint32 NumScriptTemplates() const { return mScriptTemplates.size(); }
|
||||
inline uint32 NumStates() const { return mStates.size(); }
|
||||
inline uint32 NumMessages() const { return mMessages.size(); }
|
||||
inline bool IsLoadedSuccessfully() { return mFullyLoaded; }
|
||||
};
|
||||
|
||||
#endif // CGAMETEMPLATE_H
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "CScriptObject.h"
|
||||
#include "Core/Resource/Area/CGameArea.h"
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
|
||||
struct SState
|
||||
{
|
||||
union {
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
CFourCC ID_4CC;
|
||||
};
|
||||
TString Name;
|
||||
@@ -17,7 +17,7 @@ struct SState
|
||||
SState()
|
||||
{}
|
||||
|
||||
SState(u32 InID, const TString& kInName)
|
||||
SState(uint32 InID, const TString& kInName)
|
||||
: ID(InID)
|
||||
, Name(kInName)
|
||||
{}
|
||||
@@ -36,7 +36,7 @@ struct SState
|
||||
struct SMessage
|
||||
{
|
||||
union {
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
CFourCC ID_4CC;
|
||||
};
|
||||
TString Name;
|
||||
@@ -44,7 +44,7 @@ struct SMessage
|
||||
SMessage()
|
||||
{}
|
||||
|
||||
SMessage(u32 InID, const TString& kInName)
|
||||
SMessage(uint32 InID, const TString& kInName)
|
||||
: ID(InID)
|
||||
, Name(kInName)
|
||||
{}
|
||||
@@ -63,10 +63,10 @@ struct SMessage
|
||||
class CLink
|
||||
{
|
||||
CGameArea *mpArea;
|
||||
u32 mStateID;
|
||||
u32 mMessageID;
|
||||
u32 mSenderID;
|
||||
u32 mReceiverID;
|
||||
uint32 mStateID;
|
||||
uint32 mMessageID;
|
||||
uint32 mSenderID;
|
||||
uint32 mReceiverID;
|
||||
|
||||
public:
|
||||
CLink(CGameArea *pArea)
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
, mReceiverID(-1)
|
||||
{}
|
||||
|
||||
CLink(CGameArea *pArea, u32 StateID, u32 MessageID, u32 SenderID, u32 ReceiverID)
|
||||
CLink(CGameArea *pArea, uint32 StateID, uint32 MessageID, uint32 SenderID, uint32 ReceiverID)
|
||||
: mpArea(pArea)
|
||||
, mStateID(StateID)
|
||||
, mMessageID(MessageID)
|
||||
@@ -85,9 +85,9 @@ public:
|
||||
, mReceiverID(ReceiverID)
|
||||
{}
|
||||
|
||||
void SetSender(u32 NewSenderID, u32 Index = -1)
|
||||
void SetSender(uint32 NewSenderID, uint32 Index = -1)
|
||||
{
|
||||
u32 OldSenderID = mSenderID;
|
||||
uint32 OldSenderID = mSenderID;
|
||||
CScriptObject *pOldSender = mpArea->InstanceByID(OldSenderID);
|
||||
CScriptObject *pNewSender = mpArea->InstanceByID(NewSenderID);
|
||||
|
||||
@@ -96,9 +96,9 @@ public:
|
||||
pNewSender->AddLink(eOutgoing, this, Index);
|
||||
}
|
||||
|
||||
void SetReceiver(u32 NewReceiverID, u32 Index = -1)
|
||||
void SetReceiver(uint32 NewReceiverID, uint32 Index = -1)
|
||||
{
|
||||
u32 OldReceiverID = mSenderID;
|
||||
uint32 OldReceiverID = mSenderID;
|
||||
CScriptObject *pOldReceiver = mpArea->InstanceByID(OldReceiverID);
|
||||
CScriptObject *pNewReceiver = mpArea->InstanceByID(NewReceiverID);
|
||||
|
||||
@@ -107,13 +107,13 @@ public:
|
||||
pNewReceiver->AddLink(eIncoming, this, Index);
|
||||
}
|
||||
|
||||
u32 SenderIndex() const
|
||||
uint32 SenderIndex() const
|
||||
{
|
||||
CScriptObject *pSender = mpArea->InstanceByID(mSenderID);
|
||||
|
||||
if (pSender)
|
||||
{
|
||||
for (u32 iLink = 0; iLink < pSender->NumLinks(eOutgoing); iLink++)
|
||||
for (uint32 iLink = 0; iLink < pSender->NumLinks(eOutgoing); iLink++)
|
||||
{
|
||||
if (pSender->Link(eOutgoing, iLink) == this)
|
||||
return iLink;
|
||||
@@ -123,13 +123,13 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
u32 ReceiverIndex() const
|
||||
uint32 ReceiverIndex() const
|
||||
{
|
||||
CScriptObject *pReceiver = mpArea->InstanceByID(mReceiverID);
|
||||
|
||||
if (pReceiver)
|
||||
{
|
||||
for (u32 iLink = 0; iLink < pReceiver->NumLinks(eIncoming); iLink++)
|
||||
for (uint32 iLink = 0; iLink < pReceiver->NumLinks(eIncoming); iLink++)
|
||||
{
|
||||
if (pReceiver->Link(eIncoming, iLink) == this)
|
||||
return iLink;
|
||||
@@ -156,15 +156,15 @@ public:
|
||||
|
||||
// Accessors
|
||||
inline CGameArea* Area() const { return mpArea; }
|
||||
inline u32 State() const { return mStateID; }
|
||||
inline u32 Message() const { return mMessageID; }
|
||||
inline u32 SenderID() const { return mSenderID; }
|
||||
inline u32 ReceiverID() const { return mReceiverID; }
|
||||
inline uint32 State() const { return mStateID; }
|
||||
inline uint32 Message() const { return mMessageID; }
|
||||
inline uint32 SenderID() const { return mSenderID; }
|
||||
inline uint32 ReceiverID() const { return mReceiverID; }
|
||||
inline CScriptObject* Sender() const { return mpArea->InstanceByID(mSenderID); }
|
||||
inline CScriptObject* Receiver() const { return mpArea->InstanceByID(mReceiverID); }
|
||||
|
||||
inline void SetState(u32 StateID) { mStateID = StateID; }
|
||||
inline void SetMessage(u32 MessageID) { mMessageID = MessageID; }
|
||||
inline void SetState(uint32 StateID) { mStateID = StateID; }
|
||||
inline void SetMessage(uint32 MessageID) { mMessageID = MessageID; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "CScriptObject.h"
|
||||
#include "Core/Resource/CDependencyGroup.h"
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
}
|
||||
|
||||
// Data Manipulation
|
||||
void AddInstance(CScriptObject *pObject, u32 Index = -1)
|
||||
void AddInstance(CScriptObject *pObject, uint32 Index = -1)
|
||||
{
|
||||
if (Index != -1 && Index < mInstances.size())
|
||||
{
|
||||
@@ -55,12 +55,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveInstanceByIndex(u32 Index)
|
||||
void RemoveInstanceByIndex(uint32 Index)
|
||||
{
|
||||
mInstances.erase(mInstances.begin() + Index);
|
||||
}
|
||||
|
||||
void RemoveInstanceByID(u32 ID)
|
||||
void RemoveInstanceByID(uint32 ID)
|
||||
{
|
||||
for (auto it = mInstances.begin(); it != mInstances.end(); it++)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void Reserve(u32 Amount)
|
||||
void Reserve(uint32 Amount)
|
||||
{
|
||||
mInstances.reserve(Amount);
|
||||
}
|
||||
@@ -82,10 +82,10 @@ public:
|
||||
inline TString Name() const { return mLayerName; }
|
||||
inline bool IsActive() const { return mActive; }
|
||||
inline bool IsVisible() const { return mVisible; }
|
||||
inline u32 NumInstances() const { return mInstances.size(); }
|
||||
inline CScriptObject* InstanceByIndex(u32 Index) const { return mInstances[Index]; }
|
||||
inline uint32 NumInstances() const { return mInstances.size(); }
|
||||
inline CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; }
|
||||
|
||||
inline CScriptObject* InstanceByID(u32 ID) const
|
||||
inline CScriptObject* InstanceByID(uint32 ID) const
|
||||
{
|
||||
for (auto it = mInstances.begin(); it != mInstances.end(); it++)
|
||||
{
|
||||
@@ -100,9 +100,9 @@ public:
|
||||
inline void SetActive(bool Active) { mActive = Active; }
|
||||
inline void SetVisible(bool Visible) { mVisible = Visible; }
|
||||
|
||||
inline u32 AreaIndex() const
|
||||
inline uint32 AreaIndex() const
|
||||
{
|
||||
for (u32 iLyr = 0; iLyr < mpArea->NumScriptLayers(); iLyr++)
|
||||
for (uint32 iLyr = 0; iLyr < mpArea->NumScriptLayers(); iLyr++)
|
||||
{
|
||||
if (mpArea->ScriptLayer(iLyr) == this)
|
||||
return iLyr;
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
// Operators
|
||||
CScriptObject* operator[](u32 Index) { return InstanceByIndex(Index); }
|
||||
CScriptObject* operator[](uint32 Index) { return InstanceByIndex(Index); }
|
||||
};
|
||||
|
||||
#endif // CSCRIPTLAYER_H
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "CGameTemplate.h"
|
||||
#include "Core/Resource/Animation/CAnimSet.h"
|
||||
|
||||
CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate)
|
||||
CScriptObject::CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate)
|
||||
: mpTemplate(pTemplate)
|
||||
, mpArea(pArea)
|
||||
, mpLayer(pLayer)
|
||||
@@ -16,7 +16,7 @@ CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLa
|
||||
|
||||
// Init properties
|
||||
CStructProperty* pProperties = pTemplate->Properties();
|
||||
u32 PropertiesSize = pProperties->DataSize();
|
||||
uint32 PropertiesSize = pProperties->DataSize();
|
||||
|
||||
mPropertyData.resize( PropertiesSize );
|
||||
void* pData = mPropertyData.data();
|
||||
@@ -41,7 +41,7 @@ CScriptObject::~CScriptObject()
|
||||
mpTemplate->RemoveObject(this);
|
||||
|
||||
// Note: Incoming links will be deleted by the sender.
|
||||
for (u32 iLink = 0; iLink < mOutLinks.size(); iLink++)
|
||||
for (uint32 iLink = 0; iLink < mOutLinks.size(); iLink++)
|
||||
delete mOutLinks[iLink];
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ bool CScriptObject::IsEditorProperty(IProperty *pProp)
|
||||
);
|
||||
}
|
||||
|
||||
void CScriptObject::SetLayer(CScriptLayer *pLayer, u32 NewLayerIndex)
|
||||
void CScriptObject::SetLayer(CScriptLayer *pLayer, uint32 NewLayerIndex)
|
||||
{
|
||||
ASSERT(pLayer != nullptr);
|
||||
|
||||
@@ -109,11 +109,11 @@ void CScriptObject::SetLayer(CScriptLayer *pLayer, u32 NewLayerIndex)
|
||||
}
|
||||
}
|
||||
|
||||
u32 CScriptObject::LayerIndex() const
|
||||
uint32 CScriptObject::LayerIndex() const
|
||||
{
|
||||
if (!mpLayer) return -1;
|
||||
|
||||
for (u32 iInst = 0; iInst < mpLayer->NumInstances(); iInst++)
|
||||
for (uint32 iInst = 0; iInst < mpLayer->NumInstances(); iInst++)
|
||||
{
|
||||
if (mpLayer->InstanceByIndex(iInst) == this)
|
||||
return iInst;
|
||||
@@ -135,7 +135,7 @@ bool CScriptObject::HasNearVisibleActivation() const
|
||||
if (mIsCheckingNearVisibleActivation) return false;
|
||||
mIsCheckingNearVisibleActivation = true;
|
||||
|
||||
for (u32 iLink = 0; iLink < mInLinks.size(); iLink++)
|
||||
for (uint32 iLink = 0; iLink < mInLinks.size(); iLink++)
|
||||
{
|
||||
CLink *pLink = mInLinks[iLink];
|
||||
|
||||
@@ -183,7 +183,7 @@ bool CScriptObject::HasNearVisibleActivation() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void CScriptObject::AddLink(ELinkType Type, CLink *pLink, u32 Index /*= -1*/)
|
||||
void CScriptObject::AddLink(ELinkType Type, CLink *pLink, uint32 Index /*= -1*/)
|
||||
{
|
||||
std::vector<CLink*> *pLinkVec = (Type == eIncoming ? &mInLinks : &mOutLinks);
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ class CScriptObject
|
||||
CScriptTemplate *mpTemplate;
|
||||
CGameArea *mpArea;
|
||||
CScriptLayer *mpLayer;
|
||||
u32 mVersion;
|
||||
uint32 mVersion;
|
||||
|
||||
u32 mInstanceID;
|
||||
uint32 mInstanceID;
|
||||
std::vector<CLink*> mOutLinks;
|
||||
std::vector<CLink*> mInLinks;
|
||||
std::vector<char> mPropertyData;
|
||||
@@ -40,8 +40,8 @@ class CScriptObject
|
||||
|
||||
TResPtr<CResource> mpDisplayAsset;
|
||||
TResPtr<CCollisionMeshGroup> mpCollision;
|
||||
u32 mActiveCharIndex;
|
||||
u32 mActiveAnimIndex;
|
||||
uint32 mActiveCharIndex;
|
||||
uint32 mActiveAnimIndex;
|
||||
bool mHasInGameModel;
|
||||
|
||||
EVolumeShape mVolumeShape;
|
||||
@@ -51,7 +51,7 @@ class CScriptObject
|
||||
mutable bool mIsCheckingNearVisibleActivation;
|
||||
|
||||
public:
|
||||
CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate);
|
||||
CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate);
|
||||
~CScriptObject();
|
||||
|
||||
void CopyProperties(CScriptObject* pObject);
|
||||
@@ -60,11 +60,11 @@ public:
|
||||
void EvaluateCollisionModel();
|
||||
void EvaluateVolume();
|
||||
bool IsEditorProperty(IProperty *pProp);
|
||||
void SetLayer(CScriptLayer *pLayer, u32 NewLayerIndex = -1);
|
||||
u32 LayerIndex() const;
|
||||
void SetLayer(CScriptLayer *pLayer, uint32 NewLayerIndex = -1);
|
||||
uint32 LayerIndex() const;
|
||||
bool HasNearVisibleActivation() const;
|
||||
|
||||
void AddLink(ELinkType Type, CLink *pLink, u32 Index = -1);
|
||||
void AddLink(ELinkType Type, CLink *pLink, uint32 Index = -1);
|
||||
void RemoveLink(ELinkType Type, CLink *pLink);
|
||||
void BreakAllLinks();
|
||||
|
||||
@@ -73,11 +73,11 @@ public:
|
||||
CGameTemplate* GameTemplate() const { return mpTemplate->GameTemplate(); }
|
||||
CGameArea* Area() const { return mpArea; }
|
||||
CScriptLayer* Layer() const { return mpLayer; }
|
||||
u32 Version() const { return mVersion; }
|
||||
u32 ObjectTypeID() const { return mpTemplate->ObjectID(); }
|
||||
u32 InstanceID() const { return mInstanceID; }
|
||||
u32 NumLinks(ELinkType Type) const { return (Type == eIncoming ? mInLinks.size() : mOutLinks.size()); }
|
||||
CLink* Link(ELinkType Type, u32 Index) const { return (Type == eIncoming ? mInLinks[Index] : mOutLinks[Index]); }
|
||||
uint32 Version() const { return mVersion; }
|
||||
uint32 ObjectTypeID() const { return mpTemplate->ObjectID(); }
|
||||
uint32 InstanceID() const { return mInstanceID; }
|
||||
uint32 NumLinks(ELinkType Type) const { return (Type == eIncoming ? mInLinks.size() : mOutLinks.size()); }
|
||||
CLink* Link(ELinkType Type, uint32 Index) const { return (Type == eIncoming ? mInLinks[Index] : mOutLinks[Index]); }
|
||||
void* PropertyData() const { return (void*) mPropertyData.data(); }
|
||||
|
||||
CVector3f Position() const { return mPosition.IsValid() ? mPosition.Get() : CVector3f::skZero; }
|
||||
@@ -88,8 +88,8 @@ public:
|
||||
bool HasInGameModel() const { return mHasInGameModel; }
|
||||
CStructRef LightParameters() const { return mLightParameters; }
|
||||
CResource* DisplayAsset() const { return mpDisplayAsset; }
|
||||
u32 ActiveCharIndex() const { return mActiveCharIndex; }
|
||||
u32 ActiveAnimIndex() const { return mActiveAnimIndex; }
|
||||
uint32 ActiveCharIndex() const { return mActiveCharIndex; }
|
||||
uint32 ActiveAnimIndex() const { return mActiveAnimIndex; }
|
||||
CCollisionMeshGroup* Collision() const { return mpCollision; }
|
||||
EVolumeShape VolumeShape() const { return mVolumeShape; }
|
||||
float VolumeScale() const { return mVolumeScale; }
|
||||
|
||||
@@ -27,7 +27,7 @@ CScriptTemplate::CScriptTemplate(CGameTemplate *pGame)
|
||||
}
|
||||
|
||||
// New constructor
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, u32 InObjectID, const TString& kInFilePath)
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, const TString& kInFilePath)
|
||||
: mRotationType(eRotationEnabled)
|
||||
, mScaleType(eScaleEnabled)
|
||||
, mPreviewScale(1.f)
|
||||
@@ -98,7 +98,7 @@ void CScriptTemplate::Save(bool Force)
|
||||
{
|
||||
if (IsDirty() || Force)
|
||||
{
|
||||
Log::Write("Saving script template: " + mSourceFile);
|
||||
debugf("Saving script template: %s", *mSourceFile);
|
||||
CXMLWriter Writer(mSourceFile, "ScriptObject", 0, mpGame->Game());
|
||||
ASSERT(Writer.IsValid());
|
||||
Serialize(Writer);
|
||||
@@ -128,13 +128,13 @@ EVolumeShape CScriptTemplate::VolumeShape(CScriptObject *pObj)
|
||||
{
|
||||
if (pObj->Template() != this)
|
||||
{
|
||||
Log::Error(pObj->Template()->Name() + " instance somehow called VolumeShape() on " + Name() + " template");
|
||||
errorf("%s instance somehow called VolumeShape() on %s template", *pObj->Template()->Name(), *Name());
|
||||
return eInvalidShape;
|
||||
}
|
||||
|
||||
if (mVolumeShape == eConditionalShape)
|
||||
{
|
||||
s32 Index = CheckVolumeConditions(pObj, true);
|
||||
int32 Index = CheckVolumeConditions(pObj, true);
|
||||
if (Index == -1) return eInvalidShape;
|
||||
else return mVolumeConditions[Index].Shape;
|
||||
}
|
||||
@@ -145,20 +145,20 @@ float CScriptTemplate::VolumeScale(CScriptObject *pObj)
|
||||
{
|
||||
if (pObj->Template() != this)
|
||||
{
|
||||
Log::Error(pObj->Template()->Name() + " instance somehow called VolumeScale() on " + Name() + " template");
|
||||
errorf("%s instance somehow called VolumeScale() on %s template", *pObj->Template()->Name(), *Name());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mVolumeShape == eConditionalShape)
|
||||
{
|
||||
s32 Index = CheckVolumeConditions(pObj, false);
|
||||
int32 Index = CheckVolumeConditions(pObj, false);
|
||||
if (Index == -1) return mVolumeScale;
|
||||
else return mVolumeConditions[Index].Scale;
|
||||
}
|
||||
else return mVolumeScale;
|
||||
}
|
||||
|
||||
s32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
|
||||
int32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
|
||||
{
|
||||
// Private function
|
||||
if (mVolumeShape == eConditionalShape)
|
||||
@@ -195,20 +195,20 @@ s32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
|
||||
}
|
||||
|
||||
// Test and check whether any of the conditions are true
|
||||
for (u32 LinkIdx = 0; LinkIdx < mVolumeConditions.size(); LinkIdx++)
|
||||
for (uint32 LinkIdx = 0; LinkIdx < mVolumeConditions.size(); LinkIdx++)
|
||||
{
|
||||
if (mVolumeConditions[LinkIdx].Value == Val)
|
||||
return LinkIdx;
|
||||
}
|
||||
|
||||
if (LogErrors)
|
||||
Log::Error(pObj->Template()->Name() + " instance " + TString::HexString(pObj->InstanceID()) + " has unexpected volume shape value of " + TString::HexString((u32) Val, 0));
|
||||
errorf("%s instance %08X has unexpected volume shape value of 0x%X", *pObj->Template()->Name(), pObj->InstanceID(), Val);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, u32& rOutCharIndex, u32& rOutAnimIndex, bool& rOutIsInGame)
|
||||
CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, uint32& rOutCharIndex, uint32& rOutAnimIndex, bool& rOutIsInGame)
|
||||
{
|
||||
rOutCharIndex = -1;
|
||||
rOutAnimIndex = -1;
|
||||
@@ -236,8 +236,8 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, u32& rOutCharI
|
||||
|
||||
if (pRes)
|
||||
{
|
||||
u32 MaxNumChars = static_cast<CAnimSet*>(pRes)->NumCharacters();
|
||||
rOutCharIndex = (it->ForceNodeIndex >= 0 && it->ForceNodeIndex < (s32) MaxNumChars ? it->ForceNodeIndex : Params.CharacterIndex());
|
||||
uint32 MaxNumChars = static_cast<CAnimSet*>(pRes)->NumCharacters();
|
||||
rOutCharIndex = (it->ForceNodeIndex >= 0 && it->ForceNodeIndex < (int32) MaxNumChars ? it->ForceNodeIndex : Params.CharacterIndex());
|
||||
rOutAnimIndex = Params.AnimIndex();
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(void* pPropertyData)
|
||||
|
||||
|
||||
// ************ OBJECT TRACKING ************
|
||||
u32 CScriptTemplate::NumObjects() const
|
||||
uint32 CScriptTemplate::NumObjects() const
|
||||
{
|
||||
return mObjectList.size();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "EVolumeShape.h"
|
||||
#include "Core/Resource/Model/CModel.h"
|
||||
#include "Core/Resource/CCollisionMeshGroup.h"
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/types.h>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
@@ -64,14 +64,14 @@ private:
|
||||
} AssetSource;
|
||||
|
||||
TIDString AssetLocation;
|
||||
s32 ForceNodeIndex; // Force animsets to use specific node instead of one from property
|
||||
int32 ForceNodeIndex; // Force animsets to use specific node instead of one from property
|
||||
|
||||
void Serialize(IArchive& Arc)
|
||||
{
|
||||
Arc << SerialParameter("Type", AssetType, SH_Attribute)
|
||||
<< SerialParameter("Source", AssetSource, SH_Attribute)
|
||||
<< SerialParameter("Location", AssetLocation, SH_Attribute)
|
||||
<< SerialParameter("ForceCharacterIndex", ForceNodeIndex, SH_Attribute | SH_Optional, (s32) -1);
|
||||
<< SerialParameter("ForceCharacterIndex", ForceNodeIndex, SH_Attribute | SH_Optional, (int32) -1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
TIDString mVolumeConditionIDString;
|
||||
|
||||
TString mSourceFile;
|
||||
u32 mObjectID;
|
||||
uint32 mObjectID;
|
||||
|
||||
// Editor Properties
|
||||
TIDString mNameIDString;
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
CStructProperty* mpLightParametersProperty;
|
||||
|
||||
struct SVolumeCondition {
|
||||
u32 Value;
|
||||
uint32 Value;
|
||||
EVolumeShape Shape;
|
||||
float Scale;
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
// Old constructor
|
||||
CScriptTemplate(CGameTemplate *pGame);
|
||||
// New constructor
|
||||
CScriptTemplate(CGameTemplate* pGame, u32 ObjectID, const TString& kFilePath);
|
||||
CScriptTemplate(CGameTemplate* pGame, uint32 ObjectID, const TString& kFilePath);
|
||||
~CScriptTemplate();
|
||||
void Serialize(IArchive& rArc);
|
||||
void Save(bool Force = false);
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
// Property Fetching
|
||||
EVolumeShape VolumeShape(CScriptObject *pObj);
|
||||
float VolumeScale(CScriptObject *pObj);
|
||||
CResource* FindDisplayAsset(void* pPropertyData, u32& rOutCharIndex, u32& rOutAnimIndex, bool& rOutIsInGame);
|
||||
CResource* FindDisplayAsset(void* pPropertyData, uint32& rOutCharIndex, uint32& rOutAnimIndex, bool& rOutIsInGame);
|
||||
CCollisionMeshGroup* FindCollision(void* pPropertyData);
|
||||
|
||||
// Accessors
|
||||
@@ -150,12 +150,12 @@ public:
|
||||
inline ERotationType RotationType() const { return mRotationType; }
|
||||
inline EScaleType ScaleType() const { return mScaleType; }
|
||||
inline float PreviewScale() const { return mPreviewScale; }
|
||||
inline u32 ObjectID() const { return mObjectID; }
|
||||
inline uint32 ObjectID() const { return mObjectID; }
|
||||
inline bool IsVisible() const { return mVisible; }
|
||||
inline TString SourceFile() const { return mSourceFile; }
|
||||
inline CStructProperty* Properties() const { return mpProperties.get(); }
|
||||
inline u32 NumAttachments() const { return mAttachments.size(); }
|
||||
const SAttachment& Attachment(u32 Index) const { return mAttachments[Index]; }
|
||||
inline uint32 NumAttachments() const { return mAttachments.size(); }
|
||||
const SAttachment& Attachment(uint32 Index) const { return mAttachments[Index]; }
|
||||
const std::vector<TString>& RequiredModules() const { return mModules; }
|
||||
|
||||
inline CStringProperty* NameProperty() const { return mpNameProperty; }
|
||||
@@ -170,14 +170,14 @@ public:
|
||||
inline bool IsDirty() const { return mDirty || mpProperties->IsDirty(); }
|
||||
|
||||
// Object Tracking
|
||||
u32 NumObjects() const;
|
||||
uint32 NumObjects() const;
|
||||
const std::list<CScriptObject*>& ObjectList() const;
|
||||
void AddObject(CScriptObject *pObject);
|
||||
void RemoveObject(CScriptObject *pObject);
|
||||
void SortObjects();
|
||||
|
||||
private:
|
||||
s32 CheckVolumeConditions(CScriptObject *pObj, bool LogErrors);
|
||||
int32 CheckVolumeConditions(CScriptObject *pObj, bool LogErrors);
|
||||
};
|
||||
|
||||
#endif // CSCRIPTTEMPLATE_H
|
||||
|
||||
@@ -50,11 +50,11 @@ bool IsGameTemplateLoaded(EGame Game)
|
||||
inline void SerializeGameList(IArchive& Arc)
|
||||
{
|
||||
// Serialize the number of games with valid GameInfos.
|
||||
u32 NumGames = 0;
|
||||
uint32 NumGames = 0;
|
||||
|
||||
if (Arc.IsWriter())
|
||||
{
|
||||
for (u32 GameIdx = 0; GameIdx < (u32) EGame::Max; GameIdx++)
|
||||
for (uint32 GameIdx = 0; GameIdx < (uint32) EGame::Max; GameIdx++)
|
||||
{
|
||||
if ( gGameList[GameIdx].IsValid )
|
||||
NumGames++;
|
||||
@@ -64,7 +64,7 @@ inline void SerializeGameList(IArchive& Arc)
|
||||
Arc.SerializeArraySize(NumGames);
|
||||
|
||||
// Serialize the actual game info
|
||||
for (u32 GameIdx = 0; GameIdx < (u32) EGame::Max; GameIdx++)
|
||||
for (uint32 GameIdx = 0; GameIdx < (uint32) EGame::Max; GameIdx++)
|
||||
{
|
||||
// Skip games that don't have game templates when writing.
|
||||
if (Arc.IsWriter() && !gGameList[GameIdx].IsValid)
|
||||
@@ -77,7 +77,7 @@ inline void SerializeGameList(IArchive& Arc)
|
||||
Arc << SerialParameter("ID", Game, SH_Attribute);
|
||||
ASSERT( Game != EGame::Invalid );
|
||||
|
||||
gGameList[ (u32) Game ].Serialize(Arc);
|
||||
gGameList[ (uint32) Game ].Serialize(Arc);
|
||||
Arc.ParamEnd();
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ inline void SerializeGameList(IArchive& Arc)
|
||||
void LoadGameList()
|
||||
{
|
||||
ASSERT(!gLoadedGameList);
|
||||
Log::Write("Loading game list");
|
||||
debugf("Loading game list");
|
||||
|
||||
CXMLReader Reader(gkGameListPath);
|
||||
ASSERT(Reader.IsValid());
|
||||
@@ -99,7 +99,7 @@ void LoadGameList()
|
||||
void SaveGameList()
|
||||
{
|
||||
ASSERT(gLoadedGameList);
|
||||
Log::Write("Saving game list");
|
||||
debugf("Saving game list");
|
||||
|
||||
CXMLWriter Writer(gkGameListPath, "GameList");
|
||||
ASSERT(Writer.IsValid());
|
||||
|
||||
@@ -24,14 +24,14 @@ bool gMapIsDirty = false;
|
||||
bool gMapIsLoaded = false;
|
||||
|
||||
/** Mapping of typename hashes back to the original string */
|
||||
std::unordered_map<u32, TString> gHashToTypeName;
|
||||
std::unordered_map<uint32, TString> gHashToTypeName;
|
||||
|
||||
/** Register a hash -> name mapping */
|
||||
inline void RegisterTypeName(u32 TypeHash, TString TypeName)
|
||||
inline void RegisterTypeName(uint32 TypeHash, TString TypeName)
|
||||
{
|
||||
ASSERT( !TypeName.IsEmpty() );
|
||||
ASSERT( TypeName != "Unknown" );
|
||||
gHashToTypeName.emplace( std::make_pair<u32, TString>(std::move(TypeHash), std::move(TypeName)) );
|
||||
gHashToTypeName.emplace( std::make_pair<uint32, TString>(std::move(TypeHash), std::move(TypeName)) );
|
||||
}
|
||||
|
||||
/** Key structure for name map lookups */
|
||||
@@ -40,11 +40,11 @@ struct SNameKey
|
||||
union
|
||||
{
|
||||
struct {
|
||||
u32 TypeHash;
|
||||
u32 ID;
|
||||
uint32 TypeHash;
|
||||
uint32 ID;
|
||||
};
|
||||
struct {
|
||||
u64 Key;
|
||||
uint64 Key;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ struct SNameKey
|
||||
: TypeHash(-1), ID(-1)
|
||||
{}
|
||||
|
||||
SNameKey(u32 InTypeHash, u32 InID)
|
||||
SNameKey(uint32 InTypeHash, uint32 InID)
|
||||
: TypeHash(InTypeHash), ID(InID)
|
||||
{}
|
||||
|
||||
@@ -92,7 +92,7 @@ struct KeyHash
|
||||
{
|
||||
inline size_t operator()(const SNameKey& kKey) const
|
||||
{
|
||||
return std::hash<u64>()(kKey.Key);
|
||||
return std::hash<uint64>()(kKey.Key);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -125,7 +125,7 @@ struct SNameValue
|
||||
std::map<SNameKey, SNameValue> gNameMap;
|
||||
|
||||
/** Legacy map that only includes the ID in the key */
|
||||
std::map<u32, TString> gLegacyNameMap;
|
||||
std::map<uint32, TString> gLegacyNameMap;
|
||||
|
||||
/** Internal: Creates a name key for the given property. */
|
||||
SNameKey CreateKey(IProperty* pProperty)
|
||||
@@ -136,7 +136,7 @@ SNameKey CreateKey(IProperty* pProperty)
|
||||
return Key;
|
||||
}
|
||||
|
||||
SNameKey CreateKey(u32 ID, const char* pkTypeName)
|
||||
SNameKey CreateKey(uint32 ID, const char* pkTypeName)
|
||||
{
|
||||
return SNameKey( CCRC32::StaticHashString(pkTypeName), ID );
|
||||
}
|
||||
@@ -145,7 +145,7 @@ SNameKey CreateKey(u32 ID, const char* pkTypeName)
|
||||
void LoadMap()
|
||||
{
|
||||
ASSERT( !gMapIsLoaded );
|
||||
Log::Write("Loading property map");
|
||||
debugf("Loading property map");
|
||||
|
||||
if ( gkUseLegacyMapForNameLookups )
|
||||
{
|
||||
@@ -191,7 +191,7 @@ void SaveMap(bool Force /*= false*/)
|
||||
else return;
|
||||
}
|
||||
|
||||
Log::Write("Saving property map");
|
||||
debugf("Saving property map");
|
||||
|
||||
if( gMapIsDirty || Force )
|
||||
{
|
||||
@@ -247,7 +247,7 @@ const char* GetPropertyName(IProperty* pInProperty)
|
||||
/** Given a property name and type, returns the name of the property.
|
||||
* This requires you to provide the exact type string used in the hash.
|
||||
*/
|
||||
const char* GetPropertyName(u32 ID, const char* pkTypeName)
|
||||
const char* GetPropertyName(uint32 ID, const char* pkTypeName)
|
||||
{
|
||||
// Does not support legacy map
|
||||
ConditionalLoadMap();
|
||||
@@ -258,7 +258,7 @@ const char* GetPropertyName(u32 ID, const char* pkTypeName)
|
||||
}
|
||||
|
||||
/** Calculate the property ID of a given name/type. */
|
||||
u32 CalculatePropertyID(const char* pkName, const char* pkTypeName)
|
||||
uint32 CalculatePropertyID(const char* pkName, const char* pkTypeName)
|
||||
{
|
||||
CCRC32 CRC;
|
||||
CRC.Hash(pkName);
|
||||
@@ -267,7 +267,7 @@ u32 CalculatePropertyID(const char* pkName, const char* pkTypeName)
|
||||
}
|
||||
|
||||
/** Returns whether the specified ID is in the map. */
|
||||
bool IsValidPropertyID(u32 ID, const char* pkTypeName, bool* pOutIsValid /*= nullptr*/)
|
||||
bool IsValidPropertyID(uint32 ID, const char* pkTypeName, bool* pOutIsValid /*= nullptr*/)
|
||||
{
|
||||
SNameKey Key = CreateKey(ID, pkTypeName);
|
||||
auto MapFind = gNameMap.find(Key);
|
||||
@@ -285,7 +285,7 @@ bool IsValidPropertyID(u32 ID, const char* pkTypeName, bool* pOutIsValid /*= nul
|
||||
}
|
||||
|
||||
/** Retrieves a list of all properties that match the requested property ID. */
|
||||
void RetrievePropertiesWithID(u32 ID, const char* pkTypeName, std::list<IProperty*>& OutList)
|
||||
void RetrievePropertiesWithID(uint32 ID, const char* pkTypeName, std::list<IProperty*>& OutList)
|
||||
{
|
||||
SNameKey Key = CreateKey(ID, pkTypeName);
|
||||
auto MapFind = gNameMap.find(Key);
|
||||
@@ -298,7 +298,7 @@ void RetrievePropertiesWithID(u32 ID, const char* pkTypeName, std::list<IPropert
|
||||
}
|
||||
|
||||
/** Retrieves a list of all XML templates that contain a given property ID. */
|
||||
void RetrieveXMLsWithProperty(u32 ID, const char* pkTypeName, std::set<TString>& OutSet)
|
||||
void RetrieveXMLsWithProperty(uint32 ID, const char* pkTypeName, std::set<TString>& OutSet)
|
||||
{
|
||||
SNameKey Key = CreateKey(ID, pkTypeName);
|
||||
auto MapFind = gNameMap.find(Key);
|
||||
@@ -316,7 +316,7 @@ void RetrieveXMLsWithProperty(u32 ID, const char* pkTypeName, std::set<TString>&
|
||||
}
|
||||
|
||||
/** Updates the name of a given property in the map */
|
||||
void SetPropertyName(u32 ID, const char* pkTypeName, const char* pkNewName)
|
||||
void SetPropertyName(uint32 ID, const char* pkTypeName, const char* pkNewName)
|
||||
{
|
||||
if( gkUseLegacyMapForUpdates )
|
||||
{
|
||||
@@ -362,8 +362,8 @@ void SetPropertyName(u32 ID, const char* pkTypeName, const char* pkNewName)
|
||||
/** Change a type name of a property. */
|
||||
void ChangeTypeName(IProperty* pProperty, const char* pkOldTypeName, const char* pkNewTypeName)
|
||||
{
|
||||
u32 OldTypeHash = CCRC32::StaticHashString(pkOldTypeName);
|
||||
u32 NewTypeHash = CCRC32::StaticHashString(pkNewTypeName);
|
||||
uint32 OldTypeHash = CCRC32::StaticHashString(pkOldTypeName);
|
||||
uint32 NewTypeHash = CCRC32::StaticHashString(pkNewTypeName);
|
||||
|
||||
if (OldTypeHash == NewTypeHash)
|
||||
{
|
||||
@@ -422,8 +422,8 @@ void ChangeTypeName(IProperty* pProperty, const char* pkOldTypeName, const char*
|
||||
/** Change a type name. */
|
||||
void ChangeTypeNameGlobally(const char* pkOldTypeName, const char* pkNewTypeName)
|
||||
{
|
||||
u32 OldTypeHash = CCRC32::StaticHashString(pkOldTypeName);
|
||||
u32 NewTypeHash = CCRC32::StaticHashString(pkNewTypeName);
|
||||
uint32 OldTypeHash = CCRC32::StaticHashString(pkOldTypeName);
|
||||
uint32 NewTypeHash = CCRC32::StaticHashString(pkNewTypeName);
|
||||
|
||||
if (OldTypeHash == NewTypeHash)
|
||||
{
|
||||
@@ -494,6 +494,35 @@ void RegisterProperty(IProperty* pProperty)
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we didn't find the property name, check for int<->choice conversions
|
||||
if (MapFind == gNameMap.end())
|
||||
{
|
||||
if (pProperty->Type() == EPropertyType::Int)
|
||||
{
|
||||
uint32 ChoiceHash = CCRC32::StaticHashString("choice");
|
||||
SNameKey ChoiceKey(ChoiceHash, pProperty->ID());
|
||||
MapFind = gNameMap.find(ChoiceKey);
|
||||
}
|
||||
else if (pProperty->Type() == EPropertyType::Choice)
|
||||
{
|
||||
uint32 IntHash = CCRC32::StaticHashString("int");
|
||||
SNameKey IntKey(IntHash, pProperty->ID());
|
||||
MapFind = gNameMap.find(IntKey);
|
||||
}
|
||||
}
|
||||
|
||||
// If we still didn't find it, register the property name in the map
|
||||
if (MapFind == gNameMap.end())
|
||||
{
|
||||
SNameValue Value;
|
||||
Value.Name = "Unknown";
|
||||
Value.IsValid = false;
|
||||
gNameMap[Key] = Value;
|
||||
MapFind = gNameMap.find(Key);
|
||||
RegisterTypeName(Key.TypeHash, pProperty->HashableTypeName());
|
||||
}
|
||||
|
||||
// We should have a valid iterator at this point no matter what.
|
||||
ASSERT(MapFind != gNameMap.end());
|
||||
pProperty->SetName( MapFind->second.Name );
|
||||
}
|
||||
@@ -536,7 +565,7 @@ CIterator::~CIterator()
|
||||
delete mpImpl;
|
||||
}
|
||||
|
||||
u32 CIterator::ID() const
|
||||
uint32 CIterator::ID() const
|
||||
{
|
||||
return mpImpl->mIter->first.ID;
|
||||
}
|
||||
@@ -548,7 +577,7 @@ const char* CIterator::Name() const
|
||||
|
||||
const char* CIterator::TypeName() const
|
||||
{
|
||||
u32 TypeHash = mpImpl->mIter->first.TypeHash;
|
||||
uint32 TypeHash = mpImpl->mIter->first.TypeHash;
|
||||
auto Find = gHashToTypeName.find(TypeHash);
|
||||
ASSERT(Find != gHashToTypeName.end());
|
||||
return *Find->second;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef NPROPERTYMAP_H
|
||||
#define NPROPERTYMAP_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include "Core/Resource/Script/Property/IProperty.h"
|
||||
|
||||
/** NPropertyMap: Namespace for property ID -> name mappings */
|
||||
@@ -20,25 +20,25 @@ const char* GetPropertyName(IProperty* pProperty);
|
||||
/** Given a property name and type, returns the name of the property.
|
||||
* This requires you to provide the exact type string used in the hash.
|
||||
*/
|
||||
const char* GetPropertyName(u32 ID, const char* pkTypeName);
|
||||
const char* GetPropertyName(uint32 ID, const char* pkTypeName);
|
||||
|
||||
/** Calculate the property ID of a given name/type. */
|
||||
u32 CalculatePropertyID(const char* pkName, const char* pkTypeName);
|
||||
uint32 CalculatePropertyID(const char* pkName, const char* pkTypeName);
|
||||
|
||||
/**
|
||||
* Returns whether the specified name is in the map.
|
||||
* If the ID is valid and pOutIsValid is non-null, it will return whether the current name is correct.
|
||||
*/
|
||||
bool IsValidPropertyID(u32 ID, const char* pkTypeName, bool* pOutIsValid = nullptr);
|
||||
bool IsValidPropertyID(uint32 ID, const char* pkTypeName, bool* pOutIsValid = nullptr);
|
||||
|
||||
/** Retrieves a list of all properties that match the requested property ID. */
|
||||
void RetrievePropertiesWithID(u32 ID, const char* pkTypeName, std::list<IProperty*>& OutList);
|
||||
void RetrievePropertiesWithID(uint32 ID, const char* pkTypeName, std::list<IProperty*>& OutList);
|
||||
|
||||
/** Retrieves a list of all XML templates that contain a given property ID. */
|
||||
void RetrieveXMLsWithProperty(u32 ID, const char* pkTypeName, std::set<TString>& OutSet);
|
||||
void RetrieveXMLsWithProperty(uint32 ID, const char* pkTypeName, std::set<TString>& OutSet);
|
||||
|
||||
/** Updates the name of a given property in the map */
|
||||
void SetPropertyName(u32 ID, const char* pkTypeName, const char* pkNewName);
|
||||
void SetPropertyName(uint32 ID, const char* pkTypeName, const char* pkNewName);
|
||||
|
||||
/** Change a type name of a property. */
|
||||
void ChangeTypeName(IProperty* pProperty, const char* pkOldTypeName, const char* pkNewTypeName);
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
CIterator();
|
||||
~CIterator();
|
||||
|
||||
u32 ID() const;
|
||||
uint32 ID() const;
|
||||
const char* Name() const;
|
||||
const char* TypeName() const;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CAnimationProperty : public TSerializeableTypedProperty< u32, EPropertyType::Animation >
|
||||
class CAnimationProperty : public TSerializeableTypedProperty< uint32, EPropertyType::Animation >
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
@@ -15,12 +15,12 @@ protected:
|
||||
public:
|
||||
virtual void SerializeValue(void* pData, IArchive& rArc) const
|
||||
{
|
||||
rArc.SerializePrimitive( (u32&) ValueRef(pData), SH_HexDisplay );
|
||||
rArc.SerializePrimitive( (uint32&) ValueRef(pData), SH_HexDisplay );
|
||||
}
|
||||
|
||||
virtual TString ValueAsString(void* pData) const
|
||||
{
|
||||
return TString::HexString( (u32) Value(pData) );
|
||||
return TString::HexString( (uint32) Value(pData) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct SScriptArray
|
||||
|
||||
/** You probably shouldn't use this on intrinsic classes; script only */
|
||||
/** @todo proper support of default values for arrays (this would be used for prefabs) */
|
||||
class CArrayProperty : public TTypedProperty<u32, EPropertyType::Array>
|
||||
class CArrayProperty : public TTypedProperty<uint32, EPropertyType::Array>
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
@@ -37,7 +37,7 @@ class CArrayProperty : public TTypedProperty<u32, EPropertyType::Array>
|
||||
return *( (SScriptArray*) RawValuePtr(pData) );
|
||||
}
|
||||
|
||||
u32 _InternalArrayCount(void* pPropertyData) const
|
||||
uint32 _InternalArrayCount(void* pPropertyData) const
|
||||
{
|
||||
std::vector<char>& rArray = _GetInternalArray(pPropertyData).Array;
|
||||
return rArray.size() / ItemSize();
|
||||
@@ -50,12 +50,12 @@ protected:
|
||||
{}
|
||||
|
||||
public:
|
||||
virtual u32 DataSize() const
|
||||
virtual uint32 DataSize() const
|
||||
{
|
||||
return sizeof(SScriptArray);
|
||||
}
|
||||
|
||||
virtual u32 DataAlignment() const
|
||||
virtual uint32 DataAlignment() const
|
||||
{
|
||||
return alignof(SScriptArray);
|
||||
}
|
||||
@@ -112,13 +112,13 @@ public:
|
||||
|
||||
virtual void SerializeValue(void* pData, IArchive& Arc) const
|
||||
{
|
||||
u32 Count = ArrayCount(pData);
|
||||
uint32 Count = ArrayCount(pData);
|
||||
Arc.SerializeArraySize(Count);
|
||||
|
||||
if (Arc.IsReader())
|
||||
Resize(pData, Count);
|
||||
|
||||
for (u32 ItemIdx = 0; ItemIdx < Count; ItemIdx++)
|
||||
for (uint32 ItemIdx = 0; ItemIdx < Count; ItemIdx++)
|
||||
{
|
||||
if (Arc.ParamBegin("ArrayElement", 0))
|
||||
{
|
||||
@@ -142,14 +142,14 @@ public:
|
||||
mpItemArchetype->Initialize(this, mpScriptTemplate, 0);
|
||||
}
|
||||
|
||||
u32 ArrayCount(void* pPropertyData) const
|
||||
uint32 ArrayCount(void* pPropertyData) const
|
||||
{
|
||||
return ValueRef(pPropertyData);
|
||||
}
|
||||
|
||||
void Resize(void* pPropertyData, u32 NewCount) const
|
||||
void Resize(void* pPropertyData, uint32 NewCount) const
|
||||
{
|
||||
u32 OldCount = _InternalArrayCount(pPropertyData);
|
||||
uint32 OldCount = _InternalArrayCount(pPropertyData);
|
||||
|
||||
if (OldCount != NewCount)
|
||||
{
|
||||
@@ -158,21 +158,21 @@ public:
|
||||
// Handle destruction of old elements
|
||||
if (OldCount > NewCount)
|
||||
{
|
||||
for (u32 ItemIdx = NewCount; ItemIdx < OldCount; ItemIdx++)
|
||||
for (uint32 ItemIdx = NewCount; ItemIdx < OldCount; ItemIdx++)
|
||||
{
|
||||
void* pItemPtr = ItemPointer(pPropertyData, ItemIdx);
|
||||
mpItemArchetype->Destruct(pItemPtr);
|
||||
}
|
||||
}
|
||||
|
||||
u32 NewSize = NewCount * ItemSize();
|
||||
uint32 NewSize = NewCount * ItemSize();
|
||||
rArray.Array.resize(NewSize);
|
||||
rArray.Count = NewCount;
|
||||
|
||||
// Handle construction of new elements
|
||||
if (NewCount > OldCount)
|
||||
{
|
||||
for (u32 ItemIdx = OldCount; ItemIdx < NewCount; ItemIdx++)
|
||||
for (uint32 ItemIdx = OldCount; ItemIdx < NewCount; ItemIdx++)
|
||||
{
|
||||
void* pItemPtr = ItemPointer(pPropertyData, ItemIdx);
|
||||
mpItemArchetype->Construct(pItemPtr);
|
||||
@@ -181,19 +181,19 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void* ItemPointer(void* pPropertyData, u32 ItemIndex) const
|
||||
void* ItemPointer(void* pPropertyData, uint32 ItemIndex) const
|
||||
{
|
||||
ASSERT(_InternalArrayCount(pPropertyData) > ItemIndex);
|
||||
std::vector<char>& rArray = _GetInternalArray(pPropertyData).Array;
|
||||
u32 MyItemSize = ItemSize();
|
||||
uint32 MyItemSize = ItemSize();
|
||||
ASSERT(rArray.size() >= (MyItemSize * (ItemIndex+1)));
|
||||
return rArray.data() + (MyItemSize * ItemIndex);
|
||||
}
|
||||
|
||||
u32 ItemSize() const
|
||||
uint32 ItemSize() const
|
||||
{
|
||||
u32 ItemAlign = mpItemArchetype->DataAlignment();
|
||||
u32 ItemSize = ALIGN(mpItemArchetype->DataSize(), ItemAlign);
|
||||
uint32 ItemAlign = mpItemArchetype->DataAlignment();
|
||||
uint32 ItemSize = ALIGN(mpItemArchetype->DataSize(), ItemAlign);
|
||||
return ItemSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CByteProperty : public TNumericalProperty< s8, EPropertyType::Byte >
|
||||
class CByteProperty : public TNumericalProperty< int8, EPropertyType::Byte >
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
@@ -15,12 +15,12 @@ protected:
|
||||
public:
|
||||
virtual void SerializeValue(void* pData, IArchive& Arc) const
|
||||
{
|
||||
Arc.SerializePrimitive( (u8&) ValueRef(pData), 0 );
|
||||
Arc.SerializePrimitive( (int8&) ValueRef(pData), 0 );
|
||||
}
|
||||
|
||||
virtual TString ValueAsString(void* pData) const
|
||||
{
|
||||
return TString::FromInt32( (s32) Value(pData), 0, 10 );
|
||||
return TString::FromInt32( (int32) Value(pData), 0, 10 );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -11,20 +11,20 @@
|
||||
* In PWE, however, they are both implemented the same way under the hood.
|
||||
*/
|
||||
template<EPropertyType TypeEnum>
|
||||
class TEnumPropertyBase : public TSerializeableTypedProperty<s32, TypeEnum>
|
||||
class TEnumPropertyBase : public TSerializeableTypedProperty<int32, TypeEnum>
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
struct SEnumValue
|
||||
{
|
||||
TString Name;
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
|
||||
SEnumValue()
|
||||
: ID(0)
|
||||
{}
|
||||
|
||||
SEnumValue(const TString& rkInName, u32 InID)
|
||||
SEnumValue(const TString& rkInName, uint32 InID)
|
||||
: Name(rkInName), ID(InID) {}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
TTypedProperty::Serialize(rArc);
|
||||
|
||||
TEnumPropertyBase* pArchetype = static_cast<TEnumPropertyBase*>(mpArchetype);
|
||||
u32 DefaultValueFlags = SH_HexDisplay | (pArchetype || Game() <= EGame::Prime ? SH_Optional : 0);
|
||||
uint32 DefaultValueFlags = SH_HexDisplay | (pArchetype || Game() <= EGame::Prime ? SH_Optional : 0);
|
||||
|
||||
rArc << SerialParameter("DefaultValue", mDefaultValue, DefaultValueFlags, pArchetype ? pArchetype->mDefaultValue : 0);
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
virtual void SerializeValue(void* pData, IArchive& Arc) const
|
||||
{
|
||||
Arc.SerializePrimitive( (u32&) ValueRef(pData), 0 );
|
||||
Arc.SerializePrimitive( (uint32&) ValueRef(pData), 0 );
|
||||
}
|
||||
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
@@ -103,16 +103,16 @@ public:
|
||||
return TString::FromInt32( Value(pData), 0, 10 );
|
||||
}
|
||||
|
||||
void AddValue(TString ValueName, u32 ValueID)
|
||||
void AddValue(TString ValueName, uint32 ValueID)
|
||||
{
|
||||
mValues.push_back( SEnumValue(ValueName, ValueID) );
|
||||
}
|
||||
|
||||
inline u32 NumPossibleValues() const { return mValues.size(); }
|
||||
inline uint32 NumPossibleValues() const { return mValues.size(); }
|
||||
|
||||
u32 ValueIndex(u32 ID) const
|
||||
uint32 ValueIndex(uint32 ID) const
|
||||
{
|
||||
for (u32 ValueIdx = 0; ValueIdx < mValues.size(); ValueIdx++)
|
||||
for (uint32 ValueIdx = 0; ValueIdx < mValues.size(); ValueIdx++)
|
||||
{
|
||||
if (mValues[ValueIdx].ID == ID)
|
||||
{
|
||||
@@ -122,13 +122,13 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
u32 ValueID(u32 Index) const
|
||||
uint32 ValueID(uint32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < mValues.size());
|
||||
return mValues[Index].ID;
|
||||
}
|
||||
|
||||
TString ValueName(u32 Index) const
|
||||
TString ValueName(uint32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < mValues.size());
|
||||
return mValues[Index].Name;
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
{
|
||||
if (mValues.empty()) return true;
|
||||
int ID = ValueRef(pPropertyData);
|
||||
u32 Index = ValueIndex(ID);
|
||||
uint32 Index = ValueIndex(ID);
|
||||
return Index >= 0 && Index < mValues.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ void CFlagsProperty::PostInitialize()
|
||||
|
||||
void CFlagsProperty::SerializeValue(void* pData, IArchive& rArc) const
|
||||
{
|
||||
rArc.SerializePrimitive( (u32&) ValueRef(pData), SH_HexDisplay );
|
||||
rArc.SerializePrimitive( (uint32&) ValueRef(pData), SH_HexDisplay );
|
||||
}
|
||||
|
||||
void CFlagsProperty::InitFromArchetype(IProperty* pOther)
|
||||
@@ -46,7 +46,7 @@ TString CFlagsProperty::ValueAsString(void* pData) const
|
||||
* Checks whether there are any unrecognized bits toggled on in the property value.
|
||||
* Returns the mask of any invalid bits. If all bits are valid, returns 0.
|
||||
*/
|
||||
u32 CFlagsProperty::HasValidValue(void* pPropertyData)
|
||||
uint32 CFlagsProperty::HasValidValue(void* pPropertyData)
|
||||
{
|
||||
if (!mAllFlags) return 0;
|
||||
return ValueRef(pPropertyData) & ~mAllFlags;
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CFlagsProperty : public TSerializeableTypedProperty<u32, EPropertyType::Flags>
|
||||
class CFlagsProperty : public TSerializeableTypedProperty<uint32, EPropertyType::Flags>
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
struct SBitFlag
|
||||
{
|
||||
TString Name;
|
||||
u32 Mask;
|
||||
uint32 Mask;
|
||||
|
||||
SBitFlag()
|
||||
: Mask(0)
|
||||
{}
|
||||
|
||||
SBitFlag(const TString& rkInName, u32 InMask)
|
||||
SBitFlag(const TString& rkInName, uint32 InMask)
|
||||
: Name(rkInName), Mask(InMask)
|
||||
{}
|
||||
|
||||
@@ -32,7 +32,7 @@ class CFlagsProperty : public TSerializeableTypedProperty<u32, EPropertyType::Fl
|
||||
}
|
||||
};
|
||||
std::vector<SBitFlag> mBitFlags;
|
||||
u32 mAllFlags;
|
||||
uint32 mAllFlags;
|
||||
|
||||
CFlagsProperty(EGame Game)
|
||||
: TSerializeableTypedProperty(Game)
|
||||
@@ -40,18 +40,18 @@ class CFlagsProperty : public TSerializeableTypedProperty<u32, EPropertyType::Fl
|
||||
{}
|
||||
|
||||
public:
|
||||
inline u32 NumFlags() const
|
||||
inline uint32 NumFlags() const
|
||||
{
|
||||
return mBitFlags.size();
|
||||
}
|
||||
|
||||
inline TString FlagName(u32 Idx) const
|
||||
inline TString FlagName(uint32 Idx) const
|
||||
{
|
||||
ASSERT(Idx >= 0 && Idx < mBitFlags.size());
|
||||
return mBitFlags[Idx].Name;
|
||||
}
|
||||
|
||||
inline u32 FlagMask(u32 Idx) const
|
||||
inline uint32 FlagMask(uint32 Idx) const
|
||||
{
|
||||
ASSERT(Idx >= 0 && Idx < mBitFlags.size());
|
||||
return mBitFlags[Idx].Mask;
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
* Checks whether there are any unrecognized bits toggled on in the property value.
|
||||
* Returns the mask of any invalid bits. If all bits are valid, returns 0.
|
||||
*/
|
||||
u32 HasValidValue(void* pPropertyData);
|
||||
uint32 HasValidValue(void* pPropertyData);
|
||||
};
|
||||
|
||||
#endif // CFLAGSPROPERTY_H
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CIntProperty : public TNumericalProperty< s32, EPropertyType::Int >
|
||||
class CIntProperty : public TNumericalProperty< int32, EPropertyType::Int >
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r
|
||||
CCRC32 FullHash = BaseHash;
|
||||
const char* pkTypeName = *mTypeNames[TypeIdx];
|
||||
FullHash.Hash( pkTypeName );
|
||||
u32 PropertyID = FullHash.Digest();
|
||||
uint32 PropertyID = FullHash.Digest();
|
||||
|
||||
// Check if this hash is a property ID
|
||||
if (IsValidPropertyID(PropertyID, pkTypeName, rkParams))
|
||||
@@ -234,8 +234,7 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r
|
||||
DelimitedXmlList += *Iter + "\n";
|
||||
}
|
||||
|
||||
TString LogMsg = TString::Format("%s [%s] : 0x%08X\n", *PropertyName.Name, *PropertyName.Type, PropertyName.ID) + DelimitedXmlList;
|
||||
Log::Write(LogMsg);
|
||||
debugf("%s [%s] : 0x%08X\n%s", *PropertyName.Name, *PropertyName.Type, PropertyName.ID, *DelimitedXmlList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +257,7 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r
|
||||
}
|
||||
|
||||
/** Returns whether a given property ID is valid */
|
||||
bool CPropertyNameGenerator::IsValidPropertyID(u32 ID, const char*& pkType, const SPropertyNameGenerationParameters& rkParams)
|
||||
bool CPropertyNameGenerator::IsValidPropertyID(uint32 ID, const char*& pkType, const SPropertyNameGenerationParameters& rkParams)
|
||||
{
|
||||
if (!mValidTypePairMap.empty())
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ enum class ENameCasing
|
||||
/** ID/type pairing for ID pool */
|
||||
struct SPropertyIdTypePair
|
||||
{
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
const char* pkType;
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ struct SGeneratedPropertyName
|
||||
{
|
||||
TString Name;
|
||||
TString Type;
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
std::set<TString> XmlList;
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ class CPropertyNameGenerator
|
||||
std::vector<TString> mTypeNames;
|
||||
|
||||
/** Mapping of valid ID/type pairs; if empty, all property names in NPropertyMap are allowed */
|
||||
std::unordered_map<u32, const char*> mValidTypePairMap;
|
||||
std::unordered_map<uint32, const char*> mValidTypePairMap;
|
||||
|
||||
/** List of words */
|
||||
struct SWord
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
void Generate(const SPropertyNameGenerationParameters& rkParams, IProgressNotifier* pProgressNotifier);
|
||||
|
||||
/** Returns whether a given property ID is valid */
|
||||
bool IsValidPropertyID(u32 ID, const char*& pkType, const SPropertyNameGenerationParameters& rkParams);
|
||||
bool IsValidPropertyID(uint32 ID, const char*& pkType, const SPropertyNameGenerationParameters& rkParams);
|
||||
|
||||
/** Accessors */
|
||||
bool IsRunning() const
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSequenceProperty : public TTypedProperty< s32, EPropertyType::Sequence >
|
||||
class CSequenceProperty : public TTypedProperty< int32, EPropertyType::Sequence >
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CShortProperty : public TNumericalProperty< s16, EPropertyType::Short >
|
||||
class CShortProperty : public TNumericalProperty< int16, EPropertyType::Short >
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
virtual TString ValueAsString(void* pData) const
|
||||
{
|
||||
return TString::FromInt32( (s32) Value(pData), 0, 10 );
|
||||
return TString::FromInt32( (int32) Value(pData), 0, 10 );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSoundProperty : public TSerializeableTypedProperty< s32, EPropertyType::Sound >
|
||||
class CSoundProperty : public TSerializeableTypedProperty< int32, EPropertyType::Sound >
|
||||
{
|
||||
friend class IProperty;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ void CStructProperty::PostInitialize()
|
||||
ASSERT( IsRootParent() || mpArchetype != nullptr );
|
||||
}
|
||||
|
||||
u32 CStructProperty::DataSize() const
|
||||
uint32 CStructProperty::DataSize() const
|
||||
{
|
||||
if (!mChildren.empty())
|
||||
{
|
||||
@@ -27,7 +27,7 @@ u32 CStructProperty::DataSize() const
|
||||
}
|
||||
}
|
||||
|
||||
u32 CStructProperty::DataAlignment() const
|
||||
uint32 CStructProperty::DataAlignment() const
|
||||
{
|
||||
// Structs are aligned to the first child property.
|
||||
return (mChildren.empty() ? 1 : mChildren[0]->DataAlignment());
|
||||
@@ -102,10 +102,10 @@ void CStructProperty::Serialize(IArchive& rArc)
|
||||
// We've initialized from the archetypes, now serialize parameter overrides
|
||||
if (rArc.ParamBegin("SubProperties", 0))
|
||||
{
|
||||
u32 NumChildOverrides;
|
||||
uint32 NumChildOverrides;
|
||||
rArc.SerializeArraySize(NumChildOverrides);
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < NumChildOverrides; ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < NumChildOverrides; ChildIdx++)
|
||||
{
|
||||
if (rArc.ParamBegin("Element", SH_IgnoreName))
|
||||
{
|
||||
@@ -113,7 +113,7 @@ void CStructProperty::Serialize(IArchive& rArc)
|
||||
// We don't really need the type, but it's a good sanity check, and it's also good practice
|
||||
// to guarantee that parameters are read in order, as some serializers are order-dependent.
|
||||
EPropertyType ChildType;
|
||||
u32 ChildID;
|
||||
uint32 ChildID;
|
||||
|
||||
rArc << SerialParameter("Type", ChildType, SH_Attribute)
|
||||
<< SerialParameter("ID", ChildID, SH_Attribute | SH_HexDisplay );
|
||||
@@ -134,7 +134,7 @@ void CStructProperty::Serialize(IArchive& rArc)
|
||||
// Check if any properties need to override parameters from their archetype.
|
||||
std::vector<IProperty*> PropertiesToSerialize;
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
if (mChildren[ChildIdx]->ShouldSerialize())
|
||||
{
|
||||
@@ -142,7 +142,7 @@ void CStructProperty::Serialize(IArchive& rArc)
|
||||
}
|
||||
}
|
||||
|
||||
u32 NumChildOverrides = PropertiesToSerialize.size();
|
||||
uint32 NumChildOverrides = PropertiesToSerialize.size();
|
||||
|
||||
if (NumChildOverrides > 0)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ void CStructProperty::Serialize(IArchive& rArc)
|
||||
|
||||
void CStructProperty::SerializeValue(void* pData, IArchive& Arc) const
|
||||
{
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
if (Arc.ParamBegin("Property", 0))
|
||||
{
|
||||
@@ -176,7 +176,7 @@ void CStructProperty::InitFromArchetype(IProperty* pOther)
|
||||
_ClearChildren();
|
||||
mChildren.reserve( pOther->NumChildren() );
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < pOther->NumChildren(); ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < pOther->NumChildren(); ChildIdx++)
|
||||
{
|
||||
IProperty* pChild = CreateCopy( pOther->ChildByIndex(ChildIdx) );
|
||||
mChildren.push_back( pChild );
|
||||
@@ -188,7 +188,7 @@ bool CStructProperty::ShouldSerialize() const
|
||||
if (IProperty::ShouldSerialize())
|
||||
return true;
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
if (mChildren[ChildIdx]->ShouldSerialize())
|
||||
return true;
|
||||
|
||||
@@ -19,8 +19,8 @@ protected:
|
||||
public:
|
||||
virtual EPropertyType Type() const;
|
||||
virtual void PostInitialize();
|
||||
virtual u32 DataSize() const;
|
||||
virtual u32 DataAlignment() const;
|
||||
virtual uint32 DataSize() const;
|
||||
virtual uint32 DataAlignment() const;
|
||||
virtual void Construct(void* pData) const;
|
||||
virtual void Destruct(void* pData) const;
|
||||
virtual bool MatchesDefault(void* pData) const;
|
||||
|
||||
@@ -76,7 +76,7 @@ void IProperty::Serialize(IArchive& rArc)
|
||||
{
|
||||
// Always serialize ID first! ID is always required (except for root properties, which have an ID of 0xFFFFFFFF)
|
||||
// because they are needed to look up the correct property to apply parameter overrides to.
|
||||
rArc << SerialParameter("ID", mID, SH_HexDisplay | SH_Attribute | SH_Optional, (u32) 0xFFFFFFFF);
|
||||
rArc << SerialParameter("ID", mID, SH_HexDisplay | SH_Attribute | SH_Optional, (uint32) 0xFFFFFFFF);
|
||||
|
||||
// Now we can serialize the archetype reference and initialize if needed
|
||||
if ( ((mpArchetype && mpArchetype->IsRootParent()) || rArc.IsReader()) && rArc.CanSkipParameters() )
|
||||
@@ -149,7 +149,7 @@ bool IProperty::ShouldSerialize() const
|
||||
mMaxVersion != mpArchetype->mMaxVersion;
|
||||
}
|
||||
|
||||
void IProperty::Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u32 InOffset)
|
||||
void IProperty::Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, uint32 InOffset)
|
||||
{
|
||||
// Make sure we only get initialized once.
|
||||
ASSERT( (mFlags & EPropertyFlag::IsInitialized) == 0 );
|
||||
@@ -199,7 +199,7 @@ void IProperty::Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u
|
||||
PostInitialize();
|
||||
|
||||
// Now, route initialization to any child properties...
|
||||
u32 ChildOffset = mOffset;
|
||||
uint32 ChildOffset = mOffset;
|
||||
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
@@ -231,9 +231,9 @@ void* IProperty::RawValuePtr(void* pData) const
|
||||
return pValuePtr;
|
||||
}
|
||||
|
||||
IProperty* IProperty::ChildByID(u32 ID) const
|
||||
IProperty* IProperty::ChildByID(uint32 ID) const
|
||||
{
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
if (mChildren[ChildIdx]->mID == ID)
|
||||
return mChildren[ChildIdx];
|
||||
@@ -248,13 +248,13 @@ IProperty* IProperty::ChildByIDString(const TIDString& rkIdString)
|
||||
// some ID strings are formatted with 8 characters and some with 2 (plus the beginning "0x")
|
||||
ASSERT(rkIdString.Size() >= 4);
|
||||
|
||||
u32 IDEndPos = rkIdString.IndexOf(':');
|
||||
u32 NextChildID = -1;
|
||||
uint32 IDEndPos = rkIdString.IndexOf(':');
|
||||
uint32 NextChildID = -1;
|
||||
|
||||
if (IDEndPos == -1)
|
||||
NextChildID = rkIdString.ToInt32();
|
||||
NextChildID = rkIdString.ToInt32(16);
|
||||
else
|
||||
NextChildID = rkIdString.SubString(2, IDEndPos - 2).ToInt32();
|
||||
NextChildID = rkIdString.SubString(2, IDEndPos - 2).ToInt32(16);
|
||||
|
||||
if (NextChildID == 0xFFFFFFFF)
|
||||
{
|
||||
@@ -278,7 +278,7 @@ void IProperty::GatherAllSubInstances(std::list<IProperty*>& OutList, bool Recur
|
||||
{
|
||||
OutList.push_back(this);
|
||||
|
||||
for( u32 SubIdx = 0; SubIdx < mSubInstances.size(); SubIdx++ )
|
||||
for( uint32 SubIdx = 0; SubIdx < mSubInstances.size(); SubIdx++ )
|
||||
{
|
||||
IProperty* pSubInstance = mSubInstances[SubIdx];
|
||||
|
||||
@@ -310,7 +310,7 @@ TString IProperty::GetTemplateFileName()
|
||||
pTemplateRoot = pTemplateRoot->RootParent();
|
||||
|
||||
// Now that we have the base property of our template, we can return the file path.
|
||||
static const u32 kChopAmount = strlen("../templates/");
|
||||
static const uint32 kChopAmount = strlen("../templates/");
|
||||
|
||||
if (pTemplateRoot->ScriptTemplate())
|
||||
{
|
||||
@@ -378,7 +378,7 @@ void IProperty::MarkDirty()
|
||||
mFlags &= ~(EPropertyFlag::HasCachedNameCheck | EPropertyFlag::HasCorrectPropertyName);
|
||||
|
||||
// Mark sub-instances as dirty since they may need to resave as well
|
||||
for (u32 SubIdx = 0; SubIdx < mSubInstances.size(); SubIdx++)
|
||||
for (uint32 SubIdx = 0; SubIdx < mSubInstances.size(); SubIdx++)
|
||||
{
|
||||
mSubInstances[SubIdx]->MarkDirty();
|
||||
}
|
||||
@@ -454,7 +454,7 @@ bool IProperty::ConvertType(EPropertyType NewType, IProperty* pNewArchetype /*=
|
||||
// Swap out our parent's reference to us to point to the new property.
|
||||
if (mpParent)
|
||||
{
|
||||
for (u32 SiblingIdx = 0; SiblingIdx < mpParent->mChildren.size(); SiblingIdx++)
|
||||
for (uint32 SiblingIdx = 0; SiblingIdx < mpParent->mChildren.size(); SiblingIdx++)
|
||||
{
|
||||
IProperty* pSibling = mpParent->mChildren[SiblingIdx];
|
||||
if (pSibling == this)
|
||||
@@ -466,7 +466,7 @@ bool IProperty::ConvertType(EPropertyType NewType, IProperty* pNewArchetype /*=
|
||||
}
|
||||
|
||||
// Change all our child properties to be parented under the new property. (Is this adoption?)
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
for (uint32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
mChildren[ChildIdx]->mpParent = pNewProperty;
|
||||
pNewProperty->mChildren.push_back(mChildren[ChildIdx]);
|
||||
@@ -478,7 +478,7 @@ bool IProperty::ConvertType(EPropertyType NewType, IProperty* pNewArchetype /*=
|
||||
// Note that when the sub-instances complete their conversion, they delete themselves.
|
||||
// The IProperty destructor removes the property from the archetype's sub-instance list.
|
||||
// So we shouldn't use a for loop, instead we should just wait until the array is empty
|
||||
u32 SubCount = mSubInstances.size();
|
||||
uint32 SubCount = mSubInstances.size();
|
||||
|
||||
while (!mSubInstances.empty())
|
||||
{
|
||||
@@ -542,7 +542,7 @@ bool IProperty::HasAccurateName()
|
||||
CCRC32 Hash;
|
||||
Hash.Hash(*mName);
|
||||
Hash.Hash(HashableTypeName());
|
||||
u32 GeneratedID = Hash.Digest();
|
||||
uint32 GeneratedID = Hash.Digest();
|
||||
|
||||
// Some choice properties are incorrectly declared as ints, so account for
|
||||
// this and allow matching ints against choice typenames as well.
|
||||
@@ -619,7 +619,7 @@ IProperty* IProperty::CreateCopy(IProperty* pArchetype)
|
||||
|
||||
IProperty* IProperty::CreateIntrinsic(EPropertyType Type,
|
||||
EGame Game,
|
||||
u32 Offset,
|
||||
uint32 Offset,
|
||||
const TString& rkName)
|
||||
{
|
||||
IProperty* pOut = Create(Type, Game);
|
||||
@@ -631,7 +631,7 @@ IProperty* IProperty::CreateIntrinsic(EPropertyType Type,
|
||||
|
||||
IProperty* IProperty::CreateIntrinsic(EPropertyType Type,
|
||||
IProperty* pParent,
|
||||
u32 Offset,
|
||||
uint32 Offset,
|
||||
const TString& rkName)
|
||||
{
|
||||
// pParent should always be valid.
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
#include "Core/Resource/Animation/CAnimationParameters.h"
|
||||
#include <Common/Common.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Math/MathUtil.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
#include <Common/Math/MathUtil.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -17,7 +18,7 @@ class CStructProperty;
|
||||
typedef TString TIDString;
|
||||
|
||||
/** Property flags */
|
||||
enum class EPropertyFlag : u32
|
||||
enum class EPropertyFlag : uint32
|
||||
{
|
||||
/** Property has been fully initialized and has had PostLoad called */
|
||||
IsInitialized = 0x1,
|
||||
@@ -139,10 +140,10 @@ protected:
|
||||
CScriptTemplate* mpScriptTemplate;
|
||||
|
||||
/** Offset of this property within the property block */
|
||||
u32 mOffset;
|
||||
uint32 mOffset;
|
||||
|
||||
/** Property ID. This ID is used to uniquely identify this property within this struct. */
|
||||
u32 mID;
|
||||
uint32 mID;
|
||||
|
||||
/** Property metadata */
|
||||
TString mName;
|
||||
@@ -166,8 +167,8 @@ public:
|
||||
|
||||
/** Interface */
|
||||
virtual EPropertyType Type() const = 0;
|
||||
virtual u32 DataSize() const = 0;
|
||||
virtual u32 DataAlignment() const = 0;
|
||||
virtual uint32 DataSize() const = 0;
|
||||
virtual uint32 DataAlignment() const = 0;
|
||||
virtual void Construct(void* pData) const = 0;
|
||||
virtual void Destruct(void* pData) const = 0;
|
||||
virtual bool MatchesDefault(void* pData) const = 0;
|
||||
@@ -187,9 +188,9 @@ public:
|
||||
virtual bool ShouldSerialize() const;
|
||||
|
||||
/** Utility methods */
|
||||
void Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u32 InOffset);
|
||||
void Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, uint32 InOffset);
|
||||
void* RawValuePtr(void* pData) const;
|
||||
IProperty* ChildByID(u32 ID) const;
|
||||
IProperty* ChildByID(uint32 ID) const;
|
||||
IProperty* ChildByIDString(const TIDString& rkIdString);
|
||||
void GatherAllSubInstances(std::list<IProperty*>& OutList, bool Recursive);
|
||||
TString GetTemplateFileName();
|
||||
@@ -206,8 +207,8 @@ public:
|
||||
/** Accessors */
|
||||
EGame Game() const;
|
||||
inline ECookPreference CookPreference() const;
|
||||
inline u32 NumChildren() const;
|
||||
inline IProperty* ChildByIndex(u32 ChildIndex) const;
|
||||
inline uint32 NumChildren() const;
|
||||
inline IProperty* ChildByIndex(uint32 ChildIndex) const;
|
||||
inline IProperty* Parent() const;
|
||||
inline IProperty* RootParent();
|
||||
inline IProperty* Archetype() const;
|
||||
@@ -217,8 +218,8 @@ public:
|
||||
inline TString Description() const;
|
||||
inline TString Suffix() const;
|
||||
inline TIDString IDString(bool FullyQualified) const;
|
||||
inline u32 Offset() const;
|
||||
inline u32 ID() const;
|
||||
inline uint32 Offset() const;
|
||||
inline uint32 ID() const;
|
||||
|
||||
inline bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); }
|
||||
inline bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); }
|
||||
@@ -237,12 +238,12 @@ public:
|
||||
|
||||
static IProperty* CreateIntrinsic(EPropertyType Type,
|
||||
EGame Game,
|
||||
u32 Offset,
|
||||
uint32 Offset,
|
||||
const TString& rkName);
|
||||
|
||||
static IProperty* CreateIntrinsic(EPropertyType Type,
|
||||
IProperty* pParent,
|
||||
u32 Offset,
|
||||
uint32 Offset,
|
||||
const TString& rkName);
|
||||
|
||||
static IProperty* ArchiveConstructor(EPropertyType Type,
|
||||
@@ -254,12 +255,12 @@ inline ECookPreference IProperty::CookPreference() const
|
||||
return mCookPreference;
|
||||
}
|
||||
|
||||
inline u32 IProperty::NumChildren() const
|
||||
inline uint32 IProperty::NumChildren() const
|
||||
{
|
||||
return mChildren.size();
|
||||
}
|
||||
|
||||
inline IProperty* IProperty::ChildByIndex(u32 ChildIndex) const
|
||||
inline IProperty* IProperty::ChildByIndex(uint32 ChildIndex) const
|
||||
{
|
||||
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
|
||||
return mChildren[ChildIndex];
|
||||
@@ -331,12 +332,12 @@ inline TString IProperty::IDString(bool FullyQualified) const
|
||||
return TString::HexString(mID);
|
||||
}
|
||||
|
||||
inline u32 IProperty::Offset() const
|
||||
inline uint32 IProperty::Offset() const
|
||||
{
|
||||
return mOffset;
|
||||
}
|
||||
|
||||
inline u32 IProperty::ID() const
|
||||
inline uint32 IProperty::ID() const
|
||||
{
|
||||
return mID;
|
||||
}
|
||||
@@ -360,8 +361,8 @@ protected:
|
||||
|
||||
public:
|
||||
virtual EPropertyType Type() const { return PropEnum; }
|
||||
virtual u32 DataSize() const { return sizeof(PropType); }
|
||||
virtual u32 DataAlignment() const { return alignof(PropType); }
|
||||
virtual uint32 DataSize() const { return sizeof(PropType); }
|
||||
virtual uint32 DataAlignment() const { return alignof(PropType); }
|
||||
virtual void Construct(void* pData) const { new(ValuePtr(pData)) PropType(mDefaultValue); }
|
||||
virtual void Destruct(void* pData) const { ValueRef(pData).~PropType(); }
|
||||
virtual bool MatchesDefault(void* pData) const { return ValueRef(pData) == mDefaultValue; }
|
||||
|
||||
Reference in New Issue
Block a user