From 56f2ea46c2ad1896b930195c2d709dabd1858356 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Wed, 22 Jan 2020 10:20:32 +0800 Subject: [PATCH] Added a flashing icon to the Horrigan encounter Minor edits to some code and documents. --- artifacts/ddraw.ini | 2 +- artifacts/scripting/headers/sfall.h | 4 ++-- sfall/FalloutEngine/VariableOffsets.h | 7 +++++-- sfall/Modules/Interface.cpp | 2 +- sfall/Modules/MiscPatches.cpp | 2 +- sfall/Modules/Worldmap.cpp | 25 +++++++++++++++++++++++++ 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index efad20c8..053bdd08 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -210,7 +210,7 @@ DebugEditorKey=0 ;Changes some of Fallout 2 engine functions to Fallout 1 behavior: ;- disables playing the final movie/credits after the endgame slideshow ;- disables halving the weight for power armor items -;- endgame_movie script function plays Movie11 or Movie12 depending on the player's gender before the credits +;- endgame_movie script function plays movie 10 or 11 based on the player's gender before the credits Fallout1Behavior=0 ;Time limit in years. Must be between -3 and 13 diff --git a/artifacts/scripting/headers/sfall.h b/artifacts/scripting/headers/sfall.h index 2ecedd38..f01ff0b6 100644 --- a/artifacts/scripting/headers/sfall.h +++ b/artifacts/scripting/headers/sfall.h @@ -72,7 +72,7 @@ #define LIST_GROUNDITEMS (1) #define LIST_SCENERY (2) #define LIST_WALLS (3) -//#define LIST_TILES (4) //Not listable via sfall list functions +//#define LIST_TILES (4) //Not listable via sfall list functions #define LIST_MISC (5) #define LIST_SPATIAL (6) #define LIST_ALL (9) @@ -82,7 +82,7 @@ #define ENCOUNTER_FLAG_LOCK (0x2) // block new forced encounter by the next function call until the current specified encounter occurs #define ENCOUNTER_FLAG_NO_ICON (0x4) // disable displaying the flashing icon #define ENCOUNTER_FLAG_ICON_SP (0x8) // use special encounter icon -#define ENCOUNTER_FLAG_FADEOUT (0x10) // use fade out effect on the encounter (Note: you should restore the fade out screen when entering the encounter) +#define ENCOUNTER_FLAG_FADEOUT (0x10) // fade out the screen on encounter (Note: you yourself should restore the fade screen when entering the encounter) //The attack types returned by get_attack_type #define ATKTYPE_LWEP1 (0) diff --git a/sfall/FalloutEngine/VariableOffsets.h b/sfall/FalloutEngine/VariableOffsets.h index 1e483a67..4079e6ab 100644 --- a/sfall/FalloutEngine/VariableOffsets.h +++ b/sfall/FalloutEngine/VariableOffsets.h @@ -47,11 +47,12 @@ #define FO_VAR_currentWindow 0x51DCB8 #define FO_VAR_cursor_line 0x664514 #define FO_VAR_debug_func 0x51DF04 +#define FO_VAR_dialog_target 0x518848 +#define FO_VAR_dialog_target_is_party 0x51884C #define FO_VAR_dialogue_head 0x518850 #define FO_VAR_dialogue_state 0x518714 #define FO_VAR_dialogue_switch_mode 0x518718 -#define FO_VAR_dialog_target 0x518848 -#define FO_VAR_dialog_target_is_party 0x51884C +#define FO_VAR_dialogueBackWindow 0x518740 #define FO_VAR_display_win 0x631E4C #define FO_VAR_displayMapList 0x41B560 #define FO_VAR_dropped_explosive 0x5190E0 @@ -168,6 +169,7 @@ #define FO_VAR_optionsButtonUp 0x59D3FC #define FO_VAR_optionsButtonUp1 0x570514 #define FO_VAR_optionsButtonUpKey 0x518F28 +#define FO_VAR_optnwin 0x663900 #define FO_VAR_outlined_object 0x518D94 #define FO_VAR_partyMemberAIOptions 0x519DB8 #define FO_VAR_partyMemberCount 0x519DAC @@ -206,6 +208,7 @@ #define FO_VAR_script_path_base 0x51C710 #define FO_VAR_scriptListInfo 0x51C7C8 #define FO_VAR_skill_data 0x51D118 +#define FO_VAR_skldxwin 0x668140 #define FO_VAR_slot_cursor 0x5193B8 #define FO_VAR_sndfx_volume 0x518E90 #define FO_VAR_sneak_working 0x56D77C // DWORD var diff --git a/sfall/Modules/Interface.cpp b/sfall/Modules/Interface.cpp index 4f22ab37..37979b2d 100644 --- a/sfall/Modules/Interface.cpp +++ b/sfall/Modules/Interface.cpp @@ -475,7 +475,7 @@ enum TerrainHoverImage { width = 200, height = 15, size = width * height, - x_shift = (width / 4 ) + 25 // adjust x position + x_shift = (width / 4) + 25 // adjust x position }; static std::array wmTmpBuffer; diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index e9da61d2..37b75957 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -590,7 +590,7 @@ void F1EngineBehaviorPatch() { dlog("Applying Fallout 1 engine behavior patch.", DL_INIT); BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow SafeWrite8(0x477C71, 0xEB); // disable halving the weight for power armor items - HookCall(0x43F872, endgame_movie_hook); // play Movie11 or Movie12 depending on the player's gender before the credits + HookCall(0x43F872, endgame_movie_hook); // play movie 10 or 11 based on the player's gender before the credits dlogr(" Done", DL_INIT); } } diff --git a/sfall/Modules/Worldmap.cpp b/sfall/Modules/Worldmap.cpp index 488bd59b..c63486b1 100644 --- a/sfall/Modules/Worldmap.cpp +++ b/sfall/Modules/Worldmap.cpp @@ -315,6 +315,28 @@ end: } } +static void __declspec(naked) wmRndEncounterOccurred_hook() { + __asm { + push eax; + mov edx, 1; + mov dword ptr ds:[FO_VAR_wmRndCursorFid], 0; + mov ds:[FO_VAR_wmEncounterIconShow], edx; + mov ecx, 7; +jLoop: + mov eax, edx; + sub eax, ds:[FO_VAR_wmRndCursorFid]; + mov ds:[FO_VAR_wmRndCursorFid], eax; + call fo::funcoffs::wmInterfaceRefresh_; + mov eax, 200; + call fo::funcoffs::block_for_tocks_; + dec ecx; + jnz jLoop; + mov ds:[FO_VAR_wmEncounterIconShow], ecx; + pop eax; // map id + jmp fo::funcoffs::map_load_idx_; + } +} + static void RestRestore() { if (!restMode) return; restMode = false; @@ -643,6 +665,9 @@ void Worldmap::init() { WorldmapFpsPatch(); PipBoyAutomapsPatch(); + // Add a flashing icon to the Horrigan encounter + HookCall(0x4C071C, wmRndEncounterOccurred_hook); + LoadGameHook::OnGameReset() += []() { SetCarInterfaceArt(433); // set index if (restTime) SetRestHealTime(180);