diff options
author | Paul Gilbert | 2014-07-25 22:07:34 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-07-25 22:07:34 -0400 |
commit | 5f2687fdb3a1f5543b4214db0170317c039e60ac (patch) | |
tree | 3e7db012ed3d0557367df1b673236e86d41651c1 /engines/mads/nebular/menu_nebular.cpp | |
parent | 7d4b05098d101cdb6918ec8a11017a7d03ea8814 (diff) | |
download | scummvm-rg350-5f2687fdb3a1f5543b4214db0170317c039e60ac.tar.gz scummvm-rg350-5f2687fdb3a1f5543b4214db0170317c039e60ac.tar.bz2 scummvm-rg350-5f2687fdb3a1f5543b4214db0170317c039e60ac.zip |
MADS: Main menu background is now correctly loading
Diffstat (limited to 'engines/mads/nebular/menu_nebular.cpp')
-rw-r--r-- | engines/mads/nebular/menu_nebular.cpp | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index c47272624c..f6ca990952 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -37,29 +37,44 @@ namespace Nebular { MenuView::MenuView(MADSEngine *vm) : FullScreenDialog(vm) { _breakFlag = false; + _redrawFlag = true; + _palFlag = false; } -void MenuView::execute() { - Common::Event event; +void MenuView::show() { + Scene &scene = _vm->_game->_scene; + EventsManager &events = *_vm->_events; + display(); - // Main event loop to show the view - while (!_breakFlag) { - // Handle events - while (g_system->getEventManager()->pollEvent(event)) { - onEvent(event); - } + events.hideCursor(); + + while (!_breakFlag && !_vm->shouldQuit()) { + handleEvents(); - if (_vm->_events->checkForNextFrameCounter()) { - // Next frame drawn, so allow view to prepare for following one - doFrame(); + if (_redrawFlag) { + scene.drawElements(_vm->_game->_fx, _vm->_game->_fx); + _redrawFlag = false; } - // Slight delay - g_system->delayMillis(10); - _breakFlag = _vm->shouldQuit(); + _vm->_events->waitForNextFrame(); + _vm->_game->_fx = kTransitionNone; + doFrame(); } } +void MenuView::display() { + _vm->_palette->resetGamePalette(4, 8); + + FullScreenDialog::display(); +} + +void MenuView::handleEvents() { + Common::Event event; + + while (g_system->getEventManager()->pollEvent(event)) + onEvent(event); +} + /*------------------------------------------------------------------------*/ MainMenu::MainMenu(MADSEngine *vm): MenuView(vm) { @@ -182,23 +197,23 @@ bool MainMenu::onEvent(Common::Event &event) { void MainMenu::doFrame() { int itemSize; + // Delay between animation frames on the menu uint32 currTime = g_system->getMillis(); if (currTime < _delayTimeout) return; _delayTimeout = currTime + MADS_MENU_ANIM_DELAY; - // Rex Nebular handling to cycle through the animated display of the menu items + // If we've alerady reached the end of the menuitem animation, exit immediately if (_menuItemIndex == 7) return; - // If the user has chosen to skip the menu animation, show the menu immediately + // If the user has chosen to skip the animation, show the full menu immediately if (_skipFlag && !_vm->_events->isCursorVisible()) { // Clear any pending animation // _savedSurface.copyTo(&_vm->_screen, Common::Point(0, MADS_MENU_Y)); - // Quickly loop through all the menuitems to display each's final frame + // Quickly loop through all the menu items to display each's final frame while (_menuItemIndex < 7) { - if (_menuItem) { // Draw the final frame of the menuitem MSprite *spr = _menuItem->getFrame(0); @@ -241,20 +256,7 @@ void MainMenu::doFrame() { // Get the next menuitem resource Common::String spritesName = Resources::formatName(NEBULAR_MENUSCREEN, 'A', ++_menuItemIndex, EXT_SS, ""); - - /* - //sprintf(resName, "RM%dA%d.SS", REX_MENUSCREEN, ++_menuItemIndex); - data = _vm->res()->get(resName); - _menuItem = new SpriteAsset(_vm, data, data->size(), resName); - _vm->res()->toss(resName); - */ - // Slot it into available palette space - /* - RGBList *palData = _menuItem->getRgbList(); - _vm->_palette->addRange(palData); - _menuItem->translate(palData, true); - _itemPalData.push_back(palData); - */ + _menuItem = new SpriteAsset(_vm, spritesName, 0); _frameIndex = _menuItem->getCount() - 1; // If the final resource is now loaded, which contains the highlighted versions of |