3
* @brief handle the guardians
6
* @author Jean-Michel Martin de Santero
7
* @author Bruno Ethvignot
10
* copyright (c) 1998-2007 TLK Games all rights reserved
11
* $Id: guardians.c,v 1.49 2007/08/31 20:46:43 gurumeditation Exp $
13
* Powermanga is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 3 of the License, or
16
* (at your option) any later version.
18
* Powermanga is distributed in the hope that it will be useful, but
19
* WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program; if not, write to the Free Software
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
29
#include "powermanga.h"
32
#include "config_file.h"
33
#include "congratulations.h"
34
#include "curve_phase.h"
36
#include "electrical_shock.h"
39
#include "energy_gauge.h"
40
#include "explosions.h"
42
#include "extra_gun.h"
43
#include "gfx_wrapper.h"
44
#include "grid_phase.h"
45
#include "guardians.h"
48
#include "menu_sections.h"
49
#include "meteors_phase.h"
50
#include "lonely_foes.h"
51
#include "options_panel.h"
52
#include "satellite_protections.h"
53
#include "sdl_mixer.h"
54
#include "spaceship.h"
55
#include "starfield.h"
58
/** Data structure for the sprites images of the guardian */
59
image gardi[GUARDIAN_MAX_OF_ANIMS][ENEMIES_SPECIAL_NUM_OF_IMAGES];
60
const Sint32 clip_gard10 = 16;
61
guardian_struct *guardian;
64
* Initialization guardian that is only run once
65
* @return TRUE if it completed successfully or FALSE otherwise
68
guardians_once_init (void)
74
(guardian_struct *) memory_allocation (sizeof (guardian_struct));
77
fprintf (stderr, "(!)guardians.c/guardians_once_init():"
78
"not enough memory to allocate 'guardian_struct'!\n");
86
* Release memory used by the current guardian
89
guardian_images_free (void)
92
for (i = 0; i < GUARDIAN_MAX_OF_ANIMS; i++)
94
for (j = 0; j < ENEMIES_SPECIAL_NUM_OF_IMAGES; j++)
96
if (gardi[i][j].img != NULL)
98
free_memory (gardi[i][j].img);
99
gardi[i][j].img = NULL;
101
if (gardi[i][j].compress != NULL)
103
free_memory (gardi[i][j].compress);
104
gardi[i][j].compress = NULL;
111
* Release memory used by the guardians
114
guardians_free (void)
116
guardian_images_free ();
117
if (guardian != NULL)
119
free_memory ((char *) guardian);
125
* Initialize a new guardian
126
* @param type Guardian identifier
127
* @param current_image Current image index
128
* @param energy_level Energy level of guardian
129
* @param anim_speed Time delay before next image
130
* @param fire_rate Counter of delay between two shots
131
* @param speed Speed of the sprite
134
guardian_init (Uint32 index, Uint32 type, Sint32 current_image,
135
Uint32 energy_level, Uint32 anim_speed, Uint32 fire_rate,
140
spaceship_struct *ship = spaceship_get ();
141
guard = enemy_get ();
146
guard->spr.pow_of_dest = (Sint16) ((ship->type << 1) + type);
147
guard->spr.energy_level =
148
(ship->type << 2) + (guard->spr.pow_of_dest << 3) / 3 + energy_level;
149
guard->spr.max_energy_level = guard->spr.energy_level;
150
guard->spr.numof_images = 32;
151
guard->spr.current_image = current_image;
152
guard->spr.anim_count = 0;
153
guard->spr.anim_speed = anim_speed;
154
for (i = 0; i < guard->spr.numof_images; i++)
156
guard->spr.img[i] = (image *) & gardi[index][i];
158
guard->fire_rate = fire_rate;
159
guard->fire_rate_count = guard->fire_rate;
160
guard->displacement = DISPLACEMENT_GUARDIAN;
161
guard->spr.speed = speed;
164
guard->visible = TRUE;
165
guardian->enemy[index] = guard;
170
* Add a guardian displacement
171
* @param direction Direction of this displacement
172
* @param delay Time delay of this displacement
173
* @param speed Speed of this displacement
176
guardian_add_move (Uint32 direction, Sint32 delay, Uint32 speed)
178
guardian->move_direction[guardian->move_max] = direction;
179
guardian->move_delay[guardian->move_max] = delay;
180
guardian->move_speed[guardian->move_max++] = speed;
184
* Initialize a direction toward left
187
guardian_set_direction_toward_left (void)
189
guardian_add_move (GUARD_IMMOBILE, 100, 0);
190
guardian_add_move (GUARD_MOVEMENT_TOWARD_LEFT, 400, 1);
194
* Initialize a direction toward right
197
guardian_set_direction_toward_right (void)
199
guardian_add_move (GUARD_IMMOBILE, 100, 0);
200
guardian_add_move (GUARD_MOVEMENT_TOWARD_RIGHT, 400, 1);
204
* Initialize a direction toward top
207
guardian_set_direction_toward_top (void)
209
guardian_add_move (GUARD_IMMOBILE, 100, 0);
210
guardian_add_move (GUARD_MOVEMENT_TOWARD_TOP, 400, 3);
214
* Initialize a direction toward bottom
217
guardian_set_direction_toward_bottom (void)
219
guardian_add_move (GUARD_IMMOBILE, 100, 0);
220
guardian_add_move (GUARD_MOVEMENT_TOWARD_BOTTOM, 400, 3);
224
* Intialize guardian 01
225
* @return TRUE if it completed successfully or FALSE otherwise
228
guardian_01_init (void)
230
enemy *guard = guardian_init (0, THANIKEE, 15, 30, 4, 85, 0.5);
236
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
237
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[17]->h);
238
guardian_set_direction_toward_right ();
239
guardian_set_direction_toward_left ();
244
* Intialize guardian 02
245
* @return TRUE if it completed successfully or FALSE otherwise
248
guardian_02_init (void)
250
enemy *guard = guardian_init (0, BARYBOOG, 15, 50, 4, 50, 1.0);
256
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
257
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
258
guardian_set_direction_toward_left ();
259
guardian_set_direction_toward_right ();
260
guardian_set_direction_toward_bottom ();
261
guardian_set_direction_toward_top ();
262
guardian_set_direction_toward_left ();
263
guardian_set_direction_toward_right ();
264
guardian_set_direction_toward_left ();
265
guardian_set_direction_toward_bottom ();
266
guardian_set_direction_toward_top ();
267
guardian_set_direction_toward_right ();
268
guardian->x_min = offscreen_clipsize - 10;
269
guardian->x_max = offscreen_clipsize + offscreen_width_visible + 40;
270
guardian->y_min = offscreen_clipsize - 15;
271
guardian->y_max = offscreen_clipsize + offscreen_height_visible + 40;
276
* Intialize guardian 03
277
* @return TRUE if it completed successfully or FALSE otherwise
280
guardian_03_init (void)
282
enemy *guard = guardian_init (0, PIKKIOU, 15, 70, 4, 75, 0.5);
288
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
289
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
290
guardian_set_direction_toward_right ();
291
guardian_set_direction_toward_left ();
292
guardian->lonely_foe_delay = 16;
297
* Intialize guardian 04
298
* @return TRUE if it completed successfully or FALSE otherwise
301
guardian_04_init (void)
303
enemy *guard = guardian_init (0, NEGDEIS, 15, 90, 4, 75, 0.5);
309
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
310
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
311
guardian_set_direction_toward_right ();
312
guardian_set_direction_toward_left ();
313
guardian_set_direction_toward_bottom ();
314
guardian_add_move (GUARD_MOVEMENT_TOWARD_TOP, 400, 3);
315
guardian_set_direction_toward_right ();
316
guardian_set_direction_toward_left ();
317
guardian_set_direction_toward_right ();
318
guardian_set_direction_toward_bottom ();
319
guardian_add_move (GUARD_MOVEMENT_TOWARD_TOP, 400, 3);
320
guardian_set_direction_toward_left ();
321
/* clear time delay of launch of SAPOUCH */
322
guardian->lonely_foe_delay = 0;
323
guardian->devilians_counter = 0;
324
guardian->devilians_enable = FALSE;
325
guardian->devilians_delay = 0;
326
/* generate Naggys to amuse player before the appearance of guardian */
327
lonely_foe_add (NAGGYS);
332
* Intialize guardian 05
333
* @return TRUE if it completed successfully or FALSE otherwise
336
guardian_05_init (void)
338
enemy *guard = guardian_init (0, FLASHY, 15, 110, 4, 80, 0.5);
344
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
345
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
346
guardian_set_direction_toward_right ();
347
guardian_set_direction_toward_left ();
348
guardian_set_direction_toward_bottom ();
349
guardian_add_move (GUARD_MOVEMENT_TOWARD_TOP, 400, 3);
350
guardian_set_direction_toward_right ();
351
guardian_set_direction_toward_left ();
352
guardian_set_direction_toward_right ();
353
guardian_set_direction_toward_bottom ();
354
guardian_add_move (GUARD_MOVEMENT_TOWARD_TOP, 400, 3);
355
guardian_set_direction_toward_left ();
356
guardian->soukee_delay = 0;
361
* Intialize guardian 06
362
* @return TRUE if it completed successfully or FALSE otherwise
365
guardian_06_init (void)
367
enemy *guard = guardian_init (0, MEECKY, 15, 130, 4, 80, 0.5);
373
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
374
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
375
guard = guardian_init (1, MEECKY, 15, 0, 4, 80, 0.5);
380
guard->spr.xcoord = guardian->enemy[0]->spr.xcoord;
381
guard->spr.ycoord = guardian->enemy[0]->spr.ycoord + 63;
382
guard->spr.energy_level = (guard->spr.pow_of_dest << 3) / 3;
383
guard->spr.max_energy_level = guard->spr.energy_level;
384
guardian_set_direction_toward_right ();
385
guardian_set_direction_toward_left ();
386
guardian->missile_delay = 0;
387
guardian->x_min = (float) offscreen_clipsize - 16;
389
(float) (offscreen_clipsize + offscreen_width_visible + 48);
391
(float) (offscreen_clipsize + offscreen_height_visible + 40);
392
guardian->y_inc = 1.0;
397
* Intialize guardian 07 (wheel with double reverse rotation)
398
* @return TRUE if it completed successfully or FALSE otherwise
401
guardian_07_init (void)
403
enemy *guard = guardian_init (0, TYPYBOON, 0, 150, 4, 55, 0.5);
409
(float) (offscreen_width_visible - guard->spr.img[0]->w / 2);
410
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[0]->h);
411
guardian_set_direction_toward_right ();
412
guardian_set_direction_toward_left ();
413
guardian->quibouly_delay = 0;
414
if (num_of_enemies < (MAX_OF_ENEMIES - 2))
416
lonely_foe_add (NAGGYS);
422
* Intialize guardian 08
423
* @return TRUE if it completed successfully or FALSE otherwise
426
guardian_08_init (void)
428
enemy *guard = guardian_init (0, MATHYDEE, 0, 170, 4, 65, 0.5);
434
(float) (offscreen_width_visible - guard->spr.img[0]->w / 2);
435
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[0]->h);
436
guardian_set_direction_toward_right ();
437
guardian_set_direction_toward_left ();
438
guardian->tournadee_delay = 0;
439
if (num_of_enemies < (MAX_OF_ENEMIES - 2))
441
lonely_foe_add (NAGGYS);
447
* Intialize guardian 09
448
* @return TRUE if it completed successfully or FALSE otherwise
451
guardian_09_init (void)
453
enemy *guard = guardian_init (0, OVYDOON, 15, 190, 4, 60, 0.5);
459
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
460
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
461
guard = guardian_init (1, OVYDOON, 15, 0, 4, 75, 0.5);
466
guard->spr.energy_level = (guard->spr.pow_of_dest * 3) / 2;
467
guard->spr.max_energy_level = guard->spr.energy_level;
468
guard->spr.xcoord = guardian->enemy[0]->spr.xcoord;
469
guard->spr.ycoord = guardian->enemy[0]->spr.ycoord;
470
guardian_set_direction_toward_right ();
471
guardian_set_direction_toward_left ();
472
guardian->lonely_foe_delay = 0;
473
if (num_of_enemies < (MAX_OF_ENEMIES - 2))
475
lonely_foe_add (NAGGYS);
481
* Intialize guardian 10
482
* @return TRUE if it completed successfully or FALSE otherwise
485
guardian_10_init (void)
487
enemy *guard = guardian_init (0, GATLEENY, 15, 210, 1, 50, 0.5);
493
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
494
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
495
guard = guardian_init (1, GATLEENY, 8, 210, 20, 65, 0.5);
500
guard->spr.xcoord = guardian->enemy[0]->spr.xcoord;
501
guard->spr.ycoord = guardian->enemy[0]->spr.ycoord;
502
guardian->move_current = GUARD_MOVEMENT_TOWARD_BOTTOM;
503
guardian->lonely_foe_delay = 0;
504
if (num_of_enemies < (MAX_OF_ENEMIES - 2))
506
lonely_foe_add (NAGGYS);
513
* Intialize guardian 11
514
* @return TRUE if it completed successfully or FALSE otherwise
517
guardian_11_init (void)
519
enemy *guard = guardian_init (0, NAUTEE, 15, 230, 4, 60, 0.5);
525
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
526
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
527
guardian_set_direction_toward_right ();
528
guardian_set_direction_toward_left ();
529
guardian->missile_delay = 0;
530
guardian->sapouch_delay = 0;
531
if (num_of_enemies < (MAX_OF_ENEMIES - 2))
533
lonely_foe_add (NAGGYS);
539
* Intialize guardian 12
540
* @return TRUE if it completed successfully or FALSE otherwise
543
guardian_12_init (void)
545
enemy *guard = guardian_init (0, KAMEAMEA, 15, 250, 4, 60, 0.5);
551
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
552
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
553
guardian_add_move (GUARD_IMMOBILE, 100, 0);
554
guardian_add_move (GUARD_MOVEMENT_TOWARD_LEFT, 50, 2);
555
guardian_add_move (GUARD_IMMOBILE, 50, 0);
556
guardian_add_move (GUARD_MOVEMENT_TOWARD_RIGHT, 50, 2);
557
guardian_add_move (GUARD_IMMOBILE, 400, 0);
558
guardian_add_move (GUARD_MOVEMENT_TOWARD_BOTTOM, 500, 4);
559
guardian_add_move (GUARD_MOVEMENT_TOWARD_TOP, 500, 4);
560
guardian_add_move (GUARD_IMMOBILE, 50, 0);
561
guardian_add_move (GUARD_MOVEMENT_TOWARD_RIGHT, 50, 2);
562
guardian_add_move (GUARD_IMMOBILE, 50, 0);
563
guardian_add_move (GUARD_MOVEMENT_TOWARD_LEFT, 50, 2);
564
guardian->y_min = offscreen_clipsize;
565
guardian->y_max = offscreen_clipsize + offscreen_height_visible + 30;
570
* Initialize guardian 13
571
* @return TRUE if it completed successfully or FALSE otherwise
574
guardian_13_init (void)
577
guard = guardian_init (0, SUPRALIS, 8, 250, 4, 60, 0.5);
583
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
584
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
585
guardian->y_inc = 2.0;
586
guardian_add_move (GUARD_IMMOBILE, 10, 0);
587
guardian_add_move (GUARD_MOVEMENT_TOWARD_RIGHT, 400, 3);
588
guardian_add_move (GUARD_IMMOBILE, 10, 0);
589
guardian_add_move (GUARD_MOVEMENT_TOWARD_LEFT, 400, 3);
590
guardian->x_min = offscreen_clipsize - 20;
591
guardian->x_max = offscreen_clipsize + offscreen_width_visible + 20;
592
guardian->y_min = offscreen_clipsize;
593
guardian->y_max = offscreen_clipsize + offscreen_height_visible;
598
* Intialize guardian 14, guardian with long trunk
599
* @return TRUE if it completed successfully or FALSE otherwise
602
guardian_14_init (void)
605
guard = guardian_init (0, GHOTTEN, 31, 250, 4, 60, 0.5);
611
(float) (offscreen_width_visible - guard->spr.img[15]->w / 2);
612
guard->spr.ycoord = (float) (offscreen_starty - guard->spr.img[15]->h);
613
guardian_add_move (GUARD_MOVEMENT_TOWARD_RIGHT, 400, 2);
614
guardian_add_move (GUARD_MOVEMENT_TOWARD_LEFT, 400, 2);
615
guardian->x_min = offscreen_clipsize + 10;
616
guardian->x_max = offscreen_clipsize + offscreen_width_visible - 10;
617
guardian->perturbians_delay = 0;
618
guardian->saakamin_delay = 0;
623
* Meteors storm finished: initialize a new guardian
624
* @param guardian_num number of the guardian 1 to 14, 15=congratulations
625
* @return TRUE if it completed successfully or FALSE otherwise
628
guardian_new (Uint32 guardian_num)
631
guardian->number = guardian_num;
632
guardian->is_appearing = TRUE;
633
courbe.activity = FALSE;
634
grid.is_enable = FALSE;
635
meteor_activity = FALSE;
636
energy_gauge_guard_is_update = TRUE;
637
guardian->is_enabled = TRUE;
638
guardian->current_images_set = 0;
639
guardian->move_current = 0;
640
guardian->move_max = 0;
641
guardian->x_min = offscreen_clipsize;
642
guardian->x_max = offscreen_clipsize + offscreen_width_visible;
643
guardian->y_min = offscreen_clipsize;
644
guardian->y_max = offscreen_clipsize + offscreen_height_visible;
646
switch (guardian_num)
649
result = guardian_01_init ();
652
result = guardian_02_init ();
655
result = guardian_03_init ();
658
result = guardian_04_init ();
661
result = guardian_05_init ();
664
result = guardian_06_init ();
667
result = guardian_07_init ();
670
result = guardian_08_init ();
673
result = guardian_09_init ();
676
result = guardian_10_init ();
679
result = guardian_11_init ();
682
result = guardian_12_init ();
685
result = guardian_13_init ();
688
result = guardian_14_init ();
691
congratulations_initialize ();
704
* The guardian appears from the screen top
705
* @param guard Pointer to a enemy structure
708
guardian_appears_from_top (enemy * guard)
710
guard->spr.ycoord += guard->spr.speed;
711
if (guard->spr.ycoord >= offscreen_clipsize)
713
guard->spr.ycoord = (float) offscreen_clipsize;
714
guardian->is_appearing = FALSE;
715
guardian->move_current = 0;
716
guardian->move_time_delay =
717
guardian->move_delay[guardian->move_current];
722
* Add a new shot (type bullet) in guardian phase
723
* @param guard Pointer to the enemy guardian
724
* @param power Power of the destruction
725
* @param speed Speed of the displacement
726
* @return Number of bullets fired
729
guardian_fire (enemy * guard, Sint32 power, float speed)
731
Uint32 cannon_num, numof_bullets;
732
if (player_pause || menu_status != MENU_OFF
733
|| menu_section != NO_SECTION_SELECTED)
737
guard->fire_rate_count--;
738
if (guard->fire_rate_count > 0 || num_of_shots >= (MAX_OF_SHOTS - 1))
742
guard->fire_rate_count = guard->fire_rate;
745
cannon_num < guard->spr.img[guard->spr.current_image]->numof_cannons;
748
shot_guardian_add (guard, cannon_num, power, speed);
752
sound_play (SOUND_GUARDIAN_FIRE_1);
754
return numof_bullets;
759
* @param type Type of foe
760
* @param current_image Current image index
761
* @param img_angle Angle of displacement
763
* @return Pointer to the new enemy element
766
guardian_add_missile (Uint32 type, Uint32 current_image, Sint32 img_angle,
771
spaceship_struct *ship = spaceship_get ();
777
foe->spr.pow_of_dest = (Sint16) ((ship->type << 1) + 5);
778
foe->spr.energy_level = foe->spr.pow_of_dest >> 2;
779
foe->spr.numof_images = 32;
780
foe->spr.current_image = current_image;
781
foe->spr.anim_count = 0;
782
foe->spr.anim_speed = 2;
783
for (i = 0; i < foe->spr.numof_images; i++)
785
foe->spr.img[i] = (image *) & fire[MISSx4][i];
788
foe->fire_rate_count = foe->fire_rate;
789
foe->displacement = DISPLACEMENT_LONELY_FOE;
790
foe->spr.speed = 2.0f;
794
foe->img_angle = img_angle;
795
foe->angle_tir = angle_tir;
796
foe->img_old_angle = foe->img_angle;
797
foe->agilite = 0.028f;
802
* Add one or more missiles homing head
803
* @param guard Pointer the main enemy structure of the guardian
804
* @param inc Counter step
805
* @param max_counter Delay before send the missiles
806
* @param numof_miss Number of missiles to add from 1 to n
807
* @return TRUE if at least one missile was added or FALSE otherwise
810
guardian_add_missiles (enemy * guard, Uint32 inc, Uint32 max_counter,
817
guardian->missile_delay += inc;
818
while (guardian->missile_delay >= max_counter && !spaceship_is_dead)
820
guardian->missile_delay -= max_counter;
821
if (guardian->missile_delay < 0)
823
guardian->missile_delay = 0;
826
for (i = 0; i < numof_miss; i++)
838
foe = guardian_add_missile (SOUKEE, 16, img_angle, angle_tir);
845
guard->spr.img[guard->spr.current_image]->
846
cannons_coords[i][XCOORD] - foe->spr.img[foe->img_angle]->x_gc;
849
guard->spr.img[guard->spr.current_image]->
850
cannons_coords[i][YCOORD] - foe->spr.img[foe->img_angle]->y_gc;
854
sound_play (SOUND_GUARDIAN_FIRE_2);
858
sound_play (SOUND_GUARDIAN_FIRE_3);
866
* Add an enemy who is specific in the guardian
867
* @param type Type of foe
868
* @param pow_of_des Power of destruction
869
* @param energy_level Energy level (<= 0 destroyed foe)
870
* @param current_image Current image index
871
* @param anim_speed Time delay before next image (animation speed)
872
* @param fire_rate Counter of delay between two shots
873
* @param speed Speed of the sprite
874
* @return Pointer to the new enemy element
877
guardian_add_foe (Uint32 type, Uint32 pow_of_des, Uint32 energy_level,
878
Uint32 current_image, Uint32 anim_speed, Uint32 fire_rate,
883
spaceship_struct *ship = spaceship_get ();
889
foe->spr.pow_of_dest = (ship->type << 1) + pow_of_des;
890
foe->spr.energy_level = energy_level;
891
foe->spr.numof_images = 32;
892
foe->spr.current_image = current_image;
893
foe->spr.anim_count = 0;
894
foe->spr.anim_speed = anim_speed;
895
for (i = 0; i < foe->spr.numof_images; i++)
897
foe->spr.img[i] = (image *) & enemi[type][i];
899
foe->fire_rate = fire_rate;
900
foe->fire_rate_count = foe->fire_rate;
901
foe->displacement = DISPLACEMENT_LONELY_FOE;
902
foe->spr.speed = speed;
910
* Add a lonely foe to the enemies list
911
* @param max_counter delay before send a lonely foe
912
* @param foe_num Foe number of -1 if foe is automatically selected
915
guardian_add_lonely_foe (Uint32 max_counter, Sint32 foe_num)
917
guardian->lonely_foe_delay++;
918
if (guardian->lonely_foe_delay < max_counter)
922
lonely_foe_add (foe_num);
924
sound_play (SOUND_GUARDIAN_FIRE_2);
926
guardian->lonely_foe_delay = 0;
930
* Add a Soukee foe to the enemies list
931
* @param guard Pointer the main enemy structure of the guardian
932
* @param inc Counter step
933
* @param max_counter Delay before send a Soukee
936
guardian_add_soukee (enemy * guard, Uint32 inc, Uint32 max_counter)
939
spaceship_struct *ship = spaceship_get ();
940
guardian->soukee_delay += inc;
941
while (guardian->soukee_delay >= max_counter && !spaceship_is_dead)
943
guardian->soukee_delay -= max_counter;
944
if (guardian->soukee_delay < 0)
946
guardian->soukee_delay = 0;
949
guardian_add_foe (SOUKEE, 14, (ship->type << 1) + 14, 8, 2, 70, 2.0f);
955
guard->spr.xcoord + guard->spr.img[guard->spr.current_image]->x_gc -
956
foe->spr.img[0]->w / 2;
958
guard->spr.ycoord + guard->spr.img[guard->spr.current_image]->y_gc -
959
foe->spr.img[0]->h / 2;
961
foe->angle_tir = PI_SUR_2;
962
foe->img_old_angle = foe->img_angle;
963
foe->agilite = 0.018f;
965
sound_play (SOUND_GUARDIAN_FIRE_2);
971
* Add a Shuriky foe to the enemies list
972
* @param guard Pointer the main enemy structure of the guardian
973
* @param max_counter Delay before send a Shuriky
976
guardian_add_shuriky (enemy * guard, Uint32 max_counter)
979
spaceship_struct *ship = spaceship_get ();
980
guardian->shuriky_delay++;
981
if (guardian->shuriky_delay < max_counter)
985
guardian->shuriky_delay = 0;
987
guardian_add_foe (SHURIKY, 10, (ship->type << 1) + 10, 0, 2, 70, 0.3f);
993
guard->spr.xcoord + guard->spr.img[guard->spr.current_image]->x_gc -
994
foe->spr.img[0]->w / 2;
996
guard->spr.ycoord + guard->spr.img[guard->spr.current_image]->y_gc -
997
foe->spr.img[0]->h / 2;
999
sound_play (SOUND_GUARDIAN_FIRE_3);
1004
* Add a Devilians foe to the enemies list
1005
* @param guard Pointer the main enemy structure of the guardian
1006
* @param max_counter Delay before send a Quibouly
1007
* @param max_foes Number of foes launched before disable
1010
guardian_add_devilians (enemy * guard, Uint32 max_counter, Uint32 max_foes)
1012
if (!guardian->devilians_enable)
1016
guardian->devilians_delay++;
1017
if (guardian->devilians_delay < max_counter)
1021
lonely_foe_add (DEVILIANS);
1022
guardian->devilians_delay = 0;
1023
guardian->devilians_counter++;
1024
if (guardian->devilians_counter >= max_foes)
1026
guardian->devilians_counter = 0;
1027
guardian->devilians_enable = FALSE;
1032
* Add a Quibouly foe to the enemies list
1033
* @param guard Pointer the main enemy structure of the guardian
1034
* @param max_counter Delay before send a Quibouly
1037
guardian_add_quibouly (enemy * guard, Uint32 max_counter)
1040
spaceship_struct *ship = spaceship_get ();
1041
guardian->quibouly_delay++;
1042
if (guardian->quibouly_delay < max_counter)
1046
guardian->quibouly_delay = 0;
1048
guardian_add_foe (QUIBOULY, 10, QUIBOULY + (ship->type << 1) + 10, 0, 2,
1055
sound_play (SOUND_GUARDIAN_FIRE_2);
1058
guard->spr.xcoord + guard->spr.img[guard->spr.current_image]->x_gc -
1059
foe->spr.img[0]->w / 2;
1060
foe->spr.ycoord = guard->spr.ycoord + 96;
1064
* Add a Shuriky foe to the enemies list
1065
* @param guard Pointer the main enemy structure of the guardian
1066
* @param max_counter Delay before send a Shuriky
1069
guardian_add_tournadee (enemy * guard, Uint32 max_counter)
1072
spaceship_struct *ship = spaceship_get ();
1073
guardian->tournadee_delay++;
1074
if (guardian->tournadee_delay < max_counter)
1078
guardian->tournadee_delay = 0;
1080
guardian_add_foe (TOURNADEE, 10, TOURNADEE + (ship->type << 1) + 10, 0, 3,
1086
if (guardian->is_tournadee_left_pos)
1088
guardian->is_tournadee_left_pos = FALSE;
1089
foe->spr.xcoord = offscreen_startx - 2;
1093
guardian->is_tournadee_left_pos = TRUE;
1095
(float) (offscreen_startx + offscreen_width_visible -
1096
foe->spr.img[0]->w + 2);
1098
foe->spr.ycoord = offscreen_starty + 32 + offscreen_height_visible;
1100
sound_play (SOUND_GUARDIAN_FIRE_2);
1105
* Add a Sapouch foe to the enemies list
1106
* @param guard Pointer the main enemy structure of the guardian
1107
* @param numof Number of Sapouch launched 1 or 2
1108
* @param max_counter Delay before send a Sapouch
1109
* @param is_left TRUE if first Sapouch will be launched on left side
1112
guardian_add_sapouch (enemy * guard, Uint32 numof, Uint32 max_counter,
1115
float ycoord, speed;
1118
spaceship_struct *ship = spaceship_get ();
1119
guardian->sapouch_delay++;
1120
if (guardian->sapouch_delay < max_counter)
1124
guardian->sapouch_delay = 0;
1125
ycoord = offscreen_starty - 64;
1126
speed = 2.5f + (float) (((long) rand () % (100))) / 100.0f;
1127
for (i = 0; i < numof; i++)
1130
guardian_add_foe (SAPOUCH, 10, SAPOUCH + (ship->type << 1) + 10, 0, 4,
1131
50 + (Sint32) ((long) rand () % (50)), speed);
1138
foe->spr.xcoord = offscreen_startx;
1143
offscreen_startx + offscreen_width_visible - foe->spr.img[0]->w;
1145
foe->spr.ycoord = ycoord - foe->spr.img[0]->h;
1146
foe->retournement = FALSE;
1147
foe->change_dir = FALSE;
1149
sound_play (SOUND_GUARDIAN_FIRE_2);
1151
is_left = is_left ? FALSE : TRUE;
1156
* Add a Perturbians foe to the enemies list
1157
* @param guard Pointer the main enemy structure of the guardian
1158
* @param numof Number of Perturbians launched 1 or 2
1159
* @param max_counter Delay before send a Perturbians
1160
* @param is_left TRUE if first Perturbians will be launched on left side
1163
guardian_add_perturbians (enemy * guard, Uint32 numof, Uint32 max_counter,
1166
Uint32 i, fire_rate, power;
1168
spaceship_struct *ship = spaceship_get ();
1169
guardian->perturbians_delay++;
1170
if (guardian->perturbians_delay < max_counter)
1174
guardian->perturbians_delay = 0;
1175
fire_rate = 200 + (Sint32) ((long) rand () % (50));
1176
power = (Sint32) ((ship->type << 1) + PERTURBIANS - 40);
1177
for (i = 0; i < numof; i++)
1180
guardian_add_foe (PERTURBIANS,
1181
(Sint32) ((ship->type << 1) + PERTURBIANS - 40),
1182
(Sint32) ((ship->type << 2) + (power << 3) / 3 +
1183
10), 0, 6, fire_rate, 0.2f);
1190
foe->spr.xcoord = offscreen_startx;
1195
offscreen_startx + offscreen_width_visible - foe->spr.img[0]->w;
1197
foe->spr.ycoord = (float) (offscreen_starty - 64 - foe->spr.img[0]->h);
1199
sound_play (SOUND_GUARDIAN_FIRE_2);
1201
is_left = is_left ? FALSE : TRUE;
1206
* Add a Perturbians foe to the enemies list
1207
* @param guard Pointer the main enemy structure of the guardian
1208
* @param max_counter Delay before send a Perturbians
1211
guardian_add_saakamin (enemy * guard, Uint32 max_counter, Uint32 numof)
1214
spaceship_struct *ship = spaceship_get ();
1215
guardian->saakamin_delay++;
1216
if (guardian->saakamin_delay < max_counter)
1220
guardian->saakamin_delay = 0;
1224
guardian_add_foe (SAAKAMIN,
1225
14, (ship->type << 1) + 14, 8, 2, 70, 2.0f);
1230
foe->num_courbe = (Sint32) (((long) rand () % (121)));
1231
foe->pos_vaiss[POS_CURVE] = 0;
1233
(guard->spr.xcoord +
1234
guard->spr.img[guard->spr.current_image]->
1235
cannons_coords[0][XCOORD]) - foe->spr.img[0]->w / 2;
1237
(guard->spr.ycoord +
1238
guard->spr.img[guard->spr.current_image]->
1239
cannons_coords[0][YCOORD]) - foe->spr.img[0]->h / 2;
1244
* Guadian go to next trajectory
1247
guardian_next_trajectory (void)
1249
/* go to next trajectory */
1250
guardian->move_current++;
1251
/* maximum of displacements reached? */
1252
if (guardian->move_current >= guardian->move_max)
1254
guardian->move_current = 0;
1256
guardian->has_changed_direction = TRUE;
1257
guardian->move_time_delay = guardian->move_delay[guardian->move_current];
1261
* Guadian get next trajectory identifier
1264
guardian_get_next_trajectory (void)
1266
Uint32 move = guardian->move_current + 1;
1267
if (move >= guardian->move_max)
1271
return guardian->move_direction[move];
1275
* Flip to next image. The animation is played once
1276
* @param guard Pointer the main enemy structure of the guardian
1277
* @param delay Time delay before next image
1278
* @param reach Image number to reach
1281
guardian_flip_image (enemy * guard, Sint32 delay, Sint32 reach)
1283
guardian->anim_delay_count++;
1284
if (guardian->anim_delay_count < delay)
1288
guardian->anim_delay_count = 0;
1289
if (guard->spr.current_image == reach)
1293
if (guard->spr.current_image < reach)
1295
guard->spr.current_image++;
1299
guard->spr.current_image--;
1304
* Flip to next image. The animation is played in loop-mode
1305
* @param guard Pointer the main enemy structure of the guardian
1306
* @param delay Time delay before next image
1307
* @param inc Step value 1 or -1
1308
* @param limit Image number of the last image
1309
* @param first Image number of the first image
1312
guardian_loop_flip (enemy * guard, Sint32 delay, Sint32 inc, Sint32 limit,
1315
guardian->anim_delay_count++;
1316
if (guardian->anim_delay_count < delay)
1320
guardian->anim_delay_count = 0;
1321
guard->spr.current_image += inc;
1322
if ((inc > 0 && guard->spr.current_image > limit)
1323
|| (inc < 0 && guard->spr.current_image < limit))
1325
guard->spr.current_image = first;
1330
* Change images set of a guadian
1331
* @param guard Pointer the main enemy structure of the guardian
1332
* @param images_num Images set number
1335
guardian_change_images_set (enemy * guard, Uint32 images_num)
1338
for (i = 0; i < guard->spr.numof_images; i++)
1340
guard->spr.img[i] = (image *) & gardi[images_num][i];
1342
guardian->current_images_set = images_num;
1346
* Change images set of a guadian and the current image
1347
* @param guard Pointer the main enemy structure of the guardian
1348
* @param images_num Images set number
1349
* @param current Current image number
1352
guardian_change_images (enemy * guard, Uint32 images_num, Uint32 current)
1354
guard->spr.current_image = current;
1355
guardian_change_images_set (guard, images_num);
1359
* Move the guardian follow a straightline
1360
* @param guard Pointer to a enemy structure
1363
guardian_line_moving (enemy * guard)
1365
Uint32 move, speed, dir;
1366
if (player_pause || menu_status != MENU_OFF
1367
|| menu_section != NO_SECTION_SELECTED)
1371
move = guardian->move_current;
1372
speed = guardian->move_speed[move];
1373
dir = guardian->move_direction[move];
1374
/* update coordinates */
1375
guard->spr.xcoord += depix[speed][dir];
1376
guard->spr.ycoord += depiy[speed][dir];
1378
if (guard->spr.xcoord < guardian->x_min - EPS)
1380
guard->spr.xcoord = guardian->x_min;
1381
guardian->move_time_delay = 0;
1382
guard->spr.ycoord += guardian->y_inc;
1384
if (guard->spr.xcoord + guard->spr.img[guard->spr.current_image]->w >
1385
guardian->x_max + EPS)
1388
guardian->x_max - guard->spr.img[guard->spr.current_image]->w;
1389
guardian->move_time_delay = 0;
1390
guard->spr.ycoord += guardian->y_inc;
1392
if (guard->spr.ycoord < guardian->y_min - EPS)
1394
guard->spr.ycoord = guardian->y_min;
1395
guardian->move_time_delay = 0;
1397
if (guard->spr.ycoord + guard->spr.img[guard->spr.current_image]->h >
1398
guardian->y_max + EPS)
1401
guardian->y_max - guard->spr.img[guard->spr.current_image]->h;
1402
guardian->move_time_delay = 0;
1407
* Move the guardian follow sinus curve
1410
guardian_move_sinus (enemy * guard)
1412
if (player_pause || menu_status != MENU_OFF
1413
|| menu_section != NO_SECTION_SELECTED)
1418
/* move horizontally the guardian follow a straightline */
1419
guard->spr.xcoord +=
1420
depix[guardian->move_speed[guardian->move_current]][guardian->
1424
guard->spr.ycoord += precalc_sin[guardian->move_time_delay & 0x001f] * 4;
1425
if (guard->spr.ycoord > (float) (offscreen_clipsize + 40 + EPS))
1427
guard->spr.ycoord = (float) (offscreen_clipsize + 40);
1429
if (guard->spr.xcoord < (float) offscreen_clipsize - EPS)
1431
guard->spr.xcoord = (float) offscreen_clipsize;
1432
guardian->move_time_delay = 0;
1434
if ((guard->spr.xcoord + guard->spr.img[guard->spr.current_image]->w) >
1435
(float) (offscreen_clipsize + offscreen_width_visible + EPS))
1438
(float) (offscreen_clipsize + offscreen_width_visible) -
1439
guard->spr.img[guard->spr.current_image]->w;
1440
guardian->move_time_delay = 0;
1445
* Handle the guardian 1
1446
* @param guard Pointer to the enemy structure of the guardian
1449
guardian_01 (enemy * guard)
1451
if (guardian->is_appearing)
1453
guardian_appears_from_top (guard);
1457
if (--guardian->move_time_delay > 0)
1459
if (guardian->move_direction[guardian->move_current] <
1462
guardian_line_moving (guard);
1464
switch (guardian->move_direction[guardian->move_current])
1466
case GUARD_MOVEMENT_TOWARD_RIGHT:
1467
guardian_flip_image (guard, 3, 31);
1470
case GUARD_MOVEMENT_TOWARD_LEFT:
1471
guardian_flip_image (guard, 3, 0);
1474
case GUARD_IMMOBILE:
1475
guardian_flip_image (guard, 3, 15);
1481
guardian_next_trajectory ();
1484
guardian_fire (guard, 8, 2.0);
1488
* Handle the guardian 2
1489
* @param guard Pointer to the enemy structure of the guardian
1492
guardian_02 (enemy * guard)
1494
if (guardian->is_appearing)
1496
guard->spr.ycoord += guard->spr.speed;
1497
if (guard->spr.ycoord >= (float) (offscreen_clipsize - 15))
1499
guard->spr.ycoord = (float) (offscreen_clipsize - 15);
1500
guardian->is_appearing = FALSE;
1501
guardian->move_current = 0;
1502
guardian->move_time_delay =
1503
guardian->move_delay[guardian->move_current];
1508
/* next trajectory? */
1509
if (--guardian->move_time_delay > 0)
1511
if (guardian->move_direction[guardian->move_current] <
1512
GUARD_IMMOBILE && !player_pause && menu_status == MENU_OFF
1513
&& menu_section == NO_SECTION_SELECTED)
1515
guardian_line_moving (guard);
1517
switch (guardian->move_direction[guardian->move_current])
1519
case GUARD_MOVEMENT_TOWARD_RIGHT:
1520
if (guardian->has_changed_direction)
1522
guardian_change_images (guard, 0, 15);
1523
guardian->has_changed_direction = FALSE;
1525
guardian_flip_image (guard, 4, 31);
1528
case GUARD_MOVEMENT_TOWARD_LEFT:
1529
if (guardian->has_changed_direction)
1531
guardian_change_images (guard, 0, 15);
1532
guardian->has_changed_direction = FALSE;
1534
/* flip to the previous image */
1535
guardian_flip_image (guard, 4, 0);
1538
case GUARD_MOVEMENT_TOWARD_TOP:
1539
case GUARD_MOVEMENT_TOWARD_BOTTOM:
1540
if (guardian->has_changed_direction)
1542
guardian_change_images (guard, 1, 0);
1543
guardian->has_changed_direction = FALSE;
1545
guardian_flip_image (guard, 2, 31);
1548
case GUARD_IMMOBILE:
1549
if (guardian->has_changed_direction)
1551
guardian->has_changed_direction = FALSE;
1552
guardian_change_images_set (guard, 0);
1553
if (guardian->is_vertical_trajectory)
1555
guard->spr.current_image = 15;
1556
guardian->is_vertical_trajectory = FALSE;
1559
/* set image's guardian of central position */
1560
guardian_flip_image (guard, 3, 15);
1566
if (guardian->move_direction[guardian->move_current] ==
1567
GUARD_MOVEMENT_TOWARD_BOTTOM
1568
|| guardian->move_direction[guardian->move_current] ==
1569
GUARD_MOVEMENT_TOWARD_TOP)
1571
guardian->is_vertical_trajectory = TRUE;
1573
guardian_next_trajectory ();
1576
if (guardian_fire (guard, 10, 3.0) > 0)
1578
guardian_add_shuriky (guard, 4);
1583
* Handle the guardian 3
1584
* @param guard Pointer to the enemy structure of the guardian
1587
guardian_03 (enemy * guard)
1589
if (guardian->is_appearing)
1591
guardian_appears_from_top (guard);
1595
if (--guardian->move_time_delay > 0)
1597
if (guardian->move_direction[guardian->move_current] <
1600
guardian_line_moving (guard);
1602
switch (guardian->move_direction[guardian->move_current])
1604
case GUARD_MOVEMENT_TOWARD_RIGHT:
1605
case GUARD_MOVEMENT_TOWARD_LEFT:
1606
case GUARD_IMMOBILE:
1607
guardian_loop_flip (guard, 3, 1, 31, 0);
1613
guardian_next_trajectory ();
1616
if (guardian_fire (guard, 8, 2.0) > 0)
1618
guardian_add_lonely_foe (16, NAGGYS);
1623
* Handle the guardian 4
1624
* @param guard Pointer to the enemy structure of the guardian
1627
guardian_04 (enemy * guard)
1629
if (guardian->is_appearing)
1631
guardian_appears_from_top (guard);
1635
guardian_add_devilians (guard, 141, 3);
1636
if (--guardian->move_time_delay > 0)
1638
if (guardian->move_direction[guardian->move_current] ==
1639
GUARD_MOVEMENT_TOWARD_RIGHT
1640
|| guardian->move_direction[guardian->move_current] ==
1641
GUARD_MOVEMENT_TOWARD_LEFT)
1643
guardian_line_moving (guard);
1645
switch (guardian->move_direction[guardian->move_current])
1647
case GUARD_MOVEMENT_TOWARD_RIGHT:
1648
if (guardian->has_changed_direction)
1650
guardian->has_changed_direction = FALSE;
1651
guardian_change_images (guard, 0, 15);
1653
guardian_flip_image (guard, 4, 31);
1656
case GUARD_MOVEMENT_TOWARD_LEFT:
1657
if (guardian->has_changed_direction)
1659
guardian->has_changed_direction = FALSE;
1660
guardian_change_images (guard, 0, 15);
1662
guardian_flip_image (guard, 4, 0);
1665
case GUARD_MOVEMENT_TOWARD_BOTTOM:
1666
if (guardian->has_changed_direction)
1668
guardian->has_changed_direction = FALSE;
1669
guardian_change_images (guard, 1, 0);
1670
guardian->devilians_enable = TRUE;
1671
guardian->devilians_counter = 0;
1673
guardian_flip_image (guard, 2, 31);
1676
case GUARD_MOVEMENT_TOWARD_TOP:
1677
guardian_flip_image (guard, 2, 0);
1680
case GUARD_IMMOBILE:
1681
if (guardian->has_changed_direction)
1683
guardian->has_changed_direction = FALSE;
1684
guardian_change_images_set (guard, 0);
1685
if (guardian->is_vertical_trajectory)
1687
guard->spr.current_image = 15;
1688
guardian->is_vertical_trajectory = FALSE;
1691
guardian_flip_image (guard, 3, 15);
1697
if (guardian->move_direction[guardian->move_current] ==
1698
GUARD_MOVEMENT_TOWARD_BOTTOM
1699
|| guardian->move_direction[guardian->move_current] ==
1700
GUARD_MOVEMENT_TOWARD_TOP)
1702
guardian->is_vertical_trajectory = TRUE;
1704
guardian_next_trajectory ();
1707
if (guardian_fire (guard, 8, 2.0) > 0)
1709
guardian_add_lonely_foe (8, SAPOUCH);
1714
* Handle the guardian 5
1715
* @param guard Pointer to the enemy structure of the guardian
1718
guardian_05 (enemy * guard)
1720
Uint32 numof_bullets;
1721
if (guardian->is_appearing)
1723
guardian_appears_from_top (guard);
1727
if (!player_pause && menu_status == MENU_OFF
1728
&& menu_section == NO_SECTION_SELECTED)
1730
if (--guardian->move_time_delay > 0)
1732
if (guardian->move_direction[guardian->move_current] ==
1733
GUARD_MOVEMENT_TOWARD_RIGHT
1734
|| guardian->move_direction[guardian->move_current] ==
1735
GUARD_MOVEMENT_TOWARD_LEFT)
1737
guardian_move_sinus (guard);
1739
switch (guardian->move_direction[guardian->move_current])
1741
case GUARD_MOVEMENT_TOWARD_RIGHT:
1742
if (guardian->has_changed_direction)
1744
guardian->has_changed_direction = FALSE;
1745
guardian_change_images (guard, 0, 15);
1747
guardian_flip_image (guard, 4, 31);
1750
case GUARD_MOVEMENT_TOWARD_LEFT:
1751
if (guardian->has_changed_direction)
1753
guardian->has_changed_direction = FALSE;
1754
guardian_change_images (guard, 0, 15);
1756
guardian_flip_image (guard, 4, 0);
1759
case GUARD_MOVEMENT_TOWARD_BOTTOM:
1760
if (guardian->has_changed_direction)
1762
guardian->has_changed_direction = FALSE;
1763
guardian_change_images (guard, 1, 0);
1765
guardian_loop_flip (guard, 2, 1, 31, 0);
1768
case GUARD_IMMOBILE:
1769
if (guardian->has_changed_direction)
1771
guardian->has_changed_direction = FALSE;
1772
guardian_change_images_set (guard, 0);
1773
if (guardian->is_vertical_trajectory)
1775
guard->spr.current_image = 15;
1776
guardian->is_vertical_trajectory = FALSE;
1779
guardian_flip_image (guard, 3, 15);
1785
if (guardian->move_direction[guardian->move_current] ==
1786
GUARD_MOVEMENT_TOWARD_BOTTOM
1787
|| guardian->move_direction[guardian->move_current] ==
1788
GUARD_MOVEMENT_TOWARD_TOP)
1790
guardian->is_vertical_trajectory = TRUE;
1792
guardian_next_trajectory ();
1797
numof_bullets = guardian_fire (guard, 8, 2.0);
1798
guardian_add_soukee (guard, numof_bullets, 16);
1802
* Handle the guardian 6
1803
* Guardian with a articulated arm (2 sprites used)
1804
* @param guard Pointer to the enemy structure of the guardian
1807
guardian_06 (enemy * guard)
1809
Uint32 numof_bullets;
1810
if (guardian->is_appearing)
1812
if (guard == guardian->enemy[0])
1814
guardian_appears_from_top (guard);
1815
guardian->enemy[1]->spr.xcoord = guard->spr.xcoord;
1816
guardian->enemy[1]->spr.ycoord = guard->spr.ycoord + 63;
1821
if (!player_pause && menu_status == MENU_OFF
1822
&& guard == guardian->enemy[0]
1823
&& menu_section == NO_SECTION_SELECTED)
1825
guardian->move_time_delay--;
1826
if (guardian->move_time_delay > 0)
1828
if (guardian->move_direction[guardian->move_current] <
1831
guardian_line_moving (guard);
1833
switch (guardian->move_direction[guardian->move_current])
1835
case GUARD_MOVEMENT_TOWARD_RIGHT:
1836
if (guardian->has_changed_direction)
1838
guardian->has_changed_direction = FALSE;
1839
guardian_change_images (guard, 0, 15);
1841
guardian_flip_image (guard, 4, 31);
1844
case GUARD_MOVEMENT_TOWARD_LEFT:
1845
if (guardian->has_changed_direction)
1847
guardian->has_changed_direction = FALSE;
1848
guardian_change_images (guard, 0, 15);
1850
guardian_flip_image (guard, 4, 0);
1853
case GUARD_IMMOBILE:
1854
if (guardian->has_changed_direction)
1856
guardian->has_changed_direction = FALSE;
1857
guardian_change_images_set (guard, 0);
1858
if (guardian->is_vertical_trajectory)
1860
guard->spr.current_image = 15;
1861
guardian->is_vertical_trajectory = FALSE;
1864
guardian_flip_image (guard, 3, 15);
1870
guardian_next_trajectory ();
1873
/* articulated arm enable? */
1874
if (guard == guardian->enemy[1]
1875
&& guard->displacement == DISPLACEMENT_GUARDIAN
1876
&& guard->is_enabled)
1878
guard->spr.xcoord = guardian->enemy[0]->spr.xcoord;
1879
guard->spr.ycoord = guardian->enemy[0]->spr.ycoord + 63;
1880
guard->spr.anim_count++;
1881
if (!(guard->spr.anim_count &= (guard->spr.anim_speed - 1)))
1883
guard->spr.current_image++;
1884
guard->spr.current_image &= 31;
1888
numof_bullets = guardian_fire (guard, 8, 2.0);
1889
guardian_add_missiles (guard, numof_bullets, 8, 2);
1893
* Handle the guardian 7
1894
* wheel with double reverse rotation
1895
* @param guard Pointer to the enemy structure of the guardian
1898
guardian_07 (enemy * guard)
1900
if (guardian->is_appearing)
1902
guardian_appears_from_top (guard);
1906
if (--guardian->move_time_delay > 0)
1908
if (guardian->move_direction[guardian->move_current] <
1911
guardian_line_moving (guard);
1913
switch (guardian->move_direction[guardian->move_current])
1915
case GUARD_MOVEMENT_TOWARD_RIGHT:
1916
case GUARD_MOVEMENT_TOWARD_LEFT:
1917
case GUARD_IMMOBILE:
1918
guardian_loop_flip (guard, 3, 1, 31, 0);
1924
guardian_next_trajectory ();
1927
if (guardian_fire (guard, 8, 2.0) > 0)
1929
guardian_add_lonely_foe (50, -1);
1930
guardian_add_quibouly (guard, 6);
1935
* Handle the guardian 8
1936
* @param guard Pointer to the enemy structure of the guardian
1939
guardian_08 (enemy * guard)
1941
if (guardian->is_appearing)
1943
guardian_appears_from_top (guard);
1947
if (--guardian->move_time_delay > 0)
1949
if (guardian->move_direction[guardian->move_current] <
1952
guardian_line_moving (guard);
1954
switch (guardian->move_direction[guardian->move_current])
1956
case GUARD_MOVEMENT_TOWARD_RIGHT:
1957
case GUARD_MOVEMENT_TOWARD_LEFT:
1958
case GUARD_IMMOBILE:
1959
guardian_loop_flip (guard, 3, 1, 31, 0);
1965
guardian_next_trajectory ();
1968
if (guardian_fire (guard, 8, 2.0) > 0)
1970
guardian_add_lonely_foe (40, -1);
1971
guardian_add_tournadee (guard, 12);
1976
* Handle the guardian 9
1977
* Aircraft with rotary nose (2 sprites)
1978
* @param guard Pointer to the enemy structure of the guardian
1981
guardian_09 (enemy * guard)
1983
if (guardian->is_appearing)
1985
if (guard == guardian->enemy[0])
1987
guardian_appears_from_top (guard);
1988
guardian->enemy[1]->spr.xcoord = guard->spr.xcoord;
1989
guardian->enemy[1]->spr.ycoord = guard->spr.ycoord;
1994
if (!player_pause && menu_status == MENU_OFF
1995
&& guard == guardian->enemy[0]
1996
&& menu_section == NO_SECTION_SELECTED)
1998
if (--guardian->move_time_delay > 0)
2000
if (guardian->move_direction[guardian->move_current] <
2003
guardian_line_moving (guard);
2005
switch (guardian->move_direction[guardian->move_current])
2007
case GUARD_MOVEMENT_TOWARD_RIGHT:
2008
if (guardian->has_changed_direction)
2010
guardian->has_changed_direction = FALSE;
2011
guardian_change_images (guard, 0, 15);
2013
guardian_flip_image (guard, 4, 31);
2016
case GUARD_MOVEMENT_TOWARD_LEFT:
2017
if (guardian->has_changed_direction)
2019
guardian->has_changed_direction = FALSE;
2020
guardian_change_images (guard, 0, 15);
2022
guardian_flip_image (guard, 4, 0);
2025
case GUARD_IMMOBILE:
2026
if (guardian->has_changed_direction)
2028
guardian->has_changed_direction = FALSE;
2029
guardian_change_images_set (guard, 0);
2030
/* check if one were previously on a vertical trajectory
2031
* so set the fair image */
2032
if (guardian->is_vertical_trajectory)
2034
guard->spr.current_image = 15;
2035
guardian->is_vertical_trajectory = FALSE;
2038
guardian_flip_image (guard, 3, 15);
2044
guardian_next_trajectory ();
2048
if (guard == guardian->enemy[1]
2049
&& guard->displacement == DISPLACEMENT_GUARDIAN
2050
&& guard->is_enabled)
2052
guard->spr.xcoord = guardian->enemy[0]->spr.xcoord;
2053
guard->spr.ycoord = guardian->enemy[0]->spr.ycoord;
2054
guard->spr.anim_count++;
2055
if (!(guard->spr.anim_count &= (guard->spr.anim_speed - 1)))
2057
guard->spr.current_image++;
2059
guard->spr.current_image &= 31;
2062
if (guardian_fire (guard, 8, 2.0) > 0)
2064
guardian_add_lonely_foe (40, -1);
2069
* Handle the guardian 10
2070
* Disk with a big adjustable canon
2071
* @param guard Pointer to the enemy structure of the guardian
2074
guardian_10 (enemy * guard)
2078
Sint32 anim_count, length1, length2;
2079
enemy *guard2 = guardian->enemy[1];
2080
spaceship_struct *ship = spaceship_get ();
2081
if (guardian->is_appearing)
2083
if (guard == guardian->enemy[0])
2085
guardian_appears_from_top (guard);
2086
guardian->enemy[1]->spr.xcoord = guard->spr.xcoord;
2087
guardian->enemy[1]->spr.ycoord = guard->spr.ycoord;
2092
if (!player_pause && menu_status == MENU_OFF
2093
&& guard == guardian->enemy[0]
2094
&& menu_section == NO_SECTION_SELECTED)
2096
if (guardian->move_current == GUARD_MOVEMENT_TOWARD_RIGHT)
2098
guard->spr.xcoord++;
2100
if (guardian->move_current == GUARD_MOVEMENT_TOWARD_BOTTOM)
2102
guard->spr.ycoord++;
2104
if (guardian->move_current == GUARD_MOVEMENT_TOWARD_LEFT)
2106
guard->spr.xcoord--;
2108
if (guardian->move_current == GUARD_MOVEMENT_TOWARD_TOP)
2110
guard->spr.ycoord--;
2112
if (guard->spr.xcoord < (float) offscreen_clipsize - clip_gard10)
2114
guard->spr.xcoord = (float) (offscreen_clipsize - clip_gard10);
2115
guardian->move_current = GUARD_MOVEMENT_TOWARD_TOP;
2117
if ((guard->spr.xcoord +
2118
guard->spr.img[guard->spr.current_image]->w) >
2119
(float) (offscreen_clipsize + offscreen_width_visible +
2123
(float) (offscreen_clipsize + offscreen_width_visible +
2125
guard->spr.img[guard->spr.current_image]->w;
2126
guardian->move_current = GUARD_MOVEMENT_TOWARD_BOTTOM;
2128
if (guard->spr.ycoord < (float) offscreen_clipsize - clip_gard10)
2130
guard->spr.ycoord = (float) (offscreen_clipsize - clip_gard10);
2131
guardian->move_current = GUARD_MOVEMENT_TOWARD_RIGHT;
2133
if ((guard->spr.ycoord +
2134
guard->spr.img[guard->spr.current_image]->h) >
2135
(float) (offscreen_clipsize + offscreen_height_visible +
2139
(float) (offscreen_clipsize + offscreen_height_visible +
2141
guard->spr.img[guard->spr.current_image]->h;
2142
guardian->move_current = GUARD_MOVEMENT_TOWARD_LEFT;
2146
if (guard == guardian->enemy[0])
2148
guard->spr.anim_count++;
2149
if (guard->spr.anim_count >= guard->spr.anim_speed)
2151
guard->spr.anim_count = 0;
2152
guard->spr.current_image++;
2153
if (guard->spr.current_image > 31)
2155
guard->spr.current_image = 0;
2160
/* check if second part of the guardian existing */
2161
if (guard2->displacement == DISPLACEMENT_GUARDIAN)
2163
guard2->spr.xcoord = guardian->enemy[0]->spr.xcoord;
2164
guard2->spr.ycoord = guardian->enemy[0]->spr.ycoord;
2165
/* cannon rotation to follow the player's spaceship */
2166
if (guard2->img_angle != guard2->spr.current_image)
2168
if (guard2->sens_anim)
2170
guard2->spr.anim_count++;
2171
if (guard2->spr.anim_count >= guard2->spr.anim_speed)
2173
guard2->spr.anim_count = 0;
2174
guard2->spr.current_image--;
2175
if (guard2->spr.current_image < 0)
2177
guard2->spr.current_image =
2178
(Sint16) (guard2->spr.numof_images - 1);
2184
guard2->spr.anim_count++;
2185
if (guard2->spr.anim_count >= guard2->spr.anim_speed)
2187
guard2->spr.anim_count = 0;
2188
guard2->spr.current_image++;
2189
if (guard2->spr.current_image >=
2190
guard2->spr.numof_images)
2192
guard2->spr.current_image = 0;
2196
/* count length in the oposite trigonometrical direction */
2197
anim_count = guard2->spr.current_image;
2199
for (i = 0; i < 32; i++)
2203
if (anim_count > 31)
2207
if (guard2->img_angle == anim_count)
2212
/* count length in the trigonometrical direction */
2213
anim_count = guard2->spr.current_image;
2215
for (i = 0; i < 32; i++)
2223
if (guard2->img_angle == anim_count)
2228
if (length1 < length2)
2230
guard2->sens_anim = 0;
2234
guard2->sens_anim = 1;
2237
/* search cannon position compared to the direction of spaceship */
2239
calc_target_angle ((Sint16)
2240
(guard2->spr.xcoord +
2241
guard2->spr.img[guard2->spr.current_image]->
2243
(Sint16) (guard2->spr.ycoord +
2244
guard2->spr.img[guard2->spr.
2247
(Sint16) (ship->spr.xcoord +
2248
ship->spr.img[ship->spr.
2249
current_image]->x_gc),
2250
(Sint16) (ship->spr.ycoord +
2251
ship->spr.img[ship->spr.
2252
current_image]->y_gc));
2253
/* search image to draw determined upon angle */
2254
if (sign (angle < 0))
2256
guard2->img_angle = (Sint16) ((angle + DEUX_PI) / PI_SUR_16);
2260
guard2->img_angle = (Sint16) (angle / PI_SUR_16);
2262
/* avoid a negative table index */
2263
guard2->img_angle = (Sint16) abs (guard2->img_angle);
2264
/* avoid shot angle higher than the number of images of the sprite */
2265
if (guard2->img_angle >= guard2->spr.numof_images)
2267
guard2->img_angle = (Sint16) (guard2->spr.numof_images - 1);
2272
if (guardian_fire (guard, 8, 2.0) > 0)
2274
guardian_add_lonely_foe (40, -1);
2279
* Handle the guardian 11
2280
* @param guard Pointer to the enemy structure of the guardian
2283
guardian_11 (enemy * guard)
2285
Uint32 numof_bullets;
2286
if (guardian->is_appearing)
2288
guardian_appears_from_top (guard);
2292
if (!player_pause && menu_status == MENU_OFF
2293
&& menu_section == NO_SECTION_SELECTED)
2295
if (--guardian->move_time_delay > 0)
2297
if (guardian->move_direction[guardian->move_current] <
2300
guardian_line_moving (guard);
2302
switch (guardian->move_direction[guardian->move_current])
2304
case GUARD_MOVEMENT_TOWARD_RIGHT:
2305
if (guardian->has_changed_direction)
2307
guardian_change_images (guard, 0, 15);
2308
guardian->has_changed_direction = FALSE;
2310
guardian_flip_image (guard, 4, 31);
2313
case GUARD_MOVEMENT_TOWARD_LEFT:
2314
if (guardian->has_changed_direction)
2316
guardian->has_changed_direction = FALSE;
2317
guardian_change_images (guard, 0, 15);
2319
guardian_flip_image (guard, 4, 0);
2322
case GUARD_IMMOBILE:
2323
if (guardian->has_changed_direction)
2325
guardian->has_changed_direction = FALSE;
2326
guardian_change_images_set (guard, 0);
2327
if (guardian->is_vertical_trajectory)
2329
guard->spr.current_image = 15;
2330
guardian->is_vertical_trajectory = FALSE;
2333
guardian_flip_image (guard, 3, 15);
2339
guardian_next_trajectory ();
2343
numof_bullets = guardian_fire (guard, 8, 2.0);
2344
guardian_add_missiles (guard, numof_bullets, 8, 2);
2348
* Handle the guardian 12
2349
* @param guard Pointer to the enemy structure of the guardian
2352
guardian_12 (enemy * guard)
2354
Uint32 numof_bullets;
2355
bool add_shuriky = FALSE;
2356
bool add_missiles = FALSE;
2357
if (guardian->is_appearing)
2359
guardian_appears_from_top (guard);
2363
if (!player_pause && menu_status == MENU_OFF
2364
&& menu_section == NO_SECTION_SELECTED)
2366
if (--guardian->move_time_delay > 0)
2368
switch (guardian->move_direction[guardian->move_current])
2370
case GUARD_MOVEMENT_TOWARD_RIGHT:
2371
guardian_line_moving (guard);
2372
guardian_flip_image (guard, 4, 31);
2376
case GUARD_MOVEMENT_TOWARD_LEFT:
2377
guardian_line_moving (guard);
2378
guardian_flip_image (guard, 4, 0);
2382
case GUARD_MOVEMENT_TOWARD_BOTTOM:
2383
guardian->is_vertical_trajectory = TRUE;
2384
/* from 8 to 14: bottom to up
2385
* from 15 to 31: up to bottom */
2386
guardian_flip_image (guard, 3, 31);
2387
if (guard->spr.current_image >= 15)
2389
guardian_line_moving (guard);
2393
case GUARD_MOVEMENT_TOWARD_TOP:
2394
guardian_line_moving (guard);
2395
guardian_flip_image (guard, 2, 31);
2398
case GUARD_IMMOBILE:
2399
if (guardian->current_images_set == 0)
2402
if (guard->spr.current_image != 15)
2404
guardian_flip_image (guard, 3, 15);
2406
else if (guardian_get_next_trajectory () ==
2407
GUARD_MOVEMENT_TOWARD_BOTTOM)
2409
guardian_change_images (guard, 1, 0);
2411
else if (guardian_get_next_trajectory () ==
2412
GUARD_MOVEMENT_TOWARD_LEFT)
2414
guardian_add_sapouch (guard, 2, 80, TRUE);
2419
if (guardian->is_vertical_trajectory)
2421
if (guard->spr.current_image < 31)
2423
guardian_flip_image (guard, 3, 31);
2427
guardian_change_images (guard, 0, 15);
2428
guardian->is_vertical_trajectory = FALSE;
2433
/* lamps of the guardian wink */
2434
/* image from O to 7 */
2435
guardian_loop_flip (guard, 1, 1, 7, 0);
2436
add_missiles = TRUE;
2440
if (guardian->has_changed_direction)
2442
guardian->has_changed_direction = FALSE;
2447
guardian_next_trajectory ();
2450
numof_bullets = guardian_fire (guard, 8, 2.0);
2451
if (numof_bullets > 0)
2455
guardian_add_shuriky (guard, 6);
2459
guardian_add_missiles (guard, numof_bullets, 24, 4);
2467
* Handle the guardian 13
2468
* @param guard Pointer to the enemy structure of the guardian
2471
guardian_13 (enemy * guard)
2473
bool add_missiles = FALSE;
2474
Uint32 numof_bullets;
2475
if (guardian->is_appearing)
2477
guardian_appears_from_top (guard);
2481
if (!player_pause && menu_status == MENU_OFF
2482
&& menu_section == NO_SECTION_SELECTED)
2484
if (--guardian->move_time_delay > 0)
2486
guardian_add_devilians (guard, 121, 3);
2487
if (guardian->move_direction[guardian->move_current] <
2490
guardian_line_moving (guard);
2493
if (guardian->current_images_set == 0)
2495
/* change sprite if level of the life of the guardian is has its half */
2496
if (guard->spr.energy_level <=
2497
guard->spr.max_energy_level / 2)
2499
guardian_change_images (guard, 1, 16);
2500
guardian->y_inc = 3.0;
2501
guardian->devilians_enable = TRUE;
2505
guardian_loop_flip (guard, 2, 1, 31, 0);
2509
/* guardian weakened, low part destroyed: animation 2 */
2511
add_missiles = TRUE;
2512
switch (guardian->move_direction[guardian->move_current])
2514
case GUARD_MOVEMENT_TOWARD_RIGHT:
2515
guardian_flip_image (guard, 4, 31);
2518
case GUARD_MOVEMENT_TOWARD_LEFT:
2519
guardian_flip_image (guard, 0, 0);
2522
case GUARD_IMMOBILE:
2523
guardian_flip_image (guard, 0, 15);
2524
guardian->devilians_enable = TRUE;
2531
guardian_next_trajectory ();
2535
numof_bullets = guardian_fire (guard, 8, 2.0);
2538
guardian_add_missiles (guard, numof_bullets, 6, 2);
2543
* Handle the guardian 14
2544
* @param guard Pointer to the enemy structure of the guardian
2547
guardian_14 (enemy * guard)
2549
Uint32 numof_bullets;
2550
if (guardian->is_appearing)
2552
guardian_appears_from_top (guard);
2556
if (!player_pause && menu_status == MENU_OFF
2557
&& menu_section == NO_SECTION_SELECTED)
2559
if (--guardian->move_time_delay > 0)
2561
if (guardian->move_direction[guardian->move_current] <
2564
guardian_line_moving (guard);
2567
if (guardian->anim_delay_count >= 1
2568
&& guard->spr.current_image == 31)
2570
guardian->anim_delay_count = 0;
2571
if (guardian->current_images_set == 0)
2573
guardian_change_images (guard, 1, 0);
2577
guardian_change_images (guard, 0, 0);
2582
guardian_flip_image (guard, 2, 31);
2585
switch (guardian->move_direction[guardian->move_current])
2587
case GUARD_MOVEMENT_TOWARD_RIGHT:
2589
case GUARD_MOVEMENT_TOWARD_LEFT:
2595
guardian_next_trajectory ();
2598
guardian_add_perturbians (guard, 2, 210, TRUE);
2600
numof_bullets = guardian_fire (guard, 4, 2.0);
2601
if (numof_bullets > 0)
2603
guardian_add_saakamin (guard, 6, 7);
2608
* Draw a guardian vessel enemy
2609
* @param guard Pointer to enemy structure
2612
guardian_draw (enemy * guard)
2615
float x_expl, y_expl;
2616
sprite ve_spr = guard->spr;
2618
/* display white mask */
2619
if (guard->is_white_mask_displayed)
2621
draw_sprite_mask (coulor[WHITE],
2622
guard->spr.img[guard->spr.current_image],
2623
(Sint32) (guard->spr.xcoord),
2624
(Sint32) (guard->spr.ycoord));
2625
guard->is_white_mask_displayed = FALSE;
2629
draw_sprite (guard->spr.img[guard->spr.current_image],
2630
(Uint32) guard->spr.xcoord, (Uint32) guard->spr.ycoord);
2632
&& rand () % (ve_spr.max_energy_level + 1) >
2633
ve_spr.energy_level + (ve_spr.max_energy_level >> 3))
2637
((Sint32) ve_spr.img[ve_spr.current_image]->
2638
numof_collisions_zones));
2640
(float) (ve_spr.xcoord +
2641
ve_spr.img[ve_spr.current_image]->
2642
collisions_coords[zon_col][XCOORD] +
2644
((Sint32) ve_spr.img[ve_spr.current_image]->
2645
collisions_sizes[zon_col][XCOORD] + 1));
2647
(float) (ve_spr.ycoord +
2648
ve_spr.img[ve_spr.current_image]->
2649
collisions_coords[zon_col][YCOORD] +
2651
((Sint32) ve_spr.img[ve_spr.current_image]->
2652
collisions_sizes[zon_col][YCOORD] + 1));
2653
explosion_guardian_add (x_expl, y_expl);
2659
* Run all guardians + congratulations
2660
* @param guard Pointer to enemy structure
2663
guardian_handle (enemy * guard)
2665
spaceship_struct *ship = spaceship_get ();
2666
switch (guardian->number)
2669
guardian_01 (guard);
2672
guardian_02 (guard);
2675
guardian_03 (guard);
2678
guardian_04 (guard);
2681
guardian_05 (guard);
2684
guardian_06 (guard);
2687
guardian_07 (guard);
2690
guardian_08 (guard);
2693
guardian_09 (guard);
2696
guardian_10 (guard);
2699
guardian_11 (guard);
2702
/* guardians 12, 13, 14 and congratulations */
2704
guardian_12 (guard);
2707
guardian_13 (guard);
2710
guardian_14 (guard);
2718
if (guardian->is_appearing)
2720
if (guard == guardian->enemy[0])
2722
/* guardian blink: display once on two */
2723
if (guardian->is_blinking)
2725
/* the guardian consists of two sprites */
2726
if (guardian->number == 6 || guardian->number == 9
2727
|| guardian->number == 10)
2729
guardian_draw (guardian->enemy[0]);
2730
guardian_draw (guardian->enemy[1]);
2734
guardian_draw (guard);
2736
guardian->is_blinking = FALSE;
2740
guardian->is_blinking = TRUE;
2746
/* collisions with protections satellite */
2747
enemy_satellites_collisions (guard);
2748
/* collisions with extra guns */
2749
enemy_guns_collisions (guard);
2750
/* collision with player's spaceship */
2751
if (!ship->invincibility_delay)
2753
enemy_spaceship_collision (guard);
2755
/* display the guardian */
2756
guardian_draw (guard);
2761
* Loading guardian's sprites images in memory
2762
* @param guardian_num number of the guardian 1 to 14
2763
* @return TRUE if successful
2766
guardian_load (Sint32 guardian_num)
2768
Uint32 num_of_sprites;
2770
if (power_conf->verbose > 0)
2772
fprintf (stdout, "> guardians.c/guardian_load(%i)\n", guardian_num);
2775
guardian_images_free ();
2777
switch (guardian_num)
2795
("graphics/sprites/guardians/guardian_%02d.spr",
2796
guardian_num - 1, &gardi[0][0], num_of_sprites,
2797
ENEMIES_SPECIAL_NUM_OF_IMAGES))
2805
* Prepare next level if end of guardian
2808
guardian_finished (void)
2810
Uint32 guard_num = 0;
2812
if (guardian->number == 0)
2816
/* guardian 11, 12, 13 and 14 requiring special handling */
2817
if (num_level == MAX_NUM_OF_LEVELS && guardian->number >= 11
2818
&& guardian->number < 15)
2820
switch (guardian->number)
2823
if (!guardian_load (12))
2830
if (!guardian_load (13))
2837
if (!guardian_load (14))
2844
spaceship_disappears = TRUE;
2845
/* congratulations */
2846
if (starfield_speed == 0.0)
2855
/* player's spaceship disappear from the screen */
2856
spaceship_disappears = TRUE;
2857
text_level_move (num_level);
2858
is_finished = text_level_move (num_level);
2859
if (starfield_speed == 0.0 && is_finished)
2863
if (num_level > MAX_NUM_OF_LEVELS)
2868
/* load guardian files in advance */
2904
if (!guardian_load (guard_num))
2910
/* load grid level */
2911
if (!grid_load (num_level))
2915
/* load curve phase level file (little skirmish) */
2916
if (!curve_load_level (num_level))
2920
if (!meteors_load (num_level))
2924
/* enable the curve level file loaded previously */
2925
curve_enable_level ();
2926
courbe.activity = TRUE;
2927
grid.is_enable = FALSE;
2928
meteor_activity = FALSE;
2929
guardian->number = 0;
2937
gardien 1 : gauche a droite
2938
gardien 2 : gauche a droite + animation descente
2939
gardien 3 : gauche a droite
2940
gardien 4 : gauche a droite + animation quand il pause
2941
gardien 5 : gauche a droite (sinus vertical) + missile
2942
gardien 6 : compose de 2 sprites : gauche a droite (tube vertical)
2943
gardien 7 : gauche a droite + mine (tir & anim si mort) + autres vaisseaux
2944
gardien 8 : gauche a droite + autres vaisseaux
2945
gardien 9 : compose de 2 sprites : gauche a droite (nez du vaisseau) + autres vaisseaux
2946
gardien 10 : tourne en rectangle + autres vaisseaux
2947
gardien 11 : gauche a droite + autres vaisseaux
2950
- 9 LONELY_HOCKYS: boule canon va de haut en bas
2951
- 20 LONELY_DEMONIANS: vaisseau va de haut en bas
2952
- 22 LONELY_FIDGETINIANS: vaisseau dentee va de haut en bas
2953
- 28 LONELY_DIVERTIZERS vaisseau tourne va de haut en bas
2954
- 31 LONELY_CARRYONIANS vaisseau bas ailes va de bas en haut
2955
- 39 LONELY_MADIRIANS vaisseau canon gauche a droite
2962
/* initialize guardian 1 */