diff options
author | Max Horn | 2006-09-16 13:38:43 +0000 |
---|---|---|
committer | Max Horn | 2006-09-16 13:38:43 +0000 |
commit | b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e (patch) | |
tree | 144c8c7d881894583afdd66b3a584f38520fd699 | |
parent | 61626263236a4e3b9397bd3dfd9c467a4a9a0d31 (diff) | |
download | scummvm-rg350-b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e.tar.gz scummvm-rg350-b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e.tar.bz2 scummvm-rg350-b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e.zip |
Replaced checkRange by assertRange, which has (a) an (IMO) more logical order of parameters, and (b) removes lots of useless duplicate information in error messages
svn-id: r23885
-rw-r--r-- | engines/scumm/actor.cpp | 14 | ||||
-rw-r--r-- | engines/scumm/akos.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/boxes.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/charset.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/he/palette_he.cpp | 30 | ||||
-rw-r--r-- | engines/scumm/he/script_v100he.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/he/script_v60he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/he/script_v72he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/he/script_v90he.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/he/sound_he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/he/sprite_he.cpp | 174 | ||||
-rw-r--r-- | engines/scumm/object.cpp | 26 | ||||
-rw-r--r-- | engines/scumm/palette.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/resource.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/resource_v3.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/resource_v4.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/room.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/script.cpp | 24 | ||||
-rw-r--r-- | engines/scumm/script_v2.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/script_v5.cpp | 10 | ||||
-rw-r--r-- | engines/scumm/script_v6.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/script_v8.cpp | 16 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/util.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/util.h | 2 |
25 files changed, 181 insertions, 183 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 74677add49..809adceb07 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1185,7 +1185,7 @@ void Actor::drawActorCostume(bool hitTestMode) { if (talkState == 0) talkState = _vm->_rnd.getRandomNumberRng(1, 10); - checkRange(13, 1, talkState, "Talk state %d out of range"); + assertRange(1, talkState, 13, "Talk state"); setTalkCondition(talkState); } else { setTalkCondition(1); @@ -1935,12 +1935,12 @@ byte *Actor::getActorName() { } int Actor::getAnimVar(byte var) const { - checkRange(26, 0, var, "getAnimVar %d out of range(r)"); + assertRange(0, var, 26, "getAnimVar:"); return _animVariable[var]; } void Actor::setAnimVar(byte var, int value) { - checkRange(26, 0, var, "setAnimVar %d out of range(r)"); + assertRange(0, var, 26, "setAnimVar:"); _animVariable[var] = value; } @@ -2052,7 +2052,7 @@ void Actor::setHEFlag(int bit, int set) { void Actor::setUserCondition(int slot, int set) { const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF; - checkRange(32, 1, slot, "Condition %d out of range"); + assertRange(1, slot, 32, "setUserCondition: Condition"); if (set == 0) { _heCondMask &= ~(1 << (slot + 0xF)); } else { @@ -2066,13 +2066,13 @@ void Actor::setUserCondition(int slot, int set) { } bool Actor::isUserConditionSet(int slot) const { - checkRange(32, 1, slot, "Condition %d out of range"); + assertRange(1, slot, 32, "isUserConditionSet: Condition"); return (_heCondMask & (1 << (slot + 0xF))) != 0; } void Actor::setTalkCondition(int slot) { const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF; - checkRange(32, 1, slot, "Condition %d out of range"); + assertRange(1, slot, 32, "setTalkCondition: Condition"); _heCondMask = (_heCondMask & ~condMaskCode) | 1; if (slot != 1) { _heCondMask |= 1 << (slot - 1); @@ -2085,7 +2085,7 @@ void Actor::setTalkCondition(int slot) { } bool Actor::isTalkConditionSet(int slot) const { - checkRange(32, 1, slot, "Condition %d out of range"); + assertRange(1, slot, 32, "isTalkConditionSet: Condition"); return (_heCondMask & (1 << (slot - 1))) != 0; } diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 1e6edb9bdd..eb0de5b6e2 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -1717,7 +1717,7 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con void ScummEngine_v6::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2) { _akosQueuePos++; - checkRange(31, 0, _akosQueuePos, "akos_queCommand overflow"); + assertRange(0, _akosQueuePos, 31, "akos_queCommand: _akosQueuePos"); _akosQueue[_akosQueuePos].cmd = cmd; _akosQueue[_akosQueuePos].actor = a->_number; diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index 05969bac33..359d04f65e 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -401,7 +401,7 @@ Box *ScummEngine::getBoxBaseAddr(int box) { if (_game.version <= 4 && ptr[0] == box) box--; - checkRange(ptr[0] - 1, 0, box, "Illegal box %d"); + assertRange(0, box, ptr[0] - 1, "box"); if (_game.version == 0) return (Box *)(ptr + box * SIZEOF_BOX_C64 + 1); else if (_game.version <= 2) diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index e38fbf5934..b4cba89460 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -226,7 +226,7 @@ CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm) } void CharsetRendererCommon::setCurID(byte id) { - checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d"); + assertRange(0, id, _vm->_numCharsets - 1, "charset"); _curId = id; @@ -245,7 +245,7 @@ void CharsetRendererCommon::setCurID(byte id) { } void CharsetRendererV3::setCurID(byte id) { - checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d"); + assertRange(0, id, _vm->_numCharsets - 1, "charset"); _curId = id; @@ -1206,7 +1206,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { byte *charPtr, *dst; int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; - checkRange(_vm->_numCharsets - 1, 0, _curId, "Printing with bad charset %d"); + assertRange(0, _curId, _vm->_numCharsets - 1, "charset"); if ((vs = _vm->findVirtScreen(_top)) == NULL) return; @@ -1316,7 +1316,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { const byte *charPtr; int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; - checkRange(_vm->_numCharsets - 1, 1, _curId, "Printing with bad charset %d"); + assertRange(1, _curId, _vm->_numCharsets - 1, "charset"); if ((vs = _vm->findVirtScreen(_top)) == NULL && (vs = _vm->findVirtScreen(_top + getFontHeight())) == NULL) return; diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp index c9217cae7b..bcec3a75fc 100644 --- a/engines/scumm/he/palette_he.cpp +++ b/engines/scumm/he/palette_he.cpp @@ -78,9 +78,9 @@ uint8 *ScummEngine_v90he::getHEPaletteIndex(int palSlot) { } int ScummEngine_v90he::getHEPaletteSimilarColor(int palSlot, int red, int green, int start, int end) { - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); - checkRange(255, 0, start, "Invalid palette slot %d"); - checkRange(255, 0, end, "Invalid palette slot %d"); + assertRange(1, palSlot, _numPalettes, "palette"); + assertRange(0, start, 255, "start palette slot"); + assertRange(0, end, 255, "pend alette slot"); uint8 *pal = _hePalettes + palSlot * 1024 + start * 3; @@ -104,22 +104,22 @@ int ScummEngine_v90he::getHEPaletteSimilarColor(int palSlot, int red, int green, } int ScummEngine_v90he::getHEPaletteColorComponent(int palSlot, int color, int component) { - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); - checkRange(255, 0, color, "Invalid palette slot %d"); + assertRange(1, palSlot, _numPalettes, "palette"); + assertRange(0, color, 255, "palette slot"); return _hePalettes[palSlot * 1024 + color * 3 + component % 3]; } int ScummEngine_v90he::getHEPaletteColor(int palSlot, int color) { - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); - checkRange(255, 0, color, "Invalid palette slot %d"); + assertRange(1, palSlot, _numPalettes, "palette"); + assertRange(0, color, 255, "palette slot"); return _hePalettes[palSlot * 1024 + 768 + color]; } void ScummEngine_v90he::setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b) { debug(7, "setHEPaletteColor(%d, %d, %d, %d, %d)", palSlot, color, r, g, b); - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); uint8 *p = _hePalettes + palSlot * 1024 + color * 3; *(p + 0) = r; *(p + 1) = g; @@ -128,7 +128,7 @@ void ScummEngine_v90he::setHEPaletteColor(int palSlot, uint8 color, uint8 r, uin } void ScummEngine_v90he::setHEPaletteFromPtr(int palSlot, const uint8 *palData) { - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); uint8 *pc = _hePalettes + palSlot * 1024; uint8 *pi = pc + 768; for (int i = 0; i < 256; ++i) { @@ -141,7 +141,7 @@ void ScummEngine_v90he::setHEPaletteFromPtr(int palSlot, const uint8 *palData) { void ScummEngine_v90he::setHEPaletteFromCostume(int palSlot, int resId) { debug(7, "setHEPaletteFromCostume(%d, %d)", palSlot, resId); - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); const uint8 *data = getResourceAddress(rtCostume, resId); assert(data); const uint8 *rgbs = findResourceData(MKID_BE('RGBS'), data); @@ -151,7 +151,7 @@ void ScummEngine_v90he::setHEPaletteFromCostume(int palSlot, int resId) { void ScummEngine_v90he::setHEPaletteFromImage(int palSlot, int resId, int state) { debug(7, "setHEPaletteFromImage(%d, %d, %d)", palSlot, resId, state); - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); uint8 *data = getResourceAddress(rtImage, resId); assert(data); const uint8 *rgbs = findWrappedBlock(MKID_BE('RGBS'), data, state, 0); @@ -161,7 +161,7 @@ void ScummEngine_v90he::setHEPaletteFromImage(int palSlot, int resId, int state) void ScummEngine_v90he::setHEPaletteFromRoom(int palSlot, int resId, int state) { debug(7, "setHEPaletteFromRoom(%d, %d, %d)", palSlot, resId, state); - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); const uint8 *data = getResourceAddress(rtRoom, resId); assert(data); const uint8 *pals = findResourceData(MKID_BE('PALS'), data); @@ -173,7 +173,7 @@ void ScummEngine_v90he::setHEPaletteFromRoom(int palSlot, int resId, int state) void ScummEngine_v90he::restoreHEPalette(int palSlot) { debug(7, "restoreHEPalette(%d)", palSlot); - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); if (palSlot != 1) { memcpy(_hePalettes + palSlot * 1024, _hePalettes + 1024, 1024); } @@ -190,7 +190,7 @@ void ScummEngine_v90he::copyHEPalette(int dstPalSlot, int srcPalSlot) { void ScummEngine_v90he::copyHEPaletteColor(int palSlot, uint8 dstColor, uint8 srcColor) { debug(7, "copyHEPaletteColor(%d, %d, %d)", palSlot, dstColor, srcColor); - checkRange(_numPalettes, 1, palSlot, "Invalid palette %d"); + assertRange(1, palSlot, _numPalettes, "palette"); uint8 *dstPal = _hePalettes + palSlot * 1024 + dstColor * 3; uint8 *srcPal = _hePalettes + 1024 + srcColor * 3; memcpy(dstPal, srcPal, 3); @@ -205,7 +205,7 @@ void ScummEngine_v99he::setPaletteFromPtr(const byte *ptr, int numcolor) { numcolor = getResourceDataSize(ptr) / 3; } - checkRange(256, 0, numcolor, "Too many colors (%d) in Palette"); + assertRange(0, numcolor, 256, "setPaletteFromPtr: numcolor"); dest = _hePalettes + 1024; diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index d20a0487a6..6d4b84883d 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -455,7 +455,7 @@ void ScummEngine_v100he::o100_actorOps() { case 57: // SO_PALETTE j = pop(); i = pop(); - checkRange(255, 0, i, "o100_actorOps: Illegal palette slot %d"); + assertRange(0, i, 255, "palette slot"); a->remapActorPaletteColor(i, j); a->_needRedraw = true; break; diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 12a4b1c258..7610f9df01 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -554,7 +554,7 @@ void ScummEngine_v60he::o60_roomOps() { case 187: // SO_CYCLE_SPEED b = pop(); a = pop(); - checkRange(16, 1, a, "o60_roomOps: 187: color cycle out of range (%d)"); + assertRange(1, a, 16, "o60_roomOps: 187: color cycle"); _colorCycle[a - 1].delay = (b != 0) ? 0x4000 / (b * 0x4C) : 0; break; @@ -682,7 +682,7 @@ void ScummEngine_v60he::o60_actorOps() { case 86: // SO_PALETTE j = pop(); i = pop(); - checkRange(255, 0, i, "Illegal palette slot %d"); + assertRange(0, i, 255, "o60_actorOps: palette slot"); a->remapActorPaletteColor(i, j); a->_needRedraw = true; break; diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 22ff50476a..e4bfad4b0d 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1174,7 +1174,7 @@ void ScummEngine_v72he::o72_actorOps() { case 86: // SO_PALETTE j = pop(); i = pop(); - checkRange(255, 0, i, "Illegal palette slot %d"); + assertRange(0, i, 255, "palette slot"); a->remapActorPaletteColor(i, j); a->_needRedraw = true; break; @@ -1279,7 +1279,7 @@ void ScummEngine_v72he::o72_verbOps() { if (subOp == 196) { _curVerb = pop(); _curVerbSlot = getVerbSlot(_curVerb, 0); - checkRange(_numVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d"); + assertRange(0, _curVerbSlot, _numVerbs - 1, "new verb slot"); return; } vs = &_verbs[_curVerbSlot]; diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 7032a1fc97..aecbbb2f42 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -466,7 +466,7 @@ void ScummEngine_v90he::o90_getActorData() { push(a->isUserConditionSet(val)); break; case 2: - checkRange(15, 0, val, "Limb %d out of range"); + assertRange(0, val, 15, "o90_getActorData: Limb"); push(a->_cost.frame[val]); break; case 3: diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index f7dc7989a2..d0af600899 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -262,7 +262,7 @@ int SoundHE::getSoundVar(int sound, int var) { return isSoundCodeUsed(sound); } - checkRange(25, 0, var, "Illegal sound variable %d"); + assertRange(0, var, 25, "sound variable"); int chan = -1; for (int i = 0; i < ARRAYSIZE(_heChannel); i ++) { @@ -279,7 +279,7 @@ int SoundHE::getSoundVar(int sound, int var) { } void SoundHE::setSoundVar(int sound, int var, int val) { - checkRange(25, 0, var, "Illegal sound variable %d"); + assertRange(0, var, 25, "sound variable"); int chan = -1; for (int i = 0; i < ARRAYSIZE(_heChannel); i ++) { diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp index 5b0fb0f7fa..a86305d2b9 100644 --- a/engines/scumm/he/sprite_he.cpp +++ b/engines/scumm/he/sprite_he.cpp @@ -49,7 +49,7 @@ void ScummEngine_v90he::allocateArrays() { } void Sprite::getSpriteBounds(int spriteId, bool checkGroup, Common::Rect &bound) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int32 spr_wiz_x, spr_wiz_y; int angle, scale, x1, y1; int32 w, h; @@ -115,7 +115,7 @@ int Sprite::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGroupId, int t for (int j = 0; j < num; j++) { code = classId = args[j]; classId &= 0x7F; - checkRange(32, 1, classId, "class %d out of range in statement"); + assertRange(1, classId, 32, "class"); if (code & 0x80) { if (!(spi->classFlags & (1 << (classId - 1)))) cond = 0; @@ -204,7 +204,7 @@ int Sprite::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGroupId, int t } int Sprite::getSpriteClass(int spriteId, int num, int *args) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int code, classId; if (num == 0) @@ -213,7 +213,7 @@ int Sprite::getSpriteClass(int spriteId, int num, int *args) { for (int i = 0; i < num; i++) { code = classId = args[i]; classId &= 0x7F; - checkRange(32, 1, classId, "class %d out of range in statement"); + assertRange(1, classId, 32, "class"); if (code & 0x80) { if (!(_spriteTable[spriteId].classFlags & (1 << (classId - 1)))) return 0; @@ -227,85 +227,85 @@ int Sprite::getSpriteClass(int spriteId, int num, int *args) { } int Sprite::getSpriteFlagDoubleBuffered(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFDoubleBuffered) != 0) ? 1 : 0; } int Sprite::getSpriteFlagYFlipped(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFYFlipped) != 0) ? 1 : 0; } int Sprite::getSpriteFlagXFlipped(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFXFlipped) != 0) ? 1 : 0; } int Sprite::getSpriteFlagActive(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFActive) != 0) ? 1 : 0; } int Sprite::getSpriteFlagRemapPalette(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFRemapPalette) != 0) ? 1 : 0; } int Sprite::getSpriteFlagAutoAnim(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFAutoAnim) != 0) ? 1 : 0; } int Sprite::getSpriteFlagUpdateType(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFMarkDirty) != 0) ? 1 : 0; } int Sprite::getSpriteFlagEraseType(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return ((_spriteTable[spriteId].flags & kSFImageless) != 0) ? 1 : 0; } int Sprite::getSpriteImage(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].image; } int Sprite::getSpriteImageState(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].imageState; } int Sprite::getSpriteGroup(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].group; } int Sprite::getSpritePalette(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].palette; } int Sprite::getSpritePriority(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].priority; } int Sprite::getSpriteDisplayX(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].group) return _spriteTable[spriteId].tx + _spriteGroups[_spriteTable[spriteId].group].tx; @@ -314,7 +314,7 @@ int Sprite::getSpriteDisplayX(int spriteId) { } int Sprite::getSpriteDisplayY(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].group) return _spriteTable[spriteId].ty + _spriteGroups[_spriteTable[spriteId].group].ty; @@ -323,50 +323,50 @@ int Sprite::getSpriteDisplayY(int spriteId) { } int Sprite::getSpriteUserValue(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].userValue; } int Sprite::getSpriteShadow(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].shadow; } int Sprite::getSpriteImageStateCount(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].imageStateCount; } int Sprite::getSpriteScale(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].scale; } int Sprite::getSpriteAnimSpeed(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].animSpeed; } int Sprite::getSpriteSourceImage(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].sourceImage; } int Sprite::getSpriteMaskImage(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); return _spriteTable[spriteId].maskImage; } int Sprite::getSpriteGeneralProperty(int spriteId, int type) { debug(0, "getSpriteGeneralProperty: spriteId %d type 0x%x", spriteId, type); - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); // XXX U32 related check @@ -383,7 +383,7 @@ int Sprite::getSpriteGeneralProperty(int spriteId, int type) { } void Sprite::getSpriteImageDim(int spriteId, int32 &w, int32 &h) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].image) { _vm->_wiz->getWizImageDim(_spriteTable[spriteId].image, _spriteTable[spriteId].imageState, w, h); @@ -394,14 +394,14 @@ void Sprite::getSpriteImageDim(int spriteId, int32 &w, int32 &h) { } void Sprite::getSpritePosition(int spriteId, int32 &tx, int32 &ty) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); tx = _spriteTable[spriteId].tx; ty = _spriteTable[spriteId].ty; } void Sprite::getSpriteDist(int spriteId, int32 &dx, int32 &dy) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); dx = _spriteTable[spriteId].dx; dy = _spriteTable[spriteId].dy; @@ -413,7 +413,7 @@ void Sprite::getSpriteDist(int spriteId, int32 &dx, int32 &dy) { int ScummEngine_v90he::getGroupSpriteArray(int spriteGroupId) { int i, numSprites = 0; - checkRange(_sprite->_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _sprite->_varNumSpriteGroups, "sprite group"); for (i = (_sprite->_varNumSprites - 1); i > 0; i--) { if (_sprite->_spriteTable[i].group == spriteGroupId) @@ -439,43 +439,43 @@ int ScummEngine_v90he::getGroupSpriteArray(int spriteGroupId) { } int Sprite::getGroupPriority(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); return _spriteGroups[spriteGroupId].priority; } int Sprite::getGroupDstResNum(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); return _spriteGroups[spriteGroupId].image; } int Sprite::getGroupXMul(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); return _spriteGroups[spriteGroupId].scale_x_ratio_mul; } int Sprite::getGroupXDiv(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); return _spriteGroups[spriteGroupId].scale_x_ratio_div; } int Sprite::getGroupYMul(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); return _spriteGroups[spriteGroupId].scale_y_ratio_mul; } int Sprite::getGroupYDiv(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); return _spriteGroups[spriteGroupId].scale_y_ratio_div; } void Sprite::getGroupPosition(int spriteGroupId, int32 &tx, int32 &ty) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); tx = _spriteGroups[spriteGroupId].tx; ty = _spriteGroups[spriteGroupId].ty; @@ -485,7 +485,7 @@ void Sprite::getGroupPosition(int spriteGroupId, int32 &tx, int32 &ty) { // spriteInfoSet functions // void Sprite::setSpritePalette(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].palette != value) { _spriteTable[spriteId].palette = value; @@ -494,7 +494,7 @@ void Sprite::setSpritePalette(int spriteId, int value) { } void Sprite::setSpriteSourceImage(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].sourceImage != value) { _spriteTable[spriteId].sourceImage = value; @@ -503,13 +503,13 @@ void Sprite::setSpriteSourceImage(int spriteId, int value) { } void Sprite::setSpriteMaskImage(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].maskImage = value; } void Sprite::setSpriteImageState(int spriteId, int state) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].image) { int imageStateCount = _spriteTable[spriteId].imageStateCount - 1; @@ -524,7 +524,7 @@ void Sprite::setSpriteImageState(int spriteId, int state) { } void Sprite::setSpritePosition(int spriteId, int tx, int ty) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (_spriteTable[spriteId].tx != tx || _spriteTable[spriteId].ty != ty) { _spriteTable[spriteId].tx = tx; @@ -534,22 +534,22 @@ void Sprite::setSpritePosition(int spriteId, int tx, int ty) { } void Sprite::setSpriteGroup(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); - checkRange(_varNumSpriteGroups, 0, value, "Invalid sprite group %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); + assertRange(0, value, _varNumSpriteGroups, "sprite group"); _spriteTable[spriteId].group = value; _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } void Sprite::setSpriteDist(int spriteId, int value1, int value2) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].dx = value1; _spriteTable[spriteId].dy = value2; } void Sprite::setSpriteShadow(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].shadow = value; if (_spriteTable[spriteId].image) @@ -557,19 +557,19 @@ void Sprite::setSpriteShadow(int spriteId, int value) { } void Sprite::setSpriteUserValue(int spriteId, int value1, int value2) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].userValue = value2; } void Sprite::setSpritePriority(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].priority = value; } void Sprite::moveSprite(int spriteId, int value1, int value2) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].tx += value1; _spriteTable[spriteId].ty += value2; @@ -579,7 +579,7 @@ void Sprite::moveSprite(int spriteId, int value1, int value2) { } void Sprite::setSpriteScale(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].flags |= kSFScaled; @@ -592,7 +592,7 @@ void Sprite::setSpriteScale(int spriteId, int value) { } void Sprite::setSpriteAngle(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].flags |= kSFRotated; @@ -605,7 +605,7 @@ void Sprite::setSpriteAngle(int spriteId, int value) { } void Sprite::setSpriteFlagDoubleBuffered(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int oldFlags = _spriteTable[spriteId].flags; if (value) @@ -618,7 +618,7 @@ void Sprite::setSpriteFlagDoubleBuffered(int spriteId, int value) { } void Sprite::setSpriteFlagYFlipped(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int oldFlags = _spriteTable[spriteId].flags; if (value) @@ -631,7 +631,7 @@ void Sprite::setSpriteFlagYFlipped(int spriteId, int value) { } void Sprite::setSpriteFlagXFlipped(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int oldFlags = _spriteTable[spriteId].flags; if (value) @@ -644,7 +644,7 @@ void Sprite::setSpriteFlagXFlipped(int spriteId, int value) { } void Sprite::setSpriteFlagActive(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (value) _spriteTable[spriteId].flags |= kSFActive; @@ -653,7 +653,7 @@ void Sprite::setSpriteFlagActive(int spriteId, int value) { } void Sprite::setSpriteFlagRemapPalette(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int oldFlags = _spriteTable[spriteId].flags; if (value) @@ -666,7 +666,7 @@ void Sprite::setSpriteFlagRemapPalette(int spriteId, int value) { } void Sprite::setSpriteFlagAutoAnim(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); if (value) _spriteTable[spriteId].flags |= kSFAutoAnim; @@ -675,7 +675,7 @@ void Sprite::setSpriteFlagAutoAnim(int spriteId, int value) { } void Sprite::setSpriteFlagUpdateType(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); switch (value) { case 2: @@ -694,7 +694,7 @@ void Sprite::setSpriteFlagUpdateType(int spriteId, int value) { } void Sprite::setSpriteFlagEraseType(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); // Note that condition is inverted if (!value) @@ -704,15 +704,15 @@ void Sprite::setSpriteFlagEraseType(int spriteId, int value) { } void Sprite::setSpriteAnimSpeed(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].animSpeed = value; _spriteTable[spriteId].animProgress = value; } void Sprite::setSpriteSetClass(int spriteId, int classId, int toggle) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); - checkRange(32, 1, classId, "class %d out of range in statement"); + assertRange(1, spriteId, _varNumSprites, "sprite"); + assertRange(1, classId, 32, "class"); if (toggle) { _spriteTable[spriteId].classFlags |= (1 << (classId - 1)); @@ -722,20 +722,20 @@ void Sprite::setSpriteSetClass(int spriteId, int classId, int toggle) { } void Sprite::setSpriteResetClass(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].classFlags = 0; } void Sprite::setSpriteField84(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].field_84 = value; } void Sprite::setSpriteGeneralProperty(int spriteId, int type, int value) { debug(0, "setSpriteGeneralProperty: spriteId %d type 0x%x", spriteId, type); - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); int32 delay; // XXX U32 related check @@ -761,7 +761,7 @@ void Sprite::setSpriteGeneralProperty(int spriteId, int type, int value) { } void Sprite::resetSprite(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); _spriteTable[spriteId].angle = 0; _spriteTable[spriteId].scale = 0; @@ -793,7 +793,7 @@ void Sprite::resetSprite(int spriteId) { void Sprite::setSpriteImage(int spriteId, int imageNum) { int origResId, origResWizStates; - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + assertRange(1, spriteId, _varNumSprites, "sprite"); origResId = _spriteTable[spriteId].image; origResWizStates = _spriteTable[spriteId].imageStateCount; @@ -832,7 +832,7 @@ void Sprite::redrawSpriteGroup(int spriteGroupId) { } void Sprite::moveGroupMembers(int spriteGroupId, int value1, int value2) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) { @@ -846,7 +846,7 @@ void Sprite::moveGroupMembers(int spriteGroupId, int value1, int value2) { } void Sprite::setGroupMembersPriority(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) @@ -855,7 +855,7 @@ void Sprite::setGroupMembersPriority(int spriteGroupId, int value) { } void Sprite::setGroupMembersGroup(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) { @@ -866,7 +866,7 @@ void Sprite::setGroupMembersGroup(int spriteGroupId, int value) { } void Sprite::setGroupMembersUpdateType(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) @@ -875,7 +875,7 @@ void Sprite::setGroupMembersUpdateType(int spriteGroupId, int value) { } void Sprite::setGroupMembersResetSprite(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) @@ -884,7 +884,7 @@ void Sprite::setGroupMembersResetSprite(int spriteGroupId) { } void Sprite::setGroupMembersAnimationSpeed(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) { @@ -895,7 +895,7 @@ void Sprite::setGroupMembersAnimationSpeed(int spriteGroupId, int value) { } void Sprite::setGroupMembersAutoAnimFlag(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) { @@ -908,7 +908,7 @@ void Sprite::setGroupMembersAutoAnimFlag(int spriteGroupId, int value) { } void Sprite::setGroupMembersShadow(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].group == spriteGroupId) { @@ -920,7 +920,7 @@ void Sprite::setGroupMembersShadow(int spriteGroupId, int value) { } void Sprite::setGroupBounds(int spriteGroupId, int x1, int y1, int x2, int y2) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); _spriteGroups[spriteGroupId].flags |= kSGFClipBox; _spriteGroups[spriteGroupId].bbox.left = x1; @@ -933,7 +933,7 @@ void Sprite::setGroupBounds(int spriteGroupId, int x1, int y1, int x2, int y2) { } void Sprite::setGroupPriority(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (_spriteGroups[spriteGroupId].priority != value) { _spriteGroups[spriteGroupId].priority = value; @@ -942,7 +942,7 @@ void Sprite::setGroupPriority(int spriteGroupId, int value) { } void Sprite::setGroupPosition(int spriteGroupId, int value1, int value2) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (_spriteGroups[spriteGroupId].tx != value1 || _spriteGroups[spriteGroupId].ty != value2) { _spriteGroups[spriteGroupId].tx = value1; @@ -952,7 +952,7 @@ void Sprite::setGroupPosition(int spriteGroupId, int value1, int value2) { } void Sprite::moveGroup(int spriteGroupId, int value1, int value2) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (value1 || value2) { _spriteGroups[spriteGroupId].tx += value1; @@ -962,7 +962,7 @@ void Sprite::moveGroup(int spriteGroupId, int value1, int value2) { } void Sprite::setGroupImage(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (_spriteGroups[spriteGroupId].image != value) { _spriteGroups[spriteGroupId].image = value; @@ -979,7 +979,7 @@ void Sprite::setGroupScaling(int spriteGroupId) { } void Sprite::setGroupXMul(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (_spriteGroups[spriteGroupId].scale_x_ratio_mul != value) { _spriteGroups[spriteGroupId].scale_x_ratio_mul = value; @@ -989,7 +989,7 @@ void Sprite::setGroupXMul(int spriteGroupId, int value) { } void Sprite::setGroupXDiv(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (value == 0) error("setGroupXDiv: Divisor must not be 0"); @@ -1002,7 +1002,7 @@ void Sprite::setGroupXDiv(int spriteGroupId, int value) { } void Sprite::setGroupYMul(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (_spriteGroups[spriteGroupId].scale_y_ratio_mul != value) { _spriteGroups[spriteGroupId].scale_y_ratio_mul = value; @@ -1012,7 +1012,7 @@ void Sprite::setGroupYMul(int spriteGroupId, int value) { } void Sprite::setGroupYDiv(int spriteGroupId, int value) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); if (value == 0) error("setGroupYDiv: Divisor must not be 0"); @@ -1025,7 +1025,7 @@ void Sprite::setGroupYDiv(int spriteGroupId, int value) { } void Sprite::resetGroupBounds(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); _spriteGroups[spriteGroupId].flags &= ~(kSGFClipBox); redrawSpriteGroup(spriteGroupId); @@ -1042,7 +1042,7 @@ void Sprite::allocTables(int numSprites, int numGroups, int numMaxSprites) { } void Sprite::resetGroup(int spriteGroupId) { - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + assertRange(1, spriteGroupId, _varNumSpriteGroups, "sprite group"); SpriteGroup *spg = &_spriteGroups[spriteGroupId]; spg->priority = 0; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 85c4d46247..4cb8122a4f 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -55,9 +55,9 @@ struct BompHeader { /* Bomp header */ bool ScummEngine::getClass(int obj, int cls) const { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getClass"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); cls &= 0x7F; - checkRange(32, 1, cls, "Class %d out of range in getClass"); + assertRange(1, cls, 32, "class"); if (_game.features & GF_SMALL_HEADER) { // Translate the new (V5) object classes to the old classes @@ -82,9 +82,9 @@ bool ScummEngine::getClass(int obj, int cls) const { } void ScummEngine::putClass(int obj, int cls, bool set) { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putClass"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); cls &= 0x7F; - checkRange(32, 1, cls, "Class %d out of range in putClass"); + assertRange(1, cls, 32, "class"); if (_game.features & GF_SMALL_HEADER) { // Translate the new (V5) object classes to the old classes @@ -116,18 +116,18 @@ void ScummEngine::putClass(int obj, int cls, bool set) { } int ScummEngine::getOwner(int obj) const { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getOwner"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); return _objectOwnerTable[obj]; } void ScummEngine::putOwner(int obj, int owner) { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putOwner"); - checkRange(0xFF, 0, owner, "Owner %d out of range in putOwner"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); + assertRange(0, owner, 0xFF, "owner"); _objectOwnerTable[obj] = owner; } int ScummEngine::getState(int obj) { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getState"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); if (!_copyProtection) { // I knew LucasArts sold cracked copies of the original Maniac Mansion, @@ -147,13 +147,13 @@ int ScummEngine::getState(int obj) { } void ScummEngine::putState(int obj, int state) { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putState"); - checkRange(0xFF, 0, state, "State %d out of range in putState"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); + assertRange(0, state, 0xFF, "state"); _objectStateTable[obj] = state; } int ScummEngine::getObjectRoom(int obj) const { - checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getObjectRoom"); + assertRange(0, obj, _numGlobalObjects - 1, "object"); return _objectRoomTable[obj]; } @@ -427,7 +427,7 @@ void ScummEngine::drawObject(int obj, int arg) { if (od.obj_nr == 0) return; - checkRange(_numGlobalObjects - 1, 0, od.obj_nr, "Object %d out of range in drawObject"); + assertRange(0, od.obj_nr, _numGlobalObjects - 1, "object"); const int xpos = od.x_pos / 8; const int ypos = od.y_pos; @@ -1619,7 +1619,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { vs = &virtscr[0]; - checkRange(_numGlobalObjects - 1, 30, eo->number, "Illegal Blast object %d"); + assertRange(30, eo->number, _numGlobalObjects - 1, "blast object"); objnum = getObjectIndex(eo->number); if (objnum == -1) diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index fe6ea4702d..aeb4aa0bfc 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -268,7 +268,7 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) { } } - checkRange(256, 0, numcolor, "Too many colors (%d) in Palette"); + assertRange(0, numcolor, 256, "setPaletteFromPtr: numcolor"); dest = _currentPalette; @@ -357,7 +357,7 @@ void ScummEngine::initCycl(const byte *ptr) { void ScummEngine::stopCycle(int i) { ColorCycle *cycl; - checkRange(16, 0, i, "Stop Cycle %d Out Of Range"); + assertRange(0, i, 16, "stopCycle: cycle"); if (i != 0) { _colorCycle[i - 1].delay = 0; return; diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 3dfc68071a..47e411dd06 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -579,7 +579,7 @@ void ScummEngine::loadCharset(int no) { } assert(no < (int)sizeof(_charsetData) / 16); - checkRange(_numCharsets - 1, 1, no, "Loading illegal charset %d"); + assertRange(1, no, _numCharsets - 1, "charset"); ptr = getResourceAddress(rtCharset, no); @@ -589,7 +589,7 @@ void ScummEngine::loadCharset(int no) { } void ScummEngine::nukeCharset(int i) { - checkRange(_numCharsets - 1, 1, i, "Nuking illegal charset %d"); + assertRange(1, i, _numCharsets - 1, "charset"); res.nukeResource(rtCharset, i); } diff --git a/engines/scumm/resource_v3.cpp b/engines/scumm/resource_v3.cpp index 4d87637fc1..5f9f088bfd 100644 --- a/engines/scumm/resource_v3.cpp +++ b/engines/scumm/resource_v3.cpp @@ -102,7 +102,7 @@ void ScummEngine_v3::loadCharset(int no) { uint32 size; memset(_charsetData, 0, sizeof(_charsetData)); - checkRange(2, 0, no, "Loading illegal charset %d"); + assertRange(0, no, 2, "charset"); closeRoom(); Common::File file; diff --git a/engines/scumm/resource_v4.cpp b/engines/scumm/resource_v4.cpp index 04e37b3728..f6d51373fc 100644 --- a/engines/scumm/resource_v4.cpp +++ b/engines/scumm/resource_v4.cpp @@ -135,7 +135,7 @@ void ScummEngine_v4::loadCharset(int no) { uint32 size; memset(_charsetData, 0, sizeof(_charsetData)); - checkRange(4, 0, no, "Loading illegal charset %d"); + assertRange(0, no, 4, "charset"); closeRoom(); Common::File file; diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 23189a82d0..fa76d7c882 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -331,7 +331,7 @@ void ScummEngine::setupRoomSubBlocks() { id = READ_LE_UINT32(ptr); - checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); + assertRange(_numGlobalScripts, id, _numLocalScripts + _numGlobalScripts, "local script"); _localScriptOffsets[id - _numGlobalScripts] = ptr + 4 - roomResPtr; if (_dumpScripts) { @@ -366,11 +366,11 @@ void ScummEngine::setupRoomSubBlocks() { if (_game.version == 8) { id = READ_LE_UINT32(ptr); - checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); + assertRange(_numGlobalScripts, id, _numLocalScripts + _numGlobalScripts, "local script"); _localScriptOffsets[id - _numGlobalScripts] = ptr + 4 - roomResPtr; } else if (_game.version == 7) { id = READ_LE_UINT16(ptr); - checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); + assertRange(_numGlobalScripts, id, _numLocalScripts + _numGlobalScripts, "local script"); _localScriptOffsets[id - _numGlobalScripts] = ptr + 2 - roomResPtr; } else { id = ptr[0]; diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index 3cf3c9451b..c956121db1 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -542,14 +542,14 @@ int ScummEngine::readVar(uint var) { return !ConfMan.getBool("subtitles"); } - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)"); + assertRange(0, var, _numVariables - 1, "variable (reading)"); return _scummVars[var]; } if (var & 0x8000) { if (_game.heversion >= 80) { var &= 0xFFF; - checkRange(_numRoomVariables - 1, 0, var, "Room variable %d out of range(w)"); + assertRange(0, var, _numRoomVariables - 1, "room variable (reading)"); return _roomVars[var]; } else if (_game.version <= 3 && !(_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns))) { @@ -564,7 +564,7 @@ int ScummEngine::readVar(uint var) { } } - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(rzb)"); + assertRange(0, var, _numVariables - 1, "variable (reading)"); return (_scummVars[ var ] & ( 1 << bit ) ) ? 1 : 0; } else { var &= 0x7FFF; @@ -573,7 +573,7 @@ int ScummEngine::readVar(uint var) { return 0; } - checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)"); + assertRange(0, var, _numBitVariables - 1, "variable (reading)"); return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0; } } @@ -586,9 +586,9 @@ int ScummEngine::readVar(uint var) { } if (_game.heversion >= 80) - checkRange(25, 0, var, "Local variable %d out of range(r)"); + assertRange(0, var, 25, "local variable (reading)"); else - checkRange(20, 0, var, "Local variable %d out of range(r)"); + assertRange(0, var, 20, "local variable (reading)"); return vm.localvar[_currentScript][var]; } @@ -600,7 +600,7 @@ void ScummEngine::writeVar(uint var, int value) { debugC(DEBUG_VARS, "writeVar(%d, %d)", var, value); if (!(var & 0xF000)) { - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)"); + assertRange(0, var, _numVariables - 1, "variable (writing)"); if (VAR_SUBTITLES != 0xFF && var == VAR_SUBTITLES) { // Ignore default setting in HE72-73 games @@ -641,7 +641,7 @@ void ScummEngine::writeVar(uint var, int value) { if (var & 0x8000) { if (_game.heversion >= 80) { var &= 0xFFF; - checkRange(_numRoomVariables - 1, 0, var, "Room variable %d out of range(w)"); + assertRange(0, var, _numRoomVariables - 1, "room variable (writing)"); _roomVars[var] = value; } else if (_game.version <= 3 && !(_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns))) { @@ -649,14 +649,14 @@ void ScummEngine::writeVar(uint var, int value) { // as the normal variables! int bit = var & 0xF; var = (var >> 4) & 0xFF; - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(wzb)"); + assertRange(0, var, _numVariables - 1, "variable (writing)"); if (value) _scummVars[var] |= ( 1 << bit ); else _scummVars[var] &= ~( 1 << bit ); } else { var &= 0x7FFF; - checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(w)"); + assertRange(0, var, _numBitVariables - 1, "bit variable (writing)"); if (value) _bitVars[var >> 3] |= (1 << (var & 7)); @@ -674,9 +674,9 @@ void ScummEngine::writeVar(uint var, int value) { } if (_game.heversion >= 80) - checkRange(25, 0, var, "Local variable %d out of range(w)"); + assertRange(0, var, 25, "local variable (writing)"); else - checkRange(20, 0, var, "Local variable %d out of range(w)"); + assertRange(0, var, 20, "local variable (writing)"); vm.localvar[_currentScript][var] = value; return; diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index aee06420c1..ace9a2fe8e 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -434,13 +434,13 @@ int ScummEngine_v2::readVar(uint var) { if (var >= 14 && var <= 16) var = _scummVars[var]; - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)"); + assertRange(0, var, _numVariables - 1, "variable (reading)"); debugC(DEBUG_VARS, "readvar(%d) = %d", var, _scummVars[var]); return _scummVars[var]; } void ScummEngine_v2::writeVar(uint var, int value) { - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)"); + assertRange(0, var, _numVariables - 1, "variable (writing)"); debugC(DEBUG_VARS, "writeVar(%d) = %d", var, value); if (VAR_CUTSCENEEXIT_KEY != 0xFF && var == VAR_CUTSCENEEXIT_KEY) { diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index c393050c8d..dbd5e2a77c 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -462,7 +462,7 @@ void ScummEngine_v5::o5_actorOps() { case 11: // SO_PALETTE i = getVarOrDirectByte(PARAM_1); j = getVarOrDirectByte(PARAM_2); - checkRange(31, 0, i, "Illegal palette slot %d"); + assertRange(0, i, 31, "o5_actorOps: palette slot"); a->setPalette(i, j); break; case 12: // SO_TALK_COLOR @@ -1817,7 +1817,7 @@ void ScummEngine_v5::o5_roomOps() { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } - checkRange(256, 0, a, "o5_roomOps: 2: Illegal room color slot (%d)"); + assertRange(0, a, 256, "o5_roomOps: 2: room color slot"); _roomPalette[b] = a; _fullRedraw = true; } else { @@ -1838,7 +1838,7 @@ void ScummEngine_v5::o5_roomOps() { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } - checkRange(256, 0, a, "o5_roomOps: 2: Illegal room color slot (%d)"); + assertRange(0, a, 256, "o5_roomOps: 4: room color slot"); _shadowPalette[b] = a; setDirtyColors(b, b); } else { @@ -1992,7 +1992,7 @@ void ScummEngine_v5::o5_roomOps() { case 16: // SO_CYCLE_SPEED a = getVarOrDirectByte(PARAM_1); b = getVarOrDirectByte(PARAM_2); - checkRange(16, 1, a, "o5_roomOps: 16: color cycle out of range (%d)"); + assertRange(1, a, 16, "o5_roomOps: 16: color cycle"); _colorCycle[a - 1].delay = (b != 0) ? 0x4000 / (b * 0x4C) : 0; break; default: @@ -2342,7 +2342,7 @@ void ScummEngine_v5::o5_verbOps() { verb = getVarOrDirectByte(PARAM_1); slot = getVerbSlot(verb, 0); - checkRange(_numVerbs - 1, 0, slot, "Illegal new verb slot %d"); + assertRange(0, slot, _numVerbs - 1, "new verb slot"); vs = &_verbs[slot]; vs->verbid = verb; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index b6fed34c9c..500801673f 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -1749,7 +1749,7 @@ void ScummEngine_v6::o6_roomOps() { case 187: // SO_CYCLE_SPEED b = pop(); a = pop(); - checkRange(16, 1, a, "o6_roomOps: 187: color cycle out of range (%d)"); + assertRange(1, a, 16, "o6_roomOps: 187: color cycle"); _colorCycle[a - 1].delay = (b != 0) ? 0x4000 / (b * 0x4C) : 0; break; @@ -1833,7 +1833,7 @@ void ScummEngine_v6::o6_actorOps() { case 86: // SO_PALETTE j = pop(); i = pop(); - checkRange(255, 0, i, "Illegal palette slot %d"); + assertRange(0, i, 255, "o6_actorOps: palette slot"); a->setPalette(i, j); break; case 87: // SO_TALK_COLOR @@ -1933,7 +1933,7 @@ void ScummEngine_v6::o6_verbOps() { if (subOp == 196) { _curVerb = pop(); _curVerbSlot = getVerbSlot(_curVerb, 0); - checkRange(_numVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d"); + assertRange(0, _curVerbSlot, _numVerbs - 1, "new verb slot"); return; } vs = &_verbs[_curVerbSlot]; diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index f9e6e11c30..6bce0c7a93 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -393,19 +393,19 @@ int ScummEngine_v8::readVar(uint var) { debugC(DEBUG_VARS, "readvar(%d)", var); if (!(var & 0xF0000000)) { - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)"); + assertRange(0, var, _numVariables - 1, "variable"); return _scummVars[var]; } if (var & 0x80000000) { var &= 0x7FFFFFFF; - checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)"); + assertRange(0, var, _numBitVariables - 1, "bit variable (reading)"); return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0; } if (var & 0x40000000) { var &= 0xFFFFFFF; - checkRange(25, 0, var, "Local variable %d out of range(r)"); + assertRange(0, var, 25, "local variable (reading)"); return vm.localvar[_currentScript][var]; } @@ -417,7 +417,7 @@ void ScummEngine_v8::writeVar(uint var, int value) { debugC(DEBUG_VARS, "writeVar(%d, %d)", var, value); if (!(var & 0xF0000000)) { - checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)"); + assertRange(0, var, _numVariables - 1, "variable (writing)"); if (var == VAR_CHARINC) { if (ConfMan.hasKey("talkspeed")) { @@ -441,7 +441,7 @@ void ScummEngine_v8::writeVar(uint var, int value) { if (var & 0x80000000) { var &= 0x7FFFFFFF; - checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(w)"); + assertRange(0, var, _numBitVariables - 1, "bit variable (writing)"); if (value) _bitVars[var >> 3] |= (1 << (var & 7)); @@ -452,7 +452,7 @@ void ScummEngine_v8::writeVar(uint var, int value) { if (var & 0x40000000) { var &= 0xFFFFFFF; - checkRange(25, 0, var, "Local variable %d out of range(w)"); + assertRange(0, var, 25, "local variable (writing)"); vm.localvar[_currentScript][var] = value; return; } @@ -934,7 +934,7 @@ void ScummEngine_v8::o8_actorOps() { case 0x6F: // SO_ACTOR_PALETTE Set actor palette j = pop(); i = pop(); - checkRange(31, 0, i, "Illegal palette slot %d"); + assertRange(0, i, 31, "o8_actorOps: palette slot"); a->setPalette(i, j); break; case 0x70: // SO_ACTOR_TALK_COLOR Set actor talk color @@ -1055,7 +1055,7 @@ void ScummEngine_v8::o8_verbOps() { if (subOp == 0x96) { _curVerb = pop(); _curVerbSlot = getVerbSlot(_curVerb, 0); - checkRange(_numVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d"); + assertRange(0, _curVerbSlot, _numVerbs - 1, "new verb slot"); //printf("Setting current actor to %d\n", _curActor); return; } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 912bcb9ff3..d320bc55de 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1954,13 +1954,13 @@ void ScummEngine_v7::scummLoop_handleSound() { #pragma mark - int ScummEngine_v60he::getHETimer(int timer) { - checkRange(15, 1, timer, "getHETimer: Timer out of range(%d)"); + assertRange(1, timer, 15, "getHETimer: Timer"); int time = _system->getMillis() - _heTimers[timer]; return time; } void ScummEngine_v60he::setHETimer(int timer) { - checkRange(15, 1, timer, "setHETimer: Timer out of range(%d)"); + assertRange(1, timer, 15, "setHETimer: Timer"); _heTimers[timer] = _system->getMillis(); } diff --git a/engines/scumm/util.cpp b/engines/scumm/util.cpp index 480dc01ba0..a0f3b05c5e 100644 --- a/engines/scumm/util.cpp +++ b/engines/scumm/util.cpp @@ -29,11 +29,9 @@ namespace Scumm { #pragma mark --- Utilities --- #pragma mark - -void checkRange(int max, int min, int no, const char *str) { - if (no < min || no > max) { - char buf[256]; - snprintf(buf, sizeof(buf), str, no); - error("Value %d is out of bounds (%d,%d) (%s)", no, min, max, buf); +void assertRange(int min, int value, int max, const char *desc) { + if (value < min || value > max) { + error("%s %d is out of bounds (%d,%d)", desc, value, min, max); } } diff --git a/engines/scumm/util.h b/engines/scumm/util.h index ebd56ff477..ca1ecd6293 100644 --- a/engines/scumm/util.h +++ b/engines/scumm/util.h @@ -38,7 +38,7 @@ int normalizeAngle(int angle); int fromSimpleDir(int dirtype, int dir); int toSimpleDir(int dirtype, int dir); -void checkRange(int max, int min, int no, const char *str); +void assertRange(int min, int value, int max, const char *desc); const char *tag2str(uint32 tag); |