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 | |
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')
-rw-r--r-- | engines/mads/nebular/dialogs_nebular.cpp | 25 | ||||
-rw-r--r-- | engines/mads/nebular/dialogs_nebular.h | 5 | ||||
-rw-r--r-- | engines/mads/nebular/menu_nebular.cpp | 66 | ||||
-rw-r--r-- | engines/mads/nebular/menu_nebular.h | 8 |
4 files changed, 57 insertions, 47 deletions
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 4e237ea52d..63b16d87e2 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -33,6 +33,7 @@ #include "mads/staticres.h" #include "mads/nebular/dialogs_nebular.h" #include "mads/nebular/game_nebular.h" +#include "mads/nebular/menu_nebular.h" namespace MADS { @@ -270,6 +271,12 @@ bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, void DialogsNebular::showDialog() { switch (_pendingDialog) { + case DIALOG_MAIN_MENU: { + MainMenu *menu = new MainMenu(_vm); + menu->show(); + delete menu; + break; + } case DIALOG_DIFFICULTY: { DifficultyDialog *dlg = new DifficultyDialog(_vm); dlg->show(); @@ -526,6 +533,7 @@ void PictureDialog::restore() { FullScreenDialog::FullScreenDialog(MADSEngine *vm) : _vm(vm) { _screenId = 990; + _palFlag = true; } FullScreenDialog::~FullScreenDialog() { @@ -540,12 +548,7 @@ void FullScreenDialog::display() { int currentSceneId = scene._currentSceneId; int priorSceneId = scene._priorSceneId; - if (_vm->_dialogs->_pendingDialog) { - palFlag = true; - } else { - _vm->_palette->initPalette(); - } - scene.loadScene(_screenId, game._aaName, palFlag); + scene.loadScene(_screenId, game._aaName, _palFlag); scene._priorSceneId = priorSceneId; scene._currentSceneId = currentSceneId; @@ -567,11 +570,7 @@ void FullScreenDialog::display() { _vm->_screen.empty(); _vm->_screen.hLine(0, 20, MADS_SCREEN_WIDTH, 2); _vm->_screen.hLine(0, 179, MADS_SCREEN_WIDTH, 2); - - _vm->_screen.copyRectToScreen(Common::Rect(0, _vm->_screen._offset.y, - MADS_SCREEN_WIDTH, _vm->_screen._offset.y + 1)); - _vm->_screen.copyRectToScreen(Common::Rect(0, _vm->_screen._offset.y + 157, - MADS_SCREEN_WIDTH, _vm->_screen._offset.y + 157)); + game._scene._spriteSlots.fullRefresh(); game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? kTransitionFadeIn : kCenterVertTransition; game._trigger = 0; @@ -582,8 +581,6 @@ void FullScreenDialog::display() { _vm->_palette->setEntry(13, 45, 45, 0); _vm->_palette->setEntry(14, 63, 63, 63); _vm->_palette->setEntry(15, 45, 45, 45); - - _vm->_events->setCursor(CURSOR_ARROW); } /*------------------------------------------------------------------------*/ @@ -641,6 +638,8 @@ void GameDialog::display() { _lineIndex = -1; setClickableLines(); + + _vm->_events->setCursor(CURSOR_ARROW); } GameDialog::~GameDialog() { diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index f4003a8a98..fe7e656b0d 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -120,6 +120,11 @@ protected: int _screenId; /** + * Flag for palette initialization + */ + bool _palFlag; + + /** * Handles displaying the screen background and dialog */ virtual void display(); 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 diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h index 4cd6f37430..e960da494d 100644 --- a/engines/mads/nebular/menu_nebular.h +++ b/engines/mads/nebular/menu_nebular.h @@ -37,19 +37,23 @@ namespace Nebular { enum MADSGameAction { START_GAME, RESUME_GAME, SHOW_INTRO, CREDITS, QUOTES, EXIT }; class MenuView: public FullScreenDialog { +private: + void handleEvents(); protected: - MADSEngine *_vm; bool _breakFlag; + bool _redrawFlag; virtual void doFrame() = 0; virtual bool onEvent(Common::Event &event) = 0; + + virtual void display(); public: MenuView(MADSEngine *vm); virtual ~MenuView() {} - void execute(); + virtual void show(); }; class MainMenu: public MenuView { |