diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 192b2970..24582bb7 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -687,6 +687,9 @@ NumbersInDialogue=0 ;Set to 1 to use Fallout's normal text font instead of DOS-like font on the world map WorldMapFontPatch=0 +;Set to 1 to use Fallout's normal text font for death screen subtitles +DeathScreenFontPatch=0 + ;Set to 1 to display full item description for weapon/ammo in the barter screen FullItemDescInBarter=0 diff --git a/sfall/DamageMod.cpp b/sfall/DamageMod.cpp index 6f69a290..3dc91573 100644 --- a/sfall/DamageMod.cpp +++ b/sfall/DamageMod.cpp @@ -333,8 +333,14 @@ static __declspec(naked) void MeleeDmgDisplayPrintFix_hook() { mov eax, dword ptr ds:[_obj_dude]; // Get pointer to PC call perk_level_; // Get rank of Bonus HtH Damage shl eax, 1; // Multiply by 2 - sub ecx, eax; // Subtract from Melee Damage - mov eax, ecx; // Move back to eax in preparation of push + push eax; + mov edx, STAT_melee_dmg; + mov eax, dword ptr ds:[_obj_dude]; + call stat_get_base_; + pop edx; + sub ecx, edx; // Subtract from Melee Damage + cmp ecx, eax; + cmovg eax, ecx; // Move back to eax in preparation of push retn; } } @@ -347,8 +353,14 @@ static __declspec(naked) void CommonDmgRngDispFix_hook() { mov edx, PERK_bonus_hth_damage; // perk_level_ argument: PERK_bonus_hth_damage call perk_level_; // Get rank of Bonus HtH Damage shl eax, 1; // Multiply by 2 - sub ebx, eax; // Subtract from Melee Damage - mov eax, ebx; // Move back to eax in preparation of push + push eax; + mov edx, STAT_melee_dmg; + mov eax, dword ptr ds:[_obj_dude]; + call stat_get_base_; + pop edx; + sub ebx, edx; // Subtract from Melee Damage + cmp ebx, eax; + cmovg eax, ebx; // Move back to eax in preparation of push retn; } } diff --git a/sfall/FalloutEngine.cpp b/sfall/FalloutEngine.cpp index feb2e074..bad6ed4b 100644 --- a/sfall/FalloutEngine.cpp +++ b/sfall/FalloutEngine.cpp @@ -718,6 +718,7 @@ const DWORD soundPlay_ = 0x4AD73C; const DWORD soundPlaying_ = 0x4ADA84; const DWORD sprintf_ = 0x4F0041; const DWORD square_num_ = 0x4B1F04; +const DWORD stat_get_base_ = 0x4AF3E0; const DWORD stat_get_base_direct_ = 0x4AF408; const DWORD stat_get_bonus_ = 0x4AF474; const DWORD stat_level_ = 0x4AEF48; // &GetCurrentStat(void* critter, int statID) diff --git a/sfall/FalloutEngine.h b/sfall/FalloutEngine.h index 7422f536..0a1c95a5 100644 --- a/sfall/FalloutEngine.h +++ b/sfall/FalloutEngine.h @@ -1006,6 +1006,7 @@ extern const DWORD soundPlay_; extern const DWORD soundPlaying_; extern const DWORD sprintf_; extern const DWORD square_num_; +extern const DWORD stat_get_base_; extern const DWORD stat_get_base_direct_; extern const DWORD stat_get_bonus_; extern const DWORD stat_level_; diff --git a/sfall/HookScripts.h b/sfall/HookScripts.h index 14203596..8f5b22d7 100644 --- a/sfall/HookScripts.h +++ b/sfall/HookScripts.h @@ -59,10 +59,11 @@ void __stdcall SetHSReturn(DWORD d); // register hook by proc num (special values: -1 - use default (start) procedure, 0 - unregister) void __stdcall RegisterHook(TProgram* script, int id, int procNum, bool specReg); -void HookScriptClear(); void LoadHookScripts(); +void HookScriptClear(); extern DWORD initingHookScripts; + int __fastcall AmmoCostHook_Script(DWORD hookType, TGameObj* weapon, DWORD &rounds); void __stdcall RunHookScriptsAtProc(DWORD procId); diff --git a/sfall/Interface.cpp b/sfall/Interface.cpp index c6b79ad8..a38f6f17 100644 --- a/sfall/Interface.cpp +++ b/sfall/Interface.cpp @@ -95,7 +95,7 @@ run: static void __declspec(naked) wmInterfaceInit_text_font_hook() { __asm { - mov eax, 0x65; // normal text font + mov eax, 101; // normal text font jmp text_font_; } } diff --git a/sfall/LoadGameHook.h b/sfall/LoadGameHook.h index 73f98a10..3d245f01 100644 --- a/sfall/LoadGameHook.h +++ b/sfall/LoadGameHook.h @@ -24,33 +24,35 @@ void LoadGameHookInit(); bool IsGameLoaded(); DWORD InWorldMap(); + DWORD InCombat(); + DWORD InDialog(); enum LoopFlag : unsigned long { - WORLDMAP = 1 << 0, // 0x1 -// RESERVED = 1 << 1, // 0x2 (unused) - DIALOG = 1 << 2, // 0x4 - ESCMENU = 1 << 3, // 0x8 - SAVEGAME = 1 << 4, // 0x10 - LOADGAME = 1 << 5, // 0x20 - COMBAT = 1 << 6, // 0x40 - OPTIONS = 1 << 7, // 0x80 - HELP = 1 << 8, // 0x100 - CHARSCREEN = 1 << 9, // 0x200 - PIPBOY = 1 << 10, // 0x400 - PCOMBAT = 1 << 11, // 0x800 - INVENTORY = 1 << 12, // 0x1000 - AUTOMAP = 1 << 13, // 0x2000 - SKILLDEX = 1 << 14, // 0x4000 - INTFACEUSE = 1 << 15, // 0x8000 - INTFACELOOT = 1 << 16, // 0x10000 - BARTER = 1 << 17, // 0x20000 - HEROWIN = 1 << 18, // 0x40000 Hero Appearance mod - DIALOGVIEW = 1 << 19, // 0x80000 - COUNTERWIN = 1 << 20, // 0x100000 Counter window for moving multiple items or setting a timer + WORLDMAP = 1 << 0, // 0x1 +// RESERVED = 1 << 1, // 0x2 (unused) + DIALOG = 1 << 2, // 0x4 + ESCMENU = 1 << 3, // 0x8 + SAVEGAME = 1 << 4, // 0x10 + LOADGAME = 1 << 5, // 0x20 + COMBAT = 1 << 6, // 0x40 + OPTIONS = 1 << 7, // 0x80 + HELP = 1 << 8, // 0x100 + CHARSCREEN = 1 << 9, // 0x200 + PIPBOY = 1 << 10, // 0x400 + PCOMBAT = 1 << 11, // 0x800 + INVENTORY = 1 << 12, // 0x1000 + AUTOMAP = 1 << 13, // 0x2000 + SKILLDEX = 1 << 14, // 0x4000 + INTFACEUSE = 1 << 15, // 0x8000 + INTFACELOOT = 1 << 16, // 0x10000 + BARTER = 1 << 17, // 0x20000 + HEROWIN = 1 << 18, // 0x40000 Hero Appearance mod + DIALOGVIEW = 1 << 19, // 0x80000 + COUNTERWIN = 1 << 20, // 0x100000 Counter window for moving multiple items or setting a timer -// SPECIAL = 1UL << 31 // 0x80000000 Additional special flag for all modes +// SPECIAL = 1UL << 31 // 0x80000000 Additional special flag for all modes }; DWORD GetLoopFlags(); diff --git a/sfall/MiscPatches.cpp b/sfall/MiscPatches.cpp index ccf8e29d..1bcdf554 100644 --- a/sfall/MiscPatches.cpp +++ b/sfall/MiscPatches.cpp @@ -278,6 +278,14 @@ static void __declspec(naked) map_check_state_hook() { } } +static void __declspec(naked) main_death_scene_hook() { + __asm { + mov eax, 101; + call text_font_; + jmp debug_printf_; + } +} + static void AdditionalWeaponAnimsPatch() { if (GetConfigInt("Misc", "AdditionalWeaponAnims", 0)) { dlog("Applying additional weapon animations patch.", DL_INIT); @@ -693,11 +701,15 @@ void MiscPatchesInit() { HookCall(0x48A954, obj_move_to_tile_hook); HookCall(0x483726, map_check_state_hook); - // Corrects the height of the black background for the subtitles on death screens - if (hrpIsEnabled == false || hrpVersionValid) { - SafeWrite32(0x48134D, -602 - (640 * 2)); // main_death_scene_ (shift y-offset 2px up, w/o HRP) - SafeWrite8(0x481345, 4); // main_death_scene_ + // Set the normal font for death screen subtitles + if (GetConfigInt("Misc", "DeathScreenFontPatch", 0)) { + dlog("Applying death screen font patch.", DL_INIT); + HookCall(0x4812DF, main_death_scene_hook); + dlogr(" Done", DL_INIT); } + // Corrects the height of the black background for death screen subtitles + if (hrpIsEnabled == false) SafeWrite32(0x48134D, -602 - (640 * 2)); // main_death_scene_ (shift y-offset 2px up, w/o HRP) + if (hrpIsEnabled == false || hrpVersionValid) SafeWrite8(0x481345, 4); // main_death_scene_ if (hrpVersionValid) SafeWrite8(HRPAddress(0x10011738), 10); F1EngineBehaviorPatch(); diff --git a/sfall/ScriptExtender.cpp b/sfall/ScriptExtender.cpp index 72864e0a..9435c77d 100644 --- a/sfall/ScriptExtender.cpp +++ b/sfall/ScriptExtender.cpp @@ -506,7 +506,6 @@ static void __declspec(naked) op_available_global_script_types() { __asm { mov edx, availableGlobalScriptTypes; _J_RET_VAL_TYPE(VAR_TYPE_INT); -// retn; } } @@ -703,7 +702,6 @@ static void __declspec(naked) op_init_hook() { __asm { mov edx, initingHookScripts; _J_RET_VAL_TYPE(VAR_TYPE_INT); -// retn; } }