1 #pragma once
2 #ifndef ATANKS_SRC_GLOBALTYPES_H_INCLUDED
3 #define ATANKS_SRC_GLOBALTYPES_H_INCLUDED
4 
5 /*
6  * atanks - obliterate each other with oversize weapons
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  */
23 
24 #define DEFAULT_SCREEN_WIDTH     800
25 #define DEFAULT_SCREEN_HEIGHT    600
26 #define GAMENAMELEN               64
27 #define MAX_INTEREST_AMOUNT   100000
28 #define MAX_TEAM_AMOUNT       500000
29 #define DEMO_WAIT_TIME            60
30 #ifdef ATANKS_IS_WINDOWS
31 #  define MAX_AI_TIME             30 // DirectDraw is too slow, allow more time
32 #else
33 #  define MAX_AI_TIME             10 // Standard with anything but windows
34 #endif // ATANKS_IS_MSVC
35 #define ALL_SOCKETS               -1
36 
37 // Start enforcing unified integer typing
38 #include <cstdint>
39 
40 // Use atomic types for thread safety where locks are a bad idea
41 #include <atomic>
42 typedef std::atomic_bool         abool_t;
43 typedef std::atomic_flag         aflag_t;
44 typedef std::atomic_int_fast32_t ai32_t;
45 
46 
47 /** @file globaltypes.h
48   * @brief Definitions of types relevant to global data.
49 **/
50 
51 
52 /** @enum eBackgroundTypes
53   * @brief types for drawing menu background
54 **/
55 enum eBackgroundTypes
56 {
57 	BACKGROUND_BLANK  = 0,
58 	BACKGROUND_CIRCLE,
59 	BACKGROUND_LINE,
60 	BACKGROUND_SQUARE,
61 	BACKGROUND_COUNT,
62 };
63 
64 
65 /** @enum eBoxModes
66   * @brief Whether boxed mode is on, off or random.
67 **/
68 enum eBoxModes
69 {
70 	BM_OFF = 0,
71 	BM_ON,
72 	BM_RANDOM
73 };
74 
75 
76 /** @enum eColourTheme
77   * @brief determine which colour theme to use
78 **/
79 enum eColourTheme
80 {
81 	CT_REGULAR = 0,
82 	CT_CRISPY
83 };
84 
85 
86 /** @enum eCOntrol
87   * @brief control results for human and computer control
88 **/
89 enum eControl
90 {
91 	CONTROL_NONE  = 0,
92 	CONTROL_FIRE  = 101, // Explicitly fire a weapon/item
93 	CONTROL_OTHER = 102, // Something else but firing something
94 	CONTROL_SKIP  = 201, // Turn on skipping computer play through in game menu
95 	CONTROL_QUIT  = 202  // Any means to quit the game
96 };
97 
98 
99 
100 /** @enum eDataStage
101   * @brief The data stage of the weapons text file loading
102 **/
103 enum eDataStage
104 {
105 	DS_NAME = 0,
106 	DS_DESC,
107 	DS_DATA
108 };
109 eDataStage &operator++ (eDataStage &ds); // Enable pre-increment
110 
111 
112 /** @enum eFileStage
113   * @brief The file stage of the weapons text file loading
114 **/
115 enum eFileStage
116 {
117 	FS_WEAPONS = 0,
118 	FS_NATURALS,
119 	FS_ITEMS
120 };
121 
122 
123 /** @enum eFullScreen
124   * @brief Whether to use full screen or not.
125 **/
126 enum eFullScreen
127 {
128 	FULL_SCREEN_EITHER = 0,
129 	FULL_SCREEN_TRUE,
130 	FULL_SCREEN_FALSE
131 };
132 
133 
134 /** @enum eLandscapeTypes
135   * @brief determine the types the landscape can have
136 **/
137 enum eLandscapeTypes
138 {
139 	LAND_RANDOM = 0,
140 	LAND_CANYONS,
141 	LAND_MOUNTAINS,
142 	LAND_VALLEYS,
143 	LAND_HILLS,
144 	LAND_FOOTHILLS,
145 	LAND_PLAIN,
146 	LAND_NONE
147 };
148 
149 
150 /** @enum eLandSlideTypes
151   * @brief determine the kind of land sliding.
152 **/
153 enum eLandSlideTypes
154 {
155 	SLIDE_NONE = 0,   // gravity does not exist
156 	SLIDE_TANK_ONLY,  // dirt falls, tank does not
157 	SLIDE_INSTANT,    // dirt falls without you seeing it
158 	SLIDE_GRAVITY,    // normal
159 	SLIDE_CARTOON     // gravity is delayed
160 };
161 
162 
163 /** @enum eLanguages
164   * @brief Declare the list of supported languages.
165   *
166   * The last item EL_LANGUAGE_COUNT can be used to retrieve the
167   * number of supported languages.
168   *
169   * This enum is sorted in the order the languages should be listed.
170 **/
171 enum eLanguages
172 {
173 	EL_ENGLISH = 0,
174 	EL_PORTUGUESE,
175 	EL_FRENCH,
176 	EL_GERMAN,
177 	EL_SLOVAK,
178 	EL_RUSSIAN,
179 	EL_SPANISH,
180 	EL_ITALIAN,
181 	EL_LANGUAGE_COUNT
182 };
183 
184 // Helper operators to rotate languages:
185 eLanguages &operator++(eLanguages &lang);
186 eLanguages operator++ (eLanguages &lang, int);
187 eLanguages &operator--(eLanguages &lang);
188 eLanguages operator-- (eLanguages &lang, int);
189 eLanguages &operator+=(eLanguages &lang, int32_t val);
190 eLanguages &operator-=(eLanguages &lang, int32_t val);
191 
192 
193 /** @enum eSatelliteLaser
194   * @brief Size of satellite laser
195 **/
196 enum eSatelliteLaser
197 {
198 	SL_NONE = 0,
199 	SL_WEAK,
200 	SL_STRONG,
201 	SL_SUPER
202 };
203 
204 
205 /** @enum eSaveGameStage
206   * @brief Stages written in a saved game file
207 **/
208 enum eSaveGameStage
209 {
210 	SGS_NONE = 0,
211 	SGS_GLOBAL,
212 	SGS_ENVIRONMENT,
213 	SGS_PLAYERS
214 };
215 
216 
217 /** @enum eSkipPlayType
218   * @brief How skipping computer play is managed
219 **/
220 enum eSkipPlayType
221 {
222 	SKIP_NONE = 0,
223 	SKIP_HUMANS_DEAD
224 };
225 
226 
227 /** @enum eSoundDriver
228   * @brief determine which sound driver to use
229 **/
230 enum eSoundDriver
231 {
232 	SD_AUTODETECT = 0,
233 	SD_OSS,
234 	SD_ESD,  // Does anybody still use that?
235 	SD_ARTS, // Long long deprecated
236 	SD_ALSA,
237 	SD_JACK
238 	// What about PulseAudio?
239 };
240 
241 
242 /** @enum eSounds
243   * @brief enum that describes the sound array
244 **/
245 enum eSounds
246 {
247 	// === FIRE a weapon / an item ===
248 	SND_FIRE_MISS_SML       = 0,
249 	SND_FIRE_MISS_MED       = 1,
250 	SND_FIRE_MISS_LRG       = 2,
251 	SND_FIRE_NUKE           = 3,
252 	SND_FIRE_DEATHEAD       = 4,
253     SND_FIRE_LASER          = 5,
254     SND_FIRE_TELEPORT       = 6,
255     SND_FIRE_WIND_FAN       = 7,
256 
257 	// === EXPLosion of a weapon / an item ===
258 	SND_EXPL_MISS_SML       = 10,
259 	SND_EXPL_MISS_MED       = 11,
260 	SND_EXPL_MISS_LRG       = 12,
261 	SND_EXPL_NUKE           = 13,
262 	SND_EXPL_DEATHEAD       = 14,
263     SND_EXPL_DIRT_BALL_BOMB = 15,
264     SND_EXPL_SHAPED_CHARGE  = 16,
265     SND_EXPL_WIDE_BOY       = 17,
266     SND_EXPL_CUTTER         = 18,
267     SND_EXPL_NAPALM         = 19,
268     SND_EXPL_NAPALM_BURN    = 20,
269     SND_EXPL_PER_CENT_BOMB  = 21,
270     SND_EXPL_REDUCER        = 22,
271 
272 	// === NATUral going off ===
273     SND_NATU_THUNDER_SMLMED = 30,
274     SND_NATU_THUNDER_LRG    = 31,
275     SND_NATU_DIRT_FALL      = 32,
276 
277 	// === INTErface sounds ===
278     SND_INTE_BUTTON_CLICK   = 40,
279 
280 	// Play BackGround MUSIC
281 	SND_BG_MUSIC            = 50,
282 	SND_COUNT
283 
284 };
285 
286 
287 /** @enum eStages
288   * @brief General stages for the game flow.
289 **/
290 enum eRoundStages
291 {
292 	STAGE_AIM = 0,
293 	STAGE_FIRE,
294 	STAGE_SCOREBOARD, // The scoreboard is displayed
295 	STAGE_ENDGAME     // All actions have ceased, the round has ended.
296 };
297 
298 
299 /** @enum eViolentDeath
300   * @brief Level of automatic violent death option.
301 **/
302 enum eViolentDeath
303 {
304 	VD_OFF = 0,
305 	VD_LIGHT,
306 	VD_MEDIUM,
307 	VD_HEAVY
308 };
309 
310 
311 /** @enum eWallTypes
312   * @brief All the types the walls can have.
313 **/
314 enum eWallTypes
315 {
316 	WALL_RUBBER = 0,
317 	WALL_STEEL,
318 	WALL_SPRING,
319 	WALL_WRAP,
320 	WALL_RANDOM
321 };
322 
323 
324 /** @enum eWinner
325   * @brief All possible winning sets
326 **/
327 enum eWinner
328 {
329 	WINNER_NO_WIN = 101,
330 	WINNER_DRAW   = 102,
331 	WINNER_JEDI   = 104,
332 	WINNER_SITH   = 105
333 };
334 
335 
336 #endif // ATANKS_SRC_GLOBALTYPES_H_INCLUDED
337 
338