[Scummvm-cvs-logs] CVS: scummvm/bs2/driver sprite.cpp,1.13,1.14
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Sat Aug 30 03:24:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/bs2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv17305/driver
Modified Files:
sprite.cpp
Log Message:
Fixed sprite clipping issues, I hope.
Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/sprite.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sprite.cpp 29 Aug 2003 06:42:34 -0000 1.13
+++ sprite.cpp 30 Aug 2003 10:23:40 -0000 1.14
@@ -1439,24 +1439,32 @@
rd.right = rd.left + rs.right;
rd.bottom = rd.top + rs.bottom;
+ // Check if the sprite would end up completely outside the screen.
+
+ if (rd.left > 640 || rd.top > 440 || rd.right < 0 || rd.bottom < 40) {
+ if (freeSprite)
+ free(sprite);
+ return RD_OK;
+ }
+
if (rd.top < 40) {
- rs.top = (40 - rd.top) * 256 / scale;
+ rs.top = 40 - rd.top;
rd.top = 40;
clipped = true;
}
if (rd.bottom > 440) {
- rs.bottom -= ((rd.bottom - 440) * 256 / scale);
rd.bottom = 440;
+ rs.bottom = rs.top + (rd.bottom - rd.top);
clipped = true;
}
if (rd.left < 0) {
- rs.left = (0 - rd.left) * 256 / scale;
+ rs.left = -rd.left;
rd.left = 0;
clipped = true;
}
if (rd.right > 640) {
- rs.right -= ((rd.right - 640) * 256 / scale);
rd.right = 640;
+ rs.right = rs.left + (rd.right - rd.left);
clipped = true;
}
@@ -1504,7 +1512,8 @@
// -----------------------------------------------------------------
// The light mask is an optional layer that covers the entire room
- // and which is used to simulate light and shadows.
+ // and which is used to simulate light and shadows. Scaled sprites
+ // (actors, presumably) are always affected.
if ((renderCaps & RDBLTFX_SHADOWBLEND) && lightMask && (scale != 256 || (s->type & RDSPR_SHADOW))) {
uint8 *lightMap;
More information about the Scummvm-git-logs
mailing list