Fix kyra2/kyra3 mouse cursor related regressions, introduced with r41959.

svn-id: r41960
This commit is contained in:
Johannes Schickel 2009-06-29 18:49:17 +00:00
parent 67f69bcaf2
commit cc0b30370e
4 changed files with 7 additions and 6 deletions

View file

@ -34,7 +34,8 @@
namespace Kyra {
Screen::Screen(KyraEngine_v1 *vm, OSystem *system)
: _system(system), _vm(vm), _sjisInvisibleColor(0) {
: _system(system), _vm(vm), _sjisInvisibleColor(0),
_cursorColorKey((vm->gameFlags().gameID == GI_KYRA1) ? 0xFF : 0x00) {
_debugEnabled = false;
_maskMinY = _maskMaxY = -1;
}
@ -2622,12 +2623,11 @@ void Screen::setMouseCursor(int x, int y, const byte *shape) {
y <<= 1;
mouseWidth <<= 1;
mouseHeight <<= 1;
fillRect(mouseWidth, 0, mouseWidth, mouseHeight, 255, 8);
}
uint8 *cursor = new uint8[mouseHeight * mouseWidth];
fillRect(0, 0, mouseWidth, mouseHeight, 255, 8);
fillRect(0, 0, mouseWidth, mouseHeight, _cursorColorKey, 8);
drawShape(8, shape, 0, 0, 0, 0);
int xOffset = 0;
@ -2642,7 +2642,7 @@ void Screen::setMouseCursor(int x, int y, const byte *shape) {
CursorMan.showMouse(false);
copyRegionToBuffer(8, xOffset, 0, mouseWidth, mouseHeight, cursor);
CursorMan.replaceCursor(cursor, mouseWidth, mouseHeight, x, y, 255);
CursorMan.replaceCursor(cursor, mouseWidth, mouseHeight, x, y, _cursorColorKey);
if (isMouseVisible())
CursorMan.showMouse(true);
delete[] cursor;

View file

@ -398,6 +398,7 @@ protected:
// mouse handling
int _mouseLockCount;
const uint8 _cursorColorKey;
virtual void postProcessCursor(uint8 *data, int w, int h, int pitch) {};

View file

@ -91,7 +91,7 @@ private:
void convertTo16Colors(uint8 *page, int w, int h, int pitch, int keyColor = -1);
void postProcessCursor(uint8 *data, int width, int height, int pitch) {
convertTo16Colors(data, width, height, pitch, 255);
convertTo16Colors(data, width, height, pitch, _cursorColorKey);
}
void mergeOverlay(int x, int y, int w, int h);

View file

@ -997,7 +997,7 @@ void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) {
void Screen_LoL::postProcessCursor(uint8 *data, int w, int h, int pitch) {
while (h--) {
for (int i = 0; i < w; ++i) {
if (*data != 255)
if (*data != _cursorColorKey)
*data = _paletteConvTable[*data];
++data;
}