From 026382c2cacd88e323253fa1822e99674a197966 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 Feb 2018 22:06:04 -0500 Subject: XEEN: Fixes and cleanup for Dark Side ending --- engines/xeen/files.cpp | 10 +++- engines/xeen/files.h | 2 +- engines/xeen/worldofxeen/clouds_cutscenes.cpp | 6 +- engines/xeen/worldofxeen/darkside_cutscenes.cpp | 68 +++++++++++++++++----- engines/xeen/worldofxeen/darkside_cutscenes.h | 32 ++++++++-- engines/xeen/worldofxeen/worldofxeen.cpp | 4 +- engines/xeen/worldofxeen/worldofxeen_resources.cpp | 6 +- 7 files changed, 96 insertions(+), 32 deletions(-) diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp index 89cc2c0584..3d536a4194 100644 --- a/engines/xeen/files.cpp +++ b/engines/xeen/files.cpp @@ -232,8 +232,8 @@ FileManager::FileManager(XeenEngine *vm) { } if (Common::File::exists("intro.cc")) { - CCArchive *introCc = new CCArchive("intro.cc", "intro", true); - SearchMan.add("intro", introCc); + File::_introCc = new CCArchive("intro.cc", "intro", true); + SearchMan.add("intro", File::_introCc); } File::_currentArchive = vm->getGameID() == GType_DarkSide || vm->getGameID() == GType_Swords ? @@ -267,6 +267,7 @@ void FileManager::save(Common::WriteStream &s) { CCArchive *File::_xeenCc; CCArchive *File::_darkCc; +CCArchive *File::_introCc; SaveArchive *File::_xeenSave; SaveArchive *File::_darkSave; BaseCCArchive *File::_currentArchive; @@ -325,6 +326,11 @@ void File::setCurrentArchive(int ccMode) { _currentSave = _darkSave; break; + case 2: + _currentArchive = _introCc; + _currentSave = nullptr; + break; + default: break; } diff --git a/engines/xeen/files.h b/engines/xeen/files.h index 086bb00f27..3a4c4b1054 100644 --- a/engines/xeen/files.h +++ b/engines/xeen/files.h @@ -114,7 +114,7 @@ class File : public Common::File { friend class OutFile; friend class SavesManager; private: - static CCArchive *_xeenCc, *_darkCc; + static CCArchive *_xeenCc, *_darkCc, *_introCc; static SaveArchive *_xeenSave, *_darkSave; static BaseCCArchive *_currentArchive; static SaveArchive *_currentSave; diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp index 047109e748..3dc40c2a5d 100644 --- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp +++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp @@ -346,12 +346,14 @@ void CloudsCutscenes::showCloudsEnding(uint finalScore) { _mirror.load("mirror.end"); _mirrBack.load("mirrback.end"); _mergeX = 0; + doScroll(true, false); if (showCloudsEnding1()) if (showCloudsEnding2()) if (showCloudsEnding3()) if (showCloudsEnding4(finalScore)) - showCloudsEnding5(); + if (showCloudsEnding5()) + doScroll(true, false); } bool CloudsCutscenes::showCloudsEnding1() { @@ -949,8 +951,6 @@ bool CloudsCutscenes::showCloudsEnding5() { king.draw(0, 0, Common::Point(0, 0)); king.draw(0, 1, Common::Point(160, 0)); WAIT(1); - doScroll(true, false); - return true; } diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index 0e97d8cd93..e68bffc33e 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -327,11 +327,25 @@ bool DarkSideCutscenes::showDarkSideIntro() { return true; } -bool DarkSideCutscenes::showDarkSideEnding() { +void DarkSideCutscenes::showDarkSideEnding(uint endingScore) { + _vm->_files->setGameCc(1); + _vm->_files->_isDarkCc = true; + _vm->_sound->_musicSide = 1; + _vm->_screen->fadeOut(); + + if (showDarkSideEnding1()) + if (showDarkSideEnding2()) + if (showDarkSideEnding3()) + showDarkSideEnding4(); + + showDarkSideScore(endingScore); + _vm->_screen->fadeOut(); +} + +bool DarkSideCutscenes::showDarkSideEnding1() { EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; - _vm->_files->_isDarkCc = true; sound.playSong("dngon3.m"); screen.loadBackground("scene1.raw"); @@ -450,7 +464,7 @@ bool DarkSideCutscenes::showDarkSideEnding() { // Play landing thud sound.playSound("thud.voc"); while (!_vm->shouldExit() && !events.isKeyMousePressed() - && sound.isPlaying()) { + && sound.isPlaying()) { events.pollEventsAndWait(); } @@ -502,7 +516,7 @@ bool DarkSideCutscenes::showDarkSideEnding() { // Zoomed out throneroom view of beam coming out of box for (int idx = 0; idx < 20; ++idx) { if (idx == 6 || idx == 8 || idx == 9 || idx == 10 - || idx == 13 || idx == 15 || idx == 16) + || idx == 13 || idx == 15 || idx == 16) sound.playFX(3); screen.restoreBackground(); @@ -549,8 +563,13 @@ bool DarkSideCutscenes::showDarkSideEnding() { sound.playSound("windstor.voc"); } - for (int idx = 0; idx < 8; ++idx) - sc07[idx].clear(); + return true; +} + +bool DarkSideCutscenes::showDarkSideEnding2() { + EventsManager &events = *_vm->_events; + Screen &screen = *_vm->_screen; + Sound &sound = *_vm->_sound; // Corak?! sound.playSound("corak2.voc"); @@ -726,7 +745,14 @@ bool DarkSideCutscenes::showDarkSideEnding() { events.pollEventsAndWait(); showSubtitles(); } - sc14.clear(); + + return true; +} + +bool DarkSideCutscenes::showDarkSideEnding3() { + EventsManager &events = *_vm->_events; + Screen &screen = *_vm->_screen; + Sound &sound = *_vm->_sound; // Fighting start SpriteResource sc15("sc15.end"); @@ -971,8 +997,14 @@ bool DarkSideCutscenes::showDarkSideEnding() { screen.update(); screen.fadeOut(); - sc23[0].clear(); - sc23[1].clear(); + return true; +} + +bool DarkSideCutscenes::showDarkSideEnding4() { + EventsManager &events = *_vm->_events; + FileManager &files = *_vm->_files; + Screen &screen = *_vm->_screen; + Sound &sound = *_vm->_sound; // Corak does a ricochet shot on Sheltem SpriteResource sc24[2] = { @@ -1079,6 +1111,7 @@ bool DarkSideCutscenes::showDarkSideEnding() { sc27.clear(); // Vortex is opened and the two are sucked in, obliterating them + files.setGameCc(2); SpriteResource sc28[11] = { SpriteResource("sca28.end"), SpriteResource("scb28.end"), SpriteResource("scc28.end"), SpriteResource("scd28.end"), @@ -1096,6 +1129,7 @@ bool DarkSideCutscenes::showDarkSideEnding() { sc28[0].draw(0, 0, Common::Point(74, 0)); screen.update(); screen.fadeIn(); + files.setGameCc(1); for (int idx = 0; idx < 44; ++idx) { screen.restoreBackground(); @@ -1151,16 +1185,20 @@ bool DarkSideCutscenes::showDarkSideEnding() { screen.fadeOut(); sound.stopSong(); - for (int idx = 0; idx < 6; ++idx) - sc29[idx].clear(); - freeSubtitles(); - return true; } -void DarkSideCutscenes::showDarkSideScore() { - Common::String str = Common::String::format(Res.DARKSIDE_ENDING1, _vm->_endingScore); +void DarkSideCutscenes::showDarkSideScore(uint endingScore) { + SavesManager &saves = *_vm->_saves; + Sound &sound = *_vm->_sound; + + sound.stopAllAudio(); + sound.playSong("outday3.m"); + + Common::String str = Common::String::format(Res.DARKSIDE_ENDING1, endingScore); showPharaohEndText(str.c_str(), Res.DARKSIDE_ENDING2); + + saves.saveGame(); } void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, const char *msg3) { diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.h b/engines/xeen/worldofxeen/darkside_cutscenes.h index 30e3e8d3c9..f2dd5c5045 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.h +++ b/engines/xeen/worldofxeen/darkside_cutscenes.h @@ -32,6 +32,31 @@ class XeenEngine; namespace WorldOfXeen { class DarkSideCutscenes : public Cutscenes { +private: + /** + * Shows the part 1 of the Dark Side ending, everything up to Corak appearing + */ + bool showDarkSideEnding1(); + + /** + * Shows the part 2 of the Dark Side ending, exposition until start of fighting + */ + bool showDarkSideEnding2(); + + /** + * Shows the part 3 of the Dark Side ending, the fighting + */ + bool showDarkSideEnding3(); + + /** + * Shows the part 4 of the Dark Side ending, the self-destruct and castle explosion + */ + bool showDarkSideEnding4(); + + /** + * Last part of the Dark Side ending, shows the final score and saves the game/ + */ + void showDarkSideScore(uint endingScore); protected: /** * Shows the Pharaoh ending screen where score text is shown @@ -53,12 +78,7 @@ public: /** * Shows the Dark Side of Xeen ending sequence */ - bool showDarkSideEnding(); - - /** - * Show the ending score - */ - void showDarkSideScore(); + void showDarkSideEnding(uint endingScore); }; } // End of namespace WorldOfXeen diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp index 9bc6394f48..e1e397ff46 100644 --- a/engines/xeen/worldofxeen/worldofxeen.cpp +++ b/engines/xeen/worldofxeen/worldofxeen.cpp @@ -68,7 +68,7 @@ void WorldOfXeenEngine::outerGameLoop() { break; case WOX_DARKSIDE_ENDING: - showDarkSideEnding(); + //showDarkSideEnding(); break; case WOX_WORLD_ENDING: @@ -213,7 +213,7 @@ void WorldOfXeenEngine::showCutscene(const Common::String &name, int status, uin if (name == "ENDGAME") showCloudsEnding(score); else if (name == "ENDGAME2") - showDarkSideEnding(); + showDarkSideEnding(score); else if (name == "WORLDEND") showWorldOfXeenEnding((GooberState)status, score); diff --git a/engines/xeen/worldofxeen/worldofxeen_resources.cpp b/engines/xeen/worldofxeen/worldofxeen_resources.cpp index fec30158e9..5bd6247d08 100644 --- a/engines/xeen/worldofxeen/worldofxeen_resources.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_resources.cpp @@ -46,12 +46,12 @@ const char *const WorldOfXeenResources::DARKSIDE_ENDING1 = "\n\x3" "cCongratulat const char *const WorldOfXeenResources::DARKSIDE_ENDING2 = "\n" "Adventurers,\n" "\n" - "I have saved your game in Castleview.\n" + "I will save your game in Castleview.\n" "\n" "The World of Xeen still needs you!\n" "\n" - "Load your game and come visit me in the Great Pyramid " - "for further instructions"; + "Load your game afterwards and come visit me in the " + "Great Pyramid for further instructions"; const char *const WorldOfXeenResources::PHAROAH_ENDING_TEXT1 = "\xC" "d\xB" "001\x9" "001%s\x3" "c\x9" "000\xB" "180Press a Key!\x3" "l"; -- cgit v1.2.3