diff options
author | Matthew Hoops | 2011-05-05 19:27:28 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-05 19:27:28 -0400 |
commit | 0f0ae4576e40ae7a2a7c6f23f12c2d56b52a9b75 (patch) | |
tree | 5c684cb8a3e64bd34e8b8774055477e58fdae2f4 /engines | |
parent | 4a3d94a60e74b9f1c2d48d3d739928cf9feef2c7 (diff) | |
download | scummvm-rg350-0f0ae4576e40ae7a2a7c6f23f12c2d56b52a9b75.tar.gz scummvm-rg350-0f0ae4576e40ae7a2a7c6f23f12c2d56b52a9b75.tar.bz2 scummvm-rg350-0f0ae4576e40ae7a2a7c6f23f12c2d56b52a9b75.zip |
SCI: Use new MacCursor code instead of convertCrsrCursor()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/cursor.cpp | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 3b95a5c955..d4d7dcfd4f 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -25,11 +25,11 @@ #include "common/config-manager.h" #include "common/events.h" -#include "common/macresman.h" #include "common/memstream.h" #include "common/system.h" #include "common/util.h" #include "graphics/cursorman.h" +#include "graphics/maccursor.h" #include "sci/sci.h" #include "sci/event.h" @@ -473,49 +473,19 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu assert(resource); - if (resource->size == 32 * 2 + 4) { - // Mac CURS cursor - // See http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-402.html - // for more information. - byte *cursorBitmap = new byte[16 * 16]; - byte *data = resource->data; - - // Get B&W data - for (byte i = 0; i < 32; i++) { - byte imageByte = *data++; - for (byte b = 0; b < 8; b++) - cursorBitmap[i * 8 + b] = (byte)((imageByte & (0x80 >> b)) > 0 ? 1 : 2); - } - - // Apply mask data - for (byte i = 0; i < 32; i++) { - byte imageByte = *data++; - for (byte b = 0; b < 8; b++) - if ((imageByte & (0x80 >> b)) == 0) - cursorBitmap[i * 8 + b] = 0; // Doesn't matter, just is transparent - } - - uint16 hotspotY = READ_BE_UINT16(data); - uint16 hotspotX = READ_BE_UINT16(data + 2); - - static const byte cursorPalette[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff }; - - CursorMan.replaceCursor(cursorBitmap, 16, 16, hotspotX, hotspotY, 0); - CursorMan.replaceCursorPalette(cursorPalette, 1, 2); + Common::MemoryReadStream resStream(resource->data, resource->size); + Graphics::MacCursor *macCursor = new Graphics::MacCursor(); - delete[] cursorBitmap; - } else { - // Mac crsr cursor - byte *cursorBitmap, *palette; - int width, height, hotspotX, hotspotY, palSize, keycolor; - Common::MemoryReadStream resStream(resource->data, resource->size); - Common::MacResManager::convertCrsrCursor(&resStream, &cursorBitmap, width, height, hotspotX, hotspotY, keycolor, true, &palette, palSize); - CursorMan.replaceCursor(cursorBitmap, width, height, hotspotX, hotspotY, keycolor); - CursorMan.replaceCursorPalette(palette, 0, palSize); - delete[] cursorBitmap; - delete[] palette; + if (!macCursor->readFromStream(resStream)) { + warning("Failed to load Mac cursor %d", viewNum); + return; } + CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(), + macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor()); + CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256); + + delete macCursor; kernelShow(); } |