[Scummvm-git-logs] scummvm master -> 6dd999ecd450c317c2e1020e7908f03f0841ece0
sev-
sev at scummvm.org
Sat Oct 23 20:55:18 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
42f8af29e2 GROOVIE: Added some code for Triangle puzzle
6dd999ecd4 GROOVIE: More code for Triangle puzzle
Commit: 42f8af29e2fe306497e916317f53bcb521fd48fd
https://github.com/scummvm/scummvm/commit/42f8af29e2fe306497e916317f53bcb521fd48fd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-10-23T23:55:05+03:00
Commit Message:
GROOVIE: Added some code for Triangle puzzle
Changed paths:
engines/groovie/logic/triangle.cpp
engines/groovie/logic/triangle.h
diff --git a/engines/groovie/logic/triangle.cpp b/engines/groovie/logic/triangle.cpp
index 74c1414267..813c52fdbf 100644
--- a/engines/groovie/logic/triangle.cpp
+++ b/engines/groovie/logic/triangle.cpp
@@ -33,9 +33,61 @@ extern const int8 beehiveLogicTable2[800];
}
TriangleGame::TriangleGame() {
+ init();
}
void TriangleGame::run(byte *scriptVariables) {
+ byte op = scriptVariables[3];
+ int8 move;
+
+ switch (op) {
+ case 3:
+ init();
+ scriptVariables[3] = 0;
+ return;
+
+ case 4:
+ move = sub03(2);
+ break;
+
+ case 5:
+ move = sub03(1);
+ break;
+
+ default:
+ setCell(scriptVariables[1] + 10 * scriptVariables[0], 2);
+ scriptVariables[3] = sub02();
+
+ if (scriptVariables[3] == 0) {
+ move = sub03(1);
+ } else {
+ return;
+ }
+ }
+
+ scriptVariables[0] = move / 10;
+ scriptVariables[1] = move % 10;
+ scriptVariables[3] = sub02();
+}
+
+void TriangleGame::init() {
+ _triangleCellCount = 0;
+ memset(_triangleCells, 0, 66);
+}
+
+int8 TriangleGame::sub02() {
+ return 0;
+}
+
+int8 TriangleGame::sub03(int8 player) {
+ return 0;
+}
+
+void TriangleGame::setCell(int8 cellnum, int8 val) {
+ if (cellnum >= 0 && cellnum < 66) {
+ ++_triangleCellCount;
+ _triangleCells[cellnum] = val;
+ }
}
namespace {
diff --git a/engines/groovie/logic/triangle.h b/engines/groovie/logic/triangle.h
index 34e64be60f..ef69099127 100644
--- a/engines/groovie/logic/triangle.h
+++ b/engines/groovie/logic/triangle.h
@@ -32,6 +32,16 @@ class TriangleGame {
public:
TriangleGame();
void run(byte *scriptVariables);
+
+private:
+ void init();
+ int8 sub02();
+ int8 sub03(int8 player);
+ void setCell(int8 cellnum, int8 val);
+
+private:
+ int _triangleCellCount;
+ int8 _triangleCells[66];
};
} // End of Groovie namespace
Commit: 6dd999ecd450c317c2e1020e7908f03f0841ece0
https://github.com/scummvm/scummvm/commit/6dd999ecd450c317c2e1020e7908f03f0841ece0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-10-23T23:55:05+03:00
Commit Message:
GROOVIE: More code for Triangle puzzle
Changed paths:
engines/groovie/logic/triangle.cpp
engines/groovie/logic/triangle.h
diff --git a/engines/groovie/logic/triangle.cpp b/engines/groovie/logic/triangle.cpp
index 813c52fdbf..7f086ab08a 100644
--- a/engines/groovie/logic/triangle.cpp
+++ b/engines/groovie/logic/triangle.cpp
@@ -29,7 +29,7 @@ namespace {
extern const int8 triangleLookup1[12];
extern const int8 triangleLookup2[12];
extern const int8 triangleLookup3[12];
-extern const int8 beehiveLogicTable2[800];
+extern const int8 triangleLogicTable[924];
}
TriangleGame::TriangleGame() {
@@ -76,6 +76,32 @@ void TriangleGame::init() {
}
int8 TriangleGame::sub02() {
+ int8 v6[132];
+ int8 v7[68];
+
+ sub05(_triangleCells, v6, v7);
+
+ for (int i = 0; v6[i] != 66; i++) {
+ bool v1 = false;
+ bool v2 = false;
+ bool pl = false;
+
+ // There could be several sections, each one
+ // ends with 66. And the overall list ends with 66 too
+ // Hence, two loops
+ for (; v6[i] != 66; i++) {
+ if (!triangleLogicTable[14 * v6[i] + 6])
+ pl = true;
+ if (!triangleLogicTable[14 * v6[i] + 7])
+ v2 = true;
+ if (!triangleLogicTable[14 * v6[i] + 8])
+ v1 = true;
+ }
+
+ if (pl && v2 && v1)
+ return _triangleCells[v6[i - 1]];
+ }
+
return 0;
}
@@ -83,6 +109,9 @@ int8 TriangleGame::sub03(int8 player) {
return 0;
}
+void TriangleGame::sub05(int8 *triangleCells, int8 *a2, int8 *a3) {
+}
+
void TriangleGame::setCell(int8 cellnum, int8 val) {
if (cellnum >= 0 && cellnum < 66) {
++_triangleCellCount;
diff --git a/engines/groovie/logic/triangle.h b/engines/groovie/logic/triangle.h
index ef69099127..0dd5d8a82e 100644
--- a/engines/groovie/logic/triangle.h
+++ b/engines/groovie/logic/triangle.h
@@ -37,6 +37,7 @@ private:
void init();
int8 sub02();
int8 sub03(int8 player);
+ void sub05(int8 *triangleCells, int8 *a2, int8 *a3);
void setCell(int8 cellnum, int8 val);
private:
More information about the Scummvm-git-logs
mailing list