mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-20 10:25:40 +00:00
General: Remove unnecessary inline specifiers and add overrides
This commit is contained in:
@@ -14,12 +14,11 @@ class CBone;
|
||||
|
||||
struct SBoneTransformInfo
|
||||
{
|
||||
CVector3f Position;
|
||||
CQuaternion Rotation;
|
||||
CVector3f Scale;
|
||||
CVector3f Position{CVector3f::skZero};
|
||||
CQuaternion Rotation{CQuaternion::skIdentity};
|
||||
CVector3f Scale{CVector3f::skOne};
|
||||
|
||||
SBoneTransformInfo()
|
||||
: Position(CVector3f::skZero), Rotation(CQuaternion::skIdentity), Scale(CVector3f::skOne) {}
|
||||
SBoneTransformInfo() = default;
|
||||
};
|
||||
|
||||
class CSkeleton : public CResource
|
||||
@@ -33,8 +32,8 @@ class CSkeleton : public CResource
|
||||
static const float skSphereRadius;
|
||||
|
||||
public:
|
||||
CSkeleton(CResourceEntry *pEntry = 0);
|
||||
~CSkeleton();
|
||||
explicit CSkeleton(CResourceEntry *pEntry = nullptr);
|
||||
~CSkeleton() override;
|
||||
void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot);
|
||||
CBone* BoneByID(uint32 BoneID) const;
|
||||
CBone* BoneByName(const TString& rkBoneName) const;
|
||||
@@ -43,8 +42,8 @@ public:
|
||||
void Draw(FRenderOptions Options, const CBoneTransformData *pkData);
|
||||
std::pair<int32,float> RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData);
|
||||
|
||||
inline uint32 NumBones() const { return mBones.size(); }
|
||||
inline CBone* RootBone() const { return mpRootBone; }
|
||||
uint32 NumBones() const { return mBones.size(); }
|
||||
CBone* RootBone() const { return mpRootBone; }
|
||||
};
|
||||
|
||||
class CBone
|
||||
|
||||
@@ -23,7 +23,7 @@ class CSkin : public CResource
|
||||
std::vector<SVertGroup> mVertGroups;
|
||||
|
||||
public:
|
||||
CSkin(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
||||
explicit CSkin(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {}
|
||||
|
||||
const SVertexWeights& WeightsForVertex(uint32 VertIdx)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ class CSourceAnimData : public CResource
|
||||
IMetaTransition *mpDefaultTransition;
|
||||
|
||||
public:
|
||||
CSourceAnimData(CResourceEntry *pEntry = 0)
|
||||
explicit CSourceAnimData(CResourceEntry *pEntry = nullptr)
|
||||
: CResource(pEntry)
|
||||
, mpDefaultTransition(nullptr)
|
||||
{}
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
delete mpDefaultTransition;
|
||||
}
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const
|
||||
CDependencyTree* BuildDependencyTree() const override
|
||||
{
|
||||
// SAND normally has dependencies from meta-transitions and events
|
||||
// However, all of these can be character-specific. To simplify things, all SAND
|
||||
|
||||
@@ -26,11 +26,11 @@ extern CMetaAnimFactory gMetaAnimFactory;
|
||||
class CAnimPrimitive
|
||||
{
|
||||
TResPtr<CAnimation> mpAnim;
|
||||
uint32 mID;
|
||||
uint32 mID = 0;
|
||||
TString mName;
|
||||
|
||||
public:
|
||||
CAnimPrimitive() : mID(0) {}
|
||||
CAnimPrimitive() = default;
|
||||
|
||||
CAnimPrimitive(const CAssetID& rkAnimAssetID, uint32 CharAnimID, const TString& rkAnimName)
|
||||
: mID(CharAnimID), mName(rkAnimName)
|
||||
@@ -45,8 +45,9 @@ public:
|
||||
mName = rInput.ReadString();
|
||||
}
|
||||
|
||||
inline bool operator==(const CAnimPrimitive& rkRight) const { return mID == rkRight.mID; }
|
||||
inline bool operator< (const CAnimPrimitive& rkRight) const { return mID < rkRight.mID; }
|
||||
bool operator==(const CAnimPrimitive& other) const { return mID == other.mID; }
|
||||
bool operator!=(const CAnimPrimitive& other) const { return !operator==(other); }
|
||||
bool operator< (const CAnimPrimitive& other) const { return mID < other.mID; }
|
||||
|
||||
// Accessors
|
||||
CAnimation* Animation() const { return mpAnim; }
|
||||
@@ -58,8 +59,8 @@ public:
|
||||
class IMetaAnimation
|
||||
{
|
||||
public:
|
||||
IMetaAnimation() {}
|
||||
virtual ~IMetaAnimation() {}
|
||||
IMetaAnimation() = default;
|
||||
virtual ~IMetaAnimation() = default;
|
||||
virtual EMetaAnimType Type() const = 0;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
||||
|
||||
@@ -78,13 +79,13 @@ protected:
|
||||
public:
|
||||
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB);
|
||||
CMetaAnimPlay(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaAnimType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
|
||||
// Accessors
|
||||
inline CAnimPrimitive Primitive() const { return mPrimitive; }
|
||||
inline float UnknownA() const { return mUnknownA; }
|
||||
inline uint32 UnknownB() const { return mUnknownB; }
|
||||
CAnimPrimitive Primitive() const { return mPrimitive; }
|
||||
float UnknownA() const { return mUnknownA; }
|
||||
uint32 UnknownB() const { return mUnknownB; }
|
||||
};
|
||||
|
||||
// CMetaAnimBlend - blend between two animations
|
||||
@@ -100,14 +101,14 @@ protected:
|
||||
public:
|
||||
CMetaAnimBlend(EMetaAnimType Type, IInputStream& rInput, EGame Game);
|
||||
~CMetaAnimBlend();
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaAnimType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
|
||||
// Accessors
|
||||
inline IMetaAnimation* BlendAnimationA() const { return mpMetaAnimA; }
|
||||
inline IMetaAnimation* BlendAnimationB() const { return mpMetaAnimB; }
|
||||
inline float UnknownA() const { return mUnknownA; }
|
||||
inline bool UnknownB() const { return mUnknownB; }
|
||||
IMetaAnimation* BlendAnimationA() const { return mpMetaAnimA; }
|
||||
IMetaAnimation* BlendAnimationB() const { return mpMetaAnimB; }
|
||||
float UnknownA() const { return mUnknownA; }
|
||||
bool UnknownB() const { return mUnknownB; }
|
||||
};
|
||||
|
||||
// SAnimProbabilityPair - structure used by CMetaAnimationRandom to associate an animation with a probability value
|
||||
@@ -126,8 +127,8 @@ protected:
|
||||
public:
|
||||
CMetaAnimRandom(IInputStream& rInput, EGame Game);
|
||||
~CMetaAnimRandom();
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaAnimType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
};
|
||||
|
||||
// CMetaAnim - play a series of animations in sequence
|
||||
@@ -139,8 +140,8 @@ protected:
|
||||
public:
|
||||
CMetaAnimSequence(IInputStream& rInput, EGame Game);
|
||||
~CMetaAnimSequence();
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaAnimType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
};
|
||||
|
||||
#endif // IMETAANIMATION
|
||||
|
||||
@@ -27,8 +27,8 @@ extern CMetaTransFactory gMetaTransFactory;
|
||||
class IMetaTransition
|
||||
{
|
||||
public:
|
||||
IMetaTransition() {}
|
||||
virtual ~IMetaTransition() {}
|
||||
IMetaTransition() = default;
|
||||
virtual ~IMetaTransition() = default;
|
||||
virtual EMetaTransType Type() const = 0;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
||||
};
|
||||
@@ -41,8 +41,8 @@ class CMetaTransMetaAnim : public IMetaTransition
|
||||
public:
|
||||
CMetaTransMetaAnim(IInputStream& rInput, EGame Game);
|
||||
~CMetaTransMetaAnim();
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaTransType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
};
|
||||
|
||||
// CMetaTransTrans
|
||||
@@ -57,8 +57,8 @@ class CMetaTransTrans : public IMetaTransition
|
||||
|
||||
public:
|
||||
CMetaTransTrans(EMetaTransType Type, IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaTransType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
};
|
||||
|
||||
// CMetaTransSnap
|
||||
@@ -66,8 +66,8 @@ class CMetaTransSnap : public IMetaTransition
|
||||
{
|
||||
public:
|
||||
CMetaTransSnap(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaTransType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
};
|
||||
|
||||
// CMetaTransType4
|
||||
@@ -75,8 +75,8 @@ class CMetaTransType4 : public IMetaTransition
|
||||
{
|
||||
public:
|
||||
CMetaTransType4(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
EMetaTransType Type() const override;
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||
};
|
||||
|
||||
#endif // IMETATRANSITION_H
|
||||
|
||||
@@ -65,9 +65,9 @@ class CGameArea : public CResource
|
||||
std::vector< std::vector<CAssetID> > mExtraLayerDeps;
|
||||
|
||||
public:
|
||||
CGameArea(CResourceEntry *pEntry = 0);
|
||||
CGameArea(CResourceEntry *pEntry = nullptr);
|
||||
~CGameArea();
|
||||
CDependencyTree* BuildDependencyTree() const;
|
||||
CDependencyTree* BuildDependencyTree() const override;
|
||||
|
||||
void AddWorldModel(CModel *pModel);
|
||||
void MergeTerrain();
|
||||
@@ -85,26 +85,26 @@ public:
|
||||
void DeleteInstance(CScriptObject *pInstance);
|
||||
void ClearExtraDependencies();
|
||||
|
||||
// Inline Accessors
|
||||
inline uint32 WorldIndex() const { return mWorldIndex; }
|
||||
inline CTransform4f Transform() const { return mTransform; }
|
||||
inline CMaterialSet* Materials() const { return mpMaterialSet; }
|
||||
inline uint32 NumWorldModels() const { return mWorldModels.size(); }
|
||||
inline uint32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||
inline CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; }
|
||||
inline CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; }
|
||||
inline CCollisionMeshGroup* Collision() const { return mpCollision.get(); }
|
||||
inline uint32 NumScriptLayers() const { return mScriptLayers.size(); }
|
||||
inline CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; }
|
||||
inline uint32 NumLightLayers() const { return mLightLayers.size(); }
|
||||
inline uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||
inline CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; }
|
||||
inline CAssetID PathID() const { return mPathID; }
|
||||
inline CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; }
|
||||
inline CAssetID PortalAreaID() const { return mPortalAreaID; }
|
||||
inline CAABox AABox() const { return mAABox; }
|
||||
// Accessors
|
||||
uint32 WorldIndex() const { return mWorldIndex; }
|
||||
CTransform4f Transform() const { return mTransform; }
|
||||
CMaterialSet* Materials() const { return mpMaterialSet; }
|
||||
uint32 NumWorldModels() const { return mWorldModels.size(); }
|
||||
uint32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||
CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; }
|
||||
CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; }
|
||||
CCollisionMeshGroup* Collision() const { return mpCollision.get(); }
|
||||
uint32 NumScriptLayers() const { return mScriptLayers.size(); }
|
||||
CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; }
|
||||
uint32 NumLightLayers() const { return mLightLayers.size(); }
|
||||
uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||
CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; }
|
||||
CAssetID PathID() const { return mPathID; }
|
||||
CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; }
|
||||
CAssetID PortalAreaID() const { return mPortalAreaID; }
|
||||
CAABox AABox() const { return mAABox; }
|
||||
|
||||
inline void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; }
|
||||
void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; }
|
||||
};
|
||||
|
||||
#endif // CGAMEAREA_H
|
||||
|
||||
@@ -59,17 +59,17 @@ class CFont : public CResource
|
||||
|
||||
|
||||
public:
|
||||
CFont(CResourceEntry *pEntry = 0);
|
||||
CFont(CResourceEntry *pEntry = nullptr);
|
||||
~CFont();
|
||||
CDependencyTree* BuildDependencyTree() const;
|
||||
CDependencyTree* BuildDependencyTree() const override;
|
||||
CVector2f RenderString(const TString& rkString, CRenderer *pRenderer, float AspectRatio,
|
||||
CVector2f Position = CVector2f(0,0),
|
||||
CColor FillColor = CColor::skWhite, CColor StrokeColor = CColor::skBlack,
|
||||
uint32 FontSize = CFONT_DEFAULT_SIZE);
|
||||
|
||||
// Accessors
|
||||
inline TString FontName() const { return mFontName; }
|
||||
inline CTexture* Texture() const { return mpFontTexture; }
|
||||
TString FontName() const { return mFontName; }
|
||||
CTexture* Texture() const { return mpFontTexture; }
|
||||
private:
|
||||
static void InitBuffers();
|
||||
static void ShutdownBuffers();
|
||||
|
||||
@@ -43,17 +43,17 @@ private:
|
||||
|
||||
public:
|
||||
// Accessors
|
||||
inline ELightType Type() const { return mType; }
|
||||
inline uint32 LayerIndex() const { return mLayerIndex; }
|
||||
inline CVector3f Position() const { return mPosition; }
|
||||
inline CVector3f Direction() const { return mDirection; }
|
||||
inline CColor Color() const { return mColor; }
|
||||
inline CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
||||
inline CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||
ELightType Type() const { return mType; }
|
||||
uint32 LayerIndex() const { return mLayerIndex; }
|
||||
CVector3f Position() const { return mPosition; }
|
||||
CVector3f Direction() const { return mDirection; }
|
||||
CColor Color() const { return mColor; }
|
||||
CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
||||
CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||
|
||||
inline void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||
inline void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||
inline void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||
void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||
void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||
void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||
|
||||
float GetRadius() const;
|
||||
float GetIntensity() const;
|
||||
|
||||
@@ -10,13 +10,13 @@ class CMapArea : public CResource
|
||||
CAssetID mNameString;
|
||||
|
||||
public:
|
||||
CMapArea(CResourceEntry *pEntry = 0)
|
||||
CMapArea(CResourceEntry *pEntry = nullptr)
|
||||
: CResource(pEntry)
|
||||
{}
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const
|
||||
CDependencyTree* BuildDependencyTree() const override
|
||||
{
|
||||
CDependencyTree *pTree = new CDependencyTree();
|
||||
auto *pTree = new CDependencyTree();
|
||||
pTree->AddDependency(mNameString);
|
||||
return pTree;
|
||||
}
|
||||
|
||||
@@ -126,34 +126,34 @@ public:
|
||||
void SetNumPasses(uint32 NumPasses);
|
||||
|
||||
// Accessors
|
||||
inline TString Name() const { return mName; }
|
||||
inline EGame Version() const { return mVersion; }
|
||||
inline FMaterialOptions Options() const { return mOptions; }
|
||||
inline FVertexDescription VtxDesc() const { return mVtxDesc; }
|
||||
inline GLenum BlendSrcFac() const { return mBlendSrcFac; }
|
||||
inline GLenum BlendDstFac() const { return mBlendDstFac; }
|
||||
inline CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; }
|
||||
inline CColor TevColor(ETevOutput Out) const { return mTevColors[int(Out)]; }
|
||||
inline CTexture* IndTexture() const { return mpIndirectTexture; }
|
||||
inline bool IsLightingEnabled() const { return mLightingEnabled; }
|
||||
inline uint32 EchoesUnknownA() const { return mEchoesUnknownA; }
|
||||
inline uint32 EchoesUnknownB() const { return mEchoesUnknownB; }
|
||||
inline uint32 PassCount() const { return mPasses.size(); }
|
||||
inline CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex].get(); }
|
||||
inline CMaterial* GetNextDrawPass() const { return mpNextDrawPassMaterial.get(); }
|
||||
inline CMaterial* GetBloomVersion() const { return mpBloomMaterial.get(); }
|
||||
TString Name() const { return mName; }
|
||||
EGame Version() const { return mVersion; }
|
||||
FMaterialOptions Options() const { return mOptions; }
|
||||
FVertexDescription VtxDesc() const { return mVtxDesc; }
|
||||
GLenum BlendSrcFac() const { return mBlendSrcFac; }
|
||||
GLenum BlendDstFac() const { return mBlendDstFac; }
|
||||
CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; }
|
||||
CColor TevColor(ETevOutput Out) const { return mTevColors[int(Out)]; }
|
||||
CTexture* IndTexture() const { return mpIndirectTexture; }
|
||||
bool IsLightingEnabled() const { return mLightingEnabled; }
|
||||
uint32 EchoesUnknownA() const { return mEchoesUnknownA; }
|
||||
uint32 EchoesUnknownB() const { return mEchoesUnknownB; }
|
||||
uint32 PassCount() const { return mPasses.size(); }
|
||||
CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex].get(); }
|
||||
CMaterial* GetNextDrawPass() const { return mpNextDrawPassMaterial.get(); }
|
||||
CMaterial* GetBloomVersion() const { return mpBloomMaterial.get(); }
|
||||
|
||||
inline void SetName(const TString& rkName) { mName = rkName; }
|
||||
inline void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); }
|
||||
inline void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); }
|
||||
inline void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; }
|
||||
inline void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); }
|
||||
inline void SetTevColor(const CColor& Color, ETevOutput Out) { mTevColors[int(Out)] = Color; }
|
||||
inline void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; }
|
||||
inline void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); }
|
||||
void SetName(const TString& rkName) { mName = rkName; }
|
||||
void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); }
|
||||
void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); }
|
||||
void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; }
|
||||
void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); }
|
||||
void SetTevColor(const CColor& Color, ETevOutput Out) { mTevColors[int(Out)] = Color; }
|
||||
void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; }
|
||||
void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); }
|
||||
|
||||
// Static
|
||||
inline static void KillCachedMaterial() { sCurrentMaterial = 0; }
|
||||
static void KillCachedMaterial() { sCurrentMaterial = 0; }
|
||||
};
|
||||
|
||||
#endif // MATERIAL_H
|
||||
|
||||
@@ -72,23 +72,23 @@ public:
|
||||
void SetEnabled(bool Enabled);
|
||||
|
||||
// Getters
|
||||
inline CFourCC Type() const { return mPassType; }
|
||||
inline TString NamedType() const { return PassTypeName(mPassType); }
|
||||
inline ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; }
|
||||
inline ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; }
|
||||
inline ETevOutput ColorOutput() const { return mColorOutput; }
|
||||
inline ETevOutput AlphaOutput() const { return mAlphaOutput; }
|
||||
inline ETevKSel KColorSel() const { return mKColorSel; }
|
||||
inline ETevKSel KAlphaSel() const { return mKAlphaSel; }
|
||||
inline ETevRasSel RasSel() const { return mRasSel; }
|
||||
inline float TevColorScale() const { return mTevColorScale; }
|
||||
inline float TevAlphaScale() const { return mTevAlphaScale; }
|
||||
inline uint32 TexCoordSource() const { return mTexCoordSource; }
|
||||
inline CTexture* Texture() const { return mpTexture; }
|
||||
inline EUVAnimMode AnimMode() const { return mAnimMode; }
|
||||
inline float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; }
|
||||
inline char TexSwapComp(uint32 Comp) const { return mTexSwapComps[Comp]; }
|
||||
inline bool IsEnabled() const { return mEnabled; }
|
||||
CFourCC Type() const { return mPassType; }
|
||||
TString NamedType() const { return PassTypeName(mPassType); }
|
||||
ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; }
|
||||
ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; }
|
||||
ETevOutput ColorOutput() const { return mColorOutput; }
|
||||
ETevOutput AlphaOutput() const { return mAlphaOutput; }
|
||||
ETevKSel KColorSel() const { return mKColorSel; }
|
||||
ETevKSel KAlphaSel() const { return mKAlphaSel; }
|
||||
ETevRasSel RasSel() const { return mRasSel; }
|
||||
float TevColorScale() const { return mTevColorScale; }
|
||||
float TevAlphaScale() const { return mTevAlphaScale; }
|
||||
uint32 TexCoordSource() const { return mTexCoordSource; }
|
||||
CTexture* Texture() const { return mpTexture; }
|
||||
EUVAnimMode AnimMode() const { return mAnimMode; }
|
||||
float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; }
|
||||
char TexSwapComp(uint32 Comp) const { return mTexSwapComps[Comp]; }
|
||||
bool IsEnabled() const { return mEnabled; }
|
||||
|
||||
// Static
|
||||
static TString PassTypeName(CFourCC Type);
|
||||
|
||||
@@ -14,9 +14,8 @@ class CMaterialSet
|
||||
std::vector<std::unique_ptr<CMaterial>> mMaterials;
|
||||
|
||||
public:
|
||||
CMaterialSet() {}
|
||||
|
||||
~CMaterialSet() {}
|
||||
CMaterialSet() = default;
|
||||
~CMaterialSet() = default;
|
||||
|
||||
CMaterialSet* Clone()
|
||||
{
|
||||
@@ -29,7 +28,7 @@ public:
|
||||
return pOut;
|
||||
}
|
||||
|
||||
uint32 NumMaterials()
|
||||
uint32 NumMaterials() const
|
||||
{
|
||||
return mMaterials.size();
|
||||
}
|
||||
|
||||
@@ -22,25 +22,25 @@ private:
|
||||
std::map<uint32,SPoiMap*> mPoiLookupMap;
|
||||
|
||||
public:
|
||||
CPoiToWorld(CResourceEntry *pEntry = 0);
|
||||
~CPoiToWorld();
|
||||
explicit CPoiToWorld(CResourceEntry *pEntry = nullptr);
|
||||
~CPoiToWorld() override;
|
||||
|
||||
void AddPoi(uint32 PoiID);
|
||||
void AddPoiMeshMap(uint32 PoiID, uint32 ModelID);
|
||||
void RemovePoi(uint32 PoiID);
|
||||
void RemovePoiMeshMap(uint32 PoiID, uint32 ModelID);
|
||||
|
||||
inline uint32 NumMappedPOIs() const
|
||||
uint32 NumMappedPOIs() const
|
||||
{
|
||||
return mMaps.size();
|
||||
}
|
||||
|
||||
inline const SPoiMap* MapByIndex(uint32 Index) const
|
||||
const SPoiMap* MapByIndex(uint32 Index) const
|
||||
{
|
||||
return mMaps[Index];
|
||||
}
|
||||
|
||||
inline const SPoiMap* MapByID(uint32 InstanceID) const
|
||||
const SPoiMap* MapByID(uint32 InstanceID) const
|
||||
{
|
||||
auto it = mPoiLookupMap.find(InstanceID);
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
class CResTypeFilter
|
||||
{
|
||||
EGame mGame;
|
||||
EGame mGame = EGame::Invalid;
|
||||
std::set<EResourceType> mAcceptedTypes;
|
||||
|
||||
public:
|
||||
CResTypeFilter() : mGame(EGame::Invalid) { }
|
||||
CResTypeFilter() = default;
|
||||
CResTypeFilter(EGame Game, const TString& rkTypeList) { FromString(Game, rkTypeList); }
|
||||
|
||||
void SetAcceptedTypes(EGame Game, const TStringList& rkTypes)
|
||||
@@ -53,22 +53,22 @@ public:
|
||||
rArc << SerialParameter("AcceptedTypes", mAcceptedTypes, SH_Proxy);
|
||||
}
|
||||
|
||||
inline bool Accepts(EResourceType Type) const
|
||||
bool Accepts(EResourceType Type) const
|
||||
{
|
||||
return mAcceptedTypes.find(Type) != mAcceptedTypes.end();
|
||||
}
|
||||
|
||||
inline bool Accepts(CResTypeInfo *pType) const
|
||||
bool Accepts(CResTypeInfo *pType) const
|
||||
{
|
||||
return pType && Accepts(pType->Type());
|
||||
}
|
||||
|
||||
inline bool Accepts(CResourceEntry *pEntry) const
|
||||
bool Accepts(CResourceEntry *pEntry) const
|
||||
{
|
||||
return pEntry && Accepts(pEntry->ResourceType());
|
||||
}
|
||||
|
||||
inline bool Accepts(const CResTypeFilter& rkFilter) const
|
||||
bool Accepts(const CResTypeFilter& rkFilter) const
|
||||
{
|
||||
for (auto Iter = mAcceptedTypes.begin(); Iter != mAcceptedTypes.end(); Iter++)
|
||||
{
|
||||
@@ -79,12 +79,12 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool operator==(const CResTypeFilter& rkOther) const
|
||||
bool operator==(const CResTypeFilter& rkOther) const
|
||||
{
|
||||
return mAcceptedTypes == rkOther.mAcceptedTypes;
|
||||
}
|
||||
|
||||
inline bool operator!=(const CResTypeFilter& rkOther) const
|
||||
bool operator!=(const CResTypeFilter& rkOther) const
|
||||
{
|
||||
return !(*this == rkOther);
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ public:
|
||||
CFourCC CookedExtension(EGame Game) const;
|
||||
|
||||
// Accessors
|
||||
inline EResourceType Type() const { return mType; }
|
||||
inline TString TypeName() const { return mTypeName; }
|
||||
inline bool CanBeSerialized() const { return mCanBeSerialized; }
|
||||
inline bool CanHaveDependencies() const { return mCanHaveDependencies; }
|
||||
inline bool CanBeCreated() const { return mCanBeCreated; }
|
||||
EResourceType Type() const { return mType; }
|
||||
TString TypeName() const { return mTypeName; }
|
||||
bool CanBeSerialized() const { return mCanBeSerialized; }
|
||||
bool CanHaveDependencies() const { return mCanHaveDependencies; }
|
||||
bool CanBeCreated() const { return mCanBeCreated; }
|
||||
|
||||
// Static
|
||||
static void GetAllTypesInGame(EGame Game, std::list<CResTypeInfo*>& rOut);
|
||||
|
||||
@@ -32,11 +32,11 @@ class CResource
|
||||
DECLARE_RESOURCE_TYPE(Resource)
|
||||
|
||||
CResourceEntry *mpEntry;
|
||||
int mRefCount;
|
||||
int mRefCount = 0;
|
||||
|
||||
public:
|
||||
CResource(CResourceEntry *pEntry = 0)
|
||||
: mpEntry(pEntry), mRefCount(0)
|
||||
explicit CResource(CResourceEntry *pEntry = nullptr)
|
||||
: mpEntry(pEntry)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -44,17 +44,17 @@ public:
|
||||
virtual CDependencyTree* BuildDependencyTree() const { return new CDependencyTree(); }
|
||||
virtual void Serialize(IArchive& /*rArc*/) {}
|
||||
virtual void InitializeNewResource() {}
|
||||
|
||||
inline CResourceEntry* Entry() const { return mpEntry; }
|
||||
inline CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); }
|
||||
inline EResourceType Type() const { return mpEntry->TypeInfo()->Type(); }
|
||||
inline TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
|
||||
inline TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
|
||||
inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
|
||||
inline EGame Game() const { return mpEntry ? mpEntry->Game() : EGame::Invalid; }
|
||||
inline bool IsReferenced() const { return mRefCount > 0; }
|
||||
inline void Lock() { mRefCount++; }
|
||||
inline void Release() { mRefCount--; }
|
||||
|
||||
CResourceEntry* Entry() const { return mpEntry; }
|
||||
CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); }
|
||||
EResourceType Type() const { return mpEntry->TypeInfo()->Type(); }
|
||||
TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
|
||||
TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
|
||||
CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
|
||||
EGame Game() const { return mpEntry ? mpEntry->Game() : EGame::Invalid; }
|
||||
bool IsReferenced() const { return mRefCount > 0; }
|
||||
void Lock() { mRefCount++; }
|
||||
void Release() { mRefCount--; }
|
||||
};
|
||||
|
||||
#endif // CRESOURCE_H
|
||||
|
||||
@@ -21,13 +21,13 @@ public:
|
||||
m[1] = Part2;
|
||||
}
|
||||
|
||||
CSavedStateID(IInputStream& rInput)
|
||||
explicit CSavedStateID(IInputStream& rInput)
|
||||
{
|
||||
m[0] = rInput.ReadLongLong();
|
||||
m[1] = rInput.ReadLongLong();
|
||||
}
|
||||
|
||||
TString ToString()
|
||||
TString ToString() const
|
||||
{
|
||||
uint32 Part1 = (m[0] >> 32) & 0xFFFFFFFF;
|
||||
uint32 Part2 = (m[0] >> 16) & 0x0000FFFF;
|
||||
@@ -61,17 +61,17 @@ public:
|
||||
}
|
||||
|
||||
// Operators
|
||||
inline bool operator==(const CSavedStateID& rkOther)
|
||||
bool operator==(const CSavedStateID& rkOther) const
|
||||
{
|
||||
return (m[0] == rkOther.m[0] && m[1] == rkOther.m[1]);
|
||||
}
|
||||
|
||||
inline bool operator!=(const CSavedStateID& rkOther)
|
||||
bool operator!=(const CSavedStateID& rkOther) const
|
||||
{
|
||||
return !(*this == rkOther);
|
||||
}
|
||||
|
||||
inline bool operator<(const CSavedStateID& rkOther)
|
||||
bool operator<(const CSavedStateID& rkOther) const
|
||||
{
|
||||
return (m[0] == rkOther.m[0] ? m[1] < rkOther.m[1] : m[0] < rkOther.m[0]);
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ class CStringList : public CResource
|
||||
std::vector<TString> mStringList;
|
||||
|
||||
public:
|
||||
CStringList(CResourceEntry *pEntry = 0)
|
||||
explicit CStringList(CResourceEntry *pEntry = nullptr)
|
||||
: CResource(pEntry)
|
||||
{}
|
||||
|
||||
inline uint32 NumStrings() const
|
||||
uint32 NumStrings() const
|
||||
{
|
||||
return mStringList.size();
|
||||
}
|
||||
|
||||
inline TString StringByIndex(uint32 Index) const
|
||||
TString StringByIndex(uint32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < mStringList.size());
|
||||
return mStringList[Index];
|
||||
|
||||
@@ -1,34 +1,16 @@
|
||||
#include "CTexture.h"
|
||||
#include <cmath>
|
||||
|
||||
CTexture::CTexture(CResourceEntry *pEntry /*= 0*/)
|
||||
CTexture::CTexture(CResourceEntry *pEntry)
|
||||
: CResource(pEntry)
|
||||
, mTexelFormat(ETexelFormat::RGBA8)
|
||||
, mSourceTexelFormat(ETexelFormat::RGBA8)
|
||||
, mWidth(0)
|
||||
, mHeight(0)
|
||||
, mNumMipMaps(0)
|
||||
, mLinearSize(0)
|
||||
, mEnableMultisampling(false)
|
||||
, mBufferExists(false)
|
||||
, mpImgDataBuffer(nullptr)
|
||||
, mImgDataSize(0)
|
||||
, mGLBufferExists(false)
|
||||
{
|
||||
}
|
||||
|
||||
CTexture::CTexture(uint32 Width, uint32 Height)
|
||||
: mTexelFormat(ETexelFormat::RGBA8)
|
||||
, mSourceTexelFormat(ETexelFormat::RGBA8)
|
||||
, mWidth((uint16) Width)
|
||||
, mHeight((uint16) Height)
|
||||
: mWidth(static_cast<uint16>(Width))
|
||||
, mHeight(static_cast<uint16>(Height))
|
||||
, mNumMipMaps(1)
|
||||
, mLinearSize(Width * Height * 4)
|
||||
, mEnableMultisampling(false)
|
||||
, mBufferExists(false)
|
||||
, mpImgDataBuffer(nullptr)
|
||||
, mImgDataSize(0)
|
||||
, mGLBufferExists(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -15,22 +15,23 @@ class CTexture : public CResource
|
||||
friend class CTextureDecoder;
|
||||
friend class CTextureEncoder;
|
||||
|
||||
ETexelFormat mTexelFormat; // Format of decoded image data
|
||||
ETexelFormat mSourceTexelFormat; // Format of input TXTR file
|
||||
uint16 mWidth, mHeight; // Image dimensions
|
||||
uint32 mNumMipMaps; // The number of mipmaps this texture has
|
||||
uint32 mLinearSize; // The size of the top level mipmap, in bytes
|
||||
ETexelFormat mTexelFormat{ETexelFormat::RGBA8}; // Format of decoded image data
|
||||
ETexelFormat mSourceTexelFormat{ETexelFormat::RGBA8}; // Format of input TXTR file
|
||||
uint16 mWidth = 0; // Image width
|
||||
uint16 mHeight = 0; // Image height
|
||||
uint32 mNumMipMaps = 0; // The number of mipmaps this texture has
|
||||
uint32 mLinearSize = 0; // The size of the top level mipmap, in bytes
|
||||
|
||||
bool mEnableMultisampling; // Whether multisample should be enabled (if this texture is a render target).
|
||||
bool mBufferExists; // Indicates whether image data buffer has valid data
|
||||
uint8 *mpImgDataBuffer; // Pointer to image data buffer
|
||||
uint32 mImgDataSize; // Size of image data buffer
|
||||
bool mEnableMultisampling = false; // Whether multisample should be enabled (if this texture is a render target).
|
||||
bool mBufferExists = false; // Indicates whether image data buffer has valid data
|
||||
uint8 *mpImgDataBuffer = nullptr; // Pointer to image data buffer
|
||||
uint32 mImgDataSize = 0; // Size of image data buffer
|
||||
|
||||
bool mGLBufferExists; // Indicates whether GL buffer has valid data
|
||||
GLuint mTextureID; // ID for texture GL buffer
|
||||
bool mGLBufferExists = false; // Indicates whether GL buffer has valid data
|
||||
GLuint mTextureID = 0; // ID for texture GL buffer
|
||||
|
||||
public:
|
||||
CTexture(CResourceEntry *pEntry = 0);
|
||||
explicit CTexture(CResourceEntry *pEntry = nullptr);
|
||||
CTexture(uint32 Width, uint32 Height);
|
||||
~CTexture();
|
||||
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
uint32 NumMipMaps() const { return mNumMipMaps; }
|
||||
GLuint TextureID() const { return mTextureID; }
|
||||
|
||||
inline void SetMultisamplingEnabled(bool Enable)
|
||||
void SetMultisamplingEnabled(bool Enable)
|
||||
{
|
||||
if (mEnableMultisampling != Enable)
|
||||
DeleteBuffers();
|
||||
|
||||
@@ -87,17 +87,17 @@ class CWorld : public CResource
|
||||
std::vector<SArea> mAreas;
|
||||
|
||||
public:
|
||||
CWorld(CResourceEntry *pEntry = 0);
|
||||
explicit CWorld(CResourceEntry *pEntry = nullptr);
|
||||
~CWorld();
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const;
|
||||
CDependencyTree* BuildDependencyTree() const override;
|
||||
void SetAreaLayerInfo(CGameArea *pArea);
|
||||
TString InGameName() const;
|
||||
TString AreaInGameName(uint32 AreaIndex) const;
|
||||
uint32 AreaIndex(CAssetID AreaID) const;
|
||||
|
||||
// Serialization
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
void Serialize(IArchive& rArc) override;
|
||||
friend void Serialize(IArchive& rArc, STimeAttackData& rTimeAttackData);
|
||||
friend void Serialize(IArchive& rArc, SMemoryRelay& rMemRelay);
|
||||
friend void Serialize(IArchive& rArc, SArea& rArea);
|
||||
@@ -107,23 +107,23 @@ public:
|
||||
friend void Serialize(IArchive& rArc, SAudioGrp& rAudioGrp);
|
||||
|
||||
// Accessors
|
||||
inline TString Name() const { return mName; }
|
||||
inline CStringTable* NameString() const { return mpWorldName; }
|
||||
inline CStringTable* DarkNameString() const { return mpDarkWorldName; }
|
||||
inline CResource* SaveWorld() const { return mpSaveWorld; }
|
||||
inline CModel* DefaultSkybox() const { return mpDefaultSkybox; }
|
||||
inline CResource* MapWorld() const { return mpMapWorld; }
|
||||
TString Name() const { return mName; }
|
||||
CStringTable* NameString() const { return mpWorldName; }
|
||||
CStringTable* DarkNameString() const { return mpDarkWorldName; }
|
||||
CResource* SaveWorld() const { return mpSaveWorld; }
|
||||
CModel* DefaultSkybox() const { return mpDefaultSkybox; }
|
||||
CResource* MapWorld() const { return mpMapWorld; }
|
||||
|
||||
inline uint32 NumAreas() const { return mAreas.size(); }
|
||||
inline CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; }
|
||||
inline uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); }
|
||||
inline uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; }
|
||||
inline TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; }
|
||||
inline CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; }
|
||||
inline bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; }
|
||||
uint32 NumAreas() const { return mAreas.size(); }
|
||||
CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; }
|
||||
uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); }
|
||||
uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; }
|
||||
TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; }
|
||||
CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; }
|
||||
bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; }
|
||||
|
||||
inline void SetName(const TString& rkName) { mName = rkName; }
|
||||
inline void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; }
|
||||
void SetName(const TString& rkName) { mName = rkName; }
|
||||
void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; }
|
||||
};
|
||||
|
||||
#endif // CWORLD_H
|
||||
|
||||
@@ -11,12 +11,12 @@ class CCollidableOBBTree : public CCollisionMesh
|
||||
std::unique_ptr<SOBBTreeNode> mpOBBTree;
|
||||
|
||||
public:
|
||||
virtual void BuildRenderData() override;
|
||||
void BuildRenderData() override;
|
||||
|
||||
void BuildOBBTree();
|
||||
|
||||
/** Accessors */
|
||||
inline SOBBTreeNode* GetOBBTree() const
|
||||
SOBBTreeNode* GetOBBTree() const
|
||||
{
|
||||
return mpOBBTree.get();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
bool IsFloor() const;
|
||||
bool IsUnstandable(EGame Game) const;
|
||||
|
||||
inline uint64 RawFlags() const { return mRawFlags; }
|
||||
uint64 RawFlags() const { return mRawFlags; }
|
||||
};
|
||||
|
||||
#endif // CCOLLISIONMATERIAL
|
||||
|
||||
@@ -21,22 +21,22 @@ public:
|
||||
virtual void BuildRenderData();
|
||||
|
||||
/** Accessors */
|
||||
inline CAABox Bounds() const
|
||||
CAABox Bounds() const
|
||||
{
|
||||
return mAABox;
|
||||
}
|
||||
|
||||
inline const SCollisionIndexData& GetIndexData() const
|
||||
const SCollisionIndexData& GetIndexData() const
|
||||
{
|
||||
return mIndexData;
|
||||
}
|
||||
|
||||
inline const CCollisionRenderData& GetRenderData() const
|
||||
const CCollisionRenderData& GetRenderData() const
|
||||
{
|
||||
return mRenderData;
|
||||
}
|
||||
|
||||
inline CCollisionRenderData& GetRenderData()
|
||||
CCollisionRenderData& GetRenderData()
|
||||
{
|
||||
return mRenderData;
|
||||
}
|
||||
|
||||
@@ -21,23 +21,23 @@ public:
|
||||
delete *it;
|
||||
}
|
||||
|
||||
inline uint32 NumMeshes() const { return mMeshes.size(); }
|
||||
inline CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; }
|
||||
inline void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); }
|
||||
uint32 NumMeshes() const { return mMeshes.size(); }
|
||||
CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; }
|
||||
void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); }
|
||||
|
||||
inline void BuildRenderData()
|
||||
void BuildRenderData()
|
||||
{
|
||||
for (auto It = mMeshes.begin(); It != mMeshes.end(); It++)
|
||||
(*It)->BuildRenderData();
|
||||
}
|
||||
|
||||
inline void Draw()
|
||||
void Draw()
|
||||
{
|
||||
for (auto it = mMeshes.begin(); it != mMeshes.end(); it++)
|
||||
(*it)->GetRenderData().Render(false);
|
||||
}
|
||||
|
||||
inline void DrawWireframe()
|
||||
void DrawWireframe()
|
||||
{
|
||||
for (auto it = mMeshes.begin(); it != mMeshes.end(); it++)
|
||||
(*it)->GetRenderData().Render(true);
|
||||
|
||||
@@ -30,17 +30,13 @@ class CCollisionRenderData
|
||||
std::vector<uint> mBoundingDepthOffsets;
|
||||
|
||||
/** Whether render data has been built */
|
||||
bool mBuilt;
|
||||
bool mBuilt = false;
|
||||
|
||||
/** Whether bounding hierarchy render data has been built */
|
||||
bool mBoundingHierarchyBuilt;
|
||||
bool mBoundingHierarchyBuilt = false;
|
||||
|
||||
public:
|
||||
/** Default constructor */
|
||||
CCollisionRenderData()
|
||||
: mBuilt(false)
|
||||
, mBoundingHierarchyBuilt(false)
|
||||
{}
|
||||
CCollisionRenderData() = default;
|
||||
|
||||
/** Build from collision data */
|
||||
void BuildRenderData(const SCollisionIndexData& kIndexData);
|
||||
@@ -52,7 +48,7 @@ public:
|
||||
int MaxBoundingHierarchyDepth() const;
|
||||
|
||||
/** Accessors */
|
||||
inline bool IsBuilt() const { return mBuilt; }
|
||||
bool IsBuilt() const { return mBuilt; }
|
||||
};
|
||||
|
||||
#endif // CCOLLISIONRENDERDATA_H
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
class CPoiToWorldCooker
|
||||
{
|
||||
CPoiToWorldCooker() {}
|
||||
CPoiToWorldCooker() = default;
|
||||
|
||||
public:
|
||||
static bool CookEGMC(CPoiToWorld *pPoiToWorld, IOutputStream& rOut);
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
class CResourceCooker
|
||||
{
|
||||
CResourceCooker() {}
|
||||
CResourceCooker() = default;
|
||||
|
||||
public:
|
||||
static bool CookResource(CResourceEntry *pEntry, IOutputStream& rOutput)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/** Cooker class for writing game-compatible SCAN assets */
|
||||
class CScanCooker
|
||||
{
|
||||
CScanCooker() {}
|
||||
CScanCooker() = default;
|
||||
|
||||
public:
|
||||
static bool CookSCAN(CScan* pScan, IOutputStream& SCAN);
|
||||
|
||||
@@ -14,7 +14,7 @@ class CScriptCooker
|
||||
bool mWriteGeneratedSeparately;
|
||||
|
||||
public:
|
||||
CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true)
|
||||
explicit CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true)
|
||||
: mGame(Game)
|
||||
, mWriteGeneratedSeparately(WriteGeneratedObjectsSeparately && mGame >= EGame::EchoesDemo)
|
||||
{}
|
||||
|
||||
@@ -8,17 +8,13 @@
|
||||
// Small class to manage file sections for CMDL/MREA output
|
||||
class CSectionMgrOut
|
||||
{
|
||||
uint32 mSectionCount;
|
||||
uint32 mCurSectionStart;
|
||||
uint32 mCurSectionIndex;
|
||||
uint32 mSectionCount = 0;
|
||||
uint32 mCurSectionStart = 0;
|
||||
uint32 mCurSectionIndex = 0;
|
||||
std::vector<uint32> mSectionSizes;
|
||||
|
||||
public:
|
||||
CSectionMgrOut()
|
||||
: mSectionCount(0)
|
||||
, mCurSectionStart(0)
|
||||
, mCurSectionIndex(0)
|
||||
{}
|
||||
CSectionMgrOut() = default;
|
||||
|
||||
void SetSectionCount(uint32 Count)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ class CStringCooker
|
||||
{
|
||||
TResPtr<CStringTable> mpStringTable;
|
||||
|
||||
CStringCooker(CStringTable* pStringTable)
|
||||
explicit CStringCooker(CStringTable* pStringTable)
|
||||
: mpStringTable(pStringTable) {}
|
||||
|
||||
public:
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "CTextureEncoder.h"
|
||||
#include <Common/Log.h>
|
||||
|
||||
CTextureEncoder::CTextureEncoder()
|
||||
: mpTexture(nullptr)
|
||||
{
|
||||
}
|
||||
CTextureEncoder::CTextureEncoder() = default;
|
||||
|
||||
void CTextureEncoder::WriteTXTR(IOutputStream& rTXTR)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
// More advanced functions (including actual encoding!) coming later
|
||||
class CTextureEncoder
|
||||
{
|
||||
TResPtr<CTexture> mpTexture;
|
||||
ETexelFormat mSourceFormat;
|
||||
ETexelFormat mOutputFormat;
|
||||
TResPtr<CTexture> mpTexture{nullptr};
|
||||
ETexelFormat mSourceFormat{};
|
||||
ETexelFormat mOutputFormat{};
|
||||
|
||||
CTextureEncoder();
|
||||
void WriteTXTR(IOutputStream& rTXTR);
|
||||
|
||||
@@ -8,7 +8,7 @@ class CPoiToWorldLoader
|
||||
{
|
||||
TResPtr<CPoiToWorld> mpPoiToWorld;
|
||||
|
||||
CPoiToWorldLoader() {}
|
||||
CPoiToWorldLoader() = default;
|
||||
|
||||
public:
|
||||
static CPoiToWorld* LoadEGMC(IInputStream& rEGMC, CResourceEntry *pEntry);
|
||||
|
||||
@@ -8,7 +8,7 @@ class CScanLoader
|
||||
{
|
||||
TResPtr<CScan> mpScan;
|
||||
|
||||
CScanLoader() {}
|
||||
CScanLoader() = default;
|
||||
CScan* LoadScanMP1(IInputStream& SCAN, CResourceEntry* pEntry);
|
||||
CScan* LoadScanMP2(IInputStream& SCAN, CResourceEntry* pEntry);
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ class CSectionMgrIn
|
||||
{
|
||||
IInputStream *mpInputStream;
|
||||
std::vector<uint32> mSectionSizes;
|
||||
uint32 mCurSec;
|
||||
uint32 mCurSecStart;
|
||||
uint32 mSecsStart;
|
||||
uint32 mCurSec = 0;
|
||||
uint32 mCurSecStart = 0;
|
||||
uint32 mSecsStart = 0;
|
||||
|
||||
public:
|
||||
CSectionMgrIn(uint32 Count, IInputStream* pSrc)
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
mSectionSizes[iSec] = pSrc->ReadLong();
|
||||
}
|
||||
|
||||
inline void Init()
|
||||
void Init()
|
||||
{
|
||||
// Initializes the block manager and marks the start of the first block
|
||||
mCurSec = 0;
|
||||
@@ -43,18 +43,18 @@ public:
|
||||
mCurSecStart = mpInputStream->Tell();
|
||||
}
|
||||
|
||||
inline void ToNextSection()
|
||||
void ToNextSection()
|
||||
{
|
||||
mCurSecStart += mSectionSizes[mCurSec];
|
||||
mpInputStream->Seek(mCurSecStart, SEEK_SET);
|
||||
mCurSec++;
|
||||
}
|
||||
|
||||
inline uint32 NextOffset() { return mCurSecStart + mSectionSizes[mCurSec]; }
|
||||
inline uint32 CurrentSection() { return mCurSec; }
|
||||
inline uint32 CurrentSectionSize() { return mSectionSizes[mCurSec]; }
|
||||
inline uint32 NumSections() { return mSectionSizes.size(); }
|
||||
inline void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; }
|
||||
uint32 NextOffset() const { return mCurSecStart + mSectionSizes[mCurSec]; }
|
||||
uint32 CurrentSection() const { return mCurSec; }
|
||||
uint32 CurrentSectionSize() const { return mSectionSizes[mCurSec]; }
|
||||
uint32 NumSections() const { return mSectionSizes.size(); }
|
||||
void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; }
|
||||
};
|
||||
|
||||
#endif // CSECTIONMGRIN_H
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
class CSkeletonLoader
|
||||
{
|
||||
TResPtr<CSkeleton> mpSkeleton;
|
||||
EGame mVersion;
|
||||
EGame mVersion{};
|
||||
|
||||
CSkeletonLoader() {}
|
||||
CSkeletonLoader() = default;
|
||||
void SetLocalBoneCoords(CBone *pBone);
|
||||
void CalculateBoneInverseBindMatrices();
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
class CSkinLoader
|
||||
{
|
||||
CSkinLoader() {}
|
||||
CSkinLoader() = default;
|
||||
|
||||
public:
|
||||
static CSkin* LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry);
|
||||
};
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
class CStringLoader
|
||||
{
|
||||
CStringTable *mpStringTable;
|
||||
EGame mVersion;
|
||||
CStringTable *mpStringTable = nullptr;
|
||||
EGame mVersion{};
|
||||
|
||||
CStringLoader() {}
|
||||
CStringLoader() = default;
|
||||
void LoadPrimeDemoSTRG(IInputStream& STRG);
|
||||
void LoadPrimeSTRG(IInputStream& STRG);
|
||||
void LoadCorruptionSTRG(IInputStream& STRG);
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
// This is needed so we have access to the full dependency list of all resource types.
|
||||
class CUnsupportedFormatLoader
|
||||
{
|
||||
CDependencyGroup *mpGroup;
|
||||
CUnsupportedFormatLoader() {}
|
||||
CDependencyGroup *mpGroup = nullptr;
|
||||
CUnsupportedFormatLoader() = default;
|
||||
|
||||
static void PerformCheating(IInputStream& rFile, EGame Game, std::list<CAssetID>& rAssetList);
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
// Used for finding dependencies. Split from CUnsupportedFormatLoader for being too big.
|
||||
class CUnsupportedParticleLoader
|
||||
{
|
||||
CDependencyGroup *mpGroup;
|
||||
CUnsupportedParticleLoader() {}
|
||||
CDependencyGroup *mpGroup = nullptr;
|
||||
CUnsupportedParticleLoader() = default;
|
||||
|
||||
// Format-Specific Parameter Loading
|
||||
bool ParseParticleParameter(IInputStream& rPART);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class CWorldLoader
|
||||
{
|
||||
TResPtr<CWorld> mpWorld;
|
||||
EGame mVersion;
|
||||
EGame mVersion{};
|
||||
|
||||
CWorldLoader();
|
||||
void LoadPrimeMLVL(IInputStream& rMLVL);
|
||||
|
||||
@@ -21,14 +21,14 @@ class CModel : public CBasicModel
|
||||
bool mHasOwnMaterials;
|
||||
|
||||
public:
|
||||
CModel(CResourceEntry *pEntry = 0);
|
||||
explicit CModel(CResourceEntry *pEntry = nullptr);
|
||||
CModel(CMaterialSet *pSet, bool OwnsMatSet);
|
||||
~CModel();
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const;
|
||||
CDependencyTree* BuildDependencyTree() const override;
|
||||
void BufferGL();
|
||||
void GenerateMaterialShaders();
|
||||
void ClearGLBuffer();
|
||||
void ClearGLBuffer() override;
|
||||
void Draw(FRenderOptions Options, uint32 MatSet);
|
||||
void DrawSurface(FRenderOptions Options, uint32 Surface, uint32 MatSet);
|
||||
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
bool IsSurfaceTransparent(uint32 Surface, uint32 MatSet);
|
||||
bool IsLightmapped() const;
|
||||
|
||||
inline bool IsSkinned() const { return (mpSkin != nullptr); }
|
||||
bool IsSkinned() const { return (mpSkin != nullptr); }
|
||||
|
||||
private:
|
||||
CIndexBuffer* InternalGetIBO(uint32 Surface, EPrimitiveType Primitive);
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
CStaticModel::CStaticModel()
|
||||
: CBasicModel(nullptr)
|
||||
, mpMaterial(nullptr)
|
||||
, mTransparent(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,9 +15,7 @@ CStaticModel::CStaticModel(CMaterial *pMat)
|
||||
{
|
||||
}
|
||||
|
||||
CStaticModel::~CStaticModel()
|
||||
{
|
||||
}
|
||||
CStaticModel::~CStaticModel() = default;
|
||||
|
||||
void CStaticModel::AddSurface(SSurface *pSurface)
|
||||
{
|
||||
@@ -213,12 +209,12 @@ void CStaticModel::SetMaterial(CMaterial *pMat)
|
||||
mTransparent = pMat->Options().HasFlag(EMaterialOption::Transparent);
|
||||
}
|
||||
|
||||
bool CStaticModel::IsTransparent()
|
||||
bool CStaticModel::IsTransparent() const
|
||||
{
|
||||
return mTransparent;
|
||||
}
|
||||
|
||||
bool CStaticModel::IsOccluder()
|
||||
bool CStaticModel::IsOccluder() const
|
||||
{
|
||||
return mpMaterial->Options().HasFlag(EMaterialOption::Occluder);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
* IBOs. This allows for a significantly reduced number of draw calls. */
|
||||
class CStaticModel : public CBasicModel
|
||||
{
|
||||
CMaterial *mpMaterial;
|
||||
CMaterial *mpMaterial = nullptr;
|
||||
std::vector<CIndexBuffer> mIBOs;
|
||||
std::vector<std::vector<uint32>> mSurfaceEndOffsets;
|
||||
bool mTransparent;
|
||||
bool mTransparent = false;
|
||||
|
||||
public:
|
||||
CStaticModel();
|
||||
CStaticModel(CMaterial *pMat);
|
||||
explicit CStaticModel(CMaterial *pMat);
|
||||
~CStaticModel();
|
||||
void AddSurface(SSurface *pSurface);
|
||||
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
|
||||
CMaterial* GetMaterial();
|
||||
void SetMaterial(CMaterial *pMat);
|
||||
bool IsTransparent();
|
||||
bool IsOccluder();
|
||||
bool IsTransparent() const;
|
||||
bool IsOccluder() const;
|
||||
|
||||
private:
|
||||
CIndexBuffer* InternalGetIBO(EPrimitiveType Primitive);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include <Common/Math/CVector3f.h>
|
||||
#include <array>
|
||||
|
||||
typedef std::array<uint8, 4> TBoneIndices;
|
||||
typedef std::array<float, 4> TBoneWeights;
|
||||
using TBoneIndices = std::array<uint8, 4>;
|
||||
using TBoneWeights = std::array<float, 4>;
|
||||
|
||||
class CVertex
|
||||
{
|
||||
@@ -24,12 +24,11 @@ public:
|
||||
|
||||
CVertex() {}
|
||||
|
||||
CVertex(const CVector3f& rPos)
|
||||
CVertex(const CVector3f& rPos) : Position{rPos}
|
||||
{
|
||||
Position = rPos;
|
||||
}
|
||||
|
||||
bool operator==(const CVertex& rkOther) {
|
||||
bool operator==(const CVertex& rkOther) const {
|
||||
return ((Position == rkOther.Position) &&
|
||||
(Normal == rkOther.Normal) &&
|
||||
(Color[0] == rkOther.Color[0]) &&
|
||||
@@ -45,6 +44,11 @@ public:
|
||||
(BoneIndices == rkOther.BoneIndices) &&
|
||||
(BoneWeights == rkOther.BoneWeights));
|
||||
}
|
||||
|
||||
bool operator!=(const CVertex& other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CVERTEX_H
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
// Should prolly be a class
|
||||
struct SSurface
|
||||
{
|
||||
uint32 VertexCount;
|
||||
uint32 TriangleCount;
|
||||
uint32 VertexCount = 0;
|
||||
uint32 TriangleCount = 0;
|
||||
CAABox AABox;
|
||||
CVector3f CenterPoint;
|
||||
uint32 MaterialID;
|
||||
uint32 MaterialID = 0;
|
||||
CVector3f ReflectionDirection;
|
||||
uint16 MeshID;
|
||||
uint16 MeshID = 0;
|
||||
|
||||
struct SPrimitive
|
||||
{
|
||||
@@ -30,11 +30,7 @@ struct SSurface
|
||||
};
|
||||
std::vector<SPrimitive> Primitives;
|
||||
|
||||
SSurface()
|
||||
{
|
||||
VertexCount = 0;
|
||||
TriangleCount = 0;
|
||||
}
|
||||
SSurface() = default;
|
||||
|
||||
std::pair<bool,float> IntersectsRay(const CRay& rkRay, bool AllowBackfaces = false, float LineThreshold = 0.02f);
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ class CScan : public CResource
|
||||
std::vector<uint8> mPropertyData;
|
||||
|
||||
public:
|
||||
CScan(CResourceEntry* pEntry = 0);
|
||||
explicit CScan(CResourceEntry* pEntry = nullptr);
|
||||
CStructRef ScanData() const;
|
||||
|
||||
/** Convenience property accessors */
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
CBoolRef IsCriticalPropertyRef() const;
|
||||
|
||||
/** CResource interface */
|
||||
virtual CDependencyTree* BuildDependencyTree() const override;
|
||||
CDependencyTree* BuildDependencyTree() const override;
|
||||
};
|
||||
|
||||
#endif // CSCAN_H
|
||||
|
||||
@@ -19,12 +19,12 @@ struct SObjId
|
||||
CFourCC ID_4CC;
|
||||
};
|
||||
|
||||
inline SObjId() {}
|
||||
inline SObjId(uint32 InID) : ID(InID) {}
|
||||
inline SObjId(CFourCC InID) : ID_4CC(InID) {}
|
||||
SObjId() {}
|
||||
SObjId(uint32 InID) : ID(InID) {}
|
||||
SObjId(CFourCC InID) : ID_4CC(InID) {}
|
||||
|
||||
inline operator uint32() const { return ID; }
|
||||
inline operator CFourCC() const { return ID_4CC; }
|
||||
operator uint32() const { return ID; }
|
||||
operator CFourCC() const { return ID_4CC; }
|
||||
|
||||
void Serialize(IArchive& Arc)
|
||||
{
|
||||
@@ -61,8 +61,8 @@ struct TTemplatePath
|
||||
}
|
||||
};
|
||||
|
||||
typedef TTemplatePath<CScriptTemplate> SScriptTemplatePath;
|
||||
typedef TTemplatePath<IProperty> SPropertyTemplatePath;
|
||||
using SScriptTemplatePath = TTemplatePath<CScriptTemplate>;
|
||||
using SPropertyTemplatePath = TTemplatePath<IProperty>;
|
||||
|
||||
/** CGameTemplate - Per-game template data */
|
||||
class CGameTemplate
|
||||
@@ -106,12 +106,12 @@ public:
|
||||
CScriptTemplate* FindMiscTemplate(const TString& kTemplateName);
|
||||
TString GetGameDirectory() const;
|
||||
|
||||
// Inline Accessors
|
||||
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; }
|
||||
// Accessors
|
||||
EGame Game() const { return mGame; }
|
||||
uint32 NumScriptTemplates() const { return mScriptTemplates.size(); }
|
||||
uint32 NumStates() const { return mStates.size(); }
|
||||
uint32 NumMessages() const { return mMessages.size(); }
|
||||
bool IsLoadedSuccessfully() const { return mFullyLoaded; }
|
||||
};
|
||||
|
||||
#endif // CGAMETEMPLATE_H
|
||||
|
||||
@@ -63,18 +63,14 @@ struct SMessage
|
||||
class CLink
|
||||
{
|
||||
CGameArea *mpArea;
|
||||
uint32 mStateID;
|
||||
uint32 mMessageID;
|
||||
uint32 mSenderID;
|
||||
uint32 mReceiverID;
|
||||
uint32 mStateID = UINT32_MAX;
|
||||
uint32 mMessageID = UINT32_MAX;
|
||||
uint32 mSenderID = UINT32_MAX;
|
||||
uint32 mReceiverID = UINT32_MAX;
|
||||
|
||||
public:
|
||||
CLink(CGameArea *pArea)
|
||||
: mpArea(pArea)
|
||||
, mStateID(-1)
|
||||
, mMessageID(-1)
|
||||
, mSenderID(-1)
|
||||
, mReceiverID(-1)
|
||||
{}
|
||||
|
||||
CLink(CGameArea *pArea, uint32 StateID, uint32 MessageID, uint32 SenderID, uint32 ReceiverID)
|
||||
@@ -140,31 +136,31 @@ public:
|
||||
}
|
||||
|
||||
// Operators
|
||||
bool operator==(const CLink& rkOther)
|
||||
bool operator==(const CLink& rkOther) const
|
||||
{
|
||||
return ( (mpArea == rkOther.mpArea) &&
|
||||
(mStateID == rkOther.mStateID) &&
|
||||
(mMessageID == rkOther.mMessageID) &&
|
||||
(mSenderID == rkOther.mSenderID) &&
|
||||
(mReceiverID == rkOther.mReceiverID) );
|
||||
return (mpArea == rkOther.mpArea) &&
|
||||
(mStateID == rkOther.mStateID) &&
|
||||
(mMessageID == rkOther.mMessageID) &&
|
||||
(mSenderID == rkOther.mSenderID) &&
|
||||
(mReceiverID == rkOther.mReceiverID);
|
||||
}
|
||||
|
||||
bool operator!=(const CLink& rkOther)
|
||||
bool operator!=(const CLink& rkOther) const
|
||||
{
|
||||
return (!(*this == rkOther));
|
||||
}
|
||||
|
||||
// Accessors
|
||||
inline CGameArea* Area() const { return mpArea; }
|
||||
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); }
|
||||
CGameArea* Area() const { return mpArea; }
|
||||
uint32 State() const { return mStateID; }
|
||||
uint32 Message() const { return mMessageID; }
|
||||
uint32 SenderID() const { return mSenderID; }
|
||||
uint32 ReceiverID() const { return mReceiverID; }
|
||||
CScriptObject* Sender() const { return mpArea->InstanceByID(mSenderID); }
|
||||
CScriptObject* Receiver() const { return mpArea->InstanceByID(mReceiverID); }
|
||||
|
||||
inline void SetState(uint32 StateID) { mStateID = StateID; }
|
||||
inline void SetMessage(uint32 MessageID) { mMessageID = MessageID; }
|
||||
void SetState(uint32 StateID) { mStateID = StateID; }
|
||||
void SetMessage(uint32 MessageID) { mMessageID = MessageID; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -11,15 +11,13 @@ class CScriptLayer
|
||||
{
|
||||
CGameArea *mpArea;
|
||||
TString mLayerName;
|
||||
bool mActive;
|
||||
bool mVisible;
|
||||
bool mActive = true;
|
||||
bool mVisible = true;
|
||||
std::vector<CScriptObject*> mInstances;
|
||||
public:
|
||||
CScriptLayer(CGameArea *pArea)
|
||||
: mpArea(pArea)
|
||||
, mLayerName("New Layer")
|
||||
, mActive(true)
|
||||
, mVisible(true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,14 +76,14 @@ public:
|
||||
}
|
||||
|
||||
// Accessors
|
||||
inline CGameArea* Area() const { return mpArea; }
|
||||
inline TString Name() const { return mLayerName; }
|
||||
inline bool IsActive() const { return mActive; }
|
||||
inline bool IsVisible() const { return mVisible; }
|
||||
inline uint32 NumInstances() const { return mInstances.size(); }
|
||||
inline CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; }
|
||||
CGameArea* Area() const { return mpArea; }
|
||||
TString Name() const { return mLayerName; }
|
||||
bool IsActive() const { return mActive; }
|
||||
bool IsVisible() const { return mVisible; }
|
||||
uint32 NumInstances() const { return mInstances.size(); }
|
||||
CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; }
|
||||
|
||||
inline CScriptObject* InstanceByID(uint32 ID) const
|
||||
CScriptObject* InstanceByID(uint32 ID) const
|
||||
{
|
||||
for (auto it = mInstances.begin(); it != mInstances.end(); it++)
|
||||
{
|
||||
@@ -96,11 +94,11 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline void SetName(const TString& rkName) { mLayerName = rkName; }
|
||||
inline void SetActive(bool Active) { mActive = Active; }
|
||||
inline void SetVisible(bool Visible) { mVisible = Visible; }
|
||||
void SetName(const TString& rkName) { mLayerName = rkName; }
|
||||
void SetActive(bool Active) { mActive = Active; }
|
||||
void SetVisible(bool Visible) { mVisible = Visible; }
|
||||
|
||||
inline uint32 AreaIndex() const
|
||||
uint32 AreaIndex() const
|
||||
{
|
||||
for (uint32 iLyr = 0; iLyr < mpArea->NumScriptLayers(); iLyr++)
|
||||
{
|
||||
|
||||
@@ -7,10 +7,7 @@ CScriptObject::CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *
|
||||
: mpTemplate(pTemplate)
|
||||
, mpArea(pArea)
|
||||
, mpLayer(pLayer)
|
||||
, mVersion(0)
|
||||
, mInstanceID(InstanceID)
|
||||
, mHasInGameModel(false)
|
||||
, mIsCheckingNearVisibleActivation(false)
|
||||
{
|
||||
mpTemplate->AddObject(this);
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ class CInstanceID
|
||||
{
|
||||
uint32 mId = 0;
|
||||
public:
|
||||
operator uint32() const { return mId; }
|
||||
CInstanceID() = default;
|
||||
CInstanceID(uint32 id) : mId(id) {}
|
||||
CInstanceID& operator=(uint32 id) { mId = id; return *this; }
|
||||
uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); }
|
||||
uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); }
|
||||
uint16 Id() const { return uint16(mId & 0xffffu); }
|
||||
constexpr operator uint32() const { return mId; }
|
||||
constexpr CInstanceID() = default;
|
||||
constexpr CInstanceID(uint32 id) : mId(id) {}
|
||||
constexpr CInstanceID& operator=(uint32 id) { mId = id; return *this; }
|
||||
[[nodiscard]] constexpr uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); }
|
||||
[[nodiscard]] constexpr uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); }
|
||||
[[nodiscard]] constexpr uint16 Id() const { return uint16(mId & 0xffffu); }
|
||||
};
|
||||
|
||||
class CScriptObject
|
||||
@@ -37,7 +37,7 @@ class CScriptObject
|
||||
CScriptTemplate *mpTemplate;
|
||||
CGameArea *mpArea;
|
||||
CScriptLayer *mpLayer;
|
||||
uint32 mVersion;
|
||||
uint32 mVersion = 0;
|
||||
|
||||
CInstanceID mInstanceID;
|
||||
std::vector<CLink*> mOutLinks;
|
||||
@@ -53,15 +53,15 @@ class CScriptObject
|
||||
|
||||
TResPtr<CResource> mpDisplayAsset;
|
||||
TResPtr<CCollisionMeshGroup> mpCollision;
|
||||
uint32 mActiveCharIndex;
|
||||
uint32 mActiveAnimIndex;
|
||||
bool mHasInGameModel;
|
||||
uint32 mActiveCharIndex = 0;
|
||||
uint32 mActiveAnimIndex = 0;
|
||||
bool mHasInGameModel = false;
|
||||
|
||||
EVolumeShape mVolumeShape;
|
||||
float mVolumeScale;
|
||||
EVolumeShape mVolumeShape{};
|
||||
float mVolumeScale = 0.0f;
|
||||
|
||||
// Recursion guard
|
||||
mutable bool mIsCheckingNearVisibleActivation;
|
||||
mutable bool mIsCheckingNearVisibleActivation = false;
|
||||
|
||||
public:
|
||||
CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate);
|
||||
|
||||
@@ -5,45 +5,19 @@
|
||||
#include "Core/Resource/Animation/CAnimSet.h"
|
||||
#include <Common/Log.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
// Old constructor
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate *pGame)
|
||||
: mpGame(pGame)
|
||||
, mpProperties(nullptr)
|
||||
, mVisible(true)
|
||||
, mDirty(false)
|
||||
, mpNameProperty(nullptr)
|
||||
, mpPositionProperty(nullptr)
|
||||
, mpRotationProperty(nullptr)
|
||||
, mpScaleProperty(nullptr)
|
||||
, mpActiveProperty(nullptr)
|
||||
, mpLightParametersProperty(nullptr)
|
||||
, mPreviewScale(1.f)
|
||||
, mVolumeShape(EVolumeShape::NoShape)
|
||||
, mVolumeScale(1.f)
|
||||
{
|
||||
}
|
||||
|
||||
// New constructor
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, const TString& kInFilePath)
|
||||
: mRotationType(ERotationType::RotationEnabled)
|
||||
, mScaleType(EScaleType::ScaleEnabled)
|
||||
, mPreviewScale(1.f)
|
||||
, mVolumeShape(EVolumeShape::NoShape)
|
||||
, mVolumeScale(1.f)
|
||||
, mSourceFile(kInFilePath)
|
||||
: mSourceFile(kInFilePath)
|
||||
, mObjectID(InObjectID)
|
||||
, mpGame(pInGame)
|
||||
, mpNameProperty(nullptr)
|
||||
, mpPositionProperty(nullptr)
|
||||
, mpRotationProperty(nullptr)
|
||||
, mpScaleProperty(nullptr)
|
||||
, mpActiveProperty(nullptr)
|
||||
, mpLightParametersProperty(nullptr)
|
||||
, mVisible(true)
|
||||
, mDirty(false)
|
||||
{
|
||||
// Load
|
||||
CXMLReader Reader(kInFilePath);
|
||||
@@ -62,9 +36,7 @@ CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, cons
|
||||
if (!mLightParametersIDString.IsEmpty()) mpLightParametersProperty = TPropCast<CStructProperty>( mpProperties->ChildByIDString(mLightParametersIDString) );
|
||||
}
|
||||
|
||||
CScriptTemplate::~CScriptTemplate()
|
||||
{
|
||||
}
|
||||
CScriptTemplate::~CScriptTemplate() = default;
|
||||
|
||||
void CScriptTemplate::Serialize(IArchive& Arc)
|
||||
{
|
||||
|
||||
@@ -80,17 +80,17 @@ private:
|
||||
std::vector<SEditorAsset> mAssets;
|
||||
std::vector<SAttachment> mAttachments;
|
||||
|
||||
ERotationType mRotationType;
|
||||
EScaleType mScaleType;
|
||||
float mPreviewScale;
|
||||
ERotationType mRotationType{ERotationType::RotationEnabled};
|
||||
EScaleType mScaleType{EScaleType::ScaleEnabled};
|
||||
float mPreviewScale = 1.0f;
|
||||
|
||||
// Preview Volume
|
||||
EVolumeShape mVolumeShape;
|
||||
float mVolumeScale;
|
||||
EVolumeShape mVolumeShape{EVolumeShape::NoShape};
|
||||
float mVolumeScale = 1.0f;
|
||||
TIDString mVolumeConditionIDString;
|
||||
|
||||
TString mSourceFile;
|
||||
uint32 mObjectID;
|
||||
uint32 mObjectID = 0;
|
||||
|
||||
// Editor Properties
|
||||
TIDString mNameIDString;
|
||||
@@ -103,12 +103,12 @@ private:
|
||||
CGameTemplate* mpGame;
|
||||
std::list<CScriptObject*> mObjectList;
|
||||
|
||||
CStringProperty* mpNameProperty;
|
||||
CVectorProperty* mpPositionProperty;
|
||||
CVectorProperty* mpRotationProperty;
|
||||
CVectorProperty* mpScaleProperty;
|
||||
CBoolProperty* mpActiveProperty;
|
||||
CStructProperty* mpLightParametersProperty;
|
||||
CStringProperty* mpNameProperty = nullptr;
|
||||
CVectorProperty* mpPositionProperty = nullptr;
|
||||
CVectorProperty* mpRotationProperty = nullptr;
|
||||
CVectorProperty* mpScaleProperty = nullptr;
|
||||
CBoolProperty* mpActiveProperty = nullptr;
|
||||
CStructProperty* mpLightParametersProperty = nullptr;
|
||||
|
||||
struct SVolumeCondition {
|
||||
uint32 Value;
|
||||
@@ -123,14 +123,14 @@ private:
|
||||
}
|
||||
};
|
||||
std::vector<SVolumeCondition> mVolumeConditions;
|
||||
bool mVisible;
|
||||
bool mDirty;
|
||||
bool mVisible = true;
|
||||
bool mDirty = false;
|
||||
|
||||
public:
|
||||
// Default constructor. Don't use. This is only here so the serializer doesn't complain
|
||||
CScriptTemplate() { ASSERT(false); }
|
||||
// Old constructor
|
||||
CScriptTemplate(CGameTemplate *pGame);
|
||||
explicit CScriptTemplate(CGameTemplate *pGame);
|
||||
// New constructor
|
||||
CScriptTemplate(CGameTemplate* pGame, uint32 ObjectID, const TString& kFilePath);
|
||||
~CScriptTemplate();
|
||||
@@ -145,29 +145,29 @@ public:
|
||||
CCollisionMeshGroup* FindCollision(void* pPropertyData);
|
||||
|
||||
// Accessors
|
||||
inline CGameTemplate* GameTemplate() const { return mpGame; }
|
||||
inline TString Name() const { return mpProperties->Name(); }
|
||||
inline ERotationType RotationType() const { return mRotationType; }
|
||||
inline EScaleType ScaleType() const { return mScaleType; }
|
||||
inline float PreviewScale() const { return mPreviewScale; }
|
||||
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 uint32 NumAttachments() const { return mAttachments.size(); }
|
||||
CGameTemplate* GameTemplate() const { return mpGame; }
|
||||
TString Name() const { return mpProperties->Name(); }
|
||||
ERotationType RotationType() const { return mRotationType; }
|
||||
EScaleType ScaleType() const { return mScaleType; }
|
||||
float PreviewScale() const { return mPreviewScale; }
|
||||
uint32 ObjectID() const { return mObjectID; }
|
||||
bool IsVisible() const { return mVisible; }
|
||||
TString SourceFile() const { return mSourceFile; }
|
||||
CStructProperty* Properties() const { return mpProperties.get(); }
|
||||
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; }
|
||||
inline CVectorProperty* PositionProperty() const { return mpPositionProperty; }
|
||||
inline CVectorProperty* RotationProperty() const { return mpRotationProperty; }
|
||||
inline CVectorProperty* ScaleProperty() const { return mpScaleProperty; }
|
||||
inline CBoolProperty* ActiveProperty() const { return mpActiveProperty; }
|
||||
inline CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; }
|
||||
CStringProperty* NameProperty() const { return mpNameProperty; }
|
||||
CVectorProperty* PositionProperty() const { return mpPositionProperty; }
|
||||
CVectorProperty* RotationProperty() const { return mpRotationProperty; }
|
||||
CVectorProperty* ScaleProperty() const { return mpScaleProperty; }
|
||||
CBoolProperty* ActiveProperty() const { return mpActiveProperty; }
|
||||
CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; }
|
||||
|
||||
inline void SetVisible(bool Visible) { mVisible = Visible; }
|
||||
inline void MarkDirty() { mDirty = true; }
|
||||
inline bool IsDirty() const { return mDirty || mpProperties->IsDirty(); }
|
||||
void SetVisible(bool Visible) { mVisible = Visible; }
|
||||
void MarkDirty() { mDirty = true; }
|
||||
bool IsDirty() const { return mDirty || mpProperties->IsDirty(); }
|
||||
|
||||
// Object Tracking
|
||||
uint32 NumObjects() const;
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
const char* Name() const;
|
||||
const char* TypeName() const;
|
||||
|
||||
operator bool() const;
|
||||
explicit operator bool() const;
|
||||
void operator ++();
|
||||
};
|
||||
|
||||
|
||||
@@ -14,16 +14,7 @@
|
||||
|
||||
/** IProperty */
|
||||
IProperty::IProperty(EGame Game)
|
||||
: mpParent( nullptr )
|
||||
, mpPointerParent( nullptr )
|
||||
, mpArchetype( nullptr )
|
||||
, mGame( Game )
|
||||
, mpScriptTemplate( nullptr )
|
||||
, mOffset( -1 )
|
||||
, mID( -1 )
|
||||
, mCookPreference( ECookPreference::Default )
|
||||
, mMinVersion( 0.0f )
|
||||
, mMaxVersion( FLT_MAX )
|
||||
: mGame(Game)
|
||||
{}
|
||||
|
||||
void IProperty::_ClearChildren()
|
||||
|
||||
@@ -13,33 +13,33 @@ class CGameTemplate;
|
||||
class CScriptTemplate;
|
||||
class CStructProperty;
|
||||
|
||||
/** Typedefs */
|
||||
typedef TString TIDString;
|
||||
/** Aliases */
|
||||
using TIDString = TString;
|
||||
|
||||
/** Property flags */
|
||||
enum class EPropertyFlag : uint32
|
||||
{
|
||||
/** Property has been fully initialized and has had PostLoad called */
|
||||
IsInitialized = 0x1,
|
||||
IsInitialized = 0x1,
|
||||
/** Property is an archetype (a template for other properties to copy from) */
|
||||
IsArchetype = 0x2,
|
||||
IsArchetype = 0x2,
|
||||
/** Property is an array archetype (a template for elements of an array property) */
|
||||
IsArrayArchetype = 0x4,
|
||||
IsArrayArchetype = 0x4,
|
||||
/** This property and all its children are a single unit and do not have individual property IDs, sizes, etc. */
|
||||
IsAtomic = 0x8,
|
||||
IsAtomic = 0x8,
|
||||
/** This is a property of a C++ class, not a script object */
|
||||
IsIntrinsic = 0x10,
|
||||
IsIntrinsic = 0x10,
|
||||
/** Property has been modified, and needs to be resaved. Only valid on archetypes */
|
||||
IsDirty = 0x20,
|
||||
IsDirty = 0x20,
|
||||
/** We have cached whether the property name is correct */
|
||||
HasCachedNameCheck = 0x40000000,
|
||||
HasCachedNameCheck = 0x40000000,
|
||||
/** The name of the property is a match for the property ID hash */
|
||||
HasCorrectPropertyName = 0x80000000,
|
||||
HasCorrectPropertyName = 0x80000000,
|
||||
|
||||
/** Flags that are left intact when copying from an archetype */
|
||||
ArchetypeCopyFlags = EPropertyFlag::IsAtomic,
|
||||
ArchetypeCopyFlags = IsAtomic,
|
||||
/** Flags that are inheritable from parent */
|
||||
InheritableFlags = EPropertyFlag::IsArchetype | EPropertyFlag::IsArrayArchetype | EPropertyFlag::IsAtomic,
|
||||
InheritableFlags = IsArchetype | IsArrayArchetype | IsAtomic,
|
||||
};
|
||||
DECLARE_FLAGS_ENUMCLASS(EPropertyFlag, FPropertyFlags)
|
||||
|
||||
@@ -117,14 +117,14 @@ protected:
|
||||
FPropertyFlags mFlags;
|
||||
|
||||
/** Parent property */
|
||||
IProperty* mpParent;
|
||||
IProperty* mpParent = nullptr;
|
||||
|
||||
/** Pointer parent; if non-null, this parent needs to be dereferenced to access the correct
|
||||
* memory region that our property data is stored in */
|
||||
IProperty* mpPointerParent;
|
||||
IProperty* mpPointerParent = nullptr;
|
||||
|
||||
/** Archetype property; source property that we copied metadata from */
|
||||
IProperty* mpArchetype;
|
||||
IProperty* mpArchetype = nullptr;
|
||||
|
||||
/** Sub-instances of archetype properties. For non-archetypes, will be empty.
|
||||
* @todo this really oughta be a linked list */
|
||||
@@ -137,29 +137,29 @@ protected:
|
||||
EGame mGame;
|
||||
|
||||
/** Script template that this property belongs to. Null for struct/enum/flag archetypes. */
|
||||
CScriptTemplate* mpScriptTemplate;
|
||||
CScriptTemplate* mpScriptTemplate = nullptr;
|
||||
|
||||
/** Offset of this property within the property block */
|
||||
uint32 mOffset;
|
||||
uint32 mOffset = UINT32_MAX;
|
||||
|
||||
/** Property ID. This ID is used to uniquely identify this property within this struct. */
|
||||
uint32 mID;
|
||||
uint32 mID = UINT32_MAX;
|
||||
|
||||
/** Property metadata */
|
||||
TString mName;
|
||||
TString mDescription;
|
||||
TString mSuffix;
|
||||
ECookPreference mCookPreference;
|
||||
ECookPreference mCookPreference{ECookPreference::Default};
|
||||
|
||||
/** Min/max allowed version number. These numbers correspond to the game's internal build number.
|
||||
* This is not used yet but in the future it can be used to configure certain properties to only
|
||||
* show up when certain versions of the game are being edited. The default values allow the
|
||||
* property to show up in all versions. */
|
||||
float mMinVersion;
|
||||
float mMaxVersion;
|
||||
float mMinVersion = 0.0f;
|
||||
float mMaxVersion = FLT_MAX;
|
||||
|
||||
/** Private constructor - use static methods to instantiate */
|
||||
IProperty(EGame Game);
|
||||
explicit IProperty(EGame Game);
|
||||
void _ClearChildren();
|
||||
|
||||
public:
|
||||
@@ -207,29 +207,69 @@ public:
|
||||
|
||||
/** Accessors */
|
||||
EGame Game() const;
|
||||
inline ECookPreference CookPreference() const;
|
||||
inline uint32 NumChildren() const;
|
||||
inline IProperty* ChildByIndex(uint32 ChildIndex) const;
|
||||
inline IProperty* Parent() const;
|
||||
inline IProperty* RootParent();
|
||||
inline IProperty* Archetype() const;
|
||||
inline IProperty* RootArchetype();
|
||||
inline CScriptTemplate* ScriptTemplate() const;
|
||||
inline TString Name() const;
|
||||
inline TString Description() const;
|
||||
inline TString Suffix() const;
|
||||
inline TIDString IDString(bool FullyQualified) const;
|
||||
inline uint32 Offset() const;
|
||||
inline uint32 ID() const;
|
||||
ECookPreference CookPreference() const { return mCookPreference; }
|
||||
uint32 NumChildren() const { return mChildren.size(); }
|
||||
|
||||
inline bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); }
|
||||
inline bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); }
|
||||
inline bool IsArrayArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArrayArchetype); }
|
||||
inline bool IsAtomic() const { return mFlags.HasFlag(EPropertyFlag::IsAtomic); }
|
||||
inline bool IsIntrinsic() const { return mFlags.HasFlag(EPropertyFlag::IsIntrinsic); }
|
||||
inline bool IsDirty() const { return mFlags.HasFlag(EPropertyFlag::IsDirty); }
|
||||
inline bool IsRootParent() const { return mpParent == nullptr; }
|
||||
inline bool IsRootArchetype() const { return mpArchetype == nullptr; }
|
||||
IProperty* ChildByIndex(uint32 ChildIndex) const
|
||||
{
|
||||
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
|
||||
return mChildren[ChildIndex];
|
||||
}
|
||||
|
||||
IProperty* Parent() const { return mpParent; }
|
||||
IProperty* RootParent()
|
||||
{
|
||||
IProperty* pParent = Parent();
|
||||
IProperty* pOut = this;
|
||||
|
||||
while (pParent)
|
||||
{
|
||||
pOut = pParent;
|
||||
pParent = pParent->Parent();
|
||||
}
|
||||
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IProperty* Archetype() const { return mpArchetype; }
|
||||
IProperty* RootArchetype()
|
||||
{
|
||||
IProperty* pArchetype = Archetype();
|
||||
IProperty* pOut = this;
|
||||
|
||||
while (pArchetype)
|
||||
{
|
||||
pOut = pArchetype;
|
||||
pArchetype = pArchetype->Archetype();
|
||||
}
|
||||
|
||||
return pOut;
|
||||
}
|
||||
|
||||
CScriptTemplate* ScriptTemplate() const { return mpScriptTemplate; }
|
||||
TString Name() const { return mName; }
|
||||
TString Description() const { return mDescription; }
|
||||
TString Suffix() const { return mSuffix; }
|
||||
|
||||
TIDString IDString(bool FullyQualified) const
|
||||
{
|
||||
if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr)
|
||||
return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID);
|
||||
else
|
||||
return TString::HexString(mID);
|
||||
}
|
||||
|
||||
uint32 Offset() const { return mOffset; }
|
||||
uint32 ID() const { return mID; }
|
||||
|
||||
bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); }
|
||||
bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); }
|
||||
bool IsArrayArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArrayArchetype); }
|
||||
bool IsAtomic() const { return mFlags.HasFlag(EPropertyFlag::IsAtomic); }
|
||||
bool IsIntrinsic() const { return mFlags.HasFlag(EPropertyFlag::IsIntrinsic); }
|
||||
bool IsDirty() const { return mFlags.HasFlag(EPropertyFlag::IsDirty); }
|
||||
bool IsRootParent() const { return mpParent == nullptr; }
|
||||
bool IsRootArchetype() const { return mpArchetype == nullptr; }
|
||||
|
||||
/** Create */
|
||||
static IProperty* Create(EPropertyType Type,
|
||||
@@ -251,130 +291,42 @@ public:
|
||||
const IArchive& Arc);
|
||||
};
|
||||
|
||||
inline ECookPreference IProperty::CookPreference() const
|
||||
{
|
||||
return mCookPreference;
|
||||
}
|
||||
|
||||
inline uint32 IProperty::NumChildren() const
|
||||
{
|
||||
return mChildren.size();
|
||||
}
|
||||
|
||||
inline IProperty* IProperty::ChildByIndex(uint32 ChildIndex) const
|
||||
{
|
||||
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
|
||||
return mChildren[ChildIndex];
|
||||
}
|
||||
|
||||
inline IProperty* IProperty::Parent() const
|
||||
{
|
||||
return mpParent;
|
||||
}
|
||||
|
||||
inline IProperty* IProperty::RootParent()
|
||||
{
|
||||
IProperty* pParent = Parent();
|
||||
IProperty* pOut = this;
|
||||
|
||||
while (pParent)
|
||||
{
|
||||
pOut = pParent;
|
||||
pParent = pParent->Parent();
|
||||
}
|
||||
|
||||
return pOut;
|
||||
}
|
||||
|
||||
inline IProperty* IProperty::Archetype() const
|
||||
{
|
||||
return mpArchetype;
|
||||
}
|
||||
|
||||
inline IProperty* IProperty::RootArchetype()
|
||||
{
|
||||
IProperty* pArchetype = Archetype();
|
||||
IProperty* pOut = this;
|
||||
|
||||
while (pArchetype)
|
||||
{
|
||||
pOut = pArchetype;
|
||||
pArchetype = pArchetype->Archetype();
|
||||
}
|
||||
|
||||
return pOut;
|
||||
}
|
||||
|
||||
inline CScriptTemplate* IProperty::ScriptTemplate() const
|
||||
{
|
||||
return mpScriptTemplate;
|
||||
}
|
||||
|
||||
inline TString IProperty::Name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
inline TString IProperty::Description() const
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
inline TString IProperty::Suffix() const
|
||||
{
|
||||
return mSuffix;
|
||||
}
|
||||
|
||||
inline TString IProperty::IDString(bool FullyQualified) const
|
||||
{
|
||||
if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr)
|
||||
return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID);
|
||||
else
|
||||
return TString::HexString(mID);
|
||||
}
|
||||
|
||||
inline uint32 IProperty::Offset() const
|
||||
{
|
||||
return mOffset;
|
||||
}
|
||||
|
||||
inline uint32 IProperty::ID() const
|
||||
{
|
||||
return mID;
|
||||
}
|
||||
|
||||
template<typename PropType, EPropertyType PropEnum>
|
||||
class TTypedProperty : public IProperty
|
||||
{
|
||||
friend class IProperty;
|
||||
friend class CTemplateLoader;
|
||||
public:
|
||||
typedef PropType ValueType;
|
||||
using ValueType = PropType;
|
||||
|
||||
protected:
|
||||
PropType mDefaultValue = {};
|
||||
|
||||
TTypedProperty(EGame Game) : IProperty(Game) {}
|
||||
explicit TTypedProperty(EGame Game) : IProperty(Game) {}
|
||||
|
||||
public:
|
||||
virtual EPropertyType Type() const { return PropEnum; }
|
||||
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; }
|
||||
virtual void RevertToDefault(void* pData) const { ValueRef(pData) = mDefaultValue; }
|
||||
virtual void SetDefaultFromData(void* pData) { mDefaultValue = ValueRef(pData); MarkDirty(); }
|
||||
EPropertyType Type() const override { return PropEnum; }
|
||||
uint32 DataSize() const override { return sizeof(PropType); }
|
||||
uint32 DataAlignment() const override { return alignof(PropType); }
|
||||
void Construct(void* pData) const override { new (ValuePtr(pData)) PropType(mDefaultValue); }
|
||||
void Destruct(void* pData) const override { ValueRef(pData).~PropType(); }
|
||||
bool MatchesDefault(void* pData) const override { return ValueRef(pData) == mDefaultValue; }
|
||||
void RevertToDefault(void* pData) const override { ValueRef(pData) = mDefaultValue; }
|
||||
void SetDefaultFromData(void* pData) override
|
||||
{
|
||||
mDefaultValue = ValueRef(pData);
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
virtual bool CanHaveDefault() const { return true; }
|
||||
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
void InitFromArchetype(IProperty* pOther) override
|
||||
{
|
||||
IProperty::InitFromArchetype(pOther);
|
||||
mDefaultValue = static_cast<TTypedProperty*>(pOther)->mDefaultValue;
|
||||
}
|
||||
|
||||
virtual void CopyDefaultValueTo(IProperty* pOtherProperty)
|
||||
void CopyDefaultValueTo(IProperty* pOtherProperty) override
|
||||
{
|
||||
// WARNING: We don't do any type checking here because this function is used for type conversion,
|
||||
// which necessitates that the property class is allowed to be different. The underlying type is
|
||||
@@ -384,32 +336,32 @@ public:
|
||||
pTypedOther->mDefaultValue = mDefaultValue;
|
||||
}
|
||||
|
||||
inline PropType* ValuePtr(void* pData) const
|
||||
PropType* ValuePtr(void* pData) const
|
||||
{
|
||||
return (PropType*) RawValuePtr(pData);
|
||||
}
|
||||
|
||||
inline PropType& ValueRef(void* pData) const
|
||||
PropType& ValueRef(void* pData) const
|
||||
{
|
||||
return *ValuePtr(pData);
|
||||
}
|
||||
|
||||
inline PropType Value(void* pData) const
|
||||
PropType Value(void* pData) const
|
||||
{
|
||||
return *ValuePtr(pData);
|
||||
}
|
||||
|
||||
inline const PropType& DefaultValue() const
|
||||
const PropType& DefaultValue() const
|
||||
{
|
||||
return mDefaultValue;
|
||||
}
|
||||
|
||||
inline void SetDefaultValue(const PropType& kInDefaultValue)
|
||||
void SetDefaultValue(const PropType& kInDefaultValue)
|
||||
{
|
||||
mDefaultValue = kInDefaultValue;
|
||||
}
|
||||
|
||||
inline static EPropertyType StaticType() { return PropEnum; }
|
||||
static EPropertyType StaticType() { return PropEnum; }
|
||||
};
|
||||
|
||||
template<typename PropType, EPropertyType PropEnum>
|
||||
@@ -417,12 +369,12 @@ class TSerializeableTypedProperty : public TTypedProperty<PropType, PropEnum>
|
||||
{
|
||||
using base = TTypedProperty<PropType, PropEnum>;
|
||||
protected:
|
||||
TSerializeableTypedProperty(EGame Game)
|
||||
explicit TSerializeableTypedProperty(EGame Game)
|
||||
: base(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
virtual void Serialize(IArchive& rArc)
|
||||
void Serialize(IArchive& rArc) override
|
||||
{
|
||||
base::Serialize(rArc);
|
||||
TSerializeableTypedProperty* pArchetype = static_cast<TSerializeableTypedProperty*>(base::mpArchetype);
|
||||
@@ -462,7 +414,7 @@ public:
|
||||
rArc << SerialParameter("DefaultValue", base::mDefaultValue);
|
||||
}
|
||||
|
||||
virtual bool ShouldSerialize() const
|
||||
bool ShouldSerialize() const override
|
||||
{
|
||||
base* pArchetype = static_cast<base*>(base::mpArchetype);
|
||||
|
||||
@@ -485,17 +437,15 @@ class TNumericalProperty : public TSerializeableTypedProperty<PropType, PropEnum
|
||||
friend class CTemplateLoader;
|
||||
|
||||
protected:
|
||||
PropType mMinValue;
|
||||
PropType mMaxValue;
|
||||
PropType mMinValue = -1;
|
||||
PropType mMaxValue = -1;
|
||||
|
||||
TNumericalProperty(EGame Game)
|
||||
explicit TNumericalProperty(EGame Game)
|
||||
: base(Game)
|
||||
, mMinValue( -1 )
|
||||
, mMaxValue( -1 )
|
||||
{}
|
||||
|
||||
public:
|
||||
virtual void Serialize(IArchive& rArc)
|
||||
void Serialize(IArchive& rArc) override
|
||||
{
|
||||
base::Serialize(rArc);
|
||||
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(base::mpArchetype);
|
||||
@@ -504,7 +454,7 @@ public:
|
||||
<< SerialParameter("Max", mMaxValue, SH_Optional, pArchetype ? pArchetype->mMaxValue : (PropType) -1);
|
||||
}
|
||||
|
||||
virtual bool ShouldSerialize() const
|
||||
bool ShouldSerialize() const override
|
||||
{
|
||||
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(base::mpArchetype);
|
||||
return base::ShouldSerialize() ||
|
||||
@@ -512,7 +462,7 @@ public:
|
||||
mMaxValue != pArchetype->mMaxValue;
|
||||
}
|
||||
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
void InitFromArchetype(IProperty* pOther) override
|
||||
{
|
||||
base::InitFromArchetype(pOther);
|
||||
TNumericalProperty* pCastOther = static_cast<TNumericalProperty*>(pOther);
|
||||
@@ -520,7 +470,7 @@ public:
|
||||
mMaxValue = pCastOther->mMaxValue;
|
||||
}
|
||||
|
||||
virtual void PropertyValueChanged(void* pPropertyData)
|
||||
void PropertyValueChanged(void* pPropertyData) override
|
||||
{
|
||||
base::PropertyValueChanged(pPropertyData);
|
||||
|
||||
@@ -534,7 +484,7 @@ public:
|
||||
|
||||
/** Property casting with dynamic type checking */
|
||||
template<class PropertyClass>
|
||||
inline PropertyClass* TPropCast(IProperty* pProperty)
|
||||
PropertyClass* TPropCast(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty && pProperty->Type() == PropertyClass::StaticType())
|
||||
{
|
||||
|
||||
@@ -27,15 +27,13 @@ template<class PropertyClass, typename ValueType = typename PropertyClass::Value
|
||||
class TPropertyRef
|
||||
{
|
||||
/** Property data being referenced */
|
||||
void* mpPropertyData;
|
||||
void* mpPropertyData = nullptr;
|
||||
|
||||
/** Property being referenced */
|
||||
PropertyClass* mpProperty;
|
||||
PropertyClass* mpProperty = nullptr;
|
||||
|
||||
public:
|
||||
TPropertyRef()
|
||||
: mpPropertyData(nullptr), mpProperty(nullptr)
|
||||
{}
|
||||
TPropertyRef() = default;
|
||||
|
||||
explicit TPropertyRef(void* pInData, IProperty* pInProperty)
|
||||
: mpPropertyData(pInData), mpProperty( TPropCast<PropertyClass>(pInProperty) )
|
||||
@@ -48,19 +46,19 @@ public:
|
||||
}
|
||||
|
||||
/** Accessors */
|
||||
inline void* DataPointer() const { return mpPropertyData; }
|
||||
inline PropertyClass* Property() const { return mpProperty; }
|
||||
inline ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); }
|
||||
inline void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; }
|
||||
inline bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; }
|
||||
void* DataPointer() const { return mpPropertyData; }
|
||||
PropertyClass* Property() const { return mpProperty; }
|
||||
ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); }
|
||||
void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; }
|
||||
bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; }
|
||||
|
||||
/** Inline operators */
|
||||
inline operator ValueType() const
|
||||
operator ValueType() const
|
||||
{
|
||||
return Get();
|
||||
}
|
||||
|
||||
inline bool operator==(IProperty* pProperty) const
|
||||
bool operator==(IProperty* pProperty) const
|
||||
{
|
||||
return mpProperty == pProperty;
|
||||
}
|
||||
@@ -72,25 +70,25 @@ public:
|
||||
};
|
||||
|
||||
/** Convenience typedefs */
|
||||
typedef TPropertyRef<CBoolProperty> CBoolRef;
|
||||
typedef TPropertyRef<CByteProperty> CByteRef;
|
||||
typedef TPropertyRef<CShortProperty> CShortRef;
|
||||
typedef TPropertyRef<CIntProperty> CIntRef;
|
||||
typedef TPropertyRef<CFloatProperty> CFloatRef;
|
||||
typedef TPropertyRef<CFlagsProperty> CFlagsRef;
|
||||
typedef TPropertyRef<CStringProperty> CStringRef;
|
||||
typedef TPropertyRef<CVectorProperty> CVectorRef;
|
||||
typedef TPropertyRef<CColorProperty> CColorRef;
|
||||
typedef TPropertyRef<CAssetProperty> CAssetRef;
|
||||
typedef TPropertyRef<CSoundProperty> CSoundRef;
|
||||
typedef TPropertyRef<CAnimationProperty> CAnimationRef;
|
||||
typedef TPropertyRef<CAnimationSetProperty> CAnimationSetRef;
|
||||
typedef TPropertyRef<CSequenceProperty> CSequenceRef;
|
||||
typedef TPropertyRef<CSplineProperty> CSplineRef;
|
||||
typedef TPropertyRef<CGuidProperty> CGuidRef;
|
||||
typedef TPropertyRef<CPointerProperty> CPointerRef;
|
||||
typedef TPropertyRef<CStructProperty> CStructRef;
|
||||
typedef TPropertyRef<CArrayProperty> CArrayRef;
|
||||
using CAnimationRef = TPropertyRef<CAnimationProperty>;
|
||||
using CAnimationSetRef = TPropertyRef<CAnimationSetProperty>;
|
||||
using CArrayRef = TPropertyRef<CArrayProperty>;
|
||||
using CAssetRef = TPropertyRef<CAssetProperty>;
|
||||
using CBoolRef = TPropertyRef<CBoolProperty>;
|
||||
using CByteRef = TPropertyRef<CByteProperty>;
|
||||
using CColorRef = TPropertyRef<CColorProperty>;
|
||||
using CFlagsRef = TPropertyRef<CFlagsProperty>;
|
||||
using CFloatRef = TPropertyRef<CFloatProperty>;
|
||||
using CGuidRef = TPropertyRef<CGuidProperty>;
|
||||
using CIntRef = TPropertyRef<CIntProperty>;
|
||||
using CPointerRef = TPropertyRef<CPointerProperty>;
|
||||
using CSequenceRef = TPropertyRef<CSequenceProperty>;
|
||||
using CShortRef = TPropertyRef<CShortProperty>;
|
||||
using CSoundRef = TPropertyRef<CSoundProperty>;
|
||||
using CSplineRef = TPropertyRef<CSplineProperty>;
|
||||
using CStringRef = TPropertyRef<CStringProperty>;
|
||||
using CStructRef = TPropertyRef<CStructProperty>;
|
||||
using CVectorRef = TPropertyRef<CVectorProperty>;
|
||||
|
||||
/** Special version for enums */
|
||||
template<typename ValueType>
|
||||
|
||||
@@ -24,11 +24,9 @@ class CStringTable : public CResource
|
||||
struct SStringData
|
||||
{
|
||||
TString String;
|
||||
bool IsLocalized;
|
||||
bool IsLocalized = false;
|
||||
|
||||
SStringData()
|
||||
: IsLocalized(false)
|
||||
{}
|
||||
SStringData() = default;
|
||||
|
||||
void Serialize(IArchive& Arc)
|
||||
{
|
||||
@@ -52,19 +50,19 @@ class CStringTable : public CResource
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CStringTable(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
||||
explicit CStringTable(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {}
|
||||
|
||||
/** Returns the number of languages in the table */
|
||||
inline uint NumLanguages() const { return mLanguages.size(); }
|
||||
uint NumLanguages() const { return mLanguages.size(); }
|
||||
|
||||
/** Returns the number of strings in the table */
|
||||
inline uint NumStrings() const { return mLanguages.empty() ? 0 : mLanguages[0].Strings.size(); }
|
||||
uint NumStrings() const { return mLanguages.empty() ? 0 : mLanguages[0].Strings.size(); }
|
||||
|
||||
/** Returns languages used by index */
|
||||
inline ELanguage LanguageByIndex(uint Index) const { return mLanguages.size() > Index ? mLanguages[Index].Language : ELanguage::Invalid; }
|
||||
ELanguage LanguageByIndex(uint Index) const { return mLanguages.size() > Index ? mLanguages[Index].Language : ELanguage::Invalid; }
|
||||
|
||||
/** Returns the string name by string index. May be blank if the string at the requested index is unnamed */
|
||||
inline TString StringNameByIndex(uint Index) const { return mStringNames.size() > Index ? mStringNames[Index] : ""; }
|
||||
TString StringNameByIndex(uint Index) const { return mStringNames.size() > Index ? mStringNames[Index] : ""; }
|
||||
|
||||
/** Returns a string given a language/index pair */
|
||||
TString GetString(ELanguage Language, uint StringIndex) const;
|
||||
@@ -85,13 +83,13 @@ public:
|
||||
void RemoveString(uint StringIndex);
|
||||
|
||||
/** Initialize new resource data */
|
||||
virtual void InitializeNewResource() override;
|
||||
void InitializeNewResource() override;
|
||||
|
||||
/** Serialize resource data */
|
||||
virtual void Serialize(IArchive& Arc) override;
|
||||
void Serialize(IArchive& Arc) override;
|
||||
|
||||
/** Build the dependency tree for this resource */
|
||||
virtual CDependencyTree* BuildDependencyTree() const override;
|
||||
CDependencyTree* BuildDependencyTree() const override;
|
||||
|
||||
/** Static - Strip all formatting tags for a given string */
|
||||
static TString StripFormatting(const TString& kInString);
|
||||
|
||||
Reference in New Issue
Block a user