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

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Mon Jan 21 22:09:43 CET 2008


Revision: 30602
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30602&view=rev
Author:   buddha_
Date:     2008-01-21 13:09:42 -0800 (Mon, 21 Jan 2008)

Log Message:
-----------
Implements 2 arguments version of the adj.ego.move.to.x.y-command. Should fix bug #1733297 (GR: Actor stuck (Amiga version)). Savegames when using adj.ego.move.to.x.y-command may be broken at the moment.

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

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2008-01-21 20:48:25 UTC (rev 30601)
+++ scummvm/trunk/engines/agi/agi.cpp	2008-01-21 21:09:42 UTC (rev 30602)
@@ -360,6 +360,9 @@
 	debug(2, "initializing");
 	debug(2, "game.ver = 0x%x", _game.ver);
 
+	/* initialize with adj.ego.move.to.x.y(0, 0) so to speak */
+	_game.adjMouseX = _game.adjMouseY = 0;
+
 	/* reset all flags to false and all variables to 0 */
 	for (i = 0; i < MAX_FLAGS; i++)
 		_game.flags[i] = 0;

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2008-01-21 20:48:25 UTC (rev 30601)
+++ scummvm/trunk/engines/agi/agi.h	2008-01-21 21:09:42 UTC (rev 30602)
@@ -489,6 +489,11 @@
 #define STATE_RUNNING	0x02
 	int state;		/**< state of the interpreter */
 
+	// TODO: Check whether adjMouseX and adjMouseY must be saved and loaded when using savegames.
+	//       If they must be then loading and saving is partially broken at the moment.
+	int adjMouseX;	/**< last given adj.ego.move.to.x.y-command's 1st parameter */
+	int adjMouseY;	/**< last given adj.ego.move.to.x.y-command's 2nd parameter */
+
 	char name[8];	/**< lead in id (e.g. `GR' for goldrush) */
 	char id[8];		/**< game id */
 	uint32 crc;		/**< game CRC */

Modified: scummvm/trunk/engines/agi/cycle.cpp
===================================================================
--- scummvm/trunk/engines/agi/cycle.cpp	2008-01-21 20:48:25 UTC (rev 30601)
+++ scummvm/trunk/engines/agi/cycle.cpp	2008-01-21 21:09:42 UTC (rev 30602)
@@ -223,8 +223,23 @@
 
 	/* Click-to-walk mouse interface */
 	if (_game.playerControl && v->flags & ADJ_EGO_XY) {
-		v->direction = getDirection(v->xPos, v->yPos, v->parm1, v->parm2, v->stepSize);
+		int toX = v->parm1;
+		int toY = v->parm2;
 
+		// AGI Mouse games use ego's sprite's bottom left corner for mouse walking target.
+		// Amiga games use ego's sprite's bottom center for mouse walking target.
+		// TODO: Check what Atari ST AGI and Apple IIGS AGI use for mouse walking target.
+		if (getPlatform() == Common::kPlatformAmiga)
+			toX -= (v->xSize / 2); // Center ego's sprite horizontally
+
+		// Adjust ego's sprite's mouse walking target position (These parameters are
+		// controlled with the adj.ego.move.to.x.y-command). Note that these values rely
+		// on the horizontal centering of the ego's sprite at least on the Amiga platform.
+		toX += _game.adjMouseX;
+		toY += _game.adjMouseY;
+
+		v->direction = getDirection(v->xPos, v->yPos, toX, toY, v->stepSize);
+
 		if (v->direction == 0)
 			inDestination(v);
 	}

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2008-01-21 20:48:25 UTC (rev 30601)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2008-01-21 21:09:42 UTC (rev 30602)
@@ -664,15 +664,36 @@
 }
 
 cmd(adj_ego_move_to_x_y) {
+	int8 x, y;
+
 	switch (logicNamesCmd[182].numArgs) {
+	// The 2 arguments version is used at least in Amiga Gold Rush!
+	// (v2.05 1989-03-09, Amiga AGI 2.316) in logics 130 and 150
+	// (Using arguments (0, 0), (0, 7), (0, 8), (9, 9) and (-9, 9)).
 	case 2:
-		// TODO: Implement the 2 arguments using variant of 'adj.ego.move.to.x.y'.
-		// It's used at least in Amiga Gold Rush! (v2.05 1989-03-09, Amiga AGI 2.316)
-		// in logics 130 and 150 (Using arguments (0, 0), (0, 7), (0, 8), (9, 9), (-9, 9)).
-		// I may be wrong about the (-9, 9) argument pair though, it may just be (247, 9).
-		debugC(4, kDebugLevelScripts, "Unsupported command adj.ego.move.to.x.y(%d, %d)",
-			(int8) p0, (int8) p1);
+		// Both arguments are signed 8-bit (i.e. in range -128 to +127).
+		x = (int8) p0;
+		y = (int8) p1;
+
+		// Turn off ego's current movement caused with the mouse if
+		// adj.ego.move.to.x.y is called with other arguments than previously.
+		// Fixes weird looping behaviour when walking to a ladder in the mines
+		// (Rooms 147-162) in Gold Rush using the mouse. Sometimes the ego didn't
+		// stop when walking to a ladder using the mouse but kept moving on the
+		// ladder in a horizontally looping manner i.e. from right to left, from
+		// right to left etc. In the Amiga Gold Rush the ego stopped when getting
+		// onto the ladder so this is more like it (Although that may be a caused
+		// by something else because this command doesn't do any flag manipulations
+		// in the Amiga version - checked it with disassembly).
+		if (x != game.adjMouseX || y != game.adjMouseY)
+			game.viewTable[EGO_VIEW_TABLE].flags &= ~ADJ_EGO_XY;
+
+		game.adjMouseX = x;
+		game.adjMouseY = y;
+
+		debugC(4, kDebugLevelScripts, "adj.ego.move.to.x.y(%d, %d)", x, y);
 		break;
+	// TODO: Check where (if anywhere) the 0 arguments version is used
 	case 0:
 	default:
 		game.viewTable[0].flags |= ADJ_EGO_XY;


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