aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-06 22:49:57 -0400
committerPaul Gilbert2014-05-06 22:49:57 -0400
commit0c079f4d6958e295a2c4d666d106c66505d55380 (patch)
treea6bb6df27d257d5b8e0c4d9765e4989b25b03db6
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
-rw-r--r--engines/mads/palette.cpp17
-rw-r--r--engines/mads/palette.h10
-rw-r--r--engines/mads/staticres.cpp7
-rw-r--r--engines/mads/staticres.h3
4 files changed, 27 insertions, 10 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;
}
}
diff --git a/engines/mads/palette.h b/engines/mads/palette.h
index 1beadd4c16..9bf5bfa830 100644
--- a/engines/mads/palette.h
+++ b/engines/mads/palette.h
@@ -220,9 +220,15 @@ public:
setPalette(&palette[0], 0, PALETTE_COUNT);
}
- int rgbMerge(byte r, byte g, byte b);
+ /**
+ * Calculates a merge/hash for a given palette entry
+ */
+ static int rgbMerge(byte r, byte g, byte b);
- int rgbMerge(RGB6 &palEntry);
+ /**
+ * Calculates a merge/hash for a given palette entry
+ */
+ static int rgbMerge(RGB6 &palEntry);
/**
* Fades the given palette to greyscale
diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp
index 396e5a13d2..189e5f72e7 100644
--- a/engines/mads/staticres.cpp
+++ b/engines/mads/staticres.cpp
@@ -45,9 +45,14 @@ const char *const kOverStr = "over";
const char *const kGameReleaseInfoStr = "ScummVM rev: 8.43 14-Sept-92";
const char *const kGameReleaseTitleStr = "GAME RELASE VERSION INFO";
-const uint32 DEFAULT_VGA_PALETTE[16] = {
+const uint32 DEFAULT_VGA_LOW_PALETTE[16] = {
0x000000, 0x0000a8, 0x00a800, 0x00a8a8, 0xa80000, 0xa800a8, 0xa85400, 0xa8a8a8,
0x545454, 0x5454fc, 0x54fc54, 0x54fcfc, 0xfc5454, 0xfc54fc, 0xfcfc54, 0xfcfcfc
};
+const uint32 DEFAULT_VGA_HIGH_PALETTE[16] = {
+ 0x2c402c, 0x2c4030, 0x2c4034, 0x2c403c, 0x2c4040, 0x2c3c40, 0x2c3440, 0x2c3040,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
+};
+
} // End of namespace MADS
diff --git a/engines/mads/staticres.h b/engines/mads/staticres.h
index 0680455028..560fd12e67 100644
--- a/engines/mads/staticres.h
+++ b/engines/mads/staticres.h
@@ -39,7 +39,8 @@ extern const char *const kOverStr;
extern const char *const kGameReleaseInfoStr;
extern const char *const kGameReleaseTitleStr;
-extern const uint32 DEFAULT_VGA_PALETTE[16];
+extern const uint32 DEFAULT_VGA_LOW_PALETTE[16];
+extern const uint32 DEFAULT_VGA_HIGH_PALETTE[16];
} // End of namespace MADS