From 1224eaa01859347754f503a4994ca574c3f1df31 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Thu, 9 Jan 2025 10:46:43 +0800 Subject: [PATCH] Fixed map lighting from Night Vision perk * Before the perk effect only kicked in when map update proc ran after game load. Now the delay is much shorter. --- sfall/FalloutEngine/FunctionOffsets_def.h | 1 + sfall/FalloutEngine/Functions_def.h | 1 + sfall/Modules/ScriptExtender.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/sfall/FalloutEngine/FunctionOffsets_def.h b/sfall/FalloutEngine/FunctionOffsets_def.h index 1f392d38a..f47bfbf34 100644 --- a/sfall/FalloutEngine/FunctionOffsets_def.h +++ b/sfall/FalloutEngine/FunctionOffsets_def.h @@ -2019,6 +2019,7 @@ FUNC(light_get_tile_true_, 0x47A9C4) FUNC(light_increase_ambient_, 0x47A900) FUNC(light_init_, 0x47A8F0) FUNC(light_reset_tiles_, 0x47AA84) +FUNC(light_set_ambient_, 0x47A908) FUNC(light_set_tile_, 0x47A9EC) FUNC(light_subtract_from_tile_, 0x47AA48) FUNC(lighten_buf_, 0x4D3A48) diff --git a/sfall/FalloutEngine/Functions_def.h b/sfall/FalloutEngine/Functions_def.h index da6199218..11aa4ce2a 100644 --- a/sfall/FalloutEngine/Functions_def.h +++ b/sfall/FalloutEngine/Functions_def.h @@ -178,6 +178,7 @@ WRAP_WATCOM_FUNC1(long, item_w_secondary_mp_cost, fo::GameObject*, item) WRAP_WATCOM_FUNC2(long, item_w_subtype, fo::GameObject*, item, long, hitMode) WRAP_WATCOM_FUNC1(long, item_weight, fo::GameObject*, item) WRAP_WATCOM_FUNC2(long, light_get_tile, long, elevation, long, tileNum) // Returns light level at given tile +WRAP_WATCOM_FUNC2(void, light_set_ambient, long, intensity, long, isRefresh) WRAP_WATCOM_FUNC2(long, load_frame, const char*, fileName, fo::FrmFile**, frmPtr) WRAP_WATCOM_FUNC4(BYTE*, loadPCX, const char*, fileName, long*, width, long*, height, BYTE*, palette) WRAP_WATCOM_FUNC1(fo::Program*, loadProgram, const char*, fileName) diff --git a/sfall/Modules/ScriptExtender.cpp b/sfall/Modules/ScriptExtender.cpp index 084cb6935..0edaa8752 100644 --- a/sfall/Modules/ScriptExtender.cpp +++ b/sfall/Modules/ScriptExtender.cpp @@ -530,6 +530,8 @@ static void InitGlobalScripts() { HookScripts::InitHookScripts(); LoadGlobalScriptsList(); + // Fix map lighting from Night Vision perk when loading a saved game + fo::func::light_set_ambient(fo::var::ambient_light, 1); // refresh map lighting isGlobalScriptLoading = 0; }