From 310bd54e64fef98438439c6966c7785764ca53b7 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 16 Aug 2011 01:23:02 -0400 Subject: SCUMM: Set the default moonbase cursor to be the default Windows cursor --- engines/scumm/cursor.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'engines/scumm/cursor.cpp') diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index a8adb4d5c5..6708d393f3 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -22,6 +22,9 @@ #include "common/system.h" #include "common/util.h" #include "graphics/cursorman.h" +#ifdef ENABLE_HE +#include "graphics/wincursor.h" +#endif #include "scumm/bomp.h" #include "scumm/charset.h" #include "scumm/he/intern_he.h" @@ -226,6 +229,45 @@ void ScummEngine_v70he::setDefaultCursor() { updateCursor(); } +#ifdef ENABLE_HE +void ScummEngine_v100he::setDefaultCursor() { + if (_game.id == GID_MOONBASE) { + // Moonbase uses the default Windows cursor instead of the usual + // default HE cursor. + Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); + + // Clear the cursor + for (int i = 0; i < 1024; i++) + WRITE_UINT16(_grabbedCursor + i * 2, 5); + + _cursor.width = cursor->getWidth(); + _cursor.height = cursor->getHeight(); + _cursor.hotspotX = cursor->getHotspotX(); + _cursor.hotspotY = cursor->getHotspotY(); + + const byte *surface = cursor->getSurface(); + const byte *palette = cursor->getPalette(); + + for (uint16 y = 0; y < _cursor.height; y++) { + for (uint16 x = 0; x < _cursor.width; x++) { + byte pixel = *surface++; + if (pixel != cursor->getKeyColor()) { + pixel -= cursor->getPaletteStartIndex(); + WRITE_UINT16(_grabbedCursor + (y * _cursor.width + x) * 2, get16BitColor(palette[pixel * 3], palette[pixel * 3 + 1], palette[pixel * 3 + 2])); + } + + } + } + + delete cursor; + + updateCursor(); + } else { + ScummEngine_v70he::setDefaultCursor(); + } +} +#endif + void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { int w, h; const byte *dataptr, *bomp; -- cgit v1.2.3 From 111d70af7d06743d61188443b2bf474f5ba64499 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 16 Aug 2011 02:44:29 -0400 Subject: SCUMM: Make the default cursor for all v80+ games be the Windows cursor --- engines/scumm/cursor.cpp | 85 +++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 44 deletions(-) (limited to 'engines/scumm/cursor.cpp') diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 6708d393f3..29b5eaedcb 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -180,12 +180,8 @@ void ScummEngine_v70he::setDefaultCursor() { 0xff, 0xff, 0xff, 0, 0, 0, }; - if (_bytesPerPixel == 2) { - for (i = 0; i < 1024; i++) - WRITE_UINT16(_grabbedCursor + i * 2, 5); - } else { - memset(_grabbedCursor, 5, sizeof(_grabbedCursor)); - } + + memset(_grabbedCursor, 5, sizeof(_grabbedCursor)); _cursor.hotspotX = _cursor.hotspotY = 2; src = default_he_cursor; @@ -198,16 +194,10 @@ void ScummEngine_v70he::setDefaultCursor() { for (j = 0; j < 32; j++) { switch ((p & (0x3 << 14)) >> 14) { case 1: - if (_bytesPerPixel == 2) - WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[4], palette[5], palette[6])); - else - _grabbedCursor[32 * i + j] = 0xfe; + _grabbedCursor[32 * i + j] = 0xfe; break; case 2: - if (_bytesPerPixel == 2) - WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[0], palette[1], palette[2])); - else - _grabbedCursor[32 * i + j] = 0xfd; + _grabbedCursor[32 * i + j] = 0xfd; break; default: break; @@ -219,52 +209,59 @@ void ScummEngine_v70he::setDefaultCursor() { } } - if (_bytesPerPixel == 1) { - // Since white color position is not guaranteed - // we setup our own palette if supported by backend - CursorMan.disableCursorPalette(false); - CursorMan.replaceCursorPalette(palette, 0xfd, 3); - } + // Since white color position is not guaranteed + // we setup our own palette if supported by backend + CursorMan.disableCursorPalette(false); + CursorMan.replaceCursorPalette(palette, 0xfd, 3); updateCursor(); } #ifdef ENABLE_HE -void ScummEngine_v100he::setDefaultCursor() { - if (_game.id == GID_MOONBASE) { - // Moonbase uses the default Windows cursor instead of the usual - // default HE cursor. - Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); +void ScummEngine_v80he::setDefaultCursor() { + // v80+ games use the default Windows cursor instead of the usual + // default HE cursor. + Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); - // Clear the cursor + // Clear the cursor + if (_bytesPerPixel == 2) { for (int i = 0; i < 1024; i++) WRITE_UINT16(_grabbedCursor + i * 2, 5); + } else { + memset(_grabbedCursor, 5, sizeof(_grabbedCursor)); + } - _cursor.width = cursor->getWidth(); - _cursor.height = cursor->getHeight(); - _cursor.hotspotX = cursor->getHotspotX(); - _cursor.hotspotY = cursor->getHotspotY(); + _cursor.width = cursor->getWidth(); + _cursor.height = cursor->getHeight(); + _cursor.hotspotX = cursor->getHotspotX(); + _cursor.hotspotY = cursor->getHotspotY(); - const byte *surface = cursor->getSurface(); - const byte *palette = cursor->getPalette(); + const byte *surface = cursor->getSurface(); + const byte *palette = cursor->getPalette(); - for (uint16 y = 0; y < _cursor.height; y++) { - for (uint16 x = 0; x < _cursor.width; x++) { - byte pixel = *surface++; - if (pixel != cursor->getKeyColor()) { - pixel -= cursor->getPaletteStartIndex(); - WRITE_UINT16(_grabbedCursor + (y * _cursor.width + x) * 2, get16BitColor(palette[pixel * 3], palette[pixel * 3 + 1], palette[pixel * 3 + 2])); - } + for (uint16 y = 0; y < _cursor.height; y++) { + for (uint16 x = 0; x < _cursor.width; x++) { + byte pixel = *surface++; + if (pixel != cursor->getKeyColor()) { + pixel -= cursor->getPaletteStartIndex(); + + if (_bytesPerPixel == 2) + WRITE_UINT16(_grabbedCursor + (y * _cursor.width + x) * 2, get16BitColor(palette[pixel * 3], palette[pixel * 3 + 1], palette[pixel * 3 + 2])); + else + _grabbedCursor[y * _cursor.width + x] = (pixel == 0) ? 0xfd : 0xfe; } } + } - delete cursor; + delete cursor; - updateCursor(); - } else { - ScummEngine_v70he::setDefaultCursor(); - } + // Since white color position is not guaranteed + // we setup our own palette if supported by backend + CursorMan.disableCursorPalette(false); + CursorMan.replaceCursorPalette(palette, 0xfd, cursor->getPaletteCount() * 3); + + updateCursor(); } #endif -- cgit v1.2.3 From ced79d8f2931098e74d6c72ec7cca43eb24c765c Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 18 Aug 2011 00:21:13 -0400 Subject: SCUMM: Fix cursor palette in the HE80+ default cursor --- engines/scumm/cursor.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'engines/scumm/cursor.cpp') diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 29b5eaedcb..6739282c9d 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -254,12 +254,14 @@ void ScummEngine_v80he::setDefaultCursor() { } } - delete cursor; + if (_bytesPerPixel == 1) { + // Since white color position is not guaranteed + // we setup our own palette if supported by backend + CursorMan.disableCursorPalette(false); + CursorMan.replaceCursorPalette(palette, 0xfd, cursor->getPaletteCount()); + } - // Since white color position is not guaranteed - // we setup our own palette if supported by backend - CursorMan.disableCursorPalette(false); - CursorMan.replaceCursorPalette(palette, 0xfd, cursor->getPaletteCount() * 3); + delete cursor; updateCursor(); } -- cgit v1.2.3