ScummVM API documentation
tlcgame.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_TLCGAME_H
29 #define GROOVIE_LOGIC_TLCGAME_H
30 
31 #include "common/textconsole.h"
32 #include "common/random.h"
33 
34 #define GROOVIE_TLC_MAX_EPSIODES (15)
35 #define GROOVIE_TLC_MAX_QUEST_EP (50)
36 
37 namespace Groovie {
38 
39 class GroovieEngine;
40 
41 // The regions.rle contains 898 entries. Round about 18 kByte in memory.
43  char name[12];
44  int numAnswers;
45  uint32 offset;
46 };
47 
48 struct TlcRegion {
49  uint16 left;
50  uint16 top;
51  uint16 right;
52  uint16 bottom;
53 };
54 
56  bool questionUsed;
57  uint32 questionScore;
58 };
59 
60 struct TlcTatHeader {
61  uint32 questionsNum;
62  uint32 questionsOffset;
63  uint8 binDividends[16];
64 };
65 
66 struct TlcTatAnswer {
67  uint8 binScore[16];
68 };
69 
71  char name[6];
72  int answerCount;
73  TlcTatAnswer answerData[8];
74 };
75 
76 class TlcGame
77 {
78 public:
79 #ifdef ENABLE_GROOVIE2
80  TlcGame(byte *scriptVariables);
81  ~TlcGame();
82 
83  static const char *getTlcMusicFilename(int musicId);
84 
85  void handleOp(uint8 op);
86 
93  void opRegions();
94 
106  int getRegionNext(uint16 &left, uint16 &top, uint16 &right, uint16 &bottom);
107 
112  void getRegionRewind();
113 
114 
120  void opFlags();
121 
122 
128  void opExitPoll();
129 
134  void opTat();
135 
136 private:
137  Common::RandomSource _random;
138 
139  void inline setScriptVar(uint16 var, byte value);
140  void inline setScriptVar16(uint16 var, uint16 value);
141  uint16 inline getScriptVar16(uint16 var);
142  byte *_scriptVariables;
143 
148  void regionsInit();
149  void regionsLoad();
150 
151  // Variables for region handling
152  int _numRegionHeaders;
153  int _curAnswerIndex;
154  int _curQuestNumAnswers;
155  TlcRegion _curQuestRegions[8];
156  TlcRegionsHeader *_regionHeader;
157 
161  void epInit();
162  void epSelectNextQuestion();
163  void epResultQuestion();
164  void epResultEpisode();
165 
166  // Variables for Exit Poll handling
167  int16 _epScoreBin[6];
168  int _epEpisodeIdx; // 15 Episodes: 0..14
169  int _epQuestionIdx; // 1..X (questions in current episode. counted up for every question)
170  int _epQuestionNumOfPool; // 1..X (question number in the data base. The questions are played in random order)
171  int _epQuestionsInEpisode;
172  TlcEpQuestionData *_epQuestionsData;
173 
174  // Variables for flag handling
175  byte _tatFlags[0x0E][0x09];
176 
180  void tatInitRegs();
181  void tatLoadDB();
182  void tatLoadDBHeaders();
183  void tatResultQuest();
184  void tatResultEpisode();
185  void tatGetProfile();
186  void debugTatFlags(int y, int y2);
187 
188  // Variables for TAT handling
189  int _tatEpisodes;
190  int _tatQuestCount;
191  TlcTatHeader *_tatHeaders;
192  TlcTatQuestions *_tatQuestions;
193  // uint8 _tatCoeffs[15][16];
194 #endif
195 };
196 
197 } // End of Groovie namespace
198 
199 #endif // GROOVIE_LOGIC_TLCGAME_H
Definition: tlcgame.h:70
Definition: tlcgame.h:66
Definition: random.h:44
Definition: tlcgame.h:42
Definition: tlcgame.h:60
Definition: tlcgame.h:55
Definition: tlcgame.h:48
Definition: tlcgame.h:76
Definition: cursor.h:32