aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/actor.cpp5
-rw-r--r--scumm/costume.cpp28
-rw-r--r--scumm/gfx.cpp28
-rw-r--r--scumm/saveload.cpp11
-rw-r--r--scumm/script_v5.cpp6
-rw-r--r--scumm/scumm.h1
-rw-r--r--scumm/scummvm.cpp14
7 files changed, 58 insertions, 35 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index eeda5d8e4b..7a52d53b72 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -975,7 +975,10 @@ void Actor::drawActorCostume() {
cr._zbuf = (byte)_vm->gdi._numZBuffer;
cr._shadow_mode = shadow_mode;
- cr._shadow_table = _vm->_shadowPalette;
+ if (_vm->_features & GF_SMALL_HEADER)
+ cr._shadow_table = NULL;
+ else
+ cr._shadow_table = _vm->_shadowPalette;
cr.setCostume(costume);
cr.setPalette(palette);
diff --git a/scumm/costume.cpp b/scumm/costume.cpp
index 5763c93d9e..002a00e40f 100644
--- a/scumm/costume.cpp
+++ b/scumm/costume.cpp
@@ -385,9 +385,8 @@ void CostumeRenderer::proc6() {
do {
if (color && y < scrheight) {
pcolor = _palette[color];
- if (pcolor == 13) {
+ if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];
- }
*dst = pcolor;
}
@@ -434,7 +433,7 @@ void CostumeRenderer::proc5() {
do {
if (color && y < scrheight && !(*mask & maskbit)) {
pcolor = _palette[color];
- if (pcolor == 13)
+ if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];
*dst = pcolor;
}
@@ -496,7 +495,7 @@ void CostumeRenderer::proc4() {
do {
if (color && y < scrheight && !((*mask | mask[_imgbufoffs]) & maskbit)) {
pcolor = _palette[color];
- if (pcolor == 13)
+ if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];
*dst = pcolor;
}
@@ -559,7 +558,7 @@ void CostumeRenderer::proc3() {
if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
if (color && y < _outheight && !((*mask | mask[_imgbufoffs]) & maskbit)) {
pcolor = _palette[color];
- if (pcolor == 13)
+ if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];
*dst = pcolor;
}
@@ -620,7 +619,7 @@ void CostumeRenderer::proc2() {
if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
if (color && y < _outheight && !(*mask & maskbit)) {
pcolor = _palette[color];
- if (pcolor == 13)
+ if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];
*dst = pcolor;
}
@@ -681,7 +680,7 @@ void CostumeRenderer::proc1() {
if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
if (color && y < _outheight) {
pcolor = _palette[color];
- if (pcolor == 13)
+ if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];
*dst = pcolor;
}
@@ -737,9 +736,8 @@ void CostumeRenderer::proc6_ami() {
do {
if (color && x >= 0 && x < _vm->_realWidth) {
pcolor = _palette[color];
-/* if (pcolor == 13) {
- pcolor = _shadow_table[*dst];
- }*/
+/* if (pcolor == 13 && _shadow_table)
+ pcolor = _shadow_table[*dst];*/
*dst = pcolor;
}
@@ -786,7 +784,7 @@ void CostumeRenderer::proc5_ami() {
do {
if (color && x >=0 && x < _vm->_realWidth && !(*mask & maskbit)) {
pcolor = _palette[color];
-/* if (pcolor == 13)
+/* if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];*/
*dst = pcolor;
}
@@ -851,7 +849,7 @@ void CostumeRenderer::proc4_ami() {
do {
if (color && x >= 0 && x < _vm->_realWidth && !((*mask | mask[_imgbufoffs]) & maskbit)) {
pcolor = _palette[color];
-/* if (pcolor == 13)
+/* if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];*/
*dst = pcolor;
}
@@ -914,7 +912,7 @@ void CostumeRenderer::proc3_ami() {
if (cost_scaleTable[_scaleIndexY] < _scaleY) {
if (color && _xpos >= 0 && _xpos < _vm->_realWidth && !((*mask | mask[_imgbufoffs]) & maskbit)) {
pcolor = _palette[color];
-/* if (pcolor == 13)
+/* if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];*/
*dst = pcolor;
}
@@ -978,7 +976,7 @@ void CostumeRenderer::proc2_ami() {
if (cost_scaleTable[_scaleIndexY] < _scaleY) {
if (color && _xpos >= 0 && _xpos < _vm->_realWidth && !(*mask & maskbit)) {
pcolor = _palette[color];
-/* if (pcolor == 13)
+/* if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];*/
*dst = pcolor;
}
@@ -1046,7 +1044,7 @@ void CostumeRenderer::proc1_ami() {
if (cost_scaleTable[_scaleIndexY] < _scaleY) {
if (color && _xpos >= 0 && _xpos < _vm->_realWidth) {
pcolor = _palette[color];
-/* if (pcolor == 13)
+/* if (pcolor == 13 && _shadow_table)
pcolor = _shadow_table[*dst];*/
*dst = pcolor;
}
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 215a9047bb..08c4a0d304 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1085,8 +1085,7 @@ void Gdi::decodeStripEGA(byte *dst, byte *src, int height) {
}
const register byte colors[2] = { color >> 4, color & 0xf };
for(z = 0; z < run; z++) {
-
- *(dst + y * _vm->_realWidth + x) = _vm->_shadowPalette[ colors[z&1] ];
+ *(dst + y * _vm->_realWidth + x) = colors[z&1];
y++;
if(y >= height) {
@@ -1116,7 +1115,7 @@ void Gdi::decodeStripEGA(byte *dst, byte *src, int height) {
}
for(z = 0; z < run; z++) {
- *(dst + y * _vm->_realWidth + x) = _vm->_shadowPalette[color & 0xf];
+ *(dst + y * _vm->_realWidth + x) = color & 0xf;
y++;
if(y >= height) {
@@ -1222,7 +1221,7 @@ void Gdi::decodeStripOldEGA(byte *dst, byte *src, int height, int stripnr) {
if (run == 0) {
run = *src++;
}
- color = _vm->_shadowPalette[data & 0x0f];
+ color = data & 0x0f;
}
if (!dither) {
*ptr_dither_table = color;
@@ -1247,7 +1246,7 @@ void Gdi::decodeStripOldEGA(byte *dst, byte *src, int height, int stripnr) {
if (run == 0) {
run = *src++;
}
- color = _vm->_shadowPalette[data & 0x0f];
+ color = data & 0x0f;
}
if (!dither) {
*ptr_dither_table = color;
@@ -2665,6 +2664,25 @@ void Scumm::setShake(int mode) {
#pragma mark --- Palette ---
#pragma mark -
+void Scumm::setupEGAPalette() {
+ setPalColor( 0, 0, 0, 0);
+ setPalColor( 1, 0, 0, 168);
+ setPalColor( 2, 0, 168, 0);
+ setPalColor( 3, 0, 168, 168);
+ setPalColor( 4, 168, 0, 0);
+ setPalColor( 5, 168, 0, 168);
+ setPalColor( 6, 168, 84, 0);
+ setPalColor( 7, 168, 168, 168);
+ setPalColor( 8, 84, 84, 84);
+ setPalColor( 9, 84, 84, 168);
+ setPalColor(10, 0, 252, 0);
+ setPalColor(11, 0, 252, 252);
+ setPalColor(12, 252, 84, 84);
+ setPalColor(13, 252, 0, 252);
+ setPalColor(14, 252, 252, 0);
+ setPalColor(15, 252, 252, 252);
+}
+
void Scumm::setPaletteFromPtr(byte *ptr) {
int i;
byte *dest, r, g, b;
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 9258480bc6..79bbafde8d 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -174,8 +174,15 @@ bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr) {
initScreens(0, sb, _realWidth, sh);
_completeScreenRedraw = true;
-
- if (!(_features & GF_16COLOR))
+
+ if (_features & GF_16COLOR) {
+ // HACK: There was a time when ScummVM didn't store the
+ // palette in _currentPalette for 16-color games. To avoid
+ // breaking savegame compatibility, always set up the default
+ // palette after loading a game.
+ setupEGAPalette();
+ setDirtyColors(0, 15);
+ } else
setDirtyColors(0, 255);
_lastCodePtr = NULL;
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index e2b3231612..5f773d7f15 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1672,8 +1672,7 @@ void Scumm_v5::o5_roomOps() {
// printf("copyPalColor(%d, %d)\n", a, b);
// copyPalColor(a, b);
_shadowPalette[b] = a;
- if (!(_features & GF_16COLOR))
- setDirtyColors(b, b);
+ setDirtyColors(b, b);
} else {
error("room-color is no longer a valid command");
}
@@ -1694,8 +1693,7 @@ void Scumm_v5::o5_roomOps() {
}
checkRange(256, 0, a, "o5_roomOps: 2: Illegal room color slot (%d)");
_shadowPalette[b] = a;
- if (!(_features & GF_16COLOR))
- setDirtyColors(b, b);
+ setDirtyColors(b, b);
} else {
a = getVarOrDirectWord(0x80);
b = getVarOrDirectWord(0x40);
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 6a105e617b..8aa906ad9b 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -806,6 +806,7 @@ public:
void clampCameraPos(ScummPoint *pt);
byte *getPalettePtr();
+ void setupEGAPalette();
void setPalette(int pal);
void setPaletteFromPtr(byte *ptr);
void setPaletteFromRes();
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index e12fe32da9..afdf493cb8 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -544,13 +544,9 @@ void Scumm::scummInit() {
}
if (_features & GF_16COLOR) {
- byte pal16[16 * 4] = {
- 0, 0, 0, 0, 0, 0, 168, 0, 0, 168, 0, 0, 0, 168, 168, 0,
- 168, 0, 0, 0, 168, 0, 168, 0, 168, 84, 0, 0, 168, 168, 168, 0,
- 84, 84, 84, 0, 84, 84, 168, 0, 0, 252, 0, 0, 0, 252, 252, 0,
- 252, 84, 84, 0, 252, 0, 252, 0, 252, 252, 0, 0, 252, 252, 252, 0
- };
- _system->set_palette(pal16, 0, 16);
+ for (i = 0; i < 16; i++)
+ _shadowPalette[i] = i;
+ setupEGAPalette();
}
if (_features & GF_AFTER_V3)
@@ -981,8 +977,10 @@ void Scumm::startScene(int room, Actor * a, int objectNr) {
}
if (!(_features & GF_AFTER_V7)) {
- for (i = 0; i < 0x100; i++)
+ for (i = 0; i < 256; i++)
_shadowPalette[i] = i;
+ if (_features & GF_SMALL_HEADER)
+ setDirtyColors(0, 255);
}
clearDrawObjectQueue();