diff options
author | Travis Howell | 2005-04-17 12:55:42 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-17 12:55:42 +0000 |
commit | caae2f00de411c7a26f5d5cd0a31fe23a017e501 (patch) | |
tree | 442af92f4dd377ef15926b718066ff1693fe75cb /scumm | |
parent | 2141a2648cba0451aec05c8ef2a8ad5dd724ef16 (diff) | |
download | scummvm-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')
-rw-r--r-- | scumm/palette.cpp | 14 | ||||
-rw-r--r-- | scumm/room.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v100he.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 2 | ||||
-rw-r--r-- | scumm/scumm.h | 3 |
8 files changed, 23 insertions, 12 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; diff --git a/scumm/room.cpp b/scumm/room.cpp index bd1094d46a..ae495f757a 100644 --- a/scumm/room.cpp +++ b/scumm/room.cpp @@ -519,7 +519,7 @@ void ScummEngine::initRoomSubBlocks() { } if (_PALS_offs || _CLUT_offs) - setPalette(0, _roomResource); + setPalette(0); initBGBuffers(_roomHeight); } diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index b6e6a93bd3..b9485cf0b3 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -1573,13 +1573,13 @@ void ScummEngine_v100he::o100_roomOps() { case 134: // SO_ROOM_NEW_PALETTE a = pop(); - setPalette(a, _roomResource); + setPalette(a); break; case 135: b = pop(); a = pop(); - setPalette(a, b); + setRoomPalette(a, b); break; case 136: // SO_ROOM_SAVEGAME diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 680192a4be..7e8b89862e 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -1757,7 +1757,7 @@ void ScummEngine_v6::o6_roomOps() { if (_gameId == GID_SAMNMAX && vm.slot[_currentScript].number == 64) setDirtyColors(0, 255); else - setPalette(a, _roomResource); + setPalette(a); break; default: error("o6_roomOps: default case %d", op); diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index ab3f45d962..a3aabf3c29 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -526,7 +526,7 @@ void ScummEngine_v60he::o60_roomOps() { case 213: // SO_ROOM_NEW_PALETTE a = pop(); - setPalette(a, _roomResource); + setPalette(a); break; case 220: a = pop(); @@ -549,7 +549,7 @@ void ScummEngine_v60he::o60_roomOps() { case 236: // HE 7.2 b = pop(); a = pop(); - setPalette(a, b); + setRoomPalette(a, b); break; default: error("o60_roomOps: default case %d", op); diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 49543dc245..3ad79b794a 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -1043,7 +1043,7 @@ void ScummEngine_v72he::o72_roomOps() { case 213: // SO_ROOM_NEW_PALETTE a = pop(); - setPalette(a, _roomResource); + setPalette(a); break; case 220: @@ -1068,7 +1068,7 @@ void ScummEngine_v72he::o72_roomOps() { case 236: b = pop(); a = pop(); - setPalette(a, b); + setRoomPalette(a, b); break; default: diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 6e29b88fff..738b0c69f0 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -868,7 +868,7 @@ void ScummEngine_v8::o8_roomOps() { break; case 0x5C: // SO_ROOM_NEW_PALETTE New palette a = pop(); - setPalette(a, _roomResource); + setPalette(a); break; case 0x5D: // SO_ROOM_SAVE_GAME Save game _saveTemporaryState = true; diff --git a/scumm/scumm.h b/scumm/scumm.h index 76ba8263bd..6ad002e63c 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -978,7 +978,8 @@ protected: void setupEGAPalette(); void setupV1ManiacPalette(); void setupV1ZakPalette(); - void setPalette(int pal, int room); + void setPalette(int pal); + void setRoomPalette(int pal, int room); virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1); virtual void setPalColor(int index, int r, int g, int b); void setDirtyColors(int min, int max); |