Fixed being able to call multiple exit msg boxes with Alt+F4

This commit is contained in:
NovaRain
2023-03-16 10:44:58 +08:00
parent 254473cf1c
commit b69e4e0eeb
+11 -5
View File
@@ -34,7 +34,8 @@ static POINT client;
static long moveWindowKey[2];
static long windowData;
static long reqGameQuit;
static long reqGameQuit = 0;
static bool isClosing = false;
static bool cCursorShow = true;
static bool bkgndErased = false;
@@ -137,19 +138,20 @@ static long __stdcall WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
call fo::funcoffs::main_menu_is_shown_;
test eax, eax;
jnz skip;
cmp isClosing, 0;
jnz end;
mov isClosing, 1;
call fo::funcoffs::game_quit_with_confirm_;
mov isClosing, al;
skip:
mov reqGameQuit, eax;
end:
}
return 0;
}
return DefWindowProcA(hWnd, msg, wParam, lParam);
}
static long __stdcall main_menu_loop_hook() {
return (!reqGameQuit) ? fo::func::get_input() : VK_ESCAPE;
}
static long __stdcall GNW95_keyboard_hook(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode < 0) {
goto callNext;
@@ -182,6 +184,10 @@ callNext:
return 1;
}
static long __stdcall main_menu_loop_hook() {
return (!reqGameQuit) ? fo::func::get_input() : VK_ESCAPE;
}
void WinProc::SetWindowProc() {
SetWindowLongA((HWND)fo::var::getInt(FO_VAR_GNW95_hwnd), GWL_WNDPROC, (LONG)WindowProc);
}