aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/palette.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-06 22:49:57 -0400
committerPaul Gilbert2014-05-06 22:49:57 -0400
commit0c079f4d6958e295a2c4d666d106c66505d55380 (patch)
treea6bb6df27d257d5b8e0c4d9765e4989b25b03db6 /engines/mads/palette.cpp
parentbd136a1c87b764de58b2e60dd8f14bb3c33dda40 (diff)
downloadscummvm-rg350-0c079f4d6958e295a2c4d666d106c66505d55380.tar.gz
scummvm-rg350-0c079f4d6958e295a2c4d666d106c66505d55380.tar.bz2
scummvm-rg350-0c079f4d6958e295a2c4d666d106c66505d55380.zip
MADS: Fixes for correctly setting up grey fading palette intensities
Diffstat (limited to 'engines/mads/palette.cpp')
-rw-r--r--engines/mads/palette.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index aa227bf8e8..6beaad9787 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -442,8 +442,8 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo
int greyAccum = 0;
int firstColor = 0;
- for (int greyCtr = 0; greyCtr < 64; greyCtr++) {
- for (int idx = 0; idx < greyTable[greyCtr]; idx++) {
+ for (int greyCtr = 0; greyCtr < 64; ++greyCtr) {
+ for (int idx = 0; idx < greyTable[greyCtr]; ++idx) {
greySum += greyList[greyScan++]._list;
++greyColors;
@@ -467,7 +467,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo
}
}
- // Process palette with intensities
+ // Set the palette range of greyscale values to be used
byte *palP = &palette[baseGrey * 3];
for (int greys = 0; greys < numGreys; ++greys) {
for (int color = 0; color < 3; ++color) {
@@ -499,9 +499,8 @@ void Fader::getGreyValues(const byte palette[PALETTE_SIZE],
void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT],
byte greyTable[64], int numColors) {
Common::fill(&greyTable[0], &greyTable[64], 0);
- for (int i = 0; i < 64; ++i) {
+ for (int i = 0; i < numColors; ++i) {
int idx = greyList[i]._list;
- assert(idx >= 0 && idx < 64);
++greyTable[idx];
}
}
@@ -645,7 +644,13 @@ void Palette::initVGAPalette(byte *palette) {
byte *destP = palette;
for (int palIndex = 0; palIndex < 16; ++palIndex) {
for (int byteCtr = 2; byteCtr >= 0; --byteCtr)
- *destP++ = ((DEFAULT_VGA_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2;
+ *destP++ = ((DEFAULT_VGA_LOW_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2;
+ }
+
+ destP = &palette[0xF0 * 3];
+ for (int palIndex = 0; palIndex < 16; ++palIndex) {
+ for (int byteCtr = 2; byteCtr >= 0; --byteCtr)
+ *destP++ = ((DEFAULT_VGA_HIGH_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2;
}
}