aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorTravis Howell2009-10-26 12:29:57 +0000
committerTravis Howell2009-10-26 12:29:57 +0000
commitbf20d530a310c19d01be7e92143fd081819777f7 (patch)
tree1266a13ad2d9703eacb532592405492a9a7ba7db /engines/scumm
parente963dfbd172dd461bf246a09552eca5c07cb52b1 (diff)
downloadscummvm-rg350-bf20d530a310c19d01be7e92143fd081819777f7.tar.gz
scummvm-rg350-bf20d530a310c19d01be7e92143fd081819777f7.tar.bz2
scummvm-rg350-bf20d530a310c19d01be7e92143fd081819777f7.zip
Add patch from Tobias, for costume palettes in PCE version of Loom, with minor changes.
svn-id: r45403
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/costume.cpp17
-rw-r--r--engines/scumm/palette.cpp4
-rw-r--r--engines/scumm/scumm.h3
3 files changed, 16 insertions, 8 deletions
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 584e7b3269..e6e5a2829a 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -596,7 +596,7 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) {
byte *dst;
byte maskbit;
int xPos, yPos;
- uint color, width, height; //, pcolor;
+ uint pcolor, width, height;
bool masked;
int vertShift;
int xStep;
@@ -651,13 +651,13 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) {
mask = v1.mask_ptr + yPos * _numStrips + (v1.x + xPos) / 8;
maskbit = revBitMask((v1.x + xPos) % 8);
- color = block[row][col];
+ pcolor = block[row][col];
masked = (v1.y + yPos < 0 || v1.y + yPos >= _out.h) ||
(v1.x + xPos < 0 || v1.x + xPos >= _out.w) ||
(v1.mask_ptr && (mask[0] & maskbit));
- if (color && !masked) {
- WRITE_UINT16(dst, _vm->_16BitPalette[color]);
+ if (pcolor && !masked) {
+ WRITE_UINT16(dst, ((uint16*)_palette)[pcolor]);
}
xPos += xStep;
@@ -913,7 +913,14 @@ void NESCostumeRenderer::setCostume(int costume, int shadow) {
}
void PCEngineCostumeRenderer::setPalette(uint16 *palette) {
- // TODO
+ const byte* ptr = _loaded._palette;
+ byte rgb[45];
+ byte *rgbPtr = rgb;
+ _vm->readPCEPalette(&ptr, &rgbPtr, 15);
+
+ _palette[0] = 0;
+ for (int i = 0; i < 15; ++i)
+ _palette[i + 1] = _vm->get16BitColor(rgb[i * 3 + 0], rgb[i * 3 + 1], rgb[i * 3 + 2]);
}
void ClassicCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 7ab5584f9e..57b70f0bbf 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -209,7 +209,7 @@ void colorPCEToRGB(uint16 color, byte *r, byte *g, byte *b) {
*g = ((color >> 6) & 0x7) << 5;
}
-void readPalette(const byte **ptr, byte **dest, int numEntries) {
+void ScummEngine::readPCEPalette(const byte **ptr, byte **dest, int numEntries) {
byte r, g, b;
byte msbs = 0;
@@ -252,7 +252,7 @@ void ScummEngine::setPCEPaletteFromPtr(const byte *ptr) {
*dest++ = bgSpriteB;
// entry 1 - 14
- readPalette(&ptr, &dest, 14);
+ readPCEPalette(&ptr, &dest, 14);
// entry 15: DEFAULT_PALETTE[var3AE3];
*dest++ = 6 << 5;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index b136bab52d..21ad9149a8 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1031,7 +1031,7 @@ protected:
void setPaletteFromTable(const byte *ptr, int numcolor, int firstIndex = 0);
void resetPalette();
-
+
void setCurrentPalette(int pal);
void setRoomPalette(int pal, int room);
void setPCEPaletteFromPtr(const byte *ptr);
@@ -1049,6 +1049,7 @@ public:
uint8 *getHEPaletteSlot(uint16 palSlot);
uint16 get16BitColor(uint8 r, uint8 g, uint8 b);
int remapPaletteColor(int r, int g, int b, int threshold); // Used by Actor::remapActorPalette
+ void readPCEPalette(const byte **ptr, byte **dest, int numEntries);
protected:
void moveMemInPalRes(int start, int end, byte direction);
void setShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor);