1 #ifndef GAME_H
2 #define GAME_H
3 
4 #include <vector>
5 #include <string>
6 #include "SDL.h"
7 #include "Maths.h"
8 #include "UtilityClass.h"
9 #include "GraphicsUtil.h"
10 
11 
12 class entityclass;
13 class mapclass;
14 class Graphics;
15 class musicclass;
16 
17 class Game
18 {
19 public:
20     Game(void);
21     ~Game(void);
22 
23 
setGlobalSoundVol(const float _vol)24     void setGlobalSoundVol(const float _vol)
25     {
26         m_globalVol = _vol;
27     }
getGlobalSoundVol()28     float getGlobalSoundVol()
29     {
30         return m_globalVol;
31     }
32 
33 
34     int crewrescued();
35 
36     std::string unrescued();
37 
38     void resetgameclock();
39 
40     void customsavequick(std::string savfile, mapclass& map, entityclass& obj, musicclass& music);
41     void savequick(mapclass& map, entityclass& obj, musicclass& music);
42 
43     void gameclock();
44 
45     std::string giventimestring(int hrs, int min, int sec, UtilityClass& help );
46 
47     std::string  timestring(UtilityClass& help);
48 
49     std::string partimestring(UtilityClass& help);
50 
51     std::string resulttimestring(UtilityClass& help);
52 
53     std::string timetstring(int t, UtilityClass& help);
54 
55     void  createmenu(std::string t);
56 
57     void lifesequence(entityclass& obj);
58 
59     void gethardestroom(mapclass& map);
60 
61     void updatestate(Graphics& dwgfx, mapclass& map, entityclass& obj, UtilityClass& help, musicclass& music);
62 
63     void unlocknum(int t, mapclass& map, Graphics& dwgfx);
64 
65     void loadstats(mapclass& map, Graphics& dwgfx);
66 
67     void  savestats(mapclass& map, Graphics& dwgfx);
68 
69     void deletestats(mapclass& map, Graphics& dwgfx);
70 
71     void deletequick();
72 
73     void savetele(mapclass& map, entityclass& obj, musicclass& music);
74 
75     void loadtele(mapclass& map, entityclass& obj, musicclass& music);
76 
77     void deletetele();
78 
79     void customstart(entityclass& obj, musicclass& music );
80 
81     void start(entityclass& obj, musicclass& music );
82 
83     void startspecial(int t, entityclass& obj, musicclass& music);
84 
85     void starttrial(int t, entityclass& obj, musicclass& music);
86 
telegotoship()87     void telegotoship()
88     {
89         //Special function to move the telesave to the ship teleporter.
90         //telecookie.data.savex = 13*8;
91         //telecookie.data.savey = 129;
92         //telecookie.data.saverx = 102;
93         //telecookie.data.savery = 111;
94         //telecookie.data.savegc = 0;
95         //telecookie.data.savedir = 1;
96         //telecookie.data.savepoint = 0;
97 
98         //telecookie.data.currentsong = 4;
99         //telecookie.data.companion = 0;
100 
101         //telecookie.data.finalmode = false;
102         //telecookie.data.finalstretch = false;
103     }
104 
105     void swnpenalty();
106 
107     void deathsequence(mapclass& map, entityclass& obj, musicclass& music);
108 
109     void customloadquick(std::string savfile, mapclass& map, entityclass& obj, musicclass& music);
110     void loadquick(mapclass& map, entityclass& obj, musicclass& music);
111 
112     void loadsummary(mapclass& map, UtilityClass& help);
113 
114     void initteleportermode(mapclass& map);
115 
116 	std::string saveFilePath;
117 
118 
119     int door_left;
120     int door_right;
121     int door_up;
122     int door_down;
123     int roomx, roomy, roomchangedir;
124     int temp, j, k;
125 
126     int savex, savey, saverx, savery;
127     int savegc, savedir;
128 
129     //Added for port
130     int edsavex, edsavey, edsaverx, edsavery;
131     int edsavegc, edsavedir;
132 
133     //State logic stuff
134     int state, statedelay;
135 
136 		bool glitchrunkludge;
137 
138 		int usingmmmmmm;
139 
140     int gamestate;
141     bool hascontrol, jumpheld;
142     int jumppressed;
143     int gravitycontrol;
144 
145     bool infocus;
146     bool muted;
147     int mutebutton;
148 	private:
149     float m_globalVol;
150 
151 	public:
152 
153     int tapleft, tapright;
154 
155     //Menu interaction stuff
156     bool mapheld;
157     int menupage;
158     //public var crewstats:Array = new Array();
159     int lastsaved;
160     int deathcounts;
161 	int timerStartTime;
162 
163     int frames, seconds, minutes, hours;
164     bool gamesaved;
165     std::string savetime;
166     std::string savearea;
167     int savetrinkets;
168     bool startscript;
169     std::string newscript;
170 
171     int mainmenu;
172     bool menustart;
173 
174     //Teleporting
175     bool teleport_to_new_area;
176     int teleport_to_x, teleport_to_y;
177     std::string teleportscript;
178     bool useteleporter;
179     int teleport_to_teleporter;
180 
181     //Main Menu Variables
182     std::vector<std::string> menuoptions;
183     std::vector<bool> menuoptionsactive;
184     int nummenuoptions, currentmenuoption ;
185     std::string menuselection, currentmenuname, previousmenuname;
186     int menuxoff, menuyoff;
187 
188     int menucountdown;
189     std::string menudest;
190 
191     int creditposx, creditposy, creditposdelay;
192 
193 
194     //60 fps mode!
195     bool sfpsmode;
196 
197     //Sine Wave Ninja Minigame
198     bool swnmode;
199     int swngame, swnstate, swnstate2, swnstate3, swnstate4, swndelay, swndeaths;
200     int swntimer, swncolstate, swncoldelay;
201     int  swnrecord, swnbestrank, swnrank, swnmessage;
202 
203     //SuperCrewMate Stuff
204     bool supercrewmate, scmhurt, scmmoveme;
205     int scmprogress;
206 
207     //Accessibility Options
208     bool  colourblindmode;
209     bool noflashingmode;
210     int slowdown;
211     Uint32 gameframerate;
212 
213     bool nodeathmode;
214     int gameoverdelay;
215     bool nocutscenes;
216 
217     //Time Trials
218     bool intimetrial, timetrialparlost;
219     int timetrialcountdown, timetrialshinytarget, timetriallevel;
220     int timetrialpar, timetrialresulttime, timetrialrank;
221 
222     int creditposition;
223     bool insecretlab;
224 
225     bool inintermission;
226 
227     std::vector<bool> crewstats;
228 
229     bool alarmon;
230     int alarmdelay;
231     bool blackout;
232 
233     std::vector<bool> tele_crewstats;
234 
235     std::vector<bool> quick_crewstats;
236 
237     std::vector<int> unlock;
238     std::vector<int> unlocknotify;
239     std::vector<int> temp_unlock;
240     std::vector<int> temp_unlocknotify;
241     int stat_trinkets;
242     bool fullscreen;
243     int bestgamedeaths;
244 
245     bool stat_screenshakes;
246     bool stat_backgrounds;
247     bool stat_flipmode;
248     bool stat_invincibility;
249     int stat_slowdown;
250 
251 
252     std::vector<int>besttimes;
253     std::vector<int>besttrinkets;
254     std::vector<int>bestlives;
255     std::vector<int> bestrank;
256 
257     bool telecookieexists;
258     bool quickcookieexists;
259 
260     std::string tele_gametime;
261     int tele_trinkets;
262     std::string tele_currentarea;
263     std::string quick_gametime;
264     int quick_trinkets;
265     std::string quick_currentarea;
266 
267     int mx, my;
268     int screenshake, flashlight;
269     bool test;
270     std::string teststring, tempstring;
271     bool advancetext, pausescript;
272 
273     int deathseq, lifeseq;
274 
275     int coins, trinkets, crewmates, trinkencollect;
276     int savepoint, teleport, teleportxpos;
277     int edteleportent;
278     bool completestop;
279 
280     float inertia;
281 
282     int companion;
283     bool roomchange;
284     SDL_Rect teleblock;
285     bool activetele;
286     int readytotele;
287     int activity_r, activity_g, activity_b;
288     std::string activity_lastprompt;
289 
290     std::string telesummary, quicksummary, customquicksummary;
291 
292     bool backgroundtext;
293 
294     int activeactivity, act_fade;
295 
296     bool press_left, press_right, press_action, press_map;
297 
298     //Some stats:
299     int totalflips;
300     std::string hardestroom;
301     int hardestroomdeaths, currentroomdeaths;
302 
303     bool savemystats;
304 
305 
306     bool advanced_mode;
307     bool fullScreenEffect_badSignal;
308 	bool useLinearFilter;
309 	int stretchMode;
310 	int controllerSensitivity;
311 
312     //Screenrecording stuff, for beta/trailer
313     int recording;
314     std::string recordstring;
315     bool combomode;
316     int combolen;
317     std::string comboaction;
318     std::string currentaction;
319     bool recordinit;
320 
321     std::vector<int> playback;
322     int playbackpos;
323     int playbacksize;
324     int playmove;
325     int playcombo;
326     bool playbackfinished;
327 
328     bool menukludge;
329     bool quickrestartkludge;
330 
331     bool paused;
332     int globalsound;
333 
334     //Custom stuff
335     std::string customscript[50];
336     int customcol;
337     int levelpage;
338     int playcustomlevel;
339     std::string customleveltitle;
340     std::string customlevelfilename;
341 
342     void clearcustomlevelstats();
343     void loadcustomlevelstats();
344     void savecustomlevelstats();
345     void updatecustomlevelstats(std::string clevel, int cscore);
346 
347     std::string customlevelstats[200]; //string array containing level filenames
348     int customlevelscore[200];//0 - not played, 1 - finished, 2 - all trinkets, 3 - finished, all trinkets
349     int numcustomlevelstats;
350     bool customlevelstatsloaded;
351 
352 
353 	std::vector<SDL_GameControllerButton> controllerButton_map;
354 	std::vector<SDL_GameControllerButton> controllerButton_flip;
355 	std::vector<SDL_GameControllerButton> controllerButton_esc;
356 
357 };
358 
359 #endif /* GAME_H */
360