From f986129ab79d253f538c5bc9384df014b74ff617 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Wed, 5 Jan 2022 09:26:29 +0000 Subject: [PATCH] Fixes by rftr: - options screen: fixed crash related to handling inputs while the screen was loading/refreshing - options screen and features screen: added 'Q' input handling to quit to the main menu git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9235 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- FeaturesScreen.cpp | 7 +++++++ Options Screen.cpp | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/FeaturesScreen.cpp b/FeaturesScreen.cpp index 3c4df473..047c2309 100644 --- a/FeaturesScreen.cpp +++ b/FeaturesScreen.cpp @@ -796,6 +796,13 @@ void GetUserInput() { switch (Event.usParam) { + case 'q': + case 'Q': + //Confirm the Exit to the main menu screen + DoMessageBox(MSG_BOX_BASIC_STYLE, zOptionsText[OPT_RETURN_TO_MAIN], FEATURES_SCREEN, MSG_BOX_FLAG_YESNO, + ConfirmQuitToMainMenuMessageBoxCallBack); + break; + case ESC: SetExitScreen(guiPreviousScreen); break; diff --git a/Options Screen.cpp b/Options Screen.cpp index f1aa4954..ff3743eb 100644 --- a/Options Screen.cpp +++ b/Options Screen.cpp @@ -81,6 +81,7 @@ INT32 giOptionsMessageBox = -1; // Options pop up messages index value INT8 gbHighLightedOptionText = -1; +BOOLEAN gfOptionsScreenUnloading = FALSE; //BOOLEAN gfHideBloodAndGoreOption=FALSE; //all this blood gore option enforcment is unused //If a germany build we are to hide the blood and gore option @@ -226,11 +227,13 @@ UINT32 OptionsScreenHandle() BlitBufferToBuffer( guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); } + else + { + GetOptionsScreenUserInput(); + } RestoreBackgroundRects(); - GetOptionsScreenUserInput(); - HandleOptionsScreen(); if( gfRedrawOptionsScreen ) @@ -759,11 +762,16 @@ BOOLEAN EnterOptionsScreen() gfSettingOfDontAnimateSmoke = gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ]; gfSettingOfTacticalFaceIcon = gGameSettings.fOptions[ TOPTION_SHOW_TACTICAL_FACE_ICONS ]; + gfOptionsScreenUnloading = FALSE; return( TRUE ); } void ExitOptionsScreen() { + if (gfOptionsScreenUnloading == TRUE) + return; + + gfOptionsScreenUnloading = TRUE; if( gfExitOptionsDueToMessageBox ) { @@ -963,6 +971,13 @@ void GetOptionsScreenUserInput() { switch( Event.usParam ) { + case 'q': + case 'Q': + //Confirm the Exit to the main menu screen + DoOptionsMessageBox( MSG_BOX_BASIC_STYLE, zOptionsText[OPT_RETURN_TO_MAIN], OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, + ConfirmQuitToMainMenuMessageBoxCallBack ); + break; + case ESC: SetOptionsExitScreen( guiPreviousOptionScreen ); break;