aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2005-03-03 02:51:15 +0000
committerTravis Howell2005-03-03 02:51:15 +0000
commite85baf02d14d09eae9631697fabcfaea742b2934 (patch)
treed8e6b39be26e6bd3bcc87b0106bf93353987c0be /scumm
parent120b3851967d3c4839b80ee64de58411078cea43 (diff)
downloadscummvm-rg350-e85baf02d14d09eae9631697fabcfaea742b2934.tar.gz
scummvm-rg350-e85baf02d14d09eae9631697fabcfaea742b2934.tar.bz2
scummvm-rg350-e85baf02d14d09eae9631697fabcfaea742b2934.zip
Correct palSlot range
svn-id: r16979
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script_v72he.cpp1
-rw-r--r--scumm/script_v90he.cpp20
2 files changed, 11 insertions, 10 deletions
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index b8e235f778..c32eef2963 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -1111,6 +1111,7 @@ void ScummEngine_v72he::o72_actorOps() {
break;
case 175: // HE 99+
a->hePaletteNum = pop();
+ a->needRedraw = true;
break;
case 198: // SO_ACTOR_VARIABLE
i = pop();
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index a03375fc22..b8840c0d4a 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -1889,7 +1889,7 @@ void ScummEngine_v90he::o90_getObjectData() {
}
uint8 *ScummEngine_v90he::getHEPalette(int palSlot) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
if (palSlot == 1) {
return _currentPalette; // XXX won't work, as size == 768
} else {
@@ -1898,7 +1898,7 @@ uint8 *ScummEngine_v90he::getHEPalette(int palSlot) {
}
void ScummEngine_v90he::setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
uint8 *p = _hePalettes + palSlot * 1024 + color * 3;
*(p + 0) = r;
*(p + 1) = g;
@@ -1907,7 +1907,7 @@ void ScummEngine_v90he::setHEPaletteColor(int palSlot, uint8 color, uint8 r, uin
}
void ScummEngine_v90he::setHEPaletteFromPtr(int palSlot, const uint8 *palData) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
uint8 *pc = _hePalettes + palSlot * 1024;
uint8 *pi = pc + 768;
for (int i = 0; i < 256; ++i) {
@@ -1919,7 +1919,7 @@ void ScummEngine_v90he::setHEPaletteFromPtr(int palSlot, const uint8 *palData) {
}
void ScummEngine_v90he::setHEPaletteFromCostume(int palSlot, int resId) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
const uint8 *data = getResourceAddress(rtCostume, resId);
assert(data);
const uint8 *rgbs = findResourceData(MKID('RGBS'), data);
@@ -1928,7 +1928,7 @@ void ScummEngine_v90he::setHEPaletteFromCostume(int palSlot, int resId) {
}
void ScummEngine_v90he::setHEPaletteFromImage(int palSlot, int resId, int state) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
const uint8 *data = getResourceAddress(rtImage, resId);
assert(data);
const uint8 *rgbs = findWrappedBlock(MKID('RGBS'), data, state, 0);
@@ -1937,7 +1937,7 @@ void ScummEngine_v90he::setHEPaletteFromImage(int palSlot, int resId, int state)
}
void ScummEngine_v90he::setHEPaletteFromRoom(int palSlot, int resId, int state) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
const uint8 *data = getResourceAddress(rtRoom, resId);
assert(data);
const uint8 *rgbs = findWrappedBlock(MKID('PALS'), data, state, 0);
@@ -1946,22 +1946,22 @@ void ScummEngine_v90he::setHEPaletteFromRoom(int palSlot, int resId, int state)
}
void ScummEngine_v90he::restoreHEPalette(int palSlot) {
- assert(palSlot >= 1 && palSlot < _numPalettes);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
if (palSlot != 1) {
memcpy(_hePalettes + palSlot * 1024, _hePalettes + 1024, 1024);
}
}
void ScummEngine_v90he::copyHEPalette(int dstPalSlot, int srcPalSlot) {
- assert(dstPalSlot >= 1 && dstPalSlot < _numPalettes);
- assert(srcPalSlot >= 1 && srcPalSlot < _numPalettes);
+ assert(dstPalSlot >= 1 && dstPalSlot <= _numPalettes);
+ assert(srcPalSlot >= 1 && srcPalSlot <= _numPalettes);
if (dstPalSlot != srcPalSlot) {
memcpy(_hePalettes + srcPalSlot * 1024, _hePalettes + dstPalSlot * 1024, 1024);
}
}
void ScummEngine_v90he::copyHEPaletteColor(int palSlot, uint8 dstColor, uint8 srcColor) {
- assert(palSlot >= 1 && palSlot < _numPalettes - 1);
+ assert(palSlot >= 1 && palSlot <= _numPalettes);
uint8 *dstPal = _hePalettes + palSlot * 1024 + dstColor * 3;
uint8 *srcPal = _hePalettes + (palSlot + 1) * 1024 + srcColor * 3;
memcpy(dstPal, srcPal, 3);