diff options
author | Nicola Mettifogo | 2007-08-14 19:53:32 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-08-14 19:53:32 +0000 |
commit | 70f69a18bb0d807999a873c865fa29c9a9d61a2f (patch) | |
tree | 2cd2332b4d4973605ed2dd5a1fe6b2d6b413f405 /engines | |
parent | 32164ff210015297b55c27b97614a35d96bd3dd0 (diff) | |
download | scummvm-rg350-70f69a18bb0d807999a873c865fa29c9a9d61a2f.tar.gz scummvm-rg350-70f69a18bb0d807999a873c865fa29c9a9d61a2f.tar.bz2 scummvm-rg350-70f69a18bb0d807999a873c865fa29c9a9d61a2f.zip |
Fixed bug (array-overflow) in NS introduction. This randomly caused the intro to crash during sketching.
svn-id: r28621
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/callables_ns.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index 7d4dda1c2e..3c32b6f58f 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -587,7 +587,11 @@ void zeroMask(int x, int y, int color, void *data) { //_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 @@ void Parallaction_ns::_c_sketch(void *parm) { 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; |