mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added AttackComplexFix option (from Mr.Stalin)
This commit is contained in:
@@ -537,6 +537,13 @@ ObjCanHearObjFix=0
|
||||
;If the argument value is -1, the mood will be determined by the local variable 0 of the script (vanilla behavior)
|
||||
StartGDialogFix=0
|
||||
|
||||
;Set to 1 to fix and repurpose the unused called_shot/num_attacks arguments of attack_complex script function
|
||||
;This also changes the behavior of the result flags arguments
|
||||
;called_shot - additional damage, when the damage received by the target is above the specified minimum damage
|
||||
;num_attacks - the number of free action points on the first turn only
|
||||
;attacker_results - unused, must be 0 or not equal to the target_results argument when specifying result flags for the target
|
||||
AttackComplexFix=0
|
||||
|
||||
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
|
||||
ComputeSprayMod=0
|
||||
|
||||
|
||||
@@ -1729,6 +1729,14 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_attack_hook() {
|
||||
__asm {
|
||||
mov esi, dword ptr [esp + 0x3C + 4]; // free_move
|
||||
mov ebx, dword ptr [esp + 0x40 + 4]; // add amount damage to target
|
||||
jmp gdialogActive_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BugsInit()
|
||||
{
|
||||
@@ -2185,4 +2193,18 @@ void BugsInit()
|
||||
|
||||
// Fix for critter_mod_skill taking a negative amount value as a positive
|
||||
SafeWrite8(0x45B910, 0x7E); // jbe > jle
|
||||
|
||||
// Fix and repurpose the unused called_shot/num_attack arguments of attack_complex function
|
||||
// also change the behavior of the result flags arguments
|
||||
// called_shot - additional damage, when the damage received by the target is above the specified minimum
|
||||
// num_attacks - the number of free action points on the first turn only
|
||||
// attacker_results - unused, must be 0 or not equal to the target_results argument when specifying result flags for the target
|
||||
if (GetPrivateProfileIntA("Misc", "AttackComplexFix", 0, ini)) {
|
||||
dlog("Applying attack_complex fix.", DL_INIT);
|
||||
HookCall(0x456D4A, op_attack_hook);
|
||||
SafeWrite8(0x456D61, 0x74); // mov [esp+x], esi
|
||||
SafeWrite8(0x456D92, 0x5C); // mov [esp+x], ebx
|
||||
SafeWrite8(0x456D98, 0x94); // setnz > setz (fix setting result flags)
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user