aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner2011-02-20 00:37:59 +0000
committerWillem Jan Palenstijn2011-11-20 22:43:10 +0100
commite1fefefff2f2adc26cff5cc8f0c62cb210b31415 (patch)
tree4b2cbcf6501f4c2f22dbc67f151bc97db0186c8a
parente4005ae92769f345f8fe83e4c6e7f90840ca1deb (diff)
downloadscummvm-rg350-e1fefefff2f2adc26cff5cc8f0c62cb210b31415.tar.gz
scummvm-rg350-e1fefefff2f2adc26cff5cc8f0c62cb210b31415.tar.bz2
scummvm-rg350-e1fefefff2f2adc26cff5cc8f0c62cb210b31415.zip
TOLTECS: Updated For OSystem Palette RGBA->RGB Change.
-rw-r--r--engines/toltecs/palette.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/engines/toltecs/palette.cpp b/engines/toltecs/palette.cpp
index 6fc60290ac..615585814a 100644
--- a/engines/toltecs/palette.cpp
+++ b/engines/toltecs/palette.cpp
@@ -39,30 +39,28 @@ Palette::~Palette() {
}
void Palette::setFullPalette(byte *palette) {
- byte colors[1024];
+ byte colors[768];
for (int i = 0; i < 256; i++) {
- colors[i * 4 + 0] = palette[i * 3 + 0] << 2;
- colors[i * 4 + 1] = palette[i * 3 + 1] << 2;
- colors[i * 4 + 2] = palette[i * 3 + 2] << 2;
- colors[i * 4 + 3] = 255;
+ colors[i * 3 + 0] = palette[i * 3 + 0] << 2;
+ colors[i * 3 + 1] = palette[i * 3 + 1] << 2;
+ colors[i * 3 + 2] = palette[i * 3 + 2] << 2;
}
_vm->_system->getPaletteManager()->setPalette((const byte *)colors, 0, 256);
_vm->_system->updateScreen();
}
void Palette::getFullPalette(byte *palette) {
- byte colors[1024];
+ byte colors[768];
_vm->_system->getPaletteManager()->grabPalette(colors, 0, 256);
for (int i = 0; i < 256; i++) {
- palette[i * 3 + 0] = colors[i * 4 + 0] >> 2;
- palette[i * 3 + 1] = colors[i * 4 + 1] >> 2;
- palette[i * 3 + 2] = colors[i * 4 + 2] >> 2;
+ palette[i * 3 + 0] = colors[i * 3 + 0] >> 2;
+ palette[i * 3 + 1] = colors[i * 3 + 1] >> 2;
+ palette[i * 3 + 2] = colors[i * 3 + 2] >> 2;
}
}
void Palette::setDeltaPalette(byte *palette, byte mask, char deltaValue, int16 count, int16 startIndex) {
-
- byte colors[1024];
+ byte colors[768];
byte *palPtr = palette + startIndex * 3;
int16 index = startIndex, colorCount = count;
@@ -76,18 +74,17 @@ void Palette::setDeltaPalette(byte *palette, byte mask, char deltaValue, int16 c
while (count--) {
rgb = *palPtr++;
- if (mask & 1) colors[index * 4 + 0] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
+ if (mask & 1) colors[index * 3 + 0] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
rgb = *palPtr++;
- if (mask & 2) colors[index * 4 + 1] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
+ if (mask & 2) colors[index * 3 + 1] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
rgb = *palPtr++;
- if (mask & 4) colors[index * 4 + 2] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
- index++;
+ if (mask & 4) colors[index * 3 + 2] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
+ index++;
}
debug(0, "startIndex = %d; colorCount = %d", startIndex, colorCount);
_vm->_system->getPaletteManager()->setPalette((const byte *)colors, 0, 256);
-
}
void Palette::loadAddPalette(uint resIndex, byte startIndex) {