Fixed display issues when calling gdialog_mod_barter with critters with no "Barter" flag set (from Crafty)

This commit is contained in:
NovaRain
2017-01-09 16:35:03 +08:00
parent f05ec714e7
commit ca86b5f930
3 changed files with 32 additions and 2 deletions
+27 -1
View File
@@ -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);
}
}
+2 -1
View File
@@ -23,7 +23,7 @@
#include "Logging.h"
// global variables
long* ptr_pc_traits = reinterpret_cast<long*>(_pc_trait); // 2 of them
long* ptr_pc_traits = reinterpret_cast<long*>(_pc_trait); // 2 of them
DWORD* ptr_aiInfoList = reinterpret_cast<DWORD*>(_aiInfoList);
DWORD* ptr_ambient_light = reinterpret_cast<DWORD*>(_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;
+3
View File
@@ -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_;