[Scummvm-cvs-logs] SF.net SVN: scummvm: [28621] scummvm/trunk/engines/parallaction/ callables_ns.cpp
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Tue Aug 14 21:53:32 CEST 2007
Revision: 28621
http://scummvm.svn.sourceforge.net/scummvm/?rev=28621&view=rev
Author: peres001
Date: 2007-08-14 12:53:32 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
Fixed bug (array-overflow) in NS introduction. This randomly caused the intro to crash during sketching.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/callables_ns.cpp
Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp 2007-08-14 18:58:47 UTC (rev 28620)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp 2007-08-14 19:53:32 UTC (rev 28621)
@@ -587,7 +587,11 @@
//_vm->_gfx->zeroMaskValue(x, y, color);
BackgroundInfo* info = (BackgroundInfo*)data;
-
+/*
+ if (x < 0 || x > 319 || y < 0 || y > 199) {
+ printf("zeroMask(%i, %i)\n", x, y);
+ }
+*/
uint16 _ax = x + y * info->width;
info->mask.data[_ax >> 2] &= ~(3 << ((_ax & 3) << 1));
@@ -597,12 +601,27 @@
static uint16 index = 1;
- uint16 newy = _rightHandPositions[2*index+1];
- uint16 newx = _rightHandPositions[2*index];
+ uint16 newx;
+ uint16 newy;
uint16 oldy = _rightHandPositions[2*(index-1)+1];
uint16 oldx = _rightHandPositions[2*(index-1)];
+ // WORKAROUND: original code overflowed _rightHandPositions by trying
+ // to access elements at positions 684 and 685. That used to happen
+ // when index == 342. Code now checks for this possibility and assigns
+ // the last valid value to the new coordinates for drawing without
+ // accessing the array.
+ if (index < 342) {
+ newy = oldy;
+ newx = oldx;
+ } else {
+ newy = _rightHandPositions[2*index+1];
+ newx = _rightHandPositions[2*index];
+ }
+
+ printf("sketch index = %i\n", index);
+
Graphics::drawLine(oldx, oldy, newx, newy, 0, zeroMask, _backgroundInfo);
_rightHandAnim->_left = newx;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list