Added check for the World Lighting Options property in LightParameters when lighting script nodes
This commit is contained in:
parent
e430cbfb73
commit
6669dd4367
|
@ -1,25 +0,0 @@
|
||||||
#include "CLightParameters.h"
|
|
||||||
|
|
||||||
CLightParameters::CLightParameters(CPropertyStruct *pStruct, EGame game)
|
|
||||||
: mpStruct(pStruct), mGame(game)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CLightParameters::~CLightParameters()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int CLightParameters::LightLayerIndex()
|
|
||||||
{
|
|
||||||
if (!mpStruct) return 0;
|
|
||||||
|
|
||||||
TLongProperty *pParam;
|
|
||||||
|
|
||||||
if (mGame <= ePrime)
|
|
||||||
pParam = (TLongProperty*) mpStruct->PropertyByIndex(0xD);
|
|
||||||
else
|
|
||||||
pParam = (TLongProperty*) mpStruct->PropertyByID(0x1F715FD3);
|
|
||||||
|
|
||||||
if (!pParam) return 0;
|
|
||||||
else return pParam->Get();
|
|
||||||
}
|
|
|
@ -4,15 +4,59 @@
|
||||||
#include "Core/Resource/CGameArea.h"
|
#include "Core/Resource/CGameArea.h"
|
||||||
#include "Core/Resource/Script/IProperty.h"
|
#include "Core/Resource/Script/IProperty.h"
|
||||||
|
|
||||||
|
enum EWorldLightingOptions
|
||||||
|
{
|
||||||
|
eUnknown1 = 0,
|
||||||
|
eNormalLighting = 1,
|
||||||
|
eUnknown2 = 2,
|
||||||
|
eDisableWorldLighting = 3
|
||||||
|
};
|
||||||
|
|
||||||
class CLightParameters
|
class CLightParameters
|
||||||
{
|
{
|
||||||
CPropertyStruct *mpStruct;
|
CPropertyStruct *mpStruct;
|
||||||
EGame mGame;
|
EGame mGame;
|
||||||
|
|
||||||
|
TLongProperty *mpLightLayer;
|
||||||
|
TLongProperty *mpWorldLightingOptions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLightParameters(CPropertyStruct *pStruct, EGame game);
|
CLightParameters(CPropertyStruct *pStruct, EGame Game)
|
||||||
~CLightParameters();
|
: mpStruct(pStruct)
|
||||||
int LightLayerIndex();
|
, mGame(Game)
|
||||||
|
, mpLightLayer(nullptr)
|
||||||
|
, mpWorldLightingOptions(nullptr)
|
||||||
|
{
|
||||||
|
if (mpStruct)
|
||||||
|
{
|
||||||
|
if (mGame <= ePrime)
|
||||||
|
{
|
||||||
|
mpWorldLightingOptions = (TLongProperty*) mpStruct->PropertyByIndex(0x7);
|
||||||
|
mpLightLayer = (TLongProperty*) mpStruct->PropertyByIndex(0xD);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mpWorldLightingOptions = (TLongProperty*) mpStruct->PropertyByIndex(0x6B5E7509);
|
||||||
|
mpLightLayer = (TLongProperty*) mpStruct->PropertyByID(0x1F715FD3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int LightLayerIndex() const
|
||||||
|
{
|
||||||
|
if (!mpLightLayer)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return mpLightLayer->Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline EWorldLightingOptions WorldLightingOptions() const
|
||||||
|
{
|
||||||
|
if (mpWorldLightingOptions)
|
||||||
|
return (EWorldLightingOptions) mpWorldLightingOptions->Get();
|
||||||
|
else
|
||||||
|
return eNormalLighting;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLIGHTPARAMETERS_H
|
#endif // CLIGHTPARAMETERS_H
|
||||||
|
|
|
@ -251,7 +251,6 @@ SOURCES += \
|
||||||
ScriptExtra/CSpacePirateExtra.cpp \
|
ScriptExtra/CSpacePirateExtra.cpp \
|
||||||
ScriptExtra/CWaypointExtra.cpp \
|
ScriptExtra/CWaypointExtra.cpp \
|
||||||
CAreaAttributes.cpp \
|
CAreaAttributes.cpp \
|
||||||
CLightParameters.cpp \
|
|
||||||
CRayCollisionTester.cpp \
|
CRayCollisionTester.cpp \
|
||||||
Log.cpp \
|
Log.cpp \
|
||||||
OpenGL/CDynamicVertexBuffer.cpp \
|
OpenGL/CDynamicVertexBuffer.cpp \
|
||||||
|
|
|
@ -154,16 +154,30 @@ void CScriptNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
|
||||||
// Draw model
|
// Draw model
|
||||||
if (UsesModel())
|
if (UsesModel())
|
||||||
{
|
{
|
||||||
CGraphics::SetupAmbientColor();
|
EWorldLightingOptions LightingOptions = (mpLightParameters ? mpLightParameters->WorldLightingOptions() : eNormalLighting);
|
||||||
LoadModelMatrix();
|
|
||||||
|
if (CGraphics::sLightMode == CGraphics::eWorldLighting && LightingOptions == eDisableWorldLighting)
|
||||||
|
{
|
||||||
|
CGraphics::sNumLights = 0;
|
||||||
|
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skBlack;
|
||||||
|
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
|
||||||
|
CGraphics::UpdateLightBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
LoadLights(ViewInfo);
|
LoadLights(ViewInfo);
|
||||||
CGraphics::UpdateVertexBlock();
|
CGraphics::UpdateLightBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadModelMatrix();
|
||||||
|
|
||||||
// Draw model if possible!
|
// Draw model if possible!
|
||||||
if (mpActiveModel)
|
if (mpActiveModel)
|
||||||
{
|
{
|
||||||
if (mpExtra) CGraphics::sPixelBlock.TevColor = mpExtra->TevColor();
|
if (mpExtra) CGraphics::sPixelBlock.TevColor = mpExtra->TevColor();
|
||||||
else CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
else CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
||||||
|
|
||||||
CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo);
|
CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo);
|
||||||
CGraphics::UpdatePixelBlock();
|
CGraphics::UpdatePixelBlock();
|
||||||
|
|
||||||
|
|
|
@ -1701,7 +1701,7 @@
|
||||||
<property ID="0x6B40ACEF" name="Unknown"/>
|
<property ID="0x6B40ACEF" name="Unknown"/>
|
||||||
<property ID="0x6B4ED718" name="CAUD"/>
|
<property ID="0x6B4ED718" name="CAUD"/>
|
||||||
<property ID="0x6B571BA5" name="Unknown"/>
|
<property ID="0x6B571BA5" name="Unknown"/>
|
||||||
<property ID="0x6B5E7509" name="Unknown"/>
|
<property ID="0x6B5E7509" name="World Lighting Options"/>
|
||||||
<property ID="0x6B5E87A7" name="Unknown"/>
|
<property ID="0x6B5E87A7" name="Unknown"/>
|
||||||
<property ID="0x6B62E419" name="Unknown"/>
|
<property ID="0x6B62E419" name="Unknown"/>
|
||||||
<property ID="0x6B6ECC5D" name="Unknown"/>
|
<property ID="0x6B6ECC5D" name="Unknown"/>
|
||||||
|
|
|
@ -4,9 +4,15 @@
|
||||||
<property ID="0xA33E5B0E" type="color">
|
<property ID="0xA33E5B0E" type="color">
|
||||||
<default>1.0, 1.0, 1.0, 1.0</default>
|
<default>1.0, 1.0, 1.0, 1.0</default>
|
||||||
</property>
|
</property>
|
||||||
<property ID="0x6B5E7509" type="long">
|
<enum ID="0x6B5E7509">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
<enumerators>
|
||||||
|
<enumerator ID="0x00" name="Unknown 1"/>
|
||||||
|
<enumerator ID="0x01" name="Normal World Lighting"/>
|
||||||
|
<enumerator ID="0x02" name="Unknown 2"/>
|
||||||
|
<enumerator ID="0x03" name="Disable World Lighting"/>
|
||||||
|
</enumerators>
|
||||||
|
</enum>
|
||||||
<property ID="0x3DC5F0C6" type="bool">
|
<property ID="0x3DC5F0C6" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -8,7 +8,14 @@
|
||||||
<property ID="0x04" name="Unknown 4" type="float"/>
|
<property ID="0x04" name="Unknown 4" type="float"/>
|
||||||
<property ID="0x05" name="Unknown 5" type="color"/>
|
<property ID="0x05" name="Unknown 5" type="color"/>
|
||||||
<property ID="0x06" name="Unknown 6" type="bool"/>
|
<property ID="0x06" name="Unknown 6" type="bool"/>
|
||||||
<property ID="0x07" name="World Lighting Options" type="long"/>
|
<enum ID="0x07" name="World Lighting Options">
|
||||||
|
<enumerators>
|
||||||
|
<enumerator ID="0x00" name="Unknown 1"/>
|
||||||
|
<enumerator ID="0x01" name="Normal World Lighting"/>
|
||||||
|
<enumerator ID="0x02" name="Unknown 2"/>
|
||||||
|
<enumerator ID="0x03" name="Disable World Lighting"/>
|
||||||
|
</enumerators>
|
||||||
|
</enum>
|
||||||
<property ID="0x08" name="Light Recalculation Options" type="long"/>
|
<property ID="0x08" name="Light Recalculation Options" type="long"/>
|
||||||
<property ID="0x09" name="Unknown 7" type="vector3f"/>
|
<property ID="0x09" name="Unknown 7" type="vector3f"/>
|
||||||
<property ID="0x0A" name="Unknown 8" type="long"/>
|
<property ID="0x0A" name="Unknown 8" type="long"/>
|
||||||
|
|
|
@ -3040,7 +3040,7 @@
|
||||||
<property ID="0x6B20BDB0" name="Unknown"/>
|
<property ID="0x6B20BDB0" name="Unknown"/>
|
||||||
<property ID="0x6B554A8D" name="Unknown"/>
|
<property ID="0x6B554A8D" name="Unknown"/>
|
||||||
<property ID="0x6B571BA5" name="Unknown"/>
|
<property ID="0x6B571BA5" name="Unknown"/>
|
||||||
<property ID="0x6B5E7509" name="Unknown"/>
|
<property ID="0x6B5E7509" name="World Lighting Options"/>
|
||||||
<property ID="0x6B5E87A7" name="Unknown"/>
|
<property ID="0x6B5E87A7" name="Unknown"/>
|
||||||
<property ID="0x6B6606B8" name="ELSC"/>
|
<property ID="0x6B6606B8" name="ELSC"/>
|
||||||
<property ID="0x6B6BDC47" name="Holstering"/>
|
<property ID="0x6B6BDC47" name="Holstering"/>
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
<property ID="0xA71810E9" type="bool">
|
<property ID="0xA71810E9" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</property>
|
</property>
|
||||||
<property ID="0x6B5E7509" type="long">
|
<enum ID="0x6B5E7509">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
<enumerators>
|
||||||
|
<enumerator ID="0x00" name="Unknown 1"/>
|
||||||
|
<enumerator ID="0x01" name="Normal World Lighting"/>
|
||||||
|
<enumerator ID="0x02" name="Unknown 2"/>
|
||||||
|
<enumerator ID="0x03" name="Disable World Lighting"/>
|
||||||
|
</enumerators>
|
||||||
|
</enum>
|
||||||
<property ID="0x628E6AC3" type="long">
|
<property ID="0x628E6AC3" type="long">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -2761,7 +2761,7 @@
|
||||||
<property ID="0x6B20BDB0" name="Unknown"/>
|
<property ID="0x6B20BDB0" name="Unknown"/>
|
||||||
<property ID="0x6B554A8D" name="Unknown"/>
|
<property ID="0x6B554A8D" name="Unknown"/>
|
||||||
<property ID="0x6B571BA5" name="Unknown"/>
|
<property ID="0x6B571BA5" name="Unknown"/>
|
||||||
<property ID="0x6B5E7509" name="Unknown"/>
|
<property ID="0x6B5E7509" name="World Lighting Options"/>
|
||||||
<property ID="0x6B5E87A7" name="Unknown"/>
|
<property ID="0x6B5E87A7" name="Unknown"/>
|
||||||
<property ID="0x6B6606B8" name="ELSC"/>
|
<property ID="0x6B6606B8" name="ELSC"/>
|
||||||
<property ID="0x6B6BDC47" name="Holstering"/>
|
<property ID="0x6B6BDC47" name="Holstering"/>
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
<property ID="0xA71810E9" type="bool">
|
<property ID="0xA71810E9" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</property>
|
</property>
|
||||||
<property ID="0x6B5E7509" type="long">
|
<enum ID="0x6B5E7509">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
<enumerators>
|
||||||
|
<enumerator ID="0x00" name="Unknown 1"/>
|
||||||
|
<enumerator ID="0x01" name="Normal World Lighting"/>
|
||||||
|
<enumerator ID="0x02" name="Unknown 2"/>
|
||||||
|
<enumerator ID="0x03" name="Disable World Lighting"/>
|
||||||
|
</enumerators>
|
||||||
|
</enum>
|
||||||
<property ID="0x628E6AC3" type="long">
|
<property ID="0x628E6AC3" type="long">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -2302,7 +2302,7 @@
|
||||||
<property ID="0x6B20BDB0" name="Unknown"/>
|
<property ID="0x6B20BDB0" name="Unknown"/>
|
||||||
<property ID="0x6B554A8D" name="Unknown"/>
|
<property ID="0x6B554A8D" name="Unknown"/>
|
||||||
<property ID="0x6B571BA5" name="Unknown"/>
|
<property ID="0x6B571BA5" name="Unknown"/>
|
||||||
<property ID="0x6B5E7509" name="Unknown"/>
|
<property ID="0x6B5E7509" name="World Lighting Options"/>
|
||||||
<property ID="0x6B5E87A7" name="Unknown"/>
|
<property ID="0x6B5E87A7" name="Unknown"/>
|
||||||
<property ID="0x6B6606B8" name="ELSC"/>
|
<property ID="0x6B6606B8" name="ELSC"/>
|
||||||
<property ID="0x6B6BDC47" name="Holstering"/>
|
<property ID="0x6B6BDC47" name="Holstering"/>
|
||||||
|
|
|
@ -10,9 +10,15 @@
|
||||||
<property ID="0xA71810E9" type="bool">
|
<property ID="0xA71810E9" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</property>
|
</property>
|
||||||
<property ID="0x6B5E7509" type="long">
|
<enum ID="0x6B5E7509">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
<enumerators>
|
||||||
|
<enumerator ID="0x00" name="Unknown 1"/>
|
||||||
|
<enumerator ID="0x01" name="Normal World Lighting"/>
|
||||||
|
<enumerator ID="0x02" name="Unknown 2"/>
|
||||||
|
<enumerator ID="0x03" name="Disable World Lighting"/>
|
||||||
|
</enumerators>
|
||||||
|
</enum>
|
||||||
<property ID="0x3DC5F0C6" type="bool">
|
<property ID="0x3DC5F0C6" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -886,7 +886,7 @@
|
||||||
<property ID="0x6B1FBC3A" name="Unknown"/>
|
<property ID="0x6B1FBC3A" name="Unknown"/>
|
||||||
<property ID="0x6B20BDB0" name="Unknown"/>
|
<property ID="0x6B20BDB0" name="Unknown"/>
|
||||||
<property ID="0x6B571BA5" name="Unknown"/>
|
<property ID="0x6B571BA5" name="Unknown"/>
|
||||||
<property ID="0x6B5E7509" name="Unknown"/>
|
<property ID="0x6B5E7509" name="World Lighting Options"/>
|
||||||
<property ID="0x6BB8E35C" name="DamageInfo"/>
|
<property ID="0x6BB8E35C" name="DamageInfo"/>
|
||||||
<property ID="0x6BC22735" name="Unknown"/>
|
<property ID="0x6BC22735" name="Unknown"/>
|
||||||
<property ID="0x6BD4E178" name="Unknown"/>
|
<property ID="0x6BD4E178" name="Unknown"/>
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
<property ID="0xA71810E9" type="bool">
|
<property ID="0xA71810E9" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</property>
|
</property>
|
||||||
<property ID="0x6B5E7509" type="long">
|
<enum ID="0x6B5E7509">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
<enumerators>
|
||||||
|
<enumerator ID="0x00" name="Unknown 1"/>
|
||||||
|
<enumerator ID="0x01" name="Normal World Lighting"/>
|
||||||
|
<enumerator ID="0x02" name="Unknown 2"/>
|
||||||
|
<enumerator ID="0x03" name="Disable World Lighting"/>
|
||||||
|
</enumerators>
|
||||||
|
</enum>
|
||||||
<property ID="0x628E6AC3" type="long">
|
<property ID="0x628E6AC3" type="long">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue