diff --git a/sfall/Bugs.cpp b/sfall/Bugs.cpp index e86b90b8..aecbb0dd 100644 --- a/sfall/Bugs.cpp +++ b/sfall/Bugs.cpp @@ -839,6 +839,25 @@ end: } } +static void __declspec(naked) gdActivateBarter_hook() { + __asm { + call gdialog_barter_pressed_ + cmp ds:[_dialogue_state], ecx + jne skip + cmp ds:[_dialogue_switch_mode], esi + je end +skip: + push ecx + push esi + push edi + push ebp + sub esp, 0x18 + push 0x44A5CC +end: + retn + } +} + void BugsInit() { @@ -1070,9 +1089,16 @@ void BugsInit() dlogr(" Done", DL_INIT); //} - //if (GetPrivateProfileIntA("Misc", "PrintToFileFix", 0, ini)) { + //if (GetPrivateProfileIntA("Misc", "PrintToFileFix", 1, ini)) { dlog("Applying print to file fix.", DL_INIT); MakeCall(0x4C67D4, &db_get_file_list_hack, false); dlogr(" Done", DL_INIT); //} + + // Fix for display issues when calling gdialog_mod_barter with critters with no "Barter" flag set + if (GetPrivateProfileIntA("Misc", "gdBarterDispFix", 1, ini)) { + dlog("Applying gdialog_mod_barter display fix.", DL_INIT); + HookCall(0x448250, &gdActivateBarter_hook); + dlogr(" Done", DL_INIT); + } } diff --git a/sfall/FalloutEngine.cpp b/sfall/FalloutEngine.cpp index 7ef25235..93e7dfde 100644 --- a/sfall/FalloutEngine.cpp +++ b/sfall/FalloutEngine.cpp @@ -23,7 +23,7 @@ #include "Logging.h" // global variables -long* ptr_pc_traits = reinterpret_cast(_pc_trait); // 2 of them +long* ptr_pc_traits = reinterpret_cast(_pc_trait); // 2 of them DWORD* ptr_aiInfoList = reinterpret_cast(_aiInfoList); DWORD* ptr_ambient_light = reinterpret_cast(_ambient_light); @@ -329,6 +329,7 @@ const DWORD game_help_ = 0x443F74; const DWORD game_set_global_var_ = 0x443C98; const DWORD game_time_date_ = 0x4A3338; const DWORD gdialog_barter_cleanup_tables_ = 0x448660; +const DWORD gdialog_barter_pressed_ = 0x44A52C; const DWORD gdialogDisplayMsg_ = 0x445448; const DWORD gdProcess_ = 0x4465C0; const DWORD get_input_ = 0x4C8B78; diff --git a/sfall/FalloutEngine.h b/sfall/FalloutEngine.h index 5b7385fc..91b8b9df 100644 --- a/sfall/FalloutEngine.h +++ b/sfall/FalloutEngine.h @@ -58,6 +58,8 @@ #define _cursor_line 0x664514 #define _dialog_target 0x518848 #define _dialog_target_is_party 0x51884C +#define _dialogue_state 0x518714 +#define _dialogue_switch_mode 0x518718 #define _drugInfoList 0x5191CC #define _edit_win 0x57060C #define _Educated 0x57082C @@ -498,6 +500,7 @@ extern const DWORD game_help_; extern const DWORD game_set_global_var_; extern const DWORD game_time_date_; extern const DWORD gdialog_barter_cleanup_tables_; +extern const DWORD gdialog_barter_pressed_; extern const DWORD gdialogDisplayMsg_; extern const DWORD gdProcess_; extern const DWORD get_input_;