mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added set/unset Special game mode flag when a party member joins/leaves in dialog
Re-fixed commit 227a062 (correct variant)
This commit is contained in:
@@ -181,6 +181,21 @@ long GetScriptLocalVars(long sid) {
|
||||
return (script) ? script->numLocalVars : 0;
|
||||
}
|
||||
|
||||
// Returns window ID by x/y coordinate (hidden windows are ignored)
|
||||
long __fastcall GetTopWindowID(long xPos, long yPos) {
|
||||
fo::Window* win = nullptr;
|
||||
long countWin = *(DWORD*)FO_VAR_num_windows - 1;
|
||||
for (int n = countWin; n >= 0; n--) {
|
||||
win = fo::var::window[n];
|
||||
if (xPos >= win->wRect.left && xPos <= win->wRect.right && yPos >= win->wRect.top && yPos <= win->wRect.bottom) {
|
||||
if (!(win->flags & fo::WinFlags::Hidden)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return win->wID;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
//print text to surface
|
||||
void PrintText(char *DisplayText, BYTE ColourIndex, DWORD Xpos, DWORD Ypos, DWORD TxtWidth, DWORD ToWidth, BYTE *ToSurface) {
|
||||
|
||||
@@ -76,6 +76,8 @@ bool IsPartyMember(fo::GameObject* critter);
|
||||
// Returns the number of local variables of the object script
|
||||
long GetScriptLocalVars(long sid);
|
||||
|
||||
long __fastcall GetTopWindowID(long xPos, long yPos);
|
||||
|
||||
// Print text to surface
|
||||
void PrintText(char *displayText, BYTE colorIndex, DWORD x, DWORD y, DWORD textWidth, DWORD destWidth, BYTE *surface);
|
||||
// gets the height of the currently selected font
|
||||
|
||||
@@ -583,19 +583,9 @@ static long gmouse_handle_event_hook() {
|
||||
}
|
||||
|
||||
static void __declspec(naked) gmouse_bk_process_hook() {
|
||||
using namespace fo::WinFlags;
|
||||
__asm {
|
||||
call fo::funcoffs::win_get_top_win_;
|
||||
cmp eax, ds:[FO_VAR_display_win];
|
||||
jnz checkFlag;
|
||||
retn;
|
||||
checkFlag:
|
||||
call fo::funcoffs::GNW_find_;
|
||||
test [eax + 4], Hidden; // window flags
|
||||
jz skip;
|
||||
mov eax, ds:[FO_VAR_display_win]; // window is hidden, so return the number of the display_win
|
||||
skip:
|
||||
retn;
|
||||
mov ecx, eax;
|
||||
jmp fo::GetTopWindowID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -650,6 +650,23 @@ static void __declspec(naked) gdialog_bk_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) gdialogUpdatePartyStatus_hook1() {
|
||||
__asm {
|
||||
push edx;
|
||||
_InLoop2(1, SPECIAL);
|
||||
pop edx;
|
||||
jmp fo::funcoffs::gdialog_window_destroy_;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) gdialogUpdatePartyStatus_hook0() {
|
||||
__asm {
|
||||
call fo::funcoffs::gdialog_window_create_;
|
||||
_InLoop2(0, SPECIAL);
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadGameHook::init() {
|
||||
saveInCombatFix = GetConfigInt("Misc", "SaveInCombatFix", 1);
|
||||
if (saveInCombatFix > 2) saveInCombatFix = 0;
|
||||
@@ -710,7 +727,10 @@ void LoadGameHook::init() {
|
||||
HookCall(0x476AC6, setup_move_timer_win_Hook); // before init win
|
||||
HookCall(0x477067, exit_move_timer_win_Hook);
|
||||
|
||||
HookCall(0x447A7E, gdialog_bk_hook); // Set the Special flag before animating the dialog interface when switching from dialog mode to barter
|
||||
// Set and unset the Special flag of game mode when animating the dialog interface panel
|
||||
HookCall(0x447A7E, gdialog_bk_hook); // set when switching from dialog mode to barter mode (unset when entering barter)
|
||||
HookCall(0x4457B1, gdialogUpdatePartyStatus_hook1); // set when a party member joins/leaves
|
||||
HookCall(0x4457BC, gdialogUpdatePartyStatus_hook0); // unset
|
||||
}
|
||||
|
||||
Delegate<>& LoadGameHook::OnBeforeGameInit() {
|
||||
|
||||
Reference in New Issue
Block a user