diff --git a/sfall/FalloutEngine/FunctionOffsets_def.h b/sfall/FalloutEngine/FunctionOffsets_def.h index d4eb43db8..ad8146110 100644 --- a/sfall/FalloutEngine/FunctionOffsets_def.h +++ b/sfall/FalloutEngine/FunctionOffsets_def.h @@ -123,6 +123,7 @@ FUNC(GNW_text_width_, 0x4D5B60) FUNC(GNW_win_refresh_, 0x4D6FD8) FUNC(GameMap2Slot_, 0x47F510) FUNC(GetComment_, 0x47ED5C) +FUNC(GetMutateTrait_, 0x43D38C) FUNC(GetSlotList_, 0x47E5D0) FUNC(IncGamma_, 0x4928E4) FUNC(Index2RGB_, 0x4C72D5) diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index a114320cb..843da1024 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -3453,6 +3453,45 @@ static __declspec(naked) void op_using_skill_hack() { } } +static bool pickedTag = false; +static bool pickedMutate = false; + +static __declspec(naked) void perks_dialog_hook_tag() { + static const DWORD perks_dialog_tag_Ret = 0x43C9C5; + __asm { + cmp pickedTag, 0; + jne skip; + call fo::funcoffs::Add4thTagSkill_; + mov pickedTag, al; + retn; +skip: + add esp, 4; + jmp perks_dialog_tag_Ret; + } +} + +static __declspec(naked) void perks_dialog_hook_mutate() { + static const DWORD perks_dialog_mutate_Ret = 0x43CA04; + __asm { + cmp pickedMutate, 0; + jne skip; + call fo::funcoffs::GetMutateTrait_; + mov pickedMutate, al; + retn; +skip: + add esp, 4; + jmp perks_dialog_mutate_Ret; + } +} + +static __declspec(naked) void editor_design_hook() { + __asm { // eax = 0 + mov pickedTag, al; + mov pickedMutate, al; + jmp fo::funcoffs::intface_update_hit_points_; + } +} + void BugFixes::init() { #ifndef NDEBUG LoadGameHook::OnBeforeGameClose() += PrintAddrList; @@ -4277,6 +4316,11 @@ void BugFixes::init() { // Fix for object_fix_weapon_ammo_ engine function not checking "misc" type items SafeWrite8(0x48916B, 0x41); // jnz 0x4891AD SafeWrite8(0x4891C8, CodeType::JumpShort); // jmp 0x4891E9 (skip proto data correction) + + // Fix to prevent the windows of Tag! and Mutate! perks from reappearing when there are still unused perks + HookCall(0x43C9A0, perks_dialog_hook_tag); + HookCall(0x43C9E2, perks_dialog_hook_mutate); + HookCall(0x4329D1, editor_design_hook); // reset flags on exiting the character screen } }