aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSylvain Dupont2010-10-14 00:03:53 +0000
committerSylvain Dupont2010-10-14 00:03:53 +0000
commit320dd0b07147341d72328dd4e51d7cfda468a2b6 (patch)
treef84d142de1638b567171029bbe0cc6d7202ceb6f /engines
parente0b69a3061a0e0112a611151e004ea6e6f5b82c2 (diff)
downloadscummvm-rg350-320dd0b07147341d72328dd4e51d7cfda468a2b6.tar.gz
scummvm-rg350-320dd0b07147341d72328dd4e51d7cfda468a2b6.tar.bz2
scummvm-rg350-320dd0b07147341d72328dd4e51d7cfda468a2b6.zip
TOON: Fixed Bug #3084725 with cursor disappearing at screen borders
Bug #3084725: "TOON: Glitch in cursor anim" svn-id: r53453
Diffstat (limited to 'engines')
-rw-r--r--engines/toon/anim.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 157422cd9d..be53c12dc7 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -140,9 +140,26 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int
int32 rectX = _frames[frame]._x2 - _frames[frame]._x1;
int32 rectY = _frames[frame]._y2 - _frames[frame]._y1;
+ int32 offsX = 0;
+ int32 offsY = 0;
- if ((xx + _x1 + _frames[frame]._x1 < 0) || (yy + _y1 + _frames[frame]._y1 < 0))
+ if (xx + _x1 + _frames[frame]._x1 < 0) {
+ offsX = -(xx + _x1 + _frames[frame]._x1);
+ }
+
+ if (offsX >= rectX)
+ return;
+ else
+ rectX -= offsX;
+
+ if (yy + _y1 + _frames[frame]._y1 < 0) {
+ offsY = -(yy + _y1 + _frames[frame]._y1);
+ }
+
+ if (offsY >= rectY)
return;
+ else
+ rectY -= offsY;
if (rectX + xx + _x1 + _frames[frame]._x1 >= surface.w)
rectX = surface.w - xx - _x1 - _frames[frame]._x1;
@@ -157,8 +174,8 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int
return;
int32 destPitch = surface.pitch;
- uint8 *srcRow = _frames[frame]._data;
- uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1) * destPitch + (xx + _x1 + _frames[frame]._x1);
+ uint8 *srcRow = _frames[frame]._data + offsX + (_frames[frame]._x2 - _frames[frame]._x1) * offsY;
+ uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1 + offsY) * destPitch + (xx + _x1 + _frames[frame]._x1 + offsX);
for (int32 y = 0; y < rectY; y++) {
uint8 *cur = curRow;
uint8 *c = srcRow + y * (_frames[frame]._x2 - _frames[frame]._x1);