1 /*
2 Copyright (C) 2003 Parallel Realities
3 Copyright (C) 2011 Guus Sliepen
4 Copyright (C) 2015-2020 The Diligent Circle <diligentcircle@riseup.net>
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 3
9 of the License, or (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef ENGINE_H
21 #define ENGINE_H
22 
23 #include "SDL.h"
24 
25 #include "defs.h"
26 #include "structs.h"
27 
28 #include "collectable.h"
29 
30 
31 typedef struct Engine_ {
32 
33 	SDL_Event event;
34 	int done;
35 
36 	SDL_RWops *sdlrw;
37 
38 	float musicVolume;
39 
40 	int maxAliens;
41 
42 	float ssx;
43 	float ssy;
44 	float smx;
45 	float smy;
46 
47 	Object *bulletHead;
48 	Object *bulletTail;
49 	Object *explosionHead;
50 	Object *explosionTail;
51 	Collectable *collectableHead;
52 	Collectable *collectableTail;
53 	Object *debrisHead;
54 	Object *debrisTail;
55 
56 	int cursor_x, cursor_y;
57 
58 	int commsSection;
59 
60 	int eventTimer;
61 
62 	int lowShield;
63 	int averageShield;
64 
65 	int targetIndex;
66 
67 	// Mission completion timer (allows for 4 seconds before leaving sector)
68 	Uint32 missionCompleteTimer;
69 
70 	// Times the mission normally
71 	Uint32 counter2;
72 	long timeTaken; // In seconds
73 
74 	// For missions with a time limit
75 	int timeMission;
76 	Uint32 counter;
77 	int seconds;
78 	int minutes;
79 
80 	// Mission Related stuff
81 	int allAliensDead;
82 	int addAliens;
83 
84 	int paused;
85 	int gameSection;
86 
87 	int useAudio;
88 	int useSound;
89 	int useMusic;
90 	int fullScreen;
91 	int autoPause;
92 	int radioLife;
93 	char lang[STRMAX_SHORT];
94 
95 	char configDirectory[PATH_MAX];
96 
97 	int keyState[KEY_LAST];
98 	double xaxis;
99 	double yaxis;
100 
101 	int useController;
102 
103 	int cheat; // overall cheat
104 	int cheatShield;
105 	int cheatCash;
106 	int cheatAmmo;
107 	int cheatTime;
108 
109 } Engine;
110 
111 
112 extern Engine engine;
113 
114 void engine_init();
115 void engine_showError(int errorId, const char *name);
116 void engine_warn(const char *msg);
117 void engine_error(const char *msg);
118 void engine_setupConfigDirectory();
119 void engine_setMode();
120 void engine_setFullscreen(int value);
121 void engine_resetLists();
122 void engine_cleanup();
123 
124 #endif
125