[Scummvm-git-logs] scummvm master -> 8e9e30946ed6d9c5f9d0bbf42e45396bbfde00be

Die4Ever 30947252+Die4Ever at users.noreply.github.com
Thu Oct 28 06:22: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:
9b51c274be GROOVIE: pente whitespace fixes
5fcd0f2461 GROOVIE: beehive overrideMoves for testing
8e9e30946e GROOVIE: mouse trap fix if statements in sub08


Commit: 9b51c274bec3b51a9ff6d304190f436a1a0147b7
    https://github.com/scummvm/scummvm/commit/9b51c274bec3b51a9ff6d304190f436a1a0147b7
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2021-10-28T01:20:11-05:00

Commit Message:
GROOVIE: pente whitespace fixes

Changed paths:
    engines/groovie/logic/pente.cpp


diff --git a/engines/groovie/logic/pente.cpp b/engines/groovie/logic/pente.cpp
index 6ee7a7b6c5..bb923780d9 100644
--- a/engines/groovie/logic/pente.cpp
+++ b/engines/groovie/logic/pente.cpp
@@ -20,10 +20,10 @@
  *
  */
 
-#include <limits.h>
-#include "groovie/groovie.h"
 #include "groovie/logic/pente.h"
 #include "common/stack.h"
+#include "groovie/groovie.h"
+#include <limits.h>
 
 namespace Groovie {
 
@@ -50,18 +50,14 @@ struct penteTable {
 	uint16 linesCounter;
 	uint16 linesTable[20][15][21];
 	byte numAdjacentPieces[20][15];
-	byte calcTouchingPieces;// the deepest level of AI recursion sets this to 0, and then sets it back to 1 when returning
+	byte calcTouchingPieces; // the deepest level of AI recursion sets this to 0, and then sets it back to 1 when returning
 };
 
-
-void PenteGame::penteSub02Frees(penteTable *table)
-{
+void PenteGame::penteSub02Frees(penteTable *table) {
 	delete table;
 }
 
-
-void PenteGame::penteSub05BuildLookupTable(penteTable *table)
-{
+void PenteGame::penteSub05BuildLookupTable(penteTable *table) {
 	uint16 *puVar1;
 	uint _width;
 	uint uVar4;
@@ -182,11 +178,7 @@ void PenteGame::penteSub05BuildLookupTable(penteTable *table)
 	table->linesCounter = lines_counter;
 }
 
-
-
-
-penteTable *PenteGame::penteSub01Init(byte width, byte height, byte length)
-{
+penteTable *PenteGame::penteSub01Init(byte width, byte height, byte length) {
 	penteTable *table;
 	byte bVar5;
 	uint16 _height;
@@ -212,13 +204,11 @@ penteTable *PenteGame::penteSub01Init(byte width, byte height, byte length)
 	return table;
 }
 
-
 uint &getPlayerTable(penteTable *table, bool staufTurn, pentePlayerTable *&pt) {
 	pt = staufTurn ? &table->stauf : &table->player;
 	return staufTurn ? table->staufScore : table->playerScore;
 }
 
-
 void penteScoringLine(penteTable *table, uint16 lineIndex, bool stauf_turn, bool revert) {
 	pentePlayerTable *playerTable;
 	uint &score = getPlayerTable(table, stauf_turn, playerTable);
@@ -294,7 +284,7 @@ void penteTouchingPieces(penteTable *table, byte moveX, byte moveY, bool revert)
 		}
 
 		for (; y <= endY; y++) {
-			if(revert)
+			if (revert)
 				table->numAdjacentPieces[x][y]--;
 			else
 				table->numAdjacentPieces[x][y]++;
@@ -302,7 +292,6 @@ void penteTouchingPieces(penteTable *table, byte moveX, byte moveY, bool revert)
 	}
 }
 
-
 void PenteGame::penteSub03Scoring(penteTable *table, byte move_y, byte move_x, bool stauf_turn) {
 	table->boardState[move_x][move_y] = stauf_turn ? 88 : 79;
 	uint16 lines = table->linesTable[move_x][move_y][0];
@@ -319,7 +308,6 @@ void PenteGame::penteSub03Scoring(penteTable *table, byte move_y, byte move_x, b
 	table->moveCounter++;
 }
 
-
 void PenteGame::penteSub07RevertScore(penteTable *table, byte y, byte x) {
 	bool stauf_turn = table->boardState[x][y] == 88;
 	table->boardState[x][y] = 0;
@@ -336,7 +324,6 @@ void PenteGame::penteSub07RevertScore(penteTable *table, byte y, byte x) {
 	}
 }
 
-
 byte PenteGame::penteScoreCaptureSingle(penteTable *table, byte x, byte y, int slopeX, int slopeY) {
 	byte x1 = x + slopeX;
 	byte y1 = y + slopeY;
@@ -381,13 +368,11 @@ Slope slopes[] = {{1, 0},
 				  {0, -1},
 				  {1, -1}};
 
-uint PenteGame::penteSub04ScoreCapture(penteTable *table, byte y, byte x)
-{
+uint PenteGame::penteSub04ScoreCapture(penteTable *table, byte y, byte x) {
 	byte bitMask = 0;
 	bool isStauf = table->boardState[x][y] == 88;
 
-	
-	for (const Slope &slope : slopes ) {
+	for (const Slope &slope : slopes) {
 		bitMask <<= 1;
 		bitMask |= penteScoreCaptureSingle(table, x, y, slope.x, slope.y);
 	}
@@ -408,9 +393,6 @@ uint PenteGame::penteSub04ScoreCapture(penteTable *table, byte y, byte x)
 	return bitMask;
 }
 
-
-
-
 void PenteGame::penteSub08MaybeAnimateCapture(short move, byte *bitMaskG, short *param_3, short *param_4)
 
 {
@@ -472,11 +454,7 @@ void PenteGame::penteSub08MaybeAnimateCapture(short move, byte *bitMaskG, short
 	return;
 }
 
-
-
-
-void PenteGame::penteSub11RevertCapture(penteTable *table, byte y, byte x, byte bitMask)
-{
+void PenteGame::penteSub11RevertCapture(penteTable *table, byte y, byte x, byte bitMask) {
 	bool isPlayer = table->boardState[x][y] == 79;
 	for (int i = bitMask; i; i >>= 1) {
 		if ((i & 1) == 0)
@@ -504,11 +482,7 @@ void PenteGame::penteSub11RevertCapture(penteTable *table, byte y, byte x, byte
 	}
 }
 
-
-
-
-int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_score)
-{
+int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_score) {
 	int iVar2;
 	int iVar3;
 	int iVar4;
@@ -582,7 +556,8 @@ int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_s
 		}
 
 		uint16 uVar6;
-		for (uVar6 = 1; uVar6 < local_970[1]; uVar6 = uVar6 * 3 + 1) {}
+		for (uVar6 = 1; uVar6 < local_970[1]; uVar6 = uVar6 * 3 + 1) {
+		}
 
 		while (2 < (short)uVar6) {
 			uVar6 = (short)uVar6 / 3;
@@ -649,11 +624,7 @@ int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_s
 	return -best_score;
 }
 
-
-
-
-uint PenteGame::penteSub09Ai(uint y_1, int param_2, int param_3, penteTable *table_4, byte depth)
-{
+uint PenteGame::penteSub09Ai(uint y_1, int param_2, int param_3, penteTable *table_4, byte depth) {
 	bool bVar1;
 	uint uVar2;
 	int iVar3;
@@ -746,7 +717,6 @@ uint PenteGame::penteSub09Ai(uint y_1, int param_2, int param_3, penteTable *tab
 	return y_1 & 0xffff0000 | (uint)uVar5;
 }
 
-
 int varsMoveToXY(byte var0, byte var1, byte var2, byte &x, byte &y) {
 	int move = ((char)var0 * 10 + (short)(char)var1) * 10 + (short)(char)var2;
 	x = (byte)(move / 15);
@@ -770,8 +740,7 @@ void moveXYToVars(uint x, uint y, byte &var0, byte &var1, byte &var2) {
 	moveToVars(move, var0, var1, var2);
 }
 
-void PenteGame::penteOp(byte *vars)
-{
+void PenteGame::penteOp(byte *vars) {
 	uint16 uVar1;
 	int iVar2;
 	uint uVar3;
@@ -827,14 +796,14 @@ void PenteGame::penteOp(byte *vars)
 			}
 			if ((int)game_state_table->playerScore < WIN_SCORE) {
 				uVar3 = game_state_table->staufScore;
-				vars[5] = 2;// Stauf wins
+				vars[5] = 2; // Stauf wins
 				if ((int)uVar3 < WIN_SCORE) {
-					vars[5] = 4;// player wins because the board is full?
+					vars[5] = 4; // player wins because the board is full?
 				}
 				goto DEALLOC;
 			}
 		}
-		vars[5] = 3;// player wins
+		vars[5] = 3; // player wins
 	DEALLOC:
 		penteSub02Frees(game_state_table);
 		game_state_table = (penteTable *)0x0;
@@ -885,7 +854,6 @@ LAB_00412e85:
 	moveXYToVars(globalX, globalY, vars[0], vars[1], vars[2]);
 }
 
-
 PenteGame::PenteGame() : _random("PenteGame") {
 	global1 = -1;
 	game_state_table = NULL;
@@ -1025,4 +993,4 @@ void PenteGame::testGame(uint32 seed, Common::Array<int> moves, bool playerWin)
 	warning("finished PenteGame::testGame(%u, %u, %d)", seed, moves.size(), (int)playerWin);
 }
 
-} // End of Groovie namespace
+} // namespace Groovie


Commit: 5fcd0f2461f5bc15d2a41943d17613d3a3197117
    https://github.com/scummvm/scummvm/commit/5fcd0f2461f5bc15d2a41943d17613d3a3197117
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2021-10-28T01:21:08-05:00

Commit Message:
GROOVIE: beehive overrideMoves for testing

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


diff --git a/engines/groovie/logic/beehive.cpp b/engines/groovie/logic/beehive.cpp
index 2db3769b62..05d581224c 100644
--- a/engines/groovie/logic/beehive.cpp
+++ b/engines/groovie/logic/beehive.cpp
@@ -30,6 +30,31 @@ extern const int8 beehiveLogicTable1[368];
 extern const int8 beehiveLogicTable2[800];
 }
 
+Common::Array<int> overrideMoves;
+int overrideIndex = 0;
+
+void BeehiveGame::overrideClick(byte *vars) {
+	if (overrideIndex >= overrideMoves.size())
+		return;
+
+	int move = overrideMoves[overrideIndex];
+	vars[0] = move / 10;
+	vars[1] = move % 10;
+}
+
+void BeehiveGame::overrideMove(byte *vars) {
+	if (overrideIndex >= overrideMoves.size())
+		return;
+
+	int from = overrideMoves[overrideIndex++];
+	int to = overrideMoves[overrideIndex++];
+	vars[0] = from / 10;
+	vars[1] = from % 10;
+
+	vars[2] = to / 10;
+	vars[3] = to % 10;
+}
+
 void BeehiveGame::run(byte *scriptVariables) {
 	int8 *hexagons = (int8 *)scriptVariables + 25;
 	int8 *hexDifference = (int8 *)scriptVariables + 13;
@@ -71,6 +96,7 @@ void BeehiveGame::run(byte *scriptVariables) {
 	case 2:	// Player clicks on a honey-filled (source) hexagon
 		memset(hexagons, 0, HEXCOUNT);
 		scriptVariables[85] = 0;
+		//overrideClick(scriptVariables);
 		v24 = 10 * scriptVariables[0] + scriptVariables[1];
 		debugC(2, kDebugLogic, "Beehive player clicked %d", (int)v24);
 		selectSourceHexagon(v24, &v22, tempState);
@@ -82,6 +108,7 @@ void BeehiveGame::run(byte *scriptVariables) {
 	case 3:	// Player moves into an empty (destination) hexagon
 		scriptVariables[24] = 1;
 		scriptVariables[4] = 2;
+		overrideMove(scriptVariables);
 		v24 = 10 * scriptVariables[0] + scriptVariables[1];
 		v22 = 10 * scriptVariables[2] + scriptVariables[3];
 		debugC(1, kDebugLogic, "Beehive player moved from %d, to %d", (int)v24, (int)v22);
@@ -759,7 +786,8 @@ void BeehiveGame::testGame(Common::Array<int> moves, bool playerWin) {
 }
 
 void BeehiveGame::tests() {
-
+	// tests are broken right now, but you might still want to use the overrideMoves
+#if 0
 	// 8 moves per line, in from and to pairs
 	// this winning test should work on every seed, it always works in the speedrun
 	testGame({
@@ -777,6 +805,15 @@ void BeehiveGame::tests() {
 		/**/ 58, 59, /**/ 57, 45, /**/ 44, 35, /**/ 35, 26, /**/ 46, 54, /**/ 59, 60, /**/ 59, 55, /**/ 55, 40,
 		/**/ 39, 23
 	}, false);
+
+#endif
+	// trim the array short to choose your own ending moves
+	overrideMoves = {
+		/**/ 34, 42, /**/ 56, 50, /**/ 50, 35, /**/ 42, 55, /**/ 34, 42, /**/ 42, 49, /**/ 35, 43, /**/ 43, 50,
+		/**/ 50, 51, /**/ 51, 52, /**/ 52, 53, /**/ 53, 54, /**/ 52, 57, /**/ 52, 46, /**/ 34, 25, /**/ 34, 24,
+		/**/ 25, 23, /**/ 46, 31, /**/ 31, 30, /**/ 52, 38, /**/ 29, 12, /**/ 31, 39, /**/ 35, 28, /**/ 49, 32,
+		/**/ 31, 40, /**/ 39, 47, /**/ 20, 19, /**/ 29, 37, /**/ 57, 58, /**/ 53, 46, /**/ 53, 52
+	};
 }
 
 } // End of Groovie namespace
diff --git a/engines/groovie/logic/beehive.h b/engines/groovie/logic/beehive.h
index 93bf7c4429..41581b7a0f 100644
--- a/engines/groovie/logic/beehive.h
+++ b/engines/groovie/logic/beehive.h
@@ -66,6 +66,8 @@ private:
 	int8 findCell(int8 *beehiveState, int8 *pos, int8 key);
 	void testGame(Common::Array<int> moves, bool playerWin);
 	void tests();
+	void overrideClick(byte *vars);
+	void overrideMove(byte *vars);
 
 	#define HEXCOUNT 61
 	int8 _beehiveState[HEXCOUNT];


Commit: 8e9e30946ed6d9c5f9d0bbf42e45396bbfde00be
    https://github.com/scummvm/scummvm/commit/8e9e30946ed6d9c5f9d0bbf42e45396bbfde00be
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2021-10-28T01:21:56-05:00

Commit Message:
GROOVIE: mouse trap fix if statements in sub08

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


diff --git a/engines/groovie/logic/mousetrap.cpp b/engines/groovie/logic/mousetrap.cpp
index 700d78a159..cfac2df305 100644
--- a/engines/groovie/logic/mousetrap.cpp
+++ b/engines/groovie/logic/mousetrap.cpp
@@ -280,19 +280,14 @@ void MouseTrapGame::sub08(byte *scriptVariables) {
 	scriptVariables[12] = pos % 10;
 	posToXY(scriptVariables[1] + 10 * scriptVariables[0], &x, &y);
 
-	if (y <= y1) {
-		if (y >= y1) {
-			if (x <= x1) {
-				if (x < x1)
-					scriptVariables[15] = 1;
-			} else {
-				scriptVariables[15] = 3;
-			}
-		} else {
-			scriptVariables[15] = 2;
-		}
-	} else {
+	if (y > y1) {
 		scriptVariables[15] = 0;
+	} else if (y < y1) {
+		scriptVariables[15] = 2;
+	} else if (x > x1) {
+		scriptVariables[15] = 3;
+	} else if (x < x1) {
+		scriptVariables[15] = 1;
 	}
 
 	if (!_mouseTrapCounter1)




More information about the Scummvm-git-logs mailing list