diff options
author | Paul Gilbert | 2018-03-04 20:32:15 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-03-04 22:40:43 -0500 |
commit | badbeda5e2e4bad22a3f15582f1d0d4801682df6 (patch) | |
tree | 839f496a57e1a404fd31899f4e2ff8ceb26467c3 | |
parent | b6b9714ec02aa4b927ace42cb9699de899494f91 (diff) | |
download | scummvm-rg350-badbeda5e2e4bad22a3f15582f1d0d4801682df6.tar.gz scummvm-rg350-badbeda5e2e4bad22a3f15582f1d0d4801682df6.tar.bz2 scummvm-rg350-badbeda5e2e4bad22a3f15582f1d0d4801682df6.zip |
XEEN: Implemented Dark Side of Xeen menu
-rw-r--r-- | engines/xeen/dialogs/credits_screen.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.cpp | 177 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.h | 68 |
3 files changed, 229 insertions, 18 deletions
diff --git a/engines/xeen/dialogs/credits_screen.cpp b/engines/xeen/dialogs/credits_screen.cpp index 8fe0387ccf..09547ba282 100644 --- a/engines/xeen/dialogs/credits_screen.cpp +++ b/engines/xeen/dialogs/credits_screen.cpp @@ -63,7 +63,7 @@ void CreditsScreen::execute(const char *content) { clearButtons(); // Wait for keypress - while (!events.isKeyMousePressed()) + while (!_vm->shouldExit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); doScroll(true, false); diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp index 356bb8c3e3..d1d6814cf1 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp @@ -51,7 +51,8 @@ void MainMenuContainer::show() { delete menu; } -MainMenuContainer::MainMenuContainer(const Common::String &spritesName) : _animateCtr(0), _dialog(nullptr) { +MainMenuContainer::MainMenuContainer(const Common::String &spritesName, uint frameCount) : + _frameCount(frameCount), _animateCtr(0), _dialog(nullptr) { _backgroundSprites.load(spritesName); } @@ -64,7 +65,7 @@ MainMenuContainer::~MainMenuContainer() { void MainMenuContainer::draw() { g_vm->_screen->restoreBackground(); - _animateCtr = (_animateCtr + 1) % 9; + _animateCtr = (_animateCtr + 1) % _frameCount; _backgroundSprites.draw(0, _animateCtr); } @@ -86,7 +87,7 @@ void MainMenuContainer::execute() { if (_dialog) _dialog->draw(); - // Fade/scroll in screen if first frame + // Fade/scroll in screen if first frame showing screen if (!showFlag) { loadBackground(); screen.doScroll(false, false); @@ -101,8 +102,8 @@ void MainMenuContainer::execute() { // There's a dialog active, so let it handle the event _dialog->handleEvents(); - // If dialog was removed as a result of the event, flag screen for re-showing - // if the menu screen isn't being left + // If dialog was removed as a result of the event, flag screen for re-showing, + // such as returning to main menu from the Credits screen if (!_dialog) showFlag = false; } else { @@ -123,7 +124,7 @@ void MainMenuContainer::execute() { /*------------------------------------------------------------------------*/ -CloudsMainMenuContainer::CloudsMainMenuContainer() : MainMenuContainer("intro.vga") { +CloudsMainMenuContainer::CloudsMainMenuContainer() : MainMenuContainer("intro.vga", 9) { g_vm->_sound->playSong("inn.m"); } @@ -140,31 +141,40 @@ void CloudsMainMenuContainer::showMenuDialog() { /*------------------------------------------------------------------------*/ -DarkSideMainMenuContainer::DarkSideMainMenuContainer() : MainMenuContainer("intro.vga") { - g_vm->_sound->playSong("inn.m"); +DarkSideMainMenuContainer::DarkSideMainMenuContainer() : MainMenuContainer("title2a.int", 10) { + Screen &screen = *g_vm->_screen; + Sound &sound = *g_vm->_sound; + screen.loadPalette("dark.pal"); + screen.fadeIn(0x81); + sound.playSong("newbrigh.m"); + + _background.load("title2.int"); } void DarkSideMainMenuContainer::loadBackground() { Screen &screen = *g_vm->_screen; - screen.loadPalette("mm4.pal"); - screen.loadBackground("intro.raw"); + _background.draw(0, 0, Common::Point(0, 0)); + _background.draw(0, 1, Common::Point(160, 0)); + + screen.loadPalette("dark.pal"); screen.saveBackground(); } void DarkSideMainMenuContainer::showMenuDialog() { - setOwner(new CloudsMenuDialog(this)); + setOwner(new DarkSideMenuDialog(this)); } /*------------------------------------------------------------------------*/ -WorldOfXeenMainMenuContainer::WorldOfXeenMainMenuContainer() : MainMenuContainer("intro.vga") { - g_vm->_sound->playSong("inn.m"); +WorldOfXeenMainMenuContainer::WorldOfXeenMainMenuContainer() : MainMenuContainer("world.int", 5) { + Sound &sound = *g_vm->_sound; + sound.playSong("newbrigh.m"); } void WorldOfXeenMainMenuContainer::loadBackground() { Screen &screen = *g_vm->_screen; - screen.loadPalette("mm4.pal"); - screen.loadBackground("intro.raw"); + screen.loadPalette("dark.pal"); + screen.loadBackground("world.raw"); screen.saveBackground(); } @@ -206,6 +216,10 @@ bool MainMenuDialog::handleEvents() { CreditsScreen::show(g_vm); break; + case Common::KEYCODE_ESCAPE: + // Exit dialog (returning to just the animated background) + break; + default: return false; } @@ -276,6 +290,139 @@ bool CloudsMenuDialog::handleEvents() { /*------------------------------------------------------------------------*/ +DarkSideMenuDialog::DarkSideMenuDialog(MainMenuContainer *owner) : MainMenuDialog(owner), _firstDraw(true) { + Windows &windows = *g_vm->_windows; + Window &w = windows[GAME_WINDOW]; + w.setBounds(Common::Rect(72, 25, 248, 150)); + w.open(); + + loadButtons(); +} + +DarkSideMenuDialog::~DarkSideMenuDialog() { + Windows &windows = *g_vm->_windows; + Window &w = windows[GAME_WINDOW]; + w.close(); +} + +void DarkSideMenuDialog::loadButtons() { + addButton(Common::Rect(124, 87, 177, 97), Common::KEYCODE_s); + addButton(Common::Rect(126, 98, 173, 108), Common::KEYCODE_l); + addButton(Common::Rect(91, 110, 209, 120), Common::KEYCODE_c); + addButton(Common::Rect(85, 121, 216, 131), Common::KEYCODE_o); +} + +void DarkSideMenuDialog::draw() { + Screen &screen = *g_vm->_screen; + EventsManager &events = *g_vm->_events; + Sound &sound = *g_vm->_sound; + Windows &windows = *g_vm->_windows; + + if (!_firstDraw) + return; + + SpriteResource kludgeSprites("kludge.int"); + SpriteResource title2Sprites[8] = { + SpriteResource("title2b.int"), SpriteResource("title2c.int"), + SpriteResource("title2d.int"), SpriteResource("title2e.int"), + SpriteResource("title2f.int"), SpriteResource("title2g.int"), + SpriteResource("title2h.int"), SpriteResource("title2i.int"), + }; + + screen.loadBackground("title2b.raw"); + kludgeSprites.draw(0, 0, Common::Point(85, 86)); + screen.saveBackground(); + sound.playSound("elect.voc"); + + for (int i = 0; i < 30 && !g_vm->shouldExit(); ++i) { + events.updateGameCounter(); + screen.restoreBackground(); + title2Sprites[i / 4].draw(0, i % 4); + windows[0].update(); + + if (i == 19) + sound.stopSound(); + + if (events.wait(2)) + break; + } + + events.clearEvents(); + sound.stopSound(); + + screen.restoreBackground(); + windows[0].update(); + _firstDraw = false; +} + +bool DarkSideMenuDialog::handleEvents() { + if (MainMenuDialog::handleEvents()) + return true; + + switch (_buttonValue) { + case Common::KEYCODE_o: + // Show other options dialog + // TODO + break; + + default: + break; + } + + return false; +} + +/*------------------------------------------------------------------------*/ + +WorldMenuDialog::WorldMenuDialog(MainMenuContainer *owner) : MainMenuDialog(owner) { + Windows &windows = *g_vm->_windows; + Window &w = windows[GAME_WINDOW]; + w.setBounds(Common::Rect(72, 25, 248, 175)); + w.open(); + + loadButtons(); +} + +WorldMenuDialog::~WorldMenuDialog() { + Windows &windows = *g_vm->_windows; + Window &w = windows[GAME_WINDOW]; + w.close(); +} + +void WorldMenuDialog::loadButtons() { + _buttonSprites.load("start.icn"); + addButton(Common::Rect(93, 53, 227, 73), Common::KEYCODE_s, &_buttonSprites); + addButton(Common::Rect(93, 78, 227, 98), Common::KEYCODE_l, &_buttonSprites); + addButton(Common::Rect(93, 103, 227, 123), Common::KEYCODE_c, &_buttonSprites); + addButton(Common::Rect(93, 128, 227, 148), Common::KEYCODE_o, &_buttonSprites); +} + +void WorldMenuDialog::draw() { + Windows &windows = *g_vm->_windows; + Window &w = windows[GAME_WINDOW]; + + w.frame(); + w.writeString(Common::String::format(Res.CLOUDS_MAIN_MENU, g_vm->_gameWon[0] ? 117 : 92)); + drawButtons(&w); +} + +bool WorldMenuDialog::handleEvents() { + if (MainMenuDialog::handleEvents()) + return true; + + switch (_buttonValue) { + case Common::KEYCODE_o: + // Show other options dialog + // TODO + break; + + default: + break; + } + + return false; +} + } // End of namespace WorldOfXeen } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.h b/engines/xeen/worldofxeen/worldofxeen_menu.h index 92d770be80..1db78b9b0d 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.h +++ b/engines/xeen/worldofxeen/worldofxeen_menu.h @@ -33,7 +33,8 @@ class MainMenuDialog; class MainMenuContainer { private: - int _animateCtr; + uint _animateCtr; + uint _frameCount; SpriteResource _backgroundSprites; MainMenuDialog *_dialog; protected: @@ -60,7 +61,7 @@ public: /** * Constructor */ - MainMenuContainer(const Common::String &spritesName); + MainMenuContainer(const Common::String &spritesName, uint frameCount); /** * Destructor @@ -96,6 +97,8 @@ public: }; class DarkSideMainMenuContainer : public MainMenuContainer { +private: + SpriteResource _background; protected: /** * Load the background @@ -206,6 +209,67 @@ public: virtual bool handleEvents(); }; +class DarkSideMenuDialog : public MainMenuDialog { +private: + SpriteResource _buttonSprites; + bool _firstDraw; +private: + /** + * Loads buttons for the dialog + */ + void loadButtons(); +public: + /** + * Constructor + */ + DarkSideMenuDialog(MainMenuContainer *owner); + + /** + * Destructor + */ + virtual ~DarkSideMenuDialog(); + + /** + * Draws the dialog + */ + virtual void draw(); + + /** + * Handles events + */ + virtual bool handleEvents(); +}; + +class WorldMenuDialog : public MainMenuDialog { +private: + SpriteResource _buttonSprites; +private: + /** + * Loads buttons for the dialog + */ + void loadButtons(); +public: + /** + * Constructor + */ + WorldMenuDialog(MainMenuContainer *owner); + + /** + * Destructor + */ + virtual ~WorldMenuDialog(); + + /** + * Draws the dialog + */ + virtual void draw(); + + /** + * Handles events + */ + virtual bool handleEvents(); +}; + } // End of namespace WorldOfXeen } // End of namespace Xeen |