aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2007-09-05 21:57:57 +0000
committerFilippos Karapetis2007-09-05 21:57:57 +0000
commit8ccd247a749772e4ee5df8de8da17983baf3094d (patch)
treedeba6b57eef8e3f37af34eb4d71c7224ede5a2ef /engines
parent8ac039243076fb504349415aa88130e771ac3522 (diff)
downloadscummvm-rg350-8ccd247a749772e4ee5df8de8da17983baf3094d.tar.gz
scummvm-rg350-8ccd247a749772e4ee5df8de8da17983baf3094d.tar.bz2
scummvm-rg350-8ccd247a749772e4ee5df8de8da17983baf3094d.zip
Only change the cursor palette when the mouse hovers over a hotspot in Mickey, not the whole cursor. This is a much faster operation, which also gives better results
svn-id: r28860
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/graphics.cpp8
-rw-r--r--engines/agi/graphics.h1
-rw-r--r--engines/agi/preagi_mickey.cpp20
3 files changed, 19 insertions, 10 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 5aef39fe82..5af68e9b5e 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -1005,6 +1005,14 @@ void GfxMgr::setCursor(bool amigaStyleCursor) {
}
}
+void GfxMgr::setCursorPalette(bool amigaStyleCursor) {
+ if (!amigaStyleCursor) {
+ CursorMan.replaceCursorPalette(sciMouseCursorPalette, 1, ARRAYSIZE(sciMouseCursorPalette) / 4);
+ } else { // amigaStyleCursor
+ CursorMan.replaceCursorPalette(amigaMouseCursorPalette, 1, ARRAYSIZE(amigaMouseCursorPalette) / 4);
+ }
+}
+
/**
* Initialize graphics device.
*
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h
index 781c88475b..96b6247aeb 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -92,6 +92,7 @@ public:
void putBlock(int x1, int y1, int x2, int y2);
void gfxSetPalette();
void setCursor(bool amigaStyleCursor = false);
+ void setCursorPalette(bool amigaStylePalette = false);
int keypress();
int getKey();
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 1083251c91..9fd889922f 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -358,18 +358,18 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
// Change cursor
if (northIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
(event.mouse.y >= 0 && event.mouse.y <= 10)) {
- _vm->_gfx->setCursor(true);
+ _vm->_gfx->setCursorPalette(true);
} else if (southIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
(event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) {
- _vm->_gfx->setCursor(true);
+ _vm->_gfx->setCursorPalette(true);
} else if (westIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
(event.mouse.x >= 20 && event.mouse.x <= 30)) {
- _vm->_gfx->setCursor(true);
+ _vm->_gfx->setCursorPalette(true);
} else if (eastIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
(event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) {
- _vm->_gfx->setCursor(true);
+ _vm->_gfx->setCursorPalette(true);
} else {
- _vm->_gfx->setCursor(false);
+ _vm->_gfx->setCursorPalette(false);
}
}
break;
@@ -379,28 +379,28 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
(event.mouse.y >= 0 && event.mouse.y <= 10)) {
*sel0 = goIndex; *sel1 = northIndex;
drawMenu(menu, *sel0, *sel1);
- _vm->_gfx->setCursor(false);
+ _vm->_gfx->setCursorPalette(false);
clickToMove = true;
} else if (southIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
(event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) {
*sel0 = goIndex; *sel1 = southIndex;
drawMenu(menu, *sel0, *sel1);
- _vm->_gfx->setCursor(false);
+ _vm->_gfx->setCursorPalette(false);
clickToMove = true;
} else if (westIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
(event.mouse.x >= 20 && event.mouse.x <= 30)) {
*sel0 = goIndex; *sel1 = westIndex;
drawMenu(menu, *sel0, *sel1);
- _vm->_gfx->setCursor(false);
+ _vm->_gfx->setCursorPalette(false);
clickToMove = true;
} else if (eastIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
(event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) {
*sel0 = goIndex; *sel1 = eastIndex;
drawMenu(menu, *sel0, *sel1);
- _vm->_gfx->setCursor(false);
+ _vm->_gfx->setCursorPalette(false);
clickToMove = true;
} else {
- _vm->_gfx->setCursor(false);
+ _vm->_gfx->setCursorPalette(false);
}
return true;
case Common::EVENT_RBUTTONUP: