diff options
author | Eugene Sandulenko | 2014-05-01 09:44:47 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2014-05-01 09:44:47 +0300 |
commit | 39f771a3c5a2c750fae3c357d3ddec66d63a03dc (patch) | |
tree | 74cc931da488a3e6d290578c5152073fe77997ba | |
parent | b5271364a34d753291b58b5eb344894f17cfe797 (diff) | |
download | scummvm-rg350-39f771a3c5a2c750fae3c357d3ddec66d63a03dc.tar.gz scummvm-rg350-39f771a3c5a2c750fae3c357d3ddec66d63a03dc.tar.bz2 scummvm-rg350-39f771a3c5a2c750fae3c357d3ddec66d63a03dc.zip |
FULLPIPE: Implement ModalSaveGame::saveload()
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.h | 3 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 34 | ||||
-rw-r--r-- | engines/fullpipe/modal.h | 5 | ||||
-rw-r--r-- | engines/fullpipe/utils.h | 1 |
5 files changed, 49 insertions, 2 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index d9f7327a6b..f60b8040ad 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -501,6 +501,14 @@ void GameLoader::updateSystems(int counterdiff) { } } +void GameLoader::readSavegame(const char *fname) { + warning("STUB: readSavegame(%s)", fname); +} + +void GameLoader::writeSavegame(Scene *sc, const char *fname) { + warning("STUB: writeSavegame(sc, %s)", fname); +} + Sc2::Sc2() { _sceneId = 0; _field_2 = 0; diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index a79c0e11b4..61a8b7aafc 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -89,6 +89,9 @@ class GameLoader : public CObject { void applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount); void saveScenePicAniInfos(int sceneId); + void readSavegame(const char *fname); + void writeSavegame(Scene *sc, const char *fname); + GameProject *_gameProject; InteractionController *_interactionController; InputController *_inputController; diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 39b021b38a..10d841e7df 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1460,6 +1460,8 @@ ModalSaveGame::ModalSaveGame() { _rect = g_fp->_sceneRect; _queryDlg = 0; _mode = 1; + + _objtype = kObjTypeModalSaveGame; } ModalSaveGame::~ModalSaveGame() { @@ -1718,6 +1720,38 @@ void ModalSaveGame::processMouse(int x, int y) { _queryRes = 0; } +void ModalSaveGame::saveload() { + if (_objtype != kObjTypeModalSaveGame) + return; + + if (_mode) { + if (getSaveName()) { + bool allowed = true; + + for (Common::Array<MessageQueue *>::iterator s = g_fp->_globalMessageQueueList->begin(); s != g_fp->_globalMessageQueueList->end(); ++s) { + if (!(*s)->_isFinished && ((*s)->getFlags() & 1)) + allowed = false; + } + + if (g_fp->_isSaveAllowed && allowed) + g_fp->_gameLoader->writeSavegame(g_fp->_currentScene, getSaveName()); + } + } else { + if (getSaveName()) { + if (_parentObj) { + delete _parentObj; + + _parentObj = 0; + } + + g_fp->stopAllSoundStreams(); + g_fp->stopSoundStream2(); + + g_fp->_gameLoader->readSavegame(getSaveName()); + } + } +} + void FullpipeEngine::openHelp() { if (!_modalObject) { ModalHelp *help = new ModalHelp; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 2c2295f775..0d73ddb595 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -46,9 +46,10 @@ class BaseModalObject { public: BaseModalObject *_parentObj; + ObjType _objtype; public: - BaseModalObject() : _parentObj(0) {} + BaseModalObject() : _parentObj(0) { _objtype = kObjTypeDefault; } virtual ~BaseModalObject() {} @@ -259,7 +260,7 @@ public: virtual bool handleMessage(ExCommand *message); virtual bool init(int counterdiff); virtual void update(); - virtual void saveload() {} + virtual void saveload(); void processMouse(int x, int y); diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 72e746cd03..3e3ec0b2fc 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -68,6 +68,7 @@ enum ObjType { kObjTypeDefault, kObjTypeExCommand, kObjTypeExCommand2, + kObjTypeModalSaveGame, kObjTypeMovGraph, kObjTypeMovGraphLink, kObjTypeMovGraphNode, |