From 1ac00f210b38b88c689397d733e090583a287529 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Mon, 16 Mar 2009 09:11:51 +0000 Subject: Fixed most palette issues in BRA Amiga. svn-id: r39441 --- engines/parallaction/disk.h | 2 ++ engines/parallaction/disk_br.cpp | 47 ++++++++++++++++++++++++++++++++------ engines/parallaction/staticres.cpp | 15 +++++++++++- 3 files changed, 56 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 70680f783a..5e77d0cb97 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -253,6 +253,8 @@ protected: Sprites* createSprites(Common::ReadStream &stream); Font *createFont(const char *name, Common::SeekableReadStream &stream); void loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream); + void adjustForPalette(Graphics::Surface &surf, int move); + public: AmigaDisk_br(Parallaction *vm); diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index c35a2e7f4c..9fa3e7a701 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -31,6 +31,7 @@ namespace Parallaction { +extern byte _braAmigaFramesDefaultPalette[]; struct Sprite { uint16 size; @@ -440,6 +441,14 @@ void AmigaDisk_br::init() { _sset.add(subDirNames[i], _baseDir->getSubDirectory(subDirPrefixes[i], subDirNames[i], 2), 6); } +void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int move) { + uint size = surf.w * surf.h; + byte *data = (byte*)surf.pixels; + for (uint i = 0; i < size; i++, data++) { + *data += move; + } +} + void AmigaDisk_br::loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream) { byte *pal; @@ -447,25 +456,47 @@ void AmigaDisk_br::loadBackground(BackgroundInfo& info, Common::SeekableReadStre Graphics::ILBMDecoder decoder(stream, info.bg, pal); decoder.decode(); - uint i; + int i; info.width = info.bg.w; info.height = info.bg.h; - byte *p = pal; + /* TODO: support loading of additional palette (*.ap files), for locations which + have them. If an additional palette is present then it is used in place of + _braAmigaFramesDefaultPalette. + */ + byte r,g,b; + byte *p = _braAmigaFramesDefaultPalette; for (i = 0; i < 16; i++) { - byte r = *p >> 2; + r = *p >> 2; + p++; + g = *p >> 2; + p++; + b = *p >> 2; + p++; + info.palette.setEntry(i, r, g, b); + } + + p = pal; + for (i = 16; i < 32; i++) { + r = *p >> 2; p++; - byte g = *p >> 2; + g = *p >> 2; p++; - byte b = *p >> 2; + b = *p >> 2; p++; info.palette.setEntry(i, r, g, b); } +#if 0 + // The first entry in the palette is overwritten in the original, but I could not + // find any difference so far. + info.palette.setEntry(0, pal[0] >> 2, pal[1] >> 2, pal[2] >> 0); +#endif free(pal); - return; + // background data is drawn used the upper portion of the palette + adjustForPalette(info.bg, 16); } @@ -528,10 +559,12 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { byte *pal = 0; Graphics::Surface* surf = new Graphics::Surface; - Graphics::ILBMDecoder decoder(*stream, *surf, pal); decoder.decode(); + // static pictures are drawn used the upper half of the palette + adjustForPalette(*surf, 16); + free(pal); delete stream; diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp index 22158c026a..e33f017e54 100644 --- a/engines/parallaction/staticres.cpp +++ b/engines/parallaction/staticres.cpp @@ -49,7 +49,10 @@ byte Input::_resMouseArrow_NS[256] = { }; /* TODO: Scale this bitmap. Its 32x16, but the original scales it twice horizontally and 6 times - vertically (64x96) + vertically (64x96). + + TODO: The cursor data should be adjusted by adding 0x10 to each byte, because the bitmap + must be drawn using the background palette. */ byte Input::_resMouseArrow_BR_Amiga[512] = { @@ -87,6 +90,16 @@ byte Input::_resMouseArrow_BR_Amiga[512] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +/* + This palette snippet is used for animations in Big Red Adventure. +*/ +byte _braAmigaFramesDefaultPalette[48] = { + 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0xFF, 0xE0, 0xCF, 0x7F, 0x7F, 0x7F, 0xD9, 0x9C, 0x84, 0x00, + 0x9E, 0xF0, 0x91, 0xCC, 0x36, 0xFF, 0x6A, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0x11, 0xB0, 0xEE, + 0xF0, 0xFF, 0x17, 0x3D, 0x18, 0xAC, 0x3A, 0xB0, 0x00, 0x00, 0x7D, 0x00, 0x00, 0xFF, 0xA8, 0xFF, +}; + + byte _amigaTopazFont[2600] = { 0x00, 0x00, 0x03, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x79, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x02, 0x79, -- cgit v1.2.3