From b665c904f143e740650765ac58ebccfc818c3206 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Tue, 1 Jun 2021 09:51:59 +0800 Subject: [PATCH] Minor code edits --- artifacts/ddraw.ini | 2 +- sfall/Modules/AI.cpp | 2 +- sfall/Modules/BugFixes.cpp | 6 ++++++ sfall/Modules/DebugEditor.cpp | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 5e700de5..e0bee64f 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -371,7 +371,7 @@ SingleCore=1 OverrideArtCacheSize=0 ;Prevents you from saving in combat except at the start of your turn to avoid a few bugs -;Note that even with this option enabled, it is still not advisable to save in combat at all (obsolete information) +;Note that even with this option enabled, it is still not advisable to save in combat ;Set to 2 to block all saving in combat SaveInCombatFix=1 diff --git a/sfall/Modules/AI.cpp b/sfall/Modules/AI.cpp index 40d24139..9c7a448f 100644 --- a/sfall/Modules/AI.cpp +++ b/sfall/Modules/AI.cpp @@ -599,7 +599,7 @@ void AI::init() { /////////////////////// Combat behavior AI fixes /////////////////////// #ifndef NDEBUG - if (IniReader::GetIntDefaultConfig("Debugging", "AIBugFixes", 1) == 0) return; + if (IniReader::GetIntDefaultConfig("Debugging", "AIFixes", 1) == 0) return; #endif // Fix for NPCs not fully reloading a weapon if it has an ammo capacity more than a box of ammo diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 5b29eb27..5d082ede 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -3864,6 +3864,12 @@ void BugFixes::init() }; SafeWriteBytes(0x42A0F4, codeData1, 18); // ai_move_steps_closer_ HookCall(0x42A0F8, (void*)fo::funcoffs::obj_dist_); + BYTE codeData2[] = { // swap code + 0x90, 0x90, 0x31, 0xC0, // xor eax, eax + 0xF6, 0x47, 0x25, 0x08, // test [edi + 0x25], MultiHex_ + }; + SafeWriteBytes(0x42A0E6, codeData2, 8); // ai_move_steps_closer_ + SafeWrite8(0x42A0F2, CodeType::JumpZ); // jmp > jz // Fix to prevent the execution of critter_p_proc and game events when playing movies (same as when the dialog is active) HookCall(0x4A3C89, doBkProcesses_hook); diff --git a/sfall/Modules/DebugEditor.cpp b/sfall/Modules/DebugEditor.cpp index 597ecb42..8b33af3d 100644 --- a/sfall/Modules/DebugEditor.cpp +++ b/sfall/Modules/DebugEditor.cpp @@ -313,7 +313,7 @@ hide: } static void __declspec(naked) art_data_size_hook() { - static char* artDbgMsg = "\nERROR: File not found: %s\n"; + static const char* artDbgMsg = "\nERROR: File not found: %s\n"; __asm { test edi, edi; jz artNotExist; @@ -340,7 +340,7 @@ display: } static void __declspec(naked) proto_load_pid_hack() { - static const char* proDbgMsg = "\nERROR reading prototype file: %s\n"; + static const char* proDbgMsg = "\nERROR: Reading prototype file: %s\n"; __asm { mov dword ptr [esp + 0x120 - 0x1C + 4], -1; lea eax, [esp + 0x120 - 0x120 + 4]; // pro file