From d81bb78053453b02e36b1aa7b2a972931ddbd549 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 22 Nov 2009 08:55:36 +0000 Subject: Add patch for Tobias, for cursor palette in PCE version of Loom. svn-id: r46066 --- engines/scumm/cursor.cpp | 17 +++++++++++++++-- engines/scumm/palette.cpp | 2 +- engines/scumm/scumm.h | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 55f3af45ad..a998402474 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -44,6 +44,10 @@ static const byte default_v1_cursor_colors[4] = { 1, 1, 12, 11 }; +static const uint16 default_pce_cursor_colors[4] = { + 0x01FF, 0x016D, 0x0000, 0x0092 +}; + static const byte default_cursor_colors[4] = { 15, 15, 7, 8 }; @@ -533,13 +537,22 @@ void ScummEngine_v5::resetCursors() { void ScummEngine_v5::setBuiltinCursor(int idx) { int i, j; - byte color = default_cursor_colors[idx]; + uint16 color; const uint16 *src = _cursorImages[_currentCursor]; if (_bytesPerPixel == 2) { + if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) { + byte r, g, b; + colorPCEToRGB(default_pce_cursor_colors[idx], &r, &g, &b); + color = get16BitColor(r, g, b); + } else { + color = _16BitPalette[default_cursor_colors[idx]]; + } + for (i = 0; i < 1024; i++) WRITE_UINT16(_grabbedCursor + i * 2, 0xFF); } else { + color = default_cursor_colors[idx]; memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor)); } @@ -552,7 +565,7 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { for (j = 0; j < 16; j++) { if (src[i] & (1 << j)) { if (_bytesPerPixel == 2) - WRITE_UINT16(_grabbedCursor + 32 * i + (15 - j) * 2, _16BitPalette[color]); + WRITE_UINT16(_grabbedCursor + 32 * i + (15 - j) * 2, color); else _grabbedCursor[16 * i + 15 - j] = color; } diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 18b6b3e383..8be707c281 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -202,7 +202,7 @@ void ScummEngine::setPaletteFromTable(const byte *ptr, int numcolor, int index) setPalColor( index, ptr[0], ptr[1], ptr[2]); } -void colorPCEToRGB(uint16 color, byte *r, byte *g, byte *b) { +void ScummEngine::colorPCEToRGB(uint16 color, byte *r, byte *g, byte *b) { // 3 bits for each color component: 0xgggrrrbbb *b = ((color) & 0x7) * 0xFF / 0x7; *r = ((color >> 3) & 0x7) * 0xFF / 0x7; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 882b2023c6..d903e883af 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -1050,6 +1050,7 @@ public: uint16 get16BitColor(uint8 r, uint8 g, uint8 b); int remapPaletteColor(int r, int g, int b, int threshold); // Used by Actor::remapActorPalette void readPCEPalette(const byte **ptr, byte **dest, int numEntries); + void colorPCEToRGB(uint16 color, byte *r, byte *g, byte *b); void setPCETextPalette(uint8 color); protected: void moveMemInPalRes(int start, int end, byte direction); -- cgit v1.2.3