diff options
author | Walter van Niftrik | 2009-04-24 14:30:27 +0000 |
---|---|---|
committer | Walter van Niftrik | 2009-04-24 14:30:27 +0000 |
commit | 8d3cb3bd5f60895fe41bb515b3106d19959b98cf (patch) | |
tree | 2ec4c82fc92aeae32bf68c0f84d5cb88148f4f39 /engines | |
parent | 6f60e0dd48aea56c47af0b682ab9ddcc4fcc570b (diff) | |
download | scummvm-rg350-8d3cb3bd5f60895fe41bb515b3106d19959b98cf.tar.gz scummvm-rg350-8d3cb3bd5f60895fe41bb515b3106d19959b98cf.tar.bz2 scummvm-rg350-8d3cb3bd5f60895fe41bb515b3106d19959b98cf.zip |
SCI: Fix transparency in view-based mouse cursors.
svn-id: r40116
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gfx/gfx_driver.cpp | 11 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 1 | ||||
-rw-r--r-- | engines/sci/gfx/res_cursor.cpp | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index aa8bbc98ac..ffe161d846 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 c3abc73fef..bfbc7299ff 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 9a109f6ebf..82c3b694cd 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}, |