diff options
author | Walter van Niftrik | 2009-04-24 12:30:57 +0000 |
---|---|---|
committer | Walter van Niftrik | 2009-04-24 12:30:57 +0000 |
commit | c0805599ca3627ce0ed23dd00171a0b422bdefb7 (patch) | |
tree | ce548224c193d559cc4a85e55fc1ad4657ea5756 /engines | |
parent | df81ef750c819a483514f423599366c155057b90 (diff) | |
download | scummvm-rg350-c0805599ca3627ce0ed23dd00171a0b422bdefb7.tar.gz scummvm-rg350-c0805599ca3627ce0ed23dd00171a0b422bdefb7.tar.bz2 scummvm-rg350-c0805599ca3627ce0ed23dd00171a0b422bdefb7.zip |
SCI: Fixed mouse cursor hotspots in ECO1.
svn-id: r40110
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 3 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_driver.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_driver.h | 4 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 52 | ||||
-rw-r--r-- | engines/sci/scicore/vocab_debug.cpp | 2 |
5 files changed, 34 insertions, 33 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index a5fc6e3f65..810b99a22f 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -315,8 +315,7 @@ reg_t kSetCursorNew(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; } case 3 : { - Common::Point hotspot = Common::Point(0, 0); - GFX_ASSERT(gfxop_set_pointer_view(s->gfx_state, UKPV(0), UKPV(1), UKPV(2), &hotspot)); + GFX_ASSERT(gfxop_set_pointer_view(s->gfx_state, UKPV(0), UKPV(1), UKPV(2), NULL)); s->mouse_pointer_view = UKPV(0); s->mouse_pointer_loop = UKPV(1); s->mouse_pointer_cel = UKPV(2); diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index 95c1db3d94..aa8bbc98ac 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -286,13 +286,13 @@ static uint8 *create_cursor(gfx_driver_t *drv, gfx_pixmap_t *pointer, int mode) } -static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer) { - if (pointer == NULL) { +static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common::Point *hotspot) { + if ((pointer == NULL) || (hotspot == NULL)) { g_system->showMouse(false); } else { delete[] S->pointer_data; S->pointer_data = create_cursor(drv, pointer, 1); - g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, pointer->xoffset, pointer->yoffset); + g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y); g_system->showMouse(true); } diff --git a/engines/sci/gfx/gfx_driver.h b/engines/sci/gfx/gfx_driver.h index 84b8526b7c..a24347c1f1 100644 --- a/engines/sci/gfx/gfx_driver.h +++ b/engines/sci/gfx/gfx_driver.h @@ -251,11 +251,13 @@ struct gfx_driver_t { /* Graphics driver */ /*** Mouse pointer operations ***/ - int (*set_pointer)(gfx_driver_t *drv, gfx_pixmap_t *pointer); + int (*set_pointer)(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common::Point *hotspot); /* Sets a new mouse pointer. ** Parameters: (gfx_driver_t *) drv: The driver to modify ** (gfx_pixmap_t *) pointer: The pointer to set, or NULL to set ** no pointer + ** (Common::Point *) hotspot: The coordinates of the hotspot, + ** or NULL to set no pointer ** Returns : (int) GFX_OK or GFX_FATAL ** If pointer is not NULL, it will have been scaled to the appropriate ** size and registered as a pixmap (if neccessary) beforehand. diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index f36eb4609f..ed0e1fd415 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1185,33 +1185,32 @@ int gfxop_sleep(gfx_state_t *state, uint32 msecs) { return GFX_OK; } -int _gfxop_set_pointer(gfx_state_t *state, gfx_pixmap_t *pxm) { +static int _gfxop_set_pointer(gfx_state_t *state, gfx_pixmap_t *pxm, Common::Point *hotspot) { BASIC_CHECKS(GFX_FATAL); - state->driver->set_pointer(state->driver, pxm); + state->driver->set_pointer(state->driver, pxm, hotspot); return GFX_OK; } int gfxop_set_pointer_cursor(gfx_state_t *state, int nr) { - gfx_pixmap_t *new_pointer = NULL; - BASIC_CHECKS(GFX_FATAL); if (nr == GFXOP_NO_POINTER) - new_pointer = NULL; - else { - new_pointer = state->gfxResMan->getCursor(nr); + return _gfxop_set_pointer(state, NULL, NULL); - if (!new_pointer) { - GFXWARN("Attempt to set invalid pointer #%d\n", nr); - } + gfx_pixmap_t *new_pointer = state->gfxResMan->getCursor(nr); + + if (!new_pointer) { + GFXWARN("Attempt to set invalid pointer #%d\n", nr); + return GFX_ERROR; } - return _gfxop_set_pointer(state, new_pointer); + Common::Point p = Common::Point(new_pointer->xoffset, new_pointer->yoffset); + return _gfxop_set_pointer(state, new_pointer, &p); } -int gfxop_set_pointer_view(gfx_state_t *state, int nr, int loop, int cel, Common::Point *hotspot) { +int gfxop_set_pointer_view(gfx_state_t *state, int nr, int loop, int cel, Common::Point *hotspot) { int real_loop = loop; int real_cel = cel; gfx_pixmap_t *new_pointer = NULL; @@ -1220,24 +1219,25 @@ int gfxop_set_pointer_view(gfx_state_t *state, int nr, int loop, int cel, Common new_pointer = _gfxr_get_cel(state, nr, &real_loop, &real_cel, 0); // FIXME: For now, don't palettize pointers - if (hotspot) { - new_pointer->xoffset = hotspot->x; - new_pointer->yoffset = hotspot->y; + if (!new_pointer) { + GFXWARN("Attempt to set invalid pointer #%d\n", nr); + return GFX_ERROR; + } + + if (real_loop != loop || real_cel != cel) { + GFXDEBUG("Changed loop/cel from %d/%d to %d/%d in view %d\n", loop, cel, real_loop, real_cel, nr); } - // Special case for Eco Quest 1: The game is trying to hide the mouse cursor by clipping it, which is rejected - // by our graphics scaler. Hide the cursor when that happens instead. + // Eco Quest 1 uses a 1x1 transparent cursor to hide the cursor from the user. Some scalers don't seem to support this. if (new_pointer->width < 2 || new_pointer->height < 2) - return _gfxop_set_pointer(state, NULL); + return _gfxop_set_pointer(state, NULL, NULL); - if (!new_pointer) { - GFXWARN("Attempt to set invalid pointer #%d\n", nr); - return GFX_ERROR; - } else { - if (real_loop != loop || real_cel != cel) { - GFXDEBUG("Changed loop/cel from %d/%d to %d/%d in view %d\n", loop, cel, real_loop, real_cel, nr); - } - return _gfxop_set_pointer(state, new_pointer); + if (hotspot) + return _gfxop_set_pointer(state, new_pointer, hotspot); + else { + // Compute hotspot from xoffset/yoffset + Common::Point p = Common::Point(new_pointer->xoffset + (new_pointer->width >> 1), new_pointer->yoffset + new_pointer->height - 1); + return _gfxop_set_pointer(state, new_pointer, &p); } } diff --git a/engines/sci/scicore/vocab_debug.cpp b/engines/sci/scicore/vocab_debug.cpp index a4c0a17561..cc95b4ae3d 100644 --- a/engines/sci/scicore/vocab_debug.cpp +++ b/engines/sci/scicore/vocab_debug.cpp @@ -233,7 +233,7 @@ static const char *sci1_default_knames[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = { /*0x4e*/ "OnControl", /*0x4f*/ "InitBresen", /*0x50*/ "DoBresen", - /*0x51*/ "DoAvoider", + /*0x51*/ SCRIPT_UNKNOWN_FUNCTION_STRING, // DoAvoider is not implemented in SCI1 /*0x52*/ "SetJump", /*0x53*/ "SetDebug", /*0x54*/ "InspectObj", |