1 /*
2  * This file is part of 'Garden of coloured lights'.
3  *
4  * 'Garden of coloured lights' is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * 'Garden of coloured lights' is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 'Garden of coloured lights'.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #define ALLEGRO_STATICLINK
20 
21 /* Transforms foo to "foo" */
22 #define TO_STRING(str) # str
23 /* A step between DIRECTORY and TO_STRING */
24 #define DIRECTORY_LOWLEVEL(root,file) TO_STRING(root/file)
25 /* transforms path,file to "path/file" */
26 #define DIRECTORY(x,y) DIRECTORY_LOWLEVEL(x,y)
27 
28 /* The data directory will be here... */
29 #define DATADIR_SIZE 512
30 extern char data_directory[DATADIR_SIZE];
31 
32 #define NO_KEYS CKEY_END
33 #define X_MIN 5000
34 #define Y_MIN 5000
35 #define X_MAX 635000
36 #define Y_MAX 475000
37 
38 #define GRAIN 1000
39 
40 #define ANGLEFULL_HEX 0x400
41 #define ANGLE_1 1024
42 #define ANGLE_2 512
43 #define ANGLE_3 341
44 // 3 is not exact
45 #define ANGLE_4 256
46 #define ANGLE_5 205
47 // not exact
48 #define ANGLE_6 171
49 // 6 is not exact
50 #define ANGLE_7 146
51 // 7 not exact
52 #define ANGLE_8 128
53 #define ANGLE_9 114
54 // 9 not exact
55 #define ANGLE_10 102
56 #define ANGLE_12 85
57 #define ANGLE_16 64
58 #define ANGLE_8_3 384
59 #define ANGLE_16_3 192
60 #define ANGLE_32 32
61 #define ANGLE_64 16
62 #define ANGLE_128 8
63 #define ANGLE_TO_FIXED 4
64 
65 #ifndef PI
66 #define PI 3.141592
67 #endif
68 
69 #define NO_ENEMIES 50
70 #define NO_EBULLETS 500
71 #define NO_PBULLETS 60
72 #define NO_CLOUDS 500
73 
74 #define SMALL_ROTATIONS 128
75 
76 #define MAX_TARGETS 40
77 
78 #define NO_STARS 40
79 
80 #define RAND_X (grand(X_MAX - (X_MIN * 4)) + X_MIN * 2)
81 #define RAND_Y (grand(Y_MAX - (Y_MIN * 4)) + Y_MIN * 2)
82 
83 #define RAND_X_IN (grand(X_MAX - (X_MIN * 32)) + X_MIN * 16)
84 #define RAND_Y_IN (grand(Y_MAX - (Y_MIN * 32)) + Y_MIN * 16)
85 
86 #define X_MIDDLE 320000
87 #define Y_MIDDLE 240000
88 
89 #define RLE_CIRCLES 30
90 
91 #define NO_PARTS 6
92 
93 #define NO_PETALS 8
94 
95 #define NO_BONES 40
96 // there are only 20 in front, though
97 
98 enum
99 {
100 	CKEY_LEFT,
101 	CKEY_RIGHT,
102 	CKEY_UP,
103 	CKEY_DOWN,
104 	CKEY_FIRE1,
105 	CKEY_FIRE2,
106 	CKEY_FIRE3,
107 	CKEY_SLOW,
108 	CKEY_END
109 };
110 
111 enum
112 {
113 	WPN_MGUN,
114 	WPN_SCATTER,
115 	WPN_LWBEAM,
116 	WPN_CANNON,
117 	WPN_RECT,
118 	WPN_SWBEAM,
119 	WPN_SEEKER,
120 	WPN_EIGHT,
121 	WPN_BLADE,
122 	WPN_TYPES
123 };
124 
125 enum
126 {
127 	PBULLET_NONE,
128 	PBULLET_CANNON,
129 	PBULLET_MGUN,
130 	PBULLET_SEEKER,
131 	PBULLET_SCATTER,
132 	PBULLET_BLADE,
133 	PBULLET_RING,
134 	PBULLET_RECT
135 };
136 
137 enum
138 {
139 	WSTYLE_ORBITAL,
140 	WSTYLE_TRAIL,
141 	WSTYLE_FRONT,
142 	WSTYLE_BLADE
143 };
144 
145 enum
146 {
147 	BLADE_LEFT,
148 	BLADE_RIGHT,
149 	BLADE_CW_SLASH,
150 	BLADE_ACW_SLASH,
151 	BLADE_CW_SWING,
152 	BLADE_ACW_SWING,
153 	BLADE_RETURN_LEFT,
154 	BLADE_RETURN_RIGHT
155 };
156 
157 enum
158 {
159 	SLOW_WEAPON,
160 	FAST_WEAPON
161 };
162 
163 struct playerstruct
164 {
165 
166 	int key[CKEY_END];
167 	int x;
168 	int y;
169 	int lives;
170 	int score;
171 	int respawning;
172 	int in_play;
173 	int grace;
174 	int recycle_speed[3];
175 	int recycle[3];
176 	int wstrength[3];
177 	int rpixels[3];
178 	int wtype[3];
179 	int weapon[3];
180 	int wx[3];
181 	int wy[3];
182 	int wstyle[3];
183 	int wstatus[3];
184 	int wlevel[3];
185 	int wxp[3];
186 	int wpixels[3];
187 	int wpixels2[3];
188 	int wgained[3];
189 	int wfired;
190 	int wframe;
191 	int wframe_speed;
192 	int wframe_max;
193 
194 	int orbitals;
195 	int orbital_angle;
196 	int firing;
197 
198 	int beam[3];
199 	int beam_counter[3];
200 	int beam_fade[3];
201 // int beam_index;
202 	int beam_open[3];
203 	char beam_flicker[3];
204 
205 	int swbeam[3];
206 	int swbeam_counter[3];
207 	int swbeam_x1[3], swbeam_y1[3], swbeam_x2[3], swbeam_y2[3];
208 	int swbeam_level[3];
209 
210 	int wings1;
211 	int wings2;
212 
213 	int swing_x[10];
214 	int swing_y[10];
215 	int swing_x2[10];
216 	int swing_y2[10];
217 	int swing_strength[10];
218 	int swing_pos;
219 // int swing_pos2;
220 	int swing_angle;
221 	int swing_sprite_angle;
222 // int swing_speed_x;
223 	//int swing_speed_y;
224 	int swing_state;
225 	int swing_length;
226 	int swing_hold;
227 	int blade_index;
228 
229 	int ring_angle;
230 	int ring_hold;
231 	int ring_index;
232 	int move_x;
233 	int move_y;
234 
235 
236 };
237 
238 struct eclassstruct
239 {
240 	int max_hp;
241 	int xsize;
242 	int ysize;
243 	int xoffset;
244 	int yoffset;
245 	int ai;
246 	int speed1;
247 	int speed2;
248 	int speed3;
249 	char priority;
250 	int score;
251 	int xp;
252 
253 // int speed;
254 
255 
256 };
257 
258 enum
259 {
260 	CLOUD_NONE,
261 	CLOUD_MGSHOCK,
262 	CLOUD_CIRCLE1,
263 	CLOUD_CIRCLE2,
264 	CLOUD_CIRCLE3,
265 	CLOUD_CIRCLE5,
266 	CLOUD_CIRCLE10,
267 	CLOUD_MSHOCK,
268 	CLOUD_LSHOCK,
269 	CLOUD_HSHOCK,
270 	CLOUD_SLINE,
271 	CLOUD_SPAWNER,
272 	CLOUD_CARRIER1_BANG,
273 	CLOUD_PRING,
274 	CLOUD_RSHOCK1,
275 	CLOUD_RSHOCK2,
276 	CLOUD_RSHOCK3,
277 	CLOUD_RSHOCK4,
278 	CLOUD_RSHOCK5,
279 	CLOUD_TSHOCK,			// tiny - mgshock without parts
280 	CLOUD_PETAL1,
281 	CLOUD_PETAL1_DEBRIS,
282 	CLOUD_PETAL2_DEBRIS,
283 	CLOUD_PETAL3_DEBRIS,
284 	CLOUD_BURN,
285 	CLOUD_UBURN,
286 	CLOUD_ESLINE,
287 	CLOUD_DELAY1,
288 	CLOUD_DELAY2,
289 	CLOUD_DELAY3,
290 	CLOUD_DELAY4,
291 	CLOUD_SCIRCLE
292 };
293 
294 struct cloudstruct
295 {
296 	int type;
297 	int x;
298 	int y;
299 	int x2;
300 	int y2;
301 	int x_speed;
302 	int y_speed;
303 	int timeout;
304 	int colour;
305 	int drag;
306 	int angle;
307 };
308 
309 struct enemystruct
310 {
311 	int type;
312 	int x;
313 	int y;
314 	int x_speed;
315 	int y_speed;
316 	int recycle;
317 	int persist;
318 	int hp;
319 	int pulse1;
320 	int pulse2;
321 
322 	int x_target[MAX_TARGETS];
323 	int y_target[MAX_TARGETS];
324 	int target_time;
325 	int max_target_time;
326 	int target;
327 	int phase;
328 	int phase2;
329 
330 	int angle;
331 	int angle1;
332 	int angle2;
333 
334 	int angle_turning;
335 	int angle_turning_count;
336 	int angle1_turning;
337 	int angle1_turning_count;
338 
339 	int distance;
340 
341 	int whurt[3];
342 
343 	int part[NO_PARTS];
344 	int part_index;
345 	int parent;
346 
347 	int status;
348 
349 	int petal_angle[NO_PETALS];
350 	int petal_angle_speed[NO_PETALS];
351 
352 	int escorting;
353 
354 };
355 
356 enum
357 {
358 	ENEMY_NONE,
359 
360 // L1
361 	ENEMY_SWOOPER1,
362 	ENEMY_DARTER1,
363 	ENEMY_STOPPER1,
364 	ENEMY_DIVER1,
365 	ENEMY_CARRIER1,
366 	ENEMY_CARRIER1_PART,
367 	ENEMY_POD1,
368 	ENEMY_SWOOPER2,
369 	ENEMY_DARTER2,
370 	ENEMY_BOSS1,
371 	ENEMY_BOSS1_PART,
372 
373 // L2
374 	ENEMY_DRIFTER1,
375 	ENEMY_BEAMER,
376 	ENEMY_RISER,
377 	ENEMY_CRUISER1,
378 	ENEMY_CRUISER2,
379 	ENEMY_CRUISER3,
380 	ENEMY_CRUISER4,
381 	ENEMY_CRUISER5,
382 	ENEMY_DRIFTER2,
383 	ENEMY_ESCORT,
384 	ENEMY_SHOOTER,
385 	ENEMY_BOSS2,
386 
387 // L3
388 	ENEMY_SMALL,
389 	ENEMY_LARGER,
390 	ENEMY_SMALL2,
391 	ENEMY_LARGER2,
392 	ENEMY_WINGS,
393 	ENEMY_WINGS2,
394 	ENEMY_MEGA,
395 	ENEMY_BOSS3,
396 
397 // L4
398 	ENEMY_HOOK,
399 	ENEMY_WALKER,
400 	ENEMY_DROPPER,
401 	ENEMY_RING,
402 	ENEMY_HUNTER,
403 	ENEMY_SPINNER,
404 	ENEMY_HOOK2,
405 	ENEMY_BOSS4,
406 
407 	NO_ENEMY_TYPES
408 };
409 
410 
411 enum
412 {
413 	AI_SWOOPER,
414 	AI_DSWOOPER,
415 	AI_DARTER,
416 	AI_STOPPER,
417 	AI_DIVER,
418 	AI_DART_STOPPER,
419 	AI_DRIFTER,
420 	AI_CRUISER,
421 	AI_BOSS,
422 	AI_HOOK,
423 	AI_WALK,
424 
425 	AI_FALL,
426 	AI_DANCER,
427 	AI_GLIDER,
428 	AI_MARCH,
429 	AI_ATTACKER,
430 	AI_BEAMER,
431 	AI_PAUSER,
432 	AI_BOSS1
433 };
434 
435 struct ebulletstruct
436 {
437 	int type;
438 	int x;
439 	int y;
440 	int x_speed;
441 	int y_speed;
442 	int angle;
443 	int angle2;
444 	int timeout;
445 	int time;
446 	int accel;
447 	int sprite_angle;
448 	int colour;
449 	int cord_angle;
450 	int cord_x;
451 	int cord_y;
452 	int cord_x_speed;
453 	int cord_y_speed;
454 	int cord_wait;
455 	int cord_colour;
456 	int status;
457 	char new_ebullet;
458 };
459 
460 enum
461 {
462 	EBULLET_NONE,
463 	EBULLET_SHOT,
464 	EBULLET_SHOT2,
465 	EBULLET_DDART,
466 	EBULLET_WING_DIAMOND,
467 	EBULLET_SEED,
468 	EBULLET_SEED2,
469 	EBULLET_BURST,
470 	EBULLET_STREAM,
471 	EBULLET_SDART,
472 	EBULLET_DOT,
473 	EBULLET_BEAM,
474 	EBULLET_LSEED,
475 	EBULLET_LSEED2,
476 	EBULLET_CURVE,
477 	EBULLET_BEAM2,
478 	EBULLET_SPIN,
479 	EBULLET_TRACKER,
480 	EBULLET_HEAVY
481 };
482 
483 struct pbulletstruct
484 {
485 	int x;
486 	int y;
487 	int type;
488 	int x_speed;
489 	int y_speed;
490 	int angle;
491 	int timeout;
492 	int time;
493 	int persist;
494 	int xsize;
495 	int ysize;
496 	int dam;
497 	int source;
498 	int target;
499 	int status;
500 	int level;
501 };
502 
503 
504 
505 enum
506 {
507 	MULTI_NONE,
508 	MULTI_BASIC
509 };
510 
511 
512 
513 struct arenastruct
514 {
515 	int level;
516 	int difficulty;
517 
518 	int level_finished;
519 	int game_over;
520 	int new_level_sign;
521 //  int player_lives;
522 //  int players;
523 	int change_palette;
524 	int shift_palette;
525 	int target_palette;
526 
527 	int shift_message;
528 
529 	int phase;
530 
531 	int underlay_position;
532 
533 	unsigned char counter;
534 
535 	int block1_x[20];
536 	int block1_y[20];
537 	int block1_y_speed[20];
538 	int block1_size[20];
539 	int block2_x[20];
540 	int block2_y[20];
541 	int block2_y_speed[20];
542 	int block2_size[20];
543 
544 	int flower_turn1;
545 	int flower_turn2;
546 
547 	int beam;
548 	int old_beam;
549 
550 	int part_x1[18][16];		// just needs to be [18] [14] but I added padding after a stupid mistake.
551 	int part_y1[18][16];
552 	int part_x2[18][16];
553 	int part_y2[18][16];
554 	int part_cx[18][16];
555 	int part_cy[18][16];
556 	int part_flow;
557 	int part_rank;
558 	int wave_y;
559 	int part_pulse1;
560 	int part_pulse2;
561 
562 	int cruiser_escorts;
563 
564 	char just_got_highscore;
565 
566 	int stage_score;
567 	int max_stage_score;
568 	int phase_bonus;
569 	int next_phase[8];
570 
571 	int bone_type[2][NO_BONES];
572 	int bone_subtype[2][NO_BONES];
573 	int bone_x[2][NO_BONES];
574 	int bone_y[2][NO_BONES];
575 
576 
577 };
578 
579 struct bossstruct
580 {
581 	int fight;
582 	int index;
583 
584 	int hp;
585 	int max_hp;
586 	int hp_bar_size;
587 
588 	int phase;
589 	int phase_count;
590 	int recycle;
591 	int status;
592 	int t_angle[4];
593 	int t_angle_turning[4];
594 	int t_status;
595 	int t_status_change;
596 	int t_recycle[4];
597 	int t_beam[4];
598 
599 	int out_sides;
600 	int out_sides2;
601 	int out_up;
602 	int out_out_up;
603 
604 	int petal_angle[3];
605 	int petal_out[3];
606 	int petal_speed[3];
607 	int phase2;
608 	int next_small;
609 
610 	int spin_size;
611 	int spin_rad;
612 	int spin_angle;
613 	int spin_angle2;
614 	int spin_size2;
615 	int spin_rad2;
616 
617 	int spin_rad3;
618 	int spin_size3;
619 	int spin_counter;
620 	int sides_recycle;
621 
622 	int outer_fire_type;
623 	int outer_fire_count;
624 
625 
626 };
627 
628 
629 struct optionstruct
630 {
631 	int sound_init;		// if 0, sound isn't initialised at all. Changed in config file only or during install_sound
632 	int sound_mode;		// mono, stereo, reversed, off
633 	int run_vsync;		// on or off
634 	int sound_volume;		// sound fx volume; if 0 sound effects not played
635 //	int ambience_volume;		// if 0 ambience not played
636 	int joystick;
637 	int highscore[3];
638 	int joy_button[4];
639 	int joy_sensitivity;
640 	int init_joystick;
641 	int joy_analogue;
642 	int key_or_joy;
643 	int joy_stick;
644 
645 	int tourist;			// this is a cheat code entered via the initfile. See menu.c and game.c.
646 
647 };
648