summaryrefslogtreecommitdiffstats
path: root/src/render/Timecycle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/Timecycle.cpp')
-rw-r--r--src/render/Timecycle.cpp203
1 files changed, 99 insertions, 104 deletions
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index 7ab3e91e..cf3426d7 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Clock.h"
#include "Weather.h"
@@ -10,101 +10,101 @@
#include "FileMgr.h"
#include "Timecycle.h"
-int (*CTimeCycle::m_nAmbientRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86AF78;
-int (*CTimeCycle::m_nAmbientGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x665308;
-int (*CTimeCycle::m_nAmbientBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72CF88;
-int (*CTimeCycle::m_nDirectionalRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FAB78;
-int (*CTimeCycle::m_nDirectionalGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F4528;
-int (*CTimeCycle::m_nDirectionalBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83CE58;
-int (*CTimeCycle::m_nSkyTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FB90;
-int (*CTimeCycle::m_nSkyTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x8460A8;
-int (*CTimeCycle::m_nSkyTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87B158;
-int (*CTimeCycle::m_nSkyBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FA960;
-int (*CTimeCycle::m_nSkyBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70D6A8;
-int (*CTimeCycle::m_nSkyBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83D288;
-int (*CTimeCycle::m_nSunCoreRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x878360;
-int (*CTimeCycle::m_nSunCoreGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE088;
-int (*CTimeCycle::m_nSunCoreBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x773A68;
-int (*CTimeCycle::m_nSunCoronaRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x664B60;
-int (*CTimeCycle::m_nSunCoronaGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F01E0;
-int (*CTimeCycle::m_nSunCoronaBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E6340;
-float (*CTimeCycle::m_fSunSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733510;
-float (*CTimeCycle::m_fSpriteSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87F820;
-float (*CTimeCycle::m_fSpriteBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x6E96F0;
-short (*CTimeCycle::m_nShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x83CFD8;
-short (*CTimeCycle::m_nLightShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x72B0F8;
-short (*CTimeCycle::m_nTreeShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x733450;
-float (*CTimeCycle::m_fFogStart)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8806C8;
-float (*CTimeCycle::m_fFarClip)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8804E0;
-float (*CTimeCycle::m_fLightsOnGroundBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x83D108;
-int (*CTimeCycle::m_nLowCloudsRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x726770;
-int (*CTimeCycle::m_nLowCloudsGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87BF08;
-int (*CTimeCycle::m_nLowCloudsBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FA10;
-int (*CTimeCycle::m_nFluffyCloudsTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70F2B0;
-int (*CTimeCycle::m_nFluffyCloudsTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72D288;
-int (*CTimeCycle::m_nFluffyCloudsTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86B108;
-int (*CTimeCycle::m_nFluffyCloudsBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E8DA8;
-int (*CTimeCycle::m_nFluffyCloudsBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x715AA8;
-int (*CTimeCycle::m_nFluffyCloudsBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE2D0;
-float (*CTimeCycle::m_fBlurRed)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87C7E0;
-float (*CTimeCycle::m_fBlurGreen)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x774C10;
-float (*CTimeCycle::m_fBlurBlue)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8784E0;
-float (*CTimeCycle::m_fBlurAlpha)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733690;
-
-float &CTimeCycle::m_fCurrentAmbientRed = *(float*)0x8F29B4;
-float &CTimeCycle::m_fCurrentAmbientGreen = *(float*)0x94144C;
-float &CTimeCycle::m_fCurrentAmbientBlue = *(float*)0x942FC0;
-float &CTimeCycle::m_fCurrentDirectionalRed = *(float*)0x8F29D8;
-float &CTimeCycle::m_fCurrentDirectionalGreen = *(float*)0x940594;
-float &CTimeCycle::m_fCurrentDirectionalBlue = *(float*)0x942FAC;
-int &CTimeCycle::m_nCurrentSkyTopRed = *(int*)0x9403C0;
-int &CTimeCycle::m_nCurrentSkyTopGreen = *(int*)0x943074;
-int &CTimeCycle::m_nCurrentSkyTopBlue = *(int*)0x8F29B8;
-int &CTimeCycle::m_nCurrentSkyBottomRed = *(int*)0x9414D0;
-int &CTimeCycle::m_nCurrentSkyBottomGreen = *(int*)0x8F2BD0;
-int &CTimeCycle::m_nCurrentSkyBottomBlue = *(int*)0x8F625C;
-int &CTimeCycle::m_nCurrentSunCoreRed = *(int*)0x8F2534;
-int &CTimeCycle::m_nCurrentSunCoreGreen = *(int*)0x8F6264;
-int &CTimeCycle::m_nCurrentSunCoreBlue = *(int*)0x94149C;
-int &CTimeCycle::m_nCurrentSunCoronaRed = *(int*)0x8F2C1C;
-int &CTimeCycle::m_nCurrentSunCoronaGreen = *(int*)0x885B54;
-int &CTimeCycle::m_nCurrentSunCoronaBlue = *(int*)0x880F60;
-float &CTimeCycle::m_fCurrentSunSize = *(float*)0x940588;
-float &CTimeCycle::m_fCurrentSpriteSize = *(float*)0x8F1AA8;
-float &CTimeCycle::m_fCurrentSpriteBrightness = *(float*)0x8F5FDC;
-int &CTimeCycle::m_nCurrentShadowStrength = *(int*)0x95CC76;
-int &CTimeCycle::m_nCurrentLightShadowStrength = *(int*)0x95CC66;
-int &CTimeCycle::m_nCurrentTreeShadowStrength = *(int*)0x95CC86;
-float &CTimeCycle::m_fCurrentFogStart = *(float*)0x8F1AE0;
-float &CTimeCycle::m_fCurrentFarClip = *(float*)0x8F5FD8;
-float &CTimeCycle::m_fCurrentLightsOnGroundBrightness = *(float*)0x8F1B60;
-int &CTimeCycle::m_nCurrentLowCloudsRed = *(int*)0x95CB54;
-int &CTimeCycle::m_nCurrentLowCloudsGreen = *(int*)0x95CB48;
-int &CTimeCycle::m_nCurrentLowCloudsBlue = *(int*)0x95CC1C;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopRed = *(int*)0x8F2550;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopGreen = *(int*)0x8F59CC;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopBlue = *(int*)0x941434;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomRed = *(int*)0x8F1A38;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomGreen = *(int*)0x8E28B8;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomBlue = *(int*)0x8F3960;
-float &CTimeCycle::m_fCurrentBlurRed = *(float*)0x8F6000;
-float &CTimeCycle::m_fCurrentBlurGreen = *(float*)0x9405A0;
-float &CTimeCycle::m_fCurrentBlurBlue = *(float*)0x8F250C;
-float &CTimeCycle::m_fCurrentBlurAlpha = *(float*)0x940728;
-int &CTimeCycle::m_nCurrentFogColourRed = *(int*)0x940714;
-int &CTimeCycle::m_nCurrentFogColourGreen = *(int*)0x8E2A60;
-int &CTimeCycle::m_nCurrentFogColourBlue = *(int*)0x8F57EC;
-
-int &CTimeCycle::m_FogReduction = *(int*)0x880FB8;
-
-int &CTimeCycle::m_CurrentStoredValue = *(int*)0x94057C;
-CVector *CTimeCycle::m_VectorToSun = (CVector*)0x665548; // [16]
-float *CTimeCycle::m_fShadowFrontX = (float*)0x72CE90;
-float *CTimeCycle::m_fShadowFrontY = (float*)0x72CE50;
-float *CTimeCycle::m_fShadowSideX = (float*)0x87C708;
-float *CTimeCycle::m_fShadowSideY = (float*)0x87C6C8;
-float *CTimeCycle::m_fShadowDisplacementX = (float*)0x6F0748;
-float *CTimeCycle::m_fShadowDisplacementY = (float*)0x6F0788;
+int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurAlpha[NUMHOURS][NUMWEATHERS];
+
+float CTimeCycle::m_fCurrentAmbientRed;
+float CTimeCycle::m_fCurrentAmbientGreen;
+float CTimeCycle::m_fCurrentAmbientBlue;
+float CTimeCycle::m_fCurrentDirectionalRed;
+float CTimeCycle::m_fCurrentDirectionalGreen;
+float CTimeCycle::m_fCurrentDirectionalBlue;
+int CTimeCycle::m_nCurrentSkyTopRed;
+int CTimeCycle::m_nCurrentSkyTopGreen;
+int CTimeCycle::m_nCurrentSkyTopBlue;
+int CTimeCycle::m_nCurrentSkyBottomRed;
+int CTimeCycle::m_nCurrentSkyBottomGreen;
+int CTimeCycle::m_nCurrentSkyBottomBlue;
+int CTimeCycle::m_nCurrentSunCoreRed;
+int CTimeCycle::m_nCurrentSunCoreGreen;
+int CTimeCycle::m_nCurrentSunCoreBlue;
+int CTimeCycle::m_nCurrentSunCoronaRed;
+int CTimeCycle::m_nCurrentSunCoronaGreen;
+int CTimeCycle::m_nCurrentSunCoronaBlue;
+float CTimeCycle::m_fCurrentSunSize;
+float CTimeCycle::m_fCurrentSpriteSize;
+float CTimeCycle::m_fCurrentSpriteBrightness;
+int CTimeCycle::m_nCurrentShadowStrength;
+int CTimeCycle::m_nCurrentLightShadowStrength;
+int CTimeCycle::m_nCurrentTreeShadowStrength;
+float CTimeCycle::m_fCurrentFogStart;
+float CTimeCycle::m_fCurrentFarClip;
+float CTimeCycle::m_fCurrentLightsOnGroundBrightness;
+int CTimeCycle::m_nCurrentLowCloudsRed;
+int CTimeCycle::m_nCurrentLowCloudsGreen;
+int CTimeCycle::m_nCurrentLowCloudsBlue;
+int CTimeCycle::m_nCurrentFluffyCloudsTopRed;
+int CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
+int CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
+float CTimeCycle::m_fCurrentBlurRed;
+float CTimeCycle::m_fCurrentBlurGreen;
+float CTimeCycle::m_fCurrentBlurBlue;
+float CTimeCycle::m_fCurrentBlurAlpha;
+int CTimeCycle::m_nCurrentFogColourRed;
+int CTimeCycle::m_nCurrentFogColourGreen;
+int CTimeCycle::m_nCurrentFogColourBlue;
+
+int CTimeCycle::m_FogReduction;
+
+int CTimeCycle::m_CurrentStoredValue;
+CVector CTimeCycle::m_VectorToSun[16];
+float CTimeCycle::m_fShadowFrontX[16];
+float CTimeCycle::m_fShadowFrontY[16];
+float CTimeCycle::m_fShadowSideX[16];
+float CTimeCycle::m_fShadowSideY[16];
+float CTimeCycle::m_fShadowDisplacementX[16];
+float CTimeCycle::m_fShadowDisplacementY[16];
void
@@ -290,7 +290,7 @@ CTimeCycle::Update(void)
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
if(m_FogReduction != 0)
- m_fCurrentFarClip = max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
+ m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
@@ -311,12 +311,7 @@ CTimeCycle::Update(void)
if(TheCamera.GetForward().z < -0.9f ||
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
- m_FogReduction = min(m_FogReduction+1, 64);
+ m_FogReduction = Min(m_FogReduction+1, 64);
else
- m_FogReduction = max(m_FogReduction-1, 0);
+ m_FogReduction = Max(m_FogReduction-1, 0);
}
-
-STARTPATCHES
- InjectHook(0x4ABAE0, CTimeCycle::Initialise, PATCH_JUMP);
- InjectHook(0x4ABF40, CTimeCycle::Update, PATCH_JUMP);
-ENDPATCHES