diff options
author | Eugene Sandulenko | 2014-04-15 22:17:56 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2014-04-15 22:17:56 +0300 |
commit | df39d9a9639d3f55a07af2bdd767d89095e109bd (patch) | |
tree | c28a678d45088724df46c079b95e331b973db721 /engines/fullpipe | |
parent | 98fc589434b18f85a776fb31f1784c540e1ae687 (diff) | |
download | scummvm-rg350-df39d9a9639d3f55a07af2bdd767d89095e109bd.tar.gz scummvm-rg350-df39d9a9639d3f55a07af2bdd767d89095e109bd.tar.bz2 scummvm-rg350-df39d9a9639d3f55a07af2bdd767d89095e109bd.zip |
FULLPIPE: Implement ModalMainMenu::init()
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/constants.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 142 | ||||
-rw-r--r-- | engines/fullpipe/modal.h | 17 |
5 files changed, 162 insertions, 3 deletions
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 741a55f74c..c0b7ed906c 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -267,6 +267,7 @@ namespace Fullpipe { #define TrubaUp 680 // Main Menu +#define PIC_MEX_BGR 5300 #define PIC_MNU_AUTHORS_L 4624 #define PIC_MNU_CONTINUE_L 4626 #define PIC_MNU_DEBUG_L 4632 diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 2b4c90b576..c6cc270b67 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -191,6 +191,10 @@ void FullpipeEngine::initialize() { _mgm = new MGM; } +void FullpipeEngine::restartGame() { + warning("STUB: FullpipeEngine::restartGame()"); +} + Common::Error FullpipeEngine::run() { const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0); // Initialize backend diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 11d7585fa2..9ba5da3726 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -91,6 +91,7 @@ public: GUI::Debugger *getDebugger() { return _console; } void initialize(); + void restartGame(); void setMusicAllowed(int val) { _musicAllowed = val; } diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 46830fce35..ba42096e5a 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -901,6 +901,136 @@ bool ModalMainMenu::handleMessage(ExCommand *message) { return false; } +bool ModalMainMenu::init(int counterdiff) { + switch (_hoverAreaId) { + case PIC_MNU_RESTART_L: + g_fp->restartGame(); + + if (this == g_fp->_modalObject) + return false; + + delete this; + break; + + case PIC_MNU_EXIT_L: + { + ModalQuery *mq = new ModalQuery(); + + g_fp->_modalObject = mq; + + mq->_parentObj = this; + mq->create(_scene, PIC_MEX_BGR); + + _hoverAreaId = 0; + + return true; + } + + case PIC_MNU_DEBUG_L: + g_fp->_gameLoader->unloadScene(SC_MAINMENU); + g_fp->_sceneRect = _screct; + + if (!g_fp->_currentScene) + error("ModalMainMenu::init: Bad state"); + + g_fp->_currentScene->_x = _bgX; + g_fp->_currentScene->_y = _bgY; + + g_fp->_gameLoader->preloadScene(g_fp->_currentScene->_sceneId, SC_DBGMENU); + + return false; + + case PIC_MNU_CONTINUE_L: + if (!_mfield_34) { + g_fp->_gameLoader->unloadScene(SC_MAINMENU); + g_fp->_sceneRect = _screct; + + if (g_fp->_currentScene) { + g_fp->_currentScene->_x = _bgX; + g_fp->_currentScene->_y = _bgY; + } + + return false; + } + + g_fp->restartGame(); + + if (this == g_fp->_modalObject) + return false; + + delete this; + break; + + case PIC_MNU_AUTHORS_L: + g_fp->_modalObject = new ModalCredits(); + g_fp->_modalObject->_parentObj = this; + + _hoverAreaId = 0; + + return true; + + case PIC_MNU_SAVE_L: + case PIC_MNU_LOAD_L: + { + ModalSaveGame *sg = new ModalSaveGame(); + + g_fp->_modalObject = sg; + g_fp->_modalObject->_parentObj = _parentObj; + + int mode = 0; + if (_hoverAreaId == PIC_MNU_SAVE_L) + mode = 1; + + sg->setup(g_fp->accessScene(SC_MAINMENU), mode); + sg->setScene(g_fp->accessScene(SC_MAINMENU)); + + sg->_rect = _screct; + sg->_oldBgX = _bgX; + sg->_oldBgY = _bgY; + + delete this; + } + + break; + + default: + if (_lastArea) { + updateSliderPos(); + } else { + g_fp->_cursorId = PIC_CSR_DEFAULT; + + int idx = checkHover(g_fp->_mouseScreenPos); + + if (idx < 0) + goto LABEL_40; + + g_fp->_cursorId = PIC_CSR_DEFAULT; + + if (idx != this->_menuSliderIdx && idx != this->_musicSliderIdx ) + goto LABEL_40; + } + + g_fp->_cursorId = PIC_CSR_LIFT; + + LABEL_40: + g_fp->setCursor(g_fp->_cursorId); + + updateVolume(); + + return true; + } + + return true; +} + +void ModalMainMenu::updateVolume() { + warning("STUB: ModalMainMenu::updateVolume()"); +} + +void ModalMainMenu::updateSliderPos() { + warning("STUB: ModalMainMenu::updateSliderPos()"); +} + int ModalMainMenu::checkHover(Common::Point &point) { warning("STUB: ModalMainMenu::checkHover()"); @@ -1008,6 +1138,18 @@ void ModalHelp::launch() { } } +void ModalQuery::create(Scene *sc, int picId) { + warning("STUB: ModalQuery::create()"); +} + +void ModalSaveGame::setScene(Scene *sc) { + warning("STUB: ModalSaveGame::setScene()"); +} + +void ModalSaveGame::setup(Scene *sc, int mode) { + warning("STUB: ModalSaveGame::setup()"); +} + void FullpipeEngine::openHelp() { if (!_modalObject) { ModalHelp *help = new ModalHelp; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index b932b695b1..c891ed46bf 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -174,7 +174,7 @@ public: virtual bool pollEvent() { return true; } virtual bool handleMessage(ExCommand *message); - virtual bool init(int counterdiff) { return true; } + virtual bool init(int counterdiff); virtual void update(); virtual void saveload() {} @@ -184,6 +184,8 @@ private: void setSliderPos(); void enableDebugMenu(char c); int checkHover(Common::Point &point); + void updateVolume(); + void updateSliderPos(); }; class ModalHelp : public BaseModalObject { @@ -210,7 +212,7 @@ public: class ModalQuery : public BaseModalObject { public: - ModalQuery(); + ModalQuery() {} virtual ~ModalQuery() {} virtual bool pollEvent() { return true; } @@ -218,11 +220,13 @@ public: virtual bool init(int counterdiff) { return true; } virtual void update() {} virtual void saveload() {} + + void create(Scene *sc, int picId); }; class ModalSaveGame : public BaseModalObject { public: - ModalSaveGame(); + ModalSaveGame() {} virtual ~ModalSaveGame() {} virtual bool pollEvent() { return true; } @@ -230,6 +234,13 @@ public: virtual bool init(int counterdiff) { return true; } virtual void update() {} virtual void saveload() {} + + void setScene(Scene *sc); + void setup(Scene *sc, int mode); + + Common::Rect _rect; + int _oldBgX; + int _oldBgY; }; |