diff options
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/locations.cpp | 16 | ||||
-rw-r--r-- | engines/xeen/sound.cpp | 14 | ||||
-rw-r--r-- | engines/xeen/sound.h | 9 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/clouds_cutscenes.cpp | 31 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/darkside_cutscenes.cpp | 54 |
5 files changed, 73 insertions, 51 deletions
diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp index 9a2060b78d..be97b636fd 100644 --- a/engines/xeen/locations.cpp +++ b/engines/xeen/locations.cpp @@ -1325,7 +1325,7 @@ int ReaperCutscene::show() { } _subtitles.setLine(_mazeFlag ? 5 : 6); - sound.playSound(_mazeFlag ? "reaper12.voc" : "reaper14.voc"); + sound.playVoice(_mazeFlag ? "reaper12.voc" : "reaper14.voc"); do { events.updateGameCounter(); @@ -1349,11 +1349,11 @@ int ReaperCutscene::show() { windows[0].update(); WAIT(7); - sound.playSound(_mazeFlag ? "reaper12.voc" : "reaper14.voc"); + sound.playVoice(_mazeFlag ? "reaper12.voc" : "reaper14.voc"); if (_mazeFlag) - sound.playSound(_isDarkCc ? "goin1.voc" : "reaper13.voc"); + sound.playVoice(_isDarkCc ? "goin1.voc" : "reaper13.voc"); else - sound.playSound(_isDarkCc ? "needkey1.voc" : "reaper15.voc"); + sound.playVoice(_isDarkCc ? "needkey1.voc" : "reaper15.voc"); do { events.updateGameCounter(); @@ -1600,7 +1600,7 @@ int GolemCutscene::show() { sound.setMusicPercent(38); _subtitles.setLine(_mazeFlag ? 8 : 7); - sound.playSound(_mazeFlag ? "golem15.voc" : "golem13.voc"); + sound.playVoice(_mazeFlag ? "golem15.voc" : "golem13.voc"); do { events.updateGameCounter(); @@ -1633,13 +1633,13 @@ int GolemCutscene::show() { events.wait(_isDarkCc ? 10 : 1); if (!_isDarkCc) { - sound.playSound("ogre.voc"); + sound.playVoice("ogre.voc"); while (sound.isSoundPlaying()) events.pollEventsAndWait(); - sound.playSound(_mazeFlag ? "golem16.voc" : "golem14.voc"); + sound.playVoice(_mazeFlag ? "golem16.voc" : "golem14.voc"); } else { - sound.playSound(_mazeFlag ? "go2.voc" : "key2.voc"); + sound.playVoice(_mazeFlag ? "go2.voc" : "key2.voc"); } do { diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index eb7c0616d4..be15028f42 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -69,6 +69,20 @@ void Sound::playSound(const Common::String &name, int ccNum, int unused) { playSound(f); } +void Sound::playVoice(const Common::String &name, int ccMode) { + File f; + bool result = (ccMode == -1) ? f.open(name) : f.open(name, ccMode); + if (!result) + error("Could not open sound - %s", name.c_str()); + + stopSound(); + + Common::SeekableReadStream *srcStream = f.readStream(f.size()); + Audio::SeekableAudioStream *stream = Audio::makeVOCStream(srcStream, + Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); + _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, stream); +} + void Sound::stopSound() { _mixer->stopHandle(_soundHandle); } diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index 274aedb8b0..86303f682f 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -128,6 +128,11 @@ public: void updateSoundSettings(); /** + * Stops all playing music, FX, and sound samples + */ + void stopAllAudio(); + + /** * Play a given sound */ void playSound(Common::SeekableReadStream &s, int unused = 0); @@ -155,9 +160,9 @@ public: bool isSoundPlaying() const; /** - * Stops all playing music, FX, and sound samples + * Play a given voice file */ - void stopAllAudio(); + void playVoice(const Common::String &name, int ccMode = -1); }; } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp index ead66fa501..0e8149e37e 100644 --- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp +++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp @@ -40,7 +40,7 @@ bool CloudsCutscenes::showCloudsIntro() { Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; - files._isDarkCc = false; + bool darkCc = files._isDarkCc; files.setGameCc(0); bool seenIntro = showCloudsTitle() && showCloudsIntroInner(); @@ -48,6 +48,7 @@ bool CloudsCutscenes::showCloudsIntro() { events.clearEvents(); sound.stopAllAudio(); screen.freePages(); + files.setGameCc(darkCc ? 1 : 0); return seenIntro; } @@ -118,7 +119,6 @@ bool CloudsCutscenes::showCloudsIntroInner() { lake("lake.vga"), xeen("xeen.vga"), wizTower("wiztower.vga"), wizTower2("wiztwer2.vga"), lake2("lake2.vga"), lake3("lake3.vga"), xeen1("xeen1.vga"); - _vm->_files->_isDarkCc = false; // Show the production splash screen sound.playSong("mm4theme.m"); @@ -275,7 +275,7 @@ bool CloudsCutscenes::showCloudsIntroInner() { } // Play the next sample - sound.playSound(_INTRO_VOCS[lineCtr]); + sound.playVoice(_INTRO_VOCS[lineCtr]); } for (int frameCtr = 0, lookup = 0; sound.isSoundPlaying() || @@ -362,9 +362,9 @@ bool CloudsCutscenes::showCloudsIntroInner() { lineCtr = 20; if (lineCtr == 5) - sound.playSound(_INTRO_VOCS[6]); + sound.playVoice(_INTRO_VOCS[6]); else if (lineCtr == 6) - sound.playSound(_INTRO_VOCS[7]); + sound.playVoice(_INTRO_VOCS[7]); } // Roll up the scroll again @@ -379,7 +379,9 @@ void CloudsCutscenes::showCloudsEnding(uint finalScore) { FileManager &files = *g_vm->_files; Sound &sound = *g_vm->_sound; + bool darkCc = files._isDarkCc; files.setGameCc(0); + _mirror.load("mirror.end"); _mirrBack.load("mirrback.end"); _mergeX = 0; @@ -393,6 +395,7 @@ void CloudsCutscenes::showCloudsEnding(uint finalScore) { events.clearEvents(); sound.stopAllAudio(); + files.setGameCc(darkCc ? 1 : 0); if (!g_vm->shouldExit()) doScroll(true, false); @@ -482,7 +485,7 @@ bool CloudsCutscenes::showCloudsEnding1() { sound.playFX(34); } else if (!flag && idx1 == 1 && idx2 == 6) { flag = true; - sound.playSound("xeenlaff.voc"); + sound.playVoice("xeenlaff.voc"); } switch (cloudsCtr) { @@ -548,19 +551,19 @@ bool CloudsCutscenes::showCloudsEnding1() { switch (idx) { case 0: // You have defeated my general, Lord Xeen - sound.playSound("dark1.voc"); + sound.playVoice("dark1.voc"); break; case 1: // And foiled my plans to conquer this world - sound.playSound("dark2.voc"); + sound.playVoice("dark2.voc"); break; case 2: // But the Dark Side will always be mine - sound.playSound("dark3.voc"); + sound.playVoice("dark3.voc"); break; default: // Laugh - sound.playSound("darklaff.voc"); + sound.playVoice("darklaff.voc"); sound.setMusicPercent(75); break; } @@ -593,7 +596,7 @@ bool CloudsCutscenes::showCloudsEnding1() { if (!sound._subtitles) { // Laugh - sound.playSound("darklaff.voc"); + sound.playVoice("darklaff.voc"); sound.setMusicPercent(75); } @@ -699,7 +702,7 @@ bool CloudsCutscenes::showCloudsEnding2() { const char *const VOC_NAMES[3] = { "king1.voc", "king2.voc", "king3.voc" }; _subtitles.setLine(12); for (int idx = 0; idx < 3; ++idx) { - sound.playSound(VOC_NAMES[idx]); + sound.playVoice(VOC_NAMES[idx]); do { king.draw(0, 0, Common::Point(0, 0)); @@ -815,7 +818,7 @@ bool CloudsCutscenes::showCloudsEnding3() { for (int frameCtr = 0; frameCtr < 3; ++frameCtr) { if (frameCtr == 2) - sound.playSound(Common::String::format("%s.voc", mon._attackVoc.c_str())); + sound.playVoice(Common::String::format("%s.voc", mon._attackVoc.c_str())); ROTATE_BG; counter1 = (counter1 + 1) % 8; @@ -983,7 +986,7 @@ bool CloudsCutscenes::showCloudsEnding5() { screen.fadeIn(); _subtitles.setLine(13); - sound.playSound("king4.voc"); + sound.playVoice("king4.voc"); do { king.draw(0, 0, Common::Point(0, 0)); king.draw(0, 1, Common::Point(160, 0)); diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index be8b5cf62c..0e931ce9d7 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -310,7 +310,7 @@ bool DarkSideCutscenes::showDarkSideIntro1() { // Inconceivable, the royal pyramid besieged screen.saveBackground(); - sound.playSound("pharoh1a.voc"); + sound.playVoice("pharoh1a.voc"); _subtitles.setLine(0); @@ -321,7 +321,7 @@ bool DarkSideCutscenes::showDarkSideIntro1() { _subtitles.show(); if (!sound.isSoundPlaying() && !phar2) - sound.playSound("pharoh1b.voc"); + sound.playVoice("pharoh1b.voc"); WAIT_SUBTITLES(4); } @@ -366,9 +366,9 @@ bool DarkSideCutscenes::showDarkSideIntro1() { _subtitles.show(); if (idx == SCREEN_WIDTH) - sound.playSound(PHAR_VOC[0]); + sound.playVoice(PHAR_VOC[0]); if (!sound.isSoundPlaying() && phar2Index < 4) - sound.playSound(PHAR_VOC[1 + phar2Index++]); + sound.playVoice(PHAR_VOC[1 + phar2Index++]); if (phar2Index == 4) { if (!sound.isSoundPlaying() && !_subtitles.active()) @@ -424,7 +424,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { fizzle.draw(0, idx, Common::Point(9, 57)); if (idx == 6) { - sound.playSound("pharoh3.voc"); + sound.playVoice("pharoh3.voc"); sound.playFX(0); } @@ -443,7 +443,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!vocIndex) _subtitles.setLine(10); - sound.playSound(VOC_NAMES[vocIndex++]); + sound.playVoice(VOC_NAMES[vocIndex++]); if (vocIndex == 3) nwcIndex = 7; } @@ -463,7 +463,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { WAIT(3); } while (vocIndex < 3 || sound.isSoundPlaying() || _subtitles.active()); - sound.playSound(VOC_NAMES[3]); + sound.playVoice(VOC_NAMES[3]); _subtitles.setLine(11); idx = 34; @@ -479,7 +479,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { } while (sound.isSoundPlaying() || _subtitles.active()); _subtitles.setLine(12); - sound.playSound("dark3.voc"); + sound.playVoice("dark3.voc"); const char *const VOC_NAMES2[2] = { "pharoh5a.voc", "pharoh5b.voc" }; vocIndex = 0; @@ -493,7 +493,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!sound.isSoundPlaying() && vocIndex < 2) { if (vocIndex) _subtitles.setLine(13); - sound.playSound(VOC_NAMES2[vocIndex++]); + sound.playVoice(VOC_NAMES2[vocIndex++]); } } while (vocIndex < 2 || sound.isSoundPlaying() || _subtitles.active()); @@ -504,7 +504,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { ANIMATE_PHAROAH; if (!sound.isSoundPlaying() && !vocIndex) { - sound.playSound("laff1.voc"); + sound.playVoice("laff1.voc"); vocIndex = 1; } @@ -536,7 +536,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { fizzle.draw(0, idx, Common::Point(9, 57)); if (idx == 6) - sound.playSound("pharoh6w.voc"); + sound.playVoice("pharoh6w.voc"); if (idx > 6) _subtitles.show(); WAIT(3); @@ -552,7 +552,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!sound.isSoundPlaying() && !vocIndex && !_subtitles.active()) { _subtitles.setLine(15); - sound.playSound(VOC_NAMES3[vocIndex++]); + sound.playVoice(VOC_NAMES3[vocIndex++]); sound.playFX(0); } @@ -571,7 +571,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { fizzle.draw(0, idx, Common::Point(9, 57)); if (!sound.isSoundPlaying() && !vocIndex) { - sound.playSound("pharoh7t.voc"); + sound.playVoice("pharoh7t.voc"); vocIndex = 1; } @@ -594,7 +594,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { fizzle.draw(0, idx, Common::Point(9, 57)); if (idx == 5) - sound.playSound("pharoh8.voc"); + sound.playVoice("pharoh8.voc"); if (idx > 6) _subtitles.show(); @@ -610,7 +610,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!sound.isSoundPlaying() && vocIndex < 2 && !_subtitles.active()) { _subtitles.setLine((vocIndex == 0) ? 18 : 19); - sound.playSound(VOC_NAMES4[vocIndex++]); + sound.playVoice(VOC_NAMES4[vocIndex++]); sound.playFX(0); } @@ -627,7 +627,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { fizzle.draw(0, idx, Common::Point(9, 57)); if (!sound.isSoundPlaying() && !vocIndex) { - sound.playSound("pharoh7t.voc"); + sound.playVoice("pharoh7t.voc"); vocIndex = 1; } @@ -642,7 +642,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { ANIMATE_PHAROAH; if (!sound.isSoundPlaying() && !vocIndex) { - sound.playSound("pharoh9b.voc"); + sound.playVoice("pharoh9b.voc"); vocIndex = 1; } @@ -675,7 +675,7 @@ bool DarkSideCutscenes::showDarkSideIntro3() { _subtitles.show(); screen.fadeIn(); - sound.playSound("pharoh11.voc", 2, 0); + sound.playVoice("pharoh11.voc", 2); for (int idx = 0; idx < 35; ++idx) { screen.restoreBackground(); @@ -895,7 +895,7 @@ bool DarkSideCutscenes::showDarkSideEnding1() { faceEnd.clear(); // Alamar says "Come to me" - sound.playSound("come2.voc"); + sound.playVoice("come2.voc"); _subtitles.setLine(21); WAIT(27); @@ -1079,7 +1079,7 @@ bool DarkSideCutscenes::showDarkSideEnding2() { Sound &sound = *g_vm->_sound; // Corak?! - sound.playSound("corak2.voc"); + sound.playVoice("corak2.voc"); // Yep, that's my name, don't wear it out SpriteResource sc08("sc08.end"); @@ -1089,7 +1089,7 @@ bool DarkSideCutscenes::showDarkSideEnding2() { if (idx == 2) { if (!_subtitles.waitForLineOrSound()) return false; - sound.playSound("yes1.voc"); + sound.playVoice("yes1.voc"); _subtitles.setLine(23); } @@ -1114,7 +1114,7 @@ bool DarkSideCutscenes::showDarkSideEnding2() { for (int idx = 0; idx < 15; ++idx) { if (idx == 2) - sound.playSound("nowre1.voc"); + sound.playVoice("nowre1.voc"); screen.restoreBackground(); sc09.draw(0, getSpeakingFrame(0, 8)); @@ -1132,7 +1132,7 @@ bool DarkSideCutscenes::showDarkSideEnding2() { for (int idx = 0; idx < 15; ++idx) { if (idx == 3) - sound.playSound("nordo2.voc"); + sound.playVoice("nordo2.voc"); screen.restoreBackground(); sc10.draw(0, getSpeakingFrame(0, 1)); @@ -1198,7 +1198,7 @@ bool DarkSideCutscenes::showDarkSideEnding2() { for (int idx = 0; idx < 16; ++idx) { if (idx == 1) - sound.playSound("ready2.voc"); + sound.playVoice("ready2.voc"); sc13.draw(0, getSpeakingFrame(0, 3)); _subtitles.show(); @@ -1546,7 +1546,7 @@ bool DarkSideCutscenes::showDarkSideEnding4() { for (int struggleNum = 0; struggleNum < 2; ++struggleNum) { for (int idx = 0; idx < 9; ++idx) { if (struggleNum == 0 && idx == 2) - sound.playSound("admit2.voc"); + sound.playVoice("admit2.voc"); sc25.draw(0, idx, Common::Point(27, 30)); _subtitles.show(); @@ -1566,7 +1566,7 @@ bool DarkSideCutscenes::showDarkSideEnding4() { screen.loadBackground("sc260001.raw"); screen.saveBackground(); _subtitles.show(); - sound.playSound("ido2.voc"); + sound.playVoice("ido2.voc"); for (int idx = 0; sound.isSoundPlaying() || _subtitles.active(); ) { screen.restoreBackground(); @@ -1595,7 +1595,7 @@ bool DarkSideCutscenes::showDarkSideEnding4() { for (int idx = 0; idx < 12; ++idx) { if (idx == 1) - sound.playSound("what3.voc"); + sound.playVoice("what3.voc"); screen.restoreBackground(); sc27.draw(0, idx, Common::Point(65, 22)); |