diff options
author | Johannes Schickel | 2009-06-25 02:38:19 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-25 02:38:19 +0000 |
commit | 951e82a9219c6f536f505adea92faae5e1eb669d (patch) | |
tree | 25c20af3c3109425378906175c1b04d06fe02269 /engines | |
parent | 6e299e4777b9b3653dea75ece726ccb0f1f2d617 (diff) | |
download | scummvm-rg350-951e82a9219c6f536f505adea92faae5e1eb669d.tar.gz scummvm-rg350-951e82a9219c6f536f505adea92faae5e1eb669d.tar.bz2 scummvm-rg350-951e82a9219c6f536f505adea92faae5e1eb669d.zip |
Readd PC98 palette loading for LoL 16 color.
svn-id: r41850
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/screen.cpp | 25 | ||||
-rw-r--r-- | engines/kyra/screen.h | 10 | ||||
-rw-r--r-- | engines/kyra/sequences_lol.cpp | 1 |
3 files changed, 31 insertions, 5 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 41ac81406c..b9929bab1a 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -2831,6 +2831,8 @@ bool Screen::loadPalette(const char *filename, Palette &pal) { if (_vm->gameFlags().platform == Common::kPlatformAmiga) pal.loadAmigaPalette(*stream, stream->size() / Palette::kAmigaBytesPerColor); + else if (_vm->gameFlags().platform == Common::kPlatformPC98 && _use16ColorMode) + pal.loadPC98Palette(*stream, stream->size() / Palette::kPC98BytesPerColor); else pal.loadVGAPalette(*stream, stream->size() / Palette::kVGABytesPerColor); @@ -2870,9 +2872,11 @@ void Screen::loadPalette(const byte *data, Palette &pal, int bytes) { Common::MemoryReadStream stream(data, bytes, false); if (_vm->gameFlags().platform == Common::kPlatformAmiga) - pal.loadAmigaPalette(stream, stream.size() / 2); + pal.loadAmigaPalette(stream, stream.size() / Palette::kAmigaBytesPerColor); + else if (_vm->gameFlags().platform == Common::kPlatformPC98 && _use16ColorMode) + pal.loadPC98Palette(stream, stream.size() / Palette::kPC98BytesPerColor); else - pal.loadVGAPalette(stream, stream.size() / 3); + pal.loadVGAPalette(stream, stream.size() / Palette::kVGABytesPerColor); } // dirty rect handling @@ -3280,6 +3284,23 @@ void Palette::loadAmigaPalette(Common::ReadStream &stream, int colors) { memset(_palData + colors * 3, 0, (_numColors - colors) * 3); } +void Palette::loadPC98Palette(Common::ReadStream &stream, int colors) { + if (colors == -1) + colors = _numColors; + + assert(colors <= _numColors); + + for (int i = 0; i < colors; ++i) { + const byte g = stream.readByte(), r = stream.readByte(), b = stream.readByte(); + + _palData[i * 3 + 0] = ((r & 0x0F) * 0x3F) / 0x0F; + _palData[i * 3 + 1] = ((g & 0x0F) * 0x3F) / 0x0F; + _palData[i * 3 + 2] = ((b & 0x0F) * 0x3F) / 0x0F; + } + + memset(_palData + colors * 3, 0, (_numColors - colors) * 3); +} + void Palette::clear() { memset(_palData, 0, _numColors * 3); } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 9828704dd4..6b3a09ab34 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -74,18 +74,24 @@ public: enum { kVGABytesPerColor = 3, + kPC98BytesPerColor = 3, kAmigaBytesPerColor = 2 }; /** * Load a VGA palette from the given stream. */ - void loadVGAPalette(Common::ReadStream &stream, const int colors = -1); + void loadVGAPalette(Common::ReadStream &stream, int colors = -1); /** * Load a AMIGA palette from the given stream. */ - void loadAmigaPalette(Common::ReadStream &stream, const int colors = -1); + void loadAmigaPalette(Common::ReadStream &stream, int colors = -1); + + /** + * Load a PC98 16 color palette from the given stream. + */ + void loadPC98Palette(Common::ReadStream &stream, int colors = -1); /** * Return the number of colors this palette manages. diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index b5e909f345..871ea316b1 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -135,7 +135,6 @@ void LoLEngine::setupPrologueData(bool load) { const char * const *fileList = _flags.isTalkie ? fileListCD : (_flags.useInstallerPackage ? fileListFloppy : fileListFloppyExtracted); - char filename[32]; for (uint i = 0; fileList[i]; ++i) { filename[0] = '\0'; |