diff options
author | Paul Gilbert | 2008-01-01 12:58:50 +0000 |
---|---|---|
committer | Paul Gilbert | 2008-01-01 12:58:50 +0000 |
commit | e3c60fea4e44f8b82f832c83cf93254c40796c26 (patch) | |
tree | 80654a7b40417aab3607c5ec3ce54a74c58119f5 | |
parent | 87ed2bf0cb54a64d7a416f76bdf9127e6522752f (diff) | |
download | scummvm-rg350-e3c60fea4e44f8b82f832c83cf93254c40796c26.tar.gz scummvm-rg350-e3c60fea4e44f8b82f832c83cf93254c40796c26.tar.bz2 scummvm-rg350-e3c60fea4e44f8b82f832c83cf93254c40796c26.zip |
Extended PaletteCollection class to handle EGA palettes
svn-id: r30114
-rw-r--r-- | engines/lure/palette.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/engines/lure/palette.cpp b/engines/lure/palette.cpp index 59c8ad045b..653e2ce491 100644 --- a/engines/lure/palette.cpp +++ b/engines/lure/palette.cpp @@ -152,18 +152,31 @@ void Palette::copyFrom(Palette *src) { PaletteCollection::PaletteCollection(uint16 resourceId) { Disk &d = Disk::getReference(); MemoryBlock *resource = d.getEntry(resourceId); + bool isEGA = LureEngine::getReference().isEGA(); uint32 palSize; uint8 *data = resource->data(); - if (resource->size() % (SUB_PALETTE_SIZE * 3) != 0) - error("Resource #%d is not a valid palette set", resourceId); + if (isEGA) { + // EGA Palette collection - only has 1 sub-palette + if ((resource->size() != 16) && (resource->size() != 17)) + error("Resource #%d is not a valid palette set", resourceId); + + _numPalettes = 1; + _palettes = (Palette **) Memory::alloc(1 * sizeof(Palette *)); + _palettes[0] = new Palette(16, data, EGA); - palSize = SUB_PALETTE_SIZE * 3; - _numPalettes = resource->size() / palSize; + } else { + // VGA Palette collection + if (resource->size() % (SUB_PALETTE_SIZE * 3) != 0) + error("Resource #%d is not a valid palette set", resourceId); - _palettes = (Palette **) Memory::alloc(_numPalettes * sizeof(Palette *)); - for (uint8 paletteCtr = 0; paletteCtr < _numPalettes; ++paletteCtr, data += palSize) - _palettes[paletteCtr] = new Palette(SUB_PALETTE_SIZE, data, RGB64); + palSize = SUB_PALETTE_SIZE * 3; + _numPalettes = resource->size() / palSize; + + _palettes = (Palette **) Memory::alloc(_numPalettes * sizeof(Palette *)); + for (uint8 paletteCtr = 0; paletteCtr < _numPalettes; ++paletteCtr, data += palSize) + _palettes[paletteCtr] = new Palette(SUB_PALETTE_SIZE, data, RGB64); + } delete resource; } |