Fix room palette issues in small_header games.

Fix is only for EGA games so far.

svn-id: r9873
This commit is contained in:
Travis Howell 2003-08-27 01:12:18 +00:00
parent 6969357505
commit 06d07054c3
7 changed files with 31 additions and 17 deletions

View file

@ -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;

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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);
if (_features & GF_16COLOR) {
_roomPalette[b] = a;
} else {
_shadowPalette[b] = a;
setDirtyColors(b, b);
}
} else {
error("room-color is no longer a valid command");
}

View file

@ -1001,6 +1001,7 @@ protected:
public:
byte _proc_special_palette[256];
byte *_roomPalette;
byte *_shadowPalette;
int _midiDriver; // Use the MD_ values from mididrv.h

View file

@ -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);
}