aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorRobert Špalek2009-10-27 23:51:32 +0000
committerRobert Špalek2009-10-27 23:51:32 +0000
commited87e5cd318c9d869934daaf0cb6d67270d54c75 (patch)
treeaf879a2a8dc13f0587fe5a499ca42c4863bffb1c /engines/draci/game.cpp
parent7d6e96fa80373d5eceae6cb3a776c24d4adcb8cd (diff)
downloadscummvm-rg350-ed87e5cd318c9d869934daaf0cb6d67270d54c75.tar.gz
scummvm-rg350-ed87e5cd318c9d869934daaf0cb6d67270d54c75.tar.bz2
scummvm-rg350-ed87e5cd318c9d869934daaf0cb6d67270d54c75.zip
Don't change mouse cursors so ridiculously often.
svn-id: r45451
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index f771c564f0..73a5a34d9a 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -463,16 +463,11 @@ void Game::updateCursor() {
if (_loopStatus == kStatusDialogue)
return;
+ bool mouseChanged = false;
+
// If we are in inventory mode, we do a different kind of updating that handles
// inventory items and return early
if (_loopStatus == kStatusInventory && _loopSubstatus == kSubstatusOrdinary) {
-
- if (_currentItem == kNoItem) {
- _vm->_mouse->setCursorType(kNormalCursor);
- } else {
- _vm->_mouse->loadItemCursor(_currentItem);
- }
-
if (_itemUnderCursor != kNoItem) {
const GameItem *item = &_items[_itemUnderCursor];
@@ -482,6 +477,14 @@ void Game::updateCursor() {
} else {
_vm->_mouse->loadItemCursor(_currentItem, true);
}
+ mouseChanged = true;
+ }
+ }
+ if (!mouseChanged) {
+ if (_currentItem == kNoItem) {
+ _vm->_mouse->setCursorType(kNormalCursor);
+ } else {
+ _vm->_mouse->loadItemCursor(_currentItem);
}
}
@@ -498,14 +501,6 @@ void Game::updateCursor() {
_oldObjUnderCursor = _objUnderCursor;
}
- // Load the appropriate cursor (item image if an item is held or ordinary cursor
- // if not)
- if (_currentItem == kNoItem) {
- _vm->_mouse->setCursorType(kNormalCursor);
- } else {
- _vm->_mouse->loadItemCursor(_currentItem);
- }
-
// TODO: Handle main menu
// If there is no game object under the cursor, try using the room itself
@@ -516,6 +511,7 @@ void Game::updateCursor() {
} else {
_vm->_mouse->loadItemCursor(_currentItem, true);
}
+ mouseChanged = true;
}
// If there *is* a game object under the cursor, update the cursor image
} else {
@@ -531,11 +527,22 @@ void Game::updateCursor() {
} else {
_vm->_mouse->loadItemCursor(_currentItem, true);
}
+ mouseChanged = true;
}
// If the walking direction *is* set, the game object is a gate, so update
// the cursor image to the appropriate arrow.
} else {
_vm->_mouse->setCursorType((CursorType)obj->_walkDir);
+ mouseChanged = true;
+ }
+ }
+ // Load the appropriate cursor (item image if an item is held or ordinary cursor
+ // if not)
+ if (!mouseChanged) {
+ if (_currentItem == kNoItem) {
+ _vm->_mouse->setCursorType(kNormalCursor);
+ } else {
+ _vm->_mouse->loadItemCursor(_currentItem);
}
}
}