[Scummvm-cvs-logs] SF.net SVN: scummvm: [30190] scummvm/trunk/engines/agi

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Thu Jan 3 09:41:41 CET 2008


Revision: 30190
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30190&view=rev
Author:   buddha_
Date:     2008-01-03 00:41:40 -0800 (Thu, 03 Jan 2008)

Log Message:
-----------
Fix for the Space Trek sprite duplication bug (#1659209). Makes commands position and position.v use coordinate clipping for Space Trek.

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/agi/op_cmd.cpp
    scummvm/trunk/engines/agi/view.cpp

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2008-01-03 08:39:49 UTC (rev 30189)
+++ scummvm/trunk/engines/agi/agi.h	2008-01-03 08:41:40 UTC (rev 30190)
@@ -130,6 +130,9 @@
 /*
  * GF_OLDAMIGAV20 means that the interpreter is an old Amiga AGI interpreter that
  * uses value 20 for the computer type (v20 i.e. vComputer) rather than the usual value 5.
+ *
+ * GF_CLIPCOORDS means that views' coordinates must be clipped at least in commands
+ * position and position.v.
  */
 enum AgiGameFeatures {
 	GF_AGIMOUSE =    (1 << 0),
@@ -141,7 +144,8 @@
 	GF_FANMADE =     (1 << 6),
 	GF_MENUS =		 (1 << 7),
 	GF_ESCPAUSE =	 (1 << 8),
-	GF_OLDAMIGAV20 = (1 << 9)
+	GF_OLDAMIGAV20 = (1 << 9),
+	GF_CLIPCOORDS  = (1 << 10)
 };
 
 struct AGIGameDescription;
@@ -873,6 +877,7 @@
 public:
 
 	void setCel(VtEntry *, int);
+	void clipViewCoordinates(VtEntry *v);
 	void setLoop(VtEntry *, int);
 	void setView(VtEntry *, int);
 	void startUpdate(VtEntry *);

Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	2008-01-03 08:39:49 UTC (rev 30189)
+++ scummvm/trunk/engines/agi/detection.cpp	2008-01-03 08:41:40 UTC (rev 30190)
@@ -2011,7 +2011,7 @@
 	FANMADE_I("sq0", "v1.04", "2ad9d1a4624a98571ee77dcc83f231b6"),
 	FANMADE_I("sqx", "v10.0 Feb 05", "c992ae2f8ab18360404efdf16fa9edd1"),
 	FANMADE_I("sqx", "v10.0 Jul 18", "812edec45cefad559d190ffde2f9c910"),
-	FANMADE("Space Trek (v1.0)", "807a1aeadb2ace6968831d36ab5ea37a"),
+	FANMADE_F("Space Trek (v1.0)", "807a1aeadb2ace6968831d36ab5ea37a", GF_CLIPCOORDS),
 	FANMADE("Special Delivery", "88764dfe61126b8e73612c851b510a33"),
 	FANMADE("Speeder Bike Challenge (v1.0)", "2deb25bab379285ca955df398d96c1e7"),
 	FANMADE("Star Commander 1 - The Escape (v1.0)", "a7806f01e6fa14ebc029faa58f263750"),

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2008-01-03 08:39:49 UTC (rev 30189)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2008-01-03 08:41:40 UTC (rev 30190)
@@ -757,11 +757,33 @@
 cmd(position) {
 	vt.xPos = vt.xPos2 = p1;
 	vt.yPos = vt.yPos2 = p2;
+
+	// WORKAROUND: Part of the fix for bug #1659209 "AGI: Space Trek sprite duplication"
+	// with an accompanying identical workaround in position.v-command (i.e. command 0x26).
+	// These two workarounds together make up the whole fix. The bug was caused by
+	// wrongly written script data in Space Trek v1.0's scripts (At least logics 4 and 11).
+	// Position-command was called with horizontal values over 200 (Outside the screen!).
+	// Clipping the coordinates so the views stay wholly on-screen seems to fix the problems.
+	//   It is probable (Would have to check better with disassembly to be completely sure)
+	// that AGI 2.440 clipped its coordinates in its position and position.v-commands
+	// although AGI 2.917 certainly doesn't (Checked that with disassembly) and that's why
+	// Space Trek may have worked better with AGI 2.440 than with some other AGI versions.
+	//   I haven't checked but if Space Trek solely abuses the position-command we wouldn't
+	// strictly need the identical workaround in the position.v-command but it does make
+	// for a nice symmetry.
+	if (g_agi->getFeatures() & GF_CLIPCOORDS)
+		g_agi->clipViewCoordinates(&vt);
 }
 
 cmd(position_f) {
 	vt.xPos = vt.xPos2 = _v[p1];
 	vt.yPos = vt.yPos2 = _v[p2];
+
+	// WORKAROUND: Part of the fix for bug #1659209 "AGI: Space Trek sprite duplication"
+	// with an accompanying identical workaround in position-command (i.e. command 0x25).
+	// See that workaround's comment for more in-depth information.
+	if (g_agi->getFeatures() & GF_CLIPCOORDS)
+		g_agi->clipViewCoordinates(&vt);
 }
 
 cmd(get_posn) {

Modified: scummvm/trunk/engines/agi/view.cpp
===================================================================
--- scummvm/trunk/engines/agi/view.cpp	2008-01-03 08:39:49 UTC (rev 30189)
+++ scummvm/trunk/engines/agi/view.cpp	2008-01-03 08:41:40 UTC (rev 30190)
@@ -254,6 +254,15 @@
 	lSetCel(v, n);
 
 	/* If position isn't appropriate, update it accordingly */
+	clipViewCoordinates(v);
+}
+
+/**
+ * Restrict view table entry's position so it stays wholly inside the screen.
+ * Also take horizon into account when clipping if not set to ignore it.
+ * @param v pointer to view table entry
+ */
+void AgiEngine::clipViewCoordinates(VtEntry *v) {
 	if (v->xPos + v->xSize > _WIDTH) {
 		v->flags |= UPDATE_POS;
 		v->xPos = _WIDTH - v->xSize;


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