mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
MOHAWK: RIVEN: Don't allow opening the main menu from the config screens
This commit is contained in:
+16
-14
@@ -335,18 +335,15 @@ void MohawkEngine_Riven::processInput() {
|
||||
}
|
||||
|
||||
void MohawkEngine_Riven::goToMainMenu() {
|
||||
_menuSavedStack = _stack->getId();
|
||||
_menuSavedCard = _card->getId();
|
||||
|
||||
// If we are already in menu, do not call again
|
||||
if (_menuSavedStack == kStackAspit && _menuSavedCard == 1) {
|
||||
_menuSavedStack = -1;
|
||||
_menuSavedCard = -1;
|
||||
if (isInMainMenu()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_menuTumbnail.reset(new Graphics::Surface());
|
||||
createThumbnailFromScreen(_menuTumbnail.get());
|
||||
_menuSavedStack = _stack->getId();
|
||||
_menuSavedCard = _card->getId();
|
||||
|
||||
_menuThumbnail.reset(new Graphics::Surface());
|
||||
createThumbnailFromScreen(_menuThumbnail.get());
|
||||
|
||||
RivenCommand *go = new RivenStackChangeCommand(this, kStackAspit, 1, true, true);
|
||||
RivenScriptPtr goScript = _scriptMan->createScriptWithCommand(go);
|
||||
@@ -362,11 +359,16 @@ void MohawkEngine_Riven::resumeFromMainMenu() {
|
||||
|
||||
_menuSavedStack = -1;
|
||||
_menuSavedCard = -1;
|
||||
_menuTumbnail.reset();
|
||||
_menuThumbnail.reset();
|
||||
}
|
||||
|
||||
bool MohawkEngine_Riven::isInMainMenu() const {
|
||||
static const uint16 kCardIdAspitAtrusJournal = 5;
|
||||
return _stack->getId() == kStackAspit && _card->getId() < kCardIdAspitAtrusJournal;
|
||||
}
|
||||
|
||||
bool MohawkEngine_Riven::isGameStarted() const {
|
||||
return _stack->getId() != kStackAspit || _menuSavedStack != -1;
|
||||
return !isInMainMenu() || _menuSavedStack != -1;
|
||||
}
|
||||
|
||||
void MohawkEngine_Riven::pauseEngineIntern(bool pause) {
|
||||
@@ -646,7 +648,7 @@ void MohawkEngine_Riven::startNewGame() {
|
||||
// Clear all the state data
|
||||
_menuSavedStack = -1;
|
||||
_menuSavedCard = -1;
|
||||
_menuTumbnail.reset();
|
||||
_menuThumbnail.reset();
|
||||
|
||||
_vars.clear();
|
||||
initVars();
|
||||
@@ -692,7 +694,7 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
|
||||
if (loadError.getCode() == Common::kNoError) {
|
||||
_menuSavedStack = -1;
|
||||
_menuSavedCard = -1;
|
||||
_menuTumbnail.reset();
|
||||
_menuThumbnail.reset();
|
||||
}
|
||||
|
||||
return loadError;
|
||||
@@ -719,7 +721,7 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
|
||||
_vars["CurrentCardID"] = _menuSavedCard;
|
||||
}
|
||||
|
||||
const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuTumbnail.get() : nullptr;
|
||||
const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuThumbnail.get() : nullptr;
|
||||
Common::Error error = _saveLoad->saveGame(slot, desc, thumbnail, autosave);
|
||||
|
||||
if (_menuSavedStack != -1) {
|
||||
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
|
||||
int _menuSavedCard;
|
||||
int _menuSavedStack;
|
||||
Common::ScopedPtr<Graphics::Surface, Graphics::SurfaceDeleter> _menuTumbnail;
|
||||
Common::ScopedPtr<Graphics::Surface, Graphics::SurfaceDeleter> _menuThumbnail;
|
||||
|
||||
bool _gameEnded;
|
||||
uint32 _lastSaveTime;
|
||||
@@ -180,6 +180,7 @@ public:
|
||||
// Main menu handling
|
||||
void goToMainMenu();
|
||||
void resumeFromMainMenu();
|
||||
bool isInMainMenu() const;
|
||||
bool isGameStarted() const;
|
||||
void startNewGame();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user