diff options
author | Paul Gilbert | 2018-04-28 18:06:23 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-04-28 18:06:23 -0400 |
commit | c2cdb2808d720e09ee6641e9a50c2e0a34f5bef8 (patch) | |
tree | c817f60bd47a2448c7fa83d6921f73a22c42fb11 /engines/xeen/worldofxeen | |
parent | d25335405c82804e00e76612c84cefc40bfe176e (diff) | |
download | scummvm-rg350-c2cdb2808d720e09ee6641e9a50c2e0a34f5bef8.tar.gz scummvm-rg350-c2cdb2808d720e09ee6641e9a50c2e0a34f5bef8.tar.bz2 scummvm-rg350-c2cdb2808d720e09ee6641e9a50c2e0a34f5bef8.zip |
XEEN: Implement changes needed for World of Xeen 2 CD talkie
Diffstat (limited to 'engines/xeen/worldofxeen')
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.cpp | 64 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.h | 20 |
2 files changed, 74 insertions, 10 deletions
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp index a4a4b0277b..81cb7f14d9 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp @@ -41,7 +41,10 @@ void MainMenuContainer::show() { menu = new DarkSideMainMenuContainer(); break; case GType_WorldOfXeen: - menu = new WorldOfXeenMainMenuContainer(); + if (g_vm->getIsCD()) + menu = new WorldOfXeenCDMainMenuContainer(); + else + menu = new WorldOfXeenMainMenuContainer(); break; default: error("Invalid game"); @@ -51,10 +54,20 @@ void MainMenuContainer::show() { delete menu; } -MainMenuContainer::MainMenuContainer(const Common::String &spritesName, uint frameCount) : - _frameCount(frameCount), _animateCtr(0), _dialog(nullptr) { +MainMenuContainer::MainMenuContainer(const char *spritesName1, const char *spritesName2, const char *spritesName3) : + _animateCtr(0), _dialog(nullptr) { g_vm->_files->setGameCc(g_vm->getGameID() == GType_Clouds ? 0 : 1); - _backgroundSprites.load(spritesName); + + _backgroundSprites.resize(1 + (spritesName2 ? 1 : 0) + (spritesName3 ? 1 : 0)); + _backgroundSprites[0].load(spritesName1); + if (spritesName2) + _backgroundSprites[1].load(spritesName2); + if (spritesName3) + _backgroundSprites[0].load(spritesName3); + + _frameCount = 0; + for (uint idx = 0; idx < _backgroundSprites.size(); ++idx) + _frameCount += _backgroundSprites[idx].size(); } MainMenuContainer::~MainMenuContainer() { @@ -67,7 +80,17 @@ MainMenuContainer::~MainMenuContainer() { void MainMenuContainer::draw() { g_vm->_screen->restoreBackground(); _animateCtr = (_animateCtr + 1) % _frameCount; - _backgroundSprites.draw(0, _animateCtr); + + // Draw the next background frame + uint frameNum = _animateCtr; + for (uint idx = 0; idx < _backgroundSprites.size(); ++idx) { + if (frameNum < _backgroundSprites[idx].size()) { + _backgroundSprites[idx].draw(0, frameNum); + return; + } else { + frameNum -= _backgroundSprites[idx].size(); + } + } } void MainMenuContainer::execute() { @@ -123,7 +146,7 @@ void MainMenuContainer::execute() { /*------------------------------------------------------------------------*/ -CloudsMainMenuContainer::CloudsMainMenuContainer() : MainMenuContainer("intro.vga", 9) { +CloudsMainMenuContainer::CloudsMainMenuContainer() : MainMenuContainer("intro.vga") { } void CloudsMainMenuContainer::display() { @@ -148,7 +171,7 @@ void CloudsMainMenuContainer::showMenuDialog() { /*------------------------------------------------------------------------*/ -DarkSideMainMenuContainer::DarkSideMainMenuContainer() : MainMenuContainer("title2a.int", 10) { +DarkSideMainMenuContainer::DarkSideMainMenuContainer() : MainMenuContainer("title2a.int") { Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; screen.loadPalette("dark.pal"); @@ -184,7 +207,7 @@ void DarkSideMainMenuContainer::showMenuDialog() { /*------------------------------------------------------------------------*/ -WorldOfXeenMainMenuContainer::WorldOfXeenMainMenuContainer() : MainMenuContainer("world.int", 5) { +WorldOfXeenMainMenuContainer::WorldOfXeenMainMenuContainer() : MainMenuContainer("world.int") { } void WorldOfXeenMainMenuContainer::display() { @@ -209,6 +232,31 @@ void WorldOfXeenMainMenuContainer::showMenuDialog() { /*------------------------------------------------------------------------*/ +WorldOfXeenCDMainMenuContainer::WorldOfXeenCDMainMenuContainer() : MainMenuContainer("world0.int", "world1.int", "world2.int") { +} + +void WorldOfXeenCDMainMenuContainer::display() { + FileManager &files = *g_vm->_files; + Screen &screen = *g_vm->_screen; + Sound &sound = *g_vm->_sound; + + sound._musicSide = 1; + files.setGameCc(1); + + screen.loadPalette("dark.pal"); + screen.loadBackground("world.raw"); + screen.saveBackground(); + + if (!sound.isMusicPlaying()) + sound.playSong("newbrigh.m"); +} + +void WorldOfXeenCDMainMenuContainer::showMenuDialog() { + setOwner(new WorldMenuDialog(this)); +} + +/*------------------------------------------------------------------------*/ + bool MainMenuDialog::handleEvents() { checkEvents(g_vm); int difficulty; diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.h b/engines/xeen/worldofxeen/worldofxeen_menu.h index e753665f08..ba4a465047 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.h +++ b/engines/xeen/worldofxeen/worldofxeen_menu.h @@ -25,6 +25,7 @@ #include "xeen/xeen.h" #include "xeen/dialogs/dialogs.h" +#include "common/array.h" namespace Xeen { namespace WorldOfXeen { @@ -35,7 +36,7 @@ class MainMenuContainer { private: uint _animateCtr; uint _frameCount; - SpriteResource _backgroundSprites; + Common::Array<SpriteResource> _backgroundSprites; MenuContainerDialog *_dialog; protected: /** @@ -61,7 +62,7 @@ public: /** * Constructor */ - MainMenuContainer(const Common::String &spritesName, uint frameCount); + MainMenuContainer(const char *spritesName1, const char *spritesName2 = nullptr, const char *spritesName3 = nullptr); /** * Destructor @@ -128,6 +129,21 @@ public: WorldOfXeenMainMenuContainer(); }; +class WorldOfXeenCDMainMenuContainer : public MainMenuContainer { +protected: + /** + * Called when the menu screen is first shown + */ + virtual void display(); + + /** + * Shows the main menu dialog + */ + virtual void showMenuDialog(); +public: + WorldOfXeenCDMainMenuContainer(); +}; + class MenuContainerDialog : public ButtonContainer { protected: MainMenuContainer *_owner; |