aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2011-01-19 18:02:53 +0000
committerArnaud Boutonné2011-01-19 18:02:53 +0000
commit878bedf454a8440b3d3c8887bc021a698dbb5605 (patch)
tree3b1356dd10997ce7400c40e81d46aa5efe85530f
parent16ba5717f40c202b4879a59b619a595ef849d27f (diff)
downloadscummvm-rg350-878bedf454a8440b3d3c8887bc021a698dbb5605.tar.gz
scummvm-rg350-878bedf454a8440b3d3c8887bc021a698dbb5605.tar.bz2
scummvm-rg350-878bedf454a8440b3d3c8887bc021a698dbb5605.zip
HUGO: Move mouseHander() out of runMachine()
svn-id: r55332
-rw-r--r--engines/hugo/hugo.cpp4
-rw-r--r--engines/hugo/inventory.cpp1
-rw-r--r--engines/hugo/mouse.cpp48
3 files changed, 29 insertions, 24 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 8b1ebd78dd..05c40e2cc3 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -313,6 +313,9 @@ Common::Error HugoEngine::run() {
break;
}
}
+ _mouse->mouseHandler(); // Mouse activity - adds to display list
+ _screen->displayList(D_DISPLAY); // Blit the display list to screen
+
_status.doQuitFl |= shouldQuit(); // update game quit flag
}
return Common::kNoError;
@@ -374,7 +377,6 @@ void HugoEngine::runMachine() {
_scheduler->runScheduler(); // Process any actions
_screen->displayList(D_RESTORE); // Restore previous background
_object->updateImages(); // Draw into _frontBuffer, compile display list
- _mouse->mouseHandler(); // Mouse activity - adds to display list
_screen->drawStatusText();
_screen->displayList(D_DISPLAY); // Blit the display list to screen
_sound->checkMusic();
diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp
index 19995d3650..980ffd2be8 100644
--- a/engines/hugo/inventory.cpp
+++ b/engines/hugo/inventory.cpp
@@ -229,7 +229,6 @@ void InventoryHandler::runInventory() {
case I_ACTIVE: // Inventory active
_vm->_parser->charHandler(); // Still allow commands
_vm->_screen->displayList(D_RESTORE); // Restore previous background
- _vm->_mouse->mouseHandler(); // Mouse activity - adds to display list
_vm->_screen->displayList(D_DISPLAY); // Blit the display list to screen
break;
}
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index 035a706b14..039f33b324 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -242,11 +242,14 @@ void MouseHandler::processLeftClick(int16 objId, int16 cx, int16 cy) {
void MouseHandler::mouseHandler() {
debugC(2, kDebugMouse, "mouseHandler");
+ status_t &gameStatus = _vm->getGameStatus();
+
+ if ((gameStatus.viewState != V_PLAY) && (gameStatus.inventoryState != I_ACTIVE))
+ return;
+
int16 cx = _vm->getMouseX();
int16 cy = _vm->getMouseY();
- status_t &gameStatus = _vm->getGameStatus();
-
gameStatus.cx = cx; // Save cursor coords
gameStatus.cy = cy;
@@ -264,29 +267,30 @@ void MouseHandler::mouseHandler() {
}
}
- if (objId == -1) // No match, check rest of view
- objId = _vm->_object->findObject(cx, cy);
- if (objId >= 0) { // Got a match
- // Display object name next to cursor (unless CURSOR_NOCHAR)
- // Note test for swapped hero name
- char *name = _vm->_arrayNouns[_vm->_object->_objects[(objId == HERO) ? _vm->_heroImage : objId].nounIndex][CURSOR_NAME];
- if (name[0] != CURSOR_NOCHAR)
- cursorText(name, cx, cy, U_FONT8, _TBRIGHTWHITE);
-
- // Process right click over object in view or iconbar
- if (gameStatus.rightButtonFl)
- processRightClick(objId, cx, cy);
- }
+ if (!gameStatus.gameOverFl) {
+ if (objId == -1) // No match, check rest of view
+ objId = _vm->_object->findObject(cx, cy);
+ if (objId >= 0) { // Got a match
+ // Display object name next to cursor (unless CURSOR_NOCHAR)
+ // Note test for swapped hero name
+ char *name = _vm->_arrayNouns[_vm->_object->_objects[(objId == HERO) ? _vm->_heroImage : objId].nounIndex][CURSOR_NAME];
+ if (name[0] != CURSOR_NOCHAR)
+ cursorText(name, cx, cy, U_FONT8, _TBRIGHTWHITE);
+
+ // Process right click over object in view or iconbar
+ if (gameStatus.rightButtonFl)
+ processRightClick(objId, cx, cy);
+ }
- // Process cursor over an exit hotspot
- if (objId == -1) {
- int i = findExit(cx, cy);
- if (i != -1 && _vm->_hotspots[i].viewx >= 0) {
- objId = EXIT_HOTSPOT;
- cursorText(_vm->_textMouse[kMsExit], cx, cy, U_FONT8, _TBRIGHTWHITE);
+ // Process cursor over an exit hotspot
+ if (objId == -1) {
+ int i = findExit(cx, cy);
+ if (i != -1 && _vm->_hotspots[i].viewx >= 0) {
+ objId = EXIT_HOTSPOT;
+ cursorText(_vm->_textMouse[kMsExit], cx, cy, U_FONT8, _TBRIGHTWHITE);
+ }
}
}
-
// Left click over icon, object or to move somewhere
if (gameStatus.leftButtonFl)
processLeftClick(objId, cx, cy);