[Scummvm-git-logs] scummvm master -> bacb576af3db9457c0180887111ab2d4fdcf8d20

sev- sev at scummvm.org
Mon Oct 25 13:39:10 UTC 2021


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
83ecd6cac2 GROOVIE: Implement top-level function for MouseTrap
5ab18dfe48 GROOVIE: Added service functions to Mouse Trap
bacb576af3 DIRECTOR: Added more tail macros to detection


Commit: 83ecd6cac2ce34d46b3f58be64af77f9662a72d9
    https://github.com/scummvm/scummvm/commit/83ecd6cac2ce34d46b3f58be64af77f9662a72d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-10-25T16:38:58+03:00

Commit Message:
GROOVIE: Implement top-level function for MouseTrap

Changed paths:
    engines/groovie/logic/mousetrap.cpp
    engines/groovie/logic/mousetrap.h


diff --git a/engines/groovie/logic/mousetrap.cpp b/engines/groovie/logic/mousetrap.cpp
index b7101a85bc..c83114315f 100644
--- a/engines/groovie/logic/mousetrap.cpp
+++ b/engines/groovie/logic/mousetrap.cpp
@@ -29,11 +29,8 @@ MouseTrapGame::MouseTrapGame() : _random("MouseTrapGame") {
 }
 
 void MouseTrapGame::run(byte *scriptVariables) {
-	// TODO: Finish the logic
 	byte op = scriptVariables[2];
 
-	warning("Mousetrap subop %d", op);
-
 	// variable 24 is the mouse?
 	//scriptVariables[24] = 2;
 
@@ -43,21 +40,21 @@ void MouseTrapGame::run(byte *scriptVariables) {
 
 	switch (op) {
 	case 0:
+		sub01(scriptVariables);
 		break;
 	case 1: // init board
 		// value of 0 is V, 1 is <, 2 is ^, 3 is >
 		// variable 23 is the outside piece
-		scriptVariables[23] = _random.getRandomNumber(3);
+		//scriptVariables[23] = _random.getRandomNumber(3);
 		// variable slot is the space number + 25, the left corner
 		// (Stauf's goal) is space 1, above that is space 2, the
 		// center is 13, and the right corner (goal) is space 25
-		for (int i = 27; i <= 49; i++) {
-			scriptVariables[i] = _random.getRandomNumber(3);
-		}
+		init();
+		sub03(scriptVariables);
 		break;
 	case 2: // before player chooses the floor to move, set the banned move
 	{
-		int clicked = int(scriptVariables[0]) * 5 + int(scriptVariables[1]) + 1;
+		int clicked = xyToPos(_mouseTrapX, _mouseTrapY);
 		scriptVariables[clicked + 50] = 0;
 		break;
 	}
@@ -66,14 +63,19 @@ void MouseTrapGame::run(byte *scriptVariables) {
 		// set the banned move
 		// this probably also sets a variable to allow the player to
 		// move the mouse, and checks for win/lose
+		sub05(scriptVariables);
 		break;
 	case 5: // maybe player moving mouse
+		sub06(scriptVariables);
 		break;
 	case 6: // Stauf moving floor?
+		sub07(scriptVariables);
 		break;
 	case 7: // maybe Stauf moving mouse
+		sub08(scriptVariables);
 		break;
 	case 8: // Samantha making a move
+		sub09(scriptVariables);
 		break;
 
 	default:
@@ -82,4 +84,34 @@ void MouseTrapGame::run(byte *scriptVariables) {
 	}
 }
 
+void MouseTrapGame::init() {
+}
+
+void MouseTrapGame::sub01(byte *scriptVariables) {
+}
+
+void MouseTrapGame::sub03(byte *scriptVariables) {
+}
+
+void MouseTrapGame::sub05(byte *scriptVariables) {
+}
+
+void MouseTrapGame::sub06(byte *scriptVariables) {
+}
+
+void MouseTrapGame::sub07(byte *scriptVariables) {
+}
+
+void MouseTrapGame::sub08(byte *scriptVariables) {
+}
+
+void MouseTrapGame::sub09(byte *scriptVariables) {
+}
+
+int8 MouseTrapGame::xyToPos(int8 x, int8 y) {
+	return 5 * y + x + 1;
+}
+
+
+
 } // End of Groovie namespace
diff --git a/engines/groovie/logic/mousetrap.h b/engines/groovie/logic/mousetrap.h
index 7fe2a90cbc..5b47d8125f 100644
--- a/engines/groovie/logic/mousetrap.h
+++ b/engines/groovie/logic/mousetrap.h
@@ -50,9 +50,20 @@ class MouseTrapGame {
 public:
 	MouseTrapGame();
 	void run(byte *scriptVariables);
-	
+
 private:
+	void init();
+	void sub01(byte *scriptVariables);
+	void sub03(byte *scriptVariables);
+	void sub05(byte *scriptVariables);
+	void sub06(byte *scriptVariables);
+	void sub07(byte *scriptVariables);
+	void sub08(byte *scriptVariables);
+	void sub09(byte *scriptVariables);
+	int8 xyToPos(int8 x, int8 y);
+
 	Common::RandomSource _random;
+	int8 _mouseTrapX, _mouseTrapY;
 };
 
 } // End of Groovie namespace


Commit: 5ab18dfe481c56651f249e0336dd7c66c40462e2
    https://github.com/scummvm/scummvm/commit/5ab18dfe481c56651f249e0336dd7c66c40462e2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-10-25T16:38:58+03:00

Commit Message:
GROOVIE: Added service functions to Mouse Trap

Changed paths:
    engines/groovie/logic/mousetrap.cpp
    engines/groovie/logic/mousetrap.h


diff --git a/engines/groovie/logic/mousetrap.cpp b/engines/groovie/logic/mousetrap.cpp
index c83114315f..b5c09fd7e9 100644
--- a/engines/groovie/logic/mousetrap.cpp
+++ b/engines/groovie/logic/mousetrap.cpp
@@ -26,6 +26,11 @@
 namespace Groovie {
 
 MouseTrapGame::MouseTrapGame() : _random("MouseTrapGame") {
+	_mouseTrapCounter = 0;
+	_mouseTrapX = _mouseTrapY = 0;
+	memset(_mouseTrapRoute, 0, 75);
+	_mouseTrapPos.x = _mouseTrapPos.y = 0;
+	memset(_mouseTrapCells, 0, 31);
 }
 
 void MouseTrapGame::run(byte *scriptVariables) {
@@ -84,6 +89,10 @@ void MouseTrapGame::run(byte *scriptVariables) {
 	}
 }
 
+static const int8 mouseTrapStates[] = {
+	6, 12,  9,  3
+};
+
 void MouseTrapGame::init() {
 }
 
@@ -112,6 +121,41 @@ int8 MouseTrapGame::xyToPos(int8 x, int8 y) {
 	return 5 * y + x + 1;
 }
 
+void MouseTrapGame::posToXY(int8 pos, int8 *x, int8 *y) {
+	*y = (pos - 1) / 5;
+	*x = (pos - 1) % 5;
+}
+
+void MouseTrapGame::copyStateToVars(byte *scriptVariables) {
+	memset(scriptVariables + 51, 0, 24);
+	scriptVariables[75] = 0;
+
+	for (int i = 0; i < _mouseTrapCounter; i++)
+		scriptVariables[xyToPos(_mouseTrapRoute[3 * i], _mouseTrapRoute[3 * i + 1]) + 50] = 1;
+}
+
+int8 MouseTrapGame::findState(int8 val) {
+  int8 result = 0;
+
+  while (mouseTrapStates[result] != val) {
+    if (++result >= 4)
+      return -1;
+  }
+  return result;
+}
+
+void MouseTrapGame::flipField(int8 x, int8 y) {
+}
+
+bool MouseTrapGame::calcSolution() {
+	int8 pos = _mouseTrapPos.x + 5 * _mouseTrapPos.y;
+	int8 val = _mouseTrapCells[pos + 5];
+
+	return ((val & 1) != 0 && _mouseTrapPos.y && (_mouseTrapCells[pos] & 4) != 0)
+		|| ((val & 4) != 0 && _mouseTrapPos.y < 4 && (_mouseTrapCells[pos + 10] & 1) != 0)
+		|| ((val & 8) != 0 && _mouseTrapPos.x < 4 && (_mouseTrapCells[pos + 6] & 2) != 0)
+		|| ((val & 2) != 0 && _mouseTrapPos.x && (_mouseTrapCells[pos + 4] & 8) != 0);
+}
 
 
 } // End of Groovie namespace
diff --git a/engines/groovie/logic/mousetrap.h b/engines/groovie/logic/mousetrap.h
index 5b47d8125f..672e281f8d 100644
--- a/engines/groovie/logic/mousetrap.h
+++ b/engines/groovie/logic/mousetrap.h
@@ -28,6 +28,11 @@
 
 namespace Groovie {
 
+struct Point8 {
+	int8 x;
+	int8 y;
+};
+
 /*
  * Mouse Trap puzzle in the Lab.
  *
@@ -61,9 +66,19 @@ private:
 	void sub08(byte *scriptVariables);
 	void sub09(byte *scriptVariables);
 	int8 xyToPos(int8 x, int8 y);
+	void posToXY(int8 pos, int8 *x, int8 *y);
+	void copyStateToVars(byte *scriptVariables);
+	int8 findState(int8 val);
+	void flipField(int8 x, int8 y);
+	bool calcSolution();
 
+private:
 	Common::RandomSource _random;
 	int8 _mouseTrapX, _mouseTrapY;
+	int8 _mouseTrapCounter;
+	int8 _mouseTrapRoute[75];
+	int8 _mouseTrapCells[31];
+	Point8 _mouseTrapPos;
 };
 
 } // End of Groovie namespace


Commit: bacb576af3db9457c0180887111ab2d4fdcf8d20
    https://github.com/scummvm/scummvm/commit/bacb576af3db9457c0180887111ab2d4fdcf8d20
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-10-25T16:38:58+03:00

Commit Message:
DIRECTOR: Added more tail macros to detection

Changed paths:
    engines/director/detection_tables.h


diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 788d9048d6..6ee44cba58 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -1189,6 +1189,7 @@ namespace Director {
 #define GENGAME1_(t,e,f,m,s,l,p,fl,v) 				{ { t, e, AD_ENTRY1s(f, m, s), l, p, (fl | SUPPORT_STATUS), GUIO1(GUIO_NOASPECT) }, GID_GENERIC, v }
 #define GENGAME1t_(t,e,f,m,s,l,p,fl,v) 				{ { t, e, AD_ENTRY1s(f, m, s), l, p, (fl | SUPPORT_STATUS | ADGF_TAILMD5), GUIO1(GUIO_NOASPECT) }, GID_GENERIC, v }
 #define GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,l,p,fl,v) 	{ { t, e, AD_ENTRY2s(f1, m1, s1, f2, m2, s2), l, p, (fl | SUPPORT_STATUS), GUIO1(GUIO_NOASPECT) }, GID_GENERIC, v }
+#define GENGAME2t_(t,e,f1,m1,s1,f2,m2,s2,l,p,fl,v) 	{ { t, e, AD_ENTRY2s(f1, m1, s1, f2, m2, s2), l, p, (fl | SUPPORT_STATUS | ADGF_TAILMD5), GUIO1(GUIO_NOASPECT) }, GID_GENERIC, v }
 
 #define MACGAME1(t,e,f,m,s,v) 	GENGAME1_(t,e,f,m,s,Common::EN_ANY,Common::kPlatformMacintosh,ADGF_MACRESFORK,v)
 #define MACGAME1t(t,e,f,m,s,v) 	GENGAME1t_(t,e,f,m,s,Common::EN_ANY,Common::kPlatformMacintosh,ADGF_MACRESFORK,v)
@@ -1211,9 +1212,11 @@ namespace Director {
 
 #define MACGAME2(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformMacintosh,ADGF_MACRESFORK,v)
 #define WINGAME2(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformWindows,ADGF_NO_FLAGS,v)
+#define WINGAME2t(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2t_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformWindows,ADGF_NO_FLAGS,v)
 #define FMTGAME2(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformFMTowns,ADGF_NO_FLAGS,v)
 #define MACDEMO2(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformMacintosh,(ADGF_MACRESFORK|ADGF_DEMO),v)
 #define WINDEMO2(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformWindows,ADGF_DEMO,v)
+#define WINDEMO2t(t,e,f1,m1,s1,f2,m2,s2,v) 	GENGAME2t_(t,e,f1,m1,s1,f2,m2,s2,Common::EN_ANY,Common::kPlatformWindows,ADGF_DEMO,v)
 #define MACGAME2_l(t,e,f1,m1,s1,f2,m2,s2,l,v) GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,l,Common::kPlatformMacintosh,ADGF_MACRESFORK,v)
 #define WINGAME2_l(t,e,f1,m1,s1,f2,m2,s2,l,v) GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,l,Common::kPlatformWindows,ADGF_NO_FLAGS,v)
 #define FMTGAME2_l(t,e,f1,m1,s1,f2,m2,s2,l,v) GENGAME2_(t,e,f1,m1,s1,f2,m2,s2,l,Common::kPlatformFMTowns,ADGF_NO_FLAGS,v)




More information about the Scummvm-git-logs mailing list