diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 4621aa51..22287317 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -351,7 +351,7 @@ CorpseLineOfFireFix=0 ;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use ProcessorIdle=-1 -;Set a number of how many protos of a type can be loaded into memory at once (valid range: 512..4096) +;Set a number of how many protos per type can be loaded into memory at once (valid range: 512..4096) ;Set to -1 to let set_proto_data script function automatically increase the limit when needed LoadProtoMaxLimit=-1 diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index c5908bdf..05e68bd3 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -216,7 +216,7 @@ Some additional reg_anim_* functions were introduced. They all work in the same > void reg_anim_turn_towards(object, tile/target, delay) - makes object change its direction to face given tile num or target object. -> int metarule2_explosions(int arg1, int arg2) +> int metarule2_explosions(int arg1, int arg2, int arg3) was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h: > void set_attack_explosion_pattern(x, y) diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 848673ff..009f4638 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -1323,7 +1323,7 @@ static void __declspec(naked) compute_damage_hack() { __asm { mov ecx, esi; // ctd call InstantDeathFix; - // overwritted engine code + // overwritten engine code add esp, 0x34; pop ebp; pop edi; @@ -1532,6 +1532,36 @@ limit: } } +int tagSkill4LevelBase = -1; +static void __declspec(naked) SliderBtn_hook_down() { + __asm { + call fo::funcoffs::skill_level_; + cmp tagSkill4LevelBase, -1; + jnz fix; + retn; +fix: + cmp ds:[FO_VAR_tag_skill + 3 * 4], ebx; // _tag_skill4, ebx = _skill_cursor + jnz skip; + cmp eax, tagSkill4LevelBase; // curr > x2 + jg skip; + xor eax, eax; +skip: + retn; + } +} + +static void __declspec(naked) Add4thTagSkill_hook() { + __asm { + mov edi, eax; + call fo::funcoffs::skill_set_tags_; + mov eax, ds:[FO_VAR_obj_dude]; + mov edx, dword ptr ds:[edi + 3 * 4]; // _temp_tag_skill4 + call fo::funcoffs::skill_level_; + mov tagSkill4LevelBase, eax; // x2 + retn; + } +} + static BYTE retrievePtr = 0; static void __declspec(naked) ai_retrieve_object_hook() { __asm { @@ -2006,6 +2036,14 @@ void BugFixes::init() MakeCall(0x472F5F, inven_obj_examine_func_hack); SafeWrite8(0x472F64, 0x90); + // Fix for the exploit that allows you to gain excessive skill points from Tag! perk before leaving the character screen + //if (GetConfigInt("Misc", "TagPerkFix", 1)) { + dlog("Applying fix for Tag! exploit.", DL_INIT); + HookCall(0x43B463, SliderBtn_hook_down); + HookCall(0x43D7DD, Add4thTagSkill_hook); + dlogr(" Done", DL_INIT); + //} + // Fix for ai_retrieve_object_ engine function not returning the requested object when there are different objects // with the same ID dlog("Applying ai_retrieve_object engine function fix.", DL_INIT); @@ -2020,7 +2058,7 @@ void BugFixes::init() dlogr(" Done", DL_INIT); } - // Fix for "Heave Ho!" perk increasing strength stat above 10 when determining the max range of thrown weapons + // Fix for Heave Ho! perk increasing Strength stat above 10 when determining the maximum range of thrown weapons HookCall(0x478AD9, item_w_range_hook); } diff --git a/sfall/Modules/BugFixes.h b/sfall/Modules/BugFixes.h index ccdeee7b..0133f8bb 100644 --- a/sfall/Modules/BugFixes.h +++ b/sfall/Modules/BugFixes.h @@ -11,6 +11,8 @@ public: void init(); }; +extern int tagSkill4LevelBase; + extern void ResetBodyState(); } diff --git a/sfall/Modules/LoadGameHook.cpp b/sfall/Modules/LoadGameHook.cpp index e412a061..8efd6739 100644 --- a/sfall/Modules/LoadGameHook.cpp +++ b/sfall/Modules/LoadGameHook.cpp @@ -474,6 +474,7 @@ success: call PerksAcceptCharScreen; end: _InLoop2(0, CHARSCREEN); + mov tagSkill4LevelBase, -1; // for fixing Tag! perk exploit popad; retn; }