General: Remove unnecessary inline specifiers and add overrides

This commit is contained in:
Lioncash 2020-06-11 14:10:22 -04:00
parent 2d76c5865a
commit 012da6fb6d
107 changed files with 885 additions and 1055 deletions

View File

@ -35,12 +35,12 @@ public:
}
}
inline int LightLayerIndex() const
int LightLayerIndex() const
{
return mLightLayer.IsValid() ? mLightLayer.Get() : 0;
}
inline EWorldLightingOptions WorldLightingOptions() const
EWorldLightingOptions WorldLightingOptions() const
{
return mWorldLightingOptions.IsValid() ? mWorldLightingOptions.Get() : eNormalLighting;
}

View File

@ -22,21 +22,21 @@ public:
class CMayaSpline
{
uint mPreInfinity; // 0x00
uint mPostInfinity; // 0x04
uint mPreInfinity = 0; // 0x00
uint mPostInfinity = 0; // 0x04
std::vector<CMayaSplineKnot> mKnots; // 0x08, 0x0C, 0x10
uint mClampMode; // 0x14 - clamp mode
float mMinAmplitude; // 0x18
float mMaxAmplitude; // 0x1C
uint mClampMode = 0; // 0x14 - clamp mode
float mMinAmplitude = 0.0f; // 0x18
float mMaxAmplitude = 0.0f; // 0x1C
mutable int mCachedKnotIndex; // 0x20
mutable int mUnknown1; // 0x24
mutable uint8 mDirtyFlags; // 0x28
mutable float mCachedMinTime; // 0x2C
mutable float mCachedHermiteCoefficients[4]; // 0x30, 0x34, 0x38, 0x3C
mutable int mCachedKnotIndex = 0; // 0x20
mutable int mUnknown1 = 0; // 0x24
mutable uint8 mDirtyFlags = 0; // 0x28
mutable float mCachedMinTime = 0.0f; // 0x2C
mutable float mCachedHermiteCoefficients[4] = {}; // 0x30, 0x34, 0x38, 0x3C
public:
CMayaSpline() {}
CMayaSpline() = default;
uint GetKnotCount() const;
const std::vector<CMayaSplineKnot>& GetKnots() const;
float GetMinTime() const;

View File

@ -45,18 +45,18 @@ public:
static IDependencyNode* ArchiveConstructor(EDependencyNodeType Type);
// Accessors
inline uint NumChildren() const { return mChildren.size(); }
inline IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; }
uint NumChildren() const { return mChildren.size(); }
IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; }
};
// Basic dependency tree; this class is sufficient for most resource types.
class CDependencyTree : public IDependencyNode
{
public:
CDependencyTree() {}
CDependencyTree() = default;
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
void AddChild(IDependencyNode *pNode);
void AddDependency(const CAssetID& rkID, bool AvoidDuplicates = true);
@ -71,17 +71,17 @@ protected:
CAssetID mID;
public:
CResourceDependency() {}
CResourceDependency() = default;
CResourceDependency(const CAssetID& rkID) : mID(rkID) {}
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
virtual void GetAllResourceReferences(std::set<CAssetID>& rOutSet) const;
virtual bool HasDependency(const CAssetID& rkID) const;
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
void GetAllResourceReferences(std::set<CAssetID>& rOutSet) const override;
bool HasDependency(const CAssetID& rkID) const override;
// Accessors
inline CAssetID ID() const { return mID; }
inline void SetID(const CAssetID& rkID) { mID = rkID; }
CAssetID ID() const { return mID; }
void SetID(const CAssetID& rkID) { mID = rkID; }
};
// Node representing a single resource dependency referenced by a script property.
@ -90,58 +90,53 @@ class CPropertyDependency : public CResourceDependency
TString mIDString;
public:
CPropertyDependency()
: CResourceDependency()
{}
CPropertyDependency() = default;
CPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID)
: CResourceDependency(rkAssetID)
, mIDString(rkPropID)
{}
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
// Accessors
inline TString PropertyID() const { return mIDString; }
TString PropertyID() const { return mIDString; }
};
// Node representing a single animset dependency referenced by a script property. Indicates which character is being used.
class CCharPropertyDependency : public CPropertyDependency
{
protected:
int mUsedChar;
int mUsedChar = -1;
public:
CCharPropertyDependency()
: CPropertyDependency()
, mUsedChar(-1)
{}
CCharPropertyDependency() = default;
CCharPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID, int UsedChar)
: CPropertyDependency(rkPropID, rkAssetID)
, mUsedChar(UsedChar)
{}
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
// Accessors
inline int UsedChar() const { return mUsedChar; }
int UsedChar() const { return mUsedChar; }
};
// Node representing a script object. Indicates the type of object.
class CScriptInstanceDependency : public IDependencyNode
{
protected:
uint mObjectType;
uint mObjectType = 0;
public:
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
// Accessors
inline uint ObjectType() const { return mObjectType; }
uint ObjectType() const { return mObjectType; }
// Static
static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance);
@ -151,17 +146,17 @@ public:
class CSetCharacterDependency : public CDependencyTree
{
protected:
uint32 mCharSetIndex;
uint32 mCharSetIndex = 0;
public:
CSetCharacterDependency() : CDependencyTree() {}
CSetCharacterDependency(uint32 SetIndex) : CDependencyTree(), mCharSetIndex(SetIndex) {}
CSetCharacterDependency() = default;
CSetCharacterDependency(uint32 SetIndex) : mCharSetIndex(SetIndex) {}
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
// Accessors
inline uint32 CharSetIndex() const { return mCharSetIndex; }
uint32 CharSetIndex() const { return mCharSetIndex; }
// Static
static CSetCharacterDependency* BuildTree(const SSetCharacter& rkChar);
@ -174,14 +169,14 @@ protected:
std::set<uint32> mCharacterIndices;
public:
CSetAnimationDependency() : CDependencyTree() {}
CSetAnimationDependency() = default;
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
// Accessors
inline bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); }
inline bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); }
bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); }
bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); }
// Static
static CSetAnimationDependency* BuildTree(const CAnimSet *pkOwnerSet, uint32 AnimIndex);
@ -191,18 +186,18 @@ public:
class CAnimEventDependency : public CResourceDependency
{
protected:
uint32 mCharIndex;
uint32 mCharIndex = 0;
public:
CAnimEventDependency() : CResourceDependency() {}
CAnimEventDependency() = default;
CAnimEventDependency(const CAssetID& rkID, uint32 CharIndex)
: CResourceDependency(rkID), mCharIndex(CharIndex) {}
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
// Accessors
inline uint32 CharIndex() const { return mCharIndex; }
uint32 CharIndex() const { return mCharIndex; }
};
// Node representing an area. Tracks dependencies on a per-instance basis and can separate dependencies of different script layers.
@ -212,17 +207,17 @@ protected:
std::vector<uint32> mLayerOffsets;
public:
CAreaDependencyTree() : CDependencyTree() {}
CAreaDependencyTree() = default;
virtual EDependencyNodeType Type() const;
virtual void Serialize(IArchive& rArc);
EDependencyNodeType Type() const override;
void Serialize(IArchive& rArc) override;
void AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps);
void GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<uint32>& rModuleLayerOffsetsOut) const;
// Accessors
inline uint32 NumScriptLayers() const { return mLayerOffsets.size(); }
inline uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
uint32 NumScriptLayers() const { return mLayerOffsets.size(); }
uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
};
#endif // CDEPENDENCYTREE

View File

@ -78,7 +78,7 @@ public:
void LoadResource(const CAssetID& rkID, std::vector<uint8>& rBuffer);
bool ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot);
inline TString ProjectPath() const { return mProjectPath; }
TString ProjectPath() const { return mProjectPath; }
protected:
bool ExtractDiscData();
@ -91,7 +91,7 @@ protected:
TString MakeWorldName(CAssetID WorldID);
// Convenience Functions
inline SResourceInstance* FindResourceInstance(const CAssetID& rkID)
SResourceInstance* FindResourceInstance(const CAssetID& rkID)
{
uint64 IntegralID = rkID.ToLongLong();
auto Found = mResourceMap.find(IntegralID);

View File

@ -82,34 +82,34 @@ public:
static CGameProject* LoadProject(const TString& rkProjPath, IProgressNotifier *pProgress);
// Directory Handling
inline TString ProjectRoot() const { return mProjectRoot; }
inline TString ProjectPath() const { return mProjectRoot + FileUtil::SanitizeName(mProjectName, false) + ".prj"; }
inline TString HiddenFilesDir() const { return mProjectRoot + ".project/"; }
inline TString DiscDir(bool Relative) const { return Relative ? "Disc/" : mProjectRoot + "Disc/"; }
inline TString PackagesDir(bool Relative) const { return Relative ? "Packages/" : mProjectRoot + "Packages/"; }
inline TString ResourcesDir(bool Relative) const { return Relative ? "Resources/" : mProjectRoot + "Resources/"; }
TString ProjectRoot() const { return mProjectRoot; }
TString ProjectPath() const { return mProjectRoot + FileUtil::SanitizeName(mProjectName, false) + ".prj"; }
TString HiddenFilesDir() const { return mProjectRoot + ".project/"; }
TString DiscDir(bool Relative) const { return Relative ? "Disc/" : mProjectRoot + "Disc/"; }
TString PackagesDir(bool Relative) const { return Relative ? "Packages/" : mProjectRoot + "Packages/"; }
TString ResourcesDir(bool Relative) const { return Relative ? "Resources/" : mProjectRoot + "Resources/"; }
// Disc Filesystem Management
inline TString DiscFilesystemRoot(bool Relative) const { return DiscDir(Relative) + (IsWiiBuild() ? "DATA/" : "") + "files/"; }
TString DiscFilesystemRoot(bool Relative) const { return DiscDir(Relative) + (IsWiiBuild() ? "DATA/" : "") + "files/"; }
// Accessors
inline void SetProjectName(const TString& rkName) { mProjectName = rkName; }
void SetProjectName(const TString& rkName) { mProjectName = rkName; }
inline TString Name() const { return mProjectName; }
inline uint32 NumPackages() const { return mPackages.size(); }
inline CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; }
inline void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
inline CResourceStore* ResourceStore() const { return mpResourceStore.get(); }
inline CGameInfo* GameInfo() const { return mpGameInfo.get(); }
inline CAudioManager* AudioManager() const { return mpAudioManager.get(); }
inline CTweakManager* TweakManager() const { return mpTweakManager.get(); }
inline EGame Game() const { return mGame; }
inline ERegion Region() const { return mRegion; }
inline TString GameID() const { return mGameID; }
inline float BuildVersion() const { return mBuildVersion; }
inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
inline bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; }
inline bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; }
TString Name() const { return mProjectName; }
uint32 NumPackages() const { return mPackages.size(); }
CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; }
void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
CResourceStore* ResourceStore() const { return mpResourceStore.get(); }
CGameInfo* GameInfo() const { return mpGameInfo.get(); }
CAudioManager* AudioManager() const { return mpAudioManager.get(); }
CTweakManager* TweakManager() const { return mpTweakManager.get(); }
EGame Game() const { return mGame; }
ERegion Region() const { return mRegion; }
TString GameID() const { return mGameID; }
float BuildVersion() const { return mBuildVersion; }
bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; }
bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; }
};
#endif // CGAMEPROJECT_H

View File

@ -13,7 +13,7 @@ class COpeningBanner
bool mWii;
public:
COpeningBanner(CGameProject *pProj);
explicit COpeningBanner(CGameProject *pProj);
TString EnglishGameName() const;
void SetEnglishGameName(const TString& rkName);
void Save();

View File

@ -34,24 +34,22 @@ struct SNamedResource
class CPackage
{
CGameProject *mpProject;
CGameProject *mpProject = nullptr;
TString mPakName;
TString mPakPath;
std::vector<SNamedResource> mResources;
bool mNeedsRecook;
bool mNeedsRecook = false;
// Cached dependency list; used to figure out if a given resource is in this package
mutable bool mCacheDirty;
mutable bool mCacheDirty = false;
mutable std::set<CAssetID> mCachedDependencies;
public:
CPackage() {}
CPackage() = default;
CPackage(CGameProject *pProj, const TString& rkName, const TString& rkPath)
: mpProject(pProj)
, mPakName(rkName)
, mPakPath(rkPath)
, mNeedsRecook(false)
, mCacheDirty(true)
{}
@ -70,14 +68,14 @@ public:
TString CookedPackagePath(bool Relative) const;
// Accessors
inline TString Name() const { return mPakName; }
inline TString Path() const { return mPakPath; }
inline CGameProject* Project() const { return mpProject; }
inline uint32 NumNamedResources() const { return mResources.size(); }
inline const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; }
inline bool NeedsRecook() const { return mNeedsRecook; }
TString Name() const { return mPakName; }
TString Path() const { return mPakPath; }
CGameProject* Project() const { return mpProject; }
uint32 NumNamedResources() const { return mResources.size(); }
const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; }
bool NeedsRecook() const { return mNeedsRecook; }
inline void SetPakName(TString NewName) { mPakName = NewName; }
void SetPakName(TString NewName) { mPakName = std::move(NewName); }
};
#endif // CPACKAGE

View File

@ -41,7 +41,7 @@ class CResourceEntry
mutable TString mCachedUppercaseName; // This is used to speed up case-insensitive sorting and filtering.
// Private constructor
CResourceEntry(CResourceStore *pStore);
explicit CResourceEntry(CResourceStore *pStore);
public:
static CResourceEntry* CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
@ -86,27 +86,27 @@ public:
void ClearFlag(EResEntryFlag Flag);
// Accessors
inline void SetFlagEnabled(EResEntryFlag Flag, bool Enabled) { Enabled ? SetFlag(Flag) : ClearFlag(Flag); }
void SetFlagEnabled(EResEntryFlag Flag, bool Enabled) { Enabled ? SetFlag(Flag) : ClearFlag(Flag); }
inline void SetDirty() { SetFlag(EResEntryFlag::NeedsRecook); }
inline void SetHidden(bool Hidden) { SetFlagEnabled(EResEntryFlag::Hidden, Hidden); }
inline bool HasFlag(EResEntryFlag Flag) const { return mFlags.HasFlag(Flag); }
inline bool IsHidden() const { return HasFlag(EResEntryFlag::Hidden); }
inline bool IsMarkedForDeletion() const { return HasFlag(EResEntryFlag::MarkedForDeletion); }
void SetDirty() { SetFlag(EResEntryFlag::NeedsRecook); }
void SetHidden(bool Hidden) { SetFlagEnabled(EResEntryFlag::Hidden, Hidden); }
bool HasFlag(EResEntryFlag Flag) const { return mFlags.HasFlag(Flag); }
bool IsHidden() const { return HasFlag(EResEntryFlag::Hidden); }
bool IsMarkedForDeletion() const { return HasFlag(EResEntryFlag::MarkedForDeletion); }
inline bool IsLoaded() const { return mpResource != nullptr; }
inline bool IsCategorized() const { return mpDirectory && !mpDirectory->FullPath().CaseInsensitiveCompare( mpStore->DefaultResourceDirPath() ); }
inline bool IsNamed() const { return mName != mID.ToString(); }
inline CResource* Resource() const { return mpResource; }
inline CResTypeInfo* TypeInfo() const { return mpTypeInfo; }
inline CResourceStore* ResourceStore() const { return mpStore; }
inline CDependencyTree* Dependencies() const { return mpDependencies; }
inline CAssetID ID() const { return mID; }
inline CVirtualDirectory* Directory() const { return mpDirectory; }
inline TString DirectoryPath() const { return mpDirectory->FullPath(); }
inline TString Name() const { return mName; }
inline const TString& UppercaseName() const { return mCachedUppercaseName; }
inline EResourceType ResourceType() const { return mpTypeInfo->Type(); }
bool IsLoaded() const { return mpResource != nullptr; }
bool IsCategorized() const { return mpDirectory && !mpDirectory->FullPath().CaseInsensitiveCompare( mpStore->DefaultResourceDirPath() ); }
bool IsNamed() const { return mName != mID.ToString(); }
CResource* Resource() const { return mpResource; }
CResTypeInfo* TypeInfo() const { return mpTypeInfo; }
CResourceStore* ResourceStore() const { return mpStore; }
CDependencyTree* Dependencies() const { return mpDependencies; }
CAssetID ID() const { return mID; }
CVirtualDirectory* Directory() const { return mpDirectory; }
TString DirectoryPath() const { return mpDirectory->FullPath(); }
TString Name() const { return mName; }
const TString& UppercaseName() const { return mCachedUppercaseName; }
EResourceType ResourceType() const { return mpTypeInfo->Type(); }
protected:
CResource* InternalLoad(IInputStream& rInput);

View File

@ -20,7 +20,7 @@ enum class EDatabaseVersion
// Add new versions before this line
Max,
Current = EDatabaseVersion::Max - 1
Current = Max - 1
};
class CResourceStore
@ -39,8 +39,8 @@ class CResourceStore
bool mDatabasePathExists;
public:
CResourceStore(const TString& rkDatabasePath);
CResourceStore(CGameProject *pProject);
explicit CResourceStore(const TString& rkDatabasePath);
explicit CResourceStore(CGameProject *pProject);
~CResourceStore();
bool SerializeDatabaseCache(IArchive& rArc);
bool LoadDatabaseCache();
@ -78,19 +78,19 @@ public:
static TString StaticDefaultResourceDirPath(EGame Game);
// Accessors
inline CGameProject* Project() const { return mpProj; }
inline EGame Game() const { return mGame; }
inline TString DatabaseRootPath() const { return mDatabasePath; }
inline bool DatabasePathExists() const { return mDatabasePathExists; }
inline TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; }
inline TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; }
inline CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; }
inline uint32 NumTotalResources() const { return mResourceEntries.size(); }
inline uint32 NumLoadedResources() const { return mLoadedResources.size(); }
inline bool IsCacheDirty() const { return mDatabaseCacheDirty; }
CGameProject* Project() const { return mpProj; }
EGame Game() const { return mGame; }
TString DatabaseRootPath() const { return mDatabasePath; }
bool DatabasePathExists() const { return mDatabasePathExists; }
TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; }
TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; }
CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; }
uint32 NumTotalResources() const { return mResourceEntries.size(); }
uint32 NumLoadedResources() const { return mLoadedResources.size(); }
bool IsCacheDirty() const { return mDatabaseCacheDirty; }
inline void SetCacheDirty() { mDatabaseCacheDirty = true; }
inline bool IsEditorStore() const { return mpProj == nullptr; }
void SetCacheDirty() { mDatabaseCacheDirty = true; }
bool IsEditorStore() const { return mpProj == nullptr; }
};
extern TString gDataDir;

View File

@ -19,7 +19,7 @@ class CVirtualDirectory
std::vector<CResourceEntry*> mResources;
public:
CVirtualDirectory(CResourceStore *pStore);
explicit CVirtualDirectory(CResourceStore *pStore);
CVirtualDirectory(const TString& rkName, CResourceStore *pStore);
CVirtualDirectory(CVirtualDirectory *pParent, const TString& rkName, CResourceStore *pStore);
~CVirtualDirectory();
@ -48,14 +48,14 @@ public:
static bool IsValidDirectoryPath(TString Path);
// Accessors
inline CVirtualDirectory* Parent() const { return mpParent; }
inline bool IsRoot() const { return !mpParent; }
inline TString Name() const { return mName; }
CVirtualDirectory* Parent() const { return mpParent; }
bool IsRoot() const { return !mpParent; }
TString Name() const { return mName; }
inline uint32 NumSubdirectories() const { return mSubdirectories.size(); }
inline CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; }
inline uint32 NumResources() const { return mResources.size(); }
inline CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; }
uint32 NumSubdirectories() const { return mSubdirectories.size(); }
CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; }
uint32 NumResources() const { return mResources.size(); }
CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; }
};
#endif // CVIRTUALDIRECTORY

View File

@ -12,14 +12,14 @@ class CCharacterUsageMap
{
std::map<CAssetID, std::vector<bool>> mUsageMap;
std::set<CAssetID> mStillLookingIDs;
CResourceStore *mpStore;
uint32 mLayerIndex;
bool mIsInitialArea;
bool mCurrentAreaAllowsDupes;
CResourceStore *mpStore = nullptr;
uint32 mLayerIndex = UINT32_MAX;
bool mIsInitialArea = true;
bool mCurrentAreaAllowsDupes = false;
public:
CCharacterUsageMap(CResourceStore *pStore)
: mpStore(pStore), mLayerIndex(-1), mIsInitialArea(true), mCurrentAreaAllowsDupes(false)
explicit CCharacterUsageMap(CResourceStore *pStore)
: mpStore(pStore)
{}
bool IsCharacterUsed(const CAssetID& rkID, uint32 CharacterIndex) const;
@ -47,19 +47,17 @@ class CPackageDependencyListBuilder
std::set<CAssetID> mPackageUsedAssets;
std::set<CAssetID> mAreaUsedAssets;
std::set<CAssetID> mUniversalAreaAssets;
bool mEnableDuplicates;
bool mCurrentAreaHasDuplicates;
bool mIsUniversalAreaAsset;
bool mIsPlayerActor;
bool mEnableDuplicates = false;
bool mCurrentAreaHasDuplicates = false;
bool mIsUniversalAreaAsset = false;
bool mIsPlayerActor = false;
public:
CPackageDependencyListBuilder(const CPackage *pkPackage)
explicit CPackageDependencyListBuilder(const CPackage *pkPackage)
: mpkPackage(pkPackage)
, mGame(pkPackage->Project()->Game())
, mpStore(pkPackage->Project()->ResourceStore())
, mGame(pkPackage->Project()->Game())
, mCharacterUsageMap(pkPackage->Project()->ResourceStore())
, mCurrentAreaHasDuplicates(false)
, mIsPlayerActor(false)
{
}
@ -79,10 +77,10 @@ class CAreaDependencyListBuilder
CCharacterUsageMap mCharacterUsageMap;
std::set<CAssetID> mBaseUsedAssets;
std::set<CAssetID> mLayerUsedAssets;
bool mIsPlayerActor;
bool mIsPlayerActor = false;
public:
CAreaDependencyListBuilder(CResourceEntry *pAreaEntry)
explicit CAreaDependencyListBuilder(CResourceEntry *pAreaEntry)
: mpAreaEntry(pAreaEntry)
, mpStore(pAreaEntry->ResourceStore())
, mGame(pAreaEntry->Game())
@ -106,7 +104,7 @@ class CAssetDependencyListBuilder
CAssetID mCurrentAnimSetID;
public:
CAssetDependencyListBuilder(CResourceEntry* pEntry)
explicit CAssetDependencyListBuilder(CResourceEntry* pEntry)
: mpResourceEntry(pEntry)
, mCharacterUsageMap(pEntry->ResourceStore())
{}

View File

@ -7,14 +7,12 @@
class IProgressNotifier
{
TString mTaskName;
int mTaskIndex;
int mTaskCount;
int mTaskIndex = 0;
int mTaskCount = 1;
public:
IProgressNotifier()
: mTaskIndex(0)
, mTaskCount(1)
{}
IProgressNotifier() = default;
virtual ~IProgressNotifier() = default;
void SetNumTasks(int NumTasks)
{
@ -67,9 +65,9 @@ protected:
class CNullProgressNotifier : public IProgressNotifier
{
public:
bool ShouldCancel() const { return false; }
bool ShouldCancel() const override{ return false; }
protected:
void UpdateProgress(const TString&, const TString&, float) {}
void UpdateProgress(const TString&, const TString&, float) override {}
};
extern CNullProgressNotifier *gpNullProgress;

View File

@ -6,6 +6,7 @@
class IUIRelay
{
public:
virtual ~IUIRelay() = default;
virtual void ShowMessageBox(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0;
virtual void ShowMessageBoxAsync(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0;
virtual bool AskYesNoQuestion(const TString& rkInfoBoxTitle, const TString& rkQuestion) = 0;

View File

@ -28,7 +28,7 @@ public:
void SetMultisamplingEnabled(bool Enable);
// Accessors
inline CTexture* Texture() const { return mpTexture; }
CTexture* Texture() const { return mpTexture; }
// Static
static void BindDefaultFramebuffer(GLenum Target = GL_FRAMEBUFFER);

View File

@ -6,25 +6,17 @@
class CRenderbuffer
{
GLuint mRenderbuffer;
uint mWidth, mHeight;
bool mEnableMultisampling;
bool mInitialized;
GLuint mRenderbuffer = 0;
uint mWidth = 0;
uint mHeight = 0;
bool mEnableMultisampling = false;
bool mInitialized = false;
public:
CRenderbuffer()
: mWidth(0)
, mHeight(0)
, mEnableMultisampling(false)
, mInitialized(false)
{
}
CRenderbuffer() = default;
CRenderbuffer(uint Width, uint Height)
: mWidth(Width)
, mHeight(Height)
, mEnableMultisampling(false)
, mInitialized(false)
{
}
@ -41,7 +33,7 @@ public:
InitStorage();
}
inline void Resize(uint Width, uint Height)
void Resize(uint Width, uint Height)
{
mWidth = Width;
mHeight = Height;
@ -50,23 +42,23 @@ public:
InitStorage();
}
inline void Bind()
void Bind()
{
if (!mInitialized) Init();
glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer);
}
inline void Unbind()
void Unbind()
{
glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
inline GLuint BufferID()
GLuint BufferID() const
{
return mRenderbuffer;
}
inline void SetMultisamplingEnabled(bool Enable)
void SetMultisamplingEnabled(bool Enable)
{
if (mEnableMultisampling != Enable)
{

View File

@ -47,7 +47,7 @@ public:
static CShader* CurrentShader();
static void KillCachedShader();
inline static int NumShaders() { return smNumShaders; }
static int NumShaders() { return smNumShaders; }
private:
void CacheCommonUniforms();

View File

@ -17,7 +17,7 @@ public:
SetBufferSize(0);
}
CUniformBuffer(uint Size)
explicit CUniformBuffer(uint Size)
{
glGenBuffers(1, &mUniformBuffer);
SetBufferSize(Size);
@ -65,7 +65,7 @@ public:
InitializeBuffer();
}
uint GetBufferSize()
uint GetBufferSize() const
{
return mBufferSize;
}

View File

@ -12,7 +12,7 @@ class CVertexArrayManager
{
std::unordered_map<CVertexBuffer*, GLuint> mVBOMap;
std::unordered_map<CDynamicVertexBuffer*, GLuint> mDynamicVBOMap;
uint32 mVectorIndex;
uint32 mVectorIndex = 0;
static std::vector<CVertexArrayManager*> sVAManagers;
static CVertexArrayManager *spCurrentManager;

View File

@ -3,7 +3,6 @@
CVertexBuffer::CVertexBuffer()
{
mBuffered = false;
SetVertexDesc(EVertexAttribute::Position | EVertexAttribute::Normal |
EVertexAttribute::Tex0 | EVertexAttribute::Tex1 |
EVertexAttribute::Tex2 | EVertexAttribute::Tex3 |
@ -216,12 +215,12 @@ void CVertexBuffer::Unbind()
glBindVertexArray(0);
}
bool CVertexBuffer::IsBuffered()
bool CVertexBuffer::IsBuffered() const
{
return mBuffered;
}
FVertexDescription CVertexBuffer::VertexDesc()
FVertexDescription CVertexBuffer::VertexDesc() const
{
return mVtxDesc;
}
@ -238,7 +237,7 @@ void CVertexBuffer::SetSkin(CSkin *pSkin)
mpSkin = pSkin;
}
uint32 CVertexBuffer::Size()
uint32 CVertexBuffer::Size() const
{
return mPositions.size();
}

View File

@ -19,11 +19,11 @@ class CVertexBuffer
std::vector<CVector2f> mTexCoords[8]; // Vectors of texture coordinates
std::vector<TBoneIndices> mBoneIndices; // Vectors of bone indices
std::vector<TBoneWeights> mBoneWeights; // Vectors of bone weights
bool mBuffered; // Bool value that indicates whether the attributes have been buffered.
bool mBuffered = false; // Bool value that indicates whether the attributes have been buffered.
public:
CVertexBuffer();
CVertexBuffer(FVertexDescription Desc);
explicit CVertexBuffer(FVertexDescription Desc);
~CVertexBuffer();
uint16 AddVertex(const CVertex& rkVtx);
uint16 AddIfUnique(const CVertex& rkVtx, uint16 Start);
@ -32,11 +32,11 @@ public:
void Buffer();
void Bind();
void Unbind();
bool IsBuffered();
FVertexDescription VertexDesc();
bool IsBuffered() const;
FVertexDescription VertexDesc() const;
void SetVertexDesc(FVertexDescription Desc);
void SetSkin(CSkin *pSkin);
uint32 Size();
uint32 Size() const;
GLuint CreateVAO();
};

View File

@ -12,19 +12,16 @@
class CRenderBucket
{
bool mEnableDepthSortDebugVisualization;
bool mEnableDepthSortDebugVisualization = false;
class CSubBucket
{
std::vector<SRenderablePtr> mRenderables;
uint32 mEstSize;
uint32 mSize;
uint32 mEstSize = 0;
uint32 mSize = 0;
public:
CSubBucket()
: mEstSize(0)
, mSize(0)
{}
CSubBucket() = default;
void Add(const SRenderablePtr &rkPtr);
void Sort(const CCamera *pkCamera, bool DebugVisualization);
@ -36,9 +33,7 @@ class CRenderBucket
CSubBucket mTransparentSubBucket;
public:
CRenderBucket()
: mEnableDepthSortDebugVisualization(false)
{}
CRenderBucket() = default;
void Add(const SRenderablePtr& rkPtr, bool Transparent);
void Clear();

View File

@ -11,8 +11,8 @@ class CRenderer;
class IRenderable
{
public:
IRenderable() {}
virtual ~IRenderable() {}
IRenderable() = default;
virtual ~IRenderable() = default;
virtual void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) = 0;
virtual void Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/) {}
virtual void DrawSelection() {}

View File

@ -9,28 +9,19 @@
struct SCollisionRenderSettings
{
uint64 HighlightMask;
uint64 HideMask;
int BoundingHierarchyRenderDepth;
uint64 HighlightMask = 0;
uint64 HideMask = 0;
int BoundingHierarchyRenderDepth = 0;
CCollisionMaterial HideMaterial;
bool DrawWireframe;
bool DrawBackfaces;
bool DrawAreaCollisionBounds;
bool DrawBoundingHierarchy;
bool TintWithSurfaceColor;
bool TintUnwalkableTris;
bool DrawWireframe = true;
bool DrawBackfaces = false;
bool DrawAreaCollisionBounds = true;
bool DrawBoundingHierarchy = false;
bool TintWithSurfaceColor = true;
bool TintUnwalkableTris = true;
SCollisionRenderSettings()
: HighlightMask(0)
, HideMask(0)
, BoundingHierarchyRenderDepth(0)
, DrawWireframe(true)
, DrawBackfaces(false)
, DrawAreaCollisionBounds(true)
, DrawBoundingHierarchy(false)
, TintWithSurfaceColor(true)
, TintUnwalkableTris(true) {}
SCollisionRenderSettings() = default;
};
struct SViewInfo

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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;
}

View File

@ -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

View File

@ -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);

View File

@ -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();
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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]);
}

View File

@ -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];

View File

@ -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)
{
}

View File

@ -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();

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -6,7 +6,8 @@
class CPoiToWorldCooker
{
CPoiToWorldCooker() {}
CPoiToWorldCooker() = default;
public:
static bool CookEGMC(CPoiToWorld *pPoiToWorld, IOutputStream& rOut);
};

View File

@ -14,7 +14,7 @@
class CResourceCooker
{
CResourceCooker() {}
CResourceCooker() = default;
public:
static bool CookResource(CResourceEntry *pEntry, IOutputStream& rOutput)

View File

@ -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);

View File

@ -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)
{}

View File

@ -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)
{

View File

@ -9,7 +9,7 @@ class CStringCooker
{
TResPtr<CStringTable> mpStringTable;
CStringCooker(CStringTable* pStringTable)
explicit CStringCooker(CStringTable* pStringTable)
: mpStringTable(pStringTable) {}
public:

View File

@ -1,10 +1,7 @@
#include "CTextureEncoder.h"
#include <Common/Log.h>
CTextureEncoder::CTextureEncoder()
: mpTexture(nullptr)
{
}
CTextureEncoder::CTextureEncoder() = default;
void CTextureEncoder::WriteTXTR(IOutputStream& rTXTR)
{

View File

@ -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);

View File

@ -8,7 +8,7 @@ class CPoiToWorldLoader
{
TResPtr<CPoiToWorld> mpPoiToWorld;
CPoiToWorldLoader() {}
CPoiToWorldLoader() = default;
public:
static CPoiToWorld* LoadEGMC(IInputStream& rEGMC, CResourceEntry *pEntry);

View File

@ -8,7 +8,7 @@ class CScanLoader
{
TResPtr<CScan> mpScan;
CScanLoader() {}
CScanLoader() = default;
CScan* LoadScanMP1(IInputStream& SCAN, CResourceEntry* pEntry);
CScan* LoadScanMP2(IInputStream& SCAN, CResourceEntry* pEntry);

View File

@ -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

View File

@ -8,9 +8,9 @@
class CSkeletonLoader
{
TResPtr<CSkeleton> mpSkeleton;
EGame mVersion;
EGame mVersion{};
CSkeletonLoader() {}
CSkeletonLoader() = default;
void SetLocalBoneCoords(CBone *pBone);
void CalculateBoneInverseBindMatrices();

View File

@ -6,7 +6,8 @@
class CSkinLoader
{
CSkinLoader() {}
CSkinLoader() = default;
public:
static CSkin* LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry);
};

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -9,7 +9,7 @@
class CWorldLoader
{
TResPtr<CWorld> mpWorld;
EGame mVersion;
EGame mVersion{};
CWorldLoader();
void LoadPrimeMLVL(IInputStream& rMLVL);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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);
};

View File

@ -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

View File

@ -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

View File

@ -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; }
};

View File

@ -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++)
{

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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;

View File

@ -66,7 +66,7 @@ public:
const char* Name() const;
const char* TypeName() const;
operator bool() const;
explicit operator bool() const;
void operator ++();
};

View File

@ -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()

View File

@ -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())
{

View File

@ -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>

View File

@ -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);

View File

@ -8,15 +8,13 @@ class CSceneNode;
struct SRayIntersection
{
bool Hit;
float Distance;
CVector3f HitPoint;
CSceneNode *pNode;
uint ComponentIndex;
SRayIntersection()
: Hit(false), Distance(0.f), HitPoint(CVector3f::skZero), pNode(nullptr), ComponentIndex(-1) {}
bool Hit = false;
float Distance = 0.0f;
CVector3f HitPoint{CVector3f::skZero};
CSceneNode *pNode = nullptr;
uint ComponentIndex = UINT32_MAX;
SRayIntersection() = default;
SRayIntersection(bool _Hit, float _Distance, CVector3f _HitPoint, CSceneNode *_pNode, uint _ComponentIndex)
: Hit(_Hit), Distance(_Distance), HitPoint(_HitPoint), pNode(_pNode), ComponentIndex(_ComponentIndex) {}
};

View File

@ -9,12 +9,12 @@ class CCollisionNode : public CSceneNode
TResPtr<CCollisionMeshGroup> mpCollision;
public:
CCollisionNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CCollisionMeshGroup *pCollision = 0);
ENodeType NodeType();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
CCollisionNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CCollisionMeshGroup *pCollision = nullptr);
ENodeType NodeType() override;
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
void SetCollision(CCollisionMeshGroup *pCollision);
};

View File

@ -8,21 +8,21 @@ class CLightNode : public CSceneNode
{
CLight *mpLight;
public:
CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CLight *Light = 0);
ENodeType NodeType();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo);
void DrawSelection();
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay &Ray, uint32 AssetID, const SViewInfo& ViewInfo);
CStructRef GetProperties() const;
void PropertyModified(IProperty* pProperty);
bool AllowsRotate() const { return false; }
CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CLight *Light = nullptr);
ENodeType NodeType() override;
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& ViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& Ray, uint32 AssetID, const SViewInfo& ViewInfo) override;
CStructRef GetProperties() const override;
void PropertyModified(IProperty* pProperty) override;
bool AllowsRotate() const override { return false; }
CLight* Light();
CVector2f BillboardScale();
protected:
void CalculateTransform(CTransform4f& rOut) const;
void CalculateTransform(CTransform4f& rOut) const override;
};
#endif // CLIGHTNODE_H

View File

@ -17,29 +17,29 @@ class CModelNode : public CSceneNode
public:
explicit CModelNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CModel *pModel = 0);
virtual ENodeType NodeType();
virtual void PostLoad();
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
virtual void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
virtual void DrawSelection();
virtual void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo);
virtual SRayIntersection RayNodeIntersectTest(const CRay &Ray, uint32 AssetID, const SViewInfo& rkViewInfo);
virtual CColor TintColor(const SViewInfo& rkViewInfo) const;
ENodeType NodeType() override;
void PostLoad() override;
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& Ray, uint32 AssetID, const SViewInfo& rkViewInfo) override;
CColor TintColor(const SViewInfo& rkViewInfo) const override;
// Setters
void SetModel(CModel *pModel);
inline void SetMatSet(uint32 MatSet) { mActiveMatSet = MatSet; }
inline void SetWorldModel(bool World) { mWorldModel = World; }
inline void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
inline void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; }
inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
inline CModel* Model() const { return mpModel; }
inline uint32 MatSet() const { return mActiveMatSet; }
inline bool IsWorldModel() const { return mWorldModel; }
inline uint32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
void SetMatSet(uint32 MatSet) { mActiveMatSet = MatSet; }
void SetWorldModel(bool World) { mWorldModel = World; }
void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
void ClearTintColor() { mTintColor = CColor::skWhite; }
void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; }
void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
CModel* Model() const { return mpModel; }
uint32 MatSet() const { return mActiveMatSet; }
bool IsWorldModel() const { return mWorldModel; }
uint32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
};
#endif // CMODELNODE_H

View File

@ -2,29 +2,28 @@
#define CROOTNODE_H
#include "CSceneNode.h"
#include <iostream>
// CRootNode's main purpose is to manage groups of other nodes as its children.
class CRootNode : public CSceneNode
{
public:
explicit CRootNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0)
explicit CRootNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr)
: CSceneNode(pScene, NodeID, pParent) {}
~CRootNode() {}
~CRootNode() = default;
ENodeType NodeType()
ENodeType NodeType() override
{
return ENodeType::Root;
}
inline void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) {}
void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) override {}
inline SRayIntersection RayNodeIntersectTest(const CRay &, uint32, const SViewInfo&)
SRayIntersection RayNodeIntersectTest(const CRay &, uint32, const SViewInfo&) override
{
return SRayIntersection();
}
inline void DrawSelection() {}
void DrawSelection() override {}
};
#endif // CROOTNODE_H

View File

@ -20,44 +20,44 @@ class CSceneIterator
public:
CSceneIterator(CScene *pScene, FNodeFlags AllowedNodeTypes = ENodeType::All, bool AllowHiddenNodes = false);
inline CSceneNode* Next()
CSceneNode* Next()
{
InternalFindNext();
return mpCurNode;
}
inline bool DoneIterating() const
bool DoneIterating() const
{
return (mpCurNode == nullptr);
}
inline CSceneNode* GetNode() const
CSceneNode* GetNode() const
{
return mpCurNode;
}
inline operator bool() const
explicit operator bool() const
{
return !DoneIterating();
}
inline CSceneNode* operator*() const
CSceneNode* operator*() const
{
return mpCurNode;
}
inline CSceneNode* operator->() const
CSceneNode* operator->() const
{
return mpCurNode;
}
inline CSceneIterator& operator++()
CSceneIterator& operator++()
{
Next();
return *this;
}
inline CSceneIterator operator++(int)
CSceneIterator operator++(int)
{
CSceneIterator Copy = *this;
Next();

View File

@ -26,15 +26,15 @@ public:
void ParentDisplayAssetChanged(CResource *pNewDisplayAsset);
CModel* Model() const;
ENodeType NodeType() { return ENodeType::ScriptAttach; }
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
void DrawSelection();
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
ENodeType NodeType() override { return ENodeType::ScriptAttach; }
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
inline IProperty* AttachProperty() const { return mpAttachAssetProp; }
inline TString LocatorName() const { return mLocatorName; }
IProperty* AttachProperty() const { return mpAttachAssetProp; }
TString LocatorName() const { return mLocatorName; }
protected:
void CalculateTransform(CTransform4f& rOut) const;

View File

@ -13,11 +13,7 @@
CScriptNode::CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CScriptObject *pInstance)
: CSceneNode(pScene, NodeID, pParent)
, mGameModeVisibility(EGameModeVisibility::Untested)
, mpVolumePreviewNode(nullptr)
, mHasVolumePreview(false)
, mpInstance(pInstance)
, mpExtra(nullptr)
{
ASSERT(pInstance);

View File

@ -13,7 +13,7 @@ class CScriptExtra;
class CScriptNode : public CSceneNode
{
CScriptObject *mpInstance;
CScriptExtra *mpExtra;
CScriptExtra *mpExtra = nullptr;
TResPtr<CResource> mpDisplayAsset;
uint32 mCharIndex;
@ -21,34 +21,37 @@ class CScriptNode : public CSceneNode
CCollisionNode *mpCollisionNode;
std::vector<CScriptAttachNode*> mAttachments;
bool mHasValidPosition;
bool mHasVolumePreview;
CModelNode *mpVolumePreviewNode;
bool mHasValidPosition = false;
bool mHasVolumePreview = false;
CModelNode *mpVolumePreviewNode = nullptr;
std::unique_ptr<CLightParameters> mpLightParameters;
public:
enum class EGameModeVisibility
{
Visible, NotVisible, Untested
} mGameModeVisibility;
Visible,
NotVisible,
Untested,
};
EGameModeVisibility mGameModeVisibility{EGameModeVisibility::Untested};
CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CScriptObject *pObject = 0);
ENodeType NodeType();
void PostLoad();
void OnTransformed();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
void DrawSelection();
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
bool AllowsRotate() const;
bool AllowsScale() const;
bool IsVisible() const;
CColor TintColor(const SViewInfo& rkViewInfo) const;
CColor WireframeColor() const;
CStructRef GetProperties() const;
void PropertyModified(IProperty* pProp);
CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CScriptObject *pObject = nullptr);
ENodeType NodeType() override;
void PostLoad() override;
void OnTransformed() override;
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
bool AllowsRotate() const override;
bool AllowsScale() const override;
bool IsVisible() const override;
CColor TintColor(const SViewInfo& rkViewInfo) const override;
CColor WireframeColor() const override;
CStructRef GetProperties() const override;
void PropertyModified(IProperty* pProp) override;
void LinksModified();
void UpdatePreviewVolume();
@ -69,9 +72,9 @@ public:
CTexture* ActiveBillboard() const;
bool UsesModel() const;
inline uint32 NumAttachments() const { return mAttachments.size(); }
inline CScriptAttachNode* Attachment(uint32 Index) const { return mAttachments[Index]; }
inline CResource* DisplayAsset() const { return mpDisplayAsset; }
uint32 NumAttachments() const { return mAttachments.size(); }
CScriptAttachNode* Attachment(uint32 Index) const { return mAttachments[Index]; }
CResource* DisplayAsset() const { return mpDisplayAsset; }
protected:
void SetDisplayAsset(CResource *pRes);

View File

@ -9,14 +9,14 @@ class CStaticNode : public CSceneNode
CStaticModel *mpModel;
public:
CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CStaticModel *pModel = 0);
ENodeType NodeType();
void PostLoad();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
void DrawSelection();
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CStaticModel *pModel = nullptr);
ENodeType NodeType() override;
void PostLoad() override;
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
};
#endif // CSTATICNODE_H

View File

@ -30,20 +30,20 @@ private:
float mCachedRayDistance;
public:
explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr);
~CDamageableTriggerExtra();
void CreateMaterial();
void UpdatePlaneTransform();
ERenderSide RenderSideForDirection(const CVector3f& rkDir);
ERenderSide TransformRenderSide(ERenderSide Side);
void OnTransformed();
void PropertyModified(IProperty* pProperty);
bool ShouldDrawNormalAssets();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
void DrawSelection();
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 ComponentIndex, const SViewInfo& rkViewInfo);
void OnTransformed() override;
void PropertyModified(IProperty* pProperty) override;
bool ShouldDrawNormalAssets() override;
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 ComponentIndex, const SViewInfo& rkViewInfo) override;
};
#endif // CDAMAGEABLETRIGGEREXTRA_H

View File

@ -14,13 +14,13 @@ class CDoorExtra : public CScriptExtra
CColor mShieldColor;
public:
explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
void PropertyModified(IProperty* pProperty);
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
void DrawSelection();
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr);
void PropertyModified(IProperty* pProperty) override;
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
void DrawSelection() override;
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
};
#endif // CDOOREXTRA_H

View File

@ -14,8 +14,8 @@ class CPointOfInterestExtra : public CScriptExtra
public:
explicit CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
void PropertyModified(IProperty* pProperty);
void ModifyTintColor(CColor& Color);
void PropertyModified(IProperty* pProperty) override;
void ModifyTintColor(CColor& Color) override;
CScan* GetScan() const { return mpScanData; }
static const CColor skRegularColor;

View File

@ -10,9 +10,9 @@ class CRadiusSphereExtra : public CScriptExtra
CFloatRef mRadius;
public:
explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr);
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
CColor Color() const;
CAABox Bounds() const;
};

View File

@ -26,7 +26,7 @@ protected:
EGame mGame;
public:
explicit CScriptExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0)
explicit CScriptExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr)
: CSceneNode(pScene, -1, pParent)
, mpScriptNode(pParent)
, mpInstance(pInstance)
@ -34,20 +34,20 @@ public:
{
}
virtual ~CScriptExtra() {}
inline CScriptObject* Instance() const { return mpInstance; }
inline EGame Game() const { return mGame; }
virtual ~CScriptExtra() = default;
CScriptObject* Instance() const { return mpInstance; }
EGame Game() const { return mGame; }
// Default implementations for CSceneNode
virtual ENodeType NodeType() { return ENodeType::ScriptExtra; }
virtual void RayAABoxIntersectTest(CRayCollisionTester& /*rTester*/, const SViewInfo& /*rkViewInfo*/) {}
virtual SRayIntersection RayNodeIntersectTest(const CRay& /*rkRay*/, uint32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/)
ENodeType NodeType() override { return ENodeType::ScriptExtra; }
void RayAABoxIntersectTest(CRayCollisionTester& /*rTester*/, const SViewInfo& /*rkViewInfo*/) override {}
SRayIntersection RayNodeIntersectTest(const CRay& /*rkRay*/, uint32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/) override
{
SRayIntersection out;
out.Hit = false;
return out;
}
virtual CColor WireframeColor() const { return mpParent->WireframeColor(); }
CColor WireframeColor() const override { return mpParent->WireframeColor(); }
// Virtual CScriptExtra functions
virtual void InstanceTransformed() {}

View File

@ -25,8 +25,8 @@ class CSpacePirateExtra : public CScriptExtra
TEnumRef<EVulnerabilityTypeMP1> mPlasmaVulnerability;
public:
explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
CColor TevColor();
explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr);
CColor TevColor() override;
};
#endif // CSPACEPIRATEEXTRA_H

Some files were not shown because too many files have changed in this diff Show More