[Scummvm-cvs-logs] SF.net SVN: scummvm:[43920] scummvm/trunk/engines/cine/script_fw.cpp

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Thu Sep 3 22:56:47 CEST 2009


Revision: 43920
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43920&view=rev
Author:   buddha_
Date:     2009-09-03 20:56:44 +0000 (Thu, 03 Sep 2009)

Log Message:
-----------
Workaround for bug #2848940 (ScummVM crashes with Future wars): getZoneFromPositionRaw accessed data outside its 320x200 buffer because Y values in range 200-232 were given to it. Original doesn't properly handle this either so trying this workaround of returning zero for positions outside the 320x200 buffer. Hopefully nothing else breaks in Future Wars because of this (More testing is direly needed!).

Modified Paths:
--------------
    scummvm/trunk/engines/cine/script_fw.cpp

Modified: scummvm/trunk/engines/cine/script_fw.cpp
===================================================================
--- scummvm/trunk/engines/cine/script_fw.cpp	2009-09-03 17:52:38 UTC (rev 43919)
+++ scummvm/trunk/engines/cine/script_fw.cpp	2009-09-03 20:56:44 UTC (rev 43920)
@@ -1841,6 +1841,20 @@
 }
 
 int16 getZoneFromPositionRaw(byte *page, int16 x, int16 y, int16 width) {
+	// WORKAROUND for bug #2848940 ("ScummVM crashes with Future wars"):
+	// Vertical positions outside the 320x200 screen (e.g. in range 200-232)
+	// are accessed after teleporting Lo'Ann to the future using the pendant
+	// and walking down the slope and out of the screen (This causes a crash
+	// at least on Mac OS X). The original PC version of Future Wars doesn't
+	// clip its coordinates in this function or in checkCollision-function
+	// according to reverse engineering but instead just happily reads outside
+	// the 320x200 buffer. Not really knowing how to properly fix this I simply
+	// hope that the area outside the 320x200 part is full of zero and not of
+	// some random values and thus I return zero here and hope nothing breaks.
+	if (g_cine->getGameType() == Cine::GType_FW && !Common::Rect(320, 200).contains(x, y)) {
+		return 0;
+	}
+
 	byte *ptr = page + (y * width) + x;
 	byte zoneVar;
 


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