diff options
author | Kari Salminen | 2009-09-03 20:56:44 +0000 |
---|---|---|
committer | Kari Salminen | 2009-09-03 20:56:44 +0000 |
commit | 9b2104db32d074886daa0ec48624193351d6ed51 (patch) | |
tree | 77240182c933fe6983c1d40fcf536d6b36f4a473 /engines/cine | |
parent | 9aa7546a3491acbbace93729efed2dc62a1f1855 (diff) | |
download | scummvm-rg350-9b2104db32d074886daa0ec48624193351d6ed51.tar.gz scummvm-rg350-9b2104db32d074886daa0ec48624193351d6ed51.tar.bz2 scummvm-rg350-9b2104db32d074886daa0ec48624193351d6ed51.zip |
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!).
svn-id: r43920
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/script_fw.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index a9824674e6..e926027f68 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -1841,6 +1841,20 @@ int16 getZoneFromPosition(byte *page, int16 x, int16 y, int16 width) { } 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; |