diff options
author | Matthew Hoops | 2010-02-26 08:14:33 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-02-26 08:14:33 +0000 |
commit | e8c2c2b25c12b2e303643bc6ea1f168922d77e40 (patch) | |
tree | a79546187d04d1841ee0482b0717fd365010db93 /engines/mohawk/riven.cpp | |
parent | 08d3c24c12953c0c99286dac94486507f8deae6d (diff) | |
download | scummvm-rg350-e8c2c2b25c12b2e303643bc6ea1f168922d77e40.tar.gz scummvm-rg350-e8c2c2b25c12b2e303643bc6ea1f168922d77e40.tar.bz2 scummvm-rg350-e8c2c2b25c12b2e303643bc6ea1f168922d77e40.zip |
Slightly rework refreshing cards in Riven (and remove the hackish changeToCard(0)).
svn-id: r48134
Diffstat (limited to 'engines/mohawk/riven.cpp')
-rw-r--r-- | engines/mohawk/riven.cpp | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 677b1ae12c..2c5f849ba9 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -127,16 +127,13 @@ Common::Error MohawkEngine_Riven::run() { needsUpdate = true; break; case Common::EVENT_LBUTTONDOWN: - if (_curHotspot >= 0) { + if (_curHotspot >= 0) runHotspotScript(_curHotspot, kMouseDownScript); - //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); - } break; case Common::EVENT_LBUTTONUP: - if (_curHotspot >= 0) { + if (_curHotspot >= 0) runHotspotScript(_curHotspot, kMouseUpScript); - //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); - } else + else checkInventoryClick(); break; case Common::EVENT_KEYDOWN: @@ -156,9 +153,8 @@ Common::Error MohawkEngine_Riven::run() { for (uint16 i = 0; i < _hotspotCount; i++) _gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled); needsUpdate = true; - } else { - changeToCard(); - } + } else + refreshCard(); break; case Common::KEYCODE_F5: runDialog(*_optionsDialog); @@ -180,10 +176,8 @@ Common::Error MohawkEngine_Riven::run() { } } - if (_curHotspot >= 0) { + if (_curHotspot >= 0) runHotspotScript(_curHotspot, kMouseInsideScript); - //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); - } if (shouldQuit()) { if (_eventMan->shouldRTL() && (getFeatures() & GF_DEMO) && !(_curStack == aspit && _curCard == 12)) { @@ -274,29 +268,26 @@ struct RivenSpecialChange { { tspit, 0x21b69, ospit, 0x2e76 } // Dome Linking Book }; -void MohawkEngine_Riven::changeToCard(uint16 n) { - bool refreshMode = (n == 0); - - // While this could be run without harm, it doesn't need to be. This should add a speed boost. - if (!refreshMode) { - debug (1, "Changing to card %d", n); - _curCard = n; +void MohawkEngine_Riven::changeToCard(uint16 dest) { + _curCard = dest; + debug (1, "Changing to card %d", _curCard); - if (!(getFeatures() & GF_DEMO)) { - for (byte i = 0; i < 13; i++) - if (_curStack == rivenSpecialChange[i].startStack && _curCard == matchRMAPToCard(rivenSpecialChange[i].startCardRMAP)) { - changeToStack(rivenSpecialChange[i].targetStack); - _curCard = matchRMAPToCard(rivenSpecialChange[i].targetCardRMAP); - } - } + if (!(getFeatures() & GF_DEMO)) { + for (byte i = 0; i < 13; i++) + if (_curStack == rivenSpecialChange[i].startStack && _curCard == matchRMAPToCard(rivenSpecialChange[i].startCardRMAP)) { + changeToStack(rivenSpecialChange[i].targetStack); + _curCard = matchRMAPToCard(rivenSpecialChange[i].targetCardRMAP); + } + } - if (_cardData.hasData) - runCardScript(kCardLeaveScript); + if (_cardData.hasData) + runCardScript(kCardLeaveScript); - loadCard(_curCard); - } + loadCard(_curCard); + refreshCard(); // Handles hotspots and scripts +} - // We need to reload hotspots when refreshing, however +void MohawkEngine_Riven::refreshCard() { loadHotspots(_curCard); _gfx->_updatesEnabled = true; |