[Scummvm-cvs-logs] SF.net SVN: scummvm:[51768] scummvm/trunk/engines/sci/engine/kmovement.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Aug 5 23:48:30 CEST 2010
Revision: 51768
http://scummvm.svn.sourceforge.net/scummvm/?rev=51768&view=rev
Author: thebluegr
Date: 2010-08-05 21:48:30 +0000 (Thu, 05 Aug 2010)
Log Message:
-----------
Added a sanity check inside kDoBresen, thanks to lskovlun. Fixes the random crashes in the floor scrubbing scene in SQ5
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kmovement.cpp
Modified: scummvm/trunk/engines/sci/engine/kmovement.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmovement.cpp 2010-08-05 21:48:15 UTC (rev 51767)
+++ scummvm/trunk/engines/sci/engine/kmovement.cpp 2010-08-05 21:48:30 UTC (rev 51768)
@@ -30,6 +30,7 @@
#include "sci/engine/selector.h"
#include "sci/engine/kernel.h"
#include "sci/graphics/animate.h"
+#include "sci/graphics/screen.h"
namespace Sci {
@@ -313,8 +314,15 @@
|| ((y == desty) && (abs(dy) >= abs(dx))) /* Moving fast, reached? */
))) {
// Whew... in short: If we have reached or passed our target position
- x = destx;
- y = desty;
+
+ // Sanity check: make sure that destx, desty are inside the screen coordinates.
+ // They can go off screen in some cases, e.g. in SQ5 while scrubbing the floor
+ if (destx < g_sci->_gfxScreen->getWidth() && desty < g_sci->_gfxScreen->getHeight()) {
+ x = destx;
+ y = desty;
+ } else {
+ warning("kDoBresen: destination x, y would be off-screen(%d, %d)", destx, desty);
+ }
completed = 1;
debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x", PRINT_REG(mover));
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