aboutsummaryrefslogtreecommitdiff
path: root/scumm/palette.cpp
diff options
context:
space:
mode:
authorTravis Howell2005-04-17 12:55:42 +0000
committerTravis Howell2005-04-17 12:55:42 +0000
commitcaae2f00de411c7a26f5d5cd0a31fe23a017e501 (patch)
tree442af92f4dd377ef15926b718066ff1693fe75cb /scumm/palette.cpp
parent2141a2648cba0451aec05c8ef2a8ad5dd724ef16 (diff)
downloadscummvm-rg350-caae2f00de411c7a26f5d5cd0a31fe23a017e501.tar.gz
scummvm-rg350-caae2f00de411c7a26f5d5cd0a31fe23a017e501.tar.bz2
scummvm-rg350-caae2f00de411c7a26f5d5cd0a31fe23a017e501.zip
Add separate function for loading palette from choosen room.
Avoid pointer problems. svn-id: r17653
Diffstat (limited to 'scumm/palette.cpp')
-rw-r--r--scumm/palette.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/scumm/palette.cpp b/scumm/palette.cpp
index e659b62488..726a69ccb6 100644
--- a/scumm/palette.cpp
+++ b/scumm/palette.cpp
@@ -857,14 +857,24 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) {
setDirtyColors(idx, idx);
}
-void ScummEngine::setPalette(int palindex, int room) {
+void ScummEngine::setPalette(int palindex) {
const byte *pals;
_curPalIndex = palindex;
- pals = getPalettePtr(_curPalIndex, room);
+ pals = getPalettePtr(_curPalIndex, _roomResource);
setPaletteFromPtr(pals);
}
+void ScummEngine::setRoomPalette(int palindex, int room) {
+ const byte *roomptr = getResourceAddress(rtRoom, room);
+ assert(roomptr);
+ const byte *pals = findResource(MKID('PALS'), roomptr);
+ assert(pals);
+ const byte *rgbs = findPalInPals(pals, palindex);
+ assert(rgbs);
+ setPaletteFromPtr(rgbs);
+}
+
const byte *ScummEngine::findPalInPals(const byte *pal, int idx) {
const byte *offs;
uint32 size;