[Scummvm-git-logs] scummvm master -> cc4f5d9f68fbc8d27833a80ff48a4cbcc983d306
bluegr
bluegr at gmail.com
Thu Oct 28 13:45:49 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:
cc4f5d9f68 GROOVIE: Initial work on the logic of the Clandestiny wine rack puzzle
Commit: cc4f5d9f68fbc8d27833a80ff48a4cbcc983d306
https://github.com/scummvm/scummvm/commit/cc4f5d9f68fbc8d27833a80ff48a4cbcc983d306
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-10-28T16:45:36+03:00
Commit Message:
GROOVIE: Initial work on the logic of the Clandestiny wine rack puzzle
Changed paths:
engines/groovie/logic/winerack.cpp
engines/groovie/logic/winerack.h
diff --git a/engines/groovie/logic/winerack.cpp b/engines/groovie/logic/winerack.cpp
index 35ceaf0f8e..f2d35b0589 100644
--- a/engines/groovie/logic/winerack.cpp
+++ b/engines/groovie/logic/winerack.cpp
@@ -25,11 +25,115 @@
namespace Groovie {
-WineRackGame::WineRackGame() : _random("WineRackGame") {
+enum WineBottle {
+ kWineBottleOpponent = 1,
+ kWineBottlePlayer = 2
+};
+
+WineRackGame::WineRackGame() : _random("WineRackGame"), _totalBottles(0) {
+ memset(_wineRackGrid, 0, 100);
}
void WineRackGame::run(byte *scriptVariables) {
+ char op = scriptVariables[3];
+
+ switch (op) {
+ case 3:
+ initGrid(scriptVariables[4]);
+ break;
+ case 4:
+ placeBottle(calculateNextMove(2), 2);
+ scriptVariables[0] = op / 10;
+ scriptVariables[1] = op % 10;
+ //scriptVariables[3] = (char)FUN_00412c90();
+ break;
+ case 5:
+ scriptVariables[3] = 0;
+ placeBottle(calculateNextMove(1), 1);
+ scriptVariables[0] = op / 10;
+ scriptVariables[1] = op % 10;
+ //if ((char)FUN_00412cf0() != 0) {
+ // scriptVariables[3] = 1;
+ //}
+ break;
+ default:
+ scriptVariables[3] = 0;
+ placeBottle(scriptVariables[0] * 10 + scriptVariables[1], 2);
+ //if ((char)FUN_00412c90() != 0) {
+ // scriptVariables[3] = 2;
+ // return;
+ //}
+
+ placeBottle(calculateNextMove(1), 1);
+ scriptVariables[0] = op / 10;
+ scriptVariables[1] = op % 10;
+
+ //if ((char)FUN_00412cf0() != 0) {
+ // scriptVariables[3] = 1;
+ //}
+ break;
+ }
+}
+
+void WineRackGame::initGrid(byte difficulty) {
+ memset(_wineRackGrid + 1, 0, 25);
+
+ switch (difficulty) {
+ case 0:
+ _totalBottles = 24;
+
+ _wineRackGrid[15] = kWineBottlePlayer;
+ _wineRackGrid[18] = kWineBottleOpponent;
+ _wineRackGrid[19] = kWineBottleOpponent;
+ _wineRackGrid[20] = kWineBottleOpponent;
+ _wineRackGrid[21] = kWineBottleOpponent;
+ _wineRackGrid[22] = kWineBottleOpponent;
+ _wineRackGrid[23] = kWineBottleOpponent;
+ _wineRackGrid[25] = kWineBottlePlayer;
+ _wineRackGrid[26] = kWineBottleOpponent;
+ _wineRackGrid[27] = kWineBottleOpponent;
+ _wineRackGrid[28] = kWineBottleOpponent;
+ _wineRackGrid[33] = kWineBottleOpponent;
+ _wineRackGrid[34] = kWineBottleOpponent;
+ _wineRackGrid[35] = kWineBottlePlayer;
+ _wineRackGrid[36] = kWineBottleOpponent;
+ _wineRackGrid[44] = kWineBottlePlayer;
+ _wineRackGrid[45] = kWineBottlePlayer;
+ _wineRackGrid[54] = kWineBottlePlayer;
+ _wineRackGrid[62] = kWineBottlePlayer;
+ _wineRackGrid[63] = kWineBottlePlayer;
+ _wineRackGrid[64] = kWineBottlePlayer;
+ _wineRackGrid[72] = kWineBottlePlayer;
+ _wineRackGrid[82] = kWineBottlePlayer;
+ _wineRackGrid[91] = kWineBottlePlayer;
+ break;
+ case 1:
+ _totalBottles = 12;
+
+ _wineRackGrid[75] = kWineBottlePlayer;
+ _wineRackGrid[56] = kWineBottlePlayer;
+ _wineRackGrid[45] = kWineBottlePlayer;
+ _wineRackGrid[27] = kWineBottlePlayer;
+ _wineRackGrid[24] = kWineBottlePlayer;
+ _wineRackGrid[15] = kWineBottlePlayer;
+ _wineRackGrid[64] = kWineBottleOpponent;
+ _wineRackGrid[34] = kWineBottleOpponent;
+ _wineRackGrid[33] = kWineBottleOpponent;
+ _wineRackGrid[18] = kWineBottleOpponent;
+ _wineRackGrid[16] = kWineBottleOpponent;
+ _wineRackGrid[14] = kWineBottleOpponent;
+ break;
+ }
+}
+
+void WineRackGame::placeBottle(byte pos, byte val) {
+ _totalBottles++;
+ _wineRackGrid[pos] = val;
+}
+
+byte WineRackGame::calculateNextMove(byte op) {
// TODO
+ return 0;
}
} // End of Groovie namespace
diff --git a/engines/groovie/logic/winerack.h b/engines/groovie/logic/winerack.h
index a2c6d3d2f5..a5adb81bf0 100644
--- a/engines/groovie/logic/winerack.h
+++ b/engines/groovie/logic/winerack.h
@@ -39,6 +39,12 @@ public:
void run(byte *scriptVariables);
private:
+ void initGrid(byte difficulty);
+ void placeBottle(byte pos, byte val);
+ byte calculateNextMove(byte op);
+
+ int _totalBottles;
+ byte _wineRackGrid[100];
Common::RandomSource _random;
};
More information about the Scummvm-git-logs
mailing list