ScummVM API documentation
triangle.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  *
21  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, MojoTouch has exclusively licensed
23  * this code on November 10th, 2021, to be use in closed-source products.
24  * Therefore, any contributions (commits) to it will also be dual-licensed.
25  *
26  */
27 
28 #ifndef GROOVIE_LOGIC_TRIANGLE_H
29 #define GROOVIE_LOGIC_TRIANGLE_H
30 
31 #include "common/random.h"
32 #include "common/system.h"
33 
34 namespace Groovie {
35 
36 class TriangleGame {
37 public:
38  TriangleGame();
39  void run(byte *scriptVariables);
40 
41 private:
42  void init();
43  int8 sub02();
44  int8 sub03(int8 player);
45  void sub05(int8 *triangleCells, int8 *a2, int8 *a3);
46  void sub07(int8 *tempMoves, int8 *triangleCells, int8 *tempTriangle3, int8 *tempTriangle2, int8 *tempTriangle1, int8 *tempMoves2);
47  int8 sub09(int8 key, int8 *a2, int8 *a3, int8 *a4, int8 *triangleCells);
48  int8 sub10(int8 key, int8 *a2, int8 *triangleCells);
49  int8 sub12(int8 a1, int8 *a2, int8 *triangleCells, int8 *a4);
50  int sub13(int8 row, int8 *triangleCells, int8 *moves);
51  void setCell(int8 cellnum, int8 val);
52  void copyLogicRow(int row, int8 key, int8 *dest);
53  void replaceCells(int8 *tempTriangle, int limit, int8 from, int8 to);
54  int copyLookup(const int8 *lookup, int8 *start, int8 *dest);
55  void collapseLoops(int8 *route, int8 *singleRow);
56 
57  bool testGame(uint32 seed, Common::Array<uint8> moves, bool player_win);
58  void ensureSamanthaWin(uint32 seed);
59  void testPlayRandomly(uint32 seed);
60  void test();
61 
62 private:
63  int _triangleCellCount;
64  int8 _triangleCells[66];
65 
66  Common::RandomSource _random;
67 };
68 
69 } // End of Groovie namespace
70 
71 #endif // GROOVIE_LOGIC_TRIANGLE_H
Definition: random.h:44
Definition: triangle.h:36
Definition: cursor.h:32