Updated to Script Template V4

This commit is contained in:
parax0 2016-01-02 10:24:40 -07:00
parent 1c80970a04
commit 78400b7072
1501 changed files with 100753 additions and 115119 deletions

View File

@ -58,8 +58,9 @@ public:
}
TBasicString(const CharType* pkText)
: mInternalString(pkText)
{
if (pkText)
mInternalString = pkText;
}
TBasicString(const CharType* pkText, u32 length)
@ -731,6 +732,20 @@ public:
return sstream.str();
}
static TBasicString<CharType> FromFloat(float value, int MinDecimals = 1)
{
TString Out = std::to_string(value);
int NumZeroes = Out.Size() - (Out.IndexOf(".") + 1);
while (Out.Back() == '\0' && NumZeroes > MinDecimals)
{
Out = Out.ChopBack(1);
NumZeroes--;
}
return Out;
}
static TBasicString<CharType> HexString(unsigned char num, bool addPrefix = true, bool uppercase = false, int width = 0)
{
return HexString((unsigned long) num, addPrefix, uppercase, width);

View File

@ -10,6 +10,4 @@ typedef signed short s16;
typedef signed long s32;
typedef signed long long s64;
#endif // TYPES_H

View File

@ -29,9 +29,11 @@ bool CAreaAttributes::IsSkyEnabled()
switch (mGame)
{
case ePrime:
case eEchoesDemo:
case eEchoes:
case eCorruptionProto:
case eCorruption:
return static_cast<CBoolProperty*>(pBaseStruct->PropertyByIndex(1))->Get();
return static_cast<TBoolProperty*>(pBaseStruct->PropertyByIndex(1))->Get();
default:
return false;
}
@ -44,10 +46,12 @@ CModel* CAreaAttributes::SkyModel()
switch (mGame)
{
case ePrime:
case eEchoesDemo:
case eEchoes:
return (CModel*) static_cast<CFileProperty*>(pBaseStruct->PropertyByIndex(7))->Get().RawPointer();
return (CModel*) static_cast<TFileProperty*>(pBaseStruct->PropertyByID(0xD208C9FA))->Get().RawPointer();
case eCorruptionProto:
case eCorruption:
return (CModel*) static_cast<CFileProperty*>(pBaseStruct->PropertyByIndex(8))->Get().RawPointer();
return (CModel*) static_cast<TFileProperty*>(pBaseStruct->PropertyByIndex(8))->Get().RawPointer();
default:
return nullptr;
}

View File

@ -13,12 +13,12 @@ int CLightParameters::LightLayerIndex()
{
if (!mpStruct) return 0;
CLongProperty *pParam;
TLongProperty *pParam;
if (mGame <= ePrime)
pParam = (CLongProperty*) mpStruct->PropertyByIndex(0xD);
pParam = (TLongProperty*) mpStruct->PropertyByIndex(0xD);
else
pParam = (CLongProperty*) mpStruct->PropertyByID(0x1F715FD3);
pParam = (TLongProperty*) mpStruct->PropertyByID(0x1F715FD3);
if (!pParam) return 0;
else return pParam->Get();

View File

@ -2,7 +2,7 @@
#define CLIGHTPARAMETERS_H
#include "Core/Resource/CGameArea.h"
#include "Core/Resource/Script/CProperty.h"
#include "Core/Resource/Script/IProperty.h"
class CLightParameters
{

View File

@ -113,8 +113,6 @@ HEADERS += \
Resource/Model/EVertexDescription.h \
Resource/Model/SSurface.h \
Resource/Script/CMasterTemplate.h \
Resource/Script/CProperty.h \
Resource/Script/CPropertyTemplate.h \
Resource/Script/CScriptLayer.h \
Resource/Script/CScriptObject.h \
Resource/Script/CScriptTemplate.h \
@ -139,7 +137,6 @@ HEADERS += \
Resource/CStringTable.h \
Resource/CTexture.h \
Resource/CWorld.h \
Resource/EFormatVersion.h \
Resource/EResType.h \
Resource/ETevEnums.h \
Resource/ETexelFormat.h \
@ -178,7 +175,12 @@ HEADERS += \
OpenGL/CVertexArrayManager.h \
OpenGL/CVertexBuffer.h \
OpenGL/GLCommon.h \
ScriptExtra/CRadiusSphereExtra.h
ScriptExtra/CRadiusSphereExtra.h \
Resource/EGame.h \
Resource/Cooker/CAreaCooker.h \
Resource/Script/IPropertyValue.h \
Resource/Script/IPropertyTemplate.h \
Resource/Script/IProperty.h
# Source Files
SOURCES += \
@ -211,8 +213,6 @@ SOURCES += \
Resource/Model/CStaticModel.cpp \
Resource/Model/SSurface.cpp \
Resource/Script/CMasterTemplate.cpp \
Resource/Script/CProperty.cpp \
Resource/Script/CPropertyTemplate.cpp \
Resource/Script/CScriptLayer.cpp \
Resource/Script/CScriptObject.cpp \
Resource/Script/CScriptTemplate.cpp \
@ -261,4 +261,7 @@ SOURCES += \
OpenGL/CVertexArrayManager.cpp \
OpenGL/CVertexBuffer.cpp \
OpenGL/GLCommon.cpp \
ScriptExtra/CRadiusSphereExtra.cpp
ScriptExtra/CRadiusSphereExtra.cpp \
Resource/Cooker/CAreaCooker.cpp \
Resource/Script/IPropertyTemplate.cpp \
Resource/Script/IProperty.cpp

View File

@ -3,7 +3,7 @@
#include "CResource.h"
#include "TResPtr.h"
#include "EFormatVersion.h"
#include "EGame.h"
#include "Core/Resource/Model/CModel.h"
class CAnimationParameters

View File

@ -3,7 +3,7 @@
#include "CMaterialPass.h"
#include "CTexture.h"
#include "EFormatVersion.h"
#include "EGame.h"
#include "TResPtr.h"
#include "Core/Resource/Model/EVertexDescription.h"
#include "Core/Render/ERenderOptions.h"

View File

@ -3,7 +3,7 @@
#include "CMaterial.h"
#include "CTexture.h"
#include "EFormatVersion.h"
#include "EGame.h"
#include <FileIO/IInputStream.h>
class CMaterialSet

View File

@ -3,7 +3,7 @@
#include "CResource.h"
#include "CStringTable.h"
#include "EFormatVersion.h"
#include "EGame.h"
#include "TResPtr.h"
class CScan : public CResource

View File

@ -0,0 +1,20 @@
#include "CAreaCooker.h"
CAreaCooker::CAreaCooker()
{
}
u32 CAreaCooker::GetMREAVersion(EGame version)
{
switch (version)
{
case ePrimeDemo: return 0xC;
case ePrime: return 0xF;
case eEchoesDemo: return 0x15;
case eEchoes: return 0x19;
case eCorruptionProto: return 0x1D;
case eCorruption: return 0x1E;
case eReturns: return 0x20;
default: return 0;
}
}

View File

@ -0,0 +1,14 @@
#ifndef CAREACOOKER_H
#define CAREACOOKER_H
#include "Core/Resource/EGame.h"
#include <Common/types.h>
class CAreaCooker
{
CAreaCooker();
public:
static u32 GetMREAVersion(EGame version);
};
#endif // CAREACOOKER_H

View File

@ -3,7 +3,7 @@
#include "Core/Resource/CMaterial.h"
#include "Core/Resource/CMaterialSet.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
class CMaterialCooker
{

View File

@ -2,7 +2,7 @@
#define CMODELCOOKER_H
#include "Core/Resource/Model/CModel.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include <FileIO/FileIO.h>
class CModelCooker

View File

@ -1,5 +1,5 @@
#include "CTemplateWriter.h"
#include "CWorldCooker.h"
#include "CAreaCooker.h"
#include <boost/filesystem.hpp>
#include <tinyxml2.h>
@ -13,104 +13,121 @@ CTemplateWriter::CTemplateWriter()
void CTemplateWriter::SaveAllTemplates()
{
// Create directory
std::list<CMasterTemplate*> masterList = CMasterTemplate::GetMasterList();
TString out = "../templates/";
boost::filesystem::create_directory(out.ToStdString());
std::list<CMasterTemplate*> MasterList = CMasterTemplate::GetMasterList();
TString Out = "../templates/";
boost::filesystem::create_directory(Out.ToStdString());
// Resave master templates
for (auto it = masterList.begin(); it != masterList.end(); it++)
SaveGameTemplates(*it, out);
for (auto it = MasterList.begin(); it != MasterList.end(); it++)
SaveGameTemplates(*it, Out);
// Resave game list
XMLDocument gameList;
XMLDocument GameList;
XMLDeclaration *pDecl = gameList.NewDeclaration();
gameList.LinkEndChild(pDecl);
XMLDeclaration *pDecl = GameList.NewDeclaration();
GameList.LinkEndChild(pDecl);
XMLElement *pBase = gameList.NewElement("GameList");
pBase->SetAttribute("version", 3);
gameList.LinkEndChild(pBase);
XMLElement *pBase = GameList.NewElement("GameList");
pBase->SetAttribute("version", 4);
GameList.LinkEndChild(pBase);
for (auto it = masterList.begin(); it != masterList.end(); it++)
for (auto it = MasterList.begin(); it != MasterList.end(); it++)
{
CMasterTemplate *pMaster = *it;
XMLElement *pGame = gameList.NewElement("game");
XMLElement *pGameName = gameList.NewElement("name");
pGameName->SetText(*pMaster->mGameName);
XMLElement *pWorldVersion = gameList.NewElement("mlvl");
u32 versionNumber = CWorldCooker::GetMLVLVersion(pMaster->GetGame());
pWorldVersion->SetText(*TString::HexString(versionNumber, true, true, 2));
XMLElement *pTempPath = gameList.NewElement("master");
pTempPath->SetText(*pMaster->mSourceFile);
pGame->LinkEndChild(pGameName);
pGame->LinkEndChild(pWorldVersion);
pGame->LinkEndChild(pTempPath);
XMLElement *pGame = GameList.NewElement("game");
pBase->LinkEndChild(pGame);
XMLElement *pGameName = GameList.NewElement("name");
pGameName->SetText(*pMaster->mGameName);
pGame->LinkEndChild(pGameName);
XMLElement *pAreaVersion = GameList.NewElement("mrea");
u32 VersionNumber = CAreaCooker::GetMREAVersion(pMaster->GetGame());
pAreaVersion->SetText(*TString::HexString(VersionNumber, true, true, 2));
pGame->LinkEndChild(pAreaVersion);
XMLElement *pTempPath = GameList.NewElement("master");
pTempPath->SetText(*pMaster->mSourceFile);
pGame->LinkEndChild(pTempPath);
}
gameList.SaveFile(*(out + "GameList.xml"));
TString GameListName = Out + "GameList.xml";
GameList.SaveFile(*GameListName);
}
void CTemplateWriter::SaveGameTemplates(CMasterTemplate *pMaster, const TString& dir)
void CTemplateWriter::SaveGameTemplates(CMasterTemplate *pMaster, const TString& rkDir)
{
// Create directory
TString outFile = dir + pMaster->mSourceFile;
TString outDir = outFile.GetFileDirectory();
boost::filesystem::create_directory(outDir.ToStdString());
TString OutFile = rkDir + pMaster->mSourceFile;
TString OutDir = OutFile.GetFileDirectory();
boost::filesystem::create_directory(OutDir.ToStdString());
// Resave script templates
for (auto it = pMaster->mTemplates.begin(); it != pMaster->mTemplates.end(); it++)
SaveScriptTemplate(it->second, outDir);
SaveScriptTemplate(it->second, OutDir);
// Resave master template
XMLDocument master;
XMLDocument Master;
XMLDeclaration *pDecl = master.NewDeclaration();
master.LinkEndChild(pDecl);
XMLDeclaration *pDecl = Master.NewDeclaration();
Master.LinkEndChild(pDecl);
XMLElement *pBase = master.NewElement("MasterTemplate");
pBase->SetAttribute("version", 3);
master.LinkEndChild(pBase);
XMLElement *pBase = Master.NewElement("MasterTemplate");
pBase->SetAttribute("version", 4);
Master.LinkEndChild(pBase);
// Write property list
if (!pMaster->mPropertyList.empty())
if (!pMaster->mPropertyNames.empty())
{
SavePropertyList(pMaster, outDir);
SavePropertyList(pMaster, OutDir);
XMLElement *pPropList = master.NewElement("properties");
XMLElement *pPropList = Master.NewElement("properties");
pPropList->SetText("Properties.xml");
pBase->LinkEndChild(pPropList);
}
// Write versions
if (!pMaster->mGameVersions.empty())
{
XMLElement *pVersionsBlock = Master.NewElement("versions");
pBase->LinkEndChild(pVersionsBlock);
for (auto it = pMaster->mGameVersions.begin(); it != pMaster->mGameVersions.end(); it++)
{
XMLElement *pVersion = Master.NewElement("version");
pVersion->SetText(*(*it));
pBase->LinkEndChild(pVersion);
}
}
// Write script objects
XMLElement *pObjects = master.NewElement("objects");
XMLElement *pObjects = Master.NewElement("objects");
pBase->LinkEndChild(pObjects);
for (auto it = pMaster->mTemplates.begin(); it != pMaster->mTemplates.end(); it++)
{
TString objID;
u32 intID = (it->second)->ObjectID();
if (intID <= 0xFF) objID = TString::HexString(intID, true, true, 2);
else objID = CFourCC(intID).ToString();
u32 ObjID = (it->second)->ObjectID();
XMLElement *pObj = master.NewElement("object");
pObj->SetAttribute("ID", *objID);
TString StrID;
if (ObjID <= 0xFF)
StrID = TString::HexString(ObjID, true, true, 2);
else
StrID = CFourCC(ObjID).ToString();
XMLElement *pObj = Master.NewElement("object");
pObj->SetAttribute("ID", *StrID);
pObj->SetAttribute("template", *(it->second)->mSourceFile);
pObjects->LinkEndChild(pObj);
}
// Write script states/messages
std::map<u32, TString> *pMaps[2] = { &pMaster->mStates, &pMaster->mMessages };
TString types[2] = { "state", "message" };
TString Types[2] = { "state", "message" };
for (u32 iScr = 0; iScr < 2; iScr++)
{
XMLElement *pElem = master.NewElement(*(types[iScr] + "s"));
XMLElement *pElem = Master.NewElement(*(Types[iScr] + "s"));
pBase->LinkEndChild(pElem);
for (auto it = pMaps[iScr]->begin(); it != pMaps[iScr]->end(); it++)
@ -119,7 +136,7 @@ void CTemplateWriter::SaveGameTemplates(CMasterTemplate *pMaster, const TString&
if (it->first <= 0xFF) ID = TString::HexString(it->first, true, true, 2);
else ID = CFourCC(it->first).ToString();
XMLElement *pSubElem = master.NewElement(*types[iScr]);
XMLElement *pSubElem = Master.NewElement(*Types[iScr]);
pSubElem->SetAttribute("ID", *ID);
pSubElem->SetAttribute("name", *(it->second));
pElem->LinkEndChild(pSubElem);
@ -127,113 +144,69 @@ void CTemplateWriter::SaveGameTemplates(CMasterTemplate *pMaster, const TString&
}
// Save file
master.SaveFile(*outFile);
Master.SaveFile(*OutFile);
}
void CTemplateWriter::SavePropertyList(CMasterTemplate *pMaster, const TString& dir)
void CTemplateWriter::SavePropertyList(CMasterTemplate *pMaster, const TString& rkDir)
{
// Create XML
XMLDocument list;
XMLDocument List;
XMLDeclaration *pDecl = list.NewDeclaration();
list.LinkEndChild(pDecl);
XMLDeclaration *pDecl = List.NewDeclaration();
List.LinkEndChild(pDecl);
XMLElement *pBase = list.NewElement("Properties");
pBase->SetAttribute("version", 3);
list.LinkEndChild(pBase);
XMLElement *pBase = List.NewElement("Properties");
pBase->SetAttribute("version", 4);
List.LinkEndChild(pBase);
// Write properties
for (auto it = pMaster->mPropertyList.begin(); it != pMaster->mPropertyList.end(); it++)
for (auto it = pMaster->mPropertyNames.begin(); it != pMaster->mPropertyNames.end(); it++)
{
CPropertyTemplate *pTemp = it->second;
u32 ID = it->first;
TString Name = it->second;
if (pTemp->Type() == eStructProperty)
{
CStructTemplate *pStructTemp = static_cast<CStructTemplate*>(pTemp);
XMLElement *pElem = list.NewElement("struct");
pElem->SetAttribute("ID", *TString::HexString(pTemp->PropertyID(), true, true, 8));
pElem->SetAttribute("name", *pTemp->Name());
if (!pStructTemp->mSourceFile.IsEmpty())
{
SaveStructTemplate(pStructTemp, pMaster, dir);
pElem->SetAttribute("template", *pStructTemp->mSourceFile);
}
pBase->LinkEndChild(pElem);
}
else
{
XMLElement *pElem = list.NewElement("property");
pElem->SetAttribute("ID", *TString::HexString(pTemp->PropertyID(), true, true, 8));
pElem->SetAttribute("name", *pTemp->Name());
pElem->SetAttribute("type", *PropEnumToPropString(pTemp->Type()));
if (pTemp->Type() == eFileProperty)
{
// Construct extension list string
CFileTemplate *pFileProp = static_cast<CFileTemplate*>(pTemp);
const TStringList& extensions = pFileProp->Extensions();
TString strList = "";
for (auto it = extensions.begin(); it != extensions.end();)
{
strList += *it;
it++;
if (it != extensions.end()) strList += ",";
}
pElem->SetAttribute("ext", *strList);
}
pBase->LinkEndChild(pElem);
}
XMLElement *pElem = List.NewElement("property");
pElem->SetAttribute("ID", *TString::HexString(ID, true, true, 8));
pElem->SetAttribute("name", *Name);
pBase->LinkEndChild(pElem);
}
list.SaveFile(*(dir + "Properties.xml"));
TString OutFile = rkDir + "Properties.xml";
List.SaveFile(*OutFile);
}
void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString& dir)
void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString& rkDir)
{
// Create directory
TString outFile = dir + pTemp->mSourceFile;
TString outDir = outFile.GetFileDirectory();
TString OutFile = rkDir + pTemp->mSourceFile;
TString outDir = OutFile.GetFileDirectory();
boost::filesystem::create_directory(*outDir);
// Create new document
XMLDocument scriptXML;
XMLDocument ScriptXML;
XMLDeclaration *pDecl = scriptXML.NewDeclaration();
scriptXML.LinkEndChild(pDecl);
XMLDeclaration *pDecl = ScriptXML.NewDeclaration();
ScriptXML.LinkEndChild(pDecl);
// Base element
XMLElement *pBase = scriptXML.NewElement("ScriptTemplate");
pBase->SetAttribute("version", 3.0f);
scriptXML.LinkEndChild(pBase);
XMLElement *pRoot = ScriptXML.NewElement("ScriptTemplate");
pRoot->SetAttribute("version", 4);
ScriptXML.LinkEndChild(pRoot);
// Write object name
XMLElement *pName = scriptXML.NewElement("name");
XMLElement *pName = ScriptXML.NewElement("name");
pName->SetText(*pTemp->TemplateName());
pBase->LinkEndChild(pName);
pRoot->LinkEndChild(pName);
// Write properties
for (auto it = pTemp->mPropertySets.begin(); it != pTemp->mPropertySets.end(); it++)
{
XMLElement *pProperties = scriptXML.NewElement("properties");
pProperties->SetAttribute("version", *it->SetName);
SaveProperties(&scriptXML, pProperties, it->pBaseStruct, pTemp->MasterTemplate(), dir);
pBase->LinkEndChild(pProperties);
}
SaveProperties(&ScriptXML, pRoot, pTemp->mpBaseStruct, pTemp->MasterTemplate(), rkDir);
// Write editor properties
XMLElement *pEditor = scriptXML.NewElement("editor");
pBase->LinkEndChild(pEditor);
XMLElement *pEditor = ScriptXML.NewElement("editor");
pRoot->LinkEndChild(pEditor);
// Editor Properties
XMLElement *pEditorProperties = scriptXML.NewElement("properties");
XMLElement *pEditorProperties = ScriptXML.NewElement("properties");
pEditor->LinkEndChild(pEditorProperties);
TString propNames[6] = {
@ -250,7 +223,7 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString&
{
if (!pPropStrings[iProp]->IsEmpty())
{
XMLElement *pProperty = scriptXML.NewElement("property");
XMLElement *pProperty = ScriptXML.NewElement("property");
pProperty->SetAttribute("name", *propNames[iProp]);
pProperty->SetAttribute("ID", **pPropStrings[iProp]);
pEditorProperties->LinkEndChild(pProperty);
@ -258,28 +231,29 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString&
}
// Editor Assets
XMLElement *pAssets = scriptXML.NewElement("assets");
XMLElement *pAssets = ScriptXML.NewElement("assets");
pEditor->LinkEndChild(pAssets);
for (auto it = pTemp->mAssets.begin(); it != pTemp->mAssets.end(); it++)
{
TString source = (it->AssetSource == CScriptTemplate::SEditorAsset::eFile ? "file" : "property");
TString type;
TString Source = (it->AssetSource == CScriptTemplate::SEditorAsset::eFile ? "file" : "property");
TString Type;
switch (it->AssetType)
{
case CScriptTemplate::SEditorAsset::eModel: type = "model"; break;
case CScriptTemplate::SEditorAsset::eAnimParams: type = "animparams"; break;
case CScriptTemplate::SEditorAsset::eBillboard: type = "billboard"; break;
case CScriptTemplate::SEditorAsset::eCollision: type = "collision"; break;
case CScriptTemplate::SEditorAsset::eModel: Type = "model"; break;
case CScriptTemplate::SEditorAsset::eAnimParams: Type = "animparams"; break;
case CScriptTemplate::SEditorAsset::eBillboard: Type = "billboard"; break;
case CScriptTemplate::SEditorAsset::eCollision: Type = "collision"; break;
}
s32 force = -1;
if (it->AssetSource == CScriptTemplate::SEditorAsset::eAnimParams) force = it->ForceNodeIndex;
s32 Force = -1;
if (it->AssetSource == CScriptTemplate::SEditorAsset::eAnimParams)
Force = it->ForceNodeIndex;
XMLElement *pAsset = scriptXML.NewElement(*type);
pAsset->SetAttribute("source", *source);
if (force >= 0) pAsset->SetAttribute("force", std::to_string(force).c_str());
XMLElement *pAsset = ScriptXML.NewElement(*Type);
pAsset->SetAttribute("source", *Source);
if (Force >= 0) pAsset->SetAttribute("force", std::to_string(Force).c_str());
pAsset->SetText(*it->AssetLocation);
pAssets->LinkEndChild(pAsset);
}
@ -287,17 +261,17 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString&
// Preview Scale
if (pTemp->mPreviewScale != 1.f)
{
XMLElement *pPreviewScale = scriptXML.NewElement("preview_scale");
XMLElement *pPreviewScale = ScriptXML.NewElement("preview_scale");
pPreviewScale->SetText(*TString::FromFloat(pTemp->mPreviewScale));
pEditor->LinkEndChild(pPreviewScale);
pPreviewScale->SetText(pTemp->mPreviewScale);
}
// Rot/Scale Type
XMLElement *pRotType = scriptXML.NewElement("rotation_type");
XMLElement *pRotType = ScriptXML.NewElement("rotation_type");
pEditor->LinkEndChild(pRotType);
pRotType->SetText(pTemp->mRotationType == CScriptTemplate::eRotationEnabled ? "enabled" : "disabled");
XMLElement *pScaleType = scriptXML.NewElement("scale_type");
XMLElement *pScaleType = ScriptXML.NewElement("scale_type");
pEditor->LinkEndChild(pScaleType);
if (pTemp->mScaleType != CScriptTemplate::eScaleVolume)
@ -308,7 +282,7 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString&
pScaleType->SetText("volume");
// Volume Preview
XMLElement *pVolume = scriptXML.NewElement("preview_volume");
XMLElement *pVolume = ScriptXML.NewElement("preview_volume");
pEditor->LinkEndChild(pVolume);
// Enum -> String conversion lambda to avoid redundant code
@ -335,27 +309,21 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString&
pVolume->SetAttribute("propertyID", *pTemp->mVolumeConditionIDString);
// Find conditional test property
CPropertyTemplate *pProp;
for (auto it = pTemp->mPropertySets.begin(); it != pTemp->mPropertySets.end(); it++)
{
pProp = it->pBaseStruct->PropertyByIDString(pTemp->mVolumeConditionIDString);
if (pProp) break;
}
IPropertyTemplate *pProp = pTemp->mpBaseStruct->PropertyByIDString(pTemp->mVolumeConditionIDString);
// Write conditions
for (auto it = pTemp->mVolumeConditions.begin(); it != pTemp->mVolumeConditions.end(); it++)
{
// Value should be an integer, or a boolean condition?
TString strVal;
TString StrVal;
if (pProp->Type() == eBoolProperty)
strVal = (it->Value == 1 ? "true" : "false");
StrVal = (it->Value == 1 ? "true" : "false");
else
strVal = TString::HexString((u32) it->Value, true, true, (it->Value > 0xFF ? 8 : 2));
StrVal = TString::HexString((u32) it->Value, true, true, (it->Value > 0xFF ? 8 : 2));
XMLElement *pCondition = scriptXML.NewElement("condition");
pCondition->SetAttribute("value", *strVal);
XMLElement *pCondition = ScriptXML.NewElement("condition");
pCondition->SetAttribute("value", *StrVal);
pCondition->SetAttribute("shape", *GetVolumeString(it->Shape));
if (it->Scale != 1.f) pCondition->SetAttribute("scale", it->Scale);
pVolume->LinkEndChild(pCondition);
@ -364,221 +332,239 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp, const TString&
}
// Write to file
scriptXML.SaveFile(*outFile);
ScriptXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveStructTemplate(CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& dir)
void CTemplateWriter::SaveStructTemplate(CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& rkDir)
{
// Create directory
TString outFile = dir + pTemp->mSourceFile;
TString outDir = outFile.GetFileDirectory();
TString name = pTemp->mSourceFile.GetFileName();
boost::filesystem::create_directory(outDir.ToStdString());
TString OutFile = rkDir + pTemp->mSourceFile;
TString OutDir = OutFile.GetFileDirectory();
TString Name = OutFile.GetFileName(false);
boost::filesystem::create_directory(OutDir.ToStdString());
// Create new document and write struct properties to it
XMLDocument structXML;
XMLDocument StructXML;
XMLDeclaration *pDecl = structXML.NewDeclaration();
structXML.LinkEndChild(pDecl);
XMLDeclaration *pDecl = StructXML.NewDeclaration();
StructXML.LinkEndChild(pDecl);
XMLElement *pBase = structXML.NewElement("struct");
pBase->SetAttribute("name", *name);
pBase->SetAttribute("type", (pTemp->IsSingleProperty() ? "single" : "multi"));
SaveProperties(&structXML, pBase, pTemp, pMaster, dir);
structXML.LinkEndChild(pBase);
XMLElement *pRoot = StructXML.NewElement("struct");
pRoot->SetAttribute("name", *Name);
pRoot->SetAttribute("type", (pTemp->IsSingleProperty() ? "single" : "multi"));
StructXML.LinkEndChild(pRoot);
structXML.SaveFile(*outFile);
SaveProperties(&StructXML, pRoot, pTemp, pMaster, rkDir);
StructXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveEnumTemplate(CEnumTemplate *pTemp, const TString& dir)
void CTemplateWriter::SaveEnumTemplate(CEnumTemplate *pTemp, const TString& rkDir)
{
// Create directory
TString outFile = dir + pTemp->mSourceFile;
TString outDir = outFile.GetFileDirectory();
TString name = pTemp->mSourceFile.GetFileName(false);
boost::filesystem::create_directory(*outDir);
TString OutFile = rkDir + pTemp->mSourceFile;
TString OutDir = OutFile.GetFileDirectory();
TString Name = OutFile.GetFileName(false);
boost::filesystem::create_directory(*OutDir);
// Create new document and write enumerators to it
XMLDocument enumXML;
XMLDocument EnumXML;
XMLDeclaration *pDecl = enumXML.NewDeclaration();
enumXML.LinkEndChild(pDecl);
XMLDeclaration *pDecl = EnumXML.NewDeclaration();
EnumXML.LinkEndChild(pDecl);
XMLElement *pBase = enumXML.NewElement("enum");
pBase->SetAttribute("name", *name);
SaveEnumerators(&enumXML, pBase, pTemp);
enumXML.LinkEndChild(pBase);
XMLElement *pRoot = EnumXML.NewElement("enum");
pRoot->SetAttribute("name", *Name);
EnumXML.LinkEndChild(pRoot);
enumXML.SaveFile(*outFile);
SaveEnumerators(&EnumXML, pRoot, pTemp);
EnumXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveBitfieldTemplate(CBitfieldTemplate *pTemp, const TString& dir)
void CTemplateWriter::SaveBitfieldTemplate(CBitfieldTemplate *pTemp, const TString& rkDir)
{
// Create directory
TString outFile = dir + pTemp->mSourceFile;
TString outDir = outFile.GetFileDirectory();
TString name = pTemp->mSourceFile.GetFileName();
boost::filesystem::create_directory(*outDir);
TString OutFile = rkDir + pTemp->mSourceFile;
TString OutDir = OutFile.GetFileDirectory();
TString Name = pTemp->mSourceFile.GetFileName(false);
boost::filesystem::create_directory(*OutDir);
// Create new document and write enumerators to it
XMLDocument bitfieldXML;
XMLDocument BitfieldXML;
XMLDeclaration *pDecl = bitfieldXML.NewDeclaration();
bitfieldXML.LinkEndChild(pDecl);
XMLDeclaration *pDecl = BitfieldXML.NewDeclaration();
BitfieldXML.LinkEndChild(pDecl);
XMLElement *pBase = bitfieldXML.NewElement("bitfield");
pBase->SetAttribute("name", *name);
SaveBitFlags(&bitfieldXML, pBase, pTemp);
bitfieldXML.LinkEndChild(pBase);
XMLElement *pRoot = BitfieldXML.NewElement("bitfield");
pRoot->SetAttribute("name", *Name);
BitfieldXML.LinkEndChild(pRoot);
bitfieldXML.SaveFile(*outFile);
SaveBitFlags(&BitfieldXML, pRoot, pTemp);
BitfieldXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& dir)
void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& rkDir)
{
// Create base element
XMLElement *pPropsBlock = pDoc->NewElement("properties");
pParent->LinkEndChild(pPropsBlock);
for (u32 iProp = 0; iProp < pTemp->Count(); iProp++)
{
CPropertyTemplate *pProp = pTemp->PropertyByIndex(iProp);
u32 propID = (pProp->PropertyID() == 0xFFFFFFFF ? iProp : pProp->PropertyID());
TString strID = TString::HexString(propID, true, true, (propID > 0xFF ? 8 : 2));
// Get ID
IPropertyTemplate *pProp = pTemp->PropertyByIndex(iProp);
u32 ID = pProp->PropertyID();
TString StrID = TString::HexString(ID, true, true, (ID > 0xFF ? 8 : 2));
// Create element
XMLElement *pElem;
if (pProp->Type() == eStructProperty)
pElem = pDoc->NewElement("struct");
else if (pProp->Type() == eEnumProperty)
pElem = pDoc->NewElement("enum");
else if (pProp->Type() == eBitfieldProperty)
pElem = pDoc->NewElement("bitfield");
else if (pProp->Type() == eArrayProperty)
pElem = pDoc->NewElement("array");
else
pElem = pDoc->NewElement("property");
// Set common property parameters, starting with ID
pElem->SetAttribute("ID", *StrID);
// Type
if (pProp->Type() == eStructProperty)
pElem->SetAttribute("type", (static_cast<CStructTemplate*>(pProp)->mIsSingleProperty ? "single" : "multi"));
else if (TString(pElem->Name()) == "property")
pElem->SetAttribute("type", *PropEnumToPropString(pProp->Type()));
// Name
TString Name = pProp->Name();
if (pMaster->HasPropertyList())
{
CStructTemplate *pStructTemp = static_cast<CStructTemplate*>(pProp);
bool isExternal = (!pStructTemp->mSourceFile.IsEmpty());
TString MasterName = pMaster->PropertyName(ID);
XMLElement *pElem = pDoc->NewElement("struct");
pElem->SetAttribute("ID", *strID);
if ((!pMaster->HasPropertyList()) || (pProp->PropertyID() == -1) || pTemp->IsSingleProperty())
{
pElem->SetAttribute("name", *pProp->Name());
}
if (!isExternal) {
TString type = pStructTemp->IsSingleProperty() ? "single" : "multi";
pElem->SetAttribute("type", *type);
}
// Only save properties if this is a multi struct, or if there is no master property list
if (!pMaster->HasPropertyList() || !pStructTemp->IsSingleProperty())
{
// Embed struct or save to external XML?
if (!pStructTemp->mSourceFile.IsEmpty())
{
SaveStructTemplate(pStructTemp, pMaster, dir);
pElem->SetAttribute("template", *pStructTemp->mSourceFile);
}
else
{
SaveProperties(pDoc, pElem, pStructTemp, pMaster, dir);
}
}
pParent->LinkEndChild(pElem);
if (Name != MasterName)
pElem->SetAttribute("name", *Name);
}
else
pElem->SetAttribute("name", *Name);
// Default
if (pProp->CanHaveDefault())
{
XMLElement *pDefault = pDoc->NewElement("default");
pDefault->SetText(*pProp->DefaultToString());
pElem->LinkEndChild(pDefault);
}
// Range
if (pProp->IsNumerical() && pProp->HasValidRange())
{
XMLElement *pRange = pDoc->NewElement("range");
pRange->SetText(*pProp->RangeToString());
pElem->LinkEndChild(pRange);
}
// Cook Pref
ECookPreference CookPref = pProp->CookPreference();
if (CookPref != eNoCookPreference)
{
XMLElement *pCookPref = pDoc->NewElement("should_cook");
pCookPref->SetText(CookPref == eAlwaysCook ? "always" : "never");
pElem->LinkEndChild(pCookPref);
}
// File-specific parameters
if (pProp->Type() == eFileProperty)
{
CFileTemplate *pFile = static_cast<CFileTemplate*>(pProp);
const TStringList& rkExtensions = pFile->Extensions();
TString ExtensionsString;
for (auto it = rkExtensions.begin(); it != rkExtensions.end(); it++)
ExtensionsString += *it + ",";
ExtensionsString.ChopBack(1); // Remove extra comma
pElem->SetAttribute("extensions", *ExtensionsString);
}
// Enum-specific parameters
else if (pProp->Type() == eEnumProperty)
{
CEnumTemplate *pEnumTemp = static_cast<CEnumTemplate*>(pProp);
bool isExternal = (!pEnumTemp->mSourceFile.IsEmpty());
CEnumTemplate *pEnum = static_cast<CEnumTemplate*>(pProp);
XMLElement *pElem = pDoc->NewElement("enum");
pElem->SetAttribute("ID", *strID);
if ((!pMaster->HasPropertyList()) || (pProp->PropertyID() == -1))
pElem->SetAttribute("name", *pProp->Name());
if (isExternal)
{
SaveEnumTemplate(pEnumTemp, dir);
pElem->SetAttribute("template", *pEnumTemp->mSourceFile);
}
if (pEnum->mSourceFile.IsEmpty())
SaveEnumerators(pDoc, pElem, pEnum);
else
{
SaveEnumerators(pDoc, pElem, pEnumTemp);
SaveEnumTemplate(pEnum, rkDir);
pElem->SetAttribute("template", *pEnum->mSourceFile);
}
pParent->LinkEndChild(pElem);
}
// Bitfield-specific parameters
else if (pProp->Type() == eBitfieldProperty)
{
CBitfieldTemplate *pBitfieldTemp = static_cast<CBitfieldTemplate*>(pProp);
bool isExternal = (!pBitfieldTemp->mSourceFile.IsEmpty());
CBitfieldTemplate *pBitfield = static_cast<CBitfieldTemplate*>(pProp);
XMLElement *pElem = pDoc->NewElement("bitfield");
pElem->SetAttribute("ID", *strID);
if ((!pMaster->HasPropertyList()) || (pProp->PropertyID() == -1))
pElem->SetAttribute("name", *pProp->Name());
if (isExternal)
{
SaveBitfieldTemplate(pBitfieldTemp, dir);
pElem->SetAttribute("template", *pBitfieldTemp->mSourceFile);
}
if (pBitfield->mSourceFile.IsEmpty())
SaveBitFlags(pDoc, pElem, pBitfield);
else
{
SaveBitFlags(pDoc, pElem, pBitfieldTemp);
SaveBitfieldTemplate(pBitfield, rkDir);
pElem->SetAttribute("template", *pBitfield->mSourceFile);
}
pParent->LinkEndChild(pElem);
}
else
// Struct/array-specific parameters
if (pProp->Type() == eStructProperty || pProp->Type() == eArrayProperty)
{
XMLElement *pElem = pDoc->NewElement("property");
pElem->SetAttribute("ID", *strID);
CStructTemplate *pStruct = static_cast<CStructTemplate*>(pProp);
if ((!pMaster->HasPropertyList()) || (pProp->PropertyID() == -1) || pTemp->IsSingleProperty())
if (pStruct->mSourceFile.IsEmpty())
SaveProperties(pDoc, pElem, pStruct, pMaster, rkDir);
else
{
pElem->SetAttribute("name", *pProp->Name());
pElem->SetAttribute("type", *PropEnumToPropString(pProp->Type()));
if (pProp->Type() == eFileProperty)
{
// Construct extension list string
CFileTemplate *pFileProp = static_cast<CFileTemplate*>(pProp);
const TStringList& extensions = pFileProp->Extensions();
TString strList = "";
for (auto it = extensions.begin(); it != extensions.end();)
{
strList += *it;
it++;
if (it != extensions.end()) strList += ",";
}
pElem->SetAttribute("ext", *strList);
}
SaveStructTemplate(pStruct, pMaster, rkDir);
pElem->SetAttribute("template", *pStruct->mSourceFile);
}
pParent->LinkEndChild(pElem);
}
}
}
void CTemplateWriter::SaveEnumerators(XMLDocument *pDoc, XMLElement *pParent, CEnumTemplate *pTemp)
{
XMLElement *pEnumerators = pDoc->NewElement("enumerators");
pParent->LinkEndChild(pEnumerators);
for (u32 iEnum = 0; iEnum < pTemp->NumEnumerators(); iEnum++)
{
XMLElement *pElem = pDoc->NewElement("enumerator");
pElem->SetAttribute("ID", *TString::HexString(pTemp->EnumeratorID(iEnum), true, true, 8));
u32 EnumerID = pTemp->EnumeratorID(iEnum);
pElem->SetAttribute("ID", *TString::HexString(EnumerID, true, true, (EnumerID > 0xFF ? 8 : 0)));
pElem->SetAttribute("name", *pTemp->EnumeratorName(iEnum));
pParent->LinkEndChild(pElem);
pEnumerators->LinkEndChild(pElem);
}
}
void CTemplateWriter::SaveBitFlags(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CBitfieldTemplate *pTemp)
void CTemplateWriter::SaveBitFlags(XMLDocument *pDoc, XMLElement *pParent, CBitfieldTemplate *pTemp)
{
XMLElement *pFlags = pDoc->NewElement("flags");
pParent->LinkEndChild(pFlags);
for (u32 iFlag = 0; iFlag < pTemp->NumFlags(); iFlag++)
{
XMLElement *pElem = pDoc->NewElement("bitflag");
XMLElement *pElem = pDoc->NewElement("flag");
pElem->SetAttribute("mask", *TString::HexString(pTemp->FlagMask(iFlag), true, true, 8));
pElem->SetAttribute("name", *pTemp->FlagName(iFlag));
pParent->LinkEndChild(pElem);
pFlags->LinkEndChild(pElem);
}
}

View File

@ -11,13 +11,13 @@ class CTemplateWriter
public:
static void SaveAllTemplates();
static void SaveGameTemplates(CMasterTemplate *pMaster, const TString& dir);
static void SavePropertyList(CMasterTemplate *pMaster, const TString& dir);
static void SaveScriptTemplate(CScriptTemplate *pTemp, const TString& dir);
static void SaveStructTemplate(CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& dir);
static void SaveEnumTemplate(CEnumTemplate *pTemp, const TString& dir);
static void SaveBitfieldTemplate(CBitfieldTemplate *pTemp, const TString& dir);
static void SaveProperties(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& dir);
static void SaveGameTemplates(CMasterTemplate *pMaster, const TString& rkDir);
static void SavePropertyList(CMasterTemplate *pMaster, const TString& rkDir);
static void SaveScriptTemplate(CScriptTemplate *pTemp, const TString& rkDir);
static void SaveStructTemplate(CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& rkDir);
static void SaveEnumTemplate(CEnumTemplate *pTemp, const TString& rkDir);
static void SaveBitfieldTemplate(CBitfieldTemplate *pTemp, const TString& rkDir);
static void SaveProperties(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CStructTemplate *pTemp, CMasterTemplate *pMaster, const TString& rkDir);
static void SaveEnumerators(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CEnumTemplate *pTemp);
static void SaveBitFlags(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CBitfieldTemplate *pTemp);
};

View File

@ -1,7 +1,7 @@
#ifndef CWORLDCOOKER_H
#define CWORLDCOOKER_H
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include <Common/types.h>
class CWorldCooker

View File

@ -1,5 +1,5 @@
#ifndef EFORMATVERSION_H
#define EFORMATVERSION_H
#ifndef EGAME_H
#define EGAME_H
// Global version enum that can be easily shared between loaders
enum EGame
@ -11,8 +11,7 @@ enum EGame
eCorruptionProto = 4,
eCorruption = 5,
eReturns = 6,
TropicalFreeze = 7,
eUnknownVersion = -1
};
#endif // EFORMATVERSION_H
#endif // EGAME_H

View File

@ -2,7 +2,7 @@
#define CCHARACTERLOADER_H
#include "Core/Resource/CAnimSet.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/CResCache.h"
class CAnimSetLoader

View File

@ -101,23 +101,27 @@ void CAreaLoader::ReadSCLYPrime()
return;
}
mpMREA->Seek(0x4, SEEK_CUR);
if (mVersion <= ePrime)
mpMREA->Seek(0x4, SEEK_CUR);
else
mpMREA->Seek(0x1, SEEK_CUR);
mNumLayers = mpMREA->ReadLong();
mpArea->mScriptLayers.reserve(mNumLayers);
std::vector<u32> LayerSizes(mNumLayers);
for (u32 l = 0; l < mNumLayers; l++)
LayerSizes[l] = mpMREA->ReadLong();
for (u32 iLayer = 0; iLayer < mNumLayers; iLayer++)
LayerSizes[iLayer] = mpMREA->ReadLong();
for (u32 l = 0; l < mNumLayers; l++)
for (u32 iLayer = 0; iLayer < mNumLayers; iLayer++)
{
u32 next = mpMREA->Tell() + LayerSizes[l];
u32 Next = mpMREA->Tell() + LayerSizes[iLayer];
CScriptLayer *layer = CScriptLoader::LoadLayer(*mpMREA, mpArea, mVersion);
if (layer)
mpArea->mScriptLayers.push_back(layer);
CScriptLayer *pLayer = CScriptLoader::LoadLayer(*mpMREA, mpArea, mVersion);
if (pLayer)
mpArea->mScriptLayers.push_back(pLayer);
mpMREA->Seek(next, SEEK_SET);
mpMREA->Seek(Next, SEEK_SET);
}
SetUpObjects();
@ -572,6 +576,12 @@ CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA)
Loader.ReadLightsPrime();
break;
case eEchoesDemo:
Loader.ReadHeaderEchoes();
Loader.ReadGeometryPrime();
Loader.ReadSCLYPrime();
Loader.ReadCollision();
Loader.ReadLightsPrime();
break;
case eEchoes:
Loader.ReadHeaderEchoes();
Loader.ReadGeometryPrime();

View File

@ -4,7 +4,7 @@
#include "CBlockMgrIn.h"
#include "Core/Resource/Script/SConnection.h"
#include "Core/Resource/CGameArea.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/CResCache.h"
#include <FileIO/FileIO.h>

View File

@ -3,7 +3,7 @@
#include "Core/Resource/CCollisionMesh.h"
#include "Core/Resource/CCollisionMeshGroup.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
class CCollisionLoader
{

View File

@ -2,7 +2,7 @@
#define CFONTLOADER_H
#include "Core/Resource/CFont.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/CResCache.h"
class CFontLoader

View File

@ -2,7 +2,7 @@
#define CMATERIALLOADER_H
#include "Core/Resource/CMaterialSet.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/CResCache.h"
#include <FileIO/FileIO.h>

View File

@ -5,7 +5,7 @@
#include "Core/Resource/Model/CBasicModel.h"
#include "Core/Resource/Model/CModel.h"
#include "Core/Resource/CResCache.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include <Common/EnumUtil.h>
#include <FileIO/FileIO.h>

View File

@ -51,21 +51,21 @@ CScan* CScanLoader::LoadScanMP2(IInputStream& SCAN)
return nullptr;
}
mpScan = new CScan();
SCAN.Seek(0x2, SEEK_CUR);
u16 NumProperties = SCAN.ReadShort();
switch (NumProperties)
{
case 0x14:
mpScan = new CScan();
LoadParamsMP2(SCAN);
break;
case 0x16:
mpScan = new CScan();
LoadParamsMP3(SCAN);
break;
default:
Log::FileError(SCAN.GetSourceString(), SCAN.Tell() - 2, "Invalid SNFO property count: " + TString::HexString(NumProperties));
delete mpScan;
return nullptr;
}

View File

@ -2,7 +2,7 @@
#define CSCANLOADER_H
#include "Core/Resource/CScan.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
class CScanLoader
{

View File

@ -1,4 +1,5 @@
#include "CScriptLoader.h"
#include "CTemplateLoader.h"
#include "Core/Resource/Script/CMasterTemplate.h"
#include "Core/Resource/CResCache.h"
#include "Core/Log.h"
@ -10,152 +11,215 @@ CScriptLoader::CScriptLoader()
mpObj = nullptr;
}
CPropertyStruct* CScriptLoader::LoadStructMP1(IInputStream& SCLY, CStructTemplate *pTemp)
void CScriptLoader::ReadProperty(IProperty *pProp, u32 Size, IInputStream& SCLY)
{
u32 structStart = SCLY.Tell();
CPropertyStruct *propStruct = new CPropertyStruct();
propStruct->mpTemplate = pTemp;
IPropertyTemplate *pTemp = pProp->Template();
// Verify property count
u32 propCount = pTemp->Count();
if (!pTemp->IsSingleProperty())
switch (pTemp->Type())
{
u32 filePropCount = SCLY.ReadLong();
if (propCount != filePropCount)
Log::FileWarning(SCLY.GetSourceString(), structStart, "Struct \"" + pTemp->Name() + "\" template prop count doesn't match file");
case eBoolProperty: {
TBoolProperty *pBoolCast = static_cast<TBoolProperty*>(pProp);
pBoolCast->Set( (SCLY.ReadByte() != 0) );
break;
}
// Parse properties
propStruct->Reserve(propCount);
case eByteProperty: {
TByteProperty *pByteCast = static_cast<TByteProperty*>(pProp);
pByteCast->Set(SCLY.ReadByte());
break;
}
for (u32 iProp = 0; iProp < propCount; iProp++)
{
CPropertyBase *pProp = nullptr;
CPropertyTemplate *pPropTmp = pTemp->PropertyByIndex(iProp);
EPropertyType type = pPropTmp->Type();
case eShortProperty: {
TShortProperty *pShortCast = static_cast<TShortProperty*>(pProp);
pShortCast->Set(SCLY.ReadShort());
break;
}
switch (type)
case eLongProperty: {
TLongProperty *pLongCast = static_cast<TLongProperty*>(pProp);
pLongCast->Set(SCLY.ReadLong());
break;
}
case eBitfieldProperty: {
TBitfieldProperty *pBitfieldCast = static_cast<TBitfieldProperty*>(pProp);
pBitfieldCast->Set(SCLY.ReadLong());
// Validate
u32 mask = 0;
CBitfieldTemplate *pBitfieldTemp = static_cast<CBitfieldTemplate*>(pTemp);
for (u32 iMask = 0; iMask < pBitfieldTemp->NumFlags(); iMask++)
mask |= pBitfieldTemp->FlagMask(iMask);
u32 check = pBitfieldCast->Get() & ~mask;
if (check != 0)
Log::FileWarning(SCLY.GetSourceString(), SCLY.Tell() - 4, "Bitfield property \"" + pBitfieldTemp->Name() + "\" in struct \"" + pTemp->Name() + "\" has flags set that aren't in the template: " + TString::HexString(check, true, true, 8));
break;
}
case eEnumProperty: {
TEnumProperty *pEnumCast = static_cast<TEnumProperty*>(pProp);
CEnumTemplate *pEnumTemp = static_cast<CEnumTemplate*>(pTemp);
u32 ID = SCLY.ReadLong();
u32 index = pEnumTemp->EnumeratorIndex(ID);
if (index == -1) Log::FileError(SCLY.GetSourceString(), SCLY.Tell() - 4, "Enum property \"" + pEnumTemp->Name() + "\" in struct \"" + pTemp->Name() + "\" has invalid enumerator value: " + TString::HexString(ID, true, true, 8));
pEnumCast->Set(index);
break;
}
case eFloatProperty: {
TFloatProperty *pFloatCast = static_cast<TFloatProperty*>(pProp);
pFloatCast->Set(SCLY.ReadFloat());
break;
}
case eStringProperty: {
TStringProperty *pStringCast = static_cast<TStringProperty*>(pProp);
pStringCast->Set(SCLY.ReadString());
break;
}
case eVector3Property: {
TVector3Property *pVector3Cast = static_cast<TVector3Property*>(pProp);
pVector3Cast->Set(CVector3f(SCLY));
break;
}
case eColorProperty: {
TColorProperty *pColorCast = static_cast<TColorProperty*>(pProp);
pColorCast->Set(CColor(SCLY));
break;
}
case eFileProperty: {
TFileProperty *pFileCast = static_cast<TFileProperty*>(pProp);
CUniqueID ResID = (mVersion < eCorruptionProto ? SCLY.ReadLong() : SCLY.ReadLongLong());
const TStringList& Extensions = static_cast<CFileTemplate*>(pTemp)->Extensions();
CResource *pRes = nullptr;
// Check for each extension individually until we find a match
// This could be done better with a function to fetch the extension given the resource ID
// and a "does resource exist" function, but this will do for now
bool hasIgnoredExt = false;
if (ResID.IsValid())
{
case eBoolProperty: {
bool v = (SCLY.ReadByte() == 1);
pProp = new CBoolProperty(v);
break;
}
case eByteProperty: {
char v = SCLY.ReadByte();
pProp = new CByteProperty(v);
break;
}
case eShortProperty: {
short v = SCLY.ReadShort();
pProp = new CShortProperty(v);
break;
}
case eLongProperty: {
long v = SCLY.ReadLong();
pProp = new CLongProperty(v);
break;
}
case eBitfieldProperty: {
long v = SCLY.ReadLong();
pProp = new CBitfieldProperty(v);
// Validate
u32 mask = 0;
CBitfieldTemplate *pBitfieldTemp = static_cast<CBitfieldTemplate*>(pPropTmp);
for (u32 iMask = 0; iMask < pBitfieldTemp->NumFlags(); iMask++)
mask |= pBitfieldTemp->FlagMask(iMask);
u32 check = v & ~mask;
if (check != 0) Log::FileWarning(SCLY.GetSourceString(), SCLY.Tell() - 4, "Bitfield property \"" + pBitfieldTemp->Name() + "\" in struct \"" + pTemp->Name() + "\" has flags set that aren't in the template: " + TString::HexString(check, true, true, 8));
break;
}
case eEnumProperty: {
CEnumTemplate *pEnumTemp = static_cast<CEnumTemplate*>(pPropTmp);
u32 ID = SCLY.ReadLong();
u32 index = pEnumTemp->EnumeratorIndex(ID);
if (index == -1) Log::FileError(SCLY.GetSourceString(), SCLY.Tell() - 4, "Enum property \"" + pEnumTemp->Name() + "\" in struct \"" + pTemp->Name() + "\" has invalid enumerator value: " + TString::HexString(ID, true, true, 8));
pProp = new CEnumProperty(index);
break;
}
case eFloatProperty: {
float v = SCLY.ReadFloat();
pProp = new CFloatProperty(v);
break;
}
case eStringProperty: {
TString v = SCLY.ReadString();
pProp = new CStringProperty(v);
break;
}
case eVector3Property: {
CVector3f v(SCLY);
pProp = new CVector3Property(v);
break;
}
case eColorProperty: {
CColor v(SCLY);
pProp = new CColorProperty(v);
break;
}
case eFileProperty: {
u32 ResID = SCLY.ReadLong();
const TStringList& Extensions = static_cast<CFileTemplate*>(pPropTmp)->Extensions();
CResource *pRes = nullptr;
for (auto it = Extensions.begin(); it != Extensions.end(); it++)
{
const TString& ext = *it;
if ((ext != "MREA") && (ext != "MLVL")) // Let's avoid recursion please
if ((ext != "MREA") && (ext != "MLVL")) {
pRes = gResCache.GetResource(ResID, ext);
if (pRes) break;
}
if (pRes) break;
else
hasIgnoredExt = true;
}
pProp = new CFileProperty(pRes);
break;
}
case eStructProperty: {
CStructTemplate *StructTmp = pTemp->StructByIndex(iProp);
pProp = LoadStructMP1(SCLY, StructTmp);
break;
}
case eAnimParamsProperty: {
pProp = new CAnimParamsProperty(CAnimationParameters(SCLY, mVersion));
break;
}
default:
pProp = new CUnknownProperty();
break;
}
if (pProp)
// Property may have an incorrect extension listed - print error
if ((!pRes) && (CUniqueID(ResID).IsValid()) && (!hasIgnoredExt))
{
pProp->mpTemplate = pPropTmp;
propStruct->mProperties.push_back(pProp);
TString ExtList;
for (auto it = Extensions.begin(); it != Extensions.end(); it++)
{
if (it != Extensions.begin()) ExtList += "/";
ExtList += *it;
}
}
pFileCast->Set(pRes);
break;
}
return propStruct;
case eStructProperty: {
CPropertyStruct *pStructCast = static_cast<CPropertyStruct*>(pProp);
if (mVersion < eEchoesDemo)
LoadStructMP1(SCLY, pStructCast, static_cast<CStructTemplate*>(pStructCast->Template()));
else
LoadStructMP2(SCLY, pStructCast, static_cast<CStructTemplate*>(pTemp));
break;
}
case eArrayProperty: {
CArrayProperty *pArrayCast = static_cast<CArrayProperty*>(pProp);
u32 Size = SCLY.ReadLong();
pArrayCast->Resize(Size);
for (u32 iElem = 0; iElem < Size; iElem++)
{
if (mVersion < eEchoesDemo)
LoadStructMP1(SCLY, pArrayCast->ElementByIndex(iElem), pArrayCast->SubStructTemplate());
else
LoadStructMP2(SCLY, pArrayCast->ElementByIndex(iElem), pArrayCast->SubStructTemplate());
}
break;
}
case eCharacterProperty: {
TAnimParamsProperty *pAnimCast = static_cast<TAnimParamsProperty*>(pProp);
pAnimCast->Set(CAnimationParameters(SCLY, mVersion));
break;
}
case eUnknownProperty: {
TUnknownProperty *pUnknownCast = static_cast<TUnknownProperty*>(pProp);
std::vector<u8> Buffer(Size);
SCLY.ReadBytes(Buffer.data(), Buffer.size());
pUnknownCast->Set(Buffer);
break;
}
}
}
void CScriptLoader::LoadStructMP1(IInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp)
{
u32 StructStart = SCLY.Tell();
// Verify property count
u32 PropCount = pTemp->Count();
u32 Version = 0;
if (!pTemp->IsSingleProperty())
{
u32 FilePropCount = SCLY.ReadLong();
Version = pTemp->VersionForPropertyCount(FilePropCount);
if (Version == -1)
Log::FileWarning(SCLY.GetSourceString(), StructStart, "Struct \"" + pTemp->Name() + "\" template prop count doesn't match file");
}
// Parse properties
for (u32 iProp = 0; iProp < PropCount; iProp++)
{
IPropertyTemplate *pPropTemp = pTemp->PropertyByIndex(iProp);
IProperty *pProp = pStruct->PropertyByIndex(iProp);
if (pPropTemp->CookPreference() != eNeverCook && pPropTemp->IsInVersion(Version))
ReadProperty(pProp, 0, SCLY);
}
}
CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& SCLY)
{
u32 objStart = SCLY.Tell();
u8 type = SCLY.ReadByte();
u32 size = SCLY.ReadLong();
u32 end = SCLY.Tell() + size;
u32 ObjStart = SCLY.Tell();
u8 Type = SCLY.ReadByte();
u32 Size = SCLY.ReadLong();
u32 End = SCLY.Tell() + Size;
CScriptTemplate *pTemp = mpMaster->TemplateByID((u32) type);
CScriptTemplate *pTemp = mpMaster->TemplateByID((u32) Type);
if (!pTemp)
{
// No valid template for this object; can't load
Log::FileError(SCLY.GetSourceString(), objStart, "Invalid object ID encountered: " + TString::HexString(type));
SCLY.Seek(end, SEEK_SET);
Log::FileError(SCLY.GetSourceString(), ObjStart, "Invalid object ID encountered: " + TString::HexString(Type));
SCLY.Seek(End, SEEK_SET);
return nullptr;
}
@ -163,30 +227,24 @@ CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& SCLY)
mpObj->mInstanceID = SCLY.ReadLong();
// Load connections
u32 numLinks = SCLY.ReadLong();
mpObj->mOutConnections.reserve(numLinks);
u32 NumLinks = SCLY.ReadLong();
mpObj->mOutConnections.reserve(NumLinks);
for (u32 iLink = 0; iLink < numLinks; iLink++)
for (u32 iLink = 0; iLink < NumLinks; iLink++)
{
SLink link;
link.State = SCLY.ReadLong();
link.Message = SCLY.ReadLong();
link.ObjectID = SCLY.ReadLong();
mpObj->mOutConnections.push_back(link);
SLink Link;
Link.State = SCLY.ReadLong();
Link.Message = SCLY.ReadLong();
Link.ObjectID = SCLY.ReadLong();
mpObj->mOutConnections.push_back(Link);
}
// Load object...
u32 count = SCLY.PeekLong();
CStructTemplate *pBase = pTemp->BaseStructByCount(count);
if (!pBase) {
Log::Error(pTemp->TemplateName() + " template doesn't match file property count (" + TString::FromInt32(count) + ")");
pBase = pTemp->BaseStructByIndex(0);
}
mpObj->mpProperties = LoadStructMP1(SCLY, pBase);
CPropertyStruct *pBase = mpObj->mpProperties;
LoadStructMP1(SCLY, pBase, static_cast<CStructTemplate*>(pBase->Template()));
// Cleanup and return
SCLY.Seek(end, SEEK_SET);
SCLY.Seek(End, SEEK_SET);
mpObj->EvaluateProperties();
return mpObj;
@ -210,33 +268,37 @@ CScriptLayer* CScriptLoader::LoadLayerMP1(IInputStream &SCLY)
}
// Layer sizes are always a multiple of 32 - skip end padding before returning
u32 remaining = 32 - ((SCLY.Tell() - LayerStart) & 0x1F);
SCLY.Seek(remaining, SEEK_CUR);
u32 Remaining = 32 - ((SCLY.Tell() - LayerStart) & 0x1F);
SCLY.Seek(Remaining, SEEK_CUR);
return mpLayer;
}
void CScriptLoader::LoadStructMP2(IInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp)
{
// Verify property count
u32 propCount = pTemp->Count();
u32 StructStart = SCLY.Tell();
StructStart += 0;
u32 PropCount = pTemp->Count();
u32 Version = 0;
if (!pTemp->IsSingleProperty())
{
u16 numProperties = SCLY.ReadShort();
if ((numProperties != propCount) && (mVersion < eReturns))
Log::FileWarning(SCLY.GetSourceString(), SCLY.Tell() - 2, "Struct \"" + pTemp->Name() + "\" template property count doesn't match file");
propCount = numProperties;
u16 NumProperties = SCLY.ReadShort();
Version = pTemp->VersionForPropertyCount(NumProperties);
//if ((NumProperties != PropCount) && (mVersion < eReturns))
// Log::FileWarning(SCLY.GetSourceString(), SCLY.Tell() - 2, "Struct \"" + pTemp->Name() + "\" template property count doesn't match file");
PropCount = NumProperties;
}
// Parse properties
pStruct->Reserve(propCount);
for (u32 iProp = 0; iProp < propCount; iProp++)
for (u32 iProp = 0; iProp < PropCount; iProp++)
{
CPropertyBase *pProp;
CPropertyTemplate *pPropTemp;
u32 propertyStart = SCLY.Tell();
u32 propertyID = -1;
IProperty *pProp;
IPropertyTemplate *pPropTemp;
u32 PropertyStart = SCLY.Tell();
u32 PropertyID = -1;
u16 PropertyLength = 0;
u32 NextProperty = 0;
@ -247,170 +309,19 @@ void CScriptLoader::LoadStructMP2(IInputStream& SCLY, CPropertyStruct *pStruct,
}
else
{
propertyID = SCLY.ReadLong();
PropertyID = SCLY.ReadLong();
PropertyLength = SCLY.ReadShort();
NextProperty = SCLY.Tell() + PropertyLength;
pProp = pStruct->PropertyByID(propertyID);
pPropTemp = pTemp->PropertyByID(propertyID);
pProp = pStruct->PropertyByID(PropertyID);
pPropTemp = pTemp->PropertyByID(PropertyID);
}
if (!pPropTemp)
Log::FileError(SCLY.GetSourceString(), propertyStart, "Can't find template for property " + TString::HexString(propertyID) + " - skipping");
Log::FileError(SCLY.GetSourceString(), PropertyStart, "Can't find template for property " + TString::HexString(PropertyID) + " - skipping");
else
{
switch (pPropTemp->Type())
{
case eBoolProperty: {
CBoolProperty *pBoolCast = static_cast<CBoolProperty*>(pProp);
pBoolCast->Set( (SCLY.ReadByte() != 0) );
break;
}
case eByteProperty: {
CByteProperty *pByteCast = static_cast<CByteProperty*>(pProp);
pByteCast->Set(SCLY.ReadByte());
break;
}
case eShortProperty: {
CShortProperty *pShortCast = static_cast<CShortProperty*>(pProp);
pShortCast->Set(SCLY.ReadShort());
break;
}
case eLongProperty: {
CLongProperty *pLongCast = static_cast<CLongProperty*>(pProp);
pLongCast->Set(SCLY.ReadLong());
break;
}
case eBitfieldProperty: {
CBitfieldProperty *pBitfieldCast = static_cast<CBitfieldProperty*>(pProp);
pBitfieldCast->Set(SCLY.ReadLong());
// Validate
u32 mask = 0;
CBitfieldTemplate *pBitfieldTemp = static_cast<CBitfieldTemplate*>(pPropTemp);
for (u32 iMask = 0; iMask < pBitfieldTemp->NumFlags(); iMask++)
mask |= pBitfieldTemp->FlagMask(iMask);
u32 check = pBitfieldCast->Get() & ~mask;
if (check != 0) Log::FileWarning(SCLY.GetSourceString(), SCLY.Tell() - 4, "Bitfield property \"" + pBitfieldTemp->Name() + "\" in struct \"" + pTemp->Name() + "\" has flags set that aren't in the template: " + TString::HexString(check, true, true, 8));
break;
}
case eEnumProperty: {
CEnumProperty *pEnumCast = static_cast<CEnumProperty*>(pProp);
CEnumTemplate *pEnumTemp = static_cast<CEnumTemplate*>(pPropTemp);
u32 ID = SCLY.ReadLong();
u32 index = pEnumTemp->EnumeratorIndex(ID);
if (index == -1) Log::FileError(SCLY.GetSourceString(), SCLY.Tell() - 4, "Enum property \"" + pEnumTemp->Name() + "\" in struct \"" + pTemp->Name() + "\" has invalid enumerator value: " + TString::HexString(ID, true, true, 8));
pEnumCast->Set(index);
break;
}
case eFloatProperty: {
CFloatProperty *pFloatCast = static_cast<CFloatProperty*>(pProp);
pFloatCast->Set(SCLY.ReadFloat());
break;
}
case eStringProperty: {
CStringProperty *pStringCast = static_cast<CStringProperty*>(pProp);
pStringCast->Set(SCLY.ReadString());
break;
}
case eVector3Property: {
CVector3Property *pVector3Cast = static_cast<CVector3Property*>(pProp);
pVector3Cast->Set(CVector3f(SCLY));
break;
}
case eColorProperty: {
CColorProperty *pColorCast = static_cast<CColorProperty*>(pProp);
pColorCast->Set(CColor(SCLY));
break;
}
case eFileProperty: {
CFileProperty *pFileCast = static_cast<CFileProperty*>(pProp);
CUniqueID ResID = (mVersion < eCorruptionProto ? SCLY.ReadLong() : SCLY.ReadLongLong());
const TStringList& Extensions = static_cast<CFileTemplate*>(pPropTemp)->Extensions();
CResource *pRes = nullptr;
// Check for each extension individually until we find a match
// This could be done better with a function to fetch the extension given the resource ID
// and a "does resource exist" function, but this will do for now
bool hasIgnoredExt = false;
if (ResID.IsValid())
{
for (auto it = Extensions.begin(); it != Extensions.end(); it++)
{
const TString& ext = *it;
if ((ext != "MREA") && (ext != "MLVL")) {
pRes = gResCache.GetResource(ResID, ext);
if (pRes) break;
}
else
hasIgnoredExt = true;
}
}
// Property may have an incorrect extension listed - print error
if ((!pRes) && (CUniqueID(ResID).IsValid()) && (!hasIgnoredExt))
{
TString ExtList;
for (auto it = Extensions.begin(); it != Extensions.end(); it++)
{
if (it != Extensions.begin()) ExtList += "/";
ExtList += *it;
}
Log::FileWarning(SCLY.GetSourceString(), "Incorrect resource type? " + ExtList + " " + TString::HexString(propertyID));
}
pFileCast->Set(pRes);
break;
}
case eUnknownProperty: {
CUnknownProperty *pUnknownCast = static_cast<CUnknownProperty*>(pProp);
std::vector<u8> buf(PropertyLength);
SCLY.ReadBytes(buf.data(), buf.size());
pUnknownCast->Set(buf);
break;
}
case eStructProperty: {
CPropertyStruct *pStructCast = static_cast<CPropertyStruct*>(pProp);
LoadStructMP2(SCLY, pStructCast, static_cast<CStructTemplate*>(pPropTemp));
break;
}
case eArrayProperty: {
CArrayProperty *pArrayCast = static_cast<CArrayProperty*>(pProp);
std::vector<u8> buf(PropertyLength);
SCLY.ReadBytes(buf.data(), buf.size());
pArrayCast->Set(buf);
break;
}
case eAnimParamsProperty: {
CAnimParamsProperty *pAnimCast = static_cast<CAnimParamsProperty*>(pProp);
pAnimCast->Set(CAnimationParameters(SCLY, mVersion));
break;
}
}
}
ReadProperty(pProp, PropertyLength, SCLY);
if (NextProperty > 0)
SCLY.Seek(NextProperty, SEEK_SET);
@ -443,20 +354,16 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& SCLY)
for (u32 iCon = 0; iCon < NumConnections; iCon++)
{
SLink con;
con.State = SCLY.ReadLong();
con.Message = SCLY.ReadLong();
con.ObjectID = SCLY.ReadLong();
mpObj->mOutConnections.push_back(con);
SLink Link;
Link.State = SCLY.ReadLong();
Link.Message = SCLY.ReadLong();
Link.ObjectID = SCLY.ReadLong();
mpObj->mOutConnections.push_back(Link);
}
// Load object
SCLY.Seek(0x6, SEEK_CUR); // Skip base struct ID + size
u16 numProps = SCLY.PeekShort();
mpObj->CopyFromTemplate(pTemplate, (u32) numProps);
CStructTemplate *pBase = pTemplate->BaseStructByCount(numProps);
LoadStructMP2(SCLY, mpObj->mpProperties, pBase);
LoadStructMP2(SCLY, mpObj->mpProperties, mpObj->mpTemplate->BaseStruct());
// Cleanup and return
SCLY.Seek(ObjEnd, SEEK_SET);
@ -466,14 +373,30 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& SCLY)
CScriptLayer* CScriptLoader::LoadLayerMP2(IInputStream& SCLY)
{
CFourCC SCLY_Magic(SCLY);
bool IsSCGN = false;
if (SCLY_Magic == "SCLY") SCLY.Seek(0x6, SEEK_CUR);
else if (SCLY_Magic == "SCGN") SCLY.Seek(0x2, SEEK_CUR);
if (mVersion >= eEchoes)
{
CFourCC SCLY_Magic(SCLY);
if (SCLY_Magic == "SCLY")
{
SCLY.Seek(0x6, SEEK_CUR);
}
else if (SCLY_Magic == "SCGN")
{
SCLY.Seek(0x2, SEEK_CUR);
IsSCGN = true;
}
else
{
Log::FileError(SCLY.GetSourceString(), SCLY.Tell() - 4, "Invalid script layer magic: " + TString::HexString((u32) SCLY_Magic.ToLong()));
return nullptr;
}
}
else
{
Log::FileError(SCLY.GetSourceString(), SCLY.Tell() - 4, "Invalid script layer magic: " + TString::HexString((u32) SCLY_Magic.ToLong()));
return nullptr;
SCLY.Seek(0x1, SEEK_CUR);
}
u32 NumObjects = SCLY.ReadLong();
@ -488,7 +411,7 @@ CScriptLayer* CScriptLoader::LoadLayerMP2(IInputStream& SCLY)
mpLayer->AddObject(pObj);
}
if (SCLY_Magic == "SCGN")
if (IsSCGN)
{
mpLayer->SetName("Generated");
mpLayer->SetActive(true);
@ -496,13 +419,13 @@ CScriptLayer* CScriptLoader::LoadLayerMP2(IInputStream& SCLY)
return mpLayer;
}
CScriptLayer* CScriptLoader::LoadLayer(IInputStream &SCLY, CGameArea *pArea, EGame version)
CScriptLayer* CScriptLoader::LoadLayer(IInputStream &SCLY, CGameArea *pArea, EGame Version)
{
if (!SCLY.IsValid()) return nullptr;
CScriptLoader Loader;
Loader.mVersion = version;
Loader.mpMaster = CMasterTemplate::GetMasterForGame(version);
Loader.mVersion = Version;
Loader.mpMaster = CMasterTemplate::GetMasterForGame(Version);
Loader.mpArea = pArea;
if (!Loader.mpMaster)
@ -511,7 +434,10 @@ CScriptLayer* CScriptLoader::LoadLayer(IInputStream &SCLY, CGameArea *pArea, EGa
return nullptr;
}
if (version <= ePrime)
if (!Loader.mpMaster->IsLoadedSuccessfully())
CTemplateLoader::LoadGameTemplates(Version);
if (Version <= ePrime)
return Loader.LoadLayerMP1(SCLY);
else
return Loader.LoadLayerMP2(SCLY);

View File

@ -16,8 +16,9 @@ class CScriptLoader
CMasterTemplate *mpMaster;
CScriptLoader();
void ReadProperty(IProperty *pProp, u32 Size, IInputStream& SCLY);
CPropertyStruct* LoadStructMP1(IInputStream& SCLY, CStructTemplate *tmp);
void LoadStructMP1(IInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp);
CScriptObject* LoadObjectMP1(IInputStream& SCLY);
CScriptLayer* LoadLayerMP1(IInputStream& SCLY);

View File

@ -3,7 +3,7 @@
#include "Core/Resource/CStringTable.h"
#include "Core/Resource/CResCache.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/TResPtr.h"
class CStringLoader

File diff suppressed because it is too large Load Diff

View File

@ -7,29 +7,44 @@
class CTemplateLoader
{
static const TString mskTemplatesDir;
static const TString mskGameListPath;
CMasterTemplate *mpMaster;
TString mTemplatesDir;
TString mMasterDir;
// Constructor
CTemplateLoader(const TString& templatesDir) : mTemplatesDir(templatesDir) {}
CTemplateLoader(const TString& rkTemplatesDir)
: mTemplatesDir(rkTemplatesDir) {}
// Load Property
void LoadBitFlags(tinyxml2::XMLElement *pElem, CBitfieldTemplate *pTemp, const TString& templateName);
void LoadEnumerators(tinyxml2::XMLElement *pElem, CEnumTemplate *pTemp, const TString& templateName);
void LoadStructProperties(tinyxml2::XMLElement *pElem, CStructTemplate *pTemp, const TString& templateName);
CPropertyTemplate* LoadPropertyTemplate(tinyxml2::XMLElement *pElem, const TString& templateName);
IPropertyTemplate* LoadProperty(tinyxml2::XMLElement *pElem, CStructTemplate *pParentStruct, const TString& rkTemplateName);
IPropertyTemplate* CreateProperty(u32 ID, EPropertyType Type, const TString& rkName, CStructTemplate *pStruct);
void LoadStructTemplate(const TString& rkTemplateFileName, CStructTemplate *pStruct);
void LoadEnumTemplate(const TString& rkTemplateFileName, CEnumTemplate *pEnum);
void LoadBitfieldTemplate(const TString& rkTemplateFileName, CBitfieldTemplate *pBitfield);
void LoadProperties(tinyxml2::XMLElement *pPropertiesElem, CStructTemplate *pStruct, const TString& rkTemplateName);
void LoadEnumerators(tinyxml2::XMLElement *pEnumeratorsElem, CEnumTemplate *pEnum, const TString& rkTemplateName);
void LoadBitFlags(tinyxml2::XMLElement *pFlagsElem, CBitfieldTemplate *pBitfield, const TString& rkTemplateName);
// Load Script Object
CScriptTemplate* LoadScriptTemplate(tinyxml2::XMLDocument *pDoc, const TString& templateName, u32 objectID);
CScriptTemplate* LoadScriptTemplate(tinyxml2::XMLDocument *pDoc, const TString& rkTemplateName, u32 ObjectID);
// Load Master
void LoadMasterTemplate(tinyxml2::XMLDocument *pDoc);
void LoadPropertyList(tinyxml2::XMLDocument *pDoc, const TString& listName);
CMasterTemplate* LoadGame(tinyxml2::XMLNode *pNode);
CMasterTemplate* LoadGameInfo(tinyxml2::XMLNode *pNode);
void LoadMasterTemplate(tinyxml2::XMLDocument *pDoc, CMasterTemplate *pMaster);
void LoadPropertyList(tinyxml2::XMLDocument *pDoc, const TString& rkListName);
// Utility
static void OpenXML(const TString& rkPath, tinyxml2::XMLDocument& rDoc);
static TString ErrorName(tinyxml2::XMLError Error);
public:
static void LoadGameList();
static void LoadGameTemplates(EGame Game);
};
#endif // CTEMPLATELOADER_H

View File

@ -9,9 +9,8 @@ CWorldLoader::CWorldLoader()
void CWorldLoader::LoadPrimeMLVL(IInputStream& MLVL)
{
/**
/*
* This function loads MLVL files from Prime 1/2
* Corruption isn't too different, but having to check for it on every file ID is obnoxious
* We start immediately after the "version" value (0x8 in the file)
*/
// Header
@ -19,8 +18,8 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& MLVL)
{
mpWorld->mpWorldName = gResCache.GetResource(MLVL.ReadLong(), "STRG");
if (mVersion == eEchoes) mpWorld->mpDarkWorldName = gResCache.GetResource(MLVL.ReadLong(), "STRG");
if (mVersion > ePrime) mpWorld->mUnknown1 = MLVL.ReadLong();
if (mVersion >= ePrime) mpWorld->mpSaveWorld = gResCache.GetResource(MLVL.ReadLong(), "SAVW");
if (mVersion >= eEchoes) mpWorld->mUnknown1 = MLVL.ReadLong();
if (mVersion >= ePrime) mpWorld->mpSaveWorld = gResCache.GetResource(MLVL.ReadLong(), "SAVW");
mpWorld->mpDefaultSkybox = gResCache.GetResource(MLVL.ReadLong(), "CMDL");
}
@ -146,7 +145,7 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& MLVL)
}
// Rels
if (mVersion == eEchoes)
if ( (mVersion == eEchoesDemo) || (mVersion == eEchoes) )
{
u32 NumRels = MLVL.ReadLong();
pArea->RelFilenames.resize(NumRels);
@ -154,15 +153,18 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& MLVL)
for (u32 iRel = 0; iRel < NumRels; iRel++)
pArea->RelFilenames[iRel] = MLVL.ReadString();
u32 NumRelOffsets = MLVL.ReadLong(); // Don't know what these offsets correspond to
pArea->RelOffsets.resize(NumRelOffsets);
if (mVersion == eEchoes)
{
u32 NumRelOffsets = MLVL.ReadLong(); // Don't know what these offsets correspond to
pArea->RelOffsets.resize(NumRelOffsets);
for (u32 iOff = 0; iOff < NumRelOffsets; iOff++)
pArea->RelOffsets[iOff] = MLVL.ReadLong();
for (u32 iOff = 0; iOff < NumRelOffsets; iOff++)
pArea->RelOffsets[iOff] = MLVL.ReadLong();
}
}
// Footer
if (mVersion >= eEchoes)
if (mVersion >= eEchoesDemo)
pArea->InternalName = MLVL.ReadString();
}

View File

@ -3,7 +3,7 @@
#include "Core/Resource/CWorld.h"
#include "Core/Resource/CResCache.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include <FileIO/FileIO.h>

View File

@ -20,6 +20,23 @@ EGame CMasterTemplate::GetGame()
return mGame;
}
u32 CMasterTemplate::NumGameVersions()
{
if (mGameVersions.empty()) return 1;
else return mGameVersions.size();
}
u32 CMasterTemplate::GetGameVersion(TString VersionName)
{
VersionName = VersionName.ToLower();
for (u32 iVer = 0; iVer < mGameVersions.size(); iVer++)
if (mGameVersions[iVer].ToLower() == VersionName)
return iVer;
return -1;
}
CScriptTemplate* CMasterTemplate::TemplateByID(u32 ObjectID)
{
auto it = mTemplates.find(ObjectID);
@ -83,14 +100,14 @@ TString CMasterTemplate::MessageByIndex(u32 Index)
return (std::next(it, Index))->second;
}
CPropertyTemplate* CMasterTemplate::GetProperty(u32 PropertyID)
TString CMasterTemplate::PropertyName(u32 PropertyID)
{
auto it = mPropertyList.find(PropertyID);
auto it = mPropertyNames.find(PropertyID);
if (it != mPropertyList.end())
if (it != mPropertyNames.end())
return it->second;
else
return nullptr;
return "Unknown";
}
bool CMasterTemplate::HasPropertyList()

View File

@ -2,7 +2,7 @@
#define CMASTERTEMPLATE_H
#include "CScriptTemplate.h"
#include "Core/Resource/EFormatVersion.h"
#include "Core/Resource/EGame.h"
#include <Common/types.h>
#include <map>
@ -17,12 +17,13 @@ class CMasterTemplate
u32 mVersion;
bool mFullyLoaded;
std::vector<TString> mGameVersions;
std::map<u32, CScriptTemplate*> mTemplates;
std::map<u32, TString> mStates;
std::map<u32, TString> mMessages;
bool mHasPropList;
std::map<u32, CPropertyTemplate*> mPropertyList;
std::map<u32, TString> mPropertyNames;
static std::map<EGame, CMasterTemplate*> smMasterMap;
static u32 smGameListVersion;
@ -31,6 +32,8 @@ public:
CMasterTemplate();
~CMasterTemplate();
EGame GetGame();
u32 NumGameVersions();
u32 GetGameVersion(TString VersionName);
u32 NumScriptTemplates();
u32 NumStates();
u32 NumMessages();
@ -43,7 +46,7 @@ public:
TString MessageByID(u32 MessageID);
TString MessageByID(const CFourCC& MessageID);
TString MessageByIndex(u32 Index);
CPropertyTemplate* GetProperty(u32 PropertyID);
TString PropertyName(u32 PropertyID);
bool HasPropertyList();
bool IsLoadedSuccessfully();

View File

@ -1,123 +0,0 @@
#include "CProperty.h"
// ************ CPropertyStruct ************
CPropertyStruct::~CPropertyStruct()
{
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
delete *it;
}
CPropertyBase* CPropertyStruct::PropertyByIndex(u32 index)
{
return mProperties[index];
}
CPropertyBase* CPropertyStruct::PropertyByID(u32 ID)
{
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
{
if ((*it)->ID() == ID)
return *it;
}
return nullptr;
}
CPropertyBase* CPropertyStruct::PropertyByIDString(const TIDString& str)
{
// Resolve namespace
u32 nsStart = str.IndexOf(":");
// String has namespace; the requested property is within a struct
if (nsStart != -1)
{
TString strStructID = str.Truncate(nsStart);
if (!strStructID.IsHexString()) return nullptr;
u32 structID = strStructID.ToInt32();
TString propName = str.ChopFront(nsStart + 1);
CPropertyStruct *pStruct = StructByID(structID);
if (!pStruct) return nullptr;
else return pStruct->PropertyByIDString(propName);
}
// No namespace; fetch the property from this struct
else
{
if (str.IsHexString())
return PropertyByID(str.ToInt32());
else
return nullptr;
}
}
CPropertyStruct* CPropertyStruct::StructByIndex(u32 index)
{
CPropertyBase *pProp = PropertyByIndex(index);
if (pProp->Type() == eStructProperty)
return static_cast<CPropertyStruct*>(pProp);
else
return nullptr;
}
CPropertyStruct* CPropertyStruct::StructByID(u32 ID)
{
CPropertyBase *pProp = PropertyByID(ID);
if (pProp->Type() == eStructProperty)
return static_cast<CPropertyStruct*>(pProp);
else
return nullptr;
}
CPropertyStruct* CPropertyStruct::StructByIDString(const TIDString& str)
{
CPropertyBase *pProp = PropertyByIDString(str);
if (pProp->Type() == eStructProperty)
return static_cast<CPropertyStruct*>(pProp);
else
return nullptr;
}
// ************ STATIC ************
CPropertyStruct* CPropertyStruct::CopyFromTemplate(CStructTemplate *pTemp)
{
CPropertyStruct *pStruct = new CPropertyStruct();
pStruct->mpTemplate = pTemp;
pStruct->Reserve(pTemp->Count());
for (u32 iProp = 0; iProp < pTemp->Count(); iProp++)
{
CPropertyTemplate *pPropTemp = pTemp->PropertyByIndex(iProp);
CPropertyBase *pProp = nullptr;
switch (pPropTemp->Type())
{
case eBoolProperty: pProp = new CBoolProperty(false); break;
case eByteProperty: pProp = new CByteProperty(0); break;
case eShortProperty: pProp = new CShortProperty(0); break;
case eLongProperty: pProp = new CLongProperty(0); break;
case eEnumProperty: pProp = new CEnumProperty(0); break;
case eBitfieldProperty: pProp = new CBitfieldProperty(0); break;
case eFloatProperty: pProp = new CFloatProperty(0.f); break;
case eStringProperty: pProp = new CStringProperty(""); break;
case eVector3Property: pProp = new CVector3Property(CVector3f::skZero); break;
case eColorProperty: pProp = new CColorProperty(CColor::skBlack); break;
case eFileProperty: pProp = new CFileProperty(); break;
case eArrayProperty: pProp = new CArrayProperty(); break;
case eAnimParamsProperty: pProp = new CAnimParamsProperty(); break;
case eUnknownProperty: pProp = new CUnknownProperty(); break;
case eStructProperty: pProp = CPropertyStruct::CopyFromTemplate(static_cast<CStructTemplate*>(pPropTemp)); break;
}
if (pProp)
{
pProp->SetTemplate(pPropTemp);
pStruct->mProperties.push_back(pProp);
}
}
return pStruct;
}

View File

@ -1,101 +0,0 @@
#ifndef CPROPERTY
#define CPROPERTY
/* This header file declares some classes used to track script object properties
* CPropertyBase, __CProperty (and typedefs), CPropertyStruct
* It's a bit hard to read, should be reorganized at some point */
#include "CPropertyTemplate.h"
#include "EPropertyType.h"
#include "Core/Resource/CResource.h"
#include "Core/Resource/TResPtr.h"
#include "Core/Resource/CAnimationParameters.h"
#include <Common/CColor.h>
#include <Common/TString.h>
#include <Math/CVector3f.h>
#include <list>
class CScriptTemplate;
typedef TString TIDString;
/*
* CPropertyBase is the base class, containing just some virtual function definitions
* Virtual destructor is mainly there to make cleanup easy; don't need to cast to delete
*/
class CPropertyBase
{
friend class CScriptLoader;
protected:
CPropertyTemplate *mpTemplate;
public:
virtual ~CPropertyBase() {}
inline virtual EPropertyType Type() = 0;
inline CPropertyTemplate *Template() { return mpTemplate; }
inline void SetTemplate(CPropertyTemplate *_tmp) { mpTemplate = _tmp; }
inline TString Name() { return mpTemplate->Name(); }
inline u32 ID() { return mpTemplate->PropertyID(); }
};
/*
* __CProperty is a template subclass for actual properties.
* Don't use this class directly. Typedefs are provided for every possible property type.
*/
template <typename t, EPropertyType type>
class __CProperty : public CPropertyBase
{
friend class CScriptLoader;
t mValue;
public:
__CProperty() {}
__CProperty(t v) { Set(v); }
~__CProperty() {}
inline EPropertyType Type() { return type; }
inline t Get() { return mValue; }
inline void Set(t v) { mValue = v; }
};
typedef __CProperty<bool, eBoolProperty> CBoolProperty;
typedef __CProperty<char, eByteProperty> CByteProperty;
typedef __CProperty<short, eShortProperty> CShortProperty;
typedef __CProperty<long, eLongProperty> CLongProperty;
typedef __CProperty<long, eEnumProperty> CEnumProperty;
typedef __CProperty<long, eBitfieldProperty> CBitfieldProperty;
typedef __CProperty<float, eFloatProperty> CFloatProperty;
typedef __CProperty<TString, eStringProperty> CStringProperty;
typedef __CProperty<CVector3f, eVector3Property> CVector3Property;
typedef __CProperty<CColor, eColorProperty> CColorProperty;
typedef __CProperty<TResPtr<CResource>, eFileProperty> CFileProperty;
typedef __CProperty<CAnimationParameters, eAnimParamsProperty> CAnimParamsProperty;
typedef __CProperty<std::vector<u8>, eArrayProperty> CArrayProperty;
typedef __CProperty<std::vector<u8>, eUnknownProperty> CUnknownProperty;
/*
* CPropertyStruct is for defining structs of properties.
*/
class CPropertyStruct : public CPropertyBase
{
friend class CScriptLoader;
std::vector<CPropertyBase*> mProperties;
public:
// Destructor simply iterates through the list and deletes them. Nothing complicated.
~CPropertyStruct();
// Inline
EPropertyType Type() { return eStructProperty; }
inline u32 Count() { return mProperties.size(); }
inline void Reserve(u32 amount) { mProperties.reserve(amount); }
inline CPropertyBase* operator[](u32 index) { return mProperties[index]; }
// Functions
CPropertyBase* PropertyByIndex(u32 index);
CPropertyBase* PropertyByID(u32 ID);
CPropertyBase* PropertyByIDString(const TIDString& str);
CPropertyStruct* StructByIndex(u32 index);
CPropertyStruct* StructByID(u32 ID);
CPropertyStruct* StructByIDString(const TIDString& str);
// Static
static CPropertyStruct* CopyFromTemplate(CStructTemplate *pTemp);
};
#endif // CPROPERTY

View File

@ -1,175 +0,0 @@
#include "CPropertyTemplate.h"
#include <iostream>
EPropertyType PropStringToPropEnum(const TString& prop)
{
if (prop == "bool") return eBoolProperty;
if (prop == "byte") return eByteProperty;
if (prop == "short") return eShortProperty;
if (prop == "long") return eLongProperty;
if (prop == "enum") return eEnumProperty;
if (prop == "bitfield") return eBitfieldProperty;
if (prop == "float") return eFloatProperty;
if (prop == "string") return eStringProperty;
if (prop == "color") return eColorProperty;
if (prop == "vector3f") return eVector3Property;
if (prop == "file") return eFileProperty;
if (prop == "struct") return eStructProperty;
if (prop == "array") return eArrayProperty;
if (prop == "animparams") return eAnimParamsProperty;
if (prop == "unknown") return eUnknownProperty;
return eInvalidProperty;
}
TString PropEnumToPropString(EPropertyType prop)
{
switch (prop)
{
case eBoolProperty: return "bool";
case eByteProperty: return "byte";
case eShortProperty: return "short";
case eLongProperty: return "long";
case eEnumProperty: return "enum";
case eBitfieldProperty: return "bitfield";
case eFloatProperty: return "float";
case eStringProperty: return "string";
case eColorProperty: return "color";
case eVector3Property: return "vector3f";
case eFileProperty: return "file";
case eStructProperty: return "struct";
case eArrayProperty: return "array";
case eAnimParamsProperty: return "animparams";
case eUnknownProperty: return "unknown";
case eInvalidProperty:
default:
return "invalid";
}
}
/*******************
* CStructTemplate *
*******************/
CStructTemplate::CStructTemplate() : CPropertyTemplate(-1)
{
mIsSingleProperty = false;
mPropType = eStructProperty;
}
CStructTemplate::~CStructTemplate()
{
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
delete *it;
}
// ************ GETTERS ************
EPropertyType CStructTemplate::Type() const
{
return eStructProperty;
}
bool CStructTemplate::IsSingleProperty() const
{
return mIsSingleProperty;
}
u32 CStructTemplate::Count() const
{
return mProperties.size();
}
CPropertyTemplate* CStructTemplate::PropertyByIndex(u32 index)
{
if (mProperties.size() > index)
return mProperties[index];
else
return nullptr;
}
CPropertyTemplate* CStructTemplate::PropertyByID(u32 ID)
{
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
{
if ((*it)->PropertyID() == ID)
return *it;
}
return nullptr;
}
CPropertyTemplate* CStructTemplate::PropertyByIDString(const TIDString& str)
{
// Resolve namespace
u32 nsStart = str.IndexOf(":");
u32 propStart = nsStart + 1;
// String has namespace; the requested property is within a struct
if (nsStart != -1)
{
TString strStructID = str.SubString(0, nsStart);
if (!strStructID.IsHexString()) return nullptr;
u32 structID = strStructID.ToInt32();
TString propName = str.SubString(propStart, str.Length() - propStart);
CStructTemplate *pStruct = StructByID(structID);
if (!pStruct) return nullptr;
else return pStruct->PropertyByIDString(propName);
}
// No namespace; fetch the property from this struct
else
{
// ID string lookup
if (str.IsHexString())
return PropertyByID(str.ToInt32());
else
return nullptr;
}
}
CStructTemplate* CStructTemplate::StructByIndex(u32 index)
{
CPropertyTemplate *pProp = PropertyByIndex(index);
if (pProp->Type() == eStructProperty)
return static_cast<CStructTemplate*>(pProp);
else
return nullptr;
}
CStructTemplate* CStructTemplate::StructByID(u32 ID)
{
CPropertyTemplate *pProp = PropertyByID(ID);
if (pProp && pProp->Type() == eStructProperty)
return static_cast<CStructTemplate*>(pProp);
else
return nullptr;
}
CStructTemplate* CStructTemplate::StructByIDString(const TString& str)
{
CPropertyTemplate *pProp = PropertyByIDString(str);
if (pProp && pProp->Type() == eStructProperty)
return static_cast<CStructTemplate*>(pProp);
else
return nullptr;
}
// ************ DEBUG ************
void CStructTemplate::DebugPrintProperties(TString base)
{
base = base + Name() + "::";
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
{
CPropertyTemplate *tmp = *it;
if (tmp->Type() == eStructProperty)
{
CStructTemplate *tmp2 = static_cast<CStructTemplate*>(tmp);
tmp2->DebugPrintProperties(base);
}
else
std::cout << base << tmp->Name() << "\n";
}
}

View File

@ -1,219 +0,0 @@
#ifndef CPROPERTYTEMPLATE
#define CPROPERTYTEMPLATE
#include "EPropertyType.h"
#include <Common/TString.h>
#include <Common/types.h>
#include <vector>
typedef TString TIDString;
class CPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
protected:
EPropertyType mPropType;
TString mPropName;
u32 mPropID;
public:
CPropertyTemplate(u32 ID)
: mPropID(ID)
{
}
CPropertyTemplate(EPropertyType type, TString name, u32 ID)
: mPropType(type),
mPropName(name),
mPropID(ID)
{
}
virtual EPropertyType Type() const
{
return mPropType;
}
inline TString Name() const
{
return mPropName;
}
inline u32 PropertyID() const
{
return mPropID;
}
inline void SetName(const TString& Name)
{
mPropName = Name;
}
};
class CFileTemplate : public CPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
TStringList mAcceptedExtensions;
public:
CFileTemplate(u32 ID) : CPropertyTemplate(ID) { mPropType = eFileProperty; }
CFileTemplate(const TString& name, u32 ID, const TStringList& extensions)
: CPropertyTemplate(ID)
{
mPropType = eFileProperty;
mPropName = name;
mAcceptedExtensions = extensions;
}
EPropertyType Type() const
{
return eFileProperty;
}
const TStringList& Extensions() const
{
return mAcceptedExtensions;
}
};
class CEnumTemplate : public CPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
struct SEnumerator
{
TString Name;
u32 ID;
SEnumerator(const TString& _name, u32 _ID)
: Name(_name), ID(_ID) {}
};
std::vector<SEnumerator> mEnumerators;
TString mSourceFile;
public:
CEnumTemplate(u32 ID)
: CPropertyTemplate(ID)
{
mPropType = eEnumProperty;
}
CEnumTemplate(const TString& name, u32 ID)
: CPropertyTemplate(eEnumProperty, name, ID)
{}
EPropertyType Type() const
{
return eEnumProperty;
}
u32 NumEnumerators()
{
return mEnumerators.size();
}
u32 EnumeratorIndex(u32 enumID)
{
for (u32 iEnum = 0; iEnum < mEnumerators.size(); iEnum++)
{
if (mEnumerators[iEnum].ID == enumID)
return iEnum;
}
return -1;
}
u32 EnumeratorID(u32 enumIndex)
{
if (mEnumerators.size() > enumIndex)
return mEnumerators[enumIndex].ID;
else return -1;
}
TString EnumeratorName(u32 enumIndex)
{
if (mEnumerators.size() > enumIndex)
return mEnumerators[enumIndex].Name;
else return "INVALID ENUM INDEX";
}
};
class CBitfieldTemplate : public CPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
struct SBitFlag
{
TString Name;
u32 Mask;
SBitFlag(const TString& _name, u32 _mask)
: Name(_name), Mask(_mask) {}
};
std::vector<SBitFlag> mBitFlags;
TString mSourceFile;
public:
CBitfieldTemplate(u32 ID)
: CPropertyTemplate(ID)
{
mPropType = eBitfieldProperty;
}
CBitfieldTemplate(const TString& name, u32 ID)
: CPropertyTemplate(eBitfieldProperty, name, ID)
{}
EPropertyType Type() const
{
return eBitfieldProperty;
}
u32 NumFlags()
{
return mBitFlags.size();
}
TString FlagName(u32 index)
{
return mBitFlags[index].Name;
}
u32 FlagMask(u32 index)
{
return mBitFlags[index].Mask;
}
};
class CStructTemplate : public CPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
bool mIsSingleProperty;
std::vector<CPropertyTemplate*> mProperties;
TString mSourceFile;
public:
CStructTemplate();
~CStructTemplate();
EPropertyType Type() const;
bool IsSingleProperty() const;
u32 Count() const;
CPropertyTemplate* PropertyByIndex(u32 index);
CPropertyTemplate* PropertyByID(u32 ID);
CPropertyTemplate* PropertyByIDString(const TIDString& str);
CStructTemplate* StructByIndex(u32 index);
CStructTemplate* StructByID(u32 ID);
CStructTemplate* StructByIDString(const TIDString& str);
void DebugPrintProperties(TString base);
};
#endif // CPROPERTYTEMPLATE

View File

@ -3,16 +3,16 @@
#include "Core/Resource/CAnimSet.h"
CScriptObject::CScriptObject(CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate)
: mpTemplate(pTemplate)
, mpArea(pArea)
, mpLayer(pLayer)
, mVersion(0)
, mpDisplayModel(nullptr)
, mpCollision(nullptr)
, mHasInGameModel(false)
{
mpTemplate = pTemplate;
mpArea = pArea;
mpLayer = pLayer;
mpProperties = nullptr;
mpTemplate->AddObject(this);
mpDisplayModel = nullptr;
mpBillboard = nullptr;
mpCollision = nullptr;
mHasInGameModel = false;
mpProperties = (CPropertyStruct*) pTemplate->BaseStruct()->InstantiateProperty();
}
CScriptObject::~CScriptObject()
@ -22,14 +22,7 @@ CScriptObject::~CScriptObject()
}
// ************ DATA MANIPULATION ************
void CScriptObject::CopyFromTemplate(CScriptTemplate *pTemp, u32 propCount)
{
CStructTemplate *pBaseStruct = pTemp->BaseStructByCount(propCount);
delete mpProperties;
mpProperties = CPropertyStruct::CopyFromTemplate(pBaseStruct);
}
void CScriptObject::EvaluateProperties()
void CScriptObject::EvaluateProperties()
{
mpInstanceName = mpTemplate->FindInstanceName(mpProperties);
mpPosition = mpTemplate->FindPosition(mpProperties);
@ -61,12 +54,12 @@ void CScriptObject::EvaluateCollisionModel()
}
// ************ GETTERS ************
CPropertyBase* CScriptObject::PropertyByIndex(u32 index) const
IProperty* CScriptObject::PropertyByIndex(u32 index) const
{
return mpProperties->PropertyByIndex(index);
}
CPropertyBase* CScriptObject::PropertyByIDString(const TString& str) const
IProperty* CScriptObject::PropertyByIDString(const TString& str) const
{
return mpProperties->PropertyByIDString(str);
}
@ -91,6 +84,11 @@ CScriptLayer* CScriptObject::Layer() const
return mpLayer;
}
u32 CScriptObject::Version() const
{
return mVersion;
}
CPropertyStruct* CScriptObject::Properties() const
{
return mpProperties;

View File

@ -2,8 +2,8 @@
#define CSCRIPTOBJECT_H
#include "SConnection.h"
#include "CProperty.h"
#include "CPropertyTemplate.h"
#include "IProperty.h"
#include "IPropertyTemplate.h"
#include "CScriptTemplate.h"
#include "Core/Resource/Model/CModel.h"
#include "Core/Resource/CCollisionMeshGroup.h"
@ -19,17 +19,18 @@ class CScriptObject
CScriptTemplate *mpTemplate;
TResPtr<CGameArea> mpArea;
CScriptLayer *mpLayer;
u32 mVersion;
u32 mInstanceID;
std::vector<SLink> mOutConnections;
std::vector<SLink> mInConnections;
CPropertyStruct *mpProperties;
CStringProperty *mpInstanceName;
CVector3Property *mpPosition;
CVector3Property *mpRotation;
CVector3Property *mpScale;
CBoolProperty *mpActive;
TStringProperty *mpInstanceName;
TVector3Property *mpPosition;
TVector3Property *mpRotation;
TVector3Property *mpScale;
TBoolProperty *mpActive;
CPropertyStruct *mpLightParameters;
TResPtr<CModel> mpDisplayModel;
TResPtr<CTexture> mpBillboard;
@ -43,7 +44,6 @@ public:
CScriptObject(CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate);
~CScriptObject();
void CopyFromTemplate(CScriptTemplate *pTemp, u32 propCount);
void EvaluateProperties();
void EvaluateDisplayModel();
void EvaluateBillboard();
@ -53,10 +53,11 @@ public:
CMasterTemplate* MasterTemplate() const;
CGameArea* Area() const;
CScriptLayer* Layer() const;
u32 Version() const;
CPropertyStruct* Properties() const;
u32 NumProperties() const;
CPropertyBase* PropertyByIndex(u32 index) const;
CPropertyBase* PropertyByIDString(const TIDString& str) const;
IProperty* PropertyByIndex(u32 index) const;
IProperty* PropertyByIDString(const TIDString& str) const;
u32 ObjectTypeID() const;
u32 InstanceID() const;
u32 NumInLinks() const;

View File

@ -9,18 +9,18 @@
#include <string>
CScriptTemplate::CScriptTemplate(CMasterTemplate *pMaster)
: mpMaster(pMaster)
, mpBaseStruct(nullptr)
, mVisible(true)
, mPreviewScale(1.f)
, mVolumeShape(eNoShape)
, mVolumeScale(1.f)
{
mpMaster = pMaster;
mVisible = true;
mPreviewScale = 1.f;
mVolumeScale = 1.f;
mVolumeShape = eNoShape;
}
CScriptTemplate::~CScriptTemplate()
{
for (u32 iSet = 0; iSet < mPropertySets.size(); iSet++)
delete mPropertySets[iSet].pBaseStruct;
delete mpBaseStruct;
}
CMasterTemplate* CScriptTemplate::MasterTemplate()
@ -33,41 +33,9 @@ EGame CScriptTemplate::Game()
return mpMaster->GetGame();
}
TString CScriptTemplate::TemplateName(s32 propCount) const
TString CScriptTemplate::TemplateName() const
{
// Return original name if there is only one property set
// or if caller doesn't want to distinguish between sets
if ((NumPropertySets() == 1) || (propCount == -1))
return mTemplateName;
// Otherwise we return the template name with the set name appended
for (auto it = mPropertySets.begin(); it != mPropertySets.end(); it++)
if (it->pBaseStruct->Count() == propCount)
return mTemplateName + " (" + it->SetName + ")";
return mTemplateName + " (Invalid)";
}
TString CScriptTemplate::PropertySetNameByCount(s32 propCount) const
{
for (auto it = mPropertySets.begin(); it != mPropertySets.end(); it++)
if (it->pBaseStruct->Count() == propCount)
return it->SetName;
return "";
}
TString CScriptTemplate::PropertySetNameByIndex(u32 index) const
{
if (index < NumPropertySets())
return mPropertySets[index].SetName;
else
return "";
}
u32 CScriptTemplate::NumPropertySets() const
{
return mPropertySets.size();
return mTemplateName;
}
CScriptTemplate::ERotationType CScriptTemplate::RotationType() const
@ -100,10 +68,9 @@ bool CScriptTemplate::IsVisible() const
return mVisible;
}
void CScriptTemplate::DebugPrintProperties(int propCount)
void CScriptTemplate::DebugPrintProperties()
{
CStructTemplate *pTemp = BaseStructByCount(propCount);
if (pTemp) pTemp->DebugPrintProperties("");
mpBaseStruct->DebugPrintProperties("");
}
// ************ PROPERTY FETCHING ************
@ -111,7 +78,7 @@ template<typename t, EPropertyType propType>
t TFetchProperty(CPropertyStruct *pProperties, const TIDString& ID)
{
if (ID.IsEmpty()) return nullptr;
CPropertyBase *pProp = pProperties->PropertyByIDString(ID);
IProperty *pProp = pProperties->PropertyByIDString(ID);
if (pProp && (pProp->Type() == propType))
return static_cast<t>(pProp);
@ -119,23 +86,9 @@ t TFetchProperty(CPropertyStruct *pProperties, const TIDString& ID)
return nullptr;
}
CStructTemplate* CScriptTemplate::BaseStructByCount(s32 propCount)
CStructTemplate* CScriptTemplate::BaseStruct()
{
if (mPropertySets.size() == 1) return mPropertySets[0].pBaseStruct;
for (u32 iSet = 0; iSet < mPropertySets.size(); iSet++)
if (mPropertySets[iSet].pBaseStruct->Count() == propCount)
return mPropertySets[iSet].pBaseStruct;
return nullptr;
}
CStructTemplate* CScriptTemplate::BaseStructByIndex(u32 index)
{
if (index < NumPropertySets())
return mPropertySets[index].pBaseStruct;
else
return nullptr;
return mpBaseStruct;
}
EVolumeShape CScriptTemplate::VolumeShape(CScriptObject *pObj)
@ -177,32 +130,32 @@ s32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
// Private function
if (mVolumeShape == eConditionalShape)
{
CPropertyBase *pProp = pObj->Properties()->PropertyByIDString(mVolumeConditionIDString);
IProperty *pProp = pObj->Properties()->PropertyByIDString(mVolumeConditionIDString);
// Get value of the condition test property (only boolean, integral, and enum types supported)
int v;
switch (pProp->Type())
{
case eBoolProperty:
v = (static_cast<CBoolProperty*>(pProp)->Get() ? 1 : 0);
v = (static_cast<TBoolProperty*>(pProp)->Get() ? 1 : 0);
break;
case eByteProperty:
v = (int) static_cast<CByteProperty*>(pProp)->Get();
v = (int) static_cast<TByteProperty*>(pProp)->Get();
break;
case eShortProperty:
v = (int) static_cast<CShortProperty*>(pProp)->Get();
v = (int) static_cast<TShortProperty*>(pProp)->Get();
break;
case eLongProperty:
v = (int) static_cast<CLongProperty*>(pProp)->Get();
v = (int) static_cast<TLongProperty*>(pProp)->Get();
break;
case eEnumProperty: {
CEnumProperty *pEnumCast = static_cast<CEnumProperty*>(pProp);
TEnumProperty *pEnumCast = static_cast<TEnumProperty*>(pProp);
CEnumTemplate *pEnumTemp = static_cast<CEnumTemplate*>(pEnumCast->Template());
int index = static_cast<CEnumProperty*>(pProp)->Get();
int index = static_cast<TEnumProperty*>(pProp)->Get();
v = pEnumTemp->EnumeratorID(index);
break;
}
@ -222,29 +175,29 @@ s32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
return -1;
}
CStringProperty* CScriptTemplate::FindInstanceName(CPropertyStruct *pProperties)
TStringProperty* CScriptTemplate::FindInstanceName(CPropertyStruct *pProperties)
{
return TFetchProperty<CStringProperty*, eStringProperty>(pProperties, mNameIDString);
return TFetchProperty<TStringProperty*, eStringProperty>(pProperties, mNameIDString);
}
CVector3Property* CScriptTemplate::FindPosition(CPropertyStruct *pProperties)
TVector3Property* CScriptTemplate::FindPosition(CPropertyStruct *pProperties)
{
return TFetchProperty<CVector3Property*, eVector3Property>(pProperties, mPositionIDString);
return TFetchProperty<TVector3Property*, eVector3Property>(pProperties, mPositionIDString);
}
CVector3Property* CScriptTemplate::FindRotation(CPropertyStruct *pProperties)
TVector3Property* CScriptTemplate::FindRotation(CPropertyStruct *pProperties)
{
return TFetchProperty<CVector3Property*, eVector3Property>(pProperties, mRotationIDString);
return TFetchProperty<TVector3Property*, eVector3Property>(pProperties, mRotationIDString);
}
CVector3Property* CScriptTemplate::FindScale(CPropertyStruct *pProperties)
TVector3Property* CScriptTemplate::FindScale(CPropertyStruct *pProperties)
{
return TFetchProperty<CVector3Property*, eVector3Property>(pProperties, mScaleIDString);
return TFetchProperty<TVector3Property*, eVector3Property>(pProperties, mScaleIDString);
}
CBoolProperty* CScriptTemplate::FindActive(CPropertyStruct *pProperties)
TBoolProperty* CScriptTemplate::FindActive(CPropertyStruct *pProperties)
{
return TFetchProperty<CBoolProperty*, eBoolProperty>(pProperties, mActiveIDString);
return TFetchProperty<TBoolProperty*, eBoolProperty>(pProperties, mActiveIDString);
}
CPropertyStruct* CScriptTemplate::FindLightParameters(CPropertyStruct *pProperties)
@ -270,17 +223,17 @@ CModel* CScriptTemplate::FindDisplayModel(CPropertyStruct *pProperties)
// Property
else
{
CPropertyBase *pProp = pProperties->PropertyByIDString(it->AssetLocation);
IProperty *pProp = pProperties->PropertyByIDString(it->AssetLocation);
if (pProp->Type() == eFileProperty)
{
CFileProperty *pFile = static_cast<CFileProperty*>(pProp);
TFileProperty *pFile = static_cast<TFileProperty*>(pProp);
pRes = pFile->Get();
}
else if (pProp->Type() == eAnimParamsProperty)
else if (pProp->Type() == eCharacterProperty)
{
CAnimParamsProperty *pParams = static_cast<CAnimParamsProperty*>(pProp);
TAnimParamsProperty *pParams = static_cast<TAnimParamsProperty*>(pProp);
pRes = pParams->Get().GetCurrentModel(it->ForceNodeIndex);
}
}
@ -310,11 +263,11 @@ CTexture* CScriptTemplate::FindBillboardTexture(CPropertyStruct *pProperties)
// Property
else
{
CPropertyBase *pProp = pProperties->PropertyByIDString(it->AssetLocation);
IProperty *pProp = pProperties->PropertyByIDString(it->AssetLocation);
if (pProp->Type() == eFileProperty)
{
CFileProperty *pFile = static_cast<CFileProperty*>(pProp);
TFileProperty *pFile = static_cast<TFileProperty*>(pProp);
pRes = pFile->Get();
}
}
@ -344,11 +297,11 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(CPropertyStruct *pProperties
// Property
else
{
CPropertyBase *pProp = pProperties->PropertyByIDString(it->AssetLocation);
IProperty *pProp = pProperties->PropertyByIDString(it->AssetLocation);
if (pProp->Type() == eFileProperty)
{
CFileProperty *pFile = static_cast<CFileProperty*>(pProp);
TFileProperty *pFile = static_cast<TFileProperty*>(pProp);
pRes = pFile->Get();
}
}
@ -369,17 +322,17 @@ bool CScriptTemplate::HasInGameModel(CPropertyStruct *pProperties)
if (it->AssetSource == SEditorAsset::eFile) continue;
CResource *pRes = nullptr;
CPropertyBase *pProp = pProperties->PropertyByIDString(it->AssetLocation);
IProperty *pProp = pProperties->PropertyByIDString(it->AssetLocation);
if (pProp->Type() == eFileProperty)
{
CFileProperty *pFile = static_cast<CFileProperty*>(pProp);
TFileProperty *pFile = static_cast<TFileProperty*>(pProp);
pRes = pFile->Get();
}
else if (pProp->Type() == eAnimParamsProperty)
else if (pProp->Type() == eCharacterProperty)
{
CAnimParamsProperty *pParams = static_cast<CAnimParamsProperty*>(pProp);
TAnimParamsProperty *pParams = static_cast<TAnimParamsProperty*>(pProp);
pRes = pParams->Get().GetCurrentModel(it->ForceNodeIndex);
}

View File

@ -1,8 +1,8 @@
#ifndef CSCRIPTTEMPLATE_H
#define CSCRIPTTEMPLATE_H
#include "CPropertyTemplate.h"
#include "CProperty.h"
#include "IPropertyTemplate.h"
#include "IProperty.h"
#include "EPropertyType.h"
#include "EVolumeShape.h"
#include "Core/Resource/Model/CModel.h"
@ -39,11 +39,6 @@ public:
};
private:
struct SPropertySet {
TString SetName;
CStructTemplate *pBaseStruct;
};
struct SEditorAsset
{
enum {
@ -59,7 +54,7 @@ private:
};
CMasterTemplate *mpMaster;
std::vector<SPropertySet> mPropertySets;
CStructTemplate *mpBaseStruct;
std::list<CScriptObject*> mObjectList;
TString mTemplateName;
TString mSourceFile;
@ -75,9 +70,9 @@ private:
TIDString mLightParametersIDString;
std::vector<SEditorAsset> mAssets;
float mPreviewScale;
ERotationType mRotationType;
EScaleType mScaleType;
float mPreviewScale;
// Preview Volume
EVolumeShape mVolumeShape;
@ -97,9 +92,7 @@ public:
CMasterTemplate* MasterTemplate();
EGame Game();
TString TemplateName(s32 propCount = -1) const;
TString PropertySetNameByCount(s32 propCount) const;
TString PropertySetNameByIndex(u32 index) const;
TString TemplateName() const;
u32 NumPropertySets() const;
ERotationType RotationType() const;
EScaleType ScaleType() const;
@ -107,18 +100,17 @@ public:
u32 ObjectID() const;
void SetVisible(bool visible);
bool IsVisible() const;
void DebugPrintProperties(int propCount = -1);
void DebugPrintProperties();
// Property Fetching
CStructTemplate* BaseStructByCount(s32 propCount);
CStructTemplate* BaseStructByIndex(u32 index);
CStructTemplate* BaseStruct();
EVolumeShape VolumeShape(CScriptObject *pObj);
float VolumeScale(CScriptObject *pObj);
CStringProperty* FindInstanceName(CPropertyStruct *pProperties);
CVector3Property* FindPosition(CPropertyStruct *pProperties);
CVector3Property* FindRotation(CPropertyStruct *pProperties);
CVector3Property* FindScale(CPropertyStruct *pProperties);
CBoolProperty* FindActive(CPropertyStruct *pProperties);
TStringProperty* FindInstanceName(CPropertyStruct *pProperties);
TVector3Property* FindPosition(CPropertyStruct *pProperties);
TVector3Property* FindRotation(CPropertyStruct *pProperties);
TVector3Property* FindScale(CPropertyStruct *pProperties);
TBoolProperty* FindActive(CPropertyStruct *pProperties);
CPropertyStruct* FindLightParameters(CPropertyStruct *pProperties);
CModel* FindDisplayModel(CPropertyStruct *pProperties);
CTexture* FindBillboardTexture(CPropertyStruct *pProperties);

View File

@ -18,7 +18,7 @@ enum EPropertyType
eFileProperty,
eStructProperty,
eArrayProperty,
eAnimParamsProperty,
eCharacterProperty,
eUnknownProperty,
eInvalidProperty
};

View File

@ -0,0 +1,126 @@
#include "IProperty.h"
#include "IPropertyTemplate.h"
// ************ IProperty ************
IPropertyTemplate* IProperty::Template()
{
return mpTemplate;
}
TString IProperty::Name()
{
return mpTemplate->Name();
}
u32 IProperty::ID()
{
return mpTemplate->PropertyID();
}
// ************ CPropertyStruct ************
CPropertyStruct::~CPropertyStruct()
{
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
delete *it;
}
IProperty* CPropertyStruct::PropertyByIndex(u32 index)
{
return mProperties[index];
}
IProperty* CPropertyStruct::PropertyByID(u32 ID)
{
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
{
if ((*it)->ID() == ID)
return *it;
}
return nullptr;
}
IProperty* CPropertyStruct::PropertyByIDString(const TIDString& rkStr)
{
// Resolve namespace
u32 NSStart = rkStr.IndexOf(":");
// String has namespace; the requested property is within a struct
if (NSStart != -1)
{
TString StrStructID = rkStr.Truncate(NSStart);
if (!StrStructID.IsHexString()) return nullptr;
u32 StructID = StrStructID.ToInt32();
TString PropName = rkStr.ChopFront(NSStart + 1);
CPropertyStruct *pStruct = StructByID(StructID);
if (!pStruct) return nullptr;
else return pStruct->PropertyByIDString(PropName);
}
// No namespace; fetch the property from this struct
else
{
if (rkStr.IsHexString())
return PropertyByID(rkStr.ToInt32());
else
return nullptr;
}
}
CPropertyStruct* CPropertyStruct::StructByIndex(u32 index)
{
IProperty *pProp = PropertyByIndex(index);
if (pProp->Type() == eStructProperty)
return static_cast<CPropertyStruct*>(pProp);
else
return nullptr;
}
CPropertyStruct* CPropertyStruct::StructByID(u32 ID)
{
IProperty *pProp = PropertyByID(ID);
if (pProp->Type() == eStructProperty)
return static_cast<CPropertyStruct*>(pProp);
else
return nullptr;
}
CPropertyStruct* CPropertyStruct::StructByIDString(const TIDString& rkStr)
{
IProperty *pProp = PropertyByIDString(rkStr);
if (pProp->Type() == eStructProperty)
return static_cast<CPropertyStruct*>(pProp);
else
return nullptr;
}
// ************ CArrayProperty ************
void CArrayProperty::Resize(u32 Size)
{
u32 OldSize = mSubStructs.size();
if (OldSize == Size) return;
if (Size < OldSize)
{
for (u32 i = mSubStructs.size() - 1; i >= Size; i--)
delete mSubStructs[i];
}
mSubStructs.resize(Size);
if (Size > OldSize)
{
for (u32 i = OldSize; i < Size; i++)
mSubStructs[i] = static_cast<CArrayTemplate*>(mpTemplate)->CreateSubStruct();
}
}
CStructTemplate* CArrayProperty::SubStructTemplate()
{
// CArrayTemplate inherits from CStructTemplate. It defines the substruct structure.
return static_cast<CStructTemplate*>(Template());
}

View File

@ -0,0 +1,129 @@
#ifndef IPROPERTY
#define IPROPERTY
/* This header file declares some classes used to track script object properties
* IProperty, TTypedProperty (and typedefs), CPropertyStruct, and CArrayProperty */
#include "EPropertyType.h"
#include "IPropertyValue.h"
#include "Core/Resource/CResource.h"
#include "Core/Resource/TResPtr.h"
#include "Core/Resource/CAnimationParameters.h"
#include <Common/CColor.h>
#include <Common/TString.h>
#include <Math/CVector3f.h>
#include <list>
class CScriptTemplate;
class CStructTemplate;
class IPropertyTemplate;
typedef TString TIDString;
/*
* IProperty is the base class, containing just some virtual function definitions
* Virtual destructor is mainly there to make cleanup easy; don't need to cast to delete
*/
class IProperty
{
friend class CScriptLoader;
protected:
IPropertyTemplate *mpTemplate;
public:
IProperty(IPropertyTemplate *pTemp) : mpTemplate(pTemp) {}
virtual ~IProperty() {}
virtual EPropertyType Type() = 0;
IPropertyTemplate* Template();
TString Name();
u32 ID();
};
/*
* __CProperty is a template subclass for actual properties.
*/
template <typename PropType, EPropertyType TypeEnum, class ValueClass>
class TTypedProperty : public IProperty
{
friend class CScriptLoader;
ValueClass mValue;
public:
TTypedProperty(IPropertyTemplate *pTemp)
: IProperty(pTemp) {}
TTypedProperty(IPropertyTemplate *pTemp, PropType v)
: IProperty(pTemp), mValue(v) {}
~TTypedProperty() {}
inline EPropertyType Type() { return TypeEnum; }
inline PropType Get() { return mValue.Get(); }
inline void Set(PropType v) { mValue.Set(v); }
};
typedef TTypedProperty<bool, eBoolProperty, CBoolValue> TBoolProperty;
typedef TTypedProperty<char, eByteProperty, CByteValue> TByteProperty;
typedef TTypedProperty<short, eShortProperty, CShortValue> TShortProperty;
typedef TTypedProperty<long, eLongProperty, CLongValue> TLongProperty;
typedef TTypedProperty<long, eEnumProperty, CLongValue> TEnumProperty;
typedef TTypedProperty<long, eBitfieldProperty, CLongValue> TBitfieldProperty;
typedef TTypedProperty<float, eFloatProperty, CFloatValue> TFloatProperty;
typedef TTypedProperty<TString, eStringProperty, CStringValue> TStringProperty;
typedef TTypedProperty<CVector3f, eVector3Property, CVector3Value> TVector3Property;
typedef TTypedProperty<CColor, eColorProperty, CColorValue> TColorProperty;
typedef TTypedProperty<TResPtr<CResource>, eFileProperty, CFileValue> TFileProperty;
typedef TTypedProperty<CAnimationParameters, eCharacterProperty, CCharacterValue> TAnimParamsProperty;
typedef TTypedProperty<std::vector<u8>, eUnknownProperty, CUnknownValue> TUnknownProperty;
/*
* CPropertyStruct is for defining structs of properties.
*/
class CPropertyStruct : public IProperty
{
friend class CScriptLoader;
std::vector<IProperty*> mProperties;
public:
CPropertyStruct(IPropertyTemplate *pTemp)
: IProperty(pTemp) {}
~CPropertyStruct();
EPropertyType Type() { return eStructProperty; }
// Inline
inline u32 Count() { return mProperties.size(); }
inline void AddSubProperty(IProperty *pProp) { mProperties.push_back(pProp); }
inline IProperty* operator[](u32 index) { return mProperties[index]; }
// Functions
IProperty* PropertyByIndex(u32 index);
IProperty* PropertyByID(u32 ID);
IProperty* PropertyByIDString(const TIDString& rkStr);
CPropertyStruct* StructByIndex(u32 index);
CPropertyStruct* StructByID(u32 ID);
CPropertyStruct* StructByIDString(const TIDString& rkStr);
};
/*
* CArrayProperty stores a repeated property struct.
*/
class CArrayProperty : public IProperty
{
friend class CScriptLoader;
std::vector<CPropertyStruct*> mSubStructs;
public:
CArrayProperty(IPropertyTemplate *pTemp)
: IProperty(pTemp) {}
EPropertyType Type() { return eArrayProperty; }
// Inline
inline u32 Count() { return mSubStructs.size(); }
inline void Reserve(u32 amount) { mSubStructs.reserve(amount); }
inline CPropertyStruct* ElementByIndex(u32 index) { return mSubStructs[index]; }
inline CPropertyStruct* operator[](u32 index) { return ElementByIndex(index); }
// Functions
void Resize(u32 Size);
CStructTemplate* SubStructTemplate();
};
#endif // IPROPERTY

View File

@ -0,0 +1,224 @@
#include "IPropertyTemplate.h"
#include <iostream>
// ************ IPropertyTemplate ************
bool IPropertyTemplate::IsInVersion(u32 Version) const
{
if (mAllowedVersions.empty())
return true;
for (u32 iVer = 0; iVer < mAllowedVersions.size(); iVer++)
if (mAllowedVersions[iVer] == Version)
return true;
return false;
}
TIDString IPropertyTemplate::IDString(bool FullPath) const
{
TIDString out;
if (mpParent && FullPath) out = mpParent->IDString(true) + ":";
out += TIDString::HexString(mID, true, true, 8);
return out;
}
CStructTemplate* IPropertyTemplate::RootStruct()
{
if (mpParent) return mpParent->RootStruct();
else if (Type() == eStructProperty) return static_cast<CStructTemplate*>(this);
else return nullptr;
}
// ************ CStructTemplate ************
bool CStructTemplate::IsSingleProperty() const
{
return mIsSingleProperty;
}
u32 CStructTemplate::Count() const
{
return mSubProperties.size();
}
u32 CStructTemplate::NumVersions()
{
return mVersionPropertyCounts.size();
}
u32 CStructTemplate::PropertyCountForVersion(u32 Version)
{
if (Version == -1) Version = 0;
return mVersionPropertyCounts[Version];
}
u32 CStructTemplate::VersionForPropertyCount(u32 PropCount)
{
for (u32 iVer = 0; iVer < NumVersions(); iVer++)
if (mVersionPropertyCounts[iVer] == PropCount)
return iVer;
return -1;
}
IPropertyTemplate* CStructTemplate::PropertyByIndex(u32 index)
{
if (mSubProperties.size() > index)
return mSubProperties[index];
else
return nullptr;
}
IPropertyTemplate* CStructTemplate::PropertyByID(u32 ID)
{
for (auto it = mSubProperties.begin(); it != mSubProperties.end(); it++)
{
if ((*it)->PropertyID() == ID)
return *it;
}
return nullptr;
}
IPropertyTemplate* CStructTemplate::PropertyByIDString(const TIDString& str)
{
// Resolve namespace
u32 nsStart = str.IndexOf(":");
u32 propStart = nsStart + 1;
// String has namespace; the requested property is within a struct
if (nsStart != -1)
{
TString strStructID = str.SubString(0, nsStart);
if (!strStructID.IsHexString()) return nullptr;
u32 structID = strStructID.ToInt32();
TString propName = str.SubString(propStart, str.Length() - propStart);
CStructTemplate *pStruct = StructByID(structID);
if (!pStruct) return nullptr;
else return pStruct->PropertyByIDString(propName);
}
// No namespace; fetch the property from this struct
else
{
// ID string lookup
if (str.IsHexString())
return PropertyByID(str.ToInt32());
else
return nullptr;
}
}
CStructTemplate* CStructTemplate::StructByIndex(u32 index)
{
IPropertyTemplate *pProp = PropertyByIndex(index);
if (pProp->Type() == eStructProperty)
return static_cast<CStructTemplate*>(pProp);
else
return nullptr;
}
CStructTemplate* CStructTemplate::StructByID(u32 ID)
{
IPropertyTemplate *pProp = PropertyByID(ID);
if (pProp && pProp->Type() == eStructProperty)
return static_cast<CStructTemplate*>(pProp);
else
return nullptr;
}
CStructTemplate* CStructTemplate::StructByIDString(const TString& str)
{
IPropertyTemplate *pProp = PropertyByIDString(str);
if (pProp && pProp->Type() == eStructProperty)
return static_cast<CStructTemplate*>(pProp);
else
return nullptr;
}
bool CStructTemplate::HasProperty(const TIDString& rkIdString)
{
IPropertyTemplate *pProperty = PropertyByIDString(rkIdString);
return (pProperty != nullptr);
}
void CStructTemplate::DetermineVersionPropertyCounts()
{
for (u32 iVer = 0; iVer < mVersionPropertyCounts.size(); iVer++)
{
mVersionPropertyCounts[iVer] = 0;
for (u32 iProp = 0; iProp < mSubProperties.size(); iProp++)
{
if (mSubProperties[iProp]->IsInVersion(iVer) && mSubProperties[iProp]->CookPreference() != eNeverCook)
mVersionPropertyCounts[iVer]++;
}
}
}
// ************ GLOBAL FUNCTIONS ************
TString PropEnumToPropString(EPropertyType prop)
{
switch (prop)
{
case eBoolProperty: return "bool";
case eByteProperty: return "byte";
case eShortProperty: return "short";
case eLongProperty: return "long";
case eEnumProperty: return "enum";
case eBitfieldProperty: return "bitfield";
case eFloatProperty: return "float";
case eStringProperty: return "string";
case eColorProperty: return "color";
case eVector3Property: return "vector3f";
case eFileProperty: return "file";
case eStructProperty: return "struct";
case eArrayProperty: return "array";
case eCharacterProperty: return "character";
case eUnknownProperty: return "unknown";
case eInvalidProperty:
default:
return "invalid";
}
}
EPropertyType PropStringToPropEnum(const TString& rkProp)
{
if (rkProp == "bool") return eBoolProperty;
if (rkProp == "byte") return eByteProperty;
if (rkProp == "short") return eShortProperty;
if (rkProp == "long") return eLongProperty;
if (rkProp == "enum") return eEnumProperty;
if (rkProp == "bitfield") return eBitfieldProperty;
if (rkProp == "float") return eFloatProperty;
if (rkProp == "string") return eStringProperty;
if (rkProp == "color") return eColorProperty;
if (rkProp == "vector3f") return eVector3Property;
if (rkProp == "file") return eFileProperty;
if (rkProp == "struct") return eStructProperty;
if (rkProp == "array") return eArrayProperty;
if (rkProp == "character") return eCharacterProperty;
if (rkProp == "unknown") return eUnknownProperty;
return eInvalidProperty;
}
// ************ DEBUG ************
void CStructTemplate::DebugPrintProperties(TString base)
{
base = base + Name() + "::";
for (auto it = mSubProperties.begin(); it != mSubProperties.end(); it++)
{
IPropertyTemplate *tmp = *it;
if (tmp->Type() == eStructProperty)
{
CStructTemplate *tmp2 = static_cast<CStructTemplate*>(tmp);
tmp2->DebugPrintProperties(base);
}
else
std::cout << base << tmp->Name() << "\n";
}
}

View File

@ -0,0 +1,517 @@
#ifndef IPROPERTYTEMPLATE
#define IPROPERTYTEMPLATE
#include "EPropertyType.h"
#include "IProperty.h"
#include "IPropertyValue.h"
#include "Core/Resource/CAnimationParameters.h"
#include <Common/CColor.h>
#include <Common/TString.h>
#include <Common/types.h>
#include <Math/CVector3f.h>
#include <vector>
typedef TString TIDString;
class CStructTemplate;
class IProperty;
enum ECookPreference
{
eNoCookPreference,
eAlwaysCook,
eNeverCook
};
// IPropertyTemplate - Base class. Contains basic info that every property has,
// plus virtual functions for determining more specific property type.
class IPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
protected:
CStructTemplate *mpParent;
TString mName;
u32 mID;
ECookPreference mCookPreference;
std::vector<u32> mAllowedVersions;
public:
IPropertyTemplate(u32 ID, CStructTemplate *pParent = 0)
: mID(ID)
, mpParent(pParent)
, mName("Unknown")
, mCookPreference(eNoCookPreference)
{
}
IPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: mID(ID)
, mpParent(pParent)
, mName(rkName)
, mCookPreference(CookPreference)
{
}
virtual EPropertyType Type() const = 0;
virtual bool CanHaveDefault() const = 0;
virtual bool IsNumerical() const = 0;
virtual bool HasValidRange() const { return false; }
virtual TString DefaultToString() { return ""; }
virtual TString RangeToString() { return ""; }
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
{
if (rkParamName == "should_cook")
{
if (rkValue == "always")
mCookPreference = eAlwaysCook;
else if (rkValue == "never")
mCookPreference = eNeverCook;
else
mCookPreference = eNoCookPreference;
}
}
virtual IProperty* InstantiateProperty() = 0;
inline TString Name() const
{
return mName;
}
inline u32 PropertyID() const
{
return mID;
}
inline ECookPreference CookPreference() const
{
return mCookPreference;
}
inline void SetName(const TString& Name)
{
mName = Name;
}
inline CStructTemplate* Parent() const
{
return mpParent;
}
bool IsInVersion(u32 Version) const;
TIDString IDString(bool FullPath) const;
CStructTemplate* RootStruct();
};
// TTypedPropertyTemplate - Template property class that allows for tracking
// a default value. Typedefs are set up for a bunch of property types.
template<typename PropType, EPropertyType PropTypeEnum, class ValueClass>
class TTypedPropertyTemplate : public IPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
protected:
ValueClass mDefaultValue;
public:
TTypedPropertyTemplate(u32 ID, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pParent) {}
TTypedPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, rkName, CookPreference, pParent) {}
virtual EPropertyType Type() const { return PropTypeEnum; }
virtual bool CanHaveDefault() const { return true; }
virtual bool IsNumerical() const { return false; }
virtual TString DefaultToString()
{
return mDefaultValue.ToString();
}
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
{
IPropertyTemplate::SetParam(rkParamName, rkValue);
if (rkParamName == "default")
mDefaultValue.FromString(rkValue);
}
virtual IProperty* InstantiateProperty()
{
typedef TTypedProperty<PropType, PropTypeEnum, ValueClass> TPropertyType;
TPropertyType *pOut = new TPropertyType(this);
pOut->Set(GetDefaultValue());
return pOut;
}
inline PropType GetDefaultValue() const
{
return mDefaultValue.Get();
}
inline void SetDefaultValue(const PropType& rkIn)
{
mDefaultValue.Set(rkIn);
}
};
// TNumericalPropertyTemplate - Subclass of TTypedPropertyTemplate for numerical
// property types, and allows a min/max value to be tracked.
template<typename PropType, EPropertyType PropTypeEnum, class ValueClass>
class TNumericalPropertyTemplate : public TTypedPropertyTemplate<PropType,PropTypeEnum,ValueClass>
{
friend class CTemplateLoader;
friend class CTemplateWriter;
ValueClass mMin;
ValueClass mMax;
public:
TNumericalPropertyTemplate(u32 ID, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pParent)
{}
TNumericalPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, pParent)
, mMin(0)
, mMax(0)
{}
virtual bool IsNumerical() const { return true; }
virtual bool HasValidRange() const
{
return (mMin != 0 || mMax != 0);
}
virtual TString RangeToString() const
{
return mMin.ToString() + "," + mMax.ToString();
}
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
{
TTypedPropertyTemplate<PropType,PropTypeEnum,ValueClass>::SetParam(rkParamName, rkValue);
if (rkParamName == "range")
{
TStringList Components = rkValue.Split(", ");
if (Components.size() == 2)
{
mMin.FromString(Components.front());
mMax.FromString(Components.back());
}
}
}
inline PropType GetMin()
{
return mMin.Get();
}
inline PropType GetMax()
{
return mMax.Get();
}
inline void SetRange(const PropType& rkMin, const PropType& rkMax)
{
mMin.Set(rkMin);
mMax.Set(rkMax);
}
};
// Typedefs for all property types that don't need further functionality.
typedef TTypedPropertyTemplate<bool, eBoolProperty, CBoolValue> TBoolTemplate;
typedef TNumericalPropertyTemplate<s8, eByteProperty, CByteValue> TByteTemplate;
typedef TNumericalPropertyTemplate<s16, eShortProperty, CShortValue> TShortTemplate;
typedef TNumericalPropertyTemplate<s32, eLongProperty, CLongValue> TLongTemplate;
typedef TNumericalPropertyTemplate<float, eFloatProperty, CFloatValue> TFloatTemplate;
typedef TTypedPropertyTemplate<TString, eStringProperty, CStringValue> TStringTemplate;
typedef TTypedPropertyTemplate<CVector3f, eVector3Property, CVector3Value> TVector3Template;
typedef TTypedPropertyTemplate<CColor, eColorProperty, CColorValue> TColorTemplate;
// CFileTemplate - Property template for files. Tracks a list of file types that
// the property is allowed to accept.
class CFileTemplate : public IPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
TStringList mAcceptedExtensions;
public:
CFileTemplate(u32 ID, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pParent) {}
CFileTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, rkName, CookPreference, pParent) {}
virtual EPropertyType Type() const { return eFileProperty; }
virtual bool CanHaveDefault() const { return false; }
virtual bool IsNumerical() const { return false; }
IProperty* InstantiateProperty()
{
return new TFileProperty(this);
}
void SetAllowedExtensions(const TStringList& rkExtensions)
{
mAcceptedExtensions = rkExtensions;
}
const TStringList& Extensions() const
{
return mAcceptedExtensions;
}
};
// CCharacterTemplate - Typed property that doesn't allow default values.
class CCharacterTemplate : public TTypedPropertyTemplate<CAnimationParameters,
eCharacterProperty,
CCharacterValue>
{
friend class CTemplateLoader;
friend class CTemplateWriter;
public:
CCharacterTemplate(u32 ID, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pParent) { }
CCharacterTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, pParent) { }
virtual bool CanHaveDefault() const
{
return false;
}
};
// CEnumTemplate - Property template for enums. Tracks a list of possible values (enumerators).
class CEnumTemplate : public TLongTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
struct SEnumerator
{
TString Name;
u32 ID;
SEnumerator(const TString& rkName, u32 _ID)
: Name(rkName), ID(_ID) {}
};
std::vector<SEnumerator> mEnumerators;
TString mSourceFile;
public:
CEnumTemplate(u32 ID, CStructTemplate *pParent = 0)
: TLongTemplate(ID, pParent)
{
mDefaultValue.SetHexStringOutput(true);
}
CEnumTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TLongTemplate(ID, rkName, CookPreference, pParent)
{
mDefaultValue.SetHexStringOutput(true);
}
virtual EPropertyType Type() const { return eEnumProperty; }
virtual bool CanHaveDefault() const { return true; }
virtual bool IsNumerical() const { return false; }
virtual IProperty* InstantiateProperty()
{
TEnumProperty *pEnum = new TEnumProperty(this);
u32 Index = EnumeratorIndex(GetDefaultValue());
pEnum->Set(Index);
return pEnum;
}
u32 NumEnumerators()
{
return mEnumerators.size();
}
u32 EnumeratorIndex(u32 enumID)
{
for (u32 iEnum = 0; iEnum < mEnumerators.size(); iEnum++)
{
if (mEnumerators[iEnum].ID == enumID)
return iEnum;
}
return -1;
}
u32 EnumeratorID(u32 enumIndex)
{
if (mEnumerators.size() > enumIndex)
return mEnumerators[enumIndex].ID;
else return -1;
}
TString EnumeratorName(u32 enumIndex)
{
if (mEnumerators.size() > enumIndex)
return mEnumerators[enumIndex].Name;
else return "INVALID ENUM INDEX";
}
};
// CBitfieldTemplate - Property template for bitfields, which can have multiple
// distinct boolean parameters packed into one property.
class CBitfieldTemplate : public TLongTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
struct SBitFlag
{
TString Name;
u32 Mask;
SBitFlag(const TString& _name, u32 _mask)
: Name(_name), Mask(_mask) {}
};
std::vector<SBitFlag> mBitFlags;
TString mSourceFile;
public:
CBitfieldTemplate(u32 ID, CStructTemplate *pParent = 0)
: TLongTemplate(ID, pParent) {}
CBitfieldTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TLongTemplate(ID, rkName, CookPreference, pParent) {}
virtual EPropertyType Type() const { return eBitfieldProperty; }
virtual bool CanHaveDefault() const { return true; }
virtual bool IsNumerical() const { return false; }
virtual IProperty* InstantiateProperty()
{
TBitfieldProperty *pBitfield = new TBitfieldProperty(this);
pBitfield->Set(GetDefaultValue());
return pBitfield;
}
u32 NumFlags()
{
return mBitFlags.size();
}
TString FlagName(u32 index)
{
return mBitFlags[index].Name;
}
u32 FlagMask(u32 index)
{
return mBitFlags[index].Mask;
}
};
// CStructTemplate - Defines structs composed of multiple sub-properties.
class CStructTemplate : public IPropertyTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
protected:
std::vector<IPropertyTemplate*> mSubProperties;
std::vector<u32> mVersionPropertyCounts;
bool mIsSingleProperty;
TString mSourceFile;
void DetermineVersionPropertyCounts();
public:
CStructTemplate(u32 ID, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pParent)
, mIsSingleProperty(false) {}
CStructTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, rkName, CookPreference, pParent)
, mIsSingleProperty(false) {}
~CStructTemplate()
{
for (auto it = mSubProperties.begin(); it != mSubProperties.end(); it++)
delete *it;
}
EPropertyType Type() const { return eStructProperty; }
bool CanHaveDefault() const { return false; }
bool IsNumerical() const { return false; }
IProperty* InstantiateProperty()
{
CPropertyStruct *pStruct = new CPropertyStruct(this);
for (u32 iSub = 0; iSub < mSubProperties.size(); iSub++)
{
IProperty *pSubProp = mSubProperties[iSub]->InstantiateProperty();
pStruct->AddSubProperty(pSubProp);
}
return pStruct;
}
bool IsSingleProperty() const;
u32 Count() const;
u32 NumVersions();
u32 PropertyCountForVersion(u32 Version);
u32 VersionForPropertyCount(u32 PropCount);
IPropertyTemplate* PropertyByIndex(u32 index);
IPropertyTemplate* PropertyByID(u32 ID);
IPropertyTemplate* PropertyByIDString(const TIDString& str);
CStructTemplate* StructByIndex(u32 index);
CStructTemplate* StructByID(u32 ID);
CStructTemplate* StructByIDString(const TIDString& str);
bool HasProperty(const TIDString& rkIdString);
void DebugPrintProperties(TString base);
};
// CArrayTemplate - Defines a repeating struct composed of multiple sub-properties.
// Similar to CStructTemplate, but with new implementations of Type() and InstantiateProperty().
class CArrayTemplate : public CStructTemplate
{
friend class CTemplateLoader;
friend class CTemplateWriter;
public:
CArrayTemplate(u32 ID, CStructTemplate *pParent = 0)
: CStructTemplate(ID, pParent)
{
mIsSingleProperty = true;
}
CArrayTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: CStructTemplate(ID, rkName, CookPreference, pParent)
{
mIsSingleProperty = true;
}
EPropertyType Type() const { return eArrayProperty; }
IProperty* InstantiateProperty()
{
return new CArrayProperty(this);
}
CPropertyStruct* CreateSubStruct()
{
return (CPropertyStruct*) CStructTemplate::InstantiateProperty();
}
};
#endif // IPROPERTYTEMPLATE

View File

@ -0,0 +1,275 @@
#ifndef IPROPERTYVALUE_H
#define IPROPERTYVALUE_H
#include "EPropertyType.h"
#include "Core/Log.h"
#include "Core/Resource/CAnimationParameters.h"
#include "Core/Resource/CResource.h"
#include "Core/Resource/TResPtr.h"
#include <Common/CColor.h>
#include <Common/TString.h>
#include <Math/CVector3f.h>
class IPropertyValue
{
public:
virtual TString ToString() const = 0;
virtual void FromString(const TString& rkString) = 0;
};
template<typename PropType>
class TTypedPropertyValue : public IPropertyValue
{
protected:
PropType mValue;
public:
TTypedPropertyValue() {}
TTypedPropertyValue(PropType Val)
: mValue(Val) {}
PropType Get() const
{
return mValue;
}
void Set(const PropType& rkIn)
{
mValue = rkIn;
}
bool operator==(const TTypedPropertyValue& rkOther) const
{
return (mValue == rkOther.mValue);
}
bool operator==(const PropType& rkOther) const { return (mValue == rkOther); }
bool operator!=(const PropType& rkOther) const { return (mValue != rkOther); }
bool operator< (const PropType& rkOther) const { return (mValue < rkOther); }
bool operator<=(const PropType& rkOther) const { return (mValue <= rkOther); }
bool operator> (const PropType& rkOther) const { return (mValue > rkOther); }
bool operator>=(const PropType& rkOther) const { return (mValue >= rkOther); }
};
class CBoolValue : public TTypedPropertyValue<bool>
{
public:
CBoolValue() { mValue = false; }
CBoolValue(bool Val) { mValue = Val; }
TString ToString() const
{
return (!mValue ? "false" : "true");
}
void FromString(const TString& rkString)
{
mValue = (rkString == "true");
}
};
class CByteValue : public TTypedPropertyValue<s8>
{
public:
CByteValue() { mValue = 0; }
CByteValue(s8 Val) { mValue = Val; }
TString ToString() const
{
return TString::FromInt32(mValue, 0, 10);
}
void FromString(const TString& rkString)
{
u32 base = (rkString.StartsWith("0x") ? 16 : 10);
mValue = (s8) rkString.ToInt32(base);
}
};
class CShortValue : public TTypedPropertyValue<s16>
{
public:
CShortValue() { mValue = 0; }
CShortValue(s16 Val) { mValue = Val; }
TString ToString() const
{
return TString::FromInt32((s32) mValue, 0, 10);
}
void FromString(const TString& rkString)
{
u32 base = (rkString.StartsWith("0x") ? 16 : 10);
mValue = (s16) rkString.ToInt32(base);
}
};
class CLongValue : public TTypedPropertyValue<s32>
{
protected:
bool mShouldOutputHex;
public:
CLongValue() { mShouldOutputHex = false; mValue = 0; }
CLongValue(s32 Val) { mShouldOutputHex = false; mValue = Val; }
void SetHexStringOutput(bool enable)
{
mShouldOutputHex = enable;
}
TString ToString() const
{
if (mShouldOutputHex)
return TString::HexString((u32) mValue, true, true, 8);
else
return TString::FromInt32(mValue, 0, 10);
}
void FromString(const TString& rkString)
{
u32 base = (rkString.StartsWith("0x") ? 16 : 10);
mValue = (s32) rkString.ToInt32(base);
}
};
class CFloatValue : public TTypedPropertyValue<float>
{
public:
CFloatValue() { mValue = 0.0f; }
CFloatValue(float Val) { mValue = Val; }
TString ToString() const
{
return TString::FromFloat(mValue);
}
void FromString(const TString& rkString)
{
mValue = rkString.ToFloat();
}
};
class CStringValue : public TTypedPropertyValue<TString>
{
public:
CStringValue() {}
CStringValue(const TString& rkVal) { mValue = rkVal; }
// These functions are extremely complicated, but try to follow along
TString ToString() const
{
return mValue;
}
void FromString(const TString& rkString)
{
mValue = rkString;
}
};
class CColorValue : public TTypedPropertyValue<CColor>
{
public:
CColorValue() {}
CColorValue(const CColor& rkVal) { mValue = rkVal; }
TString ToString() const
{
TString out;
out += TString::FromFloat(mValue.r) + ", ";
out += TString::FromFloat(mValue.g) + ", ";
out += TString::FromFloat(mValue.b) + ", ";
out += TString::FromFloat(mValue.a);
return out;
}
void FromString(const TString& rkString)
{
TStringList Components = rkString.Split(", ");
if (Components.size() < 3 || Components.size() > 4)
{
Log::Error("CColorValue::FromString was passed a string with an invalid number of components");
mValue = CColor::skTransparentBlack;
return;
}
float *pPtr = &mValue.r;
mValue.a = 1.0f;
for (auto it = Components.begin(); it != Components.end(); it++)
{
*pPtr = it->ToFloat();
pPtr++;
}
}
};
class CVector3Value : public TTypedPropertyValue<CVector3f>
{
public:
CVector3Value() {}
CVector3Value(const CVector3f& rkVal) { mValue = rkVal; }
TString ToString() const
{
TString out;
out += TString::FromFloat(mValue.x) + ", ";
out += TString::FromFloat(mValue.y) + ", ";
out += TString::FromFloat(mValue.z);
return out;
}
void FromString(const TString& rkString)
{
TStringList Components = rkString.Split(", ");
if (Components.size() != 3)
{
Log::Error("CVector3Value::FromString was passed a string with an invalid number of components");
mValue = CVector3f::skInfinite;
return;
}
float *pPtr = &mValue.x;
for (auto it = Components.begin(); it != Components.end(); it++)
{
*pPtr = it->ToFloat();
pPtr++;
}
}
};
class CCharacterValue : public TTypedPropertyValue<CAnimationParameters>
{
public:
CCharacterValue() {}
TString ToString() const { return ""; }
void FromString(const TString&) { }
};
class CFileValue : public TTypedPropertyValue<TResPtr<CResource>>
{
public:
CFileValue() {}
CFileValue(CResource *pRes) { mValue = pRes; }
TString ToString() const { return ""; }
void FromString(const TString&) { }
};
class CUnknownValue : public TTypedPropertyValue<std::vector<u8>>
{
public:
CUnknownValue();
TString ToString() const { return ""; }
void FromString(const TString&) {}
};
#endif // IPROPERTYVALUE_H

View File

@ -25,16 +25,15 @@ CScriptNode::CScriptNode(CSceneManager *pScene, CSceneNode *pParent, CScriptObje
if (mpInstance)
{
CScriptTemplate *pTemp = mpInstance->Template();
CScriptTemplate *pTemp = Template();
// Determine transform
mPosition = mpInstance->Position();
mRotation = CQuaternion::FromEuler(mpInstance->Rotation());
mScale = mpInstance->Scale();
mScaleMultiplier = mpInstance->Template()->PreviewScale();
MarkTransformChanged();
SetName("[" + pTemp->TemplateName(mpInstance->NumProperties()) + "] " + mpInstance->InstanceName());
SetName("[" + pTemp->TemplateName() + "] " + mpInstance->InstanceName());
// Determine display assets
mpActiveModel = mpInstance->GetDisplayModel();
@ -110,7 +109,7 @@ void CScriptNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
// If we're in game mode, then override other visibility settings.
if (ViewInfo.GameMode)
{
if (!mpInstance->IsActive() || !mpInstance->HasInGameModel())
if ( (!mpInstance->IsActive() && Template()->Game() != eReturns) || !mpInstance->HasInGameModel())
return;
}
@ -163,9 +162,9 @@ void CScriptNode::Draw(ERenderOptions Options, int ComponentIndex, const SViewIn
if (UsesModel())
{
CGraphics::SetupAmbientColor();
CGraphics::UpdateVertexBlock();
LoadModelMatrix();
LoadLights(ViewInfo);
CGraphics::UpdateVertexBlock();
// Draw model if possible!
if (mpActiveModel)
@ -249,7 +248,7 @@ void CScriptNode::RayAABoxIntersectTest(CRayCollisionTester& Tester, const SView
// If we're in game mode, then check whether we're visible before proceeding with the ray test.
if (ViewInfo.GameMode)
{
if (!mpInstance->IsActive() || !mpInstance->HasInGameModel())
if ( (!mpInstance->IsActive() && Template()->Game() != eReturns) || !mpInstance->HasInGameModel())
return;
}
@ -368,20 +367,18 @@ SRayIntersection CScriptNode::RayNodeIntersectTest(const CRay& Ray, u32 AssetID,
bool CScriptNode::AllowsRotate() const
{
CScriptTemplate *pTemp = mpInstance->Template();
return (pTemp->RotationType() == CScriptTemplate::eRotationEnabled);
return (Template()->RotationType() == CScriptTemplate::eRotationEnabled);
}
bool CScriptNode::AllowsScale() const
{
CScriptTemplate *pTemp = mpInstance->Template();
return (pTemp->ScaleType() != CScriptTemplate::eScaleDisabled);
return (Template()->ScaleType() != CScriptTemplate::eScaleDisabled);
}
bool CScriptNode::IsVisible() const
{
// Reimplementation of CSceneNode::IsVisible() to allow for layer and template visiblity to be taken into account
return (mVisible && mpInstance->Layer()->IsVisible() && mpInstance->Template()->IsVisible());
return (mVisible && mpInstance->Layer()->IsVisible() && Template()->IsVisible());
}
CColor CScriptNode::TintColor(const SViewInfo &ViewInfo) const
@ -462,6 +459,11 @@ CScriptObject* CScriptNode::Object() const
return mpInstance;
}
CScriptTemplate* CScriptNode::Template() const
{
return mpInstance->Template();
}
CModel* CScriptNode::ActiveModel() const
{
return mpActiveModel;
@ -487,19 +489,19 @@ CAABox CScriptNode::PreviewVolumeAABox() const
CVector2f CScriptNode::BillboardScale() const
{
CVector2f out = (mpInstance->Template()->ScaleType() == CScriptTemplate::eScaleEnabled ? AbsoluteScale().xz() : CVector2f(1.f));
return out * 0.5f * mScaleMultiplier;
CVector2f out = (Template()->ScaleType() == CScriptTemplate::eScaleEnabled ? AbsoluteScale().xz() : CVector2f(1.f));
return out * 0.5f * Template()->PreviewScale();
}
// ************ PROTECTED ************
void CScriptNode::CalculateTransform(CTransform4f& rOut) const
{
CScriptTemplate *pTemp = mpInstance->Template();
CScriptTemplate *pTemp = Template();
if (pTemp->ScaleType() != CScriptTemplate::eScaleDisabled)
{
CVector3f Scale = (HasPreviewVolume() ? CVector3f::skOne : AbsoluteScale());
rOut.Scale(Scale * mScaleMultiplier);
rOut.Scale(Scale * pTemp->PreviewScale());
}
if (UsesModel() && pTemp->RotationType() == CScriptTemplate::eRotationEnabled)

View File

@ -18,7 +18,6 @@ class CScriptNode : public CSceneNode
bool mHasValidPosition;
bool mHasVolumePreview;
float mScaleMultiplier;
CModelNode *mpVolumePreviewNode;
CLightParameters *mpLightParameters;
@ -39,6 +38,7 @@ public:
void GeneratePosition();
CScriptObject* Object() const;
CScriptTemplate* Template() const;
CModel* ActiveModel() const;
bool UsesModel() const;
bool HasPreviewVolume() const;

View File

@ -16,7 +16,7 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
CPropertyStruct *pBaseStruct = pInstance->Properties();
// Fetch render side
mpRenderSideProp = (CEnumProperty*) pBaseStruct->PropertyByIndex(0x5);
mpRenderSideProp = (TEnumProperty*) pBaseStruct->PropertyByIndex(0x5);
if (mpRenderSideProp && mpRenderSideProp->Type() != eEnumProperty)
mpRenderSideProp = nullptr;
@ -24,7 +24,7 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
if (mpRenderSideProp) PropertyModified(mpRenderSideProp);
// Fetch scale
mpSizeProp = (CVector3Property*) pBaseStruct->PropertyByIndex(0x2);
mpSizeProp = (TVector3Property*) pBaseStruct->PropertyByIndex(0x2);
if (mpSizeProp && mpSizeProp->Type() != eVector3Property)
mpSizeProp = nullptr;
@ -34,7 +34,7 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
// Fetch textures
for (u32 iTex = 0; iTex < 3; iTex++)
{
mpTextureProps[iTex] = (CFileProperty*) pBaseStruct->PropertyByIndex(0x6 + iTex);
mpTextureProps[iTex] = (TFileProperty*) pBaseStruct->PropertyByIndex(0x6 + iTex);
if (mpTextureProps[iTex])
{
@ -147,7 +147,7 @@ void CDamageableTriggerExtra::UpdatePlaneTransform()
MarkTransformChanged();
}
void CDamageableTriggerExtra::PropertyModified(CPropertyBase *pProperty)
void CDamageableTriggerExtra::PropertyModified(IProperty *pProperty)
{
if (pProperty == mpRenderSideProp)
{

View File

@ -17,9 +17,9 @@ class CDamageableTriggerExtra : public CScriptExtra
eDown = 6
};
CVector3Property *mpSizeProp;
CEnumProperty *mpRenderSideProp;
CFileProperty *mpTextureProps[3];
TVector3Property *mpSizeProp;
TEnumProperty *mpRenderSideProp;
TFileProperty *mpTextureProps[3];
CVector3f mPlaneSize;
ERenderSide mRenderSide;
@ -33,7 +33,7 @@ public:
~CDamageableTriggerExtra();
void CreateMaterial();
void UpdatePlaneTransform();
void PropertyModified(CPropertyBase *pProperty);
void PropertyModified(IProperty *pProperty);
bool ShouldDrawNormalAssets();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);

View File

@ -9,19 +9,35 @@ CDoorExtra::CDoorExtra(CScriptObject *pInstance, CSceneManager *pScene, CSceneNo
{
CPropertyStruct *pBaseStruct = pInstance->Properties();
mpShieldModelProp = (CFileProperty*) pBaseStruct->PropertyByID(0xB20CC271);
mpShieldModelProp = (TFileProperty*) pBaseStruct->PropertyByID(0xB20CC271);
if (mpShieldModelProp && (mpShieldModelProp->Type() != eFileProperty))
mpShieldModelProp = nullptr;
mpShieldColorProp = (CColorProperty*) pBaseStruct->PropertyByID(0x47B4E863);
if (mpShieldColorProp && (mpShieldColorProp->Type() != eColorProperty))
mpShieldColorProp = nullptr;
if (mpShieldModelProp)
PropertyModified(mpShieldModelProp);
if (mGame >= eEchoes)
{
mpShieldColorProp = (TColorProperty*) pBaseStruct->PropertyByID(0x47B4E863);
if (mpShieldColorProp && (mpShieldColorProp->Type() != eColorProperty))
mpShieldColorProp = nullptr;
if (mpShieldColorProp)
PropertyModified(mpShieldColorProp);
}
else
{
mpDisabledProp = (TBoolProperty*) pBaseStruct->PropertyByID(0xDEE730F5);
if (mpDisabledProp && (mpDisabledProp->Type() != eBoolProperty))
mpDisabledProp = nullptr;
if (mpDisabledProp)
PropertyModified(mpDisabledProp);
}
}
void CDoorExtra::PropertyModified(CPropertyBase *pProperty)
void CDoorExtra::PropertyModified(IProperty *pProperty)
{
if (pProperty == mpShieldModelProp)
{
@ -35,6 +51,21 @@ void CDoorExtra::PropertyModified(CPropertyBase *pProperty)
MarkTransformChanged();
}
else if (pProperty == mpShieldColorProp)
{
mShieldColor = mpShieldColorProp->Get();
}
else if (pProperty == mpDisabledProp)
{
// The Echoes demo doesn't have the shield color property. The color is
// always cyan if the door is unlocked and always white if the door is locked.
mShieldColor = CColor::skWhite;
if (!mpDisabledProp->Get())
mShieldColor = CColor::skCyan;
}
}
void CDoorExtra::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
@ -62,10 +93,7 @@ void CDoorExtra::Draw(ERenderOptions Options, int ComponentIndex, const SViewInf
CGraphics::SetupAmbientColor();
CGraphics::UpdateVertexBlock();
CColor Tint = mpParent->TintColor(ViewInfo);
if (mpShieldColorProp)
Tint *= mpShieldColorProp->Get();
CColor Tint = mpParent->TintColor(ViewInfo) * mShieldColor;
CGraphics::sPixelBlock.TintColor = Tint;
CGraphics::sPixelBlock.TevColor = CColor::skWhite;

View File

@ -6,13 +6,15 @@
class CDoorExtra : public CScriptExtra
{
// Render colored door shield in MP2/3
CFileProperty *mpShieldModelProp;
CColorProperty *mpShieldColorProp;
TFileProperty *mpShieldModelProp;
TColorProperty *mpShieldColorProp;
TBoolProperty *mpDisabledProp;
TResPtr<CModel> mpShieldModel;
CColor mShieldColor;
public:
explicit CDoorExtra(CScriptObject *pInstance, CSceneManager *pScene, CSceneNode *pParent = 0);
void PropertyModified(CPropertyBase *pProperty);
void PropertyModified(IProperty *pProperty);
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
void DrawSelection();

View File

@ -15,14 +15,14 @@ CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CSceneMan
{
case ePrimeDemo:
case ePrime:
mpScanProperty = (CFileProperty*) pBaseProp->PropertyByIDString("0x04:0x00");
mpScanProperty = (TFileProperty*) pBaseProp->PropertyByIDString("0x04:0x00");
break;
case eEchoesDemo:
case eEchoes:
case eCorruptionProto:
case eCorruption:
mpScanProperty = (CFileProperty*) pBaseProp->PropertyByIDString("0xBDBEC295:0xB94E9BE7");
mpScanProperty = (TFileProperty*) pBaseProp->PropertyByIDString("0xBDBEC295:0xB94E9BE7");
break;
default:
@ -39,7 +39,7 @@ CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CSceneMan
}
}
void CPointOfInterestExtra::PropertyModified(CPropertyBase* pProperty)
void CPointOfInterestExtra::PropertyModified(IProperty* pProperty)
{
if (mpScanProperty == pProperty)
mpScanData = mpScanProperty->Get();

View File

@ -8,12 +8,12 @@
class CPointOfInterestExtra : public CScriptExtra
{
// Tint POI billboard orange/red depending on scan importance
CFileProperty *mpScanProperty;
TFileProperty *mpScanProperty;
TResPtr<CScan> mpScanData;
public:
explicit CPointOfInterestExtra(CScriptObject *pInstance, CSceneManager *pScene, CSceneNode *pParent = 0);
void PropertyModified(CPropertyBase* pProperty);
void PropertyModified(IProperty* pProperty);
void ModifyTintColor(CColor& Color);
static const CColor skRegularColor;

View File

@ -11,16 +11,16 @@ CRadiusSphereExtra::CRadiusSphereExtra(CScriptObject *pInstance, CSceneManager *
switch (mObjectType)
{
case 0x63: // Repulsor (MP1)
mpRadius = (CFloatProperty*) pInstance->Properties()->PropertyByID(0x3);
mpRadius = (TFloatProperty*) pInstance->Properties()->PropertyByID(0x3);
break;
case 0x68: // RadialDamage (MP1)
mpRadius = (CFloatProperty*) pInstance->Properties()->PropertyByID(0x4);
mpRadius = (TFloatProperty*) pInstance->Properties()->PropertyByID(0x4);
break;
case 0x5245504C: // "REPL" Repulsor (MP2/MP3)
case 0x52414444: // "RADD" RadialDamage (MP2/MP3/DKCR)
mpRadius =(CFloatProperty*) pInstance->Properties()->PropertyByID(0x78C507EB);
mpRadius = (TFloatProperty*) pInstance->Properties()->PropertyByID(0x78C507EB);
break;
}
}

View File

@ -7,7 +7,7 @@ class CRadiusSphereExtra : public CScriptExtra
{
// Sphere visualization for objects that have a float radius property.
u32 mObjectType;
CFloatProperty *mpRadius;
TFloatProperty *mpRadius;
public:
explicit CRadiusSphereExtra(CScriptObject *pInstance, CSceneManager *pScene, CSceneNode *pParent = 0);

View File

@ -40,7 +40,7 @@ public:
// Virtual CScriptExtra functions
virtual void InstanceTransformed() {}
virtual void PropertyModified(CPropertyBase* /*pProperty*/) {}
virtual void PropertyModified(IProperty* /*pProperty*/) {}
virtual void LinksModified() {}
virtual bool ShouldDrawNormalAssets() { return true; }
virtual bool ShouldDrawVolume() { return true; }

View File

@ -12,19 +12,19 @@ CSpacePirateExtra::CSpacePirateExtra(CScriptObject *pInstance, CSceneManager *pS
if (pVulns && pVulns->Type() == eStructProperty)
{
mpPowerVuln = (CLongProperty*) pVulns->PropertyByID(0x0);
mpPowerVuln = (TLongProperty*) pVulns->PropertyByID(0x0);
if (mpPowerVuln && mpPowerVuln->Type() != eLongProperty && mpPowerVuln->Type() != eEnumProperty)
mpPowerVuln = nullptr;
mpWaveVuln = (CLongProperty*) pVulns->PropertyByID(0x2);
mpWaveVuln = (TLongProperty*) pVulns->PropertyByID(0x2);
if (mpWaveVuln && mpWaveVuln->Type() != eLongProperty && mpWaveVuln->Type() != eEnumProperty)
mpWaveVuln = nullptr;
mpIceVuln = (CLongProperty*) pVulns->PropertyByID(0x1);
mpIceVuln = (TLongProperty*) pVulns->PropertyByID(0x1);
if (mpIceVuln && mpIceVuln->Type() != eLongProperty && mpIceVuln->Type() != eEnumProperty)
mpIceVuln = nullptr;
mpPlasmaVuln = (CLongProperty*) pVulns->PropertyByID(0x3);
mpPlasmaVuln = (TLongProperty*) pVulns->PropertyByID(0x3);
if (mpPlasmaVuln && mpPlasmaVuln->Type() != eLongProperty && mpPlasmaVuln->Type() != eEnumProperty)
mpPlasmaVuln = nullptr;
}

View File

@ -2,15 +2,15 @@
#define CSPACEPIRATEEXTRA_H
#include "CScriptExtra.h"
#include "Core/Resource/Script/CProperty.h"
#include "Core/Resource/Script/IProperty.h"
class CSpacePirateExtra : public CScriptExtra
{
// Render beam troopers with the correct color
CLongProperty *mpPowerVuln;
CLongProperty *mpWaveVuln;
CLongProperty *mpIceVuln;
CLongProperty *mpPlasmaVuln;
TLongProperty *mpPowerVuln;
TLongProperty *mpWaveVuln;
TLongProperty *mpIceVuln;
TLongProperty *mpPlasmaVuln;
public:
explicit CSpacePirateExtra(CScriptObject *pInstance, CSceneManager *pScene, CSceneNode *pParent = 0);

View File

@ -28,6 +28,7 @@ CONFIG(debug, debug|release) {
-L$$PWD/../../build/Math/ -lMathd \
-L$$PWD/../../build/Core/ -lCored \
-L$$PWD/../../externals/assimp/lib/ -lassimp-vc120-mtd \
-L$$PWD/../../externals/boost_1_56_0/lib32-msvc-12.0 -llibboost_filesystem-vc120-mt-gd-1_56 \
-L$$PWD/../../externals/tinyxml2/lib/ -ltinyxml2d
# Debug Target Dependencies
@ -52,6 +53,7 @@ CONFIG(release, debug|release) {
-L$$PWD/../../build/Math/ -lMath \
-L$$PWD/../../build/Core/ -lCore \
-L$$PWD/../../externals/assimp/lib/ -lassimp-vc120-mt \
-L$$PWD/../../externals/boost_1_56_0/lib32-msvc-12.0 -llibboost_filesystem-vc120-mt-1_56 \
-L$$PWD/../../externals/tinyxml2/lib/ -ltinyxml2
# Release Target Dependencies

View File

@ -20,7 +20,7 @@
static const QString gskNullProperty = "[NULL]";
static const QString gskUnsupportedType = "Invalid property type";
WPropertyEditor::WPropertyEditor(QWidget *pParent, CPropertyBase *pProperty)
WPropertyEditor::WPropertyEditor(QWidget *pParent, IProperty *pProperty)
: QWidget(pParent)
{
mUI.PropertyName = new QLabel(gskNullProperty, this);
@ -44,7 +44,7 @@ void WPropertyEditor::resizeEvent(QResizeEvent* /*pEvent*/)
CreateLabelText();
}
void WPropertyEditor::SetProperty(CPropertyBase *pProperty)
void WPropertyEditor::SetProperty(IProperty *pProperty)
{
if (pProperty)
{
@ -83,7 +83,7 @@ void WPropertyEditor::CreateEditor()
// Bool - QCheckBox
case eBoolProperty:
{
CBoolProperty *pBoolCast = static_cast<CBoolProperty*>(mpProperty);
TBoolProperty *pBoolCast = static_cast<TBoolProperty*>(mpProperty);
QCheckBox *pCheckBox = new QCheckBox(this);
pCheckBox->setChecked(pBoolCast->Get());
@ -95,7 +95,7 @@ void WPropertyEditor::CreateEditor()
// Byte - WIntegralSpinBox
case eByteProperty:
{
CByteProperty *pByteCast = static_cast<CByteProperty*>(mpProperty);
TByteProperty *pByteCast = static_cast<TByteProperty*>(mpProperty);
QSpinBox *pSpinBox = new WIntegralSpinBox(this);
pSpinBox->setRange(-128, 128);
@ -110,7 +110,7 @@ void WPropertyEditor::CreateEditor()
// Short - WIntegralSpinBox
case eShortProperty:
{
CShortProperty *pShortCast = static_cast<CShortProperty*>(mpProperty);
TShortProperty *pShortCast = static_cast<TShortProperty*>(mpProperty);
QSpinBox *pSpinBox = new WIntegralSpinBox(this);
pSpinBox->setRange(-32768, 32767);
@ -125,7 +125,7 @@ void WPropertyEditor::CreateEditor()
// Long - WIntegralSpinBox
case eLongProperty:
{
CLongProperty *pLongCast = static_cast<CLongProperty*>(mpProperty);
TLongProperty *pLongCast = static_cast<TLongProperty*>(mpProperty);
QSpinBox *pSpinBox = new WIntegralSpinBox(this);
pSpinBox->setRange(INT32_MIN, INT32_MAX);
@ -140,7 +140,7 @@ void WPropertyEditor::CreateEditor()
// Enum - QComboBox
case eEnumProperty:
{
CEnumProperty *pEnumCast = static_cast<CEnumProperty*>(mpProperty);
TEnumProperty *pEnumCast = static_cast<TEnumProperty*>(mpProperty);
CEnumTemplate *pTemplate = static_cast<CEnumTemplate*>(pEnumCast->Template());
QComboBox *pComboBox = new QComboBox(this);
@ -162,7 +162,7 @@ void WPropertyEditor::CreateEditor()
// Bitfield - QGroupBox containing QCheckBoxes
case eBitfieldProperty:
{
CBitfieldProperty *pBitfieldCast = static_cast<CBitfieldProperty*>(mpProperty);
TBitfieldProperty *pBitfieldCast = static_cast<TBitfieldProperty*>(mpProperty);
CBitfieldTemplate *pTemplate = static_cast<CBitfieldTemplate*>(pBitfieldCast->Template());
long value = pBitfieldCast->Get();
@ -190,7 +190,7 @@ void WPropertyEditor::CreateEditor()
// Float - WDraggableSpinBox
case eFloatProperty:
{
CFloatProperty *pFloatCast = static_cast<CFloatProperty*>(mpProperty);
TFloatProperty *pFloatCast = static_cast<TFloatProperty*>(mpProperty);
WDraggableSpinBox *pDraggableSpinBox = new WDraggableSpinBox(this);
pDraggableSpinBox->setDecimals(4);
@ -205,7 +205,7 @@ void WPropertyEditor::CreateEditor()
// String - QLineEdit
case eStringProperty:
{
CStringProperty *pStringCast = static_cast<CStringProperty*>(mpProperty);
TStringProperty *pStringCast = static_cast<TStringProperty*>(mpProperty);
QLineEdit *pLineEdit = new QLineEdit(this);
pLineEdit->setText(TO_QSTRING(pStringCast->Get()));
@ -219,7 +219,7 @@ void WPropertyEditor::CreateEditor()
// Vector3 - WVectorEditor (inside QGroupBox)
case eVector3Property:
{
CVector3Property *pVector3Cast = static_cast<CVector3Property*>(mpProperty);
TVector3Property *pVector3Cast = static_cast<TVector3Property*>(mpProperty);
QGroupBox *pGroupBox = new QGroupBox(this);
WVectorEditor *pVectorEditor = new WVectorEditor(pGroupBox);
@ -240,7 +240,7 @@ void WPropertyEditor::CreateEditor()
// Color - WColorPicker
case eColorProperty:
{
CColorProperty *pColorCast = static_cast<CColorProperty*>(mpProperty);
TColorProperty *pColorCast = static_cast<TColorProperty*>(mpProperty);
WColorPicker *pColorPicker = new WColorPicker(this);
CColor color = pColorCast->Get();
@ -254,7 +254,7 @@ void WPropertyEditor::CreateEditor()
// File - WResourceSelector
case eFileProperty:
{
CFileProperty *pFileCast = static_cast<CFileProperty*>(mpProperty);
TFileProperty *pFileCast = static_cast<TFileProperty*>(mpProperty);
CFileTemplate *pFileTemp = static_cast<CFileTemplate*>(pFileCast->Template());
WResourceSelector *pResourceSelector = new WResourceSelector(this);
@ -289,9 +289,9 @@ void WPropertyEditor::CreateEditor()
}
// AnimParams - WAnimParamsEditor
case eAnimParamsProperty:
case eCharacterProperty:
{
CAnimParamsProperty *pAnimCast = static_cast<CAnimParamsProperty*>(mpProperty);
TAnimParamsProperty *pAnimCast = static_cast<TAnimParamsProperty*>(mpProperty);
CAnimationParameters params = pAnimCast->Get();
WAnimParamsEditor *pEditor = new WAnimParamsEditor(params, this);
@ -313,7 +313,7 @@ void WPropertyEditor::CreateEditor()
if ((mpProperty->Type() != eStructProperty) &&
(mpProperty->Type() != eBitfieldProperty) &&
(mpProperty->Type() != eVector3Property) &&
(mpProperty->Type() != eAnimParamsProperty))
(mpProperty->Type() != eCharacterProperty))
{
mUI.EditorWidget->setMinimumHeight(21);
mUI.EditorWidget->setMaximumHeight(21);
@ -330,7 +330,7 @@ void WPropertyEditor::UpdateEditor()
case eBoolProperty:
{
CBoolProperty *pBoolCast = static_cast<CBoolProperty*>(mpProperty);
TBoolProperty *pBoolCast = static_cast<TBoolProperty*>(mpProperty);
QCheckBox *pCheckBox = static_cast<QCheckBox*>(mUI.EditorWidget);
pCheckBox->setChecked(pBoolCast->Get());
break;
@ -338,7 +338,7 @@ void WPropertyEditor::UpdateEditor()
case eByteProperty:
{
CByteProperty *pByteCast = static_cast<CByteProperty*>(mpProperty);
TByteProperty *pByteCast = static_cast<TByteProperty*>(mpProperty);
QSpinBox *pSpinBox = static_cast<QSpinBox*>(mUI.EditorWidget);
pSpinBox->setValue(pByteCast->Get());
break;
@ -346,7 +346,7 @@ void WPropertyEditor::UpdateEditor()
case eShortProperty:
{
CShortProperty *pShortCast = static_cast<CShortProperty*>(mpProperty);
TShortProperty *pShortCast = static_cast<TShortProperty*>(mpProperty);
QSpinBox *pSpinBox = static_cast<QSpinBox*>(mUI.EditorWidget);
pSpinBox->setValue(pShortCast->Get());
break;
@ -354,7 +354,7 @@ void WPropertyEditor::UpdateEditor()
case eLongProperty:
{
CLongProperty *pLongCast = static_cast<CLongProperty*>(mpProperty);
TLongProperty *pLongCast = static_cast<TLongProperty*>(mpProperty);
QSpinBox *pSpinBox = static_cast<QSpinBox*>(mUI.EditorWidget);
pSpinBox->setValue(pLongCast->Get());
break;
@ -362,7 +362,7 @@ void WPropertyEditor::UpdateEditor()
case eEnumProperty:
{
CEnumProperty *pEnumCast = static_cast<CEnumProperty*>(mpProperty);
TEnumProperty *pEnumCast = static_cast<TEnumProperty*>(mpProperty);
QComboBox *pComboBox = static_cast<QComboBox*>(mUI.EditorWidget);
pComboBox->setCurrentIndex(pEnumCast->Get());
break;
@ -370,7 +370,7 @@ void WPropertyEditor::UpdateEditor()
case eBitfieldProperty:
{
CBitfieldProperty *pBitfieldCast = static_cast<CBitfieldProperty*>(mpProperty);
TBitfieldProperty *pBitfieldCast = static_cast<TBitfieldProperty*>(mpProperty);
CBitfieldTemplate *pTemplate = static_cast<CBitfieldTemplate*>(pBitfieldCast->Template());
QGroupBox *pGroupBox = static_cast<QGroupBox*>(mUI.EditorWidget);
@ -393,7 +393,7 @@ void WPropertyEditor::UpdateEditor()
case eFloatProperty:
{
CFloatProperty *pFloatCast = static_cast<CFloatProperty*>(mpProperty);
TFloatProperty *pFloatCast = static_cast<TFloatProperty*>(mpProperty);
WDraggableSpinBox *pDraggableSpinBox = static_cast<WDraggableSpinBox*>(mUI.EditorWidget);
pDraggableSpinBox->setValue(pFloatCast->Get());
break;
@ -401,7 +401,7 @@ void WPropertyEditor::UpdateEditor()
case eStringProperty:
{
CStringProperty *pStringCast = static_cast<CStringProperty*>(mpProperty);
TStringProperty *pStringCast = static_cast<TStringProperty*>(mpProperty);
QLineEdit *pLineEdit = static_cast<QLineEdit*>(mUI.EditorWidget);
pLineEdit->setText(TO_QSTRING(pStringCast->Get()));
pLineEdit->setCursorPosition(0);
@ -410,7 +410,7 @@ void WPropertyEditor::UpdateEditor()
case eVector3Property:
{
CVector3Property *pVector3Cast = static_cast<CVector3Property*>(mpProperty);
TVector3Property *pVector3Cast = static_cast<TVector3Property*>(mpProperty);
QGroupBox *pGroupBox = static_cast<QGroupBox*>(mUI.EditorWidget);
WVectorEditor *pVectorEditor = static_cast<WVectorEditor*>(pGroupBox->children().first());
@ -420,7 +420,7 @@ void WPropertyEditor::UpdateEditor()
case eColorProperty:
{
CColorProperty *pColorCast = static_cast<CColorProperty*>(mpProperty);
TColorProperty *pColorCast = static_cast<TColorProperty*>(mpProperty);
WColorPicker *pColorPicker = static_cast<WColorPicker*>(mUI.EditorWidget);
CColor color = pColorCast->Get();
@ -432,7 +432,7 @@ void WPropertyEditor::UpdateEditor()
case eFileProperty:
{
CFileProperty *pFileCast = static_cast<CFileProperty*>(mpProperty);
TFileProperty *pFileCast = static_cast<TFileProperty*>(mpProperty);
CFileTemplate *pFileTemp = static_cast<CFileTemplate*>(pFileCast->Template());
WResourceSelector *pResourceSelector = static_cast<WResourceSelector*>(mUI.EditorWidget);
pResourceSelector->SetAllowedExtensions(pFileTemp->Extensions());
@ -452,7 +452,7 @@ void WPropertyEditor::UpdateEditor()
{
if (pObj != pGroupBox->layout())
{
CPropertyBase *pProp = pStructCast->PropertyByIndex(PropNum);
IProperty *pProp = pStructCast->PropertyByIndex(PropNum);
static_cast<WPropertyEditor*>(pObj)->SetProperty(pProp);
PropNum++;
}
@ -460,9 +460,9 @@ void WPropertyEditor::UpdateEditor()
break;
}
case eAnimParamsProperty:
case eCharacterProperty:
{
CAnimParamsProperty *pAnimCast = static_cast<CAnimParamsProperty*>(mpProperty);
TAnimParamsProperty *pAnimCast = static_cast<TAnimParamsProperty*>(mpProperty);
WAnimParamsEditor *pEditor = static_cast<WAnimParamsEditor*>(mUI.EditorWidget);
pEditor->SetParameters(pAnimCast->Get());
break;

View File

@ -1,7 +1,7 @@
#ifndef WPROPERTYEDITOR_H
#define WPROPERTYEDITOR_H
#include <Core/Resource/Script/CProperty.h>
#include <Core/Resource/Script/IProperty.h>
#include <QWidget>
#include <QHBoxLayout>
#include <QLabel>
@ -11,7 +11,7 @@ class WPropertyEditor : public QWidget
Q_OBJECT
// Editor
CPropertyBase *mpProperty;
IProperty *mpProperty;
// UI
struct {
@ -21,11 +21,11 @@ class WPropertyEditor : public QWidget
} mUI;
public:
explicit WPropertyEditor(QWidget *pParent = 0, CPropertyBase *pProperty = 0);
explicit WPropertyEditor(QWidget *pParent = 0, IProperty *pProperty = 0);
~WPropertyEditor();
void resizeEvent(QResizeEvent *pEvent);
void SetProperty(CPropertyBase *pProperty);
void SetProperty(IProperty *pProperty);
private:
void CreateEditor();

View File

@ -2,6 +2,9 @@
#include "CDarkStyle.h"
#include <Core/Resource/Factory/CTemplateLoader.h>
// temp
#include <Core/Resource/Cooker/CTemplateWriter.h>
#include <QApplication>
#include <QStyleFactory>

View File

@ -1,23 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<GameList version="3">
<GameList version="4">
<game>
<name>Metroid Prime</name>
<mlvl>0x11</mlvl>
<mrea>0x0F</mrea>
<master>mp1/MasterTemplate.xml</master>
</game>
<game>
<name>Metroid Prime 2: Echoes Bonus Disc</name>
<mrea>0x15</mrea>
<master>mp2demo/MasterTemplate.xml</master>
</game>
<game>
<name>Metroid Prime 2: Echoes</name>
<mlvl>0x17</mlvl>
<mrea>0x19</mrea>
<master>mp2/MasterTemplate.xml</master>
</game>
<game>
<name>Metroid Prime 3: Corruption E3 2006 Prototype Build</name>
<mrea>0x1D</mrea>
<master>mp3proto/MasterTemplate.xml</master>
</game>
<game>
<name>Metroid Prime 3: Corruption</name>
<mlvl>0x19</mlvl>
<mrea>0x1E</mrea>
<master>mp3/MasterTemplate.xml</master>
</game>
<game>
<name>Donkey Kong Country Returns</name>
<mlvl>0x1B</mlvl>
<mrea>0x20</mrea>
<master>dkcr/MasterTemplate.xml</master>
</game>
</GameList>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="AnimEnum">
<enumerators>
<enumerator ID="0x8B3D86DC" name="Unknown 1"/>
<enumerator ID="0xF095D135" name="Unknown 2"/>
<enumerator ID="0xEF006D07" name="Unknown 3"/>
</enumerators>
</enum>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="BarrelCannonEnum">
<enumerators>
<enumerator ID="0x1923DFB0" name="Unknown 1"/>
<enumerator ID="0xA61445EB" name="Unknown 2"/>
<enumerator ID="0x1CD43817" name="Unknown 3"/>
<enumerator ID="0x0009FA85" name="Unknown 4"/>
</enumerators>
</enum>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="CableEnum">
<enumerators>
<enumerator ID="0x80DD21B4" name="Unknown 1"/>
<enumerator ID="0x24CF38F1" name="Unknown 2"/>
<enumerator ID="0x23363FD3" name="Unknown 3"/>
</enumerators>
</enum>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="DamageableTriggerEnum">
<enumerators>
<enumerator ID="0x1DB35D5F" name="Unknown 1"/>
<enumerator ID="0x61939D58" name="Unknown 2"/>
<enumerator ID="0x385E6442" name="Unknown 3"/>
<enumerator ID="0x0C91B7E6" name="Unknown 4"/>
</enumerators>
</enum>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="InventorySlot">
<enumerators>
<enumerator ID="0xB22FD89B" name="Unknown 1"/>
<enumerator ID="0x0AB70F9F" name="Unknown 2"/>
<enumerator ID="0x7EC6E111" name="Unknown 3"/>
<enumerator ID="0x556483BA" name="Unknown 4"/>
<enumerator ID="0x28B8C79F" name="Unknown 5"/>
<enumerator ID="0x288E1995" name="Unknown 6"/>
<enumerator ID="0x20452B38" name="Unknown 7"/>
<enumerator ID="0xA08E45BD" name="Unknown 8"/>
<enumerator ID="0x9302608B" name="Unknown 9"/>
<enumerator ID="0x6242D55B" name="Unknown 10"/>
<enumerator ID="0x652F1142" name="Unknown 11"/>
<enumerator ID="0x122821D4" name="Unknown 12"/>
<enumerator ID="0x6BF49970" name="Unknown 13"/>
<enumerator ID="0x67AD9570" name="Unknown 14"/>
<enumerator ID="0xAF376DBC" name="Unknown 15"/>
<enumerator ID="0xC2614252" name="Unknown 16"/>
<enumerator ID="0xE6880EBF" name="Unknown 17"/>
<enumerator ID="0x4CE83DAB" name="Unknown 18"/>
<enumerator ID="0x3132788C" name="Unknown 19"/>
<enumerator ID="0x13F9BA3C" name="Unknown 20"/>
<enumerator ID="0x0B678DCF" name="Unknown 21"/>
<enumerator ID="0x926EDC75" name="Unknown 22"/>
<enumerator ID="0xE569ECE3" name="Unknown 23"/>
<enumerator ID="0x7B0D7940" name="Unknown 24"/>
<enumerator ID="0x0C0A49D6" name="Unknown 25"/>
<enumerator ID="0x9503186C" name="Unknown 26"/>
<enumerator ID="0xE20428FA" name="Unknown 27"/>
<enumerator ID="0x72BB356B" name="Unknown 28"/>
<enumerator ID="0x58839E3B" name="Unknown 29"/>
<enumerator ID="0xC18ACF81" name="Unknown 30"/>
<enumerator ID="0xB68DFF17" name="Unknown 31"/>
<enumerator ID="0x5D1C98AE" name="Unknown 32"/>
<enumerator ID="0xC415C914" name="Unknown 33"/>
<enumerator ID="0xB312F982" name="Unknown 34"/>
<enumerator ID="0x2D766C21" name="Unknown 35"/>
<enumerator ID="0x5A715CB7" name="Unknown 36"/>
<enumerator ID="0xC3780D0D" name="Unknown 37"/>
<enumerator ID="0xB47F3D9B" name="Unknown 38"/>
<enumerator ID="0x24C0200A" name="Unknown 39"/>
<enumerator ID="0xF1925BC3" name="Unknown 40"/>
<enumerator ID="0xB82D38C0" name="Unknown 41"/>
<enumerator ID="0x00F1201C" name="Unknown 42"/>
<enumerator ID="0xE3006233" name="Unknown 43"/>
<enumerator ID="0xBCF65B69" name="Unknown 44"/>
<enumerator ID="0x7F7E9C47" name="Unknown 45"/>
</enumerators>
</enum>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="MusicEnumA">
<enumerators>
<enumerator ID="0x9EFE0717" name="Unknown 1"/>
<enumerator ID="0x28D5A7D7" name="Unknown 2"/>
<enumerator ID="0xD6A26606" name="Unknown 3"/>
</enumerators>
</enum>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="MusicEnumB">
<enumerators>
<enumerator ID="0xCBF698CA" name="Unknown 1"/>
<enumerator ID="0xBCF1A85C" name="Unknown 2"/>
<enumerator ID="0x25F8F9E6" name="Unknown 3"/>
<enumerator ID="0x52FFC970" name="Unknown 4"/>
<enumerator ID="0xCC9B5CD3" name="Unknown 5"/>
<enumerator ID="0xBB9C6C45" name="Unknown 6"/>
<enumerator ID="0x22953DFF" name="Unknown 7"/>
<enumerator ID="0x55920D69" name="Unknown 8"/>
<enumerator ID="0xC52D10F8" name="Unknown 9"/>
<enumerator ID="0xB22A206E" name="Unknown 10"/>
</enumerators>
</enum>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="RobotChickenEnum">
<enumerators>
<enumerator ID="0x8C665F9A" name="Unknown 1"/>
<enumerator ID="0x5E7931A4" name="Unknown 2"/>
</enumerators>
</enum>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="Shape">
<enumerators>
<enumerator ID="0x482B22F1" name="Box"/>
<enumerator ID="0x779DB545" name="Box"/>
<enumerator ID="0x8392F5E4" name="Ellipsoid"/>
<enumerator ID="0x39ED7B8E" name="Cylinder"/>
</enumerators>
</enum>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="UnknownEnum1">
<enumerators>
<enumerator ID="0xD086634A" name="Unknown 1"/>
<enumerator ID="0x9EFEC452" name="Unknown 2"/>
<enumerator ID="0x7A08E735" name="Unknown 3"/>
<enumerator ID="0x50C802D9" name="Unknown 4"/>
<enumerator ID="0xF0F41378" name="Unknown 5"/>
<enumerator ID="0x85CC49A7" name="Unknown 6"/>
<enumerator ID="0xF3FA81F9" name="Unknown 7"/>
<enumerator ID="0x12D7814B" name="Unknown 8"/>
<enumerator ID="0x3ED0780A" name="Unknown 9"/>
<enumerator ID="0xD30DC76F" name="Unknown 10"/>
<enumerator ID="0xAF419B49" name="Unknown 11"/>
<enumerator ID="0xA3CA9851" name="Unknown 12"/>
<enumerator ID="0x841A1F8E" name="Unknown 13"/>
<enumerator ID="0xDE847FAF" name="Unknown 14"/>
<enumerator ID="0xA1933C0A" name="Unknown 15"/>
<enumerator ID="0x2B471C09" name="Unknown 16"/>
<enumerator ID="0xB24E4DB3" name="Unknown 17"/>
<enumerator ID="0xABEC556C" name="Unknown 18"/>
<enumerator ID="0x8B3230C7" name="Unknown 19"/>
<enumerator ID="0xAED13BCA" name="Unknown 20"/>
<enumerator ID="0x3EEF8753" name="Unknown 21"/>
<enumerator ID="0xB3FB5FA4" name="Unknown 22"/>
<enumerator ID="0xC547BF6B" name="Unknown 23"/>
<enumerator ID="0x11F351AB" name="Unknown 24"/>
<enumerator ID="0x3498471C" name="Unknown 25"/>
<enumerator ID="0xC466996F" name="Unknown 26"/>
<enumerator ID="0xFA2C9120" name="Unknown 27"/>
<enumerator ID="0x5178A767" name="Unknown 28"/>
<enumerator ID="0x0709C8FC" name="Unknown 29"/>
<enumerator ID="0x21695AC9" name="Unknown 30"/>
<enumerator ID="0xC25A07B4" name="Unknown 31"/>
<enumerator ID="0x84ED6FA3" name="Unknown 32"/>
<enumerator ID="0x0D7E08B3" name="Unknown 33"/>
<enumerator ID="0x88667A15" name="Unknown 34"/>
<enumerator ID="0x0E2A6D5C" name="Unknown 35"/>
<enumerator ID="0xB480D1C5" name="Unknown 36"/>
<enumerator ID="0x57B38CB8" name="Unknown 37"/>
<enumerator ID="0xD22CE16B" name="Unknown 38"/>
<enumerator ID="0x045DAD13" name="Unknown 39"/>
<enumerator ID="0x6CB4849F" name="Unknown 40"/>
<enumerator ID="0x0A30916F" name="Unknown 41"/>
<enumerator ID="0x006A8C25" name="Unknown 42"/>
<enumerator ID="0x2FE99ACD" name="Unknown 43"/>
<enumerator ID="0xCCDAC7B0" name="Unknown 44"/>
<enumerator ID="0xDFA559AB" name="Unknown 45"/>
<enumerator ID="0x0A1D4C6A" name="Unknown 46"/>
<enumerator ID="0x11FA9AD3" name="Unknown 47"/>
<enumerator ID="0x7527D2CA" name="Unknown 48"/>
<enumerator ID="0x3CCFABB4" name="Unknown 49"/>
<enumerator ID="0x892ADAE9" name="Unknown 50"/>
<enumerator ID="0x6A198794" name="Unknown 51"/>
<enumerator ID="0xA0B21A0E" name="Unknown 52"/>
<enumerator ID="0x36B86BFB" name="Unknown 53"/>
</enumerators>
</enum>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="UnknownEnum2">
<enumerators>
<enumerator ID="0xF7A83E59" name="Unknown 1"/>
<enumerator ID="0x0291D74B" name="Unknown 2"/>
<enumerator ID="0x3BB45C07" name="Unknown 3"/>
<enumerator ID="0x7EAFB026" name="Unknown 4"/>
<enumerator ID="0x69069679" name="Unknown 5"/>
<enumerator ID="0x1837C775" name="Unknown 6"/>
</enumerators>
</enum>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="UnknownEnum3">
<enumerators>
<enumerator ID="0x82B6A62A" name="Unknown 1"/>
<enumerator ID="0xCE9CA7B2" name="Unknown 2"/>
</enumerators>
</enum>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="UnknownEnum4">
<enumerators>
<enumerator ID="0x25234BDB" name="Unknown 1"/>
<enumerator ID="0xBC2A1A61" name="Unknown 2"/>
</enumerators>
</enum>

View File

@ -1,145 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<MasterTemplate version="3">
<MasterTemplate version="4">
<properties>Properties.xml</properties>
<objects>
<object ID="AAGM" template="Script/AnimGridModifier.xml"/>
<object ID="ACKF" template="Script/ActorKeyframe.xml"/>
<object ID="AIHT" template="Script/AIHint.xml"/>
<object ID="AIKF" template="Script/AIKeyframe.xml"/>
<object ID="AIWP" template="Script/AIWaypoint.xml"/>
<object ID="ACOU" template="Script/Acoustics.xml"/>
<object ID="ACTR" template="Script/Actor.xml"/>
<object ID="AIWP" template="Script/AIWaypoint.xml"/>
<object ID="AMKF" template="Script/ActorMultiKeyFrame.xml"/>
<object ID="AOCL" template="Script/AudioOccluder.xml"/>
<object ID="AAGM" template="Script/AnimGridModifier.xml"/>
<object ID="ACKF" template="Script/ActorKeyframe.xml"/>
<object ID="AMKF" template="Script/ActorMultiKeyframe.xml"/>
<object ID="ATRN" template="Script/ActorTransform.xml"/>
<object ID="REAA" template="Script/AreaAttributes.xml"/>
<object ID="ADMG" template="Script/AreaDamage.xml"/>
<object ID="ARNO" template="Script/AreaNode.xml"/>
<object ID="ARPA" template="Script/AreaPath.xml"/>
<object ID="ASAS" template="Script/ASAS.xml"/>
<object ID="ATRN" template="Script/ActorTransform.xml"/>
<object ID="AOCL" template="Script/AudioOccluder.xml"/>
<object ID="AVIS" template="Script/AVIS.xml"/>
<object ID="BABL" template="Script/BarrelBalloon.xml"/>
<object ID="BARL" template="Script/BarrelCannon.xml"/>
<object ID="BUHA" template="Script/BeatUpHandler.xml"/>
<object ID="BIRD" template="Script/BirdBoss.xml"/>
<object ID="BLME" template="Script/BloomEffect.xml"/>
<object ID="BLMV" template="Script/BloomVolume.xml"/>
<object ID="BONU" template="Script/Bonus.xml"/>
<object ID="BTYR" template="Script/BouncyTire.xml"/>
<object ID="BUHA" template="Script/BeatUpHandler.xml"/>
<object ID="CABL" template="Script/Cable.xml"/>
<object ID="BLUR" template="Script/CameraBlurKeyframe.xml"/>
<object ID="FILT" template="Script/CameraFilterKeyframe.xml"/>
<object ID="CAMH" template="Script/CameraHint.xml"/>
<object ID="CMAN" template="Script/CameraManager.xml"/>
<object ID="CMOD" template="Script/CameraModifier.xml"/>
<object ID="CAMS" template="Script/CameraShaker.xml"/>
<object ID="CART" template="Script/MineCart.xml"/>
<object ID="CINE" template="Script/CinematicCamera.xml"/>
<object ID="CKPT" template="Script/Checkpoint.xml"/>
<object ID="CINE" template="Script/CinematicCamera.xml"/>
<object ID="CLPC" template="Script/ClingPathControl.xml"/>
<object ID="CLRM" template="Script/ColorModulate.xml"/>
<object ID="CMAN" template="Script/CameraManager.xml"/>
<object ID="CMGR" template="Script/CrabManager.xml"/>
<object ID="CMOD" template="Script/CameraModifier.xml"/>
<object ID="CRLY" template="Script/ConditionalRelay.xml"/>
<object ID="CNTA" template="Script/ControllerAction.xml"/>
<object ID="CNTR" template="Script/Counter.xml"/>
<object ID="CRAB" template="Script/PirateCrab.xml"/>
<object ID="CRED" template="Script/Credits.xml"/>
<object ID="CRLY" template="Script/ConditionalRelay.xml"/>
<object ID="CSGO" template="Script/CSGO.xml"/>
<object ID="CSTI" template="Script/CSTI.xml"/>
<object ID="DEBR" template="Script/Debris.xml"/>
<object ID="DFOG" template="Script/DistanceFog.xml"/>
<object ID="DLHT" template="Script/DynamicLight.xml"/>
<object ID="DMGA" template="Script/DamageArea.xml"/>
<object ID="DMGE" template="Script/DamageEffect.xml"/>
<object ID="DOFT" template="Script/DepthOfFieldTuner.xml"/>
<object ID="DTRG" template="Script/DamageableTrigger.xml"/>
<object ID="DTRO" template="Script/DamageableTriggerOrientated.xml"/>
<object ID="DEBR" template="Script/Debris.xml"/>
<object ID="DOFT" template="Script/DepthOfFieldTuner.xml"/>
<object ID="DFOG" template="Script/DistanceFog.xml"/>
<object ID="DLHT" template="Script/DynamicLight.xml"/>
<object ID="EFCT" template="Script/Effect.xml"/>
<object ID="EOLD" template="Script/EOLDisplay.xml"/>
<object ID="FILT" template="Script/CameraFilterKeyframe.xml"/>
<object ID="FLPS" template="Script/FalsePerspective.xml"/>
<object ID="FOBS" template="Script/ForestBoss.xml"/>
<object ID="FXDC" template="Script/EnvFxDensityController.xml"/>
<object ID="FSWC" template="Script/FactorySwitch.xml"/>
<object ID="GCGP" template="Script/GenericCreatureGroup.xml"/>
<object ID="GCTR" template="Script/GenericCreature.xml"/>
<object ID="GENR" template="Script/Generator.xml"/>
<object ID="FLPS" template="Script/FalsePerspective.xml"/>
<object ID="FOGO" template="Script/FogOverlay.xml"/>
<object ID="FOGV" template="Script/FogVolume.xml"/>
<object ID="FOBS" template="Script/ForestBoss.xml"/>
<object ID="GMGR" template="Script/GameManager.xml"/>
<object ID="CSGO" template="Script/CSGO.xml"/>
<object ID="GOBD" template="Script/GeneratedObjectDeleter.xml"/>
<object ID="GENR" template="Script/Generator.xml"/>
<object ID="GCTR" template="Script/GenericCreature.xml"/>
<object ID="GCGP" template="Script/GenericCreatureGroup.xml"/>
<object ID="GPDT" template="Script/GroundPoundDetector.xml"/>
<object ID="GUCH" template="Script/GuiCharacter.xml"/>
<object ID="HINT" template="Script/PlayerHint.xml"/>
<object ID="GMNU" template="Script/GuiMenu.xml"/>
<object ID="GPTR" template="Script/GPTR.xml"/>
<object ID="GSLD" template="Script/GuiSlider.xml"/>
<object ID="GWIG" template="Script/GuiWidget.xml"/>
<object ID="HUDD" template="Script/HUD.xml"/>
<object ID="HUDP" template="Script/HUDP.xml"/>
<object ID="IHUD" template="Script/IslandHUD.xml"/>
<object ID="ISAR" template="Script/IslandArea.xml"/>
<object ID="JB01" template="Script/JungleBoss.xml"/>
<object ID="KNGP" template="Script/KongProxy.xml"/>
<object ID="JB01" template="Script/JungleBoss1.xml"/>
<object ID="KONG" template="Script/Kong.xml"/>
<object ID="KNGP" template="Script/KongProxy.xml"/>
<object ID="LVLD" template="Script/LevelDarkener.xml"/>
<object ID="LODC" template="Script/LODController.xml"/>
<object ID="LVOL" template="Script/LightVolume.xml"/>
<object ID="MNPL" template="Script/MotionPlatform.xml"/>
<object ID="MOLC" template="Script/MoleCart.xml"/>
<object ID="MOLE" template="Script/Mole.xml"/>
<object ID="MOLM" template="Script/MoleTrainManager.xml"/>
<object ID="MOVI" template="Script/StreamedMovie.xml"/>
<object ID="MPSR" template="Script/MultiplayerSyncRelay.xml"/>
<object ID="MEAT" template="Script/MEAT.xml"/>
<object ID="MRLY" template="Script/MemoryRelay.xml"/>
<object ID="CART" template="Script/MineCart.xml"/>
<object ID="MOLC" template="Script/MoleCart.xml"/>
<object ID="MOLM" template="Script/MoleTrainManager.xml"/>
<object ID="MOLE" template="Script/Mole.xml"/>
<object ID="MMDL" template="Script/MultiModelActor.xml"/>
<object ID="MPSR" template="Script/MultiplayerSyncRelay.xml"/>
<object ID="MUMA" template="Script/MusicMaster.xml"/>
<object ID="SAMD" template="Script/StreamedAudioModifier.xml"/>
<object ID="MUTR" template="Script/MusicTrack.xml"/>
<object ID="OBRG" template="Script/OceanBridge.xml"/>
<object ID="PCHK" template="Script/PilotChicken.xml"/>
<object ID="PCKP" template="Script/Pickup.xml"/>
<object ID="WAVE" template="Script/OceanWave.xml"/>
<object ID="OPAA" template="Script/OptionalAreaAsset.xml"/>
<object ID="PCTL" template="Script/PathControl.xml"/>
<object ID="PLAC" template="Script/PlayerActor.xml"/>
<object ID="PLAT" template="Script/Platform.xml"/>
<object ID="PNUT" template="Script/Peanut.xml"/>
<object ID="POIO" template="Script/PoiObject.xml"/>
<object ID="PRLA" template="Script/PRLA.xml"/>
<object ID="PROJ" template="Script/Projectile.xml"/>
<object ID="PCKP" template="Script/Pickup.xml"/>
<object ID="PCHK" template="Script/PilotChicken.xml"/>
<object ID="CRAB" template="Script/PirateCrab.xml"/>
<object ID="CMGR" template="Script/PirateCrabManager.xml"/>
<object ID="PLAT" template="Script/Platform.xml"/>
<object ID="HINT" template="Script/PlayerHint.xml"/>
<object ID="PLAC" template="Script/PlayerActor.xml"/>
<object ID="PRSP" template="Script/PRSP.xml"/>
<object ID="PTOK" template="Script/PlayerToken.xml"/>
<object ID="RACR" template="Script/RambiCrate.xml"/>
<object ID="POIO" template="Script/PoiObject.xml"/>
<object ID="SPRL" template="Script/PositionRelay.xml"/>
<object ID="PRLA" template="Script/PRLA.xml"/>
<object ID="PROJ" template="Script/Projectile.xml"/>
<object ID="RADD" template="Script/RadialDamage.xml"/>
<object ID="RBRL" template="Script/RocketBarrel.xml"/>
<object ID="RCHK" template="Script/RobotChicken.xml"/>
<object ID="RCKF" template="Script/RobotChickenFlyer.xml"/>
<object ID="RCTL" template="Script/ReviewControl.xml"/>
<object ID="REAA" template="Script/AreaAttributes.xml"/>
<object ID="REAC" template="Script/REAC.xml"/>
<object ID="ROPE" template="Script/SwingRope.xml"/>
<object ID="RMBI" template="Script/RMBI.xml"/>
<object ID="RACR" template="Script/RambiCrate.xml"/>
<object ID="REAC" template="Script/ReactiveObject.xml"/>
<object ID="RSCL" template="Script/RSCL.xml"/>
<object ID="SRLY" template="Script/Relay.xml"/>
<object ID="RRLY" template="Script/RandomRelay.xml"/>
<object ID="RSBL" template="Script/RespawnBalloon.xml"/>
<object ID="RSCL" template="Script/RSCL.xml"/>
<object ID="RTNM" template="Script/Retronome.xml"/>
<object ID="RCTL" template="Script/ReviewControl.xml"/>
<object ID="RCHK" template="Script/RobotChicken.xml"/>
<object ID="RCKF" template="Script/RobotChickenFlyer.xml"/>
<object ID="RBRL" template="Script/RocketBarrel.xml"/>
<object ID="RUMB" template="Script/RumbleEffect.xml"/>
<object ID="SAMD" template="Script/SAMD.xml"/>
<object ID="SCTL" template="Script/SurfaceControl.xml"/>
<object ID="SHDW" template="Script/ShadowProjector.xml"/>
<object ID="SLCT" template="Script/ScriptLayerController.xml"/>
<object ID="SQTR" template="Script/SequenceTimer.xml"/>
<object ID="SHDW" template="Script/ShadowProjector.xml"/>
<object ID="SBMI" template="Script/SkyboxModInca.xml"/>
<object ID="SOND" template="Script/Sound.xml"/>
<object ID="SNDM" template="Script/SoundModifier.xml"/>
<object ID="SNMD" template="Script/SNMD.xml"/>
<object ID="SOND" template="Script/Sound.xml"/>
<object ID="SPWN" template="Script/SpawnPoint.xml"/>
<object ID="SPFN" template="Script/SpecialFunction.xml"/>
<object ID="SPIN" template="Script/Spinner.xml"/>
<object ID="SPNW" template="Script/SplinePathNetwork.xml"/>
<object ID="SPPA" template="Script/SplinePath.xml"/>
<object ID="SPWN" template="Script/SpawnPoint.xml"/>
<object ID="SQTR" template="Script/SequenceTimer.xml"/>
<object ID="SRLY" template="Script/Relay.xml"/>
<object ID="STAU" template="Script/StreamedAudio.xml"/>
<object ID="SUSP" template="Script/SuspensionBridge.xml"/>
<object ID="SVOL" template="Script/SplineModifierVolume.xml"/>
<object ID="SPPA" template="Script/SplinePath.xml"/>
<object ID="SPNW" template="Script/SplinePathNetwork.xml"/>
<object ID="SWKP" template="Script/SquawkPuzzleAlert.xml"/>
<object ID="STAU" template="Script/StreamedAudio.xml"/>
<object ID="MOVI" template="Script/StreamedMovie.xml"/>
<object ID="SUBT" template="Script/Subtitles.xml"/>
<object ID="SCTL" template="Script/SurfaceControl.xml"/>
<object ID="SUSP" template="Script/SuspensionBridge.xml"/>
<object ID="ROPE" template="Script/SwingRope.xml"/>
<object ID="SWTC" template="Script/Switch.xml"/>
<object ID="TARP" template="Script/TarPit.xml"/>
<object ID="TEOL" template="Script/TimeAttackEOLDisplay.xml"/>
<object ID="TXPN" template="Script/TextPane.xml"/>
<object ID="TIDE" template="Script/TidalWave.xml"/>
<object ID="TEOL" template="Script/TimeAttackEOLDisplay.xml"/>
<object ID="TKEY" template="Script/TimeKeyframe.xml"/>
<object ID="TIMR" template="Script/Timer.xml"/>
<object ID="TIPI" template="Script/TippyPlatform.xml"/>
<object ID="TKEY" template="Script/TimeKeyframe.xml"/>
<object ID="TPND" template="Script/TPND.xml"/>
<object ID="TMGR" template="Script/TrainTrackManager.xml"/>
<object ID="TRGR" template="Script/Trigger.xml"/>
<object ID="TRSC" template="Script/TRSC.xml"/>
<object ID="TSEQ" template="Script/TrainSequence.xml"/>
<object ID="TRSC" template="Script/TransitionScreen.xml"/>
<object ID="TRGR" template="Script/Trigger.xml"/>
<object ID="TUTR" template="Script/Tutorial.xml"/>
<object ID="TXPN" template="Script/TextPane.xml"/>
<object ID="VRBR" template="Script/VerticalRocketBarrel.xml"/>
<object ID="VBPT" template="Script/VolcanoBossBodyPart.xml"/>
<object ID="VOLG" template="Script/VolGroup.xml"/>
<object ID="VRBR" template="Script/VerticalRocketBarrel.xml"/>
<object ID="WAVE" template="Script/OceanWave.xml"/>
<object ID="WAYP" template="Script/Waypoint.xml"/>
<object ID="WLDA" template="Script/WorldAttributes.xml"/>
<object ID="WLIT" template="Script/WorldLightFader.xml"/>
</objects>
<states>
<state ID="!ZER" name="NonZero"/>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="4">
<name>AIHint</name>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xB3127B71" type="long">
<default>0</default>
</property>
<property ID="0x78C507EB" type="float">
<default>0.0</default>
</property>
<property ID="0x19028099" type="float">
<default>0.0</default>
</property>
<property ID="0x2C93AAF5" type="float">
<default>0.0</default>
</property>
<property ID="0xE7CF7950" type="float">
<default>0.0</default>
</property>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="4">
<name>AIKeyframe</name>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xC215A24F" type="long">
<default>-1</default>
</property>
<property ID="0x1FE44C3A" type="bool">
<default>false</default>
</property>
<property ID="0x5CCE5B97" type="bool">
<default>false</default>
</property>
<property ID="0xEDA47FF6" type="bool">
<default>false</default>
</property>
<property ID="0xCEE68723" type="float">
<default>0.0</default>
</property>
<property ID="0x6D62EF74" type="long">
<default>8</default>
</property>
<property ID="0x6F8D34CA" type="float">
<default>1.0</default>
</property>
<enum ID="0xED1F8AAB" template="Enums/AnimEnum.xml">
<default>0x8B3D86DC</default>
</enum>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,22 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>AIWaypoint</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x5D298A43"/>
</struct>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0x97B791D7" type="float">
<default>1.0</default>
</property>
<property ID="0x388E4902" type="float">
<default>1.0</default>
</property>
<property ID="0x80F7E605" type="float">
<default>0.0</default>
</property>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<assets>
<model source="file">script/common/AIWaypoint.cmdl</model>
</assets>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,26 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>ASAS</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0x1BB81937"/>
<property ID="0xE7D8D823"/>
<property ID="0x05C9246C"/>
<property ID="0x244F7338"/>
<property ID="0x8C95539A"/>
<property ID="0x071E84B6"/>
<property ID="0xFDEBA36A"/>
<property ID="0x250142A2"/>
<property ID="0xEB9F334C"/>
<property ID="0xEEB39069"/>
<property ID="0xCAB4886B"/>
<property ID="0x6748B641"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<enum ID="0xE7D8D823" template="Enums/MusicEnumB.xml">
<default>0xCBF698CA</default>
</enum>
<property ID="0x05C9246C" type="bool">
<default>false</default>
</property>
<property ID="0x2409B906" type="bool">
<default>false</default>
</property>
<property ID="0xEB9F334C" type="bool">
<default>false</default>
</property>
<property ID="0xEEB39069" type="float">
<default>0.0</default>
</property>
<property ID="0x244F7338" type="float">
<default>0.0</default>
</property>
<property ID="0xCAB4886B" type="bool">
<default>false</default>
</property>
<property ID="0x1BB81937" type="float">
<default>0.0</default>
</property>
<property ID="0x6748B641" type="float">
<default>0.0</default>
</property>
<property ID="0x8C95539A" type="bool">
<default>false</default>
</property>
<property ID="0x071E84B6" type="float">
<default>0.0</default>
</property>
<property ID="0xFDEBA36A" type="float">
<default>0.0</default>
</property>
<property ID="0x250142A2" type="bool">
<default>false</default>
</property>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -30,7 +54,8 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="4">
<name>AVIS</name>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xB2556C66" type="file" extensions="UNKN"/>
<property ID="0x42097686" type="file" extensions="UNKN"/>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,32 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>Acoustics</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0x765CAE8C"/>
<property ID="0xA6BCDF8E"/>
<property ID="0x11AA184B"/>
<property ID="0x2714DC3B"/>
<property ID="0x5A38A08D"/>
<property ID="0xE9AD286A"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0x765CAE8C" type="bool">
<default>false</default>
</property>
<property ID="0xC78B91FA" type="bool">
<default>false</default>
</property>
<property ID="0xA6BCDF8E" type="bool">
<default>false</default>
</property>
<property ID="0x11AA184B" type="bool">
<default>true</default>
</property>
<property ID="0x2714DC3B" type="bool">
<default>true</default>
</property>
<property ID="0x5A38A08D" type="float">
<default>1.0</default>
</property>
<enum ID="0xE9AD286A">
<default>0x15C2A4E5</default>
<enumerators>
<enumerator ID="0x15C2A4E5" name="Unknown 1"/>
<enumerator ID="0x3451AABF" name="Unknown 2"/>
<enumerator ID="0x1526F437" name="Unknown 3"/>
<enumerator ID="0xA565970E" name="Unknown 4"/>
<enumerator ID="0x3C6CC6B4" name="Unknown 5"/>
<enumerator ID="0x305FD4D6" name="Unknown 6"/>
<enumerator ID="0x82D700E1" name="Unknown 7"/>
<enumerator ID="0x63C5C4A2" name="Unknown 8"/>
<enumerator ID="0xA400169F" name="Unknown 9"/>
<enumerator ID="0x76F248AC" name="Unknown 10"/>
<enumerator ID="0xA5635267" name="Unknown 11"/>
<enumerator ID="0x0AD53D06" name="Unknown 12"/>
<enumerator ID="0x1FE2B108" name="Unknown 13"/>
<enumerator ID="0x32D3C956" name="Unknown 14"/>
<enumerator ID="0x13F78AD4" name="Unknown 15"/>
<enumerator ID="0x112FF1FC" name="Unknown 16"/>
<enumerator ID="0x8826A046" name="Unknown 17"/>
<enumerator ID="0x7A0D9732" name="Unknown 18"/>
<enumerator ID="0xE304C688" name="Unknown 19"/>
<enumerator ID="0x91A41B53" name="Unknown 20"/>
<enumerator ID="0x08AD4AE9" name="Unknown 21"/>
<enumerator ID="0x7FAA7A7F" name="Unknown 22"/>
<enumerator ID="0x4EF81BF8" name="Unknown 23"/>
<enumerator ID="0xD7F14A42" name="Unknown 24"/>
<enumerator ID="0x1B5A08D8" name="Unknown 25"/>
<enumerator ID="0x82535962" name="Unknown 26"/>
<enumerator ID="0x555373A4" name="Unknown 27"/>
<enumerator ID="0xCC5A221E" name="Unknown 28"/>
</enumerators>
</enum>
<struct ID="0xA383E10B" type="multi">
<property ID="0xF060EEEC"/>
<property ID="0x22A0058D"/>
<property ID="0x3DD7B303"/>
<property ID="0xF52AF9F3"/>
<property ID="0xC77A8932"/>
<property ID="0x5D6B1084"/>
<property ID="0xFCF4AAB0"/>
<property ID="0xFB11A412"/>
<property ID="0x253DA9C6"/>
<property ID="0x1F5A38E3"/>
<properties>
<enum ID="0xF060EEEC">
<default>0xC4CB1DA9</default>
<enumerators>
<enumerator ID="0xC4CB1DA9" name="Unknown 1"/>
<enumerator ID="0x5AA68394" name="Unknown 2"/>
<enumerator ID="0x5C6D417F" name="Unknown 3"/>
<enumerator ID="0x48132C7A" name="Unknown 4"/>
<enumerator ID="0x4ED8EE91" name="Unknown 5"/>
<enumerator ID="0xF0AF4B1F" name="Unknown 6"/>
<enumerator ID="0xF66489F4" name="Unknown 7"/>
<enumerator ID="0x6D7873A6" name="Unknown 8"/>
</enumerators>
</enum>
<property ID="0x3DD7B303" type="float">
<default>0.0</default>
</property>
<property ID="0xF52AF9F3" type="float">
<default>0.0</default>
</property>
<enum ID="0x22A0058D">
<default>0x00EDE964</default>
<enumerators>
<enumerator ID="0x00EDE964" name="Unknown 1"/>
<enumerator ID="0x2D99FF73" name="Unknown 2"/>
<enumerator ID="0xCC8B3B30" name="Unknown 3"/>
<enumerator ID="0xD9BCB73E" name="Unknown 4"/>
<enumerator ID="0x217181FE" name="Unknown 5"/>
<enumerator ID="0x9D9D36C4" name="Unknown 6"/>
</enumerators>
</enum>
<property ID="0xC77A8932" type="float">
<default>0.01</default>
</property>
<property ID="0x5D6B1084" type="float">
<default>0.0</default>
</property>
<property ID="0xFCF4AAB0" type="float">
<default>0.0</default>
</property>
<property ID="0xFB11A412" type="float">
<default>0.0</default>
</property>
<property ID="0x253DA9C6" type="float">
<default>0.0</default>
</property>
<property ID="0x1F5A38E3" type="float">
<default>0.0</default>
</property>
</properties>
</struct>
<struct ID="0x6530E9CF" type="multi">
<properties>
<property ID="0x8E16E012" type="float">
<default>0.0</default>
</property>
<property ID="0xC287B5AF" type="float">
<default>0.0</default>
</property>
<property ID="0x168AE1DD" type="float">
<default>0.0</default>
</property>
<property ID="0x1DA37B0D" type="float">
<default>0.0</default>
</property>
</properties>
</struct>
<struct ID="0x3BC9DA35" type="multi">
<properties>
<property ID="0xF5B6BF6C" type="float">
<default>0.0</default>
</property>
<property ID="0x14FFF39C" type="float">
<default>0.0</default>
</property>
<property ID="0x1DA37B0D" type="float">
<default>0.0</default>
</property>
<property ID="0x11BC5E7A" type="float">
<default>0.0</default>
</property>
</properties>
</struct>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -36,7 +150,9 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>volume</scale_type>
<preview_volume shape="Box"/>
</editor>
</ScriptTemplate>

View File

@ -1,119 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>Actor</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<struct ID="0xCF90D15E" type="multi">
<property ID="0xF0668919"/>
</struct>
<property ID="0xF344C0B0"/>
<property ID="0x2E686C2A"/>
<struct ID="0x7B71AE90" type="multi">
<property ID="0x10F37815"/>
<property ID="0xF65FEEF8"/>
</struct>
<property ID="0xC27FFA8F"/>
<property ID="0x0FC966DC"/>
<property ID="0xA244C9D8"/>
<struct ID="0xBF81C83E" type="multi">
<property ID="0x64C0C54F"/>
<property ID="0x79CFA775"/>
<property ID="0xBBC77411"/>
<property ID="0x1CF3F468"/>
<property ID="0x1524C118"/>
<property ID="0xC7C4C8A9"/>
<property ID="0xCECB77DD"/>
</struct>
<struct ID="0x7E397FED" type="multi">
<struct ID="0xB028DB0E" type="multi">
<property ID="0xB772D4C1"/>
<property ID="0xCAC1E778"/>
<property ID="0x67F4D3DE"/>
<property ID="0x1F715FD3"/>
<property ID="0x6B5E7509"/>
<property ID="0x287DE7BE"/>
<property ID="0x628E6AC3"/>
<property ID="0xA71810E9"/>
<property ID="0x61A940D6"/>
<property ID="0xC1B12BB4"/>
<property ID="0x3DC5F0C6"/>
<property ID="0xA33E5B0E"/>
<property ID="0xD19DE775"/>
</struct>
<property ID="0x799263F1"/>
<property ID="0xE315EE72"/>
<property ID="0xED3A6E87"/>
<property ID="0x1499803C"/>
<property ID="0x6DA86200"/>
<property ID="0x101EA33E"/>
<property ID="0x90AA341F"/>
<property ID="0x7C269EBC"/>
<property ID="0x1BCAB75C"/>
</struct>
<property ID="0x7859B520"/>
<property ID="0xC08D1B93"/>
<property ID="0x1E32523E"/>
<property ID="0x1D8DD846"/>
<property ID="0x87613768"/>
<property ID="0xE2DDC4C1"/>
<property ID="0x73E7BFE9"/>
<property ID="0x4743294F"/>
<property ID="0x0D8098BF"/>
<property ID="0xB530D7DE"/>
<property ID="0x261E92A4"/>
<property ID="0xAA719632"/>
<property ID="0x4DDC1327"/>
<property ID="0xA6AA06D5"/>
<property ID="0x32FAB97E"/>
<property ID="0xC23011D9"/>
<property ID="0xA38A84C2"/>
<property ID="0x27E50799"/>
<property ID="0xBE513E2B"/>
<property ID="0xC1B9C601"/>
<property ID="0x22E046BA"/>
<struct ID="0x6C75E2EA" type="multi">
<struct ID="0xDAA9D4BE" type="multi">
<property ID="0x5405F708"/>
<property ID="0x6B62E419"/>
</struct>
<struct ID="0xF361604C" type="multi">
<property ID="0x5405F708"/>
<property ID="0x6B62E419"/>
</struct>
<struct ID="0x5D09F1DD" type="multi">
<property ID="0x5405F708"/>
<property ID="0x6B62E419"/>
</struct>
<property ID="0x6351A049"/>
<property ID="0xC2AD5735"/>
</struct>
<struct ID="0x68FD49AE" type="multi">
<property ID="0xA1266897"/>
<property ID="0x7BE67947"/>
<property ID="0x6F74F82F"/>
<property ID="0x611F9F41"/>
<struct ID="0xE67EF99E" type="multi">
<property ID="0xB297F186"/>
<property ID="0xCA3E85C5"/>
<property ID="0x036DC8DD"/>
<property ID="0x37A12336"/>
<property ID="0x87F624CE"/>
<property ID="0xC46A562B"/>
<property ID="0x58D29F3F"/>
<property ID="0xE0029E4A"/>
<property ID="0x69FC4177"/>
<property ID="0xA57469D3"/>
<property ID="0xE8BCC8D8"/>
<property ID="0x5E300B3F"/>
<property ID="0xFBC6C110"/>
</struct>
</struct>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xF344C0B0" type="vector3f">
<default>0.0, 0.0, 0.0</default>
</property>
<property ID="0x2E686C2A" type="vector3f">
<default>0.0, 0.0, 0.0</default>
</property>
<property ID="0x75DBB375" type="float">
<default>1.0</default>
</property>
<property ID="0x2F2AE3E5" type="float">
<default>0.0</default>
</property>
<struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"/>
<struct ID="0x7B71AE90" template="Structs/DamageVulnerability.xml"/>
<property ID="0xC27FFA8F" type="file" extensions="CMDL"/>
<property ID="0x0FC966DC" type="file" extensions="DCLN"/>
<property ID="0xA244C9D8" type="character"/>
<struct ID="0xBF81C83E" template="Structs/ShadowData.xml"/>
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<property ID="0xC08D1B93" type="bool">
<default>true</default>
</property>
<property ID="0x1E32523E" type="bool">
<default>true</default>
</property>
<property ID="0x1D8DD846" type="bool">
<default>true</default>
</property>
<property ID="0x7859B520" type="bool">
<default>false</default>
</property>
<property ID="0x87613768" type="bool">
<default>false</default>
</property>
<property ID="0xE2DDC4C1" type="string"/>
<property ID="0x32FAB97E" type="long">
<default>0</default>
</property>
<property ID="0xAA719632" type="float">
<default>0.0</default>
</property>
<property ID="0x4743294F" type="bool">
<default>false</default>
</property>
<property ID="0x0D8098BF" type="bool">
<default>false</default>
</property>
<property ID="0x4DDC1327" type="bool">
<default>false</default>
</property>
<property ID="0xA6AA06D5" type="bool">
<default>false</default>
</property>
<property ID="0x73E7BFE9" type="bool">
<default>false</default>
</property>
<property ID="0x261E92A4" type="bool">
<default>true</default>
</property>
<property ID="0xB530D7DE" type="bool">
<default>false</default>
</property>
<property ID="0xF8DF6CD2" type="color">
<default>1.0, 1.0, 1.0, 1.0</default>
</property>
<struct ID="0xC23011D9" template="Structs/MayaSpline.xml"/>
<property ID="0xC1B9C601" type="bool">
<default>false</default>
</property>
<property ID="0x27E50799" type="bool">
<default>false</default>
</property>
<property ID="0x22E046BA" type="float">
<default>0.0</default>
</property>
<property ID="0xBE513E2B" type="float">
<default>1.0</default>
</property>
<property ID="0xA38A84C2" type="bool">
<default>false</default>
</property>
<struct ID="0x6C75E2EA" template="Structs/UnknownStruct8.xml"/>
<struct ID="0x68FD49AE" template="Structs/AnimGridModifierData.xml"/>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>

View File

@ -1,22 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>ActorKeyframe</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0xC215A24F"/>
<property ID="0x1FE44C3A"/>
<property ID="0xCEE68723"/>
<property ID="0x5CCE5B97"/>
<property ID="0xEDA47FF6"/>
<property ID="0x6D62EF74"/>
<property ID="0xED1F8AAB"/>
<property ID="0x6F8D34CA"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xC215A24F" type="long">
<default>-1</default>
</property>
<property ID="0x1FE44C3A" type="bool">
<default>false</default>
</property>
<property ID="0x5CCE5B97" type="bool">
<default>false</default>
</property>
<property ID="0xEDA47FF6" type="bool">
<default>false</default>
</property>
<property ID="0xCEE68723" type="float">
<default>0.0</default>
</property>
<property ID="0x6D62EF74" type="long">
<default>8</default>
</property>
<property ID="0x6F8D34CA" type="float">
<default>1.0</default>
</property>
<enum ID="0xED1F8AAB" template="Enums/AnimEnum.xml">
<default>0x8B3D86DC</default>
</enum>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -26,7 +39,8 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,90 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<name>ActorMultiKeyFrame</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<ScriptTemplate version="4">
<name>ActorMultiKeyframe</name>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0x1FE44C3A" type="bool">
<default>false</default>
</property>
<struct ID="0x48B5B2A2" type="multi">
<property ID="0x8DAA8422"/>
<struct ID="0xE2DB9114" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
<property ID="0x5CCE5B97"/>
</struct>
<struct ID="0x085D4C76" type="multi">
<property ID="0xC215A24F"/>
<property ID="0x5CCE5B97"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0xE70FFA97" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
<property ID="0x5CCE5B97"/>
</struct>
<struct ID="0x0621F0F3" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0xE9734612" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0x03F59B70" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0xECA72D91" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0x1AD889F9" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0xF58A3F18" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0xDA6BA7AD" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0x3539114C" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0xDFBFCC2E" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0x30ED7ACF" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0xD1C370AB" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0x3E91C64A" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0xD4171B28" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0x3B45ADC9" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0xCD3A09A1" type="multi">
<property ID="0xC215A24F"/>
<property ID="0xEDA47FF6"/>
</struct>
<struct ID="0x2268BF40" type="multi">
<property ID="0xC215A24F"/>
</struct>
<struct ID="0x793D2104" type="multi">
<property ID="0xC215A24F"/>
</struct>
<properties>
<property ID="0x8DAA8422" type="long">
<default>0</default>
</property>
<struct ID="0xE2DB9114" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x085D4C76" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xE70FFA97" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x0621F0F3" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xE9734612" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x03F59B70" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xECA72D91" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x1AD889F9" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xF58A3F18" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xDA6BA7AD" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x3539114C" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xDFBFCC2E" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x30ED7ACF" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xD1C370AB" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x3E91C64A" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xD4171B28" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x3B45ADC9" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0xCD3A09A1" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x2268BF40" template="Structs/ActorMultiKeyframeStruct.xml"/>
<struct ID="0x793D2104" template="Structs/ActorMultiKeyframeStruct.xml"/>
</properties>
</struct>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -94,7 +45,8 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,33 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>ActorTransform</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0xC6CE7689"/>
<property ID="0x8B51E23F"/>
<property ID="0xA5753D52"/>
<struct ID="0xEFE4EA57" type="multi">
<property ID="0x69D8447D"/>
<property ID="0xD0239F95"/>
<property ID="0xC15EF5EC"/>
</struct>
<struct ID="0x2F7EC0A2" type="multi">
<property ID="0xF437A62F"/>
<property ID="0x6F92EA40"/>
<property ID="0x180C38B0"/>
</struct>
<struct ID="0x692267EA" type="multi">
<property ID="0x24E9A09B"/>
<property ID="0xCBBB167A"/>
<property ID="0x213DCB18"/>
</struct>
<property ID="0x51B8AACA"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xC6CE7689" type="long">
<default>20</default>
</property>
<property ID="0x8B51E23F" type="float">
<default>10.0</default>
</property>
<property ID="0xA5753D52" type="float">
<default>0.0</default>
</property>
<struct ID="0xEFE4EA57" template="Structs/UnknownStruct20.xml"/>
<struct ID="0x2F7EC0A2" template="Structs/UnknownStruct21.xml"/>
<struct ID="0x692267EA" template="Structs/UnknownStruct22.xml"/>
<struct ID="0x51B8AACA" template="Structs/MayaSpline.xml"/>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -37,7 +28,8 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,36 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>AnimGridModifier</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<struct ID="0x68FD49AE" type="multi">
<property ID="0xA1266897"/>
<property ID="0x6F74F82F"/>
<property ID="0x611F9F41"/>
<struct ID="0xE67EF99E" type="multi">
<property ID="0xB297F186"/>
<property ID="0xCA3E85C5"/>
<property ID="0x036DC8DD"/>
<property ID="0x37A12336"/>
<property ID="0x87F624CE"/>
<property ID="0xC46A562B"/>
<property ID="0x58D29F3F"/>
<property ID="0x69FC4177"/>
<property ID="0xA57469D3"/>
<property ID="0xE8BCC8D8"/>
<property ID="0x5E300B3F"/>
<property ID="0x63564BA2"/>
<property ID="0xFBC6C110"/>
<property ID="0x30C30368"/>
<property ID="0x3C3862F3"/>
</struct>
</struct>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<struct ID="0x68FD49AE" template="Structs/AnimGridModifierData.xml"/>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -40,7 +16,8 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>disabled</scale_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,24 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>AreaAttributes</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<struct ID="0x5846524D" type="single"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0x95D4BEE7"/>
<property ID="0x56263E35"/>
<property ID="0xD208C9FA"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0x95D4BEE7" type="bool">
<default>false</default>
</property>
<property ID="0x56263E35" type="long">
<default>-1</default>
</property>
<property ID="0xBA5F801E" type="float">
<default>1.0</default>
</property>
<property ID="0xD208C9FA" type="file" extensions="CMDL"/>
<property ID="0x29445302" type="bool">
<default>true</default>
</property>
<property ID="0xE3426206" type="bool">
<default>false</default>
</property>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets>
<model source="property">0xD208C9FA</model>
</assets>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="4">
<name>AreaDamage</name>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml">
<properties>
<struct ID="0x5846524D">
<properties>
<property ID="0x02">
<default>2.0, 2.0, 2.0</default>
</property>
</properties>
</struct>
</properties>
</struct>
<struct ID="0x337F9524" template="Structs/DamageInfo.xml"/>
<property ID="0x8E07E9D3" type="float">
<default>1.0</default>
</property>
<property ID="0xC052BC02" type="float">
<default>1.0</default>
</property>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>
</ScriptTemplate>

View File

@ -1,57 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>AreaNode</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0xA6F8611C"/>
<property ID="0xF1AE2F13"/>
<property ID="0x8D3AB314"/>
<property ID="0x4DEF7B9B"/>
<property ID="0x6A02F05F"/>
<property ID="0x737631AD"/>
<property ID="0x3B83DD31"/>
<property ID="0xF344C0B0"/>
<property ID="0x30CBDB68"/>
<property ID="0x0FC966DC"/>
<property ID="0x33CF5665"/>
<property ID="0xA244C9D8"/>
<property ID="0xB7CD213C"/>
<property ID="0x9F93BC3F"/>
<struct ID="0x7E397FED" type="multi">
<struct ID="0xB028DB0E" type="multi">
<property ID="0x1F715FD3"/>
</struct>
</struct>
<property ID="0x6A789BE3"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0x4DEF7B9B" type="bool">
<default>false</default>
</property>
<property ID="0xF1AE2F13" type="bool">
<default>false</default>
</property>
<property ID="0xA6F8611C" type="bool">
<default>false</default>
</property>
<enum ID="0x8D3AB314">
<default>0x24E6FE6B</default>
<enumerators>
<enumerator ID="0x0BB40E5E" name="Unknown 1"/>
<enumerator ID="0x24E6FE6B" name="Unknown 2"/>
<enumerator ID="0xFB8DD144" name="Unknown 3"/>
<enumerator ID="0x060BCB31" name="Unknown 4"/>
<enumerator ID="0xC8068C4F" name="Unknown 5"/>
<enumerator ID="0xA5355C31" name="Unknown 6"/>
<enumerator ID="0x0CA17800" name="Unknown 7"/>
<enumerator ID="0x9DFC67D1" name="Unknown 8"/>
</enumerators>
</enum>
<property ID="0x6A02F05F" type="string"/>
<property ID="0x737631AD" type="file" extensions="STRG"/>
<property ID="0x3B83DD31" type="file" extensions="STRG"/>
<property ID="0x30CBDB68" type="long">
<default>0</default>
</property>
<property ID="0xF344C0B0" type="vector3f">
<default>0.0, 0.0, 0.0</default>
</property>
<property ID="0x2E686C2A" type="vector3f">
<default>0.0, 0.0, 0.0</default>
</property>
<property ID="0x0FC966DC" type="file" extensions="DCLN"/>
<property ID="0x33CF5665" type="file" extensions="unknown"/>
<property ID="0xA244C9D8" type="character"/>
<property ID="0xB7CD213C" type="character"/>
<property ID="0x9F93BC3F" type="character"/>
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<property ID="0x6A789BE3" type="file" extensions="MLVL"/>
<struct ID="0xA9D29E32" type="multi">
<property ID="0xA28B199D"/>
<property ID="0x003E7991"/>
<properties>
<property ID="0xA28B199D" type="file" extensions="CAUD"/>
<property ID="0x003E7991" type="file" extensions="CAUD"/>
</properties>
</struct>
<struct ID="0x86963E8A" type="multi">
<property ID="0xFBB7BE45"/>
<property ID="0x844AB6B0"/>
<property ID="0xA6E3187A"/>
<property ID="0x045C4906"/>
<property ID="0x9C403177"/>
<property ID="0x1F68F1B7"/>
<property ID="0x29463E36"/>
<property ID="0x103E9376"/>
<property ID="0x7024D89B"/>
<property ID="0x495C75DB"/>
<property ID="0x19080EBD"/>
<property ID="0x2070A3FD"/>
<properties>
<property ID="0xFBB7BE45" type="color">
<default>0.0, 0.0, 0.0, 1.0</default>
</property>
<property ID="0x0FBCE3FB" type="color">
<default>0.0, 0.0, 0.0, 1.0</default>
</property>
<property ID="0x844AB6B0" type="color">
<default>0.0, 0.0, 0.0, 1.0</default>
</property>
<property ID="0xA6E3187A" type="color">
<default>1.0, 1.0, 1.0, 1.0</default>
</property>
<property ID="0x045C4906" type="color">
<default>0.0, 0.0, 0.0, 1.0</default>
</property>
<property ID="0x9C403177" type="color">
<default>0.0, 0.0, 0.0, 1.0</default>
</property>
<property ID="0x29463E36" type="character"/>
<property ID="0x103E9376" type="character"/>
<property ID="0x7024D89B" type="character"/>
<property ID="0x495C75DB" type="character"/>
<property ID="0x19080EBD" type="character"/>
<property ID="0x2070A3FD" type="character"/>
</properties>
</struct>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
<property name="LightParameters" ID="0x7E397FED:0xB028DB0E"/>
</properties>
<assets>

View File

@ -1,48 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>AreaPath</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0xC27FFA8F"/>
<property ID="0xA244C9D8"/>
<property ID="0xDE5709D9"/>
<property ID="0x474BCCE3"/>
<struct ID="0x7E397FED" type="multi">
<struct ID="0xB028DB0E" type="multi">
<property ID="0xB772D4C1"/>
<property ID="0x67F4D3DE"/>
<property ID="0x1F715FD3"/>
</struct>
<property ID="0xED3A6E87"/>
</struct>
<property ID="0x7561F8F7"/>
<property ID="0xD626B1D8"/>
<property ID="0x9DC43B9C"/>
<property ID="0x1989E2E5"/>
<property ID="0xFA0EED84"/>
<struct ID="0x91FA7B19" type="multi">
<property ID="0xF4AC7CAA"/>
</struct>
<property ID="0x1B32DC50"/>
<property ID="0x7C642C9C"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xC27FFA8F" type="file" extensions="CMDL"/>
<property ID="0xA244C9D8" type="character"/>
<property ID="0xDE5709D9" type="file" extensions="CMDL"/>
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<enum ID="0x474BCCE3">
<default>0x1F46814C</default>
<enumerators>
<enumerator ID="0x1F46814C" name="Unknown 1"/>
<enumerator ID="0xDBE9ABC6" name="Unknown 2"/>
</enumerators>
</enum>
<property ID="0x7561F8F7" type="bool">
<default>false</default>
</property>
<property ID="0xD626B1D8" type="bool">
<default>true</default>
</property>
<property ID="0x45BB081B" type="bool">
<default>false</default>
</property>
<property ID="0x9DC43B9C" type="float">
<default>0.5</default>
</property>
<property ID="0x1989E2E5" type="float">
<default>0.5</default>
</property>
<struct ID="0xFA0EED84" template="Structs/MayaSpline.xml"/>
<struct ID="0x91FA7B19" template="Structs/AreaPathStructA.xml"/>
<property ID="0x1B32DC50" type="file" extensions="PART"/>
<property ID="0x7C642C9C" type="file" extensions="CAUD"/>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
<property name="Position" ID="0x255A4580:0x5846524D:0x00"/>
<property name="Rotation" ID="0x255A4580:0x5846524D:0x01"/>
<property name="Scale" ID="0x255A4580:0x5846524D:0x02"/>
<property name="Active" ID="0x255A4580:0x41435456"/>
<property name="LightParameters" ID="0x7E397FED:0xB028DB0E"/>
</properties>
<assets>
<animparams source="property">0xA244C9D8</animparams>
<model source="property">0xC27FFA8F</model>
<model source="property">0xDE5709D9</model>
</assets>
<assets/>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>

View File

@ -1,16 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>AudioOccluder</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<property ID="0xFA7B5650"/>
<property ID="0xFE89B6E4"/>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<property ID="0xFE89B6E4" type="float">
<default>1.0</default>
</property>
<property ID="0xFA7B5650" type="long">
<default>32000</default>
</property>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>
@ -20,6 +21,7 @@
<property name="Active" ID="0x255A4580:0x41435456"/>
</properties>
<assets/>
<preview_scale>0.5</preview_scale>
<rotation_type>enabled</rotation_type>
<scale_type>enabled</scale_type>
</editor>

View File

@ -1,48 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScriptTemplate version="3">
<ScriptTemplate version="4">
<name>BarrelBalloon</name>
<properties version="NTSC">
<struct ID="0x255A4580" type="multi">
<property ID="0x494E414D"/>
<struct ID="0x5846524D" type="single"/>
<property ID="0x41435456"/>
<property ID="0x5D298A43"/>
</struct>
<struct ID="0x7E397FED" type="multi">
<struct ID="0xB028DB0E" type="multi">
<property ID="0x6B5E7509"/>
<property ID="0x628E6AC3"/>
<property ID="0xA71810E9"/>
</struct>
</struct>
<properties>
<struct ID="0x255A4580" template="Structs/EditorProperties.xml"/>
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<struct ID="0x94F9C48D" type="multi">
<property ID="0xF8B3ABE0"/>
<property ID="0x82DE5E29"/>
<property ID="0x1644AF87"/>
<property ID="0xDDB16979"/>
<property ID="0x2B201845"/>
<property ID="0xBF75E71F"/>
<property ID="0xE87BB75C"/>
<property ID="0x9545F9EF"/>
<property ID="0x1BD4C955"/>
<property ID="0x64ACDF7B"/>
<property ID="0xCD6E33A5"/>
<property ID="0xC3CDAFCB"/>
<property ID="0x88BEFDEB"/>
<property ID="0x228EE623"/>
<property ID="0x7E31967C"/>
<property ID="0xDCB3F50E"/>
<property ID="0xBD917023"/>
<property ID="0x9A27DDC3"/>
<property ID="0x409618B6"/>
<property ID="0x0EEFA478"/>
<property ID="0x6B40ACEF"/>
<property ID="0x2672E0BF"/>
<property ID="0xE4CD14F9"/>
<property ID="0x1A422994"/>
<property ID="0x59CD8DEE"/>
<properties>
<property ID="0xF8B3ABE0" type="character"/>
<property ID="0x82DE5E29" type="string"/>
<property ID="0x1644AF87" type="string"/>
<property ID="0xDDB16979" type="float">
<default>3.0</default>
</property>
<property ID="0x2B201845" type="float">
<default>1.0</default>
</property>
<property ID="0xBF75E71F" type="float">
<default>1.0</default>
</property>
<property ID="0xE87BB75C" type="float">
<default>2.5</default>
</property>
<property ID="0x9545F9EF" type="float">
<default>0.5</default>
</property>
<property ID="0x1BD4C955" type="float">
<default>1.0</default>
</property>
<property ID="0x64ACDF7B" type="float">
<default>1.0</default>
</property>
<property ID="0xCD6E33A5" type="float">
<default>3.0</default>
</property>
<property ID="0xC3CDAFCB" type="float">
<default>1.5</default>
</property>
<property ID="0x88BEFDEB" type="float">
<default>2.2</default>
</property>
<property ID="0x228EE623" type="float">
<default>0.2</default>
</property>
<property ID="0x7E31967C" type="float">
<default>0.5</default>
</property>
<property ID="0xDCB3F50E" type="float">
<default>0.5</default>
</property>
<struct ID="0xBD917023" template="Structs/MayaSpline.xml"/>
<property ID="0x7C8454BD" type="float">
<default>2.0</default>
</property>
<property ID="0x42AC42EA" type="float">
<default>1.0</default>
</property>
<property ID="0x9A27DDC3" type="float">
<default>3.0</default>
</property>
<property ID="0x409618B6" type="float">
<default>15.0</default>
</property>
<property ID="0x0EEFA478" type="float">
<default>10.0</default>
</property>
<property ID="0x6B40ACEF" type="long">
<default>0</default>
</property>
<property ID="0x2672E0BF" type="file" extensions="PART"/>
<property ID="0xE4CD14F9" type="file" extensions="CAUD"/>
<property ID="0x1A422994" type="file" extensions="CAUD"/>
<property ID="0x59CD8DEE" type="file" extensions="CAUD"/>
</properties>
</struct>
</properties>
<states/>
<messages/>
<editor>
<properties>
<property name="InstanceName" ID="0x255A4580:0x494E414D"/>

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