diff options
author | Eugene Sandulenko | 2016-12-09 16:20:28 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-12-09 16:58:31 +0100 |
commit | ffe52deeed75a2f5e393e2f478abd7a041bb7461 (patch) | |
tree | fd7c80da2e04ec8b2caccc2fc52fe167f502f2e9 /engines | |
parent | 2a01424f0e94e40f697bf748fad6e69a3ee4baa3 (diff) | |
download | scummvm-rg350-ffe52deeed75a2f5e393e2f478abd7a041bb7461.tar.gz scummvm-rg350-ffe52deeed75a2f5e393e2f478abd7a041bb7461.tar.bz2 scummvm-rg350-ffe52deeed75a2f5e393e2f478abd7a041bb7461.zip |
FULLPIPE: Implement switching scenes from the map
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/constants.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 61 | ||||
-rw-r--r-- | engines/fullpipe/modal.h | 1 |
5 files changed, 69 insertions, 0 deletions
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index eb6debe9e0..236b4be7cc 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -259,6 +259,7 @@ namespace Fullpipe { #define SND_CMN_032 3517 #define SND_CMN_054 4762 #define SND_CMN_055 4763 +#define SND_CMN_056 4772 #define SND_CMN_060 4921 #define SND_CMN_061 4922 #define SND_CMN_070 5199 diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 57bde97d9d..aebf73dbe4 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -355,6 +355,10 @@ bool preloadCallback(PreloadItem &pre, int flag) { return true; } +void GameLoader::addPreloadItem(PreloadItem *item) { + _preloadItems.push_back(new PreloadItem(*item)); +} + bool GameLoader::preloadScene(int sceneId, int entranceId) { debugC(0, kDebugLoading, "preloadScene(%d, %d), ", sceneId, entranceId); diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 6c41e1bd07..a6c2416aae 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -105,6 +105,8 @@ class GameLoader : public CObject { bool preloadScene(int sceneId, int entranceId); bool unloadScene(int sceneId); + void addPreloadItem(PreloadItem *item); + void updateSystems(int counterdiff); int getSceneTagBySceneId(int sceneId, SceneTag **st); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 05b719a5c2..6bfd9efea0 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -445,6 +445,13 @@ bool ModalMap::handleMessage(ExCommand *cmd) { switch (cmd->_messageNum) { case 29: + if (_picI03) { + if (_highlightedPic) + clickButton(_highlightedPic); + + return false; + } + _flag = 1; _mouseX = g_fp->_mouseScreenPos.x; _mouseY = g_fp->_mouseScreenPos.y; @@ -455,6 +462,9 @@ bool ModalMap::handleMessage(ExCommand *cmd) { return false; case 30: + if (_picI03) + return false; + _flag = 0; return false; @@ -539,6 +549,57 @@ void ModalMap::initMap() { g_fp->setArcadeOverlay(PIC_CSR_MAP); } +void ModalMap::clickButton(PictureObject *pic) { + if (g_fp->_currentScene == g_fp->_loaderScene) { + _isRunning = 0; + return; + } + + PreloadItem *pitem = 0; + + for (uint i = 0; i < g_fp->_gameLoader->_preloadItems.size(); i++) + if (g_fp->_gameLoader->_preloadItems[i]->preloadId2 == SC_MAP) { + pitem = g_fp->_gameLoader->_preloadItems[i]; + break; + } + + if (!pitem) { + PreloadItem preload; + + preload.preloadId2 = SC_MAP; + g_fp->_gameLoader->addPreloadItem(&preload); + pitem = g_fp->_gameLoader->_preloadItems[g_fp->_gameLoader->_preloadItems.size() - 1]; + } + + PreloadItem *pitem2 = 0; + + for (uint i = 0; i < g_fp->_gameLoader->_preloadItems.size(); i++) + if (g_fp->_gameLoader->_preloadItems[i]->preloadId1 == SC_MAP && + g_fp->_gameLoader->_preloadItems[i]->preloadId2 == pic->_id) { + pitem2 = g_fp->_gameLoader->_preloadItems[i]; + break; + } + + if (pitem && pitem2) { + pitem->preloadId1 = g_fp->_currentScene->_sceneId; + pitem->sceneId = pitem2->sceneId; + pitem->param = pitem2->param; + + if (pitem->preloadId1 == pitem2->sceneId) { + _isRunning = 0; + } else if (checkScenePass(pitem)) { + _isRunning = 0; + + if (!g_fp->isSaveAllowed()) { + //g_fp->_gameLoader->loadAndDecryptSave("savetmp.sav"); + } + g_fp->_gameLoader->preloadScene(pitem->preloadId1, SC_MAP); + } else { + g_fp->playSound(SND_CMN_056, 0); + } + } +} + PictureObject *ModalMap::getScenePicture(int sceneId) { int picId = 0; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 5eed7e75bc..2e7c4f9677 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -127,6 +127,7 @@ private: bool isSceneEnabled(int sceneId); int findMapSceneId(int picId); + void clickButton(PictureObject *pic); }; class ModalFinal : public BaseModalObject { |