mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-10 05:57:48 +00:00
Added Game Mode in the World Editor
This commit is contained in:
@@ -12,6 +12,7 @@ CScriptObject::CScriptObject(CGameArea *pArea, CScriptLayer *pLayer, CScriptTemp
|
||||
mpDisplayModel = nullptr;
|
||||
mpBillboard = nullptr;
|
||||
mpCollision = nullptr;
|
||||
mHasInGameModel = false;
|
||||
}
|
||||
|
||||
CScriptObject::~CScriptObject()
|
||||
@@ -36,6 +37,7 @@ void CScriptObject::EvaluateProperties()
|
||||
mpScale = mpTemplate->FindScale(mpProperties);
|
||||
mpActive = mpTemplate->FindActive(mpProperties);
|
||||
mpLightParameters = mpTemplate->FindLightParameters(mpProperties);
|
||||
mHasInGameModel = mpTemplate->HasInGameModel(mpProperties);
|
||||
mVolumeShape = mpTemplate->VolumeShape(this);
|
||||
EvaluateDisplayModel();
|
||||
EvaluateBillboard();
|
||||
@@ -168,7 +170,12 @@ bool CScriptObject::IsActive() const
|
||||
if (mpActive)
|
||||
return mpActive->Get();
|
||||
else
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CScriptObject::HasInGameModel() const
|
||||
{
|
||||
return mHasInGameModel;
|
||||
}
|
||||
|
||||
void CScriptObject::SetPosition(const CVector3f& newPos)
|
||||
|
||||
@@ -37,6 +37,8 @@ class CScriptObject
|
||||
CToken mModelToken;
|
||||
CToken mBillboardToken;
|
||||
CToken mCollisionToken;
|
||||
bool mHasInGameModel;
|
||||
|
||||
EVolumeShape mVolumeShape;
|
||||
|
||||
public:
|
||||
@@ -69,6 +71,7 @@ public:
|
||||
CVector3f Scale() const;
|
||||
TString InstanceName() const;
|
||||
bool IsActive() const;
|
||||
bool HasInGameModel() const;
|
||||
void SetPosition(const CVector3f& newPos);
|
||||
void SetRotation(const CVector3f& newRot);
|
||||
void SetScale(const CVector3f& newScale);
|
||||
|
||||
@@ -210,7 +210,7 @@ CPropertyStruct* CScriptTemplate::FindLightParameters(CPropertyStruct *pProperti
|
||||
return TFetchProperty<CPropertyStruct*, eStructProperty>(pProperties, mLightParametersIDString);
|
||||
}
|
||||
|
||||
// todo: merge these three functions, they have near-identical code
|
||||
// todo: merge these four functions, they have near-identical code
|
||||
CModel* CScriptTemplate::FindDisplayModel(CPropertyStruct *pProperties)
|
||||
{
|
||||
for (auto it = mAssets.begin(); it != mAssets.end(); it++)
|
||||
@@ -319,6 +319,36 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(CPropertyStruct *pProperties
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CScriptTemplate::HasInGameModel(CPropertyStruct *pProperties)
|
||||
{
|
||||
for (auto it = mAssets.begin(); it != mAssets.end(); it++)
|
||||
{
|
||||
if ((it->AssetType != SEditorAsset::eModel) && (it->AssetType != SEditorAsset::eAnimParams)) continue;
|
||||
if (it->AssetSource == SEditorAsset::eFile) continue;
|
||||
CResource *pRes = nullptr;
|
||||
|
||||
CPropertyBase *pProp = pProperties->PropertyByIDString(it->AssetLocation);
|
||||
|
||||
if (pProp->Type() == eFileProperty)
|
||||
{
|
||||
CFileProperty *pFile = static_cast<CFileProperty*>(pProp);
|
||||
pRes = pFile->Get();
|
||||
}
|
||||
|
||||
else if (pProp->Type() == eAnimParamsProperty)
|
||||
{
|
||||
CAnimParamsProperty *pParams = static_cast<CAnimParamsProperty*>(pProp);
|
||||
pRes = pParams->Get().GetCurrentModel(it->ForceNodeIndex);
|
||||
}
|
||||
|
||||
// Verify resource exists + is correct type
|
||||
if (pRes && (pRes->Type() == eModel))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CScriptTemplate::HasPosition()
|
||||
{
|
||||
return (!mPositionIDString.IsEmpty());
|
||||
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
CModel* FindDisplayModel(CPropertyStruct *pProperties);
|
||||
CTexture* FindBillboardTexture(CPropertyStruct *pProperties);
|
||||
CCollisionMeshGroup* FindCollision(CPropertyStruct *pProperties);
|
||||
bool HasInGameModel(CPropertyStruct *pProperties);
|
||||
bool HasPosition();
|
||||
|
||||
// Object Tracking
|
||||
|
||||
Reference in New Issue
Block a user