From 42d021e757aad2d3187c8b82dbf176a72772ffd9 Mon Sep 17 00:00:00 2001 From: Aruki Date: Sat, 22 Sep 2018 23:54:34 -0600 Subject: [PATCH] More cleanup, renamed CMasterTemplate to CGameTemplate --- src/Core/CAreaAttributes.cpp | 4 +- src/Core/Core.pro | 8 +- src/Core/GameProject/CDependencyTree.cpp | 6 +- src/Core/GameProject/CGameExporter.cpp | 2 +- src/Core/GameProject/CGameProject.cpp | 2 +- src/Core/GameProject/CGameProject.h | 2 +- src/Core/Resource/Factory/CScriptLoader.cpp | 26 +- src/Core/Resource/Factory/CScriptLoader.h | 4 +- src/Core/Resource/Factory/CTemplateLoader.cpp | 330 +++++++++--------- src/Core/Resource/Factory/CTemplateLoader.h | 20 +- ...{CMasterTemplate.cpp => CGameTemplate.cpp} | 101 +++--- .../{CMasterTemplate.h => CGameTemplate.h} | 18 +- src/Core/Resource/Script/CScriptObject.cpp | 2 +- src/Core/Resource/Script/CScriptObject.h | 2 +- src/Core/Resource/Script/CScriptTemplate.cpp | 12 +- src/Core/Resource/Script/CScriptTemplate.h | 18 +- .../Resource/Script/Property/CByteProperty.h | 6 +- .../Resource/Script/Property/CColorProperty.h | 12 +- .../Resource/Script/Property/CEnumProperty.h | 28 +- .../Script/Property/CFlagsProperty.cpp | 2 +- .../Resource/Script/Property/CFlagsProperty.h | 6 +- .../Resource/Script/Property/CFloatProperty.h | 6 +- .../Resource/Script/Property/CGuidProperty.h | 6 +- .../Resource/Script/Property/CIntProperty.h | 6 +- .../Script/Property/CPointerProperty.h | 6 +- .../Property/CPropertyNameGenerator.cpp | 4 +- .../Script/Property/CSequenceProperty.h | 6 +- .../Resource/Script/Property/CShortProperty.h | 6 +- .../Resource/Script/Property/CSoundProperty.h | 4 +- .../Script/Property/CSplineProperty.h | 6 +- .../Script/Property/CStringProperty.h | 4 +- .../Script/Property/CStructProperty.cpp | 2 +- .../Script/Property/CStructProperty.h | 14 +- .../Script/Property/CVectorProperty.h | 10 +- .../Resource/Script/Property/IProperty.cpp | 126 +++---- src/Core/Resource/Script/Property/IProperty.h | 196 +++++------ .../Resource/Script/Property/TPropertyRef.h | 10 +- src/Core/Scene/CScriptAttachNode.cpp | 2 +- src/Core/Scene/CScriptNode.cpp | 4 +- src/Editor/CExportGameDialog.cpp | 2 +- src/Editor/CGeneratePropertyNamesDialog.cpp | 5 +- src/Editor/PropertyEdit/CPropertyDelegate.cpp | 138 ++++---- src/Editor/PropertyEdit/CPropertyModel.cpp | 78 ++--- src/Editor/PropertyEdit/CPropertyView.cpp | 38 +- src/Editor/WorldEditor/CInstancesModel.cpp | 12 +- src/Editor/WorldEditor/CInstancesModel.h | 4 +- src/Editor/WorldEditor/CLinkDialog.cpp | 12 +- src/Editor/WorldEditor/CLinkDialog.h | 4 +- src/Editor/WorldEditor/CLinkModel.cpp | 6 +- src/Editor/WorldEditor/CPoiMapSidebar.cpp | 4 +- src/Editor/WorldEditor/CStateMessageModel.h | 20 +- .../WorldEditor/CTemplateEditDialog.cpp | 27 +- src/Editor/WorldEditor/CTemplateEditDialog.h | 14 +- src/Editor/WorldEditor/CTemplateListView.h | 18 +- src/Editor/WorldEditor/CWorldEditor.cpp | 4 +- src/Editor/WorldEditor/WCreateTab.cpp | 4 +- src/Editor/WorldEditor/WCreateTab.h | 2 +- src/Editor/WorldEditor/WInstancesTab.cpp | 18 +- 58 files changed, 724 insertions(+), 715 deletions(-) rename src/Core/Resource/Script/{CMasterTemplate.cpp => CGameTemplate.cpp} (76%) rename src/Core/Resource/Script/{CMasterTemplate.h => CGameTemplate.h} (93%) diff --git a/src/Core/CAreaAttributes.cpp b/src/Core/CAreaAttributes.cpp index ed8c1bd9..e5319670 100644 --- a/src/Core/CAreaAttributes.cpp +++ b/src/Core/CAreaAttributes.cpp @@ -1,5 +1,5 @@ #include "CAreaAttributes.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include "Core/Resource/Script/CScriptLayer.h" CAreaAttributes::CAreaAttributes(CScriptObject *pObj) @@ -17,7 +17,7 @@ void CAreaAttributes::SetObject(CScriptObject *pObj) CStructProperty* pProperties = pTemplate->Properties(); mpObject = pObj; - mGame = pTemplate->MasterTemplate()->Game(); + mGame = pTemplate->GameTemplate()->Game(); mNeedSky = CBoolRef(pObj->PropertyData(), pProperties->ChildByIndex(1)); if (mGame == ePrime) diff --git a/src/Core/Core.pro b/src/Core/Core.pro index 10ceb07f..29125f60 100644 --- a/src/Core/Core.pro +++ b/src/Core/Core.pro @@ -110,7 +110,6 @@ HEADERS += \ Resource/Model/CStaticModel.h \ Resource/Model/CVertex.h \ Resource/Model/SSurface.h \ - Resource/Script/CMasterTemplate.h \ Resource/Script/CScriptLayer.h \ Resource/Script/CScriptObject.h \ Resource/Script/CScriptTemplate.h \ @@ -249,7 +248,8 @@ HEADERS += \ Resource/Script/Property/CVectorProperty.h \ Resource/Script/Property/CColorProperty.h \ Resource/Script/Property/CStructProperty.h \ - Resource/Script/Property/CGuidProperty.h + Resource/Script/Property/CGuidProperty.h \ + Resource/Script/CGameTemplate.h # Source Files SOURCES += \ @@ -279,7 +279,6 @@ SOURCES += \ Resource/Model/CModel.cpp \ Resource/Model/CStaticModel.cpp \ Resource/Model/SSurface.cpp \ - Resource/Script/CMasterTemplate.cpp \ Resource/Script/CScriptObject.cpp \ Resource/Script/CScriptTemplate.cpp \ Resource/CCollisionMesh.cpp \ @@ -359,7 +358,8 @@ SOURCES += \ Resource/Script/Property/CPropertyNameGenerator.cpp \ Resource/Script/Property/IProperty.cpp \ Resource/Script/Property/CStructProperty.cpp \ - Resource/Script/Property/CFlagsProperty.cpp + Resource/Script/Property/CFlagsProperty.cpp \ + Resource/Script/CGameTemplate.cpp # Codegen CODEGEN_DIR = $$EXTERNALS_DIR/CodeGen diff --git a/src/Core/GameProject/CDependencyTree.cpp b/src/Core/GameProject/CDependencyTree.cpp index 567dd396..50894762 100644 --- a/src/Core/GameProject/CDependencyTree.cpp +++ b/src/Core/GameProject/CDependencyTree.cpp @@ -1,7 +1,7 @@ #include "CDependencyTree.h" #include "Core/GameProject/CGameProject.h" #include "Core/Resource/Animation/CAnimSet.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include "Core/Resource/Script/CScriptLayer.h" #include "Core/Resource/Script/CScriptObject.h" @@ -360,7 +360,7 @@ void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector& rModuleDepsOut, std::vector& rModuleLayerOffsetsOut) const { - CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game); + CGameTemplate *pGame = CGameTemplate::GetGameTemplate(Game); // Output module list will be split per-script layer // The output offset list contains two offsets per layer - start index and end index @@ -386,7 +386,7 @@ void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector if (UsedObjectTypes.find(ObjType) == UsedObjectTypes.end()) { // Get the module list for this object type and check whether any of them are new before adding them to the output list - CScriptTemplate *pTemplate = pMaster->TemplateByID(ObjType); + CScriptTemplate *pTemplate = pGame->TemplateByID(ObjType); const std::vector& rkModules = pTemplate->RequiredModules(); for (u32 iMod = 0; iMod < rkModules.size(); iMod++) diff --git a/src/Core/GameProject/CGameExporter.cpp b/src/Core/GameProject/CGameExporter.cpp index 5bca3f69..68fa9ea3 100644 --- a/src/Core/GameProject/CGameExporter.cpp +++ b/src/Core/GameProject/CGameExporter.cpp @@ -4,7 +4,7 @@ #include "CResourceStore.h" #include "Core/CompressionUtil.h" #include "Core/Resource/CWorld.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include #include #include diff --git a/src/Core/GameProject/CGameProject.cpp b/src/Core/GameProject/CGameProject.cpp index 826de08d..547e8417 100644 --- a/src/Core/GameProject/CGameProject.cpp +++ b/src/Core/GameProject/CGameProject.cpp @@ -1,7 +1,7 @@ #include "CGameProject.h" #include "IUIRelay.h" #include "Core/Resource/Factory/CTemplateLoader.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include #include diff --git a/src/Core/GameProject/CGameProject.h b/src/Core/GameProject/CGameProject.h index 4d60d608..8dbdfda0 100644 --- a/src/Core/GameProject/CGameProject.h +++ b/src/Core/GameProject/CGameProject.h @@ -6,7 +6,7 @@ #include "CResourceStore.h" #include "Core/CAudioManager.h" #include "Core/IProgressNotifier.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include #include #include diff --git a/src/Core/Resource/Factory/CScriptLoader.cpp b/src/Core/Resource/Factory/CScriptLoader.cpp index f0bab080..378bebee 100644 --- a/src/Core/Resource/Factory/CScriptLoader.cpp +++ b/src/Core/Resource/Factory/CScriptLoader.cpp @@ -1,7 +1,7 @@ #include "CScriptLoader.h" #include "CTemplateLoader.h" #include "Core/GameProject/CResourceStore.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include "Core/Resource/Script/Property/CArrayProperty.h" #include "Core/Resource/Script/Property/CAssetProperty.h" #include "Core/Resource/Script/Property/CEnumProperty.h" @@ -131,7 +131,7 @@ void CScriptLoader::ReadProperty(IProperty *pProp, u32 Size, IInputStream& rSCLY case EPropertyType::Asset: { CAssetProperty* pAsset = TPropCast(pProp); - pAsset->ValueRef(pData) = CAssetID(rSCLY, mpMaster->Game()); + pAsset->ValueRef(pData) = CAssetID(rSCLY, mpGameTemplate->Game()); #if VALIDATE_PROPERTY_VALUES CAssetID ID = pAsset->ValueRef(pData); @@ -170,7 +170,7 @@ void CScriptLoader::ReadProperty(IProperty *pProp, u32 Size, IInputStream& rSCLY case EPropertyType::AnimationSet: { CAnimationSetProperty* pAnimSet = TPropCast(pProp); - pAnimSet->ValueRef(pData) = CAnimationParameters(rSCLY, mpMaster->Game()); + pAnimSet->ValueRef(pData) = CAnimationParameters(rSCLY, mpGameTemplate->Game()); break; } @@ -278,7 +278,7 @@ CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& rSCLY) u32 Size = rSCLY.ReadLong(); u32 End = rSCLY.Tell() + Size; - CScriptTemplate *pTemplate = mpMaster->TemplateByID((u32) Type); + CScriptTemplate *pTemplate = mpGameTemplate->TemplateByID((u32) Type); if (!pTemplate) { // No valid template for this object; can't load @@ -385,7 +385,7 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& rSCLY) u16 ObjectSize = rSCLY.ReadShort(); u32 ObjEnd = rSCLY.Tell() + ObjectSize; - CScriptTemplate* pTemplate = mpMaster->TemplateByID(ObjectID); + CScriptTemplate* pTemplate = mpGameTemplate->TemplateByID(ObjectID); if (!pTemplate) { @@ -447,16 +447,16 @@ CScriptLayer* CScriptLoader::LoadLayer(IInputStream& rSCLY, CGameArea *pArea, EG CScriptLoader Loader; Loader.mVersion = Version; - Loader.mpMaster = CMasterTemplate::MasterForGame(Version); + Loader.mpGameTemplate = CGameTemplate::GetGameTemplate(Version); Loader.mpArea = pArea; - if (!Loader.mpMaster) + if (!Loader.mpGameTemplate) { - Log::Write("This game doesn't have a master template; couldn't load script layer"); + Log::Write("This game doesn't have a game template; couldn't load script layer"); return nullptr; } - if (!Loader.mpMaster->IsLoadedSuccessfully()) + if (!Loader.mpGameTemplate->IsLoadedSuccessfully()) CTemplateLoader::LoadGameTemplates(Version); if (Version <= ePrime) @@ -471,17 +471,17 @@ CScriptObject* CScriptLoader::LoadInstance(IInputStream& rSCLY, CGameArea *pArea CScriptLoader Loader; Loader.mVersion = (ForceReturnsFormat ? eReturns : Version); - Loader.mpMaster = CMasterTemplate::MasterForGame(Version); + Loader.mpGameTemplate = CGameTemplate::GetGameTemplate(Version); Loader.mpArea = pArea; Loader.mpLayer = pLayer; - if (!Loader.mpMaster) + if (!Loader.mpGameTemplate) { - Log::Write("This game doesn't have a master template; couldn't load script instance"); + Log::Write("This game doesn't have a game template; couldn't load script instance"); return nullptr; } - if (!Loader.mpMaster->IsLoadedSuccessfully()) + if (!Loader.mpGameTemplate->IsLoadedSuccessfully()) CTemplateLoader::LoadGameTemplates(Version); if (Loader.mVersion <= ePrime) diff --git a/src/Core/Resource/Factory/CScriptLoader.h b/src/Core/Resource/Factory/CScriptLoader.h index 6512701d..26e94f94 100644 --- a/src/Core/Resource/Factory/CScriptLoader.h +++ b/src/Core/Resource/Factory/CScriptLoader.h @@ -5,7 +5,7 @@ #include "Core/Resource/Area/CGameArea.h" #include "Core/Resource/Script/CScriptObject.h" #include "Core/Resource/Script/CScriptLayer.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" class CScriptLoader { @@ -13,7 +13,7 @@ class CScriptLoader CScriptObject* mpObj; CScriptLayer* mpLayer; CGameArea* mpArea; - CMasterTemplate *mpMaster; + CGameTemplate *mpGameTemplate; // Current array item pointer void* mpArrayItemData; diff --git a/src/Core/Resource/Factory/CTemplateLoader.cpp b/src/Core/Resource/Factory/CTemplateLoader.cpp index a8c116b5..9cd465ce 100644 --- a/src/Core/Resource/Factory/CTemplateLoader.cpp +++ b/src/Core/Resource/Factory/CTemplateLoader.cpp @@ -11,45 +11,45 @@ using namespace tinyxml2; // ugly macro because this is all temp code anyway so whatever #define SET_MEMBER_CASES_NUMERICAL(MemberName, Param, LParam) \ - case EPropertyTypeNew::Byte:\ + case EPropertyType::Byte:\ TPropCast(pProp)->MemberName = (s8) LParam.ToInt32(10);\ break;\ \ - case EPropertyTypeNew::Short:\ + case EPropertyType::Short:\ TPropCast(pProp)->MemberName = (s16) LParam.ToInt32(10);\ break;\ \ - case EPropertyTypeNew::Int:\ + case EPropertyType::Int:\ TPropCast(pProp)->MemberName = (s32) LParam.ToInt32(10);\ break;\ \ - case EPropertyTypeNew::Float:\ + case EPropertyType::Float:\ TPropCast(pProp)->MemberName = LParam.ToFloat();\ break;\ \ #define SET_MEMBER_CASES_NON_NUMERICAL(MemberName, Param, LParam) \ - case EPropertyTypeNew::Bool:\ + case EPropertyType::Bool:\ TPropCast(pProp)->MemberName = (LParam == "true");\ break;\ \ - case EPropertyTypeNew::Choice:\ + case EPropertyType::Choice:\ TPropCast(pProp)->MemberName = LParam.ToInt32( LParam.StartsWith("0x") ? 16 : 10 );\ break;\ \ - case EPropertyTypeNew::Enum:\ + case EPropertyType::Enum:\ TPropCast(pProp)->MemberName = LParam.ToInt32( LParam.StartsWith("0x") ? 16 : 10 );\ break;\ \ - case EPropertyTypeNew::Flags:\ + case EPropertyType::Flags:\ TPropCast(pProp)->MemberName = LParam.ToInt32( LParam.StartsWith("0x") ? 16 : 10 );\ break;\ \ - case EPropertyTypeNew::String:\ + case EPropertyType::String:\ TPropCast(pProp)->MemberName = Param;\ break;\ \ - case EPropertyTypeNew::Vector:\ + case EPropertyType::Vector:\ {\ TStringList Components = Param.Split(", ");\ if (Components.size() != 3) {\ @@ -64,7 +64,7 @@ using namespace tinyxml2; }\ break;\ }\ - case EPropertyTypeNew::Color:\ + case EPropertyType::Color:\ {\ TStringList Components = Param.Split(", ");\ if (Components.size() < 3 || Components.size() > 4) {\ @@ -79,11 +79,11 @@ using namespace tinyxml2; }\ break;\ }\ - case EPropertyTypeNew::Asset:\ + case EPropertyType::Asset:\ TPropCast(pProp)->MemberName = CAssetID::FromString(Param);\ break;\ \ - case EPropertyTypeNew::Sound:\ + case EPropertyType::Sound:\ TPropCast(pProp)->MemberName = LParam.ToInt32(10);\ break;\ \ @@ -107,29 +107,29 @@ using namespace tinyxml2; break;\ }\ -EPropertyTypeNew PropStringToPropEnum(TString Prop) +EPropertyType PropStringToPropEnum(TString Prop) { Prop = Prop.ToLower(); - if (Prop == "bool") return EPropertyTypeNew::Bool; - if (Prop == "byte") return EPropertyTypeNew::Byte; - if (Prop == "short") return EPropertyTypeNew::Short; - if (Prop == "long") return EPropertyTypeNew::Int; - if (Prop == "enum") return EPropertyTypeNew::Enum; - if (Prop == "bitfield") return EPropertyTypeNew::Flags; - if (Prop == "float") return EPropertyTypeNew::Float; - if (Prop == "string") return EPropertyTypeNew::String; - if (Prop == "color") return EPropertyTypeNew::Color; - if (Prop == "vector3f") return EPropertyTypeNew::Vector; - if (Prop == "sound") return EPropertyTypeNew::Sound; - if (Prop == "asset") return EPropertyTypeNew::Asset; - if (Prop == "struct") return EPropertyTypeNew::Struct; - if (Prop == "array") return EPropertyTypeNew::Array; - if (Prop == "character") return EPropertyTypeNew::AnimationSet; - if (Prop == "mayaspline") return EPropertyTypeNew::Spline; - return EPropertyTypeNew::Invalid; + if (Prop == "bool") return EPropertyType::Bool; + if (Prop == "byte") return EPropertyType::Byte; + if (Prop == "short") return EPropertyType::Short; + if (Prop == "long") return EPropertyType::Int; + if (Prop == "enum") return EPropertyType::Enum; + if (Prop == "bitfield") return EPropertyType::Flags; + if (Prop == "float") return EPropertyType::Float; + if (Prop == "string") return EPropertyType::String; + if (Prop == "color") return EPropertyType::Color; + if (Prop == "vector3f") return EPropertyType::Vector; + if (Prop == "sound") return EPropertyType::Sound; + if (Prop == "asset") return EPropertyType::Asset; + if (Prop == "struct") return EPropertyType::Struct; + if (Prop == "array") return EPropertyType::Array; + if (Prop == "character") return EPropertyType::AnimationSet; + if (Prop == "mayaspline") return EPropertyType::Spline; + return EPropertyType::Invalid; } -IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* pScript, CStructPropertyNew* pParent, const TString& rkTemplateName) +IProperty* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* pScript, CStructProperty* pParent, const TString& rkTemplateName) { TString NodeType = TString(pElem->Name()).ToLower(); TString IDAttr = TString(pElem->Attribute("ID")).ToLower(); @@ -150,16 +150,16 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* if (!NameAttr.IsEmpty()) Name = NameAttr; else if (mGame >= eEchoesDemo) - Name = CMasterTemplate::PropertyName(ID); + Name = CGameTemplate::PropertyName(ID); else { - Log::Error(rkTemplateName + ": Property " + TString::HexString(ID) + " doesn't have a name either in the template itself nor in the master list"); + Log::Error(rkTemplateName + ": Property " + TString::HexString(ID) + " doesn't have a name either in the template itself nor in the game list"); return nullptr; } // Does the property already exist (eg is this an override)? - IPropertyNew* pProp = pParent->ChildByID(ID); - EPropertyTypeNew Type; + IProperty* pProp = pParent->ChildByID(ID); + EPropertyType Type; bool IsNewProperty = false; // If it doesn't, then we'll need to create it. @@ -170,7 +170,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* Type = PropStringToPropEnum(TypeStr); IsNewProperty = true; - if (Type == EPropertyTypeNew::Invalid) + if (Type == EPropertyType::Invalid) { if (TypeStr.IsEmpty()) Log::Error(rkTemplateName + ": Property " + TString::HexString(ID) + " doesn't have a type set"); @@ -181,27 +181,27 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* } // Load archetype if required - bool bNeedsArchetype = ( Type == EPropertyTypeNew::Struct || - Type == EPropertyTypeNew::Enum || - Type == EPropertyTypeNew::Choice || - Type == EPropertyTypeNew::Flags ); + bool bNeedsArchetype = ( Type == EPropertyType::Struct || + Type == EPropertyType::Enum || + Type == EPropertyType::Choice || + Type == EPropertyType::Flags ); if (bNeedsArchetype) { - IPropertyNew* pArchetype = nullptr; + IProperty* pArchetype = nullptr; //todo: struct archetypes are not supposed to be optional but apparently some still don't have them if (!TemplateAttr.IsEmpty()) { - if (Type == EPropertyTypeNew::Struct) + if (Type == EPropertyType::Struct) { pArchetype = LoadStructArchetype(TemplateAttr); } - else if (Type == EPropertyTypeNew::Enum || Type == EPropertyTypeNew::Choice) + else if (Type == EPropertyType::Enum || Type == EPropertyType::Choice) { - pArchetype = LoadEnumArchetype(TemplateAttr, Type == EPropertyTypeNew::Choice); + pArchetype = LoadEnumArchetype(TemplateAttr, Type == EPropertyType::Choice); } - else if (Type == EPropertyTypeNew::Flags) + else if (Type == EPropertyType::Flags) { pArchetype = LoadFlagsArchetype(TemplateAttr); } @@ -210,14 +210,14 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* // create property as a copy of the archetype if (pArchetype != nullptr) { - pProp = IPropertyNew::CreateCopy(pArchetype); + pProp = IProperty::CreateCopy(pArchetype); } } // no archetype, so do normal create if (!pProp) { - pProp = IPropertyNew::Create(Type, mGame); + pProp = IProperty::Create(Type, mGame); } // we need to have a valid property by this point @@ -251,7 +251,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* while (pVersion) { TString VerName = pVersion->GetText(); - u32 VerIdx = mpMaster->GameVersion(VerName); + u32 VerIdx = mpGameTemplate->GameVersion(VerName); if (VerIdx == -1) Log::Error(rkTemplateName + ": Property " + TString::HexString(ID) + " has invalid version \"" + VerName + "\""); @@ -272,11 +272,11 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* TString lValue = ParamVal.ToLower(); if (lValue == "always") - pProp->mCookPreference = ECookPreferenceNew::Always; + pProp->mCookPreference = ECookPreference::Always; else if (lValue == "never") - pProp->mCookPreference = ECookPreferenceNew::Never; + pProp->mCookPreference = ECookPreference::Never; else - pProp->mCookPreference = ECookPreferenceNew::Default; + pProp->mCookPreference = ECookPreference::Default; } else if (ParamName == "description") { @@ -304,7 +304,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* } // Asset-specific parameters - if (Type == EPropertyTypeNew::Asset) + if (Type == EPropertyType::Asset) { TString ExtensionsAttr = pElem->Attribute("extensions"); @@ -317,7 +317,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* } // Enum-specific parameters - else if (Type == EPropertyTypeNew::Enum || Type == EPropertyTypeNew::Choice) + else if (Type == EPropertyType::Enum || Type == EPropertyType::Choice) { // use static_cast so we can do both enum and choice with this code CEnumProperty* pEnum = static_cast(pProp); @@ -330,7 +330,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* } // Bitfield-specific parameters - else if (Type == EPropertyTypeNew::Flags) + else if (Type == EPropertyType::Flags) { CFlagsProperty* pFlags = TPropCast(pProp); @@ -342,13 +342,13 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* } // Struct-specific parameters - else if ( (Type == EPropertyTypeNew::Struct) || (Type == EPropertyTypeNew::Array) ) + else if ( (Type == EPropertyType::Struct) || (Type == EPropertyType::Array) ) { - CStructPropertyNew* pStruct = nullptr; + CStructProperty* pStruct = nullptr; - if (Type == EPropertyTypeNew::Struct) + if (Type == EPropertyType::Struct) { - pStruct = TPropCast(pProp); + pStruct = TPropCast(pProp); } else { @@ -356,14 +356,14 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* if (pArray->mpItemArchetype != nullptr) { - ASSERT(pArray->mpItemArchetype->Type() == EPropertyTypeNew::Struct); - pStruct = TPropCast(pArray->mpItemArchetype); + ASSERT(pArray->mpItemArchetype->Type() == EPropertyType::Struct); + pStruct = TPropCast(pArray->mpItemArchetype); } else { if (Name == "Activation Times") { - CFloatProperty* pFloatItem = (CFloatProperty*) IPropertyNew::Create(EPropertyTypeNew::Float, mGame); + CFloatProperty* pFloatItem = (CFloatProperty*) IProperty::Create(EPropertyType::Float, mGame); pFloatItem->mName = "Time"; pFloatItem->mID = 0; pFloatItem->mDefaultValue = 0.0f; @@ -372,8 +372,8 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* } else { - pArray->mpItemArchetype = IPropertyNew::Create(EPropertyTypeNew::Struct, mGame); - pStruct = TPropCast(pArray->mpItemArchetype); + pArray->mpItemArchetype = IProperty::Create(EPropertyType::Struct, mGame); + pStruct = TPropCast(pArray->mpItemArchetype); pStruct->mFlags = EPropertyFlag::IsAtomic | EPropertyFlag::IsArrayArchetype; } } @@ -395,7 +395,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* if (IsNewProperty) { - CMasterTemplate::AddProperty(pProp, mMasterDir + rkTemplateName); + CGameTemplate::AddProperty(pProp, mGameDir + rkTemplateName); if (pParent) pParent->mChildren.push_back(pProp); @@ -404,28 +404,28 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* return pProp; } -CStructPropertyNew* CTemplateLoader::LoadStructArchetype(const TString& rkTemplateFileName) +CStructProperty* CTemplateLoader::LoadStructArchetype(const TString& rkTemplateFileName) { // Check whether this struct has already been read TString StructName = rkTemplateFileName.GetFileName(false); - CStructPropertyNew* pArchetype = static_cast( mpMaster->FindPropertyArchetype(StructName) ); + CStructProperty* pArchetype = static_cast( mpGameTemplate->FindPropertyArchetype(StructName) ); // Names cannot be shared between multiple property archetypes if (pArchetype != nullptr) { - ASSERT(pArchetype->Type() == EPropertyTypeNew::Struct); + ASSERT(pArchetype->Type() == EPropertyType::Struct); } - // If the struct template hasn't been read yet, then we read it and add it to master's list + // If the struct template hasn't been read yet, then we read it and add it to game's list if (!pArchetype) { XMLDocument Doc; - OpenXML(mskTemplatesDir + mMasterDir + rkTemplateFileName, Doc); + OpenXML(mskTemplatesDir + mGameDir + rkTemplateFileName, Doc); if (!Doc.Error()) { - pArchetype = TPropCast( - IPropertyNew::Create(EPropertyTypeNew::Struct, mGame) + pArchetype = TPropCast( + IProperty::Create(EPropertyType::Struct, mGame) ); ASSERT(pArchetype != nullptr); @@ -468,10 +468,10 @@ CStructPropertyNew* CTemplateLoader::LoadStructArchetype(const TString& rkTempla LoadProperties(pSubPropsElem, nullptr, pArchetype, rkTemplateFileName); pArchetype->Initialize(nullptr, nullptr, 0); - mpMaster->mPropertyTemplates.emplace( + mpGameTemplate->mPropertyTemplates.emplace( std::make_pair( StructName, - CMasterTemplate::SPropertyTemplatePath(rkTemplateFileName, pArchetype) + CGameTemplate::SPropertyTemplatePath(rkTemplateFileName, pArchetype) )); } } @@ -484,25 +484,25 @@ CEnumProperty* CTemplateLoader::LoadEnumArchetype(const TString& rkTemplateFileN { // Check whether this struct has already been read TString EnumName = rkTemplateFileName.GetFileName(false); - CEnumProperty* pArchetype = static_cast( mpMaster->FindPropertyArchetype(EnumName) ); + CEnumProperty* pArchetype = static_cast( mpGameTemplate->FindPropertyArchetype(EnumName) ); // Names cannot be shared between multiple property archetypes if (pArchetype != nullptr) { - ASSERT(pArchetype->Type() == EPropertyTypeNew::Enum || pArchetype->Type() == EPropertyTypeNew::Choice); + ASSERT(pArchetype->Type() == EPropertyType::Enum || pArchetype->Type() == EPropertyType::Choice); } - // If the enum template hasn't been read yet, then we read it and add it to master's list + // If the enum template hasn't been read yet, then we read it and add it to game's list if (!pArchetype) { XMLDocument Doc; - OpenXML(mskTemplatesDir + mMasterDir + rkTemplateFileName, Doc); + OpenXML(mskTemplatesDir + mGameDir + rkTemplateFileName, Doc); if (!Doc.Error()) { // use static_cast so this code works for both enum and choice pArchetype = static_cast( - IPropertyNew::Create(bIsChoice ? EPropertyTypeNew::Choice : EPropertyTypeNew::Enum, mGame) + IProperty::Create(bIsChoice ? EPropertyType::Choice : EPropertyType::Enum, mGame) ); ASSERT(pArchetype != nullptr); @@ -519,10 +519,10 @@ CEnumProperty* CTemplateLoader::LoadEnumArchetype(const TString& rkTemplateFileN LoadEnumerators(pEnumers, pArchetype, rkTemplateFileName); pArchetype->Initialize(nullptr, nullptr, 0); - mpMaster->mPropertyTemplates.emplace( + mpGameTemplate->mPropertyTemplates.emplace( std::make_pair( EnumName, - CMasterTemplate::SPropertyTemplatePath(rkTemplateFileName, pArchetype) + CGameTemplate::SPropertyTemplatePath(rkTemplateFileName, pArchetype) )); } } @@ -535,24 +535,24 @@ CFlagsProperty* CTemplateLoader::LoadFlagsArchetype(const TString& rkTemplateFil { // Check whether this struct has already been read TString FlagsName = rkTemplateFileName.GetFileName(false); - CFlagsProperty* pArchetype = static_cast( mpMaster->FindPropertyArchetype(FlagsName) ); + CFlagsProperty* pArchetype = static_cast( mpGameTemplate->FindPropertyArchetype(FlagsName) ); // Names cannot be shared between multiple property archetypes if (pArchetype != nullptr) { - ASSERT(pArchetype->Type() == EPropertyTypeNew::Flags); + ASSERT(pArchetype->Type() == EPropertyType::Flags); } - // If the enum template hasn't been read yet, then we read it and add it to master's list + // If the enum template hasn't been read yet, then we read it and add it to game's list if (!pArchetype) { XMLDocument Doc; - OpenXML(mskTemplatesDir + mMasterDir + rkTemplateFileName, Doc); + OpenXML(mskTemplatesDir + mGameDir + rkTemplateFileName, Doc); if (!Doc.Error()) { pArchetype = TPropCast( - IPropertyNew::Create(EPropertyTypeNew::Flags, mGame) + IProperty::Create(EPropertyType::Flags, mGame) ); ASSERT(pArchetype != nullptr); @@ -569,10 +569,10 @@ CFlagsProperty* CTemplateLoader::LoadFlagsArchetype(const TString& rkTemplateFil LoadBitFlags(pFlags, pArchetype, rkTemplateFileName); pArchetype->Initialize(nullptr, nullptr, 0); - mpMaster->mPropertyTemplates.emplace( + mpGameTemplate->mPropertyTemplates.emplace( std::make_pair( FlagsName, - CMasterTemplate::SPropertyTemplatePath(rkTemplateFileName, pArchetype) + CGameTemplate::SPropertyTemplatePath(rkTemplateFileName, pArchetype) )); } @@ -582,7 +582,7 @@ CFlagsProperty* CTemplateLoader::LoadFlagsArchetype(const TString& rkTemplateFil return pArchetype; } -void CTemplateLoader::LoadProperties(XMLElement *pPropertiesElem, CScriptTemplate *pScript, CStructPropertyNew* pStruct, const TString& rkTemplateName) +void CTemplateLoader::LoadProperties(XMLElement *pPropertiesElem, CScriptTemplate *pScript, CStructProperty* pStruct, const TString& rkTemplateName) { XMLElement *pChild = pPropertiesElem->FirstChildElement(); @@ -661,12 +661,12 @@ void CTemplateLoader::LoadBitFlags(XMLElement *pFlagsElem, CFlagsProperty* pFlag // ************ SCRIPT OBJECT ************ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TString& rkTemplateName, u32 ObjectID) { - CScriptTemplate *pScript = new CScriptTemplate(mpMaster); + CScriptTemplate *pScript = new CScriptTemplate(mpGameTemplate); pScript->mObjectID = ObjectID; pScript->mSourceFile = rkTemplateName; - IPropertyNew* pBaseStruct = IPropertyNew::Create(EPropertyTypeNew::Struct, mGame); - pScript->mpProperties = std::make_unique( *TPropCast(pBaseStruct) ); + IProperty* pBaseStruct = IProperty::Create(EPropertyType::Struct, mGame); + pScript->mpProperties = std::make_unique( *TPropCast(pBaseStruct) ); XMLElement *pRoot = pDoc->FirstChildElement("ScriptTemplate"); @@ -845,11 +845,11 @@ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TS Attachment.AttachType = eAttach; // Validate property - IPropertyNew* pProp = pScript->mpProperties->ChildByIDString(Attachment.AttachProperty); + IProperty* pProp = pScript->mpProperties->ChildByIDString(Attachment.AttachProperty); if (!pProp) Log::Error(rkTemplateName + ": Invalid property for attachment " + TString::FromInt32(AttachIdx) + ": " + Attachment.AttachProperty); - else if (pProp->Type() != EPropertyTypeNew::AnimationSet && (pProp->Type() != EPropertyTypeNew::Asset || !TPropCast(pProp)->GetTypeFilter().Accepts(eModel))) + else if (pProp->Type() != EPropertyType::AnimationSet && (pProp->Type() != EPropertyType::Asset || !TPropCast(pProp)->GetTypeFilter().Accepts(eModel))) Log::Error(rkTemplateName + ": Property referred to by attachment " + TString::FromInt32(AttachIdx) + " is not an attachable asset! Must be a file property that accepts CMDLs, or an animation set property."); else @@ -986,11 +986,11 @@ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TS return pScript; } -// ************ MASTER ************ -void CTemplateLoader::LoadMasterTemplate(XMLDocument *pDoc, CMasterTemplate *pMaster) +// ************ GAME ************ +void CTemplateLoader::LoadGameTemplate(XMLDocument *pDoc, CGameTemplate *pGame) { - mpMaster = pMaster; - mMasterDir = pMaster->mSourceFile.GetFileDirectory(); + mpGameTemplate = pGame; + mGameDir = pGame->mSourceFile.GetFileDirectory(); XMLElement *pRoot = pDoc->FirstChildElement("MasterTemplate"); XMLElement *pElem = pRoot->FirstChildElement(); @@ -1019,7 +1019,7 @@ void CTemplateLoader::LoadMasterTemplate(XMLDocument *pDoc, CMasterTemplate *pMa TString TemplateName = pObj->Attribute("template"); XMLDocument ScriptXML; - OpenXML(mskTemplatesDir + mMasterDir + TemplateName, ScriptXML); + OpenXML(mskTemplatesDir + mGameDir + TemplateName, ScriptXML); if (!ScriptXML.Error()) { @@ -1027,10 +1027,10 @@ void CTemplateLoader::LoadMasterTemplate(XMLDocument *pDoc, CMasterTemplate *pMa if (pTemp) { - mpMaster->mScriptTemplates.emplace( + mpGameTemplate->mScriptTemplates.emplace( std::make_pair( ID, - CMasterTemplate::SScriptTemplatePath(ID, TemplateName, pTemp) + CGameTemplate::SScriptTemplatePath(ID, TemplateName, pTemp) )); } } @@ -1055,7 +1055,7 @@ void CTemplateLoader::LoadMasterTemplate(XMLDocument *pDoc, CMasterTemplate *pMa StateID = CFourCC(StrID).ToLong(); TString StateName = pState->Attribute("name"); - mpMaster->mStates[StateID] = StateName; + mpGameTemplate->mStates[StateID] = StateName; pState = pState->NextSiblingElement("state"); } } @@ -1076,7 +1076,7 @@ void CTemplateLoader::LoadMasterTemplate(XMLDocument *pDoc, CMasterTemplate *pMa MessageID = CFourCC(StrID).ToLong(); TString MessageName = pMessage->Attribute("name"); - mpMaster->mMessages[MessageID] = MessageName; + mpGameTemplate->mMessages[MessageID] = MessageName; pMessage = pMessage->NextSiblingElement("message"); } } @@ -1084,12 +1084,12 @@ void CTemplateLoader::LoadMasterTemplate(XMLDocument *pDoc, CMasterTemplate *pMa pElem = pElem->NextSiblingElement(); } - pMaster->mFullyLoaded = true; + pGame->mFullyLoaded = true; } -CMasterTemplate* CTemplateLoader::LoadGameInfo(XMLNode *pNode) +CGameTemplate* CTemplateLoader::LoadGameInfo(XMLNode *pNode) { - CMasterTemplate *pMaster = new CMasterTemplate(); + CGameTemplate *pGame = new CGameTemplate(); XMLElement *pGameElem = pNode->FirstChildElement(); // Parse game parameters @@ -1098,24 +1098,24 @@ CMasterTemplate* CTemplateLoader::LoadGameInfo(XMLNode *pNode) TString NodeName = TString(pGameElem->Name()).ToLower(); if (NodeName == "name") - pMaster->mGameName = pGameElem->GetText(); + pGame->mGameName = pGameElem->GetText(); else if (NodeName == "mrea") { u32 VersionNum = std::stoul(pGameElem->GetText(), 0, 16); - pMaster->mGame = CAreaLoader::GetFormatVersion(VersionNum); + pGame->mGame = CAreaLoader::GetFormatVersion(VersionNum); } else if (NodeName == "master") { TString MasterPath = pGameElem->GetText(); - pMaster->mSourceFile = MasterPath; + pGame->mSourceFile = MasterPath; } pGameElem = pGameElem->NextSiblingElement(); } - return pMaster; + return pGame; } // ************ UTILITY ************ @@ -1182,17 +1182,17 @@ void CTemplateLoader::LoadGameList() if (Reader.ParamBegin("Game", 0)) { EGame Game; - TString Name, MasterPath; + TString Name, GamePath; Reader << SerialParameter("ID", Game, SH_Attribute) << SerialParameter("Name", Name) - << SerialParameter("MasterTemplate", MasterPath); + << SerialParameter("GameTemplate", GamePath); - CMasterTemplate* pMaster = new CMasterTemplate(); - pMaster->mGame = Game; - pMaster->mGameName = Name; - pMaster->mSourceFile = MasterPath; - CMasterTemplate::smMasterMap[Game] = pMaster; + CGameTemplate* pGame = new CGameTemplate(); + pGame->mGame = Game; + pGame->mGameName = Name; + pGame->mSourceFile = GamePath; + CGameTemplate::smGameMap[Game] = pGame; Reader.ParamEnd(); } } @@ -1204,21 +1204,21 @@ void CTemplateLoader::LoadGameList() const TString kPropertyMapPath = kTemplatesDir + "PropertyMap.xml"; CXMLReader Reader(kPropertyMapPath); ASSERT(Reader.IsValid()); - Reader << SerialParameter("PropertyMap", CMasterTemplate::smPropertyNames, SH_HexDisplay); + Reader << SerialParameter("PropertyMap", CGameTemplate::smPropertyNames, SH_HexDisplay); } { - // Read master templates - std::list MasterList = CMasterTemplate::MasterList(); + // Read game templates + std::list GameList = CGameTemplate::GameTemplateList(); - for (auto Iter = MasterList.begin(); Iter != MasterList.end(); Iter++) + for (auto Iter = GameList.begin(); Iter != GameList.end(); Iter++) { - CMasterTemplate* pMaster = *Iter; - const TString kMasterPath = pMaster->GetGameDirectory(true) + "Game.xml"; + CGameTemplate* pGame = *Iter; + const TString kGamePath = pGame->GetGameDirectory(true) + "Game.xml"; - CXMLReader Reader(kMasterPath); + CXMLReader Reader(kGamePath); ASSERT(Reader.IsValid()); - pMaster->Serialize(Reader); - pMaster->LoadSubTemplates(); + pGame->Serialize(Reader); + pGame->LoadSubTemplates(); } } #else @@ -1236,7 +1236,7 @@ void CTemplateLoader::LoadGameList() const char *pkGameListVersion = pRoot->Attribute("version"); if (pkGameListVersion) - CMasterTemplate::smGameListVersion = TString(pkGameListVersion).ToInt32(10); + CGameTemplate::smGameListVersion = TString(pkGameListVersion).ToInt32(10); XMLElement *pElem = pRoot->FirstChildElement(); @@ -1259,8 +1259,8 @@ void CTemplateLoader::LoadGameList() else if (NodeName == "game") { CTemplateLoader Loader(mskTemplatesDir); - CMasterTemplate *pMaster = Loader.LoadGameInfo(pElem); - CMasterTemplate::smMasterMap[pMaster->mGame] = pMaster; + CGameTemplate *pGame = Loader.LoadGameInfo(pElem); + CGameTemplate::smGameMap[pGame->mGame] = pGame; } pElem = pElem->NextSiblingElement(); @@ -1270,22 +1270,22 @@ void CTemplateLoader::LoadGameList() void CTemplateLoader::LoadGameTemplates(EGame Game) { - std::list MasterList = CMasterTemplate::MasterList(); + std::list GameList = CGameTemplate::GameTemplateList(); - for (auto it = MasterList.begin(); it != MasterList.end(); it++) + for (auto it = GameList.begin(); it != GameList.end(); it++) { - CMasterTemplate *pMaster = *it; + CGameTemplate *pGame = *it; - if (pMaster->Game() == Game && !pMaster->IsLoadedSuccessfully()) + if (pGame->Game() == Game && !pGame->IsLoadedSuccessfully()) { - XMLDocument MasterXML; - OpenXML(mskTemplatesDir + pMaster->mSourceFile, MasterXML); + XMLDocument GameXML; + OpenXML(mskTemplatesDir + pGame->mSourceFile, GameXML); - if (!MasterXML.Error()) + if (!GameXML.Error()) { CTemplateLoader Loader(mskTemplatesDir); Loader.mGame = Game; - Loader.LoadMasterTemplate(&MasterXML, pMaster); + Loader.LoadGameTemplate(&GameXML, pGame); } break; @@ -1295,22 +1295,22 @@ void CTemplateLoader::LoadGameTemplates(EGame Game) void CTemplateLoader::LoadAllGames() { - std::list MasterList = CMasterTemplate::MasterList(); + std::list GameList = CGameTemplate::GameTemplateList(); - for (auto it = MasterList.begin(); it != MasterList.end(); it++) + for (auto it = GameList.begin(); it != GameList.end(); it++) { - CMasterTemplate *pMaster = *it; + CGameTemplate *pGame = *it; - if (!pMaster->IsLoadedSuccessfully()) + if (!pGame->IsLoadedSuccessfully()) { - XMLDocument MasterXML; - OpenXML(mskTemplatesDir + pMaster->mSourceFile, MasterXML); + XMLDocument GameXML; + OpenXML(mskTemplatesDir + pGame->mSourceFile, GameXML); - if (!MasterXML.Error()) + if (!GameXML.Error()) { CTemplateLoader Loader(mskTemplatesDir); - Loader.mGame = pMaster->Game(); - Loader.LoadMasterTemplate(&MasterXML, pMaster); + Loader.mGame = pGame->Game(); + Loader.LoadGameTemplate(&GameXML, pGame); } } } @@ -1333,7 +1333,7 @@ void CTemplateLoader::LoadPropertyList(XMLDocument *pDoc, const TString& ListNam TString Name = pElem->Attribute("name"); if (!ID.IsEmpty() && !Name.IsEmpty()) - CMasterTemplate::smPropertyNames[ID.ToInt32()] = Name; + CGameTemplate::smPropertyNames[ID.ToInt32()] = Name; pElem = pElem->NextSiblingElement(); } @@ -1350,31 +1350,31 @@ void CTemplateLoader::SaveGameList() const TString kGameListPath = kTemplatesDir + "GameList.xml"; CXMLWriter Writer(kGameListPath, "GameList"); - u32 NumGames = CMasterTemplate::smMasterMap.size(); + u32 NumGames = CGameTemplate::smGameMap.size(); Writer.ParamBegin("Games", 0); Writer.SerializeArraySize(NumGames); - for (auto Iter = CMasterTemplate::smMasterMap.begin(); Iter != CMasterTemplate::smMasterMap.end(); Iter++) + for (auto Iter = CGameTemplate::smGameMap.begin(); Iter != CGameTemplate::smGameMap.end(); Iter++) { struct SGameInfo { EGame Game; TString Name; - TString MasterPath; + TString GamePath; void Serialize(IArchive& Arc) { Arc << SerialParameter("ID", Game, SH_Attribute) << SerialParameter("Name", Name) - << SerialParameter("MasterTemplate", MasterPath); + << SerialParameter("GameTemplate", GamePath); } }; - CMasterTemplate* pMaster = Iter->second; + CGameTemplate* pGame = Iter->second; SGameInfo Info; - Info.Game = pMaster->Game(); - Info.Name = pMaster->GameName(); - Info.MasterPath = pMaster->GetGameDirectory() + "Game.xml"; + Info.Game = pGame->Game(); + Info.Name = pGame->GameName(); + Info.GamePath = pGame->GetGameDirectory() + "Game.xml"; Writer << SerialParameter("Game", Info); } Writer.ParamEnd(); @@ -1383,22 +1383,22 @@ void CTemplateLoader::SaveGameList() // Write property list { CXMLWriter Writer(kTemplatesDir + "PropertyMap.xml", "PropertyMap"); - Writer << SerialParameter("PropertyMap", CMasterTemplate::smPropertyNames, SH_HexDisplay); + Writer << SerialParameter("PropertyMap", CGameTemplate::smPropertyNames, SH_HexDisplay); } - // Write master templates + // Write game templates { - std::list MasterList = CMasterTemplate::MasterList(); + std::list GameList = CGameTemplate::GameTemplateList(); - for (auto Iter = MasterList.begin(); Iter != MasterList.end(); Iter++) + for (auto Iter = GameList.begin(); Iter != GameList.end(); Iter++) { - CMasterTemplate* pMasterTemplate = *Iter; - TString MasterFilePath = pMasterTemplate->GetGameDirectory(true) + "Game.xml"; - FileUtil::MakeDirectory( MasterFilePath.GetFileDirectory() ); + CGameTemplate* pGameTemplate = *Iter; + TString GameFilePath = pGameTemplate->GetGameDirectory(true) + "Game.xml"; + FileUtil::MakeDirectory( GameFilePath.GetFileDirectory() ); - CXMLWriter Writer(MasterFilePath, "Game", 0, pMasterTemplate->Game()); - pMasterTemplate->Serialize(Writer); - pMasterTemplate->SaveSubTemplates(); + CXMLWriter Writer(GameFilePath, "Game", 0, pGameTemplate->Game()); + pGameTemplate->Serialize(Writer); + pGameTemplate->SaveSubTemplates(); } } } diff --git a/src/Core/Resource/Factory/CTemplateLoader.h b/src/Core/Resource/Factory/CTemplateLoader.h index c15fd637..50ab2fcf 100644 --- a/src/Core/Resource/Factory/CTemplateLoader.h +++ b/src/Core/Resource/Factory/CTemplateLoader.h @@ -1,7 +1,7 @@ #ifndef CTEMPLATELOADER_H #define CTEMPLATELOADER_H -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include "Core/Resource/Script/CScriptTemplate.h" #include "Core/Resource/Script/Property/IProperty.h" #include "Core/Resource/Script/Property/CEnumProperty.h" @@ -13,33 +13,33 @@ class CTemplateLoader static const TString mskTemplatesDir; static const TString mskGameListPath; - CMasterTemplate *mpMaster; + CGameTemplate *mpGameTemplate; EGame mGame; TString mTemplatesDir; - TString mMasterDir; + TString mGameDir; // Constructor CTemplateLoader(const TString& rkTemplatesDir) : mTemplatesDir(rkTemplatesDir) {} // Load Property - IPropertyNew* LoadProperty(tinyxml2::XMLElement* pElem, CScriptTemplate* pScript, CStructPropertyNew* pParentStruct, const TString& rkTemplateName); - IPropertyNew* CreateProperty(u32 ID, EPropertyTypeNew Type, const TString& rkName, CScriptTemplate* pScript, CStructPropertyNew* pStruct); + IProperty* LoadProperty(tinyxml2::XMLElement* pElem, CScriptTemplate* pScript, CStructProperty* pParentStruct, const TString& rkTemplateName); + IProperty* CreateProperty(u32 ID, EPropertyType Type, const TString& rkName, CScriptTemplate* pScript, CStructProperty* pStruct); - CStructPropertyNew* LoadStructArchetype(const TString& rkTemplateFileName); + CStructProperty* LoadStructArchetype(const TString& rkTemplateFileName); CEnumProperty* LoadEnumArchetype(const TString& rkTemplateFileName, bool bIsChoice); CFlagsProperty* LoadFlagsArchetype(const TString& rkTemplateFileName); - void LoadProperties(tinyxml2::XMLElement* pPropertiesElem, CScriptTemplate* pScript, CStructPropertyNew* pStruct, const TString& rkTemplateName); + void LoadProperties(tinyxml2::XMLElement* pPropertiesElem, CScriptTemplate* pScript, CStructProperty* pStruct, const TString& rkTemplateName); void LoadEnumerators(tinyxml2::XMLElement* pEnumeratorsElem, CEnumProperty* pEnum, const TString& rkTemplateName); void LoadBitFlags(tinyxml2::XMLElement* pFlagsElem, CFlagsProperty* pFlags, const TString& rkTemplateName); // Load Script Object CScriptTemplate* LoadScriptTemplate(tinyxml2::XMLDocument* pDoc, const TString& rkTemplateName, u32 ObjectID); - // Load Master - CMasterTemplate* LoadGameInfo(tinyxml2::XMLNode* pNode); - void LoadMasterTemplate(tinyxml2::XMLDocument* pDoc, CMasterTemplate* pMaster); + // Load Game + CGameTemplate* LoadGameInfo(tinyxml2::XMLNode* pNode); + void LoadGameTemplate(tinyxml2::XMLDocument* pDoc, CGameTemplate* pGame); // Utility static void OpenXML(const TString& rkPath, tinyxml2::XMLDocument& rDoc); diff --git a/src/Core/Resource/Script/CMasterTemplate.cpp b/src/Core/Resource/Script/CGameTemplate.cpp similarity index 76% rename from src/Core/Resource/Script/CMasterTemplate.cpp rename to src/Core/Resource/Script/CGameTemplate.cpp index ba3f36f4..05c69f92 100644 --- a/src/Core/Resource/Script/CMasterTemplate.cpp +++ b/src/Core/Resource/Script/CGameTemplate.cpp @@ -1,13 +1,13 @@ -#include "CMasterTemplate.h" +#include "CGameTemplate.h" #include "Core/Resource/Factory/CWorldLoader.h" #include -CMasterTemplate::CMasterTemplate() +CGameTemplate::CGameTemplate() : mFullyLoaded(false) { } -void CMasterTemplate::Serialize(IArchive& Arc) +void CGameTemplate::Serialize(IArchive& Arc) { Arc << SerialParameter("ScriptObjects", mScriptTemplates) << SerialParameter("PropertyArchetypes", mPropertyTemplates) @@ -15,7 +15,7 @@ void CMasterTemplate::Serialize(IArchive& Arc) << SerialParameter("Messages", mMessages); } -void CMasterTemplate::LoadSubTemplates() +void CGameTemplate::LoadSubTemplates() { for (auto Iter = mScriptTemplates.begin(); Iter != mScriptTemplates.end(); Iter++) Internal_LoadScriptTemplate( Iter->second ); @@ -24,7 +24,7 @@ void CMasterTemplate::LoadSubTemplates() Internal_LoadPropertyTemplate( Iter->second ); } -void CMasterTemplate::Internal_LoadScriptTemplate(SScriptTemplatePath& Path) +void CGameTemplate::Internal_LoadScriptTemplate(SScriptTemplatePath& Path) { ASSERT(Path.pTemplate == nullptr); // make sure it hasn't been loaded yet @@ -38,7 +38,7 @@ void CMasterTemplate::Internal_LoadScriptTemplate(SScriptTemplatePath& Path) Path.pTemplate->PostLoad(); } -void CMasterTemplate::Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path) +void CGameTemplate::Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path) { if (Path.pTemplate != nullptr) // don't load twice return; @@ -55,7 +55,7 @@ void CMasterTemplate::Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path) Path.pTemplate->Initialize(nullptr, nullptr, 0); } -void CMasterTemplate::SaveSubTemplates() +void CGameTemplate::SaveSubTemplates() { const TString kGameDir = GetGameDirectory(true); @@ -80,12 +80,21 @@ void CMasterTemplate::SaveSubTemplates() } } -u32 CMasterTemplate::GameVersion(TString VersionName) +void CGameTemplate::SaveScriptTemplate(CScriptTemplate* pTemplate) +{ + ASSERT( pTemplate->GameTemplate() == this ); +} + +void CGameTemplate::SavePropertyTemplate(IProperty* pProperty) +{ +} + +u32 CGameTemplate::GameVersion(TString VersionName) { return -1; } -CScriptTemplate* CMasterTemplate::TemplateByID(u32 ObjectID) +CScriptTemplate* CGameTemplate::TemplateByID(u32 ObjectID) { auto it = mScriptTemplates.find(ObjectID); @@ -95,18 +104,18 @@ CScriptTemplate* CMasterTemplate::TemplateByID(u32 ObjectID) return nullptr; } -CScriptTemplate* CMasterTemplate::TemplateByID(const CFourCC& ObjectID) +CScriptTemplate* CGameTemplate::TemplateByID(const CFourCC& ObjectID) { return TemplateByID(ObjectID.ToLong()); } -CScriptTemplate* CMasterTemplate::TemplateByIndex(u32 Index) +CScriptTemplate* CGameTemplate::TemplateByIndex(u32 Index) { auto it = mScriptTemplates.begin(); return (std::next(it, Index))->second.pTemplate.get(); } -SState CMasterTemplate::StateByID(u32 StateID) +SState CGameTemplate::StateByID(u32 StateID) { auto Iter = mStates.find(StateID); @@ -116,19 +125,19 @@ SState CMasterTemplate::StateByID(u32 StateID) return SState(-1, "Invalid"); } -SState CMasterTemplate::StateByID(const CFourCC& State) +SState CGameTemplate::StateByID(const CFourCC& State) { return StateByID(State.ToLong()); } -SState CMasterTemplate::StateByIndex(u32 Index) +SState CGameTemplate::StateByIndex(u32 Index) { auto Iter = mStates.begin(); Iter = std::next(Iter, Index); return SState(Iter->first, Iter->second); } -SMessage CMasterTemplate::MessageByID(u32 MessageID) +SMessage CGameTemplate::MessageByID(u32 MessageID) { auto Iter = mMessages.find(MessageID); @@ -138,19 +147,19 @@ SMessage CMasterTemplate::MessageByID(u32 MessageID) return SMessage(-1, "Invalid"); } -SMessage CMasterTemplate::MessageByID(const CFourCC& MessageID) +SMessage CGameTemplate::MessageByID(const CFourCC& MessageID) { return MessageByID(MessageID.ToLong()); } -SMessage CMasterTemplate::MessageByIndex(u32 Index) +SMessage CGameTemplate::MessageByIndex(u32 Index) { auto Iter = mMessages.begin(); Iter = std::next(Iter, Index); return SMessage(Iter->first, Iter->second); } -IProperty* CMasterTemplate::FindPropertyArchetype(const TString& kTypeName) +IProperty* CGameTemplate::FindPropertyArchetype(const TString& kTypeName) { auto Iter = mPropertyTemplates.find(kTypeName); @@ -174,54 +183,54 @@ IProperty* CMasterTemplate::FindPropertyArchetype(const TString& kTypeName) return Path.pTemplate.get(); } -TString CMasterTemplate::GetGameDirectory(bool Absolute) const +TString CGameTemplate::GetGameDirectory(bool Absolute) const { TString Out = mSourceFile.GetFileDirectory(); return Absolute ? "../templates_new/" + Out : Out; } // ************ STATIC ************ -CMasterTemplate* CMasterTemplate::MasterForGame(EGame Game) +CGameTemplate* CGameTemplate::GetGameTemplate(EGame Game) { - auto it = smMasterMap.find(Game); + auto it = smGameMap.find(Game); - if (it != smMasterMap.end()) + if (it != smGameMap.end()) return it->second; else return nullptr; } -std::list CMasterTemplate::MasterList() +std::list CGameTemplate::GameTemplateList() { - std::list list; + std::list list; - for (auto it = smMasterMap.begin(); it != smMasterMap.end(); it++) + for (auto it = smGameMap.begin(); it != smGameMap.end(); it++) list.push_back(it->second); return list; } -TString CMasterTemplate::FindGameName(EGame Game) +TString CGameTemplate::FindGameName(EGame Game) { - CMasterTemplate *pMaster = MasterForGame(Game); - return pMaster ? pMaster->GameName() : "Unknown Game"; + CGameTemplate *pGame = GetGameTemplate(Game); + return pGame ? pGame->GameName() : "Unknown Game"; } -EGame CMasterTemplate::FindGameForName(const TString& rkName) +EGame CGameTemplate::FindGameForName(const TString& rkName) { - std::list Masters = MasterList(); + std::list Games = GameTemplateList(); - for (auto It = Masters.begin(); It != Masters.end(); It++) + for (auto It = Games.begin(); It != Games.end(); It++) { - CMasterTemplate *pMaster = *It; - if (pMaster->GameName() == rkName) - return pMaster->Game(); + CGameTemplate *pGame = *It; + if (pGame->GameName() == rkName) + return pGame->Game(); } return eUnknownGame; } -TString CMasterTemplate::PropertyName(u32 PropertyID) +TString CGameTemplate::PropertyName(u32 PropertyID) { auto it = smPropertyNames.find(PropertyID); @@ -232,7 +241,7 @@ TString CMasterTemplate::PropertyName(u32 PropertyID) } // Removing these functions for now. I'm not sure of the best way to go about implementing them under the new system yet. -u32 CMasterTemplate::CreatePropertyID(IProperty* pProp) +u32 CGameTemplate::CreatePropertyID(IProperty* pProp) { // MP1 properties don't have IDs so we can use this function to create one to track instances of a particular property. // To ensure the IDs are unique we'll create a hash using two things: the struct source file and the ID string (relative to the struct). @@ -250,7 +259,7 @@ u32 CMasterTemplate::CreatePropertyID(IProperty* pProp) return Hash.Digest(); } -void CMasterTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateName /*= ""*/) +void CGameTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateName /*= ""*/) { u32 ID; @@ -307,16 +316,16 @@ void CMasterTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateNam } } -void CMasterTemplate::RenameProperty(IProperty* pProp, const TString& rkNewName) +void CGameTemplate::RenameProperty(IProperty* pProp, const TString& rkNewName) { u32 ID = pProp->ID(); if (ID <= 0xFF) ID = CreatePropertyID(pProp); RenameProperty(ID, rkNewName); } -void CMasterTemplate::RenameProperty(u32 ID, const TString& rkNewName) +void CGameTemplate::RenameProperty(u32 ID, const TString& rkNewName) { - // Master name list + // Game name list auto NameIt = smPropertyNames.find(ID); TString Original; @@ -341,7 +350,7 @@ void CMasterTemplate::RenameProperty(u32 ID, const TString& rkNewName) } } -void CMasterTemplate::XMLsUsingID(u32 ID, std::vector& rOutList) +void CGameTemplate::XMLsUsingID(u32 ID, std::vector& rOutList) { auto InfoIt = smIDMap.find(ID); @@ -352,7 +361,7 @@ void CMasterTemplate::XMLsUsingID(u32 ID, std::vector& rOutList) } } -const std::vector* CMasterTemplate::TemplatesWithMatchingID(IProperty* pProp) +const std::vector* CGameTemplate::TemplatesWithMatchingID(IProperty* pProp) { u32 ID = pProp->ID(); if (ID <= 0xFF) ID = CreatePropertyID(pProp); @@ -367,7 +376,7 @@ const std::vector* CMasterTemplate::TemplatesWithMatchingID(IPropert return nullptr; } -std::map CMasterTemplate::smIDMap; -std::map CMasterTemplate::smMasterMap; -std::map CMasterTemplate::smPropertyNames; -u32 CMasterTemplate::smGameListVersion; +std::map CGameTemplate::smIDMap; +std::map CGameTemplate::smGameMap; +std::map CGameTemplate::smPropertyNames; +u32 CGameTemplate::smGameListVersion; diff --git a/src/Core/Resource/Script/CMasterTemplate.h b/src/Core/Resource/Script/CGameTemplate.h similarity index 93% rename from src/Core/Resource/Script/CMasterTemplate.h rename to src/Core/Resource/Script/CGameTemplate.h index c947fae3..4f35eced 100644 --- a/src/Core/Resource/Script/CMasterTemplate.h +++ b/src/Core/Resource/Script/CGameTemplate.h @@ -1,5 +1,5 @@ -#ifndef CMASTERTEMPLATE_H -#define CMASTERTEMPLATE_H +#ifndef CGAMETEMPLATE_H +#define CGAMETEMPLATE_H #include "CLink.h" #include "CScriptTemplate.h" @@ -35,7 +35,7 @@ struct SObjId } }; -class CMasterTemplate +class CGameTemplate { friend class CTemplateLoader; friend class CTemplateWriter; @@ -120,7 +120,7 @@ class CMasterTemplate std::vector PropertyList; // List of all properties that use this ID }; static std::map smIDMap; - static std::map smMasterMap; + static std::map smGameMap; static std::map smPropertyNames; static u32 smGameListVersion; @@ -128,10 +128,12 @@ class CMasterTemplate void Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path); public: - CMasterTemplate(); + CGameTemplate(); void Serialize(IArchive& Arc); void LoadSubTemplates(); void SaveSubTemplates(); + void SaveScriptTemplate(CScriptTemplate* pTemplate); + void SavePropertyTemplate(IProperty* pProperty); u32 GameVersion(TString VersionName); CScriptTemplate* TemplateByID(u32 ObjectID); CScriptTemplate* TemplateByID(const CFourCC& ObjectID); @@ -154,8 +156,8 @@ public: inline bool IsLoadedSuccessfully() { return mFullyLoaded; } // Static - static CMasterTemplate* MasterForGame(EGame Game); - static std::list MasterList(); + static CGameTemplate* GetGameTemplate(EGame Game); + static std::list GameTemplateList(); static TString FindGameName(EGame Game); static EGame FindGameForName(const TString& rkName); static TString PropertyName(u32 PropertyID); @@ -167,4 +169,4 @@ public: static const std::vector* TemplatesWithMatchingID(IProperty *pTemp); }; -#endif // CMASTERTEMPLATE_H +#endif // CGAMETEMPLATE_H diff --git a/src/Core/Resource/Script/CScriptObject.cpp b/src/Core/Resource/Script/CScriptObject.cpp index 9daa217f..e2af2012 100644 --- a/src/Core/Resource/Script/CScriptObject.cpp +++ b/src/Core/Resource/Script/CScriptObject.cpp @@ -1,6 +1,6 @@ #include "CScriptObject.h" #include "CScriptLayer.h" -#include "CMasterTemplate.h" +#include "CGameTemplate.h" #include "Core/Resource/Animation/CAnimSet.h" CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate) diff --git a/src/Core/Resource/Script/CScriptObject.h b/src/Core/Resource/Script/CScriptObject.h index d508b4d5..d8870cff 100644 --- a/src/Core/Resource/Script/CScriptObject.h +++ b/src/Core/Resource/Script/CScriptObject.h @@ -70,7 +70,7 @@ public: // Accessors CScriptTemplate* Template() const { return mpTemplate; } - CMasterTemplate* MasterTemplate() const { return mpTemplate->MasterTemplate(); } + CGameTemplate* GameTemplate() const { return mpTemplate->GameTemplate(); } CGameArea* Area() const { return mpArea; } CScriptLayer* Layer() const { return mpLayer; } u32 Version() const { return mVersion; } diff --git a/src/Core/Resource/Script/CScriptTemplate.cpp b/src/Core/Resource/Script/CScriptTemplate.cpp index 3f14a9ec..c1a22fdf 100644 --- a/src/Core/Resource/Script/CScriptTemplate.cpp +++ b/src/Core/Resource/Script/CScriptTemplate.cpp @@ -1,6 +1,6 @@ #include "CScriptTemplate.h" #include "CScriptObject.h" -#include "CMasterTemplate.h" +#include "CGameTemplate.h" #include "Core/GameProject/CResourceStore.h" #include "Core/Resource/Animation/CAnimSet.h" #include @@ -9,8 +9,8 @@ #include // Old constructor -CScriptTemplate::CScriptTemplate(CMasterTemplate *pMaster) - : mpMaster(pMaster) +CScriptTemplate::CScriptTemplate(CGameTemplate *pGame) + : mpGame(pGame) , mpProperties(nullptr) , mVisible(true) , mpNameProperty(nullptr) @@ -26,7 +26,7 @@ CScriptTemplate::CScriptTemplate(CMasterTemplate *pMaster) } // New constructor -CScriptTemplate::CScriptTemplate(CMasterTemplate* pInMaster, u32 InObjectID, const TString& kInFilePath) +CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, u32 InObjectID, const TString& kInFilePath) : mRotationType(eRotationEnabled) , mScaleType(eScaleEnabled) , mPreviewScale(1.f) @@ -34,7 +34,7 @@ CScriptTemplate::CScriptTemplate(CMasterTemplate* pInMaster, u32 InObjectID, con , mVolumeScale(1.f) , mSourceFile(kInFilePath) , mObjectID(InObjectID) - , mpMaster(pInMaster) + , mpGame(pInGame) , mpNameProperty(nullptr) , mpPositionProperty(nullptr) , mpRotationProperty(nullptr) @@ -91,7 +91,7 @@ void CScriptTemplate::PostLoad() EGame CScriptTemplate::Game() const { - return mpMaster->Game(); + return mpGame->Game(); } // ************ PROPERTY FETCHING ************ diff --git a/src/Core/Resource/Script/CScriptTemplate.h b/src/Core/Resource/Script/CScriptTemplate.h index 2291d153..1191cc8c 100644 --- a/src/Core/Resource/Script/CScriptTemplate.h +++ b/src/Core/Resource/Script/CScriptTemplate.h @@ -10,7 +10,7 @@ #include #include -class CMasterTemplate; +class CGameTemplate; class CScriptObject; typedef TString TIDString; @@ -79,7 +79,7 @@ private: }; std::vector mModules; - std::unique_ptr mpProperties; + std::unique_ptr mpProperties; std::vector mAssets; std::vector mAttachments; @@ -103,7 +103,7 @@ private: TIDString mActiveIDString; TIDString mLightParametersIDString; - CMasterTemplate* mpMaster; + CGameTemplate* mpGame; std::list mObjectList; CStringProperty* mpNameProperty; @@ -111,7 +111,7 @@ private: CVectorProperty* mpRotationProperty; CVectorProperty* mpScaleProperty; CBoolProperty* mpActiveProperty; - CStructPropertyNew* mpLightParametersProperty; + CStructProperty* mpLightParametersProperty; struct SVolumeCondition { u32 Value; @@ -132,9 +132,9 @@ public: // Default constructor. Don't use. This is only here so the serializer doesn't complain CScriptTemplate() { ASSERT(false); } // Old constructor - CScriptTemplate(CMasterTemplate *pMaster); + CScriptTemplate(CGameTemplate *pGame); // New constructor - CScriptTemplate(CMasterTemplate* pMaster, u32 ObjectID, const TString& kFilePath); + CScriptTemplate(CGameTemplate* pGame, u32 ObjectID, const TString& kFilePath); ~CScriptTemplate(); void Serialize(IArchive& rArc); void PostLoad(); @@ -147,7 +147,7 @@ public: CCollisionMeshGroup* FindCollision(void* pPropertyData); // Accessors - inline CMasterTemplate* MasterTemplate() const { return mpMaster; } + 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; } @@ -155,7 +155,7 @@ public: inline u32 ObjectID() const { return mObjectID; } inline bool IsVisible() const { return mVisible; } inline TString SourceFile() const { return mSourceFile; } - inline CStructPropertyNew* Properties() const { return mpProperties.get(); } + inline CStructProperty* Properties() const { return mpProperties.get(); } inline u32 NumAttachments() const { return mAttachments.size(); } const SAttachment& Attachment(u32 Index) const { return mAttachments[Index]; } const std::vector& RequiredModules() const { return mModules; } @@ -165,7 +165,7 @@ public: inline CVectorProperty* RotationProperty() const { return mpRotationProperty; } inline CVectorProperty* ScaleProperty() const { return mpScaleProperty; } inline CBoolProperty* ActiveProperty() const { return mpActiveProperty; } - inline CStructPropertyNew* LightParametersProperty() const { return mpLightParametersProperty; } + inline CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; } inline void SetVisible(bool Visible) { mVisible = Visible; } diff --git a/src/Core/Resource/Script/Property/CByteProperty.h b/src/Core/Resource/Script/Property/CByteProperty.h index be102e74..218fcef1 100644 --- a/src/Core/Resource/Script/Property/CByteProperty.h +++ b/src/Core/Resource/Script/Property/CByteProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CByteProperty : public TNumericalPropertyNew< s8, EPropertyTypeNew::Byte > +class CByteProperty : public TNumericalProperty< s8, EPropertyType::Byte > { - friend class IPropertyNew; + friend class IProperty; protected: CByteProperty(EGame Game) - : TNumericalPropertyNew(Game) + : TNumericalProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CColorProperty.h b/src/Core/Resource/Script/Property/CColorProperty.h index c5c8c207..98ffdc34 100644 --- a/src/Core/Resource/Script/Property/CColorProperty.h +++ b/src/Core/Resource/Script/Property/CColorProperty.h @@ -4,9 +4,9 @@ #include "IProperty.h" #include "CFloatProperty.h" -class CColorProperty : public TSerializeableTypedProperty< CColor, EPropertyTypeNew::Color > +class CColorProperty : public TSerializeableTypedProperty< CColor, EPropertyType::Color > { - friend class IPropertyNew; + friend class IProperty; protected: CColorProperty(EGame Game) @@ -16,10 +16,10 @@ protected: public: virtual void PostInitialize() { - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 0, "R"); - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 4, "G"); - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 8, "B"); - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 12, "A"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "R"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "G"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 8, "B"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 12, "A"); TPropCast( mChildren.back() )->SetDefaultValue(1.0f); } diff --git a/src/Core/Resource/Script/Property/CEnumProperty.h b/src/Core/Resource/Script/Property/CEnumProperty.h index 7d313ba7..37d14edd 100644 --- a/src/Core/Resource/Script/Property/CEnumProperty.h +++ b/src/Core/Resource/Script/Property/CEnumProperty.h @@ -10,11 +10,11 @@ * * In PWE, however, they are both implemented the same way under the hood. */ -template +template class TEnumPropertyBase : public TSerializeableTypedProperty { friend class CTemplateLoader; - friend class IPropertyNew; + friend class IProperty; struct SEnumValue { @@ -54,7 +54,7 @@ protected: public: virtual const char* GetHashableTypeName() const { - if (TypeEnum == EPropertyTypeNew::Enum) + if (TypeEnum == EPropertyType::Enum) return "enum"; else return "choice"; @@ -63,7 +63,7 @@ public: virtual void Serialize(IArchive& rArc) { // Skip TSerializeableTypedProperty, serialize default value ourselves so we can set SH_HexDisplay - TTypedPropertyNew::Serialize(rArc); + TTypedProperty::Serialize(rArc); TEnumPropertyBase* pArchetype = static_cast(mpArchetype); u32 DefaultValueFlags = SH_HexDisplay | (pArchetype || Game() <= ePrime ? SH_Optional : 0); @@ -80,9 +80,9 @@ public: Arc.SerializePrimitive( (u32&) ValueRef(pData), 0 ); } - virtual void InitFromArchetype(IPropertyNew* pOther) + virtual void InitFromArchetype(IProperty* pOther) { - TTypedPropertyNew::InitFromArchetype(pOther); + TTypedProperty::InitFromArchetype(pOther); TEnumPropertyBase* pOtherEnum = static_cast(pOther); mValues = pOtherEnum->mValues; } @@ -132,18 +132,18 @@ public: } }; -typedef TEnumPropertyBase CChoiceProperty; -typedef TEnumPropertyBase CEnumProperty; +typedef TEnumPropertyBase CChoiceProperty; +typedef TEnumPropertyBase CEnumProperty; // Specialization of TPropCast to allow interchangeable casting, as both types are the same thing template<> -inline CEnumProperty* TPropCast(IPropertyNew* pProperty) +inline CEnumProperty* TPropCast(IProperty* pProperty) { if (pProperty) { - EPropertyTypeNew InType = pProperty->Type(); + EPropertyType InType = pProperty->Type(); - if (InType == EPropertyTypeNew::Enum || InType == EPropertyTypeNew::Choice) + if (InType == EPropertyType::Enum || InType == EPropertyType::Choice) { return static_cast(pProperty); } @@ -153,13 +153,13 @@ inline CEnumProperty* TPropCast(IPropertyNew* pProperty) } template<> -inline CChoiceProperty* TPropCast(IPropertyNew* pProperty) +inline CChoiceProperty* TPropCast(IProperty* pProperty) { if (pProperty) { - EPropertyTypeNew InType = pProperty->Type(); + EPropertyType InType = pProperty->Type(); - if (InType == EPropertyTypeNew::Enum || InType == EPropertyTypeNew::Choice) + if (InType == EPropertyType::Enum || InType == EPropertyType::Choice) { return static_cast(pProperty); } diff --git a/src/Core/Resource/Script/Property/CFlagsProperty.cpp b/src/Core/Resource/Script/Property/CFlagsProperty.cpp index dd75cc97..e2d1b5fc 100644 --- a/src/Core/Resource/Script/Property/CFlagsProperty.cpp +++ b/src/Core/Resource/Script/Property/CFlagsProperty.cpp @@ -1,5 +1,5 @@ #include "CFlagsProperty.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" void CFlagsProperty::Serialize(IArchive& rArc) { diff --git a/src/Core/Resource/Script/Property/CFlagsProperty.h b/src/Core/Resource/Script/Property/CFlagsProperty.h index 635df308..95c7d991 100644 --- a/src/Core/Resource/Script/Property/CFlagsProperty.h +++ b/src/Core/Resource/Script/Property/CFlagsProperty.h @@ -3,10 +3,10 @@ #include "IProperty.h" -class CFlagsProperty : public TSerializeableTypedProperty +class CFlagsProperty : public TSerializeableTypedProperty { friend class CTemplateLoader; - friend class IPropertyNew; + friend class IProperty; struct SBitFlag { @@ -64,7 +64,7 @@ public: virtual void Serialize(IArchive& rArc); virtual void PostInitialize(); virtual void SerializeValue(void* pData, IArchive& rArc) const; - virtual void InitFromArchetype(IPropertyNew* pOther); + virtual void InitFromArchetype(IProperty* pOther); virtual TString GetTemplateFileName(); /** diff --git a/src/Core/Resource/Script/Property/CFloatProperty.h b/src/Core/Resource/Script/Property/CFloatProperty.h index 14d94542..f73de593 100644 --- a/src/Core/Resource/Script/Property/CFloatProperty.h +++ b/src/Core/Resource/Script/Property/CFloatProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CFloatProperty : public TNumericalPropertyNew< float, EPropertyTypeNew::Float > +class CFloatProperty : public TNumericalProperty< float, EPropertyType::Float > { - friend class IPropertyNew; + friend class IProperty; protected: CFloatProperty(EGame Game) - : TNumericalPropertyNew(Game) + : TNumericalProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CGuidProperty.h b/src/Core/Resource/Script/Property/CGuidProperty.h index 47ad90c4..197f05cc 100644 --- a/src/Core/Resource/Script/Property/CGuidProperty.h +++ b/src/Core/Resource/Script/Property/CGuidProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CGuidProperty : public TTypedPropertyNew< std::vector, EPropertyTypeNew::Guid > +class CGuidProperty : public TTypedProperty< std::vector, EPropertyType::Guid > { - friend class IPropertyNew; + friend class IProperty; protected: CGuidProperty(EGame Game) - : TTypedPropertyNew(Game) + : TTypedProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CIntProperty.h b/src/Core/Resource/Script/Property/CIntProperty.h index f26a4ce4..dd62ca4b 100644 --- a/src/Core/Resource/Script/Property/CIntProperty.h +++ b/src/Core/Resource/Script/Property/CIntProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CIntProperty : public TNumericalPropertyNew< s32, EPropertyTypeNew::Int > +class CIntProperty : public TNumericalProperty< s32, EPropertyType::Int > { - friend class IPropertyNew; + friend class IProperty; protected: CIntProperty(EGame Game) - : TNumericalPropertyNew(Game) + : TNumericalProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CPointerProperty.h b/src/Core/Resource/Script/Property/CPointerProperty.h index 7717fc33..5d96e66b 100644 --- a/src/Core/Resource/Script/Property/CPointerProperty.h +++ b/src/Core/Resource/Script/Property/CPointerProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CPointerProperty : public TTypedPropertyNew +class CPointerProperty : public TTypedProperty { friend class CTemplateLoader; - friend class IPropertyNew; + friend class IProperty; CPointerProperty(EGame Game) - : TTypedPropertyNew(Game) + : TTypedProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CPropertyNameGenerator.cpp b/src/Core/Resource/Script/Property/CPropertyNameGenerator.cpp index 34892e7e..6ae2064c 100644 --- a/src/Core/Resource/Script/Property/CPropertyNameGenerator.cpp +++ b/src/Core/Resource/Script/Property/CPropertyNameGenerator.cpp @@ -1,7 +1,7 @@ #include "CPropertyNameGenerator.h" #include "IUIRelay.h" #include "Core/Resource/Factory/CTemplateLoader.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include /** Default constructor */ @@ -151,7 +151,7 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r // Check if this hash is a property ID - it's valid if there are any XMLs using this ID SGeneratedPropertyName PropertyName; - CMasterTemplate::XMLsUsingID(PropertyID, PropertyName.XmlList); + CGameTemplate::XMLsUsingID(PropertyID, PropertyName.XmlList); if (PropertyName.XmlList.size() > 0) { diff --git a/src/Core/Resource/Script/Property/CSequenceProperty.h b/src/Core/Resource/Script/Property/CSequenceProperty.h index f4a04ae6..4439b7a9 100644 --- a/src/Core/Resource/Script/Property/CSequenceProperty.h +++ b/src/Core/Resource/Script/Property/CSequenceProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CSequenceProperty : public TTypedPropertyNew< s32, EPropertyTypeNew::Sequence > +class CSequenceProperty : public TTypedProperty< s32, EPropertyType::Sequence > { - friend class IPropertyNew; + friend class IProperty; protected: CSequenceProperty(EGame Game) - : TTypedPropertyNew(Game) + : TTypedProperty(Game) {} virtual void SerializeValue(void* pData, IArchive& rArc) const diff --git a/src/Core/Resource/Script/Property/CShortProperty.h b/src/Core/Resource/Script/Property/CShortProperty.h index d2185a4e..906cc463 100644 --- a/src/Core/Resource/Script/Property/CShortProperty.h +++ b/src/Core/Resource/Script/Property/CShortProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CShortProperty : public TNumericalPropertyNew< s16, EPropertyTypeNew::Short > +class CShortProperty : public TNumericalProperty< s16, EPropertyType::Short > { - friend class IPropertyNew; + friend class IProperty; protected: CShortProperty(EGame Game) - : TNumericalPropertyNew(Game) + : TNumericalProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CSoundProperty.h b/src/Core/Resource/Script/Property/CSoundProperty.h index 31f0f1f9..8052f5b8 100644 --- a/src/Core/Resource/Script/Property/CSoundProperty.h +++ b/src/Core/Resource/Script/Property/CSoundProperty.h @@ -3,9 +3,9 @@ #include "IProperty.h" -class CSoundProperty : public TSerializeableTypedProperty< s32, EPropertyTypeNew::Sound > +class CSoundProperty : public TSerializeableTypedProperty< s32, EPropertyType::Sound > { - friend class IPropertyNew; + friend class IProperty; protected: CSoundProperty(EGame Game) diff --git a/src/Core/Resource/Script/Property/CSplineProperty.h b/src/Core/Resource/Script/Property/CSplineProperty.h index 20d04553..4c3e1949 100644 --- a/src/Core/Resource/Script/Property/CSplineProperty.h +++ b/src/Core/Resource/Script/Property/CSplineProperty.h @@ -3,13 +3,13 @@ #include "IProperty.h" -class CSplineProperty : public TTypedPropertyNew< std::vector, EPropertyTypeNew::Spline > +class CSplineProperty : public TTypedProperty< std::vector, EPropertyType::Spline > { - friend class IPropertyNew; + friend class IProperty; protected: CSplineProperty(EGame Game) - : TTypedPropertyNew(Game) + : TTypedProperty(Game) {} public: diff --git a/src/Core/Resource/Script/Property/CStringProperty.h b/src/Core/Resource/Script/Property/CStringProperty.h index 1d35b9ff..b2053226 100644 --- a/src/Core/Resource/Script/Property/CStringProperty.h +++ b/src/Core/Resource/Script/Property/CStringProperty.h @@ -3,9 +3,9 @@ #include "IProperty.h" -class CStringProperty : public TSerializeableTypedProperty< TString, EPropertyTypeNew::String > +class CStringProperty : public TSerializeableTypedProperty< TString, EPropertyType::String > { - friend class IPropertyNew; + friend class IProperty; protected: CStringProperty(EGame Game) diff --git a/src/Core/Resource/Script/Property/CStructProperty.cpp b/src/Core/Resource/Script/Property/CStructProperty.cpp index 1581780f..1ace6245 100644 --- a/src/Core/Resource/Script/Property/CStructProperty.cpp +++ b/src/Core/Resource/Script/Property/CStructProperty.cpp @@ -1,5 +1,5 @@ #include "CStructProperty.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" EPropertyType CStructProperty::Type() const { diff --git a/src/Core/Resource/Script/Property/CStructProperty.h b/src/Core/Resource/Script/Property/CStructProperty.h index 87681eb4..04d54b20 100644 --- a/src/Core/Resource/Script/Property/CStructProperty.h +++ b/src/Core/Resource/Script/Property/CStructProperty.h @@ -3,10 +3,10 @@ #include "IProperty.h" -class CStructPropertyNew : public IPropertyNew +class CStructProperty : public IProperty { friend class CTemplateLoader; - friend class IPropertyNew; + friend class IProperty; public: // Must be a valid type for TPropertyRef @@ -16,12 +16,12 @@ protected: /** For archetypes, the filename of the template XML file. */ TString mTemplateFileName; - CStructPropertyNew(EGame Game) - : IPropertyNew(Game) + CStructProperty(EGame Game) + : IProperty(Game) {} public: - virtual EPropertyTypeNew Type() const; + virtual EPropertyType Type() const; virtual u32 DataSize() const; virtual u32 DataAlignment() const; virtual void Construct(void* pData) const; @@ -31,11 +31,11 @@ public: virtual const char* HashableTypeName() const; virtual void Serialize(IArchive& rArc); virtual void SerializeValue(void* pData, IArchive& Arc) const; - virtual void InitFromArchetype(IPropertyNew* pOther); + virtual void InitFromArchetype(IProperty* pOther); virtual bool ShouldSerialize() const; virtual TString GetTemplateFileName(); - inline static EPropertyTypeNew StaticType() { return EPropertyTypeNew::Struct; } + inline static EPropertyType StaticType() { return EPropertyType::Struct; } }; #endif diff --git a/src/Core/Resource/Script/Property/CVectorProperty.h b/src/Core/Resource/Script/Property/CVectorProperty.h index 3b0fad84..089c2bbd 100644 --- a/src/Core/Resource/Script/Property/CVectorProperty.h +++ b/src/Core/Resource/Script/Property/CVectorProperty.h @@ -3,9 +3,9 @@ #include "IProperty.h" -class CVectorProperty : public TSerializeableTypedProperty< CVector3f, EPropertyTypeNew::Vector > +class CVectorProperty : public TSerializeableTypedProperty< CVector3f, EPropertyType::Vector > { - friend class IPropertyNew; + friend class IProperty; protected: CVectorProperty(EGame Game) @@ -15,9 +15,9 @@ protected: public: virtual void PostInitialize() override { - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 0, "X"); - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 4, "Y"); - CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 8, "Z"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "X"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "Y"); + CreateIntrinsic(EPropertyType::Float, this, mOffset + 8, "Z"); } virtual void SerializeValue(void* pData, IArchive& Arc) const diff --git a/src/Core/Resource/Script/Property/IProperty.cpp b/src/Core/Resource/Script/Property/IProperty.cpp index c71980bc..08301eda 100644 --- a/src/Core/Resource/Script/Property/IProperty.cpp +++ b/src/Core/Resource/Script/Property/IProperty.cpp @@ -5,11 +5,11 @@ #include "CFlagsProperty.h" #include "CPointerProperty.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include "Core/Resource/Script/CScriptTemplate.h" -/** IPropertyNew */ -IPropertyNew::IPropertyNew(EGame Game) +/** IProperty */ +IProperty::IProperty(EGame Game) : mpParent( nullptr ) , mpPointerParent( nullptr ) , mpArchetype( nullptr ) @@ -17,12 +17,12 @@ IPropertyNew::IPropertyNew(EGame Game) , mpScriptTemplate( nullptr ) , mOffset( -1 ) , mID( -1 ) - , mCookPreference( ECookPreferenceNew::Default ) + , mCookPreference( ECookPreference::Default ) , mMinVersion( 0.0f ) , mMaxVersion( FLT_MAX ) {} -void IPropertyNew::_ClearChildren() +void IProperty::_ClearChildren() { for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++) delete mChildren[ChildIdx]; @@ -30,7 +30,7 @@ void IPropertyNew::_ClearChildren() mChildren.clear(); } -IPropertyNew::~IPropertyNew() +IProperty::~IProperty() { // Remove from archetype if( mpArchetype != nullptr ) @@ -48,17 +48,17 @@ IPropertyNew::~IPropertyNew() _ClearChildren(); } -const char* IPropertyNew::HashableTypeName() const +const char* IProperty::HashableTypeName() const { return PropEnumToHashableTypeName( Type() ); } -void* IPropertyNew::GetChildDataPointer(void* pPropertyData) const +void* IProperty::GetChildDataPointer(void* pPropertyData) const { return pPropertyData; } -void IPropertyNew::Serialize(IArchive& rArc) +void IProperty::Serialize(IArchive& rArc) { // Always serialize ID first! ID is always required (except for root properties, which have an ID of 0xFFFFFFFF) // because they are needed to look up the correct property to apply parameter overrides to. @@ -72,8 +72,8 @@ void IPropertyNew::Serialize(IArchive& rArc) if (rArc.IsReader() && !ArchetypeName.IsEmpty()) { - CMasterTemplate* pMaster = CMasterTemplate::MasterForGame( Game() ); - IPropertyNew* pArchetype = pMaster->FindPropertyArchetype(ArchetypeName); + CGameTemplate* pGame = CGameTemplate::GetGameTemplate( Game() ); + IProperty* pArchetype = pGame->FindPropertyArchetype(ArchetypeName); // The archetype must exist, or else the template file is malformed. ASSERT(pArchetype != nullptr); @@ -95,7 +95,7 @@ void IPropertyNew::Serialize(IArchive& rArc) } rArc << SerialParameter("Description", mDescription, SH_Optional, mpArchetype ? mpArchetype->mDescription : "") - << SerialParameter("CookPreference", mCookPreference, SH_Optional, mpArchetype ? mpArchetype->mCookPreference : ECookPreferenceNew::Default) + << SerialParameter("CookPreference", mCookPreference, SH_Optional, mpArchetype ? mpArchetype->mCookPreference : ECookPreference::Default) << SerialParameter("MinVersion", mMinVersion, SH_Optional, mpArchetype ? mpArchetype->mMinVersion : 0.f) << SerialParameter("MaxVersion", mMaxVersion, SH_Optional, mpArchetype ? mpArchetype->mMaxVersion : FLT_MAX) << SerialParameter("Suffix", mSuffix, SH_Optional, mpArchetype ? mpArchetype->mSuffix : ""); @@ -103,7 +103,7 @@ void IPropertyNew::Serialize(IArchive& rArc) // Children don't get serialized for most property types } -void IPropertyNew::InitFromArchetype(IPropertyNew* pOther) +void IProperty::InitFromArchetype(IProperty* pOther) { //@todo maybe somehow use Serialize for this instead? mpArchetype = pOther; @@ -122,7 +122,7 @@ void IPropertyNew::InitFromArchetype(IPropertyNew* pOther) } } -bool IPropertyNew::ShouldSerialize() const +bool IProperty::ShouldSerialize() const { return mpArchetype == nullptr || mName != mpArchetype->mName || @@ -133,7 +133,7 @@ bool IPropertyNew::ShouldSerialize() const mMaxVersion != mpArchetype->mMaxVersion; } -TString IPropertyNew::GetTemplateFileName() +TString IProperty::GetTemplateFileName() { if (mpScriptTemplate) { @@ -141,7 +141,7 @@ TString IPropertyNew::GetTemplateFileName() } else if (IsArchetype()) { - IPropertyNew* pRootParent = RootParent(); + IProperty* pRootParent = RootParent(); ASSERT(pRootParent != this); return pRootParent->GetTemplateFileName(); } @@ -151,7 +151,7 @@ TString IPropertyNew::GetTemplateFileName() } } -void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTemplate, u32 InOffset) +void IProperty::Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u32 InOffset) { // Make sure we only get initialized once. ASSERT( (mFlags & EPropertyFlag::IsInitialized) == 0 ); @@ -164,7 +164,7 @@ void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTempl // Look up property name if needed. if (Game() >= eEchoesDemo && !IsRootParent() && !IsIntrinsic() && !mpParent->IsAtomic() && !IsArrayArchetype()) { - mName = CMasterTemplate::PropertyName(mID); + mName = CGameTemplate::PropertyName(mID); } // Set any fields dependent on the parent... @@ -190,7 +190,7 @@ void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTempl for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++) { - IPropertyNew* pChild = mChildren[ChildIdx]; + IProperty* pChild = mChildren[ChildIdx]; // update offset and round up to the child's alignment if (ChildIdx > 0) @@ -207,7 +207,7 @@ void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTempl } } -void* IPropertyNew::RawValuePtr(void* pData) const +void* IProperty::RawValuePtr(void* pData) const { // For array archetypes, the caller needs to provide the pointer to the correct array item // Array archetypes can't store their index in the array so it's impossible to determine the correct pointer. @@ -216,7 +216,7 @@ void* IPropertyNew::RawValuePtr(void* pData) const return pValuePtr; } -IPropertyNew* IPropertyNew::ChildByID(u32 ID) const +IProperty* IProperty::ChildByID(u32 ID) const { for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++) { @@ -227,7 +227,7 @@ IPropertyNew* IPropertyNew::ChildByID(u32 ID) const return nullptr; } -IPropertyNew* IPropertyNew::ChildByIDString(const TIDString& rkIdString) +IProperty* IProperty::ChildByIDString(const TIDString& rkIdString) { // String must contain at least one ID! // some ID strings are formatted with 8 characters and some with 2 (plus the beginning "0x") @@ -246,7 +246,7 @@ IPropertyNew* IPropertyNew::ChildByIDString(const TIDString& rkIdString) return nullptr; } - IPropertyNew* pNextChild = ChildByID(NextChildID); + IProperty* pNextChild = ChildByID(NextChildID); // Check if we need to recurse if (IDEndPos != -1) @@ -259,14 +259,14 @@ IPropertyNew* IPropertyNew::ChildByIDString(const TIDString& rkIdString) } } -bool IPropertyNew::ShouldCook(void*pPropertyData) const +bool IProperty::ShouldCook(void*pPropertyData) const { switch (mCookPreference) { - case ECookPreferenceNew::Always: + case ECookPreference::Always: return true; - case ECookPreferenceNew::Never: + case ECookPreference::Never: return false; default: @@ -274,28 +274,28 @@ bool IPropertyNew::ShouldCook(void*pPropertyData) const } } -void IPropertyNew::SetName(const TString& rkNewName) +void IProperty::SetName(const TString& rkNewName) { mName = rkNewName; mFlags.ClearFlag(EPropertyFlag::HasCachedNameCheck); } -void IPropertyNew::SetDescription(const TString& rkNewDescription) +void IProperty::SetDescription(const TString& rkNewDescription) { mDescription = rkNewDescription; } -void IPropertyNew::SetSuffix(const TString& rkNewSuffix) +void IProperty::SetSuffix(const TString& rkNewSuffix) { mSuffix = rkNewSuffix; } -void IPropertyNew::SetPropertyFlags(FPropertyFlags FlagsToSet) +void IProperty::SetPropertyFlags(FPropertyFlags FlagsToSet) { mFlags |= FlagsToSet; } -bool IPropertyNew::HasAccurateName() +bool IProperty::HasAccurateName() { // Exceptions for the three hardcoded 4CC property IDs if (mID == FOURCC('XFRM') || mID == FOURCC('INAM') || mID == FOURCC('ACTV')) @@ -330,39 +330,39 @@ bool IPropertyNew::HasAccurateName() } /** IPropertyNew Accessors */ -EGame IPropertyNew::Game() const +EGame IProperty::Game() const { return mGame; } -IPropertyNew* IPropertyNew::Create(EPropertyTypeNew Type, +IProperty* IProperty::Create(EPropertyType Type, EGame Game) { - IPropertyNew* pOut = nullptr; + IProperty* pOut = nullptr; switch (Type) { - case EPropertyTypeNew::Bool: pOut = new CBoolProperty(Game); break; - case EPropertyTypeNew::Byte: pOut = new CByteProperty(Game); break; - case EPropertyTypeNew::Short: pOut = new CShortProperty(Game); break; - case EPropertyTypeNew::Int: pOut = new CIntProperty(Game); break; - case EPropertyTypeNew::Float: pOut = new CFloatProperty(Game); break; - case EPropertyTypeNew::Choice: pOut = new CChoiceProperty(Game); break; - case EPropertyTypeNew::Enum: pOut = new CEnumProperty(Game); break; - case EPropertyTypeNew::Flags: pOut = new CFlagsProperty(Game); break; - case EPropertyTypeNew::String: pOut = new CStringProperty(Game); break; - case EPropertyTypeNew::Vector: pOut = new CVectorProperty(Game); break; - case EPropertyTypeNew::Color: pOut = new CColorProperty(Game); break; - case EPropertyTypeNew::Asset: pOut = new CAssetProperty(Game); break; - case EPropertyTypeNew::Sound: pOut = new CSoundProperty(Game); break; - case EPropertyTypeNew::Animation: pOut = new CAnimationProperty(Game); break; - case EPropertyTypeNew::AnimationSet: pOut = new CAnimationSetProperty(Game); break; - case EPropertyTypeNew::Sequence: pOut = new CSequenceProperty(Game); break; - case EPropertyTypeNew::Spline: pOut = new CSplineProperty(Game); break; - case EPropertyTypeNew::Guid: pOut = new CGuidProperty(Game); break; - case EPropertyTypeNew::Pointer: pOut = new CPointerProperty(Game); break; - case EPropertyTypeNew::Struct: pOut = new CStructPropertyNew(Game); break; - case EPropertyTypeNew::Array: pOut = new CArrayProperty(Game); break; + case EPropertyType::Bool: pOut = new CBoolProperty(Game); break; + case EPropertyType::Byte: pOut = new CByteProperty(Game); break; + case EPropertyType::Short: pOut = new CShortProperty(Game); break; + case EPropertyType::Int: pOut = new CIntProperty(Game); break; + case EPropertyType::Float: pOut = new CFloatProperty(Game); break; + case EPropertyType::Choice: pOut = new CChoiceProperty(Game); break; + case EPropertyType::Enum: pOut = new CEnumProperty(Game); break; + case EPropertyType::Flags: pOut = new CFlagsProperty(Game); break; + case EPropertyType::String: pOut = new CStringProperty(Game); break; + case EPropertyType::Vector: pOut = new CVectorProperty(Game); break; + case EPropertyType::Color: pOut = new CColorProperty(Game); break; + case EPropertyType::Asset: pOut = new CAssetProperty(Game); break; + case EPropertyType::Sound: pOut = new CSoundProperty(Game); break; + case EPropertyType::Animation: pOut = new CAnimationProperty(Game); break; + case EPropertyType::AnimationSet: pOut = new CAnimationSetProperty(Game); break; + case EPropertyType::Sequence: pOut = new CSequenceProperty(Game); break; + case EPropertyType::Spline: pOut = new CSplineProperty(Game); break; + case EPropertyType::Guid: pOut = new CGuidProperty(Game); break; + case EPropertyType::Pointer: pOut = new CPointerProperty(Game); break; + case EPropertyType::Struct: pOut = new CStructProperty(Game); break; + case EPropertyType::Array: pOut = new CArrayProperty(Game); break; } // If this assertion fails, then there is an unhandled type! @@ -370,28 +370,28 @@ IPropertyNew* IPropertyNew::Create(EPropertyTypeNew Type, return pOut; } -IPropertyNew* IPropertyNew::CreateCopy(IPropertyNew* pArchetype) +IProperty* IProperty::CreateCopy(IProperty* pArchetype) { - IPropertyNew* pOut = Create(pArchetype->Type(), pArchetype->mGame); + IProperty* pOut = Create(pArchetype->Type(), pArchetype->mGame); pOut->InitFromArchetype(pArchetype); pArchetype->mSubInstances.push_back(pOut); return pOut; } -IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type, +IProperty* IProperty::CreateIntrinsic(EPropertyType Type, EGame Game, u32 Offset, const TString& rkName) { - IPropertyNew* pOut = Create(Type, Game); + IProperty* pOut = Create(Type, Game); pOut->mFlags |= EPropertyFlag::IsIntrinsic; pOut->SetName(rkName); pOut->Initialize(nullptr, nullptr, Offset); return pOut; } -IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type, - IPropertyNew* pParent, +IProperty* IProperty::CreateIntrinsic(EPropertyType Type, + IProperty* pParent, u32 Offset, const TString& rkName) { @@ -399,7 +399,7 @@ IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type, // If you are creating a root property, call the other overload takes an EGame instead of a parent. ASSERT(pParent != nullptr); - IPropertyNew* pOut = Create(Type, pParent->mGame); + IProperty* pOut = Create(Type, pParent->mGame); pOut->mFlags |= EPropertyFlag::IsIntrinsic; pOut->SetName(rkName); pOut->Initialize(pParent, nullptr, Offset); @@ -407,7 +407,7 @@ IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type, return pOut; } -IPropertyNew* IPropertyNew::ArchiveConstructor(EPropertyTypeNew Type, +IProperty* IProperty::ArchiveConstructor(EPropertyType Type, const IArchive& Arc) { return Create(Type, Arc.Game()); diff --git a/src/Core/Resource/Script/Property/IProperty.h b/src/Core/Resource/Script/Property/IProperty.h index e503fea9..6218fef3 100644 --- a/src/Core/Resource/Script/Property/IProperty.h +++ b/src/Core/Resource/Script/Property/IProperty.h @@ -1,5 +1,5 @@ -#ifndef IPROPERTYNEW_H -#define IPROPERTYNEW_H +#ifndef IPROPERTY_H +#define IPROPERTY_H #include "Core/Resource/Animation/CAnimationParameters.h" #include @@ -9,9 +9,9 @@ #include /** Forward declares */ -class CMasterTemplate; +class CGameTemplate; class CScriptTemplate; -class CStructPropertyNew; +class CStructProperty; /** Typedefs */ typedef TString TIDString; @@ -42,7 +42,7 @@ enum class EPropertyFlag : u32 DECLARE_FLAGS_ENUMCLASS(EPropertyFlag, FPropertyFlags) /** Property type */ -enum class EPropertyTypeNew +enum class EPropertyType { Bool = FOURCC('BOOL'), Byte = FOURCC('BYTE'), @@ -68,38 +68,38 @@ enum class EPropertyTypeNew Invalid = FOURCC('INVD') }; -inline const char* PropEnumToHashableTypeName(EPropertyTypeNew Type) +inline const char* PropEnumToHashableTypeName(EPropertyType Type) { switch (Type) { // these names are required to generate accurate property ID hashes - case EPropertyTypeNew::Bool: return "bool"; - case EPropertyTypeNew::Int: return "int"; - case EPropertyTypeNew::Float: return "float"; - case EPropertyTypeNew::Choice: return "choice"; - case EPropertyTypeNew::Enum: return "enum"; - case EPropertyTypeNew::Flags: return "Flags"; - case EPropertyTypeNew::String: return "string"; - case EPropertyTypeNew::Vector: return "Vector"; - case EPropertyTypeNew::Color: return "Color"; - case EPropertyTypeNew::Asset: return "asset"; - case EPropertyTypeNew::Sound: return "sound"; - case EPropertyTypeNew::Spline: return "spline"; - case EPropertyTypeNew::Guid: return "guid"; + case EPropertyType::Bool: return "bool"; + case EPropertyType::Int: return "int"; + case EPropertyType::Float: return "float"; + case EPropertyType::Choice: return "choice"; + case EPropertyType::Enum: return "enum"; + case EPropertyType::Flags: return "Flags"; + case EPropertyType::String: return "string"; + case EPropertyType::Vector: return "Vector"; + case EPropertyType::Color: return "Color"; + case EPropertyType::Asset: return "asset"; + case EPropertyType::Sound: return "sound"; + case EPropertyType::Spline: return "spline"; + case EPropertyType::Guid: return "guid"; // unknown hashable types - used in hashes but these names are inaccurate - case EPropertyTypeNew::Animation: return "animation"; - case EPropertyTypeNew::Sequence: return "sequence"; + case EPropertyType::Animation: return "animation"; + case EPropertyType::Sequence: return "sequence"; // non hashable types - not used in ID hashes but still displayed on the UI - case EPropertyTypeNew::Byte: return "byte"; - case EPropertyTypeNew::Short: return "short"; - case EPropertyTypeNew::Array: return "array"; + case EPropertyType::Byte: return "byte"; + case EPropertyType::Short: return "short"; + case EPropertyType::Array: return "array"; // fallback default: return ""; } } /** Enum that describes when/how properties should be cooked out */ -enum class ECookPreferenceNew +enum class ECookPreference { Default, Always, @@ -107,7 +107,7 @@ enum class ECookPreferenceNew }; /** New property class */ -class IPropertyNew +class IProperty { friend class CTemplateLoader; friend class CPropertyFactory; @@ -117,21 +117,21 @@ protected: FPropertyFlags mFlags; /** Parent property */ - IPropertyNew* mpParent; + IProperty* mpParent; /** Pointer parent; if non-null, this parent needs to be dereferenced to access the correct * memory region that our property data is stored in */ - IPropertyNew* mpPointerParent; + IProperty* mpPointerParent; /** Archetype property; source property that we copied metadata from */ - IPropertyNew* mpArchetype; + IProperty* mpArchetype; /** Sub-instances of archetype properties. For non-archetypes, will be empty. * @todo this really oughta be a linked list */ - std::vector mSubInstances; + std::vector mSubInstances; /** Child properties; these appear underneath this property on the UI */ - std::vector mChildren; + std::vector mChildren; /** Game this property belongs to */ EGame mGame; @@ -149,7 +149,7 @@ protected: TString mName; TString mDescription; TString mSuffix; - ECookPreferenceNew mCookPreference; + ECookPreference mCookPreference; /** 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 @@ -159,14 +159,14 @@ protected: float mMaxVersion; /** Private constructor - use static methods to instantiate */ - IPropertyNew(EGame Game); + IProperty(EGame Game); void _ClearChildren(); public: - virtual ~IPropertyNew(); + virtual ~IProperty(); /** Interface */ - virtual EPropertyTypeNew Type() const = 0; + virtual EPropertyType Type() const = 0; virtual u32 DataSize() const = 0; virtual u32 DataAlignment() const = 0; virtual void Construct(void* pData) const = 0; @@ -183,15 +183,15 @@ public: virtual const char* HashableTypeName() const; virtual void* GetChildDataPointer(void* pPropertyData) const; virtual void Serialize(IArchive& rArc); - virtual void InitFromArchetype(IPropertyNew* pOther); + virtual void InitFromArchetype(IProperty* pOther); virtual bool ShouldSerialize() const; virtual TString GetTemplateFileName(); /** Utility methods */ - void Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTemplate, u32 InOffset); + void Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u32 InOffset); void* RawValuePtr(void* pData) const; - IPropertyNew* ChildByID(u32 ID) const; - IPropertyNew* ChildByIDString(const TIDString& rkIdString); + IProperty* ChildByID(u32 ID) const; + IProperty* ChildByIDString(const TIDString& rkIdString); bool ShouldCook(void* pPropertyData) const; void SetName(const TString& rkNewName); void SetDescription(const TString& rkNewDescription); @@ -201,12 +201,12 @@ public: /** Accessors */ EGame Game() const; - inline ECookPreferenceNew CookPreference() const; + inline ECookPreference CookPreference() const; inline u32 NumChildren() const; - inline IPropertyNew* ChildByIndex(u32 ChildIndex) const; - inline IPropertyNew* Parent() const; - inline IPropertyNew* RootParent(); - inline IPropertyNew* Archetype() const; + inline IProperty* ChildByIndex(u32 ChildIndex) const; + inline IProperty* Parent() const; + inline IProperty* RootParent(); + inline IProperty* Archetype() const; inline CScriptTemplate* ScriptTemplate() const; inline TString Name() const; inline TString Description() const; @@ -222,50 +222,50 @@ public: inline bool IsRootParent() const { return mpParent == nullptr; } /** Create */ - static IPropertyNew* Create(EPropertyTypeNew Type, + static IProperty* Create(EPropertyType Type, EGame Game); - static IPropertyNew* CreateCopy(IPropertyNew* pArchetype); + static IProperty* CreateCopy(IProperty* pArchetype); - static IPropertyNew* CreateIntrinsic(EPropertyTypeNew Type, + static IProperty* CreateIntrinsic(EPropertyType Type, EGame Game, u32 Offset, const TString& rkName); - static IPropertyNew* CreateIntrinsic(EPropertyTypeNew Type, - IPropertyNew* pParent, + static IProperty* CreateIntrinsic(EPropertyType Type, + IProperty* pParent, u32 Offset, const TString& rkName); - static IPropertyNew* ArchiveConstructor(EPropertyTypeNew Type, + static IProperty* ArchiveConstructor(EPropertyType Type, const IArchive& Arc); }; -inline ECookPreferenceNew IPropertyNew::CookPreference() const +inline ECookPreference IProperty::CookPreference() const { return mCookPreference; } -inline u32 IPropertyNew::NumChildren() const +inline u32 IProperty::NumChildren() const { return mChildren.size(); } -inline IPropertyNew* IPropertyNew::ChildByIndex(u32 ChildIndex) const +inline IProperty* IProperty::ChildByIndex(u32 ChildIndex) const { ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size()); return mChildren[ChildIndex]; } -inline IPropertyNew* IPropertyNew::Parent() const +inline IProperty* IProperty::Parent() const { return mpParent; } -inline IPropertyNew* IPropertyNew::RootParent() +inline IProperty* IProperty::RootParent() { - IPropertyNew* pParent = Parent(); - IPropertyNew* pOut = this; + IProperty* pParent = Parent(); + IProperty* pOut = this; while (pParent) { @@ -276,32 +276,32 @@ inline IPropertyNew* IPropertyNew::RootParent() return pOut; } -inline IPropertyNew* IPropertyNew::Archetype() const +inline IProperty* IProperty::Archetype() const { return mpArchetype; } -inline CScriptTemplate* IPropertyNew::ScriptTemplate() const +inline CScriptTemplate* IProperty::ScriptTemplate() const { return mpScriptTemplate; } -inline TString IPropertyNew::Name() const +inline TString IProperty::Name() const { return mName; } -inline TString IPropertyNew::Description() const +inline TString IProperty::Description() const { return mDescription; } -inline TString IPropertyNew::Suffix() const +inline TString IProperty::Suffix() const { return mSuffix; } -inline TString IPropertyNew::IDString(bool FullyQualified) const +inline TString IProperty::IDString(bool FullyQualified) const { if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr) return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID); @@ -309,20 +309,20 @@ inline TString IPropertyNew::IDString(bool FullyQualified) const return TString::HexString(mID); } -inline u32 IPropertyNew::Offset() const +inline u32 IProperty::Offset() const { return mOffset; } -inline u32 IPropertyNew::ID() const +inline u32 IProperty::ID() const { return mID; } -template -class TTypedPropertyNew : public IPropertyNew +template +class TTypedProperty : public IProperty { - friend class IPropertyNew; + friend class IProperty; friend class CTemplateLoader; public: typedef PropType ValueType; @@ -330,14 +330,14 @@ public: protected: PropType mDefaultValue; - TTypedPropertyNew(EGame Game) - : IPropertyNew(Game) + TTypedProperty(EGame Game) + : IProperty(Game) { memset(&mDefaultValue, 0, sizeof(PropType)); } public: - virtual EPropertyTypeNew Type() const { return PropEnum; } + virtual EPropertyType Type() const { return PropEnum; } virtual u32 DataSize() const { return sizeof(PropType); } virtual u32 DataAlignment() const { return alignof(PropType); } virtual void Construct(void* pData) const { new(ValuePtr(pData)) PropType(mDefaultValue); } @@ -347,10 +347,10 @@ public: virtual bool CanHaveDefault() const { return true; } - virtual void InitFromArchetype(IPropertyNew* pOther) + virtual void InitFromArchetype(IProperty* pOther) { - IPropertyNew::InitFromArchetype(pOther); - mDefaultValue = static_cast(pOther)->mDefaultValue; + IProperty::InitFromArchetype(pOther); + mDefaultValue = static_cast(pOther)->mDefaultValue; } inline PropType* ValuePtr(void* pData) const @@ -378,21 +378,21 @@ public: mDefaultValue = kInDefaultValue; } - inline static EPropertyTypeNew StaticType() { return PropEnum; } + inline static EPropertyType StaticType() { return PropEnum; } }; -template -class TSerializeableTypedProperty : public TTypedPropertyNew +template +class TSerializeableTypedProperty : public TTypedProperty { protected: TSerializeableTypedProperty(EGame Game) - : TTypedPropertyNew(Game) + : TTypedProperty(Game) {} public: virtual void Serialize(IArchive& rArc) { - TTypedPropertyNew::Serialize(rArc); + TTypedProperty::Serialize(rArc); TSerializeableTypedProperty* pArchetype = static_cast(mpArchetype); // Determine if default value should be serialized as optional. @@ -408,13 +408,13 @@ public: { switch (Type()) { - case EPropertyTypeNew::String: - case EPropertyTypeNew::Asset: - case EPropertyTypeNew::Animation: - case EPropertyTypeNew::AnimationSet: - case EPropertyTypeNew::Sequence: - case EPropertyTypeNew::Spline: - case EPropertyTypeNew::Guid: + case EPropertyType::String: + case EPropertyType::Asset: + case EPropertyType::Animation: + case EPropertyType::AnimationSet: + case EPropertyType::Sequence: + case EPropertyType::Spline: + case EPropertyType::Guid: MakeOptional = true; break; } @@ -429,9 +429,9 @@ public: virtual bool ShouldSerialize() const { - TTypedPropertyNew* pArchetype = static_cast(mpArchetype); + TTypedProperty* pArchetype = static_cast(mpArchetype); - return TTypedPropertyNew::ShouldSerialize() || + return TTypedProperty::ShouldSerialize() || !(mDefaultValue == pArchetype->DefaultValue()); } @@ -442,17 +442,17 @@ public: } }; -template -class TNumericalPropertyNew : public TSerializeableTypedProperty +template +class TNumericalProperty : public TSerializeableTypedProperty { - friend class IPropertyNew; + friend class IProperty; friend class CTemplateLoader; protected: PropType mMinValue; PropType mMaxValue; - TNumericalPropertyNew(EGame Game) + TNumericalProperty(EGame Game) : TSerializeableTypedProperty(Game) , mMinValue( -1 ) , mMaxValue( -1 ) @@ -462,7 +462,7 @@ public: virtual void Serialize(IArchive& rArc) { TSerializeableTypedProperty::Serialize(rArc); - TNumericalPropertyNew* pArchetype = static_cast(mpArchetype); + TNumericalProperty* pArchetype = static_cast(mpArchetype); rArc << SerialParameter("Min", mMinValue, SH_Optional, pArchetype ? pArchetype->mMinValue : (PropType) -1) << SerialParameter("Max", mMaxValue, SH_Optional, pArchetype ? pArchetype->mMaxValue : (PropType) -1); @@ -470,16 +470,16 @@ public: virtual bool ShouldSerialize() const { - TNumericalPropertyNew* pArchetype = static_cast(mpArchetype); + TNumericalProperty* pArchetype = static_cast(mpArchetype); return TSerializeableTypedProperty::ShouldSerialize() || mMinValue != pArchetype->mMinValue || mMaxValue != pArchetype->mMaxValue; } - virtual void InitFromArchetype(IPropertyNew* pOther) + virtual void InitFromArchetype(IProperty* pOther) { TSerializeableTypedProperty::InitFromArchetype(pOther); - TNumericalPropertyNew* pCastOther = static_cast(pOther); + TNumericalProperty* pCastOther = static_cast(pOther); mMinValue = pCastOther->mMinValue; mMaxValue = pCastOther->mMaxValue; } @@ -498,7 +498,7 @@ public: /** Property casting with dynamic type checking */ template -inline PropertyClass* TPropCast(IPropertyNew* pProperty) +inline PropertyClass* TPropCast(IProperty* pProperty) { if (pProperty && pProperty->Type() == PropertyClass::StaticType()) { @@ -510,4 +510,4 @@ inline PropertyClass* TPropCast(IPropertyNew* pProperty) } } -#endif // IPROPERTYNEW_H +#endif // IPROPERTY_H diff --git a/src/Core/Resource/Script/Property/TPropertyRef.h b/src/Core/Resource/Script/Property/TPropertyRef.h index 8f5febbb..727a8b72 100644 --- a/src/Core/Resource/Script/Property/TPropertyRef.h +++ b/src/Core/Resource/Script/Property/TPropertyRef.h @@ -37,7 +37,7 @@ public: : mpPropertyData(nullptr), mpProperty(nullptr) {} - explicit TPropertyRef(void* pInData, IPropertyNew* pInProperty) + explicit TPropertyRef(void* pInData, IProperty* pInProperty) : mpPropertyData(pInData), mpProperty( TPropCast(pInProperty) ) { } @@ -60,12 +60,12 @@ public: return Get(); } - inline bool operator==(IPropertyNew* pProperty) const + inline bool operator==(IProperty* pProperty) const { return mpProperty == pProperty; } - friend bool operator==(IPropertyNew* pLeft, const TPropertyRef& kRight) + friend bool operator==(IProperty* pLeft, const TPropertyRef& kRight) { return pLeft == kRight.Property(); } @@ -89,7 +89,7 @@ typedef TPropertyRef CSequenceRef; typedef TPropertyRef CSplineRef; typedef TPropertyRef CGuidRef; typedef TPropertyRef CPointerRef; -typedef TPropertyRef CStructRef; +typedef TPropertyRef CStructRef; typedef TPropertyRef CArrayRef; /** Special version for enums */ @@ -101,7 +101,7 @@ public: : TPropertyRef() {} - TEnumRef(void* pInData, IPropertyNew* pInProperty) + TEnumRef(void* pInData, IProperty* pInProperty) : TPropertyRef(pInData, pInProperty) {} diff --git a/src/Core/Scene/CScriptAttachNode.cpp b/src/Core/Scene/CScriptAttachNode.cpp index a5a9054a..8ec74b1d 100644 --- a/src/Core/Scene/CScriptAttachNode.cpp +++ b/src/Core/Scene/CScriptAttachNode.cpp @@ -10,7 +10,7 @@ CScriptAttachNode::CScriptAttachNode(CScene *pScene, const SAttachment& rkAttach , mAttachType(rkAttachment.AttachType) , mLocatorName(rkAttachment.LocatorName) { - CStructPropertyNew* pBaseStruct = pParent->Template()->Properties(); + CStructProperty* pBaseStruct = pParent->Template()->Properties(); mpAttachAssetProp = pBaseStruct->ChildByIDString(rkAttachment.AttachProperty); mAttachAssetRef = CAssetRef(pParent->Instance()->PropertyData(), mpAttachAssetProp); diff --git a/src/Core/Scene/CScriptNode.cpp b/src/Core/Scene/CScriptNode.cpp index 4f3d8b4e..a891d096 100644 --- a/src/Core/Scene/CScriptNode.cpp +++ b/src/Core/Scene/CScriptNode.cpp @@ -5,7 +5,7 @@ #include "Core/Render/CGraphics.h" #include "Core/Render/CRenderer.h" #include "Core/Resource/Animation/CAnimSet.h" -#include "Core/Resource/Script/CMasterTemplate.h" +#include "Core/Resource/Script/CGameTemplate.h" #include "Core/Resource/Script/CScriptLayer.h" #include "Core/ScriptExtra/CScriptExtra.h" #include @@ -66,7 +66,7 @@ CScriptNode::CScriptNode(CScene *pScene, u32 NodeID, CSceneNode *pParent, CScrip } // Fetch LightParameters - mpLightParameters = new CLightParameters(mpInstance->LightParameters(), mpInstance->MasterTemplate()->Game()); + mpLightParameters = new CLightParameters(mpInstance->LightParameters(), mpInstance->GameTemplate()->Game()); SetLightLayerIndex(mpLightParameters->LightLayerIndex()); } diff --git a/src/Editor/CExportGameDialog.cpp b/src/Editor/CExportGameDialog.cpp index ff303348..0a2282da 100644 --- a/src/Editor/CExportGameDialog.cpp +++ b/src/Editor/CExportGameDialog.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Editor/CGeneratePropertyNamesDialog.cpp b/src/Editor/CGeneratePropertyNamesDialog.cpp index b9ce8bfe..206928a8 100644 --- a/src/Editor/CGeneratePropertyNamesDialog.cpp +++ b/src/Editor/CGeneratePropertyNamesDialog.cpp @@ -3,7 +3,6 @@ #include "Editor/Widgets/CCheckableTreeWidgetItem.h" #include "UICommon.h" -#include #include #include #include @@ -227,7 +226,7 @@ void CGeneratePropertyNamesDialog::ApplyChanges() u32 ID = TO_TSTRING( pItem->text(2) ).ToInt32(); QString NewName = pItem->text(0); - CMasterTemplate::RenameProperty( ID, TO_TSTRING(NewName) ); + CGameTemplate::RenameProperty( ID, TO_TSTRING(NewName) ); pItem->setText(3, NewName); } @@ -259,7 +258,7 @@ void CGeneratePropertyNamesDialog::CheckForNewResults() ColumnText << TO_QSTRING( rkName.Name ) << TO_QSTRING( rkName.Type ) << TO_QSTRING( TString::HexString(rkName.ID) ) - << TO_QSTRING( CMasterTemplate::PropertyName(rkName.ID) ); + << TO_QSTRING( CGameTemplate::PropertyName(rkName.ID) ); QTreeWidgetItem* pItem = new CCheckableTreeWidgetItem(pTreeWidget, ColumnText); pItem->setFlags(Qt::ItemIsEnabled | diff --git a/src/Editor/PropertyEdit/CPropertyDelegate.cpp b/src/Editor/PropertyEdit/CPropertyDelegate.cpp index 15f12191..cc09f047 100644 --- a/src/Editor/PropertyEdit/CPropertyDelegate.cpp +++ b/src/Editor/PropertyEdit/CPropertyDelegate.cpp @@ -48,7 +48,7 @@ void CPropertyDelegate::SetEditor(CWorldEditor *pEditor) QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionViewItem& /*rkOption*/, const QModelIndex& rkIndex) const { if (!mpModel) return nullptr; - IPropertyNew *pProp = mpModel->PropertyForIndex(rkIndex, false); + IProperty *pProp = mpModel->PropertyForIndex(rkIndex, false); QWidget *pOut = nullptr; if (pProp) @@ -56,7 +56,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie switch (pProp->Type()) { - case EPropertyTypeNew::Bool: + case EPropertyType::Bool: { QCheckBox *pCheckBox = new QCheckBox(pParent); CONNECT_RELAY(pCheckBox, rkIndex, toggled(bool)) @@ -64,7 +64,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Short: + case EPropertyType::Short: { WIntegralSpinBox *pSpinBox = new WIntegralSpinBox(pParent); pSpinBox->setMinimum(INT16_MIN); @@ -75,7 +75,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Int: + case EPropertyType::Int: { WIntegralSpinBox *pSpinBox = new WIntegralSpinBox(pParent); pSpinBox->setMinimum(INT32_MIN); @@ -86,7 +86,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Float: + case EPropertyType::Float: { WDraggableSpinBox *pSpinBox = new WDraggableSpinBox(pParent); pSpinBox->setSingleStep(0.1); @@ -96,7 +96,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Color: + case EPropertyType::Color: { WColorPicker *pColorPicker = new WColorPicker(pParent); CONNECT_RELAY(pColorPicker, rkIndex, ColorChanged(QColor)) @@ -104,7 +104,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Sound: + case EPropertyType::Sound: { WIntegralSpinBox *pSpinBox = new WIntegralSpinBox(pParent); pSpinBox->setMinimum(-1); @@ -114,7 +114,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::String: + case EPropertyType::String: { QLineEdit *pLineEdit = new QLineEdit(pParent); CONNECT_RELAY(pLineEdit, rkIndex, textEdited(QString)) @@ -122,8 +122,8 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Enum: - case EPropertyTypeNew::Choice: + case EPropertyType::Enum: + case EPropertyType::Choice: { QComboBox *pComboBox = new QComboBox(pParent); CEnumProperty* pEnum = TPropCast(pProp); @@ -136,7 +136,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Asset: + case EPropertyType::Asset: { CResourceSelector *pSelector = new CResourceSelector(pParent); pSelector->SetFrameVisible(false); @@ -149,7 +149,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie break; } - case EPropertyTypeNew::Array: + case EPropertyType::Array: { // No relay here, would prefer user to be sure of their change before it's reflected on the UI WIntegralSpinBox *pSpinBox = new WIntegralSpinBox(pParent); @@ -166,14 +166,14 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie else if (rkIndex.internalId() & 0x80000000) { pProp = mpModel->PropertyForIndex(rkIndex, true); - EPropertyTypeNew Type = pProp->Type(); + EPropertyType Type = pProp->Type(); // Handle character - if (Type == EPropertyTypeNew::AnimationSet) + if (Type == EPropertyType::AnimationSet) pOut = CreateCharacterEditor(pParent, rkIndex); // Handle flags - else if (Type == EPropertyTypeNew::Flags) + else if (Type == EPropertyType::Flags) { QCheckBox *pCheckBox = new QCheckBox(pParent); CONNECT_RELAY(pCheckBox, rkIndex, toggled(bool)) @@ -199,7 +199,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd if (pEditor) { // Set editor data for regular property - IPropertyNew *pProp = mpModel->PropertyForIndex(rkIndex, false); + IProperty *pProp = mpModel->PropertyForIndex(rkIndex, false); void* pData = mpModel->DataPointerForIndex(rkIndex); if (pProp) @@ -209,7 +209,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd switch (pProp->Type()) { - case EPropertyTypeNew::Bool: + case EPropertyType::Bool: { QCheckBox *pCheckBox = static_cast(pEditor); CBoolProperty *pBool = TPropCast(pProp); @@ -217,7 +217,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Short: + case EPropertyType::Short: { WIntegralSpinBox *pSpinBox = static_cast(pEditor); @@ -230,7 +230,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Int: + case EPropertyType::Int: { WIntegralSpinBox *pSpinBox = static_cast(pEditor); @@ -243,7 +243,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Sound: + case EPropertyType::Sound: { WIntegralSpinBox *pSpinBox = static_cast(pEditor); @@ -256,7 +256,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Float: + case EPropertyType::Float: { WDraggableSpinBox *pSpinBox = static_cast(pEditor); @@ -269,7 +269,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Color: + case EPropertyType::Color: { WColorPicker *pColorPicker = static_cast(pEditor); CColorProperty *pColor = TPropCast(pProp); @@ -279,7 +279,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::String: + case EPropertyType::String: { QLineEdit *pLineEdit = static_cast(pEditor); @@ -292,8 +292,8 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Enum: - case EPropertyTypeNew::Choice: + case EPropertyType::Enum: + case EPropertyType::Choice: { QComboBox *pComboBox = static_cast(pEditor); CEnumProperty* pEnum = TPropCast(pProp); @@ -301,7 +301,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Asset: + case EPropertyType::Asset: { CResourceSelector *pSelector = static_cast(pEditor); CAssetProperty *pAsset = TPropCast(pProp); @@ -309,7 +309,7 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd break; } - case EPropertyTypeNew::Array: + case EPropertyType::Array: { WIntegralSpinBox *pSpinBox = static_cast(pEditor); @@ -331,10 +331,10 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd { pProp = mpModel->PropertyForIndex(rkIndex, true); - if (pProp->Type() == EPropertyTypeNew::AnimationSet) + if (pProp->Type() == EPropertyType::AnimationSet) SetCharacterEditorData(pEditor, rkIndex); - else if (pProp->Type() == EPropertyTypeNew::Flags) + else if (pProp->Type() == EPropertyType::Flags) { QCheckBox *pCheckBox = static_cast(pEditor); CFlagsProperty* pFlags = TPropCast(pProp); @@ -354,17 +354,17 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo if (!pEditor) return; IEditPropertyCommand* pCommand = nullptr; - IPropertyNew *pProp = mpModel->PropertyForIndex(rkIndex, true); + IProperty *pProp = mpModel->PropertyForIndex(rkIndex, true); void* pData = mpModel->DataPointerForIndex(rkIndex); if (pProp) { - EPropertyTypeNew Type = pProp->Type(); + EPropertyType Type = pProp->Type(); QVector Objects; Objects << mpModel->GetScriptObject(); - if (Type != EPropertyTypeNew::Array) + if (Type != EPropertyType::Array) { // TODO: support this for non script object properties pCommand = new CEditScriptPropertyCommand(pProp, mpEditor, Objects, rkIndex); @@ -373,10 +373,10 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo // Handle sub-properties of flags and animation sets if (rkIndex.internalId() & 0x80000000) { - if (pProp->Type() == EPropertyTypeNew::AnimationSet) + if (pProp->Type() == EPropertyType::AnimationSet) SetCharacterModelData(pEditor, rkIndex); - else if (pProp->Type() == EPropertyTypeNew::Flags) + else if (pProp->Type() == EPropertyType::Flags) { QCheckBox* pCheckBox = static_cast(pEditor); CFlagsProperty* pFlags = static_cast(pProp); @@ -394,7 +394,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo switch (pProp->Type()) { - case EPropertyTypeNew::Bool: + case EPropertyType::Bool: { QCheckBox *pCheckBox = static_cast(pEditor); CBoolProperty* pBool = static_cast(pProp); @@ -402,7 +402,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Short: + case EPropertyType::Short: { WIntegralSpinBox* pSpinBox = static_cast(pEditor); CShortProperty* pShort = static_cast(pProp); @@ -410,7 +410,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Int: + case EPropertyType::Int: { WIntegralSpinBox* pSpinBox = static_cast(pEditor); CIntProperty* pInt = static_cast(pProp); @@ -418,7 +418,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Sound: + case EPropertyType::Sound: { WIntegralSpinBox* pSpinBox = static_cast(pEditor); CSoundProperty* pSound = static_cast(pProp); @@ -426,7 +426,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Float: + case EPropertyType::Float: { WDraggableSpinBox* pSpinBox = static_cast(pEditor); CFloatProperty* pFloat = static_cast(pProp); @@ -434,7 +434,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Color: + case EPropertyType::Color: { WColorPicker* pColorPicker = static_cast(pEditor); CColorProperty* pColor = static_cast(pProp); @@ -444,7 +444,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::String: + case EPropertyType::String: { QLineEdit* pLineEdit = static_cast(pEditor); CStringProperty* pString = static_cast(pProp); @@ -452,8 +452,8 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Enum: - case EPropertyTypeNew::Choice: + case EPropertyType::Enum: + case EPropertyType::Choice: { QComboBox* pComboBox = static_cast(pEditor); CEnumProperty* pEnum = static_cast(pProp); @@ -461,7 +461,7 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo break; } - case EPropertyTypeNew::Asset: + case EPropertyType::Asset: { CResourceSelector* pSelector = static_cast(pEditor); CResourceEntry* pEntry = pSelector->Entry(); @@ -504,20 +504,20 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo // Check for edit in progress bool DataChanged = pCommand->IsNewDataDifferent(); - if (DataChanged && mInRelayWidgetEdit && (pEditor->hasFocus() || pProp->Type() == EPropertyTypeNew::Color)) + if (DataChanged && mInRelayWidgetEdit && (pEditor->hasFocus() || pProp->Type() == EPropertyType::Color)) mEditInProgress = true; bool EditWasInProgress = mEditInProgress; // Check for edit finished - if (!mInRelayWidgetEdit || (!pEditor->hasFocus() && pProp->Type() != EPropertyTypeNew::Color)) + if (!mInRelayWidgetEdit || (!pEditor->hasFocus() && pProp->Type() != EPropertyType::Color)) mEditInProgress = false; // Push undo command if (DataChanged || EditWasInProgress) { // Always consider the edit done for bool properties - pCommand->SetEditComplete(!mEditInProgress || pProp->Type() == EPropertyTypeNew::Bool); + pCommand->SetEditComplete(!mEditInProgress || pProp->Type() == EPropertyType::Bool); mpEditor->UndoStack()->push(pCommand); } @@ -549,10 +549,10 @@ QWidget* CPropertyDelegate::CreateCharacterEditor(QWidget *pParent, const QModel CAnimationParameters Params = pAnimSetProp->Value(mpModel->DataPointerForIndex(rkIndex)); // Determine property type - EPropertyTypeNew Type = DetermineCharacterPropType(Params.Version(), rkIndex); + EPropertyType Type = DetermineCharacterPropType(Params.Version(), rkIndex); // Create widget - if (Type == EPropertyTypeNew::Asset) + if (Type == EPropertyType::Asset) { CResourceSelector* pSelector = new CResourceSelector(pParent); pSelector->SetFrameVisible(false); @@ -566,7 +566,7 @@ QWidget* CPropertyDelegate::CreateCharacterEditor(QWidget *pParent, const QModel return pSelector; } - else if (Type == EPropertyTypeNew::Enum || Type == EPropertyTypeNew::Choice) + else if (Type == EPropertyType::Enum || Type == EPropertyType::Choice) { QComboBox* pComboBox = new QComboBox(pParent); CAnimSet* pAnimSet = Params.AnimSet(); @@ -581,7 +581,7 @@ QWidget* CPropertyDelegate::CreateCharacterEditor(QWidget *pParent, const QModel return pComboBox; } - else if (Type == EPropertyTypeNew::Int) + else if (Type == EPropertyType::Int) { WIntegralSpinBox *pSpinBox = new WIntegralSpinBox(pParent); CONNECT_RELAY(pSpinBox, rkIndex, valueChanged(int)); @@ -595,19 +595,19 @@ void CPropertyDelegate::SetCharacterEditorData(QWidget *pEditor, const QModelInd { CAnimationSetProperty* pAnimSetProp = TPropCast(mpModel->PropertyForIndex(rkIndex, true)); CAnimationParameters Params = pAnimSetProp->Value(mpModel->DataPointerForIndex(rkIndex)); - EPropertyTypeNew Type = DetermineCharacterPropType(Params.Version(), rkIndex); + EPropertyType Type = DetermineCharacterPropType(Params.Version(), rkIndex); - if (Type == EPropertyTypeNew::Asset) + if (Type == EPropertyType::Asset) { static_cast(pEditor)->SetResource(Params.AnimSet()); } - else if (Type == EPropertyTypeNew::Enum || Type == EPropertyTypeNew::Choice) + else if (Type == EPropertyType::Enum || Type == EPropertyType::Choice) { static_cast(pEditor)->setCurrentIndex(Params.CharacterIndex()); } - else if (Type == EPropertyTypeNew::Int && !pEditor->hasFocus()) + else if (Type == EPropertyType::Int && !pEditor->hasFocus()) { int UnkIndex = (Params.Version() <= eEchoes ? rkIndex.row() - 2 : rkIndex.row() - 1); u32 Value = Params.Unknown(UnkIndex); @@ -619,20 +619,20 @@ void CPropertyDelegate::SetCharacterModelData(QWidget *pEditor, const QModelInde { CAnimationSetProperty* pAnimSetProp = TPropCast(mpModel->PropertyForIndex(rkIndex, true)); CAnimationParameters Params = pAnimSetProp->Value(mpModel->DataPointerForIndex(rkIndex)); - EPropertyTypeNew Type = DetermineCharacterPropType(Params.Version(), rkIndex); + EPropertyType Type = DetermineCharacterPropType(Params.Version(), rkIndex); - if (Type == EPropertyTypeNew::Asset) + if (Type == EPropertyType::Asset) { CResourceEntry *pEntry = static_cast(pEditor)->Entry(); Params.SetResource( pEntry ? pEntry->ID() : CAssetID::InvalidID(mpEditor->CurrentGame()) ); } - else if (Type == EPropertyTypeNew::Enum || Type == EPropertyTypeNew::Choice) + else if (Type == EPropertyType::Enum || Type == EPropertyType::Choice) { Params.SetCharIndex( static_cast(pEditor)->currentIndex() ); } - else if (Type == EPropertyTypeNew::Int) + else if (Type == EPropertyType::Int) { int UnkIndex = (Params.Version() <= eEchoes ? rkIndex.row() - 2 : rkIndex.row() - 1); Params.SetUnknown(UnkIndex, static_cast(pEditor)->value() ); @@ -642,32 +642,32 @@ void CPropertyDelegate::SetCharacterModelData(QWidget *pEditor, const QModelInde // If we just updated the resource, make sure all the sub-properties of the character are flagged as changed. // We want to do this -after- updating the anim params on the property, which is why we have a second type check. - if (Type == EPropertyTypeNew::Asset) + if (Type == EPropertyType::Asset) { QModelIndex ParentIndex = rkIndex.parent(); mpModel->dataChanged(mpModel->index(1, 1, ParentIndex), mpModel->index(mpModel->rowCount(ParentIndex) - 1, 1, ParentIndex)); } } -EPropertyTypeNew CPropertyDelegate::DetermineCharacterPropType(EGame Game, const QModelIndex& rkIndex) const +EPropertyType CPropertyDelegate::DetermineCharacterPropType(EGame Game, const QModelIndex& rkIndex) const { if (Game <= eEchoes) { - if (rkIndex.row() == 0) return EPropertyTypeNew::Asset; - else if (rkIndex.row() == 1) return EPropertyTypeNew::Choice; - else if (rkIndex.row() == 2) return EPropertyTypeNew::Int; + if (rkIndex.row() == 0) return EPropertyType::Asset; + else if (rkIndex.row() == 1) return EPropertyType::Choice; + else if (rkIndex.row() == 2) return EPropertyType::Int; } else if (Game <= eCorruption) { - if (rkIndex.row() == 0) return EPropertyTypeNew::Asset; - else if (rkIndex.row() == 1) return EPropertyTypeNew::Int; + if (rkIndex.row() == 0) return EPropertyType::Asset; + else if (rkIndex.row() == 1) return EPropertyType::Int; } else { - if (rkIndex.row() == 0) return EPropertyTypeNew::Asset; - else if (rkIndex.row() <= 2) return EPropertyTypeNew::Int; + if (rkIndex.row() == 0) return EPropertyType::Asset; + else if (rkIndex.row() <= 2) return EPropertyType::Int; } - return EPropertyTypeNew::Invalid; + return EPropertyType::Invalid; } // ************ PUBLIC SLOTS ************ diff --git a/src/Editor/PropertyEdit/CPropertyModel.cpp b/src/Editor/PropertyEdit/CPropertyModel.cpp index 27a813bc..b7045ea1 100644 --- a/src/Editor/PropertyEdit/CPropertyModel.cpp +++ b/src/Editor/PropertyEdit/CPropertyModel.cpp @@ -16,7 +16,7 @@ CPropertyModel::CPropertyModel(QObject *pParent /*= 0*/) { } -int CPropertyModel::RecursiveBuildArrays(IPropertyNew* pProperty, int ParentID) +int CPropertyModel::RecursiveBuildArrays(IProperty* pProperty, int ParentID) { // Insert into an unused slot if one exists. Otherwise, append to the end of the array. int MyID = -1; @@ -38,7 +38,7 @@ int CPropertyModel::RecursiveBuildArrays(IPropertyNew* pProperty, int ParentID) int RowNumber = (ParentID >= 0 ? mProperties[ParentID].ChildIDs.size() : 0); mProperties[MyID].Index = createIndex(RowNumber, 0, MyID); - if (pProperty->Type() == EPropertyTypeNew::Array) + if (pProperty->Type() == EPropertyType::Array) { CArrayProperty* pArray = TPropCast(pProperty); u32 ArrayCount = pArray->ArrayCount(mpPropertyData); @@ -70,7 +70,7 @@ int CPropertyModel::RecursiveBuildArrays(IPropertyNew* pProperty, int ParentID) return MyID; } -void CPropertyModel::ConfigureIntrinsic(CGameProject* pProject, IPropertyNew* pRootProperty, void* pPropertyData) +void CPropertyModel::ConfigureIntrinsic(CGameProject* pProject, IProperty* pRootProperty, void* pPropertyData) { beginResetModel(); @@ -89,13 +89,13 @@ void CPropertyModel::ConfigureIntrinsic(CGameProject* pProject, IPropertyNew* pR endResetModel(); } -void CPropertyModel::ConfigureScript(CGameProject* pProject, IPropertyNew* pRootProperty, CScriptObject* pObject) +void CPropertyModel::ConfigureScript(CGameProject* pProject, IProperty* pRootProperty, CScriptObject* pObject) { ConfigureIntrinsic(pProject, pRootProperty, pObject ? pObject->PropertyData() : nullptr); mpObject = pObject; } -IPropertyNew* CPropertyModel::PropertyForIndex(const QModelIndex& rkIndex, bool HandleFlaggedIndices) const +IProperty* CPropertyModel::PropertyForIndex(const QModelIndex& rkIndex, bool HandleFlaggedIndices) const { if (!rkIndex.isValid()) return mpRootProperty; @@ -112,7 +112,7 @@ IPropertyNew* CPropertyModel::PropertyForIndex(const QModelIndex& rkIndex, bool return mProperties[Index].pProperty; } -QModelIndex CPropertyModel::IndexForProperty(IPropertyNew *pProp) const +QModelIndex CPropertyModel::IndexForProperty(IProperty *pProp) const { // Array archetype properties cannot be associated with a single index because the same IProperty // is used for every element of the array. So instead fetch the index for the array itself. @@ -121,7 +121,7 @@ QModelIndex CPropertyModel::IndexForProperty(IPropertyNew *pProp) const while (pProp && pProp->IsArrayArchetype()) pProp = pProp->Parent(); - ASSERT(pProp != nullptr && pProp->Type() == EPropertyTypeNew::Array); + ASSERT(pProp != nullptr && pProp->Type() == EPropertyType::Array); } if (pProp == mpRootProperty) return QModelIndex(); @@ -146,7 +146,7 @@ void* CPropertyModel::DataPointerForIndex(const QModelIndex& rkIndex) const int ArrayIndices[2]; int MaxIndex = -1; - IPropertyNew* pProperty = mProperties[ID].pProperty; + IProperty* pProperty = mProperties[ID].pProperty; while (pProperty->IsArrayArchetype()) { @@ -188,15 +188,15 @@ int CPropertyModel::rowCount(const QModelIndex& rkParent) const if (rkParent.column() != 0) return 0; if (rkParent.internalId() & 0x80000000) return 0; - IPropertyNew *pProp = PropertyForIndex(rkParent, false); + IProperty *pProp = PropertyForIndex(rkParent, false); int ID = rkParent.internalId(); switch (pProp->Type()) { - case EPropertyTypeNew::Flags: + case EPropertyType::Flags: return TPropCast(pProp)->NumFlags(); - case EPropertyTypeNew::AnimationSet: + case EPropertyType::AnimationSet: { void* pData = DataPointerForIndex(rkParent); CAnimationParameters Params = TPropCast(pProp)->Value(pData); @@ -230,10 +230,10 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const { if (rkIndex.internalId() & 0x80000000) { - IPropertyNew *pProp = PropertyForIndex(rkIndex, true); - EPropertyTypeNew Type = pProp->Type(); + IProperty *pProp = PropertyForIndex(rkIndex, true); + EPropertyType Type = pProp->Type(); - if (Type == EPropertyTypeNew::Flags) + if (Type == EPropertyType::Flags) { CFlagsProperty* pFlags = TPropCast(pProp); @@ -249,7 +249,7 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const } } - else if (Type == EPropertyTypeNew::AnimationSet) + else if (Type == EPropertyType::AnimationSet) { void* pData = DataPointerForIndex(rkIndex); CAnimationSetProperty* pAnimSet = TPropCast(pProp); @@ -300,14 +300,14 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const else { - IPropertyNew *pProp = PropertyForIndex(rkIndex, false); + IProperty *pProp = PropertyForIndex(rkIndex, false); if (rkIndex.column() == 0) { // Check for arrays - IPropertyNew *pParent = pProp->Parent(); + IProperty *pParent = pProp->Parent(); - if (pParent && pParent->Type() == EPropertyTypeNew::Array) + if (pParent && pParent->Type() == EPropertyType::Array) { // For direct array sub-properties, display the element index after the name TString ElementName = pProp->Name(); @@ -325,14 +325,14 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const switch (pProp->Type()) { // Enclose vector property text in parentheses - case EPropertyTypeNew::Vector: + case EPropertyType::Vector: { CVector3f Value = TPropCast(pProp)->Value(pData); return TO_QSTRING("(" + Value.ToString() + ")"); } // Display the AGSC/sound name for sounds - case EPropertyTypeNew::Sound: + case EPropertyType::Sound: { CSoundProperty* pSound = TPropCast(pProp); u32 SoundID = pSound->Value(pData); @@ -358,12 +358,12 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const } // Display character name for characters - case EPropertyTypeNew::AnimationSet: + case EPropertyType::AnimationSet: return TO_QSTRING(TPropCast(pProp)->Value(pData).GetCurrentCharacterName()); // Display enumerator name for enums (but only on ToolTipRole) - case EPropertyTypeNew::Choice: - case EPropertyTypeNew::Enum: + case EPropertyType::Choice: + case EPropertyType::Enum: if (Role == Qt::ToolTipRole) { CEnumProperty *pEnum = TPropCast(pProp); @@ -374,20 +374,20 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const else return ""; // Display the element count for arrays - case EPropertyTypeNew::Array: + case EPropertyType::Array: { u32 Count = TPropCast(pProp)->Value(pData); return QString("%1 element%2").arg(Count).arg(Count != 1 ? "s" : ""); } // Display "[spline]" for splines (todo: proper support) - case EPropertyTypeNew::Spline: + case EPropertyType::Spline: return "[spline]"; // No display text on properties with persistent editors - case EPropertyTypeNew::Bool: - case EPropertyTypeNew::Asset: - case EPropertyTypeNew::Color: + case EPropertyType::Bool: + case EPropertyType::Asset: + case EPropertyType::Color: if (Role == Qt::DisplayRole) return ""; // fall through @@ -404,13 +404,13 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const if (!(rkIndex.internalId() & 0x80000000)) { // Add name - IPropertyNew *pProp = PropertyForIndex(rkIndex, false); + IProperty *pProp = PropertyForIndex(rkIndex, false); QString DisplayText = data(rkIndex, Qt::DisplayRole).toString(); QString TypeName = pProp->HashableTypeName(); QString Text = QString("%1 (%2)").arg(DisplayText).arg(TypeName); // Add uncooked notification - if (pProp->CookPreference() == ECookPreferenceNew::Never) + if (pProp->CookPreference() == ECookPreference::Never) { Text.prepend("[uncooked]"); } @@ -420,7 +420,7 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const if (!Desc.IsEmpty()) Text += "
" + TO_QSTRING(Desc); // Spline notification - if (pProp->Type() == EPropertyTypeNew::Spline) + if (pProp->Type() == EPropertyType::Spline) Text += "
(NOTE: Spline properties are currently unsupported for editing)"; return Text; @@ -434,7 +434,7 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const if (mBoldModifiedProperties) { - IPropertyNew *pProp = PropertyForIndex(rkIndex, true); + IProperty *pProp = PropertyForIndex(rkIndex, true); if (!pProp->IsArrayArchetype()) { @@ -455,7 +455,7 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const { if (mShowNameValidity && mpRootProperty->ScriptTemplate()->Game() >= eEchoesDemo) { - IPropertyNew *pProp = PropertyForIndex(rkIndex, true); + IProperty *pProp = PropertyForIndex(rkIndex, true); // Don't highlight the name of the root property if (pProp && pProp->Parent() != nullptr) @@ -477,11 +477,11 @@ QModelIndex CPropertyModel::index(int Row, int Column, const QModelIndex& rkPare return QModelIndex(); // Check property for children - IPropertyNew* pParent = (rkParent.isValid() ? PropertyForIndex(rkParent, false) : mpRootProperty); - EPropertyTypeNew ParentType = pParent->Type(); + IProperty* pParent = (rkParent.isValid() ? PropertyForIndex(rkParent, false) : mpRootProperty); + EPropertyType ParentType = pParent->Type(); int ParentID = rkParent.internalId(); - if (ParentType == EPropertyTypeNew::Flags || ParentType == EPropertyTypeNew::AnimationSet) + if (ParentType == EPropertyType::Flags || ParentType == EPropertyType::AnimationSet) { return createIndex(Row, Column, ParentID | 0x80000000); } @@ -517,7 +517,7 @@ Qt::ItemFlags CPropertyModel::flags(const QModelIndex& rkIndex) const else return (Qt::ItemIsEnabled | Qt::ItemIsEditable); } -void CPropertyModel::NotifyPropertyModified(class CScriptObject*, IPropertyNew* pProp) +void CPropertyModel::NotifyPropertyModified(class CScriptObject*, IProperty* pProp) { NotifyPropertyModified(IndexForProperty(pProp)); } @@ -545,7 +545,7 @@ void CPropertyModel::NotifyPropertyModified(const QModelIndex& rkIndex) void CPropertyModel::ArrayAboutToBeResized(const QModelIndex& rkIndex, u32 NewSize) { QModelIndex Index = rkIndex.sibling(rkIndex.row(), 0); - IPropertyNew* pProperty = PropertyForIndex(Index, false); + IProperty* pProperty = PropertyForIndex(Index, false); CArrayProperty* pArray = TPropCast(pProperty); ASSERT(pArray); @@ -564,7 +564,7 @@ void CPropertyModel::ArrayAboutToBeResized(const QModelIndex& rkIndex, u32 NewSi void CPropertyModel::ArrayResized(const QModelIndex& rkIndex, u32 OldSize) { QModelIndex Index = rkIndex.sibling(rkIndex.row(), 0); - IPropertyNew* pProperty = PropertyForIndex(Index, false); + IProperty* pProperty = PropertyForIndex(Index, false); CArrayProperty* pArray = TPropCast(pProperty); ASSERT(pArray); diff --git a/src/Editor/PropertyEdit/CPropertyView.cpp b/src/Editor/PropertyEdit/CPropertyView.cpp index 5bec05da..dae5e976 100644 --- a/src/Editor/PropertyEdit/CPropertyView.cpp +++ b/src/Editor/PropertyEdit/CPropertyView.cpp @@ -81,7 +81,7 @@ void CPropertyView::SetEditor(CWorldEditor *pEditor) { mpEditor = pEditor; mpDelegate->SetEditor(pEditor); - connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IPropertyNew*)), mpModel, SLOT(NotifyPropertyModified(CScriptObject*,IPropertyNew*))); + connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IProperty*)), mpModel, SLOT(NotifyPropertyModified(CScriptObject*,IProperty*))); } void CPropertyView::SetProperties(CStructRef InProperties) @@ -106,7 +106,7 @@ void CPropertyView::SetInstance(CScriptObject *pObj) // Auto-expand EditorProperties QModelIndex Index = mpModel->index(0, 0, QModelIndex()); - IPropertyNew *pProp = mpModel->PropertyForIndex(Index, false); + IProperty *pProp = mpModel->PropertyForIndex(Index, false); if (pProp && pProp->ID() == 0x255A4580) expand(Index); } @@ -121,14 +121,14 @@ void CPropertyView::UpdateEditorProperties(const QModelIndex& rkParent) { QModelIndex Index0 = mpModel->index(iRow, 0, rkParent); QModelIndex Index1 = mpModel->index(iRow, 1, rkParent); - IPropertyNew *pProp = mpModel->PropertyForIndex(Index0, false); + IProperty *pProp = mpModel->PropertyForIndex(Index0, false); if (pProp) { // For structs, update sub-properties. - if (pProp->Type() == EPropertyTypeNew::Struct) + if (pProp->Type() == EPropertyType::Struct) { - CStructPropertyNew *pStruct = TPropCast(pProp); + CStructProperty *pStruct = TPropCast(pProp); // As an optimization, in MP2+, we don't need to update unless this is an atomic struct or if // it's EditorProperties, because other structs never have editor properties in them. @@ -161,35 +161,35 @@ void CPropertyView::SetPersistentEditors(const QModelIndex& rkParent) for (u32 iChild = 0; iChild < NumChildren; iChild++) { QModelIndex ChildIndex = mpModel->index(iChild, 1, rkParent); - IPropertyNew *pProp = mpModel->PropertyForIndex(ChildIndex, false); - EPropertyTypeNew Type = (pProp ? pProp->Type() : EPropertyTypeNew::Invalid); + IProperty *pProp = mpModel->PropertyForIndex(ChildIndex, false); + EPropertyType Type = (pProp ? pProp->Type() : EPropertyType::Invalid); // Handle persistent editors under character properties if (!pProp && ChildIndex.internalId() & 0x80000000) { pProp = mpModel->PropertyForIndex(ChildIndex, true); - if (pProp->Type() == EPropertyTypeNew::AnimationSet) + if (pProp->Type() == EPropertyType::AnimationSet) { EGame Game = mpObject->Area()->Game(); Type = mpDelegate->DetermineCharacterPropType(Game, ChildIndex); } - if (pProp->Type() == EPropertyTypeNew::Flags) - Type = EPropertyTypeNew::Bool; + if (pProp->Type() == EPropertyType::Flags) + Type = EPropertyType::Bool; } switch (Type) { - case EPropertyTypeNew::Bool: - case EPropertyTypeNew::Enum: - case EPropertyTypeNew::Choice: - case EPropertyTypeNew::Color: - case EPropertyTypeNew::Asset: + case EPropertyType::Bool: + case EPropertyType::Enum: + case EPropertyType::Choice: + case EPropertyType::Color: + case EPropertyType::Asset: openPersistentEditor(ChildIndex); break; - case EPropertyTypeNew::Struct: + case EPropertyType::Struct: setFirstColumnSpanned(iChild, rkParent, true); break; } @@ -216,9 +216,9 @@ void CPropertyView::ClosePersistentEditors(const QModelIndex& rkIndex) void CPropertyView::OnPropertyModified(const QModelIndex& rkIndex) { // Check for a character resource being changed. If that's the case we need to remake the persistent editors. - IPropertyNew *pProp = mpModel->PropertyForIndex(rkIndex, true); + IProperty *pProp = mpModel->PropertyForIndex(rkIndex, true); - if (pProp->Type() == EPropertyTypeNew::AnimationSet /*&& rkIndex.internalId() & 0x1*/) + if (pProp->Type() == EPropertyType::AnimationSet /*&& rkIndex.internalId() & 0x1*/) { ClosePersistentEditors(rkIndex); SetPersistentEditors(rkIndex); @@ -231,7 +231,7 @@ void CPropertyView::CreateContextMenu(const QPoint& rkPos) if (Index.isValid() && Index.column() == 0) { - IPropertyNew *pProp = mpModel->PropertyForIndex(Index, true); + IProperty *pProp = mpModel->PropertyForIndex(Index, true); mpMenuProperty = pProp; QMenu Menu; diff --git a/src/Editor/WorldEditor/CInstancesModel.cpp b/src/Editor/WorldEditor/CInstancesModel.cpp index d4b4e8a4..10bbb71f 100644 --- a/src/Editor/WorldEditor/CInstancesModel.cpp +++ b/src/Editor/WorldEditor/CInstancesModel.cpp @@ -31,7 +31,7 @@ CInstancesModel::CInstancesModel(CWorldEditor *pEditor, QObject *pParent) , mpEditor(pEditor) , mpScene(pEditor->Scene()) , mpArea(nullptr) - , mpCurrentMaster(nullptr) + , mpCurrentGame(nullptr) , mModelType(eLayers) , mShowColumnEnabled(true) , mChangingLayout(false) @@ -366,10 +366,10 @@ void CInstancesModel::OnActiveProjectChanged(CGameProject *pProj) if (pProj) { EGame ProjGame = pProj->Game(); - mpCurrentMaster = CMasterTemplate::MasterForGame(ProjGame); + mpCurrentGame = CGameTemplate::GetGameTemplate(ProjGame); } else - mpCurrentMaster = nullptr; + mpCurrentGame = nullptr; GenerateList(); } @@ -570,13 +570,13 @@ void CInstancesModel::GenerateList() mTemplateList.clear(); - if (mpCurrentMaster) + if (mpCurrentGame) { - u32 NumTemplates = mpCurrentMaster->NumScriptTemplates(); + u32 NumTemplates = mpCurrentGame->NumScriptTemplates(); for (u32 iTemp = 0; iTemp < NumTemplates; iTemp++) { - CScriptTemplate *pTemp = mpCurrentMaster->TemplateByIndex(iTemp); + CScriptTemplate *pTemp = mpCurrentGame->TemplateByIndex(iTemp); if (pTemp->NumObjects() > 0) mTemplateList << pTemp; diff --git a/src/Editor/WorldEditor/CInstancesModel.h b/src/Editor/WorldEditor/CInstancesModel.h index 270143cf..6fdd7fc5 100644 --- a/src/Editor/WorldEditor/CInstancesModel.h +++ b/src/Editor/WorldEditor/CInstancesModel.h @@ -2,7 +2,7 @@ #define CTYPESINSTANCEMODEL_H #include "CWorldEditor.h" -#include +#include #include #include @@ -35,7 +35,7 @@ private: CWorldEditor *mpEditor; CScene *mpScene; CGameArea *mpArea; - CMasterTemplate *mpCurrentMaster; + CGameTemplate *mpCurrentGame; EInstanceModelType mModelType; QList mTemplateList; QStringList mBaseItems; diff --git a/src/Editor/WorldEditor/CLinkDialog.cpp b/src/Editor/WorldEditor/CLinkDialog.cpp index b91d3d17..fff95781 100644 --- a/src/Editor/WorldEditor/CLinkDialog.cpp +++ b/src/Editor/WorldEditor/CLinkDialog.cpp @@ -10,7 +10,7 @@ CLinkDialog::CLinkDialog(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) : QDialog(pParent) , ui(new Ui::CLinkDialog) , mpEditor(pEditor) - , mpMaster(nullptr) + , mpGame(nullptr) , mpSender(nullptr) , mpReceiver(nullptr) , mSenderStateModel(CStateMessageModel::eStates, this) @@ -77,13 +77,13 @@ void CLinkDialog::EditLink(CLink *pLink) ui->ReceiverMessageComboBox->setCurrentIndex(mReceiverMessageModel.MessageIndex(pLink->Message())); } -void CLinkDialog::SetMaster(CMasterTemplate *pMaster) +void CLinkDialog::SetGame(CGameTemplate *pGame) { - if (mpMaster != pMaster) + if (mpGame != pGame) { - mpMaster = pMaster; - mSenderStateModel.SetMasterTemplate(pMaster); - mReceiverMessageModel.SetMasterTemplate(pMaster); + mpGame = pGame; + mSenderStateModel.SetGameTemplate(pGame); + mReceiverMessageModel.SetGameTemplate(pGame); } } diff --git a/src/Editor/WorldEditor/CLinkDialog.h b/src/Editor/WorldEditor/CLinkDialog.h index c3b57e59..c6f12a40 100644 --- a/src/Editor/WorldEditor/CLinkDialog.h +++ b/src/Editor/WorldEditor/CLinkDialog.h @@ -12,7 +12,7 @@ class CLinkDialog : public QDialog Q_OBJECT CWorldEditor *mpEditor; - CMasterTemplate *mpMaster; + CGameTemplate *mpGame; CScriptObject *mpSender; CScriptObject *mpReceiver; CLink *mpEditLink; @@ -34,7 +34,7 @@ public: void NewLink(CScriptObject *pSender, CScriptObject *pReceiver); void EditLink(CLink *pLink); - void SetMaster(CMasterTemplate *pMaster); + void SetGame(CGameTemplate *pGame); void SetSender(CScriptObject *pSender); void SetReceiver(CScriptObject *pReceiver); u32 State() const; diff --git a/src/Editor/WorldEditor/CLinkModel.cpp b/src/Editor/WorldEditor/CLinkModel.cpp index b118f459..2774e263 100644 --- a/src/Editor/WorldEditor/CLinkModel.cpp +++ b/src/Editor/WorldEditor/CLinkModel.cpp @@ -1,7 +1,7 @@ #include "CLinkModel.h" #include "Editor/UICommon.h" #include -#include +#include CLinkModel::CLinkModel(QObject *pParent) : QAbstractTableModel(pParent) @@ -67,13 +67,13 @@ QVariant CLinkModel::data(const QModelIndex& rkIndex, int Role) const case 1: // Column 1 - State { - TString StateName = mpObject->MasterTemplate()->StateByID(pLink->State()).Name; + TString StateName = mpObject->GameTemplate()->StateByID(pLink->State()).Name; return UICommon::ToQString(StateName); } case 2: // Column 2 - Message { - TString MessageName = mpObject->MasterTemplate()->MessageByID(pLink->Message()).Name; + TString MessageName = mpObject->GameTemplate()->MessageByID(pLink->Message()).Name; return UICommon::ToQString(MessageName); } diff --git a/src/Editor/WorldEditor/CPoiMapSidebar.cpp b/src/Editor/WorldEditor/CPoiMapSidebar.cpp index 5a75d6f9..d4651442 100644 --- a/src/Editor/WorldEditor/CPoiMapSidebar.cpp +++ b/src/Editor/WorldEditor/CPoiMapSidebar.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include @@ -339,7 +339,7 @@ void CPoiMapSidebar::StopPicking() void CPoiMapSidebar::OnInstanceListButtonClicked() { EGame Game = Editor()->CurrentGame(); - CScriptTemplate *pPoiTemplate = CMasterTemplate::MasterForGame(Game)->TemplateByID("POIN"); + CScriptTemplate *pPoiTemplate = CGameTemplate::GetGameTemplate(Game)->TemplateByID("POIN"); CPoiListDialog Dialog(pPoiTemplate, &mSourceModel, Editor()->Scene(), this); Dialog.exec(); diff --git a/src/Editor/WorldEditor/CStateMessageModel.h b/src/Editor/WorldEditor/CStateMessageModel.h index 0b95a115..9017a64d 100644 --- a/src/Editor/WorldEditor/CStateMessageModel.h +++ b/src/Editor/WorldEditor/CStateMessageModel.h @@ -2,11 +2,11 @@ #define CSTATEMESSAGEMODEL_H #include "Editor/UICommon.h" -#include +#include #include #include -// todo: support pulling states/messages from script templates instead of master +// todo: support pulling states/messages from script templates instead of game class CStateMessageModel : public QAbstractListModel { Q_OBJECT @@ -35,7 +35,7 @@ private: }; QList mEntries; - CMasterTemplate *mpMaster; + CGameTemplate *mpGame; CScriptTemplate *mpScript; EType mType; @@ -43,7 +43,7 @@ public: explicit CStateMessageModel(EType Type, QObject *pParent = 0) : QAbstractListModel(pParent) , mType(Type) - , mpMaster(nullptr) + , mpGame(nullptr) , mpScript(nullptr) {} @@ -62,27 +62,27 @@ public: else return QVariant::Invalid; } - void SetMasterTemplate(CMasterTemplate *pMaster) + void SetGameTemplate(CGameTemplate *pGame) { beginResetModel(); - mpMaster = pMaster; + mpGame = pGame; mEntries.clear(); if (mType == eStates) { - for (u32 iState = 0; iState < pMaster->NumStates(); iState++) + for (u32 iState = 0; iState < pGame->NumStates(); iState++) { - SState State = pMaster->StateByIndex(iState); + SState State = pGame->StateByIndex(iState); mEntries << SEntry(State.ID, TO_QSTRING(State.Name)); } } else { - for (u32 iMsg = 0; iMsg < pMaster->NumMessages(); iMsg++) + for (u32 iMsg = 0; iMsg < pGame->NumMessages(); iMsg++) { - SMessage Message = pMaster->MessageByIndex(iMsg); + SMessage Message = pGame->MessageByIndex(iMsg); mEntries << SEntry(Message.ID, TO_QSTRING(Message.Name)); } } diff --git a/src/Editor/WorldEditor/CTemplateEditDialog.cpp b/src/Editor/WorldEditor/CTemplateEditDialog.cpp index d2faee61..554dac80 100644 --- a/src/Editor/WorldEditor/CTemplateEditDialog.cpp +++ b/src/Editor/WorldEditor/CTemplateEditDialog.cpp @@ -2,9 +2,8 @@ #include "ui_CTemplateEditDialog.h" #include "Editor/UICommon.h" -#include #include -#include +#include CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent) : QDialog(pParent) @@ -35,7 +34,7 @@ CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent) { CTemplateLoader::LoadAllGames(); std::vector TemplateList; - CMasterTemplate::XMLsUsingID(pProperty->ID(), TemplateList); + CGameTemplate::XMLsUsingID(pProperty->ID(), TemplateList); for (u32 iTemp = 0; iTemp < TemplateList.size(); iTemp++) mpUI->TemplatesListWidget->addItem(TO_QSTRING(TemplateList[iTemp])); @@ -90,10 +89,10 @@ void CTemplateEditDialog::ApplyChanges() // Rename properties if (RenameAll && (mGame >= eEchoesDemo || mpProperty->Archetype() != nullptr)) { - CMasterTemplate::RenameProperty(mpProperty, NewName); + CGameTemplate::RenameProperty(mpProperty, NewName); // Add modified templates to pending resave list - const std::vector *pList = CMasterTemplate::TemplatesWithMatchingID(mpProperty); + const std::vector *pList = CGameTemplate::TemplatesWithMatchingID(mpProperty); if (pList) { @@ -102,7 +101,7 @@ void CTemplateEditDialog::ApplyChanges() } } - mpProperty->SetName(NewName); // If mpTemplate has an overridden name then CMasterTemplate::RenameProperty won't touch it + mpProperty->SetName(NewName); // If mpTemplate has an overridden name then CGameTemplate::RenameProperty won't touch it if (RenameAll && mGame >= eEchoesDemo) NeedsListResave = true; @@ -179,7 +178,7 @@ void CTemplateEditDialog::UpdateDescription(const TString& rkNewDesc) if (!SourceFile.IsEmpty()) { - const std::vector* pkTemplates = CMasterTemplate::TemplatesWithMatchingID(mpProperty); + const std::vector* pkTemplates = CGameTemplate::TemplatesWithMatchingID(mpProperty); if (pkTemplates) { @@ -230,16 +229,16 @@ void CTemplateEditDialog::FindEquivalentProperties(IProperty *pTemp) } } - QList MasterList = QList::fromStdList(CMasterTemplate::MasterList()); + QList GameList = QList::fromStdList(CGameTemplate::GameList()); if (Source.IsEmpty()) { u32 ObjectID = pScript->ObjectID(); - foreach (CMasterTemplate *pMaster, MasterList) + foreach (CGameTemplate *pGame, GameList) { - if (pMaster == pTemp->MasterTemplate() || pMaster->Game() <= ePrime) continue; - CScriptTemplate *pNewScript = pMaster->TemplateByID(ObjectID); + if (pGame == pTemp->GameTemplate() || pGame->Game() <= ePrime) continue; + CScriptTemplate *pNewScript = pGame->TemplateByID(ObjectID); if (pNewScript) { @@ -253,10 +252,10 @@ void CTemplateEditDialog::FindEquivalentProperties(IProperty *pTemp) else { - foreach (CMasterTemplate *pMaster, MasterList) + foreach (CGameTemplate *pGame, GameList) { - if (pMaster == pTemp->MasterTemplate() || pMaster->Game() <= ePrime) continue; - CStructTemplate *pStruct = pMaster->StructAtSource(Source); + if (pGame == pTemp->GameTemplate() || pGame->Game() <= ePrime) continue; + CStructTemplate *pStruct = pGame->StructAtSource(Source); if (pStruct) { diff --git a/src/Editor/WorldEditor/CTemplateEditDialog.h b/src/Editor/WorldEditor/CTemplateEditDialog.h index 99b10af1..b7eb495c 100644 --- a/src/Editor/WorldEditor/CTemplateEditDialog.h +++ b/src/Editor/WorldEditor/CTemplateEditDialog.h @@ -3,7 +3,7 @@ #include "Editor/CPropertyNameValidator.h" #include -#include +#include #include namespace Ui { @@ -16,7 +16,7 @@ class CTemplateEditDialog : public QDialog Ui::CTemplateEditDialog* mpUI; CPropertyNameValidator* mpValidator; - IPropertyNew *mpProperty; + IProperty *mpProperty; EGame mGame; TString mOriginalName; @@ -25,20 +25,20 @@ class CTemplateEditDialog : public QDialog // These members help track what templates need to be updated and resaved after the user clicks OK QVector mScriptTemplatesToResave; - QVector mStructTemplatesToResave; - QVector mEquivalentProperties; + QVector mStructTemplatesToResave; + QVector mEquivalentProperties; public: - CTemplateEditDialog(IPropertyNew* pProperty, QWidget *pParent = 0); + CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = 0); ~CTemplateEditDialog(); public slots: void ApplyChanges(); protected: - void AddTemplate(IPropertyNew* pProperty); + void AddTemplate(IProperty* pProperty); void UpdateDescription(const TString& rkNewDesc); - void FindEquivalentProperties(IPropertyNew *pTemp); + void FindEquivalentProperties(IProperty *pTemp); }; #endif // CTEMPLATEEDITDIALOG_H diff --git a/src/Editor/WorldEditor/CTemplateListView.h b/src/Editor/WorldEditor/CTemplateListView.h index c6461ea8..fce239f3 100644 --- a/src/Editor/WorldEditor/CTemplateListView.h +++ b/src/Editor/WorldEditor/CTemplateListView.h @@ -3,7 +3,7 @@ #include "CTemplateMimeData.h" #include "Editor/UICommon.h" -#include +#include #include #include #include @@ -11,7 +11,7 @@ class CTemplateListModel : public QAbstractListModel { Q_OBJECT - CMasterTemplate *mpMaster; + CGameTemplate *mpGame; QList mTemplates; public: @@ -55,17 +55,17 @@ public: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled; } - void SetMaster(CMasterTemplate *pMaster) + void SetGame(CGameTemplate *pGame) { beginResetModel(); - mpMaster = pMaster; + mpGame = pGame; mTemplates.clear(); - if (mpMaster) + if (mpGame) { - for (u32 iTemp = 0; iTemp < mpMaster->NumScriptTemplates(); iTemp++) - mTemplates << mpMaster->TemplateByIndex(iTemp); + for (u32 iTemp = 0; iTemp < mpGame->NumScriptTemplates(); iTemp++) + mTemplates << mpGame->TemplateByIndex(iTemp); qSort(mTemplates.begin(), mTemplates.end(), [](CScriptTemplate *pLeft, CScriptTemplate *pRight) -> bool { return pLeft->Name() < pRight->Name(); @@ -103,9 +103,9 @@ public: QListView::setModel(mpModel); } - inline void SetMaster(CMasterTemplate *pMaster) + inline void SetGame(CGameTemplate *pGame) { - if (mpModel) mpModel->SetMaster(pMaster); + if (mpModel) mpModel->SetGame(pGame); } protected: diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index 13439ab7..1befc8cb 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -282,8 +282,8 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex) // Update UI stuff UpdateWindowTitle(); - CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(mpArea->Game()); - mpLinkDialog->SetMaster(pMaster); + CGameTemplate *pGame = CGameTemplate::GetGameTemplate(mpArea->Game()); + mpLinkDialog->SetGame(pGame); QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex)); diff --git a/src/Editor/WorldEditor/WCreateTab.cpp b/src/Editor/WorldEditor/WCreateTab.cpp index 97d962de..6de39785 100644 --- a/src/Editor/WorldEditor/WCreateTab.cpp +++ b/src/Editor/WorldEditor/WCreateTab.cpp @@ -61,8 +61,8 @@ bool WCreateTab::eventFilter(QObject *pObj, QEvent *pEvent) void WCreateTab::OnActiveProjectChanged(CGameProject *pProj) { EGame Game = (pProj ? pProj->Game() : eUnknownGame); - CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game); - ui->TemplateView->SetMaster(pMaster); + CGameTemplate *pGame = CGameTemplate::GetGameTemplate(Game); + ui->TemplateView->SetGame(pGame); } void WCreateTab::OnLayersChanged() diff --git a/src/Editor/WorldEditor/WCreateTab.h b/src/Editor/WorldEditor/WCreateTab.h index 4e0b05a7..2c9cb4b8 100644 --- a/src/Editor/WorldEditor/WCreateTab.h +++ b/src/Editor/WorldEditor/WCreateTab.h @@ -2,7 +2,7 @@ #define WCREATETAB_H #include "CWorldEditor.h" -#include +#include #include namespace Ui { diff --git a/src/Editor/WorldEditor/WInstancesTab.cpp b/src/Editor/WorldEditor/WInstancesTab.cpp index 47ffda04..95087d1c 100644 --- a/src/Editor/WorldEditor/WInstancesTab.cpp +++ b/src/Editor/WorldEditor/WInstancesTab.cpp @@ -299,11 +299,11 @@ void WInstancesTab::OnHideAllExceptTypeAction() else { EGame Game = mpEditor->CurrentGame(); - CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game); + CGameTemplate *pGame = CGameTemplate::GetGameTemplate(Game); - for (u32 iTemp = 0; iTemp < pMaster->NumScriptTemplates(); iTemp++) + for (u32 iTemp = 0; iTemp < pGame->NumScriptTemplates(); iTemp++) { - CScriptTemplate *pTemplate = pMaster->TemplateByIndex(iTemp); + CScriptTemplate *pTemplate = pGame->TemplateByIndex(iTemp); pTemplate->SetVisible( pTemplate == mpMenuTemplate ? true : false ); } @@ -330,10 +330,10 @@ void WInstancesTab::OnUnhideAllTypes() else { EGame Game = mpEditor->CurrentGame(); - CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game); + CGameTemplate *pGame = CGameTemplate::GetGameTemplate(Game); - for (u32 iTemp = 0; iTemp < pMaster->NumScriptTemplates(); iTemp++) - pMaster->TemplateByIndex(iTemp)->SetVisible(true); + for (u32 iTemp = 0; iTemp < pGame->NumScriptTemplates(); iTemp++) + pGame->TemplateByIndex(iTemp)->SetVisible(true); mpTypesModel->dataChanged( mpTypesModel->index(0, 2, TypeParent), mpTypesModel->index(mpTypesModel->rowCount(TypeParent) - 1, 2, TypeParent) ); } @@ -364,10 +364,10 @@ void WInstancesTab::OnUnhideAll() if (TypesRoot.isValid()) { EGame Game = mpEditor->CurrentGame(); - CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game); + CGameTemplate *pGame = CGameTemplate::GetGameTemplate(Game); - for (u32 iTemp = 0; iTemp < pMaster->NumScriptTemplates(); iTemp++) - pMaster->TemplateByIndex(iTemp)->SetVisible(true); + for (u32 iTemp = 0; iTemp < pGame->NumScriptTemplates(); iTemp++) + pGame->TemplateByIndex(iTemp)->SetVisible(true); mpTypesModel->dataChanged( mpTypesModel->index(0, 2, TypesRoot), mpTypesModel->index(mpTypesModel->rowCount(TypesRoot) - 1, 2, TypesRoot) ); }