diff options
author | uruk | 2014-03-06 23:01:53 +0100 |
---|---|---|
committer | uruk | 2014-03-06 23:02:07 +0100 |
commit | d09b482bcb976ab36a5a4aa670b7258b1e12a65c (patch) | |
tree | 825c5bdf2bdd8e3763fb4c234a14f5d231c48855 /engines/avalanche | |
parent | d22d20077b15e9d45a5892380681380d4f84fd3d (diff) | |
download | scummvm-rg350-d09b482bcb976ab36a5a4aa670b7258b1e12a65c.tar.gz scummvm-rg350-d09b482bcb976ab36a5a4aa670b7258b1e12a65c.tar.bz2 scummvm-rg350-d09b482bcb976ab36a5a4aa670b7258b1e12a65c.zip |
AVALANCHE: Implement MainMenu::wait().
Rework other pieces of the engine to fit to it's mechanism.
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/avalot.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 12 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 4 | ||||
-rw-r--r-- | engines/avalanche/mainmenu.cpp | 33 |
4 files changed, 50 insertions, 7 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index fefbbedd34..ae96ac4c74 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -211,7 +211,9 @@ void AvalancheEngine::setup() { loadGame(loadSlot); } else { _mainmenu->run(); - + if (_letMeOut) + return; + newGame(); thinkAbout(kObjectMoney, kThing); @@ -223,7 +225,7 @@ void AvalancheEngine::setup() { void AvalancheEngine::runAvalot() { setup(); - do { + while (!_letMeOut && !shouldQuit()) { uint32 beginLoop = _system->getMillis(); updateEvents(); // The event handler. @@ -241,7 +243,7 @@ void AvalancheEngine::runAvalot() { uint32 delay = _system->getMillis() - beginLoop; if (delay <= 55) _system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). - } while (!_letMeOut && !shouldQuit()); + }; warning("STUB: run()"); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 553556f8e0..ae53f3e034 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -801,8 +801,11 @@ void GraphicManager::menuInitialize() { _menu.create(kScreenWidth, kMenuScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); } -void GraphicManager::menuClear() { +void GraphicManager::menuFree() { _menu.free(); +} + +void GraphicManager::menuRestoreScreen() { initGraphics(kScreenWidth, 2 * kScreenHeight, true); } @@ -867,6 +870,13 @@ void GraphicManager::menuDrawBigText(FontType font, uint16 x, uint16 y, Common:: drawBigText(_menu, text, font, 14, x, y, color); } +void GraphicManager::menuDrawIndicator(int x) { // TODO: Implement striped pattern for the indicator. + if (x > 0) + _menu.fillRect(Common::Rect(x - 1, 330, x, 337), kColorBlack); + _menu.fillRect(Common::Rect(x, 330, x + 1, 337), kColorWhite); + menuRefreshScreen(); +} + /** * This function is for skipping the difference between a stored 'size' value associated with a picture * and the actual size of the pictures when reading them from files for Ghostroom and Shoot em' up. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 270e04da85..7e0ed64b5f 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -122,9 +122,11 @@ public: // so it needs it's own graphic functions on that matter. void menuRefreshScreen(); void menuInitialize(); - void menuClear(); + void menuFree(); + void menuRestoreScreen(); void menuLoadPictures(); void menuDrawBigText(FontType font, uint16 x, uint16 y, Common::String text, Color color); + void menuDrawIndicator(int x); void clearAlso(); void clearTextBar(); diff --git a/engines/avalanche/mainmenu.cpp b/engines/avalanche/mainmenu.cpp index 0f64527305..543684556c 100644 --- a/engines/avalanche/mainmenu.cpp +++ b/engines/avalanche/mainmenu.cpp @@ -37,6 +37,7 @@ MainMenu::MainMenu(AvalancheEngine *vm) { } void MainMenu::run() { + CursorMan.showMouse(false); _vm->_graphics->menuInitialize(); _vm->_graphics->menuLoadPictures(); loadRegiInfo(); @@ -54,7 +55,6 @@ void MainMenu::run() { _vm->_graphics->menuRefreshScreen(); wait(); - _vm->_graphics->menuClear(); } void MainMenu::loadFont() { @@ -81,7 +81,36 @@ void MainMenu::centre(int16 y, Common::String text) { } void MainMenu::wait() { - warning("STUB: MainMenu::wait()"); + int x = 0; + while (!_vm->shouldQuit()) { + _vm->_graphics->menuDrawIndicator(x); + _vm->_system->delayMillis(40); + x++; + if (x == 641) + x = 0; + Common::Event event; + _vm->getEvent(event); + if (event.type == Common::EVENT_KEYDOWN) { + switch (event.kbd.keycode) { + case Common::KEYCODE_SPACE: + case Common::KEYCODE_RETURN: + case Common::KEYCODE_1: // Falltroughs are inteded. + // Play the game + _vm->_graphics->menuFree(); + _vm->_graphics->menuRestoreScreen(); + CursorMan.showMouse(true); + return; + case Common::KEYCODE_ESCAPE: + case Common::KEYCODE_6: // Falltroughs are inteded. + // Exit back to DOS + _vm->_letMeOut = true; + _vm->_graphics->menuFree(); + return; + default: + break; + } + } + } } } // End of namespace Avalanche |