[Scummvm-git-logs] scummvm master -> fc7f51afb0d04f340bda763aa09c93f5903bc9f8
bluegr
bluegr at gmail.com
Sat Oct 23 17:19:46 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fc7f51afb0 GROOVIE: Add stubs for the Pente (11H) + Othello (Clan/UHP) mini-games
Commit: fc7f51afb0d04f340bda763aa09c93f5903bc9f8
https://github.com/scummvm/scummvm/commit/fc7f51afb0d04f340bda763aa09c93f5903bc9f8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-10-23T20:19:32+03:00
Commit Message:
GROOVIE: Add stubs for the Pente (11H) + Othello (Clan/UHP) mini-games
Also, perform some clean up of the logic in the cell mini-game (T7G)
Changed paths:
A engines/groovie/logic/othello.cpp
A engines/groovie/logic/othello.h
A engines/groovie/logic/pente.cpp
A engines/groovie/logic/pente.h
engines/groovie/logic/cell.cpp
engines/groovie/logic/cell.h
engines/groovie/module.mk
engines/groovie/script.cpp
engines/groovie/script.h
diff --git a/engines/groovie/logic/cell.cpp b/engines/groovie/logic/cell.cpp
index 7bc279969c..66d1baae78 100644
--- a/engines/groovie/logic/cell.cpp
+++ b/engines/groovie/logic/cell.cpp
@@ -664,7 +664,7 @@ int8 CellGame::calcBestWeight(int8 color1, int8 color2, uint16 depth, int bestWe
return res;
}
-int16 CellGame::doGame(int8 color, int depth) {
+void CellGame::doGame(int8 color, int depth) {
bool canMove;
int type;
@@ -740,23 +740,18 @@ int16 CellGame::doGame(int8 color, int depth) {
}
}
chooseBestMove(color);
- return 1;
}
-
- return 0;
}
const int8 depths[] = { 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, 2, 3, 3, 2, 3, 3, 3 };
-int16 CellGame::calcMove(int8 color, uint16 depth) {
- int result = 0;
-
+void CellGame::calcMove(int8 color, uint16 depth) {
_flag1 = false;
++_moveCount;
if (depth) {
if (depth == 1) {
_flag2 = true;
- result = doGame(color, 0);
+ doGame(color, 0);
} else {
int newDepth;
@@ -765,17 +760,17 @@ int16 CellGame::calcMove(int8 color, uint16 depth) {
if (newDepth >= 20) {
assert(0); // This branch is not implemented
} else {
- result = doGame(color, newDepth);
+ doGame(color, newDepth);
}
}
} else {
_flag2 = false;
- result = doGame(color, depth);
+ doGame(color, depth);
}
- return result;
}
-int CellGame::playStauf(byte color, uint16 depth, byte *scriptBoard) {
+void CellGame::run(uint16 depth, byte *scriptBoard) {
+ const byte color = 2;
int i;
for (i = 0; i < 49; i++, scriptBoard++) {
@@ -788,7 +783,7 @@ int CellGame::playStauf(byte color, uint16 depth, byte *scriptBoard) {
for (i = 49; i < 57; i++)
_board[i] = 0;
- return calcMove(color, depth);
+ calcMove(color, depth);
}
diff --git a/engines/groovie/logic/cell.h b/engines/groovie/logic/cell.h
index b76365ddc8..5cadde8fa5 100644
--- a/engines/groovie/logic/cell.h
+++ b/engines/groovie/logic/cell.h
@@ -36,11 +36,12 @@ class CellGame {
public:
CellGame();
~CellGame();
+ void run(uint16 depth, byte *scriptBoard);
+
byte getStartX();
byte getStartY();
byte getEndX();
byte getEndY();
- int playStauf(byte color, uint16 depth, byte *scriptBoard);
private:
void copyToTempBoard();
@@ -63,8 +64,8 @@ private:
int getBoardWeight(int8 color1, int8 color2);
void chooseBestMove(int8 color);
int8 calcBestWeight(int8 color1, int8 color2, uint16 depth, int bestWeight);
- int16 doGame(int8 color, int depth);
- int16 calcMove(int8 color, uint16 depth);
+ void doGame(int8 color, int depth);
+ void calcMove(int8 color, uint16 depth);
byte _startX;
byte _startY;
diff --git a/engines/groovie/logic/othello.cpp b/engines/groovie/logic/othello.cpp
new file mode 100644
index 0000000000..241b1a40ec
--- /dev/null
+++ b/engines/groovie/logic/othello.cpp
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "groovie/groovie.h"
+#include "groovie/logic/othello.h"
+
+namespace Groovie {
+
+OthelloGame::OthelloGame() : _random("OthelloGame") {
+}
+
+void OthelloGame::run(byte *scriptVariables) {
+ // TODO
+}
+
+} // End of Groovie namespace
diff --git a/engines/groovie/logic/othello.h b/engines/groovie/logic/othello.h
new file mode 100644
index 0000000000..a419976d4d
--- /dev/null
+++ b/engines/groovie/logic/othello.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GROOVIE_LOGIC_OTHELLO_H
+#define GROOVIE_LOGIC_OTHELLO_H
+
+#include "common/random.h"
+#include "common/system.h"
+
+namespace Groovie {
+
+/*
+ * Othello/Reversi puzzle in Clandestiny and UHP.
+ */
+class OthelloGame {
+public:
+ OthelloGame();
+ void run(byte *scriptVariables);
+
+private:
+ Common::RandomSource _random;
+};
+
+} // End of Groovie namespace
+
+#endif // GROOVIE_LOGIC_OTHELLO_H
diff --git a/engines/groovie/logic/pente.cpp b/engines/groovie/logic/pente.cpp
new file mode 100644
index 0000000000..f0fb6dbb4f
--- /dev/null
+++ b/engines/groovie/logic/pente.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "groovie/groovie.h"
+#include "groovie/logic/pente.h"
+
+namespace Groovie {
+
+PenteGame::PenteGame() : _random("PenteGame") {
+}
+
+void PenteGame::run(byte *scriptVariables) {
+ // TODO
+ scriptVariables[5] = 4; // Auto-solve the puzzle, so the player can continue
+}
+
+} // End of Groovie namespace
diff --git a/engines/groovie/logic/pente.h b/engines/groovie/logic/pente.h
new file mode 100644
index 0000000000..1cc47541c5
--- /dev/null
+++ b/engines/groovie/logic/pente.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GROOVIE_LOGIC_PENTE_H
+#define GROOVIE_LOGIC_PENTE_H
+
+#include "common/random.h"
+#include "common/system.h"
+
+namespace Groovie {
+
+/*
+ * Pente puzzle at the end of the game.
+ */
+class PenteGame {
+public:
+ PenteGame();
+ void run(byte *scriptVariables);
+
+private:
+ Common::RandomSource _random;
+};
+
+} // End of Groovie namespace
+
+#endif // GROOVIE_LOGIC_PENTE_H
diff --git a/engines/groovie/module.mk b/engines/groovie/module.mk
index a83d748819..9f81391cb4 100644
--- a/engines/groovie/module.mk
+++ b/engines/groovie/module.mk
@@ -22,6 +22,8 @@ MODULE_OBJS += \
logic/cake.o \
logic/gallery.o \
logic/mousetrap.o \
+ logic/othello.o \
+ logic/pente.o \
logic/tlcgame.o \
logic/triangle.o \
video/roq.o
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index c30db233ab..a2f01cf9b6 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -2073,7 +2073,7 @@ void Script::o_gamelogic() {
if (!_cellGame)
_cellGame = new CellGame;
- _cellGame->playStauf(2, param, &_variables[0x19]);
+ _cellGame->run(param, &_variables[0x19]);
// Set the movement origin
setVariable(0, _cellGame->getStartY()); // y
@@ -2104,14 +2104,13 @@ void Script::o_gamelogic() {
_mouseTrap.run(_variables);
break;
case 6: // 11H Pente puzzle at the end of the game (pt.grv)
- // TODO
- _variables[5] = 4; // Auto-solve the puzzle, so the player can continue
+ _pente.run(_variables);
break;
case 7: // Clan Unknown puzzle
// TODO
break;
case 8: // Clan/UHP Othello/Reversi puzzle
- // TODO
+ _othello.run(_variables);
break;
default:
debugC(1, kDebugScript, "Groovie::Script: Op42 (0x%02X): Invalid -> NOP", param);
@@ -2127,8 +2126,8 @@ void Script::o_gamelogic() {
#endif
default:
- debugC(1, kDebugScript, "Groovie::Script: GameSpecial (0x%02X)", param);
- warning("Groovie::Script: OpCode 0x42 for (GameSpecial) current game not implemented yet.");
+ warning("Groovie::Script: OpCode 0x42 (param %d) for current game is not implemented yet.", param);
+ break;
}
}
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index e65b185fb2..b9131d80c9 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -29,6 +29,8 @@
#include "groovie/logic/cake.h"
#include "groovie/logic/gallery.h"
#include "groovie/logic/mousetrap.h"
+#include "groovie/logic/othello.h"
+#include "groovie/logic/pente.h"
#include "groovie/logic/triangle.h"
#endif
@@ -268,6 +270,8 @@ private:
CakeGame _cake;
GalleryGame _gallery;
MouseTrapGame _mouseTrap;
+ OthelloGame _othello;
+ PenteGame _pente;
TriangleGame _triangle;
#endif
};
More information about the Scummvm-git-logs
mailing list