diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/gfx.cpp | 16 | ||||
-rw-r--r-- | scumm/resource_v2.cpp | 1 | ||||
-rw-r--r-- | scumm/resource_v3.cpp | 1 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 8 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 8 | ||||
-rw-r--r-- | scumm/scumm.h | 1 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 13 |
7 files changed, 31 insertions, 17 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 1faeda8cb2..b2cb92d8a9 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1050,7 +1050,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi run = data >> 4; dither = false; } - color = data & 0x0f; + color = _vm->_roomPalette[data & 0x0f]; if (run == 0) { run = *src++; } @@ -1346,10 +1346,10 @@ void Gdi::drawStripC64Background(byte *dst, int stripnr, int height) { height >>= 3; for (int y = 0; y < height; y++) { _C64Colors[3] = (_C64ColorMap[y + stripnr * height] & 7); - if (_vm->_shadowPalette[0] == 255) { - _vm->_shadowPalette[0] = 0; - _C64Colors[2] = _vm->_shadowPalette[2]; - _C64Colors[1] = _vm->_shadowPalette[1]; + if (_vm->_roomPalette[0] == 255) { + _vm->_roomPalette[0] = 0; + _C64Colors[2] = _vm->_roomPalette[2]; + _C64Colors[1] = _vm->_roomPalette[1]; } charIdx = _C64PicMap[y + stripnr * height] * 8; for (int i = 0; i < 8; i++) { @@ -1448,7 +1448,7 @@ void Gdi::decodeStripEGA(byte *dst, const byte *src, int height) { run = *src++; } for (z = 0; z < run; z++) { - *(dst + y * _vm->_screenWidth + x) = (z&1) ? ((color & 0xf) + _palette_mod) : ((color >> 4) + _palette_mod); + *(dst + y * _vm->_screenWidth + x) = (z&1) ? _vm->_roomPalette[((color & 0xf) + _palette_mod)] : _vm->_roomPalette[((color >> 4) + _palette_mod)]; y++; if (y >= height) { @@ -1478,7 +1478,7 @@ void Gdi::decodeStripEGA(byte *dst, const byte *src, int height) { } for (z = 0; z < run; z++) { - *(dst + y * _vm->_screenWidth + x) = (color & 0xf) + _palette_mod; + *(dst + y * _vm->_screenWidth + x) = _vm->_roomPalette[(color & 0xf) + _palette_mod]; y++; if (y >= height) { @@ -3344,7 +3344,7 @@ void Scumm::updatePalette() { for (i = _palDirtyMin; i <= _palDirtyMax; i++) { byte *data; - if (_features & GF_SMALL_HEADER && _version > 1) + if (_features & GF_SMALL_HEADER && _version > 2) data = _currentPalette + _shadowPalette[i] * 3; else data = _currentPalette + i * 3; diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp index eed764c0d7..cd62e006b3 100644 --- a/scumm/resource_v2.cpp +++ b/scumm/resource_v2.cpp @@ -197,6 +197,7 @@ void Scumm_v2::readMAXS() { _shadowPaletteSize = 256; + _roomPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later allocateArrays(); } diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp index 7ef9c958d0..bb1c5ccd21 100644 --- a/scumm/resource_v3.cpp +++ b/scumm/resource_v3.cpp @@ -207,6 +207,7 @@ void Scumm_v3::readMAXS() { _shadowPaletteSize = 256; + _roomPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later allocateArrays(); } diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 6d99852c71..a8cd5f3880 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -1334,11 +1334,11 @@ void Scumm_v2::o2_roomOps() { break; case 2: /* room color */ if (_version == 1) { - _shadowPalette[0] = 255; - _shadowPalette[1] = a; - _shadowPalette[2] = b; + _roomPalette[0] = 255; + _roomPalette[1] = a; + _roomPalette[2] = b; } else { - _shadowPalette[b] = a; + _roomPalette[b] = a; _fullRedraw = true; } break; diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 350b180b63..694c31b46c 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -1666,8 +1666,12 @@ void Scumm_v5::o5_roomOps() { // for GF_SMALL_HEADER games. Needs investigation. // printf("copyPalColor(%d, %d)\n", a, b); // copyPalColor(a, b); - _shadowPalette[b] = a; - setDirtyColors(b, b); + if (_features & GF_16COLOR) { + _roomPalette[b] = a; + } else { + _shadowPalette[b] = a; + setDirtyColors(b, b); + } } else { error("room-color is no longer a valid command"); } diff --git a/scumm/scumm.h b/scumm/scumm.h index 6e0f409063..e61a3ba92e 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1001,6 +1001,7 @@ protected: public: byte _proc_special_palette[256]; + byte *_roomPalette; byte *_shadowPalette; int _midiDriver; // Use the MD_ values from mididrv.h diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index f39418d529..a7c9d510bd 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -376,6 +376,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) _palManipPalette = NULL; _palManipIntermediatePal = NULL; memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); + _roomPalette = NULL; _shadowPalette = NULL; _shadowPaletteSize = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); @@ -723,6 +724,7 @@ Scumm::~Scumm () { delete _costumeRenderer; + free(_roomPalette); free(_shadowPalette); freeResources(); @@ -880,14 +882,16 @@ void Scumm::scummInit() { if (_version == 1) { for (i = 0; i < 16; i++) - _shadowPalette[i] = i; + _roomPalette[i] = i; if (_gameId == GID_MANIAC) setupV1ManiacPalette(); else setupV1ZakPalette(); } else if (_features & GF_16COLOR) { - for (i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { + _roomPalette[i] = i; _shadowPalette[i] = i; + } if (_features & GF_AMIGA) setupAmigaPalette(); else @@ -1786,8 +1790,11 @@ void Scumm::startScene(int room, Actor *a, int objectNr) { } if (_version < 7) { - for (i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { + if (_features & GF_SMALL_HEADER) + _roomPalette[i] = i; _shadowPalette[i] = i; + } if (_features & GF_SMALL_HEADER) setDirtyColors(0, 255); } |