From 301ab51735cf8c8aac88a3df7e3f8d87b4122bc7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 8 Dec 2016 22:35:33 -0500 Subject: TITANIC: Don't allow GMM Loading/Saving if the PET area is locked --- engines/titanic/pet_control/pet_control.cpp | 6 +++--- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/titanic.cpp | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 423f87cd8c..b7fece7569 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -212,7 +212,7 @@ void CPetControl::resetActiveNPC() { } PetArea CPetControl::setArea(PetArea newArea, bool forceChange) { - if ((!forceChange && newArea == _currentArea) || !isAreaActive()) + if ((!forceChange && newArea == _currentArea) || !isAreaUnlocked()) return _currentArea; // Signal the currently active area that it's being left @@ -271,7 +271,7 @@ bool CPetControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; bool result = false; - if (isAreaActive()) + if (isAreaUnlocked()) result = _frame.MouseButtonDownMsg(msg); if (!result) { @@ -302,7 +302,7 @@ bool CPetControl::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; bool result = false; - if (isAreaActive()) + if (isAreaUnlocked()) result = _frame.MouseButtonUpMsg(msg); if (!result) diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 34d1330b52..af5ceb0a2a 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -354,7 +354,7 @@ public: /** * Returns true if the PET is currently unlocked */ - bool isAreaActive() const { return _areaLockCount == 0; } + bool isAreaUnlocked() const { return _areaLockCount == 0; } /** * Increment the number of PET area (tab) locks diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index e80dc54bcb..48feab5aa4 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -41,6 +41,7 @@ #include "titanic/moves/enter_exit_first_class_state.h" #include "titanic/moves/enter_exit_sec_class_mini_lift.h" #include "titanic/moves/exit_pellerator.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/support/simple_file.h" #include "titanic/true_talk/tt_npc_script.h" @@ -169,11 +170,20 @@ void TitanicEngine::setRoomNames() { bool TitanicEngine::canLoadGameStateCurrently() { - return _window->_inputAllowed; + if (!_window->_inputAllowed) + return false; + CProjectItem *project = _window->_gameManager->_project; + if (project) { + CPetControl *pet = project->getPetControl(); + if (pet && !pet->isAreaUnlocked()) + return false; + } + + return true; } bool TitanicEngine::canSaveGameStateCurrently() { - return _window->_inputAllowed; + return canLoadGameStateCurrently(); } Common::Error TitanicEngine::loadGameState(int slot) { -- cgit v1.2.3