mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Rewrote NPC fleeing fix.
Removed DialogOptions9Lines option from ddraw.ini.
This commit is contained in:
@@ -618,9 +618,6 @@ ReloadReserve=-1
|
||||
;Set to 1 to change the counter in the 'Move Items' window to start at the maximum number of items
|
||||
ItemCounterDefaultMax=0
|
||||
|
||||
;Allows 9 options (lines of text) to be displayed correctly in a dialog window
|
||||
DialogOptions9Lines=1
|
||||
|
||||
;Set to 1 to leave the music playing in dialogue with talking heads
|
||||
EnableMusicInDialogue=0
|
||||
|
||||
|
||||
+22
-10
@@ -21,6 +21,7 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "AI.h"
|
||||
#include "Define.h"
|
||||
#include "FalloutEngine.h"
|
||||
#include "SafeWrite.h"
|
||||
|
||||
@@ -31,25 +32,36 @@ static stdext::hash_map<DWORD, DWORD> sources;
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
__asm {
|
||||
call ai_run_away_;
|
||||
mov dword ptr [esi + 0x54], 0; // critter.who_hit_me
|
||||
and byte ptr [esi + 0x3C], ~4; // unset flee flag
|
||||
retn;
|
||||
or byte ptr [esi + 0x3C], 8; // set new 'ReTarget' flag
|
||||
jmp ai_run_away_;
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD combat_ai_hook_flee_Ret = 0x42B22F;
|
||||
static void __declspec(naked) combat_ai_hook_FleeFix() {
|
||||
__asm {
|
||||
call ai_check_drugs_; // try to heal
|
||||
test byte ptr [ebp], 8; // 'ReTarget' flag
|
||||
jnz reTarget;
|
||||
test byte ptr [ebp], 4; // flee flag? (critter.combat_state)
|
||||
jnz flee;
|
||||
jz tryHeal;
|
||||
flee:
|
||||
jmp critter_name_;
|
||||
tryHeal:
|
||||
call ai_check_drugs_; // try to heal
|
||||
mov eax, esi;
|
||||
mov edx, STAT_current_hp;
|
||||
call stat_level_;
|
||||
cmp eax, [ebx + 0x10]; // minimum hp, below which NPC will run away
|
||||
mov eax, esi;
|
||||
jl flee;
|
||||
add esp, 4;
|
||||
jmp combat_ai_hook_flee_Ret;
|
||||
reTarget:
|
||||
and byte ptr [ebp], ~(4 | 8); // unset Flee/ReTarget flags
|
||||
xor edi, edi;
|
||||
mov dword ptr [esi + 0x54], edi; // critter.who_hit_me
|
||||
add esp, 4;
|
||||
jmp combat_ai_hook_flee_Ret;
|
||||
flee:
|
||||
mov eax, esi
|
||||
call critter_name_;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-11
@@ -439,15 +439,12 @@ end:
|
||||
|
||||
static void __declspec(naked) gdProcessUpdate_hack() {
|
||||
__asm {
|
||||
add eax, esi
|
||||
cmp eax, dword ptr ds:[_optionRect + 0xC] // _optionRect.offy
|
||||
jge skip
|
||||
add eax, 2
|
||||
push 0x44702D
|
||||
retn
|
||||
lea edx, [eax - 2];
|
||||
cmp edx, dword ptr ds:[_optionRect + 0xC]; // _optionRect.offy
|
||||
jl skip;
|
||||
mov eax, edx;
|
||||
skip:
|
||||
push 0x4470DB
|
||||
retn
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2181,11 +2178,11 @@ void BugFixesInit()
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Allow 9 options (lines of text) to be displayed correctly in a dialog window
|
||||
if (GetPrivateProfileIntA("Misc", "DialogOptions9Lines", 1, ini)) {
|
||||
//if (GetPrivateProfileIntA("Misc", "DialogOptions9Lines", 1, ini)) {
|
||||
dlog("Applying 9 dialog options patch.", DL_INIT);
|
||||
MakeJump(0x44701C, gdProcessUpdate_hack);
|
||||
MakeCall(0x447021, gdProcessUpdate_hack, 1);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
//}
|
||||
|
||||
// Fix for "Unlimited Ammo" exploit
|
||||
dlog("Applying fix for Unlimited Ammo exploit.", DL_INIT);
|
||||
|
||||
Reference in New Issue
Block a user