[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.97,1.98 bomp.cpp,2.15,2.16 charset.cpp,2.81,2.82 costume.cpp,1.125,1.126 gfx.cpp,2.257,2.258 gfx.h,1.57,1.58 object.cpp,1.156,1.157 script_v8.cpp,2.220,2.221
Max Horn
fingolfin at users.sourceforge.net
Wed Jan 7 19:11:01 CET 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv26986
Modified Files:
akos.cpp bomp.cpp charset.cpp costume.cpp gfx.cpp gfx.h
object.cpp script_v8.cpp
Log Message:
cleanup (make some more use of class Common::Rect)
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- akos.cpp 6 Jan 2004 17:28:28 -0000 1.97
+++ akos.cpp 8 Jan 2004 03:10:16 -0000 1.98
@@ -536,8 +536,8 @@
bool use_scaling;
int i, j;
int skip = 0, startScaleIndexX, startScaleIndexY;
- int cur_x, x_right, x_left;
- int cur_y, y_top, y_bottom;
+ Common::Rect rect;
+ int cur_x, cur_y;
int step;
byte drawFlag = 1;
@@ -586,16 +586,16 @@
cur_x -= v1.scaleXstep;
}
- x_left = x_right = cur_x;
+ rect.left = rect.right = cur_x;
j = startScaleIndexX;
for (i = 0, skip = 0; i < _width; i++) {
- if (x_right < 0) {
+ if (rect.right < 0) {
skip++;
startScaleIndexX = j;
}
if (v1.scaletable[j++] < _scaleX)
- x_right++;
+ rect.right++;
}
} else {
/* No mirror */
@@ -607,16 +607,16 @@
cur_x += v1.scaleXstep;
}
- x_left = x_right = cur_x;
+ rect.left = rect.right = cur_x;
j = startScaleIndexX;
for (i = 0, skip = 0; i < _width; i++) {
- if (x_left >= (int)_outwidth) {
+ if (rect.left >= (int)_outwidth) {
startScaleIndexX = j;
skip++;
}
if (v1.scaletable[j--] < _scaleX)
- x_left--;
+ rect.left--;
}
}
@@ -635,11 +635,11 @@
cur_y -= step;
}
- y_top = y_bottom = cur_y;
+ rect.top = rect.bottom = cur_y;
startScaleIndexY = 0x180 - ymoveCur;
for (i = 0; i < _height; i++) {
if (v1.scaletable[startScaleIndexY++] < _scaleY)
- y_bottom++;
+ rect.bottom++;
}
startScaleIndexY = 0x180 - ymoveCur;
@@ -651,15 +651,15 @@
cur_y += ymoveCur;
if (_mirror) {
- x_left = cur_x;
- x_right = cur_x + _width;
+ rect.left = cur_x;
+ rect.right = cur_x + _width;
} else {
- x_right = cur_x;
- x_left = cur_x - _width;
+ rect.right = cur_x;
+ rect.left = cur_x - _width;
}
- y_top = cur_y;
- y_bottom = cur_y + _height;
+ rect.top = cur_y;
+ rect.bottom = cur_y + _height;
startScaleIndexX = 0x180;
startScaleIndexY = 0x180;
@@ -671,15 +671,15 @@
v1.scaleXstep = _mirror ? 1 : -1;
if (_actorHitMode) {
- if (_actorHitX < x_left || _actorHitX >= x_right || _actorHitY < y_top || _actorHitY >= y_bottom)
+ if (_actorHitX < rect.left || _actorHitX >= rect.right || _actorHitY < rect.top || _actorHitY >= rect.bottom)
return 0;
} else
- _vm->markRectAsDirty(kMainVirtScreen, x_left, x_right, y_top, y_bottom, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right, rect.top, rect.bottom, _actorID);
- if (y_top >= (int)_outheight || y_bottom <= 0)
+ if (rect.top >= (int)_outheight || rect.bottom <= 0)
return 0;
- if (x_left >= (int)_outwidth || x_right <= 0)
+ if (rect.left >= (int)_outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -692,7 +692,7 @@
codec1_ignorePakCols(skip);
cur_x = 0;
} else {
- skip = x_right - _outwidth;
+ skip = rect.right - _outwidth;
if (skip <= 0) {
drawFlag = 2;
} else {
@@ -701,13 +701,13 @@
}
} else {
if (!use_scaling)
- skip = x_right - _outwidth + 1;
+ skip = rect.right - _outwidth + 1;
if (skip > 0) {
v1.skip_width -= skip;
codec1_ignorePakCols(skip);
cur_x = _outwidth - 1;
} else {
- skip = -1 - x_left;
+ skip = -1 - rect.left;
if (skip <= 0) {
drawFlag = 2;
} else {
@@ -722,16 +722,16 @@
if (v1.skip_width <= 0 || _height <= 0)
return 0;
- if ((uint) y_top > _outheight)
- y_top = 0;
+ if ((uint) rect.top > _outheight)
+ rect.top = 0;
- if ((uint) y_bottom > _outheight)
- y_bottom = _outheight;
+ if ((uint) rect.bottom > _outheight)
+ rect.bottom = _outheight;
- if (_draw_top > y_top)
- _draw_top = y_top;
- if (_draw_bottom < y_bottom)
- _draw_bottom = y_bottom;
+ if (_draw_top > rect.top)
+ _draw_top = rect.top;
+ if (_draw_bottom < rect.bottom)
+ _draw_bottom = rect.bottom;
v1.destptr = _outptr + v1.y * _outwidth + v1.x;
@@ -745,7 +745,8 @@
byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
- int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh;
+ Common::Rect clip;
+ int32 maxw, maxh;
if (_actorHitMode) {
warning("codec5: _actorHitMode not yet implemented");
@@ -753,42 +754,42 @@
}
if (!_mirror) {
- clip_left = (_actorX - xmoveCur - _width) + 1;
+ clip.left = (_actorX - xmoveCur - _width) + 1;
} else {
- clip_left = _actorX + xmoveCur - 1;
+ clip.left = _actorX + xmoveCur - 1;
}
- clip_top = _actorY + ymoveCur;
- clip_right = (clip_left + _width) - 1;
- clip_bottom = (clip_top + _height) - 1;
+ clip.top = _actorY + ymoveCur;
+ clip.right = (clip.left + _width) - 1;
+ clip.bottom = (clip.top + _height) - 1;
maxw = _outwidth - 1;
maxh = _outheight - 1;
- _vm->markRectAsDirty(kMainVirtScreen, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
- if (clip_top < 0) {
- clip_top = 0;
+ if (clip.top < 0) {
+ clip.top = 0;
}
- if (clip_bottom > maxh) {
- clip_bottom = maxh;
+ if (clip.bottom > maxh) {
+ clip.bottom = maxh;
}
- if (clip_left < 0) {
- clip_left = 0;
+ if (clip.left < 0) {
+ clip.left = 0;
}
- if (clip_right > maxw) {
- clip_right = maxw;
+ if (clip.right > maxw) {
+ clip.right = maxw;
}
- if ((clip_left >= clip_right) || (clip_top >= clip_bottom))
+ if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
return 0;
- if (_draw_top > clip_top)
- _draw_top = clip_top;
- if (_draw_bottom < clip_bottom)
- _draw_bottom = clip_bottom + 1;
+ if (_draw_top > clip.top)
+ _draw_top = clip.top;
+ if (_draw_bottom < clip.bottom)
+ _draw_bottom = clip.bottom + 1;
BompDrawData bdd;
@@ -955,7 +956,8 @@
}
byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
- int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh;
+ Common::Rect clip;
+ int32 maxw, maxh;
int32 skip_x, skip_y, cur_x, cur_y;
const byte transparency = (_vm->_features & GF_HUMONGOUS) ? 0 : 255;
@@ -965,14 +967,14 @@
}
if (!_mirror) {
- clip_left = (_actorX - xmoveCur - _width) + 1;
+ clip.left = (_actorX - xmoveCur - _width) + 1;
} else {
- clip_left = _actorX + xmoveCur;
+ clip.left = _actorX + xmoveCur;
}
- clip_top = ymoveCur + _actorY;
- clip_right = (clip_left + _width) - 1;
- clip_bottom = (clip_top + _height) - 1;
+ clip.top = ymoveCur + _actorY;
+ clip.right = (clip.left + _width) - 1;
+ clip.bottom = (clip.top + _height) - 1;
maxw = _outwidth - 1;
maxh = _outheight - 1;
@@ -981,39 +983,39 @@
cur_x = _width - 1;
cur_y = _height - 1;
- _vm->markRectAsDirty(kMainVirtScreen, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
- if (clip_left < 0) {
- skip_x = -clip_left;
- clip_left = 0;
+ if (clip.left < 0) {
+ skip_x = -clip.left;
+ clip.left = 0;
}
- if (clip_right > maxw) {
- cur_x -= clip_right - maxw;
- clip_right = maxw;
+ if (clip.right > maxw) {
+ cur_x -= clip.right - maxw;
+ clip.right = maxw;
}
- if (clip_top < 0) {
- skip_y -= clip_top;
- clip_top = 0;
+ if (clip.top < 0) {
+ skip_y -= clip.top;
+ clip.top = 0;
}
- if (clip_bottom > maxh) {
- cur_y -= clip_bottom - maxh;
- clip_bottom = maxh;
+ if (clip.bottom > maxh) {
+ cur_y -= clip.bottom - maxh;
+ clip.bottom = maxh;
}
- if ((clip_left >= clip_right) || (clip_top >= clip_bottom))
+ if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
return 0;
- if (_draw_top > clip_top)
- _draw_top = clip_top;
- if (_draw_bottom < clip_bottom)
- _draw_bottom = clip_bottom + 1;
+ if (_draw_top > clip.top)
+ _draw_top = clip.top;
+ if (_draw_bottom < clip.bottom)
+ _draw_bottom = clip.bottom + 1;
int32 width_unk, height_unk;
- height_unk = clip_top;
+ height_unk = clip.top;
int32 pitch = _outwidth;
int32 dir;
@@ -1024,10 +1026,10 @@
int tmp_skip_x = skip_x;
skip_x = _width - 1 - cur_x;
cur_x = _width - 1 - tmp_skip_x;
- width_unk = clip_right;
+ width_unk = clip.right;
} else {
dir = 1;
- width_unk = clip_left;
+ width_unk = clip.left;
}
int32 out_height;
@@ -1052,8 +1054,8 @@
if (_zbuf == 0) {
akos16Decompress(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency);
} else {
- byte *ptr = _vm->getMaskBuffer(clip_left, clip_top, _zbuf);
- akos16DecompressMask(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip_left / 8);
+ byte *ptr = _vm->getMaskBuffer(clip.left, clip.top, _zbuf);
+ akos16DecompressMask(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip.left / 8);
}
return 0;
Index: bomp.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/bomp.cpp,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -d -r2.15 -r2.16
--- bomp.cpp 6 Jan 2004 12:45:29 -0000 2.15
+++ bomp.cpp 8 Jan 2004 03:10:16 -0000 2.16
@@ -200,7 +200,7 @@
byte maskbit;
byte *mask = 0;
byte *charset_mask;
- int clip_left, clip_right, clip_top, clip_bottom;
+ Common::Rect clip;
byte *scalingYPtr = bd.scalingYPtr;
byte skip_y_bits = 0x80;
byte skip_y_new = 0;
@@ -208,38 +208,38 @@
if (bd.x < 0) {
- clip_left = -bd.x;
+ clip.left = -bd.x;
} else {
- clip_left = 0;
+ clip.left = 0;
}
if (bd.y < 0) {
- clip_top = -bd.y;
+ clip.top = -bd.y;
} else {
- clip_top = 0;
+ clip.top = 0;
}
- clip_right = bd.srcwidth;
- if (clip_right > bd.outwidth - bd.x) {
- clip_right = bd.outwidth - bd.x;
+ clip.right = bd.srcwidth;
+ if (clip.right > bd.outwidth - bd.x) {
+ clip.right = bd.outwidth - bd.x;
}
- clip_bottom = bd.srcheight;
- if (clip_bottom > bd.outheight - bd.y) {
- clip_bottom = bd.outheight - bd.y;
+ clip.bottom = bd.srcheight;
+ if (clip.bottom > bd.outheight - bd.y) {
+ clip.bottom = bd.outheight - bd.y;
}
src = bd.dataptr;
- dst = bd.out + bd.y * bd.outwidth + bd.x + clip_left;
+ dst = bd.out + bd.y * bd.outwidth + bd.x + clip.left;
- maskbit = revBitMask[(bd.x + clip_left) & 7];
+ maskbit = revBitMask[(bd.x + clip.left) & 7];
// Always mask against the charset mask
- charset_mask = getMaskBuffer(bd.x + clip_left, bd.y, 0);
+ charset_mask = getMaskBuffer(bd.x + clip.left, bd.y, 0);
// Also mask against any additionally imposed mask
if (bd.maskPtr) {
- mask = bd.maskPtr + (bd.y * gdi._numStrips) + ((bd.x + clip_left) / 8);
+ mask = bd.maskPtr + (bd.y * gdi._numStrips) + ((bd.x + clip.left) / 8);
}
// Setup vertical scaling
@@ -249,20 +249,20 @@
skip_y_new = *scalingYPtr++;
skip_y_bits = 0x80;
- if (clip_bottom > bd.scaleBottom) {
- clip_bottom = bd.scaleBottom;
+ if (clip.bottom > bd.scaleBottom) {
+ clip.bottom = bd.scaleBottom;
}
}
// Setup horizontal scaling
if (bd.scale_x != 255) {
assert(bd.scalingXPtr);
- if (clip_right > bd.scaleRight) {
- clip_right = bd.scaleRight;
+ if (clip.right > bd.scaleRight) {
+ clip.right = bd.scaleRight;
}
}
- const int width = clip_right - clip_left;
+ const int width = clip.right - clip.left;
if (width <= 0)
return;
@@ -270,10 +270,10 @@
int pos_y = 0;
byte line_buffer[1024];
- byte *line_ptr = line_buffer + clip_left;
+ byte *line_ptr = line_buffer + clip.left;
// Loop over all lines
- while (pos_y < clip_bottom) {
+ while (pos_y < clip.bottom) {
// Decode a single (bomp encoded) line, reversed if we are in mirror mode
if (mirror)
bompDecodeLineReverse(line_buffer, src + 2, bd.srcwidth);
@@ -303,9 +303,9 @@
bompScaleFuncX(line_buffer, bd.scalingXPtr, 0x80, bd.srcwidth);
}
- // The first clip_top lines are to be clipped, i.e. not drawn
- if (clip_top > 0) {
- clip_top--;
+ // The first clip.top lines are to be clipped, i.e. not drawn
+ if (clip.top > 0) {
+ clip.top--;
} else {
// Replace the parts of the line which are masked with the transparency color
if (bd.maskPtr)
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.81
retrieving revision 2.82
diff -u -d -r2.81 -r2.82
--- charset.cpp 8 Jan 2004 02:16:27 -0000 2.81
+++ charset.cpp 8 Jan 2004 03:10:16 -0000 2.82
@@ -1264,24 +1264,24 @@
}
void CharsetRendererNut::printChar(int chr) {
- int shadow_left, shadow_right, shadow_top, shadow_bottom;
+ Common::Rect shadow;
assert(_current);
if (chr == '@')
return;
- shadow_left = _left - 1;
- shadow_top = _top - 1;
+ shadow.left = _left - 1;
+ shadow.top = _top - 1;
// Note that the character is drawn with a shadow, so it is slightly
// larger than the advertised dimensions. See drawShadowChar() for
// details.
if (_firstChar) {
- _str.left = shadow_left;
- _str.top = shadow_top;
- _str.right = shadow_left;
- _str.bottom = shadow_top;
+ _str.left = shadow.left;
+ _str.top = shadow.top;
+ _str.right = shadow.left;
+ _str.bottom = shadow.top;
_firstChar = false;
}
@@ -1291,23 +1291,23 @@
if (chr >= 256 && _vm->_CJKMode)
width = 16;
- shadow_right = _left + width + 2;
- shadow_bottom = _top + height + 2;
+ shadow.right = _left + width + 2;
+ shadow.bottom = _top + height + 2;
_hasMask = true;
_current->drawShadowChar(chr, _left, _top - _vm->_screenTop, _color, !_ignoreCharsetMask);
- _vm->markRectAsDirty(kMainVirtScreen, shadow_left, shadow_right, shadow_top, shadow_bottom, 0);
+ _vm->markRectAsDirty(kMainVirtScreen, shadow.left, shadow.right, shadow.top, shadow.bottom, 0);
if (_str.left > _left)
_str.left = _left;
_left += width;
- if (_str.right < shadow_right )
- _str.right = shadow_right;
+ if (_str.right < shadow.right )
+ _str.right = shadow.right;
- if (_str.bottom < shadow_bottom)
- _str.bottom = shadow_bottom;
+ if (_str.bottom < shadow.bottom)
+ _str.bottom = shadow.bottom;
}
} // End of namespace Scumm
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- costume.cpp 6 Jan 2004 12:45:30 -0000 1.125
+++ costume.cpp 8 Jan 2004 03:10:16 -0000 1.126
@@ -77,8 +77,7 @@
byte startScaleIndexX;
byte newAmiCost;
int ex1, ex2;
- int y_top, y_bottom;
- int x_left, x_right;
+ Common::Rect rect;
int step;
newAmiCost = (_vm->_version == 5) && (_vm->_features & GF_AMIGA);
@@ -128,16 +127,16 @@
if (cost_scaleTable[_scaleIndexX++] < _scaleX)
v1.x -= v1.scaleXstep;
}
- x_right = x_left = v1.x;
+ rect.right = rect.left = v1.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
- if (x_right < 0) {
+ if (rect.right < 0) {
skip++;
startScaleIndexX = _scaleIndexX;
}
scal = cost_scaleTable[_scaleIndexX++];
if (scal < _scaleX)
- x_right++;
+ rect.right++;
}
} else {
startScaleIndexX = _scaleIndexX = xmoveCur + 128;
@@ -146,16 +145,16 @@
if (scal < _scaleX)
v1.x += v1.scaleXstep;
}
- x_right = x_left = v1.x;
+ rect.right = rect.left = v1.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
- if (x_left >= (int)_outwidth) {
+ if (rect.left >= (int)_outwidth) {
skip++;
startScaleIndexX = _scaleIndexX;
}
scal = cost_scaleTable[_scaleIndexX--];
if (scal < _scaleX)
- x_left--;
+ rect.left--;
}
}
_scaleIndexX = startScaleIndexX;
@@ -173,12 +172,12 @@
if (scal < _scaleY)
v1.y -= step;
}
- y_top = y_bottom = v1.y;
+ rect.top = rect.bottom = v1.y;
_scaleIndexY = 128 - ymoveCur;
for (i = 0; i < _height; i++) {
scal = cost_scaleTable[_scaleIndexY++];
if (scal < _scaleY)
- y_bottom++;
+ rect.bottom++;
}
_scaleIndexY = 128 - ymoveCur;
} else {
@@ -187,14 +186,14 @@
v1.x += xmoveCur;
v1.y += ymoveCur;
if (_mirror) {
- x_left = v1.x;
- x_right = v1.x + _width;
+ rect.left = v1.x;
+ rect.right = v1.x + _width;
} else {
- x_left = v1.x - _width;
- x_right = v1.x;
+ rect.left = v1.x - _width;
+ rect.right = v1.x;
}
- y_top = v1.y;
- y_bottom = y_top + _height;
+ rect.top = v1.y;
+ rect.bottom = rect.top + _height;
}
v1.skip_width = _width;
@@ -202,14 +201,14 @@
if (_vm->_version == 1)
//HACK: it fix gfx glitches leaved by actor costume in V1 games, when actor moving to left
- _vm->markRectAsDirty(kMainVirtScreen, x_left, x_right + 8, y_top, y_bottom, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID);
else
- _vm->markRectAsDirty(kMainVirtScreen, x_left, x_right + 1, y_top, y_bottom, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
- if (y_top >= (int)_outheight || y_bottom <= 0)
+ if (rect.top >= (int)_outheight || rect.bottom <= 0)
return 0;
- if (x_left >= (int)_outwidth || x_right <= 0)
+ if (rect.left >= (int)_outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -224,7 +223,7 @@
v1.x = 0;
}
} else {
- skip = x_right - _outwidth;
+ skip = rect.right - _outwidth;
if (skip <= 0) {
drawFlag = 2;
} else {
@@ -233,7 +232,7 @@
}
} else {
if (!use_scaling)
- skip = x_right - _outwidth;
+ skip = rect.right - _outwidth;
if (skip > 0) {
if (!newAmiCost && _loaded._format != 0x57) {
v1.skip_width -= skip;
@@ -241,7 +240,7 @@
v1.x = _outwidth - 1;
}
} else {
- skip = -1 - x_left;
+ skip = -1 - rect.left;
if (skip <= 0)
drawFlag = 2;
else
@@ -252,21 +251,21 @@
if (v1.skip_width <= 0)
return 0;
- if (x_left < 0)
- x_left = 0;
+ if (rect.left < 0)
+ rect.left = 0;
- if ((uint) y_top > _outheight)
- y_top = 0;
+ if ((uint) rect.top > _outheight)
+ rect.top = 0;
- if ((uint) y_bottom > _outheight)
- y_bottom = _outheight;
+ if ((uint) rect.bottom > _outheight)
+ rect.bottom = _outheight;
- if (_draw_top > y_top)
- _draw_top = y_top;
- if (_draw_bottom < y_bottom)
- _draw_bottom = y_bottom;
+ if (_draw_top > rect.top)
+ _draw_top = rect.top;
+ if (_draw_bottom < rect.bottom)
+ _draw_bottom = rect.bottom;
- if (_height + y_top >= 256) {
+ if (_height + rect.top >= 256) {
CHECK_HEAP
return 2;
}
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.257
retrieving revision 2.258
diff -u -d -r2.257 -r2.258
--- gfx.cpp 8 Jan 2004 00:48:37 -0000 2.257
+++ gfx.cpp 8 Jan 2004 03:10:16 -0000 2.258
@@ -571,7 +571,9 @@
return;
topline = vs->topline;
- height = topline + vs->height;
+
+ rect.top -= topline;
+ rect.bottom -= topline;
if (rect.left < 0)
rect.left = 0;
@@ -581,12 +583,12 @@
return;
if (rect.right > vs->width)
rect.right = vs->width;
- if (rect.bottom >= height)
- rect.bottom = height;
+ if (rect.bottom >= vs->height)
+ rect.bottom = vs->height;
- markRectAsDirty(vs->number, rect.left, rect.right, rect.top - topline, rect.bottom - topline, USAGE_BIT_RESTORED);
+ markRectAsDirty(vs->number, rect.left, rect.right, rect.top, rect.bottom, USAGE_BIT_RESTORED);
- int offset = (rect.top - topline) * vs->width + vs->xstart + rect.left;
+ int offset = (rect.top) * vs->width + vs->xstart + rect.left;
backbuff = vs->screenPtr + offset;
height = rect.height();
@@ -608,7 +610,7 @@
if (rect.right & 0x07)
mask_width++;
- mask = getMaskBuffer(rect.left, rect.top, 0);
+ mask = getMaskBuffer(rect.left, rect.top + topline, 0);
if (vs->number == kMainVirtScreen)
mask += vs->topline * gdi._numStrips;
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- gfx.h 6 Jan 2004 12:45:30 -0000 1.57
+++ gfx.h 8 Jan 2004 03:10:16 -0000 1.58
@@ -180,8 +180,7 @@
/** BlastObjects to draw */
struct BlastObject {
uint16 number;
- int16 posX, posY;
- uint16 width, height;
+ Common::Rect rect;
uint16 scaleX, scaleY;
uint16 image;
uint16 mode;
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- object.cpp 6 Jan 2004 12:45:30 -0000 1.156
+++ object.cpp 8 Jan 2004 03:10:16 -0000 1.157
@@ -1412,19 +1412,19 @@
eo = &_blastObjectQueue[_blastObjectQueuePos++];
eo->number = objectNumber;
- eo->posX = objectX + (camera._cur.x & 7);
- eo->posY = objectY + _screenTop;
+ eo->rect.left = objectX + (camera._cur.x & 7);
+ eo->rect.top = objectY + _screenTop;
if (objectWidth == 0) {
od = &_objs[idx];
- eo->width = od->width;
+ eo->rect.right = eo->rect.left + od->width;
} else {
- eo->width = objectWidth;
+ eo->rect.right = eo->rect.left + objectWidth;
}
if (objectHeight == 0) {
od = &_objs[idx];
- eo->height = od->height;
+ eo->rect.bottom = eo->rect.top + od->height;
} else {
- eo->height = objectHeight;
+ eo->rect.bottom = eo->rect.top + objectHeight;
}
eo->scaleX = scaleX;
@@ -1492,8 +1492,8 @@
} else {
bdd.dataptr = bomp + 10; // Why this? See also useBompCursor
}
- bdd.x = eo->posX;
- bdd.y = eo->posY;
+ bdd.x = eo->rect.left;
+ bdd.y = eo->rect.top;
bdd.scale_x = (byte)eo->scaleX;
bdd.scale_y = (byte)eo->scaleY;
@@ -1533,29 +1533,26 @@
void ScummEngine::removeBlastObject(BlastObject *eo) {
VirtScreen *vs = &virtscr[0];
- int top, bottom, left, right;
+ Common::Rect r;
int left_strip, right_strip;
int i;
- top = eo->posY;
- bottom = eo->posY + eo->height;
- left = eo->posX;
- right = eo->posX + eo->width;
+ r = eo->rect;
- if (bottom < 0 || right < 0 || top > vs->height || left > vs->width)
+ if (r.bottom < 0 || r.right < 0 || r.top > vs->height || r.left > vs->width)
return;
- if (top < 0)
- top = 0;
- if (bottom > vs->height)
- bottom = vs->height;
- if (left < 0)
- left = 0;
- if (right > vs->width)
- right = vs->width;
+ if (r.top < 0)
+ r.top = 0;
+ if (r.bottom > vs->height)
+ r.bottom = vs->height;
+ if (r.left < 0)
+ r.left = 0;
+ if (r.right > vs->width)
+ r.right = vs->width;
- left_strip = left / 8;
- right_strip = (right - 1) / 8;
+ left_strip = r.left / 8;
+ right_strip = (r.right - 1) / 8;
if (left_strip < 0)
left_strip = 0;
@@ -1567,9 +1564,9 @@
right_strip = 200;
}
for (i = left_strip; i <= right_strip; i++)
- gdi.resetBackground(top, bottom, i);
+ gdi.resetBackground(r.top, r.bottom, i);
- markRectAsDirty(kMainVirtScreen, left, right, top, bottom, USAGE_BIT_RESTORED);
+ markRectAsDirty(kMainVirtScreen, r.left, r.right, r.top, r.bottom, USAGE_BIT_RESTORED);
}
int ScummEngine::findLocalObjectSlot() {
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.220
retrieving revision 2.221
diff -u -d -r2.220 -r2.221
--- script_v8.cpp 7 Jan 2004 06:51:45 -0000 2.220
+++ script_v8.cpp 8 Jan 2004 03:10:16 -0000 2.221
@@ -1413,12 +1413,9 @@
for (int i = _blastObjectQueuePos - 1; i >= 0; i--) {
eo = &_blastObjectQueue[i];
- if (eo->posX <= x && eo->width + eo->posX > x &&
- eo->posY <= y && eo->height + eo->posY > y) {
- if (!getClass(eo->number, kObjectClassUntouchable)) {
- push(eo->number);
- return;
- }
+ if (eo->rect.contains(x, y) && !getClass(eo->number, kObjectClassUntouchable)) {
+ push(eo->number);
+ return;
}
}
push(0);
More information about the Scummvm-git-logs
mailing list