[Scummvm-git-logs] scummvm master -> 1aa1c047536d3990ea0a13b4561a454c6c0c8de2
elasota
noreply at scummvm.org
Fri May 26 05:58:39 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:
1aa1c04753 VCRUISE: Fix crash when leaving the game in Schizm. Fix sounds and music still playing after quitting to main menu.
Commit: 1aa1c047536d3990ea0a13b4561a454c6c0c8de2
https://github.com/scummvm/scummvm/commit/1aa1c047536d3990ea0a13b4561a454c6c0c8de2
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-26T01:57:34-04:00
Commit Message:
VCRUISE: Fix crash when leaving the game in Schizm. Fix sounds and music still playing after quitting to main menu.
Changed paths:
engines/vcruise/menu.cpp
engines/vcruise/menu.h
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
diff --git a/engines/vcruise/menu.cpp b/engines/vcruise/menu.cpp
index 5beb5a7e637..81b373134c2 100644
--- a/engines/vcruise/menu.cpp
+++ b/engines/vcruise/menu.cpp
@@ -992,9 +992,11 @@ void ReahQuitMenuPage::onButtonClicked(uint button, bool &outChangedState) {
if (button == kButtonYes) {
if (_isSchizm && _menuInterface->isInGame())
- _menuInterface->changeMenu(new ReahSchizmMainMenuPage(_isSchizm));
+ _menuInterface->quitToMenu();
else
_menuInterface->quitGame();
+
+ outChangedState = true;
} else if (button == kButtonNo)
onButtonClicked(kMenuBarButtonReturn, outChangedState);
}
diff --git a/engines/vcruise/menu.h b/engines/vcruise/menu.h
index df5b7d73e13..e1e31f9311d 100644
--- a/engines/vcruise/menu.h
+++ b/engines/vcruise/menu.h
@@ -61,6 +61,7 @@ public:
virtual void goToCredits() const = 0;
virtual void changeMenu(MenuPage *newPage) const = 0;
virtual void quitGame() const = 0;
+ virtual void quitToMenu() const = 0;
virtual bool canSave() const = 0;
virtual bool reloadFromCheckpoint() const = 0;
virtual void setMusicMute(bool muted) const = 0;
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index de75670eb0e..b6709e7710f 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -77,6 +77,7 @@ public:
void goToCredits() const override;
void changeMenu(MenuPage *newPage) const override;
void quitGame() const override;
+ void quitToMenu() const override;
bool canSave() const override;
bool reloadFromCheckpoint() const override;
void setMusicMute(bool muted) const override;
@@ -147,6 +148,10 @@ void RuntimeMenuInterface::changeMenu(MenuPage *newPage) const {
_runtime->changeToMenuPage(newPage);
}
+void RuntimeMenuInterface::quitToMenu() const {
+ _runtime->quitToMenu();
+}
+
void RuntimeMenuInterface::quitGame() const {
Common::Event evt;
evt.type = Common::EVENT_QUIT;
@@ -2352,20 +2357,29 @@ void Runtime::terminateScript() {
changeToScreen(_roomNumber, _screenNumber);
}
- if (exitToMenu && _gameState == kGameStateIdle) {
- changeToCursor(_cursors[kCursorArrow]);
+ if (exitToMenu && _gameState == kGameStateIdle)
+ quitToMenu();
+}
- if (_gameID == GID_SCHIZM && _musicActive) {
- _scoreTrack = "music99";
- _scoreSection = "start";
- startScoreSection();
- }
+void Runtime::quitToMenu() {
+ changeToCursor(_cursors[kCursorArrow]);
- if (_gameID == GID_REAH || _gameID == GID_SCHIZM)
- changeToMenuPage(createMenuMain(_gameID == GID_SCHIZM));
- else
- error("Missing main menu behavior for this game");
+ if (_gameID == GID_SCHIZM && _musicActive) {
+ _scoreTrack = "music99";
+ _scoreSection = "start";
+ startScoreSection();
}
+
+ for (Common::SharedPtr<SoundInstance> &snd : _activeSounds)
+ stopSound(*snd);
+
+ _activeSounds.clear();
+ _isInGame = false;
+
+ if (_gameID == GID_REAH || _gameID == GID_SCHIZM)
+ changeToMenuPage(createMenuMain(_gameID == GID_SCHIZM));
+ else
+ error("Missing main menu behavior for this game");
}
RoomScriptSet *Runtime::getRoomScriptSetForCurrentRoom() const {
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 585571f848e..f2782c078bf 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -801,6 +801,7 @@ private:
void drawSectionToScreen(const RenderSection §ion, const Common::Rect &rect);
void commitSectionToScreen(const RenderSection §ion, const Common::Rect &rect);
void terminateScript();
+ void quitToMenu();
RoomScriptSet *getRoomScriptSetForCurrentRoom() const;
bool checkCompletionConditions();
More information about the Scummvm-git-logs
mailing list