From ce400ce0f1764c3ee5a5dc102e84d372c8cd57ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Jan 2018 21:29:42 -0500 Subject: XEEN: Implemented death cutscene method --- engines/xeen/worldofxeen/worldofxeen.cpp | 81 ++++++++++++++++++++++++++++++++ engines/xeen/worldofxeen/worldofxeen.h | 5 ++ engines/xeen/xeen.cpp | 3 ++ engines/xeen/xeen.h | 5 ++ 4 files changed, 94 insertions(+) (limited to 'engines/xeen') diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp index a15bc401ba..cc797d77ff 100644 --- a/engines/xeen/worldofxeen/worldofxeen.cpp +++ b/engines/xeen/worldofxeen/worldofxeen.cpp @@ -86,5 +86,86 @@ void WorldOfXeenEngine::outerGameLoop() { } } +void WorldOfXeenEngine::death() { + Window &w = (*_windows)[0]; + _sound->stopAllAudio(); + SpriteResource fireSprites[4] = { + SpriteResource("fire1.vga"), + SpriteResource("fire2.vga"), + SpriteResource("fire3.vga"), + SpriteResource("fire4.vga") + }; + SpriteResource deathSprites("death.vga"), death1Sprites("death1.vga"); + const int Y_LIST[] = { + 196, 187, 179, 169, 159, 147, 138, 127, 113, 101, 86, + 73, 60, 48, 36, 23, 10, 0, 0 + }; + + Graphics::ManagedSurface savedBg; + savedBg.copyFrom(*_screen); + + fireSprites[0].draw(0, 0, Common::Point(0, 0)); + fireSprites[0].draw(0, 1, Common::Point(160, 0)); + w.update(); + _sound->playSound("fire.voc"); + + // Fire will vertically consume the screen + for (int idx = 2; idx < 36; idx += 2) { + _events->updateGameCounter(); + _screen->blitFrom(savedBg); + + fireSprites[idx / 10].draw(0, idx % 10, Common::Point(0, 0)); + fireSprites[idx / 10].draw(0, (idx % 10) + 1, Common::Point(160, 0)); + + for (int yCtr = 0, frame = 0; yCtr < (idx / 2); ++yCtr, frame += 2) { + deathSprites.draw(0, frame, Common::Point(0, Y_LIST[yCtr])); + deathSprites.draw(0, frame + 1, Common::Point(160, Y_LIST[yCtr])); + } + + w.update(); + _events->wait(1); + } + + deathSprites.draw(0, 34, Common::Point(0, 0)); + deathSprites.draw(0, 35, Common::Point(160, 0)); + w.update(); + savedBg.blitFrom(*_screen); + + _sound->playSong(_files->_isDarkCc ? "laff1.voc" : "xeenlaff.voc"); + + // Animation of Xeen or Alamar laughing + for (int idx = 0, idx2 = 0; idx < (_files->_isDarkCc ? 10 : 23); ++idx) { + _events->updateGameCounter(); + _screen->blitFrom(savedBg); + + if (idx != 0) + death1Sprites.draw(0, idx - 1); + w.update(); + + if (_files->_isDarkCc) { + _events->wait(2); + } else { + if (idx == 1 || idx == 11) + _sound->playFX(33); + _events->wait(2); + if (idx == 15) + _sound->playFX(34); + } + + if (idx == (_files->_isDarkCc ? 9 : 10)) { + if (idx2 < (_files->_isDarkCc ? 2 : 1)) { + idx = -1; + ++idx2; + } + } + + if (!_sound->isPlaying()) + idx = 23; + } + + _screen->blitFrom(savedBg); + w.update(); +} + } // End of namespace WorldOfXeen } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/worldofxeen.h b/engines/xeen/worldofxeen/worldofxeen.h index 0177e7cacf..90fd191b17 100644 --- a/engines/xeen/worldofxeen/worldofxeen.h +++ b/engines/xeen/worldofxeen/worldofxeen.h @@ -48,6 +48,11 @@ protected: * intros, main menus, or to play the actual game */ virtual void outerGameLoop(); + + /** + * Death cutscene + */ + virtual void death(); public: bool _seenDarkSideIntro; WOXGameAction _pendingAction; diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 81f629e22f..44679eeb90 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -200,6 +200,9 @@ void XeenEngine::play() { _combat->_moveMonsters = true; gameLoop(); + + if (_party->_dead) + death(); } void XeenEngine::gameLoop() { diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index c0ff0713df..dcf490d7fb 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -127,6 +127,11 @@ protected: * Play the game */ virtual void playGame(); + + /** + * Death cutscene + */ + virtual void death() = 0; public: Combat *_combat; Debugger *_debugger; -- cgit v1.2.3