aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/palette.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/palette.cpp')
-rw-r--r--engines/scumm/palette.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 9977436dc6..7a6be90f68 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -380,16 +380,7 @@ void ScummEngine::setAmigaPaletteFromPtr(const byte *ptr) {
_colorUsedByCycle[i] = 0;
}
- _amigaFirstUsedColor = 80;
- for (; _amigaFirstUsedColor < 256; ++_amigaFirstUsedColor) {
- // We look for the first used color here. If all color components are
- // >= 252 the color seems to be unused. Check remapPaletteColor for
- // the same behavior.
- if (ptr[_amigaFirstUsedColor * 3 + 0] <= 251
- || ptr[_amigaFirstUsedColor * 3 + 1] <= 251
- || ptr[_amigaFirstUsedColor * 3 + 2] <= 251)
- break;
- }
+ amigaPaletteFindFirstUsedColor();
for (int i = 0; i < 64; ++i) {
_amigaPalette[i * 3 + 0] = _currentPalette[(i + 16) * 3 + 0] >> 4;
@@ -424,6 +415,18 @@ void ScummEngine::setAmigaPaletteFromPtr(const byte *ptr) {
setDirtyColors(0, 255);
}
+void ScummEngine::amigaPaletteFindFirstUsedColor() {
+ for (_amigaFirstUsedColor = 80; _amigaFirstUsedColor < 256; ++_amigaFirstUsedColor) {
+ // We look for the first used color here. If all color components are
+ // >= 252 the color seems to be unused. Check remapPaletteColor for
+ // the same behavior.
+ if (_currentPalette[_amigaFirstUsedColor * 3 + 0] <= 251
+ || _currentPalette[_amigaFirstUsedColor * 3 + 1] <= 251
+ || _currentPalette[_amigaFirstUsedColor * 3 + 2] <= 251)
+ break;
+ }
+}
+
void ScummEngine::mapRoomPalette(int idx) {
// For Color 33 (which is in fact 17+16) see the special case in
// setAmigaPaletteFromPtr.