[Scummvm-cvs-logs] SF.net SVN: scummvm:[55655] scummvm/trunk/engines/toon/toon.cpp
sylvaintv at users.sourceforge.net
sylvaintv at users.sourceforge.net
Sun Jan 30 14:31:13 CET 2011
Revision: 55655
http://scummvm.svn.sourceforge.net/scummvm/?rev=55655&view=rev
Author: sylvaintv
Date: 2011-01-30 13:31:13 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
TOON: Add coordinates clamping for safety
In some rare cases, Drew position is outside the valid area.
Made sure it does not crash in these cases.
Modified Paths:
--------------
scummvm/trunk/engines/toon/toon.cpp
Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp 2011-01-30 13:14:54 UTC (rev 55654)
+++ scummvm/trunk/engines/toon/toon.cpp 2011-01-30 13:31:13 UTC (rev 55655)
@@ -1820,6 +1820,10 @@
if (!_currentMask)
return 1024;
+ // clamp values
+ x = MIN(1279, MAX(0, x));
+ y = MIN(399, MAX(0, y));
+
int32 maskData = _currentMask->getData(x, y) & 0x1f;
return _roomScaleData[maskData+2] * 1024 / 100;
}
@@ -1828,6 +1832,10 @@
if (!_currentMask)
return 0;
+ // clamp values
+ x = MIN(1279, MAX(0, x));
+ y = MIN(399, MAX(0, y));
+
int32 maskData = _currentMask->getData(x, y) & 0x1f;
return _roomScaleData[maskData+130] << 5;
}
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