fix off by one error

svn-id: r6442
This commit is contained in:
Max Horn 2003-01-13 13:37:43 +00:00
parent 35d3d26f0c
commit e704837f5c
2 changed files with 9 additions and 8 deletions

View File

@ -136,9 +136,9 @@ int Scumm::getScale(int box, int x, int y)
if (_features & GF_AFTER_V8) {
int slot = FROM_LE_32(ptr->v8.scaleSlot);
if (slot) {
assert(0 <= slot && slot < 20);
assert(1 <= slot && slot <= 20);
int scaleX = 0, scaleY = 0;
ScaleSlot &s = _scaleSlots[slot];
ScaleSlot &s = _scaleSlots[slot-1];
if (s.y1 == s.y2 && s.x1 == s.x2)
error("Invalid scale slot %d", slot);

View File

@ -980,12 +980,13 @@ void Scumm::setScaleItem(int slot, int a, int b, int c, int d)
void Scumm::setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, int scale2)
{
_scaleSlots[slot].x2 = x2;
_scaleSlots[slot].y2 = y2;
_scaleSlots[slot].scale2 = scale2;
_scaleSlots[slot].x1 = x1;
_scaleSlots[slot].y1 = y1;
_scaleSlots[slot].scale1 = scale1;
assert(1 <= slot && slot <= 20);
_scaleSlots[slot-1].x2 = x2;
_scaleSlots[slot-1].y2 = y2;
_scaleSlots[slot-1].scale2 = scale2;
_scaleSlots[slot-1].x1 = x1;
_scaleSlots[slot-1].y1 = y1;
_scaleSlots[slot-1].scale1 = scale1;
}
void Scumm::dumpResource(char *tag, int idx, byte *ptr)