aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/engine/eobcommon.cpp2
-rw-r--r--engines/kyra/graphics/screen.cpp105
-rw-r--r--engines/kyra/graphics/screen.h8
-rw-r--r--engines/kyra/graphics/screen_eob.cpp42
-rw-r--r--engines/kyra/graphics/screen_eob.h4
-rw-r--r--engines/kyra/graphics/screen_lok.cpp26
-rw-r--r--engines/kyra/graphics/screen_lok.h1
-rw-r--r--engines/kyra/gui/gui_eob.cpp2
-rw-r--r--engines/kyra/resource/staticres.cpp2
-rw-r--r--engines/kyra/script/script_eob.cpp2
-rw-r--r--engines/kyra/sequence/sequences_darkmoon.cpp2
-rw-r--r--engines/kyra/sequence/sequences_lok.cpp2
12 files changed, 65 insertions, 133 deletions
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index eabaf4754c..e1d4a4a865 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -1682,7 +1682,7 @@ void EoBCoreEngine::drawSequenceBitmap(const char *file, int destRect, int x1, i
_screen->drawClippedLine(0, 121, 319, 121, guiSettings()->colors.fill);
_screen->setPagePixel(0, 319, 121, 9);
_screen->setCurPage(cp);
- _screen->setupDualPalettesSplitScreen(_screen->getPalette(amigaPalIndex), _screen->getPalette(7));
+ _screen->setDualPalettes(_screen->getPalette(amigaPalIndex), _screen->getPalette(7));
_dialogueFieldAmiga = true;
}
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index d9ebb4ff88..c7d16ff1e6 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -202,7 +202,7 @@ bool Screen::init() {
const int numColorsInternal = _useAmigaExtraColors ? 64 : numColors;
_use256ColorMode = (_bytesPerPixel != 2 && !_isAmiga && !_use16ColorMode && _renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA);
- _interfacePaletteEnabled = false;
+ _dualPaletteModeSplitY = 0;
_screenPalette = new Palette(numColorsInternal);
assert(_screenPalette);
@@ -351,7 +351,7 @@ void Screen::updateScreen() {
if (_useOverlays)
updateDirtyRectsOvl();
- else if (_isAmiga && _interfacePaletteEnabled)
+ else if (_isAmiga && _dualPaletteModeSplitY)
updateDirtyRectsAmiga();
else
updateDirtyRects();
@@ -385,68 +385,26 @@ void Screen::updateDirtyRects() {
void Screen::updateDirtyRectsAmiga() {
if (_forceFullUpdate) {
- _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, 136);
-
- // Page 8 is not used by Kyra 1 AMIGA, thus we can use it to adjust the colors
- copyRegion(0, 136, 0, 0, 320, 64, 0, 8, CR_NO_P_CHECK);
-
- uint8 *dst = getPagePtr(8);
- for (int y = 0; y < 64; ++y)
- for (int x = 0; x < 320; ++x)
- *dst++ += 32;
-
- _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, 0, 136, SCREEN_W, 64);
+ uint32 *pos = (uint32*)(_pagePtrs[0] + _dualPaletteModeSplitY * SCREEN_W);
+ uint16 h = (SCREEN_H - _dualPaletteModeSplitY) * (SCREEN_W >> 2);
+ while (h--)
+ *pos++ |= 0x20202020;
+ _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
} else {
- const byte *page0 = getCPagePtr(0);
Common::List<Common::Rect>::iterator it;
-
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- if (it->bottom <= 136) {
- _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
- } else {
- // Check whether the rectangle is part of both the screen and the interface
- if (it->top < 136) {
- // The rectangle covers both screen part and interface part
-
- const int screenHeight = 136 - it->top;
- const int interfaceHeight = it->bottom - 136;
-
- const int width = it->width();
- const int lineAdd = SCREEN_W - width;
-
- // Copy the screen part verbatim
- _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, width, screenHeight);
-
- // Adjust the interface part
- copyRegion(it->left, 136, 0, 0, width, interfaceHeight, 0, 8, Screen::CR_NO_P_CHECK);
-
- uint8 *dst = getPagePtr(8);
- for (int y = 0; y < interfaceHeight; ++y) {
- for (int x = 0; x < width; ++x)
- *dst++ += 32;
- dst += lineAdd;
- }
-
- _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, it->left, 136, width, interfaceHeight);
- } else {
- // The rectangle only covers the interface part
-
- const int width = it->width();
- const int height = it->height();
- const int lineAdd = SCREEN_W - width;
-
- copyRegion(it->left, it->top, 0, 0, width, height, 0, 8, Screen::CR_NO_P_CHECK);
-
- uint8 *dst = getPagePtr(8);
- for (int y = 0; y < height; ++y) {
- for (int x = 0; x < width; ++x)
- *dst++ += 32;
- dst += lineAdd;
- }
-
- _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, it->left, it->top, width, height);
+ if (it->bottom >= _dualPaletteModeSplitY) {
+ int16 startY = MAX<int16>(_dualPaletteModeSplitY, it->top);
+ int16 h = it->bottom - startY + 1;
+ int16 w = it->width();
+ uint8 *pos = _pagePtrs[0] + startY * SCREEN_W + it->left;
+ while (h--) {
+ for (int x = 0; x < w; ++x)
+ *pos++ |= 0x20;
+ pos += (SCREEN_W - w);
}
}
+ _system->copyRectToScreen(_pagePtrs[0] + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
}
}
@@ -969,8 +927,8 @@ void Screen::setScreenPalette(const Palette &pal) {
_system->getPaletteManager()->setPalette(screenPal, 0, pal.getNumColors());
}
-void Screen::enableInterfacePalette(bool e) {
- _interfacePaletteEnabled = e;
+void Screen::enableDualPaletteMode(int splitY) {
+ _dualPaletteModeSplitY = splitY;
_forceFullUpdate = true;
_dirtyRects.clear();
@@ -980,28 +938,9 @@ void Screen::enableInterfacePalette(bool e) {
updateScreen();
}
-void Screen::setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b) {
- if (!_isAmiga)
- return;
-
- uint8 screenPal[32 * 3];
-
- assert(32 <= pal.getNumColors());
-
- for (int i = 0; i < pal.getNumColors(); ++i) {
- if (i != 0x10) {
- screenPal[3 * i + 0] = (pal[i * 3 + 0] * 0xFF) / 0x3F;
- screenPal[3 * i + 1] = (pal[i * 3 + 1] * 0xFF) / 0x3F;
- screenPal[3 * i + 2] = (pal[i * 3 + 2] * 0xFF) / 0x3F;
- } else {
- screenPal[3 * i + 0] = (r * 0xFF) / 0x3F;
- screenPal[3 * i + 1] = (g * 0xFF) / 0x3F;
- screenPal[3 * i + 2] = (b * 0xFF) / 0x3F;
- }
- }
-
- _paletteChanged = true;
- _system->getPaletteManager()->setPalette(screenPal, 32, pal.getNumColors());
+void Screen::disableDualPaletteMode() {
+ _dualPaletteModeSplitY = 0;
+ _forceFullUpdate = true;
}
void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index d90e1cdfea..083409a6e6 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -453,9 +453,9 @@ public:
virtual void setScreenPalette(const Palette &pal);
// AMIGA version only
- bool isInterfacePaletteEnabled() const { return _interfacePaletteEnabled; }
- void enableInterfacePalette(bool e);
- void setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b);
+ bool isInterfacePaletteEnabled() const { return _dualPaletteModeSplitY; }
+ void enableDualPaletteMode(int splitY);
+ void disableDualPaletteMode();
virtual void getRealPalette(int num, uint8 *dst);
Palette &getPalette(int num);
@@ -716,7 +716,7 @@ protected:
int _drawShapeVar5;
// AMIGA version
- bool _interfacePaletteEnabled;
+ int _dualPaletteModeSplitY;
// debug
bool _debugEnabled;
diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp
index d1f6f2223c..6a639eede7 100644
--- a/engines/kyra/graphics/screen_eob.cpp
+++ b/engines/kyra/graphics/screen_eob.cpp
@@ -62,7 +62,7 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
_egaDitheringTempPage = 0;
_cgaMappingDefault = 0;
_cgaDitheringTables[0] = _cgaDitheringTables[1] = 0;
- _useHiResEGADithering = _dualPaletteMode = false;
+ _useHiResEGADithering = false;
_cyclePalette = 0;
_cpsFilePattern = "%s.";
_activePalCycle = 0;
@@ -189,7 +189,7 @@ void Screen_EoB::setMouseCursor(int x, int y, const byte *shape, const uint8 *ov
copyRegionToBuffer(6, 0, 0, mouseW, mouseH, cursor);
// Mouse cursor post processing for EOB II Amiga
- if (_dualPaletteMode) {
+ if (_dualPaletteModeSplitY) {
int len = mouseW * mouseH;
while (--len > -1)
cursor[len] |= 0x20;
@@ -1828,54 +1828,24 @@ void Screen_EoB::loadSpecialAmigaCPS(const char *fileName, int destPage, bool is
convertAmigaGfx(_pagePtrs[destPage], 320, 200);
}
-void Screen_EoB::setupDualPalettesSplitScreen(Palette &top, Palette &bottom) {
+void Screen_EoB::setDualPalettes(Palette &top, Palette &bottom) {
// The original supports simultaneous fading of both palettes, but doesn't make any use of that
// feature. The fade rate is always set to 0. So I see no need to implement that.
_palettes[0]->copy(top, 0, 32, 0);
_palettes[0]->copy(bottom, 0, 32, 32);
setScreenPalette(*_palettes[0]);
- _dualPaletteMode = _forceFullUpdate = true;
-}
-
-void Screen_EoB::disableDualPalettesSplitScreen() {
- _dualPaletteMode = false;
- _forceFullUpdate = true;
+ enableDualPaletteMode(120);
}
void Screen_EoB::updateDirtyRects() {
- if (!_useHiResEGADithering && !_dualPaletteMode) {
+ if (!_useHiResEGADithering) {
Screen::updateDirtyRects();
return;
}
- if (_dualPaletteMode && _forceFullUpdate) {
- uint32 *pos = (uint32*)(_pagePtrs[0] + 120 * SCREEN_W);
- uint16 h = 80 * (SCREEN_W >> 2);
- while (h--)
- *pos++ |= 0x20202020;
- _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
-
- } else if (_dualPaletteMode) {
- Common::List<Common::Rect>::iterator it;
- for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- if (it->bottom > 119) {
- int16 startY = MAX<int16>(120, it->top);
- int16 h = it->bottom - startY + 1;
- int16 w = it->width();
- uint8 *pos = _pagePtrs[0] + startY * SCREEN_W + it->left;
- while (h--) {
- for (int x = 0; x < w; ++x)
- *pos++ |= 0x20;
- pos += (SCREEN_W - w);
- }
- }
- _system->copyRectToScreen(_pagePtrs[0] + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
- }
-
- } else if (_forceFullUpdate) {
+ if (_forceFullUpdate) {
ditherRect(getCPagePtr(0), _egaDitheringTempPage, SCREEN_W * 2, SCREEN_W, SCREEN_H);
_system->copyRectToScreen(_egaDitheringTempPage, SCREEN_W * 2, 0, 0, SCREEN_W * 2, SCREEN_H * 2);
-
} else {
const uint8 *page0 = getCPagePtr(0);
Common::List<Common::Rect>::iterator it;
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index 2b0622c679..fc6c5d28aa 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -111,8 +111,7 @@ public:
// This is a simple way of emulating the Amiga copper list palette magic for more than 32 colors.
// I use colors 32 to 63 for these extra colors (which the Amiga copper sends to the color
// registers on the fly at vertical beam position 120).
- void setupDualPalettesSplitScreen(Palette &top, Palette &bottom);
- void disableDualPalettesSplitScreen();
+ void setDualPalettes(Palette &top, Palette &bottom);
private:
void updateDirtyRects();
@@ -143,7 +142,6 @@ private:
uint8 *_dsTempPage;
uint8 *_shpBuffer;
uint8 *_convertHiColorBuffer;
- bool _dualPaletteMode;
uint16 *_cgaDitheringTables[2];
const uint8 *_cgaMappingDefault;
diff --git a/engines/kyra/graphics/screen_lok.cpp b/engines/kyra/graphics/screen_lok.cpp
index ea619a6271..07180b516e 100644
--- a/engines/kyra/graphics/screen_lok.cpp
+++ b/engines/kyra/graphics/screen_lok.cpp
@@ -245,8 +245,32 @@ int Screen_LoK::getRectSize(int x, int y) {
return ((x * y) << 3);
}
+void Screen_LoK::setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b) {
+ if (!_isAmiga)
+ return;
+
+ uint8 screenPal[32 * 3];
+
+ assert(32 <= pal.getNumColors());
+
+ for (int i = 0; i < pal.getNumColors(); ++i) {
+ if (i != 0x10) {
+ screenPal[3 * i + 0] = (pal[i * 3 + 0] * 0xFF) / 0x3F;
+ screenPal[3 * i + 1] = (pal[i * 3 + 1] * 0xFF) / 0x3F;
+ screenPal[3 * i + 2] = (pal[i * 3 + 2] * 0xFF) / 0x3F;
+ } else {
+ screenPal[3 * i + 0] = (r * 0xFF) / 0x3F;
+ screenPal[3 * i + 1] = (g * 0xFF) / 0x3F;
+ screenPal[3 * i + 2] = (b * 0xFF) / 0x3F;
+ }
+ }
+
+ _paletteChanged = true;
+ _system->getPaletteManager()->setPalette(screenPal, 32, pal.getNumColors());
+}
+
void Screen_LoK::postProcessCursor(uint8 *data, int width, int height, int pitch) {
- if (_vm->gameFlags().platform == Common::kPlatformAmiga && _interfacePaletteEnabled) {
+ if (_vm->gameFlags().platform == Common::kPlatformAmiga && _dualPaletteModeSplitY) {
pitch -= width;
for (int y = 0; y < height; ++y) {
diff --git a/engines/kyra/graphics/screen_lok.h b/engines/kyra/graphics/screen_lok.h
index 34d0e2f461..dd93eac0c1 100644
--- a/engines/kyra/graphics/screen_lok.h
+++ b/engines/kyra/graphics/screen_lok.h
@@ -56,6 +56,7 @@ public:
void bitBlitRects();
// AMIGA specific
+ void setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b);
virtual void postProcessCursor(uint8 *data, int width, int height, int pitch);
protected:
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index 6c7ad4423c..77fc28d6c3 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -66,7 +66,7 @@ void EoBCoreEngine::gui_drawPlayField(bool refresh) {
if (_flags.gameID == GI_EOB1) {
_screen->getPalette(0).copy(_screen->getPalette(1), 1, 5, 1);
} else {
- _screen->setupDualPalettesSplitScreen(_screen->getPalette(6), _screen->getPalette(1));
+ _screen->setDualPalettes(_screen->getPalette(6), _screen->getPalette(1));
_screen->getPalette(7).copy(_screen->getPalette(1), 0, 32);
}
}
diff --git a/engines/kyra/resource/staticres.cpp b/engines/kyra/resource/staticres.cpp
index 29b899a9b2..5461fe3c57 100644
--- a/engines/kyra/resource/staticres.cpp
+++ b/engines/kyra/resource/staticres.cpp
@@ -970,7 +970,7 @@ void KyraEngine_LoK::loadMainScreen(int page) {
_screen->setInterfacePalette(_screen->getPalette(1), 0x3F, 0x3F, 0x3F);
// TODO: Move this to a better place
- _screen->enableInterfacePalette(true);
+ _screen->enableDualPaletteMode(136);
}
}
diff --git a/engines/kyra/script/script_eob.cpp b/engines/kyra/script/script_eob.cpp
index 8c0fb0601e..ab7cf81d61 100644
--- a/engines/kyra/script/script_eob.cpp
+++ b/engines/kyra/script/script_eob.cpp
@@ -1540,7 +1540,7 @@ int EoBInfProcessor::oeob_delay(int8 *data) {
int EoBInfProcessor::oeob_drawScene(int8 *data) {
if (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformAmiga)
- _screen->setupDualPalettesSplitScreen(_screen->getPalette(6), _screen->getPalette(7));
+ _screen->setDualPalettes(_screen->getPalette(6), _screen->getPalette(7));
_vm->drawScene(1);
return 0;
}
diff --git a/engines/kyra/sequence/sequences_darkmoon.cpp b/engines/kyra/sequence/sequences_darkmoon.cpp
index 11c7b4e44e..7d187e5a5a 100644
--- a/engines/kyra/sequence/sequences_darkmoon.cpp
+++ b/engines/kyra/sequence/sequences_darkmoon.cpp
@@ -1560,7 +1560,7 @@ void DarkmoonSequenceHelper::init(DarkmoonSequenceHelper::Mode mode) {
}
_screen->enableHiColorMode(false);
- _screen->disableDualPalettesSplitScreen();
+ _screen->disableDualPaletteMode();
int numColors = 256;
if (_vm->_flags.platform == Common::kPlatformAmiga) {
diff --git a/engines/kyra/sequence/sequences_lok.cpp b/engines/kyra/sequence/sequences_lok.cpp
index ef3cbed8d8..b50b6c9dfe 100644
--- a/engines/kyra/sequence/sequences_lok.cpp
+++ b/engines/kyra/sequence/sequences_lok.cpp
@@ -1217,7 +1217,7 @@ void KyraEngine_LoK::seq_playCredits() {
typedef Common::List<CreditsLine> CreditsLineList;
CreditsLineList lines;
- _screen->enableInterfacePalette(false);
+ _screen->disableDualPaletteMode();
_screen->hideMouse();
if (!_flags.isTalkie) {