OSDN Git Service

Project: Starfighter 1.4 オリジナル
[starfighter-jp/starfighter-jp.git] / src / defs.h
1 /*
2 Copyright (C) 2003 Parallel Realities
3 Copyright (C) 2011, 2012 Guus Sliepen
4 Copyright (C) 2012, 2015 Julian Marchant
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 DEFS_H
21 #define DEFS_H
22
23 #define MIN(a, b) ((a) < (b) ? (a) : (b))
24 #define MAX(a, b) ((a) > (b) ? (a) : (b))
25 #define LIMIT(x, a, b) x = ((x) < (b) ? ((x) > (a) ? (x) : (a)) : (b))
26 #define LIMIT_ADD(x, y, a, b) x = (((x) + (y)) < (b) ? \
27         (((x) + (y)) > (a) ? \
28                 ((x) + (y)) : (a)) : (b))
29 #define WRAP_ADD(x, y, a, b) x = (((x) + (y)) + \
30         ((x) + (y) < (a) ? ((b) - (a)) : 0) + \
31         ((x) + (y) > (b) ? ((a) - (b)) : 0))
32 #define RANDRANGE(x, y) (((x) < (y)) ? ((x) + (rand() % (1 + (y) - (x)))) : (x))
33
34 // ALL
35 #define NONE 0
36
37 // Compile-time options
38 #ifndef VERSION
39 #define VERSION "???"
40 #endif
41
42 #ifndef DATADIR
43 #define DATADIR "."
44 #endif 
45
46 #ifndef PATH_MAX
47 #define PATH_MAX        4096
48 #endif
49
50 // Object Flags
51 #define FL_WEAPCO 1
52 #define FL_FRIEND 2
53 #define FL_IMMORTAL 4
54 #define FL_NOMOVE 8
55 #define FL_NOFIRE 16
56 #define FL_FIRERAY 32
57 #define FL_DAMAGEOWNER 64
58 #define FL_LEAVESECTOR 128
59 #define FL_ESCAPED 256
60 #define FL_DROPMINES 512
61 #define FL_AIMS 1024
62 #define FL_DISABLED 2048
63 #define FL_CANNOTDIE 4096 // This will only apply to Kline before the final mission
64 #define FL_RUNSAWAY 8192
65 #define FL_ALWAYSFACE 16384 // Kline doesn't turn his back on you! ;)
66 #define FL_CIRCLES 32768L // Kline can circle around
67 #define FL_CONTINUOUS_FIRE 65536L // Go absolutely nutts(!)
68 #define FL_DEPLOYDRONES 131072L // Deploys small drone - Used by Boss 2
69 #define FL_CANCLOAK 262144L
70 #define FL_ISCLOAKED 524288L
71 #define FL_ACTIVATE 1048576L
72 #define FL_HASMINIMUMSPEED 2097152L
73 #define FL_FIRELASER 4194304L
74
75 // Explosions
76 #define E_SMALL_EXPLOSION 4
77 #define E_BIG_EXPLOSION 8
78 #define E_SMOKE 12
79 #define E_TINY_EXPLOSION 16
80 #define E_ELECTRICAL 20
81
82 // Weapon flags
83 #define WF_SPREAD 4
84 #define WF_SCATTER 8
85 #define WF_VARIABLE_SPEED 16
86 #define WF_HOMING 32
87 #define WF_SHOCKWAVE 64
88 #define WF_WEAPCO 128
89 #define WF_FRIEND 256
90 #define WF_AIMED 512
91 #define WF_DISABLE 1024
92 #define WF_TIMEDEXPLOSION 2048
93
94 #define MAX_WEAPONS 20
95 #define MAX_SHAPES 100
96 #define MAX_SHIPSHAPES 120
97 #define MAX_TEXTSHAPES 150
98 #define MAX_FONTSHAPES 6
99 #define MAX_SHOPSHAPES 6
100 #define MAX_CARGO 20
101
102 #define SHIP_HIT_INDEX 60
103
104 // AI Types
105 enum {
106
107         AI_NORMAL = 1,
108         AI_DEFENSIVE,
109         AI_OFFENSIVE,
110         AI_EVASIVE,
111         AI_WANDER
112 };
113
114 // These are for Alien *indexes* NOT classdefs!!
115 enum {
116
117         ALIEN_BOSS_PART4 = 10,
118         ALIEN_BOSS_PART3 = 11,
119         ALIEN_BOSS_PART2 = 12,
120         ALIEN_BOSS_PART1 = 13,
121         ALIEN_BOSS = 14,
122         ALIEN_KLINE,
123         ALIEN_PHOEBE,
124         ALIEN_URSULA,
125         ALIEN_SID,
126         ALIEN_GOODTRANSPORT = 19,
127         ALIEN_MAX = 25
128 };
129
130 // Droppables
131 enum {
132
133         P_ANYTHING = 1,
134         P_WEAPONS,
135         P_CASH,
136         P_ROCKET,
137         P_SHIELD,
138         P_CARGO,
139         P_PLASMA_AMMO,
140         P_PLASMA_RATE,
141         P_PLASMA_SHOT,
142         P_PLASMA_DAMAGE,
143         P_MINE,                         // mines detonate when you "pick them up!"
144         P_PHOEBE,                       // only used as an attachment(!)
145         P_SLAVES,
146         P_ESCAPEPOD,
147         P_ORE,
148         P_SUPER
149 };
150
151 // Jobs
152 enum {
153
154         WT_PLASMA = 1,
155         WT_ROCKET,
156         WT_ENERGYRAY,
157         WT_LASER,
158         WT_MICROROCKET,
159         WT_CHARGER,
160         WT_DIRECTIONAL,
161         WT_SPREAD
162 };
163
164 // Weapons
165 enum {
166
167         W_NONE = -1,
168         W_PLAYER_WEAPON,
169         W_PLAYER_WEAPON2,
170         W_SINGLE_SHOT,
171         W_DOUBLE_SHOT,
172         W_TRIPLE_SHOT,
173         W_ROCKETS,
174         W_DOUBLE_ROCKETS,
175         W_MICRO_ROCKETS,
176         W_ENERGYRAY,
177         W_LASER,
178         W_CHARGER,
179         W_HOMING_MISSILE,
180         W_DOUBLE_HOMING_MISSILES,
181         W_MICRO_HOMING_MISSILES,
182         W_AIMED_SHOT,
183         W_SPREADSHOT,
184         W_IONCANNON,
185         W_DIRSHOCKMISSILE
186 };
187
188 // Mission types
189 enum {
190
191         M_DESTROY_ALL_TARGETS = 1,
192         M_DESTROY_TARGET_TYPE,
193         M_COLLECT,
194         M_PROTECT_PICKUP,
195         M_PROTECT_TARGET,
196         M_DISABLE_TARGET,
197         M_ESCAPE_TARGET
198 };
199
200 enum {
201
202         OB_JUST_FAILED = -2,
203         OB_FAILED,
204         OB_INCOMPLETE,
205         OB_COMPLETED,
206         OB_JUST_COMPLETED,
207         OB_CONDITION,
208         OB_HIDDEN
209 };
210
211 // Class Defs - Some of these are just place holders
212 enum {
213
214         CD_DUALFIGHTER,         // 0
215         CD_MISSILEBOAT,
216         CD_PROTOFIGHTER,
217         CD_FRIEND,
218         CD_FRIGATE,
219         CD_FRIGATE_WING1,
220         CD_FRIGATE_WING2,
221         CD_TRANSPORTSHIP,
222         CD_CARGOSHIP,
223         CD_MINER,
224         CD_KLINE,                       // 10
225         CD_AIMFIGHTER,
226         CD_SLAVETRANSPORT,
227         CD_GOODTRANSPORT,
228         CD_SID,
229         CD_MINEBOSS,
230         CD_BOSS2_WING1,
231         CD_BOSS2_WING2,
232         CD_BOSS2_WING3,
233         CD_BOSS2_WING4,
234         CD_DRONE,                       // 20
235         CD_CLOAKFIGHTER,
236         CD_EVILURSULA,
237         CD_KRASS,
238         CD_EXEC,
239         CD_ASTEROID,
240         CD_ASTEROID2,
241         CD_ESCORT,
242         CD_MOBILE_RAY,
243         CD_REBELCARRIER,
244         CD_PLUTOBOSS,           // 30
245         CD_BARRIER,
246         CD_NEPTUNEBOSS,
247         CD_MOBILESHIELD,
248         CD_PIRATE,
249         CD_FIREFLY,
250         CD_URANUSBOSS,
251         CD_URANUSBOSSWING1,
252         CD_URANUSBOSSWING2,
253         CD_MAX,
254
255         // Some special ones
256         CD_ANY = 100,
257         CD_BOSS,
258         CD_PHOEBE,
259         CD_URSULA
260 };
261
262 // Text shapes
263 enum {
264
265         TS_PRESENTS,
266         TS_AN_SDL_GAME,
267         TS_START_NEW_GAME,
268         TS_LOAD_GAME,
269         TS_CONTINUE_CURRENT_GAME,
270         TS_OPTIONS,
271         TS_CHEAT_OPTIONS,
272         TS_QUIT,
273         TS_SOUND,
274         TS_MUSIC,
275         TS_FULLSCREEN,
276         TS_AUTOPAUSE,
277         TS_BACK_TO_MAIN_MENU,
278         TS_SAVESLOT_0,
279         TS_SAVESLOT_1,
280         TS_SAVESLOT_2,
281         TS_SAVESLOT_3,
282         TS_SAVESLOT_4,
283         TS_SAVESLOT_5,
284         TS_UNLIMITED_SHIELD,
285         TS_UNLIMITED_AMMO,
286         TS_UNLIMITED_CASH,
287         TS_UNLIMITED_TIME,
288         TS_START_GAME,
289         TS_DIFFICULTY
290 };
291
292 // Menu types
293 enum {
294
295         MENU_MAIN,
296         MENU_DIFFICULTY,
297         MENU_LOAD,
298         MENU_OPTIONS,
299         MENU_CHEAT
300 };
301
302 // Shop items
303 enum {
304
305         SHOP_PLASMA_MAX_OUTPUT,
306         SHOP_PLASMA_MAX_DAMAGE,
307         SHOP_PLASMA_MAX_RATE,
308         SHOP_PLASMA_MIN_OUTPUT,
309         SHOP_PLASMA_MIN_DAMAGE,
310         SHOP_PLASMA_MIN_RATE,
311         SHOP_PLASMA_AMMO,
312         SHOP_ROCKET_AMMO,
313         SHOP_PLASMA_MAX_AMMO,
314         SHOP_ROCKET_MAX_AMMO,
315         SHOP_DOUBLE_ROCKETS,
316         SHOP_MICRO_ROCKETS,
317         SHOP_LASER,
318         SHOP_HOMING_MISSILE,
319         SHOP_CHARGER,
320         SHOP_DOUBLE_HOMING_MISSILES,
321         SHOP_MICRO_HOMING_MISSILES,
322         MAX_SHOPITEMS
323 };
324
325 // Font Colors
326 enum {
327
328         FONT_WHITE,
329         FONT_RED,
330         FONT_YELLOW,
331         FONT_GREEN,
332         FONT_CYAN,
333         FONT_OUTLINE // a dark blue color
334 };
335
336 // Sounds
337 enum {
338
339         SFX_EXPLOSION,
340         SFX_HIT,
341         SFX_DEATH,
342         SFX_MISSILE,
343         SFX_PLASMA,
344         SFX_CLOCK,
345         SFX_FLY,
346         SFX_ENERGYRAY,
347         SFX_PICKUP,
348         SFX_SHIELDUP,
349         SFX_CLOAK,
350         SFX_DEBRIS,
351         SFX_DEBRIS2,
352         SFX_LASER,
353         SFX_PLASMA2,
354         SFX_PLASMA3,
355         SFX_MAX
356 };
357
358 // Sections
359 enum {
360
361         SECTION_TITLE,
362         SECTION_INTERMISSION,
363         SECTION_GAME
364 };
365
366 // Faces
367 enum {
368
369         FACE_CHRIS = 90,
370         FACE_SID,
371         FACE_KRASS,
372         FACE_KLINE,
373         FACE_PHOEBE,
374         FACE_URSULA,
375         FACE_CREW
376 };
377
378 // Missions
379 enum {
380
381         MISN_START,
382         MISN_HAIL,
383         MISN_CERADSE,
384         MISN_HINSTAG,
385         MISN_JOLDAR,
386         MISN_MOEBO,
387         MISN_RESCUESLAVES,
388         MISN_NEROD,
389         MISN_ALLEZ,
390         MISN_URUSOR,
391         MISN_DORIM,
392         MISN_ELAMALE,
393         MISN_CLOAKFIGHTER,
394         MISN_ODEON,
395         MISN_FELLON,
396         MISN_SIVEDI,
397         MISN_ALMARTHA,
398         MISN_POSWIC,
399         MISN_ELLESH,
400         MISN_PLUTO,
401         MISN_NEPTUNE,
402         MISN_URANUS,
403         MISN_SATURN,
404         MISN_JUPITER,
405         MISN_MARS,
406         MISN_EARTH,
407         MISN_VENUS,
408         MISN_INTERCEPTION,
409         MISN_MAX
410 };
411
412 // Difficulties
413 enum {
414         DIFFICULTY_EASY = 0,
415         DIFFICULTY_NORMAL,
416         DIFFICULTY_HARD,
417         DIFFICULTY_NIGHTMARE,
418         DIFFICULTY_ORIGINAL,
419         DIFFICULTY_MAX
420 };
421
422 const char * const systemNames[] = {"Spirit", "Eyananth", "Mordor", "Sol"};
423
424 const char * const systemBackground[] = {
425         "gfx/spirit.jpg", "gfx/eyananth.jpg", "gfx/mordor.jpg", "gfx/sol.jpg"
426 };
427
428 const int rate2reload[6] = {15, 15, 13, 11, 9, 7};
429 const int screenWidth = 800;
430 const int screenHeight = 600;
431 const int xViewBorder = 100;
432 const int yViewBorder = 100;
433 const float cameraMaxSpeed = 3.;
434 const int maxHoming = 20;
435 const int maxDoubleHoming = 15;
436 const int maxMicroHoming = 10;
437
438 #endif