diff options
author | Bastien Bouclet | 2016-08-06 19:22:12 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | c1331e124f61b22446de5ff81171f2cf3bac59ba (patch) | |
tree | a357fc1846b8633e86f198d8efa47913b48a5f58 /engines/mohawk/riven.cpp | |
parent | 871516a9697db1914d703f0abb48a2f084452b0c (diff) | |
download | scummvm-rg350-c1331e124f61b22446de5ff81171f2cf3bac59ba.tar.gz scummvm-rg350-c1331e124f61b22446de5ff81171f2cf3bac59ba.tar.bz2 scummvm-rg350-c1331e124f61b22446de5ff81171f2cf3bac59ba.zip |
MOHAWK: Move the current hotspot to RivenCard
Diffstat (limited to 'engines/mohawk/riven.cpp')
-rw-r--r-- | engines/mohawk/riven.cpp | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 4d30755a32..f31f12de0e 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -68,7 +68,6 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio _saveLoad = nullptr; _optionsDialog = nullptr; _card = nullptr; - _curHotspot = nullptr; removeTimer(); // NOTE: We can never really support CD swapping. All of the music files @@ -212,7 +211,7 @@ void MohawkEngine_Riven::handleEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_MOUSEMOVE: - checkHotspotChange(); + _card->onMouseMove(event.mouse); if (!(getFeatures() & GF_DEMO)) { // Check to show the inventory, but it is always "showing" in the demo @@ -225,19 +224,17 @@ void MohawkEngine_Riven::handleEvents() { needsUpdate = true; break; case Common::EVENT_LBUTTONDOWN: - if (_curHotspot) { + if (_card->getCurHotspot()) { checkSunnerAlertClick(); - _curHotspot->runScript(kMouseDownScript); } + _card->onMouseDown(_eventMan->getMousePos()); break; case Common::EVENT_LBUTTONUP: // See RivenScript::switchCard() for more information on why we sometimes // disable the next up event. if (!_ignoreNextMouseUp) { - if (_curHotspot) - _curHotspot->runScript(kMouseUpScript); - else - checkInventoryClick(); + _card->onMouseUp(_eventMan->getMousePos()); + checkInventoryClick(); } _ignoreNextMouseUp = false; break; @@ -291,8 +288,7 @@ void MohawkEngine_Riven::handleEvents() { } } - if (_curHotspot) - _curHotspot->runScript(kMouseInsideScript); + _card->onMouseUpdate(); // Update the screen if we need to if (needsUpdate) @@ -425,26 +421,8 @@ void MohawkEngine_Riven::refreshCard() { installCardTimer(); } -void MohawkEngine_Riven::checkHotspotChange() { - Common::Point mousePos = _eventMan->getMousePos(); - RivenHotspot *hotspot = _card->getHotspotContainingPoint(mousePos); - - if (hotspot) { - if (_curHotspot != hotspot) { - _curHotspot = hotspot; - _cursor->setCursor(hotspot->getMouseCursor()); - _system->updateScreen(); - } - } else { - _curHotspot = nullptr; - _cursor->setCursor(kRivenMainCursor); - _system->updateScreen(); - } -} - void MohawkEngine_Riven::updateCurrentHotspot() { - _curHotspot = nullptr; - checkHotspotChange(); + _card->onMouseMove(_eventMan->getMousePos()); } void MohawkEngine_Riven::checkInventoryClick() { @@ -848,7 +826,7 @@ void MohawkEngine_Riven::checkSunnerAlertClick() { return; // Only set the sunners variable on the forward hotspot - if (_curHotspot->getBlstId() != 3) + if (_card->getCurHotspot()->getBlstId() != 3) return; // If the alert video is no longer playing, we have nothing left to do |