diff options
-rw-r--r-- | engines/xeen/detection.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/detection_tables.h | 2 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 10 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.cpp | 64 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.h | 20 | ||||
-rw-r--r-- | engines/xeen/xeen.h | 1 |
6 files changed, 89 insertions, 12 deletions
diff --git a/engines/xeen/detection.cpp b/engines/xeen/detection.cpp index 91eab285b3..1b9c260e35 100644 --- a/engines/xeen/detection.cpp +++ b/engines/xeen/detection.cpp @@ -61,6 +61,10 @@ Common::Platform XeenEngine::getPlatform() const { return _gameDescription->desc.platform; } +bool XeenEngine::getIsCD() const { + return getFeatures() & ADGF_CD; +} + } // End of namespace Xeen static const PlainGameDescriptor XeenGames[] = { diff --git a/engines/xeen/detection_tables.h b/engines/xeen/detection_tables.h index 01ba00df5c..17a0b9d94d 100644 --- a/engines/xeen/detection_tables.h +++ b/engines/xeen/detection_tables.h @@ -73,7 +73,7 @@ static const XeenGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformDOS, - ADGF_UNSTABLE | ADGF_CD, + ADGF_TESTING | ADGF_CD, GUIO2(GAMEOPTION_SHOW_ITEM_COSTS, GAMEOPTION_DURABLE_ARMOR) }, GType_WorldOfXeen, diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 3422756a67..581b3e1b70 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -21,6 +21,7 @@ */ #include "common/config-manager.h" +#include "backends/audiocd/audiocd.h" #include "xeen/scripts.h" #include "xeen/dialogs/dialogs_copy_protection.h" #include "xeen/dialogs/dialogs_input.h" @@ -1466,7 +1467,14 @@ bool Scripts::cmdFlipWorld(ParamsIterator ¶ms) { return true; } -bool Scripts::cmdPlayCD(ParamsIterator ¶ms) { error("TODO"); } +bool Scripts::cmdPlayCD(ParamsIterator ¶ms) { + int trackNum = params.readByte(); + int start = params.readUint16LE(); + int finish = params.readUint16LE(); + + g_system->getAudioCDManager()->play(trackNum, 1, start, finish); + return true; +} void Scripts::doCloudsEnding() { g_vm->_party->_cloudsCompleted = true; 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; diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index a092538d09..98b09e7f23 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -211,6 +211,7 @@ public: uint16 getVersion() const; uint32 getGameID() const; uint32 getGameFeatures() const; + bool getIsCD() const; int getRandomNumber(int maxNumber); |