aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-05-30 02:01:45 +0000
committerMax Horn2003-05-30 02:01:45 +0000
commit37fa2df49acf2991c24c6b7e271ed4431f8dc5c5 (patch)
tree1fdda33120dcadeeb699105478fb1fd5340fde3a
parent9f301f16e611c1b67ba3fca6508c3d11224c8df8 (diff)
downloadscummvm-rg350-37fa2df49acf2991c24c6b7e271ed4431f8dc5c5.tar.gz
scummvm-rg350-37fa2df49acf2991c24c6b7e271ed4431f8dc5c5.tar.bz2
scummvm-rg350-37fa2df49acf2991c24c6b7e271ed4431f8dc5c5.zip
cleanup; removed last horizontal bound check from updateDirtyRect -> now all the various 'offscreen actor redraw' problems should be fixed (at least I can't reproduce them in COMI anymore), while The Dig should still work just fine (at least it does in my test cases)
svn-id: r8129
-rw-r--r--scumm/akos.cpp105
-rw-r--r--scumm/camera.cpp4
-rw-r--r--scumm/gfx.cpp4
3 files changed, 49 insertions, 64 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index d1a0a18d36..566f197749 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -729,7 +729,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
- int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh, tmp_x, tmp_y;
+ int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh;
if (!_mirror) {
clip_left = (_actorX - xmoveCur - _width) + 1;
@@ -737,35 +737,32 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
clip_left = _actorX + xmoveCur - 1;
}
- clip_right = (clip_left + _width) - 1;
clip_top = _actorY + ymoveCur;
+ clip_right = (clip_left + _width) - 1;
clip_bottom = (clip_top + _height) - 1;
maxw = _outwidth - 1;
maxh = _outheight - 1;
- if (clip_left < 0) {
- clip_left = 0;
- }
+ _vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
- tmp_x = clip_right - maxw;
- if (tmp_x > 0) {
- clip_right -= tmp_x;
+ if (clip_top < 0) {
+ clip_top = 0;
}
- tmp_y = clip_top;
- if (tmp_y < 0) {
- clip_top -= tmp_y;
+ if (clip_bottom > maxh) {
+ clip_bottom = maxh;
}
- tmp_y = clip_bottom - maxh;
- if (tmp_y > 0) {
- clip_bottom -= tmp_y;
+ if (clip_left < 0) {
+ clip_left = 0;
}
- if ((clip_right <= clip_left) || (clip_top >= clip_bottom))
- return 1;
+ if (clip_right > maxw) {
+ clip_right = maxw;
+ }
- _vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
+ if ((clip_left >= clip_right) || (clip_top >= clip_bottom))
+ return 0;
if (_draw_top > clip_top)
_draw_top = clip_top;
@@ -1010,64 +1007,52 @@ void AkosRenderer::akos16DecompressMask(byte *dest, int32 pitch, const byte *src
}
byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
- int32 clip_left;
-
+ int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh;
+ int32 skip_x, skip_y, cur_x, cur_y;
+ const byte transparency = (_vm->_features & GF_HUMONGOUS) ? 0 : 255;
+
if(!_mirror) {
clip_left = (_actorX - xmoveCur - _width) + 1;
} else {
clip_left = _actorX + xmoveCur;
}
- int32 clip_top = ymoveCur + _actorY;
- int32 clip_right = (clip_left + _width) - 1;
- int32 clip_bottom = (clip_top + _height) - 1;
- int32 skip_x = 0;
- int32 skip_y = 0;
- int32 cur_x = _width - 1;
- int32 cur_y = _height - 1;
- int32 maxw = _outwidth - 1;
- int32 maxh = _outheight - 1;
- int32 tmp_x, tmp_y;
- byte transparency = (_vm->_features & GF_HUMONGOUS) ? 0 : 255;
-
-/*
- tmp_x = clip_left;
- if(tmp_x < 0) {
- tmp_x = -tmp_x;
- clip_left -= tmp_x;
- skip_x = tmp_x;
- }
-*/
+ clip_top = ymoveCur + _actorY;
+ clip_right = (clip_left + _width) - 1;
+ clip_bottom = (clip_top + _height) - 1;
+ maxw = _outwidth - 1;
+ maxh = _outheight - 1;
+
+ skip_x = 0;
+ skip_y = 0;
+ cur_x = _width - 1;
+ cur_y = _height - 1;
+
+ _vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
- // Modified by ludde
if (clip_left < 0) {
skip_x = -clip_left;
clip_left = 0;
}
- tmp_x = clip_right - maxw;
- if(tmp_x > 0) {
- cur_x -= tmp_x;
- clip_right -= tmp_x;
+ if(clip_right > maxw) {
+ cur_x -= clip_right - maxw;
+ clip_right = maxw;
}
- tmp_y = clip_top;
- if(tmp_y < 0) {
- skip_y -= tmp_y;
- clip_top -= tmp_y;
+ if(clip_top < 0) {
+ skip_y -= clip_top;
+ clip_top = 0;
}
- tmp_y = clip_bottom - maxh;
- if(tmp_y > 0) {
- cur_y -= tmp_y;
- clip_bottom -= tmp_y;
+ if(clip_bottom > maxh) {
+ cur_y -= clip_bottom - maxh;
+ clip_bottom = maxh;
}
if ((clip_left >= clip_right) || (clip_top >= clip_bottom))
return 0;
- _vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
-
if (_draw_top > clip_top)
_draw_top = clip_top;
if (_draw_bottom < clip_bottom)
@@ -1092,18 +1077,18 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
width_unk = clip_left;
}
- tmp_y = cur_y - skip_y;
- if(tmp_y < 0) {
- tmp_y = -tmp_y;
- }
+ int32 out_height;
- int32 out_height = tmp_y + 1;
+ out_height = cur_y - skip_y;
+ if (out_height < 0) {
+ out_height = -out_height;
+ }
+ out_height++;
cur_x -= skip_x;
if(cur_x < 0) {
cur_x = -cur_x;
}
-
cur_x++;
int32 numskip_before = skip_x + (skip_y * _width);
diff --git a/scumm/camera.cpp b/scumm/camera.cpp
index 7a9fab4714..90119cb90d 100644
--- a/scumm/camera.cpp
+++ b/scumm/camera.cpp
@@ -320,15 +320,13 @@ void Scumm::cameraMoved() {
}
}
- _screenStartStrip = (camera._cur.x - (_screenWidth / 2)) >> 3;
+ _screenStartStrip = camera._cur.x / 8 - gdi._numStrips / 2;
_screenEndStrip = _screenStartStrip + gdi._numStrips - 1;
_screenTop = camera._cur.y - (_screenHeight / 2);
if (_features & GF_AFTER_V7) {
-
_screenLeft = camera._cur.x - (_screenWidth / 2);
} else {
-
_screenLeft = _screenStartStrip << 3;
}
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 435ef41947..11b0b89ac9 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -285,7 +285,9 @@ void Scumm::updateDirtyRect(int virt, int left, int right, int top, int bottom,
VirtScreen *vs = &virtscr[virt];
int lp, rp;
- if (top > vs->height || right < 0 || bottom < 0)
+ if (left > right || top > bottom)
+ return;
+ if (top > vs->height || bottom < 0)
return;
if (top < 0)