From d6a4ff36392b14afea6da749c2b2f4f14906ed64 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 24 Jan 2011 02:43:07 +0000 Subject: MOHAWK: Recheck the current hotspot if a script has changed the enabled hotspots in Riven svn-id: r55493 --- engines/mohawk/riven.cpp | 8 ++++++-- engines/mohawk/riven.h | 3 ++- engines/mohawk/riven_external.cpp | 6 ++---- engines/mohawk/riven_scripts.cpp | 9 +++++++++ 4 files changed, 19 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 00d0e5255f..935ab4b45f 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -376,8 +376,7 @@ void MohawkEngine_Riven::refreshCard() { } // Now we need to redraw the cursor if necessary and handle mouse over scripts - _curHotspot = -1; - checkHotspotChange(); + updateCurrentHotspot(); } void MohawkEngine_Riven::loadCard(uint16 id) { @@ -496,6 +495,11 @@ void MohawkEngine_Riven::checkHotspotChange() { } } +void MohawkEngine_Riven::updateCurrentHotspot() { + _curHotspot = -1; + checkHotspotChange(); +} + Common::String MohawkEngine_Riven::getHotspotName(uint16 hotspot) { assert(hotspot < _hotspotCount); diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index 16acf9419c..60a31736d7 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -146,6 +146,7 @@ private: void checkInventoryClick(); bool _showHotspots; void updateZipMode(); + void checkHotspotChange(); // Variables uint32 *_vars; @@ -177,7 +178,7 @@ public: void runHotspotScript(uint16 hotspot, uint16 scriptType); int32 getCurHotspot() const { return _curHotspot; } Common::String getHotspotName(uint16 hotspot); - void checkHotspotChange(); + void updateCurrentHotspot(); // Variable functions void initVars(); diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index c806c93130..98abfaae8e 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -1796,8 +1796,7 @@ void RivenExternal::xschool280_playwhark(uint16 argc, uint16 *argv) { _vm->_hotspots[3].enabled = !_vm->_hotspots[3].enabled; // Update the cursor - _vm->_curHotspot = -1; - _vm->checkHotspotChange(); + _vm->updateCurrentHotspot(); } void RivenExternal::xjatboundary(uint16 argc, uint16 *argv) { @@ -2460,8 +2459,7 @@ void RivenExternal::xtakeit(uint16 argc, uint16 *argv) { // Check the new hotspots and refresh everything *marble = 0; setMarbleHotspots(); - _vm->_curHotspot = -1; - _vm->checkHotspotChange(); + _vm->updateCurrentHotspot(); _vm->_gfx->updateScreen(); } diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index fcdae70ce5..5d459354e9 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -380,6 +380,9 @@ void RivenScript::enableHotspot(uint16 op, uint16 argc, uint16 *argv) { _vm->_hotspots[i].enabled = true; } } + + // Recheck our current hotspot because it may have now changed + _vm->updateCurrentHotspot(); } // Command 10: disable hotspot (blst_id) @@ -390,6 +393,9 @@ void RivenScript::disableHotspot(uint16 op, uint16 argc, uint16 *argv) { _vm->_hotspots[i].enabled = false; } } + + // Recheck our current hotspot because it may have now changed + _vm->updateCurrentHotspot(); } // Command 12: stop sounds (flags) @@ -589,6 +595,9 @@ void RivenScript::activateBLST(uint16 op, uint16 argc, uint16 *argv) { } delete blst; + + // Recheck our current hotspot because it may have now changed + _vm->updateCurrentHotspot(); } // Command 44: activate FLST record (information on which SFXE resource this card should use) -- cgit v1.2.3