diff options
author | Jody Northup | 2009-06-05 06:41:04 +0000 |
---|---|---|
committer | Jody Northup | 2009-06-05 06:41:04 +0000 |
commit | f8361b5c53b96faddb56024bb932ce46b7005dbf (patch) | |
tree | 54235722ffac47e02e855778f129a9665481a00d /engines/scumm | |
parent | 1f43d9b860b9c1a6d5e62cc261ff5da94b42d50e (diff) | |
download | scummvm-rg350-f8361b5c53b96faddb56024bb932ce46b7005dbf.tar.gz scummvm-rg350-f8361b5c53b96faddb56024bb932ce46b7005dbf.tar.bz2 scummvm-rg350-f8361b5c53b96faddb56024bb932ce46b7005dbf.zip |
Converted cursor code to use 16-bit.
svn-id: r41191
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/costume.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/cursor.cpp | 14 | ||||
-rw-r--r-- | engines/scumm/he/wiz_he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 5 |
4 files changed, 16 insertions, 9 deletions
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index 4358e03a2a..089e7a2fbe 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -876,7 +876,7 @@ void ClassicCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) void ClassicCostumeRenderer::setPalette(uint16 *palette) { int i; - byte color; + byte color = 0; if (_loaded._format == 0x57) { for (i = 0; i < 13; i++) diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 64829114ca..66dd3807db 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -111,7 +111,13 @@ void ScummEngine_v6::setCursorTransparency(int a) { } void ScummEngine::updateCursor() { - const int transColor = (_game.heversion >= 80) ? 5 : 255; + //HACK Put the 16-bit mapped color, and + //hope no other palette entry shares it + int transColor = (_game.heversion >= 80) ? 5 : 255; + if (_game.features & GF_16BIT_COLOR && _hePalettes) + transColor = READ_LE_UINT16(_hePalettes + 2048 + transColor * 2); + else + transColor = 0; CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height, _cursor.hotspotX, _cursor.hotspotY, (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), @@ -138,7 +144,7 @@ void ScummEngine::setCursorFromBuffer(const byte *ptr, int width, int height, in uint size; byte *dst; - size = width * height; + size = width * height * _bitDepth; if (size > sizeof(_grabbedCursor)) error("grabCursor: grabbed cursor too big"); @@ -148,8 +154,8 @@ void ScummEngine::setCursorFromBuffer(const byte *ptr, int width, int height, in dst = _grabbedCursor; for (; height; height--) { - memcpy(dst, ptr, width); - dst += width; + memcpy(dst, ptr, width * _bitDepth); + dst += width * _bitDepth; ptr += pitch; } diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 8fe2639fbb..e91eb48cd4 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -1800,14 +1800,12 @@ void Wiz::loadWizCursor(int resId, int palette) { } const Common::Rect *r = NULL; - _vm->_bitDepth = 1; uint8 *cursor = drawWizImage(resId, 0, 0, 0, 0, 0, 0, r, kWIFBlitToMemBuffer, 0, _vm->getHEPaletteSlot(palette)); - _vm->_bitDepth = (_vm->_game.features & GF_16BIT_COLOR) ? 2 : 1; int32 cw, ch; getWizImageDim(resId, 0, cw, ch); _vm->setCursorHotspot(x, y); - _vm->setCursorFromBuffer(cursor, cw, ch, cw); + _vm->setCursorFromBuffer(cursor, cw, ch, cw * _vm->_bitDepth); // Since we set up cursor palette for default cursor, disable it now CursorMan.disableCursorPalette(true); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index c4b2ab9e56..5580c4c73d 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -974,7 +974,10 @@ protected: byte animate, animateIndex; int8 state; } _cursor; - byte _grabbedCursor[8192]; + + // HACK Double the array size to handle 16-bit images. + // this should be dynamically allocated based on game depth instead. + byte _grabbedCursor[16384]; byte _currentCursor; byte _newEffect, _switchRoomEffect2, _switchRoomEffect; |