summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/Clock.cpp9
-rw-r--r--src/core/Clock.h3
-rw-r--r--src/core/main.cpp4
-rw-r--r--src/extras/custompipes_d3d9.cpp3
-rw-r--r--src/extras/custompipes_gl.cpp3
5 files changed, 16 insertions, 6 deletions
diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
index b391e508..b0f0b34f 100644
--- a/src/core/Clock.cpp
+++ b/src/core/Clock.cpp
@@ -20,6 +20,7 @@ uint16 CClock::ms_Stored_nGameClockSeconds;
uint32 CClock::ms_nMillisecondsPerGameMinute;
uint32 CClock::ms_nLastClockTick;
bool CClock::ms_bClockHasBeenStored;
+float CClock::ms_EnvMapTimeMultiplicator;
#ifndef MASTER
bool gbFreezeTime;
@@ -35,6 +36,7 @@ CClock::Initialise(uint32 scale)
ms_nMillisecondsPerGameMinute = scale;
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
ms_bClockHasBeenStored = false;
+ ms_EnvMapTimeMultiplicator = 1.0f;
debug("CClock ready\n");
#ifndef MASTER
VarConsole.Add("Time (hour of day)", &ms_nGameClockHours, 1, 0, 23, true);
@@ -136,3 +138,10 @@ CClock::RestoreClock(void)
ms_nGameClockMinutes = ms_Stored_nGameClockMinutes;
ms_nGameClockSeconds = ms_Stored_nGameClockSeconds;
}
+
+void
+CClock::CalcEnvMapTimeMultiplicator(void)
+{
+ float nightness = Abs(ms_nGameClockHours/24.0f - 0.5f);
+ ms_EnvMapTimeMultiplicator = SQR(1.0f - nightness);;
+}
diff --git a/src/core/Clock.h b/src/core/Clock.h
index a611cd50..808e61f4 100644
--- a/src/core/Clock.h
+++ b/src/core/Clock.h
@@ -12,6 +12,7 @@ public:
static uint32 ms_nMillisecondsPerGameMinute;
static uint32 ms_nLastClockTick;
static bool ms_bClockHasBeenStored;
+ static float ms_EnvMapTimeMultiplicator;
static void Initialise(uint32 scale);
static void Update(void);
@@ -21,6 +22,8 @@ public:
static void StoreClock(void);
static void RestoreClock(void);
+ static void CalcEnvMapTimeMultiplicator(void);
+
static uint8 GetHours(void) { return ms_nGameClockHours; }
static uint8 GetMinutes(void) { return ms_nGameClockMinutes; }
static int16 GetSeconds(void) { return ms_nGameClockSeconds; }
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 03a7fcc2..8685e42d 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1143,10 +1143,10 @@ MattRenderScene(void)
/// CWorld::AdvanceCurrentScanCode();
// CMattRenderer::ResetRenderStates
/// CRenderer::ClearForFrame(); // before ConstructRenderList
- // CClock::CalcEnvMapTimeMultiplicator
+ CClock::CalcEnvMapTimeMultiplicator();
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
- // CClock::ms_EnvMapTimeMultiplicator = 1.0f;
+ CClock::ms_EnvMapTimeMultiplicator = 1.0f;
// cWorldStream::ClearDynamics
/// CRenderer::ConstructRenderList(); // before PreRender
if(gbRenderWorld0)
diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp
index 2ea2ede0..5217462c 100644
--- a/src/extras/custompipes_d3d9.cpp
+++ b/src/extras/custompipes_d3d9.cpp
@@ -128,8 +128,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
float coef = 0.0f;
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP)
- coef = RpMatFXMaterialGetEnvMapCoefficient(m);
- coef *= 0.5f;
+ coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
if(bChromeCheat && coef > 0.0f)
coef = 1.0f;
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp
index 19e37ac1..10c7fac3 100644
--- a/src/extras/custompipes_gl.cpp
+++ b/src/extras/custompipes_gl.cpp
@@ -135,8 +135,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
float coef = 0.0f;
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP)
- coef = RpMatFXMaterialGetEnvMapCoefficient(m);
- coef *= 0.5f;
+ coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
if(bChromeCheat && coef > 0.0f)
coef = 1.0f;
glUniform1f(U(u_fxparams), coef);