From 490934bb3ced55b9c1543dd230e6ce2b1b7cbce6 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Thu, 16 Apr 2026 10:29:46 +0800 Subject: [PATCH] Fixed AP cost display on game load when using CALCAPCOST hook (ref. fallout2-ce/fallout2-ce#376) --- sfall/FalloutEngine/Functions_def.h | 1 + sfall/Modules/ScriptExtender.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/sfall/FalloutEngine/Functions_def.h b/sfall/FalloutEngine/Functions_def.h index 40648d25..a624a7cc 100644 --- a/sfall/FalloutEngine/Functions_def.h +++ b/sfall/FalloutEngine/Functions_def.h @@ -139,6 +139,7 @@ WRAP_WATCOM_FUNC2(long, intface_get_attack, DWORD*, hitMode, DWORD*, isSecondary WRAP_WATCOM_FUNC0(long, intface_is_item_right_hand) WRAP_WATCOM_FUNC0(long, intface_is_hidden) WRAP_WATCOM_FUNC0(void, intface_redraw) // Redraws the main game interface windows (useful after changing some data like active hand, etc.) +WRAP_WATCOM_FUNC0(void, intface_redraw_items) // Redraws only the active item button and ammo bar WRAP_WATCOM_FUNC0(void, intface_toggle_item_state) WRAP_WATCOM_FUNC1(void, intface_update_ac, long, animate) WRAP_WATCOM_FUNC2(void, intface_update_move_points, long, ap, long, freeAP) diff --git a/sfall/Modules/ScriptExtender.cpp b/sfall/Modules/ScriptExtender.cpp index 447bf074..e37686c5 100644 --- a/sfall/Modules/ScriptExtender.cpp +++ b/sfall/Modules/ScriptExtender.cpp @@ -524,6 +524,8 @@ static void InitGlobalScripts() { HookScripts::InitHookScripts(); LoadGlobalScriptsList(); + // Display the correct AP cost from the HOOK_CALCAPCOST hook for the current active item + fo::func::intface_redraw_items(); // 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