aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-13 15:44:01 +0100
committerJohannes Schickel2011-02-14 17:08:32 +0100
commit5d9e69146cef195c0b94e528bfc0a608956f34e3 (patch)
tree7cc8bb28c193a6dd0377473e3c7d7854d3733f6d
parent04d4162357d4de5f29ba65e6c373c0304a0cad6d (diff)
downloadscummvm-rg350-5d9e69146cef195c0b94e528bfc0a608956f34e3.tar.gz
scummvm-rg350-5d9e69146cef195c0b94e528bfc0a608956f34e3.tar.bz2
scummvm-rg350-5d9e69146cef195c0b94e528bfc0a608956f34e3.zip
GROOVIE: Adapt to setPalette/grabPalette RGBA->RGB change.
-rw-r--r--engines/groovie/cursor.cpp9
-rw-r--r--engines/groovie/debug.cpp4
-rw-r--r--engines/groovie/graphics.cpp14
-rw-r--r--engines/groovie/graphics.h2
-rw-r--r--engines/groovie/roq.cpp27
-rw-r--r--engines/groovie/vdx.cpp9
6 files changed, 22 insertions, 43 deletions
diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp
index 2d0a2df245..3f76ed977f 100644
--- a/engines/groovie/cursor.cpp
+++ b/engines/groovie/cursor.cpp
@@ -226,12 +226,11 @@ byte *GrvCursorMan_t7g::loadImage(Common::SeekableReadStream &file) {
}
byte *GrvCursorMan_t7g::loadPalette(Common::SeekableReadStream &file) {
- byte *palette = new byte[4 * 32];
+ byte *palette = new byte[3 * 32];
for (uint8 colournum = 0; colournum < 32; colournum++) {
- palette[colournum * 4 + 0] = file.readByte();
- palette[colournum * 4 + 1] = file.readByte();
- palette[colournum * 4 + 2] = file.readByte();
- palette[colournum * 4 + 3] = 0;
+ palette[colournum * 3 + 0] = file.readByte();
+ palette[colournum * 3 + 1] = file.readByte();
+ palette[colournum * 3 + 2] = file.readByte();
}
return palette;
}
diff --git a/engines/groovie/debug.cpp b/engines/groovie/debug.cpp
index 92afbb0115..bd4b671e11 100644
--- a/engines/groovie/debug.cpp
+++ b/engines/groovie/debug.cpp
@@ -137,11 +137,11 @@ bool Debugger::cmd_playref(int argc, const char **argv) {
bool Debugger::cmd_dumppal(int argc, const char **argv) {
uint16 i;
- byte palettedump[256 * 4];
+ byte palettedump[256 * 3];
_vm->_system->getPaletteManager()->grabPalette(palettedump, 0, 256);
for (i = 0; i < 256; i++) {
- DebugPrintf("%3d: %3d,%3d,%3d,%3d\n", i, palettedump[(i * 4)], palettedump[(i * 4) + 1], palettedump[(i * 4) + 2], palettedump[(i * 4) + 3]);
+ DebugPrintf("%3d: %3d,%3d,%3d\n", i, palettedump[(i * 3)], palettedump[(i * 3) + 1], palettedump[(i * 3) + 2]);
}
return true;
}
diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp
index 9d6da81fb6..62ab25d9d3 100644
--- a/engines/groovie/graphics.cpp
+++ b/engines/groovie/graphics.cpp
@@ -106,11 +106,7 @@ void GraphicsMan::fadeIn(byte *pal) {
_fadeStartTime = _vm->_system->getMillis();
// Copy the target palette
- for (int i = 0; i < 256; i++) {
- _paletteFull[(i * 4) + 0] = pal[(i * 3) + 0];
- _paletteFull[(i * 4) + 1] = pal[(i * 3) + 1];
- _paletteFull[(i * 4) + 2] = pal[(i * 3) + 2];
- }
+ memcpy(_paletteFull, pal, 3*256);
// Set the current fading
_fading = 1;
@@ -151,11 +147,11 @@ void GraphicsMan::applyFading(int step) {
}
// Calculate the new palette
- byte newpal[256 * 4];
+ byte newpal[256 * 3];
for (int i = 0; i < 256; i++) {
- newpal[(i * 4) + 0] = (_paletteFull[(i * 4) + 0] * factorR) / 256;
- newpal[(i * 4) + 1] = (_paletteFull[(i * 4) + 1] * factorG) / 256;
- newpal[(i * 4) + 2] = (_paletteFull[(i * 4) + 2] * factorB) / 256;
+ newpal[(i * 3) + 0] = (_paletteFull[(i * 3) + 0] * factorR) / 256;
+ newpal[(i * 3) + 1] = (_paletteFull[(i * 3) + 1] * factorG) / 256;
+ newpal[(i * 3) + 2] = (_paletteFull[(i * 3) + 2] * factorB) / 256;
}
// Set the screen palette
diff --git a/engines/groovie/graphics.h b/engines/groovie/graphics.h
index c9bade9538..a405822c9c 100644
--- a/engines/groovie/graphics.h
+++ b/engines/groovie/graphics.h
@@ -58,7 +58,7 @@ private:
// Palette fading
void applyFading(int step);
int _fading;
- byte _paletteFull[256 * 4];
+ byte _paletteFull[256 * 3];
uint32 _fadeStartTime;
};
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 540465050d..4d7157c797 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -53,46 +53,37 @@ ROQPlayer::ROQPlayer(GroovieEngine *vm) :
_prevBuf = new Graphics::Surface();
if (_vm->_mode8bit) {
- byte pal[256 * 4];
+ byte pal[256 * 3];
#ifdef DITHER
- byte pal3[256 * 3];
// Initialize to a black palette
- for (int i = 0; i < 256 * 3; i++) {
- pal3[i] = 0;
- }
+ memset(pal, 0, 256 * 3);
// Build a basic color palette
for (int r = 0; r < 4; r++) {
for (int g = 0; g < 4; g++) {
for (int b = 0; b < 4; b++) {
byte col = (r << 4) | (g << 2) | (b << 0);
- pal3[3 * col + 0] = r << 6;
- pal3[3 * col + 1] = g << 6;
- pal3[3 * col + 2] = b << 6;
+ pal[3 * col + 0] = r << 6;
+ pal[3 * col + 1] = g << 6;
+ pal[3 * col + 2] = b << 6;
}
}
}
// Initialize the dithering algorithm
_paletteLookup = new Graphics::PaletteLUT(8, Graphics::PaletteLUT::kPaletteYUV);
- _paletteLookup->setPalette(pal3, Graphics::PaletteLUT::kPaletteRGB, 8);
+ _paletteLookup->setPalette(pal, Graphics::PaletteLUT::kPaletteRGB, 8);
for (int i = 0; (i < 64) && !_vm->shouldQuit(); i++) {
debug("Groovie::ROQ: Building palette table: %02d/63", i);
_paletteLookup->buildNext();
}
- // Prepare the palette to show
- for (int i = 0; i < 256; i++) {
- pal[(i * 4) + 0] = pal3[(i * 3) + 0];
- pal[(i * 4) + 1] = pal3[(i * 3) + 1];
- pal[(i * 4) + 2] = pal3[(i * 3) + 2];
- }
#else // !DITHER
// Set a grayscale palette
for (int i = 0; i < 256; i++) {
- pal[(i * 4) + 0] = i;
- pal[(i * 4) + 1] = i;
- pal[(i * 4) + 2] = i;
+ pal[(i * 3) + 0] = i;
+ pal[(i * 3) + 1] = i;
+ pal[(i * 3) + 2] = i;
}
#endif // DITHER
diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp
index 10177dad34..1b4a2b7800 100644
--- a/engines/groovie/vdx.cpp
+++ b/engines/groovie/vdx.cpp
@@ -555,15 +555,8 @@ void VDXPlayer::setPalette(uint8 *palette) {
if (_flagSkipPalette)
return;
- uint8 palBuf[4 * 256];
debugC(7, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Setting palette");
- for (int i = 0; i < 256; i++) {
- palBuf[(i * 4) + 0] = palette[(i * 3) + 0];
- palBuf[(i * 4) + 1] = palette[(i * 3) + 1];
- palBuf[(i * 4) + 2] = palette[(i * 3) + 2];
- palBuf[(i * 4) + 3] = 0;
- }
- _syst->getPaletteManager()->setPalette(palBuf, 0, 256);
+ _syst->getPaletteManager()->setPalette(palette, 0, 256);
}
} // End of Groovie namespace