From e412b62ffce4297da7df8fc4b71a619fa3a89880 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 26 Sep 2011 09:29:17 -0400 Subject: PEGASUS: Implement the death code --- engines/pegasus/energymonitor.cpp | 6 +++--- engines/pegasus/pegasus.cpp | 22 ++++++++++++++++++++++ engines/pegasus/pegasus.h | 3 +++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/engines/pegasus/energymonitor.cpp b/engines/pegasus/energymonitor.cpp index fc22a32416..b1ea04435b 100755 --- a/engines/pegasus/energymonitor.cpp +++ b/engines/pegasus/energymonitor.cpp @@ -160,9 +160,9 @@ int32 EnergyMonitor::getCurrentEnergy() { void EnergyMonitor::timeChanged(const TimeValue currentTime) { if (currentTime == getStop()) { - // TODO: Die :P - if (((PegasusEngine *)g_engine)->getEnergyDeathReason() != -1) - error("You're dead"); + PegasusEngine *vm = (PegasusEngine *)g_engine; + if (vm->getEnergyDeathReason() != -1) + vm->die(vm->getEnergyDeathReason()); } else { uint32 currentEnergy = kMaxJMPEnergy - currentTime; diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index 468f3a44b5..3a8e868d2d 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -495,6 +495,9 @@ void PegasusEngine::receiveNotification(Notification *notification, const tNotif #endif break; } + case kPlayerDiedFlag: + doDeath(); + break; default: break; } @@ -1020,4 +1023,23 @@ bool PegasusEngine::playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x return skipped; } +void PegasusEngine::die(const tDeathReason reason) { + // TODO: Stop dragging + + _deathReason = reason; + _shellNotification.setNotificationFlags(kPlayerDiedFlag, kPlayerDiedFlag); +} + +void PegasusEngine::doDeath() { + // TODO: Fade out + throwAwayEverything(); + useMenu(new DeathMenu(_deathReason)); + _gfx->updateDisplay(); + // TODO: Fade in +} + +void PegasusEngine::throwAwayEverything() { + // TODO +} + } // End of namespace Pegasus diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h index f881aa6f4c..b01e1929f6 100644 --- a/engines/pegasus/pegasus.h +++ b/engines/pegasus/pegasus.h @@ -111,6 +111,7 @@ public: void setEnergyDeathReason(const tDeathReason reason) { _deathReason = reason; } tDeathReason getEnergyDeathReason() { return _deathReason; } void resetEnergyDeathReason(); + void die(const tDeathReason); // Volume uint16 getSoundFXLevel(); @@ -188,6 +189,7 @@ private: void showLoadDialog(); void showTempScreen(const Common::String &fileName); bool playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x, uint16 y); + void throwAwayEverything(); // Menu GameMenu *_gameMenu; @@ -199,6 +201,7 @@ private: // Death tDeathReason _deathReason; + void doDeath(); // Neighborhood Neighborhood *_neighborhood; -- cgit v1.2.3