diff options
author | Johannes Schickel | 2009-10-11 13:54:35 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-10-11 13:54:35 +0000 |
commit | 097d6d298d0f3f5a0ee73463d9c4dc8094668b67 (patch) | |
tree | b505593995d32fe3101b7092789526baa40ac091 /engines | |
parent | 6d030126d7d75f498692d8e2772d58728c6197bd (diff) | |
download | scummvm-rg350-097d6d298d0f3f5a0ee73463d9c4dc8094668b67.tar.gz scummvm-rg350-097d6d298d0f3f5a0ee73463d9c4dc8094668b67.tar.bz2 scummvm-rg350-097d6d298d0f3f5a0ee73463d9c4dc8094668b67.zip |
Print warning, when the number of colors in a palette file exceed the number of colors in the target palette on load.
svn-id: r44922
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/screen.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index dc8402ecba..a3a9e8355d 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -2919,12 +2919,22 @@ bool Screen::loadPalette(const char *filename, Palette &pal) { debugC(3, kDebugLevelScreen, "Screen::loadPalette('%s', %p)", filename, (const void *)&pal); - if (_isAmiga) - pal.loadAmigaPalette(*stream, 0, stream->size() / Palette::kAmigaBytesPerColor); - else if (_vm->gameFlags().platform == Common::kPlatformPC98 && _use16ColorMode) - pal.loadPC98Palette(*stream, 0, stream->size() / Palette::kPC98BytesPerColor); - else - pal.loadVGAPalette(*stream, 0, stream->size() / Palette::kVGABytesPerColor); + const int maxCols = pal.getNumColors(); + int numCols = 0; + + if (_isAmiga) { + numCols = stream->size() / Palette::kAmigaBytesPerColor; + pal.loadAmigaPalette(*stream, 0, MIN(maxCols, numCols)); + } else if (_vm->gameFlags().platform == Common::kPlatformPC98 && _use16ColorMode) { + numCols = stream->size() / Palette::kPC98BytesPerColor; + pal.loadPC98Palette(*stream, 0, MIN(maxCols, numCols)); + } else { + numCols = stream->size() / Palette::kVGABytesPerColor; + pal.loadVGAPalette(*stream, 0, MIN(maxCols, numCols)); + } + + if (numCols > maxCols) + warning("Palette file '%s' includes %d colors, but the target palette only support %d colors", filename, numCols, maxCols); delete stream; return true; |