Added DeathScreenFontPatch option

* use the normal font instead of bitmap font for death screen subtitles.

Attempted to fix the melee damage display for some extreme cases when
BonusHtHDamageFix=1 and DisplayBonusDamage=0.
This commit is contained in:
NovaRain
2020-08-20 13:48:41 +08:00
parent 502a5764a5
commit 5d12d815dd
9 changed files with 64 additions and 34 deletions
+3
View File
@@ -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
+16 -4
View File
@@ -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;
}
}
+1
View File
@@ -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)
+1
View File
@@ -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_;
+2 -1
View File
@@ -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);
+1 -1
View File
@@ -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_;
}
}
+2
View File
@@ -24,7 +24,9 @@ void LoadGameHookInit();
bool IsGameLoaded();
DWORD InWorldMap();
DWORD InCombat();
DWORD InDialog();
enum LoopFlag : unsigned long {
+16 -4
View File
@@ -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();
-2
View File
@@ -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;
}
}