[Scummvm-cvs-logs] CVS: scummvm/scumm logic_he.cpp,2.7,2.8 logic_he.h,2.5,2.6 scumm.cpp,1.507,1.508 scumm.h,1.624,1.625

Eugene Sandulenko sev at users.sourceforge.net
Wed May 11 18:24:13 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2888

Modified Files:
	logic_he.cpp logic_he.h scumm.cpp scumm.h 
Log Message:
Support for football/footdemo logic


Index: logic_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/logic_he.cpp,v
retrieving revision 2.7
retrieving revision 2.8
diff -u -d -r2.7 -r2.8
--- logic_he.cpp	11 May 2005 21:35:04 -0000	2.7
+++ logic_he.cpp	12 May 2005 01:21:03 -0000	2.8
@@ -52,6 +52,7 @@
 }
 
 int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
+#if 1
 	char tmp[32], str[256];
 
 	if (numArgs > 0)
@@ -68,6 +69,14 @@
 	strncat(str, "])", 256);
 
 	debug(0, str);
+#else
+	// Used for parallel trace utility
+	for (int i = 0; i < numArgs; i++)
+		debug(0, "args[%d] = %d;", i, args[i]);
+
+	debug(0, "dispatch(%d, %d, args);", op, numArgs);
+
+#endif
 
 	return 1;
 }
@@ -415,7 +424,7 @@
 		}
 		putInArray(args[0], 0, i - 1, (int32)temp);
 
-		if (floor(data[i - 520 + 1]) + 0.5 > data[i - 520 + 1]) {
+		if (floor(data[i - 520 + 1]) + 0.5 <= data[i - 520 + 1]) {
 			temp = ceil(data[i - 520 + 1]);
 		} else {
 			temp = floor(data[i - 520 + 1]);
@@ -428,4 +437,87 @@
 	return 1;
 }
 
+/***********************
+ * Backyard Football
+ * Backyard Football Demo
+ *
+ */
+
+int LogicHEfootball::versionID() {
+	return 1;
+}
+
+int32 LogicHEfootball::dispatch(int op, int numArgs, int32 *args) {
+	int res = 0;
+
+	switch (op) {
+	case 1006:
+		res = op_1006(args);
+		break;
+
+	case 1010:
+		res = op_1010(args);
+		break;
+
+	case 1022:
+		res = op_1022(args);
+		break;
+
+	default:
+		LogicHE::dispatch(op, numArgs, args);
+		break;
+
+	}
+
+	return res;
+}
+
+int LogicHEfootball::op_1006(int32 *args) {
+	double res;
+
+	res = (1.0 - args[1] * 2.9411764e-4 * 5.3050399e-2) * args[0] * 1.2360656e-1 + 
+		args[1] * 1.1764706e-2 + 46;
+	writeScummVar(108, (int32)res);
+
+	res = 640.0 - args[2] * 1.2360656e-1 - args[1] * 1.1588235e-1 - 26;
+	writeScummVar(109, (int32)res);
+
+	return 1;
+}
+
+int LogicHEfootball::op_1010(int32 *args) {
+	double a1 = (640.0 - (double)args[1] - 26.0) * 8.6294413;
+	double res;
+
+	res = ((double)args[0] - 46 - a1 * 1.1764706e-2) / 
+		((1.0 - a1 * 2.9411764e-4 * 5.3050399e-2) * 1.2360656e-1);
+	writeScummVar(108, (int32)res);
+
+	writeScummVar(109, (int32)a1);
+
+	return 1;
+}
+
+int LogicHEfootball::op_1022(int32 *args) {
+	double res;
+	double var10 = args[4] - args[1]; // 25
+	double var8 = args[5] - args[2]; // 0
+	double var6 = args[3] - args[0]; // -2578
+
+	res = sqrt(var8 * var8 + var6 * var6 + var10 * var10); // 2.5781212
+
+	if (res >= (double)args[6]) {
+		var8 = (double)args[6] * var8 / res;
+		var10 = (double)args[6] * var10 / res;
+		res = (double)args[6] * var6 / res;
+	}
+
+	writeScummVar(108, (int32)res);
+	writeScummVar(109, (int32)var10);
+	writeScummVar(110, (int32)var8);
+	
+	return 1;
+}
+
+
 } // End of namespace Scumm

Index: logic_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/logic_he.h,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- logic_he.h	11 May 2005 21:35:10 -0000	2.5
+++ logic_he.h	12 May 2005 01:21:03 -0000	2.6
@@ -87,4 +87,17 @@
 	int checkShape(int arg_0, int arg_4, int arg_8, int arg_C, int arg_10, int arg_14, int arg_18, int arg_1C, int arg_20, int arg_24);
 };
 
+class LogicHEfootball : public LogicHE {
+public:
+	LogicHEfootball(ScummEngine_v90he *vm) : LogicHE(vm) {}
+
+	int versionID();
+	int32 dispatch(int op, int numArgs, int32 *args);
+
+private:
+	int op_1006(int32 *args);
+	int op_1010(int32 *args);
+	int op_1022(int32 *args);
+};
+
 } // End of namespace Scumm

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.507
retrieving revision 1.508
diff -u -d -r1.507 -r1.508
--- scumm.cpp	11 May 2005 14:39:04 -0000	1.507
+++ scumm.cpp	12 May 2005 01:21:03 -0000	1.508
@@ -351,7 +351,7 @@
 	 GF_USE_KEY | GF_NEW_COSTUMES | GF_HE_LOCALIZED, Common::kPlatformWindows, 0, 0},
 	{"mustard", "Spy Fox in Hold the Mustard", GID_HEGAME, 6, 99, MDT_NONE,
 	 GF_USE_KEY | GF_NEW_COSTUMES | GF_HE_LOCALIZED, Common::kPlatformWindows, 0, 0},
-	{"football", "Backyard Football", GID_HEGAME, 6, 99, MDT_NONE,
+	{"football", "Backyard Football", GID_FOOTBALL, 6, 99, MDT_NONE,
 	 GF_USE_KEY | GF_NEW_COSTUMES, Common::kPlatformWindows, 0, 0},
 
 	// Humongous Entertainment Scumm Version ?
@@ -376,7 +376,7 @@
 
 	{"bb2demo", "Backyard Baseball 2001 (Demo)", GID_HEGAME, 6, 99, MDT_NONE,
 	 GF_USE_KEY | GF_NEW_COSTUMES | GF_16BIT_COLOR, Common::kPlatformWindows, 0, 0},
-	{"footdemo", "Backyard Football 2002 (Demo)", GID_HEGAME, 6, 99, MDT_NONE,
+	{"footdemo", "Backyard Football (Demo)", GID_FOOTBALL, 6, 99, MDT_NONE,
 	 GF_USE_KEY | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS, Common::kPlatformWindows, 0, 0},
 	{"SoccerMLS", "Backyard Soccer MLS Edition", GID_HEGAME, 6, 99, MDT_NONE,
 	 GF_USE_KEY | GF_NEW_COSTUMES, Common::kPlatformWindows, 0, 0},
@@ -1794,6 +1794,10 @@
 			_logicHE = new LogicHEfunshop(this);
 			break;
 
+		case GID_FOOTBALL:
+			_logicHE = new LogicHEfootball(this);
+			break;
+
 		default:
 			_logicHE = new LogicHE(this);
 			break;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.624
retrieving revision 1.625
diff -u -d -r1.624 -r1.625
--- scumm.h	11 May 2005 21:35:11 -0000	1.624
+++ scumm.h	12 May 2005 01:21:04 -0000	1.625
@@ -250,7 +250,8 @@
 	GID_FREDDI2,
 	GID_FREDDICOVE,
 	GID_PUTTRACE,
-	GID_FUNSHOP		// Used for all three funshops
+	GID_FUNSHOP,	// Used for all three funshops
+	GID_FOOTBALL
 };
 
 struct SentenceTab {





More information about the Scummvm-git-logs mailing list