aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/cursor.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-23 10:58:06 +0000
committerMartin Kiewitz2010-07-23 10:58:06 +0000
commit8e04d25be6455d7cd38cd0b300fd0ddead2b4f99 (patch)
treeb9dd42cc301d5b5c61784bf1b183af0fd7f2d97c /engines/sci/graphics/cursor.cpp
parentb062b413aab72035996d71d274e3f6a6f8702e15 (diff)
downloadscummvm-rg350-8e04d25be6455d7cd38cd0b300fd0ddead2b4f99.tar.gz
scummvm-rg350-8e04d25be6455d7cd38cd0b300fd0ddead2b4f99.tar.bz2
scummvm-rg350-8e04d25be6455d7cd38cd0b300fd0ddead2b4f99.zip
SCI: support kSetCursorSci11(-2)
svn-id: r51202
Diffstat (limited to 'engines/sci/graphics/cursor.cpp')
-rw-r--r--engines/sci/graphics/cursor.cpp49
1 files changed, 28 insertions, 21 deletions
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index e1c05c97da..f6e2077cb3 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -47,7 +47,7 @@ GfxCursor::GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *sc
// center mouse cursor
setPosition(Common::Point(_screen->getWidth() / 2, _screen->getHeight() / 2));
- kernelSetMoveZone(Common::Rect(0, 0, _screen->getDisplayWidth(), _screen->getDisplayHeight()));
+ _moveZoneActive = false;
}
GfxCursor::~GfxCursor() {
@@ -283,32 +283,39 @@ Common::Point GfxCursor::getPosition() {
}
void GfxCursor::refreshPosition() {
- bool clipped = false;
- Common::Point mousePoint = getPosition();
-
- if (mousePoint.x < _moveZone.left) {
- mousePoint.x = _moveZone.left;
- clipped = true;
- } else if (mousePoint.x >= _moveZone.right) {
- mousePoint.x = _moveZone.right - 1;
- clipped = true;
- }
+ if (_moveZoneActive) {
+ bool clipped = false;
+ Common::Point mousePoint = getPosition();
+
+ if (mousePoint.x < _moveZone.left) {
+ mousePoint.x = _moveZone.left;
+ clipped = true;
+ } else if (mousePoint.x >= _moveZone.right) {
+ mousePoint.x = _moveZone.right - 1;
+ clipped = true;
+ }
- if (mousePoint.y < _moveZone.top) {
- mousePoint.y = _moveZone.top;
- clipped = true;
- } else if (mousePoint.y >= _moveZone.bottom) {
- mousePoint.y = _moveZone.bottom - 1;
- clipped = true;
+ if (mousePoint.y < _moveZone.top) {
+ mousePoint.y = _moveZone.top;
+ clipped = true;
+ } else if (mousePoint.y >= _moveZone.bottom) {
+ mousePoint.y = _moveZone.bottom - 1;
+ clipped = true;
+ }
+
+ // FIXME: Do this only when mouse is grabbed?
+ if (clipped)
+ setPosition(mousePoint);
}
+}
- // FIXME: Do this only when mouse is grabbed?
- if (clipped)
- setPosition(mousePoint);
+void GfxCursor::kernelResetMoveZone() {
+ _moveZoneActive = false;
}
void GfxCursor::kernelSetMoveZone(Common::Rect zone) {
- _moveZone = zone;
+ _moveZone = zone;
+ _moveZoneActive = true;
}
void GfxCursor::kernelSetPos(Common::Point pos) {