mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed Bonus Move APs being replenished when you save and load the game in combat (from Crafty)
Replaced all usages of MakeCall with 3 arguments with either MakeJump or MakeCall (2 arguments) to improve code readability (ref. commit 96fa2668cc)
This commit is contained in:
+1
-1
@@ -108,7 +108,7 @@ void AIInit() {
|
||||
//HookCall(0x42AE5C, ai_attack_hook);
|
||||
HookCall(0x426A95, combat_attack_hook);
|
||||
HookCall(0x42A796, combat_attack_hook);
|
||||
MakeCall(0x45F6AF, BlockCombatHook1, true);
|
||||
MakeJump(0x45F6AF, BlockCombatHook1);
|
||||
HookCall(0x4432A6, BlockCombatHook2);
|
||||
GetPrivateProfileString("sfall", "BlockedCombat", "You cannot enter combat at this time.", CombatBlockedMessage, 128, translationIni);
|
||||
}
|
||||
|
||||
+13
-13
@@ -737,19 +737,19 @@ void AmmoModInit() {
|
||||
if (formula=GetPrivateProfileIntA("Misc", "DamageFormula", 0, ini)) {
|
||||
switch (formula) {
|
||||
case 1:
|
||||
MakeCall(0x424995, &DamageFunction1, true);
|
||||
MakeJump(0x424995, DamageFunction1);
|
||||
break;
|
||||
case 2:
|
||||
MakeCall(0x424995, &DamageFunction2, true);
|
||||
MakeJump(0x424995, DamageFunction2);
|
||||
break;
|
||||
/*case 3:
|
||||
MakeCall(0x424995, &DamageFunction3, true);
|
||||
MakeJump(0x424995, DamageFunction3);
|
||||
break;
|
||||
case 4:
|
||||
MakeCall(0x424995, &DamageFunction4, true);
|
||||
MakeJump(0x424995, DamageFunction4);
|
||||
break;*/
|
||||
case 5:
|
||||
MakeCall(0x424995, &DamageFunction5, true);
|
||||
MakeJump(0x424995, DamageFunction5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -757,19 +757,19 @@ void AmmoModInit() {
|
||||
int DisplayBonusDmg = GetPrivateProfileIntA("Misc", "DisplayBonusDamage", 0, ini);
|
||||
if (BonusHtHDmgFix) {
|
||||
dlog("Applying Bonus HtH Damage Perk fix.", DL_INIT);
|
||||
MakeCall(0x435C0C, &MeleeDmgDispFix, true);
|
||||
MakeCall(0x43991C, &MeleeDmgPrintFix, true);
|
||||
MakeJump(0x435C0C, MeleeDmgDispFix);
|
||||
MakeJump(0x43991C, MeleeDmgPrintFix);
|
||||
if (!DisplayBonusDmg) {
|
||||
MakeCall(0x472266, &MeleeWeapDmgRngDispFix, true);
|
||||
MakeCall(0x47254B, &UnarmedDmgRngDispFix, true);
|
||||
MakeJump(0x472266, MeleeWeapDmgRngDispFix);
|
||||
MakeJump(0x47254B, UnarmedDmgRngDispFix);
|
||||
}
|
||||
MakeCall(0x478492, &HtHDamageFix1a, true);
|
||||
MakeCall(0x47854C, &HtHDamageFix1b, true);
|
||||
MakeJump(0x478492, HtHDamageFix1a);
|
||||
MakeJump(0x47854C, HtHDamageFix1b);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
//if(GetPrivateProfileIntA("Misc", "SpecialUnarmedAttacksFix", 1, ini)) {
|
||||
dlog("Applying Special Unarmed Attacks fix.", DL_INIT);
|
||||
MakeCall(0x42394D, &UnarmedAttacksFix, true);
|
||||
MakeJump(0x42394D, UnarmedAttacksFix);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
if (DisplayBonusDmg) {
|
||||
@@ -777,7 +777,7 @@ void AmmoModInit() {
|
||||
HookCall(0x4722DD, &DisplayBonusRangedDmg);
|
||||
if (BonusHtHDmgFix) {
|
||||
HookCall(0x472309, &DisplayBonusHtHDmg1);
|
||||
MakeCall(0x472546, &DisplayBonusHtHDmg2, true);
|
||||
MakeJump(0x472546, DisplayBonusHtHDmg2);
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ void AnimationsAtOnceInit() {
|
||||
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
MakeCall(0x415DE2, &anim_set_end_hack, true);
|
||||
MakeJump(0x415DE2, anim_set_end_hack);
|
||||
}
|
||||
|
||||
void AnimationsAtOnceExit() {
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ void BarBoxesInit() {
|
||||
SafeWrite8(0x46140B, 10);
|
||||
SafeWrite8(0x461495, 0x78);
|
||||
|
||||
MakeCall(0x4615A3, &DisplayBoxesHook, true);
|
||||
MakeJump(0x4615A3, DisplayBoxesHook);
|
||||
char buf[6];
|
||||
GetPrivateProfileString("Misc", "BoxBarColours", "", buf, 6, ini);
|
||||
if(strlen(buf)==5) {
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ void BooksInit() {
|
||||
}
|
||||
}
|
||||
|
||||
MakeCall(0x49B9FB, &obj_use_book_hook, true);
|
||||
MakeJump(0x49B9FB, obj_use_book_hook);
|
||||
dlog_f(" (%d/%d books) Done\n", DL_INIT, n, count);
|
||||
}
|
||||
}
|
||||
+79
-38
@@ -1035,6 +1035,39 @@ static void __declspec(naked) Save_as_ASCII_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD combatFreeMoveTmp = 0xFFFFFFFF;
|
||||
static void __declspec(naked) combat_load_hook() {
|
||||
__asm {
|
||||
call db_freadInt_;
|
||||
test eax, eax; // Successful?
|
||||
jnz end; // No
|
||||
push PERK_bonus_move;
|
||||
pop edx;
|
||||
mov eax, dword ptr ds:[_obj_dude];
|
||||
call perk_level_;
|
||||
test eax, eax; // Have the perk?
|
||||
jz end; // No
|
||||
mov eax, ds:[_combat_free_move]; // eax = real value
|
||||
mov combatFreeMoveTmp, eax // Save to the temp
|
||||
xor eax, eax
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_turn_hack() {
|
||||
__asm {
|
||||
mov edx, combatFreeMoveTmp
|
||||
cmp edx, 0xFFFFFFFF; // Is there a real value?
|
||||
je end; // No
|
||||
mov combatFreeMoveTmp, 0xFFFFFFFF;
|
||||
xchg edx, eax;
|
||||
end:
|
||||
mov ds:[_combat_free_move], eax;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BugsInit()
|
||||
{
|
||||
@@ -1052,8 +1085,8 @@ void BugsInit()
|
||||
|
||||
// Fixes for clickability issue in Pip-Boy and exploit that allows to rest in places where you shouldn't be able to rest
|
||||
dlog("Applying fix for Pip-Boy rest exploit.", DL_INIT);
|
||||
MakeCall(0x4971C7, &pipboy_hack, false);
|
||||
MakeCall(0x499530, &PipAlarm_hack, false);
|
||||
MakeCall(0x4971C7, pipboy_hack);
|
||||
MakeCall(0x499530, PipAlarm_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Fix for "Too Many Items" bug
|
||||
@@ -1065,18 +1098,18 @@ void BugsInit()
|
||||
//}
|
||||
|
||||
// Fix for cells getting consumed even when the car is already fully charged
|
||||
MakeCall(0x49BE70, &obj_use_power_on_car_hack, false);
|
||||
MakeCall(0x49BE70, obj_use_power_on_car_hack);
|
||||
|
||||
// Fix for being able to charge the car by using cells on other scenary/critters
|
||||
if (GetPrivateProfileIntA("Misc", "CarChargingFix", 1, ini)) {
|
||||
dlog("Applying car charging fix.", DL_INIT);
|
||||
MakeCall(0x49C36D, &protinst_default_use_item_hack, true);
|
||||
MakeJump(0x49C36D, protinst_default_use_item_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
// Fix for gaining stats from more than two doses of a specific chem after save-load
|
||||
dlog("Applying fix for save-load unlimited drug use exploit.", DL_INIT);
|
||||
MakeCall(0x47A243, &item_d_load_hack, false);
|
||||
MakeCall(0x47A243, item_d_load_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Fix crash when leaving the map while waiting for someone to die of a super stimpak overdose
|
||||
@@ -1102,7 +1135,7 @@ void BugsInit()
|
||||
// Allow 9 options (lines of text) to be displayed correctly in a dialog window
|
||||
if (GetPrivateProfileIntA("Misc", "DialogOptions9Lines", 1, ini)) {
|
||||
dlog("Applying 9 dialog options patch.", DL_INIT);
|
||||
MakeCall(0x44701C, &gdProcessUpdate_hack, true);
|
||||
MakeJump(0x44701C, gdProcessUpdate_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
@@ -1118,8 +1151,8 @@ void BugsInit()
|
||||
|
||||
// Fix for negative SPECIAL values in character creation
|
||||
dlog("Applying fix for negative SPECIAL values in character creation.", DL_INIT);
|
||||
MakeCall(0x43DF6F, &is_supper_bonus_hack, false);
|
||||
MakeCall(0x434BFF, &PrintBasicStat_hack, false);
|
||||
MakeCall(0x43DF6F, is_supper_bonus_hack);
|
||||
MakeCall(0x434BFF, PrintBasicStat_hack);
|
||||
HookCall(0x437AB4, &StatButtonUp_hook);
|
||||
HookCall(0x437B26, &StatButtonDown_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
@@ -1127,8 +1160,8 @@ void BugsInit()
|
||||
// Fix for not counting in the weight of equipped items on NPC when stealing or bartering
|
||||
//if (GetPrivateProfileIntA("Misc", "NPCWeightFix", 1, ini)) {
|
||||
dlog("Applying fix for not counting in weight of equipped items on NPC.", DL_INIT);
|
||||
MakeCall(0x473B4E, &loot_container_hack, false);
|
||||
MakeCall(0x47588A, &barter_inventory_hack, false);
|
||||
MakeCall(0x473B4E, loot_container_hack);
|
||||
MakeCall(0x47588A, barter_inventory_hack);
|
||||
HookCall(0x474CB8, &barter_attempt_transaction_hook);
|
||||
HookCall(0x4742AD, &move_inventory_hook);
|
||||
HookCall(0x4771B5, &item_add_mult_hook);
|
||||
@@ -1143,10 +1176,10 @@ void BugsInit()
|
||||
dlog("Applying inventory reverse order issues fix.", DL_INIT);
|
||||
// Fix for minor visual glitch when picking up solo item from the top of inventory
|
||||
// and there is multiple item stack at the bottom of inventory
|
||||
MakeCall(0x470EC2, &inven_pickup_hack, true);
|
||||
MakeJump(0x470EC2, inven_pickup_hack);
|
||||
// Fix for error in player's inventory, related to IFACE_BAR_MODE=1 in f2_res.ini, and
|
||||
// also for reverse order error
|
||||
MakeCall(0x47114A, &inven_pickup_hack2, true);
|
||||
MakeJump(0x47114A, inven_pickup_hack2);
|
||||
// Fix for using only one box of ammo when a weapon is above the ammo in the inventory list
|
||||
HookCall(0x476598, &drop_ammo_into_weapon_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
@@ -1173,15 +1206,15 @@ void BugsInit()
|
||||
//if (GetPrivateProfileIntA("Misc", "JetAntidoteFix", 1, ini)) {
|
||||
dlog("Applying Jet Antidote fix.", DL_INIT);
|
||||
// the original jet antidote fix
|
||||
MakeCall(0x47A013, (void*)0x47A168, true);
|
||||
MakeJump(0x47A013, (void*)0x47A168);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
//if (GetPrivateProfileIntA("Misc", "NPCDrugAddictionFix", 1, ini)) {
|
||||
dlog("Applying NPC's drug addiction fix.", DL_INIT);
|
||||
// proper checks for NPC's addiction instead of always using global vars
|
||||
MakeCall(0x47A644, &item_d_check_addict_hack, true);
|
||||
MakeCall(0x479FC5, &item_d_take_drug_hack, true);
|
||||
MakeJump(0x47A644, item_d_check_addict_hack);
|
||||
MakeJump(0x479FC5, item_d_take_drug_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
@@ -1211,35 +1244,35 @@ void BugsInit()
|
||||
|
||||
//if (GetPrivateProfileIntA("Misc", "MultiHexPathingFix", 1, ini)) {
|
||||
dlog("Applying MultiHex Pathing Fix.", DL_INIT);
|
||||
MakeCall(0x42901F, &MultiHexFix, false);
|
||||
MakeCall(0x429170, &MultiHexFix, false);
|
||||
MakeCall(0x42901F, MultiHexFix);
|
||||
MakeCall(0x429170, MultiHexFix);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
//if (GetPrivateProfileIntA("Misc", "DodgyDoorsFix", 1, ini)) {
|
||||
dlog("Applying Dodgy Door Fix.", DL_INIT);
|
||||
MakeCall(0x4113D6, &action_melee_hack, true);
|
||||
MakeCall(0x411BCC, &action_ranged_hack, true);
|
||||
MakeJump(0x4113D6, action_melee_hack);
|
||||
MakeJump(0x411BCC, action_ranged_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
// Fix for "NPC turns into a container" bug
|
||||
//if (GetPrivateProfileIntA("Misc", "NPCTurnsIntoContainerFix", 1, ini)) {
|
||||
dlog("Applying fix for \"NPC turns into a container\" bug.", DL_INIT);
|
||||
MakeCall(0x424F8E, &set_new_results_hack, false);
|
||||
MakeCall(0x42E46E, &critter_wake_clear_hack, true);
|
||||
MakeCall(0x488EF3, &obj_load_func_hack, true);
|
||||
MakeCall(0x424F8E, set_new_results_hack);
|
||||
MakeJump(0x42E46E, critter_wake_clear_hack);
|
||||
MakeJump(0x488EF3, obj_load_func_hack);
|
||||
HookCall(0x4949B2, &partyMemberPrepLoadInstance_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
dlog("Applying fix for explosives bugs.", DL_INIT);
|
||||
// Fix crashes when killing critters with explosives
|
||||
MakeCall(0x422F05, &combat_ctd_init_hack, true);
|
||||
MakeCall(0x489413, &obj_save_hack, true);
|
||||
MakeJump(0x422F05, combat_ctd_init_hack);
|
||||
MakeJump(0x489413, obj_save_hack);
|
||||
// Fix for destroy_p_proc not being called if the critter is killed by explosives when you leave the map
|
||||
MakeCall(0x4130C3, &action_explode_hack, false);
|
||||
MakeCall(0x4130E5, &action_explode_hack1, false);
|
||||
MakeCall(0x4130C3, action_explode_hack);
|
||||
MakeCall(0x4130E5, action_explode_hack1);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Fix for unable to sell used geiger counters or stealth boys
|
||||
@@ -1247,7 +1280,7 @@ void BugsInit()
|
||||
dlog("Applying fix for unable to sell used geiger counters or stealth boys.", DL_INIT);
|
||||
SafeWrite8(0x478115, 0xBA);
|
||||
SafeWrite8(0x478138, 0xBA);
|
||||
MakeCall(0x474D22, &barter_attempt_transaction_hack, true);
|
||||
MakeJump(0x474D22, barter_attempt_transaction_hack);
|
||||
HookCall(0x4798B1, &item_m_turn_off_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
@@ -1255,7 +1288,7 @@ void BugsInit()
|
||||
// Fix for incorrect initialization of action points at the beginning of each turn
|
||||
dlog("Applying Action Points initialization fix.", DL_INIT);
|
||||
BlockCall(0x422E02);
|
||||
MakeCall(0x422E1B, &combat_hack, false);
|
||||
MakeCall(0x422E1B, combat_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Fix for incorrect death animations being used when killing critters with kill_critter_type function
|
||||
@@ -1270,13 +1303,13 @@ void BugsInit()
|
||||
// Partial fix for incorrect positioning after exiting small locations (e.g. Ghost Farm)
|
||||
//if (GetPrivateProfileIntA("Misc", "SmallLocExitFix", 1, ini)) {
|
||||
dlog("Applying fix for incorrect positioning after exiting small locations.", DL_INIT);
|
||||
MakeCall(0x4C5A41, &wmTeleportToArea_hack, true);
|
||||
MakeJump(0x4C5A41, wmTeleportToArea_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
//if (GetPrivateProfileIntA("Misc", "PrintToFileFix", 1, ini)) {
|
||||
dlog("Applying print to file fix.", DL_INIT);
|
||||
MakeCall(0x4C67D4, &db_get_file_list_hack, false);
|
||||
MakeCall(0x4C67D4, db_get_file_list_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
@@ -1293,25 +1326,33 @@ void BugsInit()
|
||||
// and are overloaded
|
||||
HookCall(0x4764FC, (void*)item_add_force_);
|
||||
// Fix for the engine not checking player's inventory properly when putting items into the bag/backpack in the hands
|
||||
MakeCall(0x4715DB, &switch_hand_hack, true);
|
||||
MakeJump(0x4715DB, switch_hand_hack);
|
||||
// Fix to ignore player's equipped items when opening bag/backpack
|
||||
MakeCall(0x471B7F, &inven_item_wearing, false); // inven_right_hand_
|
||||
MakeCall(0x471B7F, inven_item_wearing); // inven_right_hand_
|
||||
SafeWrite8(0x471B84, 0x90); // nop
|
||||
MakeCall(0x471BCB, &inven_item_wearing, false); // inven_left_hand_
|
||||
MakeCall(0x471BCB, inven_item_wearing); // inven_left_hand_
|
||||
SafeWrite8(0x471BD0, 0x90); // nop
|
||||
MakeCall(0x471C17, &inven_item_wearing, false); // inven_worn_
|
||||
MakeCall(0x471C17, inven_item_wearing); // inven_worn_
|
||||
SafeWrite8(0x471C1C, 0x90); // nop
|
||||
// Fix crash when trying to open bag/backpack on the table in the bartering interface
|
||||
MakeCall(0x473191, &inven_action_cursor_hack, false);
|
||||
MakeCall(0x473191, inven_action_cursor_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
// Fix crash when clicking on empty space in the inventory list opened by "Use Inventory Item On" (backpack) action icon
|
||||
MakeCall(0x471A94, &use_inventory_on_hack, false);
|
||||
MakeCall(0x471A94, use_inventory_on_hack);
|
||||
|
||||
// Fix item_count function returning incorrect value when there is a container-item inside
|
||||
MakeCall(0x47808C, ItemCountFix, true); // replacing item_count_ function
|
||||
MakeJump(0x47808C, ItemCountFix); // replacing item_count_ function
|
||||
|
||||
// Fix for Sequence stat value not being printed correctly when using "print to file" option
|
||||
MakeCall(0x4396F5, &Save_as_ASCII_hack, true);
|
||||
MakeJump(0x4396F5, Save_as_ASCII_hack);
|
||||
|
||||
// Fix for Bonus Move APs being replenished when you save and load the game in combat
|
||||
//if (GetPrivateProfileIntA("Misc", "BonusMoveFix", 1, ini)) {
|
||||
dlog("Applying fix for Bonus Move exploit.", DL_INIT);
|
||||
HookCall(0x420E93, &combat_load_hook);
|
||||
MakeCall(0x422A06, combat_turn_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ void ComputeSprayModInit() {
|
||||
compute_spray_target_div = 1;
|
||||
if (compute_spray_target_mult > compute_spray_target_div)
|
||||
compute_spray_target_mult = compute_spray_target_div;
|
||||
MakeCall(0x4234F1, &compute_spray_rounds_distribution, true);
|
||||
MakeJump(0x4234F1, compute_spray_rounds_distribution);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -50,7 +50,7 @@ void ConsoleInit() {
|
||||
GetPrivateProfileString("Misc", "ConsoleOutputPath", "", path, MAX_PATH, ini);
|
||||
if(strlen(path)>0) {
|
||||
consolefile.open(path);
|
||||
if(consolefile.is_open()) MakeCall(0x43186C, &ConsoleHook, true);
|
||||
if(consolefile.is_open()) MakeJump(0x43186C, ConsoleHook);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,14 +209,14 @@ void ResetExplosionSettings() {
|
||||
}
|
||||
|
||||
void ExplosionLightingInit() {
|
||||
MakeCall(0x411AB4, &explosion_effect_hook, true); // required for explosions_metarule
|
||||
MakeJump(0x411AB4, explosion_effect_hook); // required for explosions_metarule
|
||||
|
||||
if (GetPrivateProfileIntA("Misc", "ExplosionsEmitLight", 0, ini)) {
|
||||
dlog("Applying Explosion changes.", DL_INIT);
|
||||
lightingEnabled = true;
|
||||
MakeCall(0x4118E1, &ranged_attack_lighting_fix, true);
|
||||
MakeCall(0x410A4A, &fire_dance_lighting_fix1, true);
|
||||
MakeCall(0x415A3F, anim_set_check__light_fix, true); // this allows to change light intensity
|
||||
MakeJump(0x4118E1, ranged_attack_lighting_fix);
|
||||
MakeJump(0x410A4A, fire_dance_lighting_fix1);
|
||||
MakeJump(0x415A3F, anim_set_check__light_fix); // this allows to change light intensity
|
||||
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ static void __declspec(naked) FSLoadHook() {
|
||||
}
|
||||
void FileSystemInit() {
|
||||
UsingFileSystem=true;
|
||||
MakeCall(0x47CCE2, &FSLoadHook, true);
|
||||
MakeJump(0x47CCE2, FSLoadHook);
|
||||
|
||||
HookCall(0x4C5DBD, &asm_xfclose);
|
||||
HookCall(0x4C5EA5, &asm_xfclose);
|
||||
|
||||
@@ -1176,7 +1176,7 @@ static void HookScriptInit2() {
|
||||
HookCall(0x42679A, &ToHitHook); // combat_to_hit_
|
||||
|
||||
LoadHookScript("hs_afterhitroll", HOOK_AFTERHITROLL);
|
||||
MakeCall(0x423893, &AfterHitRollHook, true);
|
||||
MakeJump(0x423893, AfterHitRollHook);
|
||||
|
||||
LoadHookScript("hs_calcapcost", HOOK_CALCAPCOST);
|
||||
HookCall(0x42307A, &CalcApCostHook);
|
||||
@@ -1189,7 +1189,7 @@ static void HookScriptInit2() {
|
||||
HookCall(0x42AE71, &CalcApCostHook);
|
||||
HookCall(0x460048, &CalcApCostHook);
|
||||
HookCall(0x47807B, &CalcApCostHook);
|
||||
MakeCall(0x478083, &CalcApCostHook2, false);
|
||||
MakeCall(0x478083, CalcApCostHook2);
|
||||
|
||||
LoadHookScript("hs_deathanim1", HOOK_DEATHANIM1);
|
||||
LoadHookScript("hs_deathanim2", HOOK_DEATHANIM2);
|
||||
@@ -1234,7 +1234,7 @@ static void HookScriptInit2() {
|
||||
HookCall(0x473573, &UseObjOnHook_item_d_take_drug); // inven_action_cursor
|
||||
|
||||
LoadHookScript("hs_removeinvenobj", HOOK_REMOVEINVENOBJ);
|
||||
MakeCall(0x477490, &RemoveObjHook, true);
|
||||
MakeJump(0x477490, RemoveObjHook);
|
||||
|
||||
LoadHookScript("hs_barterprice", HOOK_BARTERPRICE);
|
||||
HookCall(0x474D4C, &BarterPriceHook);
|
||||
@@ -1257,7 +1257,7 @@ static void HookScriptInit2() {
|
||||
SafeWrite32(0x426CF8, (DWORD)&HexShootBlockingHook);
|
||||
SafeWrite32(0x42A570, (DWORD)&HexShootBlockingHook);
|
||||
SafeWrite32(0x42A0A4, (DWORD)&HexABlockingHook);
|
||||
MakeCall(0x48B848, &HexMBlockingHook, true);
|
||||
MakeJump(0x48B848, HexMBlockingHook);
|
||||
|
||||
LoadHookScript("hs_itemdamage", HOOK_ITEMDAMAGE);
|
||||
HookCall(0x478560, &ItemDamageHook);
|
||||
@@ -1287,19 +1287,19 @@ static void HookScriptInit2() {
|
||||
HookCall(0x42BC87, &PerceptionRangeHook);
|
||||
HookCall(0x42BC9F, &PerceptionRangeHook);
|
||||
HookCall(0x42BD04, &PerceptionRangeHook);
|
||||
MakeCall(0x456BA2, &PerceptionRangeBonusHack, true);
|
||||
MakeJump(0x456BA2, PerceptionRangeBonusHack);
|
||||
HookCall(0x458403, &PerceptionRangeHook);
|
||||
|
||||
LoadHookScript("hs_inventorymove", HOOK_INVENTORYMOVE);
|
||||
HookCall(0x4712E3, &SwitchHandHook); // left slot
|
||||
HookCall(0x47136D, &SwitchHandHook); // right slot
|
||||
MakeCall(0x4713A3, &UseArmorHack, true);
|
||||
MakeJump(0x4713A3, UseArmorHack);
|
||||
//HookCall(0x4711B3, &DropIntoContainerHook);
|
||||
//HookCall(0x47147C, &DropIntoContainerHook);
|
||||
HookCall(0x471200, &MoveInventoryHook);
|
||||
//HookCall(0x4712C7, &DropAmmoIntoWeaponHook);
|
||||
//HookCall(0x471351, &DropAmmoIntoWeaponHook);
|
||||
MakeCall(0x476588, &DropAmmoIntoWeaponHack, true);
|
||||
MakeJump(0x476588, DropAmmoIntoWeaponHack);
|
||||
|
||||
LoadHookScript("hs_invenwield", HOOK_INVENWIELD);
|
||||
HookCall(0x47275E, &invenWieldFunc_Hook);
|
||||
|
||||
+10
-10
@@ -638,7 +638,7 @@ void InventoryInit() {
|
||||
mode=GetPrivateProfileInt("Misc", "CritterInvSizeLimitMode", 0, ini);
|
||||
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
|
||||
invenapqpreduction=GetPrivateProfileInt("Misc", "QuickPocketsApCostReduction", 2, ini);
|
||||
MakeCall(0x46E80B, inven_ap_cost_hook, true);
|
||||
MakeJump(0x46E80B, inven_ap_cost_hook);
|
||||
if(mode>7) mode=0;
|
||||
if(mode>=4) {
|
||||
mode-=4;
|
||||
@@ -649,16 +649,16 @@ void InventoryInit() {
|
||||
|
||||
//Check item_add_multi (picking stuff from the floor, etc.)
|
||||
HookCall(0x4771BD, &ItemAddMultiHook1);
|
||||
MakeCall(0x47726D, &ItemAddMultiHook2, true);
|
||||
MakeCall(0x42E688, &CritterIsOverloadedHook, true);
|
||||
MakeJump(0x47726D, ItemAddMultiHook2);
|
||||
MakeJump(0x42E688, CritterIsOverloadedHook);
|
||||
|
||||
//Check capacity of player and barteree when bartering
|
||||
MakeCall(0x474C78, &BarterAttemptTransactionHook1, true);
|
||||
MakeCall(0x474CCF, &BarterAttemptTransactionHook2, true);
|
||||
MakeJump(0x474C78, BarterAttemptTransactionHook1);
|
||||
MakeJump(0x474CCF, BarterAttemptTransactionHook2);
|
||||
|
||||
//Display total weight on the inventory screen
|
||||
SafeWrite32(0x4725FF, (DWORD)&InvenFmt);
|
||||
MakeCall(0x4725E0, &DisplayStatsHook, true);
|
||||
MakeJump(0x4725E0, DisplayStatsHook);
|
||||
SafeWrite8(0x47260F, 0x20);
|
||||
SafeWrite32(0x4725F9, 0x9c+0xc);
|
||||
SafeWrite8(0x472606, 0x10+0xc);
|
||||
@@ -671,18 +671,18 @@ void InventoryInit() {
|
||||
|
||||
if(GetPrivateProfileInt("Misc", "SuperStimExploitFix", 0, ini)) {
|
||||
GetPrivateProfileString("sfall", "SuperStimExploitMsg", "You cannot use a super stim on someone who is not injured!", SuperStimMsg, 128, translationIni);
|
||||
MakeCall(0x49C3CC, SuperStimFix, true);
|
||||
MakeJump(0x49C3CC, SuperStimFix);
|
||||
}
|
||||
|
||||
if(GetPrivateProfileInt("Misc", "CheckWeaponAmmoCost", 0, ini)) {
|
||||
MakeCall(0x4266E9, &add_check_for_item_ammo_cost, true);
|
||||
MakeCall(0x4234B3, ÷_burst_rounds_by_ammo_cost, true);
|
||||
MakeJump(0x4266E9, add_check_for_item_ammo_cost);
|
||||
MakeJump(0x4234B3, divide_burst_rounds_by_ammo_cost);
|
||||
}
|
||||
|
||||
ReloadWeaponKey = GetPrivateProfileInt("Input", "ReloadWeaponKey", 0, ini);
|
||||
|
||||
if (GetPrivateProfileIntA("Misc", "StackEmptyWeapons", 0, ini)) {
|
||||
MakeCall(0x4736C6, &inven_action_cursor_hack, true);
|
||||
MakeJump(0x4736C6, inven_action_cursor_hack);
|
||||
HookCall(0x4772AA, &item_add_mult_hook);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -187,10 +187,10 @@ fail:
|
||||
void KnockbackInit() {
|
||||
SafeWrite16(0x424B61, 0x25ff);
|
||||
SafeWrite32(0x424B63, (DWORD)&KnockbackAddr);
|
||||
MakeCall(0x4136D3, &KnockbackHook2, true); // for op_critter_dmg
|
||||
MakeCall(0x424791, HitChanceHook, true);
|
||||
MakeCall(0x4ABC62, PickpocketHook, true);
|
||||
MakeCall(0x429E44, BurstHook, true);
|
||||
MakeJump(0x4136D3, KnockbackHook2); // for op_critter_dmg
|
||||
MakeJump(0x424791, HitChanceHook);
|
||||
MakeJump(0x4ABC62, PickpocketHook);
|
||||
MakeJump(0x429E44, BurstHook);
|
||||
}
|
||||
void Knockback_OnGameLoad() {
|
||||
mTargets.clear();
|
||||
|
||||
+4
-4
@@ -97,14 +97,14 @@ void MainMenuInit() {
|
||||
if(tmp=GetPrivateProfileIntA("Misc", "MainMenuOffsetY", 0, ini)) {
|
||||
MainMenuYOffset=tmp;
|
||||
MainMenuTextOffset+=tmp*640;
|
||||
MakeCall(0x481844, &MainMenuButtonYHook, true);
|
||||
MakeJump(0x481844, MainMenuButtonYHook);
|
||||
}
|
||||
if(MainMenuTextOffset) {
|
||||
SafeWrite8(0x481933, 0x90);
|
||||
MakeCall(0x481934, &MainMenuTextYHook, false);
|
||||
MakeCall(0x481934, MainMenuTextYHook);
|
||||
}
|
||||
|
||||
MakeCall(0x4817AB, MainMenuTextHook, true);
|
||||
MakeJump(0x4817AB, MainMenuTextHook);
|
||||
OverrideColour=GetPrivateProfileInt("Misc", "MainMenuFontColour", 0, ini);
|
||||
if(OverrideColour) MakeCall(0x48174C, &FontColour, false);
|
||||
if(OverrideColour) MakeCall(0x48174C, FontColour);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ void PartyControlInit() {
|
||||
|
||||
HookCall(0x46EBEE, &FidChangeHook);
|
||||
|
||||
MakeCall(0x422354, &CombatHack_add_noncoms_, true);
|
||||
MakeJump(0x422354, CombatHack_add_noncoms_);
|
||||
HookCall(0x422D87, &CombatWrapper_v2);
|
||||
HookCall(0x422E20, &CombatWrapper_v2);
|
||||
|
||||
|
||||
+3
-3
@@ -727,7 +727,7 @@ static void PerkSetup() {
|
||||
}
|
||||
|
||||
//perk_owed hooks
|
||||
MakeCall(0x4AFB2F, LevelUpHook, false);//replaces 'mov edx, ds:[PlayerLevel]
|
||||
MakeCall(0x4AFB2F, LevelUpHook);//replaces 'mov edx, ds:[PlayerLevel]
|
||||
SafeWrite8(0x4AFB34, 0x90);
|
||||
|
||||
SafeWrite8(0x43C2EC, 0xEB); //skip the block of code which checks if the player has gained a perk (now handled in level up code)
|
||||
@@ -854,8 +854,8 @@ static void __declspec(naked) BlockedTrait() {
|
||||
}
|
||||
}
|
||||
static void TraitSetup() {
|
||||
MakeCall(0x4B3C7C, &TraitAdjustStatHook, true);
|
||||
MakeCall(0x4B40FC, &TraitAdjustSkillHook, true);
|
||||
MakeJump(0x4B3C7C, TraitAdjustStatHook);
|
||||
MakeJump(0x4B40FC, TraitAdjustSkillHook);
|
||||
|
||||
memset(tName, 0, sizeof(tName));
|
||||
memset(tDesc, 0, sizeof(tDesc));
|
||||
|
||||
+8
-2
@@ -45,8 +45,14 @@ void _stdcall SafeWriteStr(DWORD addr, const char* data) {
|
||||
void HookCall(DWORD addr, void* func) {
|
||||
SafeWrite32(addr+1, (DWORD)func - (addr+5));
|
||||
}
|
||||
void MakeCall(DWORD addr, void* func, bool jump) {
|
||||
SafeWrite8(addr, jump?0xe9:0xe8);
|
||||
|
||||
void MakeCall(DWORD addr, void* func) {
|
||||
SafeWrite8(addr, 0xE8);
|
||||
HookCall(addr, func);
|
||||
}
|
||||
|
||||
void MakeJump(DWORD addr, void* func) {
|
||||
SafeWrite8(addr, 0xE9);
|
||||
HookCall(addr, func);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -11,7 +11,8 @@ void _stdcall SafeWrite16(DWORD addr, WORD data);
|
||||
void _stdcall SafeWrite32(DWORD addr, DWORD data);
|
||||
void _stdcall SafeWriteStr(DWORD addr, const char* data);
|
||||
void HookCall(DWORD addr, void* func);
|
||||
void MakeCall(DWORD addr, void* func, bool jump);
|
||||
void MakeCall(DWORD addr, void* func);
|
||||
void MakeJump(DWORD addr, void* func);
|
||||
void BlockCall(DWORD addr);
|
||||
void SafeMemSet(DWORD addr, BYTE val, int len);
|
||||
void SafeWriteBytes(DWORD addr, BYTE* data, int count);
|
||||
@@ -1212,20 +1212,20 @@ void ScriptExtenderSetup() {
|
||||
HookCall(0x480E7B, MainGameLoopHook); //hook the main game loop
|
||||
HookCall(0x422845, CombatLoopHook); //hook the combat loop
|
||||
|
||||
MakeCall(0x4A390C, &FindSidHook, true);
|
||||
MakeCall(0x4A5E34, &ScrPtrHook, true);
|
||||
MakeJump(0x4A390C, FindSidHook);
|
||||
MakeJump(0x4A5E34, ScrPtrHook);
|
||||
memset(&OverrideScriptStruct, 0, sizeof(TScript));
|
||||
|
||||
MakeCall(0x4230D5, &AfterCombatAttackHook, true);
|
||||
MakeCall(0x4A67F2, &ExecMapScriptsHook, true);
|
||||
MakeJump(0x4230D5, AfterCombatAttackHook);
|
||||
MakeJump(0x4A67F2, ExecMapScriptsHook);
|
||||
|
||||
// this patch makes it possible to export variables from sfall global scripts
|
||||
MakeCall(0x4414C8, &Export_Export_FindVar_Hook, true);
|
||||
MakeJump(0x4414C8, Export_Export_FindVar_Hook);
|
||||
HookCall(0x441285, &Export_FetchOrStore_FindVar_Hook); // store
|
||||
HookCall(0x4413D9, &Export_FetchOrStore_FindVar_Hook); // fetch
|
||||
|
||||
// fix vanilla negate operator on float values
|
||||
MakeCall(0x46AB63, &NegateFixHook, true);
|
||||
MakeJump(0x46AB63, NegateFixHook);
|
||||
// fix incorrect int-to-float conversion
|
||||
// op_mult:
|
||||
SafeWrite16(0x46A3F4, 0x04DB); // replace operator to "fild 32bit"
|
||||
|
||||
+1
-1
@@ -242,7 +242,7 @@ void StatsInit() {
|
||||
|
||||
GetPrivateProfileStringA("Misc", "DerivedStats", "", table, 2048, ini);
|
||||
if(strlen(table)) {
|
||||
MakeCall(0x4AF6FC, &stat_recalc_derived, true);
|
||||
MakeJump(0x4AF6FC, stat_recalc_derived);
|
||||
memset(StatFormulas, 0, sizeof(StatFormulas));
|
||||
memset(StatShifts, 0, sizeof(StatShifts));
|
||||
memset(StatMulti, 0, sizeof(StatMulti));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user