aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/default-palette.h63
-rw-r--r--backends/graphics/graphics.h4
-rw-r--r--backends/graphics/opengl/opengl-graphics.h4
-rw-r--r--backends/graphics/sdl/sdl-graphics.h5
-rw-r--r--backends/modular-backend.cpp8
-rw-r--r--backends/modular-backend.h3
-rw-r--r--backends/platform/android/android.cpp8
-rw-r--r--backends/platform/dc/dc.h7
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h10
-rw-r--r--backends/platform/iphone/osys_main.h8
-rw-r--r--backends/platform/n64/osys_n64.h8
-rw-r--r--backends/platform/ps2/systemps2.h10
-rw-r--r--backends/platform/psp/default_display_client.h2
-rw-r--r--backends/platform/psp/osys_psp.cpp4
-rw-r--r--backends/platform/psp/osys_psp.h6
-rw-r--r--backends/platform/wii/osystem.h6
-rw-r--r--common/system.cpp1
-rw-r--r--common/system.h66
-rw-r--r--engines/agi/graphics.cpp2
-rw-r--r--engines/agos/animation.cpp2
-rw-r--r--engines/agos/draw.cpp6
-rw-r--r--engines/agos/script_s1.cpp2
-rw-r--r--engines/agos/vga_e2.cpp4
-rw-r--r--engines/agos/vga_ww.cpp2
-rw-r--r--engines/cine/pal.cpp6
-rw-r--r--engines/cine/pal.h2
-rw-r--r--engines/cruise/gfxModule.cpp2
-rw-r--r--engines/draci/screen.cpp4
-rw-r--r--engines/drascula/palette.cpp2
-rw-r--r--engines/gob/util.cpp2
-rw-r--r--engines/gob/video.cpp6
-rw-r--r--engines/groovie/debug.cpp2
-rw-r--r--engines/groovie/graphics.cpp4
-rw-r--r--engines/groovie/roq.cpp2
-rw-r--r--engines/groovie/vdx.cpp2
-rw-r--r--engines/hugo/display.cpp6
-rw-r--r--engines/kyra/screen.cpp10
-rw-r--r--engines/kyra/screen_lok.cpp2
-rw-r--r--engines/kyra/screen_lol.cpp2
-rw-r--r--engines/lure/screen.cpp14
-rw-r--r--engines/m4/graphics.cpp16
-rw-r--r--engines/m4/woodscript.cpp2
-rw-r--r--engines/made/screen.cpp2
-rw-r--r--engines/mohawk/graphics.cpp4
-rw-r--r--engines/mohawk/livingbooks.cpp6
-rw-r--r--engines/mohawk/view.cpp2
-rw-r--r--engines/parallaction/graphics.cpp2
-rw-r--r--engines/queen/display.cpp2
-rw-r--r--engines/saga/gfx.cpp10
-rw-r--r--engines/sci/graphics/screen.cpp6
-rw-r--r--engines/sci/graphics/transitions.cpp4
-rw-r--r--engines/scumm/he/cup_player_he.cpp2
-rw-r--r--engines/scumm/he/palette_he.cpp2
-rw-r--r--engines/scumm/palette.cpp6
-rw-r--r--engines/scumm/smush/smush_player.cpp2
-rw-r--r--engines/sky/screen.cpp12
-rw-r--r--engines/sword1/animation.cpp2
-rw-r--r--engines/sword1/control.cpp4
-rw-r--r--engines/sword1/screen.cpp8
-rw-r--r--engines/sword2/palette.cpp2
-rw-r--r--engines/teenagent/scene.cpp2
-rw-r--r--engines/teenagent/teenagent.cpp6
-rw-r--r--engines/testbed/graphics.cpp8
-rw-r--r--engines/tinsel/palette.cpp2
-rw-r--r--engines/toon/toon.cpp8
-rw-r--r--engines/touche/touche.cpp4
-rw-r--r--engines/tucker/locations.cpp2
-rw-r--r--engines/tucker/sequences.cpp6
-rw-r--r--engines/tucker/tucker.cpp14
-rw-r--r--graphics/palette.h107
-rw-r--r--graphics/scaler/thumbnail_intern.cpp2
-rw-r--r--sound/softsynth/mt32.cpp2
-rw-r--r--video/video_decoder.cpp2
73 files changed, 367 insertions, 203 deletions
diff --git a/backends/graphics/default-palette.h b/backends/graphics/default-palette.h
new file mode 100644
index 0000000000..6e3a75350e
--- /dev/null
+++ b/backends/graphics/default-palette.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_DEFAULT_PALETTE_H
+#define BACKENDS_GRAPHICS_DEFAULT_PALETTE_H
+
+#include "graphics/palette.h"
+
+/**
+ * This is a default implementation of the PaletteManager interface
+ * which ensures that grabPalette works as specified. Of course
+ * it is still necessary to provide code that actually updates
+ * the (possibly emulated) "hardware" palette of the backend.
+ * For this purpose, implement the abstract setPaletteIntern
+ * method.
+ */
+class DefaultPaletteManager : public PaletteManager {
+protected:
+ byte _palette[4 * 256];
+
+ /**
+ * Subclasses should only implement this method and none of the others.
+ * Its semantics are like that of setPalette, only that it does not need
+ * to worry about making it possible to query the palette values once they
+ * have been set.
+ */
+ virtual void setPaletteIntern(const byte *colors, uint start, uint num) = 0;
+
+public:
+ void setPalette(const byte *colors, uint start, uint num) {
+ assert(start + num <= 256);
+ memcpy(_palette + 4 * start, colors, 4 * num);
+ setPaletteIntern(colors, start, num);
+ }
+ void grabPalette(byte *colors, uint start, uint num) {
+ assert(start + num <= 256);
+ memcpy(colors, _palette + 4 * start, 4 * num);
+ }
+};
+
+#endif
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index d2ce6534e1..953171d089 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -30,11 +30,13 @@
#include "common/noncopyable.h"
#include "common/keyboard.h"
+#include "graphics/palette.h"
+
/**
* Abstract class for graphics manager. Subclasses
* implement the real functionality.
*/
-class GraphicsManager : Common::NonCopyable {
+class GraphicsManager : public PaletteManager {
public:
virtual ~GraphicsManager() {}
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index b0334471f1..27c850f0ab 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -81,8 +81,12 @@ public:
virtual int16 getHeight();
virtual int16 getWidth();
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 6a55a3d489..0daaab104c 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -101,8 +101,13 @@ public:
virtual int16 getHeight();
virtual int16 getWidth();
+
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index df3d631007..52edcebd24 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -132,12 +132,8 @@ int16 ModularBackend::getWidth() {
return _graphicsManager->getWidth();
}
-void ModularBackend::setPalette(const byte *colors, uint start, uint num) {
- _graphicsManager->setPalette(colors, start, num);
-}
-
-void ModularBackend::grabPalette(byte *colors, uint start, uint num) {
- _graphicsManager->grabPalette(colors, start, num);
+PaletteManager *ModularBackend::getPaletteManager() {
+ return _graphicsManager;
}
void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 5b031880ed..0f9b604de4 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -87,8 +87,7 @@ public:
virtual int16 getHeight();
virtual int16 getWidth();
- virtual void setPalette(const byte *colors, uint start, uint num);
- virtual void grabPalette(byte *colors, uint start, uint num);
+ virtual PaletteManager *getPaletteManager();
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 7a4ae24e6b..b790dab036 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -153,7 +153,7 @@ static void checkGlError(const char* file, int line) {
#define CHECK_GL_ERROR() do {} while (false)
#endif
-class OSystem_Android : public BaseBackend {
+class OSystem_Android : public BaseBackend, public PaletteManager {
private:
jobject _back_ptr; // back pointer to (java) peer instance
jmethodID MID_displayMessageOnOSD;
@@ -238,8 +238,14 @@ public:
virtual int getScreenChangeID() const { return _screen_changeid; }
virtual int16 getHeight();
virtual int16 getWidth();
+
+ virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index b78e5f13df..f1d7454007 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -69,7 +69,7 @@ class DCCDManager : public DefaultAudioCDManager {
void updateCD();
};
-class OSystem_Dreamcast : private DCHardware, public BaseBackend, public FilesystemFactory {
+class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory {
public:
OSystem_Dreamcast();
@@ -98,9 +98,14 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys
int getGraphicsMode() const;
// Set colors of the palette
+ PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
void setPalette(const byte *colors, uint start, uint num);
void grabPalette(byte *colors, uint start, uint num);
+public:
+
// Determine the pixel format currently in use for screen rendering.
Graphics::PixelFormat getScreenFormat() const;
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 50a4353e18..27d75e5124 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -37,7 +37,7 @@
#include "graphics/surface.h"
#include "graphics/colormasks.h"
-class OSystem_DS : public BaseBackend {
+class OSystem_DS : public BaseBackend, public PaletteManager {
protected:
int eventNum;
@@ -92,8 +92,14 @@ public:
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
virtual int16 getHeight();
virtual int16 getWidth();
+
+ virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
- virtual void grabPalette(unsigned char *colors, uint start, uint num);
+ virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
void restoreHardwarePalette();
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index c925078b46..df01af798a 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -51,7 +51,7 @@ typedef struct AQCallbackStruct {
AudioStreamBasicDescription dataFormat;
} AQCallbackStruct;
-class OSystem_IPHONE : public BaseBackend {
+class OSystem_IPHONE : public BaseBackend, public PaletteManager {
protected:
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
@@ -132,8 +132,14 @@ public:
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
virtual int16 getHeight();
virtual int16 getWidth();
+
+ virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index f0dc6959c1..4b2164cc9f 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -75,7 +75,7 @@ enum GraphicModeID {
OVERS_MPAL_340X240
};
-class OSystem_N64 : public BaseBackend {
+class OSystem_N64 : public BaseBackend, public PaletteManager {
protected:
Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
@@ -158,8 +158,14 @@ public:
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
virtual int16 getHeight();
virtual int16 getWidth();
+
+ virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num);
+
+public:
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 78973ed3f0..37575f399f 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -54,7 +54,7 @@ namespace Audio {
class MixerImpl;
};
-class OSystem_PS2 : public BaseBackend {
+class OSystem_PS2 : public BaseBackend, public PaletteManager {
public:
OSystem_PS2(const char *elfPath);
virtual ~OSystem_PS2(void);
@@ -64,10 +64,16 @@ public:
virtual int16 getHeight(void);
virtual int16 getWidth(void);
+
+ virtual PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
virtual void setPalette(const byte *colors, uint start, uint num);
+ virtual void grabPalette(byte *colors, uint start, uint num);
+public:
+
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual void setShakePos(int shakeOffset);
- virtual void grabPalette(byte *colors, uint start, uint num);
virtual bool grabRawScreen(Graphics::Surface *surf);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h
index 2e33632eb1..c7189b0168 100644
--- a/backends/platform/psp/default_display_client.h
+++ b/backends/platform/psp/default_display_client.h
@@ -69,7 +69,7 @@ protected:
class Overlay : public DefaultDisplayClient {
public:
Overlay() {}
- ~Overlay() { }
+ ~Overlay() {}
void init();
bool allocate();
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 025edeb684..73a030f5d1 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -273,11 +273,11 @@ void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i
}
int16 OSystem_PSP::getOverlayWidth() {
- return (int16) _overlay.getWidth();
+ return (int16)_overlay.getWidth();
}
int16 OSystem_PSP::getOverlayHeight() {
- return (int16) _overlay.getHeight();
+ return (int16)_overlay.getHeight();
}
void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) {
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index d21c7e78ef..8d274bb5bd 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -44,7 +44,7 @@
#include "backends/timer/psp/timer.h"
#include "backends/platform/psp/thread.h"
-class OSystem_PSP : public BaseBackend {
+class OSystem_PSP : public BaseBackend, public PaletteManager {
private:
Common::SaveFileManager *_savefile;
@@ -94,8 +94,12 @@ public:
int16 getHeight();
// Palette related
+ PaletteManager *getPaletteManager() { return this; }
+protected:
+ // PaletteManager API
void setPalette(const byte *colors, uint start, uint num);
void grabPalette(byte *colors, uint start, uint num);
+public:
void setCursorPalette(const byte *colors, uint start, uint num);
void disableCursorPalette(bool disable);
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index ddfa905a77..9ed4b16d79 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -54,7 +54,7 @@ extern void wii_memstats(void);
}
#endif
-class OSystem_Wii : public BaseBackend {
+class OSystem_Wii : public BaseBackend, public PaletteManager {
private:
s64 _startup_time;
@@ -164,8 +164,12 @@ public:
const Graphics::PixelFormat *format);
virtual int16 getWidth();
virtual int16 getHeight();
+
+ virtual PaletteManager *getPaletteManager() { return this; }
+protected:
virtual void setPalette(const byte *colors, uint start, uint num);
virtual void grabPalette(byte *colors, uint start, uint num);
+public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual void disableCursorPalette(bool disable);
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
diff --git a/common/system.cpp b/common/system.cpp
index 81fe761f1d..1ec7c14617 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -93,4 +93,3 @@ void OSystem::logMessage(LogMessageType::Type type, const char *message) {
Common::String OSystem::getSystemLanguage() const {
return "en_US";
}
-
diff --git a/common/system.h b/common/system.h
index 52fb2dbd56..c487e727a8 100644
--- a/common/system.h
+++ b/common/system.h
@@ -31,6 +31,7 @@
#include "common/rect.h"
#include "common/list.h" // For OSystem::getSupportedFormats()
+#include "graphics/palette.h" // for PaletteManager
#include "graphics/pixelformat.h"
namespace Audio {
@@ -54,6 +55,7 @@ namespace Common {
class AudioCDManager;
class FilesystemFactory;
+class PaletteManager;
/**
* A structure describing time and date. This is a clone of struct tm
@@ -517,66 +519,10 @@ public:
virtual int16 getWidth() = 0;
/**
- * Replace the specified range of the palette with new colors.
- * The palette entries from 'start' till (start+num-1) will be replaced - so
- * a full palette update is accomplished via start=0, num=256.
- *
- * The palette data is specified in interleaved RGBA format. That is, the
- * first byte of the memory block 'colors' points at is the red component
- * of the first new color; the second byte the green component of the first
- * new color; the third byte the blue component, the last byte to the alpha
- * (transparency) value. Then the second color starts, and so on. So memory
- * looks like this: R1-G1-B1-A1-R2-G2-B2-A2-R3-...
- *
- * @param colors the new palette data, in interleaved RGBA format
- * @param start the first palette entry to be updated
- * @param num the number of palette entries to be updated
- *
- * @note It is an error if start+num exceeds 256, behaviour is undefined
- * in that case (the backend may ignore it silently or assert).
- * @note It is an error if this function gets called when the pixel format
- * in use (the return value of getScreenFormat) has more than one
- * byte per pixel.
- * @note The alpha value is not actually used, and future revisions of this
- * API are probably going to remove it.
- *
- * @see getScreenFormat
+ * Return the palette manager singleton. For more information, refer
+ * to the PaletteManager documentation.
*/
- virtual void setPalette(const byte *colors, uint start, uint num) = 0;
-
- /**
- * Grabs a specified part of the currently active palette.
- * The format is the same as for setPalette.
- *
- * This should return exactly the same RGB data as was setup via previous
- * setPalette calls.
- *
- * For example, for every valid value of start and num of the following
- * code:
- *
- * byte origPal[num*4];
- * // Setup origPal's data however you like
- * g_system->setPalette(origPal, start, num);
- * byte obtainedPal[num*4];
- * g_system->grabPalette(obtainedPal, start, num);
- *
- * the following should be true:
- *
- * For each i < num : memcmp(&origPal[i*4], &obtainedPal[i*4], 3) == 0
- * (i is an uint here)
- *
- * @see setPalette
- * @param colors the palette data, in interleaved RGBA format
- * @param start the first platte entry to be read
- * @param num the number of palette entries to be read
- *
- * @note It is an error if this function gets called when the pixel format
- * in use (the return value of getScreenFormat) has more than one
- * byte per pixel.
- *
- * @see getScreenFormat
- */
- virtual void grabPalette(byte *colors, uint start, uint num) = 0;
+ virtual PaletteManager *getPaletteManager() = 0;
/**
* Blit a bitmap to the virtual screen.
@@ -1079,7 +1025,7 @@ public:
*
* For information about POSIX locales read here:
* http://en.wikipedia.org/wiki/Locale#POSIX-type_platforms
- *
+ *
* The default implementation returns "en_US".
*
* @return locale of the system
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 3e748c85bd..7f8d99cc2f 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -806,7 +806,7 @@ void GfxMgr::initPalette(const uint8 *p, uint colorCount, uint fromBits, uint to
}
void GfxMgr::gfxSetPalette() {
- g_system->setPalette(_palette, 0, 256);
+ g_system->getPaletteManager()->setPalette(_palette, 0, 256);
}
//Gets AGIPAL Data
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 5406e9c7ef..cdb0fd2626 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -90,7 +90,7 @@ void MoviePlayer::play() {
uint8 palette[1024];
memset(palette, 0, sizeof(palette));
_vm->clearSurfaces();
- _vm->_system->setPalette(palette, 0, 256);
+ _vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
}
_vm->fillBackGroundFromBack();
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 4d32b4521d..316b4ef2bc 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -781,7 +781,7 @@ void AGOSEngine::displayScreen() {
_paletteFlag = 0;
if (memcmp(_displayPalette, _currentPalette, 1024)) {
memcpy(_currentPalette, _displayPalette, 1024);
- _system->setPalette(_displayPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_displayPalette, 0, 256);
}
}
@@ -861,7 +861,7 @@ void AGOSEngine::fastFadeIn() {
} else {
_paletteFlag = false;
memcpy(_currentPalette, _displayPalette, 1024);
- _system->setPalette(_displayPalette, 0, _fastFadeInFlag);
+ _system->getPaletteManager()->setPalette(_displayPalette, 0, _fastFadeInFlag);
_fastFadeInFlag = 0;
}
}
@@ -889,7 +889,7 @@ void AGOSEngine::slowFadeIn() {
src += 4;
dst += 4;
}
- _system->setPalette(_currentPalette, 0, _fastFadeCount);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
delay(5);
}
_fastFadeInFlag = 0;
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 64d1cbba3f..9dd1e3c5ab 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -580,7 +580,7 @@ void AGOSEngine_Simon1::os1_specialFade() {
paletteFadeOut(_currentPalette, 32, 8);
paletteFadeOut(_currentPalette + 4 * 48, 144, 8);
paletteFadeOut(_currentPalette + 4 * 208, 48, 8);
- _system->setPalette(_currentPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
delay(5);
}
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index 54ec45b967..ea805c362c 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.cpp
@@ -373,7 +373,7 @@ void AGOSEngine::fullFade() {
srcPal += 3;
dstPal += 4;
}
- _system->setPalette(_currentPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
delay(5);
}
}
@@ -395,7 +395,7 @@ void AGOSEngine::vc56_fullScreen() {
void AGOSEngine::vc57_blackPalette() {
memset(_currentPalette, 0, sizeof(_currentPalette));
- _system->setPalette(_currentPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
}
void AGOSEngine::vc58_checkCodeWheel() {
diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp
index afc05f7869..8aecd3448a 100644
--- a/engines/agos/vga_ww.cpp
+++ b/engines/agos/vga_ww.cpp
@@ -224,7 +224,7 @@ void AGOSEngine::vc62_fastFadeOut() {
for (i = fadeCount; i != 0; --i) {
paletteFadeOut(_currentPalette, _fastFadeCount, fadeSize);
- _system->setPalette(_currentPalette, 0, _fastFadeCount);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
delay(5);
}
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 2109c15389..a074bd3f09 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -26,7 +26,7 @@
#include "cine/cine.h"
#include "cine/various.h"
#include "cine/pal.h"
-#include "common/system.h" // For g_system->setPalette
+#include "common/system.h" // For g_system->getPaletteManager()->setPalette
namespace Cine {
@@ -196,9 +196,9 @@ void Palette::setGlobalOSystemPalette() const {
for (uint i = 0; i < 16 * 4; ++i)
buf[16 * 4 + i] = buf[i] >> 1;
- g_system->setPalette(buf, 0, colorCount() * 2);
+ g_system->getPaletteManager()->setPalette(buf, 0, colorCount() * 2);
} else {
- g_system->setPalette(buf, 0, colorCount());
+ g_system->getPaletteManager()->setPalette(buf, 0, colorCount());
}
}
diff --git a/engines/cine/pal.h b/engines/cine/pal.h
index e5b318b24d..58d23e5bf0 100644
--- a/engines/cine/pal.h
+++ b/engines/cine/pal.h
@@ -159,7 +159,7 @@ public:
/** The original color format in which this palette was loaded. */
const Graphics::PixelFormat &colorFormat() const;
- /** Sets current palette to global OSystem's palette using g_system->setPalette. */
+ /** Sets current palette to global OSystem's palette using g_system->getPaletteManager()->setPalette. */
void setGlobalOSystemPalette() const;
/** Get the color at the given palette index. */
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 4a88e6ed5e..00e44465f8 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -282,7 +282,7 @@ void gfxModuleData_updatePalette() {
paletteRGBA[i * 4 + 2] = lpalette[i].B;
paletteRGBA[i * 4 + 3] = 0xFF;
}
- g_system->setPalette(paletteRGBA + palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1);
+ g_system->getPaletteManager()->setPalette(paletteRGBA + palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1);
palDirtyMin = 256;
palDirtyMax = -1;
}
diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp
index 987bbf2ac1..bb7a093d8f 100644
--- a/engines/draci/screen.cpp
+++ b/engines/draci/screen.cpp
@@ -75,7 +75,7 @@ void Screen::setPalette(const byte *data, uint16 start, uint16 num) {
_palette[i] <<= 2;
}
- _vm->_system->setPalette(_palette, start, num);
+ _vm->_system->getPaletteManager()->setPalette(_palette, start, num);
}
void Screen::interpolatePalettes(const byte *first, const byte *second, uint16 start, uint16 num, int index, int number) {
@@ -97,7 +97,7 @@ void Screen::interpolatePalettes(const byte *first, const byte *second, uint16 s
_palette[i] <<= 2;
}
- _vm->_system->setPalette(_palette, start, num);
+ _vm->_system->getPaletteManager()->setPalette(_palette, start, num);
}
int Screen::interpolate(int first, int second, int index, int number) {
diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp
index 0f75bb7959..67597efd0c 100644
--- a/engines/drascula/palette.cpp
+++ b/engines/drascula/palette.cpp
@@ -74,7 +74,7 @@ void DrasculaEngine::setPalette(byte *PalBuf) {
pal[i * 4 + 2] = PalBuf[i * 3 + 2] * 4;
pal[i * 4 + 3] = 0;
}
- _system->setPalette(pal, 0, 256);
+ _system->getPaletteManager()->setPalette(pal, 0, 256);
_system->updateScreen();
}
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 889833ad47..f0b475f65b 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -325,7 +325,7 @@ void Util::clearPalette() {
if (_vm->_global->_setAllPalette) {
if (_vm->getPixelFormat().bytesPerPixel == 1) {
memset(colors, 0, 1024);
- g_system->setPalette(colors, 0, 256);
+ g_system->getPaletteManager()->setPalette(colors, 0, 256);
}
return;
diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index 7b7295f25c..4a32489138 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -355,7 +355,7 @@ void Video::setPalElem(int16 index, char red, char green, char blue,
setPalColor(pal, red, green, blue);
if (_vm->getPixelFormat().bytesPerPixel == 1)
- g_system->setPalette(pal, index, 1);
+ g_system->getPaletteManager()->setPalette(pal, index, 1);
}
void Video::setPalette(PalDesc *palDesc) {
@@ -369,7 +369,7 @@ void Video::setPalette(PalDesc *palDesc) {
setPalColor(pal + i * 4, palDesc->vgaPal[i]);
if (_vm->getPixelFormat().bytesPerPixel == 1)
- g_system->setPalette(pal, 0, numcolors);
+ g_system->getPaletteManager()->setPalette(pal, 0, numcolors);
}
void Video::setFullPalette(PalDesc *palDesc) {
@@ -385,7 +385,7 @@ void Video::setFullPalette(PalDesc *palDesc) {
}
if (_vm->getPixelFormat().bytesPerPixel == 1)
- g_system->setPalette(pal, 0, 256);
+ g_system->getPaletteManager()->setPalette(pal, 0, 256);
} else
Video::setPalette(palDesc);
}
diff --git a/engines/groovie/debug.cpp b/engines/groovie/debug.cpp
index 7055965917..92afbb0115 100644
--- a/engines/groovie/debug.cpp
+++ b/engines/groovie/debug.cpp
@@ -138,7 +138,7 @@ bool Debugger::cmd_playref(int argc, const char **argv) {
bool Debugger::cmd_dumppal(int argc, const char **argv) {
uint16 i;
byte palettedump[256 * 4];
- _vm->_system->grabPalette(palettedump, 0, 256);
+ _vm->_system->getPaletteManager()->grabPalette(palettedump, 0, 256);
for (i = 0; i < 256; i++) {
DebugPrintf("%3d: %3d,%3d,%3d,%3d\n", i, palettedump[(i * 4)], palettedump[(i * 4) + 1], palettedump[(i * 4) + 2], palettedump[(i * 4) + 3]);
diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp
index 8546a13d40..9d6da81fb6 100644
--- a/engines/groovie/graphics.cpp
+++ b/engines/groovie/graphics.cpp
@@ -124,7 +124,7 @@ void GraphicsMan::fadeOut() {
_fadeStartTime = _vm->_system->getMillis();
// Get the current palette
- _vm->_system->grabPalette(_paletteFull, 0, 256);
+ _vm->_system->getPaletteManager()->grabPalette(_paletteFull, 0, 256);
// Set the current fading
_fading = 2;
@@ -159,7 +159,7 @@ void GraphicsMan::applyFading(int step) {
}
// Set the screen palette
- _vm->_system->setPalette(newpal, 0, 256);
+ _vm->_system->getPaletteManager()->setPalette(newpal, 0, 256);
// Request a screen update
change();
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 11bacef8e8..6772a5a40f 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -96,7 +96,7 @@ ROQPlayer::ROQPlayer(GroovieEngine *vm) :
}
#endif // DITHER
- _syst->setPalette(pal, 0, 256);
+ _syst->getPaletteManager()->setPalette(pal, 0, 256);
}
}
diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp
index 61756cb218..3ab8608031 100644
--- a/engines/groovie/vdx.cpp
+++ b/engines/groovie/vdx.cpp
@@ -563,7 +563,7 @@ void VDXPlayer::setPalette(uint8 *palette) {
palBuf[(i * 4) + 2] = palette[(i * 3) + 2];
palBuf[(i * 4) + 3] = 0;
}
- _syst->setPalette(palBuf, 0, 256);
+ _syst->getPaletteManager()->setPalette(palBuf, 0, 256);
}
} // End of Groovie namespace
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index b258712f28..b91a3f5b38 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -79,7 +79,7 @@ Screen::~Screen() {
void Screen::createPal() {
debugC(1, kDebugDisplay, "createPal");
- g_system->setPalette(_mainPalette, 0, _paletteSize / 4);
+ g_system->getPaletteManager()->setPalette(_mainPalette, 0, _paletteSize / 4);
}
void Screen::setCursorPal() {
@@ -146,7 +146,7 @@ void Screen::remapPal(const uint16 oldIndex, const uint16 newIndex) {
pal[2] = _curPalette[4 * oldIndex + 2] = _mainPalette[newIndex * 4 + 2];
pal[3] = _curPalette[4 * oldIndex + 3] = _mainPalette[newIndex * 4 + 3];
- g_system->setPalette(pal, oldIndex, 1);
+ g_system->getPaletteManager()->setPalette(pal, oldIndex, 1);
}
/**
@@ -175,7 +175,7 @@ void Screen::restorePal(Common::SeekableReadStream *f) {
pal[1] = _curPalette[i * 4 + 1];
pal[2] = _curPalette[i * 4 + 2];
pal[3] = _curPalette[i * 4 + 3];
- g_system->setPalette(pal, i, 1);
+ g_system->getPaletteManager()->setPalette(pal, i, 1);
}
}
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index c86e043db7..b8eac058fd 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -145,7 +145,7 @@ bool Screen::init() {
palette[i * 4 + 2] = ((i >> 0) & 1) * 0xFF;
palette[i * 4 + 3] = 0;
- _system->setPalette(palette, 16, 8);
+ _system->getPaletteManager()->setPalette(palette, 16, 8);
}
}
@@ -181,7 +181,7 @@ bool Screen::enableScreenDebug(bool enable) {
void Screen::setResolution() {
byte palette[4*256];
- _system->grabPalette(palette, 0, 256);
+ _system->getPaletteManager()->grabPalette(palette, 0, 256);
int width = 320, height = 200;
bool defaultTo1xScaler = false;
@@ -203,7 +203,7 @@ void Screen::setResolution() {
initGraphics(width, height, defaultTo1xScaler);
- _system->setPalette(palette, 0, 256);
+ _system->getPaletteManager()->setPalette(palette, 0, 256);
}
void Screen::updateScreen() {
@@ -711,7 +711,7 @@ void Screen::setScreenPalette(const Palette &pal) {
}
_paletteChanged = true;
- _system->setPalette(screenPal, 0, pal.getNumColors());
+ _system->getPaletteManager()->setPalette(screenPal, 0, pal.getNumColors());
}
void Screen::enableInterfacePalette(bool e) {
@@ -747,7 +747,7 @@ void Screen::setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b)
}
_paletteChanged = true;
- _system->setPalette(screenPal, 32, pal.getNumColors());
+ _system->getPaletteManager()->setPalette(screenPal, 32, pal.getNumColors());
}
void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp
index fbee0c0edb..da96ea6821 100644
--- a/engines/kyra/screen_lok.cpp
+++ b/engines/kyra/screen_lok.cpp
@@ -455,7 +455,7 @@ void Screen_LoK_16::set16ColorPalette(const uint8 *pal) {
palette[i * 4 + 3] = 0;
}
- _system->setPalette(palette, 0, 16);
+ _system->getPaletteManager()->setPalette(palette, 0, 16);
}
} // End of namespace Kyra
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index e8ec7bc180..e85ea13371 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -801,7 +801,7 @@ void Screen_LoL::copyColor(int dstColorIndex, int srcColorIndex) {
ci[2] = (d[2] << 2) | (d[2] & 3);
ci[3] = 0;
- _system->setPalette(ci, dstColorIndex, 1);
+ _system->getPaletteManager()->setPalette(ci, dstColorIndex, 1);
}
bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks) {
diff --git a/engines/lure/screen.cpp b/engines/lure/screen.cpp
index ce353aa04a..d00d969770 100644
--- a/engines/lure/screen.cpp
+++ b/engines/lure/screen.cpp
@@ -44,7 +44,7 @@ Screen::Screen(OSystem &system): _system(system),
_palette(new Palette(GAME_PALETTE_RESOURCE_ID, RGB64)) {
int_disk = this;
_screen->empty();
- _system.setPalette(_palette->data(), 0, GAME_COLOURS);
+ _system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLOURS);
}
Screen::~Screen() {
@@ -57,13 +57,13 @@ Screen::~Screen() {
void Screen::setPaletteEmpty(int numEntries) {
Palette emptyPalette(numEntries, NULL, RGB64);
- _system.setPalette(emptyPalette.data(), 0, numEntries);
+ _system.getPaletteManager()->setPalette(emptyPalette.data(), 0, numEntries);
_palette->copyFrom(&emptyPalette);
/*
delete _palette;
_palette = new Palette();
- _system.setPalette(_palette->data(), 0, numEntries);
+ _system.getPaletteManager()->setPalette(_palette->data(), 0, numEntries);
*/
_system.updateScreen();
}
@@ -73,7 +73,7 @@ void Screen::setPaletteEmpty(int numEntries) {
void Screen::setPalette(Palette *p) {
_palette->copyFrom(p);
- _system.setPalette(_palette->data(), 0, GAME_COLOURS);
+ _system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLOURS);
_system.updateScreen();
}
@@ -82,7 +82,7 @@ void Screen::setPalette(Palette *p) {
void Screen::setPalette(Palette *p, uint16 start, uint16 num) {
_palette->palette()->copyFrom(p->palette(), start * 4, start * 4, num * 4);
- _system.setPalette(_palette->data(), start, num);
+ _system.getPaletteManager()->setPalette(_palette->data(), start, num);
_system.updateScreen();
}
@@ -114,7 +114,7 @@ void Screen::paletteFadeIn(Palette *p) {
}
if (changed) {
- _system.setPalette(_palette->data(), 0, p->numEntries());
+ _system.getPaletteManager()->setPalette(_palette->data(), 0, p->numEntries());
_system.updateScreen();
_system.delayMillis(20);
while (events.pollEvent())
@@ -147,7 +147,7 @@ void Screen::paletteFadeOut(int numEntries) {
}
if (changed) {
- _system.setPalette(_palette->data(), 0, numEntries);
+ _system.getPaletteManager()->setPalette(_palette->data(), 0, numEntries);
_system.updateScreen();
_system.delayMillis(20);
while (events.pollEvent())
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index 7aa86d6173..a651510d10 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -1031,17 +1031,17 @@ Palette::Palette(MadsM4Engine *vm) : _vm(vm) {
}
void Palette::setPalette(const byte *colors, uint start, uint num) {
- g_system->setPalette(colors, start, num);
+ g_system->getPaletteManager()->setPalette(colors, start, num);
reset();
}
void Palette::setPalette(const RGB8 *colors, uint start, uint num) {
- g_system->setPalette((const byte *)colors, start, num);
+ g_system->getPaletteManager()->setPalette((const byte *)colors, start, num);
reset();
}
void Palette::grabPalette(byte *colors, uint start, uint num) {
- g_system->grabPalette(colors, start, num);
+ g_system->getPaletteManager()->grabPalette(colors, start, num);
}
void Palette::setEntry(uint index, uint8 r, uint8 g, uint8 b) {
@@ -1050,7 +1050,7 @@ void Palette::setEntry(uint index, uint8 r, uint8 g, uint8 b) {
c.g = g;
c.b = b;
c.u = 255;
- g_system->setPalette((const byte *)&c, index, 1);
+ g_system->getPaletteManager()->setPalette((const byte *)&c, index, 1);
}
uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) {
@@ -1060,7 +1060,7 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) {
int Rdiff, Gdiff, Bdiff;
if (paletteData == NULL) {
- g_system->grabPalette((byte *)palData, 0, 256);
+ g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256);
paletteData = &palData[0];
}
@@ -1080,7 +1080,7 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) {
void Palette::reset() {
RGB8 palData[256];
- g_system->grabPalette((byte *)palData, 0, 256);
+ g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256);
BLACK = palIndexFromRgb(0, 0, 0, palData);
BLUE = palIndexFromRgb(0, 0, 255, palData);
@@ -1260,7 +1260,7 @@ void Palette::addRange(RGBList *list) {
RGB8 *data = list->data();
byte *palIndexes = list->palIndexes();
RGB8 palData[256];
- g_system->grabPalette((byte *)&palData[0], 0, 256);
+ g_system->getPaletteManager()->grabPalette((byte *)&palData[0], 0, 256);
bool paletteChanged = false;
for (int colIndex = 0; colIndex < list->size(); ++colIndex) {
@@ -1300,7 +1300,7 @@ void Palette::addRange(RGBList *list) {
}
if (paletteChanged) {
- g_system->setPalette((byte *)&palData[0], 0, 256);
+ g_system->getPaletteManager()->setPalette((byte *)&palData[0], 0, 256);
reset();
}
}
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index 4928e0af8d..f45e8fa8a2 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -322,7 +322,7 @@ void WoodScript::update() {
{
// FIXME: This should be done when a new palette is set
byte palette[1024];
- g_system->grabPalette(palette, 0, 256);
+ g_system->getPaletteManager()->grabPalette(palette, 0, 256);
for (int i = 0; i < 256; i++) {
_mainPalette[i].r = palette[i * 4 + 0];
_mainPalette[i].g = palette[i * 4 + 1];
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 773e3d17ed..7a4c12eefb 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -227,7 +227,7 @@ void Screen::setRGBPalette(byte *palRGB, int start, int count) {
_screenPalette[i * 4 + 3] = 0;
}
- _vm->_system->setPalette(_screenPalette, start, count);
+ _vm->_system->getPaletteManager()->setPalette(_screenPalette, start, count);
}
uint16 Screen::updateChannel(uint16 channelIndex) {
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index ece2a69864..fe015b4527 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -147,7 +147,7 @@ void GraphicsManager::setPalette(uint16 id) {
delete tpalStream;
- getVM()->_system->setPalette(palette, colorStart, colorCount);
+ getVM()->_system->getPaletteManager()->setPalette(palette, colorStart, colorCount);
delete[] palette;
}
@@ -1016,7 +1016,7 @@ void LBGraphics::setPalette(uint16 id) {
delete ctblStream;
- _vm->_system->setPalette(palette, 0, colorCount);
+ _vm->_system->getPaletteManager()->setPalette(palette, 0, colorCount);
delete[] palette;
} else {
GraphicsManager::setPalette(id);
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 6017ab1218..e32c7df6a0 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -3018,7 +3018,7 @@ void LBPaletteItem::update() {
// TODO: actual fading-in
if (_visible && _globalVisible) {
- _vm->_system->setPalette(_palette + _drawStart * 4, _drawStart, _drawCount);
+ _vm->_system->getPaletteManager()->setPalette(_palette + _drawStart * 4, _drawStart, _drawCount);
_vm->_needsRedraw = true;
}
}
@@ -3130,9 +3130,9 @@ void LBLiveTextItem::paletteUpdate(uint16 word, bool on) {
}
if (on) {
- _vm->_system->setPalette(_highlightColor, _paletteIndex + word, 1);
+ _vm->_system->getPaletteManager()->setPalette(_highlightColor, _paletteIndex + word, 1);
} else {
- _vm->_system->setPalette(_foregroundColor, _paletteIndex + word, 1);
+ _vm->_system->getPaletteManager()->setPalette(_foregroundColor, _paletteIndex + word, 1);
}
}
diff --git a/engines/mohawk/view.cpp b/engines/mohawk/view.cpp
index 54ed552535..241b2c3663 100644
--- a/engines/mohawk/view.cpp
+++ b/engines/mohawk/view.cpp
@@ -431,7 +431,7 @@ void View::setColors(Common::SeekableReadStream *tpalStream) {
}
// TODO: copy into temporary buffer
- _vm->_system->setPalette(palette, colorStart, colorCount);
+ _vm->_system->getPaletteManager()->setPalette(palette, colorStart, colorCount);
delete[] palette;
// original does pdLightenUp here..
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 0e6f10f6af..259ad84f69 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -225,7 +225,7 @@ void Gfx::setPalette(Palette pal) {
byte sysPal[256*4];
uint n = pal.fillRGBA(sysPal);
- _vm->_system->setPalette(sysPal, 0, n);
+ _vm->_system->getPaletteManager()->setPalette(sysPal, 0, n);
}
void Gfx::setBlackPalette() {
diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index 12d3893b8a..4557588732 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -167,7 +167,7 @@ void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) {
tempPal[4 * i + 2] = *pal++;
tempPal[4 * i + 3] = 0;
}
- _system->setPalette(tempPal, start, numColors);
+ _system->getPaletteManager()->setPalette(tempPal, start, numColors);
if (updateScreen) {
_vm->input()->delay(20);
}
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 77842acc7b..771284f632 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -216,7 +216,7 @@ void Gfx::setPalette(const PalEntry *pal, bool full) {
if ((_vm->getPlatform() == Common::kPlatformMacintosh) && !_vm->_scene->isInIntro())
memset(&_currentPal[255 * 4], 0, 4);
- _system->setPalette(_currentPal, 0, PAL_ENTRIES);
+ _system->getPaletteManager()->setPalette(_currentPal, 0, PAL_ENTRIES);
}
void Gfx::setPaletteColor(int n, int r, int g, int b) {
@@ -243,7 +243,7 @@ void Gfx::setPaletteColor(int n, int r, int g, int b) {
}
if (update)
- _system->setPalette(_currentPal, n, 1);
+ _system->getPaletteManager()->setPalette(_currentPal, n, 1);
}
void Gfx::getCurrentPal(PalEntry *src_pal) {
@@ -325,7 +325,7 @@ void Gfx::palToBlack(PalEntry *srcPal, double percent) {
if ((_vm->getPlatform() == Common::kPlatformMacintosh) && !_vm->_scene->isInIntro())
memset(&_currentPal[255 * 4], 0, 4);
- _system->setPalette(_currentPal, 0, PAL_ENTRIES);
+ _system->getPaletteManager()->setPalette(_currentPal, 0, PAL_ENTRIES);
}
void Gfx::blackToPal(PalEntry *srcPal, double percent) {
@@ -392,7 +392,7 @@ void Gfx::blackToPal(PalEntry *srcPal, double percent) {
if ((_vm->getPlatform() == Common::kPlatformMacintosh) && !_vm->_scene->isInIntro())
memset(&_currentPal[255 * 4], 0, 4);
- _system->setPalette(_currentPal, 0, PAL_ENTRIES);
+ _system->getPaletteManager()->setPalette(_currentPal, 0, PAL_ENTRIES);
}
#ifdef ENABLE_IHNM
@@ -455,7 +455,7 @@ void Gfx::palFade(PalEntry *srcPal, int16 from, int16 to, int16 start, int16 num
// Color 0 should always be black in IHNM
memset(&fadePal[0 * 4], 0, 4);
- _system->setPalette(&fadePal[start * 4], start, numColors);
+ _system->getPaletteManager()->setPalette(&fadePal[start * 4], start, numColors);
}
#endif
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 2543dec7bb..39b5e5a0e1 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -511,7 +511,7 @@ void GfxScreen::getPalette(Palette *pal) {
// just copy palette to system
byte bpal[4 * 256];
// Get current palette, update it and put back
- g_system->grabPalette(bpal, 0, 256);
+ g_system->getPaletteManager()->grabPalette(bpal, 0, 256);
for (int16 i = 1; i < 255; i++) {
pal->colors[i].r = bpal[i * 4];
pal->colors[i].g = bpal[i * 4 + 1];
@@ -523,7 +523,7 @@ void GfxScreen::setPalette(Palette *pal) {
// just copy palette to system
byte bpal[4 * 256];
// Get current palette, update it and put back
- g_system->grabPalette(bpal, 0, 256);
+ g_system->getPaletteManager()->grabPalette(bpal, 0, 256);
for (int16 i = 0; i < 256; i++) {
if (!pal->colors[i].used)
continue;
@@ -532,7 +532,7 @@ void GfxScreen::setPalette(Palette *pal) {
bpal[i * 4 + 2] = CLIP(pal->colors[i].b * pal->intensity[i] / 100, 0, 255);
bpal[i * 4 + 3] = 100;
}
- g_system->setPalette(bpal, 0, 256);
+ g_system->getPaletteManager()->setPalette(bpal, 0, 256);
}
void GfxScreen::setVerticalShakePos(uint16 shakePos) {
diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp
index 3f4ce7bbc8..b7b2bfb38e 100644
--- a/engines/sci/graphics/transitions.cpp
+++ b/engines/sci/graphics/transitions.cpp
@@ -309,7 +309,7 @@ void GfxTransitions::fadeOut() {
// several pictures (e.g. qfg3 demo/intro), so the fading looked weird
int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 256 : 255;
- g_system->grabPalette(oldPalette, 0, 256);
+ g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256);
for (stepNr = 100; stepNr >= 0; stepNr -= 10) {
for (colorNr = 1; colorNr < tillColorNr; colorNr++){
@@ -317,7 +317,7 @@ void GfxTransitions::fadeOut() {
workPalette[colorNr * 4 + 1] = oldPalette[colorNr * 4 + 1] * stepNr / 100;
workPalette[colorNr * 4 + 2] = oldPalette[colorNr * 4 + 2] * stepNr / 100;
}
- g_system->setPalette(workPalette + 4, 1, 254);
+ g_system->getPaletteManager()->setPalette(workPalette + 4, 1, 254);
g_sci->getEngineState()->wait(2);
}
}
diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp
index fedbdbf377..2045b8084c 100644
--- a/engines/scumm/he/cup_player_he.cpp
+++ b/engines/scumm/he/cup_player_he.cpp
@@ -127,7 +127,7 @@ void CUP_Player::copyRectToScreen(const Common::Rect &r) {
void CUP_Player::updateScreen() {
if (_paletteChanged) {
- _system->setPalette(_paletteData, 0, 256);
+ _system->getPaletteManager()->setPalette(_paletteData, 0, 256);
_paletteChanged = false;
}
_system->updateScreen();
diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp
index ad3f90b8eb..c7ed9e64a8 100644
--- a/engines/scumm/he/palette_he.cpp
+++ b/engines/scumm/he/palette_he.cpp
@@ -394,7 +394,7 @@ void ScummEngine_v99he::updatePalette() {
*p++ = 0;
}
- _system->setPalette(palette_colors, _palDirtyMin, num);
+ _system->getPaletteManager()->setPalette(palette_colors, _palDirtyMin, num);
_palDirtyMax = -1;
_palDirtyMin = 256;
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 509547984a..52592cd90e 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -223,11 +223,11 @@ void ScummEngine::resetPalette() {
_townsClearLayerFlag = 0;
#ifdef USE_RGB_COLOR
else if (_game.id == GID_LOOM)
- towns_setTextPaletteFromPtr(tableTownsLoomPalette);
+ towns_setTextPaletteFromPtr(tableTownsLoomPalette);
else if (_game.version == 3)
towns_setTextPaletteFromPtr(tableTownsV3Palette);
#endif
-
+
_townsScreen->toggleLayers(_townsActiveLayerFlags);
#endif // DISABLE_TOWNS_DUAL_LAYER_MODE
}
@@ -1133,7 +1133,7 @@ void ScummEngine::updatePalette() {
#endif
#endif
- _system->setPalette(palette_colors, first, num);
+ _system->getPaletteManager()->setPalette(palette_colors, first, num);
}
} // End of namespace Scumm
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index dcb47f47b8..29dbb57670 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -1229,7 +1229,7 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st
*p++ = 0;
}
- _vm->_system->setPalette(palette_colors, _palDirtyMin, _palDirtyMax - _palDirtyMin + 1);
+ _vm->_system->getPaletteManager()->setPalette(palette_colors, _palDirtyMin, _palDirtyMax - _palDirtyMin + 1);
_palDirtyMax = -1;
_palDirtyMin = 256;
diff --git a/engines/sky/screen.cpp b/engines/sky/screen.cpp
index fb42da4b97..76b4b24f51 100644
--- a/engines/sky/screen.cpp
+++ b/engines/sky/screen.cpp
@@ -83,7 +83,7 @@ Screen::Screen(OSystem *pSystem, Disk *pDisk, SkyCompact *skyCompact) {
}
//set the palette
- _system->setPalette(tmpPal, 0, VGA_COLOURS);
+ _system->getPaletteManager()->setPalette(tmpPal, 0, VGA_COLOURS);
_currentPalette = 0;
_seqInfo.framesLeft = 0;
@@ -110,7 +110,7 @@ void Screen::setFocusRectangle(const Common::Rect& rect) {
//set a new palette, pal is a pointer to dos vga rgb components 0..63
void Screen::setPalette(uint8 *pal) {
convertPalette(pal, _palette);
- _system->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
_system->updateScreen();
}
@@ -123,7 +123,7 @@ void Screen::setPaletteEndian(uint8 *pal) {
#else
convertPalette(pal, _palette);
#endif
- _system->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
_system->updateScreen();
}
@@ -135,7 +135,7 @@ void Screen::halvePalette() {
halfPalette[(cnt << 2) | 2] = _palette[(cnt << 2) | 2] >> 1;
halfPalette[(cnt << 2) | 3] = 0;
}
- _system->setPalette(halfPalette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(halfPalette, 0, GAME_COLOURS);
}
void Screen::setPalette(uint16 fileNum) {
@@ -249,7 +249,7 @@ void Screen::fnFadeDown(uint32 scroll) {
for (uint8 cnt = 0; cnt < 32; cnt++) {
delayTime += 20;
palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS);
- _system->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
_system->updateScreen();
int32 waitTime = (int32)delayTime - _system->getMillis();
if (waitTime < 0)
@@ -308,7 +308,7 @@ void Screen::paletteFadeUp(uint8 *pal) {
_palette[(colCnt << 2) | 1] = (tmpPal[(colCnt << 2) | 1] * cnt) >> 5;
_palette[(colCnt << 2) | 2] = (tmpPal[(colCnt << 2) | 2] * cnt) >> 5;
}
- _system->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
_system->updateScreen();
int32 waitTime = (int32)delayTime - _system->getMillis();
if (waitTime < 0)
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 20ce543a55..7dab38b500 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -176,7 +176,7 @@ void MoviePlayer::play() {
byte pal[4 * 256];
memset(pal, 0, sizeof(pal));
- _system->setPalette(pal, 0, 256);
+ _system->getPaletteManager()->setPalette(pal, 0, 256);
}
void MoviePlayer::performPostProcessing(byte *screen) {
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index aee49c4b60..1d310d55e2 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -256,7 +256,7 @@ void Control::askForCd() {
}
palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
_resMan->resClose(SR_PALETTE);
- _system->setPalette(palOut, 0, 256);
+ _system->getPaletteManager()->setPalette(palOut, 0, 256);
free(palOut);
char fName[10];
@@ -326,7 +326,7 @@ uint8 Control::runPanel() {
}
palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
_resMan->resClose(SR_PALETTE);
- _system->setPalette(palOut, 0, 256);
+ _system->getPaletteManager()->setPalette(palOut, 0, 256);
free(palOut);
uint8 mode = 0, newMode = BUTTON_MAIN_PANEL;
bool fullRefresh = false;
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index d31396aa2b..9c8d352fda 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -154,14 +154,14 @@ void Screen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp) {
_fadingStep = 1;
_fadingDirection = FADE_UP;
memset(_currentPalette, 0, 256 * 4);
- _system->setPalette(_currentPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
} else
- _system->setPalette(_targetPalette + 4 * start, start, length);
+ _system->getPaletteManager()->setPalette(_targetPalette + 4 * start, start, length);
}
void Screen::fullRefresh() {
_fullRefresh = true;
- _system->setPalette(_targetPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_targetPalette, 0, 256);
}
bool Screen::stillFading() {
@@ -197,7 +197,7 @@ void Screen::updateScreen() {
}
if (_fadingStep) {
fadePalette();
- _system->setPalette(_currentPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
}
uint16 scrlX = (uint16)Logic::_scriptVars[SCROLL_OFFSET_X];
diff --git a/engines/sword2/palette.cpp b/engines/sword2/palette.cpp
index dd1a2ba877..2b9b5b7f49 100644
--- a/engines/sword2/palette.cpp
+++ b/engines/sword2/palette.cpp
@@ -293,7 +293,7 @@ void Screen::setSystemPalette(const byte *colors, uint start, uint num) {
} else
palette = colors;
- _vm->_system->setPalette(palette, start, num);
+ _vm->_system->getPaletteManager()->setPalette(palette, start, num);
}
} // End of namespace Sword2
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index b55a67ad2e..4b37576846 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -1185,7 +1185,7 @@ void Scene::setPalette(unsigned mul) {
p[i * 4 + c] = (unsigned)palette[i * 3 + c] * mul;
}
- _system->setPalette(p, 0, 256);
+ _system->getPaletteManager()->setPalette(p, 0, 256);
}
Object *Scene::getObject(int id, int scene_id) {
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index acd3eca2e9..73f3716a47 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -301,7 +301,7 @@ bool TeenAgentEngine::showCDLogo() {
palette[idx + 1] *= 4;
palette[idx + 2] *= 4;
}
- _system->setPalette(palette, 0, 0x100);
+ _system->getPaletteManager()->setPalette(palette, 0, 0x100);
_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
_system->updateScreen();
@@ -338,7 +338,7 @@ bool TeenAgentEngine::showLogo() {
palette[idx + 1] *= 4;
palette[idx + 2] *= 4;
}
- _system->setPalette(palette, 0, 0x100);
+ _system->getPaletteManager()->setPalette(palette, 0, 0x100);
uint n = logo.fileCount();
for(uint f = 0; f < 4; ++f)
@@ -386,7 +386,7 @@ bool TeenAgentEngine::showMetropolis() {
}
}
- _system->setPalette(palette, 0, 0x100);
+ _system->getPaletteManager()->setPalette(palette, 0, 0x100);
byte varia_6[21760], varia_9[18302];
varia.read(6, varia_6, sizeof(varia_6));
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 079239c920..ed51b33e94 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -44,7 +44,7 @@ GFXTestSuite::GFXTestSuite() {
// Initialize color palettes
// The fourth field is for alpha channel which is unused
// Assuming 8bpp as of now
- g_system->setPalette(_palette, 0, 3);
+ g_system->getPaletteManager()->setPalette(_palette, 0, 3);
// Init Mouse Palette (White-black-yellow)
GFXtests::initMousePalette();
@@ -88,7 +88,7 @@ void GFXTestSuite::setCustomColor(uint r, uint g, uint b) {
_palette[absIndx + 1] = 173;
_palette[absIndx + 2] = 255;
_palette[absIndx + 3] = 47;
- g_system->setPalette(_palette, 0, 256);
+ g_system->getPaletteManager()->setPalette(_palette, 0, 256);
}
// Helper functions used by GFX tests
@@ -982,7 +982,7 @@ TestExitStatus GFXtests::paletteRotation() {
}
// Initialize this palette.
- g_system->setPalette(palette, 0, 256);
+ g_system->getPaletteManager()->setPalette(palette, 0, 256);
// Draw 256 Rectangles, each 1 pixel wide and 10 pixels long
// one for 0-255 color range other for 0-127-255 range
@@ -1020,7 +1020,7 @@ TestExitStatus GFXtests::paletteRotation() {
rotatePalette(palette, 256);
g_system->delayMillis(10);
- g_system->setPalette(palette, 0, 256);
+ g_system->getPaletteManager()->setPalette(palette, 0, 256);
g_system->updateScreen();
}
diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp
index affc855744..438f077f4f 100644
--- a/engines/tinsel/palette.cpp
+++ b/engines/tinsel/palette.cpp
@@ -165,7 +165,7 @@ void PalettesToVideoDAC() {
}
// update the system palette
- g_system->setPalette((const byte *)pColours, pDACtail->destDACindex, pDACtail->numColours);
+ g_system->getPaletteManager()->setPalette((const byte *)pColours, pDACtail->destDACindex, pDACtail->numColours);
// update tail pointer
pDACtail++;
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index e26303eed1..9027f36717 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -930,7 +930,7 @@ void ToonEngine::flushPalette(bool deferFlushToNextRender) {
vmpalette[i*4+2] = _finalPalette[i*3+2];
vmpalette[i*4+3] = 0;
}
- _system->setPalette(vmpalette, 0, 256);
+ _system->getPaletteManager()->setPalette(vmpalette, 0, 256);
}
void ToonEngine::setPaletteEntries(uint8 *palette, int32 offset, int32 num) {
memcpy(_finalPalette + offset * 3, palette, num * 3);
@@ -1758,7 +1758,7 @@ void ToonEngine::fadeIn(int32 numFrames) {
vmpalette[i*4+2] = f * _finalPalette[i*3+2] / (numFrames - 1);
vmpalette[i*4+3] = 0;
}
- _system->setPalette(vmpalette, 0, 256);
+ _system->getPaletteManager()->setPalette(vmpalette, 0, 256);
_system->updateScreen();
_system->delayMillis(_tickLength);
}
@@ -1767,7 +1767,7 @@ void ToonEngine::fadeIn(int32 numFrames) {
void ToonEngine::fadeOut(int32 numFrames) {
uint8 oldpalette[1024];
- _system->grabPalette(oldpalette, 0, 256);
+ _system->getPaletteManager()->grabPalette(oldpalette, 0, 256);
for (int32 f = 0; f < numFrames; f++) {
uint8 vmpalette[1024];
@@ -1777,7 +1777,7 @@ void ToonEngine::fadeOut(int32 numFrames) {
vmpalette[i*4+2] = (numFrames - f - 1) * oldpalette[i*4+2] / (numFrames - 1);
vmpalette[i*4+3] = 255;
}
- _system->setPalette(vmpalette, 0, 256);
+ _system->getPaletteManager()->setPalette(vmpalette, 0, 256);
_system->updateScreen();
_system->delayMillis(_tickLength);
}
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index e99a08ee6a..e8d9be87d1 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -3259,7 +3259,7 @@ void ToucheEngine::setPalette(int firstColor, int colorCount, int rScale, int gS
pal[i * 4 + 3] = 0;
}
- _system->setPalette(&pal[firstColor * 4], firstColor, colorCount);
+ _system->getPaletteManager()->setPalette(&pal[firstColor * 4], firstColor, colorCount);
}
void ToucheEngine::updateScreenArea(int x, int y, int w, int h) {
@@ -3294,7 +3294,7 @@ void ToucheEngine::updateDirtyScreenAreas() {
}
void ToucheEngine::updatePalette() {
- _system->setPalette(_paletteBuffer, 0, 256);
+ _system->getPaletteManager()->setPalette(_paletteBuffer, 0, 256);
}
bool ToucheEngine::canLoadGameStateCurrently() {
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index a8191e39e4..009695e8aa 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -1798,7 +1798,7 @@ void TuckerEngine::execData3PreUpdate_locationNum29() {
scrollPal[i * 4 + 1] = g[i + d];
scrollPal[i * 4 + 2] = b[i + d];
}
- _system->setPalette(scrollPal, 118, 5);
+ _system->getPaletteManager()->setPalette(scrollPal, 118, 5);
if (_flagsTable[143] == 1) {
_locationObjectsTable[2].xPos = 999;
_locationObjectsTable[3].xPos = 187;
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index d804d85d9a..4a7a5f16d7 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -550,7 +550,7 @@ void AnimationSequencePlayer::mainLoop() {
updateSounds();
}
_system->copyRectToScreen(_offscreenBuffer, kScreenWidth, 0, 0, kScreenWidth, kScreenHeight);
- _system->setPalette(_animationPalette, 0, 256);
+ _system->getPaletteManager()->setPalette(_animationPalette, 0, 256);
_system->updateScreen();
syncTime();
} while (_seqNum != 1);
@@ -691,7 +691,7 @@ void AnimationSequencePlayer::fadeInPalette() {
fadeColors = true;
}
}
- _system->setPalette(paletteBuffer, 0, 256);
+ _system->getPaletteManager()->setPalette(paletteBuffer, 0, 256);
_system->updateScreen();
}
_system->delayMillis(1000 / 60);
@@ -712,7 +712,7 @@ void AnimationSequencePlayer::fadeOutPalette() {
fadeColors = true;
}
}
- _system->setPalette(paletteBuffer, 0, 256);
+ _system->getPaletteManager()->setPalette(paletteBuffer, 0, 256);
_system->updateScreen();
}
_system->delayMillis(1000 / 60);
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 2b9b4edee4..c61a4228c6 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -943,46 +943,46 @@ void TuckerEngine::updateFlagsForCharPosition() {
void TuckerEngine::fadeOutPalette(int colorsCount) {
uint8 pal[256 * 4];
- _system->grabPalette(pal, 0, colorsCount);
+ _system->getPaletteManager()->grabPalette(pal, 0, colorsCount);
for (int color = 0; color < colorsCount; ++color) {
for (int i = 0; i < 3; ++i) {
const int c = int(pal[color * 4 + i]) + kFadePaletteStep * 4;
pal[color * 4 + i] = MIN<int>(c, _currentPalette[color * 3 + i]);
}
}
- _system->setPalette(pal, 0, colorsCount);
+ _system->getPaletteManager()->setPalette(pal, 0, colorsCount);
_system->updateScreen();
waitForTimer(1);
}
void TuckerEngine::fadeInPalette(int colorsCount) {
uint8 pal[256 * 4];
- _system->grabPalette(pal, 0, colorsCount);
+ _system->getPaletteManager()->grabPalette(pal, 0, colorsCount);
for (int color = 0; color < colorsCount; ++color) {
for (int i = 0; i < 3; ++i) {
const int c = int(pal[color * 4 + i]) - kFadePaletteStep * 4;
pal[color * 4 + i] = MAX<int>(c, 0);
}
}
- _system->setPalette(pal, 0, colorsCount);
+ _system->getPaletteManager()->setPalette(pal, 0, colorsCount);
_system->updateScreen();
waitForTimer(1);
}
void TuckerEngine::fadePaletteColor(int color, int step) {
uint8 rgb[4];
- _system->grabPalette(rgb, color, 1);
+ _system->getPaletteManager()->grabPalette(rgb, color, 1);
for (int i = 0; i < 3; ++i) {
const int c = _currentPalette[color * 3 + i] + step * 4;
rgb[i] = MIN(c, 255);
}
- _system->setPalette(rgb, color, 1);
+ _system->getPaletteManager()->setPalette(rgb, color, 1);
}
void TuckerEngine::setBlackPalette() {
uint8 pal[256 * 4];
memset(pal, 0, sizeof(pal));
- _system->setPalette(pal, 0, 256);
+ _system->getPaletteManager()->setPalette(pal, 0, 256);
}
void TuckerEngine::updateCursor() {
diff --git a/graphics/palette.h b/graphics/palette.h
new file mode 100644
index 0000000000..72db16a3d3
--- /dev/null
+++ b/graphics/palette.h
@@ -0,0 +1,107 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef GRAPHICS_PALETTE_H
+#define GRAPHICS_PALETTE_H
+
+#include "common/noncopyable.h"
+
+/**
+ * The PaletteManager is part of the OSystem backend API and responsible
+ * for handling the (possibly emulated) "hardware" palette needed for
+ * many old games (e.g. in EGA and VGA mode).
+ *
+ * By itself it is a pure abstract class, i.e. an "interface"; you can
+ * use the OSystem::getPaletteManager() method to obtain an instance
+ * that you can use to perform actual palette modifications.
+ */
+class PaletteManager : Common::NonCopyable {
+public:
+ virtual ~PaletteManager() {}
+
+ /**
+ * Replace the specified range of the palette with new colors.
+ * The palette entries from 'start' till (start+num-1) will be replaced - so
+ * a full palette update is accomplished via start=0, num=256.
+ *
+ * The palette data is specified in interleaved RGBA format. That is, the
+ * first byte of the memory block 'colors' points at is the red component
+ * of the first new color; the second byte the green component of the first
+ * new color; the third byte the blue component, the last byte to the alpha
+ * (transparency) value. Then the second color starts, and so on. So memory
+ * looks like this: R1-G1-B1-A1-R2-G2-B2-A2-R3-...
+ *
+ * @param colors the new palette data, in interleaved RGBA format
+ * @param start the first palette entry to be updated
+ * @param num the number of palette entries to be updated
+ *
+ * @note It is an error if start+num exceeds 256, behaviour is undefined
+ * in that case (the backend may ignore it silently or assert).
+ * @note It is an error if this function gets called when the pixel format
+ * in use (the return value of getScreenFormat) has more than one
+ * byte per pixel.
+ * @note The alpha value is not actually used, and future revisions of this
+ * API are probably going to remove it.
+ *
+ * @see getScreenFormat
+ */
+ virtual void setPalette(const byte *colors, uint start, uint num) = 0;
+
+ /**
+ * Grabs a specified part of the currently active palette.
+ * The format is the same as for setPalette.
+ *
+ * This should return exactly the same RGB data as was setup via previous
+ * setPalette calls.
+ *
+ * For example, for every valid value of start and num of the following
+ * code:
+ *
+ * byte origPal[num*4];
+ * // Setup origPal's data however you like
+ * g_system->setPalette(origPal, start, num);
+ * byte obtainedPal[num*4];
+ * g_system->grabPalette(obtainedPal, start, num);
+ *
+ * the following should be true:
+ *
+ * For each i < num : memcmp(&origPal[i*4], &obtainedPal[i*4], 3) == 0
+ * (i is an uint here)
+ *
+ * @see setPalette
+ * @param colors the palette data, in interleaved RGBA format
+ * @param start the first platte entry to be read
+ * @param num the number of palette entries to be read
+ *
+ * @note It is an error if this function gets called when the pixel format
+ * in use (the return value of getScreenFormat) has more than one
+ * byte per pixel.
+ *
+ * @see getScreenFormat
+ */
+ virtual void grabPalette(byte *colors, uint start, uint num) = 0;
+};
+
+#endif
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index f767c91bd5..bd325aca63 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -110,7 +110,7 @@ static bool grabScreen565(Graphics::Surface *surf) {
if (screenFormat.bytesPerPixel == 1) {
palette = new byte[256 * 4];
assert(palette);
- g_system->grabPalette(palette, 0, 256);
+ g_system->getPaletteManager()->grabPalette(palette, 0, 256);
}
for (uint y = 0; y < screen->h; ++y) {
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 54366a4300..09e7e48151 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -320,7 +320,7 @@ int MidiDriver_MT32::open() {
171, 0, 0, 0 // fill
};
- g_system->setPalette(dummy_palette, 0, 3);
+ g_system->getPaletteManager()->setPalette(dummy_palette, 0, 3);
}
_initialising = true;
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 739f1d3b93..8a95e23fef 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -60,7 +60,7 @@ void VideoDecoder::setSystemPalette() {
sysPalette[i * 4 + 3] = 0;
}
- g_system->setPalette(sysPalette, 0, 256);
+ g_system->getPaletteManager()->setPalette(sysPalette, 0, 256);
delete[] sysPalette;
}