From 5b0f460581e9deb08fc0f66e8faeb356f31c2ae5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 Nov 2015 22:32:07 -0500 Subject: XEEN: Implementing more of Dark Side intro --- engines/xeen/sound.cpp | 3 + engines/xeen/sound.h | 2 + engines/xeen/worldofxeen/darkside_intro.cpp | 88 +++++++++++++++------------ engines/xeen/worldofxeen/darkside_intro.h | 4 +- engines/xeen/worldofxeen/worldofxeen_game.cpp | 5 +- engines/xeen/worldofxeen/worldofxeen_game.h | 2 + 6 files changed, 63 insertions(+), 41 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index e0b12215ce..00b92472cc 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -39,5 +39,8 @@ void SoundManager::startMusic(int v1) { } +void SoundManager::stopMusic(int id) { +} + } // End of namespace Xeen diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index fae3d76dba..5c123d7d89 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -57,6 +57,8 @@ public: void startMusic(int v1); + void stopMusic(int id); + void playSong(Common::SeekableReadStream &f) {} void playSound(VOC &voc) {} diff --git a/engines/xeen/worldofxeen/darkside_intro.cpp b/engines/xeen/worldofxeen/darkside_intro.cpp index 2d284c1581..8148e249d0 100644 --- a/engines/xeen/worldofxeen/darkside_intro.cpp +++ b/engines/xeen/worldofxeen/darkside_intro.cpp @@ -25,7 +25,7 @@ namespace Xeen { -void showDarkSideTitle(XeenEngine &vm) { +bool showDarkSideTitle(XeenEngine &vm) { EventsManager &events = *vm._events; Screen &screen = *vm._screen; SoundManager &sound = *vm._sound; @@ -41,18 +41,7 @@ void showDarkSideTitle(XeenEngine &vm) { 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); @@ -90,10 +79,8 @@ void showDarkSideTitle(XeenEngine &vm) { } if (events.wait(2, true)) - return; + return false; } - if (vm.shouldQuit()) - return; // Loop for dragon using flyspray for (int idx = 0; idx < 42 && !vm.shouldQuit(); ++idx) { @@ -123,35 +110,41 @@ void showDarkSideTitle(XeenEngine &vm) { } if (events.wait(2, true)) - return; + return false; } // Pause for a bit if (events.wait(10, true)) - return; - if (vm.shouldQuit()) - return; + return false; voc[0].stop(); voc[1].stop(); voc[2].stop(); - - - screen.fadeOut(8); - //TODO: Stuff + sound.stopMusic(95); screen.loadBackground("jvc.raw"); + screen.fadeOut(8); screen.draw(); screen.fadeIn(4); events.updateGameCounter(); events.wait(60, true); + return true; } -void showDarkSideIntro(XeenEngine &vm) { +bool showDarkSideIntro(XeenEngine &vm) { EventsManager &events = *vm._events; Screen &screen = *vm._screen; SoundManager &sound = *vm._sound; + const int XLIST1[] = { + 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 58, 60, 62 + }; + const int YLIST1[] = { + 0, 5, 10, 15, 20, 25, 30, 35, 40, 40, 39, 37, 35, 33, 31 + }; + const int XLIST2[] = { + 160, 155, 150, 145, 140, 135, 130, 125, 120, 115, 110, 105, 98, 90, 82 + }; screen.fadeOut(8); screen.loadBackground("pyramid2.raw"); @@ -171,38 +164,42 @@ void showDarkSideIntro(XeenEngine &vm) { screen.loadPage(0); screen.loadPage(1); + // Show Might and Magic Darkside of Xeen title, and gradualy scroll + // the background vertically down to show the Pharoah's base int yp = 0; - int frame = 0; + int frameNum = 0; int idx1 = 0; bool skipElapsed = false; uint32 timeExpired = 0; - // bool fadeFlag = true; + bool fadeFlag = true; - for (int idx = 200; idx > 0; ) { + for (int yCtr = SCREEN_HEIGHT; yCtr > 0; ) { events.updateGameCounter(); screen.vertMerge(yp); sprites[0].draw(screen, 0); - if (frame) - sprites[0].draw(screen, frame); + if (frameNum) + sprites[0].draw(screen, frameNum); idx1 = (idx1 + 1) % 4; if (!idx1) - frame = (frame + 1) % 10; + frameNum = (frameNum + 1) % 10; screen.draw(); if (!skipElapsed) { - timeExpired = MAX(events.timeElapsed(), (uint32)1); + timeExpired = MAX((int)events.timeElapsed() - 1, 1); skipElapsed = true; } - idx -= timeExpired; - frame = MIN(frame + timeExpired, (uint)200); + yCtr -= timeExpired; + yp = MIN(yp + timeExpired, (uint)200); - while (events.timeElapsed() < 1) { - events.pollEventsAndWait(); - if (events.isKeyMousePressed()) - return; + if (events.wait(1, true)) + return false; + + if (fadeFlag) { + screen.fadeIn(4); + fadeFlag = false; } } @@ -214,9 +211,24 @@ void showDarkSideIntro(XeenEngine &vm) { events.updateGameCounter(); events.wait(30, true); + // Zoom into the Pharoah's base closeup view + for (int idx = 14; idx >= 0; --idx) { + events.updateGameCounter(); + sprites[1].draw(screen, 0, Common::Point(XLIST1[idx], YLIST1[idx])); + sprites[1].draw(screen, 1, Common::Point(XLIST2[idx], YLIST1[idx])); + screen.draw(); + + if (idx == 2) + sound.stopMusic(48); + if (events.wait(2, true)) + return false; + } + // TODO: More sound.playSong(voc[0]); sound.playSong(voc[1]); + + return true; } } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/darkside_intro.h b/engines/xeen/worldofxeen/darkside_intro.h index 535ee21b39..e37f095347 100644 --- a/engines/xeen/worldofxeen/darkside_intro.h +++ b/engines/xeen/worldofxeen/darkside_intro.h @@ -27,9 +27,9 @@ namespace Xeen { -void showDarkSideTitle(XeenEngine &vm); +bool showDarkSideTitle(XeenEngine &vm); -void showDarkSideIntro(XeenEngine &vm); +bool showDarkSideIntro(XeenEngine &vm); } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/worldofxeen_game.cpp b/engines/xeen/worldofxeen/worldofxeen_game.cpp index 125f9f26c6..f7c9336c64 100644 --- a/engines/xeen/worldofxeen/worldofxeen_game.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_game.cpp @@ -28,6 +28,7 @@ namespace Xeen { WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) : XeenEngine(syst, gameDesc) { + _seenDarkSideIntro = false; } void WorldOfXeenEngine::showIntro() { @@ -35,7 +36,9 @@ void WorldOfXeenEngine::showIntro() { if (gDebugLevel == 0) return; - showDarkSideTitle(*this); + bool completed = showDarkSideTitle(*this); + if (!_seenDarkSideIntro && completed) + showDarkSideIntro(*this); } } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/worldofxeen_game.h b/engines/xeen/worldofxeen/worldofxeen_game.h index f81f566d88..97a8754470 100644 --- a/engines/xeen/worldofxeen/worldofxeen_game.h +++ b/engines/xeen/worldofxeen/worldofxeen_game.h @@ -35,6 +35,8 @@ namespace Xeen { class WorldOfXeenEngine: public XeenEngine { protected: virtual void showIntro(); +public: + bool _seenDarkSideIntro; public: WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc); virtual ~WorldOfXeenEngine() {} -- cgit v1.2.3