[Scummvm-git-logs] scummvm master -> 404743fafa2695a674ec19e53ad25752183ec22e
bluegr
noreply at scummvm.org
Wed Dec 29 16:48:18 UTC 2021
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:
404743fafa BURIED: Implement game pausing via Control-P - bug #12934
Commit: 404743fafa2695a674ec19e53ad25752183ec22e
https://github.com/scummvm/scummvm/commit/404743fafa2695a674ec19e53ad25752183ec22e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-29T18:47:58+02:00
Commit Message:
BURIED: Implement game pausing via Control-P - bug #12934
Also, this commit fixes wrong fall through when handling the other
hotkey combinations
Changed paths:
engines/buried/biochip_view.cpp
engines/buried/buried.cpp
engines/buried/buried.h
engines/buried/gameui.cpp
diff --git a/engines/buried/biochip_view.cpp b/engines/buried/biochip_view.cpp
index dba02dbb6d0..1ffbb1ad673 100644
--- a/engines/buried/biochip_view.cpp
+++ b/engines/buried/biochip_view.cpp
@@ -38,9 +38,7 @@
#include "common/error.h"
#include "common/stream.h"
#include "common/system.h"
-#include "common/translation.h"
#include "graphics/surface.h"
-#include "gui/message.h"
namespace Buried {
@@ -615,15 +613,7 @@ void InterfaceBioChipViewWindow::onLButtonUp(const Common::Point &point, uint fl
}
break;
case REGION_PAUSE:
- if (!_vm->isDemo()) {
- ((SceneViewWindow *)getParent()->getParent())->_paused = true;
-
- // TODO: Would be nice to load the translated text from IDS_APP_MESSAGE_PAUSED_TEXT (9023)
- GUI::MessageDialog dialog(_("Your game is now Paused. Click OK to continue."));
- dialog.runModal();
-
- ((SceneViewWindow *)getParent()->getParent())->_paused = false;
- }
+ _vm->pauseGame();
break;
case REGION_FLICKER:
if (_flicker.contains(point)) {
diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp
index df9031284d8..c3e7dee9c1f 100644
--- a/engines/buried/buried.cpp
+++ b/engines/buried/buried.cpp
@@ -40,9 +40,11 @@
#include "buried/buried.h"
#include "buried/console.h"
#include "buried/frame_window.h"
+#include "buried/gameui.h"
#include "buried/graphics.h"
#include "buried/message.h"
#include "buried/resources.h"
+#include "buried/scene_view.h"
#include "buried/sound.h"
#include "buried/video_window.h"
#include "buried/window.h"
@@ -579,4 +581,20 @@ bool BuriedEngine::isControlDown() const {
return _mainWindow && ((FrameWindow *)_mainWindow)->_controlDown;
}
+void BuriedEngine::pauseGame() {
+ FrameWindow *frameWindow = (FrameWindow *)_mainWindow;
+ SceneViewWindow *sceneView = ((GameUIWindow *)frameWindow->getMainChildWindow())->_sceneViewWindow;
+
+ if (isDemo())
+ return;
+
+ sceneView->_paused = true;
+
+ // TODO: Would be nice to load the translated text from IDS_APP_MESSAGE_PAUSED_TEXT (9023)
+ GUI::MessageDialog dialog(_("Your game is now Paused. Click OK to continue."));
+ dialog.runModal();
+
+ sceneView->_paused = false;
+}
+
} // End of namespace Buried
diff --git a/engines/buried/buried.h b/engines/buried/buried.h
index e5557ed7a49..f4f8b1dceab 100644
--- a/engines/buried/buried.h
+++ b/engines/buried/buried.h
@@ -138,6 +138,7 @@ public:
void releaseCapture() { _captureWindow = 0; }
bool runQuitDialog();
bool isControlDown() const;
+ void pauseGame();
// Save/Load
bool canLoadGameStateCurrently();
diff --git a/engines/buried/gameui.cpp b/engines/buried/gameui.cpp
index 5c32be9d7cb..f77a8533988 100644
--- a/engines/buried/gameui.cpp
+++ b/engines/buried/gameui.cpp
@@ -311,9 +311,9 @@ void GameUIWindow::onKeyUp(const Common::KeyState &key, uint flags) {
_bioChipRightWindow->invalidateWindow(false);
_bioChipRightWindow->sendMessage(new LButtonUpMessage(Common::Point(50, 130), 0));
_vm->runSaveDialog();
- return;
- }
- // Fall through
+ } else if (_sceneViewWindow)
+ _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ break;
case Common::KEYCODE_o:
case Common::KEYCODE_l:
if ((key.flags & Common::KBD_CTRL) && _sceneViewWindow->getGlobalFlags().bcCloakingEnabled != 1) {
@@ -323,9 +323,15 @@ void GameUIWindow::onKeyUp(const Common::KeyState &key, uint flags) {
if (_vm->runLoadDialog().getCode() == Common::kUnknownError)
((FrameWindow *)_vm->_mainWindow)->showMainMenu();
- return;
- }
- // Fall through
+ } else if (_sceneViewWindow)
+ _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ break;
+ case Common::KEYCODE_p:
+ if ((key.flags & Common::KBD_CTRL) && _sceneViewWindow->getGlobalFlags().bcCloakingEnabled != 1)
+ _vm->pauseGame();
+ else if (_sceneViewWindow)
+ _sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
+ break;
default:
if (_sceneViewWindow)
_sceneViewWindow->sendMessage(new KeyUpMessage(key, flags));
More information about the Scummvm-git-logs
mailing list