diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 0fa6b689..28960061 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -71,7 +71,7 @@ GraphicsHeight=0 GPUBlt=0 ;Set to 1 to allow using 32 bit graphics for talking heads -;Requires graphics mode 4 or 5, and GPUBlt set to 1 +;Requires DX9 graphics mode and v2.0 pixel shader support (see GPUBlt option) Use32BitHeadGraphics=0 ;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies diff --git a/sfall/Bugs.cpp b/sfall/Bugs.cpp index 3db7cc1c..88c19f6b 100644 --- a/sfall/Bugs.cpp +++ b/sfall/Bugs.cpp @@ -2014,6 +2014,28 @@ skip: } } +static void __declspec(naked) exec_script_proc_hack() { + __asm { + mov eax, [esi + 0x58]; + test eax, eax; + ja end; + inc eax; // start proc +end: + retn; + } +} + +static void __declspec(naked) exec_script_proc_hack1() { + __asm { + mov esi, [edi + 0x58]; + test esi, esi; + ja end; + inc esi; // start proc +end: + retn; + } +} + void BugsInit() { // fix vanilla negate operator on float values @@ -2544,4 +2566,8 @@ void BugsInit() HookCall(0x48D666, obj_load_dude_hook1); BlockCall(0x48D675); BlockCall(0x48D69D); + + // Fix for the start procedure not being called correctly if the required standard script procedure is missing + MakeCall(0x4A4926, exec_script_proc_hack); + MakeCall(0x4A4979, exec_script_proc_hack1); } diff --git a/sfall/FalloutEngine.cpp b/sfall/FalloutEngine.cpp index 90e7bee4..6c958302 100644 --- a/sfall/FalloutEngine.cpp +++ b/sfall/FalloutEngine.cpp @@ -986,6 +986,10 @@ long __stdcall QueueFindFirst(TGameObj* object, long qType) { } } +long __stdcall NewObjId() { + __asm call new_obj_id_; +} + // for the backported AmmoCostHook from 4.x long __stdcall ItemWAnimWeap(TGameObj* item, DWORD hitMode) { __asm { diff --git a/sfall/FalloutEngine.h b/sfall/FalloutEngine.h index 0165e448..04c1471b 100644 --- a/sfall/FalloutEngine.h +++ b/sfall/FalloutEngine.h @@ -1008,6 +1008,8 @@ long __stdcall StatLevel(TGameObj* critter, long statId); long __stdcall QueueFindFirst(TGameObj* object, long qType); +long __stdcall NewObjId(); + // for the backported AmmoCostHook from 4.x long __stdcall ItemWAnimWeap(TGameObj* item, DWORD hitMode); long __stdcall ItemWComputeAmmoCost(TGameObj* item, DWORD* rounds); diff --git a/sfall/Knockback.cpp b/sfall/Knockback.cpp index 405500a3..70e4ac97 100644 --- a/sfall/Knockback.cpp +++ b/sfall/Knockback.cpp @@ -202,8 +202,10 @@ void _stdcall KnockbackSetMod(TGameObj* object, DWORD type, float val, DWORD on) void _stdcall KnockbackRemoveMod(TGameObj* object, DWORD on) { std::vector* mods; + int id = object->ID; switch (on) { case 0: + object->ID = NewObjId(); // revert to engine range id mods = &mWeapons; break; case 1: @@ -216,7 +218,7 @@ void _stdcall KnockbackRemoveMod(TGameObj* object, DWORD on) { return; } for (DWORD i = 0; i < mods->size(); i++) { - if ((*mods)[i].id == object->ID) { + if ((*mods)[i].id == id) { mods->erase(mods->begin() + i); return; } diff --git a/sfall/ScriptExtender.h b/sfall/ScriptExtender.h index 0c0f6184..3beca0bb 100644 --- a/sfall/ScriptExtender.h +++ b/sfall/ScriptExtender.h @@ -29,7 +29,7 @@ enum SfallDataType { }; enum UniqueID { - UID_START = 0x10000000, + UID_START = 0x0FFFFFFF, // start at 0x10000000 UID_END = 0x7FFFFFFF }; diff --git a/sfall/movies.cpp b/sfall/movies.cpp index c8958d02..74a2c4c6 100644 --- a/sfall/movies.cpp +++ b/sfall/movies.cpp @@ -269,7 +269,7 @@ static void __declspec(naked) PlayFrameHook2() { } } -static DWORD _cdecl PreparePlayMovie(const DWORD id) { +static DWORD __cdecl PreparePlayMovie(const DWORD id) { //Get file path in unicode wchar_t path[MAX_PATH]; char* master_patches = *(char**)_patches; @@ -538,7 +538,7 @@ static sDSSound* PlayingSound(wchar_t* path, bool loop) { } static const wchar_t *SoundExtensions[] = { L"mp3", L"wma", L"wav" }; -static bool _cdecl SoundFileLoad(DWORD called, const char* path) { +static bool __cdecl SoundFileLoad(DWORD called, const char* path) { if (!path || strlen(path) < 4) return false; wchar_t buf[256]; mbstowcs_s(0, buf, path, 256);