mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 01:15:26 +00:00
Added check for the World Lighting Options property in LightParameters when lighting script nodes
This commit is contained in:
@@ -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/Script/IProperty.h"
|
||||
|
||||
enum EWorldLightingOptions
|
||||
{
|
||||
eUnknown1 = 0,
|
||||
eNormalLighting = 1,
|
||||
eUnknown2 = 2,
|
||||
eDisableWorldLighting = 3
|
||||
};
|
||||
|
||||
class CLightParameters
|
||||
{
|
||||
CPropertyStruct *mpStruct;
|
||||
EGame mGame;
|
||||
|
||||
TLongProperty *mpLightLayer;
|
||||
TLongProperty *mpWorldLightingOptions;
|
||||
|
||||
public:
|
||||
CLightParameters(CPropertyStruct *pStruct, EGame game);
|
||||
~CLightParameters();
|
||||
int LightLayerIndex();
|
||||
CLightParameters(CPropertyStruct *pStruct, EGame Game)
|
||||
: mpStruct(pStruct)
|
||||
, 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
|
||||
|
||||
@@ -251,7 +251,6 @@ SOURCES += \
|
||||
ScriptExtra/CSpacePirateExtra.cpp \
|
||||
ScriptExtra/CWaypointExtra.cpp \
|
||||
CAreaAttributes.cpp \
|
||||
CLightParameters.cpp \
|
||||
CRayCollisionTester.cpp \
|
||||
Log.cpp \
|
||||
OpenGL/CDynamicVertexBuffer.cpp \
|
||||
|
||||
@@ -154,16 +154,30 @@ void CScriptNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
|
||||
// Draw model
|
||||
if (UsesModel())
|
||||
{
|
||||
CGraphics::SetupAmbientColor();
|
||||
EWorldLightingOptions LightingOptions = (mpLightParameters ? mpLightParameters->WorldLightingOptions() : eNormalLighting);
|
||||
|
||||
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);
|
||||
CGraphics::UpdateLightBlock();
|
||||
}
|
||||
|
||||
LoadModelMatrix();
|
||||
LoadLights(ViewInfo);
|
||||
CGraphics::UpdateVertexBlock();
|
||||
|
||||
// Draw model if possible!
|
||||
if (mpActiveModel)
|
||||
{
|
||||
if (mpExtra) CGraphics::sPixelBlock.TevColor = mpExtra->TevColor();
|
||||
else CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
||||
|
||||
CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo);
|
||||
CGraphics::UpdatePixelBlock();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user