diff options
-rw-r--r-- | engines/mohawk/riven.cpp | 7 | ||||
-rw-r--r-- | engines/mohawk/riven_card.cpp | 11 | ||||
-rw-r--r-- | engines/mohawk/riven_card.h | 6 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.h | 2 |
5 files changed, 16 insertions, 12 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 8b7ee885ae..e6d8a16811 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -384,7 +384,10 @@ void MohawkEngine_Riven::changeToCard(uint16 dest) { } } - delete _card; + if (_card) { + _card->leave(); + delete _card; + } _card = new RivenCard(this, dest); refreshCard(); // Handles hotspots and scripts @@ -394,7 +397,7 @@ void MohawkEngine_Riven::refreshCard() { // Clear any timer still floating around removeTimer(); - _card->open(); + _card->enter(); if (_showHotspots) _card->drawHotspotRects(); diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index e82e00b7ac..212557b15d 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -42,12 +42,9 @@ RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) : loadCardSoundList(id); loadCardHotspotEnableList(id); loadCardWaterEffectList(id); - setCurrentCardVariable(); } RivenCard::~RivenCard() { - runLeaveScripts(); - for (uint i = 0; i < _hotspots.size(); i++) { delete _hotspots[i]; } @@ -66,7 +63,9 @@ void RivenCard::loadCardResource(uint16 id) { delete inStream; } -void RivenCard::open() { +void RivenCard::enter() { + setCurrentCardVariable(); + _vm->_activatedPLST = false; _vm->_activatedSLST = false; @@ -77,7 +76,7 @@ void RivenCard::open() { initializeZipMode(); _vm->_gfx->applyScreenUpdate(true); - runScript(kCardOpenScript); + runScript(kCardEnterScript); } void RivenCard::initializeZipMode() { @@ -430,7 +429,7 @@ void RivenCard::updateMouseCursor() { _vm->_system->updateScreen(); } -void RivenCard::runLeaveScripts() { +void RivenCard::leave() { RivenScriptPtr script(new RivenScript()); if (_pressedHotspot) { diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h index d20f63dfd6..626c427444 100644 --- a/engines/mohawk/riven_card.h +++ b/engines/mohawk/riven_card.h @@ -56,7 +56,10 @@ public: }; /** Initialization routine used to draw a card for the first time or to refresh it */ - void open(); + void enter(); + + /** Run the card's leave scripts */ + void leave(); /** Run one of the card's scripts */ void runScript(uint16 scriptType); @@ -131,7 +134,6 @@ private: RivenScriptPtr getScript(uint16 scriptType) const; void defaultLoadScript(); - void runLeaveScripts(); void updateMouseCursor(); diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 794e8db6cd..c3e92380e2 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -200,7 +200,7 @@ const char *RivenScript::getTypeName(uint16 type) { "CardLoad", "CardLeave", "CardUnknown", - "CardOpen", + "CardEnter", "CardUpdate" }; diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index 304c2f312f..cfe0f3a048 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -46,7 +46,7 @@ enum { kCardLoadScript = 6, kCardLeaveScript = 7, - kCardOpenScript = 9, + kCardEnterScript = 9, kCardUpdateScript = 10 }; |