aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-04 16:52:35 -0400
committerPaul Gilbert2016-09-04 21:29:45 -0400
commit12d57ad5fe48568a8d67665ed285c9d591590d1a (patch)
tree0ce88e7b82fb37519673988278077a2c310e69fa
parent0c948b6bd0fc87cb57ee8939228435921a504803 (diff)
downloadscummvm-rg350-12d57ad5fe48568a8d67665ed285c9d591590d1a.tar.gz
scummvm-rg350-12d57ad5fe48568a8d67665ed285c9d591590d1a.tar.bz2
scummvm-rg350-12d57ad5fe48568a8d67665ed285c9d591590d1a.zip
XEEN: Beginnings of Darkside endgame and music
-rw-r--r--engines/xeen/sound.cpp41
-rw-r--r--engines/xeen/sound.h37
-rw-r--r--engines/xeen/town.cpp2
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.cpp21
-rw-r--r--engines/xeen/xeen.cpp3
5 files changed, 87 insertions, 17 deletions
diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp
index 2aed7da45b..f5cc40249d 100644
--- a/engines/xeen/sound.cpp
+++ b/engines/xeen/sound.cpp
@@ -26,22 +26,43 @@
namespace Xeen {
-SoundManager *VOC::_sound;
+SoundManager *Voc::_sound;
-VOC::VOC(const Common::String &name) {
+Voc::Voc(const Common::String &name) {
if (!open(name))
error("Could not open - %s", name.c_str());
}
-void VOC::init(XeenEngine *vm) {
+void Voc::init(XeenEngine *vm) {
_sound = vm->_sound;
}
-void VOC::play() {
+void Voc::play() {
_sound->playSound(this, _soundHandle);
}
-void VOC::stop() {
+void Voc::stop() {
+ _sound->stopSound(_soundHandle);
+}
+
+/*------------------------------------------------------------------------*/
+
+SoundManager *Music::_sound;
+
+Music::Music(const Common::String &name) {
+ if (!open(name))
+ error("Could not open - %s", name.c_str());
+}
+
+void Music::init(XeenEngine *vm) {
+ _sound = vm->_sound;
+}
+
+void Music::play() {
+ _sound->playMusic(this, _soundHandle);
+}
+
+void Music::stop() {
_sound->stopSound(_soundHandle);
}
@@ -62,10 +83,14 @@ void SoundManager::stopMusic(int id) {
// TODO
}
-void SoundManager::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle) {
+void SoundManager::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle,
+ Audio::Mixer::SoundType soundType) {
Audio::SeekableAudioStream *stream = Audio::makeVOCStream(s, 0);
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &soundHandle, stream);
-
+ _mixer->playStream(soundType, &soundHandle, stream);
+}
+
+void SoundManager::playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle) {
+ // TODO
}
void SoundManager::stopSound(Audio::SoundHandle &soundHandle) {
diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h
index 96b02c4efe..954d324e8d 100644
--- a/engines/xeen/sound.h
+++ b/engines/xeen/sound.h
@@ -33,14 +33,14 @@ namespace Xeen {
class SoundManager;
-class VOC: public Common::File {
+class Voc: public Common::File {
private:
static SoundManager *_sound;
Audio::SoundHandle _soundHandle;
public:
- VOC() {}
- VOC(const Common::String &name);
- virtual ~VOC() { stop(); }
+ Voc() {}
+ Voc(const Common::String &name);
+ virtual ~Voc() { stop(); }
static void init(XeenEngine *vm);
/**
@@ -54,6 +54,27 @@ public:
void stop();
};
+class Music : public Common::File {
+private:
+ static SoundManager *_sound;
+ Audio::SoundHandle _soundHandle;
+public:
+ Music() {}
+ Music(const Common::String &name);
+ virtual ~Music() { stop(); }
+ static void init(XeenEngine *vm);
+
+ /**
+ * Start playing the sound
+ */
+ void play();
+
+ /**
+ * Stop playing the sound
+ */
+ void stop();
+};
+
class SoundManager {
private:
Audio::Mixer *_mixer;
@@ -73,7 +94,13 @@ public:
/**
* Play a given sound
*/
- void playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle);
+ void playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle,
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
+
+ /**
+ * Play a given music
+ */
+ void playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle);
/**
* Stop playing a sound
diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp
index 52fa988e15..cc83563de2 100644
--- a/engines/xeen/town.cpp
+++ b/engines/xeen/town.cpp
@@ -825,7 +825,7 @@ Character *Town::doTempleOptions(Character *c) {
intf.drawParty(true);
sound.playSample(nullptr, 0);
- VOC voc("ahh.voc");
+ Voc voc("ahh.voc");
voc.play();
_flag1 = true;
_donation = 0;
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
index 6226b52a11..a5de6559c4 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
@@ -39,7 +39,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
SpriteResource("nwc1.int"), SpriteResource("nwc2.int"),
SpriteResource("nwc3.int"), SpriteResource("nwc4.int")
};
- VOC voc[3];
+ Voc voc[3];
voc[0].open("dragon1.voc");
voc[1].open("dragon2.voc");
voc[2].open("dragon3.voc");
@@ -158,7 +158,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
SpriteResource sprites[3] = {
SpriteResource("title.int"), SpriteResource("pyratop.int"), SpriteResource("pyramid.int")
};
- Common::File voc[2];
+ Voc voc[2];
voc[0].open("pharoh1a.voc");
voc[1].open("pharoh1b.voc");
@@ -234,7 +234,24 @@ bool DarkSideCutscenes::showDarkSideIntro() {
}
bool DarkSideCutscenes::showDarkSideEnding() {
+ EventsManager &events = *_vm->_events;
+ Screen &screen = *_vm->_screen;
+ SoundManager &sound = *_vm->_sound;
+
+ Voc voc("ido2.voc");
+ Music newBright("newbrigh.m");
+ SpriteResource box("box.vga");
+
+ newBright.play();
+ screen.loadBackground("scene1.raw");
+ screen.loadPalette("endgame.pal");
+ screen.update();
+
+ screen.fadeIn(4);
+ events.updateGameCounter();
+
// TODO
+ events.wait(5000);
return true;
}
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index 066f238fed..e549c8e845 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -98,7 +98,8 @@ void XeenEngine::initialize() {
_sound = new SoundManager(this, _mixer);
_spells = new Spells(this);
_town = new Town(this);
- VOC::init(this);
+ Voc::init(this);
+ Music::init(this);
File f("029.obj");
_eventData = f.readStream(f.size());