From 10e2cec6b95f0e185f0522fdc7f10a076de24c7e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 20 Feb 2011 03:20:06 +0000 Subject: M4: Updated for OSystem Palette RGBA->RGB Change. --- engines/m4/dialogs.cpp | 4 ++-- engines/m4/graphics.cpp | 7 +++++-- engines/m4/graphics.h | 6 +++--- engines/m4/mads_scene.cpp | 4 ++-- engines/m4/scene.cpp | 8 ++++---- engines/m4/woodscript.cpp | 8 ++++---- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp index 101f21f48c..da828ccf5b 100644 --- a/engines/m4/dialogs.cpp +++ b/engines/m4/dialogs.cpp @@ -43,8 +43,8 @@ static void strToLower(char *s) { } const RGB8 DIALOG_PALETTE[8] = { - {0x80, 0x80, 0x80, 0xff}, {0x90, 0x90, 0x90, 0xff}, {0x70, 0x70, 0x70, 0xff}, {0x9c, 0x9c, 0x9c, 0xff}, - {0x80, 0x80, 0x80, 0xff}, {0x90, 0x90, 0x90, 0xff}, {0xDC, 0xDC, 0xDC, 0xff}, {0x00, 0x00, 0x00, 0xff} + {0x80, 0x80, 0x80}, {0x90, 0x90, 0x90}, {0x70, 0x70, 0x70}, {0x9c, 0x9c, 0x9c}, + {0x80, 0x80, 0x80}, {0x90, 0x90, 0x90}, {0xDC, 0xDC, 0xDC}, {0x00, 0x00, 0x00} }; #define ROR16(v,amt) (((uint16)(v) >> amt) | ((uint16)(v) << (16 - amt))) diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index a651510d10..5fc46d3881 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -795,7 +795,11 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) { palette[i].b = source->readByte() << 2; palette[i].g = source->readByte() << 2; palette[i].r = source->readByte() << 2; - palette[i].u = source->readByte() << 2; + // FIXME - Removed u field from RGB8 as the OSystem palette is now RGB. + // If this is needed, then the system setPalette() call will need changing to skip this. + uint8 u = source->readByte() << 2; + if (u != 0) + debugC(1, kDebugGraphics, "Unused u field in Palette data non-zero: %d", u); if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b) blackIndex = i; @@ -1049,7 +1053,6 @@ void Palette::setEntry(uint index, uint8 r, uint8 g, uint8 b) { c.r = r; c.g = g; c.b = b; - c.u = 255; g_system->getPaletteManager()->setPalette((const byte *)&c, index, 1); } diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h index ecb5048b26..d58ed69403 100644 --- a/engines/m4/graphics.h +++ b/engines/m4/graphics.h @@ -47,7 +47,7 @@ struct BGR8 { }; struct RGB8 { - uint8 r, g, b, u; + uint8 r, g, b; }; //later use ScummVM's Rect? @@ -214,8 +214,8 @@ private: MadsM4Engine *_vm; bool _colorsChanged; bool _fading_in_progress; - byte _originalPalette[256 * 4]; - byte _fadedPalette[256 * 4]; + byte _originalPalette[256 * 3]; + byte _fadedPalette[256 * 3]; int _usageCount[256]; void reset(); diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp index e88a21eb4e..4d9dcc5219 100644 --- a/engines/m4/mads_scene.cpp +++ b/engines/m4/mads_scene.cpp @@ -111,8 +111,8 @@ void MadsScene::loadSceneTemporary() { /* Existing code that eventually needs to be replaced with the proper MADS code */ // Set system palette entries _vm->_palette->blockRange(0, 18); - RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2, 0}, {0x24<<2, 0x37<<2, 0x3a<<2, 0}, - {0x00<<2, 0x10<<2, 0x16<<2, 0}}; + RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2}, {0x24<<2, 0x37<<2, 0x3a<<2}, + {0x00<<2, 0x10<<2, 0x16<<2}}; _vm->_palette->setPalette(&sysColors[0], 4, 3); _interfaceSurface->initialise(); diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp index 57d63c153a..0f684ebced 100644 --- a/engines/m4/scene.cpp +++ b/engines/m4/scene.cpp @@ -149,11 +149,11 @@ void Scene::showCodes() { for (int i = 0; i < _walkSurface->width() * _walkSurface->height(); i++) destP[i] = (srcP[i] & 0x10) ? 0xFF : 0; - byte colors[256 * 4]; + byte colors[256 * 3]; memset(colors, 0, sizeof(colors)); - colors[255 * 4 + 0] = 255; - colors[255 * 4 + 1] = 255; - colors[255 * 4 + 2] = 255; + colors[255 * 3 + 0] = 255; + colors[255 * 3 + 1] = 255; + colors[255 * 3 + 2] = 255; _vm->_palette->setPalette(colors, 0, 256); } else { // MADS handling diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp index f45e8fa8a2..1235cc9cb6 100644 --- a/engines/m4/woodscript.cpp +++ b/engines/m4/woodscript.cpp @@ -321,12 +321,12 @@ void WoodScript::update() { { // FIXME: This should be done when a new palette is set - byte palette[1024]; + byte palette[768]; g_system->getPaletteManager()->grabPalette(palette, 0, 256); for (int i = 0; i < 256; i++) { - _mainPalette[i].r = palette[i * 4 + 0]; - _mainPalette[i].g = palette[i * 4 + 1]; - _mainPalette[i].b = palette[i * 4 + 2]; + _mainPalette[i].r = palette[i * 3 + 0]; + _mainPalette[i].g = palette[i * 3 + 1]; + _mainPalette[i].b = palette[i * 3 + 2]; } } -- cgit v1.2.3