[Scummvm-git-logs] scummvm master -> 8ddd8da773c8969350914a1d07c492587eb28ab1
AndywinXp
noreply at scummvm.org
Mon Nov 13 21:33:25 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8ddd8da773 SCUMM: GUI: Fix confirmation on exit behavior on script quit commands
Commit: 8ddd8da773c8969350914a1d07c492587eb28ab1
https://github.com/scummvm/scummvm/commit/8ddd8da773c8969350914a1d07c492587eb28ab1
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-11-13T22:33:18+01:00
Commit Message:
SCUMM: GUI: Fix confirmation on exit behavior on script quit commands
We now quit without confirmation when the scripts tell the
interpreter to quit. Except in COMI main menu, when pressing
on the "Quit" option. In that case we must ALWAYS show the
confirmation dialog box.
Changed paths:
engines/scumm/gfx_gui.cpp
engines/scumm/script_v5.cpp
engines/scumm/script_v6.cpp
engines/scumm/script_v8.cpp
engines/scumm/scumm.h
diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 3159868049a..d0c68a133cb 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -846,8 +846,21 @@ int ScummEngine::getInternalGUIControlFromCoordinates(int x, int y) {
#ifdef ENABLE_SCUMM_7_8
void ScummEngine_v7::queryQuit(bool returnToLauncher) {
if (isUsingOriginalGUI()) {
+ if (_quitFromScriptCmd) {
+ _quitByGUIPrompt = true;
+ if (returnToLauncher) {
+ Common::Event event;
+ event.type = Common::EVENT_RETURN_TO_LAUNCHER;
+ getEventManager()->pushEvent(event);
+ } else {
+ quitGame();
+ }
+
+ _quitFromScriptCmd = false;
+ }
+
if (_game.version == 8 && !(_game.features & GF_DEMO) &&
- (ConfMan.hasKey("confirm_exit") && ConfMan.getBool("confirm_exit"))) {
+ ((ConfMan.hasKey("confirm_exit") && ConfMan.getBool("confirm_exit")) || (_currentRoom == 92 && _quitFromScriptCmd))) {
int boxWidth, strWidth;
int ctrlId;
@@ -1005,7 +1018,7 @@ void ScummEngine_v7::queryQuit(bool returnToLauncher) {
getEventManager()->pushEvent(event);
} else {
quitGame();
- };
+ }
}
// Restore the previous cursor...
@@ -2052,6 +2065,19 @@ void ScummEngine::queryQuit(bool returnToLauncher) {
char msgLabelPtr[512];
char localizedYesKey;
+ if (_quitFromScriptCmd) {
+ _quitByGUIPrompt = true;
+ if (returnToLauncher) {
+ Common::Event event;
+ event.type = Common::EVENT_RETURN_TO_LAUNCHER;
+ getEventManager()->pushEvent(event);
+ } else {
+ quitGame();
+ }
+
+ _quitFromScriptCmd = false;
+ }
+
convertMessageToString((const byte *)getGUIString(gsQuitPrompt), (byte *)msgLabelPtr, sizeof(msgLabelPtr));
if (msgLabelPtr[0] != '\0') {
diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index fa0708f3244..1fecd6ea930 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -2035,6 +2035,7 @@ void ScummEngine_v5::o5_systemOps() {
pauseGame();
break;
case 3: // SO_QUIT
+ _quitFromScriptCmd = true;
quitGame();
break;
default:
diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp
index e7e95268b5d..4229dd37e5c 100644
--- a/engines/scumm/script_v6.cpp
+++ b/engines/scumm/script_v6.cpp
@@ -2553,6 +2553,7 @@ void ScummEngine_v6::o6_systemOps() {
pauseGame();
break;
case SO_QUIT:
+ _quitFromScriptCmd = true;
quitGame();
break;
default:
diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp
index 985334b5623..2e45d477331 100644
--- a/engines/scumm/script_v8.cpp
+++ b/engines/scumm/script_v8.cpp
@@ -1054,6 +1054,7 @@ void ScummEngine_v8::o8_systemOps() {
restart();
break;
case SO_QUIT: // Quit game
+ _quitFromScriptCmd = true;
quitGame();
break;
default:
@@ -1200,6 +1201,7 @@ void ScummEngine_v8::o8_kernelSetFunctions() {
// Create an artificial CTRL-C keyPress
_keyPressed = Common::KEYCODE_c;
_keyPressed.flags |= Common::KBD_CTRL;
+ _quitFromScriptCmd = true;
} else {
if (ConfMan.getBool("confirm_exit"))
confirmExitDialog();
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 1f22ee8d200..95897519afa 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -556,6 +556,7 @@ public:
bool _enableAudioOverride = false;
bool _enableCOMISong = false;
bool _isAmigaPALSystem = false;
+ bool _quitFromScriptCmd = false;
Common::Keymap *_insaneKeymap;
More information about the Scummvm-git-logs
mailing list