Correct palSlot range
svn-id: r16979
This commit is contained in:
parent
120b385196
commit
e85baf02d1
2 changed files with 11 additions and 10 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue