aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-25 19:57:06 +0000
committerJohannes Schickel2009-06-25 19:57:06 +0000
commit6e69a149cd5e22e472f4bb3850d5f8b6561a138e (patch)
treec7cc24ec6095760efc422dbe11a81eb3e2d95e51 /engines
parent7a7babad77a7250369af8266ed4f28db6e004698 (diff)
downloadscummvm-rg350-6e69a149cd5e22e472f4bb3850d5f8b6561a138e.tar.gz
scummvm-rg350-6e69a149cd5e22e472f4bb3850d5f8b6561a138e.tar.bz2
scummvm-rg350-6e69a149cd5e22e472f4bb3850d5f8b6561a138e.zip
Change Screen_v2::generateOverlay to take a const Palette reference instead of a pointer.
svn-id: r41881
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_hof.cpp2
-rw-r--r--engines/kyra/kyra_mr.cpp2
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/scene_mr.cpp2
-rw-r--r--engines/kyra/screen_v2.cpp19
-rw-r--r--engines/kyra/screen_v2.h2
6 files changed, 15 insertions, 16 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 2c3907f619..e1c22d6d78 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -281,7 +281,7 @@ void KyraEngine_HoF::scrollInventoryWheel() {
int frames = movie.opened() ? movie.frames() : 6;
memcpy(_screenBuffer, _screen->getCPagePtr(2), 64000);
uint8 overlay[0x100];
- _screen->generateOverlay(_screen->getPalette(0).getData(), overlay, 0, 50);
+ _screen->generateOverlay(_screen->getPalette(0), overlay, 0, 50);
_screen->hideMouse();
_screen->copyRegion(0x46, 0x90, 0x46, 0x79, 0x71, 0x17, 0, 2, Screen::CR_NO_P_CHECK);
_screen->showMouse();
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index d0ab3808c0..4f4d77b509 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -628,7 +628,7 @@ void KyraEngine_MR::startup() {
musicUpdate(0);
_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
_paletteOverlay = new uint8[256];
- _screen->generateOverlay(_screen->getPalette(0).getData(), _paletteOverlay, 0xF0, 0x19);
+ _screen->generateOverlay(_screen->getPalette(0), _paletteOverlay, 0xF0, 0x19);
loadInterface();
musicUpdate(0);
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 216fad9122..4ac8a43ae0 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -785,8 +785,8 @@ void LoLEngine::startup() {
memset(_screen->getPalette(0).getData(), 0x3f, 0x180);
_screen->getPalette(0).copy(tmpPal, 1, 1);
memset(_screen->getPalette(0).getData() + 0x240, 0x3f, 12);
- _screen->generateOverlay(_screen->getPalette(0).getData(), _screen->_paletteOverlay1, 1, 96);
- _screen->generateOverlay(_screen->getPalette(0).getData(), _screen->_paletteOverlay2, 144, 65);
+ _screen->generateOverlay(_screen->getPalette(0), _screen->_paletteOverlay1, 1, 96);
+ _screen->generateOverlay(_screen->getPalette(0), _screen->_paletteOverlay2, 144, 65);
_screen->getPalette(0).copy(tmpPal, 0, 256);
delete[] tmpPal;
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 3f34d70867..193b4bd81a 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -342,7 +342,7 @@ void KyraEngine_MR::loadScenePal() {
palette[1] = 0;
}
- _screen->generateOverlay(_screen->getPalette(2).getData(), _paletteOverlay, 0xF0, 0x19);
+ _screen->generateOverlay(_screen->getPalette(2), _paletteOverlay, 0xF0, 0x19);
_screen->getPalette(2).copy(_costPalBuffer, _characterShapeFile * 24, 24, 144);
}
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index 1446315be5..c36055b7b7 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -38,39 +38,38 @@ Screen_v2::~Screen_v2() {
delete[] _wsaFrameAnimBuffer;
}
-uint8 *Screen_v2::generateOverlay(const uint8 *palette, uint8 *buffer, int startColor, uint16 factor) {
- if (!palette || !buffer)
+uint8 *Screen_v2::generateOverlay(const Palette &pal, uint8 *buffer, int startColor, uint16 factor) {
+ if (!buffer)
return buffer;
factor = MIN<uint16>(255, factor);
factor >>= 1;
factor &= 0xFF;
- const byte col1 = palette[startColor * 3 + 0];
- const byte col2 = palette[startColor * 3 + 1];
- const byte col3 = palette[startColor * 3 + 2];
+ const byte col1 = pal[startColor * 3 + 0];
+ const byte col2 = pal[startColor * 3 + 1];
+ const byte col3 = pal[startColor * 3 + 2];
uint8 *dst = buffer;
*dst++ = 0;
for (int i = 1; i != 255; ++i) {
uint8 processedPalette[3];
- const uint8 *src = palette + i*3;
byte col;
- col = *src++;
+ col = pal[i * 3 + 0];
col -= ((((col - col1) * factor) << 1) >> 8) & 0xFF;
processedPalette[0] = col;
- col = *src++;
+ col = pal[i * 3 + 1];
col -= ((((col - col2) * factor) << 1) >> 8) & 0xFF;
processedPalette[1] = col;
- col = *src++;
+ col = pal[i * 3 + 2];
col -= ((((col - col3) * factor) << 1) >> 8) & 0xFF;
processedPalette[2] = col;
- *dst++ = findLeastDifferentColor(processedPalette, palette+3, 255)+1;
+ *dst++ = findLeastDifferentColor(processedPalette, pal.getData() + 3, 255) + 1;
}
return buffer;
diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h
index 2906a9b5bf..6bea31fe65 100644
--- a/engines/kyra/screen_v2.h
+++ b/engines/kyra/screen_v2.h
@@ -40,7 +40,7 @@ public:
void checkedPageUpdate(int srcPage, int dstPage);
// palette handling
- uint8 *generateOverlay(const uint8 *palette, uint8 *buffer, int color, uint16 factor);
+ uint8 *generateOverlay(const Palette &pal, uint8 *buffer, int color, uint16 factor);
void applyOverlay(int x, int y, int w, int h, int pageNum, const uint8 *overlay);
int findLeastDifferentColor(const uint8 *paletteEntry, const uint8 *palette, uint16 numColors, bool skipSpecialColors = false);