diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index aa8bbc98acd..ffe161d8460 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -271,7 +271,8 @@ static uint8 *create_cursor(gfx_driver_t *drv, gfx_pixmap_t *pointer, int mode) for (int xc = 0; xc < pointer->index_width; xc++) { uint8 color = *src; - if (color != 255) + // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT + if (color < pointer->palette->size()) color = pointer->palette->getColor(color).parent_index; for (int scalectr = 0; scalectr < drv->mode->xfact; scalectr++) { *pos++ = color; @@ -292,7 +293,13 @@ static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common: } else { delete[] S->pointer_data; S->pointer_data = create_cursor(drv, pointer, 1); - g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y); + + // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT + uint8 color_key = GFX_CURSOR_TRANSPARENT; + if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && ((unsigned int)pointer->color_key < pointer->palette->size())) + color_key = pointer->palette->getColor(pointer->color_key).parent_index; + + g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); g_system->showMouse(true); } diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index c3abc73fefa..bfbc7299ff1 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -164,6 +164,7 @@ extern rect_t gfx_rect_fullscreen; #define GFX_PIXMAP_FLAG_PALETTIZED (1<<6) /* Indicates a palettized view */ #define GFX_PIXMAP_COLOR_KEY_NONE -1 /* No transpacency colour key */ +#define GFX_CURSOR_TRANSPARENT 255 // Cursor colour key struct gfx_pixmap_t { /* gfx_pixmap_t: Pixel map */ diff --git a/engines/sci/gfx/res_cursor.cpp b/engines/sci/gfx/res_cursor.cpp index 9a109f6ebfd..82c3b694cda 100644 --- a/engines/sci/gfx/res_cursor.cpp +++ b/engines/sci/gfx/res_cursor.cpp @@ -37,8 +37,6 @@ namespace Sci { #define GFX_SCI01_CURSOR_COLORS_NR 3 #define GFX_SCI0_CURSOR_COLORS_NR 2 -#define GFX_CURSOR_TRANSPARENT 255 - gfx_pixmap_color_t gfx_sci01_cursor_colors[GFX_SCI01_CURSOR_COLORS_NR] = { {GFX_COLOR_INDEX_UNMAPPED, 0x00, 0x00, 0x00}, {GFX_COLOR_INDEX_UNMAPPED, 0xff, 0xff, 0xff},