mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-12 22:56:13 +00:00
Updated to Script Template V4
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user