some useless code

This commit is contained in:
aap 2021-01-11 20:20:08 +01:00
parent 4422a3df23
commit 383142bcbe
5 changed files with 16 additions and 6 deletions

View file

@ -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);;
}

View file

@ -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; }

View file

@ -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)

View file

@ -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);

View file

@ -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);