From b6e39dbf79801b5d96ca9292a47825d39f1e3fb4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Nov 2015 20:11:23 -0500 Subject: XEEN: Some initial work on better sound manager --- engines/xeen/sound.cpp | 12 ++++++ engines/xeen/sound.h | 15 ++++++++ engines/xeen/worldofxeen/worldofxeen_game.cpp | 55 ++++++++++++++++----------- engines/xeen/worldofxeen/worldofxeen_game.h | 14 +------ engines/xeen/xeen.cpp | 4 -- engines/xeen/xeen.h | 4 +- 6 files changed, 64 insertions(+), 40 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index 7c7524af54..a71584c769 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -24,6 +24,18 @@ namespace Xeen { +VOC::~VOC() { + stop(); +} + +void VOC::play() { + warning("TODO: VOC::play"); +} + +void VOC::stop() { + warning("TODO: VOC::stop"); +} + SoundManager::SoundManager(XeenEngine *vm): _vm(vm) { } diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index 7e7df9caea..b44bff7f30 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -29,6 +29,21 @@ namespace Xeen { +class VOC: public Common::File { +public: + virtual ~VOC(); + + /** + * Play the given loaded sound + */ + void play(); + + /** + * Stop playing the sound + */ + void stop(); +}; + class SoundManager { private: XeenEngine *_vm; diff --git a/engines/xeen/worldofxeen/worldofxeen_game.cpp b/engines/xeen/worldofxeen/worldofxeen_game.cpp index 3b0efb2aac..836f039cf6 100644 --- a/engines/xeen/worldofxeen/worldofxeen_game.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_game.cpp @@ -21,6 +21,7 @@ */ #include "xeen/worldofxeen/worldofxeen_game.h" +#include "xeen/sound.h" namespace Xeen { @@ -28,24 +29,15 @@ WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *g : XeenEngine(syst, gameDesc) { } -void WorldOfXeenEngine::playGame () { - XeenEngine::playGame(); -} - -void WorldOfXeenEngine::showDarkSideTitle() { - showDarkSideTitle1(); - if (shouldQuit()) - return; +void WorldOfXeenEngine::showIntro() { + // **DEBUG** + if (gDebugLevel == 0) + return; - showDarkSideTitle2(); - if (shouldQuit()) - return; - - // TODO: Only show intro sequence if not seen before - showDarkSideIntroSequence(); + showDarkSideTitle(); } -void WorldOfXeenEngine::showDarkSideTitle1() { +void WorldOfXeenEngine::showDarkSideTitle() { // TODO: Starting method, and sound //sub_28F40 _screen->loadPalette("dark.pal"); @@ -53,11 +45,22 @@ void WorldOfXeenEngine::showDarkSideTitle1() { SpriteResource("nwc1.int"), SpriteResource("nwc2.int"), SpriteResource("nwc3.int"), SpriteResource("nwc4.int") }; - Common::File voc[3]; + VOC voc[3]; voc[0].open("dragon1.voc"); voc[1].open("dragon2.voc"); voc[2].open("dragon3.voc"); - +/* + Common::File f; + f.open("adsnd"); + Common::DumpFile df; + byte *b = new byte[f.size()]; + f.read(b, f.size()); + df.open("d:\\temp\\adsnd.bin"); + df.write(b, f.size()); + df.close(); + f.close(); + delete[] b; + */ // Load backgrounds _screen->loadBackground("nwc1.raw"); _screen->loadPage(0); @@ -97,6 +100,8 @@ void WorldOfXeenEngine::showDarkSideTitle1() { if (_events->wait(2, true)) return; } + if (shouldQuit()) + return; // Loop for dragon using flyspray for (int idx = 0; idx < 42 && !shouldQuit(); ++idx) { @@ -130,10 +135,16 @@ void WorldOfXeenEngine::showDarkSideTitle1() { } // Pause for a bit - _events->wait(10, true); -} + if (_events->wait(10, true)) + return; + if (shouldQuit()) + return; + + voc[0].stop(); + voc[1].stop(); + voc[2].stop(); + -void WorldOfXeenEngine::showDarkSideTitle2() { _screen->fadeOut(8); //TODO: Stuff @@ -145,7 +156,7 @@ void WorldOfXeenEngine::showDarkSideTitle2() { _events->wait(60, true); } -void WorldOfXeenEngine::showDarkSideIntroSequence() { +void WorldOfXeenEngine::showDarkSideIntro() { _screen->fadeOut(8); _screen->loadBackground("pyramid2.raw"); _screen->loadPage(0); @@ -191,7 +202,7 @@ void WorldOfXeenEngine::showDarkSideIntroSequence() { idx -= timeExpired; frame = MIN(frame + timeExpired, (uint)200); - + while (_events->timeElapsed() < 1) { _events->pollEventsAndWait(); if (_events->isKeyMousePressed()) diff --git a/engines/xeen/worldofxeen/worldofxeen_game.h b/engines/xeen/worldofxeen/worldofxeen_game.h index 9a3cee185d..f35f25be15 100644 --- a/engines/xeen/worldofxeen/worldofxeen_game.h +++ b/engines/xeen/worldofxeen/worldofxeen_game.h @@ -34,16 +34,6 @@ namespace Xeen { */ class WorldOfXeenEngine: public XeenEngine { private: - /** - * Shows the first part of the Dark Side of Xeen title sequence - */ - void showDarkSideTitle1(); - - /** - * Shows the second part of the Dark Side of Xeen title sequence - */ - void showDarkSideTitle2(); - /** * Shows the Dark Side of Xeen title sequence */ @@ -52,9 +42,9 @@ private: /** * Shows the Dark Side of Xeen introduction sequence */ - void showDarkSideIntroSequence(); + void showDarkSideIntro(); protected: - virtual void playGame(); + virtual void showIntro(); public: WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc); virtual ~WorldOfXeenEngine() {} diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index fb7edead00..90349858ee 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -266,10 +266,6 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade // out->writeUint32LE(_events->getFrameCounter()); } -void XeenEngine::showIntro() { - -} - void XeenEngine::showMainMenu() { //OptionsMenu::show(this); } diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index 4180a17650..cd1b98b1b8 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -104,8 +104,6 @@ private: Common::RandomSource _randomSource; int _loadSaveSlot; - void showIntro(); - void showMainMenu(); void play(); @@ -114,6 +112,8 @@ private: void gameLoop(); protected: + virtual void showIntro() = 0; + /** * Play the game */ -- cgit v1.2.3