Fallout 1 worldmap sfx implementation (#434)

Implemented FO1 worldmap sfx (#373)
Added obj_drop call definition.
This commit is contained in:
Markus
2022-04-21 19:49:48 +08:00
committed by GitHub
parent e9581cd92b
commit f985af96db
2 changed files with 62 additions and 0 deletions
+1
View File
@@ -191,6 +191,7 @@ WRAP_WATCOM_FUNC0(long, new_obj_id)
WRAP_WATCOM_FUNC2(void, obj_bound, fo::GameObject*, object, fo::BoundRect*, boundRect) // Calculates bounding box (rectangle) for a given object
WRAP_WATCOM_FUNC1(long, obj_destroy, fo::GameObject*, object)
WRAP_WATCOM_FUNC2(long, obj_dist, fo::GameObject*, obj_src, fo::GameObject*, obj_trg)
WRAP_WATCOM_FUNC2(void, obj_drop, fo::GameObject*, dropFrom, fo::GameObject*, objectToDrop)
WRAP_WATCOM_FUNC2(long, obj_erase_object, fo::GameObject*, object, fo::BoundRect*, boundRect)
WRAP_WATCOM_FUNC0(fo::GameObject*, obj_find_first)
WRAP_WATCOM_FUNC0(fo::GameObject*, obj_find_next)
+61
View File
@@ -774,6 +774,66 @@ static void UseWalkDistancePatch() {
}
}
bool wmPressed = false;
void __declspec(naked) clickedWMHotspotSound() {
__asm {
mov eax, 0x503E34 // Ib2p1xx1_1
call fo::funcoffs::gsound_play_sfx_file_
mov wmPressed, 1
mov eax, dword ptr ds : [0x00672E90]
mov edx, 0x4C425C
jmp edx
}
}
void __declspec(naked) releasedWMHotspotSound() {
__asm {
mov al, wmPressed
cmp al, 1
jne exit_
mov eax, 0x503E40 // Ib2lu1x1_1
call fo::funcoffs::gsound_play_sfx_file_
mov wmPressed, 0
exit_:
mov eax, dword ptr ds : [0x00672E88]
mov edx, 0x4C425C
jmp edx
}
}
void __declspec(naked) moveWMSound() {
__asm {
push eax
mov eax, 0x503E14
call fo::funcoffs::gsound_play_sfx_file_
pop eax
call fo::funcoffs::wmPartyInitWalking_
mov eax, 0x4C02DF
jmp eax
}
}
static void __declspec(naked) townmapButtonSound() {
__asm {
mov dword ptr ds : [edi + 0x672DD8], eax
mov ebx, 0x451990 // gsound_med_butt_release_
mov edx, 0x451988 // gsound_med_butt_press_
call fo::funcoffs::win_register_button_sound_func_
mov eax, 0x4C4B9A
jmp eax;
}
}
// https://github.com/phobos2077/sfall/issues/373
// See https://www.youtube.com/watch?v=dGZjse7uC_0&t=50m for reference on how it works in FO1.
static void Fallout1WMSoundChanges() {
MakeJump(0x4C02DA, moveWMSound);
MakeJump(0x4C4B94, townmapButtonSound);
MakeJump(0x4C4250, releasedWMHotspotSound);
MakeJump(0x4C4257, clickedWMHotspotSound);
}
static void F1EngineBehaviorPatch() {
if (IniReader::GetConfigInt("Misc", "Fallout1Behavior", 0)) {
dlog("Applying Fallout 1 engine behavior patch.", DL_INIT);
@@ -1027,6 +1087,7 @@ void MiscPatches::init() {
if (HRP::Setting::VersionIsValid) SafeWrite8(HRP::Setting::GetAddress(0x10011738), 10);
}
Fallout1WMSoundChanges();
F1EngineBehaviorPatch();
DialogueFix();
AdditionalWeaponAnimsPatch();