From d3cb0bb72c5d00b142bc7739dfb307f482c6ce00 Mon Sep 17 00:00:00 2001 From: Silent Date: Tue, 19 Sep 2017 17:46:42 +0200 Subject: [PATCH] Aaron's sun corrected --- SilentPatchSA/SilentPatchSA.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 43455e6..2246a09 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -1175,6 +1175,17 @@ static void DoPCScreenChange_Mod() } } +static CVector curVecToSun; +static void (*orgSetLightsWithTimeOfDayColour)( RpWorld* ); +static void SetLightsWithTimeOfDayColour_SilentPatch( RpWorld* world ) +{ + static CVector* const VectorToSun = *AddressByVersion( 0x6FC5B7 + 3, 0, 0 ); // TODO: DO + static int& CurrentStoredValue = **AddressByVersion( 0x6FC632 + 1, 0, 0 ); // TODO: DO + + curVecToSun = VectorToSun[CurrentStoredValue]; + orgSetLightsWithTimeOfDayColour( world ); +} + #if MEM_VALIDATORS #include @@ -2565,6 +2576,14 @@ BOOL InjectDelayedPatches_10() Patch( 0x406620+2, &pCdStreamSetFilePointer ); } + + // Fix directional light position + ReadCall( 0x53E997, orgSetLightsWithTimeOfDayColour ); + InjectHook( 0x53E997, SetLightsWithTimeOfDayColour_SilentPatch ); + Patch( 0x735618 + 2, &curVecToSun.x ); + Patch( 0x73561E + 2, &curVecToSun.y ); + Patch( 0x735624 + 1, &curVecToSun.z ); + FLAUtils::Init(); return FALSE;