diff options
Diffstat (limited to 'engines/scumm/he')
-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 |
7 files changed, 110 insertions, 110 deletions
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; |