aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-15 23:22:30 +0100
committerJohannes Schickel2011-02-15 23:22:30 +0100
commit2b62f6bec3639ab816f6f841218d4b19f70b201e (patch)
tree5b59c5e06a506ca45af266fd945b035a012ebe61
parent2078024ee41b83f87732d9d4cdceadaba8c79609 (diff)
downloadscummvm-rg350-2b62f6bec3639ab816f6f841218d4b19f70b201e.tar.gz
scummvm-rg350-2b62f6bec3639ab816f6f841218d4b19f70b201e.tar.bz2
scummvm-rg350-2b62f6bec3639ab816f6f841218d4b19f70b201e.zip
AGOS: Adapt to setPalette RGBA->RGB change.
I only (minimally) tested this change with Simon 1 + 2 DOS CD.
-rw-r--r--engines/agos/agos.h4
-rw-r--r--engines/agos/animation.cpp2
-rw-r--r--engines/agos/debug.cpp22
-rw-r--r--engines/agos/draw.cpp12
-rw-r--r--engines/agos/gfx.cpp2
-rw-r--r--engines/agos/pn.cpp7
-rw-r--r--engines/agos/script_ff.cpp2
-rw-r--r--engines/agos/script_s1.cpp6
-rw-r--r--engines/agos/vga.cpp29
-rw-r--r--engines/agos/vga_e2.cpp7
-rw-r--r--engines/agos/vga_s1.cpp10
-rw-r--r--engines/agos/window.cpp12
12 files changed, 50 insertions, 65 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index a2962cd827..7201dfd9d3 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -529,8 +529,8 @@ protected:
uint16 _PVCount1;
uint16 _GPVCount1;
- uint8 _currentPalette[1024];
- uint8 _displayPalette[1024];
+ uint8 _currentPalette[768];
+ uint8 _displayPalette[768];
byte *_planarBuf;
byte _videoBuf1[32000];
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 4c01f6b826..d39ca377dc 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -87,7 +87,7 @@ void MoviePlayer::play() {
if (_vm->getBitFlag(41)) {
_vm->fillBackFromFront();
} else {
- uint8 palette[1024];
+ uint8 palette[768];
memset(palette, 0, sizeof(palette));
_vm->clearSurfaces();
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index cb11d65218..d0dc8cc42e 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -436,7 +436,7 @@ static const byte bmp_hdr[] = {
0x00, 0x01, 0x00, 0x00,
};
-void dumpBMP(const char *filename, int16 w, int16 h, const byte *bytes, const uint32 *palette) {
+void dumpBMP(const char *filename, int16 w, int16 h, const byte *bytes, const byte *palette) {
Common::DumpFile out;
byte my_hdr[sizeof(bmp_hdr)];
int i;
@@ -454,11 +454,11 @@ void dumpBMP(const char *filename, int16 w, int16 h, const byte *bytes, const ui
out.write(my_hdr, sizeof(my_hdr));
- for (i = 0; i != 256; i++, palette++) {
+ for (i = 0; i != 256; i++, palette += 3) {
byte color[4];
- color[0] = (byte)(*palette >> 16);
- color[1] = (byte)(*palette >> 8);
- color[2] = (byte)(*palette);
+ color[0] = palette[2];
+ color[1] = palette[1];
+ color[2] = palette[0];
color[3] = 0;
out.write(color, 4);
}
@@ -565,7 +565,7 @@ void AGOSEngine::dumpBitmap(const char *filename, const byte *offs, uint16 w, ui
}
}
- dumpBMP(filename, w, h, imageBuffer, (const uint32 *)palette);
+ dumpBMP(filename, w, h, imageBuffer, palette);
free(imageBuffer);
}
@@ -594,7 +594,7 @@ void AGOSEngine::palLoad(byte *pal, const byte *vga1, int a, int b) {
}
if (getGameType() == GType_PN && (getFeatures() & GF_EGA)) {
- memcpy(palptr, _displayPalette, 64);
+ memcpy(palptr, _displayPalette, 3 * 16);
} else if (getGameType() == GType_PN || getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
src = vga1 + READ_BE_UINT16(vga1 + 6) + b * 32;
@@ -603,9 +603,8 @@ void AGOSEngine::palLoad(byte *pal, const byte *vga1, int a, int b) {
palptr[0] = ((color & 0xf00) >> 8) * 32;
palptr[1] = ((color & 0x0f0) >> 4) * 32;
palptr[2] = ((color & 0x00f) >> 0) * 32;
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
src += 2;
} while (--num);
} else {
@@ -615,9 +614,8 @@ void AGOSEngine::palLoad(byte *pal, const byte *vga1, int a, int b) {
palptr[0] = src[0] << 2;
palptr[1] = src[1] << 2;
palptr[2] = src[2] << 2;
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
src += 3;
} while (--num);
}
@@ -627,7 +625,7 @@ void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) {
uint16 width, height, flags;
uint32 offs, curOffs = 0;
const byte *p2;
- byte pal[1024];
+ byte pal[768];
uint16 zone = (getGameType() == GType_PN) ? 0 : zoneNum;
VgaPointersEntry *vpe = &_vgaBufferPointers[zone];
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 37abe9324c..317c68d31a 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -779,8 +779,8 @@ void AGOSEngine::setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height) {
void AGOSEngine::displayScreen() {
if (_fastFadeInFlag == 0 && _paletteFlag == 1) {
_paletteFlag = 0;
- if (memcmp(_displayPalette, _currentPalette, 1024)) {
- memcpy(_currentPalette, _displayPalette, 1024);
+ if (memcmp(_displayPalette, _currentPalette, sizeof(_currentPalette))) {
+ memcpy(_currentPalette, _displayPalette, sizeof(_displayPalette));
_system->getPaletteManager()->setPalette(_displayPalette, 0, 256);
}
}
@@ -860,7 +860,7 @@ void AGOSEngine::fastFadeIn() {
slowFadeIn();
} else {
_paletteFlag = false;
- memcpy(_currentPalette, _displayPalette, 1024);
+ memcpy(_currentPalette, _displayPalette, sizeof(_displayPalette));
_system->getPaletteManager()->setPalette(_displayPalette, 0, _fastFadeInFlag);
_fastFadeInFlag = 0;
}
@@ -879,15 +879,15 @@ void AGOSEngine::slowFadeIn() {
src = _displayPalette;
dst = _currentPalette;
- for (p = _fastFadeInFlag; p !=0; p -= 3) {
+ for (p = _fastFadeInFlag; p != 0; p -= 3) {
if (src[0] >= c)
dst[0] += 4;
if (src[1] >= c)
dst[1] += 4;
if (src[2] >= c)
dst[2] += 4;
- src += 4;
- dst += 4;
+ src += 3;
+ dst += 3;
}
_system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
delay(5);
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index b784e4fcb3..710c9ddd7e 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -1041,7 +1041,7 @@ void AGOSEngine::paletteFadeOut(byte *palPtr, uint num, uint size) {
p[2] -= size;
else
p[2] = 0;
- p += 4;
+ p += 3;
} while (--num);
}
diff --git a/engines/agos/pn.cpp b/engines/agos/pn.cpp
index 7471b73d16..62d65de219 100644
--- a/engines/agos/pn.cpp
+++ b/engines/agos/pn.cpp
@@ -128,12 +128,7 @@ Common::Error AGOSEngine_PN::go() {
if (getFeatures() & GF_EGA) {
// Set EGA Palette
- for (int i = 0; i < 16; i++) {
- _displayPalette[i * 4 + 0] = egaPalette[i * 3 + 0];
- _displayPalette[i * 4 + 1] = egaPalette[i * 3 + 1];
- _displayPalette[i * 4 + 2] = egaPalette[i * 3 + 2];
- _displayPalette[i * 4 + 3] = 0;
- }
+ memcpy(_displayPalette, egaPalette, sizeof(egaPalette));
_paletteFlag = 1;
}
diff --git a/engines/agos/script_ff.cpp b/engines/agos/script_ff.cpp
index 5d640af6ad..3198b1b499 100644
--- a/engines/agos/script_ff.cpp
+++ b/engines/agos/script_ff.cpp
@@ -640,7 +640,7 @@ void AGOSEngine_Feeble::off_restartClock() {
void AGOSEngine_Feeble::off_setColor() {
// 195: set palette color
- uint16 c = getVarOrByte() * 4;
+ uint16 c = getVarOrByte() * 3;
uint8 r = getVarOrByte();
uint8 g = getVarOrByte();
uint8 b = getVarOrByte();
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 9dd1e3c5ab..05a725cb50 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -578,13 +578,13 @@ void AGOSEngine_Simon1::os1_specialFade() {
for (i = 32; i != 0; --i) {
paletteFadeOut(_currentPalette, 32, 8);
- paletteFadeOut(_currentPalette + 4 * 48, 144, 8);
- paletteFadeOut(_currentPalette + 4 * 208, 48, 8);
+ paletteFadeOut(_currentPalette + 3 * 48, 144, 8);
+ paletteFadeOut(_currentPalette + 3 * 208, 48, 8);
_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
delay(5);
}
- memcpy(_displayPalette, _currentPalette, 1024);
+ memcpy(_displayPalette, _currentPalette, sizeof(_currentPalette));
}
void AGOSEngine::scriptMouseOff() {
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 8b8b16c9bb..83ee05036c 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -935,8 +935,8 @@ void AGOSEngine::vc22_setPalette() {
if (getGameType() == GType_PN) {
if (b > 128) {
- b-= 128;
- palptr = _displayPalette + 64;
+ b -= 128;
+ palptr = _displayPalette + 3 * 16;
}
} else if (getGameType() == GType_ELVIRA1) {
if (b >= 1000) {
@@ -956,24 +956,22 @@ void AGOSEngine::vc22_setPalette() {
num = 13;
for (int i = 0; i < 19; i++) {
- palptr[(13 + i) * 4 + 0] = extraColors[i * 3 + 0] * 4;
- palptr[(13 + i) * 4 + 1] = extraColors[i * 3 + 1] * 4;
- palptr[(13 + i) * 4 + 2] = extraColors[i * 3 + 2] * 4;
- palptr[(13 + i) * 4 + 3] = 0;
+ palptr[(13 + i) * 3 + 0] = extraColors[i * 3 + 0] * 4;
+ palptr[(13 + i) * 3 + 1] = extraColors[i * 3 + 1] * 4;
+ palptr[(13 + i) * 3 + 2] = extraColors[i * 3 + 2] * 4;
}
}
}
if (getGameType() == GType_ELVIRA2 && getPlatform() == Common::kPlatformAtariST) {
// Custom palette used for icon area
- palptr = &_displayPalette[13 * 64];
+ palptr = &_displayPalette[13 * 3 * 16];
for (uint8 c = 0; c < 16; c++) {
palptr[0] = iconPalette[c * 3 + 0] * 2;
palptr[1] = iconPalette[c * 3 + 1] * 2;
palptr[2] = iconPalette[c * 3 + 2] * 2;
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
};
palptr = _displayPalette;
}
@@ -986,9 +984,8 @@ void AGOSEngine::vc22_setPalette() {
palptr[0] = ((color & 0xf00) >> 8) * 32;
palptr[1] = ((color & 0x0f0) >> 4) * 32;
palptr[2] = ((color & 0x00f) >> 0) * 32;
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
src += 2;
} while (--num);
@@ -1212,10 +1209,9 @@ void AGOSEngine::vc33_setMouseOn() {
_mouseHideCount = 1;
if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
// Set mouse palette
- _displayPalette[65 * 4 + 0] = 48 * 4;
- _displayPalette[65 * 4 + 1] = 48 * 4;
- _displayPalette[65 * 4 + 2] = 40 * 4;
- _displayPalette[65 * 4 + 3] = 0;
+ _displayPalette[65 * 3 + 0] = 48 * 4;
+ _displayPalette[65 * 3 + 1] = 48 * 4;
+ _displayPalette[65 * 3 + 2] = 40 * 4;
_paletteFlag = 1;
}
mouseOn();
@@ -1313,11 +1309,10 @@ void AGOSEngine::vc37_pokePalette() {
if (getGameType() == GType_PN && (getFeatures() & GF_EGA))
return;
- byte *palptr = _displayPalette + offs * 4;
+ byte *palptr = _displayPalette + offs * 3;
palptr[0] = ((color & 0xf00) >> 8) * 32;
palptr[1] = ((color & 0x0f0) >> 4) * 32;
palptr[2] = ((color & 0x00f) >> 0) * 32;
- palptr[3] = 0;
if (!(_videoLockOut & 0x20)) {
_paletteFlag = 1;
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index a01e79ff99..b0431db801 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.cpp
@@ -115,7 +115,7 @@ void AGOSEngine::setPaletteSlot(uint16 srcOffs, uint8 dstOffs) {
byte *offs, *palptr, *src;
uint16 num;
- palptr = _displayPalette + dstOffs * 64;
+ palptr = _displayPalette + dstOffs * 3 * 16;
offs = _curVgaFile1 + READ_BE_UINT16(_curVgaFile1 + 6);
src = offs + srcOffs * 32;
num = 16;
@@ -125,9 +125,8 @@ void AGOSEngine::setPaletteSlot(uint16 srcOffs, uint8 dstOffs) {
palptr[0] = ((color & 0xf00) >> 8) * 32;
palptr[1] = ((color & 0x0f0) >> 4) * 32;
palptr[2] = ((color & 0x00f) >> 0) * 32;
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
src += 2;
} while (--num);
@@ -371,7 +370,7 @@ void AGOSEngine::fullFade() {
if (dstPal[2] != b)
dstPal[2] += 4;
srcPal += 3;
- dstPal += 4;
+ dstPal += 3;
}
_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
delay(5);
diff --git a/engines/agos/vga_s1.cpp b/engines/agos/vga_s1.cpp
index bb13d211fe..a2306d3cdb 100644
--- a/engines/agos/vga_s1.cpp
+++ b/engines/agos/vga_s1.cpp
@@ -112,7 +112,7 @@ void AGOSEngine_Simon1::vc22_setPalette() {
num = a == 0 ? 32 : 16;
palSize = 96;
- palptr = &_displayPalette[(a * 64)];
+ palptr = &_displayPalette[(a * 3 * 16)];
}
offs = _curVgaFile1 + 6;
@@ -122,22 +122,20 @@ void AGOSEngine_Simon1::vc22_setPalette() {
palptr[0] = src[0] * 4;
palptr[1] = src[1] * 4;
palptr[2] = src[2] * 4;
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
src += 3;
} while (--num);
if (getFeatures() & GF_32COLOR) {
// Custom palette used for verb area
- palptr = &_displayPalette[(13 * 64)];
+ palptr = &_displayPalette[(13 * 3 * 16)];
for (uint8 c = 0; c < 32; c++) {
palptr[0] = customPalette[c * 3 + 0];
palptr[1] = customPalette[c * 3 + 1];
palptr[2] = customPalette[c * 3 + 2];
- palptr[3] = 0;
- palptr += 4;
+ palptr += 3;
};
}
diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp
index 54e7928f38..a03c7e178a 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.cpp
@@ -151,13 +151,13 @@ void AGOSEngine::colorWindow(WindowBlock *window) {
if (getGameType() == GType_ELVIRA2 && window->y == 146) {
if (window->fillColor == 1) {
- _displayPalette[33 * 4 + 0] = 48 * 4;
- _displayPalette[33 * 4 + 1] = 40 * 4;
- _displayPalette[33 * 4 + 2] = 32 * 4;
+ _displayPalette[33 * 3 + 0] = 48 * 4;
+ _displayPalette[33 * 3 + 1] = 40 * 4;
+ _displayPalette[33 * 3 + 2] = 32 * 4;
} else {
- _displayPalette[33 * 4 + 0] = 56 * 4;
- _displayPalette[33 * 4 + 1] = 56 * 4;
- _displayPalette[33 * 4 + 2] = 40 * 4;
+ _displayPalette[33 * 3 + 0] = 56 * 4;
+ _displayPalette[33 * 3 + 1] = 56 * 4;
+ _displayPalette[33 * 3 + 2] = 40 * 4;
}
y--;