mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-12 22:56:13 +00:00
Massive overhaul of property system done over the last few months. There is unfinished/broken stuff still, but it compiles now.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
, mpRenderSideProp(nullptr)
|
||||
, mpMat(nullptr)
|
||||
{
|
||||
for (u32 iTex = 0; iTex < 3; iTex++)
|
||||
@@ -15,21 +14,21 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
|
||||
SetInheritance(true, false, false);
|
||||
CreateMaterial();
|
||||
|
||||
CPropertyStruct *pBaseStruct = pInstance->Properties();
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
// Fetch render side
|
||||
mpRenderSideProp = TPropCast<TEnumProperty>(pBaseStruct->PropertyByIndex(0x5));
|
||||
if (mpRenderSideProp) PropertyModified(mpRenderSideProp);
|
||||
mRenderSide = TEnumRef<ERenderSide>(pInstance, pProperties->ChildByIndex(5));
|
||||
if (mRenderSide.IsValid()) PropertyModified(mRenderSide.Property());
|
||||
|
||||
// Fetch scale
|
||||
mpSizeProp = TPropCast<TVector3Property>(pBaseStruct->PropertyByIndex(0x2));
|
||||
if (mpSizeProp) PropertyModified(mpSizeProp);
|
||||
mPlaneSize = CVectorRef(pInstance, pProperties->ChildByIndex(2));
|
||||
if (mPlaneSize.IsValid()) PropertyModified(mPlaneSize.Property());
|
||||
|
||||
// Fetch textures
|
||||
for (u32 iTex = 0; iTex < 3; iTex++)
|
||||
for (u32 TextureIdx = 0; TextureIdx < 3; TextureIdx++)
|
||||
{
|
||||
mpTextureProps[iTex] = TPropCast<TAssetProperty>(pBaseStruct->PropertyByIndex(0x6 + iTex));
|
||||
if (mpTextureProps[iTex]) PropertyModified(mpTextureProps[iTex]);
|
||||
mTextureAssets[TextureIdx] = CAssetRef(pInstance, pProperties->ChildByIndex(6 + TextureIdx));
|
||||
if (mTextureAssets[TextureIdx].IsValid()) PropertyModified(mTextureAssets[TextureIdx].Property());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +79,7 @@ void CDamageableTriggerExtra::CreateMaterial()
|
||||
|
||||
void CDamageableTriggerExtra::UpdatePlaneTransform()
|
||||
{
|
||||
CVector3f Extent = mPlaneSize / 2.f;
|
||||
CVector3f Extent = mPlaneSize.Get() / 2.f;
|
||||
|
||||
switch (mRenderSide)
|
||||
{
|
||||
@@ -92,7 +91,7 @@ void CDamageableTriggerExtra::UpdatePlaneTransform()
|
||||
mPosition = CVector3f(0.f, Extent.Y * Scalar, 0.f);
|
||||
mRotation = CQuaternion::FromEuler(CVector3f(90.f * Scalar, 0.f, 0.f));
|
||||
mScale = CVector3f(Extent.X, Extent.Z, 0.f);
|
||||
mCoordScale = mPlaneSize.XZ();
|
||||
mCoordScale = mPlaneSize.Get().XZ();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -104,7 +103,7 @@ void CDamageableTriggerExtra::UpdatePlaneTransform()
|
||||
mPosition = CVector3f(-Extent.X * Scalar, 0.f, 0.f);
|
||||
mRotation = CQuaternion::FromEuler(CVector3f(0.f, 90.f * Scalar, 0.f));
|
||||
mScale = CVector3f(Extent.Z, Extent.Y, 0.f);
|
||||
mCoordScale = -mPlaneSize.YZ();
|
||||
mCoordScale = -mPlaneSize.Get().YZ();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -117,7 +116,7 @@ void CDamageableTriggerExtra::UpdatePlaneTransform()
|
||||
mPosition = CVector3f(0.f, 0.f, Extent.Z * Scalar);
|
||||
mRotation = CQuaternion::FromEuler(CVector3f(0.f, RotAngle, 0.f));
|
||||
mScale = CVector3f(Extent.X, Extent.Y, 0.f);
|
||||
mCoordScale = -mPlaneSize.XY();
|
||||
mCoordScale = -mPlaneSize.Get().XY();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -176,36 +175,28 @@ CDamageableTriggerExtra::ERenderSide CDamageableTriggerExtra::TransformRenderSid
|
||||
|
||||
void CDamageableTriggerExtra::OnTransformed()
|
||||
{
|
||||
mPlaneSize = mpSizeProp->Get();
|
||||
UpdatePlaneTransform();
|
||||
}
|
||||
|
||||
void CDamageableTriggerExtra::PropertyModified(IProperty *pProperty)
|
||||
void CDamageableTriggerExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
{
|
||||
if (pProperty == mpRenderSideProp)
|
||||
if (pProperty == mRenderSide || pProperty == mPlaneSize)
|
||||
{
|
||||
mRenderSide = TransformRenderSide( (ERenderSide) mpRenderSideProp->Get() );
|
||||
UpdatePlaneTransform();
|
||||
}
|
||||
|
||||
else if (pProperty == mpSizeProp)
|
||||
{
|
||||
mPlaneSize = mpSizeProp->Get();
|
||||
UpdatePlaneTransform();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (u32 iTex = 0; iTex < 3; iTex++)
|
||||
for (u32 TextureIdx = 0; TextureIdx < 3; TextureIdx++)
|
||||
{
|
||||
if (pProperty == mpTextureProps[iTex])
|
||||
if (pProperty == mTextureAssets[TextureIdx].Property())
|
||||
{
|
||||
mpTextures[iTex] = gpResourceStore->LoadResource<CTexture>( mpTextureProps[iTex]->Get() );
|
||||
mpTextures[TextureIdx] = gpResourceStore->LoadResource<CTexture>( mTextureAssets[TextureIdx].Get() );
|
||||
|
||||
if (mpTextures[iTex] && mpTextures[iTex]->Type() != eTexture)
|
||||
mpTextures[iTex] = nullptr;
|
||||
if (mpTextures[TextureIdx] && mpTextures[TextureIdx]->Type() != eTexture)
|
||||
mpTextures[TextureIdx] = nullptr;
|
||||
|
||||
mpMat->Pass(iTex)->SetTexture(mpTextures[iTex]);
|
||||
mpMat->Pass(TextureIdx)->SetTexture(mpTextures[TextureIdx]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,12 @@ class CDamageableTriggerExtra : public CScriptExtra
|
||||
eDown = 0x20
|
||||
};
|
||||
|
||||
TVector3Property *mpSizeProp;
|
||||
TEnumProperty *mpRenderSideProp;
|
||||
TAssetProperty *mpTextureProps[3];
|
||||
CVectorRef mPlaneSize;
|
||||
TEnumRef<ERenderSide> mRenderSide;
|
||||
CAssetRef mTextureAssets[3];
|
||||
|
||||
CVector3f mPlaneSize;
|
||||
ERenderSide mRenderSide;
|
||||
TResPtr<CTexture> mpTextures[3];
|
||||
|
||||
CMaterial *mpMat;
|
||||
CMaterial* mpMat;
|
||||
CTexture* mpTextures[3];
|
||||
CVector2f mCoordScale;
|
||||
|
||||
float mCachedRayDistance;
|
||||
@@ -38,7 +35,7 @@ public:
|
||||
ERenderSide RenderSideForDirection(const CVector3f& rkDir);
|
||||
ERenderSide TransformRenderSide(ERenderSide Side);
|
||||
void OnTransformed();
|
||||
void PropertyModified(IProperty *pProperty);
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
bool ShouldDrawNormalAssets();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||
|
||||
@@ -1,35 +1,32 @@
|
||||
#include "CDoorExtra.h"
|
||||
#include "Core/Render/CRenderer.h"
|
||||
|
||||
CDoorExtra::CDoorExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
CDoorExtra::CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
, mpShieldModelProp(nullptr)
|
||||
, mpShieldColorProp(nullptr)
|
||||
, mpShieldModel(nullptr)
|
||||
{
|
||||
CPropertyStruct *pBaseStruct = pInstance->Properties();
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
mpShieldModelProp = TPropCast<TAssetProperty>(pBaseStruct->PropertyByID(0xB20CC271));
|
||||
if (mpShieldModelProp) PropertyModified(mpShieldModelProp);
|
||||
mShieldModelProp = CAssetRef(pInstance, pProperties->ChildByID(0xB20CC271));
|
||||
if (mShieldModelProp.IsValid()) PropertyModified(mShieldModelProp.Property());
|
||||
|
||||
if (mGame >= eEchoes)
|
||||
{
|
||||
mpShieldColorProp = TPropCast<TColorProperty>(pBaseStruct->PropertyByID(0x47B4E863));
|
||||
if (mpShieldColorProp) PropertyModified(mpShieldColorProp);
|
||||
mShieldColorProp = CColorRef(pInstance, pProperties->ChildByID(0x47B4E863));
|
||||
if (mShieldColorProp.IsValid()) PropertyModified(mShieldColorProp.Property());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
mpDisabledProp = TPropCast<TBoolProperty>(pBaseStruct->PropertyByID(0xDEE730F5));
|
||||
if (mpDisabledProp) PropertyModified(mpDisabledProp);
|
||||
mDisabledProp = CBoolRef(pInstance, pProperties->ChildByID(0xDEE730F5));
|
||||
if (mDisabledProp.IsValid()) PropertyModified(mDisabledProp.Property());
|
||||
}
|
||||
}
|
||||
|
||||
void CDoorExtra::PropertyModified(IProperty *pProperty)
|
||||
void CDoorExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
{
|
||||
if (pProperty == mpShieldModelProp)
|
||||
if (pProperty == mShieldModelProp)
|
||||
{
|
||||
mpShieldModel = gpResourceStore->LoadResource<CModel>( mpShieldModelProp->Get() );
|
||||
mpShieldModel = gpResourceStore->LoadResource<CModel>( mShieldModelProp.Get() );
|
||||
|
||||
if (mpShieldModel)
|
||||
mLocalAABox = mpShieldModel->AABox();
|
||||
@@ -40,18 +37,13 @@ void CDoorExtra::PropertyModified(IProperty *pProperty)
|
||||
MarkTransformChanged();
|
||||
}
|
||||
|
||||
else if (pProperty == mpShieldColorProp)
|
||||
{
|
||||
mShieldColor = mpShieldColorProp->Get();
|
||||
}
|
||||
|
||||
else if (pProperty == mpDisabledProp)
|
||||
else if (pProperty == mDisabledProp)
|
||||
{
|
||||
// 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())
|
||||
if (!mDisabledProp)
|
||||
mShieldColor = CColor::skCyan;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,17 @@
|
||||
class CDoorExtra : public CScriptExtra
|
||||
{
|
||||
// Render colored door shield in MP2/3
|
||||
TAssetProperty *mpShieldModelProp;
|
||||
TColorProperty *mpShieldColorProp;
|
||||
TBoolProperty *mpDisabledProp;
|
||||
CAssetRef mShieldModelProp;
|
||||
CColorRef mShieldColorProp;
|
||||
CBoolRef mDisabledProp;
|
||||
|
||||
TResPtr<CModel> mpShieldModel;
|
||||
CColor mShieldColor;
|
||||
|
||||
public:
|
||||
explicit CDoorExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||
void PropertyModified(IProperty *pProperty);
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||
explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||
void DrawSelection();
|
||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||
|
||||
@@ -5,21 +5,21 @@ const CColor CPointOfInterestExtra::skImportantColor = CColor::Integral(0xFF,0x0
|
||||
|
||||
CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
, mpScanProperty(nullptr)
|
||||
, mpScanData(nullptr)
|
||||
{
|
||||
// Fetch scan data property
|
||||
CPropertyStruct *pBaseProp = pInstance->Properties();
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
if (mGame <= ePrime) mpScanProperty = TPropCast<TAssetProperty>(pBaseProp->PropertyByIDString("0x04:0x00"));
|
||||
else mpScanProperty = (TAssetProperty*) pBaseProp->PropertyByIDString("0xBDBEC295:0xB94E9BE7");
|
||||
if (mpScanProperty) PropertyModified(mpScanProperty);
|
||||
if (mGame <= ePrime) mScanProperty = CAssetRef(pInstance, pProperties->ChildByIDString("0x04:0x00"));
|
||||
else mScanProperty = CAssetRef(pInstance, pProperties->ChildByIDString("0xBDBEC295:0xB94E9BE7"));
|
||||
|
||||
PropertyModified(mScanProperty.Property());
|
||||
}
|
||||
|
||||
void CPointOfInterestExtra::PropertyModified(IProperty* pProperty)
|
||||
void CPointOfInterestExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
{
|
||||
if (mpScanProperty == pProperty)
|
||||
mpScanData = gpResourceStore->LoadResource<CScan>( mpScanProperty->Get() );
|
||||
if (mScanProperty.Property() == pProperty)
|
||||
mpScanData = gpResourceStore->LoadResource<CScan>( mScanProperty.Get() );
|
||||
}
|
||||
|
||||
void CPointOfInterestExtra::ModifyTintColor(CColor& Color)
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
class CPointOfInterestExtra : public CScriptExtra
|
||||
{
|
||||
// Tint POI billboard orange/red depending on scan importance
|
||||
TAssetProperty *mpScanProperty;
|
||||
CAssetRef mScanProperty;
|
||||
TResPtr<CScan> mpScanData;
|
||||
|
||||
public:
|
||||
explicit CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||
void PropertyModified(IProperty* pProperty);
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void ModifyTintColor(CColor& Color);
|
||||
CScan* GetScan() const { return mpScanData; }
|
||||
|
||||
|
||||
@@ -2,32 +2,32 @@
|
||||
#include "Core/Render/CDrawUtil.h"
|
||||
#include "Core/Render/CRenderer.h"
|
||||
|
||||
CRadiusSphereExtra::CRadiusSphereExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
CRadiusSphereExtra::CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
, mpRadius(nullptr)
|
||||
{
|
||||
mObjectType = pInstance->ObjectTypeID();
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
switch (mObjectType)
|
||||
{
|
||||
case 0x63: // Repulsor (MP1)
|
||||
mpRadius = TPropCast<TFloatProperty>(pInstance->Properties()->PropertyByID(0x3));
|
||||
mRadius = CFloatRef(pInstance, pProperties->ChildByID(3));
|
||||
break;
|
||||
|
||||
case 0x68: // RadialDamage (MP1)
|
||||
mpRadius = TPropCast<TFloatProperty>(pInstance->Properties()->PropertyByID(0x4));
|
||||
mRadius = CFloatRef(pInstance, pProperties->ChildByID(0x4));
|
||||
break;
|
||||
|
||||
case 0x5245504C: // "REPL" Repulsor (MP2/MP3)
|
||||
case 0x52414444: // "RADD" RadialDamage (MP2/MP3/DKCR)
|
||||
mpRadius = TPropCast<TFloatProperty>(pInstance->Properties()->PropertyByID(0x78C507EB));
|
||||
case FOURCC('REPL'): // Repulsor (MP2/MP3)
|
||||
case FOURCC('RADD'): // RadialDamage (MP2/MP3/DKCR)
|
||||
mRadius = CFloatRef(pInstance, pProperties->ChildByID(0x78C507EB));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CRadiusSphereExtra::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo)
|
||||
void CRadiusSphereExtra::AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo)
|
||||
{
|
||||
if (!rkViewInfo.GameMode && (rkViewInfo.ShowFlags & eShowObjectGeometry) && mpRadius && mpParent->IsVisible() && mpParent->IsSelected())
|
||||
if (!rkViewInfo.GameMode && (rkViewInfo.ShowFlags & eShowObjectGeometry) && mRadius.IsValid() && mpParent->IsVisible() && mpParent->IsSelected())
|
||||
{
|
||||
CAABox BoundingBox = Bounds();
|
||||
|
||||
@@ -42,7 +42,7 @@ void CRadiusSphereExtra::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
CDrawUtil::DrawWireSphere(mpInstance->Position(), mpRadius->Get(), Color());
|
||||
CDrawUtil::DrawWireSphere(mpInstance->Position(), mRadius, Color());
|
||||
}
|
||||
|
||||
CColor CRadiusSphereExtra::Color() const
|
||||
@@ -66,7 +66,7 @@ CColor CRadiusSphereExtra::Color() const
|
||||
|
||||
CAABox CRadiusSphereExtra::Bounds() const
|
||||
{
|
||||
CAABox Bounds = CAABox::skOne * 2.f * mpRadius->Get();
|
||||
CAABox Bounds = CAABox::skOne * 2.f * mRadius;
|
||||
Bounds += mpParent->AbsolutePosition();
|
||||
return Bounds;
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ class CRadiusSphereExtra : public CScriptExtra
|
||||
{
|
||||
// Sphere visualization for objects that have a float radius property.
|
||||
u32 mObjectType;
|
||||
TFloatProperty *mpRadius;
|
||||
CFloatRef mRadius;
|
||||
|
||||
public:
|
||||
explicit CRadiusSphereExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||
explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
|
||||
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||
CColor Color() const;
|
||||
CAABox Bounds() const;
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
#include "CSandwormExtra.h"
|
||||
|
||||
CSandwormExtra::CSandwormExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
CSandwormExtra::CSandwormExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
{
|
||||
// The back pincers need to be flipped 180 degrees
|
||||
for (u32 iAttach = 0; iAttach < pParent->NumAttachments(); iAttach++)
|
||||
for (u32 AttachIdx = 0; AttachIdx < pParent->NumAttachments(); AttachIdx++)
|
||||
{
|
||||
CScriptAttachNode *pAttach = pParent->Attachment(iAttach);
|
||||
CScriptAttachNode *pAttach = pParent->Attachment(AttachIdx);
|
||||
|
||||
if (pAttach->LocatorName() == "L_back_claw" || pAttach->LocatorName() == "R_back_claw")
|
||||
pAttach->SetRotation(CVector3f(0,0,180));
|
||||
}
|
||||
|
||||
// Get pincers scale
|
||||
mpPincersScaleProperty = TPropCast<TFloatProperty>(pInstance->PropertyByIDString("0x3DB583AE"));
|
||||
if (mpPincersScaleProperty) PropertyModified(mpPincersScaleProperty);
|
||||
mPincersScale = CFloatRef(pInstance, pInstance->Template()->Properties()->ChildByID(0x3DB583AE));
|
||||
if (mPincersScale.IsValid()) PropertyModified(mPincersScale.Property());
|
||||
}
|
||||
|
||||
void CSandwormExtra::PropertyModified(IProperty *pProp)
|
||||
void CSandwormExtra::PropertyModified(IPropertyNew* pProp)
|
||||
{
|
||||
if (pProp == mpPincersScaleProperty)
|
||||
if (pProp == mPincersScale)
|
||||
{
|
||||
for (u32 iAttach = 0; iAttach < mpScriptNode->NumAttachments(); iAttach++)
|
||||
for (u32 AttachIdx = 0; AttachIdx < mpScriptNode->NumAttachments(); AttachIdx++)
|
||||
{
|
||||
CScriptAttachNode *pAttach = mpScriptNode->Attachment(iAttach);
|
||||
pAttach->SetScale(CVector3f(mpPincersScaleProperty->Get()));
|
||||
CScriptAttachNode* pAttach = mpScriptNode->Attachment(AttachIdx);
|
||||
pAttach->SetScale( CVector3f(mPincersScale) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
class CSandwormExtra : public CScriptExtra
|
||||
{
|
||||
// Transform adjustments to Sandworm attachments.
|
||||
TFloatProperty *mpPincersScaleProperty;
|
||||
CFloatRef mPincersScale;
|
||||
|
||||
public:
|
||||
explicit CSandwormExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent);
|
||||
void PropertyModified(IProperty *pProp);
|
||||
explicit CSandwormExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent);
|
||||
void PropertyModified(IPropertyNew* pProp);
|
||||
};
|
||||
|
||||
#endif // CSANDWORMEXTRA_H
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
// Virtual CScriptExtra functions
|
||||
virtual void InstanceTransformed() {}
|
||||
virtual void PropertyModified(IProperty* /*pProperty*/) {}
|
||||
virtual void PropertyModified(IPropertyNew* /*pProperty*/) {}
|
||||
virtual void DisplayAssetChanged(CResource* /*pNewDisplayAsset*/) {}
|
||||
virtual void LinksModified() {}
|
||||
virtual bool ShouldDrawNormalAssets() { return true; }
|
||||
|
||||
@@ -1,37 +1,33 @@
|
||||
#include "CSpacePirateExtra.h"
|
||||
|
||||
CSpacePirateExtra::CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
CSpacePirateExtra::CSpacePirateExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene ,pParent)
|
||||
, mpPowerVuln(nullptr)
|
||||
, mpWaveVuln(nullptr)
|
||||
, mpIceVuln(nullptr)
|
||||
, mpPlasmaVuln(nullptr)
|
||||
{
|
||||
CPropertyStruct *pBaseStruct = pInstance->Properties();
|
||||
CPropertyStruct *pVulns = (CPropertyStruct*) pBaseStruct->PropertyByIDString("0x04:0x10");
|
||||
CStructPropertyNew* pBaseStruct = pInstance->Template()->Properties();
|
||||
CStructPropertyNew* pVulnerabilities = TPropCast<CStructPropertyNew>(pBaseStruct->ChildByIDString("0x04:0x10"));
|
||||
|
||||
if (pVulns && pVulns->Type() == eStructProperty)
|
||||
if (pVulnerabilities)
|
||||
{
|
||||
mpPowerVuln = TPropCast<TEnumProperty>(pVulns->PropertyByID(0x0));
|
||||
mpWaveVuln = TPropCast<TEnumProperty>(pVulns->PropertyByID(0x2));
|
||||
mpIceVuln = TPropCast<TEnumProperty>(pVulns->PropertyByID(0x1));
|
||||
mpPlasmaVuln = TPropCast<TEnumProperty>(pVulns->PropertyByID(0x3));
|
||||
mPowerVulnerability = TEnumRef<EVulnerabilityTypeMP1>(pInstance, pVulnerabilities->ChildByID(0));
|
||||
mWaveVulnerability = TEnumRef<EVulnerabilityTypeMP1>(pInstance, pVulnerabilities->ChildByID(2));
|
||||
mIceVulnerability = TEnumRef<EVulnerabilityTypeMP1>(pInstance, pVulnerabilities->ChildByID(1));
|
||||
mPlasmaVulnerability = TEnumRef<EVulnerabilityTypeMP1>(pInstance, pVulnerabilities->ChildByID(3));
|
||||
}
|
||||
}
|
||||
|
||||
CColor CSpacePirateExtra::TevColor()
|
||||
{
|
||||
// Priority: Plasma -> Ice -> Power -> Wave
|
||||
if (mpPlasmaVuln && mpPlasmaVuln->Get() == 1)
|
||||
if (mPlasmaVulnerability.IsValid() && mPlasmaVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
|
||||
return CColor::skRed;
|
||||
|
||||
if (mpIceVuln && mpIceVuln->Get() == 1)
|
||||
if (mIceVulnerability.IsValid() && mIceVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
|
||||
return CColor::skWhite;
|
||||
|
||||
if (mpPowerVuln && mpPowerVuln->Get() == 1)
|
||||
if (mPowerVulnerability.IsValid() && mPowerVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
|
||||
return CColor::skYellow;
|
||||
|
||||
if (mpWaveVuln && mpWaveVuln->Get() == 1)
|
||||
if (mWaveVulnerability.IsValid() && mWaveVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
|
||||
return CColor::skPurple;
|
||||
|
||||
return CColor::skWhite;
|
||||
|
||||
@@ -4,13 +4,25 @@
|
||||
#include "CScriptExtra.h"
|
||||
#include "Core/Resource/Script/IProperty.h"
|
||||
|
||||
enum class EVulnerabilityTypeMP1
|
||||
{
|
||||
DoubleDamage,
|
||||
Normal,
|
||||
Reflect,
|
||||
Immune,
|
||||
PassThru,
|
||||
DirectDouble,
|
||||
DirectNormal,
|
||||
DirectImmune
|
||||
};
|
||||
|
||||
class CSpacePirateExtra : public CScriptExtra
|
||||
{
|
||||
// Render beam troopers with the correct color
|
||||
TEnumProperty *mpPowerVuln;
|
||||
TEnumProperty *mpWaveVuln;
|
||||
TEnumProperty *mpIceVuln;
|
||||
TEnumProperty *mpPlasmaVuln;
|
||||
TEnumRef<EVulnerabilityTypeMP1> mPowerVulnerability;
|
||||
TEnumRef<EVulnerabilityTypeMP1> mWaveVulnerability;
|
||||
TEnumRef<EVulnerabilityTypeMP1> mIceVulnerability;
|
||||
TEnumRef<EVulnerabilityTypeMP1> mPlasmaVulnerability;
|
||||
|
||||
public:
|
||||
explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
#include "Core/Resource/Script/CLink.h"
|
||||
#include "Core/Scene/CScene.h"
|
||||
|
||||
CSplinePathExtra::CSplinePathExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent)
|
||||
CSplinePathExtra::CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
{
|
||||
mpPathColor = TPropCast<TColorProperty>(pInstance->Properties()->PropertyByID(0x00DD86E2));
|
||||
mPathColor = CColorRef(pInstance, pInstance->Template()->Properties()->ChildByID(0x00DD86E2));
|
||||
}
|
||||
|
||||
void CSplinePathExtra::PropertyModified(IProperty *pProperty)
|
||||
void CSplinePathExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
{
|
||||
if (pProperty == mpPathColor)
|
||||
if (pProperty == mPathColor.Property())
|
||||
{
|
||||
for (auto it = mWaypoints.begin(); it != mWaypoints.end(); it++)
|
||||
(*it)->CheckColor();
|
||||
@@ -23,7 +23,7 @@ void CSplinePathExtra::PostLoad()
|
||||
AddWaypoints();
|
||||
}
|
||||
|
||||
void CSplinePathExtra::FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra *pWaypoint)
|
||||
void CSplinePathExtra::FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra* pWaypoint)
|
||||
{
|
||||
if (rChecked.find(pWaypoint) != rChecked.end())
|
||||
return;
|
||||
@@ -46,18 +46,18 @@ void CSplinePathExtra::AddWaypoints()
|
||||
|
||||
std::set<CWaypointExtra*> CheckedWaypoints;
|
||||
|
||||
for (u32 iLink = 0; iLink < mpInstance->NumLinks(eOutgoing); iLink++)
|
||||
for (u32 LinkIdx = 0; LinkIdx < mpInstance->NumLinks(eOutgoing); LinkIdx++)
|
||||
{
|
||||
CLink *pLink = mpInstance->Link(eOutgoing, iLink);
|
||||
CLink* pLink = mpInstance->Link(eOutgoing, LinkIdx);
|
||||
|
||||
if ( (pLink->State() == 0x49533030 && pLink->Message() == 0x41544348) || // InternalState00/Attach
|
||||
(pLink->State() == 0x4D4F5450 && pLink->Message() == 0x41544348) ) // MotionPath/Attach
|
||||
if ( (pLink->State() == FOURCC('IS00') && pLink->Message() == FOURCC('ATCH')) || // InternalState00/Attach
|
||||
(pLink->State() == FOURCC('MOTP') && pLink->Message() == FOURCC('ATCH')) ) // MotionPath/Attach
|
||||
{
|
||||
CScriptNode *pNode = mpScene->NodeForInstanceID(pLink->ReceiverID());
|
||||
CScriptNode* pNode = mpScene->NodeForInstanceID(pLink->ReceiverID());
|
||||
|
||||
if (pNode && pNode->Instance()->ObjectTypeID() == 0x57415950) // Waypoint
|
||||
if (pNode && pNode->Instance()->ObjectTypeID() == FOURCC('WAYP')) // Waypoint
|
||||
{
|
||||
CWaypointExtra *pWaypoint = static_cast<CWaypointExtra*>(pNode->Extra());
|
||||
CWaypointExtra* pWaypoint = static_cast<CWaypointExtra*>(pNode->Extra());
|
||||
FindAttachedWaypoints(CheckedWaypoints, pWaypoint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,20 +11,20 @@ class CWaypointExtra;
|
||||
class CSplinePathExtra : public CScriptExtra
|
||||
{
|
||||
// Recolor waypoint paths to match the editor color parameter
|
||||
TColorProperty *mpPathColor;
|
||||
CColorRef mPathColor;
|
||||
std::list<CWaypointExtra*> mWaypoints;
|
||||
|
||||
public:
|
||||
explicit CSplinePathExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||
explicit CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
|
||||
~CSplinePathExtra() { ClearWaypoints(); }
|
||||
inline CColor PathColor() const { return (mpPathColor ? mpPathColor->Get() : CColor::skBlack); }
|
||||
inline CColor PathColor() const { return (mPathColor.IsValid() ? mPathColor.Get() : CColor::skBlack); }
|
||||
|
||||
void PostLoad();
|
||||
void PropertyModified(IProperty *pProperty);
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
|
||||
void FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra *pWaypoint);
|
||||
void FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra* pWaypoint);
|
||||
void AddWaypoints();
|
||||
void RemoveWaypoint(CWaypointExtra *pWaypoint);
|
||||
void RemoveWaypoint(CWaypointExtra* pWaypoint);
|
||||
void ClearWaypoints();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user