diff options
author | Filippos Karapetis | 2009-10-05 16:43:24 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-05 16:43:24 +0000 |
commit | 91a16e0c7dd97b24461901d03b1b485eea833dcc (patch) | |
tree | bac7a9a3f565f692d9cfdcbff1849b95fe1854e7 /engines/sci/gui32 | |
parent | 4c35022f6b3b5cc77fa90eb306e96a14fbb91a99 (diff) | |
download | scummvm-rg350-91a16e0c7dd97b24461901d03b1b485eea833dcc.tar.gz scummvm-rg350-91a16e0c7dd97b24461901d03b1b485eea833dcc.tar.bz2 scummvm-rg350-91a16e0c7dd97b24461901d03b1b485eea833dcc.zip |
Moved the cursor movement code in the GUI
svn-id: r44664
Diffstat (limited to 'engines/sci/gui32')
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 20 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.h | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index f4babfba7f..125a8d68a2 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -1994,7 +1994,7 @@ void SciGui32::setNowSeen(reg_t objectReference) { } -void SciGui32::moveCursor(int16 x, int16 y) { +void SciGui32::moveCursor(int16 x, int16 y, int16 scaleFactor) { Common::Point newPos; // newPos = s->gfx_state->pointer_pos; @@ -2007,9 +2007,21 @@ void SciGui32::moveCursor(int16 x, int16 y) { if (newPos.y > s->port->zone.y + s->port->zone.height) newPos.y = s->port->zone.y + s->port->zone.height; - if (newPos.x < 0) newPos.x = 0; - if (newPos.y < 0) newPos.y = 0; - gfxop_set_pointer_position(s->gfx_state, newPos); + if (newPos.x < 0) + newPos.x = 0; + if (newPos.y < 0) + newPos.y = 0; + + if (x > 320 || y > 200) { + debug("[GFX] Attempt to place pointer at invalid coordinates (%d, %d)\n", x, y); + return; // Not fatal + } + + g_system->warpMouse(x * scaleFactor, y * scaleFactor); + + // Trigger event reading to make sure the mouse coordinates will + // actually have changed the next time we read them. + gfxop_get_event(s->gfx_state, SCI_EVT_PEEK); } } // End of namespace Sci diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index 28c6c95852..0dd702ee1d 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -80,7 +80,7 @@ public: void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control); void setNowSeen(reg_t objectReference); - void moveCursor(int16 x, int16 y); + void moveCursor(int16 x, int16 y, int16 scaleFactor = 1); private: OSystem *_system; |