[Scummvm-git-logs] scummvm master -> 4f03586d8b2846dad8ae3bf5a99b5c775c47daf3

mgerhardy noreply at scummvm.org
Thu Aug 18 07:38:46 UTC 2022


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:
4f03586d8b TWINE: music pauses when entering the behaviour mode menu


Commit: 4f03586d8b2846dad8ae3bf5a99b5c775c47daf3
    https://github.com/scummvm/scummvm/commit/4f03586d8b2846dad8ae3bf5a99b5c775c47daf3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-08-17T20:50:39+02:00

Commit Message:
TWINE: music pauses when entering the behaviour mode menu

so it also pauses when hitting F1-F2

https://bugs.scummvm.org/ticket/13679

Changed paths:
    engines/twine/renderer/redraw.cpp
    engines/twine/twine.cpp
    engines/twine/twine.h


diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 0241c551a8e..abfc830e5af 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -677,7 +677,7 @@ void Redraw::redrawEngineActions(bool bgRedraw) { // AffScene
 	_engine->_interface->resetClip();
 
 	if (bgRedraw) {
-		_engine->freezeTime();
+		_engine->freezeTime(false);
 		if (_engine->_scene->_needChangeScene != SCENE_CEILING_GRID_FADE_1 && _engine->_scene->_needChangeScene != SCENE_CEILING_GRID_FADE_2) {
 			_engine->_screens->fadeOut(_engine->_screens->_paletteRGBA);
 		}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 5f1e9679df0..17d0cdd4a63 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -75,8 +75,8 @@
 
 namespace TwinE {
 
-ScopedEngineFreeze::ScopedEngineFreeze(TwinEEngine *engine) : _engine(engine) {
-	_engine->freezeTime();
+ScopedEngineFreeze::ScopedEngineFreeze(TwinEEngine *engine, bool pause) : _engine(engine) {
+	_engine->freezeTime(pause);
 }
 
 ScopedEngineFreeze::~ScopedEngineFreeze() {
@@ -602,10 +602,11 @@ int TwinEEngine::getRandomNumber(uint max) {
 	return _rnd.getRandomNumber(max - 1);
 }
 
-void TwinEEngine::freezeTime() {
+void TwinEEngine::freezeTime(bool pause) {
 	if (_isTimeFreezed == 0) {
 		_saveFreezedTime = _lbaTime;
-		_pauseToken = pauseEngine();
+		if (pause)
+			_pauseToken = pauseEngine();
 	}
 	_isTimeFreezed++;
 }
@@ -614,7 +615,9 @@ void TwinEEngine::unfreezeTime() {
 	--_isTimeFreezed;
 	if (_isTimeFreezed == 0) {
 		_lbaTime = _saveFreezedTime;
-		_pauseToken.clear();
+		if (_pauseToken.isActive()) {
+			_pauseToken.clear();
+		}
 	}
 }
 
@@ -878,7 +881,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 
 		// Process Pause
 		if (_input->toggleActionIfActive(TwinEActionType::Pause)) {
-			ScopedEngineFreeze scopedFreeze(this);
+			ScopedEngineFreeze scopedFreeze(this, true);
 			const char *PauseString = "Pause";
 			_text->setFontColor(COLOR_WHITE);
 			if (_redraw->_inSceneryView) {
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 019a5723eb3..23e1a819395 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -162,7 +162,7 @@ enum class SceneLoopState {
 
 struct ScopedEngineFreeze {
 	TwinEEngine *_engine;
-	ScopedEngineFreeze(TwinEEngine *engine);
+	ScopedEngineFreeze(TwinEEngine *engine, bool pause = false);
 	~ScopedEngineFreeze();
 };
 
@@ -335,7 +335,7 @@ public:
 	void restoreFrontBuffer();
 	void saveFrontBuffer();
 
-	void freezeTime();
+	void freezeTime(bool pause);
 	void unfreezeTime();
 
 	/**




More information about the Scummvm-git-logs mailing list