diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 54f5eb78..6a3af7fb 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -3604,6 +3604,21 @@ skip: } } +static __declspec(naked) void wmSetupRandomEncounter_hack() { + static const DWORD wmSetupRandomEncounter_Ret = 0x4C11DB; + __asm { + test edx, edx; // critter + jz skip; + // overwritten engine code + mov [esi + whoHitMe], edx; + mov [edx + whoHitMe], esi; + retn; +skip: + add esp, 4; + jmp wmSetupRandomEncounter_Ret; + } +} + void BugFixes::init() { #ifndef NDEBUG LoadGameHook::OnBeforeGameClose() += PrintAddrList; @@ -4470,6 +4485,9 @@ void BugFixes::init() { // Fix crash when a critter with a powered melee/unarmed weapon runs out of ammo and there is ammo nearby MakeCall(0x47887B, item_w_can_reload_hack); + + // Fix crash when an encounter between two groups fighting each other fails to spawn one group + MakeCall(0x4C119A, wmSetupRandomEncounter_hack, 1); } } diff --git a/sfall/version.h b/sfall/version.h index 119eafd5..1381e3e6 100644 --- a/sfall/version.h +++ b/sfall/version.h @@ -25,6 +25,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 4 #define VERSION_BUILD 7 -#define VERSION_REV 0 +#define VERSION_REV 1 -#define VERSION_STRING "4.4.7" +#define VERSION_STRING "4.4.7.1"