Codebase list overgod / 862df4c
Imported Upstream version 1.0 Barry deFreese 10 years ago
133 changed file(s) with 46254 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: actor.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - functions relating to the player ships
30
31 */
32
33
34 /*
35 UPGRADES:
36
37 Primary:
38 Square - recycle (autofire)
39 Circle - number
40 Triangle - speed (proj)
41
42 Secondary:
43 Square - Damage
44 Circle - Number
45 Triangle - Size/Speed
46
47 Drive:
48 Square - Speed
49 Circle - Turn
50 Triangle - Drift
51
52 Defence:
53 Square - Armour
54 Circle - Shield capacity
55 Triangle - Shield recharge
56
57
58
59 SHIPS:
60
61 Pointy: extra-damage darts
62 Horseshoe: Fast secondary recycle
63 round: armour self-repairs
64 Retro: retro-rocket instead of drag field
65 small: smaller collision radius
66 fins: backfire
67 large rear wings: orbital
68 curve: bounces off enemies (ram)
69
70 */
71
72
73 #include "allegro.h"
74
75 #include <math.h>
76 //#include <stdlib.h>
77
78 #include "config.h"
79
80 #include "globvars.h"
81
82 #include "stuff.h"
83 #include "enemy.h"
84 #include "cloud.h"
85 #include "palette.h"
86 #include "pickup.h"
87 #include "bullet.h"
88 #include "sound.h"
89 #include "display.h"
90 #include "cmds.h"
91
92 //#include "upgrades.h"
93
94 #define ORBITAL_DISTANCE 25000
95
96 #define DISTINCT_WEAPON 11
97
98
99 void drag_actor(int i);
100 void move_actor(int i);
101 int detect_collision_actor_enemies(int a);
102 int detect_collision_actor_pickups(int a);
103 int hurt_actor(int a, int source, int hurty);
104 void actor_destroyed(int a, int source);
105 void actor_explodes(int a);
106 void score_duel_kill(int a, int source);
107 void spawn_actor(int a);
108 void gain_upgrade_points(int who, int how_many);
109 int get_upgrade_maximum(int a);
110 void extra_ship(void);
111
112 int acquire_target(int a);
113 int acquire_turret_target(int a);
114 void actor_orbital(int a);
115 void actor_shield(int a);
116 void actor_sidekicks(int a);
117 int gain_symbol(int a, int abil, int symb);
118 int new_weapon(int a);
119 int new_secondary(int a);
120 int duel_armour(int armour, int h);
121
122 int closest_enemy(int x, int y, int range, int hide_invisible);
123 int closest_enemy_or_actor(int a, int x, int y, int range, int hide_invisible);
124 void reset_actor(int a);
125
126 void calulate_total_power(int a);
127
128 void upgrade_sidekicks(int a);
129 void game_is_over(void);
130
131
132 void run_actors(void)
133 {
134 int i;
135
136 for (i = 0; i < NO_ACTORS; i ++)
137 {
138 if (actor[i].type == ACTORTYPE_NONE)
139 continue;
140 if (actor[i].in_play == 0)
141 {
142
143 actor[i].x_speed = 0;
144 actor[i].y_speed = 0;
145 if (actor[i].spawn_delay > 0)
146 {
147 actor[i].spawn_delay --;
148 continue;
149 }
150 if (game.ships_left > 0)
151 {
152 if (arena.game_over == 0)
153 spawn_actor(i); // ships_left will be non-zero for time attack games.
154 }
155 else
156 continue;
157 }
158 // actor[i].energy += actor[i].recharge;
159 // if (actor[i].energy >= actor[i].max_energy)
160 // actor[i].energy = actor[i].max_energy;
161
162 if (actor[i].screen_shake_time > 0)
163 {
164 if (actor[i].screen_shake_time > 4)
165 {
166 player[actor[i].controller].screen_shake_x = grand(7501) - 3250;
167 player[actor[i].controller].screen_shake_y = grand(7501) - 3250;
168 }
169 else
170 {
171 player[actor[i].controller].screen_shake_x = grand(3500) - 1750;
172 player[actor[i].controller].screen_shake_y = grand(3500) - 1750;
173 }
174 actor[i].screen_shake_time --;
175 }
176 else
177 {
178 player[actor[i].controller].screen_shake_x = 0;
179 player[actor[i].controller].screen_shake_y = 0;
180 }
181 // screen_shake needs to be first, as many things below can affect it and we don't want them wiped.
182
183 if (actor[i].repairing > 0)
184 {
185 actor[i].repairing --;
186 if (actor[i].armour < actor[i].max_armour)
187 actor[i].armour += 5;
188 if (actor[i].armour > actor[i].max_armour)
189 actor[i].armour = actor[i].max_armour;
190 // + play a sound?
191 }
192
193 if (actor[i].ship == SHIP_ROUND && counter % 7 == 0)
194 {
195 if (actor[i].armour < actor[i].max_armour)
196 actor[i].armour += 1;
197 }
198
199
200 if (actor[i].grace_period > 0)
201 actor[i].grace_period --;
202 if (actor[i].hurt_pulse > 0)
203 actor[i].hurt_pulse --;
204 if (actor[i].recycle1 > 0)
205 actor[i].recycle1 --;
206 if (actor[i].recycle2 > 0)
207 actor[i].recycle2 --;
208
209 if (actor[i].turret_recycle > 0)
210 actor[i].turret_recycle --;
211 if (actor[i].sidekick_recycle > 0)
212 actor[i].sidekick_recycle --;
213 if (actor[i].heavy_recycle > 0)
214 actor[i].heavy_recycle --;
215 if (actor[i].backfire_recycle > 0)
216 actor[i].backfire_recycle --;
217
218 if (actor[i].secondary_burst > 0)
219 continue_secondary_burst(i);
220
221 if (actor[i].just_upgraded_timeout > 0)
222 actor[i].just_upgraded_timeout --;
223 if (actor[i].just_collided > 0)
224 actor[i].just_collided --;
225 move_actor(i);
226 detect_collision_actor_enemies(i);
227 detect_collision_actor_pickups(i);
228 if (actor[i].upgraded_system [UPG_SEEKER] > 0)
229 acquire_target(i);
230 // if (actor[i].upgraded_system [UPG_TURRET] > 0)
231 // acquire_turret_target(i);
232 // if (actor[i].ship == SHIP_ORBITAL && actor[i].total_power > 0)
233 // actor_orbital(i);
234 if (actor[i].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE] > 0)
235 actor_shield(i);
236 // if (actor[i].upgraded_system [UPG_SIDEKICK] > 0)
237 // actor_sidekicks(i);
238 if (actor[i].drive_sound [DRIVE_THRUST] > 0)
239 actor[i].drive_sound [DRIVE_THRUST] --;
240 if (actor[i].drive_sound [DRIVE_SLIDE] > 0)
241 actor[i].drive_sound [DRIVE_SLIDE] --;
242 if (actor[i].drive_sound [DRIVE_RETRO] > 0)
243 actor[i].drive_sound [DRIVE_RETRO] --;
244 }
245
246 }
247
248 void move_actor(int i)
249 {
250
251 if (actor[i].x + actor[i].x_speed <= actor[i].edge_radius
252 || actor[i].x + actor[i].x_speed >= arena.max_x - actor[i].edge_radius - 2000)// - 3000)
253 {
254 actor[i].x_speed *= -1;
255 }
256 if (actor[i].y + actor[i].y_speed <= actor[i].edge_radius
257 || actor[i].y + actor[i].y_speed >= arena.max_y - actor[i].edge_radius - 4000)// - 4000)
258 {
259 actor[i].y_speed *= -1;
260 }
261 actor[i].x += actor[i].x_speed;
262 actor[i].y += actor[i].y_speed;
263 if (game.drag != 0)
264 drag_actor(i);
265
266 }
267
268 /*
269 void drag_actor(int i)
270 {
271
272 int drag_x, drag_y;
273 int new_x_speed, new_y_speed;
274
275 new_x_speed = ((float) actor[i].x_speed * game[0].drag);// / 10000;
276 new_y_speed = ((float) actor[i].y_speed * game[0].drag);// / 10000;
277
278 drag_x = abs(actor[i].x_speed - new_x_speed);
279 drag_y = abs(actor[i].y_speed - new_y_speed);
280
281 actor[i].drag_amount = hypot(drag_x, drag_y);
282
283 if (actor[i].drag_amount < 2)
284 return;
285
286
287 actor[i].x_speed = new_x_speed;
288 actor[i].y_speed = new_y_speed;
289
290 }
291
292 */
293
294
295
296 void drag_actor(int i)
297 {
298
299 // int drag_x, drag_y;
300 // int new_x_speed, new_y_speed;
301
302 /* float drag_mult = 0.015 - (actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 0.0015);//game.drag;
303 if (actor[i].dragging > 0)
304 {
305 drag_mult *= (float) actor[i].brake_strength * actor[i].dragging / 20;
306 }*/
307 //float drag_mult = 0.020 - (actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 0.0020);//game.drag;
308
309 float drag_mult = 0.025 - (actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 0.0025);//game.drag;
310
311 if (actor[i].dragging > 0)
312 {
313 drag_mult *= (float) actor[i].brake_strength * actor[i].dragging / 23;
314 }
315
316 int angle = radians_to_angle(atan2(actor[i].y_speed, actor[i].x_speed));
317 actor[i].moving_angle = angle;
318 float dragged = hypot(abs(actor[i].x_speed), abs(actor[i].y_speed)) * drag_mult;
319
320 if (actor[i].dragging == 0 && actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] != 0)
321 {
322 if (dragged < 10 + actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 5)
323 {
324 dragged /= 5 + actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE];
325 }
326 }
327
328 float change = cos(angle_to_radians(angle)) * dragged;
329 actor[i].x_speed -= change;// * game[0].drag;
330
331 change = sin(angle_to_radians(angle)) * dragged;
332 actor[i].y_speed -= change;// * game[0].drag;
333
334 if (actor[i].dragging == 20)
335 {
336 if (abs(actor[i].x_speed) < 20 && abs(actor[i].y_speed) < 20)
337 {
338 actor[i].x_speed = 0;
339 actor[i].y_speed = 0;
340 }
341 }
342
343
344 if (actor[i].dragging == 20 && grand(100) + 70 < dragged)
345 {
346 int passing_colours [5] = {COLOUR_YELLOW8, COLOUR_ORANGE8, COLOUR_RED8, COLOUR_RED6, COLOUR_RED4};
347 create_cloud(CLOUD_SPECK,
348 actor[i].x + grand(10001) - 5000,
349 actor[i].y + grand(10001) - 5000,
350 0, 0,
351 // actor[a].x_speed + x_accel * 20 + (300 - grand(601)),
352 // actor[a].y_speed + y_accel * 20 + (300 - grand(601)),
353 0, 0,
354 10 + grand(11),1,0, 0, 0, 0, passing_colours);
355 }
356
357 if (dragged > 250 - (actor[i].dragging == 20) * 150)
358 {
359 player[actor[i].controller].screen_shake_x += grand((dragged - 100) * 60) - ((dragged - 100) * 30);
360 player[actor[i].controller].screen_shake_y += grand((dragged - 100) * 60) - ((dragged - 100) * 30);
361 // player[actor[i].controller].screen_shake_x += grand(3500) - 1750;
362 // player[actor[i].controller].screen_shake_y += grand(3500) - 1750;
363 // if (dragged > 60)
364 // {
365
366 // }
367 }
368
369 actor[i].drag_amount = dragged;// * game[0].drag;
370 /*
371 if (actor[i].drag_amount < 2)
372 return;
373
374
375 actor[i].x_speed = new_x_speed;
376 actor[i].y_speed = new_y_speed;
377 */
378 }
379
380
381 int acquire_target(int a)
382 {
383
384 actor[a].seek_x = actor[a].x + cos(angle_to_radians(actor[a].angle - ANGLE_QUARTER)) * 75000;
385 actor[a].seek_y = actor[a].y + sin(angle_to_radians(actor[a].angle - ANGLE_QUARTER)) * 75000;
386 if (game.type == GAME_DUEL)
387 {
388 actor[a].lock = closest_enemy_or_actor(a, actor[a].seek_x, actor[a].seek_y,
389 35000 + actor[a].upgraded_system [UPG_SEEKER] * 30000, 1);
390 }
391 else
392 actor[a].lock = closest_enemy(actor[a].seek_x, actor[a].seek_y,
393 35000 + actor[a].upgraded_system [UPG_SEEKER] * 30000, 1);
394 return 0;
395
396 }
397
398 int acquire_turret_target(int a)
399 {
400
401 if (game.type == GAME_DUEL)
402 {
403 actor[a].turret_lock = closest_enemy_or_actor(a, actor[a].x, actor[a].y,
404 80000 + actor[a].upgraded_system [UPG_TURRET] * 20000, 1);
405 }
406 else
407 actor[a].turret_lock = closest_enemy(actor[a].x, actor[a].y,
408 80000 + actor[a].upgraded_system [UPG_TURRET] * 20000, 1);
409 return 0;
410
411 }
412
413 int closest_enemy(int x, int y, int range, int hide_invisible)
414 {
415
416 int i;
417 int dist;
418 int retval = -1;
419
420
421 for (i = 0; i < NO_ENEMIES; i ++)
422 {
423 if (enemy[i].type == ENEMY_NONE)
424 continue;
425 if (hide_invisible == 1)
426 {
427 if ((enemy[i].type == ENEMY_SHADOW1
428 || enemy[i].type == ENEMY_SHADOW2)
429 && enemy[i].attribute [0] == 0)
430 continue;
431 }
432 dist = hypot(y - enemy[i].y, x - enemy[i].x);
433 if (dist < range)
434 {
435 retval = i;
436 range = dist;
437 }
438 }
439
440 return retval;
441
442 }
443
444 int closest_enemy_or_actor(int a, int x, int y, int range, int hide_invisible)
445 {
446
447 int i;
448 int dist;
449 int retval = -1;
450
451
452 for (i = 0; i < 2; i ++)
453 {
454 if (i == a)
455 continue;
456 if (actor[i].type == ENEMY_NONE)
457 continue;
458 if (actor[i].in_play == 0)
459 continue;
460 dist = hypot(y - actor[i].y, x - actor[i].x);
461 if (dist < range)
462 {
463 if (i == 0)
464 retval = LOCK_ACTOR0;
465 else
466 retval = LOCK_ACTOR1;
467 range = dist;
468 }
469 }
470
471 for (i = 0; i < NO_ENEMIES; i ++)
472 {
473 if (enemy[i].type == ENEMY_NONE)
474 continue;
475 // if (enemy[i].type == ENEMY_DEAD_WANDERER)
476 // continue; // dead fighters are still dangerous, so lock onto them
477 // if (hide_invisible == 1)
478 // {
479 // if ((enemy[i].type == ENEMY_CLOAKER
480 // || enemy[i].type == ENEMY_CLOAKER2)
481 // && enemy[i].attribute [ATTRIB_CLOAKER_PULSE] == 0)
482 // continue;
483 // }
484 dist = hypot(y - enemy[i].y, x - enemy[i].x);
485 if (dist < range)
486 {
487 retval = i;
488 range = dist;
489 }
490 }
491
492 return retval;
493
494 }
495
496
497 void actor_orbital(int a)
498 {
499 if (actor[a].grace_period > 0)
500 return;
501 // this could make boss enemies too easy
502
503 int colours [4], ox, oy;
504
505 // if (actor[a].upgraded_system [UPG_ORBITAL] >= 4)
506 // actor[a].orbital_spin = 25;
507 // else
508 actor[a].orbital_spin = 18;
509
510 actor[a].orbital_angle += actor[a].orbital_spin;
511 if (actor[a].orbital_angle > ANGLE_FULL)
512 actor[a].orbital_angle -= ANGLE_FULL;
513 if (actor[a].orbital_angle < 0)
514 actor[a].orbital_angle += ANGLE_FULL;
515
516 int damage = 500 + actor[a].total_power * 35;
517 int special1 = 1 + actor[a].total_power / 5;
518
519 if (special1 > 7) special1 = 7;
520
521 colours [0] = TRANS_YELLOW;
522 colours [1] = TRANS_LGREEN;
523 colours [2] = TRANS_LGREEN;
524 colours [3] = TRANS_DGREEN;
525 // colours [0] = TRANS_YELLOW;
526 // colours [1] = TRANS_ORANGE;
527 // colours [2] = TRANS_LRED;
528 // colours [3] = TRANS_DRED;
529 // colours [0] = COLOUR_YELLOW8;
530 // colours [1] = COLOUR_YELLOW8;
531 // colours [2] = COLOUR_YELLOW6;
532 // colours [3] = COLOUR_YELLOW4;
533
534 ox = actor[a].x + xpart(actor[a].orbital_angle, ORBITAL_DISTANCE);
535 oy = actor[a].y + ypart(actor[a].orbital_angle, ORBITAL_DISTANCE);
536
537 create_bullet(BULLET_NICE_ORBITAL, ox, oy,
538 0, 0,
539 a, damage, 2, 100, 0,
540 0, 0, colours, 1,special1,0,0,0,0);
541
542 ox = actor[a].x + xpart(actor[a].orbital_angle + ANGLE_HALF, ORBITAL_DISTANCE);
543 oy = actor[a].y + ypart(actor[a].orbital_angle + ANGLE_HALF, ORBITAL_DISTANCE);
544
545 create_bullet(BULLET_NICE_ORBITAL, ox, oy,
546 0, 0,
547 a, damage, 2, 100, 0,
548 0, 0, colours, 1,special1,0,0,0,0);
549
550
551 }
552
553 void actor_shield(int a)
554 {
555
556 actor[a].max_shield = (actor[a].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE]) * 70; //100;
557
558 /* if (counter % 3 == 0)
559 {
560 if (actor[a].shield < actor[a].max_shield)
561 // actor[a].shield += actor[a].upgraded_system [UPG_SHIELD] + 1;
562 actor[a].shield += 3 + actor[a].upgraded_system [UPG_SHIELD]; // if can be increased by > 1, must not be > shield_max or layers look odd.
563 if (actor[a].shield > actor[a].max_shield)
564 actor[a].shield = actor[a].max_shield;
565 }*/
566 if (actor[a].shield < actor[a].max_shield)
567 {
568 // if (counter % 3 == 0)
569 actor[a].shield_recharge += 2 + actor[a].ability [ABILITY_DEFENCE] [SYMBOL_TRIANGLE] * 2;
570 // if (counter % 6 - actor[a].upgraded_system [UPG_SHIELD] == 0)
571 // actor[a].shield ++;
572 while(actor[a].shield_recharge > 10)
573 {
574 actor[a].shield ++;
575 actor[a].shield_recharge -= 10;
576 };
577 if (actor[a].shield > actor[a].max_shield)
578 actor[a].shield = actor[a].max_shield;
579 }
580 // if (actor[a].shield > actor[a].max_shield)
581 // actor[a].shield = actor[a].max_shield;
582
583 if (actor[a].shield_pulse > 0 && counter % 3 == 0)
584 actor[a].shield_pulse --;
585
586 }
587
588
589 void actor_sidekicks(int a)
590 {
591
592 int i, xcos2, ysin2;
593
594 int passing_colours [5];
595
596 if (actor[a].sidekick_recycle > 0)
597 actor[a].sidekick_recycle --;
598
599 int xcos = cos(angle_to_radians(actor[a].angle)) * GRAIN;
600 int ysin = sin(angle_to_radians(actor[a].angle)) * GRAIN;
601 // int xcos2;// = cos(angle_to_radians(actor[a].angle)) * GRAIN;
602 // int ysin2;// = sin(angle_to_radians(actor[a].angle)) * GRAIN;
603
604 // if (actor[a].sidekicks >= 2)
605 // {
606 // xcos2 = cos(angle_to_radians(actor[a].angle)) * GRAIN;
607 // ysin2 = sin(angle_to_radians(actor[a].angle)) * GRAIN;
608 // }
609
610 int target_x, target_y;
611 float speed_mult;
612 int accel = 0;
613
614 for (i = 0; i < actor[a].sidekicks; i ++)
615 {
616 switch(i)
617 {
618 case 0:
619 target_x = actor[a].x + (cos(angle_to_radians(actor[a].angle - ANGLE_1_EIGHTH)) * GRAIN * 40);
620 target_y = actor[a].y + (sin(angle_to_radians(actor[a].angle - ANGLE_1_EIGHTH)) * GRAIN * 40);
621 accel = 22;
622 passing_colours [0] = COLOUR_YELLOW8;
623 passing_colours [1] = COLOUR_GREEN8;
624 passing_colours [2] = COLOUR_GREEN6;
625 passing_colours [3] = COLOUR_GREEN4;
626 passing_colours [4] = COLOUR_GREEN2;
627 break;
628 case 1:
629 target_x = actor[a].x + (cos(angle_to_radians(actor[a].angle - ANGLE_QUARTER - ANGLE_1_EIGHTH)) * GRAIN * 40);
630 target_y = actor[a].y + (sin(angle_to_radians(actor[a].angle - ANGLE_QUARTER - ANGLE_1_EIGHTH)) * GRAIN * 40);
631 // target_x = actor[a].x - xcos * 20;
632 // target_y = actor[a].y - ysin * 20;
633 accel = 22;
634 break;
635 case 2:
636 target_x = actor[a].x + xcos * 40;
637 target_y = actor[a].y + ysin * 40;
638 accel = 12;
639 passing_colours [0] = COLOUR_YELLOW8;
640 passing_colours [1] = COLOUR_YELLOW6;
641 passing_colours [2] = COLOUR_YELLOW4;
642 passing_colours [3] = COLOUR_YELLOW3;
643 passing_colours [4] = COLOUR_YELLOW2;
644 break;
645 case 3:
646 target_x = actor[a].x - xcos * 40;
647 target_y = actor[a].y - ysin * 40;
648 accel = 12;
649 break;
650 }
651
652 speed_mult = hypot(actor[a].sidekick_y [i] - target_y, actor[a].sidekick_x [i] - target_x) / 600;
653
654 if (speed_mult > 200)
655 speed_mult = 200;
656
657 speed_mult *= accel;
658 speed_mult /= 10;
659 /* if (speed_mult < 20 && abs(actor[a].sidekick_x_speed [i]) + abs(actor[a].sidekick_y_speed [i]) < 2000)
660 {
661 actor[a].sidekick_angle [i] = turn_towards_angle(actor[a].sidekick_angle [i], actor[a].angle + ANGLE_QUARTER, 8);
662 actor[a].sidekick_x_speed [i] = 0;
663 actor[a].sidekick_y_speed [i] = 0;
664 }
665 else*/
666 {
667 actor[a].sidekick_angle [i] = turn_towards_xy(actor[a].sidekick_x [i], actor[a].sidekick_y [i], target_x, target_y, actor[a].sidekick_angle [i], 16);
668
669 // actor[a].sidekick_x_speed [i] = cos(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
670 // actor[a].sidekick_y_speed [i] = sin(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
671
672 // actor[a].sidekick_x_speed [i] += cos(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
673 // actor[a].sidekick_y_speed [i] += sin(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
674 xcos2 = cos(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
675 ysin2 = sin(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
676 actor[a].sidekick_x_speed [i] += xcos2;
677 actor[a].sidekick_y_speed [i] += ysin2;
678 }
679
680 actor[a].sidekick_x_speed [i] *= 0.97;
681 actor[a].sidekick_y_speed [i] *= 0.97;
682
683 actor[a].sidekick_x [i] += actor[a].sidekick_x_speed [i];
684 actor[a].sidekick_y [i] += actor[a].sidekick_y_speed [i];
685
686 if (grand(12) == 0 && abs(actor[a].sidekick_x_speed [i]) + abs(actor[a].sidekick_y_speed [i]) > 1000)
687 {
688 create_cloud(CLOUD_SPECK,
689 actor[a].sidekick_x [i] - xcos2 * 37,
690 actor[a].sidekick_y [i] - ysin2 * 37,
691 0, 0,
692 actor[a].sidekick_x_speed [i] - (xcos2 * 10) + (100 - grand(51)),
693 actor[a].sidekick_y_speed [i] - (ysin2 * 10) + (100 - grand(51)),
694 10 + grand(11),1,0, 0, 0, 0, passing_colours);
695 }
696
697
698 }
699
700
701 }
702
703 int gain_symbol(int a, int abil, int symb)
704 {
705 if (actor[a].ability [abil] [symb] >= 5)
706 {
707 // random_symbol(a);
708 return 0;
709 }
710
711 actor[a].ability [abil] [symb] ++;
712
713 switch(abil)
714 {
715 case ABILITY_PRIMARY:
716 switch(symb)
717 {
718 case SYMBOL_SQUARE:
719 // send_message(actor[a].controller, "Dart Reload", COLOUR_YELLOW8);
720 // actor[a].primary = new_weapon(a);
721 break;
722 case SYMBOL_CIRCLE:
723 // send_message(actor[a].controller, "Multiple Darts", COLOUR_YELLOW8);
724 break;
725 case SYMBOL_TRIANGLE:
726 // send_message(actor[a].controller, "Fast Darts", COLOUR_YELLOW8);
727 break;
728 }
729 break;
730 case ABILITY_SECONDARY:
731 switch(symb)
732 {
733 case SYMBOL_SQUARE:
734 // send_message(actor[a].controller, "Power", COLOUR_ORANGE8);
735 // actor[a].primary = new_weapon(a);
736 break;
737 case SYMBOL_CIRCLE:
738 // send_message(actor[a].controller, "Number", COLOUR_ORANGE8);
739 break;
740 case SYMBOL_TRIANGLE:
741 // send_message(actor[a].controller, "Range", COLOUR_ORANGE8);
742 break;
743 }
744 // actor[a].secondary = new_secondary(a);
745 break;
746 case ABILITY_DEFENCE:
747 switch(symb)
748 {
749 case SYMBOL_SQUARE:
750 // send_message(actor[a].controller, "Armour", COLOUR_BLUE8);
751 actor[a].max_armour = 1000 + ARMOUR_UPGRADE * actor[a].ability [ABILITY_DEFENCE] [SYMBOL_SQUARE];
752 if (game.type == GAME_DUEL)
753 {
754 actor[a].max_armour = duel_armour(actor[a].max_armour, game.duel_handicap [actor[a].controller]);
755 actor[a].armour += duel_armour(ARMOUR_UPGRADE, game.duel_handicap [actor[a].controller]);
756 }
757 else actor[a].armour += ARMOUR_UPGRADE;
758 if (actor[a].armour > actor[a].max_armour)
759 actor[a].armour = actor[a].max_armour;
760 break;
761 case SYMBOL_CIRCLE:
762 // send_message(actor[a].controller, "Ward", COLOUR_BLUE8);
763 break;
764 case SYMBOL_TRIANGLE:
765 // send_message(actor[a].controller, "Ward Restore", COLOUR_BLUE8);
766 break;
767 }
768 break;
769 case ABILITY_DRIVE:
770 switch(symb)
771 {
772 case SYMBOL_SQUARE:
773 // send_message(actor[a].controller, "Drive", COLOUR_GREEN8);
774 break;
775 case SYMBOL_CIRCLE:
776 // send_message(actor[a].controller, "Turn", COLOUR_GREEN8);
777 break;
778 case SYMBOL_TRIANGLE:
779 // send_message(actor[a].controller, "Drift", COLOUR_GREEN8);
780 break;
781 }
782 break;
783 // case SYMBOL_:
784 // send_message(actor[a].controller, "++", COLOUR_GREEN8);
785 // break;
786
787
788 }
789
790 calulate_total_power(a);
791
792 return 1;
793 }
794
795 int new_weapon(int a)
796 {
797
798 return WPN_DARTS;
799
800 int highest = 0;
801 if (actor[a].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE] > highest)
802 highest = actor[a].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE];
803 if (actor[a].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] > highest)
804 highest = actor[a].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
805 if (actor[a].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] > highest)
806 highest = actor[a].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE];
807
808 // if (highest < 2)
809 // return WPN_DARTS;
810
811 // int wpn = WPN_DAR;
812 if (actor[a].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE] == highest)
813 {
814 if (highest * 10 > actor[a].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] * DISTINCT_WEAPON
815 && highest * 10 > actor[a].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * DISTINCT_WEAPON)
816 return WPN_SPINES;
817 } else
818 {
819 if (actor[a].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] == highest)
820 {
821 if (highest * 10 > actor[a].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE] * DISTINCT_WEAPON
822 && highest * 10 > actor[a].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * DISTINCT_WEAPON)
823 return WPN_BURST;
824 } else
825 if (actor[a].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] == highest)
826 {
827 if (highest * 10 > actor[a].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] * DISTINCT_WEAPON
828 && highest * 10 > actor[a].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE] * DISTINCT_WEAPON)
829 return WPN_TEETH;
830 }
831 }
832
833 return WPN_DARTS;
834
835 }
836
837
838
839 int new_secondary(int a)
840 {
841
842 int highest = 0;
843 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] > highest)
844 highest = actor[a].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE];
845 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] > highest)
846 highest = actor[a].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE];
847 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] > highest)
848 highest = actor[a].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE];
849 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_CROSS] > highest)
850 highest = actor[a].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
851
852 int wpn = 0;
853 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] == highest) wpn += 1;
854 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] == highest) wpn += 10;
855 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] == highest) wpn += 100;
856 if (actor[a].ability [ABILITY_SECONDARY] [SYMBOL_CROSS] == highest) wpn += 1000;
857
858 switch(wpn)
859 {
860 default:
861 case 0:
862 return SECOND_NONE;
863 case 1:
864 return SECOND_FURIOUS_ORB;
865 case 10:
866 return SECOND_EYE_DESOLATION;
867 case 100:
868 return SECOND_WORMS_SORROW;
869 case 1000:
870 return SECOND_FROZEN_STARS;
871 case 11:
872 return SECOND_BURNING_EYE;
873 case 101:
874 return SECOND_LARVA_NEST;
875 case 1001:
876 return SECOND_MANIFOLD_ORB;
877 case 110:
878 return SECOND_TERROR_EELS;
879 case 1010:
880 return SECOND_PANIC_EELS;
881 case 1100:
882 return SECOND_WORMS_AGONY;
883 case 111:
884 // return SECOND_ORB_RECTIFICATION;
885 // case 1011:
886 return SECOND_NONE;
887 case 1101:
888 return SECOND_NONE;
889 case 1110:
890 return SECOND_NONE;
891 // case 1111:
892 // return SECOND_CIRCLE_PAIN;
893
894 }
895
896 return SECOND_NONE;
897
898 }
899
900
901
902
903
904 int detect_collision_actor_enemies(int a)
905 {
906 if (actor[a].grace_period > 0 || actor[a].in_play == 0)
907 return -1;
908
909 int x2 = actor[a].x - actor[a].x_speed;
910 int y2 = actor[a].y - actor[a].y_speed;
911 int i;
912
913 int angle1, angle2, angle3;
914 int total_speed;
915 int difference;
916 int collision_velocity = 0;
917 int hurty = 0;
918 int passing_colours [5];
919
920 int xs2, ys2;
921
922 for (i = 0; i < NO_ENEMIES; i ++)
923 {
924 if (enemy[i].type == ENEMY_NONE)
925 continue;
926 if (enemy[i].radius == 0)
927 // enemy has no collision radius - dead wanderer etc
928 continue;
929
930 if (actor[a].just_collided > 0 && enemy[i].just_collided > 0)
931 continue;
932
933 if (hypot(actor[a].x - enemy[i].x, actor[a].y - enemy[i].y) <= actor[a].radius + enemy[i].radius
934 || hypot(x2 - enemy[i].x, y2 - enemy[i].y) <= actor[a].radius + enemy[i].radius)
935 {
936 /* if (actor[a].x_speed == 0)
937 tangent = 1000;
938 else
939 tangent = tan(actor[a].y_speed / actor[a].x_speed);
940 */
941 switch(enemy[i].type)
942 {
943 /* case ENEMY_SWERVER:
944 case ENEMY_SWERVER2:
945 case ENEMY_SWERVER3:
946 case ENEMY_BOUNCER:
947 case ENEMY_BOUNCER2:
948 case ENEMY_BOUNCER3:
949 case ENEMY_BOUNCER4:
950 case ENEMY_BOUNCER5:
951 hurt_enemy(i, 99999, -1, 1);
952 return -1;*/
953
954 }
955
956
957 // Really dodgy collision physics...
958
959 collision_velocity = hypot(abs(actor[a].x_speed - enemy[i].x_speed), abs(actor[a].y_speed - enemy[i].y_speed));
960
961 // First calculate actor's post-collision velocity:
962 angle1 = radians_to_angle(atan2(actor[a].y_speed, actor[a].x_speed));
963 angle2 = radians_to_angle(atan2(actor[a].y - enemy[i].y, actor[a].x - enemy[i].x));
964
965 total_speed = hypot(actor[a].y_speed, actor[a].x_speed);
966
967 angle1 += ANGLE_HALF;
968 if (angle2 > ANGLE_FULL)
969 angle2 -= ANGLE_FULL;
970
971 angle2 += ANGLE_QUARTER;
972 if (angle2 > ANGLE_FULL)
973 angle2 -= ANGLE_FULL;
974
975 /* if (angle1 < angle2)
976 {
977 difference = angle2 - angle1;
978 }
979 else
980 {
981 difference = angle1 - angle2;
982 }
983
984 angle3 = angle1 - difference;*/
985
986 difference = angle2 - angle1;
987 angle3 = angle2 - difference; // or +?
988
989 xs2 = actor[a].x_speed;
990 ys2 = actor[a].y_speed;
991
992 actor[a].x_speed = cos(angle_to_radians(angle3)) * total_speed;
993 actor[a].y_speed = sin(angle_to_radians(angle3)) * total_speed;
994 // actor[a].x_speed = cos(angle_to_radians(angle3)) * total_speed;
995 // actor[a].y_speed = sin(angle_to_radians(angle3)) * total_speed;
996
997 actor[a].x_speed += (enemy[i].x_speed / 2) * 100 / actor[a].mass;
998 actor[a].y_speed += (enemy[i].y_speed / 2) * 100 / actor[a].mass;
999
1000 // Now the enemy's
1001 angle1 = radians_to_angle(atan2(enemy[i].y_speed, enemy[i].x_speed));
1002 angle2 = radians_to_angle(atan2(enemy[i].y - actor[a].y, enemy[i].x - actor[a].x));
1003
1004 total_speed = hypot(enemy[i].y_speed, enemy[i].x_speed);
1005
1006 angle1 += ANGLE_HALF;
1007 if (angle2 > ANGLE_FULL)
1008 angle2 -= ANGLE_FULL;
1009
1010 angle2 += ANGLE_QUARTER;
1011 if (angle2 > ANGLE_FULL)
1012 angle2 -= ANGLE_FULL;
1013
1014 difference = angle2 - angle1;
1015 angle3 = angle2 - difference; // or +?
1016
1017 enemy[i].x_speed = xpart(angle3, total_speed);//cos(angle_to_radians(angle3)) * total_speed;
1018 enemy[i].y_speed = ypart(angle3, total_speed);//sin(angle_to_radians(angle3)) * total_speed;
1019
1020 enemy[i].x_speed += (xs2 * 25) / enemy[i].mass * actor[a].mass / 100;
1021 enemy[i].y_speed += (ys2 * 25) / enemy[i].mass * actor[a].mass / 100;
1022
1023
1024 int sanity = 0;
1025
1026 do
1027 {
1028 actor[a].x_speed += xpart(angle2, 100);//grand(101) - 50;
1029 actor[a].y_speed += ypart(angle2, 100);//grand(101) - 50;
1030 move_actor(a);
1031 sanity ++;
1032 if (sanity >= 5000)
1033 break; // hmm
1034 } while (hypot(actor[a].x - enemy[i].x, actor[a].y - enemy[i].y) < actor[a].radius + enemy[i].radius);
1035
1036 actor[a].just_collided = 7;
1037 enemy[i].just_collided = 7;
1038
1039 if (actor[a].ship == SHIP_CURVE)
1040 {
1041 passing_colours [0] = TRANS_DGREEN;
1042 passing_colours [1] = TRANS_LGREEN;
1043 passing_colours [2] = TRANS_YELLOW;
1044
1045 place_explosion(actor[a].x, actor[a].y, 0,0,
1046 300 + crandom(150), passing_colours);
1047 blast(actor[a].x, actor[a].y, 40000, 100 + actor[a].total_power * 15, 20000, a);
1048 blast(enemy[i].x, enemy[i].y, 40000, 0, 2000, OWNER_ENEMY);
1049 play_wavf(NWAV_BURSTZ, 300 + grand(300));
1050 // blast(bullet[b].x, bullet[b].y, 30000, 200, 1200, bullet[b].owner);
1051 }
1052 else
1053 {
1054 passing_colours [0] = TRANS_DGREY;
1055 passing_colours [1] = TRANS_LGREY;
1056 passing_colours [2] = TRANS_WHITE;
1057
1058 place_explosion(actor[a].x, actor[a].y, 0,0,
1059 200 + crandom(150), passing_colours);
1060 }
1061
1062 // we cannot have any references to enemy[i] below as it may have been destroyed by the blast
1063 // call above.
1064
1065 place_explosion(actor[a].x, actor[a].y, 0,0,
1066 200 + crandom(150), passing_colours);
1067
1068 play_wavf(NWAV_BUMP, 700 + grand(800));
1069
1070 hurty = collision_velocity / 30;
1071 if (hurty > 50)
1072 hurty = 50;
1073
1074 if (check_shielder(i) == 0 && actor[a].ship != SHIP_CURVE)
1075 {
1076 hurt_enemy(i, hurty, a, 1);
1077 if (enemy[i].hurt_pulse < 4)
1078 enemy[i].hurt_pulse = 4;
1079 }
1080
1081 hurt_actor(a, a, hurty);
1082
1083 break;
1084 /*
1085 if ((angle1 < angle2 && angle2 > angle1 + ANGLE_HALF)
1086 || (angle1 > angle2 && angle2 > angle1 - ANGLE_HALF))
1087 {
1088 difference =
1089 angle -= turning;
1090 if (angle < 0)
1091 angle += ANGLE_FULL;
1092 }
1093 else
1094 {
1095 angle += turning;
1096 if (angle > ANGLE_FULL)
1097 angle -= ANGLE_FULL;
1098 }
1099 */
1100
1101 }
1102
1103 }
1104
1105 return -1;
1106
1107 }
1108
1109
1110 int detect_collision_actor_pickups(int a)
1111 {
1112
1113 int x2 = actor[a].x - actor[a].x_speed;
1114 int y2 = actor[a].y - actor[a].y_speed;
1115 int i;
1116 char destroy = 0;
1117
1118 for (i = 0; i < NO_PICKUPS; i ++)
1119 {
1120 if (pickup[i].type == PICKUP_NONE)
1121 continue;
1122
1123 if (hypot(actor[a].x - pickup[i].x, actor[a].y - pickup[i].y) <= actor[a].radius + pickup[i].radius
1124 || hypot(x2 - pickup[i].x, y2 - pickup[i].y) <= actor[a].radius + pickup[i].radius)
1125 {
1126 destroy = 1;
1127 switch(pickup[i].type)
1128 {
1129 case PICKUP_PRESYMBOL:
1130 destroy = 0;
1131 break;
1132 case PICKUP_PRESECONDARY:
1133 destroy = 0;
1134 break;
1135 case PICKUP_SECONDARY:
1136 actor[a].secondary = pickup[i].subtype;
1137 actor[a].secondary_burst = 0;
1138 actor[a].secondary_burst_recycle = 0;
1139 play_wavf(NWAV_REPAIR, 1700);
1140 break;
1141 case PICKUP_SQUARE:
1142 // gain_upgrade_points(a, 1);
1143 destroy = gain_symbol(a, pickup[i].subtype, SYMBOL_SQUARE);
1144 if (destroy)
1145 // play_soundf(WAV_PICKUP_UPGRADE, 1000);
1146 play_wavf(NWAV_SYMBOL, 1000);
1147 break;
1148 case PICKUP_TRIANGLE:
1149 destroy = gain_symbol(a, pickup[i].subtype, SYMBOL_TRIANGLE);
1150 // gain_upgrade_points(a, 2);
1151 if (destroy)
1152 play_wavf(NWAV_SYMBOL, 1700);
1153 // play_soundf(WAV_PICKUP_UPGRADE, 1500);
1154 break;
1155 case PICKUP_CIRCLE:
1156 destroy = gain_symbol(a, pickup[i].subtype, SYMBOL_CIRCLE);
1157 // gain_upgrade_points(a, 3);
1158 if (destroy)
1159 play_wavf(NWAV_SYMBOL, 1300);
1160 // play_soundf(WAV_PICKUP_UPGRADE, 2000);
1161 break;
1162 case PICKUP_REPAIR:
1163 // actor[a].armour = actor[a].max_armour;
1164 actor[a].repairing += 150; // actor[a].max_armour / 10;
1165 play_wav(NWAV_REPAIR);
1166 break;
1167 case PICKUP_GRACE:
1168 actor[a].grace_period = 333;
1169 break;
1170 case PICKUP_SHIP:
1171 extra_ship();
1172 break;
1173 }
1174 if (destroy)
1175 pickup_explodes(i, 1);
1176 }
1177
1178 }
1179
1180 return -1;
1181
1182 }
1183
1184
1185 void extra_ship(void)
1186 {
1187 if (game.ships_left <= 20)
1188 {
1189 game.ships_left ++;
1190 play_wav(NWAV_EXTRA);
1191 if (game.users == 1)
1192 {
1193 // send_message(game.single_player, "Extra!", STYLE_UPGRADE5);
1194 }
1195 else
1196 {
1197 // send_message(0, "Extra!", STYLE_UPGRADE5);
1198 // send_message(1, "Extra!", STYLE_UPGRADE5);
1199 }
1200 }
1201 }
1202
1203
1204
1205 int hurt_actor(int a, int source, int hurty)
1206 {
1207
1208 if (actor[a].in_play == 0)
1209 return 0;
1210
1211 // hurty *= 2;
1212
1213 if (game.type == GAME_DUEL && game.duel_leader_handicap > 0)
1214 {
1215 if (player[actor[a].controller].duel_score > player[actor[a].controller == 0].duel_score)
1216 {
1217 hurty *= 10 + (player[actor[a].controller].duel_score - player[actor[a].controller == 0].duel_score) * game.duel_leader_handicap;
1218 hurty /= 10;
1219 }
1220 }
1221
1222 if (actor[a].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE] > 0
1223 && actor[a].shield > 0)
1224 {
1225 if (actor[a].shield >= 20)
1226 play_wavf(NWAV_SHIELD, 400 + actor[a].shield * 2);
1227 if (hurty > actor[a].shield)
1228 {
1229 hurty -= actor[a].shield;
1230 actor[a].shield = 0;
1231 actor[a].shield_pulse = 2 + actor[a].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE];
1232 }
1233 else
1234 {
1235 // play_wavf(NWAV_SHIELD, 400 + actor[a].shield * 2);
1236 actor[a].shield -= hurty;
1237 actor[a].shield_pulse = 5 + actor[a].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE];
1238 return 0;
1239 }
1240 // play_soundf(WAV_SHIELD, 1000);
1241 }
1242
1243 // return 0;
1244 // shields go here...
1245
1246 // int passing_colours [5];
1247
1248 actor[a].hurt_pulse = 4;
1249
1250 if (hurty >= actor[a].armour)
1251 {
1252 actor[a].armour = 0;
1253 actor_explodes(a);
1254 actor_destroyed(a, source);
1255 return 0;
1256 }
1257
1258 play_wavf(NWAV_BUMP2, 900 + grand(300));
1259
1260 actor[a].armour -= hurty;
1261 return 1;
1262
1263 }
1264
1265 void actor_destroyed(int a, int source)
1266 {
1267
1268 actor[a].in_play = 0;
1269 actor[a].spawn_delay = 50;
1270 // actor[a].lock = -1;
1271 // actor[a].turret_lock = -1;
1272
1273 // actor[a].x = grand(arena.max_x - 100000) + 50000;
1274 // actor[a].y = grand(arena.max_y - 100000) + 50000;
1275 actor[a].next_spawn_x = grand(arena.max_x - 100000) + 50000;
1276 actor[a].next_spawn_y = grand(arena.max_y - 100000) + 50000;
1277
1278
1279 int e;
1280
1281 for (e = 0; e < NO_ENEMIES; e ++)
1282 {
1283 if (enemy[e].type == ENEMY_NONE)
1284 continue;
1285 if (enemy[e].attacking == a)
1286 enemy[e].attacking = ATTACK_NONE;
1287 }
1288
1289 if (game.type == GAME_DUEL)
1290 {
1291 score_duel_kill(a, source);
1292 return;
1293 }
1294
1295 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
1296 {
1297 arena.time_left -= 33.333 * 30;
1298 if (arena.time_left < 1)
1299 arena.time_left = 1;
1300 return;
1301 }
1302
1303
1304 if (game.ships_left == 0)
1305 {
1306 if (game.users == 1)
1307 game_is_over();
1308 else
1309 {
1310 if (actor[0].in_play == 0 && actor[1].in_play == 0)
1311 game_is_over();
1312 }
1313 }
1314
1315 }
1316
1317 void game_is_over(void)
1318 {
1319 arena.game_over = 132;
1320 }
1321
1322
1323 void score_duel_kill(int a, int source)
1324 {
1325 if (arena.game_over > 0)
1326 return;
1327
1328 if (a == source || source == OWNER_ENEMY)
1329 {
1330 if (player[actor[a].controller].duel_score > 0)
1331 player[actor[a].controller].duel_score --;
1332 return;
1333 }
1334
1335 int p = actor[source].controller;
1336
1337 player[p].duel_score ++;
1338
1339 if ((player[p].duel_score >= 10 && game.duel_mode == DUEL_10_POINTS)
1340 || (player[p].duel_score >= 30 && game.duel_mode == DUEL_30_POINTS))
1341 {
1342 game.duel_winner = p;
1343 arena.game_over = 132;
1344 }
1345
1346 }
1347
1348
1349
1350 void actor_explodes(int a)
1351 {
1352
1353 int passing_colours [5];
1354
1355 passing_colours[0] = TRANS_DRED;
1356 passing_colours[1] = TRANS_LRED;
1357 passing_colours[2] = TRANS_YELLOW;
1358
1359 place_explosion(actor[a].x, actor[a].y, 0,0,//actor[a].x_speed, actor[a].y_speed,
1360 1500 + crandom(250), passing_colours);
1361 place_burstlet_burst(actor[a].x, actor[a].y, 0, 0, 4 + grand(3), 2, 6, 1000, 1500,
1362 4, passing_colours);
1363
1364 int i;
1365
1366 if (actor[a].sidekicks != 0)
1367 {
1368 for (i = 0; i < actor[a].sidekicks; i ++)
1369 {
1370 place_explosion(actor[a].sidekick_x [i], actor[a].sidekick_y [i], 0,0,
1371 500 + crandom(250), passing_colours);
1372 place_burstlet_burst(actor[a].sidekick_x [i], actor[a].sidekick_y [i], 0, 0, 2 + grand(3), 2, 6, 1000, 1500,
1373 4, passing_colours);
1374 }
1375 actor[a].sidekicks = 0;
1376 }
1377
1378 kill_drive_sounds();
1379 play_wavf(NWAV_BLAST, 500 + grand(200));
1380
1381 }
1382
1383
1384 // called at start of each game
1385 void init_actor(int a, int type)
1386 {
1387 int i,j;
1388
1389 actor[a].type = ACTORTYPE_SHIP; // redundant
1390 actor[a].ship = type;
1391 actor[a].radius = 9000;
1392 actor[a].edge_radius = 5000;
1393 // actor[a].turning = 70; now calculated dynamically
1394 actor[a].thrust = 0;
1395 actor[a].slide = 50;
1396 actor[a].mass = 100;
1397 actor[a].x = grand(494000) + 50000;
1398 actor[a].y = grand(495000) + 50000;
1399 actor[a].next_spawn_x = actor[a].x;
1400 actor[a].next_spawn_y = actor[a].y;
1401
1402 for (i = 0; i < 4; i ++)
1403 {
1404 for (j = 0; j < 4; j ++)
1405 {
1406 actor[a].ability [i] [j] = 0;
1407 }
1408 }
1409
1410 actor[a].total_power = 0;
1411
1412 // for (j = 0; j < NO_UPGRADES; j ++)
1413 // {
1414 // actor[a].upgrades [j] = 0;
1415 // actor[a].upgrade_specials [j] = 0;
1416 // }
1417 // for (j = 0; j < MAX_UPGRADES; j ++)
1418 // {
1419 //actor[a].upgraded_system [j] = 0;
1420 // }
1421 // for (j = 0; j < 9; j ++)
1422 // {
1423 // actor[a].upgrade_structure [j] = upgrades [actor[a].ship] [j];
1424 // actor[a].upgrade_specials [j] = 0;
1425 // }
1426 /* actor[a].upgrade_structure [0] = UPG_NONE;
1427 actor[a].upgrade_structure [1] = UPG_SPEED;
1428 actor[a].upgrade_structure [2] = UPG_SLIDE;
1429 actor[a].upgrade_structure [3] = UPG_RETRO;
1430 actor[a].upgrade_structure [4] = UPG_SIDEKICK;
1431 actor[a].upgrade_structure [5] = UPG_ROCKET;
1432 actor[a].upgrade_structure [6] = UPG_PROJECT;
1433 actor[a].upgrade_structure [7] = UPG_WARHEAD;
1434 actor[a].upgrade_structure [8] = UPG_SPECIAL;*/
1435 actor[a].upgrade_slot = 0;
1436 actor[a].brakes = BRAKES_DRAG;
1437 actor[a].brake_strength = 5;
1438 actor[a].max_armour = 1000;
1439 if (game.type == GAME_DUEL)
1440 {
1441 actor[a].max_armour = duel_armour(actor[a].max_armour, game.duel_handicap [actor[a].controller]);
1442 }
1443 actor[a].armour = actor[a].max_armour;
1444 actor[a].max_shield = 0;
1445 actor[a].shield = 0;
1446 actor[a].spawn_delay = 50;
1447 actor[a].grace_period = 0;
1448 actor[a].secondary = SECOND_NONE;//D_ORB;//SECONDARY_NONE;
1449 actor[a].sidekicks = 0;
1450
1451 // actor[a].exhaust_distance_x = 14;
1452 // actor[a].exhaust_distance_y = 15;
1453 actor[a].exhaust_distance_x = 10;
1454 actor[a].exhaust_distance_y = 10;
1455 actor[a].flash_distance = 5000;
1456
1457 switch(actor[a].ship)
1458 {
1459 case SHIP_SMALL:
1460 actor[a].radius = 7000;
1461 actor[a].edge_radius = 3000;
1462 actor[a].exhaust_distance_x = 7;
1463 actor[a].exhaust_distance_y = 7;
1464 break;
1465 case SHIP_HORSESHOE:
1466 actor[a].exhaust_distance_x = 4;
1467 actor[a].exhaust_distance_y = 4;
1468 break;
1469 case SHIP_FINS:
1470 actor[a].exhaust_distance_x = 9;
1471 actor[a].exhaust_distance_y = 9;
1472 break;
1473 case SHIP_RETRO:
1474 actor[a].exhaust_distance_x = 9;
1475 actor[a].exhaust_distance_y = 9;
1476 break;
1477 case SHIP_ROUND:
1478 actor[a].exhaust_distance_x = 9;
1479 actor[a].exhaust_distance_y = 9;
1480 break;
1481 case SHIP_ORBITAL:
1482 actor[a].exhaust_distance_x = 1;
1483 actor[a].exhaust_distance_y = 1;
1484 actor[a].mass = 400;
1485 break;
1486 case SHIP_CURVE:
1487 actor[a].exhaust_distance_x = 3;
1488 actor[a].exhaust_distance_y = 3;
1489 break;
1490
1491 /*
1492 case SHIP_LACEWING:
1493 actor[a].exhaust_distance_x = 1;
1494 actor[a].exhaust_distance_y = 0;
1495 actor[a].flash_distance = 4000;
1496 break;
1497 case SHIP_AETHER:
1498 actor[a].exhaust_distance_x = 1;
1499 actor[a].exhaust_distance_y = 0;
1500 actor[a].flash_distance = 7000;
1501 break;
1502 case SHIP_DESPOT:
1503 actor[a].exhaust_distance_x = 1;
1504 actor[a].exhaust_distance_y = 0;
1505 break;
1506 case SHIP_CAPYBARA:
1507 actor[a].exhaust_distance_x = 6;
1508 actor[a].exhaust_distance_y = 5;
1509 actor[a].flash_distance = 6000;
1510 break;
1511 case SHIP_LENTIL:
1512 actor[a].exhaust_distance_x = 6;
1513 actor[a].exhaust_distance_y = 5;
1514 break;
1515 case SHIP_HOOKWORM:
1516 actor[a].exhaust_distance_x = 8;
1517 actor[a].exhaust_distance_y = 7;
1518 actor[a].flash_distance = 3000;
1519 break;
1520 case SHIP_PORKUPINE:
1521 actor[a].exhaust_distance_x = 8;
1522 actor[a].exhaust_distance_y = 7;
1523 actor[a].flash_distance = 4000;
1524 break;
1525 case SHIP_SCORPION:
1526 actor[a].exhaust_distance_x = 4;
1527 actor[a].exhaust_distance_y = 3;
1528 actor[a].flash_distance = 4000;
1529 break;
1530 case SHIP_TORTFEASOR:
1531 actor[a].exhaust_distance_x = 4;
1532 actor[a].exhaust_distance_y = 3;
1533 actor[a].flash_distance = 9000;
1534 break;
1535 case SHIP_RUMSFELD:
1536 actor[a].exhaust_distance_x = 4;
1537 actor[a].exhaust_distance_y = 3;
1538 break;
1539 case SHIP_PRONG:
1540 actor[a].flash_distance = 1000;
1541 break;
1542 case SHIP_GODBOTHERER:
1543 actor[a].exhaust_distance_x = 3;
1544 actor[a].exhaust_distance_y = 2;
1545 actor[a].flash_distance = 5000;
1546 break;
1547 case SHIP_BOTULUS:
1548 actor[a].exhaust_distance_x = 3;
1549 actor[a].exhaust_distance_y = 2;
1550 actor[a].flash_distance = 6000;
1551 break;
1552 case SHIP_SLIDEWINDER:
1553 actor[a].exhaust_distance_x = 1;
1554 actor[a].exhaust_distance_y = 0;
1555 actor[a].flash_distance = 4000;
1556 break;
1557 case SHIP_DOOM:
1558 actor[a].exhaust_distance_x = 7;
1559 actor[a].exhaust_distance_y = 6;
1560 actor[a].flash_distance = 8000;
1561 break;
1562 */
1563 }
1564
1565
1566 actor[a].retro_distance_x = 5;
1567 actor[a].retro_distance_y = 4;
1568 actor[a].slide_distance_x = 5;
1569 actor[a].slide_distance_y = 4;
1570 // actor[a].exhaust_displacement = 0;
1571
1572 actor[a].primary = WPN_DARTS;
1573 }
1574
1575 int duel_armour(int armour, int h)
1576 {
1577 switch(h)
1578 {
1579 default:
1580 armour *= 100;
1581 break;
1582 case 0:
1583 armour *= 75;
1584 break;
1585 case 1:
1586 armour *= 100;
1587 break;
1588 case 2:
1589 armour *= 120;
1590 break;
1591 case 3:
1592 armour *= 150;
1593 break;
1594 }
1595 armour /= 100;
1596
1597 return armour;
1598 }
1599
1600
1601 void calulate_total_power(int a)
1602 {
1603 int i, j;
1604
1605 actor[a].total_power = 0;
1606
1607 for (i = 0; i < 4; i ++)
1608 {
1609 for (j = 0; j < 4; j ++)
1610 {
1611 actor[a].total_power += actor[a].ability [i] [j];
1612 }
1613 }
1614 }
1615
1616
1617 // called when an actor spawns after being destroyed
1618 void spawn_actor(int a)
1619 {
1620
1621 actor[a].in_play = 1;
1622 // actor[a].x = arena.max_x / 2; //grand(arena.max_x - 100000) + 50000;
1623 // actor[a].y = arena.max_y / 2; //grand(arena.max_y - 100000) + 50000;
1624 actor[a].x = actor[a].next_spawn_x;
1625 actor[a].y = actor[a].next_spawn_y;
1626
1627 int passing_colours [5];
1628
1629 passing_colours [0] = COLOUR_WHITE;
1630
1631 create_cloud(CLOUD_SHRINKING_CIRCLE,
1632 actor[a].x,
1633 actor[a].y,
1634 0, 0,
1635 0, 0,
1636 500, -300, 10, 0, 0, 0, passing_colours);
1637
1638 passing_colours [0] = TRANS_DBLUE;
1639 passing_colours [1] = TRANS_LBLUE;
1640 passing_colours [2] = TRANS_WHITE;
1641
1642 place_explosion(actor[a].x, actor[a].y, 0,0,
1643 700 + crandom(250), passing_colours);
1644
1645
1646 /* actor[a].x_speed = 0;
1647 actor[a].y_speed = 0;
1648 actor[a].angle = 0;
1649 actor[a].base_angle = 0;
1650 actor[a].dragging = 0;
1651 actor[a].drag_amount = 0;
1652 // actor[a].in_play = 0;
1653 actor[a].moving_angle = actor[0].angle;
1654 actor[a].just_collided = 0;
1655
1656 // actor[a].recharge = ships[ship].recharge;
1657 actor[a].just_upgraded = 0;
1658 actor[a].just_upgraded_timeout = 0;
1659 actor[a].shield_pulse = 0;
1660 actor[a].recycle1 = 0;
1661 actor[a].recycle2 = 0;
1662 actor[a].heavy_recycle = 0;
1663 actor[a].turret_recycle = 0;
1664 actor[a].backfire_recycle = 0;
1665 actor[a].cannon_status = 0;
1666 actor[a].orbital_angle = 0;
1667 actor[a].bomb_status = 0;
1668 actor[a].upgrade_slot = 0;
1669 actor[a].spawn_delay = 0;
1670 actor[a].grace_period = 169;
1671 actor[a].armour = actor[a].max_armour;
1672 actor[a].max_shield = 0;
1673 actor[a].shield = 0;
1674 actor[a].lock = -1;
1675 actor[a].turret_lock = -1;*/
1676
1677 reset_actor(a);
1678
1679 actor[a].secondary = SECOND_NONE; // not in reset_actor as we want to retain this between levels.
1680
1681 actor[a].sidekicks = 0;
1682 // if (actor[a].upgraded_system [UPG_SIDEKICK] > 0)
1683 // upgrade_sidekicks(a);
1684
1685 play_wavf(NWAV_SPAWN, 800);
1686
1687 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP || game.type == GAME_DUEL)
1688 {
1689 calculate_beat();
1690 }
1691
1692 if (game.type != GAME_DUEL && game.type != GAME_TIME_ATTACK && game.type != GAME_TIME_ATTACK_COOP)
1693 game.ships_left --;
1694 }
1695
1696 void actor_new_level(int a)
1697 {
1698
1699 actor[a].in_play = 1;
1700 // actor[a].x = arena.max_x / 2; //grand(arena.max_x - 100000) + 50000;
1701 // actor[a].y = arena.max_y / 2; //grand(arena.max_y - 100000) + 50000;
1702 actor[a].x = grand(arena.max_x - 100000) + 50000;
1703 actor[a].y = grand(arena.max_y - 100000) + 50000;
1704 actor[a].next_spawn_x = actor[a].x;
1705 actor[a].next_spawn_y = actor[a].y;
1706
1707 // actor[a].sidekicks = 0;
1708 // if (actor[a].upgraded_system [UPG_SIDEKICK] > 0)
1709 // upgrade_sidekicks(a);
1710
1711 reset_actor(a);
1712
1713 }
1714
1715
1716 void reset_actor(int a)
1717 {
1718 int j;
1719
1720 actor[a].x_speed = 0;
1721 actor[a].y_speed = 0;
1722 actor[a].angle = 0;
1723 actor[a].base_angle = 0;
1724 actor[a].dragging = 0;
1725 actor[a].drag_amount = 0;
1726 actor[a].moving_angle = actor[0].angle;
1727 actor[a].just_collided = 0;
1728 actor[a].lock = -1;
1729
1730 actor[a].just_upgraded = 0;
1731 actor[a].just_upgraded_timeout = 0;
1732 actor[a].shield_pulse = 0;
1733 actor[a].recycle1 = 0;
1734 actor[a].recycle2 = 0;
1735 actor[a].heavy_recycle = 0;
1736 actor[a].turret_recycle = 0;
1737 actor[a].backfire_recycle = 0;
1738 actor[a].sidekick_recycle = 0;
1739 actor[a].orbital_angle = 0;
1740 actor[a].lock = -1;
1741 actor[a].turret_lock = -1;
1742 actor[a].cannon_status = 0;
1743 actor[a].bomb_status = 0;
1744 // actor[a].upgrade_slot = 0;
1745 actor[a].spawn_delay = 0;
1746 actor[a].grace_period = 169;
1747 actor[a].repairing = 0;
1748 actor[a].armour = actor[a].max_armour;
1749 actor[a].max_shield = 0;
1750 actor[a].shield = 0;
1751 actor[a].shield_recharge = 0;
1752 actor[a].hurt_pulse = 0;
1753 actor[a].secondary_burst = 0;
1754 actor[a].secondary_burst_recycle = 0;
1755 actor[a].screen_shake_time = 0;
1756
1757 for (j = 0; j < 5; j ++)
1758 {
1759 actor[a].sidekick_x [j] = actor[a].x;
1760 actor[a].sidekick_y [j] = actor[a].y;
1761 actor[a].sidekick_x_speed [j] = 0;
1762 actor[a].sidekick_y_speed [j] = 0;
1763 }
1764
1765 actor[a].drive_sound [DRIVE_THRUST] = 0;
1766 actor[a].drive_sound [DRIVE_SLIDE] = 0;
1767 actor[a].drive_sound [DRIVE_RETRO] = 0;
1768 actor[a].thrust = 0;
1769
1770 }
1771
1772
1773 void gain_score(int p, int sc)
1774 {
1775 if (arena.game_over > 0)
1776 return;
1777 if (game.type == GAME_DUEL)
1778 return;
1779
1780 int old_score = player[p].score;
1781 player[p].score += sc;
1782 if (player[p].score > MAX_SCORE)
1783 player[p].score = MAX_SCORE;
1784
1785 /* if (game.type != GAME_COOP)
1786 {
1787 if (old_score < 1000 && player[p].score >= 1000)
1788 extra_ship();
1789 }*/
1790
1791 if (old_score < 1000 && player[p].score >= 1000)
1792 extra_ship();
1793
1794 // if (old_score < 5000 && player[p].score >= 5000)
1795 // extra_ship();
1796
1797 // if (old_score < 10000 && player[p].score > 10000)
1798 // extra_ship();
1799
1800 if (old_score / 5000 != player[p].score / 5000)
1801 extra_ship();
1802
1803 }
1804
1805
1806
1807 void shake_all_screens(int amount)
1808 {
1809
1810 actor[0].screen_shake_time += amount;
1811 if (actor[0].screen_shake_time > 15)
1812 actor[0].screen_shake_time = 15;
1813 actor[1].screen_shake_time += amount;
1814 if (actor[1].screen_shake_time > 15)
1815 actor[1].screen_shake_time = 15;
1816
1817 }
0
1
2 void run_actors(void);
3 void gain_upgrade_points(int who, int how_many);
4 int hurt_actor(int a, int source, int hurty);
5 void init_actor(int a, int type);
6 void spawn_actor(int a);
7 void actor_new_level(int a);
8 int acquire_target(int a);
9 int closest_enemy(int x, int y, int range, int hide_invisible);
10 int closest_enemy_or_actor(int a, int x, int y, int range, int hide_invisible);
11 void gain_score(int p, int sc);
12 void shake_all_screens(int amount);
13
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: bullet.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - functions relating to bullets and dangerous projectiles
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36
37 #include "config.h"
38 #include "globvars.h"
39
40 #include "stuff.h"
41 #include "cloud.h"
42 #include "enemy.h"
43 #include "actor.h"
44 #include "sound.h"
45 #include "light.h"
46 #include "stuff.h"
47 #include "display.h"
48
49 #include "palette.h"
50
51 #ifdef SANITY_CHECK
52 extern FONT *small_font;
53 #endif
54
55 extern int var1, var2, var3; // debug display vars, externed as necessary
56
57
58 int create_bullet(int type, int x, int y,
59 int x_speed, int y_speed, int owner,
60 int damage, int timer, int mass, int angle,
61 int status, int size, int colours [4], int speed_div,
62 int special1, int special2, int special3, int special4, int special5);
63
64
65 void manage_bullet(int b);
66 int move_bullet(int mbull, char limited);
67 int detect_collision(int b, int things [2]);
68 int detect_enemy_collision(int b, int things [2]);
69 void bullet_impact(int b, int k, int hit_what);
70
71 void destroy_bullet(int b);
72 //void apply_force_to_actor(int a, int fx, int fy);
73 //void apply_force_to_enemy(int e, int fx, int fy);
74
75 void blast(int x, int y, int radius, int damage, int force, int owner);
76
77 void drag_bullet(int b, float drag_amount);
78
79 extern int inflicteda, inflictede;
80
81 int enemy_bullet_track_target(int b, int attacking, int turning);
82
83 int closest_target(int x, int y);
84 int nearby_target(int range, int x, int y);
85
86 void bullet_sound(int b, int sound);
87 void bullet_soundf(int b, int sound, int freq);
88 void bullet_soundvf(int b, int sound, int vol, int freq);
89 void enemy_sparks(int e, int b, int bx, int by, int bxs, int bys, int damage);
90
91 void shield_line(int e, int bx, int by);
92 void shielder_pulse(int e, int dam);
93 int check_shielder(int e);
94
95 void line_blast(int x, int y, int type, int target);
96 void teleport_actor(int a);
97 int clear_space(int x, int y, int rad);
98 int radius_effect(int x, int y, int radius, int effect);
99
100 void actor_in_beam(int i, int angle, int damage, int force, int colour1, int colour2);
101
102 enum
103 {
104 RADEFFECT_TELEPORT,
105 RADEFFECT_MAX
106 };
107
108 enum
109 {
110 BSOUND_BOMB,
111 BSOUND_MISSILE,
112 BSOUND_MINE,
113 BSOUND_SEEKMINE,
114 BSOUND_ORBITAL,
115 BSOUND_SEEKBLOB_BANG1,
116 BSOUND_SEEKBLOB_BANG2,
117 BSOUND_TUBE,
118 BSOUND_MINE2,
119 BSOUND_HIT
120 };
121
122 enum
123 {
124 HIT_NOTHING,
125 HIT_ACTOR,
126 HIT_ENEMY,
127 HIT_EDGE,
128 HIT_WAVE
129 };
130
131
132 void init_bullets(void)
133 {
134
135 int b;
136
137 for (b = 0; b < NO_BULLETS; b++)
138 {
139 bullet[b].type = BULLET_NONE;
140 }
141
142 }
143
144 /*
145 If this function is crashing mysteriously, it's probably being called
146 with a zero value for speed_div.
147 */
148 int create_bullet(int type, int x, int y,
149 int x_speed, int y_speed, int owner,
150 int damage, int timer, int mass, int angle,
151 int status, int size, int colours [4], int speed_div,
152 int special1, int special2, int special3, int special4, int special5)
153 {
154
155 #ifdef SANITY_CHECK
156 if (type <= BULLET_NONE || speed_div <= 0)
157 {
158 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
159 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "create_bullet %i %i", type, speed_div);
160 rest(1000);
161 // exit(type);
162 }
163 #endif
164
165
166 if (owner < -1 || owner >= NO_ACTORS)
167 return -1;
168
169 int b = 0;
170
171 for (b = 1; b < NO_BULLETS; b++)
172 {
173 /* if ((bullet_type == BULLET_SPARK || bullet_type == BULLET_SPECK)
174 && bcounter > MAX_BULLETS / 2)
175 return -1; // these bullets just for decoration*/
176 if (b == NO_BULLETS - 1) return -1;
177 if (bullet[b].type == BULLET_NONE) break;
178 }
179
180 bullet[b].type = type;
181 // bullet[b].x = x + (x_speed - actor[owner].x_speed);
182 // bullet[b].y = y + (y_speed - actor[owner].y_speed);
183 if (owner == OWNER_ENEMY)
184 {
185 bullet[b].x = x + (x_speed / speed_div);
186 bullet[b].y = y + (y_speed / speed_div);
187 }
188 else
189 {
190 bullet[b].x = x + (x_speed - actor[owner].x_speed) / speed_div;
191 bullet[b].y = y + (y_speed - actor[owner].y_speed) / speed_div;
192 // bullet[b].x = x + (x_speed) / speed_div;
193 // bullet[b].y = y + (y_speed) / speed_div;
194 }
195 bullet[b].x2 = x;
196 bullet[b].y2 = y;
197 bullet[b].x_speed = x_speed;
198 bullet[b].y_speed = y_speed;
199 bullet[b].owner = owner;
200 bullet[b].size = size;
201 bullet[b].timeout = timer;
202 // bullet[b].status = status;
203 bullet[b].damage = damage;
204 bullet[b].left_owner = 0;
205 bullet[b].mass = mass;
206 bullet[b].angle = angle;
207 bullet[b].colours [0] = colours [0];
208 bullet[b].colours [1] = colours [1];
209 bullet[b].colours [2] = colours [2];
210 bullet[b].colours [3] = colours [3];
211 bullet[b].special1 = special1;
212 bullet[b].special2 = special2;
213 bullet[b].special3 = special3;
214 bullet[b].special4 = special4;
215 bullet[b].special5 = special5;
216
217 switch(type)
218 {
219 case BULLET_PANIC_EEL:
220 if (grand(2) == 0)
221 bullet[b].special2 *= -1;
222 bullet[b].special3 = 3 + grand(2);
223 break;
224 case BULLET_CURVE:
225 if (grand(2) == 0)
226 bullet[b].angle = angle + ANGLE_HALF;
227 // else
228 // bullet[b].angle = angle - ANGLE_QUARTER;
229 bullet[b].angle %= ANGLE_FULL;
230 if (grand(10) == 0)
231 bullet[b].angle = grand(ANGLE_FULL);
232 break;
233 case BULLET_TORPEDO2:
234 bullet[b].x_speed = 0;
235 bullet[b].y_speed = 0;
236 break;
237
238 }
239
240 return b;
241
242 }
243
244
245
246 void run_bullets(void)
247 {
248
249 int b;
250
251 for (b = 1; b < NO_BULLETS; b++)
252 {
253 if (bullet[b].type != BULLET_NONE) manage_bullet(b);
254 }
255
256 }
257
258
259 void manage_bullet(int b)
260 {
261
262 // int x_gain = 0;
263 // int y_gain = 0;
264 // char angle_change;
265
266 int cx, cy, xa, ya, xb;
267 int c2x, c2y;
268
269 int passing_colour [5];
270
271 if (bullet[b].left_owner < 100)
272 bullet[b].left_owner ++;
273 if (bullet[b].timeout > 0)
274 {
275 bullet[b].timeout --;
276 if (bullet[b].timeout <= 0)
277 {
278 bullet_impact(b, -1, HIT_NOTHING);
279 return;
280 }
281 }
282
283 switch(bullet[b].type)
284 {
285 case BULLET_TOXIC_SUN:
286 drag_bullet(b, 0.08);
287 bullet[b].special2 --;
288 if (bullet[b].special2 <= 0)
289 {
290 cx = bullet[b].angle + grand(75) - grand(75) - ANGLE_QUARTER;
291 create_bullet(BULLET_TOXIC_FLARE,
292 bullet[b].x - xpart(cx, bullet[b].special4), bullet[b].y - ypart(cx, bullet[b].special4),
293 xpart(cx, bullet[b].special4 + grand(3000)), ypart(cx, bullet[b].special4 + grand(3000)),
294 bullet[b].owner,
295 bullet[b].special1, 30 + grand(10), 10, cx, 0, 0, bullet[b].colours, 1,
296 0, 0, 0, 0, 0);
297 bullet[b].special2 = 3;
298 bullet_soundvf(b, NWAV_JET, 100, 300 + grand(100) + bullet[b].special4 / 500);
299 }
300 passing_colour [0] = TRANS_YELLOW; //bullet[b].colours [0];
301 passing_colour [1] = TRANS_LGREEN; //bullet[b].colours [1];
302 passing_colour [2] = TRANS_DGREEN; //bullet[b].colours [2];
303 passing_colour [3] = TRANS_DGREY; //bullet[b].colours [3];
304 cx = grand(ANGLE_FULL);
305 create_cloud(CLOUD_BLAST_CIRCLE,
306 bullet[b].x + xpart(cx, 4000 + grand(7000)),
307 bullet[b].y + ypart(cx, 4000 + grand(7000)),
308 0, 0,
309 bullet[b].x_speed, bullet[b].y_speed,
310 25 + grand(10), 1, 1, 0, 0, 0, passing_colour);
311 break;
312 case BULLET_TOXIC_FLARE:
313 passing_colour [0] = TRANS_YELLOW; //bullet[b].colours [0];
314 passing_colour [1] = TRANS_LGREEN; //bullet[b].colours [1];
315 passing_colour [2] = TRANS_DGREEN; //bullet[b].colours [2];
316 passing_colour [3] = TRANS_DGREY; //bullet[b].colours [3];
317 create_cloud(CLOUD_BLAST_CIRCLE,
318 bullet[b].x + grand(5001) - 2500,
319 bullet[b].y + grand(5001) - 2500,
320 0, 0,
321 bullet[b].x_speed, bullet[b].y_speed,
322 25 + grand(10), 1, 1, 0, 0, 0, passing_colour);
323 break;
324 // case BULLET_NUMEROUS_BLADE:
325 case BULLET_SLIVER:
326 // drag_bullet(b, 0.03);
327 bullet[b].special1 += bullet[b].special2;
328 bullet[b].special1 &= 1023;
329 break;
330 case BULLET_EVIL_STAR:
331 case BULLET_FROZEN_STAR:
332 drag_bullet(b, 0.05);
333 // add_light(LIGHT_NORMAL, 2 + grand(3), bullet[b].x + bullet[b].x_speed, bullet[b].y + bullet[b].y_speed);
334 break;
335 case BULLET_ZAP_DRAG:
336 drag_bullet(b, 0.06);
337 if (bullet[b].special1 < 2)
338 {
339 bullet[b].x2 = bullet[b].x;
340 bullet[b].y2 = bullet[b].y;
341 bullet[b].special1 ++;
342 }
343 else
344 {
345 bullet[b].x2 = bullet[b].x - bullet[b].x_speed * 2;
346 bullet[b].y2 = bullet[b].y - bullet[b].y_speed * 2;
347 }
348 if (abs(bullet[b].x_speed) + abs(bullet[b].y_speed) > 500)
349 bullet[b].timeout = 3;
350 break;
351 case BULLET_ICE_DART:
352 case BULLET_ICE_DART_SMALL:
353 drag_bullet(b, 0.09);
354 break;
355 case BULLET_SNOW_DART:
356 case BULLET_SNOW_DART_SMALL:
357 if (grand(3) == 0)
358 {
359 passing_colour[0] = COLOUR_GREY5;
360 passing_colour[1] = COLOUR_BLUE8;
361 passing_colour[2] = COLOUR_BLUE6;
362 passing_colour[3] = COLOUR_BLUE4;
363 passing_colour[4] = COLOUR_BLUE2;
364 create_cloud(CLOUD_SPECK, bullet[b].x + grand(2001) - 1000, bullet[b].y + grand(2001) - 1000,
365 0, 0, 0, 0, 24, 1,
366 0, 0, 0, 0, passing_colour);
367 }
368 drag_bullet(b, 0.09);
369 break;
370 case BULLET_FROZEN_BREATH:
371 if (grand(2) == 0)
372 create_cloud(CLOUD_BLUE_BLOB,
373 bullet[b].x + grand(2001) - 1000,
374 bullet[b].y + grand(2001) - 1000,
375 0, 0, 0, 0, 2 + crandom(10),1 + grand(2),0, 0, 0, 0, passing_colour);
376 drag_bullet(b, 0.09);
377 break;
378 case BULLET_BURNING_DRAGGED:
379 drag_bullet(b, 0.04);
380 case BULLET_BURNING_SPIRIT:
381 if (grand(2) == 0)
382 create_cloud(CLOUD_ORANGE_BLOB,
383 bullet[b].x + grand(2001) - 1000,
384 bullet[b].y + grand(2001) - 1000,
385 0, 0, 0, 0, 2 + crandom(10),1 + grand(2),0, 0, 0, 0, passing_colour);
386 // add_light(LIGHT_NORMAL, 7, bullet[b].x + bullet[b].x_speed, bullet[b].y + bullet[b].y_speed);
387 break;
388 case BULLET_BURST:
389 create_cloud(CLOUD_ORANGE_BLOB,
390 bullet[b].x + grand(2001) - 1000,
391 bullet[b].y + grand(2001) - 1000,
392 0, 0, 0, 0, 2 + crandom(10),1 + grand(2),0, 0, 0, 0, passing_colour);
393 break;
394 case BULLET_PUFFY3:
395 create_cloud(CLOUD_GREEN_BLOB,
396 bullet[b].x + grand(2001) - 1000,
397 bullet[b].y + grand(2001) - 1000,
398 0, 0, 0, 0, 2 + crandom(10),1 + grand(2),0, 0, 0, 0, passing_colour);
399 break;
400 case BULLET_PUFFY4:
401 create_cloud(CLOUD_BLUE_BLOB,
402 bullet[b].x + grand(2001) - 1000,
403 bullet[b].y + grand(2001) - 1000,
404 0, 0, 0, 0, 2 + crandom(10),1 + grand(2),0, 0, 0, 0, passing_colour);
405 break;
406 case BULLET_GREEN_BLAT:
407 case BULLET_BLUE_BLAT:
408 /* if (grand(2) == 0)
409 create_cloud(CLOUD_GREEN_BLOB,
410 bullet[b].x + grand(2001) - 1000,
411 bullet[b].y + grand(2001) - 1000,
412 0, 0, 0, 0, 2 + crandom(10),1 + grand(2),0, 0, 0, 0, passing_colour);*/
413 drag_bullet(b, 0.07);
414 break;
415 case BULLET_FLOWER:
416 drag_bullet(b, 0.1);
417 break;
418 case BULLET_PETAL1:
419 add_light(LIGHT_NORMAL, 12 + (bullet[b].special2 / 3) + grand(4), bullet[b].x, bullet[b].y);
420 drag_bullet(b, 0.03);
421 passing_colour [0] = bullet[b].colours [0];
422 passing_colour [1] = bullet[b].colours [1];
423 passing_colour [2] = bullet[b].colours [2];
424 passing_colour [3] = bullet[b].colours [3];
425 create_cloud(CLOUD_BLAST_CIRCLE,
426 bullet[b].x + grand(6000) - 3000,
427 bullet[b].y + grand(6000) - 3000,
428 0, 0,
429 bullet[b].x_speed,
430 bullet[b].y_speed,
431 30 + grand(20), 3, 0, 0, 10 + grand(10), 0, passing_colour);
432 break;
433 case BULLET_WORM_SORROW:
434 case BULLET_WORM_AGONY:
435 passing_colour [0] = bullet[b].colours [0];
436 passing_colour [1] = bullet[b].colours [1];
437 passing_colour [2] = bullet[b].colours [2];
438 passing_colour [3] = bullet[b].colours [3];
439 create_cloud(CLOUD_FADING_LINE,
440 bullet[b].x - bullet[b].x_speed,
441 bullet[b].y - bullet[b].y_speed,
442 bullet[b].x,
443 bullet[b].y,
444 0,
445 0,
446 10, 2,0, 0, 0, 0, passing_colour);
447 if ((bullet[b].timeout == 143 + bullet[b].special5)|| (bullet[b].special3 == -1 && bullet[b].timeout % 5 == 0))
448 {
449 if (game.type == GAME_DUEL)
450 {
451 bullet[b].special3 = closest_enemy_or_actor(bullet[b].owner, bullet[b].x, bullet[b].y,
452 500000, 1);
453 }
454 else
455 bullet[b].special3 = closest_enemy(bullet[b].x, bullet[b].y, 1000000, 1);
456 if (bullet[b].timeout == 143)
457 bullet[b].timeout -= grand(10);
458 }
459
460 if (bullet[b].special3 == LOCK_ACTOR0 || bullet[b].special3 == LOCK_ACTOR1)
461 {
462
463 if (bullet[b].special3 == LOCK_ACTOR0)
464 cx = 0;
465 else
466 cx = 1;
467 if (hypot(bullet[b].y - actor[cx].y, bullet[b].x - actor[cx].x)
468 < 30000)
469 // < 5000)
470 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x, actor[cx].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
471 else
472 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x + (actor[cx].x_speed * bullet[b].special5), actor[cx].y + (actor[cx].y_speed * bullet[b].special5), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
473 }
474 else
475 if (bullet[b].special3 >= 0)
476 {
477 // destroyed enemies have locks cleared in register_destroyed (enemy.c)
478 if (hypot(bullet[b].y - enemy[bullet[b].special3].y, bullet[b].x - enemy[bullet[b].special3].x)
479 < 30000)
480 // < 5000)
481 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, enemy[bullet[b].special3].x, enemy[bullet[b].special3].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
482 else
483 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, enemy[bullet[b].special3].x + (enemy[bullet[b].special3].x_speed * bullet[b].special5), enemy[bullet[b].special3].y + (enemy[bullet[b].special3].y_speed * bullet[b].special5), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
484 // What this does: if missile is close to enemy, heads straight for it.
485 // Otherwise, leads it slightly (to an extent specified by bullet[b].special5)
486 // For this reason, enemy[].x_speed must be set correctly even for enemies for whom it's irrelevant
487 // (eg crawlers). <--- old lacewing stuff
488 if ((enemy[bullet[b].special3].type == ENEMY_SHADOW1 || enemy[bullet[b].special3].type == ENEMY_SHADOW2)
489 && enemy[bullet[b].special3].attribute [0] == 0)
490 bullet[b].special3 = -1;
491 }
492 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
493 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
494 c2x = (cx * bullet[b].special1) / GRAIN;
495 c2y = (cy * bullet[b].special1) / GRAIN;
496 bullet[b].x_speed += c2x;
497 bullet[b].y_speed += c2y;
498 // drag_bullet(b, 0.07);
499 if (bullet[b].type == BULLET_WORM_SORROW)
500 drag_bullet(b, 0.24); // 14
501 else
502 drag_bullet(b, 0.11);
503 break;
504 case BULLET_CLAW:
505 if (bullet[b].special3 > 0)
506 {
507 passing_colour [0] = TRANS_DGREY;
508 passing_colour [1] = TRANS_DGREEN;
509 passing_colour [2] = TRANS_LGREEN;
510 passing_colour [3] = TRANS_YELLOW;
511 bullet[b].special3 --;
512 create_cloud(CLOUD_FADING_LINE,
513 bullet[b].x - bullet[b].x_speed,
514 bullet[b].y - bullet[b].y_speed,
515 bullet[b].x,
516 bullet[b].y,
517 0,
518 0,
519 10, 2,0, 0, 0, 0, passing_colour);
520 }
521 else
522 {
523 passing_colour [0] = TRANS_DRED;
524 passing_colour [1] = TRANS_LRED;
525 passing_colour [2] = TRANS_ORANGE;
526 passing_colour [3] = TRANS_YELLOW;
527 create_cloud(CLOUD_FADING_LINE,
528 bullet[b].x - bullet[b].x_speed,
529 bullet[b].y - bullet[b].y_speed,
530 bullet[b].x,
531 bullet[b].y,
532 0,
533 0,
534 10, 2,0, 0, 0, 0, passing_colour);
535 cx = xpart(bullet[b].special2 - ANGLE_QUARTER, GRAIN);
536 cy = ypart(bullet[b].special2 - ANGLE_QUARTER, GRAIN);
537 c2x = (cx * bullet[b].special1) / GRAIN;
538 c2y = (cy * bullet[b].special1) / GRAIN;
539 bullet[b].x_speed += c2x;
540 bullet[b].y_speed += c2y;
541 }
542 drag_bullet(b, 0.1); // 14
543 break;
544 case BULLET_SPORE:
545 if (bullet[b].special3 == -1 && bullet[b].timeout % 5 == 0)
546 {
547 if (game.type == GAME_DUEL)
548 {
549 bullet[b].special3 = closest_enemy_or_actor(bullet[b].owner, bullet[b].x, bullet[b].y,
550 500000, 1);
551 }
552 else
553 bullet[b].special3 = closest_enemy(bullet[b].x, bullet[b].y, 1000000, 1);
554 }
555
556 if (bullet[b].special3 == LOCK_ACTOR0 || bullet[b].special3 == LOCK_ACTOR1)
557 {
558
559 if (bullet[b].special3 == LOCK_ACTOR0)
560 cx = 0;
561 else
562 cx = 1;
563 if (hypot(bullet[b].y - actor[cx].y, bullet[b].x - actor[cx].x)
564 < 30000)
565 // < 5000)
566 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x, actor[cx].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
567 else
568 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x + (actor[cx].x_speed * bullet[b].special5), actor[cx].y + (actor[cx].y_speed * bullet[b].special5), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
569 if ((enemy[bullet[b].special3].type == ENEMY_SHADOW1 || enemy[bullet[b].special3].type == ENEMY_SHADOW2)
570 && enemy[bullet[b].special3].attribute [0] == 0)
571 bullet[b].special3 = -1;
572 }
573 else
574 if (bullet[b].special3 >= 0)
575 {
576 // destroyed enemies have locks cleared in register_destroyed (enemy.c)
577 if (hypot(bullet[b].y - enemy[bullet[b].special3].y, bullet[b].x - enemy[bullet[b].special3].x)
578 < 30000)
579 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, enemy[bullet[b].special3].x, enemy[bullet[b].special3].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
580 else
581 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, enemy[bullet[b].special3].x + (enemy[bullet[b].special3].x_speed * bullet[b].special5), enemy[bullet[b].special3].y + (enemy[bullet[b].special3].y_speed * bullet[b].special5), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
582 }
583 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
584 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
585 c2x = (cx * bullet[b].special1) / GRAIN;
586 c2y = (cy * bullet[b].special1) / GRAIN;
587 bullet[b].x_speed += c2x;
588 bullet[b].y_speed += c2y;
589 drag_bullet(b, 0.1);
590 break;
591 case BULLET_ATTRACTOR_LINE:
592 case BULLET_CHARGE_LINE:
593 case BULLET_HOLE_LINE:
594 if (bullet[b].special2 != -1)
595 {
596 c2y = 1; // if 0, bullet isn't attracted.
597 if (bullet[b].type == BULLET_ATTRACTOR_LINE)
598 {
599 if (enemy[bullet[b].special2].type != ENEMY_ATTRACTOR)
600 c2y = 0;
601 cx = enemy[bullet[b].special2].x;
602 cy = enemy[bullet[b].special2].y;
603 c2x = 15000;
604 }
605 if (bullet[b].type == BULLET_CHARGE_LINE)
606 {
607 if (enemy[bullet[b].special2].type != ENEMY_BOSS2_2)
608 c2y = 0;
609 cx = enemy[bullet[b].special2].x + xpart(enemy[bullet[b].special2].angle, 35000);
610 cy = enemy[bullet[b].special2].y + ypart(enemy[bullet[b].special2].angle, 35000);
611 c2x = 7000;
612 }
613 if (bullet[b].type == BULLET_HOLE_LINE)
614 {
615 if (bullet[bullet[b].special2].type != BULLET_HOLE)
616 c2y = 0;
617 cx = bullet[bullet[b].special2].x;
618 cy = bullet[bullet[b].special2].y;
619 c2x = 7000;
620 }
621 if (c2y == 1)
622 {
623 // {
624 xb = hypot(bullet[b].y - cy, bullet[b].x - cx) + 1;
625 if (xb < c2x)
626 {
627 destroy_bullet(b);
628 return; // hmmm.
629 }
630 if (TRUE) //xb < 300000)
631 {
632 xa = radians_to_angle(atan2(bullet[b].y - cy, bullet[b].x - cx));
633 ya = 120000 / xb;
634 if (ya > 100)
635 ya = 100;
636 bullet[b].x_speed -= xpart(xa, ya * GRAIN / 3);
637 bullet[b].y_speed -= ypart(xa, ya * GRAIN / 3);
638 /* cx = xpart(xa, ya * GRAIN);
639 cy = ypart(xa, ya * GRAIN);
640 c2x = (cx * bullet[b].special1) / GRAIN;
641 c2y = (cy * bullet[b].special1) / GRAIN;
642 bullet[b].x_speed += c2x;
643 bullet[b].y_speed += c2y;*/
644 }
645 // }
646 // else
647 // bullet[b].special2 = -1;
648 }
649 } // end if bullet[b].special2 != -1
650 passing_colour [0] = bullet[b].colours [0];
651 passing_colour [1] = bullet[b].colours [1];
652 passing_colour [2] = bullet[b].colours [2];
653 passing_colour [3] = bullet[b].colours [3];
654 create_cloud(CLOUD_TRANS_FADING_LINE,
655 bullet[b].x - bullet[b].x_speed,
656 bullet[b].y - bullet[b].y_speed,
657 bullet[b].x,
658 bullet[b].y,
659 0,
660 0,
661 10, 2,0, 0, 0, 0, passing_colour);
662 drag_bullet(b, 0.07);// .11
663 break;
664 case BULLET_DISRUPT2:
665 /* passing_colour [0] = TRANS_REVERSE;
666 create_cloud(CLOUD_MED_TRANS_CIRCLE,
667 bullet[b].x + grand(5000) - grand(5000), bullet[b].y + grand(5000) - grand(5000),
668 0, 0, 0, 0, 500 + grand(400), -3, 7, 0, 0, 0, passing_colour);*/
669 break;
670 case BULLET_DISRUPT3:
671 /* passing_colour [0] = TRANS_DARKEN;
672 create_cloud(CLOUD_MED_TRANS_CIRCLE,
673 bullet[b].x + grand(5000) - grand(5000), bullet[b].y + grand(5000) - grand(5000),
674 0, 0, 0, 0, 500 + grand(400), -7, 7, 0, 0, 0, passing_colour);*/
675 break;
676 case BULLET_EVIL_WORM:
677 passing_colour [0] = bullet[b].colours [0];
678 passing_colour [1] = bullet[b].colours [1];
679 passing_colour [2] = bullet[b].colours [2];
680 passing_colour [3] = bullet[b].colours [3];
681 create_cloud(CLOUD_FADING_LINE,
682 bullet[b].x - bullet[b].x_speed,
683 bullet[b].y - bullet[b].y_speed,
684 bullet[b].x,
685 bullet[b].y,
686 0,
687 0,
688 10, 2,0, 0, 0, 0, passing_colour);
689 if (bullet[b].timeout == bullet[b].special2 || (bullet[b].special3 == -1 && bullet[b].timeout % 5 == 0))
690 {
691 bullet[b].special3 = closest_target(bullet[b].x, bullet[b].y);
692 if (bullet[b].timeout == bullet[b].special2)
693 bullet[b].timeout -= grand(10);
694 }
695
696 if (bullet[b].special3 != -1) //== LOCK_ACTOR0 || bullet[b].special3 == LOCK_ACTOR1)
697 {
698 cx = bullet[b].special3;
699 // if (bullet[b].special3 == LOCK_ACTOR0)
700 // cx = 0;
701 // else
702 // cx = 1;
703 // if (hypot(bullet[b].y - actor[cx].y, bullet[b].x - actor[cx].x)
704 // < 30000)
705 // {
706 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x, actor[cx].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
707 // }
708 // else
709 // bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x + (actor[cx].x_speed), actor[cx].y + (actor[cx].y_speed), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
710 }
711 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
712 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
713 c2x = (cx * bullet[b].special1) / GRAIN;
714 c2y = (cy * bullet[b].special1) / GRAIN;
715 bullet[b].x_speed += c2x;
716 bullet[b].y_speed += c2y;
717 drag_bullet(b, 0.05);
718 break;
719 case BULLET_SWIRL2:
720 passing_colour [0] = bullet[b].colours [0];
721 passing_colour [1] = bullet[b].colours [1];
722 passing_colour [2] = bullet[b].colours [2];
723 passing_colour [3] = bullet[b].colours [3];
724 create_cloud(CLOUD_FADING_LINE,
725 bullet[b].x - bullet[b].x_speed,
726 bullet[b].y - bullet[b].y_speed,
727 bullet[b].x,
728 bullet[b].y,
729 0,
730 0,
731 10, 2,0, 0, 0, 0, passing_colour);
732
733 if (bullet[b].special3 != -1)
734 {
735 if (bullet[bullet[b].special3].type != BULLET_SWIRL1)
736 bullet[b].special3 = -1;
737 }
738 if (bullet[b].special5 > 0)
739 bullet[b].special5 --;
740
741 if (bullet[b].special3 != -1 && bullet[b].special5 == 0)
742 {
743 cx = bullet[b].special3;
744 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, bullet[cx].x, bullet[cx].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
745 }
746 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
747 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
748 c2x = (cx * bullet[b].special1) / GRAIN;
749 c2y = (cy * bullet[b].special1) / GRAIN;
750 bullet[b].x_speed += c2x;
751 bullet[b].y_speed += c2y;
752 drag_bullet(b, 0.05);
753 break;
754 case BULLET_FROZEN_TOOTH:
755 passing_colour [0] = bullet[b].colours [0];
756 passing_colour [1] = bullet[b].colours [1];
757 passing_colour [2] = bullet[b].colours [2];
758 passing_colour [3] = bullet[b].colours [3];
759 create_cloud(CLOUD_FADING_LINE,
760 bullet[b].x - bullet[b].x_speed,
761 bullet[b].y - bullet[b].y_speed,
762 bullet[b].x,
763 bullet[b].y,
764 0,
765 0,
766 10, 2,0, 0, 0, 0, passing_colour);
767 cx = xpart(bullet[b].special5 - ANGLE_QUARTER, GRAIN);
768 cy = ypart(bullet[b].special5 - ANGLE_QUARTER, GRAIN);
769 c2x = (cx * bullet[b].special4) / GRAIN;
770 c2y = (cy * bullet[b].special4) / GRAIN;
771 bullet[b].x_speed += c2x;
772 bullet[b].y_speed += c2y;
773 // drag_bullet(b, 0.07);
774 drag_bullet(b, 0.03);
775 // add_light(LIGHT_NORMAL, 3 + grand(4), bullet[b].x + bullet[b].x_speed, bullet[b].y + bullet[b].y_speed);
776 break;
777 case BULLET_BOLT:
778 // if (bullet[b].timeout < 5)
779 // break;
780 passing_colour [0] = bullet[b].colours [3];
781 passing_colour [1] = bullet[b].colours [1];
782 passing_colour [2] = bullet[b].colours [0];
783 // passing_colour [3] = TRANS_DRED;
784 // passing_colour [4] = TRANS_DRED;
785 place_rocket_trail(bullet[b].x + grand(4001) - 2000, bullet[b].y + grand(4001) - 2000, 0, 0, 150, passing_colour);
786 // place_rocket_trail(bullet[b].x + grand(3001) - 1500, bullet[b].y + grand(3001) - 1500, 0, 0, 250, passing_colour);
787 /* if (bullet[b].timeout % 4 != 0)
788 break;
789 passing_colour [0] = bullet[b].colours [0];
790 passing_colour [1] = bullet[b].colours [1];
791 passing_colour [2] = bullet[b].colours [2];
792 place_explosion_no_light(bullet[b].x, bullet[b].y, 0, 0, 10 + grand(5), passing_colour);*/
793 // place_explosion(bullet[b].x + grand(bullet[b].special1 * 2) - bullet[b].special1, bullet[b].y + grand(bullet[b].special1 * 2) - bullet[b].special1, 0, 0, 100 + grand(50 + bullet[b].special2), passing_colour);
794 break;
795 case BULLET_YELLOW_PULSE:
796 add_light(LIGHT_NORMAL, 9 + grand(5), bullet[b].x, bullet[b].y);
797 if (grand(2) == 0)
798 break;
799 passing_colour [0] = bullet[b].colours [0];
800 cx = 36 + grand(12);
801 create_cloud(CLOUD_SMALL_FADING_CIRCLE,
802 bullet[b].x + grand(4001) - 2000,
803 bullet[b].y + grand(4001) - 2000,
804 0, 0,
805 0,
806 0,
807 cx, 3, 0, 0, cx, 0, passing_colour);
808 break;
809 case BULLET_WINGS1:
810 if (bullet[b].timeout <= 1)
811 {
812 bullet[b].type = BULLET_WINGS2;
813 bullet[b].timeout = 30;
814 }
815 break;
816 case BULLET_WINGS2:
817 if (bullet[b].special1 != ATTACK_NONE)
818 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 16);
819 if (bullet[b].timeout <= 1)
820 {
821 bullet[b].type = BULLET_WINGS3;
822 bullet[b].timeout = 80 + grand(20);
823 bullet_soundf(b, NWAV_JET, 1000 + grand(300));
824 }
825 break;
826 case BULLET_WINGS3:
827 bullet[b].angle += 5 - grand(11);
828 bullet[b].angle &= 1023;
829 cx = xpart(bullet[b].angle, 300);
830 cy = ypart(bullet[b].angle, 300);
831 bullet[b].x_speed += cx;
832 bullet[b].y_speed += cy;
833 drag_bullet(b, 0.03);
834 if (grand(2) == 0)
835 {
836 passing_colour [0] = TRANS_DRED;
837 passing_colour [1] = TRANS_LRED;
838 passing_colour [2] = TRANS_YELLOW;
839 // passing_colour [3] = TRANS_DRED;
840 // passing_colour [4] = TRANS_DRED;
841 // place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 14, bullet[b].y + grand(3001) - 1500 - cy * 14, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 140, passing_colour);
842 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 14, bullet[b].y + grand(3001) - 1500 - cy * 14, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 110, passing_colour);
843 }
844 add_light(LIGHT_NORMAL, 4 + grand(3), bullet[b].x, bullet[b].y);
845 break;
846 case BULLET_BIGWINGS1:
847 if (bullet[b].timeout <= 1)
848 {
849 bullet[b].type = BULLET_BIGWINGS2;
850 bullet[b].timeout = 30;
851 }
852 break;
853 case BULLET_BIGWINGS2:
854 if (bullet[b].special1 != ATTACK_NONE)
855 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 16);
856 if (bullet[b].timeout <= 1)
857 {
858 bullet[b].type = BULLET_BIGWINGS3;
859 bullet[b].timeout = 80 + grand(20);
860 bullet_soundf(b, NWAV_JET, 600 + grand(100));
861 }
862 break;
863 case BULLET_BIGWINGS3:
864 bullet[b].angle += 9 - grand(19);
865 bullet[b].angle &= 1023;
866 cx = xpart(bullet[b].angle, 300);
867 cy = ypart(bullet[b].angle, 300);
868 bullet[b].x_speed += cx;
869 bullet[b].y_speed += cy;
870 drag_bullet(b, 0.03);
871 if (grand(3) != 0)
872 {
873 passing_colour [0] = TRANS_DGREEN;
874 passing_colour [1] = TRANS_LGREEN;
875 passing_colour [2] = TRANS_YELLOW;
876 // passing_colour [3] = TRANS_DRED;
877 // passing_colour [4] = TRANS_DRED;
878 // place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 14, bullet[b].y + grand(3001) - 1500 - cy * 14, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 140, passing_colour);
879 place_rocket_trail(bullet[b].x + grand(4001) - 2000 - cx * 14, bullet[b].y + grand(4001) - 2000 - cy * 14, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 210, passing_colour);
880 }
881 add_light(LIGHT_NORMAL, 7 + grand(4), bullet[b].x, bullet[b].y);
882 break;
883 case BULLET_CIRCLES:
884 if (counter % 3 != 0)
885 break;
886 passing_colour [0] = bullet[b].colours [0];
887 create_cloud(CLOUD_SHRINKING_CIRCLE,
888 bullet[b].x,
889 bullet[b].y,
890 0, 0,
891 0, 0,
892 500,-50,10, 0, 0, 0, passing_colour);
893 break;
894 case BULLET_CIRCLES2:
895 if (counter % 2 != 0)
896 break;
897 passing_colour [0] = bullet[b].colours [0];
898 create_cloud(CLOUD_SHRINKING_CIRCLE,
899 bullet[b].x,
900 bullet[b].y,
901 0, 0,
902 0, 0,
903 500,-50,10, 0, 0, 0, passing_colour);
904 break;
905 case BULLET_BIGCIRCLES:
906 if (counter % 2 != 0)
907 break;
908 passing_colour [0] = bullet[b].colours [0];
909 create_cloud(CLOUD_SHRINKING_CIRCLE,
910 bullet[b].x + grand(8000) - grand(8000),
911 bullet[b].y + grand(8000) - grand(8000),
912 0, 0,
913 0, 0,
914 500 + grand(200),-50,10, 0, 0, 0, passing_colour);
915 break;
916 case BULLET_BLOCKS:
917 passing_colour [0] = bullet[b].colours [0];
918 passing_colour [1] = bullet[b].colours [1];
919 passing_colour [2] = bullet[b].colours [2];
920 passing_colour [3] = bullet[b].colours [3];
921 create_cloud(CLOUD_BLOCK1,
922 bullet[b].x - bullet[b].x_speed,
923 bullet[b].y - bullet[b].y_speed,
924 bullet[b].x,
925 bullet[b].y,
926 0, 0,
927 6 + grand(8),1,0, bullet[b].angle, 0, 0, passing_colour);
928 break;
929 case BULLET_OVERBLOCKS:
930 passing_colour [0] = bullet[b].colours [0];
931 passing_colour [1] = bullet[b].colours [1];
932 passing_colour [2] = bullet[b].colours [2];
933 passing_colour [3] = bullet[b].colours [3];
934 create_cloud(CLOUD_BLOCK1,
935 bullet[b].x - bullet[b].x_speed,
936 bullet[b].y - bullet[b].y_speed,
937 bullet[b].x,
938 bullet[b].y,
939 0, 0,
940 14 + ypart(bullet[b].special1, 7),1,0, bullet[b].angle, 0, 0, passing_colour);
941 bullet[b].size = (5 + ypart(bullet[b].special1, 8)) * GRAIN;
942 bullet[b].special1 += 145;
943 bullet[b].special1 %= ANGLE_FULL;
944 break;
945 case BULLET_ZIGZAG2:
946 /* passing_colour [0] = bullet[b].colours [0];
947 passing_colour [1] = bullet[b].colours [1];
948 passing_colour [2] = bullet[b].colours [2];
949 passing_colour [3] = bullet[b].colours [3];
950 create_cloud(CLOUD_BLOCK5,
951 bullet[b].x - bullet[b].x_speed,
952 bullet[b].y - bullet[b].y_speed,
953 bullet[b].x,
954 bullet[b].y,
955 0, 0,
956 90, 5 + grand(10), 0, bullet[b].angle, 5 + grand(5), 0, passing_colour);*/
957 /* create_cloud(CLOUD_BLOCK5,
958 bullet[b].x - bullet[b].x_speed,
959 bullet[b].y - bullet[b].y_speed,
960 bullet[b].x,
961 bullet[b].y,
962 0, 0,
963 90, 10, 0, bullet[b].angle, 7, 0, passing_colour);*/
964 bullet[b].special2--;
965 if (bullet[b].special2 == 0)
966 {
967 bullet[b].special2 = 12;
968 if (bullet[b].special5 == 1)
969 bullet[b].special2 = 6 + grand(10);
970 // bullet[b].x_speed += xpart(bullet[b].special4 + bullet[b].special1, bullet[b].special3);
971 // bullet[b].y_speed += ypart(bullet[b].special4 + bullet[b].special1, bullet[b].special3);
972 bullet[b].x_speed += xpart(bullet[b].angle + bullet[b].special1, bullet[b].special3);
973 bullet[b].y_speed += ypart(bullet[b].angle + bullet[b].special1, bullet[b].special3);
974 bullet[b].special4 = radians_to_angle(atan2(bullet[b].y_speed, bullet[b].x_speed));
975 bullet[b].special1 *= -1;
976 if (bullet[b].special3 == 7000)
977 bullet[b].special3 = 14000;
978 bullet[b].x2 = bullet[b].x;
979 bullet[b].y2 = bullet[b].y;
980 /* passing_colour [0] = bullet[b].colours [0];
981 passing_colour [1] = bullet[b].colours [1];
982 passing_colour [2] = bullet[b].colours [2];
983 passing_colour [3] = bullet[b].colours [3];
984 create_cloud(CLOUD_BLOCK1,
985 bullet[b].x - bullet[b].x_speed,
986 bullet[b].y - bullet[b].y_speed,
987 bullet[b].x,
988 bullet[b].y,
989 0, 0,
990 19, 1,0, bullet[b].special4, 0, 0, passing_colour);*/
991 }
992 bullet[b].x2 -= bullet[b].x_speed;
993 bullet[b].y2 -= bullet[b].y_speed;
994 break;
995 case BULLET_CURVEY:
996 // if (counter % 2 == 0)
997 // break;
998 passing_colour [0] = bullet[b].colours [0];
999 passing_colour [1] = bullet[b].colours [1];
1000 passing_colour [2] = bullet[b].colours [2];
1001 passing_colour [3] = bullet[b].colours [3];
1002 cx = bullet[b].x - xpart(bullet[b].angle, 1 * GRAIN);
1003 cy = bullet[b].y - ypart(bullet[b].angle, 1 * GRAIN);
1004 create_cloud(CLOUD_BLOCK1,
1005 cx,
1006 cy,
1007 bullet[b].x,
1008 bullet[b].y,
1009 0, 0,
1010 6 + grand(7),1,0, bullet[b].angle, 0, 0, passing_colour);
1011 break;
1012 case BULLET_LINE_PULSE:
1013 // passing_colour [0] = COLOUR_ORANGE8;
1014 passing_colour [0] = bullet[b].colours [0];
1015 passing_colour [1] = bullet[b].colours [1];
1016 passing_colour [2] = bullet[b].colours [2];
1017 passing_colour [3] = bullet[b].colours [3];
1018 /* if (counter % 2 != 0)
1019 break;
1020 passing_colour [0] = bullet[b].colours [0];
1021 passing_colour [1] = bullet[b].colours [1];
1022 passing_colour [2] = bullet[b].colours [2];
1023 passing_colour [3] = bullet[b].colours [3];
1024 cx = bullet[b].x - xpart(bullet[b].angle, 2 * GRAIN);
1025 cy = bullet[b].y - ypart(bullet[b].angle, 2 * GRAIN);
1026 create_cloud(CLOUD_BLOCK1,
1027 cx,
1028 cy,
1029 bullet[b].x,
1030 bullet[b].y,
1031 0, 0,
1032 6 + grand(7), 1, 0, bullet[b].angle, 0, 0, passing_colour);*/
1033 create_cloud(CLOUD_LINE_SHADOW,
1034 bullet[b].x,
1035 bullet[b].y,
1036 0, 0,
1037 0,
1038 0,
1039 30 + grand(60),3 + grand(7),0, bullet[b].angle, 0, 0, passing_colour);
1040 break;
1041 case BULLET_THICK_SHOCK:
1042 bullet[b].x2 = bullet[b].x;
1043 bullet[b].y2 = bullet[b].y;
1044 bullet[b].x += grand(28001) - 14000;
1045 bullet[b].y += grand(28001) - 14000;
1046 passing_colour [0] = bullet[b].colours [0];
1047 passing_colour [1] = bullet[b].colours [1];
1048 passing_colour [2] = bullet[b].colours [2];
1049 passing_colour [3] = bullet[b].colours [3];
1050 cx = 8 + grand(3);
1051 create_cloud(CLOUD_BLOCK4,
1052 bullet[b].x2 - bullet[b].x_speed,
1053 bullet[b].y2 - bullet[b].y_speed,
1054 bullet[b].x,
1055 bullet[b].y,
1056 0, 0,
1057 cx,1,0, bullet[b].angle, 0, 0, passing_colour);
1058 create_cloud(CLOUD_THICK_SHOCK_CIRCLE,
1059 bullet[b].x,
1060 bullet[b].y,
1061 0, 0,
1062 0, 0,
1063 cx,1,0, bullet[b].angle, 0, 0, passing_colour);
1064 add_light(LIGHT_NORMAL, 15 + grand(15), bullet[b].x, bullet[b].y);
1065 break;
1066 case BULLET_NOVA:
1067 blast(bullet[b].x, bullet[b].y, 30000, 50, 300, bullet[b].owner);
1068 if (bullet[b].timeout <= 3)
1069 {
1070 passing_colour [0] = TRANS_LRED;
1071 passing_colour [1] = TRANS_YELLOW;
1072 passing_colour [2] = TRANS_WHITE;
1073 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 600 + grand(300), passing_colour);
1074 blast(bullet[b].x, bullet[b].y, 70000, 300, 30000, bullet[b].owner);
1075 place_burstlet_burst(bullet[b].x, bullet[b].y, 0, 0, 6,
1076 6, 4, 1500, 1500, 7, passing_colour);
1077 simple_shockwave(TRANS_YELLOW, bullet[b].x, bullet[b].y, 0, 0, 800 + crandom(50), 30);
1078 bullet_soundf(b, NWAV_BURSTZL, 700 + grand(500));
1079 // simple_shockwave(TRANS_YELLOW, bullet[b].x, bullet[b].y, 0, 0, 1400 + crandom(50), 25);
1080 // simple_shockwave(TRANS_YELLOW, bullet[b].x, bullet[b].y, 0, 0, 1800 + crandom(50), 50);
1081 for (xb = 0; xb < 12; xb ++)
1082 {
1083 cx = grand(ANGLE_FULL);
1084 cy = 5000 + grand(20000);
1085 create_bullet(BULLET_HOLE_LINE,
1086 bullet[b].x + xpart(cx, cy), bullet[b].y + ypart(cx, cy),
1087 xpart(cx, cy), ypart(cx, cy),
1088 bullet[b].owner,
1089 0, 90 + grand(10), 10, 0, 0, 0, bullet[b].colours, 1,
1090 0, b, 0, 0, 0);
1091 }
1092 bullet[b].type = BULLET_HOLE;
1093 bullet[b].timeout = 180;
1094 break;
1095 }
1096 drag_bullet(b, 0.1);
1097 c2y = grand(4000);
1098 bullet[b].size = 18000;
1099 passing_colour [0] = TRANS_WHITE;
1100 passing_colour [1] = TRANS_YELLOW;
1101 passing_colour [2] = TRANS_LRED;
1102 passing_colour [3] = TRANS_DRED;
1103 if (bullet[b].timeout <= 40)
1104 {
1105 // cx = grand(xpart(bullet[b].timeout * 7 - ANGLE_QUARTER, 70000));
1106 cx = xpart(bullet[b].timeout * 7 - ANGLE_QUARTER, 70000);
1107 bullet[b].size = xpart(bullet[b].timeout * 7 - ANGLE_QUARTER, 60000);
1108 c2y = grand(4000) + (60 - bullet[b].timeout) * 80;
1109 passing_colour [0] = TRANS_ORANGE;
1110 passing_colour [1] = TRANS_LRED;
1111 passing_colour [2] = TRANS_DRED;
1112 passing_colour [3] = TRANS_DRED;
1113 }
1114 else
1115 {
1116 cx = 25000;
1117 /* passing_colour [0] = TRANS_WHITE;
1118 passing_colour [1] = TRANS_YELLOW;
1119 passing_colour [2] = TRANS_LRED;
1120 passing_colour [3] = TRANS_DRED;*/
1121 }
1122 for (xb = 0; xb < 5; xb ++)
1123 {
1124 xa = grand(ANGLE_FULL);
1125 c2x = grand(cx);
1126 create_cloud(CLOUD_BLAST_CIRCLE,
1127 bullet[b].x + xpart(xa, c2x),
1128 bullet[b].y + ypart(xa, c2x),
1129 0, 0,
1130 xpart(xa, c2y), ypart(xa, c2y),
1131 25 + grand(10), 2, 0, 0, 0, 0, passing_colour);
1132 }
1133 break;
1134 case BULLET_HOLE:
1135 if (bullet[b].timeout == 1)
1136 {
1137 simple_shockwave(TRANS_YELLOW, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50), 20);
1138 blast(bullet[b].x, bullet[b].y, 30000, 100, 4000, bullet[b].owner);
1139 break;
1140 }
1141 blast(bullet[b].x, bullet[b].y, 15000, 50, 0, bullet[b].owner);
1142 blast(bullet[b].x, bullet[b].y, 600000, 0, -100, OWNER_ENEMY);
1143 if (bullet[b].timeout < 10)
1144 break;
1145 cx = grand(ANGLE_FULL);
1146 cy = 10000 + grand(50000);
1147 create_bullet(BULLET_HOLE_LINE,
1148 bullet[b].x + xpart(cx, cy), bullet[b].y + ypart(cx, cy),
1149 0, 0,
1150 bullet[b].owner,
1151 0, 30 + grand(10), 10, 0, 0, 0, bullet[b].colours, 1,
1152 0, b, 0, 0, 0);
1153 break;
1154 case BULLET_ORBIT:
1155 // bullet[b].x2 = bullet[b].x;
1156 // bullet[b].y2 = bullet[b].y;
1157 // bullet[b].x += grand(28001) - 14000;
1158 // bullet[b].y += grand(28001) - 14000;
1159 passing_colour [0] = bullet[b].colours [0];
1160 passing_colour [1] = bullet[b].colours [1];
1161 passing_colour [2] = bullet[b].colours [2];
1162 passing_colour [3] = bullet[b].colours [3];
1163 cx = 5 + grand(7); //bullet[b].special3 + grand(bullet[b].special4);
1164 create_cloud(CLOUD_THICK_SHOCK_CIRCLE,
1165 bullet[b].x,
1166 bullet[b].y,
1167 0, 0,
1168 0, 0,
1169 cx,1,0, bullet[b].angle, 0, 0, passing_colour);
1170 if (bullet[b].colours [0] == TRANS_WHITE)
1171 {
1172 passing_colour [0] = TRANS_LGREY;
1173 create_cloud(CLOUD_BLOCK4,
1174 bullet[b].special1,// - bullet[b].x_speed,
1175 bullet[b].special2,// - bullet[b].y_speed,
1176 bullet[b].x,
1177 bullet[b].y,
1178 0, 0,
1179 cx,1,0, bullet[b].angle, 0, 0, passing_colour);
1180 }
1181 add_light(LIGHT_NORMAL, 20 + grand(8), bullet[b].x, bullet[b].y);
1182 break;
1183 /* case BULLET_E_BOMB:
1184 drag_bullet(b, 0.03);
1185 if (counter % 3 != 0)
1186 break;
1187 passing_colour [0] = COLOUR_YELLOW8; //bullet[b].colours [0];
1188 create_cloud(CLOUD_SMALL_SHRINKING_CIRCLE,
1189 bullet[b].x,
1190 bullet[b].y,
1191 0, 0,
1192 0, 0,
1193 // 300,-30,15, 0, 0, 0, passing_colour);
1194 400,30,3, 0, 0, 0, passing_colour);
1195 break;*/
1196 case BULLET_E_BOMB2:
1197 drag_bullet(b, 0.06);
1198 if (abs(bullet[b].x_speed) + abs(bullet[b].y_speed) < 2000)
1199 break;
1200 // note indices reversed
1201 passing_colour [3] = COLOUR_WHITE;//bullet[b].colours [0];
1202 passing_colour [2] = COLOUR_GREY5;//bullet[b].colours [1];
1203 passing_colour [1] = COLOUR_BLUE8;//bullet[b].colours [2];
1204 passing_colour [0] = COLOUR_BLUE7;//bullet[b].colours [3];
1205 create_cloud(CLOUD_FADING_LINE,
1206 bullet[b].x - bullet[b].x_speed,
1207 bullet[b].y - bullet[b].y_speed,
1208 bullet[b].x,
1209 bullet[b].y,
1210 0,
1211 0,
1212 10, 3,0, 0, 0, 0, passing_colour);
1213 break;
1214 case BULLET_DISRUPT1_DROP:
1215 bullet[b].special1 ++;
1216 // blast(bullet[b].x, bullet[b].y, 150000, 3, 300, bullet[b].owner);
1217 blast(bullet[b].x, bullet[b].y, 100000, 3, 300, bullet[b].owner);
1218 break;
1219 case BULLET_FORK1:
1220 case BULLET_FORK2:
1221 case BULLET_FORK3:
1222 passing_colour [0] = bullet[b].colours [0];
1223 passing_colour [1] = bullet[b].colours [1];
1224 passing_colour [2] = bullet[b].colours [2];
1225 passing_colour [3] = bullet[b].colours [3];
1226 create_cloud(CLOUD_FADING_LINE,
1227 bullet[b].x - bullet[b].x_speed,
1228 bullet[b].y - bullet[b].y_speed,
1229 bullet[b].x,
1230 bullet[b].y,
1231 0,
1232 0,
1233 10, 2 - (bullet[b].type == BULLET_FORK1),0, 0, 0, 0, passing_colour);
1234 break;
1235 case BULLET_EVIL_EEL:
1236 passing_colour [0] = bullet[b].colours [0];
1237 passing_colour [1] = bullet[b].colours [1];
1238 passing_colour [2] = bullet[b].colours [2];
1239 passing_colour [3] = bullet[b].colours [3];
1240 create_cloud(CLOUD_FADING_LINE,
1241 bullet[b].x - bullet[b].x_speed,
1242 bullet[b].y - bullet[b].y_speed,
1243 bullet[b].x,
1244 bullet[b].y,
1245 0,
1246 0,
1247 10, 2,0, 0, 0, 0, passing_colour);
1248 if (bullet[b].special3 <= 0)
1249 {
1250 bullet[b].special3 = 7 + grand(3);
1251 bullet[b].special2 *= -1;
1252 }
1253 bullet[b].special3 --;
1254 bullet[b].angle += bullet[b].special2;
1255 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1256 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1257 xa = bullet[b].special1 / 2 + grand(bullet[b].special1) / 2;
1258 c2x = (cx * xa) / GRAIN;
1259 c2y = (cy * xa) / GRAIN;
1260 bullet[b].x_speed += c2x;
1261 bullet[b].y_speed += c2y;
1262 drag_bullet(b, 0.15);
1263 break;
1264 case BULLET_PANIC_EEL:
1265 passing_colour [0] = bullet[b].colours [0];
1266 passing_colour [1] = bullet[b].colours [1];
1267 passing_colour [2] = bullet[b].colours [2];
1268 passing_colour [3] = bullet[b].colours [3];
1269 create_cloud(CLOUD_FADING_LINE,
1270 bullet[b].x - bullet[b].x_speed,
1271 bullet[b].y - bullet[b].y_speed,
1272 bullet[b].x,
1273 bullet[b].y,
1274 0,
1275 0,
1276 10, 2,0, 0, 0, 0, passing_colour);
1277 if (bullet[b].special5 > 0)
1278 {
1279 bullet[b].special5 --;
1280 drag_bullet(b, 0.05);
1281 break;
1282 }
1283 if (bullet[b].special3 <= 0)
1284 {
1285 bullet[b].special3 = 7 + grand(3);
1286 bullet[b].special2 *= -1;
1287 }
1288 bullet[b].special3 --;
1289 bullet[b].special4 += bullet[b].special2;
1290 cx = xpart(bullet[b].special4 - ANGLE_QUARTER, GRAIN);
1291 cy = ypart(bullet[b].special4 - ANGLE_QUARTER, GRAIN);
1292 xa = bullet[b].special1 / 2 + grand(bullet[b].special1) / 2;
1293 c2x = (cx * xa) / GRAIN;
1294 c2y = (cy * xa) / GRAIN;
1295 bullet[b].x_speed += c2x;
1296 bullet[b].y_speed += c2y;
1297 drag_bullet(b, 0.15);
1298 break;
1299 case BULLET_TURN_WORM:
1300 passing_colour [0] = bullet[b].colours [0];
1301 passing_colour [1] = bullet[b].colours [1];
1302 passing_colour [2] = bullet[b].colours [2];
1303 passing_colour [3] = bullet[b].colours [3];
1304 create_cloud(CLOUD_FADING_LINE,
1305 bullet[b].x - bullet[b].x_speed,
1306 bullet[b].y - bullet[b].y_speed,
1307 bullet[b].x,
1308 bullet[b].y,
1309 0,
1310 0,
1311 10, 2,0, 0, 0, 0, passing_colour);
1312 bullet[b].angle += bullet[b].special2;
1313 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1314 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1315 c2x = (cx * bullet[b].special1) / GRAIN;
1316 c2y = (cy * bullet[b].special1) / GRAIN;
1317 bullet[b].x_speed += c2x;
1318 bullet[b].y_speed += c2y;
1319 drag_bullet(b, 0.15);
1320 break;
1321 case BULLET_SQUIRMY:
1322 passing_colour [0] = bullet[b].colours [0];
1323 passing_colour [1] = bullet[b].colours [1];
1324 passing_colour [2] = bullet[b].colours [2];
1325 passing_colour [3] = bullet[b].colours [3];
1326 create_cloud(CLOUD_FADING_LINE,
1327 bullet[b].x - bullet[b].x_speed,
1328 bullet[b].y - bullet[b].y_speed,
1329 bullet[b].x,
1330 bullet[b].y,
1331 0,
1332 0,
1333 10, 2,0, 0, 0, 0, passing_colour);
1334 if (bullet[b].special3 <= 0)
1335 {
1336 bullet[b].special3 = bullet[b].special4;
1337 bullet[b].special2 *= -1;
1338 }
1339 bullet[b].special3 --;
1340 bullet[b].angle += bullet[b].special2;
1341 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1342 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1343 c2x = (cx * bullet[b].special1) / GRAIN;
1344 c2y = (cy * bullet[b].special1) / GRAIN;
1345 bullet[b].x_speed += c2x;
1346 bullet[b].y_speed += c2y;
1347 drag_bullet(b, 0.15);
1348 break;
1349 case BULLET_SEEKER1:
1350 case BULLET_SEEKER2:
1351 case BULLET_SEEKER3:
1352 add_light(LIGHT_NORMAL, (bullet[b].special2 / 3) + grand(4), bullet[b].x, bullet[b].y);
1353 if (bullet[b].special1 != ATTACK_NONE)
1354 {
1355 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, bullet[b].special3);
1356 cx = xpart(bullet[b].angle, bullet[b].special4);
1357 cy = ypart(bullet[b].angle, bullet[b].special4);
1358 bullet[b].x_speed += cx;
1359 bullet[b].y_speed += cy;
1360 drag_bullet(b, 0.03);
1361 }
1362 passing_colour [0] = bullet[b].colours [0];
1363 passing_colour [1] = bullet[b].colours [1];
1364 passing_colour [2] = bullet[b].colours [2];
1365 passing_colour [3] = bullet[b].colours [3];
1366 /* passing_colour [0] = bullet[b].colours [0];
1367 passing_colour [1] = bullet[b].colours [1];
1368 passing_colour [2] = bullet[b].colours [2];
1369 place_explosion_no_light(bullet[b].x + grand(bullet[b].special5) - bullet[b].special5 / 2, bullet[b].y + grand(bullet[b].special5) - bullet[b].special5 / 2,
1370 bullet[b].x_speed, bullet[b].y_speed, 1, passing_colour);//bullet[b].special2 * 2 + grand(20), passing_colour);
1371 */
1372
1373 cx = bullet[b].special2 + grand(12);
1374 // create_cloud(CLOUD_SMALL_FADING_CIRCLE,
1375 create_cloud(CLOUD_BLAST_CIRCLE, //MED_TRANS_FADING_CIRCLE,
1376 bullet[b].x + grand(bullet[b].special5) - bullet[b].special5 / 2,
1377 bullet[b].y + grand(bullet[b].special5) - bullet[b].special5 / 2,
1378 0, 0,
1379 bullet[b].x_speed,
1380 bullet[b].y_speed,
1381 cx, 3, 0, 0, cx, 0, passing_colour);
1382 break;
1383 case BULLET_BIGSEEKER:
1384 add_light(LIGHT_NORMAL, 25 + grand(5), bullet[b].x, bullet[b].y);
1385 if (bullet[b].special1 != ATTACK_NONE)
1386 {
1387 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 12);
1388 cx = xpart(bullet[b].angle, 210);
1389 cy = ypart(bullet[b].angle, 210);
1390 bullet[b].x_speed += cx;
1391 bullet[b].y_speed += cy;
1392 drag_bullet(b, 0.023);
1393 }
1394 if (bullet[b].timeout % 4 != 0)
1395 break;
1396 /* passing_colour [0] = bullet[b].colours [0];
1397 passing_colour [1] = bullet[b].colours [1];
1398 passing_colour [2] = bullet[b].colours [2];
1399 passing_colour [3] = bullet[b].colours [3];*/
1400 passing_colour [0] = bullet[b].colours [2];
1401 passing_colour [1] = bullet[b].colours [1];
1402 passing_colour [2] = bullet[b].colours [0];
1403 place_explosion_no_light(bullet[b].x + grand(9000) - grand(9000), bullet[b].y + grand(9000) - grand(9000),
1404 bullet[b].x_speed, bullet[b].y_speed, 1, passing_colour);//bullet[b].special2 * 2 + grand(20), passing_colour);
1405 /* cx = bullet[b].special2 + grand(12);
1406 create_cloud(CLOUD_BLAST_CIRCLE, //MED_TRANS_FADING_CIRCLE,
1407 bullet[b].x + grand(bullet[b].special5) - bullet[b].special5 / 2,
1408 bullet[b].y + grand(bullet[b].special5) - bullet[b].special5 / 2,
1409 0, 0,
1410 bullet[b].x_speed,
1411 bullet[b].y_speed,
1412 cx, 3, 0, 0, cx, 0, passing_colour);*/
1413 break;
1414 case BULLET_CHARGE:
1415 add_light(LIGHT_NORMAL, 25 + grand(5), bullet[b].x, bullet[b].y);
1416 // if (bullet[b].timeout % 3 != 0)
1417 // break;
1418 passing_colour [0] = bullet[b].colours [2];
1419 passing_colour [1] = bullet[b].colours [1];
1420 passing_colour [2] = bullet[b].colours [0];
1421 passing_colour [0] = bullet[b].colours [0];
1422 cx = bullet[b].x + grand(9001) - 4500;
1423 cy = bullet[b].y + grand(9001) - 4500;
1424 create_cloud(CLOUD_MED_TRANS_CIRCLE,
1425 cx, cy, 0, 0,
1426 0, 0, 800 + grand(400),50,2, 0, 0, 0, passing_colour);
1427 passing_colour [0] = bullet[b].colours [1];
1428 create_cloud(CLOUD_MED_TRANS_CIRCLE,
1429 cx, cy, 0, 0,
1430 0, 0, 800 + grand(400),40,1, 0, 0, 0, passing_colour);
1431 passing_colour [0] = bullet[b].colours [2];
1432 create_cloud(CLOUD_MED_TRANS_CIRCLE,
1433 cx, cy, 0, 0,
1434 0, 0, 800 + grand(400),30,1, 0, 0, 0, passing_colour);
1435 // place_explosion_no_light(bullet[b].x + grand(9000) - grand(9000), bullet[b].y + grand(9000) - grand(9000),
1436 // 0, 0, 1, passing_colour);//bullet[b].special2 * 2 + grand(20), passing_colour);
1437 break;
1438 case BULLET_SWIRL1:
1439 add_light(LIGHT_NORMAL, 25 + grand(5), bullet[b].x, bullet[b].y);
1440 if (bullet[b].timeout % 2 == 0)
1441 break;
1442 // passing_colour [0] = bullet[b].colours [2];
1443 // passing_colour [1] = bullet[b].colours [1];
1444 // passing_colour [2] = bullet[b].colours [0];
1445 passing_colour [0] = bullet[b].colours [0];
1446 cx = bullet[b].x + grand(3001) - 1500;
1447 cy = bullet[b].y + grand(3001) - 1500;
1448 create_cloud(CLOUD_MED_TRANS_CIRCLE,
1449 cx, cy, 0, 0,
1450 0, 0, 600 + grand(300),40,2, 0, 0, 0, passing_colour);
1451 passing_colour [0] = bullet[b].colours [1];
1452 create_cloud(CLOUD_MED_TRANS_CIRCLE,
1453 cx, cy, 0, 0,
1454 0, 0, 600 + grand(300),30,1, 0, 0, 0, passing_colour);
1455 passing_colour [0] = bullet[b].colours [3];
1456 create_cloud(CLOUD_MED_TRANS_CIRCLE,
1457 cx, cy, 0, 0,
1458 0, 0, 600 + grand(300),20,1, 0, 0, 0, passing_colour);
1459 // place_explosion_no_light(bullet[b].x + grand(9000) - grand(9000), bullet[b].y + grand(9000) - grand(9000),
1460 // 0, 0, 1, passing_colour);//bullet[b].special2 * 2 + grand(20), passing_colour);
1461 break;
1462 case BULLET_PULSE1:
1463 // add_light(LIGHT_NORMAL, (7) + grand(5), bullet[b].x, bullet[b].y);
1464 if (bullet[b].special1 != ATTACK_NONE)
1465 {
1466 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 16);
1467 cx = xpart(bullet[b].angle, 260);
1468 cy = ypart(bullet[b].angle, 260);
1469 bullet[b].x_speed += cx;
1470 bullet[b].y_speed += cy;
1471 }
1472 drag_bullet(b, 0.15);
1473 break;
1474 case BULLET_PULSE2:
1475 // add_light(LIGHT_NORMAL, (7) + grand(5), bullet[b].x, bullet[b].y);
1476 if (bullet[b].special1 != ATTACK_NONE)
1477 {
1478 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 32);
1479 cx = xpart(bullet[b].angle, 500);
1480 cy = ypart(bullet[b].angle, 500);
1481 bullet[b].x_speed += cx;
1482 bullet[b].y_speed += cy;
1483 }
1484 drag_bullet(b, 0.20);
1485 break;
1486 case BULLET_OVERPULSE:
1487 if (bullet[b].special1 != ATTACK_NONE)
1488 {
1489 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 32);
1490 cx = xpart(bullet[b].angle, 400);
1491 cy = ypart(bullet[b].angle, 400);
1492 bullet[b].x_speed += cx;
1493 bullet[b].y_speed += cy;
1494 }
1495 drag_bullet(b, 0.17);
1496 cx = (bullet[b].timeout % 64) * 16;
1497 if (bullet[b].special2 == 1)
1498 cx = ANGLE_FULL - cx;
1499 bullet[b].size = 12000 + xpart(cx, 3);
1500 break;
1501 case BULLET_EYE_DESOLATION:
1502 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1503 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1504 c2x = (cx * bullet[b].special4) / GRAIN;
1505 c2y = (cy * bullet[b].special4) / GRAIN;
1506 bullet[b].x_speed += c2x;
1507 bullet[b].y_speed += c2y;
1508 drag_bullet(b, 0.03);
1509 // if (crandom(bullet[b].special1) > 100)
1510 {
1511 passing_colour [0] = TRANS_DRED;//bullet[b].colours [0];
1512 passing_colour [1] = TRANS_ORANGE;//bullet[b].colours [2]; // 1->1
1513 passing_colour [2] = TRANS_YELLOW;//bullet[b].colours [3]; // 2->3
1514 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 3, bullet[b].y + grand(3001) - 1500 - cy * 3, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 140, passing_colour);
1515 }
1516 add_light(LIGHT_NORMAL, 8 + grand(4), bullet[b].x, bullet[b].y);
1517 break;
1518 case BULLET_TRI1:
1519 cx = xpart(bullet[b].angle, GRAIN);
1520 cy = ypart(bullet[b].angle, GRAIN);
1521 c2x = (cx * 100) / GRAIN;
1522 c2y = (cy * 100) / GRAIN;
1523 bullet[b].x_speed += c2x;
1524 bullet[b].y_speed += c2y;
1525 drag_bullet(b, 0.007);
1526 passing_colour [0] = TRANS_DRED;//bullet[b].colours [0];
1527 passing_colour [1] = TRANS_ORANGE;//bullet[b].colours [2]; // 1->1
1528 passing_colour [2] = TRANS_YELLOW;//bullet[b].colours [3]; // 2->3
1529 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 3, bullet[b].y + grand(3001) - 1500 - cy * 3, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 110, passing_colour);
1530 add_light(LIGHT_NORMAL, 8 + grand(4), bullet[b].x, bullet[b].y);
1531 break;
1532 case BULLET_TRI2:
1533 cx = xpart(bullet[b].angle, GRAIN);
1534 cy = ypart(bullet[b].angle, GRAIN);
1535 c2x = (cx * 140) / GRAIN;
1536 c2y = (cy * 140) / GRAIN;
1537 bullet[b].x_speed += c2x;
1538 bullet[b].y_speed += c2y;
1539 drag_bullet(b, 0.006);
1540 passing_colour [0] = TRANS_DBLUE;//bullet[b].colours [0];
1541 passing_colour [1] = TRANS_LBLUE;//bullet[b].colours [2]; // 1->1
1542 passing_colour [2] = TRANS_WHITE;//bullet[b].colours [3]; // 2->3
1543 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 3, bullet[b].y + grand(3001) - 1500 - cy * 3, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 110, passing_colour);
1544 add_light(LIGHT_NORMAL, 10 + grand(4), bullet[b].x, bullet[b].y);
1545 break;
1546 case BULLET_TRI3:
1547 cx = xpart(bullet[b].angle, GRAIN);
1548 cy = ypart(bullet[b].angle, GRAIN);
1549 c2x = (cx * 160) / GRAIN;
1550 c2y = (cy * 160) / GRAIN;
1551 bullet[b].x_speed += c2x;
1552 bullet[b].y_speed += c2y;
1553 drag_bullet(b, 0.005);
1554 passing_colour [0] = TRANS_ORANGE;//bullet[b].colours [0];
1555 passing_colour [1] = TRANS_YELLOW;//bullet[b].colours [2]; // 1->1
1556 passing_colour [2] = TRANS_WHITE;//bullet[b].colours [3]; // 2->3
1557 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 3, bullet[b].y + grand(3001) - 1500 - cy * 3, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 110, passing_colour);
1558 add_light(LIGHT_NORMAL, 12 + grand(4), bullet[b].x, bullet[b].y);
1559 break;
1560 case BULLET_OVERTRI:
1561 cx = xpart(bullet[b].angle, GRAIN);
1562 cy = ypart(bullet[b].angle, GRAIN);
1563 c2x = (cx * 100) / GRAIN;
1564 c2y = (cy * 100) / GRAIN;
1565 bullet[b].x_speed += c2x;
1566 bullet[b].y_speed += c2y;
1567 drag_bullet(b, 0.003);
1568 passing_colour [0] = TRANS_DGREEN;//bullet[b].colours [0];
1569 passing_colour [1] = TRANS_LGREEN;//bullet[b].colours [2]; // 1->1
1570 passing_colour [2] = TRANS_YELLOW;//bullet[b].colours [3]; // 2->3
1571 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 3, bullet[b].y + grand(3001) - 1500 - cy * 3, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 180, passing_colour);
1572 add_light(LIGHT_NORMAL, 18 + grand(6), bullet[b].x, bullet[b].y);
1573 break;
1574 case BULLET_BURNING_EYE:
1575 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1576 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1577 c2x = (cx * bullet[b].special4) / GRAIN;
1578 c2y = (cy * bullet[b].special4) / GRAIN;
1579 bullet[b].x_speed += c2x;
1580 bullet[b].y_speed += c2y;
1581 drag_bullet(b, 0.03);
1582 {
1583 passing_colour [0] = TRANS_DRED;//bullet[b].colours [0];
1584 passing_colour [1] = TRANS_LRED;//bullet[b].colours [2]; // 1->1
1585 passing_colour [2] = TRANS_YELLOW;//bullet[b].colours [3]; // 2->3
1586 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx * 3, bullet[b].y + grand(3001) - 1500 - cy * 3, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 90, passing_colour);
1587 }
1588 add_light(LIGHT_NORMAL, 4 + grand(3), bullet[b].x + bullet[b].x_speed, bullet[b].y + bullet[b].y_speed);
1589 break;
1590 case BULLET_MISSILE:
1591 /*
1592 KEEP for WORMS!
1593
1594 passing_colour [0] = COLOUR_GREY1;
1595 passing_colour [1] = COLOUR_GREY3;
1596 passing_colour [2] = COLOUR_GREY5;
1597 passing_colour [3] = COLOUR_WHITE;
1598 create_cloud(CLOUD_FADING_LINE,
1599 bullet[b].x - bullet[b].x_speed,
1600 bullet[b].y - bullet[b].y_speed,
1601 bullet[b].x,
1602 bullet[b].y,
1603 0,
1604 0,
1605 10, 1,0, 0, 0, 0, passing_colour);*/
1606 if (bullet[b].special3 == LOCK_ACTOR0 || bullet[b].special3 == LOCK_ACTOR1)
1607 {
1608
1609 if (bullet[b].special3 == LOCK_ACTOR0)
1610 cx = 0;
1611 else
1612 cx = 1;
1613 if (hypot(bullet[b].y - actor[cx].y, bullet[b].x - actor[cx].x)
1614 < 30000)
1615 // < 5000)
1616 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x, actor[cx].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
1617 else
1618 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[cx].x + (actor[cx].x_speed * bullet[b].special5), actor[cx].y + (actor[cx].y_speed * bullet[b].special5), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
1619 }
1620 else
1621 if (bullet[b].special3 >= 0)
1622 {
1623 // destroyed enemies have locks cleared in register_destroyed (enemy.c)
1624 if (hypot(bullet[b].y - enemy[bullet[b].special3].y, bullet[b].x - enemy[bullet[b].special3].x)
1625 < 30000)
1626 // < 5000)
1627 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, enemy[bullet[b].special3].x, enemy[bullet[b].special3].y, bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
1628 else
1629 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, enemy[bullet[b].special3].x + (enemy[bullet[b].special3].x_speed * bullet[b].special5), enemy[bullet[b].special3].y + (enemy[bullet[b].special3].y_speed * bullet[b].special5), bullet[b].angle - ANGLE_QUARTER, bullet[b].special4) + ANGLE_QUARTER;
1630 // What this does: if missile is close to enemy, heads straight for it.
1631 // Otherwise, leads it slightly (to an extent specified by bullet[b].special5)
1632 // For this reason, enemy[].x_speed must be set correctly even for enemies for whom it's irrelevant
1633 // (eg crawlers).
1634 }
1635 cx = xpart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1636 cy = ypart(bullet[b].angle - ANGLE_QUARTER, GRAIN);
1637 c2x = (cx * bullet[b].special1) / GRAIN;
1638 c2y = (cy * bullet[b].special1) / GRAIN;
1639 bullet[b].x_speed += c2x;
1640 bullet[b].y_speed += c2y;
1641 drag_bullet(b, 0.03);
1642
1643 // special1 = 200 + actor[sactor].upgraded_system [UPG_ROCKET] * 50;
1644 if (crandom(bullet[b].special1) > 100)
1645 {
1646 passing_colour [0] = bullet[b].colours [0];
1647 passing_colour [1] = bullet[b].colours [2]; // 1->1
1648 passing_colour [2] = bullet[b].colours [3]; // 2->3
1649
1650 // place_rocket_trail(bullet[b].x, bullet[b].y, bullet[b].x_speed + cx*3, bullet[b].y_speed + cy*3, 5 + grand(5), passing_colour);
1651 // place_rocket_trail(bullet[b].x, bullet[b].y, bullet[b].x_speed + cx*3, bullet[b].y_speed + cy*3, 1, passing_colour);
1652 place_rocket_trail(bullet[b].x + grand(3001) - 1500 - cx, bullet[b].y + grand(3001) - 1500 - cy, bullet[b].x_speed - cx*2, bullet[b].y_speed - cy*2, 140, passing_colour);
1653 }
1654 add_light(LIGHT_NORMAL, 10, bullet[b].x, bullet[b].y);
1655 break;
1656 case BULLET_BLAST:
1657 // add_light(LIGHT_NORMAL, 8 + grand(4), bullet[b].x, bullet[b].y);
1658 passing_colour [0] = bullet[b].colours [0];
1659 passing_colour [1] = bullet[b].colours [1];
1660 passing_colour [2] = bullet[b].colours [2];
1661 passing_colour [3] = bullet[b].colours [3];
1662 create_cloud(CLOUD_BLAST_CIRCLE,
1663 bullet[b].x + grand(5001) - 2500,
1664 bullet[b].y + grand(5001) - 2500,
1665 0, 0,
1666 bullet[b].x_speed, bullet[b].y_speed,
1667 25 + grand(10), 1, 1, 0, 0, 0, passing_colour);
1668 break;
1669 case BULLET_BIGBALL1:
1670 // add_light(LIGHT_NORMAL, 8 + grand(4), bullet[b].x, bullet[b].y);
1671 passing_colour [0] = bullet[b].colours [0];
1672 passing_colour [1] = bullet[b].colours [1];
1673 passing_colour [2] = bullet[b].colours [2];
1674 passing_colour [3] = bullet[b].colours [3];
1675 if (grand(2) == 0)
1676 create_cloud(CLOUD_BLAST_CIRCLE,
1677 bullet[b].x + grand(4001 + bullet[b].special2 * 1000) - (2000 + bullet[b].special2 * 500),
1678 bullet[b].y + grand(4001 + bullet[b].special2 * 1000) - (2000 + bullet[b].special2 * 500), //grand(10001) - 5000,
1679 0, 0,
1680 bullet[b].x_speed, bullet[b].y_speed,
1681 35 + grand(20), 1, 0, 0, 0, 0, passing_colour);
1682 break;
1683 case BULLET_FLAME:
1684 passing_colour [0] = bullet[b].colours [0];
1685 cx = bullet[b].x + grand(8001) - 2000;
1686 cy = bullet[b].y + grand(8001) - 2000;
1687 c2x = 200; //300 - bullet[b].timeout * 10;
1688 add_light(LIGHT_NORMAL, 30 + grand(10), cx, cy);
1689 create_cloud(CLOUD_FLAME_CIRCLE,
1690 cx, cy, 0,0, bullet[b].x_speed, bullet[b].y_speed,
1691 c2x + crandom(200),30 + grand(3),1, 0, 0, 0, passing_colour);
1692 passing_colour [0] = bullet[b].colours [1];
1693 create_cloud(CLOUD_FLAME_CIRCLE,
1694 cx, cy, 0,0, bullet[b].x_speed, bullet[b].y_speed,
1695 c2x + crandom(200),20 + grand(3),0, 0, 0, 0, passing_colour);
1696 passing_colour [0] = bullet[b].colours [2];
1697 create_cloud(CLOUD_FLAME_CIRCLE,
1698 cx, cy, 0,0, 0,0, //bullet[b].x_speed, bullet[b].y_speed,
1699 c2x + crandom(200),10 + grand(3),0, 0, 0, 0, passing_colour);
1700 blast(bullet[b].x, bullet[b].y, 20000, 75, 1000, bullet[b].owner);
1701 break;
1702 case BULLET_EYE_DESOLATION_SMALL:
1703 passing_colour [0] = TRANS_YELLOW;
1704 passing_colour [1] = TRANS_ORANGE;
1705 passing_colour [2] = TRANS_LRED;
1706 passing_colour [3] = TRANS_DRED;
1707 create_cloud(CLOUD_BLAST_CIRCLE,
1708 bullet[b].x + grand(5001) - 2500,
1709 bullet[b].y + grand(5001) - 2500,
1710 0, 0, 0, 0,
1711 30 + grand(10), 1, 1, 0, 0, 0, passing_colour);
1712 add_light(LIGHT_NORMAL, 7 + grand(3), bullet[b].x, bullet[b].y);
1713 drag_bullet(b, 0.02);
1714 break;
1715 case BULLET_TWIRLY1:
1716 passing_colour [0] = bullet[b].colours [0];
1717 passing_colour [1] = bullet[b].colours [1];
1718 passing_colour [2] = bullet[b].colours [2];
1719 passing_colour [3] = bullet[b].colours [3];
1720 cx = (bullet[b].timeout % 32) * 32;
1721 if (bullet[b].special1 == 1)
1722 cx = ANGLE_FULL - cx;
1723 create_cloud(CLOUD_BLAST_CIRCLE,
1724 bullet[b].x + xpart(cx, 10000) + grand(5001) - 2500,
1725 bullet[b].y + ypart(cx, 10000) + grand(5001) - 2500,
1726 0, 0, 0, 0,
1727 30 + grand(10), 3, 0, 0, 0, 0, passing_colour);
1728 create_cloud(CLOUD_BLAST_CIRCLE,
1729 bullet[b].x + xpart(cx + ANGLE_HALF, 10000) + grand(5001) - 2500,
1730 bullet[b].y + ypart(cx + ANGLE_HALF, 10000) + grand(5001) - 2500,
1731 0, 0, 0, 0,
1732 30 + grand(10), 3, 0, 0, 0, 0, passing_colour);
1733 break;
1734 case BULLET_TWIRLY2:
1735 passing_colour [0] = bullet[b].colours [0];
1736 passing_colour [1] = bullet[b].colours [1];
1737 passing_colour [2] = bullet[b].colours [2];
1738 passing_colour [3] = bullet[b].colours [3];
1739 cx = (bullet[b].timeout % 32) * 32;
1740 if (bullet[b].special1 == 1)
1741 cx = ANGLE_FULL - cx;
1742 create_cloud(CLOUD_BLAST_CIRCLE,
1743 bullet[b].x + xpart(cx, 6000) + grand(5001) - 2500,
1744 bullet[b].y + ypart(cx, 6000) + grand(5001) - 2500,
1745 0, 0, 0, 0,
1746 20 + grand(10), 2, 0, 0, 0, 0, passing_colour);
1747 create_cloud(CLOUD_BLAST_CIRCLE,
1748 bullet[b].x + xpart(cx + ANGLE_HALF, 6000) + grand(5001) - 2500,
1749 bullet[b].y + ypart(cx + ANGLE_HALF, 6000) + grand(5001) - 2500,
1750 0, 0, 0, 0,
1751 20 + grand(10), 2, 0, 0, 0, 0, passing_colour);
1752 break;
1753 case BULLET_TWIRLY3:
1754 passing_colour [0] = bullet[b].colours [0];
1755 passing_colour [1] = bullet[b].colours [1];
1756 passing_colour [2] = bullet[b].colours [2];
1757 passing_colour [3] = bullet[b].colours [3];
1758 create_cloud(CLOUD_BLAST_CIRCLE,
1759 bullet[b].x + grand(9001) - 4500,
1760 bullet[b].y + grand(9001) - 4500,
1761 0, 0, 0, 0,
1762 30 + grand(15), 2, 0, 0, 0, 0, passing_colour);
1763 break;
1764 case BULLET_TWISTY:
1765 passing_colour [0] = bullet[b].colours [1];
1766 passing_colour [1] = bullet[b].colours [2];
1767 passing_colour [2] = bullet[b].colours [3];
1768 passing_colour [3] = bullet[b].colours [3];
1769 c2x = (bullet[b].special1 % 32) * 32;
1770 c2y = xpart(c2x, 13 * GRAIN);
1771 bullet[b].size = abs(c2y) + 2000;
1772 cx = bullet[b].x + xpart(bullet[b].angle + ANGLE_QUARTER, c2y);
1773 cy = bullet[b].y + ypart(bullet[b].angle + ANGLE_QUARTER, c2y);
1774 create_cloud(CLOUD_BLAST_CIRCLE,
1775 cx + grand(5001) - 2500,
1776 cy + grand(5001) - 2500,
1777 0, 0, 0, 0,
1778 30 + grand(15), 3, 0, 0, 0, 0, passing_colour);
1779 cx = bullet[b].x + xpart(bullet[b].angle - ANGLE_QUARTER, c2y);
1780 cy = bullet[b].y + ypart(bullet[b].angle - ANGLE_QUARTER, c2y);
1781 create_cloud(CLOUD_BLAST_CIRCLE,
1782 cx + grand(5001) - 2500,
1783 cy + grand(5001) - 2500,
1784 0, 0, 0, 0,
1785 30 + grand(15), 3, 0, 0, 0, 0, passing_colour);
1786 bullet[b].special1 ++;
1787 break;
1788 case BULLET_CURVE:
1789 cx = xpart(bullet[b].angle + ANGLE_QUARTER, 200);
1790 cy = ypart(bullet[b].angle + ANGLE_QUARTER, 200);
1791 bullet[b].x_speed += cx;
1792 bullet[b].y_speed += cy;
1793 break;
1794 case BULLET_PLASMA:
1795 passing_colour [0] = bullet[b].colours [grand(4)];
1796 cx = bullet[b].x_speed / 3;
1797 cy = bullet[b].y_speed / 3;
1798 create_cloud(CLOUD_SMALL_TRANS_CIRCLE,
1799 bullet[b].x + grand(4001) - 2000,
1800 bullet[b].y + grand(4001) - 2000,
1801 cx, cy,
1802 0,
1803 0,
1804 250 + crandom(200),70,0, 0, 0, 0, passing_colour);
1805 break;
1806 case BULLET_TORPEDO:
1807 // bullet[b].angle += grand(11) - 5;
1808 cx = xpart(bullet[b].angle, 205);
1809 cy = ypart(bullet[b].angle, 205);
1810 bullet[b].x_speed += cx;
1811 bullet[b].y_speed += cy;
1812 drag_bullet(b, 0.01);
1813 if (bullet[b].timeout % 4 != 0)
1814 break;
1815 passing_colour [0] = COLOUR_YELLOW6;
1816 create_cloud(CLOUD_GROWING_CIRCLE,
1817 bullet[b].x,
1818 bullet[b].y,
1819 0, 0,
1820 // bullet[b].x_speed - cx*5, bullet[b].y_speed - cy*5,
1821 0, 0,
1822 100,3,0, 0, 100, 0, passing_colour);
1823 break;
1824 case BULLET_BOSS4:
1825 passing_colour [0] = TRANS_YELLOW;//bullet[b].colours [grand(4)];
1826 if (grand(3) == 0)
1827 passing_colour [0] = TRANS_WHITE;
1828 cx = bullet[b].x_speed / 3;
1829 cy = bullet[b].y_speed / 3;
1830 create_cloud(CLOUD_SMALL_TRANS_CIRCLE,
1831 bullet[b].x + grand(8001) - 4000,
1832 bullet[b].y + grand(8001) - 4000,
1833 cx, cy,
1834 0,
1835 0,
1836 500 + crandom(300),70,0, 0, 0, 0, passing_colour);
1837 create_cloud(CLOUD_SMALL_TRANS_CIRCLE,
1838 bullet[b].x + xpart(bullet[b].timeout * 40 + bullet[b].angle, 30000),
1839 bullet[b].y + ypart(bullet[b].timeout * 40 + bullet[b].angle, 30000),
1840 0, 0,
1841 0,
1842 0,
1843 300 + crandom(200),50,0, 0, 0, 0, passing_colour);
1844 create_cloud(CLOUD_SMALL_TRANS_CIRCLE,
1845 bullet[b].x + xpart(ANGLE_FULL - (bullet[b].timeout * 40 + bullet[b].angle), 30000),
1846 bullet[b].y + ypart(ANGLE_FULL - (bullet[b].timeout * 40 + bullet[b].angle), 30000),
1847 0, 0,
1848 0,
1849 0,
1850 300 + crandom(200),50,0, 0, 0, 0, passing_colour);
1851 // if (bullet[b].timeout % 16 == 0)
1852 // bullet_sound(b, BSOUND_MINE2);
1853 break;
1854 case BULLET_FLAK:
1855 if (counter % 3 != 0)
1856 break;
1857 passing_colour [0] = COLOUR_RED8;
1858 create_cloud(CLOUD_SHRINKING_CIRCLE,
1859 bullet[b].x,
1860 bullet[b].y,
1861 0, 0,
1862 0, 0,
1863 500,-50,10, 0, 0, 0, passing_colour);
1864 break;
1865 case BULLET_LINES:
1866 passing_colour [0] = COLOUR_GREY6;
1867 // cx = bullet[b].x_speed / 3;
1868 // cy = bullet[b].y_speed / 3;
1869 create_cloud(CLOUD_LINE_SHADOW,
1870 bullet[b].x,
1871 bullet[b].y,
1872 0, 0,
1873 0,
1874 0,
1875 20 + grand(60),3 + grand(7),0, bullet[b].angle, 0, 0, passing_colour);
1876 break;
1877 case BULLET_MINE1:
1878 case BULLET_MINE2:
1879 case BULLET_MINE3:
1880 // if (grand(4) == 0)
1881 if (grand(3) == 0 && grand(abs(bullet[b].x_speed) + abs(bullet[b].y_speed)) > 2000)
1882 {
1883 passing_colour[0] = COLOUR_YELLOW8;
1884 passing_colour[1] = COLOUR_YELLOW6;
1885 passing_colour[2] = COLOUR_ORANGE6;
1886 passing_colour[3] = COLOUR_RED5;
1887 passing_colour[4] = COLOUR_RED4;
1888 create_cloud(CLOUD_SPECK, bullet[b].x + grand(4001) - 2000, bullet[b].y + grand(4001) - 2000,
1889 0, 0, 0, 0, 16 + grand(9), 1,
1890 0, 0, 0, 0, passing_colour);
1891 }
1892 drag_bullet(b, 0.08);
1893 if (abs(bullet[b].x_speed) + abs(bullet[b].y_speed) < 1000)
1894 {
1895 bullet[b].x_speed = 0;
1896 bullet[b].y_speed = 0;
1897 }
1898 break;
1899 case BULLET_BFLAK:
1900 if (grand(3) != 0 && grand(abs(bullet[b].x_speed) + abs(bullet[b].y_speed)) > 1900)
1901 {
1902 passing_colour[0] = COLOUR_WHITE;
1903 passing_colour[1] = COLOUR_BLUE8;
1904 passing_colour[2] = COLOUR_BLUE7;
1905 passing_colour[3] = COLOUR_BLUE5;
1906 passing_colour[4] = COLOUR_BLUE3;
1907 create_cloud(CLOUD_SPECK, bullet[b].x + grand(4001) - 2000, bullet[b].y + grand(4001) - 2000,
1908 0, 0, 0, 0, 16 + grand(9), 1,
1909 0, 0, 0, 0, passing_colour);
1910 }
1911 drag_bullet(b, 0.06);
1912 break;
1913 case BULLET_BFLAK2:
1914 if (grand(3) != 0 && grand(abs(bullet[b].x_speed) + abs(bullet[b].y_speed)) > 1900)
1915 {
1916 passing_colour[0] = COLOUR_WHITE;
1917 passing_colour[1] = COLOUR_YELLOW8;
1918 passing_colour[2] = COLOUR_YELLOW7;
1919 passing_colour[3] = COLOUR_ORANGE6;
1920 passing_colour[4] = COLOUR_RED5;
1921 create_cloud(CLOUD_SPECK, bullet[b].x + grand(4001) - 2000, bullet[b].y + grand(4001) - 2000,
1922 0, 0, 0, 0, 16 + grand(9), 1,
1923 0, 0, 0, 0, passing_colour);
1924 }
1925 drag_bullet(b, 0.06);
1926 break;
1927 // case BULLET_MBOMB:
1928 case BULLET_E_BOMB:
1929 if (grand(abs(bullet[b].x_speed) + abs(bullet[b].y_speed)) > 1500)
1930 {
1931 passing_colour[0] = COLOUR_YELLOW8;
1932 passing_colour[1] = COLOUR_YELLOW6;
1933 passing_colour[2] = COLOUR_ORANGE6;
1934 passing_colour[3] = COLOUR_RED5;
1935 passing_colour[4] = COLOUR_RED4;
1936 create_cloud(CLOUD_SPECK, bullet[b].x + grand(4001) - 2000, bullet[b].y + grand(4001) - 2000,
1937 0, 0, 0, 0, 16 + grand(9), 1,
1938 0, 0, 0, 0, passing_colour);
1939 }
1940 drag_bullet(b, 0.03);
1941 break;
1942 case BULLET_PRESEEKMINE:
1943 // if (grand(4) == 0)
1944 if (grand(3) == 0 && grand(abs(bullet[b].x_speed) + abs(bullet[b].y_speed)) > 2000)
1945 {
1946 passing_colour[0] = COLOUR_WHITE;
1947 passing_colour[1] = COLOUR_BLUE8;
1948 passing_colour[2] = COLOUR_BLUE6;
1949 passing_colour[3] = COLOUR_BLUE4;
1950 passing_colour[4] = COLOUR_BLUE2;
1951 create_cloud(CLOUD_SPECK, bullet[b].x + grand(6001) - 3000, bullet[b].y + grand(6001) - 3000,
1952 0, 0, 0, 0, 24, 1,
1953 0, 0, 0, 0, passing_colour);
1954 }
1955 drag_bullet(b, 0.08);
1956 if (abs(bullet[b].x_speed) + abs(bullet[b].y_speed) < 1000)
1957 bullet[b].timeout = 1;
1958 else
1959 bullet[b].timeout ++;
1960 break;
1961 case BULLET_PREMINE:
1962 // if (grand(4) == 0 && abs(bullet[b].x_speed) + abs(bullet[b].y_speed) > 2000)
1963 if (grand(3) == 0 && grand(abs(bullet[b].x_speed) + abs(bullet[b].y_speed)) > 2000)
1964 {
1965 passing_colour[0] = COLOUR_YELLOW8;
1966 passing_colour[1] = COLOUR_RED8;
1967 passing_colour[2] = COLOUR_RED6;
1968 passing_colour[3] = COLOUR_RED4;
1969 passing_colour[4] = COLOUR_RED2;
1970 create_cloud(CLOUD_SPECK, bullet[b].x + grand(6001) - 3000, bullet[b].y + grand(6001) - 3000,
1971 0, 0, 0, 0, 24, 1,
1972 0, 0, 0, 0, passing_colour);
1973 }
1974 drag_bullet(b, 0.08);
1975 if (abs(bullet[b].x_speed) + abs(bullet[b].y_speed) < 1000)
1976 bullet[b].timeout = 1;
1977 else
1978 bullet[b].timeout ++;
1979 break;
1980 case BULLET_SEEKMINE:
1981 case BULLET_MINE:
1982 bullet[b].x_speed = 0;
1983 bullet[b].y_speed = 0;
1984 break;
1985 case BULLET_SEEKER_BLOB:
1986 if (bullet[b].special1 == ATTACK_NONE)
1987 break;
1988 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 4);
1989 // cx = cos(angle_to_radians(bullet[b].angle) + ANGLE_QUARTER) * 1200;
1990 // cy = sin(angle_to_radians(bullet[b].angle) + ANGLE_QUARTER) * 1200;
1991 cx = xpart(bullet[b].angle, 1900);
1992 cy = ypart(bullet[b].angle, 1900);
1993 bullet[b].x_speed = cx;
1994 bullet[b].y_speed = cy;
1995 break;
1996 case BULLET_PRONG:
1997 bullet[b].x_speed += grand(201) - 100;
1998 bullet[b].y_speed += grand(201) - 100;
1999 bullet[b].angle += 64;
2000 if (bullet[b].angle > ANGLE_FULL)
2001 bullet[b].angle -= ANGLE_FULL;
2002 break;
2003 case BULLET_SEEKER_BLOB3:
2004 passing_colour [0] = TRANS_LBLUE;
2005 if (grand(3) == 0)
2006 passing_colour [0] = TRANS_DBLUE;
2007 // if (grand(4) == 0)
2008 // passing_colour [0] = TRANS_WHITE;
2009 create_cloud(CLOUD_SMALL_TRANS_CIRCLE,
2010 bullet[b].x + grand(4001) - 2000,
2011 bullet[b].y + grand(4001) - 2000,
2012 0, 0, 0, 0, 250 + crandom(200),10,5, 0, 0, 0, passing_colour);
2013 if (bullet[b].special1 == ATTACK_NONE)
2014 break;
2015 bullet[b].angle = enemy_bullet_track_target(b, bullet[b].special1, 8);
2016 cx = xpart(bullet[b].angle, 2300);
2017 cy = ypart(bullet[b].angle, 2300);
2018 bullet[b].x_speed = cx;
2019 bullet[b].y_speed = cy;
2020 break;
2021 case BULLET_STING:
2022 if (bullet[b].timeout % 3 != 0)
2023 break;
2024 passing_colour[0] = bullet[b].colours [1];
2025 passing_colour[1] = bullet[b].colours [1];
2026 passing_colour[2] = bullet[b].colours [2];
2027 passing_colour[3] = bullet[b].colours [2];
2028 passing_colour[4] = bullet[b].colours [3];
2029 // create_cloud(CLOUD_SPECK, bullet[b].x, bullet[b].y, 0, 0,
2030 // 0, 0, 15 + grand(15), 1,
2031 // 1, 0, 0, 0, passing_colour);
2032 create_cloud(CLOUD_SPECK, bullet[b].x + grand(5001) - 2500, bullet[b].y + grand(5001) - 2500, 0, 0,
2033 0, 0, 15 + grand(15), 1,
2034 1, 0, 0, 0, passing_colour);
2035 break;
2036 /* case BULLET_PRONG:
2037 bullet[b].x_speed += grand(201) - 100;
2038 bullet[b].y_speed += grand(201) - 100;
2039 bullet[b].angle += 64;
2040 if (bullet[b].angle > ANGLE_FULL)
2041 bullet[b].angle -= ANGLE_FULL;
2042 break;*/
2043 }
2044 // other switch after move_bullet
2045
2046 // if (counter % 5 != 0)
2047 // return;
2048
2049 if (move_bullet(b, 1) == 0)
2050 return;
2051
2052 // other switch before move_bullet
2053 switch(bullet[b].type)
2054 {
2055 case BULLET_HOSTILE:
2056 case BULLET_SHOCK:
2057 // bullet[b].x2 = bullet[b].x;
2058 // bullet[b].y2 = bullet[b].y;
2059 bullet[b].x += grand(20001) - 10000;
2060 bullet[b].y += grand(20001) - 10000;
2061 passing_colour [0] = bullet[b].colours [0];
2062 passing_colour [1] = bullet[b].colours [1];
2063 passing_colour [2] = bullet[b].colours [2];
2064 passing_colour [3] = bullet[b].colours [3];
2065 cx = bullet[b].x;// + grand(16001) - 8000;
2066 cy = bullet[b].y;// + grand(16001) - 8000;
2067 create_cloud(CLOUD_FADING_LINE,
2068 bullet[b].x2 - bullet[b].x_speed,
2069 bullet[b].y2 - bullet[b].y_speed,
2070 bullet[b].x,
2071 bullet[b].y,
2072 0,
2073 0,
2074 10, 1,0, 0, 0, 0, passing_colour);
2075 bullet[b].x2 = cx;
2076 bullet[b].y2 = cy;
2077 break;
2078 case BULLET_ZIGZAG1:
2079 passing_colour [0] = bullet[b].colours [0];
2080 passing_colour [1] = bullet[b].colours [1];
2081 passing_colour [2] = bullet[b].colours [2];
2082 passing_colour [3] = bullet[b].colours [3];
2083 if (bullet[b].timeout % 2 == 0)
2084 {
2085 cx = bullet[b].x + xpart(bullet[b].angle + ANGLE_QUARTER, bullet[b].special1);
2086 cy = bullet[b].y + ypart(bullet[b].angle + ANGLE_QUARTER, bullet[b].special1);
2087 }
2088 else
2089 {
2090 cx = bullet[b].x + xpart(bullet[b].angle - ANGLE_QUARTER, bullet[b].special1);
2091 cy = bullet[b].y + ypart(bullet[b].angle - ANGLE_QUARTER, bullet[b].special1);
2092 }
2093 create_cloud(CLOUD_FADING_LINE,
2094 bullet[b].x2 - bullet[b].x_speed,
2095 bullet[b].y2 - bullet[b].y_speed,
2096 cx,
2097 cy,
2098 0,
2099 0,
2100 10, 1,0, 0, 0, 0, passing_colour);
2101 bullet[b].x2 = cx;
2102 bullet[b].y2 = cy;
2103 break;
2104 /* case BULLET_SHOCK_PATH:
2105 case BULLET_GOLDEN_PATH:
2106 // case BULLET_SHOCK:
2107 passing_colour [0] = bullet[b].colours [0];
2108 passing_colour [1] = bullet[b].colours [1];
2109 passing_colour [2] = bullet[b].colours [2];
2110 passing_colour [3] = bullet[b].colours [3];
2111 cx = bullet[b].x + grand(12001) - 6000;
2112 cy = bullet[b].y + grand(12001) - 6000;
2113 create_cloud(CLOUD_FADING_LINE,
2114 bullet[b].x2 - bullet[b].x_speed,
2115 bullet[b].y2 - bullet[b].y_speed,
2116 cx,
2117 cy,
2118 0,
2119 0,
2120 10, 2,0, 0, 0, 0, passing_colour);
2121 bullet[b].x2 = cx;
2122 bullet[b].y2 = cy;
2123 break;
2124 case BULLET_GOLDEN_PATH_SMALL:
2125 case BULLET_SHOCK_PATH_SMALL:
2126 passing_colour [0] = bullet[b].colours [0];
2127 passing_colour [1] = bullet[b].colours [1];
2128 passing_colour [2] = bullet[b].colours [2];
2129 passing_colour [3] = bullet[b].colours [3];
2130 cx = bullet[b].x + grand(6001) - 3000;
2131 cy = bullet[b].y + grand(6001) - 3000;
2132 create_cloud(CLOUD_FADING_LINE,
2133 bullet[b].x2 - bullet[b].x_speed,
2134 bullet[b].y2 - bullet[b].y_speed,
2135 cx,
2136 cy,
2137 0,
2138 0,
2139 10, 3,0, 0, 0, 0, passing_colour);
2140 bullet[b].x2 = cx;
2141 bullet[b].y2 = cy;
2142 break;
2143 case BULLET_TORPEDO2:
2144 if (bullet[b].timeout < 35)
2145 {
2146 if (bullet[b].timeout == 34)
2147 bullet_sound(b, BSOUND_TUBE);
2148 cx = xpart(bullet[b].angle, 400 + (35 - bullet[b].timeout) * 20);
2149 cy = ypart(bullet[b].angle, 400 + (35 - bullet[b].timeout) * 20);
2150 bullet[b].x_speed += cx;
2151 bullet[b].y_speed += cy;
2152 // drag_bullet(b, 0.01);
2153 passing_colour [0] = COLOUR_GREY1;
2154 passing_colour [1] = COLOUR_GREY3;
2155 passing_colour [2] = COLOUR_GREY5;
2156 passing_colour [3] = COLOUR_WHITE;
2157 create_cloud(CLOUD_FADING_LINE,
2158 bullet[b].x2 - bullet[b].x_speed,
2159 bullet[b].y2 - bullet[b].y_speed,
2160 bullet[b].x,
2161 bullet[b].y,
2162 0,
2163 0,
2164 10, 1,0, 0, 0, 0, passing_colour);
2165 bullet[b].x2 = bullet[b].x;
2166 bullet[b].y2 = bullet[b].y;
2167 }
2168 break;
2169 case BULLET_SUPERSTING:
2170 // if (bullet[b].timeout % 2 == 0)
2171 {
2172 passing_colour [3] = bullet[b].colours [0];
2173 passing_colour [2] = bullet[b].colours [1];
2174 passing_colour [1] = bullet[b].colours [2];
2175 passing_colour [0] = bullet[b].colours [3];
2176 c2x = xpart(bullet[b].angle + ANGLE_QUARTER, 3000);
2177 c2y = ypart(bullet[b].angle + ANGLE_QUARTER, 3000);
2178 create_cloud(CLOUD_FADING_LINE,
2179 bullet[b].x2 - (bullet[b].x_speed * 1) + c2x,
2180 bullet[b].y2 - (bullet[b].y_speed * 1) + c2y,
2181 bullet[b].x - c2x,
2182 bullet[b].y - c2y,
2183 0,
2184 0,
2185 10, 1,0, 0, 0, 0, passing_colour);
2186 create_cloud(CLOUD_FADING_LINE,
2187 bullet[b].x - (bullet[b].x_speed * 1) - c2x,
2188 bullet[b].y - (bullet[b].y_speed * 1) - c2y,
2189 bullet[b].x + c2x,
2190 bullet[b].y + c2y,
2191 0,
2192 0,
2193 10, 1,0, 0, 0, 0, passing_colour);
2194 }*/
2195
2196
2197
2198 // bullet[b].x2 = bullet[b].x + c2x;
2199 // bullet[b].y2 = bullet[b].y + c2y;
2200 /* c2x = cos(angle_to_radians(bullet[b].angle + ANGLE_QUARTER)) * 5000;
2201 c2y = sin(angle_to_radians(bullet[b].angle + ANGLE_QUARTER)) * 5000;
2202 // cx = bullet[b].x + c2x;
2203 // cy = bullet[b].y + c2y;
2204 create_cloud(CLOUD_FADING_LINE,
2205 // bullet[b].x2 - bullet[b].x_speed + c2x,
2206 // bullet[b].y2 - bullet[b].y_speed + c2y,
2207 bullet[b].x2 + c2x,
2208 bullet[b].y2 + c2y,
2209 bullet[b].x - c2x,
2210 bullet[b].y - c2y,
2211 0,
2212 0,
2213 10, 1,0, 0, 0, 0, passing_colour);
2214 bullet[b].x2 = bullet[b].x - c2x;
2215 bullet[b].y2 = bullet[b].y - c2y;*/
2216 break;
2217
2218 }
2219
2220
2221
2222 int things [2];
2223 int k, sh;
2224
2225 if (bullet[b].owner == OWNER_ENEMY || game.type == GAME_DUEL)
2226 {
2227 k = detect_collision(b, things);
2228
2229 if (k != -1)
2230 {
2231 bullet[b].x = things [0];
2232 bullet[b].y = things [1];
2233 // bullet_hits_actor
2234 if (bullet[b].mass > 0)
2235 {
2236 actor[k].x_speed += (bullet[b].x_speed * bullet[b].mass) / actor[k].mass;
2237 actor[k].y_speed += (bullet[b].y_speed * bullet[b].mass) / actor[k].mass;
2238 actor[k].screen_shake_time += bullet[b].mass / 20;
2239 if (actor[k].screen_shake_time > 5)
2240 actor[k].screen_shake_time = 5;
2241 }
2242 // hurt_actor must be after force, as actor may be destroyed in it.
2243 hurt_actor(k, bullet[b].owner, bullet[b].damage);
2244 bullet_impact(b, k, HIT_ACTOR);
2245 return;
2246 }
2247 }
2248 // else
2249
2250 if (bullet[b].owner != OWNER_ENEMY) // || game.type == GAME_DUEL)
2251 {
2252 k = detect_enemy_collision(b, things);
2253
2254 if (k != -1)
2255 {
2256 bullet[b].x = things [0];
2257 bullet[b].y = things [1];
2258 if (bullet[b].mass > 0)
2259 {
2260 enemy[k].x_speed += (bullet[b].x_speed * bullet[b].mass) / enemy[k].mass;
2261 enemy[k].y_speed += (bullet[b].y_speed * bullet[b].mass) / enemy[k].mass;
2262 }
2263 sh = check_shielder(k);
2264 if (!sh)
2265 {
2266 enemy_sparks(k, b, bullet[b].x, bullet[b].y, bullet[b].x_speed, bullet[b].y_speed, bullet[b].damage);
2267 int pulse = bullet[b].damage / 6 + 1;
2268 if (pulse > 8)
2269 pulse = 8;
2270 hurt_enemy(k, bullet[b].damage, bullet[b].owner, pulse);
2271 bullet_soundf(b, NWAV_TWING, enemy_sound_pitch(enemy[k].type)); //800 + grand(200) - enemy_pitch(enemy[k].type));
2272 }
2273 else
2274 {
2275 shield_line(k, bullet[b].x, bullet[b].y);
2276 bullet_soundf(b, NWAV_SHIELDE, enemy_sound_pitch(enemy[k].type));
2277 }
2278 bullet_impact(b, k, HIT_ENEMY);
2279 // bullet_hits_enemy
2280 return;
2281 }
2282 }
2283
2284 }
2285
2286 int check_shielder(int e)
2287 {
2288 if (enemy[e].type == ENEMY_SHIELDER1
2289 || enemy[e].type == ENEMY_DEFENDER3_TURRET1)
2290 return 0; // note enemy[e]! (not i)
2291
2292 int i, distance, retval = 0;
2293
2294 for (i = 0; i < NO_ENEMIES; i ++)
2295 {
2296 if (enemy[i].type != ENEMY_SHIELDER1
2297 && enemy[i].type != ENEMY_DEFENDER3_TURRET1)
2298 continue; // note enemy[i]! (not e)
2299
2300 distance = hypot(enemy[e].x - enemy[i].x, enemy[e].y - enemy[i].y);
2301
2302 if (distance <= 300000)
2303 {
2304 shielder_pulse(i, 100);
2305 retval = 1;
2306 }
2307 }
2308
2309 return retval;
2310
2311 }
2312
2313 void shield_line(int e, int bx, int by)
2314 {
2315 /*
2316 TODO:
2317 blasts
2318 collisions
2319 */
2320 int sangle = radians_to_angle(atan2(enemy[e].y - by, enemy[e].x - bx));
2321
2322 int pcol [5];
2323
2324 pcol [4] = TRANS_WHITE;
2325 pcol [3] = TRANS_LBLUE;
2326 pcol [2] = TRANS_LBLUE;
2327 pcol [1] = TRANS_LBLUE;
2328 pcol [0] = TRANS_DBLUE;
2329 /* pcol [3] = TRANS_YELLOW;
2330 pcol [2] = TRANS_LGREEN;
2331 pcol [1] = TRANS_DGREEN;
2332 pcol [0] = TRANS_DGREY;
2333 */
2334 /* create_cloud(CLOUD_SHIELD_LINE, enemy[e].x, enemy[e].y, 0, 0,
2335 0,0, 100, 7,
2336 //enemy[e].x_speed, enemy[e].y_speed, 100, 7,
2337 0, sangle,
2338 enemy[e].radius, 0, pcol);*/
2339
2340 create_cloud(CLOUD_SHIELD_LINE, bx, by, 0, 0,
2341 0,0, 100, 7,
2342 //enemy[e].x_speed, enemy[e].y_speed, 100, 7,
2343 0, sangle,
2344 enemy[e].radius, 0, pcol);
2345
2346
2347 }
2348
2349
2350 void shielder_pulse(int e, int dam)
2351 {
2352 enemy[e].attribute [0] = 15;
2353 return;
2354 }
2355
2356 void enemy_sparks(int e, int b, int bx, int by, int bxs, int bys, int damage)
2357 {
2358
2359 // int i;
2360 int msparks = 2 + grand(damage) / 50;
2361 if (msparks > 5) msparks = 5 - grand(2);
2362 int passing_colours [5];
2363 // int csx, csy;
2364 // int angle = 0;
2365 // int timer = 0;
2366
2367 passing_colours [0] = (enemy[e].colours [0] / 8) * 8 + 7;
2368 passing_colours [1] = passing_colours [0] - 1;
2369 passing_colours [2] = passing_colours [0] - 2;
2370 passing_colours [3] = passing_colours [0] - 3;
2371 passing_colours [4] = passing_colours [0] - 4;
2372 /* passing_colours [1] = passing_colours [0] - 1;
2373 passing_colours [2] = passing_colours [0] - 2;
2374 passing_colours [3] = passing_colours [0] - 3;
2375 passing_colours [4] = passing_colours [0] - 4; */
2376
2377 // for (i = 0; i < msparks; i ++)
2378 // {
2379 // angle = grand(ANGLE_FULL);
2380 // csx = enemy[e].x_speed + xpart(angle, 200 + grand(500));
2381 // csy = enemy[e].y_speed + ypart(angle, 200 + grand(500));
2382 // csx = xpart(angle, 200 + grand(500));
2383 // csy = ypart(angle, 200 + grand(500));
2384 // timer = 10 + grand(10);
2385 // create_cloud(CLOUD_FLECK, bx, by,
2386 // 0, 0, csx, csy, timer,
2387 // 1, 0, angle, 0, 0, passing_colours);
2388 // create_cloud(CLOUD_SPECK, bx, by,
2389 // 0, 0, enemy[e].x_speed + grand(1001) - 500, enemy[e].y_speed + grand(1001) - 500,
2390 // 10 + grand(15), 1, 0, 0, 0, 0, passing_colours);
2391 place_speck_burst(bx, by, enemy[e].x_speed, enemy[e].y_speed, msparks, 10, 15, 900, passing_colours);
2392 // }
2393
2394 }
2395
2396 void bullet_impact(int b, int k, int hit_what)
2397 {
2398 int j;
2399 int xs = bullet[b].x_speed;
2400 int ys = bullet[b].y_speed;
2401 int m, xa, xb, cx, cy;
2402
2403 int passing_colours [5];
2404
2405 if (hit_what == HIT_ACTOR && k != -1)
2406 {
2407 xs = actor[k].x_speed;
2408 ys = actor[k].y_speed;
2409 }
2410 else
2411 {
2412 if (hit_what == HIT_ENEMY && k != -1)
2413 {
2414 xs = enemy[k].x_speed;
2415 ys = enemy[k].y_speed;
2416 }
2417 else
2418 {
2419 xs = 0;
2420 ys = 0;
2421 }
2422 }
2423
2424 switch(bullet[b].type)
2425 {
2426 case BULLET_NOVA:
2427 bullet[b].x_speed = 0;
2428 bullet[b].y_speed = 0;
2429 return;
2430 case BULLET_DISRUPT3:
2431 passing_colours [0] = TRANS_DARKEN;
2432 create_cloud(CLOUD_MED_TRANS_CIRCLE,
2433 bullet[b].x, bullet[b].y, 0, 0, 0, 0, 3500, -3, 3, 0, 0, 0, passing_colours);
2434 blast(bullet[b].x, bullet[b].y, 50000, 250, 1000, bullet[b].owner);
2435 radius_effect(bullet[b].x, bullet[b].y, 50000, RADEFFECT_TELEPORT);
2436 bullet_soundf(b, NWAV_CHIME, 200 + grand(20));
2437 break;
2438 case BULLET_HOSTILE:
2439 case BULLET_SHOCK:
2440 case BULLET_ZIGZAG1:
2441 passing_colours [0] = TRANS_WHITE;
2442 passing_colours [1] = bullet[b].colours [3];//COLOUR_BLUE8;
2443 place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 4 + grand(4), 15, 15, 1200, 300, passing_colours);
2444 break;
2445 case BULLET_FURIOUS_ORB:
2446 // bullet_sound(b, BSOUND_BOMB);
2447 case BULLET_MANIFOLD_ORB_SMALL:
2448 case BULLET_FURIOUS_ORB_SMALL:
2449 passing_colours [0] = bullet[b].colours [0];
2450 passing_colours [1] = bullet[b].colours [1];
2451 passing_colours [2] = bullet[b].colours [2];
2452 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(300) + bullet[b].special2 * 10, passing_colours);
2453 blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, bullet[b].special4, bullet[b].owner);
2454 if (bullet[b].type == BULLET_FURIOUS_ORB)
2455 // bullet_soundf(b, NWAV_BURSTZL, 400 + grand(150));
2456 bullet_soundf(b, NWAV_BURST, 300 + grand(10));
2457 else
2458 bullet_soundvf(b, NWAV_BURST, 80, 400 + grand(150));
2459
2460 /* for (j = 0; j < bullet[b].damage / 12 + 1; j ++)
2461 {
2462 xs = bullet[b].x + grand(40001) - 20000;
2463 ys = bullet[b].y + grand(40001) - 20000;
2464 place_explosion_no_light(xs, ys, 0, 0, 100 + grand(150), passing_colours);
2465 // blast(xs, ys, 15000, bullet[b].damage * 5, 2000, bullet[b].owner);
2466 }*/
2467 // passing_colours [3] = TRANS_WHITE2;
2468 // passing_colours [2] = TRANS_LGREY;
2469 // passing_colours [1] = TRANS_LGREY;
2470 // passing_colours [0] = TRANS_DGREY;
2471 // create_cloud(CLOUD_SHOCKWAVE, bullet[b].x, bullet[b].y, 0, 0, 0, 0,
2472 // 200 + crandom(50) + bullet[b].special2 / 2,15,0, 0, 250 + grand(100) + bullet[b].special2 / 2, 0, passing_colours);
2473 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50) + bullet[b].special2 * 2, 15);
2474 break;
2475 case BULLET_MANIFOLD_ORB:
2476 passing_colours [0] = bullet[b].colours [0];
2477 passing_colours [1] = bullet[b].colours [1];
2478 passing_colours [2] = bullet[b].colours [2];
2479 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(300) + bullet[b].special2 * 10, passing_colours);
2480 blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, bullet[b].special4, bullet[b].owner);
2481 // bullet_soundf(b, NWAV_BURSTZL, 300 + grand(150));
2482 bullet_soundf(b, NWAV_BURST, 300 + grand(10));
2483 if (bullet[b].special5 > 0 && hit_what != HIT_WAVE)
2484 {
2485 for (j = 0; j < bullet[b].special5; j ++)
2486 {
2487 create_bullet(BULLET_MANIFOLD_ORB_SMALL, bullet[b].x, bullet[b].y,
2488 grand(5001) - 2500, grand(5001) - 2500, bullet[b].owner,
2489 1, 20 + grand(40), 100, 0, 0, 0, bullet[b].colours, 1,
2490 bullet[b].special1 / 2, bullet[b].special2 / 3, bullet[b].special3 / 3, bullet[b].special4 / 3, bullet[b].special5 / 3);
2491 }
2492 }
2493 /* for (j = 0; j < bullet[b].damage / 12 + 1; j ++)
2494 {
2495 xs = bullet[b].x + grand(40001) - 20000;
2496 ys = bullet[b].y + grand(40001) - 20000;
2497 place_explosion_no_light(xs, ys, 0, 0, 100 + grand(150), passing_colours);
2498 // blast(xs, ys, 15000, bullet[b].damage * 5, 2000, bullet[b].owner);
2499 }*/
2500 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50) + bullet[b].special2 * 2, 15);
2501 break;
2502 case BULLET_CIRCLER:
2503 passing_colours [0] = TRANS_DRED;//bullet[b].colours [0];
2504 passing_colours [1] = TRANS_ORANGE;//bullet[b].colours [1];
2505 passing_colours [2] = TRANS_YELLOW;//bullet[b].colours [2];
2506 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(300), passing_colours);
2507 blast(bullet[b].x, bullet[b].y, 40000, 300, 5000, bullet[b].owner);
2508 for (j = 0; j < 5; j ++)
2509 {
2510 xs = bullet[b].x + grand(40001) - 20000;
2511 ys = bullet[b].y + grand(40001) - 20000;
2512 place_explosion_no_light(xs, ys, 0, 0, 100 + grand(150), passing_colours);
2513 }
2514 place_burstlet_burst(bullet[b].x, bullet[b].y, 0, 0, 6,
2515 6, 4, 1500, 1500, 7, passing_colours);
2516 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50));
2517 bullet_soundf(b, NWAV_BURST, 1500 + grand(350));
2518 break;
2519 case BULLET_FORK2:
2520 case BULLET_FORK1:
2521 passing_colours [0] = bullet[b].colours [0];
2522 passing_colours [1] = bullet[b].colours [1];
2523 passing_colours [2] = bullet[b].colours [2];
2524 passing_colours [3] = bullet[b].colours [3];
2525 create_cloud(CLOUD_FADING_LINE,
2526 bullet[b].x - bullet[b].x_speed,
2527 bullet[b].y - bullet[b].y_speed,
2528 bullet[b].x,
2529 bullet[b].y,
2530 0,
2531 0,
2532 10, 2,0, 0, 0, 0, passing_colours);
2533 if (hit_what == HIT_NOTHING)
2534 {
2535 passing_colours [0] = bullet[b].colours [0];
2536 passing_colours [1] = bullet[b].colours [1];
2537 passing_colours [2] = bullet[b].colours [2];
2538 m = 2 + grand(3);
2539 for (j = 0; j < m; j ++)
2540 {
2541 create_bullet(BULLET_FORK3 - (bullet[b].type == BULLET_FORK1 && grand(3) != 0), bullet[b].x, bullet[b].y,
2542 // bullet[b].x_speed + grand(9001) - 4500, bullet[b].y_speed + grand(9001) - 4500,
2543 bullet[b].x_speed + grand(5001) - 2500, bullet[b].y_speed + grand(5001) - 2500,
2544 bullet[b].owner, bullet[b].damage, 20 + grand(40), bullet[b].mass, 0, 0, 0, bullet[b].colours, 1,
2545 bullet[b].special1, 0, 0, 0, 0);
2546 }
2547 break;
2548 }
2549 // fall-through:
2550 case BULLET_FORK3:
2551 passing_colours [0] = bullet[b].special1;
2552 j = 36 + grand(12);
2553 create_cloud(CLOUD_SMALL_FADING_CIRCLE,
2554 bullet[b].x,
2555 bullet[b].y,
2556 xs, ys,
2557 0,
2558 0,
2559 j, 3, 0, 0, j, 0, passing_colours);
2560 create_cloud(CLOUD_LIGHT,
2561 bullet[b].x,
2562 bullet[b].y,
2563 0, 0, 0, 0, 420 + crandom(105),60,0, 0, 0, 0, passing_colours);
2564 break;
2565 case BULLET_WORM_SORROW:
2566 case BULLET_WORM_AGONY:
2567 case BULLET_EVIL_EEL:
2568 case BULLET_PANIC_EEL:
2569 case BULLET_SQUIRMY:
2570 case BULLET_EVIL_WORM:
2571 case BULLET_TURN_WORM:
2572 case BULLET_SWIRL2:
2573 passing_colours [0] = bullet[b].colours [0];
2574 passing_colours [1] = bullet[b].colours [1];
2575 passing_colours [2] = bullet[b].colours [2];
2576 passing_colours [3] = bullet[b].colours [3];
2577 create_cloud(CLOUD_FADING_LINE,
2578 bullet[b].x - bullet[b].x_speed,
2579 bullet[b].y - bullet[b].y_speed,
2580 bullet[b].x,
2581 bullet[b].y,
2582 0,
2583 0,
2584 10, 2,0, 0, 0, 0, passing_colours);
2585 // if (hit_what != HIT_NOTHING)
2586 // break;
2587 passing_colours [0] = bullet[b].colours [3];
2588 j = 36 + grand(12);
2589 create_cloud(CLOUD_SMALL_FADING_CIRCLE,
2590 bullet[b].x,
2591 bullet[b].y,
2592 xs, ys,
2593 0,
2594 0,
2595 j, 3, 0, 0, j, 0, passing_colours);
2596 create_cloud(CLOUD_LIGHT,
2597 bullet[b].x,
2598 bullet[b].y,
2599 0, 0, 0, 0, 420 + crandom(105),60,0, 0, 0, 0, passing_colours);
2600 break;
2601 case BULLET_CLAW:
2602 passing_colours [0] = bullet[b].colours [3];
2603 passing_colours [1] = bullet[b].colours [2];
2604 passing_colours [2] = bullet[b].colours [1];
2605 passing_colours [3] = bullet[b].colours [0];
2606 create_cloud(CLOUD_TRANS_FADING_LINE,
2607 bullet[b].x - bullet[b].x_speed,
2608 bullet[b].y - bullet[b].y_speed,
2609 bullet[b].x,
2610 bullet[b].y,
2611 0,
2612 0,
2613 10, 2,0, 0, 0, 0, passing_colours);
2614 // passing_colours [0] = bullet[b].colours [3];
2615 passing_colours [0] = bullet[b].colours [0];
2616 passing_colours [1] = bullet[b].colours [1];
2617 passing_colours [2] = bullet[b].colours [2];
2618 passing_colours [3] = bullet[b].colours [3];
2619 j = 46 + grand(17);
2620 create_cloud(CLOUD_BLAST_CIRCLE,
2621 bullet[b].x,
2622 bullet[b].y,
2623 xs, ys,
2624 0,
2625 0,
2626 j, 3, 0, 0, j, 0, passing_colours);
2627 create_cloud(CLOUD_LIGHT,
2628 bullet[b].x,
2629 bullet[b].y,
2630 0, 0, 0, 0, 420 + crandom(105),60,0, 0, 0, 0, passing_colours);
2631 break;
2632 case BULLET_CIRCLES:
2633 case BULLET_CIRCLES2:
2634 passing_colours [0] = bullet[b].colours [0];
2635 create_cloud(CLOUD_SHRINKING_CIRCLE,
2636 bullet[b].x,
2637 bullet[b].y,
2638 0, 0,
2639 0, 0,
2640 1500,-150,20, 0, 0, 0, passing_colours);
2641 break;
2642 case BULLET_BIGCIRCLES:
2643 passing_colours [0] = bullet[b].colours [0];
2644 create_cloud(CLOUD_SHRINKING_CIRCLE,
2645 bullet[b].x,
2646 bullet[b].y,
2647 0, 0,
2648 0, 0,
2649 2500,-190,30, 0, 0, 0, passing_colours);
2650 break;
2651 case BULLET_BLOCKS:
2652 passing_colours [0] = bullet[b].colours [0];
2653 passing_colours [1] = bullet[b].colours [1];
2654 passing_colours [2] = bullet[b].colours [2];
2655 passing_colours [3] = bullet[b].colours [3];
2656 create_cloud(CLOUD_BLOCK3,
2657 bullet[b].x,
2658 bullet[b].y,
2659 0, 0,
2660 0, 0,
2661 // 100 + grand(50),-2 - grand(4),1, bullet[b].angle, grand(2), 0, passing_colours);
2662 100 + grand(50),3,0, bullet[b].angle, grand(2), 0, passing_colours);
2663 create_cloud(CLOUD_LIGHT,
2664 bullet[b].x, bullet[b].y,
2665 0, 0, 0, 0, 1600 + crandom(800),48,0, 0, 0, 0, passing_colours);
2666 break;
2667 case BULLET_OVERBLOCKS:
2668 passing_colours [0] = bullet[b].colours [0];
2669 passing_colours [1] = bullet[b].colours [1];
2670 passing_colours [2] = bullet[b].colours [2];
2671 passing_colours [3] = bullet[b].colours [3];
2672 create_cloud(CLOUD_BLOCK1,
2673 bullet[b].x + xpart(bullet[b].angle, 25000),
2674 bullet[b].y + ypart(bullet[b].angle, 25000),
2675 bullet[b].x - xpart(bullet[b].angle, 25000),
2676 bullet[b].y - ypart(bullet[b].angle, 25000),
2677 0, 0,
2678 50 + grand(8),1,0, bullet[b].angle, 0, 0, passing_colours);
2679 passing_colours [0] = bullet[b].colours [1];
2680 for (j = 0; j < 8; j ++)
2681 {
2682 xs = grand(ANGLE_FULL);
2683 ys = 2500 + grand(2500);
2684 create_cloud(CLOUD_BLOCK1,
2685 bullet[b].x + xpart(xs, 15000),
2686 bullet[b].y + ypart(xs, 15000),
2687 bullet[b].x - xpart(xs, 15000),
2688 bullet[b].y - ypart(xs, 15000),
2689 xpart(xs, ys),
2690 ypart(xs, ys),
2691 40 + grand(20),2,0, xs, 0, 0, passing_colours);
2692 }
2693 break;
2694 case BULLET_ZIGZAG2:
2695 passing_colours [0] = bullet[b].colours [0];
2696 passing_colours [1] = bullet[b].colours [1];
2697 passing_colours [2] = bullet[b].colours [2];
2698 passing_colours [3] = bullet[b].colours [3];
2699 create_cloud(CLOUD_BLOCK1,
2700 bullet[b].x - bullet[b].x_speed * 3,
2701 bullet[b].y - bullet[b].y_speed * 3,
2702 bullet[b].x,
2703 bullet[b].y,
2704 0, 0,
2705 40, 1,0, bullet[b].special4, 30, 0, passing_colours);
2706 // 200, 5,0, bullet[b].special4, 30, 0, passing_colours);
2707 break;
2708 case BULLET_CURVEY:
2709 simple_shockwave(TRANS_WHITE, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50), 20);
2710 break;
2711 // case BULLET_SHOCK:
2712 /* case BULLET_SHOCK_PATH:
2713 case BULLET_SHOCK_PATH_SMALL:
2714 case BULLET_GOLDEN_PATH:
2715 case BULLET_GOLDEN_PATH_SMALL:
2716 passing_colours[0] = bullet[b].colours [3];
2717 passing_colours[1] = bullet[b].colours [3];
2718 passing_colours[2] = bullet[b].colours [2];
2719 passing_colours[3] = bullet[b].colours [1];
2720 passing_colours[4] = bullet[b].colours [0];
2721 place_speck_burst(bullet[b].x, bullet[b].y, xs,
2722 ys, 3 + grand(3), 10, 21, 450, passing_colours);
2723 break;
2724 case BULLET_SNOW_DART:
2725 case BULLET_ICE_DART:
2726 case BULLET_FROZEN_BREATH:
2727 create_cloud(CLOUD_BLUE_BLOB2,
2728 bullet[b].x + grand(2001) - 1000,
2729 bullet[b].y + grand(2001) - 1000,
2730 0, 0, 0, 0, 8 + crandom(3),1,0, 0, 0, 0, passing_colours);
2731 break;
2732 case BULLET_BURNING_DRAGGED:*/
2733 case BULLET_BURNING_SPIRIT:
2734 create_cloud(CLOUD_ORANGE_BLOB2,
2735 bullet[b].x,// + grand(2001) - 1000,
2736 bullet[b].y,// + grand(2001) - 1000,
2737 0, 0, 0, 0, 12 + crandom(5),1,0, 0, 0, 0, passing_colours);
2738 create_cloud(CLOUD_LIGHT,
2739 bullet[b].x,
2740 bullet[b].y,
2741 0, 0, 0, 0, 550 + crandom(105),40,0, 0, 0, 0, passing_colours);
2742 break;
2743 case BULLET_BURST:
2744 passing_colours [0] = TRANS_DRED;//bullet[b].colours [0];
2745 passing_colours [1] = TRANS_LRED;//bullet[b].colours [1];
2746 passing_colours [2] = TRANS_YELLOW;//bullet[b].colours [2];
2747 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(300) + bullet[b].special2 * 10, passing_colours);
2748 blast(bullet[b].x, bullet[b].y, 30000, 50, 8200, bullet[b].owner);
2749 for (j = 0; j < 6 + grand(4); j ++)
2750 {
2751 create_bullet(BULLET_BURNING_DRAGGED, bullet[b].x, bullet[b].y,
2752 grand(15001) - 7500, grand(15001) - 7500, bullet[b].owner,
2753 100, 20 + grand(40), 10, 0, 0, 0, bullet[b].colours, 1,
2754 0, 0, 0, 0, 0);
2755 }
2756 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50), 15);
2757 bullet_soundf(b, NWAV_BURST, 800 + grand(150));
2758 break;
2759 case BULLET_PUFFY3:
2760 passing_colours [0] = TRANS_DGREY;//bullet[b].colours [0];
2761 passing_colours [1] = TRANS_DGREEN;//bullet[b].colours [1];
2762 passing_colours [2] = TRANS_LGREEN;//bullet[b].colours [2];
2763 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(100), passing_colours);
2764 blast(bullet[b].x, bullet[b].y, 20000, 1, 3200, bullet[b].owner);
2765 for (j = 0; j < 10 + grand(6); j ++)
2766 {
2767 xa = grand(ANGLE_FULL);
2768 m = 500 + grand(7000);
2769 create_bullet(BULLET_EVIL_STAR, bullet[b].x, bullet[b].y,
2770 xpart(xa, m), ypart(xa, m), bullet[b].owner,
2771 50, 70 + grand(80), 10, 0, 0, 0, bullet[b].colours, 1,
2772 0, 0, 0, 0, 0);
2773 }
2774 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 250 + crandom(50), 15);
2775 bullet_soundf(b, NWAV_DNO, 400 + grand(100));
2776 break;
2777 case BULLET_PUFFY4:
2778 passing_colours [0] = TRANS_DBLUE;//bullet[b].colours [0];
2779 passing_colours [1] = TRANS_LBLUE;//bullet[b].colours [1];
2780 passing_colours [2] = TRANS_WHITE;//bullet[b].colours [2];
2781 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(100), passing_colours);
2782 blast(bullet[b].x, bullet[b].y, 20000, 1, 3200, bullet[b].owner);
2783 for (j = 0; j < 10 + grand(6); j ++)
2784 {
2785 xa = grand(ANGLE_FULL);
2786 m = 2000 + grand(13000);
2787 create_bullet(BULLET_ZAP_DRAG, bullet[b].x, bullet[b].y,
2788 xpart(xa, m), ypart(xa, m), bullet[b].owner,
2789 30, 20 + grand(10), 30, 0, 0, 0, bullet[b].colours, 1,
2790 0, 0, 0, 0, 0);
2791 }
2792 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 250 + crandom(50), 15);
2793 bullet_soundf(b, NWAV_BURST, 300 + grand(150));
2794 break;
2795 case BULLET_BFLAK:
2796 /* passing_colours [0] = TRANS_DRED;
2797 passing_colours [1] = TRANS_LRED;
2798 passing_colours [2] = TRANS_YELLOW;*/
2799 passing_colours [0] = TRANS_DBLUE;
2800 passing_colours [1] = TRANS_LBLUE;
2801 passing_colours [2] = TRANS_WHITE;
2802 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 350 + grand(300), passing_colours);
2803 blast(bullet[b].x, bullet[b].y, 30000, 200, 8200, bullet[b].owner);
2804 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50), 15);
2805 bullet_soundf(b, NWAV_BURSTZ, 1900 + grand(300));
2806 break;
2807 case BULLET_BFLAK2:
2808 passing_colours [0] = TRANS_ORANGE;
2809 passing_colours [1] = TRANS_YELLOW;
2810 passing_colours [2] = TRANS_WHITE;
2811 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 350 + grand(100), passing_colours);
2812 blast(bullet[b].x, bullet[b].y, 30000, 150, 3200, bullet[b].owner);
2813 for (j = 0; j < 8 + grand(5); j ++)
2814 {
2815 xa = grand(ANGLE_FULL);
2816 m = 2000 + grand(9000);
2817 create_bullet(BULLET_ZAP_DRAG, bullet[b].x, bullet[b].y,
2818 xpart(xa, m), ypart(xa, m), bullet[b].owner,
2819 50, 20 + grand(10), 30, 0, 0, 0, bullet[b].colours, 1,
2820 0, 0, 0, 0, 0);
2821 }
2822 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 250 + crandom(50), 15);
2823 bullet_soundf(b, NWAV_BURSTZ, 1600 + grand(300));
2824 break;
2825 case BULLET_MBOMB:
2826 passing_colours [0] = TRANS_ORANGE;
2827 passing_colours [1] = TRANS_YELLOW;
2828 passing_colours [2] = TRANS_WHITE;
2829 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 1100 + grand(200), passing_colours);
2830 blast(bullet[b].x, bullet[b].y, 30000, 200, 3200, bullet[b].owner);
2831 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 500 + crandom(50), 15);
2832 break;
2833 case BULLET_MINE1:
2834 passing_colours [0] = TRANS_DRED;
2835 passing_colours [1] = TRANS_LRED;
2836 passing_colours [2] = TRANS_YELLOW;
2837 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(100), passing_colours);
2838 blast(bullet[b].x, bullet[b].y, 20000, 200, 8200, bullet[b].owner);
2839 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 200 + crandom(50), 15);
2840 bullet_soundf(b, NWAV_SHORTBURST, 1000 + grand(100));
2841 break;
2842 case BULLET_MINE2:
2843 passing_colours [0] = TRANS_DRED;
2844 passing_colours [1] = TRANS_LRED;
2845 passing_colours [2] = TRANS_YELLOW;
2846 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(100), passing_colours);
2847 blast(bullet[b].x, bullet[b].y, 5000, 20, 1200, bullet[b].owner);
2848 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 200 + crandom(50));
2849 passing_colours [0] = TRANS_DRED;
2850 passing_colours [1] = TRANS_LRED;
2851 passing_colours [2] = TRANS_YELLOW;
2852 passing_colours [3] = TRANS_YELLOW;
2853 for (j = 0; j < 6; j ++)
2854 {
2855 xs = xpart(((ANGLE_FULL / 6) * j) + bullet[b].angle, 7000);
2856 ys = ypart(((ANGLE_FULL / 6) * j) + bullet[b].angle, 7000);
2857 create_bullet(BULLET_BOLT, bullet[b].x + xs, bullet[b].y + ys,
2858 xs, ys, bullet[b].owner,
2859 200, 10 + grand(5), 40, 0, 0, 0, passing_colours, 1,
2860 2500,30,0,0,0);
2861 }
2862 bullet_soundf(b, NWAV_SHORTBURST, 1200 + grand(300));
2863 break;
2864 case BULLET_MINE3:
2865 /* passing_colours [0] = TRANS_ORANGE;
2866 passing_colours [1] = TRANS_YELLOW;
2867 passing_colours [2] = TRANS_WHITE;
2868 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(100), passing_colours);
2869 blast(bullet[b].x, bullet[b].y, 5000, 20, 1200, bullet[b].owner);
2870 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 200 + crandom(50));
2871 passing_colours [0] = COLOUR_YELLOW8;
2872 // xs = xpart(((ANGLE_FULL / 6) * j) + bullet[b].angle, 7000);
2873 // ys = ypart(((ANGLE_FULL / 6) * j) + bullet[b].angle, 7000);
2874 create_bullet(BULLET_SEEKER1, bullet[b].x, bullet[b].y,
2875 0, 0, bullet[b].owner,
2876 200, 60 + grand(30), 50, grand(ANGLE_FULL), 0, 0, passing_colours, 1,
2877 closest_target(bullet[b].x, bullet[b].y),20,6,200,4001);*/
2878 passing_colours [0] = TRANS_ORANGE;//bullet[b].colours [0];
2879 passing_colours [1] = TRANS_YELLOW;//bullet[b].colours [1];
2880 passing_colours [2] = TRANS_WHITE;//bullet[b].colours [2];
2881 bullet[b].colours [3] = COLOUR_ORANGE4;
2882 bullet[b].colours [2] = COLOUR_ORANGE6;
2883 bullet[b].colours [1] = COLOUR_YELLOW7;
2884 bullet[b].colours [0] = COLOUR_YELLOW8;
2885 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(100), passing_colours);
2886 blast(bullet[b].x, bullet[b].y, 20000, 1, 2500, bullet[b].owner);
2887 for (j = 0; j < 10 + grand(6); j ++)
2888 {
2889 xa = grand(ANGLE_FULL);
2890 m = 2000 + grand(12000);
2891 create_bullet(BULLET_ZAP_DRAG, bullet[b].x, bullet[b].y,
2892 xpart(xa, m), ypart(xa, m), bullet[b].owner,
2893 40, 20 + grand(10), 30, 0, 0, 0, bullet[b].colours, 1,
2894 0, 0, 0, 0, 0);
2895 }
2896 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 250 + crandom(50), 15);
2897 bullet_soundf(b, NWAV_SHORTBURST, 700 + grand(50));
2898 break;
2899 case BULLET_WINGS1:
2900 case BULLET_WINGS2:
2901 case BULLET_WINGS3:
2902 passing_colours [0] = TRANS_DRED;
2903 passing_colours [1] = TRANS_LRED;
2904 passing_colours [2] = TRANS_YELLOW;
2905 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 100 + grand(50), passing_colours);
2906 j = grand(ANGLE_FULL);
2907 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2908 j += ANGLE_FULL / 3;
2909 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2910 j += ANGLE_FULL / 3;
2911 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2912 blast(bullet[b].x, bullet[b].y, 15000, 250, 6000, bullet[b].owner);
2913 bullet_soundvf(b, NWAV_BURST, 70, 600 + grand(100));
2914 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50));
2915 break;
2916 case BULLET_BIGWINGS1:
2917 case BULLET_BIGWINGS2:
2918 case BULLET_BIGWINGS3:
2919 passing_colours [0] = TRANS_DGREEN;
2920 passing_colours [1] = TRANS_LGREEN;
2921 passing_colours [2] = TRANS_YELLOW;
2922 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(50), passing_colours);
2923 j = grand(ANGLE_FULL);
2924 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2925 j += ANGLE_FULL / 5;
2926 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2927 j += ANGLE_FULL / 5;
2928 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2929 j += ANGLE_FULL / 5;
2930 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2931 j += ANGLE_FULL / 5;
2932 place_explosion(bullet[b].x + xpart(j, 5000), bullet[b].y + ypart(j, 5000), xpart(j, 1000), ypart(j, 1000), 5 + grand(5), passing_colours);
2933 blast(bullet[b].x, bullet[b].y, 20000, 300, 9000, bullet[b].owner);
2934 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50));
2935 bullet_soundvf(b, NWAV_BURST, 120, 400 + grand(100));
2936 break;
2937 case BULLET_E_BOMB:
2938 passing_colours [0] = TRANS_DRED;//bullet[b].colours [0];
2939 passing_colours [1] = TRANS_LRED;//bullet[b].colours [1];
2940 passing_colours [2] = TRANS_YELLOW;//bullet[b].colours [2];
2941 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 700 + grand(300), passing_colours);
2942 blast(bullet[b].x, bullet[b].y, 30000, 200, 11000, bullet[b].owner);
2943 passing_colours [0] = TRANS_YELLOW;
2944 passing_colours [1] = COLOUR_YELLOW8;
2945 place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 7 + grand(4), 15, 15, 2500, 300, passing_colours);
2946 // simple_shockwave(TRANS_YELLOW, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50));
2947 bullet_soundf(b, NWAV_SHORTBURST, 1500 + grand(100));
2948 break;
2949 case BULLET_E_BOMB2:
2950 passing_colours [0] = TRANS_DBLUE;
2951 passing_colours [1] = TRANS_LBLUE;//bullet[b].colours [1];
2952 passing_colours [2] = TRANS_WHITE;//bullet[b].colours [2];
2953 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(50), passing_colours);
2954 blast(bullet[b].x, bullet[b].y, 10000, 100, 8500, bullet[b].owner);
2955 passing_colours [0] = TRANS_WHITE;
2956 passing_colours [1] = COLOUR_BLUE8;
2957 place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 4 + grand(4), 15, 15, 1200, 300, passing_colours);
2958 // simple_shockwave(TRANS_YELLOW, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50));
2959 bullet_soundf(b, NWAV_SHORTBURST, 1500 + grand(100));
2960 break;
2961 case BULLET_THICK_SHOCK:
2962 passing_colours [0] = bullet[b].colours [0];
2963 create_cloud(CLOUD_LARGE_TRANS_CIRCLE,
2964 bullet[b].x, bullet[b].y, 0, 0, 0, 0, 1200 + grand(350), -3, 8, 0, 300 + grand(50), 0, passing_colours);
2965 create_cloud(CLOUD_LIGHT,
2966 bullet[b].x, bullet[b].y,
2967 0, 0, 0, 0, 1600 + crandom(800),0,12, 0, 0, 0, passing_colours);
2968 break;
2969 case BULLET_YELLOW_PULSE:
2970 passing_colours [0] = bullet[b].colours [0];
2971 j = bullet[b].special2 + grand(12);
2972 create_cloud(CLOUD_LARGE_FADING_CIRCLE,
2973 bullet[b].x, bullet[b].y, 0, 0, 0, 0, j, -3, 1, 0, j, 0, passing_colours);
2974 create_cloud(CLOUD_LARGE_FADING_CIRCLE,
2975 bullet[b].x + xpart(bullet[b].angle + ANGLE_QUARTER, 19000),
2976 bullet[b].y + ypart(bullet[b].angle + ANGLE_QUARTER, 19000),
2977 0, 0, 0, 0, j, -3, 3, 0, j, 0, passing_colours);
2978 create_cloud(CLOUD_LARGE_FADING_CIRCLE,
2979 bullet[b].x + xpart(bullet[b].angle - ANGLE_QUARTER, 19000),
2980 bullet[b].y + ypart(bullet[b].angle - ANGLE_QUARTER, 19000),
2981 0, 0, 0, 0, j, -3, 3, 0, j, 0, passing_colours);
2982 create_cloud(CLOUD_LIGHT,
2983 bullet[b].x, bullet[b].y,
2984 0, 0, 0, 0, 1420 + crandom(105),30,7, 0, 0, 0, passing_colours);
2985 blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, bullet[b].special4, bullet[b].owner);
2986 break;
2987 case BULLET_SEEKER1:
2988 passing_colours [0] = bullet[b].colours [2];
2989 j = 764 + grand(120);
2990 create_cloud(CLOUD_MED_TRANS_CIRCLE,
2991 bullet[b].x, bullet[b].y, 0, 0, 0, 0, j, -3, 9, 0, j, 0, passing_colours);
2992 create_cloud(CLOUD_LIGHT,
2993 bullet[b].x, bullet[b].y,
2994 0, 0, 0, 0, 680 + crandom(105),-3,9, 0, 0, 0, passing_colours);
2995 break;
2996 case BULLET_SEEKER2:
2997 passing_colours [0] = bullet[b].colours [2];
2998 j = 1550 + grand(212);
2999 create_cloud(CLOUD_MED_TRANS_CIRCLE,
3000 bullet[b].x, bullet[b].y, 0, 0, 0, 0, j, -3, 7, 0, j, 0, passing_colours);
3001 create_cloud(CLOUD_LIGHT,
3002 bullet[b].x, bullet[b].y,
3003 0, 0, 0, 0, 1280 + crandom(105),-3,7, 0, 0, 0, passing_colours);
3004 break;
3005 case BULLET_SEEKER3:
3006 passing_colours [0] = TRANS_DBLUE;
3007 passing_colours [1] = TRANS_LBLUE;
3008 passing_colours [2] = TRANS_WHITE;
3009 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 1500 + grand(300), passing_colours);
3010 blast(bullet[b].x, bullet[b].y, 50000, 150, 500, bullet[b].owner);
3011 passing_colours [0] = TRANS_WHITE2;
3012 passing_colours [1] = COLOUR_WHITE;
3013 place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 5 + grand(3), 15, 15, 2500, 300, passing_colours);
3014 bullet_soundf(b, NWAV_BURSTZ, 800 + grand(100));
3015 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50));
3016 break;
3017 case BULLET_BIGSEEKER:
3018 // passing_colours [0] = //TRANS_DRED;
3019 // passing_colours [1] = //TRANS_LRED;
3020 // passing_colours [2] = //TRANS_YELLOW;
3021 passing_colours [0] = TRANS_LBLUE;
3022 passing_colours [1] = TRANS_PURPLE;
3023 passing_colours [2] = TRANS_WHITE;
3024 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 2200 + grand(500), passing_colours);
3025 blast(bullet[b].x, bullet[b].y, 50000, 300, 1000, bullet[b].owner);
3026 simple_shockwave(TRANS_PURPLE, bullet[b].x, bullet[b].y, 0, 0, 700 + crandom(50), 15);
3027 // passing_colours [0] = TRANS_WHITE2;
3028 // passing_colours [1] = COLOUR_WHITE;
3029 // place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 5 + grand(3), 15, 15, 2500, 300, passing_colours);
3030 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 400 + crandom(50));
3031 bullet_soundf(b, NWAV_BURSTZ, 500 + grand(100));
3032 break;
3033 case BULLET_CHARGE:
3034 passing_colours [0] = TRANS_DBLUE;
3035 passing_colours [1] = TRANS_LBLUE;
3036 passing_colours [2] = TRANS_WHITE;
3037 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 2200 + grand(500), passing_colours);
3038 blast(bullet[b].x, bullet[b].y, 80000, 450, 1000, bullet[b].owner);
3039 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 700 + crandom(50), 15);
3040 bullet_soundf(b, NWAV_BANG, 700 + grand(100));
3041 break;
3042 case BULLET_SWIRL1:
3043 passing_colours [0] = TRANS_LRED;
3044 passing_colours [1] = TRANS_ORANGE;
3045 passing_colours [2] = TRANS_WHITE;
3046 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 2200 + grand(500), passing_colours);
3047 break;
3048 case BULLET_DISRUPT1:
3049 create_bullet(BULLET_DISRUPT1_DROP, bullet[b].x, bullet[b].y,
3050 0, 0, bullet[b].owner,
3051 0, 60, 50, 0, 0, 0, passing_colours, 1,
3052 10,0,0,0,0);
3053 bullet_soundf(b, NWAV_CYMBAL, 400 + grand(20));
3054 break;
3055 case BULLET_DISRUPT2:
3056 passing_colours [0] = TRANS_REVERSE;
3057 create_cloud(CLOUD_MED_TRANS_CIRCLE,
3058 bullet[b].x, bullet[b].y, 0, 0, 0, 0, 3500, -3, 3, 0, 0, 0, passing_colours);
3059 blast(bullet[b].x, bullet[b].y, 100000, 100, -4000, bullet[b].owner);
3060 bullet_soundf(b, NWAV_CHIME, 300 + grand(20));
3061 break;
3062
3063 case BULLET_GREEN_BLAT:
3064 if (hit_what == HIT_NOTHING)
3065 {
3066 create_cloud(CLOUD_GREEN_BLOB2,
3067 bullet[b].x,// + grand(2001) - 1000,
3068 bullet[b].y,// + grand(2001) - 1000,
3069 0, 0, 0, 0, 12 + crandom(5),1,0, 0, 0, 0, passing_colours);
3070 create_cloud(CLOUD_LIGHT,
3071 bullet[b].x,
3072 bullet[b].y,
3073 0, 0, 0, 0, 400 + crandom(105),30,0, 0, 0, 0, passing_colours);
3074 }
3075 else
3076 {
3077 passing_colours[0] = TRANS_DGREEN;
3078 passing_colours[1] = TRANS_LGREEN;
3079 passing_colours[2] = TRANS_YELLOW;
3080 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 250 + grand(150), passing_colours);
3081 create_cloud(CLOUD_LIGHT,
3082 bullet[b].x,
3083 bullet[b].y,
3084 0, 0, 0, 0, 450 + crandom(105),40,0, 0, 0, 0, passing_colours);
3085 // passing_colours [1] = TRANS_LBLUE;
3086 // passing_colours [2] = TRANS_WHITE;
3087 // place_burstlet_burst(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(3),
3088 // 4, 2, 1000, 1500, 4, passing_colours);
3089 }
3090 /* create_cloud(CLOUD_GREEN_BLOB2,
3091 bullet[b].x,// + grand(2001) - 1000,
3092 bullet[b].y,// + grand(2001) - 1000,
3093 0, 0, 0, 0, 12 + crandom(5),1,0, 0, 0, 0, passing_colours);
3094 // if (hit_what != HIT_NOTHING)
3095 // {
3096 // passing_colours [1] = TRANS_LGREEN;
3097 // passing_colours [2] = TRANS_YELLOW;
3098 // place_burstlet_burst(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(3),
3099 // 4, 2, 1000, 1500, 4, passing_colours);
3100 // }
3101 create_cloud(CLOUD_LIGHT,
3102 bullet[b].x,
3103 bullet[b].y,
3104 0, 0, 0, 0, 550 + crandom(105),40,0, 0, 0, 0, passing_colours);*/
3105 break;
3106 case BULLET_BLUE_BLAT:
3107 if (hit_what == HIT_NOTHING)
3108 {
3109 create_cloud(CLOUD_BLUE_BLOB2,
3110 bullet[b].x,// + grand(2001) - 1000,
3111 bullet[b].y,// + grand(2001) - 1000,
3112 0, 0, 0, 0, 12 + crandom(5),1,0, 0, 0, 0, passing_colours);
3113 create_cloud(CLOUD_LIGHT,
3114 bullet[b].x,
3115 bullet[b].y,
3116 0, 0, 0, 0, 550 + crandom(105),40,0, 0, 0, 0, passing_colours);
3117 }
3118 else
3119 {
3120 passing_colours[0] = TRANS_DBLUE;
3121 passing_colours[1] = TRANS_LBLUE;
3122 passing_colours[2] = TRANS_WHITE;
3123 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 250 + grand(150), passing_colours);
3124 create_cloud(CLOUD_LIGHT,
3125 bullet[b].x,
3126 bullet[b].y,
3127 0, 0, 0, 0, 450 + crandom(105),40,0, 0, 0, 0, passing_colours);
3128 // passing_colours [1] = TRANS_LBLUE;
3129 // passing_colours [2] = TRANS_WHITE;
3130 // place_burstlet_burst(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(3),
3131 // 4, 2, 1000, 1500, 4, passing_colours);
3132 }
3133 break;
3134 case BULLET_SNOW_DART_SMALL:
3135 case BULLET_ICE_DART_SMALL:
3136 create_cloud(CLOUD_BLUE_BLOB2,
3137 bullet[b].x + grand(2001) - 1000,
3138 bullet[b].y + grand(2001) - 1000,
3139 0, 0, 0, 0, 6 + crandom(3),1,0, 0, 0, 0, passing_colours);
3140 break;
3141 case BULLET_NUMEROUS_BLADE:
3142 passing_colours[0] = bullet[b].colours [0];
3143 passing_colours[1] = bullet[b].colours [1];
3144 passing_colours[2] = bullet[b].colours [1];
3145 passing_colours[3] = bullet[b].colours [2];
3146 passing_colours[4] = bullet[b].colours [2];
3147 place_speck_burst(bullet[b].x, bullet[b].y, xs,
3148 ys, 1 + grand(2), 10, 21, 450, passing_colours);
3149 passing_colours [0] = bullet[b].colours [0];
3150 j = 16 + grand(12);
3151 create_cloud(CLOUD_SMALL_FADING_CIRCLE,
3152 bullet[b].x,
3153 bullet[b].y,
3154 xs, ys,
3155 0,
3156 0,
3157 j, 1, 0, 0, j, 0, passing_colours);
3158 break;
3159 case BULLET_CRYSTAL_TOOTH:
3160 case BULLET_CRYSTAL_SPINE:
3161 passing_colours[0] = bullet[b].colours [0];
3162 passing_colours[1] = bullet[b].colours [1];
3163 passing_colours[2] = bullet[b].colours [1];
3164 passing_colours[3] = bullet[b].colours [2];
3165 passing_colours[4] = bullet[b].colours [2];
3166 place_speck_burst(bullet[b].x, bullet[b].y, xs,
3167 ys, 2 + grand(3), 10, 21, 450, passing_colours);
3168 // fall-through...
3169 case BULLET_SILVER_TOOTH:
3170 case BULLET_BRASS_TOOTH:
3171 case BULLET_GOLDEN_NEEDLE:
3172 case BULLET_NUMEROUS_DART:
3173 case BULLET_ZAP:
3174 case BULLET_ZAP_DRAG:
3175 case BULLET_SLIVER:
3176 // if (hit_what != HIT_NOTHING)
3177 // break;
3178 passing_colours [0] = bullet[b].colours [0];
3179 j = 30 + grand(20);
3180 create_cloud(CLOUD_SMALL_FADING_CIRCLE,
3181 bullet[b].x,
3182 bullet[b].y,
3183 xs, ys,
3184 0,
3185 0,
3186 j, -1, 1, 0, j, 0, passing_colours);
3187 break;
3188 case BULLET_SILVER_TOOTH_SMALL:
3189 case BULLET_GOLDEN_NEEDLE_SMALL:
3190 case BULLET_BRASS_TOOTH_SMALL:
3191 passing_colours [0] = bullet[b].colours [0];
3192 j = 20 + grand(15);
3193 create_cloud(CLOUD_SMALL_FADING_CIRCLE,
3194 bullet[b].x,
3195 bullet[b].y,
3196 xs, ys,
3197 0,
3198 0,
3199 j, 0, 1, 0, j, 0, passing_colours);
3200 break;
3201 case BULLET_PARTICLE_SPITTER:
3202 passing_colours [0] = COLOUR_GREEN8;
3203 create_cloud(CLOUD_SMALL_CIRCLE,
3204 bullet[b].x,
3205 bullet[b].y,
3206 xs, ys,
3207 0,
3208 0,
3209 200 + crandom(120),15,15, 0, 0, 0, passing_colours);
3210 break;
3211 case BULLET_FAR_SPITTER:
3212 passing_colours [0] = COLOUR_YELLOW8;
3213 create_cloud(CLOUD_SMALL_CIRCLE,
3214 bullet[b].x,
3215 bullet[b].y,
3216 xs, ys,
3217 0,
3218 0,
3219 200 + crandom(120),15,15, 0, 0, 0, passing_colours);
3220 break;
3221 case BULLET_BLAST:
3222 case BULLET_BOLT:
3223 passing_colours[0] = bullet[b].colours [0];
3224 passing_colours[1] = bullet[b].colours [1];
3225 passing_colours[2] = bullet[b].colours [2];
3226 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(150), passing_colours);
3227 break;
3228 case BULLET_BIGBALL1:
3229 passing_colours[0] = bullet[b].colours [2];
3230 passing_colours[1] = bullet[b].colours [1];
3231 passing_colours[2] = bullet[b].colours [0];
3232 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 400 + grand(150) + bullet[b].special1 * 50, passing_colours);
3233 break;
3234 case BULLET_TRI1:
3235 passing_colours [3] = TRANS_DRED; //bullet[b].colours [0];
3236 passing_colours [2] = TRANS_LRED; //bullet[b].colours [1];
3237 passing_colours [1] = TRANS_ORANGE; //bullet[b].colours [2];
3238 passing_colours [0] = TRANS_YELLOW; //bullet[b].colours [3];
3239 for (j = 0; j < 10; j ++)
3240 {
3241 xs = grand(ANGLE_FULL);
3242 create_cloud(CLOUD_BIG_BLAST_CIRCLE,
3243 bullet[b].x,
3244 bullet[b].y, //grand(10001) - 5000,
3245 0, 0,
3246 // bullet[b].x_speed + xpart(xs, 5000 + grand(6000)),
3247 // bullet[b].y_speed + ypart(xs, 5000 + grand(6000)),
3248 xpart(xs, 4000 + grand(6000)),
3249 ypart(xs, 4000 + grand(6000)),
3250 85 + grand(50), 3, 0, 0, 0, 0, passing_colours);
3251 }
3252 passing_colours [0] = TRANS_DRED; //bullet[b].colours [0];
3253 passing_colours [1] = TRANS_LRED; //bullet[b].colours [1];
3254 passing_colours [2] = TRANS_YELLOW; //bullet[b].colours [2];
3255 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 400 + grand(300), passing_colours);
3256 blast(bullet[b].x, bullet[b].y, 50000, 150, 3000, bullet[b].owner);
3257 bullet_soundf(b, NWAV_BURST, 500 + grand(100));
3258 break;
3259 case BULLET_TRI2:
3260 passing_colours [3] = TRANS_DBLUE; //bullet[b].colours [0];
3261 passing_colours [2] = TRANS_DBLUE; //bullet[b].colours [1];
3262 passing_colours [1] = TRANS_LBLUE; //bullet[b].colours [2];
3263 passing_colours [0] = TRANS_WHITE; //bullet[b].colours [3];
3264 for (j = 0; j < 10; j ++)
3265 {
3266 xs = grand(ANGLE_FULL);
3267 create_cloud(CLOUD_BIG_BLAST_CIRCLE,
3268 bullet[b].x,
3269 bullet[b].y, //grand(10001) - 5000,
3270 0, 0,
3271 // bullet[b].x_speed + xpart(xs, 5000 + grand(6000)),
3272 // bullet[b].y_speed + ypart(xs, 5000 + grand(6000)),
3273 xpart(xs, 4000 + grand(6000)),
3274 ypart(xs, 4000 + grand(6000)),
3275 85 + grand(50), 3, 0, 0, 0, 0, passing_colours);
3276 }
3277 passing_colours [0] = TRANS_DBLUE; //bullet[b].colours [0];
3278 passing_colours [1] = TRANS_LBLUE; //bullet[b].colours [1];
3279 passing_colours [2] = TRANS_WHITE; //bullet[b].colours [2];
3280 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 400 + grand(300), passing_colours);
3281 blast(bullet[b].x, bullet[b].y, 50000, 200, 4000, bullet[b].owner);
3282 bullet_soundf(b, NWAV_BURST, 450 + grand(50));
3283 break;
3284 case BULLET_TRI3:
3285 passing_colours [3] = TRANS_LRED; //bullet[b].colours [0];
3286 passing_colours [2] = TRANS_ORANGE; //bullet[b].colours [1];
3287 passing_colours [1] = TRANS_YELLOW; //bullet[b].colours [2];
3288 passing_colours [0] = TRANS_WHITE; //bullet[b].colours [3];
3289 for (j = 0; j < 14; j ++)
3290 {
3291 xs = grand(ANGLE_FULL);
3292 create_cloud(CLOUD_BIG_BLAST_CIRCLE,
3293 bullet[b].x,
3294 bullet[b].y, //grand(10001) - 5000,
3295 0, 0,
3296 // bullet[b].x_speed + xpart(xs, 5000 + grand(6000)),
3297 // bullet[b].y_speed + ypart(xs, 5000 + grand(6000)),
3298 xpart(xs, 4000 + grand(6000)),
3299 ypart(xs, 4000 + grand(6000)),
3300 85 + grand(50), 3, 0, 0, 0, 0, passing_colours);
3301 }
3302 passing_colours [0] = TRANS_ORANGE; //bullet[b].colours [0];
3303 passing_colours [1] = TRANS_YELLOW; //bullet[b].colours [1];
3304 passing_colours [2] = TRANS_WHITE; //bullet[b].colours [2];
3305 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 400 + grand(300), passing_colours);
3306 blast(bullet[b].x, bullet[b].y, 50000, 250, 5000, bullet[b].owner);
3307 bullet_soundf(b, NWAV_BURST, 400 + grand(10));
3308 break;
3309 case BULLET_OVERTRI:
3310 passing_colours [3] = TRANS_DGREEN; //bullet[b].colours [0];
3311 passing_colours [2] = TRANS_LGREEN; //bullet[b].colours [1];
3312 passing_colours [1] = TRANS_YELLOW; //bullet[b].colours [2];
3313 passing_colours [0] = TRANS_WHITE; //bullet[b].colours [3];
3314 for (j = 0; j < 24; j ++)
3315 {
3316 xs = grand(ANGLE_FULL);
3317 create_cloud(CLOUD_BIG_BLAST_CIRCLE,
3318 bullet[b].x,
3319 bullet[b].y, //grand(10001) - 5000,
3320 0, 0,
3321 xpart(xs, 4000 + grand(6000)),
3322 ypart(xs, 4000 + grand(6000)),
3323 85 + grand(80), 3, 0, 0, 0, 0, passing_colours);
3324 }
3325 passing_colours [0] = TRANS_LGREEN; //bullet[b].colours [0];
3326 passing_colours [1] = TRANS_YELLOW; //bullet[b].colours [1];
3327 passing_colours [2] = TRANS_WHITE; //bullet[b].colours [2];
3328 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 800 + grand(300), passing_colours);
3329 blast(bullet[b].x, bullet[b].y, 70000, 500, 6000, bullet[b].owner);
3330 bullet_soundf(b, NWAV_BURST, 200 + grand(10));
3331 break;
3332 case BULLET_EYE_DESOLATION_SMALL:
3333 passing_colours[2] = TRANS_YELLOW;
3334 passing_colours[1] = TRANS_ORANGE;
3335 passing_colours[0] = TRANS_DRED;
3336 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(150), passing_colours);
3337 break;
3338 case BULLET_EYE_DESOLATION:
3339 passing_colours [0] = bullet[b].colours [0];
3340 passing_colours [1] = bullet[b].colours [1];
3341 passing_colours [2] = bullet[b].colours [2];
3342 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(300) + bullet[b].special2 * 10, passing_colours);
3343 blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, 2000 + bullet[b].special1 * 10, bullet[b].owner);
3344 if (bullet[b].special5 > 0 && hit_what != HIT_WAVE)
3345 {
3346 m = ANGLE_FULL / bullet[b].special5;
3347 for (j = 0; j < bullet[b].special5; j ++)
3348 {
3349 xs = xpart((m * j) + bullet[b].angle, 800 + bullet[b].special4 * 9);
3350 ys = ypart((m * j) + bullet[b].angle, 800 + bullet[b].special4 * 9);
3351 create_bullet(BULLET_EYE_DESOLATION_SMALL, bullet[b].x + xs * 3, bullet[b].y + ys * 3,
3352 xs, ys, bullet[b].owner,
3353 bullet[b].special1, 30 + grand(10), 100, 0, 0, 0, bullet[b].colours, 1,
3354 0,0,0,0,0);
3355 }
3356 }
3357 simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50) + bullet[b].special2 * 2, 15);
3358 bullet_soundf(b, NWAV_BURSTZL, 300 + grand(100));
3359 break;
3360 case BULLET_BURNING_EYE:
3361 passing_colours [0] = bullet[b].colours [0];
3362 passing_colours [1] = bullet[b].colours [1];
3363 passing_colours [2] = bullet[b].colours [2];
3364 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 200 + grand(300) + bullet[b].special2 * 10, passing_colours);
3365 blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, 2000 + bullet[b].special1 * 10, bullet[b].owner);
3366 passing_colours [0] = TRANS_ORANGE;
3367 passing_colours [1] = COLOUR_ORANGE8;
3368 place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 5, 15, 15, 1200 + (bullet[b].special1 * 3), 300, passing_colours);
3369 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50) + bullet[b].special2 * 2);
3370 bullet_soundf(b, NWAV_SHORTBURST, 1300 + grand(100));
3371 break;
3372 case BULLET_FLOWER:
3373 if (hit_what != HIT_NOTHING)
3374 {
3375 passing_colours [0] = TRANS_DGREEN;
3376 passing_colours [1] = TRANS_LGREEN;
3377 passing_colours [2] = TRANS_YELLOW;
3378 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(2), passing_colours);
3379 break;
3380 }
3381 switch(grand(5))
3382 {
3383 case 0:
3384 passing_colours [0] = TRANS_DRED;
3385 passing_colours [1] = TRANS_LRED;
3386 passing_colours [2] = TRANS_YELLOW;
3387 break;
3388 case 1:
3389 passing_colours [0] = TRANS_DGREEN;
3390 passing_colours [1] = TRANS_LGREEN;
3391 passing_colours [2] = TRANS_YELLOW;
3392 break;
3393 case 2:
3394 passing_colours [0] = TRANS_DBLUE;
3395 passing_colours [1] = TRANS_LBLUE;
3396 passing_colours [2] = TRANS_WHITE;
3397 break;
3398 case 3:
3399 passing_colours [0] = TRANS_ORANGE;
3400 passing_colours [1] = TRANS_YELLOW;
3401 passing_colours [2] = TRANS_WHITE;
3402 break;
3403 case 4:
3404 passing_colours [0] = TRANS_DBLUE;
3405 passing_colours [1] = TRANS_LBLUE;
3406 passing_colours [2] = TRANS_PURPLE;
3407 break;
3408 }
3409 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 80 + grand(20) + bullet[b].special1 / 2, passing_colours);
3410 // blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, 2000 + bullet[b].special1 * 10, bullet[b].owner);
3411 blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1 / 2, -2000 - bullet[b].special1 * 10, bullet[b].owner);
3412 // passing_colours [1] = TRANS_DRED;
3413 // passing_colours [2] = TRANS_DRED;
3414 xs = bullet[b].special5 / 3; // cannot == 0!!
3415 int pc2 [4];
3416 for (j = 0; j < xs; j ++)
3417 {
3418 pc2 [0] = passing_colours [2];
3419 pc2 [1] = passing_colours [2];
3420 pc2 [2] = passing_colours [2];
3421 create_cloud(CLOUD_BLAST_CIRCLE,
3422 bullet[b].x, bullet[b].y, 0, 0,
3423 bullet[b].x_speed + xpart(bullet[b].angle + j * (ANGLE_FULL / xs), 9000 + bullet[b].special1 * 9),
3424 bullet[b].y_speed + ypart(bullet[b].angle + j * (ANGLE_FULL / xs), 9000 + bullet[b].special1 * 9),
3425 40 + grand(5) + bullet[b].special1 / 3, -20, 3, 0, 0, 0, pc2);
3426 pc2 [0] = passing_colours [1];
3427 pc2 [1] = passing_colours [1];
3428 pc2 [2] = passing_colours [1];
3429 create_cloud(CLOUD_BLAST_CIRCLE,
3430 bullet[b].x, bullet[b].y, 0, 0,
3431 bullet[b].x_speed + xpart(bullet[b].angle + j * (ANGLE_FULL / xs), 8000 + bullet[b].special1 * 8),
3432 bullet[b].y_speed + ypart(bullet[b].angle + j * (ANGLE_FULL / xs), 8000 + bullet[b].special1 * 8),
3433 50 + grand(10) + bullet[b].special1 / 3, -30, 3, 0, 0, 0, pc2);
3434 }
3435 /* for (j = 0; j < 3; j ++)
3436 {
3437 passing_colours [0] = TRANS_LRED;
3438 create_cloud(CLOUD_BLAST_CIRCLE,
3439 bullet[b].x, bullet[b].y, 0, 0,
3440 bullet[b].x_speed + xpart(bullet[b].angle + j * (ANGLE_FULL / 3), 6900 + bullet[b].special1 * 9),
3441 bullet[b].y_speed + ypart(bullet[b].angle + j * (ANGLE_FULL / 3), 6900 + bullet[b].special1 * 9),
3442 40 + grand(5) + bullet[b].special1 / 3, -20, 3, 0, 0, 0, passing_colours);
3443 passing_colours [0] = TRANS_DRED;
3444 create_cloud(CLOUD_BLAST_CIRCLE,
3445 bullet[b].x, bullet[b].y, 0, 0,
3446 bullet[b].x_speed + xpart(bullet[b].angle + j * (ANGLE_FULL / 3), 6000 + bullet[b].special1 * 8),
3447 bullet[b].y_speed + ypart(bullet[b].angle + j * (ANGLE_FULL / 3), 6000 + bullet[b].special1 * 8),
3448 50 + grand(10) + bullet[b].special1 / 3, -30, 3, 0, 0, 0, passing_colours);
3449 }*/
3450 bullet[b].type = BULLET_FLOWER2;
3451 bullet[b].timeout = 15;
3452 bullet_soundf(b, NWAV_BURSTZL, 800 + grand(10));
3453 // bullet_soundf(b, NWAV_BURST, 200 + grand(100));
3454 return; // NOTE return
3455 case BULLET_FLOWER2:
3456 /* if (hit_what != HIT_NOTHING)
3457 {
3458 passing_colours [0] = TRANS_DGREEN;
3459 passing_colours [1] = TRANS_LGREEN;
3460 passing_colours [2] = TRANS_YELLOW;
3461 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(2), passing_colours);
3462 break;
3463 }*/
3464 // passing_colours [0] = TRANS_ORANGE;
3465 // passing_colours [1] = TRANS_YELLOW;
3466 // passing_colours [2] = TRANS_WHITE;
3467 switch(grand(5))
3468 {
3469 case 0:
3470 bullet[b].colours [2] = TRANS_DRED;
3471 bullet[b].colours [1] = TRANS_LRED;
3472 bullet[b].colours [0] = TRANS_YELLOW;
3473 break;
3474 case 1:
3475 bullet[b].colours [2] = TRANS_DGREEN;
3476 bullet[b].colours [1] = TRANS_LGREEN;
3477 bullet[b].colours [0] = TRANS_YELLOW;
3478 break;
3479 case 2:
3480 bullet[b].colours [2] = TRANS_DBLUE;
3481 bullet[b].colours [1] = TRANS_LBLUE;
3482 bullet[b].colours [0] = TRANS_WHITE;
3483 break;
3484 case 3:
3485 bullet[b].colours [2] = TRANS_ORANGE;
3486 bullet[b].colours [1] = TRANS_YELLOW;
3487 bullet[b].colours [0] = TRANS_WHITE;
3488 break;
3489 case 4:
3490 bullet[b].colours [2] = TRANS_DBLUE;
3491 bullet[b].colours [1] = TRANS_LBLUE;
3492 bullet[b].colours [0] = TRANS_PURPLE;
3493 break;
3494 }
3495 if (bullet[b].special5 > 0)
3496 {
3497 m = ANGLE_FULL / bullet[b].special5;
3498 for (j = 0; j < bullet[b].special5; j ++)
3499 {
3500 xs = xpart((m * j) + bullet[b].angle + ANGLE_QUARTER, 1200 + bullet[b].special4 * 15);
3501 ys = ypart((m * j) + bullet[b].angle + ANGLE_QUARTER, 1200 + bullet[b].special4 * 15);
3502 create_bullet(BULLET_PETAL1, //bullet[b].x, bullet[b].y, //
3503 bullet[b].x + xs, bullet[b].y + ys,
3504 xs, ys, bullet[b].owner,
3505 bullet[b].special1, 30 + grand(10), 100, 0, 0, 0, bullet[b].colours, 1,
3506 0,0,0,0,0);
3507 }
3508 }
3509 bullet_soundf(b, NWAV_BURST, 200 + grand(100));
3510 // bullet_soundf(b, NWAV_BURSTZL, 200 + grand(10));
3511 break;
3512 case BULLET_FROZEN_STAR:
3513 passing_colours [0] = TRANS_DBLUE;
3514 passing_colours [1] = TRANS_LBLUE;
3515 passing_colours [2] = TRANS_WHITE;
3516 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(2), passing_colours);
3517 break;
3518 case BULLET_SPORE:
3519 passing_colours [0] = TRANS_ORANGE;
3520 passing_colours [1] = TRANS_YELLOW;
3521 passing_colours [2] = TRANS_WHITE;
3522 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(2), passing_colours);
3523 break;
3524 case BULLET_EVIL_STAR:
3525 passing_colours [0] = bullet[b].colours [0];
3526 passing_colours [1] = bullet[b].colours [1];
3527 passing_colours [2] = bullet[b].colours [2];
3528 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 3 + grand(2), passing_colours);
3529 break;
3530 case BULLET_FROZEN_TOOTH:
3531 passing_colours [0] = TRANS_DBLUE;
3532 passing_colours [1] = TRANS_LBLUE;
3533 passing_colours [2] = TRANS_WHITE;
3534 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 20 + grand(10) + bullet[b].special2, passing_colours);
3535 //blast(bullet[b].x, bullet[b].y, bullet[b].special3, bullet[b].special1, 2000 + bullet[b].special1 * 10, bullet[b].owner);
3536 // passing_colours [0] = TRANS_LBLUE;
3537 // passing_colours [1] = COLOUR_WHITE;
3538 // place_line_burst(bullet[b].x, bullet[b].y, 0, 0, 5, 15, 15, 1200 + (bullet[b].special1 * 3), 300, passing_colours);
3539 // simple_shockwave(TRANS_WHITE2, bullet[b].x, bullet[b].y, 0, 0, 300 + crandom(50) + bullet[b].special2 * 2);
3540 break;
3541 case BULLET_BALL1:
3542 case BULLET_BALL2:
3543 passing_colours[0] = TRANS_ORANGE;
3544 passing_colours[1] = TRANS_YELLOW;
3545 passing_colours[2] = TRANS_WHITE;
3546 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(150), passing_colours);
3547 break;
3548 case BULLET_PULSE1:
3549 passing_colours[0] = TRANS_ORANGE;
3550 passing_colours[1] = TRANS_YELLOW;
3551 passing_colours[2] = TRANS_WHITE;
3552 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(150), passing_colours);
3553 break;
3554 case BULLET_PULSE2:
3555 passing_colours[0] = TRANS_DBLUE;
3556 passing_colours[1] = TRANS_LBLUE;
3557 passing_colours[2] = TRANS_WHITE;
3558 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 300 + grand(150), passing_colours);
3559 break;
3560 case BULLET_OVERPULSE:
3561 passing_colours[0] = TRANS_DGREEN;
3562 passing_colours[1] = TRANS_LGREEN;
3563 passing_colours[2] = TRANS_YELLOW;
3564 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 1300 + grand(450), passing_colours);
3565 break;
3566 case BULLET_TWIRLY1:
3567 case BULLET_TWIRLY2:
3568 passing_colours[0] = TRANS_ORANGE;
3569 passing_colours[1] = TRANS_YELLOW;
3570 passing_colours[2] = TRANS_WHITE;
3571 place_explosion(bullet[b].x, bullet[b].y, 0, 0, 900 + grand(100), passing_colours);
3572 break;
3573 case BULLET_TWISTY:
3574 passing_colours [0] = bullet[b].colours [0];
3575 passing_colours [1] = bullet[b].colours [1];
3576 passing_colours [2] = bullet[b].colours [2];
3577 xa = (bullet[b].special1 % 32) * 32;
3578 xb = xpart(xa, 13 * GRAIN);
3579 cx = bullet[b].x + xpart(bullet[b].angle + ANGLE_QUARTER, xb);
3580 cy = bullet[b].y + ypart(bullet[b].angle + ANGLE_QUARTER, xb);
3581 place_explosion(cx, cy, 0, 0, 600 + grand(100), passing_colours);
3582 cx = bullet[b].x + xpart(bullet[b].angle - ANGLE_QUARTER, xb);
3583 cy = bullet[b].y + ypart(bullet[b].angle - ANGLE_QUARTER, xb);
3584 place_explosion(cx, cy, 0, 0, 600 + grand(100), passing_colours);
3585 break;
3586 case BULLET_TWIRLY3:
3587 create_cloud(CLOUD_TWIRLY_CIRCLE,
3588 bullet[b].x, bullet[b].y,
3589 0, 0,
3590 0, 0,
3591 50, 1, 0, 0, 0, 0, passing_colours);
3592 break;
3593 case BULLET_CRYSTAL1:
3594 create_cloud(CLOUD_SHATTER1, bullet[b].x, bullet[b].y, 0, 0,
3595 0, 0, 35, 1,
3596 0, 0, 0, 0, passing_colours);
3597 blast(bullet[b].x, bullet[b].y, 30000, 200, 6500, bullet[b].owner);
3598 bullet_soundf(b, NWAV_SHADOW, 700 + grand(100));
3599 break;
3600 case BULLET_CRYSTAL2:
3601 create_cloud(CLOUD_SHATTER2, bullet[b].x, bullet[b].y, 0, 0,
3602 0, 0, 35, 2,
3603 0, bullet[b].angle, 0, 0, passing_colours);
3604 blast(bullet[b].x, bullet[b].y, 35000, 250, 7000, bullet[b].owner);
3605 bullet_soundf(b, NWAV_SHADOW, 500 + grand(100));
3606 break;
3607 case BULLET_LINE_PULSE:
3608 passing_colours [0] = bullet[b].colours [0];
3609 for (j = 0; j < 9; j ++)
3610 {
3611 xa = bullet[b].angle + j * ANGLE_FULL / 9 + grand(ANGLE_1_SIXTEENTH) - grand(ANGLE_1_SIXTEENTH);
3612 create_cloud(CLOUD_LINE_SHADOW,
3613 bullet[b].x + xpart(xa, 11 * GRAIN),
3614 bullet[b].y + ypart(xa, 11 * GRAIN),
3615 0, 0,
3616 xpart(xa, 1200),
3617 ypart(xa, 1200),
3618 140 + grand(40),6 + grand(3),0, xa + ANGLE_QUARTER, 0, 0, passing_colours);
3619 }
3620 break;
3621
3622
3623 case BULLET_YELLOW_FLAK:
3624 blast(bullet[b].x, bullet[b].y, 22000, 200, 5000, bullet[b].owner);
3625 create_cloud(CLOUD_FLAK_BURST,
3626 bullet[b].x, bullet[b].y,
3627 0, 0, 0, 0,
3628 60,5,0, 0, 3, 0, passing_colours);
3629 bullet_soundvf(b, NWAV_SHORTBURST, 100, 1500 + grand(100));
3630 break;
3631 }
3632
3633 // Note: not all bullets get this far (eg mines)
3634
3635 destroy_bullet(b);
3636
3637 }
3638
3639
3640 void enemy_beam(int x, int y, int angle, int power, int type, int e)
3641 {
3642
3643 int x2, y2, angle2;
3644 int actor_size;
3645 int i, a, c;
3646 int a1, adiff, t_angle;
3647
3648
3649 if (power > 100)
3650 a = (150 - power) * 6;
3651 else
3652 a = 300;
3653 if (power < 25)
3654 a = power * 12;
3655
3656 if (power > 100)
3657 c = (150 - power) / 12 + 1;// + pulsate(64, 2, effect[dr].things [2]);
3658 else
3659 c = 5 + grand(3);// + pulsate(64, 1, effect[dr].things [2]);
3660 if (power < 40)
3661 c = power / 8 + grand(3);
3662 if (c < 1)
3663 c = 1;
3664
3665 for (i = 0; i < NO_ACTORS; i ++)
3666 {
3667 if (actor[i].in_play == 0)
3668 continue;
3669 if (actor[i].grace_period > 0)
3670 continue;
3671
3672 actor_size = 7;
3673 if (actor[i].ship == SHIP_SMALL)
3674 actor_size = 5;
3675
3676 if (hypot(actor[i].x - (x + xpart(angle, 21 * GRAIN + a * GRAIN)), actor[i].y - (y + ypart(angle, 21 * GRAIN + a * GRAIN))) < (12 + actor_size) * GRAIN)
3677 {
3678 if (type == EFFECT_REDBEAM)
3679 actor_in_beam(i, angle, 20, 600, TRANS_YELLOW, TRANS_DRED);
3680 else
3681 actor_in_beam(i, angle, 20, 800, TRANS_WHITE, TRANS_LBLUE);
3682 continue;
3683 }
3684
3685 if (hypot(actor[i].x - (enemy[e].x + xpart(enemy[e].angle, 20000)),
3686 actor[i].y - (enemy[e].y + ypart(enemy[e].angle, 20000)))
3687 > hypot(actor[i].x - (enemy[e].x - xpart(enemy[e].angle, 20000)),
3688 actor[i].y - (enemy[e].y - ypart(enemy[e].angle, 20000))))
3689 continue;
3690
3691
3692 if (hypot(actor[i].x - (x + xpart(angle, 21 * GRAIN)), actor[i].y - (y + ypart(angle, 21 * GRAIN))) > a * GRAIN)
3693 continue;
3694
3695 x2 = x - xpart(angle, 200 * GRAIN);
3696 y2 = y - ypart(angle, 200 * GRAIN);
3697 angle2 = radians_to_angle(atan2(actor[i].y - y2, actor[i].x - x2));
3698
3699
3700 a1 = abs(radians_to_angle(atan2(y + ypart(angle, a * GRAIN) + ypart(angle - ANGLE_QUARTER, (c * 2 + 7) * GRAIN) - y2,
3701 x + xpart(angle, a * GRAIN) + xpart(angle - ANGLE_QUARTER, (c * 2 + actor_size) * GRAIN) - x2)));
3702
3703 if (y + ypart(angle, a * GRAIN) + ypart(angle - ANGLE_QUARTER, (c * 2 + actor_size) * GRAIN) < y2)
3704 a1 = ANGLE_FULL - a1;
3705
3706 angle2 = abs(angle2);
3707
3708 if (actor[i].y < y2)
3709 angle2 = (ANGLE_FULL - angle2) % ANGLE_FULL;
3710
3711 t_angle = angle;
3712 if (angle > ANGLE_HALF)
3713 t_angle = ANGLE_FULL - angle;
3714 t_angle = abs(t_angle);
3715
3716 var1 = angle_difference(abs(angle2),
3717 abs(radians_to_angle(atan2(actor[i].y - y, actor[i].x - x))));
3718 var2 = abs(t_angle);
3719 var3 = abs(radians_to_angle(atan2(actor[i].y - y, actor[i].x - x)));
3720
3721 adiff = abs(radians_to_angle(atan2(actor[i].y - y, actor[i].x - x)));
3722 if (adiff > ANGLE_HALF)
3723 adiff = ANGLE_FULL - adiff;
3724
3725 var3 = adiff;
3726
3727 if (angle_difference(abs(angle2), abs(angle)) < angle_difference(abs(angle), abs(a1)))
3728 {
3729
3730 {
3731 if (angle_difference(abs(t_angle), adiff) < ANGLE_QUARTER)
3732 {
3733 if (type == EFFECT_REDBEAM)
3734 actor_in_beam(i, angle, 20, 600, TRANS_YELLOW, TRANS_DRED);
3735 else
3736 actor_in_beam(i, angle, 20, 800, TRANS_WHITE, TRANS_LBLUE);
3737 continue;
3738 }
3739 }
3740
3741 }
3742
3743 }
3744
3745 }
3746
3747 void actor_in_beam(int i, int angle, int damage, int force, int colour1, int colour2)
3748 {
3749 int passing_colours [5];
3750
3751 passing_colours [0] = colour2;
3752
3753 create_cloud(CLOUD_MED_TRANS_CIRCLE,
3754 actor[i].x,
3755 actor[i].y,
3756 0, 0,
3757 0,
3758 0,
3759 1200 + grand(400),400, 0, 0, 0, 0, passing_colours);
3760 passing_colours [0] = colour1;
3761
3762 create_cloud(CLOUD_MED_TRANS_CIRCLE,
3763 actor[i].x,
3764 actor[i].y,
3765 0, 0,
3766 0,
3767 0,
3768 1000 + grand(300),400, 0, 0, 0, 0, passing_colours);
3769 actor[i].x_speed += xpart(angle, force);
3770 actor[i].y_speed += ypart(angle, force);
3771 actor[i].screen_shake_time += 2;
3772 if (actor[i].screen_shake_time > 12)
3773 actor[i].screen_shake_time = 12;
3774 hurt_actor(i, OWNER_ENEMY, damage);
3775 }
3776
3777 void destroy_bullet(int b)
3778 {
3779 bullet[b].type = BULLET_NONE;
3780 }
3781
3782
3783 int move_bullet(int mbull, char limited)
3784 {
3785
3786
3787 if (bullet[mbull].x_speed == 0 && bullet[mbull].y_speed == 0) return 1;
3788 /*
3789 if (bullet[mbull].x + bullet[mbull].x_speed <= 0
3790 || bullet[mbull].x + bullet[mbull].x_speed >= arena.max_x - 3000)
3791 {
3792 bullet_impact(mbull, -1);
3793 return 0;
3794 }
3795 if (bullet[mbull].y + bullet[mbull].y_speed <= 0
3796 || bullet[mbull].y + bullet[mbull].y_speed >= arena.max_y - 4000)
3797 {
3798 bullet_impact(mbull, -1);
3799 return 0;
3800 }
3801 */
3802
3803 if (bullet[mbull].x <= 0
3804 || bullet[mbull].x >= arena.max_x - 3000)
3805 {
3806 bullet_impact(mbull, -1, HIT_EDGE);
3807 return 0;
3808 }
3809 if (bullet[mbull].y <= 0
3810 || bullet[mbull].y >= arena.max_y - 4000)
3811 {
3812 bullet_impact(mbull, -1, HIT_EDGE);
3813 return 0;
3814 }
3815
3816 bullet[mbull].x2 += bullet[mbull].x_speed;
3817 bullet[mbull].y2 += bullet[mbull].y_speed;
3818
3819 bullet[mbull].x += bullet[mbull].x_speed;
3820 bullet[mbull].y += bullet[mbull].y_speed;
3821
3822 if (arena.waver_on_level != 0 && bullet[mbull].owner != OWNER_ENEMY)
3823 {
3824 int e, d1, d2, nd;
3825
3826 for (e = 0; e < NO_ENEMIES; e ++)
3827 {
3828 if (enemy[e].type == ENEMY_WAVER1 || enemy[e].type == ENEMY_WAVER2)
3829 {
3830 d1 = hypot(enemy[e].x - bullet[mbull].x, enemy[e].y - bullet[mbull].y);
3831 d2 = hypot(enemy[e].x - bullet[mbull].x - bullet[mbull].x_speed, enemy[e].y - bullet[mbull].y - bullet[mbull].y_speed);
3832 nd = 147 * GRAIN;
3833 if (enemy[e].type == ENEMY_WAVER2)
3834 nd = 197 * GRAIN;
3835 if ((d2 < nd && d1 >= nd)
3836 || (d1 >= nd - 8 * GRAIN && d1 <= nd + 8 * GRAIN)
3837 || (d2 >= nd && d1 < nd))
3838 {
3839 bullet_impact(mbull, -1, HIT_WAVE);
3840 return 0;
3841 }
3842 }
3843 }
3844 }
3845
3846 return 1;
3847
3848 /*
3849 char dir_x = 0, dir_y = 0;
3850
3851 int move_x = bullet[mbull].x_speed;
3852 int move_y = bullet[mbull].y_speed;
3853
3854 int timeout = 0;
3855
3856 if (move_x > 0) dir_x = 10;
3857 if (move_x < 0) dir_x = -10;
3858 if (move_y > 0) dir_y = 10;
3859 if (move_y < 0) dir_y = -10;
3860
3861
3862 int step_x = move_x;
3863 int step_y = move_y;
3864
3865 int oldx = bullet[mbull].x;
3866 int oldy = bullet[mbull].y;
3867
3868
3869 if (step_x == 0)
3870 {
3871 if (step_y > GRAIN)
3872 step_y = GRAIN;
3873 if (step_y < -GRAIN)
3874 step_y = -GRAIN;
3875 }
3876 else
3877 if (step_y == 0)
3878 {
3879 if (step_x > GRAIN)
3880 step_x = GRAIN;
3881 if (step_x < -GRAIN)
3882 step_x = -GRAIN;
3883 }
3884 else
3885 if (abs(step_x) > GRAIN || abs(step_y) > GRAIN)
3886 {
3887 if (abs(step_x) >= abs(step_y))
3888 {
3889 step_y = (step_y * GRAIN) / abs(step_x);
3890 step_x = (GRAIN * step_x) / abs(step_x);
3891 } else
3892 if (abs(step_y) > abs(step_x))
3893 {
3894 step_x = (step_x * GRAIN) / abs(step_y);
3895 step_y = (GRAIN * step_y) / abs(step_y);
3896 }
3897 }
3898
3899 // if (move_x == 10 && move_y == 0 && bullet[mbull].damage != -1)
3900 // {
3901 // if (actor_collision(mbull) == 1) return 0;
3902 // }
3903
3904
3905 while (move_x != 0 || move_y != 0)
3906 {
3907 timeout ++;
3908 if (timeout > 1000)
3909 break;
3910 // if (actor_collision(mbull) == 1) return 0;
3911
3912
3913
3914 if (step_x == 0 && step_y == 0) return 1;
3915
3916 if (step_x == 0) move_x = 0;
3917 if (step_y == 0) move_y = 0;
3918
3919
3920
3921 if (move_y != 0 && (abs(move_y + step_y) == move_y + step_y) != (abs(step_y) == step_y))
3922 {
3923 // move_y = 0;
3924 step_y = move_y;
3925 if (move_x == 0) break;
3926 }
3927
3928 if (move_x != 0 && (abs(move_x + step_x) == move_x + step_x) != (abs(step_x) == step_x))
3929 {
3930 // move_x = 0;
3931 step_x = move_x;
3932 if (move_y == 0) break;
3933 }
3934
3935 if ((move_x > 0) != (step_x > 0))// && (move_x < 0) != (step_x < 0))
3936 {
3937 // move_x = 0;
3938 step_x = move_x;
3939 if (move_y == 0) break;
3940 }
3941
3942 if ((move_y > 0) != (step_y > 0))// && (move_y < 0) != (step_y < 0))
3943 {
3944 // move_y = 0;
3945 step_y = move_y;
3946 if (move_x == 0) break;
3947 }
3948
3949
3950 if (limited == 1)
3951 {
3952 move_x -= step_x;
3953 move_y -= step_y;
3954 }
3955
3956 bullet[mbull].x += step_x;
3957 bullet[mbull].y += step_y;
3958
3959 * /
3960 } // end of while loop
3961 bullet[mbull].x2 += bullet[mbull].x_speed;
3962 bullet[mbull].y2 += bullet[mbull].y_speed;
3963
3964
3965 if (oldx == bullet[mbull].x && oldy == bullet[mbull].y)
3966 {
3967 bullet[mbull].x_speed = 0;
3968 bullet[mbull].y_speed = 0;
3969 }
3970
3971
3972
3973 return 1;
3974 */
3975 }
3976
3977
3978
3979 int detect_collision(int b, int things [2])
3980 {
3981
3982 int x2 = bullet[b].x - bullet[b].x_speed;
3983 int y2 = bullet[b].y - bullet[b].y_speed;
3984 int i;
3985 /* int xa, ya;
3986 float bullet_angle;
3987 float bullet_slope;
3988 int side_disp;
3989 int x1 =*/
3990
3991 if (bullet[b].damage == 0)
3992 return -1;
3993
3994 for (i = 0; i < NO_ACTORS; i ++)
3995 {
3996 // I tried to write an accurate collision detector but failed; all my
3997 // ideas would've been too slow. So we get this horrible thing which
3998 // is woefully inaccurate at high relative speeds:
3999 if (actor[i].in_play == 0)
4000 continue;
4001 if (actor[i].grace_period > 0)
4002 continue;
4003 if (bullet[b].owner == i)
4004 continue; // for duels; actors' bullets in non-duel games don't get this far.
4005 if (hypot(actor[i].x - bullet[b].x, actor[i].y - bullet[b].y) <= actor[i].radius + bullet[b].size)
4006 {
4007 things [0] = bullet[b].x;
4008 things [1] = bullet[b].y;
4009 return i;
4010 }
4011 if (hypot(actor[i].x - x2, actor[i].y - y2) <= actor[i].radius + bullet[b].size)
4012 {
4013 things [0] = x2;
4014 things [1] = y2;
4015 return i;
4016 }
4017
4018
4019 }
4020
4021 return -1;
4022
4023 }
4024
4025
4026
4027 int detect_enemy_collision(int b, int things [2])
4028 {
4029
4030 int x2 = bullet[b].x - bullet[b].x_speed;
4031 int y2 = bullet[b].y - bullet[b].y_speed;
4032 int e;
4033
4034 for (e = 0; e < NO_ENEMIES; e ++)
4035 {
4036 if (enemy[e].type == ENEMY_NONE)
4037 continue;
4038 if (enemy[e].radius == 0) // dead wanderer etc
4039 continue;
4040 // if (bullet[b].owner == OWNER_ENEMY)
4041 // continue;
4042 if (hypot(enemy[e].x - bullet[b].x, enemy[e].y - bullet[b].y) <= enemy[e].radius + bullet[b].size)
4043 {
4044 things [0] = bullet[b].x;
4045 things [1] = bullet[b].y;
4046 return e;
4047 }
4048 if (hypot(enemy[e].x - x2, enemy[e].y - y2) <= enemy[e].radius + bullet[b].size)
4049 {
4050 things [0] = x2;
4051 things [1] = y2;
4052 return e;
4053 }
4054 x2 = bullet[b].x - bullet[b].x_speed / 2;
4055 y2 = bullet[b].y - bullet[b].y_speed / 2;
4056 if (hypot(enemy[e].x - x2, enemy[e].y - y2) <= enemy[e].radius + bullet[b].size)
4057 {
4058 things [0] = x2;
4059 things [1] = y2;
4060 return e;
4061 }
4062
4063 }
4064
4065 return -1;
4066
4067 }
4068
4069
4070
4071
4072
4073 void blast(int x, int y, int radius, int damage, int force, int owner)
4074 {
4075
4076 int i, damage_done, distance;
4077 int bangle;
4078 float proportion;
4079
4080 if (owner == OWNER_ENEMY || game.type == GAME_DUEL)
4081 {
4082 for (i = 0; i < NO_ACTORS; i ++)
4083 {
4084 if (actor[i].in_play == 0)
4085 continue;
4086 if (actor[i].grace_period > 0)
4087 continue;
4088 if (i == owner)
4089 continue;
4090
4091 distance = hypot(actor[i].x - x, actor[i].y - y);
4092
4093 if (distance <= actor[i].radius + radius)
4094 {
4095 bangle = radians_to_angle(atan2(actor[i].y - y, actor[i].x - x));
4096 proportion = ((radius + actor[i].radius) * 50) / (distance + actor[i].radius);
4097 if (proportion > 100)
4098 proportion = 100;
4099 // actor[i].x_speed += cos(bangle) * (float) force * proportion / actor[i].mass;
4100 // actor[i].y_speed += sin(bangle) * (float) force * proportion / actor[i].mass;
4101 actor[i].x_speed += xpart(bangle, force * proportion / actor[i].mass);
4102 actor[i].y_speed += ypart(bangle, force * proportion / actor[i].mass);
4103 actor[i].screen_shake_time += (force * proportion) / 2000;
4104 if (actor[i].screen_shake_time > 12)
4105 actor[i].screen_shake_time = 12;
4106 damage_done = (float) damage * proportion;
4107 damage_done /= 100;
4108 // inflicteda = damage_done;
4109 // inflictede = proportion;
4110 if (damage_done > 0)
4111 hurt_actor(i, owner, damage_done);
4112 }
4113
4114
4115 }
4116 if (owner == OWNER_ENEMY)
4117 return;
4118 }
4119
4120 int e, sh;
4121
4122 for (e = 0; e < NO_ENEMIES; e ++)
4123 {
4124 if (enemy[e].type == ENEMY_NONE)
4125 continue;
4126 if (enemy[e].radius == 0)
4127 continue; // dead things
4128
4129 distance = hypot(enemy[e].x - x, enemy[e].y - y);
4130
4131 if (distance <= enemy[e].radius + radius)
4132 {
4133 bangle = radians_to_angle(atan2(enemy[e].y - y, enemy[e].x - x));
4134 // proportion = (float) (((distance + enemy[e].radius) * 100) / (float) radius + enemy[e].radius);
4135 proportion = ((radius + enemy[e].radius) * 50) / (distance + enemy[e].radius);
4136 // (((distance + enemy[e].radius) * 100) / (float) radius + enemy[e].radius);
4137 if (proportion > 100)
4138 proportion = 100;
4139 enemy[e].x_speed += xpart(bangle, force * proportion / enemy[e].mass);
4140 enemy[e].y_speed += ypart(bangle, force * proportion / enemy[e].mass);
4141 damage_done = (float) damage * proportion;
4142 damage_done /= 100;
4143 // inflicteda = damage_done;
4144 // inflictede = proportion;
4145 sh = check_shielder(e);
4146 if (!sh)
4147 {
4148 int pulse = damage_done / 6 + 1;
4149 if (pulse > 8)
4150 pulse = 8;
4151 if (damage_done > 0)
4152 hurt_enemy(e, damage_done, owner, pulse);
4153 }
4154 else
4155 {
4156 shield_line(e,
4157 enemy[e].x + xpart(bangle + ANGLE_HALF, enemy[e].radius), // / GRAIN),
4158 enemy[e].y + ypart(bangle + ANGLE_HALF, enemy[e].radius)); // / GRAIN));
4159 }
4160 }
4161 // if (distance <= enemy[e].radius + radius)
4162 // {
4163 // }
4164 }
4165
4166 }
4167
4168
4169 void line_blast(int x, int y, int type, int target)
4170 {
4171 int b, xa;
4172
4173 for (b = 0; b < NO_BULLETS; b ++)
4174 {
4175 if (bullet[b].type != type)
4176 continue;
4177 if (bullet[b].special2 != target)
4178 continue;
4179 xa = radians_to_angle(atan2(bullet[b].y - y, bullet[b].x - x));
4180 bullet[b].x_speed += xpart(xa, 10000);
4181 bullet[b].y_speed += ypart(xa, 10000);
4182 bullet[b].special2 = -1;
4183 }
4184
4185 }
4186
4187
4188 int radius_effect(int x, int y, int radius, int effect)
4189 {
4190
4191 int i, distance, retval = 0;
4192
4193 for (i = 0; i < NO_ACTORS; i ++)
4194 {
4195 if (actor[i].in_play == 0)
4196 continue;
4197 if (actor[i].grace_period > 0)
4198 continue;
4199 distance = hypot(actor[i].x - x, actor[i].y - y);
4200
4201 if (distance <= actor[i].radius + radius)
4202 {
4203 switch(effect)
4204 {
4205 case RADEFFECT_TELEPORT:
4206 teleport_actor(i);
4207 retval = 1;
4208 break;
4209 }
4210 }
4211
4212 }
4213
4214 return retval;
4215 }
4216
4217
4218
4219 void drag_bullet(int b, float drag_amount)
4220 {
4221 bullet[b].x_speed *= (float) 1 - drag_amount;
4222 bullet[b].y_speed *= (float) 1 - drag_amount;
4223 }
4224
4225
4226 void teleport_actor(int a)
4227 {
4228
4229 int timeout = 2000;
4230 do
4231 {
4232 actor[a].x = grand(arena.max_x - 100000) + 50000;
4233 actor[a].y = grand(arena.max_y - 100000) + 50000;
4234 timeout --;
4235 }
4236 while (clear_space(actor[a].x, actor[a].y, 10000) == 0 && timeout > 0);
4237
4238 simple_cloud_trans(TRANS_DARKEN, actor[a].x, actor[a].y, 0, 0, 2020);
4239
4240 }
4241
4242 int clear_space(int x, int y, int rad)
4243 {
4244
4245 int e;
4246
4247 for (e = 0; e < NO_ENEMIES; e ++)
4248 {
4249 if (enemy[e].type == ENEMY_NONE)
4250 continue;
4251 if (enemy[e].radius == 0) // dead wanderer etc
4252 continue;
4253 if (hypot(enemy[e].x - x, enemy[e].y - y) <= enemy[e].radius + rad)
4254 {
4255 return 0;
4256 }
4257 }
4258
4259 return 1;
4260
4261 }
4262
4263 int enemy_bullet_track_target(int b, int attacking, int turning)
4264 {
4265
4266 bullet[b].angle = turn_towards_xy(bullet[b].x, bullet[b].y, actor[attacking].x, actor[attacking].y, bullet[b].angle, turning);
4267 return bullet[b].angle;
4268 }
4269
4270
4271 // returns the nearest actor - assumes max 2 actors
4272 // returns either 1 or 0, or -1 if no actors in place
4273 int closest_target(int x, int y)
4274 {
4275
4276 if (actor[0].in_play == 0 && actor[1].in_play == 0)
4277 return ATTACK_NONE;
4278
4279 if (actor[0].in_play == 0)
4280 return 1;
4281 if (actor[1].in_play == 0)
4282 return 0;
4283
4284 if (hypot(x - actor[0].x, y - actor[0].y)
4285 < hypot(x - actor[1].x, y - actor[1].y))
4286 return 0;
4287 else
4288 return 1;
4289
4290 }
4291
4292 // returns a random actor within range. Assumes max 2 actors
4293 // returns 1, 0, or ATTACK_NONE if none within range
4294 // range calculation is quick & dirty
4295 int nearby_target(int range, int x, int y)
4296 {
4297
4298 if (actor[0].in_play == 0 && actor[1].in_play == 0)
4299 return ATTACK_NONE;
4300
4301 if (actor[0].in_play == 1)
4302 {
4303 if (abs(actor[0].x - x) + abs(actor[0].y - y) < range)
4304 {
4305 if (actor[1].in_play == 1
4306 && abs(actor[1].x - x) + abs(actor[1].y - y) < range)
4307 {
4308 return grand(2);
4309 }
4310 else
4311 return 0;
4312 }
4313 }
4314
4315 if (actor[1].in_play == 1
4316 && abs(actor[1].x - x) + abs(actor[1].y - y) < range)
4317 return 1;
4318
4319 return ATTACK_NONE;
4320
4321 }
4322
4323
4324
4325 /*
4326
4327 void apply_force_to_actor(int a, float rangle, int total_force)
4328 {
4329
4330 float rangle = atan2(fx, fy);
4331
4332 int total_force = hypot(fx, fy);
4333
4334 actor[a].x_speed += cos(angle) * total_force;
4335 actor[a].y_speed += sin(angle) * total_force;
4336
4337 }
4338
4339
4340 void apply_force_to_enemy(int e, int fx, int fy)
4341 {
4342
4343 float rangle = atan2(fx, fy);
4344
4345 int total_force = hypot(fx, fy);
4346
4347 enemy[e].x_speed += cos(angle) * total_force;
4348 enemy[e].y_speed += sin(angle) * total_force;
4349
4350
4351 }
4352
4353
4354 */
4355
4356
4357 void bullet_soundf(int b, int sound, int freq)
4358 {
4359
4360 play_wav_pos(sound, freq, 255, bullet[b].x, bullet[b].y);
4361
4362 }
4363
4364 void bullet_soundvf(int b, int sound, int vol, int freq)
4365 {
4366
4367 play_wav_pos(sound, freq, vol, bullet[b].x, bullet[b].y);
4368
4369 }
4370
4371
4372
0 int create_bullet(int type, int x, int y,
1 int x_speed, int y_speed, int owner,
2 int damage, int timer, int mass, int angle,
3 int status, int size, int colours [4], int speed_div,
4 int special1, int special2, int special3, int special4, int special5);
5
6 void init_bullets(void);
7 void run_bullets(void);
8
9 void blast(int x, int y, int radius, int damage, int force, int owner);
10
11 int closest_target(int x, int y);
12 int nearby_target(int range, int x, int y);
13
14 void shield_line(int e, int bx, int by);
15 void shielder_pulse(int e, int dam);
16 int check_shielder(int e);
17 void enemy_beam(int x, int y, int angle, int power, int type, int e);
18 void line_blast(int x, int y, int type, int target);
19
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: cloud.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - functions relating to clouds and transient special effects
30
31 */
32 #include "allegro.h"
33
34 #include <math.h>
35
36 #include "config.h"
37 #include "globvars.h"
38
39 #include "stuff.h"
40 #include "palette.h"
41
42 #include "sound.h"
43 #include "light.h"
44 #include "actor.h"
45 #include "display.h"
46
47 void manage_cloud(int cl);
48 int move_cloud(int mc, char limited);
49
50 void destroy_cloud(int c);
51 void drag_cloud(int i, float dragged);
52
53 void simple_cloud(int colour, int x, int y, int xs, int ys, int size);
54 void simple_cloud_trans(int colour, int x, int y, int xs, int ys, int size);
55 void place_explosion_with_smoke(int x, int y, int xs, int ys, int size, int colours [5]);
56 void place_explosion(int x, int y, int xs, int ys, int size, int colours [5]);
57 void place_burstlet_burst(int x, int y, int xs, int ys, int burstlets, int min_timeout, int random_timeout, int burst, int random_burst, int pretravel, int colours [5]);
58
59 void place_bang(int x, int y, int xs, int ys, int size, int btype);
60
61 int create_cloud_minimum(int type, int x, int y, int x2, int y2,
62 int x_speed, int y_speed, int timer, int tickrate,
63 int delta_tickrate, int angle,
64 int status, unsigned char seed, int minimum, int colours [5]);
65
66
67 void init_clouds(void)
68 {
69
70 int c;
71
72 for (c = 0; c < NO_CLOUDS; c++)
73 {
74 cloud[c].type = CLOUD_NONE;
75 }
76
77 }
78
79 // should delta_tickrate be unsigned?
80 int create_cloud(int type, int x, int y, int x2, int y2,
81 int x_speed, int y_speed, int timer, int tickrate,
82 int delta_tickrate, int angle,
83 int status, unsigned char seed, int colours [5])
84 {
85
86 int c = 0;
87
88 for (c = 1; c < NO_CLOUDS; c++)
89 {
90 if (c == NO_CLOUDS - 1) return -1;
91 if (cloud[c].type == CLOUD_NONE) break;
92 }
93
94 cloud[c].type = type;
95 cloud[c].x = x;// + (x_speed - actor[owner].x_speed);
96 cloud[c].y = y;// + (y_speed - actor[owner].y_speed);
97 cloud[c].x2 = x2;
98 cloud[c].y2 = y2;
99 cloud[c].x_speed = x_speed;
100 cloud[c].y_speed = y_speed;
101 cloud[c].seed = seed;
102 cloud[c].timeout = timer;
103 cloud[c].tickrate= tickrate;
104 cloud[c].delta_tickrate= delta_tickrate;
105 cloud[c].status = status;
106 cloud[c].angle = angle;
107 cloud[c].colour [0] = colours [0];
108 cloud[c].colour [1] = colours [1];
109 cloud[c].colour [2] = colours [2];
110 cloud[c].colour [3] = colours [3];
111 cloud[c].colour [4] = colours [4];
112
113 return c;
114
115 }
116
117 // just like create_cloud, but sets a minimum for the index.
118 // use it for clouds that need to overwrite other clouds on the display (eg dead trianglers)
119 int create_cloud_minimum(int type, int x, int y, int x2, int y2,
120 int x_speed, int y_speed, int timer, int tickrate,
121 int delta_tickrate, int angle,
122 int status, unsigned char seed, int minimum, int colours [5])
123 {
124
125 int c = 0;
126
127 for (c = minimum; c < NO_CLOUDS; c++)
128 {
129 if (c == NO_CLOUDS - 1) return -1;
130 if (cloud[c].type == CLOUD_NONE) break;
131 }
132
133 cloud[c].type = type;
134 cloud[c].x = x;// + (x_speed - actor[owner].x_speed);
135 cloud[c].y = y;// + (y_speed - actor[owner].y_speed);
136 cloud[c].x2 = x2;
137 cloud[c].y2 = y2;
138 cloud[c].x_speed = x_speed;
139 cloud[c].y_speed = y_speed;
140 cloud[c].seed = seed;
141 cloud[c].timeout = timer;
142 cloud[c].tickrate= tickrate;
143 cloud[c].delta_tickrate= delta_tickrate;
144 cloud[c].status = status;
145 cloud[c].angle = angle;
146 cloud[c].colour [0] = colours [0];
147 cloud[c].colour [1] = colours [1];
148 cloud[c].colour [2] = colours [2];
149 cloud[c].colour [3] = colours [3];
150 cloud[c].colour [4] = colours [4];
151
152 return c;
153
154 }
155
156
157
158 void run_clouds(void)
159 {
160
161 int c;
162
163 for (c = 1; c < NO_CLOUDS; c++)
164 {
165 if (cloud[c].type != CLOUD_NONE) manage_cloud(c);
166 }
167
168 }
169
170
171 void manage_cloud(int c)
172 {
173
174 int passing_colours [5];
175
176 // int x_gain = 0;
177 // int y_gain = 0;
178 // char angle_change;
179
180 // if (cloud[c].timeout > 0)
181 // {
182 cloud[c].timeout -= cloud[c].tickrate;
183 cloud[c].tickrate += cloud[c].delta_tickrate;
184 // }
185
186 if (cloud[c].timeout <= 0 || cloud[c].timeout >= 10000) // 10000 is sanity check - unfortunately necessary
187 {
188 destroy_cloud(c);
189 return;
190 }
191
192 switch(cloud[c].type)
193 {
194 case CLOUD_PULSER1_V:
195 case CLOUD_PULSER1_H:
196 case CLOUD_PULSER2_V:
197 case CLOUD_PULSER2_H:
198 if (cloud[c].timeout <= 2)
199 {
200 shake_all_screens(3 + grand(5));
201 place_explosion(
202 cloud[c].x + (11 * GRAIN), cloud[c].y + (11 * GRAIN),
203 0, 0, 300, cloud[c].colour);
204 place_burstlet_burst(cloud[c].x, cloud[c].y,
205 0, 0, 4 + grand(3), 2, 5, 1200, 500,
206 4, cloud[c].colour);
207 play_wav_pos(NWAV_MINEBANG, 200 + grand(200), 200, cloud[c].x, cloud[c].y);
208 destroy_cloud(c);
209 return;
210 }
211 break;
212 case CLOUD_SQUAREY:
213 cloud[c].angle -= cloud[c].status;
214 cloud[c].x = cloud[c].x2 + xpart(cloud[c].angle, 30);
215 cloud[c].y = cloud[c].y2 + ypart(cloud[c].angle, 30);
216 if (cloud[c].timeout <= 2)
217 {
218 shake_all_screens(3 + grand(5));
219 place_explosion(
220 cloud[c].x + xpart(cloud[c].angle, 30000), cloud[c].y + ypart(cloud[c].angle, 30000),
221 0, 0, 300, cloud[c].colour);
222 place_burstlet_burst(cloud[c].x + xpart(cloud[c].angle, 30000), cloud[c].y + ypart(cloud[c].angle, 30000),
223 0, 0, 4 + grand(3), 2, 5, 1200, 500,
224 4, cloud[c].colour);
225
226 //void place_burstlet_burst(int x, int y, int xs, int ys, int burstlets, int min_timeout, int random_timeout, int burst, int random_burst, int pretravel, int colours [5])
227
228
229 play_wav_pos(NWAV_MINEBANG, 200 + grand(200), 200, cloud[c].x, cloud[c].y);
230
231 destroy_cloud(c);
232 return;
233 }
234 break;
235 /* case CLOUD_TRI1:
236 case CLOUD_TRI2:
237 case CLOUD_TRI3:
238 drag_cloud(c, .05);
239 if (cloud[c].timeout % 2 == 0)
240 {
241 int cangle = grand(ANGLE_FULL);
242 int cx = cloud[c].x + xpart(cangle, grand(cloud[c].status));
243 int cy = cloud[c].y + ypart(cangle, grand(cloud[c].status));
244 passing_colours [0] = cloud[c].colour [1];
245 create_cloud_minimum(CLOUD_MED_TRANS_CIRCLE,
246 cx, cy, 0, 0, cloud[c].x_speed, cloud[c].y_speed,
247 200 + grand(350),0,2, 0, 0, 0, c, passing_colours);
248 passing_colours [0] = cloud[c].colour [2];
249 create_cloud_minimum(CLOUD_MED_TRANS_CIRCLE,
250 cx, cy, 0, 0, cloud[c].x_speed, cloud[c].y_speed,
251 300 + grand(450),0,6, 0, 0, 0, c, passing_colours);
252 }
253 if (cloud[c].timeout <= 2)
254 {
255 shake_all_screens(7 + grand(8));
256 place_explosion(
257 cloud[c].x, cloud[c].y,
258 0, 0, 1900, cloud[c].colour);
259 place_burstlet_burst(cloud[c].x, cloud[c].y,
260 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
261 4, cloud[c].colour);
262 play_wav_pos(NWAV_BANG, 700, 200, cloud[c].x, cloud[c].y);
263 destroy_cloud(c);
264 return;
265 }
266 break;*/
267 case CLOUD_LIGHT:
268 add_light(LIGHT_NORMAL, cloud[c].timeout / 40, cloud[c].x, cloud[c].y);
269 break;
270 case CLOUD_FLAME_CIRCLE:
271 drag_cloud(c, .2);
272 break;
273 case CLOUD_BIG_BLAST_CIRCLE:
274 drag_cloud(c, .1);
275 break;
276 case CLOUD_BLAST_CIRCLE:
277 drag_cloud(c, .2);
278 break;
279 case CLOUD_SEEKER_CIRCLE:
280 drag_cloud(c, .2);
281 break;
282 case CLOUD_JET_CIRCLE1:
283 case CLOUD_JET_CIRCLE2:
284 case CLOUD_DRIVE_CIRCLE:
285 drag_cloud(c, .02);
286 break;
287 case CLOUD_BURSTLET:
288 // place_explosion(cloud[c].x, cloud[c].y, 0, 0, , cloud[c].colours);
289 passing_colours [0] = cloud[c].colour [1]; // was [0]
290
291 create_cloud(CLOUD_MED_TRANS_CIRCLE,
292 cloud[c].x, cloud[c].y, 0, 0, 0, 0,
293 100 + grand(450),0,2, 0, 0, 0, passing_colours);
294 // 50 + grand(300),0,3, 0, 0, 0, passing_colours);
295 // passing_colours [0] = cloud[c].colour [1];
296
297 // create_cloud(CLOUD_MED_TRANS_CIRCLE,
298 // cloud[c].x, cloud[c].y, 0, 0, 0, 0, size,-40,15, 0, 0, 0, passing_colours);
299
300 passing_colours [0] = cloud[c].colour [2];
301
302 create_cloud(CLOUD_MED_TRANS_CIRCLE,
303 cloud[c].x, cloud[c].y, 0, 0, 0, 0,
304 50 + grand(300),0,6, 0, 0, 0, passing_colours);
305 break;
306 case CLOUD_SPAWNER:
307 // the tickrate of a spawner must be a factor of the seed
308 if (cloud[c].timeout % cloud[c].seed == 0)
309 {
310 int cangle = grand(ANGLE_FULL);
311 int cx = cloud[c].x + xpart(cangle, grand(cloud[c].status * 100));
312 int cy = cloud[c].y + ypart(cangle, grand(cloud[c].status * 100));
313 shake_all_screens(grand(cloud[c].status) / 200);
314 place_explosion(
315 cx, cy,
316 0, 0, grand(cloud[c].status) + 250, cloud[c].colour);
317 // if (cloud[c].timeout % 48 == 0)
318 // play_sound_pos(WAV_MINEBANG, 200 + grand(200), 200, cx, cy);
319 if (cloud[c].timeout % 48 == 0)
320 play_wav_pos(NWAV_BANG, 400 + grand(200), 200, cx, cy);
321
322 }
323 break;
324 }
325
326 if (move_cloud(c, 1) == 0)
327 return;
328
329 drag_cloud(c, game.drag);
330
331 }
332
333
334 void destroy_cloud(int c)
335 {
336 cloud[c].type = CLOUD_NONE;
337 }
338
339
340 int move_cloud(int c, char limited)
341 {
342
343
344 if (cloud[c].x_speed == 0 && cloud[c].y_speed == 0) return 1;
345
346
347 cloud[c].x2 += cloud[c].x_speed;
348 cloud[c].y2 += cloud[c].y_speed;
349
350 cloud[c].x += cloud[c].x_speed;
351 cloud[c].y += cloud[c].y_speed;
352
353 return 1;
354
355 }
356
357
358
359
360 void drag_cloud(int i, float dragged)
361 {
362
363 cloud[i].x_speed *= 1 - dragged;
364 cloud[i].y_speed *= 1 - dragged;
365
366 }
367
368 void simple_cloud(int colour, int x, int y, int xs, int ys, int size)
369 {
370
371 int passing_colours [5];
372
373 passing_colours [0] = colour;
374
375 create_cloud(CLOUD_MED_CIRCLE,
376 x,
377 y,
378 0, 0,
379 xs,
380 ys,
381 size,-30,10, 0, 0, 0, passing_colours);
382
383
384 }
385
386 void simple_cloud_trans(int colour, int x, int y, int xs, int ys, int size)
387 {
388
389 int passing_colours [5];
390
391 passing_colours [0] = colour;
392
393 create_cloud(CLOUD_MED_TRANS_CIRCLE,
394 x,
395 y,
396 0, 0,
397 xs,
398 ys,
399 size,-30,10, 0, 0, 0, passing_colours);
400
401
402 }
403
404 void simple_light(int x, int y, int xs, int ys, int size)
405 {
406
407 int passing_colours [5];
408
409 create_cloud(CLOUD_LIGHT,
410 x,
411 y,
412 0, 0,
413 xs,
414 ys,
415 size,-30,10, 0, 0, 0, passing_colours);
416
417 }
418
419 void simple_shockwave(int colour, int x, int y, int xs, int ys, int size, int speed)
420 {
421
422 int passing_colours [5];
423
424 switch(colour)
425 {
426 default:
427 case TRANS_WHITE2:
428 passing_colours [3] = TRANS_WHITE2;
429 passing_colours [2] = TRANS_LGREY;
430 passing_colours [1] = TRANS_LGREY;
431 passing_colours [0] = TRANS_DGREY;
432 break;
433 case TRANS_YELLOW:
434 passing_colours [3] = TRANS_YELLOW;
435 passing_colours [2] = TRANS_ORANGE;
436 passing_colours [1] = TRANS_LRED;
437 passing_colours [0] = TRANS_DRED;
438 break;
439 case TRANS_PURPLE:
440 passing_colours [3] = TRANS_PURPLE;
441 passing_colours [2] = TRANS_LBLUE;
442 passing_colours [1] = TRANS_LBLUE;
443 passing_colours [0] = TRANS_DBLUE;
444 break;
445 case TRANS_LGREEN:
446 passing_colours [3] = TRANS_YELLOW;
447 passing_colours [2] = TRANS_LGREEN;
448 passing_colours [1] = TRANS_DGREEN;
449 passing_colours [0] = TRANS_DGREEN;
450 break;
451 }
452
453 create_cloud(CLOUD_SHOCKWAVE,
454 x,
455 y,
456 0, 0,
457 xs,
458 ys,
459 size,speed,0, 0, size + 20 + grand(50), 0, passing_colours);
460
461
462 }
463
464 void place_bang(int x, int y, int xs, int ys, int size, int btype)
465 {
466
467 int passing_colours [5];
468
469 create_cloud(CLOUD_BANG,
470 x,
471 y,
472 0, 0,
473 xs,
474 ys,
475 size,-20,3, 0, btype, 0, passing_colours);
476
477 }
478
479 void place_explosion(int x, int y, int xs, int ys, int size, int colours [5])
480 {
481
482 int passing_colours [5];
483
484
485 passing_colours [0] = colours [0];
486
487 create_cloud(CLOUD_MED_TRANS_CIRCLE,
488 x,
489 y,
490 0, 0,
491 xs,
492 ys,
493 size,-100,7, 0, 0, 0, passing_colours);
494
495 passing_colours [0] = colours [1];
496
497 create_cloud(CLOUD_MED_TRANS_CIRCLE,
498 x,
499 y,
500 0, 0,
501 xs,
502 ys,
503 size,-120,10, 0, 0, 0, passing_colours);
504
505 passing_colours [0] = colours [2];
506
507 create_cloud(CLOUD_MED_TRANS_CIRCLE,
508 x,
509 y,
510 0, 0,
511 xs,
512 ys,
513 size,-140,15, 0, 0, 0, passing_colours);
514
515 create_cloud(CLOUD_LIGHT,
516 x,
517 y,
518 0, 0,
519 xs,
520 ys,
521 size,-100,7, 0, 0, 0, passing_colours);
522
523
524 }
525
526
527 void place_explosion_no_light(int x, int y, int xs, int ys, int size, int colours [5])
528 {
529
530 int passing_colours [5];
531
532
533 passing_colours [0] = colours [0];
534
535 create_cloud(CLOUD_MED_TRANS_CIRCLE,
536 x,
537 y,
538 0, 0,
539 xs,
540 ys,
541 size,-100,7, 0, 0, 0, passing_colours);
542
543 passing_colours [0] = colours [1];
544
545 create_cloud(CLOUD_MED_TRANS_CIRCLE,
546 x,
547 y,
548 0, 0,
549 xs,
550 ys,
551 size,-120,10, 0, 0, 0, passing_colours);
552
553 passing_colours [0] = colours [2];
554
555 create_cloud(CLOUD_MED_TRANS_CIRCLE,
556 x,
557 y,
558 0, 0,
559 xs,
560 ys,
561 size,-140,15, 0, 0, 0, passing_colours);
562
563
564 }
565
566 void place_small_explosion(int x, int y, int xs, int ys, int size, int colours [5])
567 {
568
569 int passing_colours [5];
570
571
572 passing_colours [0] = colours [0];
573
574 create_cloud(CLOUD_MED_TRANS_CIRCLE,
575 x,
576 y,
577 0, 0,
578 xs,
579 ys,
580 size,-15,3, 0, 0, 0, passing_colours);
581
582 passing_colours [0] = colours [1];
583
584 create_cloud(CLOUD_MED_TRANS_CIRCLE,
585 x,
586 y,
587 0, 0,
588 xs,
589 ys,
590 size,-20,5, 0, 0, 0, passing_colours);
591
592 passing_colours [0] = colours [2];
593
594 create_cloud(CLOUD_MED_TRANS_CIRCLE,
595 x,
596 y,
597 0, 0,
598 xs,
599 ys,
600 size,-23,8, 0, 0, 0, passing_colours);
601
602 create_cloud(CLOUD_LIGHT,
603 x,
604 y,
605 0, 0,
606 xs,
607 ys,
608 size,-40,7, 0, 0, 0, passing_colours);
609
610
611 }
612
613
614
615 void place_explosion_with_smoke(int x, int y, int xs, int ys, int size, int colours [5])
616 {
617
618 int passing_colours [5];
619
620 passing_colours [0] = TRANS_LGREY;
621
622 /* create_cloud(CLOUD_MED_TRANS_CIRCLE,
623 x,
624 y,
625 0, 0,
626 xs,
627 ys,
628 size,-30,1, 0, 0, 0, passing_colours);*/
629
630 create_cloud(CLOUD_LIGHT,
631 x,
632 y,
633 0, 0,
634 xs,
635 ys,
636 size,-100,7, 0, 0, 0, passing_colours);
637
638
639 passing_colours [0] = colours [0];
640
641 create_cloud(CLOUD_MED_TRANS_CIRCLE,
642 x,
643 y,
644 0, 0,
645 xs,
646 ys,
647 size,-100,7, 0, 0, 0, passing_colours);
648
649 passing_colours [0] = colours [1];
650
651 create_cloud(CLOUD_MED_TRANS_CIRCLE,
652 x,
653 y,
654 0, 0,
655 xs,
656 ys,
657 size,-105,10, 0, 0, 0, passing_colours);
658
659 passing_colours [0] = colours [2];
660
661 create_cloud(CLOUD_MED_TRANS_CIRCLE,
662 x,
663 y,
664 0, 0,
665 xs,
666 ys,
667 size,-110,15, 0, 0, 0, passing_colours);
668
669 }
670
671 void place_rocket_trail(int x, int y, int xs, int ys, int size, int colours [5])
672 {
673
674 int passing_colours [5];
675
676
677 passing_colours [0] = colours [0];
678
679 create_cloud(CLOUD_MED_TRANS_CIRCLE,
680 x,
681 y,
682 0, 0,
683 xs,
684 ys,
685 size,-10,2, 0, 0, 0, passing_colours);
686
687 passing_colours [0] = colours [1];
688
689 create_cloud(CLOUD_MED_TRANS_CIRCLE,
690 x,
691 y,
692 0, 0,
693 xs,
694 ys,
695 size,-15,4, 0, 0, 0, passing_colours);
696
697 passing_colours [0] = colours [2];
698
699 create_cloud(CLOUD_MED_TRANS_CIRCLE,
700 x,
701 y,
702 0, 0,
703 xs,
704 ys,
705 size,-20,15, 0, 0, 0, passing_colours);
706
707 }
708
709
710 void place_speck_burst(int x, int y, int xs, int ys, int specks, int min_timeout, int random_timeout, int scatter, int colours [5])
711 {
712
713 int i;
714
715 for (i = 0; i < specks; i ++)
716 {
717 create_cloud(CLOUD_SPECK,
718 x,
719 y,
720 0, 0,
721 xs + grand(scatter * 2 + 1) - scatter,
722 ys + grand(scatter * 2 + 1) - scatter,
723 min_timeout + grand(random_timeout), 1,0,0, 0, 0, colours);
724 }
725
726 }
727
728 void place_line_burst(int x, int y, int xs, int ys, int specks, int min_timeout, int random_timeout, int burst, int random_burst, int colours [5])
729 {
730
731 int i, angle, xsp, ysp, burst_speed;
732
733 for (i = 0; i < specks; i ++)
734 {
735 angle = grand(ANGLE_FULL);
736 burst_speed = burst + grand(burst);
737 xsp = xs + xpart(angle, burst_speed);
738 ysp = ys + ypart(angle, burst_speed);
739 x += xsp;
740 y += ysp;
741 create_cloud(CLOUD_SHRINKING_LINE,
742 x,
743 y,
744 0, 0,
745 xsp,
746 ysp,
747 (min_timeout + grand(random_timeout)) * 10, 10 + grand(6),0,angle, 0, 0, colours);
748 }
749
750 }
751
752
753 void place_burstlet_burst(int x, int y, int xs, int ys, int burstlets, int min_timeout, int random_timeout, int burst, int random_burst, int pretravel, int colours [5])
754 {
755
756 int i, xs2, ys2, x2, y2;
757
758 for (i = 0; i < burstlets; i ++)
759 {
760 xs2 = burst + grand(random_burst);
761 ys2 = burst + grand(random_burst);
762 if (grand(2) == 0)
763 xs2 *= -1;
764 if (grand(2) == 0)
765 ys2 *= -1;
766 xs2 += xs;
767 ys2 += ys;
768 x2 = x + xs2 * pretravel; // or it will just be masked by the main
769 y2 = y + ys2 * pretravel; // explosion
770
771 create_cloud(CLOUD_BURSTLET,
772 x2, y2, 0,0, xs2, ys2,
773 min_timeout + random_timeout,1,0, 0, 0, 0, colours);
774 }
775
776
777 }
778
779 // called at start of each level and once per tick
780 void init_effects(void)
781 {
782 int i;
783
784 for (i = 0; i < MAX_EFFECTS; i ++)
785 {
786 effect[i].type = EFFECT_NONE;
787 }
788
789 }
790
791
792 int create_effect(int type, int x, int y, int x1, int y1, int x2, int y2, int att1, int att2, int att3, int att4, int att5)
793 {
794
795 int i;
796
797 for (i = 0; i < MAX_EFFECTS + 1; i ++)
798 {
799 if (i >= MAX_EFFECTS)
800 return 0;
801 if (effect[i].type == EFFECT_NONE)
802 break;
803 }
804
805 effect[i].type = type;
806 effect[i].x = x;
807 effect[i].y = y;
808 effect[i].x1 = x1;
809 effect[i].y1 = y1;
810 effect[i].x2 = x2;
811 effect[i].y2 = y2;
812 effect[i].things [0] = att1;
813 effect[i].things [1] = att2;
814 effect[i].things [2] = att3;
815 effect[i].things [3] = att4;
816 effect[i].things [4] = att5;
817 return 1;
818 }
819
820
821
822
823
0 void init_clouds(void);
1 void init_effects(void);
2
3 int create_cloud(int type, int x, int y, int x2, int y2,
4 int x_speed, int y_speed, int timer,
5 int tickrate, int delta_tickrate, int angle,
6 int status, unsigned char seed, int colour [5]);
7
8 void simple_cloud(int colour, int x, int y, int xs, int ys, int size);
9 void simple_cloud_trans(int colour, int x, int y, int xs, int ys, int size);
10 void simple_light(int x, int y, int xs, int ys, int size);
11 void simple_shockwave(int colour, int x, int y, int xs, int ys, int size, int speed);
12 void place_explosion(int x, int y, int xs, int ys, int size, int colours [5]);
13 void place_rocket_trail(int x, int y, int xs, int ys, int size, int colours [5]);
14 void place_explosion_with_smoke(int x, int y, int xs, int ys, int size, int colours [5]);
15 void place_explosion_no_light(int x, int y, int xs, int ys, int size, int colours [5]);
16 void place_small_explosion(int x, int y, int xs, int ys, int size, int colours [5]);
17 void place_speck_burst(int x, int y, int xs, int ys, int specks, int min_timeout, int random_timeout, int scatter, int colours [5]);
18 void place_line_burst(int x, int y, int xs, int ys, int specks, int min_timeout, int random_timeout, int burst, int random_burst, int colours [5]);
19 void place_burstlet_burst(int x, int y, int xs, int ys, int burstlets, int min_timeout, int random_timeout, int burst, int random_burst, int pretravel, int colours [5]);
20 void place_bang(int x, int y, int xs, int ys, int size, int btype);
21
22 void run_clouds(void);
23
24 int create_effect(int type, int x, int y, int x1, int y1, int x2, int y2, int att1, int att2, int att3, int att4, int att5);
25
+3158
-0
cmds.c less more
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: cmds.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - implementation of keyboard commands.
30 There's no reason for this stuff to be separate from input.c except that
31 I copied large parts of it from Captain Pork's World of Violence, which
32 needed a far more complex system because of its AI players. And I never
33 got around to changing it.
34
35 */
36
37
38 #include "allegro.h"
39
40 #include <math.h>
41
42 #include "config.h"
43
44 #include "globvars.h"
45
46 #include "stuff.h"
47 #include "bullet.h"
48 #include "cloud.h"
49 #include "actor.h"
50 #include "display.h"
51 #include "sound.h"
52 #include "light.h"
53
54 #include "palette.h"
55
56 enum
57 {
58 FIRE_BOTH,
59 FIRE_CANNON_ONLY,
60 FIRE_MISSILE_ONLY
61 };
62
63 enum
64 {
65 ASOUND_CANNON,
66 ASOUND_BOMBS,
67 ASOUND_BLAT,
68 ASOUND_TUBE
69 };
70
71 #define BOMB_ANGLE_1 128
72 #define BOMB_ANGLE_2 256
73
74 #define BURST_RECYCLE_DELAY 7
75 #define BURST_RECYCLE_DELAY_CLAWS 2
76 #define BURST_RECYCLE_DELAY_WORMS 4
77
78
79 enum
80 {
81 PATTERN_TWO_PLUS_OTHERS, // two main secondaries plus other small ones
82 PATTERN_ONE_PLUS_OTHERS, // one main secondary plus other small ones
83 PATTERN_ALL_SAME, // all secondaries the same
84 PATTERN_SIDEWARDS // fire out to sides
85 };
86
87
88 /*
89 WEAPON_WOODEN_DARTS,
90 WEAPON_ICE_DARTS,
91 WEAPON_SILVER_TEETH,
92 WEAPON_SNOW_DARTS,
93 WEAPON_FROZEN_BREATH,
94 WEAPON_BRONZE_DARTS,
95 WEAPON_BRASS_TEETH,
96 WEAPON_CRYSTAL_TEETH,
97 WEAPON_GOLDEN_NEEDLES,
98 WEAPON_PARTICLE_SPITTER,
99 WEAPON_CRYSTAL_SPINES,
100 WEAPON_GOLDEN_TEETH,
101 WEAPON_NUMEROUS_DARTS,
102 WEAPON_NUMEROUS_BLADES,
103 WEAPON_FAR_SPITTER,
104 WEAPON_BURNING_SPIRIT
105 */
106 int recycle_rates [6] =
107 {
108 /*21, downgraded 27/10/04
109 17,
110 14,
111 12,
112 10,
113 9*/
114 21,
115 18,
116 15,
117 13,
118 12,
119 11
120 /*, // Darts
121 {
122 32,
123 26,
124 21,
125 18,
126 16,
127 14
128 }, // Burst
129 {
130 10,
131 9,
132 8,
133 7,
134 6,
135 5
136 }, // Spines
137 {
138 32,
139 26,
140 21,
141 18,
142 16,
143 15
144 } // Teeth
145 */
146 };
147
148 /*int recycle_rates [16] [6] =
149 {
150 {
151 21,
152 15,
153 13,
154 11,
155 10,
156 9
157 }, // Wooden darts
158 {
159 42,
160 36,
161 31,
162 27,
163 24,
164 21
165 }, // Ice darts
166 {
167 42,
168 36,
169 31,
170 27,
171 24,
172 21
173 //31,
174 //27,
175 //24,
176 //21,
177 //18,
178 //16
179 //24,
180 //21,
181 //18,
182 //16,
183 //14,
184 //13
185 //18,
186 //16,
187 //14,
188 //13,
189 //12,
190 //11
191 }, // Silver teeth
192 {
193 31,
194 27,
195 24,
196 21,
197 18,
198 16
199 }, // Snow darts
200 {
201 42,
202 36,
203 31,
204 27,
205 24,
206 21
207 }, // Frozen Breath
208 {
209 18,
210 15,
211 13,
212 11,
213 10,
214 9
215 }, // Brass Teeth
216 {
217 42,
218 36,
219 31,
220 27,
221 24,
222 21
223 }, // Shock Path
224 {
225 42,
226 36,
227 31,
228 27,
229 24,
230 21
231 }, // Crystal Teeth
232 {
233 18,
234 13,
235 11,
236 9,
237 8,
238 7
239 }, // Golden Needle
240 {
241 13,
242 11,
243 10,
244 8,
245 7,
246 6
247 }, // Particle Spitter
248 {
249 31,
250 27,
251 24,
252 21,
253 18,
254 16
255 }, // Crystal Spines
256 {
257 18,
258 18,
259 16,
260 14,
261 13,
262 12
263 }, // Golden Path
264 {
265 42,
266 36,
267 31,
268 27,
269 24,
270 21
271 }, // Numerous Darts
272 {
273 18,
274 18,
275 16,
276 14,
277 13,
278 12
279 }, // Numerous Blades
280 {
281 13,
282 17,
283 14,
284 12,
285 10,
286 9
287 }, // Far Spitter
288 {
289 18,
290 18,
291 16,
292 14,
293 13,
294 12
295 } // Burning Spirit
296
297 };
298 */
299
300 void actor_thrust(int thractor, int angled);
301 void actor_slide(int thractor, int direction);
302 void actor_turn(int thractor, int direction);
303 void actor_brake(int thractor);
304 void actor_shoot(int sactor, int which_weapon);
305 void make_bcolours(int colours [4], int base_colour);
306 void fire_cannon(int sactor);
307 void fire_secondary(int sactor);
308 void cannon_shot(int sactor, int btype, int damage, int timer, int mass,
309 int angle, int status, int size, int speed, int colours [4], int displaced,
310 int scatter, int speed_div);
311 void fire_missile(int sactor);
312 void secondary_shot(int sactor, int btype, int damage, int timer, int mass,
313 int angle, int status, int size, int speed, int colours [4], int displaced,
314 int scatter, int speed_div, int special1, int special2, int special3, int special4, int special5,
315 int flash_circle);
316 void missile_shot(int sactor, int btype, int damage, int timer, int mass,
317 int angle, int status, int seed, int speed, int colours [4], int displaced,
318 int special5);
319 void fire_bomb(int sactor);
320 void bomb_shot(int sactor, int btype, int damage, int timer, int mass,
321 int angle, int status, int seed, int speed, int colours [4], int displaced);
322 void change_angle_arc(int angles [14], int width);
323 void change_displacement(int displace [7], int type);
324
325 void exhaust_colours(int level, int passing_colours [5]);
326
327 void fire_turret(int sactor);
328 void fire_heavy_cannon(int sactor);
329 void fire_backfire(int sactor);
330 void fire_sidekicks(int a);
331
332 void actor_drive(int a, int level, int distance_x, int distance_y, int angle, int thrust, int doubled);
333
334 void actor_sound(int a, int sound);
335 void make_drive_sound(int a, int drive);
336
337 void enact_commands(void)
338 {
339 int i,j;
340
341 for (i = 0; i < NO_ACTORS; i ++)
342 {
343 if (actor[i].in_play == 0)
344 continue;
345 actor[i].engine_demand = 1;
346 actor[i].dragging = 0;
347
348 if (actor[i].actor_cmd [CMD_THRUST] == 1)
349 actor[i].engine_demand ++;
350 if (actor[i].actor_cmd [CMD_BRAKE] == 1 && actor[i].upgraded_system [UPG_RETRO] > 0)
351 actor[i].engine_demand ++;
352 if (actor[i].upgraded_system [UPG_SLIDE] > 0)
353 {
354 if (actor[i].actor_cmd [CMD_LEFT1] == 1)
355 actor[i].engine_demand ++;
356 if (actor[i].actor_cmd [CMD_RIGHT1] == 1)
357 actor[i].engine_demand ++;
358 }
359 // this makes sure available engine capacity is split between all active thrusters
360
361 for (j = NO_CMDS - 1; j >= 0; j --) // reverse order to prevent drive + drag on at same time
362 {
363 if (actor[i].actor_cmd [j] == 1)
364 {
365 switch(j)
366 {
367 case CMD_THRUST:
368 actor_thrust(i, 0);
369 break;
370 case CMD_LEFT:
371 actor_turn(i, -1);
372 break;
373 case CMD_RIGHT:
374 actor_turn(i, 1);
375 break;
376 case CMD_LEFT1:
377 actor_slide(i, -1);
378 break;
379 case CMD_RIGHT1:
380 actor_slide(i, 1);
381 break;
382 case CMD_BRAKE:
383 actor_brake(i);
384 break;
385 case CMD_FIRE1:
386 if (player[actor[i].controller].link_fire == 0)
387 actor_shoot(i, FIRE_CANNON_ONLY);
388 else
389 actor_shoot(i, FIRE_BOTH);
390 break;
391 case CMD_FIRE2:
392 actor_shoot(i, FIRE_MISSILE_ONLY);
393 break;
394 // case CMD_UPGRADE:
395 // actor_upgrade(i);
396 // break;
397 }
398
399 /*
400 enum
401 {
402 CMD_THRUST,
403 CMD_LEFT,
404 CMD_RIGHT,
405 CMD_SYSTEM1,
406 CMD_SYSTEM2,
407 CMD_SYSTEM3,
408 CMD_BRAKE,
409 CMD_LEFT1,
410 CMD_RIGHT1,
411 CMD_LEFT2,
412 CMD_RIGHT2,
413 CMD_CHARGE_SHIELD
414 };
415 */
416
417 }
418 actor[i].actor_cmd [j] = 0;
419 }
420 }
421
422 }
423
424 void actor_slide(int thractor, int direction)
425 {
426 // if (actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_CROSS] == 0)
427 // return;
428 // int x_accel = cos(angle_to_radians(actor[thractor].angle) + (PI / 2) * direction) * actor[thractor].slide;
429 // int y_accel = sin(angle_to_radians(actor[thractor].angle) + (PI / 2) * direction) * actor[thractor].slide;
430 /* int x_accel = cos(angle_to_radians(actor[thractor].angle) + PI / 4 + (PI / 2) * direction) * actor[thractor].slide;
431 int y_accel = sin(angle_to_radians(actor[thractor].angle) + PI / 4 + (PI / 2) * direction) * actor[thractor].slide;
432 actor[thractor].x_speed += x_accel;
433 actor[thractor].y_speed += y_accel;
434
435 int passing_colours [5];
436
437 exhaust_colours(actor[thractor].upgraded_system [UPG_SLIDE - 1], passing_colours);
438
439 create_cloud(CLOUD_SPECK,
440 actor[thractor].x,// - (actor[thractor].x_speed - x_accel * 10),
441 actor[thractor].y,// - (actor[thractor].y_speed - y_accel * 10),
442 0, 0,
443 actor[thractor].x_speed - x_accel * 20 + (100 - grand(201)),
444 actor[thractor].y_speed - y_accel * 20 + (100 - grand(201)),
445 10 + grand(11),1,0, 0, 0, 0, passing_colours);
446
447 */
448 // int passing_colours [5];
449 // int thrust_amount = 72;
450 // thrust_amount += actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_CROSS] * 13;
451 // thrust_amount /= actor[thractor].engine_demand;
452
453 // actor_drive(thractor, actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_CROSS] - 1, actor[thractor].slide_distance_x, actor[thractor].slide_distance_y, actor[thractor].angle + ANGLE_QUARTER + ANGLE_QUARTER * direction, thrust_amount, 0);
454 // actor_sound(thractor, 2);
455 // make_drive_sound(thractor, DRIVE_SLIDE);
456
457 /*
458 float xcos = cos(angle_to_radians(actor[thractor].angle) + (PI / 2) + (PI/2) * direction);
459 float ysin = sin(angle_to_radians(actor[thractor].angle) + (PI / 2) + (PI/2) * direction);
460 int x_accel = xcos * thrust_amount / actor[thractor].engine_demand;
461 int y_accel = ysin * thrust_amount / actor[thractor].engine_demand;
462 actor[thractor].x_speed -= x_accel;
463 actor[thractor].y_speed -= y_accel;
464
465 exhaust_colours(actor[thractor].upgraded_system [UPG_SLIDE] - 1, passing_colours);
466
467 create_cloud(CLOUD_SPECK,
468 actor[thractor].x + xcos * 5 * GRAIN,// - (actor[thractor].x_speed - x_accel * 10),
469 actor[thractor].y + ysin * 3 * GRAIN,// - (actor[thractor].y_speed - y_accel * 10),
470 0, 0,
471 // actor[thractor].x_speed - x_accel * 20 + (100 - grand(201)),
472 // actor[thractor].y_speed - y_accel * 20 + (100 - grand(201)),
473 actor[thractor].x_speed + x_accel * 20 + (300 - grand(601)),
474 actor[thractor].y_speed + y_accel * 20 + (300 - grand(601)),
475 10 + grand(11),1,0, 0, 0, 0, passing_colours);
476 */
477
478 }
479
480 void actor_brake(int thractor)
481 {
482 // int passing_colours [5];
483
484 if (actor[thractor].ship == SHIP_RETRO)
485 {
486 // int passing_colours [5];
487 /* int thrust_amount = 72;
488 thrust_amount += actor[thractor].upgraded_system [UPG_RETRO] * 13;
489 thrust_amount /= actor[thractor].engine_demand;
490 // level 1 retro gives same thrust as level 0 speed; l2->1, etc
491
492 actor_drive(thractor, actor[thractor].upgraded_system [UPG_RETRO] - 1, actor[thractor].retro_distance_x, actor[thractor].retro_distance_y, actor[thractor].angle - ANGLE_QUARTER, thrust_amount, 0);
493
494 make_drive_sound(thractor, DRIVE_RETRO);
495 return;*/
496 actor_thrust(thractor, ANGLE_HALF);
497 return;
498 }
499 // else must be drag field...
500 actor[thractor].dragging = 20;
501
502 }
503
504
505 void actor_thrust(int thractor, int angled)
506 {
507 int thrust_amount = 170;
508
509 thrust_amount += actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 4 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 4
510 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 7
511 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 2;
512
513 if (actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] == 0)
514 thrust_amount += 20;
515
516 if (actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] == 1)
517 thrust_amount -= 2;
518
519 /* thrust_amount += actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 5 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 5
520 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 9
521 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 2;
522 */
523 thrust_amount /= 2; // actor[thractor].engine_demand;
524
525 if (angled == 0)
526 actor_drive(thractor, actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE], actor[thractor].exhaust_distance_x, actor[thractor].exhaust_distance_y, actor[thractor].angle + ANGLE_QUARTER + angled, thrust_amount, angled);
527 else
528 actor_drive(thractor, actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE], actor[thractor].exhaust_distance_x + 2, actor[thractor].exhaust_distance_y + 2, actor[thractor].angle + ANGLE_QUARTER + angled, thrust_amount, angled);
529
530 actor[thractor].dragging = actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 2; // 2
531 make_drive_sound(thractor, DRIVE_THRUST);
532 }
533
534 /*
535 void actor_thrust(int thractor, int angled)
536 {
537 int thrust_amount = 170; // 120
538 thrust_amount += actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 16 // 22
539 + actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 9; // 10 // 8
540
541 thrust_amount /= 2; // actor[thractor].engine_demand;
542
543 if (angled == 0)
544 actor_drive(thractor, actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE], actor[thractor].exhaust_distance_x, actor[thractor].exhaust_distance_y, actor[thractor].angle + ANGLE_QUARTER + angled, thrust_amount, angled);
545 else
546 actor_drive(thractor, actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE], actor[thractor].exhaust_distance_x + 2, actor[thractor].exhaust_distance_y + 2, actor[thractor].angle + ANGLE_QUARTER + angled, thrust_amount, angled);
547
548 actor[thractor].dragging = actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 2;
549 make_drive_sound(thractor, DRIVE_THRUST);
550 }
551 */
552
553 // need to already have factored engine demand into thrust
554 void actor_drive(int a, int level, int distance_x, int distance_y, int angle, int thrust, int doubled)
555 {
556 // int passing_colours [5] = {TRANS_YELLOW,TRANS_ORANGE,TRANS_LRED,TRANS_DRED, TRANS_DGREY};
557 int passing_colours [5] = {TRANS_ORANGE,TRANS_LRED,TRANS_LRED,TRANS_DRED, TRANS_DGREY};
558 int passing_colours2 [5] = {TRANS_YELLOW,TRANS_YELLOW,TRANS_YELLOW,TRANS_YELLOW, TRANS_YELLOW};
559
560 if (actor[a].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] > 1)
561 passing_colours [1] = TRANS_ORANGE;
562 if (actor[a].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] > 3)
563 passing_colours2 [0] = TRANS_WHITE;
564
565 int base_size = 23 + actor[a].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 2;
566 int x_accel = xpart(angle, thrust);
567 int y_accel = ypart(angle, thrust);
568 int exhx, exhy;
569 actor[a].x_speed -= x_accel;
570 actor[a].y_speed -= y_accel;
571
572 // float xcos2, ysin2;
573 int displace = 0;
574
575 int i, j, k = 1, xs, ys, shrink = 2;
576
577 actor[a].thrust = 7;
578
579 if (doubled == 0)
580 {
581 switch(actor[a].ship)
582 {
583 case SHIP_ROUND:
584 displace = ANGLE_1_SIXTEENTH;
585 k = 2;
586 shrink = 1;
587 actor[a].thrust = 3;
588 base_size = 15 + actor[a].ability [ABILITY_DRIVE] [SYMBOL_SQUARE];
589 break;
590 case SHIP_RETRO:
591 displace = ANGLE_1_32 + 8;
592 k = 2;
593 shrink = 1;
594 actor[a].thrust = 3;
595 base_size = 15 + actor[a].ability [ABILITY_DRIVE] [SYMBOL_SQUARE];
596 break;
597 }
598 }
599
600
601 for (j = 0; j < k; j ++)
602 {
603 if (displace == 0)
604 {
605 exhx = actor[a].x + xpart(angle, distance_x * GRAIN) - 1000;
606 exhy = actor[a].y + ypart(angle, distance_y * GRAIN) - 1000;
607 }
608 else
609 {
610 if (j == 0)
611 {
612 exhx = actor[a].x + xpart(angle + ANGLE_1_EIGHTH - displace, distance_x * GRAIN) - 1000;
613 exhy = actor[a].y + ypart(angle + ANGLE_1_EIGHTH - displace, distance_y * GRAIN) - 1000;
614 }
615 else
616 {
617 exhx = actor[a].x + xpart(angle - ANGLE_1_EIGHTH + displace, distance_x * GRAIN) - 1000;
618 exhy = actor[a].y + ypart(angle - ANGLE_1_EIGHTH + displace, distance_y * GRAIN) - 1000;
619 }
620 }
621 add_light(LIGHT_NORMAL, 10 + grand(5), exhx + actor[a].x_speed, exhy + actor[a].y_speed);
622
623 for (i = 0; i < 2; i ++)
624 {
625 xs = x_accel * (15 + grand(5)) + (600 - grand(1201));
626 ys = y_accel * (15 + grand(5)) + (600 - grand(1201));
627 create_cloud(CLOUD_DRIVE_CIRCLE,
628 exhx + grand(3001) - 1500 - xs,
629 exhy + grand(3001) - 1500 - ys,
630 0, 0,
631 xs + actor[a].x_speed, ys + actor[a].y_speed,
632 base_size + grand(11),shrink + 2,1, 0, 0, 0, passing_colours2);
633 create_cloud(CLOUD_DRIVE_CIRCLE, //TRANS_FADING_CIRCLE,
634 exhx + grand(3001) - 1500 - xs,
635 exhy + grand(3001) - 1500 - ys,
636 0, 0,
637 xs + actor[a].x_speed, ys + actor[a].y_speed,
638 base_size + grand(11),shrink,0, 0, 0, 0, passing_colours);
639 }
640 }
641
642 }
643 /*
644 void exhaust_colours(int level, int passing_colours [5])
645 {
646 switch(level)
647 {
648 default:
649 case 0:
650 passing_colours [0] = COLOUR_YELLOW8;
651 passing_colours [1] = COLOUR_RED8;
652 passing_colours [2] = COLOUR_RED6;
653 passing_colours [3] = COLOUR_RED4;
654 passing_colours [4] = COLOUR_RED3;
655 break;
656 case 1:
657 passing_colours [0] = COLOUR_YELLOW8;
658 passing_colours [1] = COLOUR_ORANGE8;
659 passing_colours [2] = COLOUR_ORANGE6;
660 passing_colours [3] = COLOUR_ORANGE4;
661 passing_colours [4] = COLOUR_ORANGE3;
662 break;
663 case 2:
664 passing_colours [0] = COLOUR_YELLOW8;
665 passing_colours [1] = COLOUR_YELLOW6;
666 passing_colours [2] = COLOUR_YELLOW4;
667 passing_colours [3] = COLOUR_YELLOW3;
668 passing_colours [4] = COLOUR_YELLOW2;
669 break;
670 case 3:
671 passing_colours [0] = COLOUR_YELLOW8;
672 passing_colours [1] = COLOUR_GREEN8;
673 passing_colours [2] = COLOUR_GREEN6;
674 passing_colours [3] = COLOUR_GREEN4;
675 passing_colours [4] = COLOUR_GREEN2;
676 break;
677 case 4:
678 passing_colours [0] = COLOUR_BLUE8;
679 passing_colours [1] = COLOUR_BLUE6;
680 passing_colours [2] = COLOUR_BLUE4;
681 passing_colours [3] = COLOUR_BLUE3;
682 passing_colours [4] = COLOUR_BLUE2;
683 break;
684 case 5:
685 passing_colours [0] = COLOUR_WHITE;
686 passing_colours [1] = COLOUR_BLUE8;
687 passing_colours [2] = COLOUR_BLUE6;
688 passing_colours [3] = COLOUR_BLUE4;
689 passing_colours [4] = COLOUR_BLUE3;
690 break;
691 }
692
693 }
694
695 */
696 void actor_turn(int thractor, int direction)
697 {
698 int turned = 100; // 85
699 turned += actor[thractor].ability [ABILITY_DRIVE] [SYMBOL_CIRCLE] * 15; // 12
700
701 int target_angle = turned * direction;
702
703 /* if (actor[thractor].base_angle + target_angle < 0)
704 actor[thractor].base_angle += 10240;
705 else
706 {
707 if (actor[thractor].base_angle + target_angle > 10240)
708 actor[thractor].base_angle -= 10240;
709 }*/
710
711 actor[thractor].base_angle += target_angle;
712
713 if (actor[thractor].base_angle < 0)
714 actor[thractor].base_angle += 10240;
715 else
716 {
717 if (actor[thractor].base_angle > 10240)
718 actor[thractor].base_angle -= 10240;
719 }
720
721 actor[thractor].angle = (actor[thractor].base_angle / 10) % 1024;
722 }
723
724
725 void actor_shoot(int sactor, int which_weapon)
726 {
727
728 int recycled = 15;
729
730 if (actor[sactor].recycle1 == 0 && (which_weapon == FIRE_BOTH || which_weapon == FIRE_CANNON_ONLY))
731 {
732 fire_cannon(sactor);
733 }
734
735 if (actor[sactor].secondary != SECOND_NONE && actor[sactor].recycle2 == 0 && (which_weapon == FIRE_BOTH || which_weapon == FIRE_MISSILE_ONLY))
736 {
737 fire_secondary(sactor);
738
739 recycled = 140; // 66
740
741 if (actor[sactor].ship == SHIP_HORSESHOE)
742 recycled = 90; // 40
743
744 actor[sactor].recycle2 += recycled;
745 }
746 /*
747 if (which_weapon == FIRE_BOTH || which_weapon == FIRE_CANNON_ONLY)
748 {
749 if (actor[sactor].upgraded_system [UPG_TURRET] > 0
750 && actor[sactor].turret_recycle == 0)
751 {
752 fire_turret(sactor);
753
754 recycled = 12;
755 if (actor[sactor].upgraded_system [UPG_TURRET] == 2)
756 recycled = 11;
757 if (actor[sactor].upgraded_system [UPG_TURRET] == 3)
758 recycled = 10;
759 if (actor[sactor].upgraded_system [UPG_TURRET] == 4)
760 recycled = 9;
761 if (actor[sactor].upgraded_system [UPG_TURRET] == 5)
762 recycled = 8;
763
764 actor[sactor].turret_recycle += recycled;
765
766 }
767
768 if (actor[sactor].upgraded_system [UPG_HEAVY] > 0
769 && actor[sactor].heavy_recycle == 0)
770 {
771 fire_heavy_cannon(sactor);
772
773 recycled = 25;
774 if (actor[sactor].upgraded_system [UPG_HEAVY] == 2)
775 recycled = 20;
776 if (actor[sactor].upgraded_system [UPG_HEAVY] == 3)
777 recycled = 17;
778 if (actor[sactor].upgraded_system [UPG_HEAVY] == 4)
779 recycled = 14;
780 if (actor[sactor].upgraded_system [UPG_HEAVY] == 5)
781 recycled = 12;
782
783 actor[sactor].heavy_recycle += recycled;
784
785 }
786
787 if (actor[sactor].upgraded_system [UPG_BACKFIRE] > 0
788 && actor[sactor].backfire_recycle == 0)
789 {
790 fire_backfire(sactor);
791
792 recycled = 11;
793 if (actor[sactor].upgraded_system [UPG_BACKFIRE] == 2)
794 recycled = 10;
795 if (actor[sactor].upgraded_system [UPG_BACKFIRE] == 3)
796 recycled = 9;
797 if (actor[sactor].upgraded_system [UPG_BACKFIRE] == 4)
798 recycled = 8;
799 if (actor[sactor].upgraded_system [UPG_BACKFIRE] == 5)
800 recycled = 7;
801
802 actor[sactor].backfire_recycle += recycled;
803
804 }
805
806 if (actor[sactor].upgraded_system [UPG_SIDEKICK] > 0
807 && actor[sactor].sidekick_recycle == 0)
808 {
809 fire_sidekicks(sactor);
810
811 recycled = 14;
812 if (actor[sactor].upgraded_system [UPG_SIDEKICK] == 2)
813 recycled = 13;
814 if (actor[sactor].upgraded_system [UPG_SIDEKICK] == 3)
815 recycled = 12;
816 if (actor[sactor].upgraded_system [UPG_SIDEKICK] == 4)
817 recycled = 11;
818 if (actor[sactor].upgraded_system [UPG_SIDEKICK] == 5)
819 recycled = 10;
820
821 actor[sactor].sidekick_recycle += recycled;
822
823 }
824
825 }
826 */
827 }
828
829 void continue_secondary_burst(int a)
830 {
831
832 if (actor[a].secondary_burst_recycle == 0)
833 {
834 fire_secondary(a);
835 actor[a].secondary_burst --;
836 if (actor[a].secondary_burst == 1)
837 {
838 actor[a].secondary_burst = 0;
839 return;
840 }
841 actor[a].secondary_burst_recycle = BURST_RECYCLE_DELAY;
842 if (actor[a].secondary == SECOND_CLAWS)
843 actor[a].secondary_burst_recycle = BURST_RECYCLE_DELAY_CLAWS;
844 if (actor[a].secondary == SECOND_WORMS_AGONY)
845 actor[a].secondary_burst_recycle = BURST_RECYCLE_DELAY_WORMS;
846 }
847 else
848 actor[a].secondary_burst_recycle --;
849
850 }
851
852 void make_bcolours(int colours [4], int base_colour)
853 {
854 switch(base_colour)
855 {
856 default:
857 colours [0] = base_colour;
858 colours [1] = base_colour - 1; // 2
859 colours [2] = base_colour - 3; // 4
860 colours [3] = base_colour - 5; // 5
861 break;
862 case TRANS_LBLUE:
863 colours [0] = COLOUR_BLUE5;
864 colours [1] = COLOUR_BLUE6;
865 colours [2] = COLOUR_BLUE7;
866 colours [3] = COLOUR_WHITE;
867 break;
868 case TRANS_DBLUE:
869 colours [0] = COLOUR_BLUE4;
870 colours [1] = COLOUR_BLUE5;
871 colours [2] = COLOUR_BLUE6;
872 colours [3] = COLOUR_BLUE7;
873 break;
874 case TRANS_YELLOW:
875 colours [0] = COLOUR_YELLOW3;
876 colours [1] = COLOUR_YELLOW5;
877 colours [2] = COLOUR_YELLOW7;
878 colours [3] = COLOUR_WHITE;
879 break;
880 case TRANS_ORANGE:
881 colours [0] = COLOUR_YELLOW2;
882 colours [1] = COLOUR_YELLOW3;
883 colours [2] = COLOUR_YELLOW5;
884 colours [3] = COLOUR_YELLOW7;
885 break;
886 }
887
888 }
889
890 void fire_cannon(int sactor)
891 {
892
893 // int colours [4];
894 int bcolours1 [4] = {COLOUR_WHITE, COLOUR_WHITE, COLOUR_WHITE, COLOUR_WHITE};
895 int bcolours2 [4] = {COLOUR_WHITE, COLOUR_WHITE, COLOUR_WHITE, COLOUR_WHITE};
896 int btype [2] = {BULLET_ZAP, BULLET_ZAP};
897 int damage [2] = {0, 0};
898 int timer [2] = {8, 8}; //= 20 - actor[sactor].upgraded_system [UPG_PROJECT] * 2;
899 int mass [2] = {10, 10};
900 // int status = 0;
901 int speed [2] = {10000, 10000};//= 16000;
902 int rand_speed [2] = {0, 0};
903 int speed_div [2] = {5, 5};
904 int angles [7] = {0, 0, ANGLE_1_SIXTEENTH, -ANGLE_1_SIXTEENTH, ANGLE_1_EIGHTH, -ANGLE_1_EIGHTH, 0};
905 // int angles [7] = {0, 0, ANGLE_1_SIXTEENTH, -ANGLE_1_SIXTEENTH, ANGLE_1_EIGHTH, -ANGLE_1_EIGHTH, ANGLE_HALF};
906 // int angles [7] = {0, 0, 0, 0, 0, 0, ANGLE_HALF};
907 int rand_angle = 0;
908 // unsigned char seed = counter;
909 // int displace [7] = {-4, 4, 1, -1, 7, -7, 0};
910 int displace [7] = {-4, 4, 2, -2, 6, -6, 0};
911 // int displaced = 0;
912 int number = 0;
913 int rand_timer [2] = {0, 0};
914 int scatter [2] = {0, 0};
915 int size = 0;
916
917 // actor[sactor].recycle1 = recycle_rates [actor[sactor].primary] [actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE]];
918 // actor[sactor].recycle1 = recycle_rates [actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE]];
919 switch(actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE])
920 {
921 default:
922 case 0: actor[sactor].recycle1 = 21; break; // 21
923 case 1: actor[sactor].recycle1 = 18; break; // 17
924 case 2: actor[sactor].recycle1 = 15; break; // 14
925 case 3: actor[sactor].recycle1 = 13; break; // 12
926 case 4: actor[sactor].recycle1 = 12; break; // 10
927 case 5: actor[sactor].recycle1 = 11; break; // 9
928 }
929
930
931 switch(actor[sactor].primary)
932 {
933 /* case WEAPON_SNOW_DARTS:
934 btype [0] = BULLET_SNOW_DART;
935 btype [1] = BULLET_SNOW_DART_SMALL;
936 damage [0] = 80 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 30;
937 damage [1] = 60 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
938 speed [0] = 25000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 4000;
939 speed [1] = 20000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3200;
940 timer [0] = 18 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
941 timer [1] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
942 rand_timer [0] = 2;
943 rand_timer [1] = 2;
944 mass [0] = 100;
945 mass [1] = 100;
946 scatter [0] = 0;
947 scatter [1] = 0;
948 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
949 break;
950 case WEAPON_SILVER_TEETH:
951 btype [0] = BULLET_SILVER_TOOTH;
952 btype [1] = BULLET_SILVER_TOOTH;
953 damage [0] = 70 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
954 damage [1] = 50 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 12;
955 speed [0] = 23000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3100;
956 speed [1] = 21000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2600;
957 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
958 speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
959 make_bcolours(bcolours1, COLOUR_WHITE);
960 make_bcolours(bcolours2, COLOUR_GREY6);
961 timer [0] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
962 timer [1] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
963 rand_timer [0] = 3;
964 rand_timer [1] = 3;
965 mass [0] = 80;
966 mass [1] = 80;
967 scatter [0] = 0;
968 scatter [1] = 0;
969 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
970 break;
971 case WEAPON_ICE_DARTS:
972 btype [0] = BULLET_ICE_DART;
973 btype [1] = BULLET_ICE_DART_SMALL;
974 damage [0] = 70 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
975 damage [1] = 50 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 12;
976 speed [0] = 25000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 4000;
977 speed [1] = 20000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3200;
978 timer [0] = 18 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
979 timer [1] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
980 rand_timer [0] = 2;
981 rand_timer [1] = 2;
982 mass [0] = 100;
983 mass [1] = 100;
984 scatter [0] = 0;
985 scatter [1] = 0;
986 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
987 break;
988 case WEAPON_FROZEN_BREATH:
989 btype [0] = BULLET_FROZEN_BREATH;
990 btype [1] = BULLET_FROZEN_BREATH;
991 damage [0] = 60 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
992 damage [1] = 60 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
993 speed [0] = 22000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3200;
994 speed [1] = 22000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3200;
995 timer [0] = 17 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
996 timer [1] = 17 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
997 rand_timer [0] = 4;
998 rand_timer [1] = 4;
999 mass [0] = 150;
1000 mass [1] = 150;
1001 scatter [0] = 5;
1002 scatter [1] = 5;
1003 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1004 change_angle_arc(angles, ANGLE_HALF);
1005 break;
1006 case WEAPON_CRYSTAL_TEETH:
1007 btype [0] = BULLET_CRYSTAL_TOOTH;
1008 btype [1] = BULLET_CRYSTAL_TOOTH;
1009 damage [0] = 20 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 7;
1010 damage [1] = 20 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 7;
1011 speed [0] = 17000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2800;
1012 speed [1] = 17000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2800;
1013 rand_speed [0] = 8000;
1014 rand_speed [1] = 8000;
1015 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1016 speed_div [1] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1017 make_bcolours(bcolours1, COLOUR_GREY6);
1018 make_bcolours(bcolours2, COLOUR_GREY6);
1019 timer [0] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1020 timer [1] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1021 rand_timer [0] = 3;
1022 rand_timer [1] = 3;
1023 mass [0] = 30;
1024 mass [1] = 30;
1025 scatter [0] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 3;
1026 scatter [1] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 3;
1027 number = 4 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1028 rand_angle = 1;
1029 break;
1030 case WEAPON_GOLDEN_NEEDLES:
1031 btype [0] = BULLET_GOLDEN_NEEDLE;
1032 btype [1] = BULLET_GOLDEN_NEEDLE_SMALL;
1033 damage [0] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1034 damage [1] = 20 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 5;
1035 speed [0] = 17000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2600;
1036 speed [1] = 15000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2300;
1037 speed_div [0] = 2 - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1038 speed_div [1] = 3 - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1039 // bcolours1 [0] = COLOUR_YELLOW8;
1040 // bcolours2 [0] = COLOUR_YELLOW6;
1041 make_bcolours(bcolours1, COLOUR_YELLOW8);
1042 make_bcolours(bcolours2, COLOUR_YELLOW6);
1043 timer [0] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1044 timer [1] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1045 rand_timer [0] = 3;
1046 rand_timer [1] = 3;
1047 mass [0] = 30;
1048 mass [1] = 30;
1049 scatter [0] = 3 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1050 scatter [1] = 5 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1051 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1052 // rand_angle = 1;
1053 break;
1054 case WEAPON_PARTICLE_SPITTER:
1055 btype [0] = BULLET_PARTICLE_SPITTER;
1056 btype [1] = BULLET_PARTICLE_SPITTER;
1057 damage [0] = 10 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 5;
1058 damage [1] = 10 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 5;
1059 speed [0] = 9000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1000;
1060 speed [1] = 9000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1000;
1061 rand_speed [0] = 4000;
1062 rand_speed [1] = 4000;
1063 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1064 speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1065 bcolours1 [0] = COLOUR_GREEN5;
1066 bcolours2 [1] = COLOUR_GREEN5;
1067 timer [0] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1068 timer [1] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1069 rand_timer [0] = 6;
1070 rand_timer [1] = 6;
1071 mass [0] = 20;
1072 mass [1] = 20;
1073 scatter [0] = 70 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 10;
1074 scatter [1] = 70 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 10;
1075 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1076 rand_angle = 1;
1077 break;
1078 case WEAPON_CRYSTAL_SPINES:
1079 btype [0] = BULLET_CRYSTAL_SPINE;
1080 btype [1] = BULLET_CRYSTAL_SPINE;
1081 damage [0] = 50 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
1082 damage [1] = 50 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
1083 speed [0] = 21000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2600;
1084 speed [1] = 21000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2600;
1085 speed_div [0] = 1;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1086 speed_div [1] = 1;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1087 make_bcolours(bcolours1, COLOUR_GREY6);
1088 make_bcolours(bcolours2, COLOUR_GREY6);
1089 timer [0] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1090 timer [1] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1091 rand_timer [0] = 3;
1092 rand_timer [1] = 3;
1093 mass [0] = 80;
1094 mass [1] = 80;
1095 scatter [0] = 0;
1096 scatter [1] = 0;
1097 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1098 break;
1099 case WEAPON_FAR_SPITTER:
1100 btype [0] = BULLET_FAR_SPITTER;
1101 btype [1] = BULLET_FAR_SPITTER;
1102 damage [0] = 4 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1103 damage [1] = 4 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1104 speed [0] = 12000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1500;
1105 speed [1] = 12000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1500;
1106 rand_speed [0] = 9000;
1107 rand_speed [1] = 9000;
1108 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1109 speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1110 bcolours1 [0] = COLOUR_YELLOW5;
1111 bcolours2 [1] = COLOUR_YELLOW5;
1112 timer [0] = 25 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1113 timer [1] = 25 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1114 rand_timer [0] = 6;
1115 rand_timer [1] = 6;
1116 mass [0] = 20;
1117 mass [1] = 20;
1118 scatter [0] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 5;
1119 scatter [1] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 5;
1120 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1121 rand_angle = 1;
1122 break;
1123 case WEAPON_NUMEROUS_BLADES:
1124 btype [0] = BULLET_NUMEROUS_BLADE;
1125 btype [1] = BULLET_NUMEROUS_BLADE;
1126 damage [0] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
1127 damage [1] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 15;
1128 speed [0] = 15000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1000;
1129 speed [1] = 15000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1000;
1130 rand_speed [0] = 4000;
1131 rand_speed [1] = 4000;
1132 // speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1133 // speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1134 bcolours1 [0] = COLOUR_WHITE;
1135 bcolours2 [1] = COLOUR_WHITE;
1136 timer [0] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
1137 timer [1] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3;
1138 rand_timer [0] = 6;
1139 rand_timer [1] = 6;
1140 mass [0] = 40;
1141 mass [1] = 40;
1142 scatter [0] = 6 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1143 scatter [1] = 6 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1144 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1145 // rand_angle = 1;
1146 break;
1147 case WEAPON_NUMEROUS_DARTS:
1148 btype [0] = BULLET_NUMEROUS_DART;
1149 btype [1] = BULLET_NUMEROUS_DART;
1150 damage [0] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1151 damage [1] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1152 speed [0] = 16000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2500;
1153 speed [1] = 16000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2500;
1154 rand_speed [0] = 8000;
1155 rand_speed [1] = 8000;
1156 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1157 speed_div [1] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1158 make_bcolours(bcolours1, COLOUR_ORANGE8);
1159 make_bcolours(bcolours2, COLOUR_ORANGE8);
1160 timer [0] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1161 timer [1] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1162 rand_timer [0] = 3;
1163 rand_timer [1] = 3;
1164 mass [0] = 30;
1165 mass [1] = 30;
1166 scatter [0] = 75 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 11;
1167 scatter [1] = 75 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 11;
1168 number = 4 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1169 rand_angle = 1;
1170 break;
1171 case WEAPON_BRASS_TEETH:
1172 btype [0] = BULLET_BRASS_TOOTH;
1173 btype [1] = BULLET_BRASS_TOOTH_SMALL;
1174 damage [0] = 30 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1175 damage [1] = 20 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 5;
1176 speed [0] = 21000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2900;
1177 speed [1] = 18000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2500;
1178 speed_div [0] = 1;// - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1179 speed_div [1] = 2 - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1180 // bcolours1 [0] = COLOUR_YELLOW8;
1181 // bcolours2 [0] = COLOUR_YELLOW6;
1182 make_bcolours(bcolours1, COLOUR_YELLOW7);
1183 make_bcolours(bcolours2, COLOUR_YELLOW6);
1184 timer [0] = 16 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1185 timer [1] = 14 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1186 rand_timer [0] = 3;
1187 rand_timer [1] = 3;
1188 mass [0] = 30;
1189 mass [1] = 30;
1190 scatter [0] = 3 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1191 scatter [1] = 5 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1192 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1193 // rand_angle = 1;
1194 change_angle_arc(angles, ANGLE_1_SIXTEENTH);
1195 break;
1196 case WEAPON_SHOCK_PATH:
1197 btype [0] = BULLET_SHOCK_PATH;
1198 btype [1] = BULLET_SHOCK_PATH_SMALL;
1199 damage [0] = 70 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
1200 damage [1] = 50 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 12;
1201 speed [0] = 26000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3400;
1202 speed [1] = 23000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2900;
1203 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1204 speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1205 make_bcolours(bcolours1, TRANS_LBLUE);
1206 make_bcolours(bcolours2, TRANS_DBLUE);
1207 timer [0] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1208 timer [1] = 11 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1209 rand_timer [0] = 3;
1210 rand_timer [1] = 3;
1211 mass [0] = 80;
1212 mass [1] = 80;
1213 scatter [0] = 0;
1214 scatter [1] = 0;
1215 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1216 change_angle_arc(angles, ANGLE_1_SIXTEENTH);
1217 break;
1218 case WEAPON_GOLDEN_PATH:
1219 btype [0] = BULLET_GOLDEN_PATH;
1220 btype [1] = BULLET_GOLDEN_PATH_SMALL;
1221 damage [0] = 70 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
1222 damage [1] = 50 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 12;
1223 speed [0] = 26000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 3400;
1224 speed [1] = 23000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2900;
1225 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1226 speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1227 make_bcolours(bcolours1, TRANS_YELLOW);
1228 make_bcolours(bcolours2, TRANS_ORANGE);
1229 timer [0] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1230 timer [1] = 11 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1231 rand_timer [0] = 3;
1232 rand_timer [1] = 3;
1233 mass [0] = 80;
1234 mass [1] = 80;
1235 scatter [0] = 0;
1236 scatter [1] = 0;
1237 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1238 // change_angle_arc(angles, ANGLE_1_SIXTEENTH);
1239 break;
1240 case WEAPON_BURNING_SPIRIT:
1241 btype [0] = BULLET_BURNING_SPIRIT;
1242 btype [1] = BULLET_BURNING_SPIRIT;
1243 damage [0] = 60 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
1244 damage [1] = 60 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
1245 speed [0] = 13000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2000;
1246 speed [1] = 13000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2000;
1247 speed_div [0] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1248 speed_div [1] = 3;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1249 make_bcolours(bcolours1, TRANS_YELLOW);
1250 make_bcolours(bcolours2, TRANS_ORANGE);
1251 timer [0] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1252 timer [1] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2;
1253 rand_timer [0] = 3;
1254 rand_timer [1] = 3;
1255 mass [0] = 80;
1256 mass [1] = 80;
1257 scatter [0] = 0;
1258 scatter [1] = 0;
1259 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1260 // change_angle_arc(angles, ANGLE_HALF);
1261 break;
1262 */
1263
1264 //Tr + Cr: Crystal teeth - long-range scattergun
1265 //Ci: Golden Needles - fast, single shot, some scattering
1266 //Ci + Cr: Particle Spitter
1267
1268 /*
1269 None: Wooden darts
1270
1271 Sq: Ice darts - slow, powerful, drag-affected
1272 Sq + Tr: Silver teeth - slow recycle, long-range, powerful, no drag
1273 Sq + Ci: Snow darts - like ice darts - trail blue sparks - faster recycle
1274 Sq + Cr: Frozen breath - short-range arc; reaches 180 degrees?
1275
1276 Tr: Shock Path - fast-moving, slow recycle
1277 Tr + Ci: Brass teeth - slightly scattered; like Lacewing (ship) cannon
1278 Tr + Cr: Crystal teeth - long-range scattergun
1279
1280 Ci: Golden Needles - fast, single shot, some scattering
1281 Ci + Cr: Particle Spitter
1282
1283 Cr: Crystal Spines - like Aether Squid
1284
1285 Sq + Tr + Ci: Golden Path
1286 Sq + Tr + Cr: Numerous Darts
1287 Sq + Ci + Cr: Numerous Blades
1288 Tr + Ci + Cr: Far Spitter
1289
1290 All: Burning Spirit
1291
1292 */
1293
1294 default:
1295 case WPN_DARTS:
1296 btype [0] = BULLET_ZAP;
1297 btype [1] = BULLET_ZAP;
1298 damage [0] = 60 + (actor[sactor].ship == SHIP_POINTY) * 16;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 20;
1299 damage [1] = 30 + (actor[sactor].ship == SHIP_POINTY) * 8;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1300 // speed [0] = 17000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2000;
1301 // speed [1] = 15000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 1900;
1302 speed [0] = 17000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2300;
1303 speed [1] = 15000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2200;
1304 speed_div [0] = 2; // smaller as triangle increases
1305 speed_div [1] = 2;
1306 // displace [0] = -1;
1307 // displace [1] = 1;
1308 // displace [2] = 0;
1309 if (actor[sactor].ship == SHIP_POINTY)
1310 {
1311 make_bcolours(bcolours1, COLOUR_WHITE);
1312 make_bcolours(bcolours2, COLOUR_GREY6);
1313 }
1314 else
1315 {
1316 make_bcolours(bcolours1, COLOUR_YELLOW8);
1317 make_bcolours(bcolours2, COLOUR_YELLOW7);
1318 }
1319 // timer [0] = 15;
1320 // timer [1] = 14;
1321 timer [0] = 16;
1322 timer [1] = 15;
1323 rand_timer [0] = 3;
1324 rand_timer [1] = 2;
1325 mass [0] = 10;
1326 mass [1] = 10;
1327 scatter [0] = 0;
1328 scatter [1] = 0;
1329 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE];
1330 break;
1331 /*
1332
1333 REMEMBER: Pointy ship does extra damage.
1334
1335 case WPN_BURST:
1336 btype [0] = BULLET_CRYSTAL_SPINE;
1337 btype [1] = BULLET_CRYSTAL_SPINE;
1338 damage [0] = 50;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1339 damage [1] = 50;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1340 speed [0] = 16000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2500;
1341 speed [1] = 16000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2500;
1342 rand_speed [0] = 8000;
1343 rand_speed [1] = 8000;
1344 speed_div [0] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1345 speed_div [1] = 2;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1346 make_bcolours(bcolours1, COLOUR_WHITE);
1347 make_bcolours(bcolours2, COLOUR_WHITE);
1348 timer [0] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1349 timer [1] = 12 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1350 rand_timer [0] = 3;
1351 rand_timer [1] = 3;
1352 mass [0] = 10;
1353 mass [1] = 10;
1354 scatter [0] = 75 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] * 11;
1355 scatter [1] = 75 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] * 11;
1356 number = 4 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] * 2;
1357 rand_angle = 1;
1358 break;
1359 case WPN_TEETH:
1360 btype [0] = BULLET_BRASS_TOOTH;
1361 btype [1] = BULLET_BRASS_TOOTH_SMALL;
1362 damage [0] = 60;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1363 damage [1] = 40;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 5;
1364 speed [0] = 21000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2900;
1365 speed [1] = 18000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2500;
1366 speed_div [0] = 1;// - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1367 speed_div [1] = 2;// - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1368 // bcolours1 [0] = COLOUR_YELLOW8;
1369 // bcolours2 [0] = COLOUR_YELLOW6;
1370 make_bcolours(bcolours1, COLOUR_YELLOW8);
1371 make_bcolours(bcolours2, COLOUR_YELLOW7);
1372 timer [0] = 16 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1373 timer [1] = 14 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1374 rand_timer [0] = 3;
1375 rand_timer [1] = 3;
1376 mass [0] = 10;
1377 mass [1] = 10;
1378 scatter [0] = 3 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS];
1379 scatter [1] = 5 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CROSS] * 2;
1380 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE];
1381 // rand_angle = 1;
1382 change_angle_arc(angles, ANGLE_1_SIXTEENTH);
1383 change_displacement(displace, 0);
1384 break;
1385 case WPN_SPINES:
1386 btype [0] = BULLET_GOLDEN_NEEDLE;
1387 btype [1] = BULLET_GOLDEN_NEEDLE_SMALL;
1388 damage [0] = 60;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 10;
1389 damage [1] = 40;// + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 5;
1390 speed [0] = 17000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2600;
1391 speed [1] = 15000 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] * 2300;
1392 speed_div [0] = 2;// - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1393 speed_div [1] = 2;// - actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE] / 3;
1394 // bcolours1 [0] = COLOUR_YELLOW8;
1395 // bcolours2 [0] = COLOUR_YELLOW6;
1396 make_bcolours(bcolours1, COLOUR_YELLOW8);
1397 make_bcolours(bcolours2, COLOUR_YELLOW6);
1398 timer [0] = 15 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1399 timer [1] = 13 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_TRIANGLE];
1400 rand_timer [0] = 3;
1401 rand_timer [1] = 3;
1402 mass [0] = 10;
1403 mass [1] = 10;
1404 scatter [0] = 3 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE];
1405 scatter [1] = 5 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE] * 2;
1406 number = 2 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_CIRCLE];
1407 // rand_angle = 1;
1408 change_angle_arc(angles, -1);
1409 change_displacement(displace, 0);
1410 break;*/
1411 }
1412
1413 int i;
1414 int j = 0;
1415 int l = 0;
1416 int shot_angle;
1417 int k = 0;
1418 int firing_angle = actor[sactor].angle;
1419
1420 /*
1421 if (actor[sactor].cannon_status == 0)
1422 {
1423 actor[sactor].cannon_status ++;
1424 shot_angle = 1;
1425 }
1426 else
1427 {
1428 actor[sactor].cannon_status = 0;
1429 shot_angle = -1;
1430 }
1431 */
1432 if ((actor[sactor].cannon_status % 2) == 0)
1433 {
1434 shot_angle = 1;
1435 }
1436 else
1437 {
1438 shot_angle = -1;
1439 }
1440
1441 actor[sactor].cannon_status ++;
1442 if (actor[sactor].cannon_status == 4)
1443 actor[sactor].cannon_status = 0;
1444
1445
1446 for (k = 0; k < 1 + (actor[sactor].ship == SHIP_FINS); k ++)
1447 {
1448
1449 if (k == 1)
1450 {
1451 /* if (actor[sactor].cannon_status / 2 == 0)
1452 shot_angle = 1;
1453 else
1454 shot_angle = -1;
1455 // actor[sactor].cannon_status ++;
1456 if (actor[sactor].cannon_status == 4)
1457 actor[sactor].cannon_status = 0; */
1458 // duplicates spines code, so the two shouldn't be combined
1459 firing_angle += ANGLE_HALF;
1460 // number /= 2;
1461 // j = 0;
1462 l = 0;
1463 j = 0;//1;
1464 }
1465 /*
1466 if (actor[sactor].primary == WPN_SPINES)
1467 {
1468 if (actor[sactor].cannon_status / 2 == 0)
1469 shot_angle = 1;
1470 else
1471 shot_angle = -1;
1472 actor[sactor].cannon_status ++;
1473 if (actor[sactor].cannon_status == 4)
1474 actor[sactor].cannon_status = 0;
1475 }
1476 else*/
1477 // {
1478 // }
1479
1480 for (i = 0; i < number; i ++)
1481 {
1482 if (i == 1)
1483 l = 1;
1484 if (i == 2)
1485 {
1486 j = 1;
1487 l = 2;
1488 }
1489 // colours [0] = bcolours [j];
1490 // if (k == 1) // ie backfire from finny ship
1491 // {
1492 // if (i % 2 != actor[sactor].cannon_status % 2)
1493 // continue;
1494 // }
1495
1496 if (rand_angle == 1)
1497 {
1498 cannon_shot(sactor, btype [j], damage [j], timer [j] + grand(rand_timer [j]), mass [j],
1499 firing_angle,
1500 0, size, speed [j] + grand(rand_speed [j]), bcolours1, displace [i], scatter [j], speed_div [j]);
1501 }
1502 else
1503 {
1504 if (j == 0)
1505 cannon_shot(sactor, btype [j], damage [j], timer [j] + grand(rand_timer [j]), mass [j],
1506 firing_angle + (angles [i] * shot_angle),
1507 0, size, speed [j] + grand(rand_speed [j]), bcolours1, displace [i] * shot_angle, scatter [j], speed_div [j]);
1508 else
1509 cannon_shot(sactor, btype [j], damage [j], timer [j] + grand(rand_timer [j]), mass [j],
1510 firing_angle + (angles [i] * shot_angle),
1511 0, size, speed [j] + grand(rand_speed [j]), bcolours2, displace [i] * shot_angle, scatter [j], speed_div [j]);
1512 }
1513 } // end for i
1514 } // end for k
1515
1516
1517 // actor_sound(sactor, ASOUND_CANNON);
1518 play_wavf(NWAV_DART, 800 + actor[sactor].ability [ABILITY_PRIMARY] [SYMBOL_SQUARE] * 80);
1519
1520
1521 }
1522
1523
1524 void change_angle_arc(int angles [14], int width)
1525 {
1526
1527 switch(width)
1528 {
1529 case ANGLE_HALF:
1530 angles [2] = ANGLE_1_EIGHTH;
1531 angles [3] = -ANGLE_1_EIGHTH;
1532 angles [4] = ANGLE_QUARTER;
1533 angles [5] = -ANGLE_QUARTER;
1534 angles [6] = ANGLE_HALF;
1535 break;
1536 case ANGLE_1_SIXTEENTH:
1537 angles [2] = ANGLE_1_32;
1538 angles [3] = -ANGLE_1_32;
1539 angles [4] = ANGLE_1_SIXTEENTH;
1540 angles [5] = -ANGLE_1_SIXTEENTH;
1541 angles [6] = ANGLE_HALF;
1542 break;
1543 case -1:
1544 angles [2] = ANGLE_1_SIXTEENTH;
1545 angles [3] = ANGLE_1_EIGHTH;
1546 angles [4] = -ANGLE_1_EIGHTH;
1547 angles [5] = -ANGLE_1_SIXTEENTH;
1548 angles [6] = ANGLE_HALF;
1549 break;
1550 case -2:
1551 angles [0] = ANGLE_HALF - ANGLE_1_SIXTEENTH;
1552 angles [1] = ANGLE_HALF + ANGLE_1_SIXTEENTH;
1553 angles [2] = ANGLE_HALF - ANGLE_1_EIGHTH;
1554 angles [3] = ANGLE_HALF + ANGLE_1_EIGHTH;
1555 angles [4] = ANGLE_QUARTER;
1556 angles [5] = -ANGLE_QUARTER;
1557 angles [6] = ANGLE_HALF - ANGLE_1_32;
1558 angles [7] = ANGLE_HALF + ANGLE_1_32;
1559 angles [8] = ANGLE_HALF - ANGLE_1_SIXTEENTH - ANGLE_1_32;
1560 angles [9] = ANGLE_HALF + ANGLE_1_SIXTEENTH + ANGLE_1_32;
1561 angles [10] = ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_32;
1562 angles [11] = ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_32;
1563 angles [12] = ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH;
1564 angles [13] = ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH;
1565 break;
1566 }
1567 }
1568
1569 void change_displacement(int displace [7], int type)
1570 {
1571 switch(type)
1572 {
1573 case 0:
1574 displace [0] = -1;
1575 displace [1] = 1;
1576 displace [2] = 0;
1577 displace [3] = 0;
1578 displace [4] = 0;
1579 displace [5] = 0;
1580 displace [6] = 0;
1581 break;
1582 }
1583 }
1584
1585 void cannon_shot(int sactor, int btype, int damage, int timer, int mass,
1586 int angle, int status, int size, int speed, int colours [4], int displaced,
1587 int scatter, int speed_div)
1588 {
1589 angle += scatter;
1590 angle -= grand(scatter * 2);
1591
1592 // speed += actor[sactor].upgraded_system [UPG_PROJECT] * 5000;
1593 // speed_div -= actor[sactor].upgraded_system [UPG_PROJECT];
1594
1595 int xs = actor[sactor].x_speed + xpart(angle - ANGLE_QUARTER, speed / 3);
1596 int ys = actor[sactor].y_speed + ypart(angle - ANGLE_QUARTER, speed / 3);
1597
1598 int x = actor[sactor].x;
1599 int y = actor[sactor].y;
1600
1601 if (displaced != 0)
1602 {
1603 // x += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced), GRAIN * displaced);
1604 // y += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced), GRAIN * displaced);
1605 x += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN * displaced);
1606 y += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN * displaced);
1607 }
1608
1609 if (angle == 0)
1610 angle = 1;
1611
1612 create_bullet(btype, x, y,
1613 xs, ys, sactor,
1614 damage, timer, mass, actor[sactor].angle,
1615 status, size, colours, speed_div, 0, 0, 0, 0, 0);
1616
1617 int cloud_colours [5];
1618 cloud_colours [0] = colours [0];
1619
1620 x = actor[sactor].x + xpart(angle - ANGLE_QUARTER, actor[sactor].flash_distance);
1621 y = actor[sactor].y + ypart(angle - ANGLE_QUARTER, actor[sactor].flash_distance);
1622
1623 if (displaced != 0)
1624 {
1625 x += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN * displaced);
1626 y += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN * displaced);
1627 }
1628
1629
1630 create_cloud(CLOUD_MED_CIRCLE, x, y, 0, 0,
1631 actor[sactor].x_speed, actor[sactor].y_speed, 300, 50,
1632 0, 0, 0, 0, cloud_colours);
1633
1634 }
1635
1636
1637
1638
1639
1640 int adjust_damage(int base, int sactor)
1641 {
1642 return base + (base * actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE]) / 3;
1643 }
1644
1645
1646 void fire_secondary(int sactor)
1647 {
1648 /*
1649 specials:
1650 1 = dam
1651 2 = explosion cloud size
1652 3 = blast radius
1653 4 = force
1654 */
1655
1656 // int colours [4];
1657 int bcolours1 [4] = {TRANS_DRED, TRANS_ORANGE, TRANS_YELLOW, TRANS_YELLOW};
1658 int bcolours2 [4] = {TRANS_DRED, TRANS_ORANGE, TRANS_YELLOW, TRANS_YELLOW};
1659 int btype [2] = {BULLET_ZAP, BULLET_ZAP};
1660 int damage [2] = {0, 0};
1661 int special1 [2] = {0, 0};
1662 int special2 [2] = {0, 0};
1663 int special3 [2] = {0, 0};
1664 int special4 [2] = {0, 0};
1665 int special5 [2] = {0, 0};
1666 int timer [2] = {10, 10}; //= 20 - actor[sactor].upgraded_system [UPG_PROJECT] * 2;
1667 int mass [2] = {100, 100};
1668 // int status = 0;
1669 int speed [2] = {10000, 10000};//= 16000;
1670 int rand_speed [2] = {0, 0};
1671 int speed_div [2] = {5, 5};
1672 int angles [20] = {0, 0, ANGLE_1_SIXTEENTH, -ANGLE_1_SIXTEENTH, ANGLE_1_EIGHTH, -ANGLE_1_EIGHTH,
1673 ANGLE_1_SIXTEENTH + ANGLE_1_32,
1674 - ANGLE_1_SIXTEENTH - ANGLE_1_32,
1675 ANGLE_1_32,
1676 - ANGLE_1_32,
1677 ANGLE_HALF,
1678 ANGLE_HALF,
1679 0,
1680 0,
1681 /* ANGLE_1_EIGHTH + ANGLE_1_32,
1682 - ANGLE_1_EIGHTH - ANGLE_1_32,
1683 ANGLE_1_EIGHTH - ANGLE_1_32,
1684 - ANGLE_1_EIGHTH + ANGLE_1_32,*/
1685 // ANGLE_QUARTER - ANGLE_1_32,
1686 // - ANGLE_QUARTER + ANGLE_1_32,
1687 // ANGLE_1_32,
1688 // - ANGLE_1_32
1689 };
1690 int rand_angle = 0;
1691 // unsigned char seed = counter;
1692 int displace [3] = {-1, 1, 0};
1693 int number = 0;
1694 int rand_timer [2] = {0, 0};
1695 int scatter [2] = {0, 0};
1696 int pattern = PATTERN_TWO_PLUS_OTHERS;
1697 int size = 0;
1698 int base_speed;
1699 int flash_circle = TRANS_ORANGE;
1700
1701 // actor[sactor].recycle2 = 66;
1702
1703
1704 switch(actor[sactor].secondary)
1705 {
1706 /*
1707 Square - Damage
1708 Circle - Number
1709 Triangle - Size/Speed
1710 */
1711 default:
1712 case SECOND_FURIOUS_ORB:
1713 btype [0] = BULLET_FURIOUS_ORB;
1714 btype [1] = BULLET_FURIOUS_ORB_SMALL;
1715 damage [0] = 1;
1716 damage [1] = 1;
1717 // blast damage:
1718 // special1 [0] = 175 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 85;
1719 special1 [0] = adjust_damage(150, sactor);
1720 special1 [1] = special1 [0] / 2; //100 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 50;
1721 // visible explosion size:
1722 special2 [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 20;
1723 special2 [1] = 20 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10;
1724 // blast size:
1725 special3 [0] = 50000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10000;
1726 special3 [1] = 20000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 5000;
1727 // blast force
1728 special4 [0] = adjust_damage(300, sactor);
1729 special4 [1] = adjust_damage(100, sactor);
1730 speed [0] = 5000;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 1000;
1731 speed [1] = 2000;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 500;
1732 rand_speed [0] = 0;
1733 rand_speed [1] = 5000;
1734 speed_div [0] = 7; // smaller as triangle increases
1735 speed_div [1] = 8;
1736 displace [0] = 0;
1737 displace [1] = 0;
1738 displace [2] = 0;
1739 // make_bcolours(bcolours1, COLOUR_YELLOW8);
1740 // make_bcolours(bcolours2, COLOUR_YELLOW7);
1741 timer [0] = 50;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 5;
1742 timer [1] = 20;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 2;
1743 rand_timer [0] = 0;
1744 rand_timer [1] = 30;
1745 mass [0] = 100;
1746 mass [1] = 30;
1747 scatter [0] = 0;
1748 scatter [1] = 30;
1749 number = 1 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1750 pattern = PATTERN_ONE_PLUS_OTHERS;
1751 size = 3000;
1752 // play_wavf(NWAV_SPLERK, 1800);
1753 break;
1754 case SECOND_MANIFOLD_ORB:
1755 btype [0] = BULLET_MANIFOLD_ORB;
1756 damage [0] = 1;
1757 // blast damage
1758 // special1 [0] = 175 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 85;
1759 special1 [0] = adjust_damage(150, sactor);
1760 // visible explosion size
1761 special2 [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 20;
1762 // blast size
1763 special3 [0] = 50000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10000;
1764 // blast force
1765 // special4 [0] = 300 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 150;
1766 special4 [0] = adjust_damage(300, sactor);
1767 special5 [0] = actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1768 speed [0] = 5000;
1769 rand_speed [0] = 0;
1770 speed_div [0] = 7; // smaller as triangle increases
1771 displace [0] = 0;
1772 displace [1] = 0;
1773 displace [2] = 0;
1774 // make_bcolours(bcolours1, COLOUR_YELLOW8);
1775 // make_bcolours(bcolours2, COLOUR_YELLOW7);
1776 timer [0] = 45;
1777 rand_timer [0] = 0;
1778 mass [0] = 100;
1779 scatter [0] = 0;
1780 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
1781 pattern = PATTERN_ONE_PLUS_OTHERS;
1782 size = 3000;
1783 // play_wavf(NWAV_SPLERK, 1700);
1784 break;
1785 case SECOND_WORMS_SORROW:
1786 /*
1787 Square - Damage
1788 Circle - Number
1789 Triangle - Size/Speed
1790 */
1791 btype [0] = BULLET_WORM_SORROW;
1792 // damage [0] = 40 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 20;
1793 damage [0] = adjust_damage(13, sactor);
1794 // REMEMBER - these are actually agony
1795 speed [0] = 10000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 100;
1796 // special1 [0] = 2500 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 900;
1797 special1 [0] = 2500 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 400;
1798 special3 [0] = -1;
1799 // special4 [0] = 8 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 3;
1800 // special4 [0] = 36 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 12;
1801 special4 [0] = 36 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 6;
1802 rand_speed [0] = 0;
1803 speed_div [0] = 7; // smaller as triangle increases
1804 displace [0] = 0;
1805 displace [1] = 0;
1806 displace [2] = 0;
1807 bcolours1 [0] = COLOUR_YELLOW4;
1808 bcolours1 [1] = COLOUR_YELLOW5;
1809 bcolours1 [2] = COLOUR_YELLOW7;
1810 bcolours1 [3] = COLOUR_WHITE;
1811 timer [0] = 35 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 2;
1812 special5 [0] = actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 2;
1813 rand_timer [0] = 0; // so they all lock on at once. Randomised later
1814 mass [0] = 7;
1815 scatter [0] = 0;
1816 number = 4 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1817 pattern = PATTERN_ALL_SAME;
1818 change_angle_arc(angles, -2);
1819 flash_circle = TRANS_YELLOW;
1820 play_wavf(NWAV_WORMS, 1000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 50);
1821 break;
1822 case SECOND_WORMS_AGONY:
1823 btype [0] = BULLET_WORM_AGONY;
1824 // REMEMBER - these are actually sorrow
1825 // damage [0] = 20 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 10;
1826 damage [0] = adjust_damage(10, sactor);
1827 speed [0] = 5000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 100;
1828 special1 [0] = 600 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 160;
1829 // special1 [0] = 300 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 120;
1830 special3 [0] = -1;
1831 special4 [0] = 8 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 3;
1832 special5 [0] = 0;
1833 rand_speed [0] = 0;
1834 speed_div [0] = 7; // smaller as triangle increases
1835 displace [0] = 0;
1836 displace [1] = 0;
1837 displace [2] = 0;
1838 bcolours1 [0] = COLOUR_YELLOW4;
1839 bcolours1 [1] = COLOUR_YELLOW5;
1840 bcolours1 [2] = COLOUR_GREY6;
1841 bcolours1 [3] = COLOUR_WHITE;
1842 timer [0] = 150;
1843 rand_timer [0] = 0;
1844 mass [0] = 7;
1845 scatter [0] = 0;
1846 number = 1;
1847 pattern = PATTERN_ALL_SAME;
1848 if (actor[sactor].secondary_burst == 0)
1849 {
1850 actor[sactor].secondary_burst = 4 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1851 actor[sactor].secondary_burst_recycle = BURST_RECYCLE_DELAY_WORMS;
1852 }
1853 play_wavf(NWAV_WORMS, 1200 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 50);
1854 angles [0] = ANGLE_HALF;
1855 flash_circle = TRANS_YELLOW;
1856 break;
1857 case SECOND_PANIC_EELS:
1858 /*
1859 Square - Damage
1860 Circle - Number
1861 Triangle - Size/Speed
1862 */
1863 btype [0] = BULLET_PANIC_EEL;
1864 // damage [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 25;
1865 damage [0] = adjust_damage(50, sactor);
1866 speed [0] = 5000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 100;
1867 special2 [0] = 64;
1868 // if (grand(2) == 0)
1869 // special2 [0] = -72; in bullet.c
1870 // special3 [0] = 5 + grand(7);
1871 // special1 [0] = 900;
1872 special1 [0] = 900 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 220;
1873 // special3 [0] = -1;
1874 special4 [0] = actor[sactor].angle;
1875 special5 [0] = 9;// + grand(3);
1876 // special4 [0] = 8 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 3;
1877 rand_speed [0] = 8000;
1878 speed_div [0] = 7; // smaller as triangle increases
1879 displace [0] = 0;
1880 displace [1] = 0;
1881 displace [2] = 0;
1882 bcolours1 [0] = COLOUR_GREEN4;
1883 bcolours1 [1] = COLOUR_GREEN5;
1884 bcolours1 [2] = COLOUR_GREEN6;
1885 bcolours1 [3] = COLOUR_GREEN8;
1886 timer [0] = 150;
1887 rand_timer [0] = 30;
1888 mass [0] = 30;
1889 scatter [0] = ANGLE_FULL;//1_32;
1890 number = 4 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1891 pattern = PATTERN_ALL_SAME;
1892 // change_angle_arc(angles, ANGLE_1_32);
1893 rand_angle = 1;
1894 flash_circle = TRANS_LGREEN;
1895 play_wavf(NWAV_TEETH, 100 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 5);
1896 break;
1897 case SECOND_EYE_DESOLATION:
1898 btype [0] = BULLET_EYE_DESOLATION;
1899 damage [0] = 1;
1900 // blast damage
1901 // special1 [0] = 100 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 50; //150 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 75;
1902 special1 [0] = adjust_damage(100, sactor);
1903 // visible explosion size
1904 special2 [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 20;
1905 // blast size
1906 special3 [0] = 50000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10000;
1907 // acceleration
1908 special4 [0] = 200 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 100;
1909 // number of little things
1910 special5 [0] = actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1911 speed [0] = 2000;
1912 rand_speed [0] = 0;
1913 speed_div [0] = 7; // smaller as triangle increases
1914 displace [0] = 0;
1915 displace [1] = 0;
1916 displace [2] = 0;
1917 // make_bcolours(bcolours1, COLOUR_YELLOW8);
1918 // make_bcolours(bcolours2, COLOUR_YELLOW7);
1919 timer [0] = 55;
1920 rand_timer [0] = 0;
1921 mass [0] = 100;
1922 scatter [0] = 0;
1923 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
1924 pattern = PATTERN_ONE_PLUS_OTHERS;
1925 play_wavf(NWAV_JET, 500 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 50);
1926 break;
1927 case SECOND_BURNING_EYE:
1928 btype [0] = BULLET_BURNING_EYE;
1929 damage [0] = 1;
1930 // blast damage
1931 // special1 [0] = 80 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 40;
1932 special1 [0] = adjust_damage(80, sactor);
1933 // visible explosion size
1934 special2 [0] = 20 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 5;
1935 // blast size
1936 special3 [0] = 20000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 4000;
1937 // acceleration
1938 special4 [0] = 250 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 120;
1939 // number of little things
1940 special5 [0] = 1;//2 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1941 speed [0] = -6000;
1942 rand_speed [0] = 0;
1943 speed_div [0] = 7; // smaller as triangle increases
1944 displace [0] = 0;
1945 displace [1] = 0;
1946 displace [2] = 0;
1947 // make_bcolours(bcolours1, COLOUR_YELLOW8);
1948 // make_bcolours(bcolours2, COLOUR_YELLOW7);
1949 timer [0] = 55;
1950 rand_timer [0] = 20;
1951 mass [0] = 30;
1952 scatter [0] = 16;
1953 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
1954 pattern = PATTERN_ONE_PLUS_OTHERS;
1955 if (actor[sactor].secondary_burst == 0)
1956 {
1957 actor[sactor].secondary_burst = 2 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE];
1958 actor[sactor].secondary_burst_recycle = BURST_RECYCLE_DELAY;
1959 }
1960 play_wavf(NWAV_JET, 1200 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 200);
1961 break;
1962 case SECOND_FROZEN_TEETH:
1963 btype [0] = BULLET_FROZEN_TOOTH;
1964 // damage [0] = 100 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 50;
1965 damage [0] = adjust_damage(80, sactor);
1966 // blast damage
1967 // special1 [0] = 80 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 40;
1968 // special1 [0] = 60 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 30;
1969 // visible explosion size
1970 special2 [0] = 5 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 2;
1971 // blast size
1972 // special3 [0] = 20000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 4000;
1973 // acceleration
1974 special4 [0] = 120 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 60;
1975 // acceleration angle
1976 special5 [0] = actor[sactor].angle;
1977 speed [0] = 0;
1978 base_speed = 3000;
1979 rand_speed [0] = 0;
1980 speed_div [0] = 7; // smaller as triangle increases
1981 displace [0] = 0;
1982 displace [1] = 0;
1983 displace [2] = 0;
1984 bcolours1 [0] = COLOUR_BLUE5;
1985 bcolours1 [1] = COLOUR_BLUE6;
1986 bcolours1 [2] = COLOUR_BLUE7;
1987 bcolours1 [3] = COLOUR_BLUE8;
1988 // make_bcolours(bcolours1, COLOUR_YELLOW8);
1989 // make_bcolours(bcolours2, COLOUR_YELLOW7);
1990 timer [0] = 55;
1991 rand_timer [0] = 20;
1992 mass [0] = 30;
1993 scatter [0] = 16;
1994 // number = 2 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE];
1995 number = 4 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
1996 pattern = PATTERN_SIDEWARDS;
1997 flash_circle = TRANS_LBLUE;
1998 play_wavf(NWAV_TEETH, 300 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 30);
1999 break;
2000 case SECOND_FROZEN_STARS:
2001 btype [0] = BULLET_FROZEN_STAR;
2002 // damage [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 25;
2003 damage [0] = adjust_damage(50, sactor);
2004 speed [0] = 4000; //8000;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 1900;
2005 // speed [0] = 5000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 1500;
2006 rand_speed [0] = 9000;
2007 speed_div [0] = 7; // smaller as triangle increases
2008 displace [0] = 0;
2009 displace [1] = 0;
2010 displace [2] = 0;
2011 bcolours1 [0] = COLOUR_WHITE;
2012 bcolours1 [1] = COLOUR_BLUE8;
2013 bcolours1 [2] = COLOUR_BLUE6;
2014 bcolours1 [3] = COLOUR_BLUE8;
2015 timer [0] = 60 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 35;
2016 rand_timer [0] = 90;
2017 mass [0] = 30;
2018 scatter [0] = ANGLE_HALF;//FULL;
2019 number = 8 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 4;
2020 pattern = PATTERN_ALL_SAME;
2021 // change_angle_arc(angles, ANGLE_1_32);
2022 rand_angle = 1;
2023 flash_circle = TRANS_LBLUE;
2024 play_wavf(NWAV_TEETH, 1300);
2025 break;
2026 case SECOND_TOXIC_SUN:
2027 btype [0] = BULLET_TOXIC_SUN;
2028 // does little damage itself
2029 // damage [0] = 30 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 15;
2030 damage [0] = adjust_damage(30, sactor);
2031 // flare damage
2032 // special1 [0] = 60 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 30;
2033 special1 [0] = adjust_damage(60, sactor);
2034 // next flare
2035 special2 [0] = 44;
2036 // flare visible explosion size
2037 // special2 [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 20;
2038 // blast size
2039 // special3 [0] = 50000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10000;
2040 // flare speed
2041 special4 [0] = 5000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 1000;
2042 // number of flares
2043 // special5 [0] = 4 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2;
2044 speed [0] = 2000;
2045 rand_speed [0] = 0;
2046 speed_div [0] = 7; // smaller as triangle increases
2047 displace [0] = 0;
2048 displace [1] = 0;
2049 displace [2] = 0;
2050 // make_bcolours(bcolours1, COLOUR_YELLOW8);
2051 // make_bcolours(bcolours2, COLOUR_YELLOW7);
2052 timer [0] = 44 + (4 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 2) * 3;
2053 rand_timer [0] = 0;
2054 mass [0] = 100;
2055 scatter [0] = 0;
2056 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
2057 pattern = PATTERN_ONE_PLUS_OTHERS;
2058 // play_wavf(NWAV_WORMS, 200);
2059 play_wavf(NWAV_SPLERK, 300);
2060 break;
2061 case SECOND_SPORES:
2062 btype [0] = BULLET_SPORE;
2063 // damage [0] = 80 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 40;
2064 damage [0] = adjust_damage(80, sactor);
2065 special1 [0] = 80 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 40;
2066 special3 [0] = -1;
2067 special4 [0] = 36 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 12;
2068 special5 [0] = 1;
2069
2070
2071 speed [0] = 2000;
2072 rand_speed [0] = 2000;
2073 speed_div [0] = 7; // smaller as triangle increases
2074 displace [0] = 0;
2075 displace [1] = 0;
2076 displace [2] = 0;
2077 // make_bcolours(bcolours1, COLOUR_YELLOW8);
2078 // make_bcolours(bcolours2, COLOUR_YELLOW7);
2079 timer [0] = 100 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10;
2080 // rand_timer [0] = 20;
2081 // special1 [0] = timer [0] - 10;
2082 mass [0] = 50;
2083 scatter [0] = ANGLE_FULL;
2084 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
2085 pattern = PATTERN_ONE_PLUS_OTHERS;
2086 if (actor[sactor].secondary_burst == 0)
2087 {
2088 actor[sactor].secondary_burst = 2 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE];
2089 actor[sactor].secondary_burst_recycle = BURST_RECYCLE_DELAY;
2090 }
2091 play_wavf(NWAV_WORMS, 700);
2092 break;
2093 case SECOND_FLOWER:
2094 btype [0] = BULLET_FLOWER;
2095 damage [0] = 1;
2096 // blast damage
2097 // special1 [0] = 80 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 40; //150 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 75;
2098 special1 [0] = adjust_damage(80, sactor);
2099 // visible explosion size
2100 special2 [0] = 50 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 20;
2101 // blast size
2102 special3 [0] = 50000 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 20000;
2103 // acceleration
2104 special4 [0] = 200 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 100;
2105 // number of little things
2106 special5 [0] = 6 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 3;
2107 bcolours1 [0] = TRANS_YELLOW;
2108 bcolours1 [1] = TRANS_ORANGE;
2109 bcolours1 [2] = TRANS_LRED;
2110 bcolours1 [3] = TRANS_DRED;
2111 speed [0] = 0;
2112 rand_speed [0] = 0;
2113 speed_div [0] = 7; // smaller as triangle increases
2114 displace [0] = 0;
2115 displace [1] = 0;
2116 displace [2] = 0;
2117 timer [0] = 66;
2118 rand_timer [0] = 0;
2119 mass [0] = 100;
2120 scatter [0] = 0;
2121 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
2122 pattern = PATTERN_ONE_PLUS_OTHERS;
2123 play_wavf(NWAV_SPLERK, 250);
2124 break;
2125 case SECOND_CLAWS:
2126 btype [0] = BULLET_CLAW;
2127 // damage [0] = 25 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_SQUARE] * 12; // damage
2128 damage [0] = adjust_damage(25, sactor);
2129 special1 [0] = 500 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 150; // accel
2130 special2 [0] = actor[sactor].angle + grand(ANGLE_1_32) - grand(ANGLE_1_32);
2131 special3 [0] = 25;
2132 bcolours1 [0] = TRANS_YELLOW;
2133 bcolours1 [1] = TRANS_ORANGE;
2134 bcolours1 [2] = TRANS_LRED;
2135 bcolours1 [3] = TRANS_DRED;
2136 speed [0] = 12000;
2137 rand_speed [0] = 5000;
2138 speed_div [0] = 7; // smaller as triangle increases
2139 timer [0] = 100;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10;
2140 mass [0] = 20;
2141 scatter [0] = ANGLE_FULL;
2142 number = 1;// + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CROSS];
2143 pattern = PATTERN_ONE_PLUS_OTHERS;
2144 if (actor[sactor].secondary_burst == 0)
2145 {
2146 actor[sactor].secondary_burst = 6 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_CIRCLE] * 3;
2147 actor[sactor].secondary_burst_recycle = BURST_RECYCLE_DELAY_CLAWS;
2148 }
2149 flash_circle = 0;
2150 play_wav2(NWAV_TEETH, 1500 + actor[sactor].ability [ABILITY_SECONDARY] [SYMBOL_TRIANGLE] * 10, 80, 127);
2151 break;
2152
2153 }
2154 /*
2155 When adding seekers, remember to clear targets in enemy.c when target is destroyed!
2156 */
2157
2158 int i;
2159 int j = 0;
2160 int l = 0;
2161 int shot_angle;
2162 int angle_fired = actor[sactor].angle;
2163 if (actor[sactor].bomb_status == 0)
2164 {
2165 actor[sactor].bomb_status = 1;
2166 shot_angle = 1;
2167 }
2168 else
2169 {
2170 actor[sactor].bomb_status = 0;
2171 shot_angle = -1;
2172 }
2173
2174 for (i = 0; i < number; i ++)
2175 {
2176 switch(pattern)
2177 {
2178 case PATTERN_TWO_PLUS_OTHERS:
2179 if (i == 1)
2180 l = 1;
2181 if (i == 2)
2182 {
2183 j = 1;
2184 l = 2;
2185 }
2186 break;
2187 case PATTERN_ONE_PLUS_OTHERS:
2188 if (i == 1)
2189 {
2190 l = 2;
2191 j = 1;
2192 }
2193 break;
2194 case PATTERN_SIDEWARDS:
2195 // special1 [j] = actor[sactor].angle;
2196 if (i % 2 == 0)
2197 angles [i] = ANGLE_QUARTER;
2198 else
2199 angles [i] = - ANGLE_QUARTER;
2200 l = 0;
2201 j = 0;
2202 speed [j] = (i / 2 + 1) * base_speed;
2203 break;
2204 // PATTERN_ALL_SAME - don't need to change
2205 }
2206 // colours [0] = bcolours [j];
2207 if (rand_angle == 1)
2208 {
2209 secondary_shot(sactor, btype [j], damage [j], timer [j] + grand(rand_timer [j]), mass [j],
2210 angle_fired + grand(scatter [j]) - grand(scatter [j]),
2211 0, 0, speed [j] + grand(rand_speed [j]), bcolours1, displace [l], scatter [j], speed_div [j], special1 [j], special2 [j], special3 [j], special4 [j], special5 [j], flash_circle);
2212 }
2213 else
2214 {
2215 if (j == 0)
2216 secondary_shot(sactor, btype [j], damage [j], timer [j] + grand(rand_timer [j]), mass [j],
2217 angle_fired + (angles [i] * shot_angle),
2218 0, size, speed [j] + grand(rand_speed [j]), bcolours1, displace [l], scatter [j], speed_div [j], special1 [j], special2 [j], special3 [j], special4 [j], special5 [j], flash_circle);
2219 else
2220 secondary_shot(sactor, btype [j], damage [j], timer [j] + grand(rand_timer [j]), mass [j],
2221 angle_fired + (angles [i] * shot_angle),
2222 0, size, speed [j] + grand(rand_speed [j]), bcolours2, displace [l], scatter [j], speed_div [j], special1 [j], special2 [j], special3 [j], special4 [j], special5 [j], flash_circle);
2223 }
2224 }
2225
2226 // actor_sound(sactor, ASOUND_CANNON);
2227
2228 }
2229
2230
2231 void secondary_shot(int sactor, int btype, int damage, int timer, int mass,
2232 int angle, int status, int size, int speed, int colours [4], int displaced,
2233 int scatter, int speed_div, int special1, int special2, int special3, int special4, int special5,
2234 int flash_colour)
2235 {
2236 angle += scatter;
2237 angle -= grand(scatter * 2);
2238
2239 int xs = actor[sactor].x_speed + xpart(angle - ANGLE_QUARTER, speed / 3);
2240 int ys = actor[sactor].y_speed + ypart(angle - ANGLE_QUARTER, speed / 3);
2241
2242 int x = actor[sactor].x;
2243 int y = actor[sactor].y;
2244
2245 if (displaced != 0)
2246 {
2247 x += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced), GRAIN * 3);
2248 y += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced), GRAIN * 3);
2249 }
2250
2251 if (angle == 0)
2252 angle = 1;
2253
2254 create_bullet(btype, x, y,
2255 xs, ys, sactor,
2256 // damage, timer, mass, actor[sactor].angle,
2257 damage, timer, mass, angle,
2258 status, size, colours, speed_div, special1, special2, special3, special4, special5);
2259
2260 int cloud_colours [5];
2261 cloud_colours [0] = flash_colour;
2262
2263 x = actor[sactor].x + xpart(angle - ANGLE_QUARTER, actor[sactor].flash_distance);
2264 y = actor[sactor].y + ypart(angle - ANGLE_QUARTER, actor[sactor].flash_distance);
2265
2266 if (displaced != 0)
2267 {
2268 x += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced), GRAIN * 3);
2269 y += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced), GRAIN * 3);
2270 }
2271
2272 if (flash_colour != 0)
2273 create_cloud(CLOUD_MED_TRANS_CIRCLE, x, y, 0, 0,
2274 actor[sactor].x_speed, actor[sactor].y_speed, 400, 50,
2275 0, 0, 0, 0, cloud_colours);
2276
2277 }
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288 void fire_missile(int sactor)
2289 {
2290
2291 int colours [4] = {TRANS_LGREY, TRANS_DRED, TRANS_LRED, TRANS_YELLOW};
2292
2293 int btype = BULLET_MISSILE;
2294 int damage = 30; // misleading; the explosion changes this
2295 if (actor[sactor].upgraded_system [UPG_WARHEAD] > 0)
2296 {
2297 damage += actor[sactor].upgraded_system [UPG_WARHEAD] * 8;
2298 /* switch(actor[sactor].upgraded_system [UPG_WARHEAD])
2299 {
2300 default:
2301 case 0:
2302 colours [3] = TRANS_YELLOW;
2303 break;
2304 case 1:
2305 colours [3] = TRANS_LRED;
2306 break;
2307 case 2:
2308 colours [3] = TRANS_LBLUE;
2309 break;
2310 case 3:
2311 colours [3] = TRANS_DBLUE;
2312 break;
2313 case 4:
2314 colours [3] = TRANS_LGREEN;
2315 break;
2316 case 5:
2317 colours [3] = TRANS_PURPLE;
2318 break;
2319 }*/
2320 }
2321 /*
2322 UPG_WARHEAD,
2323 // increases missile damage
2324 // special: cluster warhead
2325 UPG_SEEKER,
2326 // makes missiles track nearest target, then increases turn rate
2327 // special:
2328 // 1. Dauntless (seekers don't explode when target does; acquire new one)
2329 // 2. Smart guidance - go for most important target
2330 // 3. Target Analysis - send only enough missiles to destroy; prefer weaker
2331 // targets if they'll be destroyed
2332 UPG_ROCKET,
2333 // increases missile acceleration, but not range by much
2334 // special: long range
2335 UPG_TUBES,
2336 // increases number of missiles
2337 // special: extra mini-missiles, ?random directions, not seeking
2338 */
2339 int timer = 45;// - actor[sactor].upgraded_system [UPG_ROCKET];
2340 int mass = 10;
2341 int status = 0;
2342 int speed = 1000;
2343 unsigned char seed = counter;
2344 int size = 0;
2345
2346 if (actor[sactor].angle == 0)
2347 actor[sactor].angle = 1; // I have no idea why this is necessary
2348
2349 int specials [7] = {0,6,1,5,2,4,3};
2350
2351
2352
2353 if (actor[sactor].bomb_status == 1)
2354 {
2355 specials [0] = 6;
2356 specials [1] = 0;
2357 specials [2] = 5;
2358 specials [3] = 1;
2359 specials [4] = 4;
2360 specials [5] = 2;
2361 specials [6] = 3;
2362 actor[sactor].bomb_status = 0;
2363 }
2364 else
2365 actor[sactor].bomb_status = 1;
2366
2367 switch(actor[sactor].upgraded_system [UPG_TUBES])
2368 {
2369 /* case 1:
2370 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2371 status, seed, speed, colours, 0);
2372 break;*/
2373 case 0:
2374 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2375 status, size, speed, colours, 1, specials [0]);
2376 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2377 status, size, speed, colours, -1, specials [1]);
2378 break;
2379 case 1:
2380 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2381 status, size, speed, colours, 1, specials [0]);
2382 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2383 status, size, speed, colours, -1, specials [1]);
2384 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2385 status, size, speed, colours, 0, specials [2]);
2386 break;
2387 case 2:
2388 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2389 status, seed, speed, colours, 2, specials [0]);
2390 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2391 status, seed, speed, colours, -2, specials [1]);
2392 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2393 status, seed, speed, colours, 1, specials [2]);
2394 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2395 status, seed, speed, colours, -1, specials [3]);
2396 break;
2397 case 3:
2398 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2399 status, seed, speed, colours, 0, specials [0]);
2400 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle + 16,
2401 status, seed, speed, colours, 2, specials [1]);
2402 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle - 16,
2403 status, seed, speed, colours, -2, specials [2]);
2404 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2405 status, seed, speed, colours, 1, specials [3]);
2406 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2407 status, seed, speed, colours, -1, specials [4]);
2408 break;
2409 /* case 4:
2410 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2411 status, seed, speed, colours, 0, specials [0]);
2412 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle + ANGLE_HALF,
2413 status, seed, speed, colours, 0, specials [1]);
2414 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle + 16,
2415 status, seed, speed, colours, 2, specials [2]);
2416 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle - 16,
2417 status, seed, speed, colours, -2, specials [3]);
2418 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2419 status, seed, speed, colours, 1, specials [4]);
2420 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2421 status, seed, speed, colours, -1, specials [5]);
2422 break;*/
2423 case 4:
2424 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle + 16,
2425 status, seed, speed, colours, 3, specials [0]);
2426 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle - 16,
2427 status, seed, speed, colours, -3, specials [1]);
2428 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2429 status, seed, speed, colours, 2, specials [2]);
2430 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2431 status, seed, speed, colours, -2, specials [3]);
2432 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2433 status, seed, speed, colours, 1, specials [4]);
2434 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2435 status, seed, speed, colours, -1, specials [5]);
2436 break;
2437 case 5:
2438 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2439 status, seed, speed, colours, 0, specials [0]);
2440 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle + 16,
2441 status, seed, speed, colours, 3, specials [1]);
2442 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle - 16,
2443 status, seed, speed, colours, -3, specials [2]);
2444 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2445 status, seed, speed, colours, 2, specials [3]);
2446 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2447 status, seed, speed, colours, -2, specials [4]);
2448 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2449 status, seed, speed, colours, 1, specials [5]);
2450 missile_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2451 status, seed, speed, colours, -1, specials [6]);
2452 break;
2453 }
2454 // cannon_shot(sactor, btype, damage, timer, mass, actor[sactor].angle,
2455 // status, seed, speed, colours, 1);
2456
2457 // actor_sound(sactor, ASOUND_TUBE);
2458
2459 }
2460
2461
2462
2463 void missile_shot(int sactor, int btype, int damage, int timer, int mass,
2464 int angle, int status, int seed, int speed, int colours [4], int displaced,
2465 int special5)
2466 {
2467
2468 int special1;
2469 int special2;
2470 int special3;
2471 int special4;
2472 special5 *= 3;
2473
2474 timer += grand(15);
2475
2476 speed += actor[sactor].upgraded_system [UPG_ROCKET] * 1000;
2477
2478 special1 = 200 + actor[sactor].upgraded_system [UPG_ROCKET] * 50;
2479
2480 int xs = actor[sactor].x_speed + xpart(angle - ANGLE_QUARTER, speed / 3);
2481 int ys = actor[sactor].y_speed + ypart(angle - ANGLE_QUARTER, speed / 3);
2482
2483 int x = actor[sactor].x;
2484 int y = actor[sactor].y;
2485
2486 if (displaced != 0)
2487 {
2488 // x += cos(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced))) * GRAIN * 3 * displaced;
2489 // y += sin(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced))) * GRAIN * 3 * displaced;
2490 x += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN * 5 * displaced);
2491 y += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN * 5 * displaced);
2492 xs += xpart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN / 8 * displaced);
2493 ys += ypart(angle - ANGLE_QUARTER + (ANGLE_QUARTER), GRAIN / 8 * displaced);
2494 }
2495
2496 special3 = -1;
2497
2498 if (actor[sactor].lock != -1)// && enemy[actor[sactor].lock].type != ENEMY_NONE)
2499 {
2500 if (actor[sactor].lock == LOCK_ACTOR0 && actor[0].in_play == 1)
2501 special3 = actor[sactor].lock;
2502 if (actor[sactor].lock == LOCK_ACTOR1 && actor[1].in_play == 1)
2503 special3 = actor[sactor].lock;
2504 if (actor[sactor].lock >= 0 && enemy[actor[sactor].lock].type != ENEMY_NONE)
2505 special3 = actor[sactor].lock;
2506 }
2507
2508 special4 = 32 + 16 * actor[sactor].upgraded_system [UPG_SEEKER];
2509
2510 if (angle == 0)
2511 angle = 1;
2512
2513 create_bullet(btype, x, y,
2514 xs, ys, sactor,
2515 damage, timer, mass, angle,
2516 status, seed, colours, 1, special1, special2, special3, special4, special5);
2517
2518
2519 }
2520
2521 void fire_bomb(int sactor)
2522 {
2523
2524 int colours [4] = {TRANS_LGREY, TRANS_DRED, TRANS_LRED, TRANS_YELLOW};
2525
2526
2527 // int btype = BULLET_BOMB;
2528 int damage = 50; // misleading; the explosion changes this
2529 if (actor[sactor].upgraded_system [UPG_BOMB] > 0)
2530 {
2531 damage += actor[sactor].upgraded_system [UPG_BOMB] * 25;
2532 }
2533 /*
2534 UPG_BOMB,
2535 // increases bomb damage
2536 // special: dispersion (explosion size)
2537 UPG_LAUNCHER,
2538 // adds more bombs (side-bombs are smaller)
2539 // special: cluster bombs (main one only?)
2540 UPG_LOADER,
2541 // increases bomb firing rate
2542 // special: long range
2543 */
2544 int timer = 30;// + actor[sactor].upgraded_system [UPG_ROCKET];
2545 int mass = 10;
2546 int status = 0;
2547 int speed = 6500;
2548 unsigned char seed = counter;
2549
2550 switch(actor[sactor].upgraded_system [UPG_LAUNCHER])
2551 {
2552 case 0:
2553 bomb_shot(sactor, BULLET_BOMB, damage, timer, mass, actor[sactor].angle,
2554 status, seed, speed, colours, 0);
2555 break;
2556 case 1:
2557 bomb_shot(sactor, BULLET_BOMB, damage, timer, mass, actor[sactor].angle,
2558 status, seed, speed, colours, 0);
2559 if (actor[sactor].bomb_status == 0)
2560 {
2561 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_1,
2562 status, seed, speed, colours, 0);
2563 actor[sactor].bomb_status = 1;
2564 } else
2565 {
2566 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_1,
2567 status, seed, speed, colours, 0);
2568 actor[sactor].bomb_status = 0;
2569 }
2570 break;
2571 case 2:
2572 bomb_shot(sactor, BULLET_BOMB, damage, timer, mass, actor[sactor].angle,
2573 status, seed, speed, colours, 0);
2574 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_1,
2575 status, seed, speed, colours, 0);
2576 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_1,
2577 status, seed, speed, colours, 0);
2578 break;
2579 case 3:
2580 bomb_shot(sactor, BULLET_BOMB, damage, timer, mass, actor[sactor].angle,
2581 status, seed, speed, colours, 0);
2582 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_1,
2583 status, seed, speed, colours, 0);
2584 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_1,
2585 status, seed, speed, colours, 0);
2586 if (actor[sactor].bomb_status == 0)
2587 {
2588 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_2,
2589 status, seed, speed, colours, 0);
2590 actor[sactor].bomb_status = 1;
2591 } else
2592 {
2593 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_2,
2594 status, seed, speed, colours, 0);
2595 actor[sactor].bomb_status = 0;
2596 }
2597
2598
2599 break;
2600 case 4:
2601 bomb_shot(sactor, BULLET_BOMB, damage, timer, mass, actor[sactor].angle,
2602 status, seed, speed, colours, 0);
2603 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_1,
2604 status, seed, speed, colours, 0);
2605 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_1,
2606 status, seed, speed, colours, 0);
2607 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_2,
2608 status, seed, speed, colours, 0);
2609 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_2,
2610 status, seed, speed, colours, 0);
2611 break;
2612 case 5:
2613 bomb_shot(sactor, BULLET_BOMB, damage, timer, mass, actor[sactor].angle,
2614 status, seed, speed, colours, 0);
2615 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_1,
2616 status, seed, speed, colours, 0);
2617 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_1,
2618 status, seed, speed, colours, 0);
2619 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle - BOMB_ANGLE_2,
2620 status, seed, speed, colours, 0);
2621 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + BOMB_ANGLE_2,
2622 status, seed, speed, colours, 0);
2623 bomb_shot(sactor, BULLET_BOMB_SIDE, damage, timer, mass, actor[sactor].angle + ANGLE_HALF,
2624 status, seed, speed, colours, 0);
2625 break;
2626 }
2627
2628 // actor_sound(sactor, ASOUND_BOMBS);
2629
2630
2631 }
2632
2633
2634
2635 void bomb_shot(int sactor, int btype, int damage, int timer, int mass,
2636 int angle, int status, int seed, int speed, int colours [4], int displaced)
2637 {
2638 int special1;
2639 int special2;
2640 int special3;
2641 int special4;
2642 int special5;
2643
2644 timer += grand(4);
2645
2646 // speed += actor[sactor].upgraded_system [UPG_ROCKET] * 1000;
2647
2648 /*
2649 UPG_BOMB,
2650 // increases bomb damage
2651 // special: dispersion (explosion size)
2652 UPG_LAUNCHER,
2653 // adds more bombs (side-bombs are smaller)
2654 // special: cluster bombs (main one only?)
2655 UPG_LOADER,
2656 // increases bomb firing rate
2657 // special: long range
2658 */
2659
2660 special1 = 30000 + actor[sactor].upgraded_system [UPG_BOMB] * 5000;
2661 // size of bomb's explosion
2662 if (btype == BULLET_BOMB_SIDE)
2663 {
2664 damage /= 2;
2665 special1 /= 2;
2666 }
2667
2668 special2 = 0;
2669 // int special1;
2670 // missiles: acceleration
2671 // bombs: explosion size
2672 // int special2;
2673 // missiles: number of clusters
2674 // bombs: number of clusters
2675
2676
2677 int xs = actor[sactor].x_speed + xpart(angle - ANGLE_QUARTER, speed / 3);
2678 int ys = actor[sactor].y_speed + ypart(angle - ANGLE_QUARTER, speed / 3);
2679
2680 int x = actor[sactor].x;
2681 int y = actor[sactor].y;
2682
2683 /* if (displaced != 0)
2684 {
2685 // x += cos(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced))) * GRAIN * 3 * displaced;
2686 // y += sin(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced))) * GRAIN * 3 * displaced;
2687 x += cos(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER))) * GRAIN * 5 * displaced;
2688 y += sin(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER))) * GRAIN * 5 * displaced;
2689 xs += cos(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER))) * GRAIN / 8 * displaced;
2690 ys += sin(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER))) * GRAIN / 8 * displaced;
2691 }*/
2692
2693 if (angle == 0)
2694 angle = 1;
2695
2696 create_bullet(btype, x, y,
2697 xs, ys, sactor,
2698 damage, timer, mass, angle,
2699 status, seed, colours, 1, special1, special2, special3, special4, special5);
2700
2701
2702 }
2703
2704
2705 /*
2706
2707 void fire_turret(int sactor)
2708 {
2709
2710 int colours [4] = {COLOUR_RED8, COLOUR_RED6, COLOUR_RED4, COLOUR_RED2};
2711
2712 int damage = 100;
2713 int timer = 11 + actor[sactor].upgraded_system [UPG_TURRET] * 2;
2714 int mass = 10;
2715 int status = 0;
2716 int speed = 22000;
2717 // unsigned char seed = counter;
2718
2719 // int target = closest_enemy(actor[sactor].x, actor[sactor].y, 100000 + actor[sactor].upgraded_system [UPG_TURRET], 1);
2720 int target = actor[sactor].turret_lock;
2721 int at;
2722
2723 int angle;
2724 int lead = 5;
2725
2726 int target_x;
2727 int target_y;
2728 int source_x;
2729 int source_y;
2730
2731
2732 if (target == LOCK_ACTOR0 || target == LOCK_ACTOR1)
2733 {
2734 if (target == LOCK_ACTOR0)
2735 at = 0;
2736 else
2737 at = 1;
2738
2739 lead = 5;
2740
2741 target_x = actor[at].x + actor[at].x_speed * lead;
2742 target_y = actor[at].y + actor[at].y_speed * lead;
2743 source_x = actor[sactor].x + actor[sactor].x_speed * lead;
2744 source_y = actor[sactor].y + actor[sactor].y_speed * lead;
2745
2746 angle = radians_to_angle(atan2(target_y - source_y,
2747 target_x - source_x));
2748
2749 }
2750 else
2751 {
2752
2753 if (target == -1 || enemy[target].type == ENEMY_NONE)
2754 {
2755 angle = actor[sactor].angle - ANGLE_QUARTER;
2756 }
2757 else
2758 {
2759
2760 lead = 5;
2761
2762 target_x = enemy[target].x + enemy[target].x_speed * lead;
2763 target_y = enemy[target].y + enemy[target].y_speed * lead;
2764 source_x = actor[sactor].x + actor[sactor].x_speed * lead;
2765 source_y = actor[sactor].y + actor[sactor].y_speed * lead;
2766
2767 // int angle = radians_to_angle(atan2(enemy[target].y - actor[sactor].y,
2768 // enemy[target].x - actor[sactor].x));
2769 angle = radians_to_angle(atan2(target_y - source_y,
2770 target_x - source_x));
2771 }
2772 }
2773
2774 // angle += (actor[sactor].upgraded_system [UPG_TURRET] * 3);
2775 // angle -= grand(actor[sactor].upgraded_system [UPG_TURRET] * 6);
2776 angle += 20;
2777 angle -= grand(40);
2778
2779 timer += grand(4);
2780
2781 int speed_div = 4;
2782
2783 speed += actor[sactor].upgraded_system [UPG_TURRET] * 800;
2784 speed_div -= actor[sactor].upgraded_system [UPG_TURRET] / 2;
2785
2786 int xs = actor[sactor].x_speed + xpart(angle, speed / 3);
2787 int ys = actor[sactor].y_speed + ypart(angle, speed / 3);
2788
2789 int x = actor[sactor].x;
2790 int y = actor[sactor].y;
2791
2792 if (angle == 0)
2793 angle = 1;
2794
2795 create_bullet(BULLET_ZAP, x, y,
2796 xs, ys, sactor,
2797 damage, timer, mass, angle,
2798 status, 0, colours, speed_div, 0, 0, 0, 0, 0);
2799
2800 // play_sound2(WAV_BLAT, 600, 155, 127);
2801
2802 int cloud_colours [5];
2803 cloud_colours [0] = colours [0];
2804
2805 x = actor[sactor].x + xpart(angle, 2000);
2806 y = actor[sactor].y + ypart(angle, 2000);
2807
2808 // if (displaced != 0)
2809 // {
2810 // x += cos(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced))) * GRAIN * 3;
2811 // y += sin(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER * displaced))) * GRAIN * 3;
2812 // }
2813
2814
2815 create_cloud(CLOUD_MED_CIRCLE, x, y, 0, 0,
2816 actor[sactor].x_speed, actor[sactor].y_speed, 300, 50,
2817 0, 0, 0, 0, cloud_colours);
2818
2819
2820 }
2821
2822
2823 void fire_heavy_cannon(int sactor)
2824 {
2825
2826 int colours [4] = {COLOUR_WHITE, COLOUR_GREY6, COLOUR_GREY4, COLOUR_GREY2};
2827 switch(actor[sactor].upgraded_system [UPG_HEAVY])
2828 {
2829 case 1:
2830 colours [3] = COLOUR_RED8;
2831 break;
2832 case 2:
2833 colours [3] = COLOUR_YELLOW8;
2834 break;
2835 case 3:
2836 colours [3] = COLOUR_GREEN8;
2837 break;
2838 case 4:
2839 colours [3] = COLOUR_BLUE8;
2840 break;
2841 case 5:
2842 colours [3] = COLOUR_WHITE;
2843 break;
2844 }
2845
2846
2847 int damage = 100 + 25 * actor[sactor].upgraded_system [UPG_HEAVY];
2848 int timer = 13;// + actor[sactor].upgraded_system [UPG_HEAVY];
2849 int mass = 10;
2850 int status = 0;
2851 int speed = 25000 + actor[sactor].upgraded_system [UPG_HEAVY] * 1000;
2852 unsigned char seed = counter;
2853
2854
2855 int angle = actor[sactor].angle - ANGLE_QUARTER;
2856
2857 timer += grand(3);
2858
2859 int speed_div = 4;
2860
2861 // speed += actor[sactor].upgraded_system [UPG_HEAVY] * 1000;
2862 speed_div -= actor[sactor].upgraded_system [UPG_HEAVY] / 2;
2863
2864 int xs = actor[sactor].x_speed + xpart(angle, speed / 3);
2865 int ys = actor[sactor].y_speed + ypart(angle, speed / 3);
2866
2867 int x, y;
2868
2869 if (angle == 0)
2870 angle = 1;
2871
2872 int cloud_colours [5];
2873 cloud_colours [0] = colours [0];
2874
2875 // x = actor[sactor].x + cos(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER))) * GRAIN * 30;
2876 // y = actor[sactor].y + sin(angle_to_radians(angle - ANGLE_QUARTER + (ANGLE_QUARTER))) * GRAIN * 30;
2877 x = actor[sactor].x + xpart(angle - ANGLE_QUARTER, GRAIN * 5);
2878 y = actor[sactor].y + ypart(angle - ANGLE_QUARTER, GRAIN * 5);
2879
2880 create_bullet(BULLET_POWERED, x, y,
2881 xs, ys, sactor,
2882 damage, timer, mass, angle,
2883 status, seed, colours, speed_div, 0, 0, 0, 0, 0);
2884
2885 x = actor[sactor].x + xpart(angle, 3000);
2886 y = actor[sactor].y + ypart(angle, 3000);
2887 x += xpart(angle - ANGLE_QUARTER, GRAIN * 3);
2888 y += ypart(angle - ANGLE_QUARTER, GRAIN * 3);
2889 create_cloud(CLOUD_MED_CIRCLE, x, y, 0, 0,
2890 actor[sactor].x_speed, actor[sactor].y_speed, 300, 50,
2891 0, 0, 0, 0, cloud_colours);
2892
2893 x = actor[sactor].x + xpart(angle + ANGLE_QUARTER, GRAIN * 5); // * must be twice above because we need to counteract it
2894 y = actor[sactor].y + ypart(angle + ANGLE_QUARTER, GRAIN * 5);
2895
2896 create_bullet(BULLET_POWERED, x, y,
2897 xs, ys, sactor,
2898 damage, timer, mass, angle,
2899 status, seed, colours, speed_div, 0, 0, 0, 0, 0);
2900
2901 // actor_sound(sactor, ASOUND_BLAT);
2902
2903 x = actor[sactor].x + xpart(angle, 3000);
2904 y = actor[sactor].y + ypart(angle, 3000);
2905 x += xpart(angle + ANGLE_QUARTER, GRAIN * 3);
2906 y += ypart(angle + ANGLE_QUARTER, GRAIN * 3);
2907 create_cloud(CLOUD_MED_CIRCLE, x, y, 0, 0,
2908 actor[sactor].x_speed, actor[sactor].y_speed, 300, 50,
2909 0, 0, 0, 0, cloud_colours);
2910
2911
2912 }
2913
2914 void fire_backfire(int sactor)
2915 {
2916
2917 int colours [4] = {COLOUR_GREEN8, COLOUR_GREEN6, COLOUR_GREEN4, COLOUR_GREEN2};
2918
2919 int damage = 100;
2920 int timer = 14;
2921 int mass = 10;
2922 int status = 0;
2923 int speed = 29000;
2924 unsigned char seed = counter;
2925
2926 int angle = actor[sactor].angle + ANGLE_QUARTER;
2927
2928 timer += grand(4);
2929
2930 int speed_div = 4;
2931
2932 int xs;// = actor[sactor].x_speed + cos(angle_to_radians(angle)) * speed / 3;
2933 int ys;// = actor[sactor].y_speed + sin(angle_to_radians(angle)) * speed / 3;
2934
2935 int x = actor[sactor].x;
2936 int y = actor[sactor].y;
2937
2938 if (angle == 0)
2939 angle = 1;
2940
2941 // x = actor[sactor].x + cos(angle_to_radians(angle - ANGLE_QUARTER)) * GRAIN * 5;
2942 // y = actor[sactor].y + sin(angle_to_radians(angle - ANGLE_QUARTER)) * GRAIN * 5;
2943
2944 int i;
2945 int multiple = 1 + actor[sactor].upgraded_system [UPG_BACKFIRE];
2946
2947 int angle_inc = ANGLE_1_SIXTEENTH;
2948
2949 angle -= angle_inc * (multiple / 2) + 1;
2950
2951 if (multiple % 2 == 0)
2952 angle += ANGLE_1_SIXTEENTH / 2;
2953
2954 int cloud_colours [5];
2955 cloud_colours [0] = colours [0];
2956
2957 int x2, y2;
2958
2959 for (i = 0; i < multiple; i ++)
2960 {
2961 // angle = grand(1000);
2962
2963 xs = actor[sactor].x_speed + xpart(angle, speed / 3);
2964 ys = actor[sactor].y_speed + ypart(angle, speed / 3);
2965
2966 create_bullet(BULLET_ZAP, x, y,
2967 xs, ys, sactor,
2968 damage, timer, mass, angle,
2969 status, seed, colours, speed_div, 0, 0, 0, 0, 0);
2970
2971 x2 = actor[sactor].x + xpart(angle, 2000);
2972 y2 = actor[sactor].y + ypart(angle, 2000);
2973
2974 // x2 += cos(angle_to_radians(angle)) * GRAIN * 3;
2975 // y2 += sin(angle_to_radians(angle)) * GRAIN * 3;
2976
2977 create_cloud(CLOUD_MED_CIRCLE, x2, y2, 0, 0,
2978 actor[sactor].x_speed, actor[sactor].y_speed, 300, 50,
2979 0, 0, 0, 0, cloud_colours);
2980
2981 angle += angle_inc;
2982
2983 }
2984 play_sound2(WAV_BLAT, 400, 155, 127);
2985
2986 }
2987
2988 void fire_sidekicks(int a)
2989 {
2990
2991 if (actor[a].sidekick_recycle > 0)
2992 return;
2993
2994 int colours [4] = {COLOUR_RED8, COLOUR_RED6, COLOUR_RED4, COLOUR_RED2};
2995 // int colours [4] = {COLOUR_YELLOW8, COLOUR_YELLOW6, COLOUR_YELLOW4, COLOUR_YELLOW2};
2996 int damage = 100;
2997 int timer = 14;
2998 int mass = 10;
2999 int status = 0;
3000 int speed = 29000;
3001 unsigned char seed = counter;
3002 int i;
3003 int angle;
3004 int speed_div = 2;
3005 int xs;// = actor[sactor].x_speed + cos(angle_to_radians(angle)) * speed / 3;
3006 int ys;// = actor[sactor].y_speed + sin(angle_to_radians(angle)) * speed / 3;
3007 int x;// = actor[a].sidekick_x [i];
3008 int y;// = actor[a].sidekick_y [i];
3009 int btype = BULLET_ZAP;
3010 timer += grand(4);
3011
3012 switch(actor[a].upgraded_system [UPG_SIDEKICK])
3013 {
3014 case 2:
3015 case 3:
3016 damage = 125;
3017 btype = BULLET_POWERED;
3018 colours [3] = COLOUR_RED8;
3019 break;
3020 case 4:
3021 damage = 150;
3022 btype = BULLET_POWERED;
3023 colours [3] = COLOUR_YELLOW8;
3024 break;
3025 case 5:
3026 damage = 175;
3027 btype = BULLET_POWERED;
3028 colours [3] = COLOUR_GREEN8;
3029 break;
3030 }
3031
3032 int cloud_colours [5];
3033
3034 cloud_colours [0] = COLOUR_ORANGE8;
3035
3036 for (i = 0; i < actor[a].sidekicks; i ++)
3037 {
3038
3039 x = actor[a].sidekick_x [i];
3040 y = actor[a].sidekick_y [i];
3041
3042 angle = actor[a].sidekick_angle [i];
3043
3044 if (angle == 0)
3045 angle = 1;
3046
3047 xs = actor[a].sidekick_x_speed [i] + xpart(angle, speed / 3);
3048 ys = actor[a].sidekick_y_speed [i] + ypart(angle, speed / 3);
3049
3050 create_bullet(btype, x, y,
3051 xs, ys, a,
3052 damage, timer, mass, angle,
3053 status, seed, colours, speed_div, 0, 0, 0, 0, 0);
3054
3055 x = x + xpart(angle, 4000);
3056 y = y + ypart(angle, 4000);
3057
3058 create_cloud(CLOUD_MED_CIRCLE, x, y, 0, 0,
3059 actor[a].sidekick_x_speed [i], actor[a].sidekick_y_speed [i], 300, 50,
3060 0, 0, 0, 0, cloud_colours);
3061
3062 }
3063
3064 play_sound2(WAV_BLAT, 500, 155, 127);
3065
3066
3067 }
3068
3069 */
3070 /*
3071 void upgrade_sidekicks(int a)
3072 {
3073 int old_number = actor[a].sidekicks;
3074
3075 switch(actor[a].upgraded_system [UPG_SIDEKICK])
3076 {
3077 case 1:
3078 case 2:
3079 actor[a].sidekicks = 2;
3080 break;
3081 default:
3082 actor[a].sidekicks = 4;
3083 break;
3084 }
3085
3086 int i;
3087
3088 if (actor[a].sidekicks > old_number)
3089 {
3090 simple_cloud_trans(TRANS_LBLUE, actor[a].x, actor[a].y, 0, 0, 500);
3091 for (i = old_number; i < actor[a].sidekicks; i ++)
3092 {
3093 actor[a].sidekick_x [i] = actor[a].x;
3094 actor[a].sidekick_y [i] = actor[a].y;
3095 actor[a].sidekick_x_speed [i] = actor[a].x_speed;
3096 actor[a].sidekick_y_speed [i] = actor[a].y_speed;
3097 actor[a].sidekick_angle [i] = actor[a].angle;
3098 }
3099 }
3100
3101 }
3102 */
3103 /*
3104 void actor_sound(int a, int sound)
3105 {
3106
3107 switch(sound)
3108 {
3109 case ASOUND_CANNON:
3110 play_sound2(WAV_CANNON, 1000 + actor[a].upgraded_system [UPG_AUTOFIRE] * 200, 155 + actor[a].upgraded_system [UPG_POWER] * 20, 127);
3111 break;
3112 case ASOUND_BOMBS:
3113 play_sound2(WAV_BOMBS, 1000 - actor[a].upgraded_system [UPG_BOMB] * 70, 155 + actor[a].upgraded_system [UPG_LAUNCHER] * 20, 127);
3114 break;
3115 case ASOUND_BLAT:
3116 play_sound2(WAV_BLAT, 400 - actor[a].upgraded_system [UPG_HEAVY] * 20, 155, 127);
3117 break;
3118 case ASOUND_TUBE:
3119 play_sound2(WAV_TUBE, 1000 + actor[a].upgraded_system [UPG_ROCKET] * 100 + actor[a].upgraded_system [UPG_LOADER] * 50, 155, 127);
3120 break;
3121 // play_sound(sample);
3122 }
3123
3124 }
3125
3126 */
3127
3128
3129 void make_drive_sound(int a, int drive)
3130 {
3131
3132 if (actor[a].drive_sound [drive] == 0)
3133 {
3134 // play_sound2(WAV_ENGINE, 1000 + actor[a].upgraded_system [UPG_SPEED] * 50, 100, 127);
3135 play_wavf(NWAV_DRIVE, 1000 - (actor[a].ability [ABILITY_DRIVE] [SYMBOL_SQUARE] * 30) - (actor[a].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 5));
3136 actor[a].drive_sound [DRIVE_THRUST] = 2;
3137
3138 /* switch(drive)
3139 {
3140 case DRIVE_THRUST:
3141 play_sound2(WAV_ENGINE, 1000 + actor[a].upgraded_system [UPG_SPEED] * 50, 100, 127);
3142 actor[a].drive_sound [DRIVE_THRUST] = 10 - actor[a].upgraded_system [UPG_SPEED] - (actor[a].upgraded_system [UPG_SPEED] == 5);
3143 break;
3144 case DRIVE_SLIDE:
3145 play_sound2(WAV_ENGINE, 1000 + actor[a].upgraded_system [UPG_SLIDE] * 50, 100, 127);
3146 actor[a].drive_sound [DRIVE_SLIDE] = 10 - actor[a].upgraded_system [UPG_SLIDE];
3147 break;
3148 case DRIVE_RETRO:
3149 play_sound2(WAV_ENGINE, 1000 + actor[a].upgraded_system [UPG_RETRO] * 50, 100, 127);
3150 actor[a].drive_sound [DRIVE_RETRO] = 10 - actor[a].upgraded_system [UPG_RETRO];
3151 break;
3152 }*/
3153 }
3154
3155 }
3156
3157
0 void enact_commands(void);
1 void continue_secondary_burst(int a);
2
0 //Platform:
1
2 //#define OVERGOD_DOS
3
4 #ifdef ALLEGRO_WINDOWS
5 #define OVERGOD_WINDOWS
6 #endif
7
8 #if defined (ALLEGRO_LINUX) || defined(ALLEGRO_UNIX)
9 #define OVERGOD_LINUX
10 #endif
11
12 #ifdef ALLEGRO_MACOSX
13 #define OVERGOD_MAC
14 #endif
15
16
17 //#define SANITY_CHECK
18
19
20 #define NO_CLOUDS 1000
21 #define NO_ACTORS 25
22 #define NO_BULLETS 1000
23 #define NO_PLAYERS 2
24 #define GRAIN 1000
25 //#define NO_CMDS 12
26 #define NO_STARS 100
27 #define NO_PICKUPS 20
28
29 #define MAX_SCORE 9999999
30 #define GRID_WIDTH 50
31
32 #define NO_WEAPONS 2
33 #define NO_SHIP_TYPES 17
34
35 #define NO_SYSTEM_TYPES 3
36
37 #define NO_UPGRADES 9
38
39 #define FULL_UPGRADE 5
40
41 #define NO_ENEMY_ATTRIBUTES 10
42 #define NO_ENEMIES 40
43 #define MAX_TURRETS 4
44 //#define NO_ENEMY_TYPES 50
45
46 #define ANGLE_FULL_HEX 0x400
47 #define ANGLE_FULL 1024
48 #define ANGLE_HALF 512
49 #define ANGLE_QUARTER 256
50 #define ANGLE_1_EIGHTH 128
51 #define ANGLE_1_SIXTEENTH 64
52 #define ANGLE_3_EIGHTHS 384
53 #define ANGLE_3_SIXTEENTHS 192
54 #define ANGLE_1_32 32
55 #define ANGLE_TO_FIXED 4
56
57 #define OWNER_ENEMY -1
58
59 #define ATTACK_NONE -1
60
61 #define MAX_EYES 8
62
63 #ifndef PI
64 #define PI 3.141592
65 #endif
66
67 #define ARMOUR_UPGRADE 200
68
69
70 struct armoury
71 {
72 char *name;
73 int type;
74 int speed;
75 int timeout;
76 int damage;
77 int mass;
78
79 };
80
81 enum
82 {
83 TARGET_PRIMARY, // need to kill to advance
84 TARGET_NO, // turrets etc
85 TARGET_EXTRA,
86 TARGET_CRAWLY // crawlies...
87 };
88
89 enum
90 {
91 CMD_THRUST,
92 CMD_LEFT,
93 CMD_RIGHT,
94 CMD_FIRE1,
95 CMD_FIRE2,
96 CMD_BRAKE,
97 CMD_LEFT1,
98 CMD_RIGHT1,
99 CMD_UPGRADE,
100 CMD_LINK,
101 NO_CMDS
102 };
103
104 enum
105 {
106 GAME_SINGLE,
107 GAME_COOP,
108 GAME_DUEL,
109 GAME_TIME_ATTACK,
110 GAME_TIME_ATTACK_COOP
111 };
112
113 enum
114 {
115 SECONDARY_NONE,
116 SECONDARY_MISSILE,
117 SECONDARY_BOMB
118 };
119
120 enum
121 {
122 ACTORTYPE_NONE,
123 ACTORTYPE_SHIP,
124 ACTORTYPE_REDSHIP
125
126 };
127
128 /*
129 SHIPS:
130
131 Pointy: extra-damage darts
132 Horseshoe: Fast secondary recycle
133 round: armour self-repairs
134 Retro: retro-rocket instead of drag field
135 small: smaller collision radius
136 fins: backfire
137 large rear wings: orbital
138 curve: bounces off enemies (ram)
139 */
140
141 enum
142 {
143 SHIP_POINTY,
144 SHIP_HORSESHOE,
145 SHIP_ROUND,
146 SHIP_RETRO,
147 SHIP_SMALL,
148 SHIP_FINS,
149 SHIP_ORBITAL,
150 SHIP_CURVE
151
152 /*SHIP_LACEWING,
153 SHIP_CAPYBARA,
154 SHIP_DESPOT,
155 SHIP_HOOKWORM,
156 SHIP_LENTIL,
157 SHIP_PORKUPINE,
158 SHIP_PRONG,
159 SHIP_SCORPION,
160 SHIP_TORTFEASOR,
161 SHIP_AETHER,
162 SHIP_RUMSFELD,
163 SHIP_GODBOTHERER,
164 SHIP_BOTULUS,
165 SHIP_SLIDEWINDER,
166 SHIP_DOOM*/
167
168 };
169
170 /*
171
172 Ships:
173
174 Lacewing - pointy: fighter
175 Aether Squid - spiny: multifire
176 Lentil - rounded: heavy bomber
177 Rumsfeld's Delight - triangle: silly
178 Hookworm - small round wing: many homing missiles
179 Tortfeasor - 2 prongs: light bomber (+ slide)
180 False Scorpion: - bracketed: agile
181 Porkupine - large round wing: multi missiles
182
183 Despot - wide lacewing - just 2 homing missiles
184 Capybara - blobby - medium bomber
185 Prong - pointy2 - super cannons
186
187 Godbotherer - fat triangle - heavy fighter - multi, autof, heavy cannons, tubes?
188 Botulus - backwards curve - fast rocketed missiles - rocket, loader, multi, power,
189 Slidewinder - three triangles - fast seeker missiles - seek, loader, auto, slide
190 Doom Fork - two prongs forwards - drifter - auto, power, rocket, whead
191
192 */
193
194 /*
195 Aether Squid
196 Lentil
197 */
198
199 enum
200 {
201 PICKUP_NONE,
202 PICKUP_REPAIR,
203 PICKUP_GRACE,
204 PICKUP_SHIP,
205 PICKUP_SQUARE,
206 PICKUP_CIRCLE,
207 PICKUP_TRIANGLE,
208 PICKUP_PRESYMBOL,
209 PICKUP_SECONDARY,
210 PICKUP_PRESECONDARY
211 };
212
213 enum
214 {
215 SYMBOL_SQUARE,
216 SYMBOL_CIRCLE,
217 SYMBOL_TRIANGLE,
218 SYMBOL_CROSS
219 };
220
221 #define SYMBOL_TIMEOUT 64
222
223 enum
224 {
225 ABILITY_PRIMARY,
226 ABILITY_DRIVE,
227 ABILITY_SECONDARY,
228 ABILITY_DEFENCE
229 };
230
231 enum
232 {
233 SUBTYPE_NONE, // for creepy-crawlies
234 SUBTYPE_GREEN,
235 SUBTYPE_YELLOW,
236 SUBTYPE_ORANGE,
237 SUBTYPE_RED,
238 SUBTYPE_BLUE,
239 SUBTYPE_PURPLE,
240 SUBTYPE_WHITE
241 };
242
243
244 enum
245 {
246 FIGHTER_ATTACK,
247 FIGHTER_MOVE,
248 BEE_RESTING
249 };
250
251 enum
252 {
253 BULLET_NONE,
254 BULLET_ZAP,
255 BULLET_POWERED,
256 BULLET_MISSILE,
257 BULLET_MISSILE_MINI,
258 BULLET_BOMB,
259 BULLET_BOMB_SIDE,
260 BULLET_BOMBLET, // also used for cluster missiles
261 BULLET_STING,
262 BULLET_HOSTILE,
263 BULLET_PREMINE,
264 BULLET_MINE,
265 BULLET_BLUE_BLOB,
266 BULLET_RED_BLOB,
267 BULLET_YELLOW_BLOB,
268 BULLET_ORANGE_BLOB,
269 BULLET_SEEKER_BLOB,
270 BULLET_PLASMA,
271 BULLET_PRESEEKMINE,
272 BULLET_SEEKMINE,
273 BULLET_SEEKER_BLOB2,
274 BULLET_LINES,
275 BULLET_CURVE,
276 BULLET_PRONG,
277 BULLET_ORBITAL,
278 BULLET_FLAK,
279 BULLET_SEEKER_BLOB3,
280 BULLET_ZZZ_BOLT,
281 BULLET_TORPEDO,
282 BULLET_SUPERSTING,
283 BULLET_NICE_ORBITAL,
284 BULLET_STING2,
285 BULLET_PURPLE_BLOB,
286 BULLET_BOSS4,
287 BULLET_TORPEDO2,
288
289 BULLET_BALL1,
290 BULLET_BALL2,
291
292 BULLET_WOODEN_DART,
293 BULLET_ICE_DART,
294 BULLET_SILVER_TOOTH,
295 BULLET_SNOW_DART,
296 BULLET_FROZEN_BREATH,
297 BULLET_SHOCK_PATH,
298 BULLET_BRASS_TOOTH,
299 BULLET_CRYSTAL_TOOTH,
300 BULLET_GOLDEN_NEEDLE,
301 BULLET_PARTICLE_SPITTER,
302 BULLET_CRYSTAL_SPINE,
303 BULLET_GOLDEN_PATH,
304 BULLET_NUMEROUS_DART,
305 BULLET_NUMEROUS_BLADE,
306 BULLET_FAR_SPITTER,
307 //BULLET_ICE_TOOTH,
308 BULLET_BURNING_SPIRIT,
309
310 BULLET_WOODEN_DART_SMALL,
311 BULLET_ICE_DART_SMALL,
312 BULLET_SILVER_TOOTH_SMALL,
313 BULLET_SNOW_DART_SMALL,
314 BULLET_BRASS_TOOTH_SMALL,
315 BULLET_SHOCK_PATH_SMALL,
316 BULLET_GOLDEN_PATH_SMALL,
317 BULLET_GOLDEN_NEEDLE_SMALL,
318
319 BULLET_FURIOUS_ORB,
320 BULLET_BURNING_EYE,
321 BULLET_LARVA_NEST,
322 BULLET_MANIFOLD_ORB,
323 BULLET_EYE_DESOLATION,
324 BULLET_TERROR_EEL,
325 BULLET_PANIC_EEL,
326 BULLET_WORM_SORROW,
327 BULLET_WORM_AGONY,
328 BULLET_FROZEN_STAR,
329 BULLET_FROZEN_TOOTH,
330 BULLET_ORB_RECTIFICATION,
331
332 BULLET_FURIOUS_ORB_SMALL,
333 BULLET_BURNING_EYE_SMALL,
334 BULLET_EYE_DESOLATION_SMALL,
335 BULLET_LARVA_NEST_SMALL,
336 BULLET_MANIFOLD_ORB_SMALL,
337
338 BULLET_GREEN_BLAT,
339 BULLET_EVIL_EEL,
340 BULLET_YELLOW_PULSE,
341 BULLET_CIRCLES,
342 BULLET_SHOCK,
343 BULLET_SQUIRMY,
344 BULLET_BURST,
345 BULLET_BURNING_DRAGGED,
346 BULLET_SEEKER1,
347 BULLET_SEEKER2,
348 BULLET_SEEKER3,
349 BULLET_SEEKER4,
350 BULLET_BLUE_BLAT,
351 BULLET_BLAST,
352 BULLET_E_BOMB,
353 BULLET_E_BOMB2,
354 BULLET_TWIRLY1,
355 BULLET_TWIRLY2,
356 BULLET_WINGS1,
357 BULLET_WINGS2,
358 BULLET_WINGS3,
359 BULLET_BLOCKS,
360 BULLET_THICK_SHOCK,
361 BULLET_WORM_BOMB,
362 BULLET_CIRCLES2,
363 BULLET_EVIL_WORM,
364 BULLET_FORK1,
365 BULLET_FORK2,
366 BULLET_FORK3,
367 BULLET_MINE1,
368 BULLET_MINE2,
369 BULLET_MINE3,
370 BULLET_MINE4,
371 BULLET_BOLT,
372 BULLET_CIRCLER,
373 BULLET_YELLOW_BLAT,
374 BULLET_BFLAK,
375 BULLET_YELLOW_FLAK,
376 BULLET_PUFFY3,
377 BULLET_PUFFY4,
378 BULLET_EVIL_STAR,
379 BULLET_PULSE1,
380 BULLET_PULSE2,
381 BULLET_TOXIC_SUN,
382 BULLET_TOXIC_FLARE,
383
384 BULLET_FLOWER,
385 BULLET_PETAL1,
386 BULLET_PETAL2,
387 BULLET_BIGBALL1,
388 BULLET_BIGSEEKER,
389 BULLET_BIGWINGS1,
390 BULLET_BIGWINGS2,
391 BULLET_BIGWINGS3,
392 BULLET_BIGCIRCLES,
393 BULLET_ORBIT,
394 BULLET_ATTRACTOR_LINE,
395 BULLET_DISRUPT1,
396 BULLET_DISRUPT1_DROP,
397 BULLET_DISRUPT2,
398 BULLET_DISRUPT3,
399 BULLET_SPORE,
400 BULLET_FLOWER2,
401 BULLET_TRI1,
402 BULLET_TRI2,
403 BULLET_TRI3,
404 BULLET_OVERTRI,
405 BULLET_CLAW,
406 BULLET_TURN_WORM,
407 BULLET_ZAP_DRAG,
408 BULLET_JET,
409 BULLET_TWISTY,
410 BULLET_TWIRLY3,
411 BULLET_CHARGE_LINE,
412 BULLET_CHARGE,
413 BULLET_OVERPULSE,
414 BULLET_SLIVER,
415 BULLET_NOVA,
416 BULLET_HOLE,
417 BULLET_HOLE_LINE,
418 BULLET_ZIGZAG1,
419 BULLET_MBOMB,
420 BULLET_CRYSTAL1,
421 BULLET_CRYSTAL2,
422 BULLET_SWIRL1,
423 BULLET_SWIRL2,
424 BULLET_BFLAK2,
425 BULLET_CURVEY,
426 BULLET_LINE_PULSE,
427 BULLET_OVERBLOCKS,
428 BULLET_ZIGZAG2,
429 BULLET_FLAME
430 };
431
432 enum
433 {
434 WEAPON_WOODEN_DARTS,
435 WEAPON_SNOW_DARTS,
436 WEAPON_SILVER_TEETH,
437 WEAPON_ICE_DARTS,
438 WEAPON_FROZEN_BREATH,
439 WEAPON_BRASS_TEETH,
440 WEAPON_SHOCK_PATH,
441 WEAPON_CRYSTAL_TEETH,
442 WEAPON_GOLDEN_NEEDLES,
443 WEAPON_PARTICLE_SPITTER,
444 WEAPON_CRYSTAL_SPINES,
445 WEAPON_GOLDEN_PATH,
446 WEAPON_NUMEROUS_DARTS,
447 WEAPON_NUMEROUS_BLADES,
448 WEAPON_FAR_SPITTER,
449 WEAPON_BURNING_SPIRIT
450 };
451
452 enum
453 {
454 WPN_DARTS, // like wooden darts
455 WPN_BURST, // like numerous darts (all equal)
456 WPN_SPINES, // high-speed
457 WPN_TEETH // long-range
458
459 };
460
461 enum
462 {
463 SECOND_NONE,
464 SECOND_FURIOUS_ORB,
465 SECOND_BURNING_EYE,
466 SECOND_LARVA_NEST,
467 SECOND_MANIFOLD_ORB,
468 SECOND_EYE_DESOLATION,
469 SECOND_TERROR_EELS,
470 SECOND_PANIC_EELS,
471 SECOND_WORMS_SORROW,
472 SECOND_WORMS_AGONY,
473 SECOND_FROZEN_STARS,
474 SECOND_FROZEN_TEETH,
475 SECOND_TOXIC_SUN,
476 SECOND_FLOWER,
477 SECOND_SPORES,
478 SECOND_CLAWS,
479 TOTAL_SECONDS
480 };
481
482
483 enum
484 {
485 ENEMY_NONE,
486 ENEMY_GUARDIAN1,
487 ENEMY_PUFFER1,
488 ENEMY_BRACKET1,
489 ENEMY_WORMER1,
490 ENEMY_HEAD1,
491 ENEMY_HEAD1_EYE1,
492 ENEMY_HEAD1_EYE2,
493 ENEMY_HEAD1_EYE3,
494 ENEMY_PUFFER2,
495 ENEMY_SPINNER1,
496 ENEMY_SPINNER2,
497 ENEMY_SPINNER3,
498 ENEMY_SPINNER4,
499 ENEMY_SPINNER5,
500 ENEMY_BRACKET2,
501 ENEMY_BRACKET3,
502 ENEMY_BRACKET4,
503 ENEMY_BRACKET4_TURRET,
504 ENEMY_FIGHTER1,
505 ENEMY_FIGHTER2,
506 ENEMY_FIGHTER3,
507 ENEMY_FIGHTER4,
508 ENEMY_FIGHTER5,
509 ENEMY_BOMBER1,
510 ENEMY_BOMBER2,
511 ENEMY_BOMBER3,
512 ENEMY_CRUISER1,
513 ENEMY_CRUISER1_TURRET,
514 ENEMY_GUARDIAN2,
515 ENEMY_GUARDIAN3,
516 ENEMY_SPIKEY1,
517 ENEMY_SPIKEY2,
518 ENEMY_SPIKEY3,
519 ENEMY_SPIKEY4,
520 ENEMY_SPIKEY5,
521 ENEMY_WORMER2,
522 ENEMY_WORMER3,
523 ENEMY_FORKER1,
524 ENEMY_FORKER2,
525 ENEMY_MINER1,
526 ENEMY_MINER2,
527 ENEMY_MINER3,
528 ENEMY_MINER3_TURRET,
529 ENEMY_CRUISER2,
530 ENEMY_CRUISER2_TURRET,
531 ENEMY_CRUISER3,
532 ENEMY_CRUISER3_TURRET,
533 ENEMY_CRUISER4,
534 ENEMY_CRUISER4_TURRET,
535 ENEMY_BOSS1_1,
536 ENEMY_BOSS1_2,
537 ENEMY_BOSS1_3,
538 ENEMY_BOSS1_TURRET1,
539 ENEMY_BOSS1_TURRET2,
540 ENEMY_BOSS1_TURRET3,
541 ENEMY_CIRCLER1,
542 ENEMY_BLATTER1,
543 ENEMY_BLATTER2,
544 ENEMY_BLATTER3,
545 ENEMY_BLATTER4,
546 ENEMY_BLATTER5,
547 ENEMY_MINEFIELDER1,
548 ENEMY_BLOATER1,
549 ENEMY_BLOATER2,
550 ENEMY_BOSS2,
551 ENEMY_BOSS2_TURRET1,
552 ENEMY_BOSS2_TURRET2,
553 ENEMY_BOSS2_TURRET3,
554 ENEMY_BOSS2_TURRET4,
555 ENEMY_SHIELDER1,
556 ENEMY_PUFFER3,
557 ENEMY_PUFFER4,
558 ENEMY_PULSER1,
559 ENEMY_PULSER2,
560 ENEMY_ZAPPER1,
561 ENEMY_MULTI1,
562 ENEMY_MULTI2,
563 ENEMY_MULTI3,
564 ENEMY_DEFENDER1,
565 ENEMY_DEFENDER1_TURRET1,
566 ENEMY_DEFENDER1_TURRET2,
567 ENEMY_DEFENDER1_TURRET3,
568 ENEMY_OVERSPINNER,
569 ENEMY_OVERSPIKEY,
570 ENEMY_UNDERSPIKEY,
571 ENEMY_OVERBLATTER,
572 ENEMY_DEFENDER2,
573 ENEMY_DEFENDER2_TURRET1,
574 ENEMY_DEFENDER2_TURRET2,
575 ENEMY_DEFENDER2_TURRET3,
576 ENEMY_DEFENDER3,
577 ENEMY_DEFENDER3_TURRET1,
578 ENEMY_DEFENDER3_TURRET2,
579 ENEMY_DEFENDER3_TURRET3,
580 ENEMY_DEFENDER3_TURRET4,
581 ENEMY_DEFENDER3_TURRET5,
582 ENEMY_DEFENDER3_TURRET6,
583 ENEMY_ORBITER1,
584 ENEMY_ORBITER2,
585 ENEMY_ORBITER3,
586 ENEMY_ATTRACTOR,
587 ENEMY_DISRUPTER1,
588 ENEMY_DISRUPTER2,
589 ENEMY_DISRUPTER3,
590 ENEMY_TRIANGLER1,
591 ENEMY_TRIANGLER2,
592 ENEMY_TRIANGLER3,
593 ENEMY_OVERTRIANGLER,
594 ENEMY_OVERTRIANGLER_TURRET,
595 ENEMY_LEAPER1,
596 ENEMY_LEAPER2,
597 ENEMY_WORMER4,
598 ENEMY_BEAMER1,
599 ENEMY_BEAMER2,
600 ENEMY_OVERBLATTER2,
601 ENEMY_OVERDISRUPTER,
602 ENEMY_GUARDIAN4,
603 ENEMY_GUARDIAN5,
604 ENEMY_OVERZAPPER,
605 ENEMY_BRACKET5,
606 ENEMY_BOSS2_2,
607 ENEMY_BOSS2_3,
608 ENEMY_BOSS3_1,
609 ENEMY_BOSS3_2,
610 ENEMY_BOSS3_3,
611 ENEMY_MESSENGER,
612 ENEMY_SHADOW1,
613 ENEMY_SHADOW2,
614 ENEMY_BOSS3_TURRET1,
615 ENEMY_BOSS3_TURRET2,
616 ENEMY_BOSS3_TURRET3,
617 ENEMY_WAVER1,
618 ENEMY_WAVER2,
619 ENEMY_CURVE1,
620 ENEMY_CURVE2,
621 ENEMY_CURVE3,
622 ENEMY_UNDERSPIKEY2,
623 ENEMY_UNDERSPIKEY3,
624 ENEMY_OVERSPIKEY2,
625 ENEMY_DEAD_TRI1,
626 ENEMY_DEAD_TRI2,
627 ENEMY_DEAD_TRI3,
628 /*
629 ENEMY_BOSS3,
630 ENEMY_BOSS3_TURRET1,
631 ENEMY_BOSS3_TURRET2,
632 ENEMY_BOSS3_TURRET3,
633 ENEMY_BOSS3_TURRET4,*/
634 NO_ENEMY_TYPES
635 };
636 // can't have entries above without eclass entries or the whole world will collapse
637
638 enum
639 {
640 AI_NONE,
641 AI_DRIFTER, // chooses a random location and goes there, then chooses another. etc
642 AI_STINGER, // darts randomly around
643 AI_PERIODIC_STINGER, // darts around at specified intervals
644 AI_TURRET, // just sits there and rotates
645 AI_FIGHTER, // turns to face target and flies by, then chooses a random dest, then returns
646 AI_BOMBER, // a lot like fighter
647 AI_CRUISER, // like drifter, but turns to face direction moved
648 AI_AUTO, // orbitals
649 AI_LEAPER, // cross between fighter and periodic stinger
650 AI_FOLLOWER, // like drifter, but destination is player's location at the time
651 AI_BEAMER // drifter, but special firing code
652 };
653
654 enum
655 {
656 ROLE_TARGET,
657 ROLE_TURRET,
658 ROLE_EXTRA,
659 ROLE_DEAD,
660 ROLE_BOSS,
661 ROLE_MINIBOSS,
662 };
663
664 enum
665 {
666 WPN_NONE,
667 WPN_ZAPPER
668 };
669
670 enum
671 {
672 SYST_NONE,
673 SYST_WPN_ZAPPER
674 };
675
676 enum
677 {
678 BRAKES_NONE,
679 BRAKES_RETRO,
680 BRAKES_DRAG
681 };
682
683 enum
684 {
685 SHIELD_NONE,
686 SHIELD_LOWFREQ,
687 SHIELD_MEDIUMFREQ,
688 SHIELD_HIGHFREQ
689 };
690
691 enum
692 {
693 SLIDE_NO,
694 SLIDE_YES
695 };
696
697 enum
698 {
699 CLOUD_NONE,
700 CLOUD_SPECK,
701 CLOUD_TRAIL1,
702 CLOUD_SMALL_CIRCLE,
703 CLOUD_SMALL_TRANS_CIRCLE,
704 CLOUD_MED_CIRCLE,
705 CLOUD_MED_TRANS_CIRCLE,
706 CLOUD_LARGE_CIRCLE,
707 CLOUD_LARGE_TRANS_CIRCLE,
708 CLOUD_FADING_LINE,
709 CLOUD_SHRINKING_LINE,
710 CLOUD_SHOCKWAVE,
711 CLOUD_BURSTLET,
712 CLOUD_GROWING_CIRCLE,
713 CLOUD_LINE_SHADOW,
714 CLOUD_SHRINKING_CIRCLE,
715 CLOUD_SPAWNER,
716 CLOUD_LIGHT,
717 CLOUD_BANG,
718 CLOUD_BLUE_BLOB,
719 CLOUD_BLUE_BLOB2,
720 CLOUD_FLECK,
721 CLOUD_SMALL_FADING_CIRCLE,
722 CLOUD_ORANGE_BLOB,
723 CLOUD_ORANGE_BLOB2,
724 CLOUD_GREEN_BLOB,
725 CLOUD_GREEN_BLOB2,
726 CLOUD_LARGE_FADING_CIRCLE,
727 CLOUD_TRANS_FADING_CIRCLE,
728 CLOUD_BLAST_CIRCLE,
729 CLOUD_MED_TRANS_FADING_CIRCLE,
730 CLOUD_SMALL_SHRINKING_CIRCLE,
731 CLOUD_BLOCK1,
732 CLOUD_BLOCK2,
733 CLOUD_BLOCK3,
734 CLOUD_BLOCK4,
735 CLOUD_THICK_SHOCK_CIRCLE,
736 CLOUD_CIRCLER_IN,
737 CLOUD_FLAK_BURST,
738 CLOUD_SHIELD_LINE,
739 CLOUD_SQUAREY,
740 CLOUD_PULSER1_V,
741 CLOUD_PULSER1_H,
742 CLOUD_PULSER2_V,
743 CLOUD_PULSER2_H,
744 CLOUD_SEEKER_CIRCLE,
745 CLOUD_ATTRACT,
746 CLOUD_TRANS_FADING_LINE,
747 CLOUD_DRIVE_CIRCLE,
748 CLOUD_LARGE_TRANS_FADING_CIRCLE,
749 CLOUD_BIG_BLAST_CIRCLE,
750 CLOUD_DISTORT,
751 CLOUD_JET_CIRCLE1,
752 CLOUD_JET_CIRCLE2,
753 CLOUD_TWISTY_CIRCLE,
754 CLOUD_TWIRLY_CIRCLE,
755 CLOUD_SHATTER1,
756 CLOUD_SHATTER2,
757 CLOUD_BLOCK5,
758 CLOUD_TRI1, // not used
759 CLOUD_TRI2,
760 CLOUD_TRI3,
761 CLOUD_OVERTRI, // to here.
762 CLOUD_FLAME_CIRCLE,
763 CLOUD_SHRINKING_FADING_CIRCLE
764
765
766 //CLOUD_BLUE_BLOB,
767 //CLOUD_BLUE_BLOB2
768
769
770
771 };
772
773 enum
774 {
775 BANG_NONE,
776 BANG_RED,
777 BANG_ORANGE,
778 BANG_YELLOW,
779 BANG_BLUE,
780 BANG_GREEN,
781 BANG_GREY
782 };
783
784 enum
785 {
786 UPG_NONE,
787 UPG_SPEED,
788 // increases speed + turning
789 // special: aerodynamics (may not be a benefit, really)
790 UPG_ARMOUR,
791 // increases armour
792 // special: shield, then increase shield
793 UPG_POWER,
794 // increases cannon damage
795 // special: plasma bolt
796 UPG_AUTOFIRE,
797 // increases cannon fire rate + scatter
798 // special: sidekick
799 UPG_MULTIFIRE,
800 // increases: cannon shot spread
801 // special: backwards fire
802 UPG_PROJECT,
803 // increases cannon speed + range
804 // special: lightning bolt
805 UPG_WARHEAD,
806 // increases missile damage
807 // special: cluster warhead
808 UPG_SEEKER,
809 // makes missiles track nearest target, then increases turn rate
810 // special:
811 // 1. Dauntless (seekers don't explode when target does; acquire new one)
812 // 2. Smart guidance - go for most important target
813 // 3. Target Analysis - send only enough missiles to destroy; prefer weaker
814 // targets if they'll be destroyed
815 UPG_ROCKET,
816 // increases missile acceleration, but not range by much
817 // special: long range
818 UPG_TUBES,
819 // increases number of missiles
820 // special: extra mini-missiles, ?random directions, not seeking
821 UPG_SLIDE,
822 // gives, then increases, slide rockets
823 // special: retro rockets (replaces drag field)
824 UPG_BOMB,
825 // increases bomb damage
826 // special: dispersion (explosion size)
827 UPG_LAUNCHER,
828 // adds more bombs (side-bombs are smaller)
829 // special: cluster bombs (main one only?)
830 UPG_LOADER,
831 // increases missile firing rate
832
833 UPG_SPECIAL,
834
835 UPG_TURRET,
836
837 UPG_SIDEKICK,
838
839 UPG_HEAVY,
840
841 UPG_ORBITAL,
842
843 UPG_BACKFIRE,
844
845 UPG_SHIELD,
846
847 UPG_RETRO,
848
849 UPG_ROAMER,
850
851 UPG_MINIMISSILES,
852
853 UPG_DRIFT,
854
855 /*
856 REMEMBER: When adding something which upgrades a secondary weapon,
857 must make sure that the secondary weapon is switched on when the upgrade
858 is gained.
859 */
860
861 MAX_UPGRADES
862 };
863
864
865 enum
866 {
867 DRIVE_THRUST,
868 DRIVE_SLIDE,
869 DRIVE_RETRO
870
871 };
872
873 enum
874 {
875 DUEL_10_POINTS,
876 DUEL_30_POINTS,
877 DUEL_3_MINUTES,
878 DUEL_10_MINUTES
879 };
880
881 #define LOCK_ACTOR0 -3
882 #define LOCK_ACTOR1 -2
883
884 /*
885 enum
886 {
887 SPECIAL_SHIELD,
888 SPECIAL_
889 };
890 */
891 struct optionstruct
892 {
893 int sound_init; // if 0, sound isn't initialised at all. Changed in config file only.
894 int sound_mode; // mono, stereo, reversed, off
895 int run_vsync; // on or off
896 int sound_volume; // sound fx volume; if 0 sound effects not played
897 int ambience_volume; // if 0 ambience not played
898 int resolution;
899 int unlock_purple;
900 int unlock_void;
901 int unlock_god;
902 int colour_text;
903 };
904
905 struct starstruct
906 {
907 int colour [2];
908 int x [2];
909 int y [2];
910 char distance [2];
911
912 };
913
914 struct gamestruct
915 {
916 int users;
917 int type;
918 int duel_mode;
919 int duel_crawlies;
920 int duel_handicap [2];
921 int duel_level;
922 int duel_leader_handicap;
923 int duel_winner;
924 int symbols_given; // ta and duel
925 int ta_enemies [15];
926 int ta_extra_list [15];
927 int ta_symbol_count;
928 long ta_total_time; // probably doesn't need to be long
929 int ta_level;
930 int ta_enemy_index;
931 int single_player;
932 int ships_left;
933 float drag;
934 int mode_purple;
935 int mode_void;
936 int mode_god;
937 };
938
939 struct arenastruct
940 {
941 int max_x;
942 int max_y;
943 int level;
944 int colour1;
945 int colour2;
946 int colour3;
947 int next_target;
948 // int target [3];
949 // int targets_left [3];
950
951 int enemy_list [50];
952 int symbol_list [50];
953 int list_index;
954 int symbol_index;
955 int total_targets;
956 int targets_left_total;
957 int next_target_upgrade;
958 int max_targets_in_level;
959 int battle_type;
960
961 int next_non_target;
962 int max_non_targets_in_level;
963
964 int time_left;
965 int level_finished;
966 int seconds_left_when_finished;
967 int time_bonus;
968 int game_over;
969 int new_level_sign;
970
971 int max_crawlies_in_level;
972 int next_crawly;
973 int next_crawly_upgrade;
974 int crawlies_created;
975
976 int between_target_upgrades;
977 int between_crawly_upgrades;
978
979 int hostile;
980
981 int eye_x [MAX_EYES];
982 int eye_y [MAX_EYES];
983 int eye_recycle [MAX_EYES];
984 int eye_angle [MAX_EYES];
985 int eye_colour1;
986 int eye_colour2;
987 int eye_colour3;
988 int eyes_on_level;
989
990 int waver_on_level;
991 };
992
993 #define ENEMY_LIST_END -1
994 #define ENEMY_LIST_WAIT -2
995 #define ENEMY_LIST_EMPTY -3
996
997 enum
998 {
999 BATTLE_NORMAL,
1000 BATTLE_BOSS,
1001 BATTLE_VARIOUS
1002 };
1003
1004 struct playerstruct
1005 {
1006 int actor_controlled;
1007 int user;
1008 // int ships_left;
1009 char player_cmd [NO_CMDS];
1010 char link_fire;
1011 int link_toggle_delay;
1012
1013 int ship;
1014 int score;
1015
1016 int duel_score;
1017
1018 int keys [NO_CMDS];
1019
1020 int screen_shake_x;
1021 int screen_shake_y;
1022 // _time is in actor
1023 };
1024
1025
1026 struct actorstruct
1027 {
1028 int x, y, x_speed, y_speed, angle, base_angle;
1029 int moving_angle; // the angle at which it's moving. Set in drag_actor,
1030 // so may not be very reliable but is good enough for friction burn and
1031 // ai routines etc.
1032
1033 int type;
1034 int ship;
1035 int controller;
1036 char actor_cmd [NO_CMDS];
1037 int drag_amount; // amount that actor is accelerated by drag
1038 int radius;
1039 int edge_radius;
1040 char in_play;
1041
1042 int turning;
1043 int thrust;
1044 int slide;
1045 int mass;
1046 int recharge;
1047
1048 int armour;
1049 int max_armour;
1050
1051 int upgrade_slot;
1052 int upgrades [NO_UPGRADES]; // referred to by slot
1053 int upgrade_specials [NO_UPGRADES];
1054 int upgrade_structure [NO_UPGRADES];
1055 int upgraded_system [MAX_UPGRADES]; // referred to by UPG_ index
1056 int just_upgraded;
1057 int just_upgraded_timeout;
1058 int shield_pulse;
1059 int recycle1;
1060 int recycle2;
1061 int cannon_status;
1062 int bomb_status;
1063 int shield;
1064 int max_shield;
1065 int shield_recharge;
1066 /* int shield_type;
1067 int shield_strength1;
1068 int shield_strength2;
1069 int shield_pulse;
1070 int shield_angle;
1071 int system [3];
1072 int system_status1 [3];
1073 int system_status2 [3];
1074 int max_energy;
1075 int energy;*/
1076 int brakes;
1077 int brake_strength;
1078 char dragging; // is 1 if drag field active
1079 int just_collided;
1080 int spawn_delay;
1081 int grace_period;
1082 int repairing;
1083 int secondary_weapon;
1084
1085 int seek_x;
1086 int seek_y;
1087 int lock;
1088 int new_lock;
1089
1090 int sidekick_x [5];
1091 int sidekick_y [5];
1092 int sidekick_x_speed [5];
1093 int sidekick_y_speed [5];
1094 int sidekick_angle [5];
1095 int sidekick_recycle;
1096 int sidekicks;
1097
1098 int turret_lock;
1099 int turret_recycle;
1100
1101 int heavy_recycle;
1102
1103 int backfire_recycle;
1104
1105 int exhaust_distance_x;
1106 int exhaust_distance_y;
1107 // int exhaust_displacement;
1108 int retro_distance_x;
1109 int retro_distance_y;
1110 // int retro_displacement;
1111 int slide_distance_x;
1112 int slide_distance_y;
1113 // int slide_displacement;
1114 int flash_distance;
1115
1116 int engine_demand;
1117
1118 int orbital_angle;
1119 int orbital_spin;
1120
1121 int hurt_pulse;
1122
1123 int drive_sound [3];
1124
1125 int ability [4] [4];
1126
1127 int primary;
1128 int secondary;
1129
1130 int secondary_burst;
1131 int secondary_burst_recycle;
1132
1133 int screen_shake_time;
1134 // shake_x/_y are in player
1135
1136 int total_power;
1137 int next_spawn_x;
1138 int next_spawn_y;
1139 };
1140
1141 enum
1142 {
1143 PRIMARY_WOODEN_DARTS,
1144 PRIMARY_ICE_DARTS,
1145 PRIMARY_SILVER_TEETH,
1146 PRIMARY_SNOW_DARTS,
1147 PRIMARY_FROZEN_BREATH,
1148 PRIMARY_BRONZE_DARTS,
1149 PRIMARY_BRASS_TEETH,
1150 PRIMARY_CRYSTAL_TEETH,
1151 PRIMARY_GOLDEN_NEEDLES,
1152 PRIMARY_PARTICLE_SPIT,
1153 PRIMARY_CRYSTAL_SPINES,
1154 PRIMARY_GOLDEN_TEETH
1155 };
1156
1157 struct bulletstruct
1158 {
1159 int x, y, x_speed, y_speed;
1160 int x2, y2;
1161 int type;
1162 int owner;
1163 int timeout;
1164 int size;
1165 int damage;
1166 int left_owner;
1167 int mass;
1168 int angle;
1169 int colours [4];
1170 int special1;
1171 // missiles: acceleration
1172 // bombs: explosion size
1173 // enemy seeker blobs: actor target
1174 // enemy prong: spin direction (applied in display.c)
1175 int special2;
1176 // missiles: number of clusters
1177 // bombs: number of clusters
1178 int special3;
1179 // missiles: seeker target
1180 int special4;
1181 // missiles: seeker turn rate
1182 int special5;
1183 // missiles: seeker guidance system
1184
1185 };
1186
1187
1188 struct cloudstruct
1189 {
1190 int x, y, x_speed, y_speed;
1191 int x2, y2;
1192 int type;
1193 unsigned char seed;
1194 int angle;
1195 int timeout;
1196 int tickrate;
1197 int delta_tickrate;
1198 int status;
1199 int colour [5];
1200 };
1201
1202 struct pickupstruct
1203 {
1204 int x, y, x_speed, y_speed;
1205 int counter;
1206 int type;
1207 int subtype;
1208 int timeout;
1209 int radius;
1210 };
1211
1212 struct enemystruct
1213 {
1214
1215 int x, y, x_speed, y_speed, angle, base_angle;
1216 int moving_angle;
1217 int type;
1218 int subtype;
1219 int attacking; // which actor is it attacking (-1 for none)
1220 int drag_amount; // amount that enemy is accelerated by drag
1221 char drag_affected; // is it affected by drag?
1222 int radius;
1223 int edge_radius;
1224 int recycle;
1225 // char in_play;
1226 int armour;
1227 int hurt_pulse;
1228 int shield;
1229 int max_shield;
1230 int attribute [NO_ENEMY_ATTRIBUTES];
1231 int colours [3];
1232 int hurt_pulse_colour1;
1233 int hurt_pulse_colour2;
1234 unsigned char counter;
1235 int just_collided;
1236 int mass;
1237 int carrying_pickup;
1238 int burst_fire;
1239 int target;
1240 int turret [MAX_TURRETS];
1241 int turret_main; // whose turret it it?
1242 int turret_index; // which turret is it?
1243 int x_dest;
1244 int y_dest;
1245 int slew_dir;
1246 int next_impulse;
1247 int ta_time_left; // time attack - time before it warps out
1248 };
1249
1250 struct enemy_classification
1251 {
1252 int max_armour;
1253 int level;
1254 int common;
1255 int score;
1256 int radius; // for hit calculation
1257 int edge_radius; // for edge-of-map collision
1258 float drag_amount;
1259 int mass;
1260 // int default_attributes [NO_ENEMY_ATTRIBUTES];
1261 int ai_type;
1262 int generous;
1263 int colour1;
1264 int colour2;
1265 int turrets;
1266 int pitch; // sound effects - hit and explodes
1267 int acceleration;
1268 int impulse_delay;
1269 int range;
1270 int slew;
1271 int role;
1272 };
1273
1274
1275
1276 enum
1277 {
1278 PITCH_GUARDIAN,
1279 PITCH_FIGHTER,
1280 PITCH_SMALL_SPINNER,
1281 PITCH_LARGE_SPINNER,
1282 PITCH_HEAVY_SPINNER,
1283 PITCH_BOSS1,
1284 PITCH_BOSS2,
1285 PITCH_BOSS3,
1286 PITCH_MINIBOSS1,
1287 PITCH_MINIBOSS2,
1288 PITCH_TURRET1,
1289 PITCH_TURRET2,
1290 PITCH_BRACKET,
1291 PITCH_MEDIUM,
1292 PITCH_HEAVY
1293 };
1294
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: displ_in.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - bitmap loading and preparation
30 The bitmaps aren't organised into a datafile because I find datafiles a bit
31 unwieldy.
32
33 */
34
35 #include "allegro.h"
36
37 #include <math.h>
38
39 #include "config.h"
40 #include "globvars.h"
41
42 //#include "stuff.h"
43
44 #include "display.h"
45
46 #include "palette.h"
47 #include "tile.h"
48
49 //#define FIX_FONT
50
51 extern int debug_info;
52
53
54 extern BITMAP *player1;
55 extern BITMAP *player2;
56
57 extern BITMAP *ship_bitmaps [NO_SHIP_TYPES] [17];
58
59 extern BITMAP *gb_ship_bitmaps [GB_SHIP_TYPES] [17];
60
61
62 /*
63 White (lines only)
64 Blue
65 Green
66 Amber
67 Red
68 */
69 extern RLE_SPRITE *large_ships [16] [5];
70
71 extern BITMAP *enemy1_bmp [ENEMY1_BMPS];
72
73 extern RLE_SPRITE *enemy1_rle [ENEMY1_RLES];
74 extern RLE_SPRITE *enemy2_rle [ENEMY2_RLES];
75 extern RLE_SPRITE *enemy3_rle [ENEMY3_RLES];
76
77 extern BITMAP *enemy_bmps [ENEMY_BMPS];
78
79 extern RLE_SPRITE *enemy4_rle [ENEMY4_RLES];
80 extern RLE_SPRITE *enemy5_rle [ENEMY5_RLES];
81 extern RLE_SPRITE *enemy6_rle [ENEMY6_RLES];
82 extern RLE_SPRITE *enemy7_rle [ENEMY7_RLES];
83 extern RLE_SPRITE *enemy8_rle [ENEMY8_RLES];
84 extern RLE_SPRITE *enemy9_rle [ENEMY9_RLES];
85
86 extern RLE_SPRITE *small1_rle [SMALL1_RLES];
87 extern RLE_SPRITE *small3_rle [SMALL3_RLES];
88 extern BITMAP *small4_bmp [SMALL4_BMPS];
89 extern BITMAP *small2_bmp [SMALL2_BMPS];
90 extern BITMAP *superjelly_bmp [2];
91 extern BITMAP *pretile_bmp [NO_PRETILE_BMPS];
92 extern BITMAP *pretile_m_bmp [NO_MAZES] [NO_PRETILE_M_BMPS];
93 extern BITMAP *redbang_bmp [50];
94 extern RLE_SPRITE *light_rle [100];
95 extern BITMAP *shield_bmp [SHIELD_BMPS];
96 extern RLE_SPRITE *tile_background;
97
98 void bitmap_error(const char errtxt []);
99
100 void make_rle_enemy1(BITMAP *source_bmp, int which_enemy, int width, int height);
101 void make_rle_enemy2(BITMAP *source_bmp, int which_enemy, int width, int height);
102 void make_rle_enemy3(BITMAP *source_bmp, int which_enemy, int width, int height);
103 void make_rle_enemy4(BITMAP *source_bmp, int which_enemy, int width, int height);
104 void make_rle_enemy5(BITMAP *source_bmp, int which_enemy, int width, int height);
105 void make_rle_small1(BITMAP *source_bmp, int which_small, int width, int height);
106 void make_rle_small3(BITMAP *source_bmp, int which_small, int width, int height);
107 void make_bmp_small2(BITMAP *source_bmp, int which_small, int width, int height);
108 void make_bmp_small4(BITMAP *source_bmp, int which_small, int width, int height);
109 void make_rle_enemy6(BITMAP *source_bmp, int which_enemy, int width, int height);
110 void make_rle_enemy7(BITMAP *source_bmp, int which_enemy, int width, int height);
111 void make_rle_enemy8(BITMAP *source_bmp, int which_enemy, int width, int height);
112 void make_rle_enemy9(BITMAP *source_bmp, int which_enemy, int width, int height);
113 void make_rle_large_ship(BITMAP *source_bmp, int which_ship);
114 void make_bmp_enemy(BITMAP *source_bmp, int which_enemy, int width, int height);
115 //void make_superjelly_bmps(void);
116 void make_bang_bmps(void);
117 void make_light_bmps(void);
118 void make_bmp_tiles(void);
119
120 void make_actor_sprites(int at);
121 void progress_update(const char progtxt []);
122
123 extern FONT *font2;
124 extern FONT *small_font;
125 extern BITMAP *level_bmp;
126 extern BITMAP *distortion_mask;
127 extern BITMAP *crystal_bmp;
128 extern RGB light_palet [256];
129 extern RLE_SPRITE *waver1_circle;
130 extern RLE_SPRITE *waver2_circle;
131
132
133 void init_display(void)
134 {
135 debug_info = 0;
136
137 player1 = NULL;
138 player2 = NULL;
139
140 level_bmp = NULL;
141 RGB temp_palette2 [1024]; // these seem to serve as a buffer against strange random corruptions of temp_palette. I don't understand this at all.
142 RGB temp_palette [256];
143 RGB temp_palette3 [1024];
144
145 DATAFILE *datf = load_datafile("gfx//data.dat");
146 if (datf == NULL)
147 {
148 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
149 allegro_message("Error: Couldn't find data.dat! \n");
150 allegro_message("\n\r");
151 exit(1);
152 }
153
154 //progress_update("Data.dat loaded");
155
156 font = (FONT *)datf[1].dat;
157 font2 = (FONT *)datf[0].dat;
158 small_font = (FONT *)datf[2].dat;
159
160 // text_mode(-1);
161 progress_update("Data.dat");
162 textprintf_centre_ex(screen, font2, 300, 100, COLOUR_YELLOW8, -1, "{__loading__");
163 textprintf_centre_ex(screen, font, 300, 100, -1, -1, "{__loading__");
164 rectfill(screen, 390, 117, 450, 118, COLOUR_YELLOW8);
165
166 //rest(1000);
167
168 BITMAP *temp_bitmap = load_bitmap("gfx//gb_si.bmp", temp_palette);
169 if (temp_bitmap == NULL)
170 {
171 bitmap_error("temp_bitmap (ships)");
172 }
173
174 BITMAP *temp_bitmap2 = create_bitmap(24, 22);
175 if (temp_bitmap2 == NULL)
176 {
177 bitmap_error("temp_bitmap2 (ships)");
178 }
179
180 // blit(temp_bitmap, temp_bitmap2, 1, 1, 0, 0, 11, 11);
181 // blit(temp_bitmap, temp_bitmap2, 15, 1, 0, 0, 13, 13);
182
183 int i;
184 int j;
185 int k;
186 int l;
187 int m;
188
189
190 for (i = 0; i < 528; i ++)
191 {
192 for (j = 0; j < 249; j ++)
193 {
194 if (getpixel(temp_bitmap, i, j) == 17)
195 // || getpixel(temp_bitmap, i, j) == 17)
196 continue;
197 m = 0;
198 for (k = -1; k < 2; k ++)
199 {
200 for (l = -1; l < 2; l ++)
201 {
202 if (k == 0 && l == 0)
203 continue;
204 if (getpixel(temp_bitmap, i + k, j + l) != 0
205 && getpixel(temp_bitmap, i + k, j + l) != 17
206 && getpixel(temp_bitmap, i + k, j + l) != COLOUR_GREY2)
207 m ++;
208 }
209 }
210 if (getpixel(temp_bitmap, i, j) == 0)
211 {
212 if (m > 0)
213 putpixel(temp_bitmap, i, j, COLOUR_GREY2);
214 }
215 else
216 {
217 if (getpixel(temp_bitmap, i, j) == 2)
218 putpixel(temp_bitmap, i, j, COLOUR_GREY6);
219 else
220 putpixel(temp_bitmap, i, j, COLOUR_GREY5);
221 }
222
223 /* else
224 {
225 if (getpixel(temp_bitmap, i, j) == 2)
226 putpixel(temp_bitmap, i, j, COLOUR_GREY6);
227 else
228 putpixel(temp_bitmap, i, j, COLOUR_GREY5);
229 } */
230 }
231 }
232
233 progress_update("Vehicles");
234
235 /*
236
237 for (i = 0; i < 528; i ++)
238 {
239 for (j = 0; j < 249; j ++)
240 {
241 if (getpixel(temp_bitmap, i, j) == 0
242 || getpixel(temp_bitmap, i, j) == 17)
243 continue;
244 m = 0;
245 for (k = -1; k < 2; k ++)
246 {
247 for (l = -1; l < 2; l ++)
248 {
249 if (k == 0 && l == 0)
250 continue;
251 if (getpixel(temp_bitmap, i + k, j + l) == 0)
252 m ++;
253 }
254 }
255 if (m > 1)
256 putpixel(temp_bitmap, i, j, COLOUR_GREY3);
257 else
258 {
259 if (getpixel(temp_bitmap, i, j) == 2)
260 putpixel(temp_bitmap, i, j, COLOUR_GREY6);
261 else
262 putpixel(temp_bitmap, i, j, COLOUR_GREY5);
263 }
264 }
265 }
266
267 */
268 for (i = 0; i < GB_SHIP_TYPES; i ++)
269 {
270 /* blit(temp_bitmap, temp_bitmap2, (i * 14) + 1, 1, 0, 0, 13, 13);
271 for (j = 0; j < 17; j ++)
272 {
273 ship_bitmaps [i] [j] = create_bitmap(13, 13);
274 if (ship_bitmaps [i] [j] == NULL)
275 {
276 bitmap_error("Ship bitmaps 0");
277 }
278 clear_bitmap(ship_bitmaps [i] [j]);
279 blit(temp_bitmap, ship_bitmaps [i] [j], (j * 14) + 1, (i * 14) + 1, 0,0,13,13);*/
280 // if (FALSE)//i != 11)// && i != 1 && i != 3 && i != 4 && FALSE)
281 // if (i != 12 && i != 13 && i != 14 && i != 15)
282 {
283 for (j = 0; j < 17; j ++)
284 {
285 gb_ship_bitmaps [i] [j] = create_bitmap(24, 22);
286 if (gb_ship_bitmaps [i] [j] == NULL)
287 {
288 bitmap_error("Ship bitmaps 0");
289 }
290 clear_bitmap(gb_ship_bitmaps [i] [j]);
291 blit(temp_bitmap, gb_ship_bitmaps [i] [j], (j * 31) + 1, (i * 31) + 1, 0,0,24,22);
292 }
293 }
294 // else
295 // make_actor_sprites(i);
296 // rotate_sprite(ship_bitmaps [i] [j], temp_bitmap2, 0, 0, itofix(j * 4));
297 }
298
299 // save_bitmap("outsh.bmp",
300
301 /* blit(temp_bitmap, temp_bitmap2, 15, 1, 0, 0, 13, 13);
302
303 for (i = 0; i < 17; i ++)
304 {
305 ship_bitmaps [1] [i] = create_bitmap(13, 13);
306 if (ship_bitmaps [1] [i] == NULL)
307 {
308 bitmap_error("Ship bitmaps 0");
309 }
310 clear_bitmap(ship_bitmaps [1] [i]);
311 rotate_sprite(ship_bitmaps [1] [i], temp_bitmap2, 0, 0, itofix(i * 4));
312 }
313
314 blit(temp_bitmap, temp_bitmap2, 10, 1, 0, 0, 8, 8);
315 */
316 destroy_bitmap(temp_bitmap);
317 destroy_bitmap(temp_bitmap2);
318 progress_update("More Vehicles");
319
320 #ifdef FIX_FONT
321
322 RGB font_palette [256];
323 // BITMAP *fbmp = load_bitmap("gfx//font_cel.bmp", font_palette);
324 BITMAP *fbmp = load_bitmap("gfx//font_oc.bmp", font_palette);
325 if (temp_bitmap == NULL)
326 {
327 bitmap_error("temp_bitmap (font_cel)");
328 }
329
330 // int k;
331
332 for (i = 0; i < 1000; i ++)
333 {
334 for (j = 0; j < 1000; j ++)
335 {
336 k = getpixel(fbmp, i, j);
337 // if (k >= GC_BLACK && k <= GC_BLUE8)
338 // k += 48;
339 // if (k >= COLOUR_GREY2 && k <= COLOUR_WHITE)
340 // k = COLOUR_GREY4;
341 if (k == 111)
342 k = COLOUR_GREY4;
343 if (k == 110)
344 k = COLOUR_GREY1;
345 putpixel(fbmp, i, j, k);
346 /* switch(getpixel(fbmp, i, j))
347 {
348 case 110: putpixel(fbmp, i, j, GC_GREY1); break;
349 case 111: putpixel(fbmp, i, j, GC_GREY6); break;
350 case 28: putpixel(fbmp, i, j, GC_GREY6); break;
351 case 26: putpixel(fbmp, i, j, GC_GREY6); break;
352 case 24: putpixel(fbmp, i, j, GC_GREY6); break;
353 }*/
354 }
355 }
356 /*
357 for (i = 0; i < 1000; i ++)
358 {
359 for (j = 0; j < 1000; j ++)
360 {
361 if (getpixel(temp_bitmap, i, j) == 255)
362 continue;
363 for (k = -1; k < 2; k ++)
364 {
365 for (l = -1; l < 2; l ++)
366 {
367 if (k == 0 && l == 0)
368 continue;
369 if (getpixel(temp_bitmap, i + k, j + l) != 0
370 && getpixel(temp_bitmap, i + k, j + l) != 255
371 && getpixel(temp_bitmap, i + k, j + l) != COLOUR_GREY2)
372 m ++;
373 }
374 }
375 if (getpixel(temp_bitmap, i, j) == 0)
376 {
377 if (m > 0)
378 putpixel(temp_bitmap, i, j, COLOUR_GREY2);
379 }
380 else
381 {
382 if (getpixel(temp_bitmap, i, j) == 2)
383 putpixel(temp_bitmap, i, j, COLOUR_GREY6);
384 else
385 putpixel(temp_bitmap, i, j, COLOUR_GREY5);
386 }
387
388 */
389 save_bitmap("font_oc.bmp", fbmp, font_palette);
390
391
392 #endif
393
394 #ifdef GENERATE_SHIPS
395
396
397 temp_bitmap = load_bitmap("gfx//gb_ship.bmp", temp_palette);
398 if (temp_bitmap == NULL)
399 {
400 bitmap_error("gb_ship");
401 }
402
403 temp_bitmap2 = create_bitmap(24, 22);
404 if (temp_bitmap2 == NULL)
405 {
406 bitmap_error("temp_bitmap2 (gb_ships)");
407 }
408
409 blit(temp_bitmap, temp_bitmap2, 1, 1, 0, 0, 24, 24);
410 // blit(temp_bitmap, temp_bitmap2, 15, 1, 0, 0, 13, 13);
411
412 // int i;
413 // int j;
414
415 progress_update("Vehicles");
416
417 for (i = 0; i < GB_SHIP_TYPES; i ++)
418 {
419 blit(temp_bitmap, temp_bitmap2, (i * 31) + 1, 1, 0, 0, 24, 24);
420 for (j = 0; j < 17; j ++)
421 {
422 gb_ship_bitmaps [i] [j] = create_bitmap(24, 24);
423 if (gb_ship_bitmaps [i] [j] == NULL)
424 {
425 bitmap_error("Gb_ship bitmaps");
426 }
427 clear_bitmap(gb_ship_bitmaps [i] [j]);
428 rotate_sprite(gb_ship_bitmaps [i] [j], temp_bitmap2, 0, 0, itofix(j * 4.15));
429 }
430 }
431 destroy_bitmap(temp_bitmap);
432 destroy_bitmap(temp_bitmap2);
433
434
435
436
437
438 progress_update("More Vehicles");
439
440 // Let's make the output ship bitmap:
441
442 BITMAP *outp = create_bitmap((17 * 31) + 1, (17 * 31) + 1);
443 if (outp == NULL)
444 {
445 bitmap_error("Output");
446 }
447 clear_bitmap(outp);
448
449 for (i = 0; i < GB_SHIP_TYPES; i ++)
450 {
451 for (j = 0; j < 17; j ++)
452 {
453 hline(outp, 0, i * 31, 18 * 32 + 1, COLOUR_PURPLE8);
454 vline(outp, j * 31, 0, GB_SHIP_TYPES * 31 + 1, COLOUR_PURPLE8);
455 if (ship_bitmaps [i] [j] != NULL)
456 draw_sprite(outp, gb_ship_bitmaps [i] [j], j * 31 + 1, i * 31 + 1);
457 }
458 }
459
460 blit(outp, screen, 0,0,5,5, (16 * 31) + 1, (16 * 31) + 1);
461 save_bitmap("gb_so.bmp", outp, temp_palette);
462
463 while (key [KEY_K] == 0)
464 {
465 };
466
467 #endif
468
469 // destroy_bitmap(outp);
470
471
472 // Load in enemy bitmaps:
473
474 temp_bitmap = load_bitmap("gfx//gb_nme1.bmp", temp_palette);
475 if (temp_bitmap == NULL)
476 {
477 bitmap_error("temp_bitmap (gb_nme1.bmp not loaded correctly?)");
478 }
479 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_GUARDIAN1, 59, 49);
480 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_BRACKET1, 51, 45);
481 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_WORMER1, 61, 50);
482 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_BRACKET2, 55, 38);
483 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_BRACKET3, 55, 49);
484 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_BRACKET4, 69, 49);
485 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_GUARDIAN2, 51, 70);
486 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_GUARDIAN3, 59, 61);
487 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_WORMER2, 61, 50);
488 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_WORMER3, 65, 65);
489 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_FORKER1, 53, 53);
490 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_FORKER2, 53, 53);
491 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_MINER1, 39, 37);
492 make_rle_enemy4(temp_bitmap, RLE_ENEMY4_MINER2, 49, 49);
493 destroy_bitmap(temp_bitmap);
494
495 progress_update("Enemies 1");
496
497
498 temp_bitmap = load_bitmap("gfx//gb_nme2.bmp", temp_palette);
499 if (temp_bitmap == NULL)
500 {
501 bitmap_error("temp_bitmap (gb_nme2.bmp not loaded correctly?)");
502 }
503 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_MINER3, 49, 67);
504 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_CIRCLER1, 69, 45);
505 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_MULTI1, 69, 69);
506 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_MULTI2, 67, 67);
507 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_MULTI3, 65, 65);
508 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_GUARDIAN4, 69, 65);
509 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_GUARDIAN5, 69, 59);
510 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_BRACKET5, 63, 61);
511 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_CURVE1, 69, 53);
512 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_CURVE2, 69, 53);
513 make_rle_enemy6(temp_bitmap, RLE_ENEMY6_CURVE3, 69, 53);
514 destroy_bitmap(temp_bitmap);
515
516 progress_update("Enemies 2");
517
518 //extern BITMAP *enemy_bmps [ENEMY_BMPS];
519
520
521 temp_bitmap = load_bitmap("gfx//gb_nmebm.bmp", temp_palette);
522 if (temp_bitmap == NULL)
523 {
524 bitmap_error("temp_bitmap (gb_nmebm.bmp not loaded correctly?)");
525 }
526 make_bmp_enemy(temp_bitmap, BMP_ENEMY_PULSER1_V, 23, 28);
527 make_bmp_enemy(temp_bitmap, BMP_ENEMY_PULSER1_H, 28, 23);
528 make_bmp_enemy(temp_bitmap, BMP_ENEMY_PULSER2_V, 25, 28);
529 make_bmp_enemy(temp_bitmap, BMP_ENEMY_PULSER2_H, 28, 25);
530
531 destroy_bitmap(temp_bitmap);
532
533 progress_update("Enemies 3");
534
535 temp_bitmap = load_bitmap("gfx//gb_big1.bmp", temp_palette);
536 if (temp_bitmap == NULL)
537 {
538 bitmap_error("temp_bitmap (gb_big1.bmp not loaded correctly?)");
539 }
540 make_rle_enemy5(temp_bitmap, RLE_ENEMY5_OVERTRIANGLER, 105, 105);
541 make_rle_enemy5(temp_bitmap, RLE_ENEMY5_DEFENDER1, 131, 67);
542 make_rle_enemy5(temp_bitmap, RLE_ENEMY5_DEFENDER2, 67, 121);
543 make_rle_enemy5(temp_bitmap, RLE_ENEMY5_DEFENDER3, 131, 67);
544 make_rle_enemy5(temp_bitmap, RLE_ENEMY5_OVERDISRUPTER, 41, 139);
545 // make_rle_enemy5(temp_bitmap, RLE_ENEMY5_BOSS1_1, 139, 101);
546 destroy_bitmap(temp_bitmap);
547
548 progress_update("Enemies 4");
549
550 temp_bitmap = load_bitmap("gfx//gb_big2.bmp", temp_palette);
551 if (temp_bitmap == NULL)
552 {
553 bitmap_error("temp_bitmap (gb_big2.bmp not loaded correctly?)");
554 }
555 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BOSS1_1, 189, 224);
556 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BOSS1_2, 229, 216);
557 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BOSS1_3, 229, 193);
558 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BOSS2_2, 247, 213);
559 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BOSS3_2, 231, 193);
560 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BEAMER1, 185, 139);
561 make_rle_enemy7(temp_bitmap, RLE_ENEMY7_BEAMER2, 185, 139);
562 destroy_bitmap(temp_bitmap);
563
564 progress_update("Enemies 5");
565
566 temp_bitmap = load_bitmap("gfx//gb_big3.bmp", temp_palette);
567 if (temp_bitmap == NULL)
568 {
569 bitmap_error("temp_bitmap (gb_big3.bmp not loaded correctly?)");
570 }
571
572 make_rle_enemy8(temp_bitmap, RLE_ENEMY8_BOSS3, 239, 239);
573 make_rle_enemy8(temp_bitmap, RLE_ENEMY8_BOSS2, 249, 249);
574 make_rle_enemy8(temp_bitmap, RLE_ENEMY8_BOSS2_3, 265, 241);
575 make_rle_enemy8(temp_bitmap, RLE_ENEMY8_BOSS3_3, 281, 223);
576
577 destroy_bitmap(temp_bitmap);
578
579 progress_update("Enemies 6");
580
581
582 temp_bitmap = load_bitmap("gfx//gb_med1.bmp", temp_palette);
583 if (temp_bitmap == NULL)
584 {
585 bitmap_error("temp_bitmap (gb_med1.bmp not loaded correctly?)");
586 }
587
588 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_DISRUPTER1, 89, 25);
589 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_DISRUPTER2, 29, 93);
590 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_DISRUPTER3, 89, 33);
591 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_TRIANGLER1, 73, 73);
592 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_TRIANGLER2, 71, 71);
593 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_TRIANGLER3, 71, 71);
594 make_rle_enemy9(temp_bitmap, RLE_ENEMY9_WORMER4, 83, 83);
595 destroy_bitmap(temp_bitmap);
596
597 progress_update("Enemies 7");
598
599 /* temp_bitmap = load_bitmap("gfx//enemy3.bmp", temp_palette);
600 if (temp_bitmap == NULL)
601 {
602 bitmap_error("temp_bitmap (enemy3.bmp not loaded correctly?)");
603 }
604
605 make_rle_enemy3(temp_bitmap, RLE_ENEMY3_FIREBASE, 133, 133);
606 make_rle_enemy3(temp_bitmap, RLE_ENEMY3_FIREBASE2, 39, 69);
607 make_rle_enemy3(temp_bitmap, RLE_ENEMY3_FIREBASE3, 91, 93);
608 make_rle_enemy3(temp_bitmap, RLE_ENEMY3_BOSS1, 175, 159);
609 make_rle_enemy3(temp_bitmap, RLE_ENEMY3_BOSS3, 155, 147);
610 make_rle_enemy3(temp_bitmap, RLE_ENEMY3_BOSS4, 223, 138);
611
612 // blit(temp_bitmap, temp_bitmap2, 1, 1, 0, 0, 35, 26);
613
614 // enemy1_rle [RLE_ENEMY1_STINGER] = get_rle_sprite(temp_bitmap2);
615
616 // destroy_bitmap(temp_bitmap2);
617
618 destroy_bitmap(temp_bitmap);
619 // destroy_bitmap(temp_bitmap2);*/
620
621 /* progress_update("Enemy3 Loaded");
622
623 temp_bitmap = load_bitmap("gfx//small1.bmp", temp_palette);
624 if (temp_bitmap == NULL)
625 {
626 bitmap_error("temp_bitmap (small1.bmp not loaded correctly?)");
627 }
628
629 for (i = RLE_SMALL1_GREEN_BLOB_L; i < SMALL1_RLES; i ++)
630 {
631 make_rle_small1(temp_bitmap, i, 11, 11);
632 }
633
634
635 progress_update("Small1 Loaded");
636 */
637 temp_bitmap = load_bitmap("gfx//gb_small.bmp", temp_palette);
638 if (temp_bitmap == NULL)
639 {
640 bitmap_error("temp_bitmap (gm_small.bmp not loaded correctly?)");
641 }
642
643 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_1, 8, 8);
644 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_2, 8, 8);
645 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_3, 7, 7);
646 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_4, 6, 6);
647 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_5, 5, 5);
648 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_6, 4, 4);
649 make_rle_small3(temp_bitmap, RLE_SMALL3_GREEN_BLOB_7, 3, 3);
650 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_1, 8, 8);
651 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_2, 8, 8);
652 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_3, 7, 7);
653 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_4, 6, 6);
654 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_5, 5, 5);
655 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_6, 4, 4);
656 make_rle_small3(temp_bitmap, RLE_SMALL3_ORANGE_BLOB_7, 3, 3);
657 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_1, 8, 8);
658 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_2, 7, 7);
659 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_3, 6, 6);
660 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_4, 6, 6);
661 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_5, 5, 5);
662 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_6, 5, 5);
663 make_rle_small3(temp_bitmap, RLE_SMALL3_BLUE_BLOB_7, 3, 3);
664 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_1, 8, 8);
665 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_2, 8, 8);
666 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_3, 7, 7);
667 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_4, 6, 6);
668 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_5, 5, 5);
669 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_6, 4, 4);
670 make_rle_small3(temp_bitmap, RLE_SMALL3_YELLOW_BLOB_7, 3, 3);
671 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE1, 12, 12);
672 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE2, 12, 12);
673 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE3, 12, 12);
674 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE4, 12, 12);
675 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE2_1, 12, 12);
676 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE2_2, 12, 12);
677 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE2_3, 12, 12);
678 make_rle_small3(temp_bitmap, RLE_SMALL3_PULSE2_4, 12, 12);
679 destroy_bitmap(temp_bitmap);
680
681
682 progress_update("Small Things");
683
684 temp_bitmap = load_bitmap("gfx//gb_small2.bmp", temp_palette);
685 if (temp_bitmap == NULL)
686 {
687 bitmap_error("temp_bitmap (gm_small2.bmp not loaded correctly?)");
688 }
689
690 for (i = 0; i < SMALL4_BMPS; i ++)
691 {
692 make_bmp_small4(temp_bitmap, i, 10, 10);
693 }
694 /*
695 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_1, 10, 10);
696 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_2, 10, 10);
697 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_3, 10, 10);
698 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_4, 10, 10);
699 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_5, 10, 10);
700 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_6, 10, 10);
701 make_bmp_small4(temp_bitmap, BMP_SMALL4_EYE_7, 10, 10);
702 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_1, 10, 10);
703 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_2, 10, 10);
704 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_3, 10, 10);
705 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_4, 10, 10);
706 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_5, 10, 10);
707 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_6, 10, 10);
708 make_bmp_small4(temp_bitmap, BMP_SMALL4_BEYE_7, 10, 10);*/
709 destroy_bitmap(temp_bitmap);
710
711 for (i = 0; i < 8; i ++)
712 {
713 shield_bmp [i] = create_bitmap(10, 10);
714 if (shield_bmp [i] == NULL)
715 bitmap_error("shield_bmp (out of memory?)");
716 clear_bitmap(shield_bmp [i]);
717 shield_bmp [i + 8] = create_bitmap(10, 10);
718 if (shield_bmp [i + 8] == NULL)
719 bitmap_error("shield_bmp (out of memory?)");
720 clear_bitmap(shield_bmp [i + 8]);
721 shield_bmp [i + 16] = create_bitmap(10, 10);
722 if (shield_bmp [i + 16] == NULL)
723 bitmap_error("shield_bmp (out of memory?)");
724 clear_bitmap(shield_bmp [i + 16]);
725
726 draw_sprite_h_flip(shield_bmp [i], small4_bmp [BMP_SMALL4_SHIELD_1 + i], 0, 0);
727 draw_sprite_vh_flip(shield_bmp [i + 8], small4_bmp [BMP_SMALL4_SHIELD_1 + i], 0, 0);
728 draw_sprite_v_flip(shield_bmp [i + 16], small4_bmp [BMP_SMALL4_SHIELD_1 + i], 0, 0);
729 }
730
731 progress_update("More Small Things");
732
733
734 /*
735 temp_bitmap = load_bitmap("gfx//small2.bmp", temp_palette);
736 if (temp_bitmap == NULL)
737 {
738 bitmap_error("temp_bitmap (small2.bmp not loaded correctly?)");
739 }
740
741 for (i = BMP_SMALL2_MISSILE_1; i < BMP_SMALL2_SIDE_BOMB + 1; i ++)
742 {
743 make_bmp_small2(temp_bitmap, i, 7, 7);
744 }
745
746 destroy_bitmap(temp_bitmap);
747
748 progress_update("Small3 Loaded");
749
750 temp_bitmap = load_bitmap("gfx//enemy2.bmp", temp_palette);
751 if (temp_bitmap == NULL)
752 {
753 bitmap_error("temp_bitmap (enemy2.bmp not loaded correctly?)");
754 }
755
756 for (i = 0; i < 9; i ++)
757 {
758 make_rle_enemy2(temp_bitmap, i, 27, 27);
759 }
760
761 destroy_bitmap(temp_bitmap);
762
763 progress_update("Enemy2 Loaded");
764 */
765 temp_bitmap = load_bitmap("gfx//gb_lsh.bmp", temp_palette);
766 if (temp_bitmap == NULL)
767 {
768 bitmap_error("temp_bitmap (gb_lsh.bmp not loaded correctly?)");
769 }
770
771 // int b;
772
773 for (i = 0; i < 16; i ++)
774 {
775 make_rle_large_ship(temp_bitmap, i);
776 }
777
778 destroy_bitmap(temp_bitmap);
779
780 progress_update("More Vehicles");
781
782 tile_background = NULL;
783 make_bmp_tiles();
784
785 init_tiles(); // just clears the rle array, setting all to NULL, and prepares the menu tile
786
787 level_bmp = create_bitmap(500, 500);
788
789 if (!level_bmp)
790 {
791 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
792 allegro_message("Bitmap creation error (level_bmp) \n%s\n", allegro_error);
793 exit(1);
794 }
795
796 progress_update("Tiles Loaded and Processed");
797
798 // level_bmp = create_bitmap(5, 5);
799
800 make_bang_bmps();
801
802 make_light_bmps();
803
804 progress_update("Light Sourcing");
805
806 // init_messages();
807
808 // progress_update("Messages Initialised");
809
810 distortion_mask = create_bitmap(201, 201);
811
812 if (distortion_mask == NULL)
813 {
814 bitmap_error("distortion_mask (out of memory?)");
815 }
816
817 crystal_bmp = create_bitmap(20, 20);
818
819 if (crystal_bmp == NULL)
820 {
821 bitmap_error("crystal_bmp (out of memory?)");
822 }
823
824 BITMAP *temp_waver_bmp = create_bitmap(41, 41);
825
826 if (temp_waver_bmp == NULL)
827 bitmap_error("temp_waver_bmp (out of memory?)");
828 clear_bitmap(temp_waver_bmp);
829 circlefill(temp_waver_bmp, 20, 20, 19, GC_RED5);
830 circle(temp_waver_bmp, 20, 20, 19, GC_RED1);
831 circlefill(temp_waver_bmp, 20, 20, 12, 0);
832 circle(temp_waver_bmp, 20, 20, 12, GC_RED1);
833 waver1_circle = get_rle_sprite(temp_waver_bmp);
834 destroy_bitmap(temp_waver_bmp);
835
836 temp_waver_bmp = create_bitmap(41, 41);
837 if (temp_waver_bmp == NULL)
838 bitmap_error("temp_waver_bmp (out of memory?)");
839 clear_bitmap(temp_waver_bmp);
840 circlefill(temp_waver_bmp, 20, 20, 19, GC_GREEN5);
841 circle(temp_waver_bmp, 20, 20, 19, GC_GREEN1);
842 circlefill(temp_waver_bmp, 20, 20, 15, 0);
843 circle(temp_waver_bmp, 20, 20, 15, GC_GREEN1);
844 waver2_circle = get_rle_sprite(temp_waver_bmp);
845 destroy_bitmap(temp_waver_bmp);
846
847 progress_update("Effects");
848
849 // set_palette(light_palet);
850 set_light_palette();
851 progress_update("Palette");
852
853 }
854
855 void make_rle_enemy1(BITMAP *source_bmp, int which_enemy, int width, int height)
856 {
857 BITMAP *temp_bmp = create_bitmap(width, height);
858 if (temp_bmp == NULL)
859 {
860 bitmap_error("temp_bmp (make_rle_enemy1)");
861 }
862
863 blit(source_bmp, temp_bmp, which_enemy * 51 + 1, 1, 0, 0, width, height);
864
865 enemy1_rle [which_enemy] = get_rle_sprite(temp_bmp);
866
867 destroy_bitmap(temp_bmp);
868 }
869
870 void make_rle_enemy2(BITMAP *source_bmp, int which_enemy, int width, int height)
871 {
872 BITMAP *temp_bmp = create_bitmap(width, height);
873
874 if (temp_bmp == NULL)
875 {
876 bitmap_error("temp_bmp (make_rle_enemy2)");
877 }
878
879 clear_bitmap(temp_bmp);
880
881 blit(source_bmp, temp_bmp, which_enemy * 41 + 1, 1, 0, 0, width, height);
882 enemy2_rle [which_enemy] = get_rle_sprite(temp_bmp);
883
884 destroy_bitmap(temp_bmp);
885
886
887 }
888
889 void make_rle_enemy3(BITMAP *source_bmp, int which_enemy, int width, int height)
890 {
891 BITMAP *temp_bmp = create_bitmap(width, height);
892 if (temp_bmp == NULL)
893 {
894 bitmap_error("temp_bmp (make_rle_enemy3)");
895 }
896
897 blit(source_bmp, temp_bmp, which_enemy * 301 + 1, 1, 0, 0, width, height);
898
899 enemy3_rle [which_enemy] = get_rle_sprite(temp_bmp);
900
901 destroy_bitmap(temp_bmp);
902
903 }
904
905 void make_rle_enemy4(BITMAP *source_bmp, int which_enemy, int width, int height)
906 {
907 BITMAP *temp_bmp = create_bitmap(width, height);
908 if (temp_bmp == NULL)
909 {
910 bitmap_error("temp_bmp (make_rle_enemy4)");
911 }
912
913 blit(source_bmp, temp_bmp, which_enemy * 71 + 1, 1, 0, 0, width, height);
914
915 enemy4_rle [which_enemy] = get_rle_sprite(temp_bmp);
916
917 destroy_bitmap(temp_bmp);
918
919 }
920
921 void make_rle_enemy5(BITMAP *source_bmp, int which_enemy, int width, int height)
922 {
923 BITMAP *temp_bmp = create_bitmap(width, height);
924 if (temp_bmp == NULL)
925 {
926 bitmap_error("temp_bmp (make_rle_enemy5)");
927 }
928
929 blit(source_bmp, temp_bmp, which_enemy * 141 + 1, 1, 0, 0, width, height);
930
931 enemy5_rle [which_enemy] = get_rle_sprite(temp_bmp);
932
933 destroy_bitmap(temp_bmp);
934
935 }
936
937 void make_rle_enemy6(BITMAP *source_bmp, int which_enemy, int width, int height)
938 {
939 BITMAP *temp_bmp = create_bitmap(width, height);
940 if (temp_bmp == NULL)
941 {
942 bitmap_error("temp_bmp (make_rle_enemy6)");
943 }
944
945 blit(source_bmp, temp_bmp, which_enemy * 71 + 1, 1, 0, 0, width, height);
946
947 enemy6_rle [which_enemy] = get_rle_sprite(temp_bmp);
948
949 destroy_bitmap(temp_bmp);
950
951 }
952
953 void make_rle_enemy7(BITMAP *source_bmp, int which_enemy, int width, int height)
954 {
955 BITMAP *temp_bmp = create_bitmap(width, height);
956 if (temp_bmp == NULL)
957 {
958 bitmap_error("temp_bmp (make_rle_enemy7)");
959 }
960
961 blit(source_bmp, temp_bmp, which_enemy * 249 + 1, 1, 0, 0, width, height);
962
963 enemy7_rle [which_enemy] = get_rle_sprite(temp_bmp);
964
965 destroy_bitmap(temp_bmp);
966
967 }
968
969 void make_rle_enemy8(BITMAP *source_bmp, int which_enemy, int width, int height)
970 {
971 BITMAP *temp_bmp = create_bitmap(width, height);
972 if (temp_bmp == NULL)
973 {
974 bitmap_error("temp_bmp (make_rle_enemy8)");
975 }
976
977 blit(source_bmp, temp_bmp, which_enemy * 282 + 1, 1, 0, 0, width, height);
978
979 enemy8_rle [which_enemy] = get_rle_sprite(temp_bmp);
980
981 destroy_bitmap(temp_bmp);
982
983 }
984
985 void make_rle_enemy9(BITMAP *source_bmp, int which_enemy, int width, int height)
986 {
987 BITMAP *temp_bmp = create_bitmap(width, height);
988 if (temp_bmp == NULL)
989 {
990 bitmap_error("temp_bmp (make_rle_enemy9)");
991 }
992
993 blit(source_bmp, temp_bmp, which_enemy * 109 + 1, 1, 0, 0, width, height);
994
995 enemy9_rle [which_enemy] = get_rle_sprite(temp_bmp);
996
997 destroy_bitmap(temp_bmp);
998
999 }
1000
1001 void make_rle_small1(BITMAP *source_bmp, int which_small, int width, int height)
1002 {
1003 BITMAP *temp_bmp = create_bitmap(width, height);
1004 if (temp_bmp == NULL)
1005 {
1006 bitmap_error("temp_bmp (make_rle_small1)");
1007 }
1008
1009 blit(source_bmp, temp_bmp, which_small * 21 + 1, 1, 0, 0, width, height);
1010
1011 small1_rle [which_small] = get_rle_sprite(temp_bmp);
1012
1013 destroy_bitmap(temp_bmp);
1014
1015 }
1016
1017 void make_rle_small3(BITMAP *source_bmp, int which_small, int width, int height)
1018 {
1019 BITMAP *temp_bmp = create_bitmap(width, height);
1020 if (temp_bmp == NULL)
1021 {
1022 bitmap_error("temp_bmp (make_rle_small3)");
1023 }
1024
1025 blit(source_bmp, temp_bmp, which_small * 15 + 1, 1, 0, 0, width, height);
1026
1027 small3_rle [which_small] = get_rle_sprite(temp_bmp);
1028
1029 destroy_bitmap(temp_bmp);
1030
1031 }
1032
1033 void make_bmp_small2(BITMAP *source_bmp, int which_small, int width, int height)
1034 {
1035
1036 small2_bmp [which_small] = create_bitmap(width, height);
1037
1038 if (small2_bmp [which_small] == NULL)
1039 {
1040 bitmap_error("temp_bmp (make_bmp_small2)");
1041 }
1042
1043 blit(source_bmp, small2_bmp [which_small], which_small * 21 + 1, 1, 0, 0, width, height);
1044
1045 }
1046
1047 void make_bmp_enemy(BITMAP *source_bmp, int which_enemy, int width, int height)
1048 {
1049
1050 enemy_bmps [which_enemy] = create_bitmap(width, height);
1051
1052 if (enemy_bmps [which_enemy] == NULL)
1053 {
1054 bitmap_error("temp_bmp (make_bmp_enemy)");
1055 }
1056
1057 blit(source_bmp, enemy_bmps [which_enemy], which_enemy * 71 + 1, 1, 0, 0, width, height);
1058
1059 }
1060
1061
1062 void make_bmp_small4(BITMAP *source_bmp, int which_small, int width, int height)
1063 {
1064
1065 small4_bmp [which_small] = create_bitmap(width, height);
1066
1067 if (small4_bmp [which_small] == NULL)
1068 {
1069 bitmap_error("temp_bmp (make_bmp_small4)");
1070 }
1071
1072 blit(source_bmp, small4_bmp [which_small], which_small * 15 + 1, 1, 0, 0, width, height);
1073
1074 }
1075
1076 void make_rle_large_ship(BITMAP *source_bmp, int which_ship)
1077 {
1078 BITMAP *temp_bmp = create_bitmap(49, 49);
1079 if (temp_bmp == NULL)
1080 {
1081 bitmap_error("temp_bmp (make_rle_large_ship)");
1082 }
1083
1084 // if (which_ship > 11)
1085 // {
1086 // blit(source_bmp, temp_bmp, 51 + 1, 1, 0, 0, 49, 49);
1087 // }
1088 // else
1089 blit(source_bmp, temp_bmp, which_ship * 51 + 1, 1, 0, 0, 49, 49);
1090
1091 int i, x, y, px, base_col;
1092
1093 for (i = 0; i < 5; i ++)
1094 {
1095 switch(i)
1096 {
1097 case 0:
1098 base_col = COLOUR_BLUE1; break;
1099 case 1:
1100 base_col = COLOUR_GREEN1; break;
1101 case 2:
1102 base_col = COLOUR_YELLOW1; break;
1103 case 3:
1104 base_col = COLOUR_RED1; break;
1105 }
1106 for (x = 0; x < 50; x ++)
1107 {
1108 for (y = 0; y < 50; y ++)
1109 {
1110 px = getpixel(temp_bmp, x, y);
1111 if (i == 4)
1112 {
1113 // if (px % 8 != 5 && px != 0)
1114 // if ((y % 4 == 0 || x % 4 == 0) && px != 0)
1115 if (px % 8 < 4 && px != 0)
1116 putpixel(temp_bmp, x, y, COLOUR_WHITE);
1117 else
1118 putpixel(temp_bmp, x, y, 0);
1119 }
1120 else
1121 {
1122 if (px != 0)
1123 putpixel(temp_bmp, x, y, base_col + (px % 8) - 1);
1124 }
1125 }
1126 }
1127 large_ships [which_ship] [i] = get_rle_sprite(temp_bmp);
1128 }
1129
1130 destroy_bitmap(temp_bmp);
1131
1132 }
1133
1134 void make_bmp_tiles(void)
1135 {
1136 // RGB temp_palette2 [1024];
1137 RGB temp_palette [256];
1138 // RGB temp_palette3 [1024];
1139
1140 BITMAP *temp_bitmap = load_bitmap("gfx//gb_tiles.bmp", temp_palette);
1141
1142 if (temp_bitmap == NULL)
1143 {
1144 bitmap_error("temp_bitmap (gb_tiles.bmp not loaded correctly?)");
1145 }
1146
1147 // clear_bitmap(temp_bmp2);
1148
1149 int i, j;
1150
1151 for (i = 0; i < NO_PRETILE_BMPS; i ++)
1152 {
1153
1154 pretile_bmp [i] = create_bitmap(50, 50);
1155
1156 if (pretile_bmp [i] == NULL)
1157 {
1158 bitmap_error("pretile (make_bmp_tiles)");
1159 }
1160
1161 blit(temp_bitmap, pretile_bmp [i], i * 51 + 1, 1, 0, 0, 50, 50);
1162 }
1163
1164 destroy_bitmap(temp_bitmap);
1165
1166 temp_bitmap = load_bitmap("gfx//gb_maze.bmp", temp_palette);
1167
1168 if (temp_bitmap == NULL)
1169 {
1170 bitmap_error("temp_bitmap (gb_maze.bmp not loaded correctly?)");
1171 }
1172
1173
1174
1175 for (j = 0; j < NO_MAZES; j ++)
1176 {
1177 for (i = 0; i < NO_PRETILE_M_BMPS; i ++)
1178 {
1179
1180 pretile_m_bmp [j] [i] = create_bitmap(50, 50);
1181 // not [i] [j]...
1182 if (pretile_m_bmp [j] [i] == NULL)
1183 {
1184 bitmap_error("pretile_m_bmp (make_bmp_tiles)");
1185 }
1186 blit(temp_bitmap, pretile_m_bmp [j] [i], i * 51 + 1, j * 51 + 1, 0, 0, 50, 50);
1187 }
1188 }
1189
1190 destroy_bitmap(temp_bitmap);
1191
1192 }
1193
1194 /*
1195 void make_superjelly_bmps(void)
1196 {
1197 superjelly_bmp [0] = create_bitmap(21, 21);
1198 if (superjelly_bmp [0] == NULL)
1199 {
1200 bitmap_error("temp_bmp (make_superjelly_bmps - superjelly_bmp [0])");
1201 }
1202 clear_bitmap(superjelly_bmp [0]);
1203
1204 superjelly_bmp [1] = create_bitmap(21, 21);
1205 if (superjelly_bmp [1] == NULL)
1206 {
1207 bitmap_error("temp_bmp (make_superjelly_bmps - superjelly_bmp [1])");
1208 }
1209 clear_bitmap(superjelly_bmp [1]);
1210
1211 draw_rle_sprite(superjelly_bmp [0], enemy1_rle [RLE_ENEMY1_SUPERJELLY], 0, 0);
1212
1213 rotate_sprite(superjelly_bmp [1], superjelly_bmp [0], 0, 0, itofix(64));
1214
1215 }
1216 */
1217
1218 void make_light_bmps(void)
1219 {
1220
1221 int i;
1222 int c1 = 3, c2 = 2;
1223 BITMAP *temp_bmp;
1224
1225 for (i = 0; i < 100; i ++)
1226 {
1227 if (i == 0)
1228 temp_bmp = create_bitmap(1, 1);
1229 else
1230 temp_bmp = create_bitmap(i * 2 + 2, i * 2 + 2);
1231 if (temp_bmp == NULL)
1232 bitmap_error("light_bmp");
1233 clear_bitmap(temp_bmp);
1234 c1 = i;
1235 c2 = i - (i / 6);
1236 // c3 = i - (i / 4);
1237 circlefill(temp_bmp, i + 1, i + 1, c1, LIGHT_1);
1238 circlefill(temp_bmp, i + 1, i + 1, c2, LIGHT_2);
1239 light_rle [i] = get_rle_sprite(temp_bmp);
1240 if (light_rle [i] == NULL)
1241 bitmap_error("light_rle");
1242 destroy_bitmap(temp_bmp);
1243 }
1244
1245 }
1246
1247 void make_bang_bmps(void)
1248 {
1249 return;
1250 /*
1251 int i;
1252 int c1 = 3, c2 = 2, c3 = 1;
1253
1254 c1 = 0;
1255 c2 = -250;
1256 c3 = -500;
1257 for (i = 0; i < 50; i ++)
1258 {
1259 redbang_bmp [i] = create_bitmap(i * 2, i * 2);
1260 if (redbang_bmp [i] == NULL)
1261 bitmap_error("redbang_bmp");
1262 clear_bitmap(redbang_bmp [i]);
1263 c1 += 10;
1264 // c2 = i - (i / 7);
1265 // c3 = i - (i / 4);
1266 c2 += 15;
1267 c3 += 20;
1268 circlefill(redbang_bmp [i], i, i, c1 / 10, TRANS_DRED);
1269 if (c2 > 0)
1270 circlefill(redbang_bmp [i], i, i, c2 / 10, TRANS_LRED);
1271 if (c3 > 0)
1272 circlefill(redbang_bmp [i], i, i, c3 / 10, TRANS_YELLOW);
1273 }
1274 */
1275 }
1276
1277 /*
1278 void draw_sprite_v_flip(BITMAP *bmp, BITMAP *sprite, int x, int y);
1279
1280 void draw_sprite_h_flip(BITMAP *bmp, BITMAP *sprite, int x, int y);
1281
1282 void draw_sprite_vh_flip(BITMAP *bmp, BITMAP *sprite, int x, int y);
1283 */
1284 void bitmap_error(const char errtxt [])
1285 {
1286 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
1287 allegro_message("Bitmap creation error \n%s\n\n\r%s", allegro_error, errtxt);
1288 // allegro_message("\n\r");
1289 // allegro_message(errtxt);
1290 exit(1);
1291
1292 }
1293
1294 void progress_update(const char progtxt [])
1295 {
1296 static int ypos = 170;
1297 rectfill(screen, 400, 117, 450, 118, COLOUR_YELLOW8);
1298 rectfill(screen, 449, 117, 450, ypos + 5, COLOUR_YELLOW8);
1299 hline(screen, 449, ypos + 5, 433, COLOUR_YELLOW8);
1300 textprintf_right_ex(screen, small_font, 430, ypos, COLOUR_GREEN8, -1, progtxt);
1301 ypos += 11;
1302 // do {rest(30);} while (!key [KEY_X]);
1303 // rest(200);
1304 }
1305
1306 void prepare_display(void)
1307 {
1308 // player bmps are set to NULL in init_display
1309 if (game.users == 1)
1310 {
1311 if (player1 != NULL)
1312 destroy_bitmap(player1);
1313 player1 = create_bitmap(scr_x, scr_y);
1314 clear_bitmap(player1);
1315 }
1316 else
1317 {
1318 if (player1 != NULL)
1319 destroy_bitmap(player1);
1320 if (player2 != NULL)
1321 destroy_bitmap(player2);
1322 player1 = create_bitmap(tp_window_width, scr_y);
1323 clear_bitmap(player1);
1324 player2 = create_bitmap(tp_window_width, scr_y);
1325 clear_bitmap(player2);
1326 }
1327
1328 }
1329
1330 #ifdef DONT_COMPILE
1331
1332 void make_actor_sprites_old_small(int at)
1333 {
1334
1335 int x,y,x1, x2, x3, y1, y2, y3;
1336 int i;
1337 float angle;
1338 int a1, a2, a3;
1339
1340 int points [16];
1341
1342 BITMAP *tbmp = create_bitmap(21, 21);
1343
1344 switch(at)
1345 {
1346 case 1:
1347 for (i = 0; i < 17; i ++)
1348 {
1349 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1350 clear_bitmap(ship_bitmaps [at] [i]);
1351 angle = i / (16 / (PI / 2)) - PI / 2;
1352 if (i == 16)
1353 angle = 0;
1354 x1 = 100 + cos(angle) * 7;
1355 y1 = 100 + sin(angle) * 7;
1356 x2 = 100 + cos(angle + PI + PI / 3) * 6;
1357 y2 = 100 + sin(angle + PI + PI / 3) * 6;
1358 x3 = 100 + cos(angle + PI - PI / 3) * 6;
1359 y3 = 100 + sin(angle + PI - PI / 3) * 6;
1360 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1361 x1 = 100 + cos(angle) * 6;
1362 y1 = 100 + sin(angle) * 6;
1363 x2 = 100 + cos(angle + PI + PI / 3) * 5;
1364 y2 = 100 + sin(angle + PI + PI / 3) * 5;
1365 x3 = 100 + cos(angle + PI - PI / 3) * 5;
1366 y3 = 100 + sin(angle + PI - PI / 3) * 5;
1367 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1368 x1 = 100 + cos(angle) * 3;
1369 y1 = 100 + sin(angle) * 3;
1370 circlefill(ship_bitmaps [at] [i], x1, y1, 1, COLOUR_WHITE);
1371 // line(ship_bitmaps [at] [i], x1, y1, x2, y2, COLOUR_GREY4);
1372 // line(ship_bitmaps [at] [i], x2, y2, x3, y3, COLOUR_GREY4);
1373 // line(ship_bitmaps [at] [i], x1, y1, x3, y3, COLOUR_GREY4);
1374 }
1375 break;
1376 case 2:
1377 for (i = 0; i < 17; i ++)
1378 {
1379 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1380 clear_bitmap(ship_bitmaps [at] [i]);
1381 angle = i / (16 / (PI / 2)) - PI / 2;
1382 if (i == 16)
1383 angle = 0;
1384 x2 = 100 + cos(angle + PI + PI / 3) * 5;
1385 y2 = 100 + sin(angle + PI + PI / 3) * 5;
1386 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY5);
1387 x2 = 100 + cos(angle + PI - PI / 3) * (6 - (angle == 16));
1388 y2 = 100 + sin(angle + PI - PI / 3) * (6 - (angle == 16));
1389 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY5);
1390 x = 10;
1391 y = 10;
1392 circlefill(ship_bitmaps [at] [i], x, y, 5, COLOUR_GREY4);
1393 circlefill(ship_bitmaps [at] [i], x, y, 4, COLOUR_GREY5);
1394 // x1 = 10;// + cos(angle) * 2;
1395 // y1 = 10;// + sin(angle) * 2;
1396 // circlefill(ship_bitmaps [at] [i], x1, y1, 1, COLOUR_WHITE);
1397 a1 = 64 - (i * 4 + 19);
1398 a2 = 64 - (i * 4 - 19);
1399 if (i == 12)
1400 {
1401 a1 = 0 + 256;//64 - (i * 4 + 19);
1402 a2 = 35 + 256; //64 - (i * 4 - 19);
1403 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 3, COLOUR_WHITE);
1404 } else
1405 {
1406 if (i > 11)
1407 {
1408 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 3, COLOUR_WHITE);
1409 // a3 = a1;
1410 // a1 = a2;
1411 // a2 = a3;
1412 }
1413 else
1414 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 3, COLOUR_WHITE);
1415 }
1416 }
1417 break;
1418 case 3:
1419 for (i = 0; i < 17; i ++)
1420 {
1421 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1422 clear_bitmap(ship_bitmaps [at] [i]);
1423 angle = i / (16 / (PI / 2)) - PI / 2;
1424 if (i == 16)
1425 angle = 0;
1426 circlefill(ship_bitmaps [at] [i], 10, 10, 2, COLOUR_GREY4);
1427 x2 = 100 + cos(angle + PI + PI / 4) * 5;
1428 y2 = 100 + sin(angle + PI + PI / 4) * 5;
1429 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY4);
1430 circlefill(ship_bitmaps [at] [i], x2, y2, 1, COLOUR_GREY5);
1431 x2 = 100 + cos(angle + PI + PI / 4) * 2;
1432 y2 = 100 + sin(angle + PI + PI / 4) * 2;
1433 circlefill(ship_bitmaps [at] [i], x2, y2, 1, COLOUR_GREY5);
1434 x2 = 100 + cos(angle + PI - PI / 4) * 5;
1435 y2 = 100 + sin(angle + PI - PI / 4) * 5;
1436 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY4);
1437 circlefill(ship_bitmaps [at] [i], x2, y2, 1, COLOUR_GREY5);
1438 x2 = 100 + cos(angle + PI - PI / 4) * 2;
1439 y2 = 100 + sin(angle + PI - PI / 4) * 2;
1440 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY5);
1441 x2 = 100 + cos(angle + PI / 4) * 5;
1442 y2 = 100 + sin(angle + PI / 4) * 5;
1443 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY4);
1444 circlefill(ship_bitmaps [at] [i], x2, y2, 1, COLOUR_GREY5);
1445 x2 = 100 + cos(angle + PI / 4) * 2;
1446 y2 = 100 + sin(angle + PI / 4) * 2;
1447 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY5);
1448 x2 = 100 + cos(angle - PI / 4) * 5;
1449 y2 = 100 + sin(angle - PI / 4) * 5;
1450 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY4);
1451 circlefill(ship_bitmaps [at] [i], x2, y2, 1, COLOUR_GREY5);
1452 x2 = 100 + cos(angle - PI / 4) * 2;
1453 y2 = 100 + sin(angle - PI / 4) * 2;
1454 circlefill(ship_bitmaps [at] [i], x2, y2, 2, COLOUR_GREY5);
1455 x = 10;
1456 y = 10;
1457 circlefill(ship_bitmaps [at] [i], x, y, 1, COLOUR_GREY5);
1458 // x1 = 10;// + cos(angle) * 2;
1459 // y1 = 10;// + sin(angle) * 2;
1460 // circlefill(ship_bitmaps [at] [i], x1, y1, 1, COLOUR_WHITE);
1461 a1 = 64 - (i * 4 + 12);
1462 a2 = 64 - (i * 4 - 12);
1463 if (i == 12)
1464 {
1465 a1 = 0 + 256;//64 - (i * 4 + 19);
1466 a2 = 35 + 256; //64 - (i * 4 - 19);
1467 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1468 } else
1469 {
1470 if (i > 11)
1471 {
1472 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1473 // a3 = a1;
1474 // a1 = a2;
1475 // a2 = a3;
1476 }
1477 else
1478 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1479 }
1480 }
1481 break;
1482 case 4:
1483 for (i = 0; i < 17; i ++)
1484 {
1485 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1486 clear_bitmap(ship_bitmaps [at] [i]);
1487 angle = i / (16 / (PI / 2)) - PI / 2;
1488 if (i == 16)
1489 angle = 0;
1490 if (i == 0)
1491 angle = 1 / (16 / (PI / 2)) - PI / 2;;
1492 clear_bitmap(tbmp);
1493 circlefill(tbmp, 10, 10, 7, COLOUR_GREY4);
1494 x = 100 + cos(angle) * 6;
1495 y = 100 + sin(angle) * 6;
1496 circlefill(tbmp, x, y, 7, 0);
1497 blit(tbmp, ship_bitmaps [at] [i], 0,0,0,0,21,21);
1498 clear_bitmap(tbmp);
1499 circlefill(tbmp, 10, 10, 6, COLOUR_GREY5);
1500 x = 100 + cos(angle) * 6;
1501 y = 100 + sin(angle) * 6;
1502 circlefill(tbmp, x, y, 8, 0);
1503 x = 10;// - cos(angle) * 3;
1504 y = 10;// - sin(angle) * 3;
1505 circlefill(ship_bitmaps [at] [i], x, y, 3, COLOUR_GREY4);
1506 masked_blit(tbmp, ship_bitmaps [at] [i], 0,0,0,0,21,21);
1507 x = 10;// - cos(angle) * 3;
1508 y = 10;// - sin(angle) * 3;
1509 circlefill(ship_bitmaps [at] [i], x, y, 2, COLOUR_GREY5);
1510 a1 = 64 - (i * 4 + 12);
1511 a2 = 64 - (i * 4 - 12);
1512 if (i == 12)
1513 {
1514 a1 = 0 + 256;//64 - (i * 4 + 19);
1515 a2 = 35 + 256; //64 - (i * 4 - 19);
1516 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1517 } else
1518 {
1519 if (i > 11)
1520 {
1521 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1522 }
1523 else
1524 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1525 }
1526 }
1527 break;
1528 case 5:
1529 for (i = 0; i < 17; i ++)
1530 {
1531 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1532 clear_bitmap(ship_bitmaps [at] [i]);
1533 angle = i / (16 / (PI / 2)) - PI / 2;
1534 if (i == 16)
1535 angle = 0;
1536 if (i == 0)
1537 angle = 1 / (16 / (PI / 2)) - PI / 2;;
1538 clear_bitmap(tbmp);
1539 circlefill(tbmp, 10, 10, 7, COLOUR_GREY4);
1540 circlefill(tbmp, 10, 10, 6, COLOUR_GREY5);
1541 /* x = 10 - cos(angle) * 4;
1542 y = 10 - sin(angle) * 4;
1543 circlefill(tbmp, x, y, 3, 0);
1544 x = 10 - cos(angle) * 3;
1545 y = 10 - sin(angle) * 3;
1546 circlefill(tbmp, x, y, 3, 0);
1547 x = 10 - cos(angle) * 2;
1548 y = 10 - sin(angle) * 2;
1549 circlefill(tbmp, x, y, 3, 0);*/
1550 x = 10;// ;;+ cos(angle) * 1;
1551 y = 10;// + sin(angle) * 1;
1552 circlefill(tbmp, x, y, 3, 0);
1553 x = 100 + cos(angle) * 2;
1554 y = 100 + sin(angle) * 2;
1555 circlefill(tbmp, x, y, 3, 0);
1556 x = 100 + cos(angle) * 3;
1557 y = 100 + sin(angle) * 3;
1558 circlefill(tbmp, x, y, 3, 0);
1559 x = 100 + cos(angle) * 4;
1560 y = 100 + sin(angle) * 4;
1561 circlefill(tbmp, x, y, 3, 0);
1562 x = 100 + cos(angle) * 5;
1563 y = 100 + sin(angle) * 5;
1564 circlefill(tbmp, x, y, 3, 0);
1565 x = 100 + cos(angle) * 6;
1566 y = 100 + sin(angle) * 6;
1567 circlefill(tbmp, x, y, 3, 0);
1568 x = 100 + cos(angle) * 7;
1569 y = 100 + sin(angle) * 7;
1570 circlefill(tbmp, x, y, 3, 0);
1571 blit(tbmp, ship_bitmaps [at] [i], 0,0,0,0,21,21);
1572 clear_bitmap(tbmp);
1573 /* circlefill(tbmp, 10, 10, 6, COLOUR_GREY5);
1574 x = 100 + cos(angle) * 6;
1575 y = 100 + sin(angle) * 6;
1576 circlefill(tbmp, x, y, 8, 0);
1577 x = 10;// - cos(angle) * 3;
1578 y = 10;// - sin(angle) * 3;
1579 circlefill(ship_bitmaps [at] [i], x, y, 4, COLOUR_GREY4);
1580 masked_blit(tbmp, ship_bitmaps [at] [i], 0,0,0,0,21,21);*/
1581 x = 10;// - cos(angle) * 3;
1582 y = 10;// - sin(angle) * 3;
1583 circlefill(ship_bitmaps [at] [i], x, y, 3, COLOUR_GREY5);
1584 a1 = 64 - (i * 4 + 12);
1585 a2 = 64 - (i * 4 - 12);
1586 if (i == 12)
1587 {
1588 a1 = 0 + 256;//64 - (i * 4 + 19);
1589 a2 = 35 + 256; //64 - (i * 4 - 19);
1590 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1591 } else
1592 {
1593 if (i > 11)
1594 {
1595 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1596 }
1597 else
1598 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1599 }
1600 }
1601 break;
1602 case 6:
1603 for (i = 0; i < 17; i ++)
1604 {
1605 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1606 clear_bitmap(ship_bitmaps [at] [i]);
1607 angle = i / (16 / (PI / 2)) - PI / 2;
1608 if (i == 16)
1609 angle = 0;
1610 x1 = 100 + cos(angle + PI) * 5;
1611 y1 = 100 + sin(angle + PI) * 5;
1612 x2 = 100 + cos(angle + PI / 2) * 9;
1613 y2 = 100 + sin(angle + PI / 2) * 9;
1614 x3 = 100 + cos(angle - PI / 2) * 9;
1615 y3 = 100 + sin(angle - PI / 2) * 9;
1616 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1617 x1 = 100 + cos(angle) * 7;
1618 y1 = 100 + sin(angle) * 7;
1619 x2 = 100 + cos(angle + PI + PI / 3) * 4;
1620 y2 = 100 + sin(angle + PI + PI / 3) * 4;
1621 x3 = 100 + cos(angle + PI - PI / 3) * 4;
1622 y3 = 100 + sin(angle + PI - PI / 3) * 4;
1623 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1624 x1 = 100 + cos(angle) * 6;
1625 y1 = 100 + sin(angle) * 6;
1626 x2 = 100 + cos(angle + PI + PI / 3) * 3;
1627 y2 = 100 + sin(angle + PI + PI / 3) * 3;
1628 x3 = 100 + cos(angle + PI - PI / 3) * 3;
1629 y3 = 100 + sin(angle + PI - PI / 3) * 3;
1630 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1631 x1 = 100 + cos(angle + PI) * 4;
1632 y1 = 100 + sin(angle + PI) * 4;
1633 x2 = 100 + cos(angle + PI / 2) * 8;
1634 y2 = 100 + sin(angle + PI / 2) * 8;
1635 x3 = 100 + cos(angle - PI / 2) * 8;
1636 y3 = 100 + sin(angle - PI / 2) * 8;
1637 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1638
1639
1640
1641
1642 x1 = 100 + cos(angle) * 3;
1643 y1 = 100 + sin(angle) * 3;
1644 circlefill(ship_bitmaps [at] [i], x1, y1, 1, COLOUR_WHITE);
1645 // line(ship_bitmaps [at] [i], x1, y1, x2, y2, COLOUR_GREY4);
1646 // line(ship_bitmaps [at] [i], x2, y2, x3, y3, COLOUR_GREY4);
1647 // line(ship_bitmaps [at] [i], x1, y1, x3, y3, COLOUR_GREY4);
1648 }
1649 break;
1650 case 7:
1651 for (i = 0; i < 17; i ++)
1652 {
1653 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1654 clear_bitmap(ship_bitmaps [at] [i]);
1655 angle = i / (16 / (PI / 2)) - PI / 2;
1656 if (i == 16)
1657 angle = 0;
1658 if (i == 0)
1659 angle = 1 / (16 / (PI / 2)) - PI / 2;;
1660 x = 100 + cos(angle) * 3;
1661 y = 100 + sin(angle) * 3;
1662 circlefill(ship_bitmaps [at] [i], x, y, 2, COLOUR_GREY4);
1663 x1 = x + cos(angle + PI / 3) * 6;
1664 y1 = y + sin(angle + PI / 3) * 6;
1665 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1666 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1667 x1 = x + cos(angle - PI / 3) * 6;
1668 y1 = y + sin(angle - PI / 3) * 6;
1669 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1670 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1671 x1 = x + cos(angle + PI + PI / 2) * 6;
1672 y1 = y + sin(angle + PI + PI / 2) * 6;
1673 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1674 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1675 x1 = x + cos(angle + PI - PI / 2) * 7;
1676 y1 = y + sin(angle + PI - PI / 2) * 7;
1677 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1678 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1679 x1 = 100 + cos(angle + PI + PI / 3) * 6;
1680 y1 = 100 + sin(angle + PI + PI / 3) * 6;
1681 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1682 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1683 x1 = 100 + cos(angle + PI - PI / 3) * 6;
1684 y1 = 100 + sin(angle + PI - PI / 3) * 6;
1685 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1686 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1687 x1 = 100 + cos(angle + PI + PI / 6) * 7;
1688 y1 = 100 + sin(angle + PI + PI / 6) * 7;
1689 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1690 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1691 x1 = 100 + cos(angle + PI - PI / 5) * 7;
1692 y1 = 100 + sin(angle + PI - PI / 5) * 7;
1693 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
1694 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
1695 x = 100 + cos(angle) * 3;
1696 y = 100 + sin(angle) * 3;
1697 circlefill(ship_bitmaps [at] [i], x, y, 3, COLOUR_GREY5);
1698
1699 a1 = 64 - (i * 4 + 12);
1700 a2 = 64 - (i * 4 - 12);
1701 if (i == 12)
1702 {
1703 a1 = 0 + 256;//64 - (i * 4 + 19);
1704 a2 = 35 + 256; //64 - (i * 4 - 19);
1705 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1706 } else
1707 {
1708 if (i > 11)
1709 {
1710 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1711 }
1712 else
1713 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
1714 }
1715 }
1716 break;
1717 case 8:
1718 for (i = 0; i < 17; i ++)
1719 {
1720 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1721 clear_bitmap(ship_bitmaps [at] [i]);
1722 angle = i / (16 / (PI / 2)) - PI / 2;
1723 if (i == 16)
1724 angle = 0;
1725 x1 = 100 + cos(angle) * 7;
1726 y1 = 100 + sin(angle) * 7;
1727 x2 = 100 + cos(angle + PI / 2) * 4;
1728 y2 = 100 + sin(angle + PI / 2) * 4;
1729 x3 = 100 + cos(angle - PI / 2) * 4;
1730 y3 = 100 + sin(angle - PI / 2) * 4;
1731 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1732 x1 = 100 + cos(angle) * 6;
1733 y1 = 100 + sin(angle) * 6;
1734 x2 = 100 + cos(angle + PI / 2) * 3;
1735 y2 = 100 + sin(angle + PI / 2) * 3;
1736 x3 = 100 + cos(angle - PI / 2) * 3;
1737 y3 = 100 + sin(angle - PI / 2) * 3;
1738 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1739 x1 = 100 + cos(angle) * 6;
1740 y1 = 100 + sin(angle) * 6;
1741 x2 = 100 + cos(angle + PI - PI / 2) * 8;
1742 y2 = 100 + sin(angle + PI - PI / 2) * 8;
1743 x3 = 100 + cos(angle + PI - PI / 4) * 8;
1744 y3 = 100 + sin(angle + PI - PI / 4) * 8;
1745 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1746 x1 = 100 + cos(angle) * 6;
1747 y1 = 100 + sin(angle) * 6;
1748 x2 = 100 + cos(angle + PI + PI / 2) * 8;
1749 y2 = 100 + sin(angle + PI + PI / 2) * 8;
1750 x3 = 100 + cos(angle + PI + PI / 4) * 8;
1751 y3 = 100 + sin(angle + PI + PI / 4) * 8;
1752 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1753 x1 = 100 + cos(angle) * 5;
1754 y1 = 100 + sin(angle) * 5;
1755 x2 = 100 + cos(angle + PI - PI / 2) * 7;
1756 y2 = 100 + sin(angle + PI - PI / 2) * 7;
1757 x3 = 100 + cos(angle + PI - PI / 4) * 7;
1758 y3 = 100 + sin(angle + PI - PI / 4) * 7;
1759 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1760 x1 = 100 + cos(angle) * 5;
1761 y1 = 100 + sin(angle) * 5;
1762 x2 = 100 + cos(angle + PI + PI / 2) * 7;
1763 y2 = 100 + sin(angle + PI + PI / 2) * 7;
1764 x3 = 100 + cos(angle + PI + PI / 4) * 7;
1765 y3 = 100 + sin(angle + PI + PI / 4) * 7;
1766 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1767 x1 = 100 + cos(angle) * 3;
1768 y1 = 100 + sin(angle) * 3;
1769 circlefill(ship_bitmaps [at] [i], x1, y1, 1, COLOUR_WHITE);
1770 }
1771 break;
1772 case 10:
1773 for (i = 0; i < 17; i ++)
1774 {
1775 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1776 clear_bitmap(ship_bitmaps [at] [i]);
1777 angle = i / (16 / (PI / 2)) - PI / 2;
1778 if (i == 16)
1779 angle = 0;
1780 x1 = 100 + cos(angle) * 7;
1781 y1 = 100 + sin(angle) * 7;
1782 x2 = 100 + cos(angle + PI / 2) * 4;
1783 y2 = 100 + sin(angle + PI / 2) * 4;
1784 x3 = 100 + cos(angle - PI / 2) * 4;
1785 y3 = 100 + sin(angle - PI / 2) * 4;
1786 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1787 x1 = 100 + cos(angle) * 6;
1788 y1 = 100 + sin(angle) * 6;
1789 x2 = 100 + cos(angle + PI / 2) * 3;
1790 y2 = 100 + sin(angle + PI / 2) * 3;
1791 x3 = 100 + cos(angle - PI / 2) * 3;
1792 y3 = 100 + sin(angle - PI / 2) * 3;
1793 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1794 x1 = 100 + cos(angle) * 6;
1795 y1 = 100 + sin(angle) * 6;
1796 x2 = 100 + cos(angle + PI - PI / 4) * 8;
1797 y2 = 100 + sin(angle + PI - PI / 4) * 8;
1798 x3 = 100 + cos(angle + PI - PI / 8) * 8;
1799 y3 = 100 + sin(angle + PI - PI / 8) * 8;
1800 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1801 x1 = 100 + cos(angle) * 6;
1802 y1 = 100 + sin(angle) * 6;
1803 x2 = 100 + cos(angle + PI + PI / 4) * 8;
1804 y2 = 100 + sin(angle + PI + PI / 4) * 8;
1805 x3 = 100 + cos(angle + PI + PI / 8) * 8;
1806 y3 = 100 + sin(angle + PI + PI / 8) * 8;
1807 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1808 x1 = 100 + cos(angle) * 5;
1809 y1 = 100 + sin(angle) * 5;
1810 x2 = 100 + cos(angle + PI - PI / 4) * 7;
1811 y2 = 100 + sin(angle + PI - PI / 4) * 7;
1812 x3 = 100 + cos(angle + PI - PI / 8) * 7;
1813 y3 = 100 + sin(angle + PI - PI / 8) * 7;
1814 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1815 x1 = 100 + cos(angle) * 5;
1816 y1 = 100 + sin(angle) * 5;
1817 x2 = 100 + cos(angle + PI + PI / 4) * 7;
1818 y2 = 100 + sin(angle + PI + PI / 4) * 7;
1819 x3 = 100 + cos(angle + PI + PI / 8) * 7;
1820 y3 = 100 + sin(angle + PI + PI / 8) * 7;
1821 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1822 x1 = 100 + cos(angle) * 3;
1823 y1 = 100 + sin(angle) * 3;
1824 circlefill(ship_bitmaps [at] [i], x1, y1, 1, COLOUR_WHITE);
1825 }
1826 break;
1827 // case 11:
1828 for (i = 0; i < 17; i ++)
1829 {
1830 tbmp = create_bitmap(210, 210);
1831 clear_bitmap(tbmp);
1832 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1833 clear_bitmap(ship_bitmaps [at] [i]);
1834 angle = i / (16 / (PI / 2)) - PI / 2;
1835 if (i == 16)
1836 angle = 0;
1837 /*
1838 points [0] = 100 + cos(angle + PI / 2) * 30;
1839 points [1] = 100 + sin(angle + PI / 2) * 30;
1840 points [2] = 100 + cos(angle + PI / 10) * 80;
1841 points [3] = 100 + sin(angle + PI / 10) * 80;
1842 points [4] = 100 + cos(angle + PI / 7) * 90;
1843 points [5] = 100 + sin(angle + PI / 7) * 90;
1844 points [6] = 100 + cos(angle + PI - PI / 3) * 50;
1845 points [7] = 100 + sin(angle + PI - PI / 3) * 50;
1846 points [8] = 100 + cos(angle + PI + PI / 3) * 50;
1847 points [9] = 100 + sin(angle + PI + PI / 3) * 50;
1848 points [10] = 100 + cos(angle - PI / 7) * 90;
1849 points [11] = 100 + sin(angle - PI / 7) * 90;
1850 points [12] = 100 + cos(angle - PI / 10) * 80;
1851 points [13] = 100 + sin(angle - PI / 10) * 80;
1852 points [14] = 100 + cos(angle - PI / 2) * 30;
1853 points [15] = 100 + sin(angle - PI / 2) * 30;
1854 polygon(ship_bitmaps [at] [i], 8, points, COLOUR_GREY4);
1855
1856 x1 = 100 + cos(angle + PI) * 40;
1857 y1 = 100 + sin(angle + PI) * 40;
1858 x2 = 100 + cos(angle + PI / 2) * 70;
1859 y2 = 100 + sin(angle + PI / 2) * 70;
1860 x3 = 100 + cos(angle - PI / 2) * 70;
1861 y3 = 100 + sin(angle - PI / 2) * 70;
1862 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1863 x1 = 100 + cos(angle + PI) * 30;
1864 y1 = 100 + sin(angle + PI) * 30;
1865 x2 = 100 + cos(angle + PI / 2) * 60;
1866 y2 = 100 + sin(angle + PI / 2) * 60;
1867 x3 = 100 + cos(angle - PI / 2) * 60;
1868 y3 = 100 + sin(angle - PI / 2) * 60;
1869 triangle(ship_bitmaps [at] [i], x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1870
1871 points [0] = 100 + cos(angle + PI / 2) * 20;
1872 points [1] = 100 + sin(angle + PI / 2) * 20;
1873 points [2] = 100 + cos(angle + PI / 8) * 70;
1874 points [3] = 100 + sin(angle + PI / 8) * 70;
1875 points [4] = 100 + cos(angle + PI / 5) * 80;
1876 points [5] = 100 + sin(angle + PI / 5) * 80;
1877 points [6] = 100 + cos(angle + PI - PI / 3) * 40;
1878 points [7] = 100 + sin(angle + PI - PI / 3) * 40;
1879 points [8] = 100 + cos(angle + PI + PI / 3) * 40;
1880 points [9] = 100 + sin(angle + PI + PI / 3) * 40;
1881 points [10] = 100 + cos(angle - PI / 5) * 80;
1882 points [11] = 100 + sin(angle - PI / 5) * 80;
1883 points [12] = 100 + cos(angle - PI / 8) * 70;
1884 points [13] = 100 + sin(angle - PI / 8) * 70;
1885 points [14] = 100 + cos(angle - PI / 2) * 20;
1886 points [15] = 100 + sin(angle - PI / 2) * 20;
1887 polygon(ship_bitmaps [at] [i], 8, points, COLOUR_GREY5);
1888
1889
1890
1891 x1 = 10;// - cos(angle) * 2;
1892 y1 = 10;// - sin(angle) * 2;
1893 circlefill(ship_bitmaps [at] [i], x1, y1, 10, COLOUR_WHITE);*/
1894 points [0] = 100 + cos(angle + PI / 2) * 30;
1895 points [1] = 100 + sin(angle + PI / 2) * 30;
1896 points [2] = 100 + cos(angle + PI / 10) * 80;
1897 points [3] = 100 + sin(angle + PI / 10) * 80;
1898 points [4] = 100 + cos(angle + PI / 7) * 90;
1899 points [5] = 100 + sin(angle + PI / 7) * 90;
1900 points [6] = 100 + cos(angle + PI - PI / 3) * 50;
1901 points [7] = 100 + sin(angle + PI - PI / 3) * 50;
1902 points [8] = 100 + cos(angle + PI + PI / 3) * 50;
1903 points [9] = 100 + sin(angle + PI + PI / 3) * 50;
1904 points [10] = 100 + cos(angle - PI / 7) * 90;
1905 points [11] = 100 + sin(angle - PI / 7) * 90;
1906 points [12] = 100 + cos(angle - PI / 10) * 80;
1907 points [13] = 100 + sin(angle - PI / 10) * 80;
1908 points [14] = 100 + cos(angle - PI / 2) * 30;
1909 points [15] = 100 + sin(angle - PI / 2) * 30;
1910 polygon(tbmp, 8, points, COLOUR_GREY4);
1911
1912 x1 = 100 + cos(angle + PI) * 40;
1913 y1 = 100 + sin(angle + PI) * 40;
1914 x2 = 100 + cos(angle + PI / 2) * 70;
1915 y2 = 100 + sin(angle + PI / 2) * 70;
1916 x3 = 100 + cos(angle - PI / 2) * 70;
1917 y3 = 100 + sin(angle - PI / 2) * 70;
1918 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
1919 x1 = 100 + cos(angle + PI) * 30;
1920 y1 = 100 + sin(angle + PI) * 30;
1921 x2 = 100 + cos(angle + PI / 2) * 60;
1922 y2 = 100 + sin(angle + PI / 2) * 60;
1923 x3 = 100 + cos(angle - PI / 2) * 60;
1924 y3 = 100 + sin(angle - PI / 2) * 60;
1925 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
1926
1927 points [0] = 100 + cos(angle + PI / 2) * 20;
1928 points [1] = 100 + sin(angle + PI / 2) * 20;
1929 points [2] = 100 + cos(angle + PI / 8) * 70;
1930 points [3] = 100 + sin(angle + PI / 8) * 70;
1931 points [4] = 100 + cos(angle + PI / 5) * 80;
1932 points [5] = 100 + sin(angle + PI / 5) * 80;
1933 points [6] = 100 + cos(angle + PI - PI / 3) * 40;
1934 points [7] = 100 + sin(angle + PI - PI / 3) * 40;
1935 points [8] = 100 + cos(angle + PI + PI / 3) * 40;
1936 points [9] = 100 + sin(angle + PI + PI / 3) * 40;
1937 points [10] = 100 + cos(angle - PI / 5) * 80;
1938 points [11] = 100 + sin(angle - PI / 5) * 80;
1939 points [12] = 100 + cos(angle - PI / 8) * 70;
1940 points [13] = 100 + sin(angle - PI / 8) * 70;
1941 points [14] = 100 + cos(angle - PI / 2) * 20;
1942 points [15] = 100 + sin(angle - PI / 2) * 20;
1943 polygon(tbmp, 8, points, COLOUR_GREY5);
1944
1945
1946
1947 x1 = 100;// - cos(angle) * 2;
1948 y1 = 100;// - sin(angle) * 2;
1949 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
1950 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
1951 }
1952
1953
1954 break;
1955 // case 11:
1956 for (i = 0; i < 17; i ++)
1957 {
1958 ship_bitmaps [at] [i] = create_bitmap(21, 21);
1959 clear_bitmap(ship_bitmaps [at] [i]);
1960 angle = i / (16 / (PI / 2)) - PI / 2;
1961 if (i == 16)
1962 angle = 0;
1963 if (i == 0)
1964 angle = 1 / (16 / (PI / 2)) - PI / 2;;
1965 points [0] = 100 + cos(angle) * 2;
1966 points [1] = 100 + sin(angle) * 2;
1967 points [2] = 100 + cos(angle + PI / 2) * 9;
1968 points [3] = 100 + sin(angle + PI / 2) * 9;
1969 points [4] = 100 + cos(angle + PI) * 2;
1970 points [5] = 100 + sin(angle + PI) * 2;
1971 points [6] = 100 + cos(angle - PI / 2) * 7;
1972 points [7] = 100 + sin(angle - PI / 2) * 7;
1973 polygon(ship_bitmaps [at] [i], 4, points, COLOUR_GREY4);
1974 circle(ship_bitmaps [at] [i], 10, 10, 7, COLOUR_GREY5);
1975 x = 10;// - cos(angle) * 3;
1976 y = 10;// - sin(angle) * 3;
1977 // circle(ship_bitmaps [at] [i], x, y, 7, COLOUR_GREY4);
1978 circle(ship_bitmaps [at] [i], x, y, 8, COLOUR_GREY5);
1979 x = 100 + cos(angle) * 12;
1980 y = 100 + sin(angle) * 12;
1981 circlefill(ship_bitmaps [at] [i], x, y, 9, 0);
1982 x = 10 - cos(angle) * 12;
1983 y = 10 - sin(angle) * 12;
1984 circlefill(ship_bitmaps [at] [i], x, y, 8, 0);
1985 circlefill(ship_bitmaps [at] [i], 10, 10, 3, COLOUR_GREY4);
1986
1987 points [0] = 100 + cos(angle) * 1;
1988 points [1] = 100 + sin(angle) * 1;
1989 points [2] = 100 + cos(angle + PI / 2) * 8;
1990 points [3] = 100 + sin(angle + PI / 2) * 8;
1991 points [4] = 100 + cos(angle + PI) * 1;
1992 points [5] = 100 + sin(angle + PI) * 1;
1993 points [6] = 100 + cos(angle - PI / 2) * 6;
1994 points [7] = 100 + sin(angle - PI / 2) * 6;
1995 polygon(ship_bitmaps [at] [i], 4, points, COLOUR_GREY5);
1996
1997 x = 10;// - cos(angle) * 3;
1998 y = 10;// - sin(angle) * 3;
1999 // circlefill(ship_bitmaps [at] [i], x, y, 3, COLOUR_GREY4);
2000 circlefill(ship_bitmaps [at] [i], x, y, 2, COLOUR_GREY5);
2001
2002 // circlefill(ship_bitmaps [at] [i], 10, 10, 1, COLOUR_GREY6);
2003
2004 x = 10;// - cos(angle) * 3;
2005 y = 10;// - sin(angle) * 3;
2006 a1 = 64 - (i * 4 + 12);
2007 a2 = 64 - (i * 4 - 12);
2008 if (i == 12)
2009 {
2010 a1 = 0 + 256;//64 - (i * 4 + 19);
2011 a2 = 35 + 256; //64 - (i * 4 - 19);
2012 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
2013 } else
2014 {
2015 if (i > 11)
2016 {
2017 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
2018 }
2019 else
2020 arc(ship_bitmaps [at] [i], x, y, itofix(a1), itofix(a2), 1, COLOUR_WHITE);
2021 }
2022 }
2023 break;
2024 case 11:
2025 for (i = 0; i < 17; i ++)
2026 {
2027 tbmp = create_bitmap(210, 210);
2028 clear_bitmap(tbmp);
2029 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2030 clear_bitmap(ship_bitmaps [at] [i]);
2031 angle = i / (16 / (PI / 2)) - PI / 2;
2032 if (i == 16)
2033 angle = 0;
2034 x1 = 100 + cos(angle) * 70;
2035 y1 = 100 + sin(angle) * 70;
2036 x2 = 100 + cos(angle + PI / 2) * 40;
2037 y2 = 100 + sin(angle + PI / 2) * 40;
2038 x3 = 100 + cos(angle - PI / 2) * 40;
2039 y3 = 100 + sin(angle - PI / 2) * 40;
2040 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2041 x1 = 100 + cos(angle) * 60;
2042 y1 = 100 + sin(angle) * 60;
2043 x2 = 100 + cos(angle + PI / 2) * 30;
2044 y2 = 100 + sin(angle + PI / 2) * 30;
2045 x3 = 100 + cos(angle - PI / 2) * 30;
2046 y3 = 100 + sin(angle - PI / 2) * 30;
2047 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2048 x1 = 100 + cos(angle) * 60;
2049 y1 = 100 + sin(angle) * 60;
2050 x2 = 100 + cos(angle + PI - PI / 4) * 80;
2051 y2 = 100 + sin(angle + PI - PI / 4) * 80;
2052 x3 = 100 + cos(angle + PI - PI / 8) * 80;
2053 y3 = 100 + sin(angle + PI - PI / 8) * 80;
2054 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2055 x1 = 100 + cos(angle) * 60;
2056 y1 = 100 + sin(angle) * 60;
2057 x2 = 100 + cos(angle + PI + PI / 4) * 80;
2058 y2 = 100 + sin(angle + PI + PI / 4) * 80;
2059 x3 = 100 + cos(angle + PI + PI / 8) * 80;
2060 y3 = 100 + sin(angle + PI + PI / 8) * 80;
2061 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2062 x1 = 100 + cos(angle) * 50;
2063 y1 = 100 + sin(angle) * 50;
2064 x2 = 100 + cos(angle + PI - PI / 4) * 70;
2065 y2 = 100 + sin(angle + PI - PI / 4) * 70;
2066 x3 = 100 + cos(angle + PI - PI / 8) * 70;
2067 y3 = 100 + sin(angle + PI - PI / 8) * 70;
2068 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2069 x1 = 100 + cos(angle) * 50;
2070 y1 = 100 + sin(angle) * 50;
2071 x2 = 100 + cos(angle + PI + PI / 4) * 70;
2072 y2 = 100 + sin(angle + PI + PI / 4) * 70;
2073 x3 = 100 + cos(angle + PI + PI / 8) * 70;
2074 y3 = 100 + sin(angle + PI + PI / 8) * 70;
2075 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2076 x1 = 100 + cos(angle) * 30;
2077 y1 = 100 + sin(angle) * 30;
2078 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2079 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2080 }
2081 break;
2082
2083 }
2084
2085 destroy_bitmap(tbmp);
2086 }
2087
2088
2089
2090 void make_actor_sprites(int at)
2091 {
2092
2093 int x,y,x1, x2, x3, y1, y2, y3;
2094 int i;
2095 float angle;
2096 int a1, a2;//, a3;
2097
2098 int points [16];
2099
2100 BITMAP *tbmp = create_bitmap(210, 210);
2101 BITMAP *tbmp2;
2102
2103 switch(at)
2104 {
2105 case 1:
2106 for (i = 0; i < 17; i ++)
2107 {
2108 clear_bitmap(tbmp);
2109 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2110 clear_bitmap(ship_bitmaps [at] [i]);
2111 angle = i / (16 / (PI / 2)) - PI / 2;
2112 if (i == 16)
2113 angle = 0;
2114 x1 = 100 + cos(angle) * 70;
2115 y1 = 100 + sin(angle) * 70;
2116 x2 = 100 + cos(angle + PI + PI / 3) * 60;
2117 y2 = 100 + sin(angle + PI + PI / 3) * 60;
2118 x3 = 100 + cos(angle + PI - PI / 3) * 60;
2119 y3 = 100 + sin(angle + PI - PI / 3) * 60;
2120 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2121 x1 = 100 + cos(angle) * 60;
2122 y1 = 100 + sin(angle) * 60;
2123 x2 = 100 + cos(angle + PI + PI / 3) * 50;
2124 y2 = 100 + sin(angle + PI + PI / 3) * 50;
2125 x3 = 100 + cos(angle + PI - PI / 3) * 50;
2126 y3 = 100 + sin(angle + PI - PI / 3) * 50;
2127 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2128 x1 = 100 + cos(angle) * 30;
2129 y1 = 100 + sin(angle) * 30;
2130 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2131 // line(ship_bitmaps [at] [i], x1, y1, x2, y2, COLOUR_GREY4);
2132 // line(ship_bitmaps [at] [i], x2, y2, x3, y3, COLOUR_GREY4);
2133 // line(ship_bitmaps [at] [i], x1, y1, x3, y3, COLOUR_GREY4);
2134 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2135 }
2136 break;
2137 case 2:
2138 for (i = 0; i < 17; i ++)
2139 {
2140 clear_bitmap(tbmp);
2141 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2142 clear_bitmap(ship_bitmaps [at] [i]);
2143 angle = i / (16 / (PI / 2)) - PI / 2;
2144 if (i == 16)
2145 angle = 0;
2146 x2 = 100 + cos(angle + PI + PI / 3) * 50;
2147 y2 = 100 + sin(angle + PI + PI / 3) * 50;
2148 circlefill(tbmp, x2, y2, 20, COLOUR_GREY5);
2149 x2 = 100 + cos(angle + PI - PI / 3) * (6 - (angle == 16));
2150 y2 = 100 + sin(angle + PI - PI / 3) * (6 - (angle == 16));
2151 circlefill(tbmp, x2, y2, 20, COLOUR_GREY5);
2152 x = 100;
2153 y = 100;
2154 circlefill(tbmp, x, y, 50, COLOUR_GREY4);
2155 circlefill(tbmp, x, y, 40, COLOUR_GREY5);
2156 // x1 = 100;// + cos(angle) * 20;
2157 // y1 = 100;// + sin(angle) * 20;
2158 // circlefill(tbmp, x1, y1, 1, COLOUR_WHITE);
2159 a1 = 64 - (i * 4 + 19);
2160 a2 = 64 - (i * 4 - 19);
2161 if (i == 12)
2162 {
2163 a1 = 0 + 256;//64 - (i * 4 + 19);
2164 a2 = 35 + 256; //64 - (i * 4 - 19);
2165 arc(tbmp, x, y, itofix(a1), itofix(a2), 30, COLOUR_WHITE);
2166 } else
2167 {
2168 if (i > 11)
2169 {
2170 arc(tbmp, x, y, itofix(a1), itofix(a2), 30, COLOUR_WHITE);
2171 // a3 = a1;
2172 // a1 = a2;
2173 // a2 = a3;
2174 }
2175 else
2176 arc(tbmp, x, y, itofix(a1), itofix(a2), 30, COLOUR_WHITE);
2177 }
2178
2179 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2180 }
2181
2182 break;
2183 case 3:
2184 for (i = 0; i < 17; i ++)
2185 {
2186 clear_bitmap(tbmp);
2187 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2188 clear_bitmap(ship_bitmaps [at] [i]);
2189 angle = i / (16 / (PI / 2)) - PI / 2;
2190 if (i == 16)
2191 angle = 0;
2192 circlefill(tbmp, 100, 100, 20, COLOUR_GREY4);
2193 x2 = 100 + cos(angle + PI + PI / 4) * 50;
2194 y2 = 100 + sin(angle + PI + PI / 4) * 50;
2195 circlefill(tbmp, x2, y2, 20, COLOUR_GREY4);
2196 circlefill(tbmp, x2, y2, 10, COLOUR_GREY5);
2197 x2 = 100 + cos(angle + PI + PI / 4) * 20;
2198 y2 = 100 + sin(angle + PI + PI / 4) * 20;
2199 circlefill(tbmp, x2, y2, 10, COLOUR_GREY5);
2200 x2 = 100 + cos(angle + PI - PI / 4) * 50;
2201 y2 = 100 + sin(angle + PI - PI / 4) * 50;
2202 circlefill(tbmp, x2, y2, 20, COLOUR_GREY4);
2203 circlefill(tbmp, x2, y2, 10, COLOUR_GREY5);
2204 x2 = 100 + cos(angle + PI - PI / 4) * 20;
2205 y2 = 100 + sin(angle + PI - PI / 4) * 20;
2206 circlefill(tbmp, x2, y2, 20, COLOUR_GREY5);
2207 x2 = 100 + cos(angle + PI / 4) * 50;
2208 y2 = 100 + sin(angle + PI / 4) * 50;
2209 circlefill(tbmp, x2, y2, 20, COLOUR_GREY4);
2210 circlefill(tbmp, x2, y2, 10, COLOUR_GREY5);
2211 x2 = 100 + cos(angle + PI / 4) * 20;
2212 y2 = 100 + sin(angle + PI / 4) * 20;
2213 circlefill(tbmp, x2, y2, 20, COLOUR_GREY5);
2214 x2 = 100 + cos(angle - PI / 4) * 50;
2215 y2 = 100 + sin(angle - PI / 4) * 50;
2216 circlefill(tbmp, x2, y2, 20, COLOUR_GREY4);
2217 circlefill(tbmp, x2, y2, 10, COLOUR_GREY5);
2218 x2 = 100 + cos(angle - PI / 4) * 20;
2219 y2 = 100 + sin(angle - PI / 4) * 20;
2220 circlefill(tbmp, x2, y2, 20, COLOUR_GREY5);
2221 x = 100;
2222 y = 100;
2223 circlefill(tbmp, x, y, 10, COLOUR_GREY5);
2224 // x1 = 100;// + cos(angle) * 20;
2225 // y1 = 100;// + sin(angle) * 20;
2226 // circlefill(tbmp, x1, y1, 1, COLOUR_WHITE);
2227 a1 = 64 - (i * 4 + 12);
2228 a2 = 64 - (i * 4 - 12);
2229 if (i == 12)
2230 {
2231 a1 = 0 + 256;//64 - (i * 4 + 19);
2232 a2 = 35 + 256; //64 - (i * 4 - 19);
2233 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2234 } else
2235 {
2236 if (i > 11)
2237 {
2238 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2239 // a3 = a1;
2240 // a1 = a2;
2241 // a2 = a3;
2242 }
2243 else
2244 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2245 }
2246 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2247 }
2248 break;
2249 case 4:
2250 tbmp2 = create_bitmap(210, 210);
2251 for (i = 0; i < 17; i ++)
2252 {
2253 clear_bitmap(tbmp);
2254 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2255 clear_bitmap(ship_bitmaps [at] [i]);
2256 clear_bitmap(tbmp2);
2257 angle = i / (16 / (PI / 2)) - PI / 2;
2258 if (i == 16)
2259 angle = 0;
2260 if (i == 0)
2261 angle = 1 / (16 / (PI / 2)) - PI / 2;;
2262 clear_bitmap(tbmp);
2263 circlefill(tbmp2, 100, 100, 70, COLOUR_GREY4);
2264 x = 100 + cos(angle) * 60;
2265 y = 100 + sin(angle) * 60;
2266 circlefill(tbmp2, x, y, 70, 0);
2267 blit(tbmp2, tbmp, 0,0,0,0,210,210);
2268 clear_bitmap(tbmp);
2269 circlefill(tbmp2, 100, 100, 60, COLOUR_GREY5);
2270 x = 100 + cos(angle) * 60;
2271 y = 100 + sin(angle) * 60;
2272 circlefill(tbmp2, x, y, 80, 0);
2273 x = 100;// - cos(angle) * 30;
2274 y = 100;// - sin(angle) * 30;
2275 circlefill(tbmp2, x, y, 30, COLOUR_GREY4);
2276 masked_blit(tbmp2, tbmp, 0,0,0,0,210,210);
2277 x = 100;// - cos(angle) * 30;
2278 y = 100;// - sin(angle) * 30;
2279 circlefill(tbmp, x, y, 20, COLOUR_GREY5);
2280 a1 = 64 - (i * 4 + 12);
2281 a2 = 64 - (i * 4 - 12);
2282 if (i == 12)
2283 {
2284 a1 = 0 + 256;//64 - (i * 4 + 19);
2285 a2 = 35 + 256; //64 - (i * 4 - 19);
2286 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2287 } else
2288 {
2289 if (i > 11)
2290 {
2291 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2292 }
2293 else
2294 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2295 }
2296 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2297 }
2298 destroy_bitmap(tbmp2);
2299 break;
2300 case 5:
2301 tbmp2 = create_bitmap(210, 210);
2302 for (i = 0; i < 17; i ++)
2303 {
2304 clear_bitmap(tbmp);
2305 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2306 clear_bitmap(ship_bitmaps [at] [i]);
2307 angle = i / (16 / (PI / 2)) - PI / 2;
2308 if (i == 16)
2309 angle = 0;
2310 if (i == 0)
2311 angle = 1 / (16 / (PI / 2)) - PI / 2;;
2312 clear_bitmap(tbmp2);
2313 circlefill(tbmp2, 100, 100, 70, COLOUR_GREY4);
2314 circlefill(tbmp2, 100, 100, 60, COLOUR_GREY5);
2315 /* x = 10 - cos(angle) * 40;
2316 y = 10 - sin(angle) * 40;
2317 circlefill(tbmp, x, y, 3, 0);
2318 x = 10 - cos(angle) * 30;
2319 y = 10 - sin(angle) * 30;
2320 circlefill(tbmp, x, y, 3, 0);
2321 x = 10 - cos(angle) * 20;
2322 y = 10 - sin(angle) * 20;
2323 circlefill(tbmp, x, y, 3, 0);*/
2324 x = 100;// ;;+ cos(angle) * 1;
2325 y = 100;// + sin(angle) * 1;
2326 circlefill(tbmp2, x, y, 30, 0);
2327 x = 100 + cos(angle) * 20;
2328 y = 100 + sin(angle) * 20;
2329 circlefill(tbmp2, x, y, 30, 0);
2330 x = 100 + cos(angle) * 30;
2331 y = 100 + sin(angle) * 30;
2332 circlefill(tbmp2, x, y, 30, 0);
2333 x = 100 + cos(angle) * 40;
2334 y = 100 + sin(angle) * 40;
2335 circlefill(tbmp2, x, y, 30, 0);
2336 x = 100 + cos(angle) * 50;
2337 y = 100 + sin(angle) * 50;
2338 circlefill(tbmp2, x, y, 30, 0);
2339 x = 100 + cos(angle) * 60;
2340 y = 100 + sin(angle) * 60;
2341 circlefill(tbmp2, x, y, 30, 0);
2342 x = 100 + cos(angle) * 70;
2343 y = 100 + sin(angle) * 70;
2344 circlefill(tbmp2, x, y, 30, 0);
2345 blit(tbmp2, tbmp, 0,0,0,0,210,210);
2346 clear_bitmap(tbmp2);
2347 /* circlefill(tbmp, 10, 10, 6, COLOUR_GREY5);
2348 x = 100 + cos(angle) * 60;
2349 y = 100 + sin(angle) * 60;
2350 circlefill(tbmp, x, y, 8, 0);
2351 x = 100;// - cos(angle) * 30;
2352 y = 100;// - sin(angle) * 30;
2353 circlefill(tbmp, x, y, 4, COLOUR_GREY4);
2354 masked_blit(tbmp, ship_bitmaps [at] [i], 0,0,0,0,21,21);*/
2355 x = 100;// - cos(angle) * 30;
2356 y = 100;// - sin(angle) * 30;
2357 circlefill(tbmp, x, y, 30, COLOUR_GREY5);
2358 a1 = 64 - (i * 4 + 12);
2359 a2 = 64 - (i * 4 - 12);
2360 if (i == 12)
2361 {
2362 a1 = 0 + 256;//64 - (i * 4 + 19);
2363 a2 = 35 + 256; //64 - (i * 4 - 19);
2364 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2365 } else
2366 {
2367 if (i > 11)
2368 {
2369 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2370 }
2371 else
2372 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2373 }
2374 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2375 }
2376 destroy_bitmap(tbmp2);
2377 break;
2378 case 6:
2379 for (i = 0; i < 17; i ++)
2380 {
2381 clear_bitmap(tbmp);
2382 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2383 clear_bitmap(ship_bitmaps [at] [i]);
2384 angle = i / (16 / (PI / 2)) - PI / 2;
2385 if (i == 16)
2386 angle = 0;
2387 x1 = 100 + cos(angle + PI) * 50;
2388 y1 = 100 + sin(angle + PI) * 50;
2389 x2 = 100 + cos(angle + PI / 2) * 90;
2390 y2 = 100 + sin(angle + PI / 2) * 90;
2391 x3 = 100 + cos(angle - PI / 2) * 90;
2392 y3 = 100 + sin(angle - PI / 2) * 90;
2393 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2394 x1 = 100 + cos(angle) * 70;
2395 y1 = 100 + sin(angle) * 70;
2396 x2 = 100 + cos(angle + PI + PI / 3) * 40;
2397 y2 = 100 + sin(angle + PI + PI / 3) * 40;
2398 x3 = 100 + cos(angle + PI - PI / 3) * 40;
2399 y3 = 100 + sin(angle + PI - PI / 3) * 40;
2400 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2401 x1 = 100 + cos(angle) * 60;
2402 y1 = 100 + sin(angle) * 60;
2403 x2 = 100 + cos(angle + PI + PI / 3) * 30;
2404 y2 = 100 + sin(angle + PI + PI / 3) * 30;
2405 x3 = 100 + cos(angle + PI - PI / 3) * 30;
2406 y3 = 100 + sin(angle + PI - PI / 3) * 30;
2407 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2408 x1 = 100 + cos(angle + PI) * 40;
2409 y1 = 100 + sin(angle + PI) * 40;
2410 x2 = 100 + cos(angle + PI / 2) * 80;
2411 y2 = 100 + sin(angle + PI / 2) * 80;
2412 x3 = 100 + cos(angle - PI / 2) * 80;
2413 y3 = 100 + sin(angle - PI / 2) * 80;
2414 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2415
2416
2417
2418
2419 x1 = 100 + cos(angle) * 30;
2420 y1 = 100 + sin(angle) * 30;
2421 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2422 // line(ship_bitmaps [at] [i], x1, y1, x2, y2, COLOUR_GREY4);
2423 // line(ship_bitmaps [at] [i], x2, y2, x3, y3, COLOUR_GREY4);
2424 // line(ship_bitmaps [at] [i], x1, y1, x3, y3, COLOUR_GREY4);
2425 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2426 }
2427 break;
2428 case 7:
2429 for (i = 0; i < 17; i ++)
2430 {
2431 clear_bitmap(tbmp);
2432 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2433 clear_bitmap(ship_bitmaps [at] [i]);
2434 angle = i / (16 / (PI / 2)) - PI / 2;
2435 if (i == 16)
2436 angle = 0;
2437 if (i == 0)
2438 angle = 1 / (16 / (PI / 2)) - PI / 2;;
2439 x = 100 + cos(angle) * 30;
2440 y = 100 + sin(angle) * 30;
2441 circlefill(tbmp, x, y, 20, COLOUR_GREY4);
2442 x1 = x + cos(angle + PI / 3) * 60;
2443 y1 = y + sin(angle + PI / 3) * 60;
2444 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2445 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2446 x1 = x + cos(angle - PI / 3) * 60;
2447 y1 = y + sin(angle - PI / 3) * 60;
2448 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2449 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2450 x1 = x + cos(angle + PI + PI / 2) * 60;
2451 y1 = y + sin(angle + PI + PI / 2) * 60;
2452 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2453 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2454 x1 = x + cos(angle + PI - PI / 2) * 70;
2455 y1 = y + sin(angle + PI - PI / 2) * 70;
2456 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2457 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2458 x1 = 100 + cos(angle + PI + PI / 3) * 60;
2459 y1 = 100 + sin(angle + PI + PI / 3) * 60;
2460 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2461 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2462 x1 = 100 + cos(angle + PI - PI / 3) * 60;
2463 y1 = 100 + sin(angle + PI - PI / 3) * 60;
2464 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2465 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2466 x1 = 100 + cos(angle + PI + PI / 6) * 70;
2467 y1 = 100 + sin(angle + PI + PI / 6) * 70;
2468 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2469 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2470 x1 = 100 + cos(angle + PI - PI / 5) * 70;
2471 y1 = 100 + sin(angle + PI - PI / 5) * 70;
2472 line(ship_bitmaps [at] [i], x, y, x1, y1, COLOUR_GREY4);
2473 putpixel(ship_bitmaps [at] [i], x1, y1, COLOUR_GREY6);
2474 x = 100 + cos(angle) * 30;
2475 y = 100 + sin(angle) * 30;
2476 circlefill(tbmp, x, y, 30, COLOUR_GREY5);
2477
2478 a1 = 64 - (i * 4 + 12);
2479 a2 = 64 - (i * 4 - 12);
2480 if (i == 12)
2481 {
2482 a1 = 0 + 256;//64 - (i * 4 + 19);
2483 a2 = 35 + 256; //64 - (i * 4 - 19);
2484 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2485 } else
2486 {
2487 if (i > 11)
2488 {
2489 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2490 }
2491 else
2492 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2493 }
2494 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2495 }
2496 break;
2497 case 8:
2498 for (i = 0; i < 17; i ++)
2499 {
2500 clear_bitmap(tbmp);
2501 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2502 clear_bitmap(ship_bitmaps [at] [i]);
2503 angle = i / (16 / (PI / 2)) - PI / 2;
2504 if (i == 16)
2505 angle = 0;
2506 x1 = 100 + cos(angle) * 70;
2507 y1 = 100 + sin(angle) * 70;
2508 x2 = 100 + cos(angle + PI / 2) * 50;
2509 y2 = 100 + sin(angle + PI / 2) * 50;
2510 x3 = 100 + cos(angle - PI / 2) * 50;
2511 y3 = 100 + sin(angle - PI / 2) * 50;
2512 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2513 x1 = 100 + cos(angle) * 60;
2514 y1 = 100 + sin(angle) * 60;
2515 x2 = 100 + cos(angle + PI / 2) * 40;
2516 y2 = 100 + sin(angle + PI / 2) * 40;
2517 x3 = 100 + cos(angle - PI / 2) * 40;
2518 y3 = 100 + sin(angle - PI / 2) * 40;
2519 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2520 x1 = 100 + cos(angle) * 60;
2521 y1 = 100 + sin(angle) * 60;
2522 x2 = 100 + cos(angle + PI - PI / 2) * 80;
2523 y2 = 100 + sin(angle + PI - PI / 2) * 80;
2524 x3 = 100 + cos(angle + PI - PI / 4) * 80;
2525 y3 = 100 + sin(angle + PI - PI / 4) * 80;
2526 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2527 x1 = 100 + cos(angle) * 60;
2528 y1 = 100 + sin(angle) * 60;
2529 x2 = 100 + cos(angle + PI + PI / 2) * 80;
2530 y2 = 100 + sin(angle + PI + PI / 2) * 80;
2531 x3 = 100 + cos(angle + PI + PI / 4) * 80;
2532 y3 = 100 + sin(angle + PI + PI / 4) * 80;
2533 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2534 x1 = 100 + cos(angle) * 50;
2535 y1 = 100 + sin(angle) * 50;
2536 x2 = 100 + cos(angle + PI - PI / 2) * 70;
2537 y2 = 100 + sin(angle + PI - PI / 2) * 70;
2538 x3 = 100 + cos(angle + PI - PI / 4) * 70;
2539 y3 = 100 + sin(angle + PI - PI / 4) * 70;
2540 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2541 x1 = 100 + cos(angle) * 50;
2542 y1 = 100 + sin(angle) * 50;
2543 x2 = 100 + cos(angle + PI + PI / 2) * 70;
2544 y2 = 100 + sin(angle + PI + PI / 2) * 70;
2545 x3 = 100 + cos(angle + PI + PI / 4) * 70;
2546 y3 = 100 + sin(angle + PI + PI / 4) * 70;
2547 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2548 x1 = 100 + cos(angle) * 30;
2549 y1 = 100 + sin(angle) * 30;
2550 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2551 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2552 /* x1 = 100 + cos(angle) * 70;
2553 y1 = 100 + sin(angle) * 70;
2554 x2 = 100 + cos(angle + PI / 2) * 40;
2555 y2 = 100 + sin(angle + PI / 2) * 40;
2556 x3 = 100 + cos(angle - PI / 2) * 40;
2557 y3 = 100 + sin(angle - PI / 2) * 40;
2558 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2559 x1 = 100 + cos(angle) * 60;
2560 y1 = 100 + sin(angle) * 60;
2561 x2 = 100 + cos(angle + PI / 2) * 30;
2562 y2 = 100 + sin(angle + PI / 2) * 30;
2563 x3 = 100 + cos(angle - PI / 2) * 30;
2564 y3 = 100 + sin(angle - PI / 2) * 30;
2565 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2566 x1 = 100 + cos(angle) * 60;
2567 y1 = 100 + sin(angle) * 60;
2568 x2 = 100 + cos(angle + PI - PI / 2) * 80;
2569 y2 = 100 + sin(angle + PI - PI / 2) * 80;
2570 x3 = 100 + cos(angle + PI - PI / 4) * 80;
2571 y3 = 100 + sin(angle + PI - PI / 4) * 80;
2572 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2573 x1 = 100 + cos(angle) * 60;
2574 y1 = 100 + sin(angle) * 60;
2575 x2 = 100 + cos(angle + PI + PI / 2) * 80;
2576 y2 = 100 + sin(angle + PI + PI / 2) * 80;
2577 x3 = 100 + cos(angle + PI + PI / 4) * 80;
2578 y3 = 100 + sin(angle + PI + PI / 4) * 80;
2579 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2580 x1 = 100 + cos(angle) * 50;
2581 y1 = 100 + sin(angle) * 50;
2582 x2 = 100 + cos(angle + PI - PI / 2) * 70;
2583 y2 = 100 + sin(angle + PI - PI / 2) * 70;
2584 x3 = 100 + cos(angle + PI - PI / 4) * 70;
2585 y3 = 100 + sin(angle + PI - PI / 4) * 70;
2586 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2587 x1 = 100 + cos(angle) * 50;
2588 y1 = 100 + sin(angle) * 50;
2589 x2 = 100 + cos(angle + PI + PI / 2) * 70;
2590 y2 = 100 + sin(angle + PI + PI / 2) * 70;
2591 x3 = 100 + cos(angle + PI + PI / 4) * 70;
2592 y3 = 100 + sin(angle + PI + PI / 4) * 70;
2593 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2594 x1 = 100 + cos(angle) * 30;
2595 y1 = 100 + sin(angle) * 30;
2596 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2597 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);*/
2598 }
2599 break;
2600 case 9:
2601 for (i = 0; i < 17; i ++)
2602 {
2603 clear_bitmap(tbmp);
2604 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2605 clear_bitmap(ship_bitmaps [at] [i]);
2606 angle = i / (16 / (PI / 2)) - PI / 2;
2607 if (i == 16)
2608 angle = 0;
2609 x1 = 100 + cos(angle) * 70;
2610 y1 = 100 + sin(angle) * 70;
2611 x2 = 100 + cos(angle + PI / 2) * 30;
2612 y2 = 100 + sin(angle + PI / 2) * 30;
2613 x3 = 100 + cos(angle - PI / 2) * 30;
2614 y3 = 100 + sin(angle - PI / 2) * 30;
2615 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2616 x1 = 100 + cos(angle) * 60;
2617 y1 = 100 + sin(angle) * 60;
2618 x2 = 100 + cos(angle + PI / 2) * 20;
2619 y2 = 100 + sin(angle + PI / 2) * 20;
2620 x3 = 100 + cos(angle - PI / 2) * 20;
2621 y3 = 100 + sin(angle - PI / 2) * 20;
2622 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2623 x1 = 100 + cos(angle) * 60;
2624 y1 = 100 + sin(angle) * 60;
2625 x2 = 100 + cos(angle + PI - PI / 4) * 80;
2626 y2 = 100 + sin(angle + PI - PI / 4) * 80;
2627 x3 = 100 + cos(angle + PI - PI / 8) * 80;
2628 y3 = 100 + sin(angle + PI - PI / 8) * 80;
2629 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2630 x1 = 100 + cos(angle) * 60;
2631 y1 = 100 + sin(angle) * 60;
2632 x2 = 100 + cos(angle + PI + PI / 4) * 80;
2633 y2 = 100 + sin(angle + PI + PI / 4) * 80;
2634 x3 = 100 + cos(angle + PI + PI / 8) * 80;
2635 y3 = 100 + sin(angle + PI + PI / 8) * 80;
2636 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2637 x1 = 100 + cos(angle) * 50;
2638 y1 = 100 + sin(angle) * 50;
2639 x2 = 100 + cos(angle + PI - PI / 4) * 70;
2640 y2 = 100 + sin(angle + PI - PI / 4) * 70;
2641 x3 = 100 + cos(angle + PI - PI / 8) * 70;
2642 y3 = 100 + sin(angle + PI - PI / 8) * 70;
2643 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2644 x1 = 100 + cos(angle) * 50;
2645 y1 = 100 + sin(angle) * 50;
2646 x2 = 100 + cos(angle + PI + PI / 4) * 70;
2647 y2 = 100 + sin(angle + PI + PI / 4) * 70;
2648 x3 = 100 + cos(angle + PI + PI / 8) * 70;
2649 y3 = 100 + sin(angle + PI + PI / 8) * 70;
2650 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2651 x1 = 100 + cos(angle) * 30;
2652 y1 = 100 + sin(angle) * 30;
2653 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2654 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2655 }
2656 break;
2657 case 11:
2658 for (i = 0; i < 17; i ++)
2659 {
2660 clear_bitmap(tbmp);
2661 // tbmp = create_bitmap(210, 210);
2662 // clear_bitmap(tbmp);
2663 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2664 clear_bitmap(ship_bitmaps [at] [i]);
2665 angle = i / (16 / (PI / 2)) - PI / 2;
2666 if (i == 16)
2667 angle = 0;
2668 points [0] = 100 + cos(angle + PI / 2) * 30;
2669 points [1] = 100 + sin(angle + PI / 2) * 30;
2670 points [2] = 100 + cos(angle + PI / 10) * 80;
2671 points [3] = 100 + sin(angle + PI / 10) * 80;
2672 points [4] = 100 + cos(angle + PI / 7) * 90;
2673 points [5] = 100 + sin(angle + PI / 7) * 90;
2674 points [6] = 100 + cos(angle + PI - PI / 3) * 50;
2675 points [7] = 100 + sin(angle + PI - PI / 3) * 50;
2676 points [8] = 100 + cos(angle + PI + PI / 3) * 50;
2677 points [9] = 100 + sin(angle + PI + PI / 3) * 50;
2678 points [10] = 100 + cos(angle - PI / 7) * 90;
2679 points [11] = 100 + sin(angle - PI / 7) * 90;
2680 points [12] = 100 + cos(angle - PI / 10) * 80;
2681 points [13] = 100 + sin(angle - PI / 10) * 80;
2682 points [14] = 100 + cos(angle - PI / 2) * 30;
2683 points [15] = 100 + sin(angle - PI / 2) * 30;
2684 polygon(tbmp, 8, points, COLOUR_GREY4);
2685
2686 x1 = 100 + cos(angle + PI) * 40;
2687 y1 = 100 + sin(angle + PI) * 40;
2688 x2 = 100 + cos(angle + PI / 2) * 70;
2689 y2 = 100 + sin(angle + PI / 2) * 70;
2690 x3 = 100 + cos(angle - PI / 2) * 70;
2691 y3 = 100 + sin(angle - PI / 2) * 70;
2692 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2693 x1 = 100 + cos(angle + PI) * 30;
2694 y1 = 100 + sin(angle + PI) * 30;
2695 x2 = 100 + cos(angle + PI / 2) * 60;
2696 y2 = 100 + sin(angle + PI / 2) * 60;
2697 x3 = 100 + cos(angle - PI / 2) * 60;
2698 y3 = 100 + sin(angle - PI / 2) * 60;
2699 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2700
2701 points [0] = 100 + cos(angle + PI / 2) * 20;
2702 points [1] = 100 + sin(angle + PI / 2) * 20;
2703 points [2] = 100 + cos(angle + PI / 8) * 70;
2704 points [3] = 100 + sin(angle + PI / 8) * 70;
2705 points [4] = 100 + cos(angle + PI / 5) * 80;
2706 points [5] = 100 + sin(angle + PI / 5) * 80;
2707 points [6] = 100 + cos(angle + PI - PI / 3) * 40;
2708 points [7] = 100 + sin(angle + PI - PI / 3) * 40;
2709 points [8] = 100 + cos(angle + PI + PI / 3) * 40;
2710 points [9] = 100 + sin(angle + PI + PI / 3) * 40;
2711 points [10] = 100 + cos(angle - PI / 5) * 80;
2712 points [11] = 100 + sin(angle - PI / 5) * 80;
2713 points [12] = 100 + cos(angle - PI / 8) * 70;
2714 points [13] = 100 + sin(angle - PI / 8) * 70;
2715 points [14] = 100 + cos(angle - PI / 2) * 20;
2716 points [15] = 100 + sin(angle - PI / 2) * 20;
2717 polygon(tbmp, 8, points, COLOUR_GREY5);
2718
2719
2720
2721 x1 = 100;// - cos(angle) * 20;
2722 y1 = 100;// - sin(angle) * 20;
2723 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2724 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2725 }
2726
2727
2728 break;
2729 /* case 12:
2730 for (i = 0; i < 17; i ++)
2731 {
2732 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2733 clear_bitmap(ship_bitmaps [at] [i]);
2734 angle = i / (16 / (PI / 2)) - PI / 2;
2735 if (i == 16)
2736 angle = 0;
2737 if (i == 0)
2738 angle = 1 / (16 / (PI / 2)) - PI / 2;;
2739 points [0] = 100 + cos(angle) * 20;
2740 points [1] = 100 + sin(angle) * 20;
2741 points [2] = 100 + cos(angle + PI / 2) * 90;
2742 points [3] = 100 + sin(angle + PI / 2) * 90;
2743 points [4] = 100 + cos(angle + PI) * 20;
2744 points [5] = 100 + sin(angle + PI) * 20;
2745 points [6] = 100 + cos(angle - PI / 2) * 70;
2746 points [7] = 100 + sin(angle - PI / 2) * 70;
2747 polygon(ship_bitmaps [at] [i], 4, points, COLOUR_GREY4);
2748 circle(tbmp, 100, 100, 70, COLOUR_GREY5);
2749 x = 100;// - cos(angle) * 30;
2750 y = 100;// - sin(angle) * 30;
2751 // circle(tbmp, x, y, 7, COLOUR_GREY4);
2752 circle(tbmp, x, y, 80, COLOUR_GREY5);
2753 x = 100 + cos(angle) * 12;
2754 y = 100 + sin(angle) * 12;
2755 circlefill(tbmp, x, y, 90, 0);
2756 x = 10 - cos(angle) * 12;
2757 y = 10 - sin(angle) * 12;
2758 circlefill(tbmp, x, y, 80, 0);
2759 circlefill(tbmp, 100, 100, 30, COLOUR_GREY4);
2760
2761 points [0] = 100 + cos(angle) * 1;
2762 points [1] = 100 + sin(angle) * 1;
2763 points [2] = 100 + cos(angle + PI / 2) * 80;
2764 points [3] = 100 + sin(angle + PI / 2) * 80;
2765 points [4] = 100 + cos(angle + PI) * 1;
2766 points [5] = 100 + sin(angle + PI) * 1;
2767 points [6] = 100 + cos(angle - PI / 2) * 60;
2768 points [7] = 100 + sin(angle - PI / 2) * 60;
2769 polygon(ship_bitmaps [at] [i], 4, points, COLOUR_GREY5);
2770
2771 x = 100;// - cos(angle) * 30;
2772 y = 100;// - sin(angle) * 30;
2773 // circlefill(tbmp, x, y, 3, COLOUR_GREY4);
2774 circlefill(tbmp, x, y, 20, COLOUR_GREY5);
2775
2776 // circlefill(tbmp, 10, 10, 1, COLOUR_GREY6);
2777
2778 x = 100;// - cos(angle) * 30;
2779 y = 100;// - sin(angle) * 30;
2780 a1 = 64 - (i * 4 + 12);
2781 a2 = 64 - (i * 4 - 12);
2782 if (i == 12)
2783 {
2784 a1 = 0 + 256;//64 - (i * 4 + 19);
2785 a2 = 35 + 256; //64 - (i * 4 - 19);
2786 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2787 } else
2788 {
2789 if (i > 11)
2790 {
2791 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2792 }
2793 else
2794 arc(tbmp, x, y, itofix(a1), itofix(a2), 10, COLOUR_WHITE);
2795 }
2796 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2797 }
2798 break;*/
2799 /* case 13:
2800 for (i = 0; i < 17; i ++)
2801 {
2802 //. tbmp = create_bitmap(210, 210);
2803 clear_bitmap(tbmp);
2804 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2805 clear_bitmap(ship_bitmaps [at] [i]);
2806 angle = i / (16 / (PI / 2)) - PI / 2;
2807 if (i == 16)
2808 angle = 0;
2809 x1 = 100 + cos(angle) * 70;
2810 y1 = 100 + sin(angle) * 70;
2811 x2 = 100 + cos(angle + PI / 2) * 40;
2812 y2 = 100 + sin(angle + PI / 2) * 40;
2813 x3 = 100 + cos(angle - PI / 2) * 40;
2814 y3 = 100 + sin(angle - PI / 2) * 40;
2815 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2816 x1 = 100 + cos(angle) * 60;
2817 y1 = 100 + sin(angle) * 60;
2818 x2 = 100 + cos(angle + PI / 2) * 30;
2819 y2 = 100 + sin(angle + PI / 2) * 30;
2820 x3 = 100 + cos(angle - PI / 2) * 30;
2821 y3 = 100 + sin(angle - PI / 2) * 30;
2822 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2823 x1 = 100 + cos(angle) * 60;
2824 y1 = 100 + sin(angle) * 60;
2825 x2 = 100 + cos(angle + PI - PI / 4) * 80;
2826 y2 = 100 + sin(angle + PI - PI / 4) * 80;
2827 x3 = 100 + cos(angle + PI - PI / 8) * 80;
2828 y3 = 100 + sin(angle + PI - PI / 8) * 80;
2829 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2830 x1 = 100 + cos(angle) * 60;
2831 y1 = 100 + sin(angle) * 60;
2832 x2 = 100 + cos(angle + PI + PI / 4) * 80;
2833 y2 = 100 + sin(angle + PI + PI / 4) * 80;
2834 x3 = 100 + cos(angle + PI + PI / 8) * 80;
2835 y3 = 100 + sin(angle + PI + PI / 8) * 80;
2836 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2837 x1 = 100 + cos(angle) * 50;
2838 y1 = 100 + sin(angle) * 50;
2839 x2 = 100 + cos(angle + PI - PI / 4) * 70;
2840 y2 = 100 + sin(angle + PI - PI / 4) * 70;
2841 x3 = 100 + cos(angle + PI - PI / 8) * 70;
2842 y3 = 100 + sin(angle + PI - PI / 8) * 70;
2843 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2844 x1 = 100 + cos(angle) * 50;
2845 y1 = 100 + sin(angle) * 50;
2846 x2 = 100 + cos(angle + PI + PI / 4) * 70;
2847 y2 = 100 + sin(angle + PI + PI / 4) * 70;
2848 x3 = 100 + cos(angle + PI + PI / 8) * 70;
2849 y3 = 100 + sin(angle + PI + PI / 8) * 70;
2850 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2851 x1 = 100 + cos(angle) * 30;
2852 y1 = 100 + sin(angle) * 30;
2853 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2854 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2855 }
2856 break;*/
2857 case 12:
2858 for (i = 0; i < 17; i ++)
2859 {
2860 clear_bitmap(tbmp);
2861 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2862 clear_bitmap(ship_bitmaps [at] [i]);
2863 angle = i / (16 / (PI / 2)) - PI / 2;
2864 if (i == 16)
2865 angle = 0;
2866 x1 = 100 + cos(angle) * 90;
2867 y1 = 100 + sin(angle) * 90;
2868 x2 = 100 + cos(angle + PI / 2) * 40;
2869 y2 = 100 + sin(angle + PI / 2) * 40;
2870 x3 = 100 + cos(angle - PI / 2) * 40;
2871 y3 = 100 + sin(angle - PI / 2) * 40;
2872 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2873 x1 = 100 + cos(angle + PI - PI / 3) * 90;
2874 y1 = 100 + sin(angle + PI - PI / 3) * 90;
2875 x2 = 100 + cos(angle + PI / 4) * 40;
2876 y2 = 100 + sin(angle + PI / 4) * 40;
2877 x3 = 100 + cos(angle + PI) * 20;
2878 y3 = 100 + sin(angle + PI) * 20;
2879 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2880 x1 = 100 + cos(angle + PI + PI / 3) * 90;
2881 y1 = 100 + sin(angle + PI + PI / 3) * 90;
2882 x2 = 100 + cos(angle - PI / 4) * 40;
2883 y2 = 100 + sin(angle - PI / 4) * 40;
2884 x3 = 100 + cos(angle + PI) * 20;
2885 y3 = 100 + sin(angle + PI) * 20;
2886 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2887 x1 = 100;
2888 y1 = 100;
2889 circlefill(tbmp, x1, y1, 30, COLOUR_GREY4);
2890
2891 x1 = 100 + cos(angle) * 80;
2892 y1 = 100 + sin(angle) * 80;
2893 x2 = 100 + cos(angle + PI / 2) * 30;
2894 y2 = 100 + sin(angle + PI / 2) * 30;
2895 x3 = 100 + cos(angle - PI / 2) * 30;
2896 y3 = 100 + sin(angle - PI / 2) * 30;
2897 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2898 x1 = 100 + cos(angle + PI - PI / 3) * 80;
2899 y1 = 100 + sin(angle + PI - PI / 3) * 80;
2900 x2 = 100 + cos(angle + PI / 4) * 30;
2901 y2 = 100 + sin(angle + PI / 4) * 30;
2902 x3 = 100 + cos(angle + PI) * 10;
2903 y3 = 100 + sin(angle + PI) * 10;
2904 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2905 x1 = 100 + cos(angle + PI + PI / 3) * 80;
2906 y1 = 100 + sin(angle + PI + PI / 3) * 80;
2907 x2 = 100 + cos(angle - PI / 4) * 30;
2908 y2 = 100 + sin(angle - PI / 4) * 30;
2909 x3 = 100 + cos(angle + PI) * 10;
2910 y3 = 100 + sin(angle + PI) * 10;
2911 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2912 x1 = 100;
2913 y1 = 100;
2914 circlefill(tbmp, x1, y1, 20, COLOUR_GREY5);
2915 /* x1 = 100 + cos(angle + PI / 2) * 80;
2916 y1 = 100 + sin(angle + PI / 2) * 80;
2917 x2 = 100;// + cos(angle + PI / 2) * 20;
2918 y2 = 100;// + sin(angle + PI / 2) * 20;
2919 x3 = 100 + cos(angle + PI / 2 + PI / 5) * 80;
2920 y3 = 100 + sin(angle + PI / 2 + PI / 5) * 80;
2921 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2922 x1 = 100 + cos(angle - PI / 2) * 80;
2923 y1 = 100 + sin(angle - PI / 2) * 80;
2924 x2 = 100;// + cos(angle + PI / 2) * 20;
2925 y2 = 100;// + sin(angle + PI / 2) * 20;
2926 x3 = 100 + cos(angle - PI / 2 - PI / 5) * 80;
2927 y3 = 100 + sin(angle - PI / 2 - PI / 5) * 80;
2928 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
2929 x1 = 100 + cos(angle) * 70;
2930 y1 = 100 + sin(angle) * 70;
2931 x2 = 100 + cos(angle + PI / 2) * 35;
2932 y2 = 100 + sin(angle + PI / 2) * 35;
2933 x3 = 100 + cos(angle - PI / 2) * 35;
2934 y3 = 100 + sin(angle - PI / 2) * 35;
2935 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2936 x1 = 100 + cos(angle + PI / 2) * 70;
2937 y1 = 100 + sin(angle + PI / 2) * 70;
2938 x2 = 100;// + cos(angle + PI / 2) * 20;
2939 y2 = 100;// + sin(angle + PI / 2) * 20;
2940 x3 = 100 + cos(angle + PI / 2 + PI / 5) * 70;
2941 y3 = 100 + sin(angle + PI / 2 + PI / 5) * 70;
2942 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2943 x1 = 100 + cos(angle - PI / 2) * 70;
2944 y1 = 100 + sin(angle - PI / 2) * 70;
2945 x2 = 100;// + cos(angle + PI / 2) * 20;
2946 y2 = 100;// + sin(angle + PI / 2) * 20;
2947 x3 = 100 + cos(angle - PI / 2 - PI / 5) * 70;
2948 y3 = 100 + sin(angle - PI / 2 - PI / 5) * 70;
2949 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);*/
2950 x1 = 100 + cos(angle) * 40;
2951 y1 = 100 + sin(angle) * 40;
2952 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
2953 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
2954 }
2955 break;
2956 case 13:
2957 tbmp2 = create_bitmap(210, 210);
2958 for (i = 0; i < 17; i ++)
2959 {
2960 clear_bitmap(tbmp);
2961 ship_bitmaps [at] [i] = create_bitmap(21, 21);
2962 clear_bitmap(ship_bitmaps [at] [i]);
2963 angle = i / (16 / (PI / 2)) - PI / 2;
2964 if (i == 16)
2965 angle = 0;
2966 if (i == 0)
2967 angle = 1 / (16 / (PI / 2)) - PI / 2;;
2968 clear_bitmap(tbmp2);
2969 x1 = 100 - cos(angle) * 20;
2970 y1 = 100 - sin(angle) * 20;
2971 circlefill(tbmp2, x1, y1, 80, COLOUR_GREY4);
2972 circlefill(tbmp2, x1, y1, 70, COLOUR_GREY5);
2973 // x = 100;// ;;+ cos(angle) * 1;
2974 // y = 100;// + sin(angle) * 1;
2975 // circlefill(tbmp2, x, y, 30, 0);
2976 x = 100 - cos(angle) * 70;
2977 y = 100 - sin(angle) * 70;
2978 circlefill(tbmp2, x, y, 75, 0);
2979 /* x = 100 - cos(angle) * 30;
2980 y = 100 - sin(angle) * 30;
2981 circlefill(tbmp2, x, y, 30, 0);
2982 x = 100 - cos(angle) * 40;
2983 y = 100 - sin(angle) * 40;
2984 circlefill(tbmp2, x, y, 30, 0);
2985 x = 100 - cos(angle) * 50;
2986 y = 100 - sin(angle) * 50;
2987 circlefill(tbmp2, x, y, 30, 0);
2988 x = 100 - cos(angle) * 60;
2989 y = 100 - sin(angle) * 60;
2990 circlefill(tbmp2, x, y, 30, 0);
2991 x = 100 - cos(angle) * 70;
2992 y = 100 - sin(angle) * 70;
2993 circlefill(tbmp2, x, y, 30, 0);*/
2994 blit(tbmp2, tbmp, 0,0,0,0,210,210);
2995 clear_bitmap(tbmp2);
2996 x = x1 + cos(angle + PI / 4 + PI / 6) * 40;
2997 y = y1 + sin(angle + PI / 4 + PI / 6) * 40;
2998 circlefill(tbmp, x, y, 20, COLOUR_GREY4);
2999 circlefill(tbmp, x, y, 10, COLOUR_GREY5);
3000 x = x1 + cos(angle - PI / 4 - PI / 6) * 40;
3001 y = y1 + sin(angle - PI / 4 - PI / 6) * 40;
3002 circlefill(tbmp, x, y, 20, COLOUR_GREY4);
3003 circlefill(tbmp, x, y, 10, COLOUR_GREY5);
3004 x = 100 - cos(angle) * 20;
3005 y = 100 - sin(angle) * 20;
3006 a1 = 64 - (i * 4 + 12);
3007 a2 = 64 - (i * 4 - 12);
3008 if (i == 12)
3009 {
3010 a1 = 0 + 256;//64 - (i * 4 + 19);
3011 a2 = 35 + 256; //64 - (i * 4 - 19);
3012 }
3013 arc(tbmp, x, y, itofix(a1), itofix(a2), 50, COLOUR_WHITE);
3014 arc(tbmp, x, y, itofix(a1), itofix(a2), 49, COLOUR_WHITE);
3015 arc(tbmp, x, y, itofix(a1), itofix(a2), 48, COLOUR_WHITE);
3016 arc(tbmp, x, y, itofix(a1), itofix(a2), 47, COLOUR_WHITE);
3017 arc(tbmp, x, y, itofix(a1), itofix(a2), 46, COLOUR_WHITE);
3018 arc(tbmp, x, y, itofix(a1), itofix(a2), 45, COLOUR_WHITE);
3019 arc(tbmp, x, y, itofix(a1), itofix(a2), 44, COLOUR_WHITE);
3020 arc(tbmp, x, y, itofix(a1), itofix(a2), 43, COLOUR_WHITE);
3021 arc(tbmp, x, y, itofix(a1), itofix(a2), 42, COLOUR_WHITE);
3022 /* if (i == 12)
3023 {
3024 a1 = 0 + 256;//64 - (i * 4 + 19);
3025 a2 = 35 + 256; //64 - (i * 4 - 19);
3026 arc(tbmp, x, y, itofix(a1), itofix(a2), 50, COLOUR_WHITE);
3027 arc(tbmp, x, y, itofix(a1), itofix(a2), 49, COLOUR_WHITE);
3028 arc(tbmp, x, y, itofix(a1), itofix(a2), 48, COLOUR_WHITE);
3029 arc(tbmp, x, y, itofix(a1), itofix(a2), 47, COLOUR_WHITE);
3030 arc(tbmp, x, y, itofix(a1), itofix(a2), 46, COLOUR_WHITE);
3031 } else
3032 {
3033 if (i > 11)
3034 {
3035 arc(tbmp, x, y, itofix(a1), itofix(a2), 50, COLOUR_WHITE);
3036 arc(tbmp, x, y, itofix(a1), itofix(a2), 49, COLOUR_WHITE);
3037 arc(tbmp, x, y, itofix(a1), itofix(a2), 48, COLOUR_WHITE);
3038 arc(tbmp, x, y, itofix(a1), itofix(a2), 47, COLOUR_WHITE);
3039 arc(tbmp, x, y, itofix(a1), itofix(a2), 46, COLOUR_WHITE);
3040 }
3041 else
3042 {
3043 arc(tbmp, x, y, itofix(a1), itofix(a2), 50, COLOUR_WHITE);
3044 arc(tbmp, x, y, itofix(a1), itofix(a2), 49, COLOUR_WHITE);
3045 arc(tbmp, x, y, itofix(a1), itofix(a2), 48, COLOUR_WHITE);
3046 arc(tbmp, x, y, itofix(a1), itofix(a2), 47, COLOUR_WHITE);
3047 arc(tbmp, x, y, itofix(a1), itofix(a2), 46, COLOUR_WHITE);
3048 }
3049 }*/
3050 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
3051 }
3052 destroy_bitmap(tbmp2);
3053 break;
3054 case 14:
3055 for (i = 0; i < 17; i ++)
3056 {
3057 clear_bitmap(tbmp);
3058 ship_bitmaps [at] [i] = create_bitmap(21, 21);
3059 clear_bitmap(ship_bitmaps [at] [i]);
3060 angle = i / (16 / (PI / 2)) - PI / 2;
3061 if (i == 16)
3062 angle = 0;
3063 x1 = 100 + cos(angle) * 80;
3064 y1 = 100 + sin(angle) * 80;
3065 x2 = 100 + cos(angle + PI / 2) * 40;
3066 y2 = 100 + sin(angle + PI / 2) * 40;
3067 x3 = 100 + cos(angle - PI / 2) * 40;
3068 y3 = 100 + sin(angle - PI / 2) * 40;
3069 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
3070 x1 = 100 + cos(angle + PI / 2) * 80;
3071 y1 = 100 + sin(angle + PI / 2) * 80;
3072 x2 = 100;// + cos(angle + PI / 2) * 20;
3073 y2 = 100;// + sin(angle + PI / 2) * 20;
3074 x3 = 100 + cos(angle + PI / 2 + PI / 5) * 80;
3075 y3 = 100 + sin(angle + PI / 2 + PI / 5) * 80;
3076 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
3077 x1 = 100 + cos(angle - PI / 2) * 80;
3078 y1 = 100 + sin(angle - PI / 2) * 80;
3079 x2 = 100;// + cos(angle + PI / 2) * 20;
3080 y2 = 100;// + sin(angle + PI / 2) * 20;
3081 x3 = 100 + cos(angle - PI / 2 - PI / 5) * 80;
3082 y3 = 100 + sin(angle - PI / 2 - PI / 5) * 80;
3083 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
3084 x1 = 100 + cos(angle) * 70;
3085 y1 = 100 + sin(angle) * 70;
3086 x2 = 100 + cos(angle + PI / 2) * 35;
3087 y2 = 100 + sin(angle + PI / 2) * 35;
3088 x3 = 100 + cos(angle - PI / 2) * 35;
3089 y3 = 100 + sin(angle - PI / 2) * 35;
3090 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
3091 x1 = 100 + cos(angle + PI / 2) * 70;
3092 y1 = 100 + sin(angle + PI / 2) * 70;
3093 x2 = 100;// + cos(angle + PI / 2) * 20;
3094 y2 = 100;// + sin(angle + PI / 2) * 20;
3095 x3 = 100 + cos(angle + PI / 2 + PI / 5) * 70;
3096 y3 = 100 + sin(angle + PI / 2 + PI / 5) * 70;
3097 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
3098 x1 = 100 + cos(angle - PI / 2) * 70;
3099 y1 = 100 + sin(angle - PI / 2) * 70;
3100 x2 = 100;// + cos(angle + PI / 2) * 20;
3101 y2 = 100;// + sin(angle + PI / 2) * 20;
3102 x3 = 100 + cos(angle - PI / 2 - PI / 5) * 70;
3103 y3 = 100 + sin(angle - PI / 2 - PI / 5) * 70;
3104 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
3105 x1 = 100 + cos(angle) * 40;
3106 y1 = 100 + sin(angle) * 40;
3107 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
3108 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
3109 }
3110 break;
3111 case 15:
3112 for (i = 0; i < 17; i ++)
3113 {
3114 clear_bitmap(tbmp);
3115 ship_bitmaps [at] [i] = create_bitmap(21, 21);
3116 clear_bitmap(ship_bitmaps [at] [i]);
3117 angle = i / (16 / (PI / 2)) - PI / 2;
3118 if (i == 16)
3119 angle = 0;
3120 x1 = 100 + cos(angle + PI / 26) * 90;
3121 y1 = 100 + sin(angle + PI / 26) * 90;
3122 x2 = 100 + cos(angle + PI / 2) * 60;
3123 y2 = 100 + sin(angle + PI / 2) * 60;
3124 x3 = 100 + cos(angle + PI - PI / 26) * 60;
3125 y3 = 100 + sin(angle + PI - PI / 26) * 60;
3126 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
3127 x1 = 100 + cos(angle - PI / 26) * 90;
3128 y1 = 100 + sin(angle - PI / 26) * 90;
3129 x2 = 100 + cos(angle - PI / 2) * 60;
3130 y2 = 100 + sin(angle - PI / 2) * 60;
3131 x3 = 100 + cos(angle + PI + PI / 26) * 60;
3132 y3 = 100 + sin(angle + PI + PI / 26) * 60;
3133 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY4);
3134 /* x1 = 100 + cos(angle + PI - PI / 4) * 50;
3135 y1 = 100 + sin(angle + PI - PI / 4) * 50;
3136 circlefill(tbmp, x1, y1, 35, COLOUR_GREY4);
3137 x1 = 100 + cos(angle + PI + PI / 4) * 50;
3138 y1 = 100 + sin(angle + PI + PI / 4) * 50;
3139 circlefill(tbmp, x1, y1, 35, COLOUR_GREY4);*/
3140 x1 = 100 - cos(angle) * 30;
3141 y1 = 100 - sin(angle) * 30;
3142 circlefill(tbmp, x1, y1, 40, COLOUR_GREY4);
3143 x1 = 100 + cos(angle + PI / 26) * 80;
3144 y1 = 100 + sin(angle + PI / 26) * 80;
3145 x2 = 100 + cos(angle + PI / 2) * 50;
3146 y2 = 100 + sin(angle + PI / 2) * 50;
3147 x3 = 100 + cos(angle + PI - PI / 26) * 50;
3148 y3 = 100 + sin(angle + PI - PI / 26) * 50;
3149 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
3150 x1 = 100 + cos(angle - PI / 26) * 80;
3151 y1 = 100 + sin(angle - PI / 26) * 80;
3152 x2 = 100 + cos(angle - PI / 2) * 50;
3153 y2 = 100 + sin(angle - PI / 2) * 50;
3154 x3 = 100 + cos(angle + PI + PI / 26) * 50;
3155 y3 = 100 + sin(angle + PI + PI / 26) * 50;
3156 triangle(tbmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
3157 x1 = 100 - cos(angle) * 30;
3158 y1 = 100 - sin(angle) * 30;
3159 circlefill(tbmp, x1, y1, 30, COLOUR_GREY5);
3160 x1 = 100 - cos(angle) * 20;
3161 y1 = 100 - sin(angle) * 20;
3162 circlefill(tbmp, x1, y1, 10, COLOUR_WHITE);
3163 stretch_sprite(ship_bitmaps [at] [i], tbmp, 0, 0, 21, 21);
3164 }
3165 break;
3166
3167
3168
3169 }
3170
3171 destroy_bitmap(tbmp);
3172 }
3173
3174 #endif
0 void init_display(void);
1 void prepare_display(void);
2
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: display.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - functions which put stuff onto the screen
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36 #include <string.h>
37
38
39 #include "config.h"
40 #include "globvars.h"
41 #include "palette.h"
42
43 #include "stuff.h"
44 #include "light.h"
45
46 #define COMPILING_DISPLAYC
47 #include "display.h"
48 #undef COMPILING_DISPLAYC
49
50 //#define DEBUG_DISPLAY
51
52 int debug_info;
53
54 extern struct lightstruct light [NO_LIGHTS];
55
56 int pline(BITMAP *bmp, int x1, int y1, int x2, int y2, int colour);
57
58 //#define DEBUG_ENEMY_SIZE
59
60 BITMAP *player1;
61 BITMAP *player2;
62 #ifdef DEBUG_DISPLAY
63 #include <stdlib.h>
64 // for itoa, used in the screenshot code but not needed for ports etc
65 extern volatile int frames_per_second;
66 extern volatile int ticked;
67 extern int slacktime;
68 extern int long_slacktime_store;
69 extern int debug_sound [5];
70
71 int slack_graph [100];
72 int slack_graph_pos;
73 int fps_graph [100];
74 int fps_graph_pos;
75 #endif
76
77 extern struct optionstruct options;
78
79 //BITMAP *ship_bitmaps [2] [65]; // externed in displ_in.c
80 BITMAP *ship_bitmaps [NO_SHIP_TYPES] [17];
81
82 BITMAP *gb_ship_bitmaps [GB_SHIP_TYPES] [17];
83
84 BITMAP *enemy1_bmp [ENEMY1_BMPS];
85 RLE_SPRITE *enemy1_rle [ENEMY1_RLES];
86 RLE_SPRITE *small1_rle [SMALL1_RLES];
87 RLE_SPRITE *small3_rle [SMALL3_RLES];
88 RLE_SPRITE *enemy2_rle [ENEMY2_RLES];
89 RLE_SPRITE *enemy3_rle [ENEMY3_RLES];
90 RLE_SPRITE *enemy4_rle [ENEMY4_RLES];
91 RLE_SPRITE *enemy5_rle [ENEMY5_RLES];
92 RLE_SPRITE *enemy6_rle [ENEMY6_RLES];
93 RLE_SPRITE *enemy7_rle [ENEMY7_RLES];
94 RLE_SPRITE *enemy8_rle [ENEMY8_RLES];
95 RLE_SPRITE *enemy9_rle [ENEMY9_RLES];
96 BITMAP *small2_bmp [SMALL2_BMPS];
97 BITMAP *small4_bmp [SMALL4_BMPS];
98 BITMAP *enemy_bmps [ENEMY_BMPS];
99 //extern float cos_table [ANGLE_FULL];
100
101
102 BITMAP *pretile_bmp [NO_PRETILE_BMPS];
103 BITMAP *pretile_m_bmp [NO_MAZES] [NO_PRETILE_M_BMPS];
104 RLE_SPRITE *tile_rle [NO_TILE_RLES];
105 BITMAP *level_bmp;
106
107 BITMAP *redbang_bmp [50];
108 RLE_SPRITE *light_rle [100];
109
110 BITMAP *superjelly_bmp [2];
111 BITMAP *shield_bmp [SHIELD_BMPS];
112 RLE_SPRITE *waver1_circle;
113 RLE_SPRITE *waver2_circle;
114
115 RLE_SPRITE *large_ships [16] [5];
116
117 RLE_SPRITE *tile_background;
118
119 FONT *font2;
120 FONT *small_font;
121
122 struct effects_struct effect [MAX_EFFECTS];
123
124 int var1, var2, var3; // debug display vars, externed as necessary
125
126 int graphics_mode;
127 int scr_x;
128 int scr_y;
129 int grid_offset_x_1p;
130 int grid_offset_x_2p;
131 int grid_offset_x_2p_finetune;
132 int grid_offset_y;
133 int special_600_y;
134 int text_offset_x;
135 int text_offset_x_1p;
136 int text_offset_x_2p;
137 int text_offset_y;
138 int grid_finetune_x_1p;
139 int grid_finetune_x_2p;
140 int grid_finetune_y;
141 int visible_grids_y;
142
143 int tp_window_width;
144
145 void indicate_fps(BITMAP *bmp, int play);
146
147 void draw_effects(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
148 void draw_an_effect(BITMAP *bmp, int dr, int x, int y);
149 void beam_points(BITMAP *bmp, int x1, int y1, int x2, int y2, int angle, int out1, int out2, int colour);
150
151 //void draw_lock(BITMAP *bmp, int dr, int x, int y, int rad);
152 //void draw_turret_lock(BITMAP *bmp, int dr, int x, int y, int rad);
153 void draw_locks(BITMAP *bmp, int p);
154
155 float angle_to_radians(int angle);
156
157 int inflicteda, inflictede;
158
159 //void draw_grid(BITMAP *bmp, int xloc, int yloc, int max_x, int max_y, int colour);
160 void draw_stars(BITMAP *bmp, int max_x, int max_y, int player);
161 void draw_grid(BITMAP *bmp, int max_x, int max_y, int play, int colour, int edge_colour, int x_offset, int centre_x, int centre_y, int finetune_x, int finetune_y);
162 void draw_actors(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
163 void draw_hud(BITMAP *bmp, int x, int y, int i);
164 void draw_eyes(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
165 void draw_an_eye(BITMAP *bmp, int i, int x, int y);
166
167 void draw_an_actor(BITMAP *bmp, int dr, int x, int y, int play);
168 void draw_ship_bitmap(BITMAP *bmp, int x, int y, int angle, int which_ship, int width, int height);
169 void draw_triangle_ship(BITMAP *bmp, int dr, int size, int pointiness, int x, int y, unsigned char colour1, unsigned char colour2);
170 //void draw_scan(BITMAP *bmp, int max_x, int max_y, int play, char range);
171 //void draw_scan_dot(BITMAP *bmp, int x, int y, int type);
172 void draw_status2(BITMAP *bmp, int max_x, int max_y, int play);
173 void draw_bullets(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
174 void draw_a_bullet(BITMAP *bmp, int dr, int x, int y, int x2, int y2, int max_x, int max_y, int play);
175 void draw_enemies(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
176 void draw_an_enemy_inter(BITMAP *bmp, int e, int max_x, int max_y, int play, int centre_x, int centre_y);
177 void draw_an_enemy_inter2(BITMAP *bmp, int e, int max_x, int max_y, int play, int centre_x, int centre_y);
178 void draw_an_enemy(BITMAP *bmp, int dr, int x, int y);
179 void draw_clouds(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
180 void draw_a_cloud(BITMAP *bmp, int dr, int x, int y, int x2, int y2);
181 void draw_pickups(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
182 void draw_a_pickup(BITMAP *bmp, int dr, int x, int y);
183 void get_pickup_colour(int st, int cols [3]);
184 void write_colour_text(BITMAP *bmp, int x, int y, int which);
185 void draw_static_symbol(BITMAP *bmp, int x, int y, int col, int symb);
186 void draw_crosshair(BITMAP *bmp, int dr, int x, int y);
187 int get_circler_colour(int x1);
188 void draw_wave(BITMAP *bmp, int x, int y, int count, int size);
189
190 //void draw_sidekicks(BITMAP *bmp, int max_x, int max_y, int play, int a);
191
192 void draw_ship_status(BITMAP *bmp, int x, int y, int a, int style);
193 void draw_upgrades(BITMAP *bmp, int x, int y, int play);
194 char *upgrade_name(int i);
195 char *primary_name(int i);
196 void secondary_name(int i, char dstr [30]);
197
198 void draw_crawler_legs(BITMAP *bmp, int x, int y, int e, int col);
199 void draw_spinner(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2);
200 void draw_overspinner(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2);
201 void draw_spikey(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2, int in_correction, int out_correction);
202 void draw_blatter(BITMAP *bmp, int x, int y, int number, int distance, int rotation, int size, int col1, int col2);
203 void draw_squarey(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2);
204 void draw_orbiter(BITMAP *bmp, int x, int y, int attribute, int out1, int out2, int out3, int angle1, int angle2, int arms, int col1, int col2);
205 void draw_puffer(BITMAP *bmp, int x, int y, int angle, int number, int distance, int size, int incol, int outcol);
206 void draw_launchers(BITMAP *bmp, int x, int y, int angle, int d_f_centre, int diagonal, int interior_angle, int recoil1, int recoil2, int col1, int col2);
207 void draw_tri(BITMAP *bmp, int x, int y, int angle, int length1, int length2, int angle2, int col1, int col2);
208 void draw_waver(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2, RLE_SPRITE *waver_rle, int waver_rle_size);
209
210 void distortion(BITMAP *bmp, int x, int y, int wx, int wy, int dx, int dy);
211 BITMAP *distortion_mask;
212 BITMAP *crystal_bmp;
213
214
215 int set_lock_x [2];
216 int set_lock_y [2];
217 int set_lock_radius [2];
218
219 int set_turret_lock_x [2];
220 int set_turret_lock_y [2];
221 int set_turret_lock_radius [2];
222
223 #define NO_MESSAGES 10
224
225 char messages [2] [NO_MESSAGES] [70];
226 int message_style [2] [NO_MESSAGES];
227 int message_counter [2] [NO_MESSAGES];
228
229 char scroll_text [10] [50];
230 int scroll_position [10];
231 int scroll_colour [10];
232
233 void display_messages(BITMAP *bmp, int play, int max_x, int max_y);
234 void kill_message(int play, int i);
235
236 void draw_lights(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
237 void draw_a_light(BITMAP *bmp, int size, int x, int y);
238 void bordered_rect(BITMAP *bmp, int x1, int y1, int x2, int y2, int colour1, int colour2);
239 void bordered_triangle(BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, int y3, int col1, int col2);
240
241 void draw_spark_jump(BITMAP *bmp, int x1, int y1, int x2, int y2, int parts, int scatter, int col, int transy);
242
243 //char prim_name [4] [10]
244
245 /*
246 void display_scrollbar(BITMAP *bmp, int play, int max_x, int max_y)
247 {
248
249 }
250
251 void new_scroll(const char *msg, int colour)
252 {
253
254
255 }
256
257 void run_scrollbar(int play)
258 {
259
260
261 }
262 */
263
264
265 void run_display(void)
266 {
267 static int counter;
268
269 counter++;
270
271 if (counter > 40000)
272 counter = 0;
273
274 // int i;
275 int centre_x, centre_y;
276 // draw_grid(player1, 150 + counter, 150 + counter, scr_x, scr_y, 100, 2);
277 // draw_grid(player1, actor[0].x / GRAIN, actor[0].y / GRAIN, scr_x, scr_y, actor[0].angle, 2);
278 if (game.users == 1)
279 {
280 centre_x = actor[player[game.single_player].actor_controlled].x + player[game.single_player].screen_shake_x;
281 centre_y = actor[player[game.single_player].actor_controlled].y + player[game.single_player].screen_shake_y;
282 set_lock_x [game.single_player] = 0;
283 set_lock_y [game.single_player] = 0;
284 set_lock_radius [game.single_player] = 0;
285 set_turret_lock_x [game.single_player] = 0;
286 set_turret_lock_y [game.single_player] = 0;
287 set_turret_lock_radius [game.single_player] = 0;
288 // draw_stars(player1, scr_x, scr_y, 0);
289 // clear_to_color(player1, arena.colour3);
290 draw_grid(player1, scr_x, scr_y, game.single_player, arena.colour1, arena.colour2, grid_offset_x_1p, centre_x, centre_y, grid_finetune_x_1p, grid_finetune_y);
291 draw_pickups(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
292 draw_enemies(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
293 draw_actors(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
294 draw_bullets(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
295 draw_effects(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
296 draw_clouds(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
297 draw_eyes(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
298 draw_lights(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
299
300 // after here, it's just HUD and screen_shake isn't applied:
301 draw_upgrades(player1, scr_x / 2 - 120, scr_y - 45, game.single_player);
302 draw_status2(player1, scr_x, scr_y, game.single_player);
303 draw_locks(player1, game.single_player);
304 /* if (actor[player[game.single_player].actor_controlled].lock != -1
305 && enemy[actor[player[game.single_player].actor_controlled].lock].type != ENEMY_NONE
306 && set_lock_radius [game.single_player] != 0)
307 draw_lock(player1, player[game.single_player].actor_controlled, set_lock_x [game.single_player], set_lock_y [game.single_player], set_lock_radius [game.single_player]);
308 if (actor[player[game.single_player].actor_controlled].turret_lock != -1
309 && enemy[actor[player[game.single_player].actor_controlled].turret_lock].type != ENEMY_NONE)
310 draw_turret_lock(player1, player[game.single_player].actor_controlled, set_turret_lock_x [game.single_player], set_turret_lock_y [game.single_player], set_turret_lock_radius [game.single_player]);*/
311 indicate_fps(player1, game.single_player);
312 // display_messages(player1, game.single_player, scr_x, scr_y);
313 /* drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
314 for (i = 195; i < 206; i ++)
315 {
316 rectfill(player1, 10 + (i-195) * 30, 100, 30 + (i-195) * 30, 150, i);
317 }
318 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);*/
319 if (options.run_vsync > 0)
320 vsync();
321
322 // textprintf_ex(player1, font, 100, 100, COLOUR_GREY5, COLOUR_YELLOW1, "%i", grand(500));
323
324 blit(player1, screen, 0, 0, 0, 0, scr_x, scr_y);
325 }
326 else
327 {
328 // grid_offset_x_2p =
329 centre_x = actor[player[0].actor_controlled].x + player[0].screen_shake_x;
330 centre_y = actor[player[0].actor_controlled].y + player[0].screen_shake_y;
331 set_lock_x [0] = 0;
332 set_lock_y [0] = 0;
333 set_lock_radius [0] = 0;
334 set_turret_lock_x [0] = 0;
335 set_turret_lock_y [0] = 0;
336 set_turret_lock_radius [0] = 0;
337 set_lock_x [1] = 0;
338 set_lock_y [1] = 0;
339 set_lock_radius [1] = 0;
340 set_turret_lock_x [1] = 0;
341 set_turret_lock_y [1] = 0;
342 set_turret_lock_radius [1] = 0;
343 // draw_stars(player1, 310, scr_y, 0);
344 // clear_to_color(player1, arena.colour3);
345 // clear_to_color(player2, arena.colour3);
346 draw_grid(player1, tp_window_width, scr_y, 0, arena.colour1, arena.colour2, grid_offset_x_2p, centre_x, centre_y, grid_offset_x_2p_finetune, grid_finetune_y);
347 draw_pickups(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
348 draw_enemies(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
349 draw_actors(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
350 draw_bullets(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
351 draw_effects(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
352 draw_clouds(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
353 draw_eyes(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
354 draw_lights(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
355
356 // draw_scan(player1, 50, 50, actor[player[0].actor_controlled].angle, 0, 0);
357 // draw_scan(player1, 260, 50, actor[player[0].actor_controlled].angle, 0, 1);
358 // draw_hud(player1, 155, 360, player[0].actor_controlled);
359 // draw_upgrades(player1, 40, 420, 0);
360 // draw_upgrades(player1, 16, 460, 0);
361 draw_upgrades(player1, tp_window_width / 2 - 120, scr_y - 20, 0);//game.single_player);
362 draw_status2(player1, tp_window_width, scr_y, 0);
363 indicate_fps(player1, 0);
364 // display_messages(player1, 0, 310, scr_y);
365
366 centre_x = actor[player[1].actor_controlled].x + player[1].screen_shake_x;
367 centre_y = actor[player[1].actor_controlled].y + player[1].screen_shake_y;
368 // draw_stars(player2, 310, scr_y, 1);
369 draw_grid(player2, tp_window_width, scr_y, 1, arena.colour1, arena.colour2, grid_offset_x_2p, centre_x, centre_y, grid_offset_x_2p_finetune, grid_finetune_y);
370 draw_eyes(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
371 draw_pickups(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
372 draw_enemies(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
373 draw_actors(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
374 draw_bullets(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
375 draw_effects(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
376 draw_clouds(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
377 draw_eyes(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
378 draw_lights(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
379
380 // draw_scan(player2, 50, 50, actor[player[1].actor_controlled].angle, 1, 0);
381 // draw_scan(player2, 260, 50, actor[player[1].actor_controlled].angle, 1, 1);
382 // draw_hud(player2, 155, 360, player[1].actor_controlled);
383 draw_upgrades(player2, tp_window_width / 2 - 120, scr_y - 20, 1);
384 draw_status2(player2, tp_window_width, scr_y, 1);
385 // draw_locks(player1, 0);
386 // draw_locks(player2, 1);
387 indicate_fps(player2, 1);
388 // display_messages(player2, 1, tp_window_width, scr_y);
389 if (options.run_vsync > 0)
390 vsync();
391 blit(player1, screen, 0, 0, 0, 0, tp_window_width, scr_y);
392 blit(player2, screen, 0, 0, tp_window_width + 10, 0, tp_window_width, scr_y);
393 // clear_bitmap(player1);
394 // clear_bitmap(player2);
395 }
396
397 }
398
399
400 void draw_locks(BITMAP *bmp, int p)
401 {
402 /* int a = player[p].actor_controlled;
403
404 if (actor[a].lock == LOCK_ACTOR0)
405 {
406 // if (actor[0].in_play != 0)
407 // draw_lock(bmp, a, set_lock_x [p], set_lock_y [p], set_lock_radius [p]);
408 }
409 else
410 {
411 if (actor[a].lock == LOCK_ACTOR1)
412 {
413 // if (actor[1].in_play != 0)
414 // draw_lock(bmp, a, set_lock_x [p], set_lock_y [p], set_lock_radius [p]);
415 }
416 else
417 {
418 // if (actor[a].lock != -1
419 // && enemy[actor[a].lock].type != ENEMY_NONE
420 // && set_lock_radius [p] != 0)
421 // draw_lock(bmp, a, set_lock_x [p], set_lock_y [p], set_lock_radius [p]);
422 }
423 }
424
425 if (actor[a].turret_lock == LOCK_ACTOR0)
426 {
427 if (actor[0].in_play != 0)
428 draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
429 }
430 else
431 {
432 if (actor[a].turret_lock == LOCK_ACTOR1)
433 {
434 if (actor[1].in_play != 0)
435 draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
436 }
437 else
438 {
439 if (actor[a].turret_lock != -1
440 && enemy[actor[a].turret_lock].type != ENEMY_NONE
441 && set_turret_lock_radius [p] != 0)
442 draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
443 }
444 }
445 */
446 // if (actor[a].turret_lock != -1
447 // && enemy[actor[a].turret_lock].type != ENEMY_NONE)
448 // draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
449
450 }
451
452
453 void draw_actors(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
454 {
455
456 int i, x, y;
457
458 for (i = 0; i < NO_ACTORS; i ++)
459 {
460 if (actor[i].in_play == 0)
461 continue;
462
463 // if (actor[i].upgraded_system [UPG_SIDEKICK] > 0)
464 // draw_sidekicks(bmp, max_x, max_y, play, i);
465
466 if (i == player[play].actor_controlled)
467 {
468 // draw_an_actor(bmp, player[play].actor_controlled, max_x / 2, max_y / 2, play);
469 draw_an_actor(bmp, player[play].actor_controlled, max_x / 2 - player[play].screen_shake_x / GRAIN, max_y / 2 - player[play].screen_shake_y / GRAIN, play);
470 draw_crosshair(bmp, player[play].actor_controlled, max_x / 2, max_y / 2);
471 continue;
472 }
473
474 if (actor[i].x < centre_x - (max_x / 2) * GRAIN - 7000
475 || actor[i].x > centre_x + (max_x / 2) * GRAIN + 7000
476 || actor[i].y < centre_y - (max_y / 2) * GRAIN - 7000
477 || actor[i].y > centre_y + (max_y / 2) * GRAIN + 7000)
478 continue;
479
480 x = (actor[i].x / GRAIN) - (centre_x / GRAIN);
481 y = (actor[i].y / GRAIN) - (centre_y / GRAIN);
482 draw_an_actor(bmp, i, x + max_x / 2, y + max_y / 2, play);
483
484 }
485
486
487
488
489 }
490
491
492 void draw_an_actor(BITMAP *bmp, int dr, int x, int y, int play)
493 {
494 int i;
495
496 int angle2 = 0;
497 int angle = 0;
498 if (angle < 0)
499 angle += ANGLE_FULL;
500
501 if (angle2 < 0)
502 angle2 += ANGLE_FULL;
503
504 draw_ship_bitmap(bmp, x, y, actor[dr].ship, actor[dr].angle, 12, 11);
505
506 switch(actor[dr].ship)
507 {
508 // case SHIP_LACEWING:
509 // draw_ship_bitmap(bmp, x, y, 0, actor[dr].angle, 12, 11);
510 // break;
511 // case SHIP_CAPYBARA:
512 // draw_ship_bitmap(bmp, x, y, 1, actor[dr].angle, 10, 10);
513 // break;
514 /* case SHIP_RUMSFELD:
515 draw_ship_bitmap(bmp, x, y, 1, actor[dr].angle, 10, 10);
516 break;
517 case SHIP_LENTIL:
518 draw_ship_bitmap(bmp, x, y, 2, actor[dr].angle, 10, 10);
519 break;
520 case SHIP_CAPYBARA:
521 draw_ship_bitmap(bmp, x, y, 3, actor[dr].angle, 10, 10);
522 break;
523 case SHIP_HOOKWORM:
524 draw_ship_bitmap(bmp, x, y, 4, actor[dr].angle, 10, 10);
525 break;
526 case SHIP_PORKUPINE:
527 draw_ship_bitmap(bmp, x, y, 5, actor[dr].angle, 10, 10);
528 break;
529 case SHIP_PRONG:
530 draw_ship_bitmap(bmp, x, y, 6, actor[dr].angle, 10, 10);
531 break;
532 case SHIP_AETHER:
533 draw_ship_bitmap(bmp, x, y, 7, actor[dr].angle, 10, 10);
534 break;
535 case SHIP_DESPOT:
536 draw_ship_bitmap(bmp, x, y, 8, actor[dr].angle, 10, 10);
537 break;
538 case SHIP_LACEWING:
539 // draw_ship_bitmap(bmp, x, y, 9, actor[dr].angle, 10, 10);
540 draw_ship_bitmap(bmp, x, y, 0, actor[dr].angle, 12, 11);
541 // circle(bmp, x, y, 8, COLOUR_YELLOW6);
542 break;
543 case SHIP_TORTFEASOR:
544 draw_ship_bitmap(bmp, x, y, 10, actor[dr].angle, 10, 10);
545 break;
546 case SHIP_SCORPION:
547 draw_ship_bitmap(bmp, x, y, 11, actor[dr].angle, 10, 10);
548 break;
549 case SHIP_GODBOTHERER:
550 draw_ship_bitmap(bmp, x, y, 12, actor[dr].angle, 10, 10);
551 break;
552 case SHIP_BOTULUS:
553 draw_ship_bitmap(bmp, x, y, 13, actor[dr].angle, 10, 10);
554 break;
555 case SHIP_SLIDEWINDER:
556 draw_ship_bitmap(bmp, x, y, 14, actor[dr].angle, 10, 10);
557 break;
558 case SHIP_DOOM:
559 draw_ship_bitmap(bmp, x, y, 15, actor[dr].angle, 10, 10);
560 break;
561 */
562 }
563 int x1, x2, y2;//, y1;
564
565 if (actor[dr].shield_pulse > 0)
566 {
567 /* int scol = COLOUR_WHITE;
568 if (actor[dr].shield_pulse == 9)
569 scol = COLOUR_GREY6;
570 if (actor[dr].shield_pulse == 8)
571 scol = COLOUR_GREY5;
572 if (actor[dr].shield_pulse < 8)
573 scol = COLOUR_GREEN1 + actor[dr].shield_pulse;*/
574 x1 = actor[dr].shield_pulse;
575 if (actor[dr].shield_pulse > 7)
576 x1 = 7;
577 x1 = grand(x1 + 1);
578 x2 = x + grand(3) - grand(3);
579 y2 = y + grand(3) - grand(3);
580 draw_trans_sprite(bmp, small4_bmp [BMP_SMALL4_SHIELD_1 + x1], x2 - 10, y2 - 10);
581 draw_trans_sprite(bmp, shield_bmp [x1], x2, y2 - 10);
582 draw_trans_sprite(bmp, shield_bmp [x1 + 8], x2, y2);
583 draw_trans_sprite(bmp, shield_bmp [x1 + 16], x2 - 10, y2);
584 /* draw_trans_sprite(bmp, small4_bmp [BMP_SMALL4_SHIELD_1 + grand(x1 + 1)], x - 10, y - 10);
585 draw_trans_sprite(bmp, shield_bmp [grand(x1 + 1)], x, y - 10);
586 draw_trans_sprite(bmp, shield_bmp [grand(x1 + 1) + 8], x, y);
587 draw_trans_sprite(bmp, shield_bmp [grand(x1 + 1) + 16], x - 10, y);*/
588
589 //circle(bmp, x + grand(5) - 2, y + grand(5) - 2, 10, scol);
590 }
591
592 int gd;
593 int y1, s1, s2, s3;
594
595 if (actor[dr].grace_period > 0)
596 {
597 gd = actor[dr].grace_period / 3;
598 if (gd > 15)
599 gd = 15;
600 y1 = 0;
601
602 // x1 = gd + (actor[dr].grace_period / 3) % 4 + 3;
603 // if (((actor[dr].grace_period / 3) / 4) % 2 == 0)
604 // x1 = gd + 4 - (actor[dr].grace_period / 3) % 4 + 3;
605 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
606 // x1 = gd + (actor[dr].grace_period / 3) % 4 + 3;
607 x1 = (actor[dr].grace_period * 30) & 1023;
608 y1 = gd / 4;
609 if (arena.level % 2 == 0)
610 {
611 x1 = ANGLE_FULL - x1;
612 s1 = y1 - 2;
613 s2 = y1 - 1;
614 s3 = y1;
615 }
616 else
617 {
618 s3 = y1 - 2;
619 s2 = y1 - 1;
620 s1 = y1;
621 }
622 // gd *= 3;
623 for (i = 0; i < 3; i ++)
624 {
625 if (s1 > 0)
626 circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 3) * i, gd),
627 y + ypart(x1 + (ANGLE_FULL / 3) * i, gd),
628 s1, TRANS_WHITE);
629 if (s2 > 0)
630 circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_SIXTEENTH, gd),
631 y + ypart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_SIXTEENTH, gd),
632 s2, TRANS_WHITE);
633 if (s3 > 0)
634 circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_EIGHTH, gd),
635 y + ypart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_EIGHTH, gd),
636 s3, TRANS_WHITE);
637 }
638 // circle(bmp, x, y, x1, TRANS_YELLOW);
639 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
640 // circle(bmp, x, y, x1, COLOUR_YELLOW3 + gd);
641 }
642 else
643 if (actor[dr].repairing > 0)
644 {
645 gd = actor[dr].repairing / 3;
646 if (gd > 15)
647 gd = 15;
648 y1 = 0;
649
650 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
651 x1 = actor[dr].repairing * 35;
652 y1 = gd / 4;
653 if (arena.level % 2 == 1)
654 {
655 x1 = ANGLE_FULL - x1;
656 s1 = y1 - 2;
657 s2 = y1 - 1;
658 s3 = y1;
659 }
660 else
661 {
662 s3 = y1 - 2;
663 s2 = y1 - 1;
664 s1 = y1;
665 }
666 // gd = 15;
667 for (i = 0; i < 4; i ++)
668 {
669 if (s1 > 0)
670 circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 4) * i, gd + grand(2)),
671 y + ypart(x1 + (ANGLE_FULL / 4) * i, gd),
672 s1, TRANS_ORANGE);
673 if (s2 > 0)
674 circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_SIXTEENTH, gd),
675 y + ypart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_SIXTEENTH, gd),
676 s2, TRANS_ORANGE);
677 if (s3 > 0)
678 circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_EIGHTH, gd),
679 y + ypart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_EIGHTH, gd),
680 s3, TRANS_ORANGE);
681 }
682 // circle(bmp, x, y, x1, TRANS_YELLOW);
683 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
684 // circle(bmp, x, y, x1, COLOUR_YELLOW3 + gd);
685
686
687 }
688 // circle(bmp, x + grand(3) - 1, y + grand(3) - 1, gd * 2 + grand(3), COLOUR_YELLOW1 + gd + grand(3));
689 /* if (gd > 10)
690 gd = 10;
691
692 if (actor[dr].grace_period > 0)
693 {
694 x1 = x + cos(angle_to_radians(counter * 8)) * gd;
695 y1 = y + sin(angle_to_radians(counter * 8)) * gd;
696 putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
697 x1 = x + cos(angle_to_radians(counter * 8) + PI / 2) * gd;
698 y1 = y + sin(angle_to_radians(counter * 8) + PI / 2) * gd;
699 putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
700 x1 = x + cos(angle_to_radians(counter * 8) + PI) * gd;
701 y1 = y + sin(angle_to_radians(counter * 8) + PI) * gd;
702 putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
703 x1 = x + cos(angle_to_radians(counter * 8) - PI / 2) * gd;
704 y1 = y + sin(angle_to_radians(counter * 8) - PI / 2) * gd;
705 putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
706 }*/
707
708
709 if (dr == 0 && actor[player[play].actor_controlled].lock == LOCK_ACTOR0)
710 {
711 set_lock_x [play] = x;// + (max_x / 2);
712 set_lock_y [play] = y;// + (max_y / 2);
713 set_lock_radius [play] = 12;
714 }
715 if (dr == 1 && actor[player[play].actor_controlled].lock == LOCK_ACTOR1)
716 {
717 set_lock_x [play] = x;// + (max_x / 2);
718 set_lock_y [play] = y;// + (max_y / 2);
719 set_lock_radius [play] = 12;
720 }
721 if (dr == 0 && actor[player[play].actor_controlled].turret_lock == LOCK_ACTOR0)
722 {
723 set_turret_lock_x [play] = x;// + (max_x / 2);
724 set_turret_lock_y [play] = y;// + (max_y / 2);
725 set_turret_lock_radius [play] = 12;
726 }
727 if (dr == 1 && actor[player[play].actor_controlled].turret_lock == LOCK_ACTOR1)
728 {
729 set_turret_lock_x [play] = x;// + (max_x / 2);
730 set_turret_lock_y [play] = y;// + (max_y / 2);
731 set_turret_lock_radius [play] = 12;
732 }
733
734
735 }
736
737
738 void draw_crosshair(BITMAP *bmp, int dr, int x, int y)
739 {
740 int xc, yc;
741 int col = COLOUR_YELLOW8;
742 if (actor[dr].recycle1 > 0)
743 col = COLOUR_GREY6;
744
745 xc = x + xpart(actor[dr].angle + 28 - ANGLE_QUARTER, 48);
746 yc = y + ypart(actor[dr].angle + 28 - ANGLE_QUARTER, 48);
747 putpixel(bmp, xc, yc, col);
748
749 xc = x + xpart(actor[dr].angle - 28 - ANGLE_QUARTER, 48);
750 yc = y + ypart(actor[dr].angle - 28 - ANGLE_QUARTER, 48);
751 putpixel(bmp, xc, yc, col);
752
753 /* xc = x + xpart(actor[dr].angle + 32 - ANGLE_QUARTER, 32);
754 yc = y + ypart(actor[dr].angle + 32 - ANGLE_QUARTER, 32);
755 putpixel(bmp, xc, yc, col);
756
757 xc = x + xpart(actor[dr].angle - 32 - ANGLE_QUARTER, 32);
758 yc = y + ypart(actor[dr].angle - 32 - ANGLE_QUARTER, 32);
759 putpixel(bmp, xc, yc, col);
760
761 xc = x + xpart(actor[dr].angle - ANGLE_QUARTER, 30);
762 yc = y + ypart(actor[dr].angle - ANGLE_QUARTER, 30);
763 putpixel(bmp, xc, yc, col);
764
765 xc = x + xpart(actor[dr].angle - ANGLE_QUARTER, 34);
766 yc = y + ypart(actor[dr].angle - ANGLE_QUARTER, 34);
767 putpixel(bmp, xc, yc, col);
768 */
769 if (actor[dr].secondary != SECOND_NONE)
770 {
771 col = COLOUR_RED8;
772 if (actor[dr].recycle2 > 0)
773 col = COLOUR_GREY3;
774
775 xc = x + xpart(actor[dr].angle + 16 - ANGLE_QUARTER, 45);
776 yc = y + ypart(actor[dr].angle + 16 - ANGLE_QUARTER, 45);
777 putpixel(bmp, xc, yc, col);
778
779 xc = x + xpart(actor[dr].angle - 16 - ANGLE_QUARTER, 45);
780 yc = y + ypart(actor[dr].angle - 16 - ANGLE_QUARTER, 45);
781 putpixel(bmp, xc, yc, col);
782
783 }
784 }
785
786
787
788 void draw_ship_bitmap(BITMAP *bmp, int x, int y, int which_ship, int angle, int width, int height)
789 {
790 /* int draw_angle = angle / 4;
791
792 if (draw_angle < 64)
793 {
794 draw_sprite(bmp, ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
795 return;
796 }
797 if (draw_angle < 128)
798 {
799 draw_sprite_v_flip(bmp, ship_bitmaps [which_ship] [128 - draw_angle], x - width, y - height - 1);
800 return;
801 }
802 if (draw_angle < 192)
803 {
804 draw_sprite_vh_flip(bmp, ship_bitmaps [which_ship] [draw_angle - 128], x - width - 2, y - height - 1);
805 return;
806 }
807 draw_sprite_h_flip(bmp, ship_bitmaps [which_ship] [256 - draw_angle], x - width - 2, y - height);
808 */
809 int draw_angle = angle / 17.0666;
810
811 // draw_angle ++;
812 if (draw_angle > 60)
813 draw_angle = 0;
814
815 // draw_angle = draw_angle / 2);
816
817 // which_ship = 1;
818 // Adding a new ship? Remember GB_SHIP_TYPES!
819
820 if (draw_angle < 15)
821 {
822 draw_sprite(bmp, gb_ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
823 return;
824 }
825 if (draw_angle < 30)
826 {
827 draw_sprite_v_flip(bmp, gb_ship_bitmaps [which_ship] [30 - draw_angle], x - width, y - height - 1);
828 return;
829 }
830 if (draw_angle < 45)
831 {
832 draw_sprite_vh_flip(bmp, gb_ship_bitmaps [which_ship] [draw_angle - 30], x - width, y - height - 1);
833 return;
834 }
835 draw_sprite_h_flip(bmp, gb_ship_bitmaps [which_ship] [60 - draw_angle], x - width, y - height);
836
837 /* int draw_angle = angle / 16;
838
839 // draw_angle ++;
840 if (draw_angle > 64)
841 draw_angle = 0;
842
843 // draw_angle = draw_angle / 2);
844
845 // which_ship = 1;
846 // Adding a new ship? Remember GB_SHIP_TYPES!
847
848 if (draw_angle < 16)
849 {
850 draw_sprite(bmp, gb_ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
851 return;
852 }
853 if (draw_angle < 32)
854 {
855 draw_sprite_v_flip(bmp, gb_ship_bitmaps [which_ship] [32 - draw_angle], x - width, y - height - 1);
856 return;
857 }
858 if (draw_angle < 48)
859 {
860 draw_sprite_vh_flip(bmp, gb_ship_bitmaps [which_ship] [draw_angle - 32], x - width, y - height - 1);
861 return;
862 }
863 draw_sprite_h_flip(bmp, gb_ship_bitmaps [which_ship] [64 - draw_angle], x - width, y - height);
864 */
865 /* draw_angle ++;
866 if (draw_angle > 64)
867 draw_angle = 0;
868
869 draw_angle = (draw_angle / 2);
870
871 which_ship = 0;
872
873 if (draw_angle < 16)
874 {
875 draw_sprite(bmp, gb_ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
876 return;
877 }
878 if (draw_angle < 32)
879 {
880 draw_sprite_v_flip(bmp, gb_ship_bitmaps [which_ship] [32 - draw_angle], x - width, y - height);
881 return;
882 }
883 if (draw_angle < 48)
884 {
885 draw_sprite_vh_flip(bmp, gb_ship_bitmaps [which_ship] [draw_angle - 32], x - width, y - height);
886 return;
887 }
888 draw_sprite_h_flip(bmp, gb_ship_bitmaps [which_ship] [64 - draw_angle], x - width, y - height);
889
890 */
891 /*
892
893 if (draw_angle < 16)
894 {
895 draw_sprite(bmp, ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
896 return;
897 }
898 if (draw_angle < 32)
899 {
900 draw_sprite_v_flip(bmp, ship_bitmaps [which_ship] [32 - draw_angle], x - width, y - height);
901 return;
902 }
903 if (draw_angle < 48)
904 {
905 draw_sprite_vh_flip(bmp, ship_bitmaps [which_ship] [draw_angle - 32], x - width, y - height);
906 return;
907 }
908 draw_sprite_h_flip(bmp, ship_bitmaps [which_ship] [64 - draw_angle], x - width, y - height);
909 */
910 }
911 /*
912 void draw_triangle_ship(BITMAP *bmp, int dr, int size, int pointiness, int x, int y, unsigned char colour1, unsigned char colour2)
913 {
914 int x1,y1,x2,y2,x3,y3;
915
916 float radangle = angle_to_radians(actor[dr].angle);
917 // float radangle = angle_to_radians(actor[dr].angle);
918
919 x1 = x + cos(radangle) * (size + pointiness);
920 y1 = y + sin(radangle) * (size + pointiness);
921 x2 = x + cos(radangle + (PI * 2) / 3) * size;
922 y2 = y + sin(radangle + (PI * 2) / 3) * size;
923 x3 = x + cos(radangle - (PI * 2) / 3) * size;
924 y3 = y + sin(radangle - (PI * 2) / 3) * size;
925
926 triangle(bmp, x1, y1, x2, y2, x3, y3, colour2);
927 line(bmp, x1, y1, x2, y2, colour1);
928 line(bmp, x1, y1, x3, y3, colour1);
929 line(bmp, x2, y2, x3, y3, colour1);
930
931 }
932 */
933
934
935 void draw_status2(BITMAP *bmp, int max_x, int max_y, int play)
936 {
937
938 int dcol1;
939 int dcol2;
940 int i, x, y;
941 int a = player[play].actor_controlled;
942
943 int minutes_left = arena.time_left / 2000;
944 int seconds_left = (arena.time_left / 33.3333) - (minutes_left * 60);
945 int centiseconds_left = (arena.time_left) - (minutes_left * 2000) - seconds_left * 33.333;
946 centiseconds_left *= 3;
947 int time_colour = COLOUR_GREY6;
948 // int time_colour2 = COLOUR_YELLOW3 + centiseconds_left / 25;
949 int time_colour2 = COLOUR_YELLOW1 + (centiseconds_left % 50) / 7;
950 int time_x = 80;
951 int time_y = 20;
952 // char timestring [10] = "{";
953 // char istr [5];
954
955 if (seconds_left < 0)
956 seconds_left = 0;
957 if (minutes_left < 0)
958 minutes_left = 0;
959 if (centiseconds_left < 0)
960 centiseconds_left = 0;
961
962 if (game.type != GAME_DUEL || game.duel_mode == DUEL_3_MINUTES || game.duel_mode == DUEL_10_MINUTES)
963 {
964 if (arena.level_finished == 1)
965 {
966 textprintf_centre_ex(bmp, font2, max_x / 2, 170, COLOUR_ORANGE2 + (counter / 4) % 4, -1, "{__l_e_v_e_l____c_l_e_a_r__}");
967 textprintf_centre_ex(bmp, font, max_x / 2, 170, -1, -1, "{__l_e_v_e_l____c_l_e_a_r__}");
968 time_colour = COLOUR_YELLOW8;
969 time_colour2 = COLOUR_YELLOW4;
970 if (arena.time_bonus > 0)
971 {
972 if (arena.seconds_left_when_finished == 1)
973 {
974 textprintf_centre_ex(bmp, font2, max_x / 2, 280 + text_offset_y, COLOUR_RED8 - (counter / 4) % 4, -1, "{_%i__second__left_}", arena.seconds_left_when_finished);
975 textprintf_centre_ex(bmp, font, max_x / 2, 280 + text_offset_y, -1, -1, "{_%i__second__left_}", arena.seconds_left_when_finished);
976 }
977 else
978 {
979 textprintf_centre_ex(bmp, font2, max_x / 2, 280 + text_offset_y, COLOUR_RED8 - (counter / 4) % 4, -1, "{_%i__seconds__left_}", arena.seconds_left_when_finished);
980 textprintf_centre_ex(bmp, font, max_x / 2, 280 + text_offset_y, -1, -1, "{_%i__seconds__left_}", arena.seconds_left_when_finished);
981 }
982 textprintf_centre_ex(bmp, font2, max_x / 2, 320 + text_offset_y, COLOUR_RED8 - (counter / 4) % 4, -1, "{_bonus:__%i_}", arena.time_bonus);
983 textprintf_centre_ex(bmp, font, max_x / 2, 320 + text_offset_y, -1, -1, "{_bonus:__%i_}", arena.time_bonus);
984 }
985 else
986 {
987 textprintf_centre_ex(bmp, font2, max_x / 2, 320 + text_offset_y, COLOUR_GREEN8 - (counter / 4) % 4, -1, "{_no__bonus_}");
988 textprintf_centre_ex(bmp, font, max_x / 2, 320 + text_offset_y, -1, -1, "{_no__bonus_}");
989 }
990 }
991 else
992 {
993 if (minutes_left == 0 && seconds_left < 10)
994 {
995 // time_colour = COLOUR_RED8 - (counter / 4) % 4;
996 // time_colour2 = COLOUR_RED4 + (counter / 4) % 4;
997 time_colour2 = COLOUR_RED1 + (centiseconds_left % 50) / 7;
998 }
999 }
1000
1001 // textprintf_right(bmp, font, time_x, 20, time_colour, "%i : %i %i", minutes_left, seconds_left, centiseconds_left);
1002
1003 // if (minutes_left < 1)
1004 // strcat(timestring, "0");
1005 /* strcat(timestring, itoa(minutes_left, istr, 10));
1006 strcat(timestring, "_:_");
1007 if (seconds_left < 10)
1008 strcat(timestring, "0");
1009 strcat(timestring, itoa(seconds_left, istr, 10));
1010 strcat(timestring, "}");
1011 textprintf_right_ex(bmp, font2, time_x + 30, time_y, time_colour2, -1, timestring);
1012 textprintf_right_ex(bmp, font, time_x + 30, time_y, -1, -1, timestring);*/
1013 if (seconds_left < 10)
1014 {
1015 textprintf_right_ex(bmp, font2, time_x + 30, time_y, time_colour2, -1, "{%i_:_0%i}", minutes_left, seconds_left);
1016 textprintf_right_ex(bmp, font, time_x + 30, time_y, -1, -1, "{%i_:_0%i}", minutes_left, seconds_left);
1017 }
1018 else
1019 {
1020 textprintf_right_ex(bmp, font2, time_x + 30, time_y, time_colour2, -1, "{%i_:_%i}", minutes_left, seconds_left);
1021 textprintf_right_ex(bmp, font, time_x + 30, time_y, -1, -1, "{%i_:_%i}", minutes_left, seconds_left);
1022 }
1023 if (centiseconds_left < 10)
1024 {
1025 textprintf_right_ex(bmp, small_font, time_x + 55, time_y + 21, time_colour, -1, "0%i", centiseconds_left);
1026 // textprintf_right(bmp, font2, time_x + 80, 20, time_colour2, "0%i", centiseconds_left);
1027 }
1028 else
1029 {
1030 textprintf_right_ex(bmp, small_font, time_x + 55, time_y + 21, time_colour, -1, "%i", centiseconds_left);
1031 // textprintf_right(bmp, font2, time_x + 80, 20, time_colour2, "%i", centiseconds_left);
1032 }
1033 } // end if !duel || timed duel
1034
1035 // for (i = 0; i <
1036 if (game.type == GAME_SINGLE || game.type == GAME_COOP)
1037 {
1038 textprintf_right_ex(bmp, font2, max_x - 20, time_y, COLOUR_GREY5, -1, "{%i}", player[play].score);
1039 textprintf_right_ex(bmp, font, max_x - 20, time_y, -1, -1, "{%i}", player[play].score);
1040 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "level %i", arena.level);
1041 }
1042
1043 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
1044 {
1045 centiseconds_left = game.ta_total_time / 120000;
1046 // cs is actually hours here. Probably unnecessary, but there are some crazy people out there.
1047 minutes_left = game.ta_total_time / 2000 - (centiseconds_left * 60);
1048 seconds_left = (game.ta_total_time / 33.3333) - (minutes_left * 60);
1049 /* strcpy(timestring, "");
1050 if (centiseconds_left > 0)
1051 {
1052 strcat(timestring, itoa(centiseconds_left, istr, 10));
1053 strcat(timestring, ":");
1054 if (minutes_left < 10)
1055 strcat(timestring, "0");
1056 }
1057 strcat(timestring, itoa(minutes_left, istr, 10));
1058 strcat(timestring, ":");
1059 if (seconds_left < 10)
1060 strcat(timestring, "0");
1061 strcat(timestring, itoa(seconds_left, istr, 10));
1062 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, timestring);*/
1063 if (centiseconds_left > 0)
1064 {
1065 if (minutes_left < 10)
1066 {
1067 if (seconds_left < 10)
1068 {
1069 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:0%i:0%i", centiseconds_left, minutes_left, seconds_left);
1070 }
1071 else
1072 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:0%i:%i", centiseconds_left, minutes_left, seconds_left);
1073 }
1074 else
1075 {
1076 if (seconds_left < 10)
1077 {
1078 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:%i:0%i", centiseconds_left, minutes_left, seconds_left);
1079 }
1080 else
1081 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:%i:%i", centiseconds_left, minutes_left, seconds_left);
1082 }
1083 }
1084 else
1085 {
1086 if (seconds_left < 10)
1087 {
1088 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:0%i", minutes_left, seconds_left);
1089 }
1090 else
1091 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:%i", minutes_left, seconds_left);
1092 }
1093
1094 /* if (centiseconds_left > 0)
1095 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:%i:%i", centiseconds_left, minutes_left, seconds_left);
1096 else
1097 textprintf_ex(bmp, small_font, 20, 56, COLOUR_GREY6, -1, "%i:%i", minutes_left, seconds_left);*/
1098 // textprintf_ex(bmp, small_font, 20, 66, COLOUR_GREY6, -1, "%i:%i", game.ta_enemy_index, game.ta_symbol_count);
1099 // textprintf_ex(bmp, small_font, 20, 66, COLOUR_GREY6, -1, "%i: %i %i %i %i %i %i %i %i %i %i", game.ta_enemy_index, game.ta_enemies [0], game.ta_enemies [1], game.ta_enemies [2], game.ta_enemies [3], game.ta_enemies [4], game.ta_enemies [5], game.ta_enemies [6], game.ta_enemies [7], game.ta_enemies [8], game.ta_enemies [9]);
1100
1101 }
1102 // textprintf_ex(bmp, small_font, 20, 166, COLOUR_GREY6, -1, "%i: %i %i %i %i %i %i %i %i %i %i %i", arena.symbol_index, arena.symbol_list [0], arena.symbol_list [1], arena.symbol_list [2], arena.symbol_list [3], arena.symbol_list [4], arena.symbol_list [5], arena.symbol_list [6], arena.symbol_list [7], arena.symbol_list [8], arena.symbol_list [9], arena.symbol_list [10]);
1103
1104 if (game.type == GAME_DUEL)
1105 {
1106 dcol1 = COLOUR_YELLOW4;
1107 dcol2 = COLOUR_BLUE8;
1108 if ((play == 0 && player[0].duel_score > player[1].duel_score)
1109 || (play == 1 && player[1].duel_score > player[0].duel_score))
1110 {
1111 dcol1 = COLOUR_YELLOW4;
1112 dcol2 = COLOUR_ORANGE8;
1113 }
1114 if (player[0].duel_score == player[1].duel_score)
1115 {
1116 dcol1 = COLOUR_BLUE4;
1117 dcol2 = COLOUR_BLUE8;
1118 }
1119 dcol1 += (counter / 4) % 4;
1120 dcol2 -= (counter / 4) % 4;
1121 textprintf_right_ex(bmp, font2, max_x - 20, time_y, dcol2, -1, "{%i}", player[play].duel_score);
1122 textprintf_right_ex(bmp, font, max_x - 20, time_y, -1, -1, "{%i}", player[play].duel_score);
1123 if (game.duel_mode == DUEL_10_POINTS)
1124 textprintf_right_ex(bmp, small_font, max_x - 20, 56, COLOUR_GREY6, -1, "First to 10");
1125 if (game.duel_mode == DUEL_30_POINTS)
1126 textprintf_right_ex(bmp, small_font, max_x - 20, 56, COLOUR_GREY6, -1, "First to 30");
1127 }
1128
1129
1130
1131 if (actor[a].upgraded_system [UPG_TURRET] > 0)
1132 {
1133 int x2, y2;
1134 int col = COLOUR_YELLOW8 - (counter / 2) % 4;
1135 x = max_x / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1136 y = max_y / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1137 x2 = max_x / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1138 y2 = max_y / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1139 pline(bmp, x, y, x2, y2, col);
1140 x = max_x / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1141 y = max_y / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1142 x2 = max_x / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1143 y2 = max_y / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1144 pline(bmp, x, y, x2, y2, col);
1145 x = max_x / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1146 y = max_y / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1147 x2 = max_x / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1148 y2 = max_y / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1149 pline(bmp, x, y, x2, y2, col);
1150 x = max_x / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1151 y = max_y / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) - 5;
1152 x2 = max_x / 2 - (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1153 y2 = max_y / 2 + (50 + actor[a].upgraded_system [UPG_TURRET] * 17) + 5;
1154 pline(bmp, x, y, x2, y2, col);
1155 }
1156
1157 // Scanner:
1158 // NOTE: Scanner assumes at most 2 players - 0 & 1!
1159
1160 // int dot_colour;
1161
1162 if (game.mode_void == 0)
1163 {
1164
1165 rectfill(bmp, max_x - 80, max_y - 105, max_x - 5, max_y - 35, COLOUR_BLUE1);
1166
1167
1168 if (play == 0)
1169 {
1170 if (game.users > 1)
1171 {
1172 i = player[1].actor_controlled;
1173 if (actor[i].in_play != 0)
1174 {
1175 x = (actor[i].x * 75) / arena.max_x + max_x - 80;
1176 y = (actor[i].y * 70) / arena.max_y + max_y - 105;
1177 hline(bmp, max_x - 80, y, max_x - 5, COLOUR_GREY3);
1178 vline(bmp, x, max_y - 105, max_y - 35, COLOUR_GREY3);
1179 }
1180 }
1181 i = player[0].actor_controlled;
1182 if (actor[i].in_play != 0)
1183 {
1184 x = (actor[i].x * 75) / arena.max_x + max_x - 80;
1185 y = (actor[i].y * 70) / arena.max_y + max_y - 105;
1186 hline(bmp, max_x - 80, y, max_x - 5, COLOUR_GREY5);
1187 vline(bmp, x, max_y - 105, max_y - 35, COLOUR_GREY5);
1188 }
1189 }
1190 else
1191 {
1192 if (game.users > 1)
1193 {
1194 i = player[0].actor_controlled;
1195 if (actor[i].in_play != 0)
1196 {
1197 x = (actor[i].x * 75) / arena.max_x + max_x - 80;
1198 y = (actor[i].y * 70) / arena.max_y + max_y - 105;
1199 hline(bmp, max_x - 80, y, max_x - 5, COLOUR_GREY3);
1200 vline(bmp, x, max_y - 105, max_y - 35, COLOUR_GREY3);
1201 }
1202 }
1203 i = player[1].actor_controlled;
1204 if (actor[i].in_play != 0)
1205 {
1206 x = (actor[i].x * 75) / arena.max_x + max_x - 80;
1207 y = (actor[i].y * 70) / arena.max_y + max_y - 105;
1208 hline(bmp, max_x - 80, y, max_x - 5, COLOUR_GREY5);
1209 vline(bmp, x, max_y - 105, max_y - 35, COLOUR_GREY5);
1210 }
1211 }
1212
1213
1214
1215 for (i = 0; i < NO_ENEMIES; i ++)
1216 {
1217 if (enemy[i].type == ENEMY_NONE
1218 || ((enemy[i].type == ENEMY_SHADOW1 || enemy[i].type == ENEMY_SHADOW2) && enemy[i].attribute [0] == 0))
1219 continue;
1220 x = (enemy[i].x * 75) / arena.max_x + max_x - 80;
1221 y = (enemy[i].y * 70) / arena.max_y + max_y - 105;
1222 if (enemy[i].target == TARGET_PRIMARY)
1223 // putpixel(bmp, x, y, COLOUR_YELLOW8);
1224 {
1225 circlefill(bmp, x, y, 1, COLOUR_YELLOW5);
1226 putpixel(bmp, x, y, COLOUR_YELLOW8);
1227 }
1228 else
1229 putpixel(bmp, x, y, COLOUR_ORANGE8);
1230 }
1231
1232 for (i = 0; i < NO_PICKUPS; i ++)
1233 {
1234 if (pickup[i].type == PICKUP_NONE)
1235 continue;
1236 x = (pickup[i].x * 75) / arena.max_x + max_x - 80;
1237 y = (pickup[i].y * 70) / arena.max_y + max_y - 105;
1238 // if (enemy[i].target == TARGET_PRIMARY)
1239 // putpixel(bmp, x, y, COLOUR_YELLOW8);
1240 // else
1241 putpixel(bmp, x, y, COLOUR_GREEN8 - (counter / 4) % 4);
1242 }
1243
1244 rect(bmp, max_x - 80, max_y - 105, max_x - 5, max_y - 35, COLOUR_BLUE8);
1245 } // end if void mode
1246
1247 // draw_ship_status(bmp, 80, max_y - 150, player[play].actor_controlled, 0);
1248 draw_ship_status(bmp, 50, max_y - 80, player[play].actor_controlled, 0);
1249
1250 if (arena.game_over != 0)
1251 {
1252 if (game.type == GAME_DUEL)
1253 {
1254 if (game.duel_winner == -1)
1255 {
1256 textprintf_centre_ex(bmp, font2, max_x / 2, 180 + text_offset_y, COLOUR_GREEN8 - (counter / 3) % 4, -1, "{draw}");
1257 textprintf_centre_ex(bmp, font, max_x / 2, 180 + text_offset_y, -1, -1, "{draw}");
1258 }
1259 else
1260 {
1261 if (game.duel_winner == play)
1262 {
1263 textprintf_centre_ex(bmp, font2, max_x / 2, 180 + text_offset_y, COLOUR_ORANGE8 - (counter / 3) % 4, -1, "{you__win}");
1264 textprintf_centre_ex(bmp, font, max_x / 2, 180 + text_offset_y, -1, -1, "{you__win}");
1265 }
1266 else
1267 {
1268 textprintf_centre_ex(bmp, font2, max_x / 2, 180 + text_offset_y, COLOUR_GREEN8 - (counter / 3) % 4, -1, "{you__lose}");
1269 textprintf_centre_ex(bmp, font, max_x / 2, 180 + text_offset_y, -1, -1, "{you__lose}");
1270 }
1271 }
1272 }
1273 else
1274 {
1275 textprintf_centre_ex(bmp, font2, max_x / 2, 180 + text_offset_y, COLOUR_GREEN8 - (counter / 3) % 4, -1, "{___g_a_m_e___o_v_e_r___}");
1276 textprintf_centre_ex(bmp, font, max_x / 2, 180 + text_offset_y, -1, -1, "{___g_a_m_e___o_v_e_r___}");
1277 }
1278 }
1279 else
1280 {
1281 if (arena.new_level_sign > 0)
1282 {
1283 dcol2 = COLOUR_YELLOW8;
1284 dcol2 -= (counter / 4) % 4;
1285 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
1286 {
1287 textprintf_centre_ex(bmp, font2, max_x / 2, 160 + text_offset_y, dcol2, -1, "{___t_i_m_e__a_t_t_a_c_k___}");
1288 textprintf_centre_ex(bmp, font, max_x / 2, 160 + text_offset_y, -1, -1, "{___t_i_m_e__a_t_t_a_c_k___}");
1289 }
1290 else
1291 {
1292 if (game.type != GAME_DUEL)
1293 {
1294 textprintf_centre_ex(bmp, font2, max_x / 2, 160 + text_offset_y, dcol2, -1, "{____l_e_v_e_l__%i____}", arena.level);
1295 textprintf_centre_ex(bmp, font, max_x / 2, 160 + text_offset_y, -1, -1, "{____l_e_v_e_l__%i____}", arena.level);
1296 }
1297 }
1298 }
1299 }
1300 // }
1301
1302 if (game.type != GAME_DUEL && game.type != GAME_TIME_ATTACK && game.type != GAME_TIME_ATTACK_COOP)
1303 {
1304
1305 rect(bmp, 19, 69, 26, 79, COLOUR_GREY2);
1306 rect(bmp, 28 + 63, 69, 34 + 63, 79, COLOUR_GREY2);
1307 rect(bmp, 26, 71, 28 + 63, 77, COLOUR_GREY2);
1308 rect(bmp, 27, 73, 27 + 63, 75, COLOUR_GREY2);
1309
1310 rectfill(bmp, 20, 70, 25, 78, COLOUR_GREY5);
1311 rectfill(bmp, 29 + 63, 70, 33 + 63, 78, COLOUR_GREY5);
1312
1313 // rectfill(bmp, 25, 72, 28 + 9 * 7, 76, COLOUR_GREY5);
1314 hline(bmp, 25, 72, 28 + 63, COLOUR_GREY5);
1315 hline(bmp, 25, 76, 28 + 63, COLOUR_GREY5);
1316
1317 if (arena.targets_left_total > 0)
1318 {
1319 // char targets_left_string [30];
1320 /* rect(bmp, 19, 69, 26, 79, COLOUR_GREY2);
1321 rect(bmp, 21 + 7 + arena.targets_left_total * 7, 69, 27 + 7 + arena.targets_left_total * 7, 79, COLOUR_GREY2);
1322 rect(bmp, 26, 71, 25 + arena.targets_left_total * 7, 77, COLOUR_GREY2);
1323
1324 rectfill(bmp, 20, 70, 25, 78, COLOUR_GREY5);
1325 rectfill(bmp, 22 + 7 + arena.targets_left_total * 7, 70, 26 + 7 + arena.targets_left_total * 7, 78, COLOUR_GREY5);
1326
1327 for (i = 0; i < arena.targets_left_total; i ++)
1328 {
1329 rectfill(bmp, 29 + i * 7, 70, 32 + i * 7, 78, COLOUR_GREY5);
1330 }
1331
1332 for (i = 0; i < arena.targets_left_total; i ++)
1333 {
1334 rect(bmp, 28 + i * 7, 70, 33 + i * 7, 78, COLOUR_GREY1);
1335 }
1336
1337 rectfill(bmp, 25, 72, 28 + arena.targets_left_total * 7, 76, COLOUR_GREY5);
1338 */
1339 rectfill(bmp, 25, 73, 28 + arena.targets_left_total * 7, 75, COLOUR_YELLOW8 - (counter / 4) % 6);
1340
1341 // targets_left_string [i] = '\0';
1342
1343 // textprintf_ex(bmp, small_font, 20, 70, COLOUR_GREY4, -1, targets_left_string);
1344 // textprintf_ex(bmp, small_font, 19, 69, COLOUR_GREY6, -1, targets_left_string);
1345 // textprintf_centre_ex(bmp, small_font, max_x / 2, 60, COLOUR_GREY4, targets_left_string);
1346 // textprintf_centre_ex(bmp, small_font, max_x / 2 - 1, 59, COLOUR_GREY6, targets_left_string);
1347 // rectfill(bmp, x + i * 10 - 3, y - 30, x + i * 10 + 3, y - 24, COLOUR_RED8);
1348 }
1349
1350
1351 // if (arena.time_left > 195 && arena.time_left < 330 && (arena.time_left / 15) % 3 != 0)
1352 if (arena.time_left > 240 && arena.time_left < 330 && (arena.time_left / 10) % 3 != 0)
1353 {
1354 textprintf_centre_ex(bmp, font2, max_x / 2, 250 + text_offset_y, COLOUR_RED8 - (counter / 2) % 4, -1, "{_hurry__up_}");
1355 textprintf_centre_ex(bmp, font, max_x / 2, 250 + text_offset_y, -1, -1, "{_hurry__up_}");
1356 }
1357
1358 // if (arena.hostile > 0 && arena.hostile < 150 && (arena.hostile / 15) % 2 == 0)
1359 if (arena.hostile > 0 && arena.hostile < 90 && (arena.hostile / 10) % 3 != 0)
1360 {
1361 textprintf_centre_ex(bmp, font2, max_x / 2, 250 + text_offset_y, COLOUR_RED8 - (counter / 2) % 4, -1, "{_watch__out_}");
1362 textprintf_centre_ex(bmp, font, max_x / 2, 250 + text_offset_y, -1, -1, "{_watch__out_}");
1363 }
1364 }
1365
1366 }
1367
1368
1369
1370 void draw_hud(BITMAP *bmp, int x, int y, int i)
1371 {
1372 return;
1373 // int viewing_angle = actor[i].moving_angle - actor[i].angle - ANGLE_QUARTER;
1374
1375 // draw_scan(bmp, 50, 50, 0, 0);
1376 /*
1377 if (game[0].users == 2)
1378 draw_scan(bmp, 260, 50, 0, 1);
1379 else
1380 draw_scan(bmp, 590, 50, 0, 1);
1381
1382 draw_ship_status(bmp, 50, 420, i, 1);
1383
1384 if (actor[i].x_speed != 0 || actor[i].y_speed != 0)
1385 {
1386 // start off with the velocity indicator:
1387 // int distance1 = sqrt(hypot(actor[i].x_speed, actor[i].y_speed)) + 5 + actor[i].radius;
1388 // int distance2 = (sqrt(hypot(actor[i].x_speed, actor[i].y_speed)) * 4) / 5 + 5 + actor[i].radius;
1389 / * int x_disp1 = cos(angle_to_radians(viewing_angle)) * distance1;
1390 int y_disp1 = sin(angle_to_radians(viewing_angle)) * distance1;
1391 int x_disp2 = cos(angle_to_radians(viewing_angle + 10)) * distance2;
1392 int y_disp2 = sin(angle_to_radians(viewing_angle + 10)) * distance2;
1393 int x_disp3 = cos(angle_to_radians(viewing_angle - 10)) * distance2;
1394 int y_disp3 = sin(angle_to_radians(viewing_angle - 10)) * distance2;
1395
1396 line(bmp, x + x_disp1, y + y_disp1, x + x_disp2, y + y_disp2, COLOUR_GREEN4);
1397 line(bmp, x + x_disp1, y + y_disp1, x + x_disp3, y + y_disp3, COLOUR_GREEN4);
1398 */
1399 // }
1400
1401 }
1402
1403 void draw_ship_status(BITMAP *bmp, int x, int y, int a, int style)
1404 {
1405
1406 int i;
1407
1408 int shield_colour;
1409
1410 // char numbers [10];
1411 // char nstring [10];
1412
1413 if (game.type != GAME_DUEL && game.type != GAME_TIME_ATTACK && game.type != GAME_TIME_ATTACK_COOP)
1414 {
1415 for (i = 0; i < game.ships_left; i ++)
1416 {
1417 rectfill(bmp, x - 8, y - 70 - i * 9, x - 15, y - 77 - i * 9, COLOUR_YELLOW7);
1418 rect(bmp, x - 8, y - 70 - i * 9, x - 15, y - 77 - i * 9, COLOUR_YELLOW1);
1419 }
1420 }
1421
1422 if (actor[a].in_play == 0)
1423 return;
1424
1425
1426 int armoured = (actor[a].armour * 100) / actor[a].max_armour;
1427 int armour_colour = RLE_LSHIP_BLUE;
1428 // if (actor[a].in_play == 1)
1429 // {
1430 if (armoured < 100)
1431 armour_colour = RLE_LSHIP_GREEN;
1432 if (armoured < 70)
1433 armour_colour = RLE_LSHIP_YELLOW;
1434 if (armoured < 30)
1435 armour_colour = RLE_LSHIP_RED;
1436
1437 draw_rle_sprite(bmp, large_ships [actor[a].ship] [armour_colour], x - 24, y - 24);
1438
1439 if (actor[a].hurt_pulse > 0)
1440 draw_rle_sprite(bmp, large_ships [actor[a].ship] [RLE_LSHIP_LINES], x - 24, y - 24);
1441
1442 armour_colour = COLOUR_BLUE4;
1443 int armour_colour2 = COLOUR_BLUE1;
1444
1445 if (armoured < 100)
1446 {
1447 armour_colour = COLOUR_GREEN4;
1448 armour_colour2 = COLOUR_GREEN1;
1449 }
1450 if (armoured < 70)
1451 {
1452 armour_colour = COLOUR_YELLOW4;
1453 armour_colour2 = COLOUR_YELLOW1;
1454 }
1455 if (armoured < 30)
1456 {
1457 armour_colour = COLOUR_RED4;
1458 armour_colour2 = COLOUR_RED1;
1459 }
1460
1461 // armour_colour += 7 - (((arena.time_left) - ((arena.time_left / 2000) * 2000) - seconds_left * 33.333) % 50) / 7;
1462 armour_colour2 += 7 - ((arena.time_left % 105) % 35) / 5;
1463 // int minutes_left = arena.time_left / 2000;
1464 // int seconds_left = (arena.time_left / 33.3333) - (minutes_left * 60);
1465
1466 /* itoa(actor[a].armour / 10, numbers, 10);
1467 strcpy(nstring, "{");
1468 strcat(nstring, numbers);
1469 strcat(nstring, "}");
1470 textprintf_ex(bmp, font2, x + 48, y + 15, armour_colour2, -1, nstring);
1471 textprintf_ex(bmp, font, x + 48, y + 15, -1, -1, nstring);*/
1472
1473 textprintf_ex(bmp, font2, x + 48, y + 15, armour_colour2, -1, "{%i}", actor[a].armour / 10);
1474 textprintf_ex(bmp, font, x + 48, y + 15, -1, -1, "{%i}", actor[a].armour / 10);
1475
1476 if (actor[a].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE] > 0)
1477 {
1478 /* itoa(actor[a].shield / 10, numbers, 10);
1479 strcpy(nstring, "{");
1480 strcat(nstring, numbers);
1481 strcat(nstring, "}");
1482 textprintf_ex(bmp, font2, x + 55, y - 20, COLOUR_GREEN4 + grand(5), -1, nstring);
1483 textprintf_ex(bmp, font, x + 55, y - 20, -1, -1, nstring);*/
1484 textprintf_ex(bmp, font2, x + 55, y - 20, COLOUR_GREEN4 + grand(5), -1, "{%i}", actor[a].shield / 10);
1485 textprintf_ex(bmp, font, x + 55, y - 20, -1, -1, "{%i}", actor[a].shield / 10);
1486 }
1487
1488 // }
1489
1490 // circlefill(bmp, x, y, 7, armour_colour);
1491
1492 int layers = actor[a].shield / 70; // 100
1493 int last_layer = actor[a].shield % 70; // 100
1494
1495 if (actor[a].in_play == 1
1496 && actor[a].ability [ABILITY_DEFENCE] [SYMBOL_CIRCLE] > 0 && actor[a].shield > 0)
1497 {
1498 for (i = 0; i < layers; i ++)
1499 {
1500 shield_colour = COLOUR_GREEN6;// + grand(6);
1501 // a2 = 64 + (actor[a].shield * 96) / actor[a].max_shield;
1502 // a1 = 64 - (actor[a].shield * 96) / actor[a].max_shield;
1503 // arc(bmp, x, y, itofix(-28), itofix(156), 35 + i * 3, shield_colour);
1504 rectfill(bmp, 0 + x - 20, y - 30 - (i * 6), 0 + x + 20, y - 35 - (i * 6), shield_colour);
1505 rect(bmp, 0 + x - 20, y - 30 - (i * 6), 0 + x + 20, y - 35 - (i * 6), COLOUR_GREEN1);
1506
1507 }
1508
1509 if (last_layer != 0)
1510 {
1511 shield_colour = COLOUR_GREEN6;// + grand(3);
1512 if (actor[a].shield_pulse > 0)
1513 {
1514 /* shield_colour = COLOUR_GREY4 + actor[a].shield_pulse / 3;
1515 if (shield_colour > COLOUR_WHITE)
1516 shield_colour = COLOUR_WHITE;*/
1517 shield_colour = actor[a].shield_pulse / 2;
1518 switch(shield_colour)
1519 {
1520 case 0: shield_colour = COLOUR_GREEN6; break;
1521 case 1: shield_colour = COLOUR_GREEN7; break;
1522 case 2: shield_colour = COLOUR_GREEN8; break;
1523 case 3: shield_colour = COLOUR_YELLOW8; break;
1524 default:
1525 case 4: shield_colour = COLOUR_WHITE; break;
1526
1527 }
1528 }
1529 // a2 = 64 + (last_layer * 96) / 100;
1530 // a1 = 64 - (last_layer * 96) / 100;
1531 // a2 = 64 + (last_layer * 96) / 100;
1532 // a1 = 64 - (last_layer * 96) / 100;
1533 // arc(bmp, x, y, itofix(a1), itofix(a2), 35 + layers * 3, shield_colour);
1534 last_layer = 20 * last_layer / 70;
1535 rectfill(bmp, 0 + x - last_layer, y - 30 - (i * 6), 0 + x + last_layer, y - 35 - (i * 6), shield_colour);
1536 rect(bmp, 0 + x - last_layer, y - 30 - (i * 6), 0 + x + last_layer, y - 35 - (i * 6), COLOUR_GREEN1);
1537 }
1538 /*
1539 if (actor[a].upgraded_system [UPG_SHIELD] > 0 && actor[a].shield > 0)
1540 {
1541 for (i = 0; i < actor[a].upgraded_system [UPG_SHIELD] + 1; i ++)
1542 {
1543 shield_colour = COLOUR_BLUE6 + grand(3);
1544 if (i == actor[a].upgraded_system [UPG_SHIELD]
1545 && actor[a].shield_pulse > 0)
1546 {
1547 shield_colour = COLOUR_GREY4 + actor[a].shield_pulse / 3;
1548 if (shield_colour > COLOUR_WHITE)
1549 shield_colour = COLOUR_WHITE;
1550 }
1551 a2 = 64 + (actor[a].shield * 96) / actor[a].max_shield;
1552 a1 = 64 - (actor[a].shield * 96) / actor[a].max_shield;
1553 arc(bmp, x, y, itofix(a1), itofix(a2), 25 + i * 3, shield_colour);
1554
1555 }
1556 */
1557 }
1558
1559 // if (actor[a].ship != SHIP_SCORPION)
1560 if (player[actor[a].controller].link_fire == 1)
1561 {
1562 circlefill(bmp, x - 36, y + 43, 2, COLOUR_YELLOW3);
1563 textprintf_centre_ex(bmp, small_font, x - 35, y + 37, COLOUR_GREEN8, -1, "x");
1564 }
1565 else
1566 {
1567 textprintf_centre_ex(bmp, small_font, x - 36, y + 37, COLOUR_ORANGE8, -1, "| |");
1568 circlefill(bmp, x - 36, y + 43, 2, COLOUR_RED8);
1569 }
1570
1571 if (actor[a].ship != SHIP_RETRO)
1572 {
1573 if (actor[a].dragging == 20)
1574 {
1575 circlefill(bmp, x - 36, y + 33, 2, COLOUR_RED8);
1576 }
1577 else
1578 {
1579 circlefill(bmp, x - 36, y + 33, 2, COLOUR_YELLOW3);
1580 }
1581 }
1582
1583 armour_colour = COLOUR_GREY4;
1584 if (actor[a].repairing > 0)
1585 {
1586 if (actor[a].repairing > 173)
1587 armour_colour = COLOUR_YELLOW8;
1588 else
1589 armour_colour = COLOUR_YELLOW1 + actor[a].repairing / 25;
1590 armour_colour2 = COLOUR_ORANGE1 + (actor[a].repairing / 4) % 8;
1591
1592 /* itoa(actor[a].repairing / 2, numbers, 10);
1593 strcpy(nstring, "{");
1594 strcat(nstring, numbers);
1595 strcat(nstring, "}");
1596 textprintf_ex(bmp, font2, x + 48, y + 45, armour_colour2, -1, nstring);
1597 textprintf_ex(bmp, font, x + 48, y + 45, -1, -1, nstring);*/
1598 textprintf_ex(bmp, font2, x + 48, y + 45, armour_colour2, -1, "{%i}", actor[a].repairing / 2);
1599 textprintf_ex(bmp, font, x + 48, y + 45, -1, -1, "{%i}", actor[a].repairing / 2);
1600
1601 armour_colour = COLOUR_YELLOW2 + (counter / 3) % 6;
1602
1603 }
1604 // armoured = (actor[a].energy * 50) / actor[a].max_energy;
1605 armoured /= 2;
1606 rectfill(bmp, x - 25, y + 30, x + armoured - 25, y + 45, armour_colour);
1607 rect(bmp, x - 25, y + 30, x + 25, y + 45, COLOUR_GREY6);
1608 // add text
1609
1610 // for (i = 0; i < player[actor[a].controller].ships_left; i ++)
1611 }
1612
1613
1614 void draw_upgrades(BITMAP *bmp, int x, int y, int play)
1615 {
1616 // text_mode(-1);
1617 int i, j, k, x_offset, n, col, l;
1618 int a = player[play].actor_controlled;
1619
1620 // actor[a].ability [abil] [symb] ++;
1621 /*
1622 Primary - yellow
1623 drive - green
1624 armour - blue
1625 secondary - red
1626 */
1627 col = COLOUR_RED8;
1628 for (i = 0; i < 4; i ++)
1629 {
1630 switch(i)
1631 {
1632 case ABILITY_PRIMARY:
1633 col = COLOUR_YELLOW5;
1634 break;
1635 case ABILITY_DRIVE:
1636 col = COLOUR_GREEN5;
1637 break;
1638 case ABILITY_DEFENCE:
1639 col = COLOUR_BLUE5;
1640 break;
1641 case ABILITY_SECONDARY:
1642 col = COLOUR_RED5;
1643 break;
1644 }
1645 n = 0;
1646 for (j = 0; j < 4; j ++)
1647 {
1648 if (actor[a].ability [i] [j] > 0)
1649 n ++;
1650 }
1651 if (n == 0)
1652 continue;
1653 x_offset = n * 6;
1654 l = 0;
1655 for (j = 0; j < 3; j ++)
1656 {
1657 if (actor[a].ability [i] [j] > 0)
1658 {
1659 draw_static_symbol(bmp, x + i * 60 + l * 10 - x_offset, y + 8, col, j);
1660 for (k = 0; k < actor[a].ability [i] [j]; k ++)
1661 {
1662 hline(bmp, x + i * 60 + l * 10 - 3 - x_offset, y - k * 3, x + i * 60 + l * 10 + 3 - x_offset, col);
1663 }
1664 l ++;
1665 }
1666 }
1667
1668 }
1669
1670 // textprintf_ex(bmp, small_font, x - 20, y + 20, COLOUR_YELLOW6, -1, primary_name(actor[a].primary));
1671 char dstr [30];
1672 secondary_name(actor[a].secondary, dstr);
1673 if (game.users == 1)
1674 textprintf_ex(bmp, small_font, x + 250, y + 20, COLOUR_YELLOW6, -1, dstr);
1675 else
1676 textprintf_ex(bmp, small_font, x + 220, y, COLOUR_YELLOW6, -1, dstr);
1677
1678 }
1679
1680 void draw_static_symbol(BITMAP *bmp, int x, int y, int col, int symb)
1681 {
1682 switch(symb)
1683 {
1684 case SYMBOL_SQUARE:
1685 rectfill(bmp, x - 3, y - 3, x + 3, y + 3, col);
1686 break;
1687 case SYMBOL_CIRCLE:
1688 circlefill(bmp, x, y, 3, col);
1689 break;
1690 /* case SYMBOL_CROSS:
1691 rectfill(bmp, x - 1, y - 3, x + 1, y + 3, col);
1692 rectfill(bmp, x - 3, y - 1, x + 3, y + 1, col);
1693 break;*/
1694 case SYMBOL_TRIANGLE:
1695 // triangle(bmp, x, y - 3, x + 3, y + 2, x - 3, y + 2, col);
1696 triangle(bmp, x, y + 5, x + 3, y - 2, x - 3, y - 2, col);
1697 break;
1698 }
1699
1700 }
1701 /*
1702 char *upgrade_name(int i)
1703 {
1704 switch (i)
1705 {
1706 case UPG_NONE:
1707 return "none";
1708 case UPG_SPEED:
1709 return "speed";
1710 case UPG_ARMOUR:
1711 return "armour";
1712 case UPG_POWER:
1713 return "power";
1714 case UPG_AUTOFIRE:
1715 return "autof";
1716 case UPG_MULTIFIRE:
1717 return "multif";
1718 case UPG_PROJECT:
1719 return "proj";
1720 case UPG_WARHEAD:
1721 return "whead";
1722 case UPG_ROCKET:
1723 return "rocket";
1724 case UPG_TUBES:
1725 return "tubes";
1726 case UPG_SLIDE:
1727 return "slide";
1728 case UPG_SEEKER:
1729 return "seek";
1730 case UPG_BOMB:
1731 return "bomb";
1732 case UPG_LAUNCHER:
1733 return "launch";
1734 case UPG_LOADER:
1735 return "load";
1736 case UPG_SPECIAL:
1737 return "special";
1738 case UPG_TURRET:
1739 return "turret";
1740 case UPG_SIDEKICK:
1741 return "sidek";
1742 case UPG_HEAVY:
1743 return "heavy";
1744 case UPG_ORBITAL:
1745 return "orbit";
1746 case UPG_BACKFIRE:
1747 return "backf";
1748 case UPG_SHIELD:
1749 return "shield";
1750 case UPG_RETRO:
1751 return "retro";
1752 case UPG_ROAMER:
1753 return "roam";
1754 case UPG_MINIMISSILES:
1755 return "minim";
1756 case UPG_DRIFT:
1757 return "drift";
1758
1759
1760
1761 }
1762
1763 return "ERROR!";
1764 }
1765
1766 char *primary_name(int i)
1767 {
1768 switch (i)
1769 {
1770 case WPN_DARTS:
1771 return "Darts";
1772 case WPN_SPINES:
1773 return "Spines";
1774 case WPN_BURST:
1775 return "Burst";
1776 case WPN_TEETH:
1777 return "Teeth";
1778 }
1779
1780 return "ERROR!";
1781
1782 }
1783 */
1784
1785 void secondary_name(int i, char str [30])
1786 {
1787 switch (i)
1788 {
1789 default:
1790 case SECOND_NONE: strcpy(str, "No Weapon"); break;
1791 case SECOND_FURIOUS_ORB: strcpy(str, "Furious Orb"); break;
1792 case SECOND_BURNING_EYE: strcpy(str, "Burning Eyes"); break;
1793 case SECOND_MANIFOLD_ORB: strcpy(str, "Manifold Orb"); break;
1794 case SECOND_EYE_DESOLATION: strcpy(str, "Eye of Desolation"); break;
1795 case SECOND_PANIC_EELS: strcpy(str, "Panic Eels"); break;
1796 case SECOND_WORMS_SORROW: strcpy(str, "Worms of Agony"); break;
1797 case SECOND_WORMS_AGONY: strcpy(str, "Worms of Sorrow"); break;
1798 case SECOND_FROZEN_STARS: strcpy(str, "Frozen Stars"); break;
1799 case SECOND_FROZEN_TEETH: strcpy(str, "Frozen Teeth"); break;
1800 case SECOND_TOXIC_SUN: strcpy(str, "Toxic Sun"); break;
1801 case SECOND_FLOWER: strcpy(str, "Toxic Flower"); break;
1802 case SECOND_SPORES: strcpy(str, "Golden Spores"); break;
1803 case SECOND_CLAWS: strcpy(str, "Claws of Hunger"); break;
1804 }
1805
1806 }
1807
1808
1809
1810 void draw_scan_dot(BITMAP *bmp, int x, int y, int type)
1811 {
1812
1813 switch(type)
1814 {
1815 case ACTORTYPE_SHIP:
1816 putpixel(bmp, x, y, COLOUR_BLUE4);
1817 break;
1818 case ACTORTYPE_REDSHIP:
1819 putpixel(bmp, x, y, COLOUR_RED4);
1820 /* putpixel(bmp, x + 1, y, 2);
1821 putpixel(bmp, x - 1, y, 2);
1822 putpixel(bmp, x, y + 1, 2);
1823 putpixel(bmp, x, y - 1, 2);*/
1824 break;
1825
1826 }
1827
1828 }
1829
1830
1831
1832 void draw_bullets(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
1833 {
1834
1835 int i, x, y, x2, y2;
1836
1837 for (i = 0; i < NO_BULLETS; i ++)
1838 {
1839 if (bullet[i].type == BULLET_NONE)
1840 continue;
1841 if (bullet[i].left_owner == 0)
1842 continue;
1843 x = (bullet[i].x / GRAIN) - (centre_x / GRAIN);
1844 y = (bullet[i].y / GRAIN) - (centre_y / GRAIN);
1845 /* if ((bullet[i].x < centre_x - (max_x / 2) * GRAIN
1846 || bullet[i].x > centre_x + (max_x / 2) * GRAIN
1847 || bullet[i].y < centre_y - (max_y / 2) * GRAIN
1848 || bullet[i].y > centre_y + (max_y / 2) * GRAIN)
1849 &&
1850 (bullet[i].x2 < centre_x - (max_x / 2) * GRAIN
1851 || bullet[i].x2 > centre_x + (max_x / 2) * GRAIN
1852 || bullet[i].y2 < centre_y - (max_y / 2) * GRAIN
1853 || bullet[i].y2 > centre_y + (max_y / 2) * GRAIN))
1854 continue;*/
1855 if ((bullet[i].x + bullet[i].size < centre_x - (max_x / 2) * GRAIN
1856 || bullet[i].x - bullet[i].size > centre_x + (max_x / 2) * GRAIN
1857 || bullet[i].y + bullet[i].size < centre_y - (max_y / 2) * GRAIN
1858 || bullet[i].y - bullet[i].size > centre_y + (max_y / 2) * GRAIN)
1859 &&
1860 (bullet[i].x2 < centre_x - (max_x / 2) * GRAIN
1861 || bullet[i].x2 > centre_x + (max_x / 2) * GRAIN
1862 || bullet[i].y2 < centre_y - (max_y / 2) * GRAIN
1863 || bullet[i].y2 > centre_y + (max_y / 2) * GRAIN))
1864 continue;
1865 x2 = (bullet[i].x2 / GRAIN) - (centre_x / GRAIN);
1866 y2 = (bullet[i].y2 / GRAIN) - (centre_y / GRAIN);
1867 draw_a_bullet(bmp, i, x + (max_x / 2), y + (max_y / 2), x2 + (max_x / 2), y2 + (max_y / 2), max_x, max_y, play);
1868
1869 }
1870
1871 }
1872
1873
1874 // angle is the angle it's being viewed at, not its direction
1875 void draw_a_bullet(BITMAP *bmp, int dr, int x, int y, int x2, int y2, int max_x, int max_y, int play)
1876 {
1877 int xa, ya, xb, yb, xc, yc, cs;
1878
1879 #ifdef DEBUG_DISPLAY
1880 if (debug_info == 1)
1881 textprintf_centre_ex(bmp, small_font, x, y, COLOUR_YELLOW4, COLOUR_GREY2, "%i", bullet[dr].type);
1882 #endif
1883
1884 switch(bullet[dr].type)
1885 {
1886 case BULLET_TRI1:
1887 draw_tri(bmp, x, y, bullet[dr].angle, 13, 8, ANGLE_QUARTER + ANGLE_1_32, GC_YELLOW1, GC_YELLOW6);
1888 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1889 xa = x - xpart(bullet[dr].angle, 4);
1890 ya = y - ypart(bullet[dr].angle, 4);
1891 circlefill(bmp, xa, ya, 4 + grand(3), TRANS_ORANGE);
1892 circlefill(bmp, xa, ya, 3 + grand(2), TRANS_YELLOW);
1893 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1894 break;
1895 case BULLET_TRI2:
1896 draw_tri(bmp, x, y, bullet[dr].angle, 13, 8, ANGLE_QUARTER + ANGLE_1_32, GC_RED1, GC_RED6);
1897 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1898 xa = x - xpart(bullet[dr].angle, 4);
1899 ya = y - ypart(bullet[dr].angle, 4);
1900 circlefill(bmp, xa, ya, 4 + grand(3), TRANS_LBLUE);
1901 circlefill(bmp, xa, ya, 3 + grand(2), TRANS_WHITE);
1902 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1903 break;
1904 case BULLET_TRI3:
1905 draw_tri(bmp, x, y, bullet[dr].angle, 14, 7, ANGLE_QUARTER + ANGLE_1_32, GC_BLUE1, GC_BLUE6);
1906 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1907 xa = x - xpart(bullet[dr].angle, 4);
1908 ya = y - ypart(bullet[dr].angle, 4);
1909 circlefill(bmp, xa, ya, 4 + grand(3), TRANS_YELLOW);
1910 circlefill(bmp, xa, ya, 3 + grand(2), TRANS_WHITE);
1911 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1912 break;
1913 case BULLET_OVERTRI:
1914 draw_tri(bmp, x, y, bullet[dr].angle, 18, 12, ANGLE_QUARTER + ANGLE_1_32, GC_ORANGE1, GC_ORANGE6);
1915 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1916 xa = x - xpart(bullet[dr].angle, 9);
1917 ya = y - ypart(bullet[dr].angle, 9);
1918 circlefill(bmp, xa, ya, 7 + grand(3), TRANS_LGREEN);
1919 circlefill(bmp, xa, ya, 6 + grand(2), TRANS_YELLOW);
1920 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1921 break;
1922 /* case BULLET_SLIVER:
1923 pline(bmp, x + xpart(bullet[dr].special1, 2), y + ypart(bullet[dr].special1, 2),
1924 x - xpart(bullet[dr].special1, 2), y - ypart(bullet[dr].special1, 2), COLOUR_YELLOW8);
1925 break;*/
1926 case BULLET_CIRCLER:
1927 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1928 xa = bullet[dr].timeout;
1929 /* if (xa < 32)
1930 circle(bmp, x, y, xa, get_circler_colour(xa / 8));
1931 if (xa < 48 && xa > 16)
1932 circle(bmp, x, y, (xa - 16), get_circler_colour((xa - 16) / 8));
1933 if (xa < 64 && xa > 32)
1934 circle(bmp, x, y, (xa - 32), get_circler_colour((xa - 32) / 8));*/
1935 if (xa < 24)
1936 circle(bmp, x, y, xa * 2, get_circler_colour(xa / 6));
1937 if (xa < 36 && xa > 12)
1938 circle(bmp, x, y, (xa - 12) * 2, get_circler_colour((xa - 12) / 6));
1939 if (xa < 48 && xa > 24)
1940 circle(bmp, x, y, (xa - 24) * 2, get_circler_colour((xa - 24) / 6));
1941 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1942 break;
1943 case BULLET_TORPEDO2:
1944 xa = x + xpart(bullet[dr].angle, 3);
1945 ya = y + ypart(bullet[dr].angle, 3);
1946 xb = x + xpart(bullet[dr].angle + ANGLE_FULL / 3, 4);
1947 yb = y + ypart(bullet[dr].angle + ANGLE_FULL / 3, 4);
1948 xc = x + xpart(bullet[dr].angle - ANGLE_FULL / 3, 4);
1949 yc = y + ypart(bullet[dr].angle - ANGLE_FULL / 3, 4);
1950 /* cs = angle_to_radians(bullet[dr].angle);
1951 xa = (x) + ((float) cos(cs) * 3);
1952 ya = (y) + ((float) sin(cs) * 3);
1953 xb = (x) + ((float) cos(cs + (PI * 2) / 3) * 4);
1954 yb = (y) + ((float) sin(cs + (PI * 2) / 3) * 4);
1955 xc = (x) + ((float) cos(cs - (PI * 2) / 3) * 4);
1956 yc = (y) + ((float) sin(cs - (PI * 2) / 3) * 4);*/
1957 /* xa = (x) + ((float) cos(radangle + PI) * 3);
1958 ya = (y) + ((float) sin(radangle + PI) * 3);
1959 xb = (x) + ((float) cos(radangle + PI + (PI * 2) / 3) * 4);
1960 yb = (y) + ((float) sin(radangle + PI + (PI * 2) / 3) * 4);
1961 xc = (x) + ((float) cos(radangle + PI - (PI * 2) / 3) * 4);
1962 yc = (y) + ((float) sin(radangle + PI - (PI * 2) / 3) * 4);*/
1963 triangle(bmp, xa, ya, xb, yb, xc, yc, COLOUR_GREY5);
1964 line(bmp, xa, ya, xb, yb, COLOUR_BLUE7);
1965 line(bmp, xa, ya, xc, yc, COLOUR_BLUE7);
1966 line(bmp, xb, yb, xc, yc, COLOUR_BLUE7);
1967 break;
1968 case BULLET_HOSTILE:
1969 break;
1970 case BULLET_STING:
1971 case BULLET_STING2:
1972 // xa = x2 - x;
1973 // ya = y2 - y;
1974 x = (bullet[dr].x) - (actor[player[play].actor_controlled].x) + (max_x / 2) * GRAIN;
1975 y = (bullet[dr].y) - (actor[player[play].actor_controlled].y) + (max_y / 2) * GRAIN;
1976 x2 = (bullet[dr].x2) - (actor[player[play].actor_controlled].x) + (max_x / 2) * GRAIN;
1977 y2 = (bullet[dr].y2) - (actor[player[play].actor_controlled].y) + (max_y / 2) * GRAIN;
1978 xa = x2 - x;
1979 ya = y2 - y;
1980 pline(bmp, x / GRAIN, y / GRAIN, (x + 3 * xa) / GRAIN, (y + 3 * ya) / GRAIN, bullet[dr].colours [0]);
1981 // putpixel(bmp, x / GRAIN, y / GRAIN, bullet[dr].colours [0]);
1982 break;
1983 case BULLET_POWERED:
1984 case BULLET_ZAP:
1985 case BULLET_ZAP_DRAG:
1986 case BULLET_SILVER_TOOTH:
1987 case BULLET_CRYSTAL_TOOTH:
1988 case BULLET_CRYSTAL_SPINE:
1989 case BULLET_GOLDEN_NEEDLE:
1990 case BULLET_GOLDEN_NEEDLE_SMALL:
1991 case BULLET_NUMEROUS_DART:
1992 case BULLET_BRASS_TOOTH:
1993 case BULLET_BRASS_TOOTH_SMALL:
1994 /* xa = x2 - x;
1995 ya = y2 - y;
1996 pline(bmp, x, y, x + xa, y + ya, bullet[dr].colours [0]);
1997 pline(bmp, x + xa, y + ya, x + 2 * xa, y + 2 * ya, bullet[dr].colours [1]);
1998 pline(bmp, x + 2 * xa, y + 2 * ya, x + 3 * xa, y + 3 * ya, bullet[dr].colours [2]);*/
1999 // we need the high granularity for zaps
2000 x = (bullet[dr].x) - (actor[player[play].actor_controlled].x);
2001 y = (bullet[dr].y) - (actor[player[play].actor_controlled].y);
2002 x2 = (bullet[dr].x2) - (actor[player[play].actor_controlled].x);
2003 y2 = (bullet[dr].y2) - (actor[player[play].actor_controlled].y);
2004 xa = x2 - x;
2005 ya = y2 - y;
2006 pline(bmp, (x) / GRAIN + (max_x / 2), y / GRAIN + (max_y / 2), (x + xa) / GRAIN + (max_x / 2), (y + ya) / GRAIN + (max_y / 2), bullet[dr].colours [0]);
2007 pline(bmp, (x + xa) / GRAIN + (max_x / 2), (y + ya) / GRAIN + (max_y / 2), (x + 2 * xa) / GRAIN + (max_x / 2), (y + 2 * ya) / GRAIN + (max_y / 2), bullet[dr].colours [1]);
2008 pline(bmp, (x + 2 * xa) / GRAIN + (max_x / 2), (y + 2 * ya) / GRAIN + (max_y / 2), (x + 3 * xa) / GRAIN + (max_x / 2), (y + 3 * ya) / GRAIN + (max_y / 2), bullet[dr].colours [2]);
2009 break;
2010 case BULLET_E_BOMB2:
2011 x2 = GC_WHITE - (bullet[dr].timeout / 4) % 4;
2012 xa = x + xpart((bullet[dr].timeout % 32) * 32, 5);
2013 ya = y + ypart((bullet[dr].timeout % 32) * 32, 5);
2014 putpixel(bmp, xa, ya, x2);
2015 xa = x + xpart((bullet[dr].timeout % 32) * 32 + ANGLE_HALF, 5);
2016 ya = y + ypart((bullet[dr].timeout % 32) * 32 + ANGLE_HALF, 5);
2017 putpixel(bmp, xa, ya, x2);
2018 x2 = GC_GREY4 + (bullet[dr].timeout / 4) % 4;
2019 circlefill(bmp, x, y, 2, x2);
2020 x2 = COLOUR_WHITE - (bullet[dr].timeout / 4) % 4;
2021 circlefill(bmp, x, y, 1, x2);
2022 break;
2023 case BULLET_DISRUPT1:
2024 clear_bitmap(distortion_mask);
2025 circlefill(distortion_mask, 100, 100, 9, 1);
2026 distortion(bmp, x, y, 19, 19, grand(31) - 15, grand(31) - 15);
2027 break;
2028 case BULLET_DISRUPT1_DROP:
2029 clear_bitmap(distortion_mask);
2030 xa = bullet[dr].special1;
2031 if (xa > 95)
2032 xa = 95;
2033 circlefill(distortion_mask, 100, 100, xa, 1);
2034 ya = bullet[dr].timeout / 2;
2035 distortion(bmp, x, y, xa, xa, grand(ya) - grand(ya), grand(ya) - grand(ya));
2036 break;
2037 case BULLET_DISRUPT2:
2038 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2039 circlefill(bmp, x, y, 6 + pulsate(64, 3, bullet[dr].timeout), TRANS_REVERSE);
2040 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2041 break;
2042 case BULLET_DISRUPT3:
2043 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2044 circlefill(bmp, x, y, 6 + pulsate(64, 3, bullet[dr].timeout), TRANS_DARKEN);
2045 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2046 break;
2047 case BULLET_MINE1:
2048 /* x2 = COLOUR_WHITE - (bullet[dr].timeout / 4) % 4;
2049 xa = x + xpart((bullet[dr].timeout % 32) * 32, 5);
2050 ya = y + ypart((bullet[dr].timeout % 32) * 32, 5);
2051 putpixel(bmp, xa, ya, x2);
2052 xa = x + xpart((bullet[dr].timeout % 32) * 32 + ANGLE_HALF, 5);
2053 ya = y + ypart((bullet[dr].timeout % 32) * 32 + ANGLE_HALF, 5);
2054 putpixel(bmp, xa, ya, x2);*/
2055 // x2 = COLOUR_GREY4 + (bullet[dr].timeout / 4) % 4;
2056 circlefill(bmp, x, y, 3, GC_GREEN2);
2057 circlefill(bmp, x, y, 2, GC_GREEN8);
2058 x2 = COLOUR_ORANGE2 + (bullet[dr].timeout / 4) % 7;
2059 putpixel(bmp, x, y, x2);
2060 // circlefill(bmp, x, y, 1, x2);
2061 break;
2062 case BULLET_MINE2:
2063 circlefill(bmp, x, y, 3, GC_RED2);
2064 circlefill(bmp, x, y, 2, GC_RED8);
2065 x2 = COLOUR_YELLOW2 + (bullet[dr].timeout / 4) % 7;
2066 putpixel(bmp, x, y, x2);
2067 break;
2068 case BULLET_MINE3:
2069 circlefill(bmp, x, y, 3, GC_YELLOW2);
2070 circlefill(bmp, x, y, 2, GC_YELLOW8);
2071 x2 = COLOUR_BLUE2 + (bullet[dr].timeout / 2) % 7;
2072 putpixel(bmp, x, y, x2);
2073 break;
2074 case BULLET_MBOMB: // was going to be the messengers' weapon, but not any more
2075 case BULLET_E_BOMB:
2076 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2077 circlefill(bmp, x, y, 2 + grand(2), TRANS_WHITE);
2078 circlefill(bmp, x, y, 3 + grand(3), TRANS_YELLOW);
2079 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2080 draw_a_light(bmp, 7 + grand(3), x, y);
2081 break;
2082 case BULLET_TWIRLY1:
2083 x2 = (bullet[dr].timeout % 32) * 32;
2084 if (bullet[dr].special1 == 1)
2085 x2 = ANGLE_FULL - x2;
2086 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2087 xa = x + xpart(x2, 10);
2088 ya = y + ypart(x2, 10);
2089 circlefill(bmp, xa, ya, 2 + grand(2), bullet[dr].colours [0]);
2090 circlefill(bmp, xa, ya, 3 + grand(3), bullet[dr].colours [1]);
2091 draw_a_light(bmp, 8 + grand(3), xa, ya);
2092 xa = x + xpart(x2 + ANGLE_HALF, 10);
2093 ya = y + ypart(x2 + ANGLE_HALF, 10);
2094 circlefill(bmp, xa, ya, 2 + grand(2), bullet[dr].colours [0]);
2095 circlefill(bmp, xa, ya, 3 + grand(3), bullet[dr].colours [1]);
2096 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2097 draw_a_light(bmp, 8 + grand(3), xa, ya);
2098 break;
2099 case BULLET_TWIRLY2:
2100 x2 = (bullet[dr].timeout % 32) * 32;
2101 if (bullet[dr].special1 == 1)
2102 x2 = ANGLE_FULL - x2;
2103 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2104 xa = x + xpart(x2, 6);
2105 ya = y + ypart(x2, 6);
2106 circlefill(bmp, xa, ya, 2 + grand(2), bullet[dr].colours [0]);
2107 draw_a_light(bmp, 8 + grand(3), xa, ya);
2108 xa = x + xpart(x2 + ANGLE_HALF, 6);
2109 ya = y + ypart(x2 + ANGLE_HALF, 6);
2110 circlefill(bmp, xa, ya, 2 + grand(2), bullet[dr].colours [0]);
2111 circlefill(bmp, x, y, 3 + grand(2), bullet[dr].colours [0]);
2112 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2113 draw_a_light(bmp, 8 + grand(3), xa, ya);
2114 break;
2115 case BULLET_TWIRLY3:
2116 x2 = (bullet[dr].timeout % 32) * 32;
2117 if (bullet[dr].special2 == 1)
2118 x2 = ANGLE_FULL - x2;
2119 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2120 for (cs = 0; cs < 3; cs ++)
2121 {
2122 // xa = x + xpart(x2 + ANGLE_QUARTER * cs, 12);
2123 // ya = y + ypart(x2 + ANGLE_QUARTER * cs, 12);
2124 xa = x + xpart(x2 + (ANGLE_FULL / 3) * cs, 12);
2125 ya = y + ypart(x2 + (ANGLE_FULL / 3) * cs, 12);
2126 circlefill(bmp, xa, ya, 2 + grand(2), TRANS_YELLOW);
2127 circlefill(bmp, xa, ya, 3 + grand(3), TRANS_LRED);
2128 draw_a_light(bmp, 8 + grand(3), xa, ya);
2129 }
2130 x2 = ANGLE_FULL - x2;
2131 for (cs = 0; cs < 3; cs ++)
2132 {
2133 xa = x + xpart(x2 + (ANGLE_FULL / 3) * cs, 4);
2134 ya = y + ypart(x2 + (ANGLE_FULL / 3) * cs, 4);
2135 circlefill(bmp, xa, ya, 2 + grand(2), TRANS_YELLOW);
2136 circlefill(bmp, xa, ya, 3 + grand(3), TRANS_LGREEN);
2137 }
2138 draw_a_light(bmp, 12 + grand(4), x, y);
2139 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2140 break;
2141 case BULLET_TWISTY:
2142 x2 = (bullet[dr].special1 % 32) * 32;
2143 y2 = xpart(x2, 13);
2144 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2145 xa = x + xpart(bullet[dr].angle + ANGLE_QUARTER, y2);
2146 ya = y + ypart(bullet[dr].angle + ANGLE_QUARTER, y2);
2147 circlefill(bmp, xa, ya, 3 + grand(2), bullet[dr].colours [0]);
2148 circlefill(bmp, xa, ya, 4 + grand(3), bullet[dr].colours [1]);
2149 draw_a_light(bmp, 8 + grand(3), xa, ya);
2150 xa = x + xpart(bullet[dr].angle - ANGLE_QUARTER, y2);
2151 ya = y + ypart(bullet[dr].angle - ANGLE_QUARTER, y2);
2152 circlefill(bmp, xa, ya, 3 + grand(2), bullet[dr].colours [0]);
2153 circlefill(bmp, xa, ya, 4 + grand(3), bullet[dr].colours [1]);
2154 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2155 draw_a_light(bmp, 8 + grand(3), xa, ya);
2156 break;
2157 case BULLET_OVERPULSE:
2158 x2 = (bullet[dr].timeout % 64) * 16;
2159 if (bullet[dr].special2 == 1)
2160 x2 = ANGLE_FULL - x2;
2161 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2162 for (cs = 0; cs < 4; cs ++)
2163 {
2164 xa = x + xpart(x2 + ANGLE_QUARTER * cs, 12 + xpart(x2, 5));
2165 ya = y + ypart(x2 + ANGLE_QUARTER * cs, 12 + xpart(x2, 5)); // yes, xpart
2166 circlefill(bmp, xa, ya, 6 + grand(2) + xpart(x2, 3), TRANS_YELLOW);
2167 circlefill(bmp, xa, ya, 7 + grand(4) + xpart(x2, 3), TRANS_LGREEN);
2168 draw_a_light(bmp, 8 + grand(3), xa, ya);
2169 }
2170 circlefill(bmp, x, y, 12 + grand(2) + xpart(x2, 3), TRANS_YELLOW);
2171 circlefill(bmp, x, y, 13 + grand(5) + xpart(x2, 3), TRANS_LGREEN);
2172 /* for (cs = 0; cs < 3; cs ++)
2173 {
2174 xa = x + xpart(x2 + (ANGLE_FULL / 3) * cs, 12 + xpart((x2 * 2), 5));
2175 ya = y + ypart(x2 + (ANGLE_FULL / 3) * cs, 12 + xpart((x2 * 2), 5)); // yes, xpart
2176 circlefill(bmp, xa, ya, 2 + grand(2), TRANS_YELLOW);
2177 circlefill(bmp, xa, ya, 3 + grand(3), TRANS_LGREEN);
2178 draw_a_light(bmp, 8 + grand(3), xa, ya);
2179 }
2180 y2 = ANGLE_FULL - x2;
2181 for (cs = 0; cs < 3; cs ++)
2182 {
2183 xa = x + xpart(y2 + (ANGLE_FULL / 3) * cs + ANGLE_FULL / 6, 12 - xpart((y2 * 2), 5));
2184 ya = y + ypart(y2 + (ANGLE_FULL / 3) * cs + ANGLE_FULL / 6, 12 - xpart((y2 * 2), 5)); // yes, xpart
2185 circlefill(bmp, xa, ya, 2 + grand(2), TRANS_YELLOW);
2186 circlefill(bmp, xa, ya, 3 + grand(3), TRANS_LGREEN);
2187 draw_a_light(bmp, 8 + grand(3), xa, ya);
2188 }*/
2189 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2190 break;
2191 /* case BULLET_GOLDEN_NEEDLE:
2192 case BULLET_GOLDEN_NEEDLE_SMALL:
2193 x = (bullet[dr].x) - (actor[player[play].actor_controlled].x) + (max_x / 2) * GRAIN;
2194 y = (bullet[dr].y) - (actor[player[play].actor_controlled].y) + (max_y / 2) * GRAIN;
2195 x2 = (bullet[dr].x2) - (actor[player[play].actor_controlled].x) + (max_x / 2) * GRAIN;
2196 y2 = (bullet[dr].y2) - (actor[player[play].actor_controlled].y) + (max_y / 2) * GRAIN;
2197 xa = x2 - x;
2198 ya = y2 - y;
2199 pline(bmp, x / GRAIN, y / GRAIN, (x + 3 * xa) / GRAIN, (y + 3 * ya) / GRAIN, bullet[dr].colours [0]);
2200 break;
2201 case BULLET_FROZEN_BREATH:
2202 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_3 + counter % 2], (x) - 3, (y) - 3);
2203 break;
2204 case BULLET_SNOW_DART:
2205 case BULLET_ICE_DART:
2206 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_3 + counter % 2], (x) - 2, (y) - 2);
2207 break; */
2208 case BULLET_BURNING_SPIRIT:
2209 draw_a_light(bmp, 6 + grand(3), x - grand(2), y - grand(2));
2210 case BULLET_BURNING_DRAGGED: // fall-through
2211 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_5 + counter % 2], (x) - 3 + counter % 2, (y) - 3 + counter % 2);
2212 break;
2213 case BULLET_BURST:
2214 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_2 + counter % 4], (x) - 4 + counter % 2, (y) - 4 + counter % 2);
2215 draw_a_light(bmp, 6 + grand(3), x - grand(2), y - grand(2));
2216 break;
2217 case BULLET_PUFFY3:
2218 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_GREEN_BLOB_2 + counter % 4], (x) - 4 + counter % 2, (y) - 4 + counter % 2);
2219 draw_a_light(bmp, 6 + grand(3), x - grand(2), y - grand(2));
2220 break;
2221 case BULLET_PUFFY4:
2222 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_2 + counter % 4], (x) - 4 + counter % 2, (y) - 4 + counter % 2);
2223 draw_a_light(bmp, 6 + grand(3), x - grand(2), y - grand(2));
2224 break;
2225 case BULLET_GREEN_BLAT:
2226 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_GREEN_BLOB_5 + bullet[dr].timeout % 2], (x) - 3 + bullet[dr].timeout % 2, (y) - 3 + bullet[dr].timeout % 2);
2227 // draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_GREEN_BLOB_5 + counter % 2], (x) - 3, (y) - 3);
2228 break;
2229 case BULLET_BLUE_BLAT:
2230 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_5 + bullet[dr].timeout % 2], (x) - 3 + bullet[dr].timeout % 2, (y) - 3 + bullet[dr].timeout % 2);
2231 break;
2232 case BULLET_YELLOW_FLAK:
2233 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_5 + bullet[dr].timeout % 2], (x) - 3 + bullet[dr].timeout % 2, (y) - 3 + bullet[dr].timeout % 2);
2234 break;
2235 /* case BULLET_SNOW_DART_SMALL:
2236 case BULLET_ICE_DART_SMALL:
2237 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_5], (x) - 1, (y) - 1);
2238 break;
2239 case BULLET_PARTICLE_SPITTER:
2240 case BULLET_FAR_SPITTER:
2241 cs = (bullet[dr].timeout / 2) % 6;
2242 if (cs > 3)
2243 cs = 6 - cs;
2244 putpixel(bmp, x, y, bullet[dr].colours [0] + cs);
2245 break; */
2246 case BULLET_FROZEN_STAR:
2247 case BULLET_EVIL_STAR:
2248 // cs = (bullet[dr].timeout / 3) % 4;
2249 // xa = bullet[dr].colours [1];
2250 // if (dr % 2 == 0)
2251 // cs = 4 - cs;
2252 circlefill(bmp, x, y, 1, bullet[dr].colours [1] - 4 + (bullet[dr].timeout / 5) % 4);
2253 putpixel(bmp, x, y, bullet[dr].colours [0] - 4 + (bullet[dr].timeout / 3) % 4);
2254 // putpixel(bmp, x - 1, y, xa);
2255 // putpixel(bmp, x + 1, y, xa);
2256 break;
2257 // case BULLET_NUMEROUS_BLADE:
2258 // case BULLET_FROZEN_STAR:
2259 case BULLET_SLIVER:
2260 cs = (bullet[dr].timeout / 3) % 4;
2261 xa = bullet[dr].colours [1] - 2;
2262 if (bullet[dr].special2 == 0) // terrible
2263 cs = 4 - cs;
2264 putpixel(bmp, x, y, bullet[dr].colours [1]);
2265 switch(cs)
2266 {
2267 case 0:
2268 putpixel(bmp, x - 1, y, xa);
2269 putpixel(bmp, x + 1, y, xa);
2270 break;
2271 case 1:
2272 putpixel(bmp, x - 1, y - 1, xa);
2273 putpixel(bmp, x + 1, y + 1, xa);
2274 break;
2275 case 2:
2276 putpixel(bmp, x, y - 1, xa);
2277 putpixel(bmp, x, y + 1, xa);
2278 break;
2279 case 3:
2280 putpixel(bmp, x + 1, y - 1, xa);
2281 putpixel(bmp, x - 1, y + 1, xa);
2282 break;
2283 }
2284 break;
2285 case BULLET_WINGS1:
2286 circlefill(bmp, x, y, 2, GC_GREY3);
2287 circlefill(bmp, x, y, 1, GC_GREY5);
2288 putpixel(bmp, x, y, GC_GREY6);
2289 pline(bmp, x, y,
2290 x + xpart(bullet[dr].angle + ANGLE_HALF, 8 - (bullet[dr].timeout / 4)),
2291 y + ypart(bullet[dr].angle + ANGLE_HALF, 8 - (bullet[dr].timeout / 4)),
2292 GC_GREY5);
2293 break;
2294 case BULLET_WINGS2:
2295 circlefill(bmp, x, y, 2, GC_GREY3);
2296 circlefill(bmp, x, y, 1, GC_GREY5);
2297 putpixel(bmp, x, y, GC_GREY6);
2298 pline(bmp, x, y,
2299 x - xpart(bullet[dr].angle + (30 - bullet[dr].timeout) * 5, 7),
2300 y - ypart(bullet[dr].angle + (30 - bullet[dr].timeout) * 5, 7),
2301 GC_GREY5);
2302 pline(bmp, x, y,
2303 x - xpart(bullet[dr].angle - (30 - bullet[dr].timeout) * 5, 7),
2304 y - ypart(bullet[dr].angle - (30 - bullet[dr].timeout) * 5, 7),
2305 GC_GREY5);
2306 break;
2307 case BULLET_WINGS3:
2308 circlefill(bmp, x, y, 2, GC_GREY3);
2309 circlefill(bmp, x, y, 1, GC_GREY5);
2310 putpixel(bmp, x, y, GC_GREY6);
2311 pline(bmp, x, y,
2312 x - xpart(bullet[dr].angle + 150, 7),
2313 y - ypart(bullet[dr].angle + 150, 7),
2314 GC_GREY5);
2315 pline(bmp, x, y,
2316 x - xpart(bullet[dr].angle - 150, 7),
2317 y - ypart(bullet[dr].angle - 150, 7),
2318 GC_GREY5);
2319 break;
2320 case BULLET_BIGWINGS1:
2321 circlefill(bmp, x, y, 4, GC_GREY2);
2322 circlefill(bmp, x, y, 3, GC_GREY5);
2323 // putpixel(bmp, x, y, GC_GREY6);
2324 pline(bmp, x, y,
2325 x + xpart(bullet[dr].angle + ANGLE_HALF, 12 - (bullet[dr].timeout / 3)),
2326 y + ypart(bullet[dr].angle + ANGLE_HALF, 12 - (bullet[dr].timeout / 3)),
2327 GC_GREY5);
2328 break;
2329 case BULLET_BIGWINGS2:
2330 circlefill(bmp, x, y, 4, GC_GREY2);
2331 circlefill(bmp, x, y, 3, GC_GREY5);
2332 pline(bmp, x, y,
2333 x - xpart(bullet[dr].angle + (30 - bullet[dr].timeout) * 7, 11),
2334 y - ypart(bullet[dr].angle + (30 - bullet[dr].timeout) * 7, 11),
2335 GC_GREY5);
2336 pline(bmp, x, y,
2337 x - xpart(bullet[dr].angle - (30 - bullet[dr].timeout) * 7, 11),
2338 y - ypart(bullet[dr].angle - (30 - bullet[dr].timeout) * 7, 11),
2339 GC_GREY5);
2340 pline(bmp, x, y,
2341 x - xpart(bullet[dr].angle + (30 - bullet[dr].timeout) * 3, 11),
2342 y - ypart(bullet[dr].angle + (30 - bullet[dr].timeout) * 3, 11),
2343 GC_GREY5);
2344 pline(bmp, x, y,
2345 x - xpart(bullet[dr].angle - (30 - bullet[dr].timeout) * 3, 11),
2346 y - ypart(bullet[dr].angle - (30 - bullet[dr].timeout) * 3, 11),
2347 GC_GREY5);
2348 break;
2349 case BULLET_BIGWINGS3:
2350 circlefill(bmp, x, y, 4, GC_GREY2);
2351 circlefill(bmp, x, y, 3, GC_GREY5);
2352 pline(bmp, x, y,
2353 x - xpart(bullet[dr].angle + 210, 11),
2354 y - ypart(bullet[dr].angle + 210, 11),
2355 GC_GREY5);
2356 pline(bmp, x, y,
2357 x - xpart(bullet[dr].angle - 210, 11),
2358 y - ypart(bullet[dr].angle - 210, 11),
2359 GC_GREY5);
2360 pline(bmp, x, y,
2361 x - xpart(bullet[dr].angle + 90, 11),
2362 y - ypart(bullet[dr].angle + 90, 11),
2363 GC_GREY5);
2364 pline(bmp, x, y,
2365 x - xpart(bullet[dr].angle - 90, 11),
2366 y - ypart(bullet[dr].angle - 90, 11),
2367 GC_GREY5);
2368 break;
2369 // case BULLET_POWERED:
2370 // circlefill(bmp, (x), y, 1, bullet[dr].colours [random() % 4]);
2371 // if (crandom(3) == 0)
2372 // circlefill(bmp, (x), y, 1, bullet[dr].colours [2]);
2373 // else
2374 // circlefill(bmp, (x), y, 1, bullet[dr].colours [0]);
2375 // circlefill(bmp, (x), y, 1 + random() % 2, bullet[dr].colours [0]);
2376 // break;
2377 /* case BULLET_PLASMA:
2378 switch(bullet[dr].colours [0])
2379 {
2380 case TRANS_DRED:
2381 xa = RLE_SMALL1_RED_BLOB_L;
2382 break;
2383 default:
2384 case TRANS_DBLUE:
2385 xa = RLE_SMALL1_BLUE_BLOB_L;
2386 break;
2387 case TRANS_DGREEN:
2388 xa = RLE_SMALL1_GREEN_BLOB_L;
2389 break;
2390 case TRANS_ORANGE:
2391 xa = RLE_SMALL1_ORANGE_BLOB_L;
2392 break;
2393 case TRANS_YELLOW:
2394 xa = RLE_SMALL1_YELLOW_BLOB_L;
2395 break;
2396 }
2397 if ((counter / 3) % 4 == 1)
2398 draw_rle_sprite(bmp, small1_rle [xa], (x) - 5, (y) - 5);
2399 if ((counter / 3) % 2 == 0)
2400 draw_rle_sprite(bmp, small1_rle [xa + 1], (x) - 5, (y) - 5);
2401 if ((counter / 3) % 4 == 3)
2402 draw_rle_sprite(bmp, small1_rle [xa + 2], (x) - 5, (y) - 5);
2403 // circlefill(bmp, (x), y, 1 + random() % 2, bullet[dr].colours [0]);
2404 break;*/
2405 // case BULLET_E_BOMB:
2406 // circlefill(bmp, x, y, 2, bullet[dr].colours [0] - (bullet[dr].timeout / 8) % 4);
2407 // break;
2408 case BULLET_BALL1:
2409 if ((counter / 3) % 2 == 1)
2410 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_1], (x) - 4, (y) - 4);
2411 else
2412 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_2], (x) - 4, (y) - 4);
2413 break;
2414 case BULLET_BALL2:
2415 if ((counter / 3) % 2 == 1)
2416 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_1], (x) - 4, (y) - 4);
2417 else
2418 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_2], (x) - 4, (y) - 4);
2419 break;
2420 case BULLET_PULSE1:
2421 if ((bullet[dr].timeout / 8) % 2 == 1)
2422 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_PULSE1 + (bullet[dr].timeout / 2) % 4], (x) - 6, (y) - 6);
2423 else
2424 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_PULSE4 - (bullet[dr].timeout / 2) % 4], (x) - 6, (y) - 6);
2425 draw_a_light(bmp, 8 + grand(3), x - grand(2), y - grand(2));
2426 break;
2427 case BULLET_PULSE2:
2428 if ((bullet[dr].timeout / 8) % 2 == 1)
2429 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_PULSE2_1 + (bullet[dr].timeout / 2) % 4], (x) - 6, (y) - 6);
2430 else
2431 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_PULSE2_4 - (bullet[dr].timeout / 2) % 4], (x) - 6, (y) - 6);
2432 draw_a_light(bmp, 8 + grand(3), x - grand(2), y - grand(2));
2433 break;
2434 case BULLET_BFLAK:
2435 /* if ((counter / 3) % 2 == 1)
2436 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_1], (x) - 4, (y) - 4);
2437 else
2438 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_2], (x) - 4, (y) - 4);
2439 xa = grand(3);
2440 ya = 3 - xa;
2441 x2 = xpart(bullet[dr].timeout * 29, 9);
2442 y2 = ypart(bullet[dr].timeout * 29, 9);
2443 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_4 + xa], x - ya + x2, y - ya + y2);
2444 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_YELLOW_BLOB_4 + xa], x - ya - x2, y - ya - y2);*/
2445 xa = bullet[dr].timeout * 18;
2446 x2 = 4 + grand(3);
2447 y2 = 6 + grand(4);
2448 /* ya = TRANS_WHITE;
2449 if (grand(3) == 0)
2450 ya = TRANS_LBLUE;
2451 if (grand(3) == 0)
2452 ya = TRANS_PURPLE;
2453 xb = TRANS_LBLUE;
2454 if (ya == TRANS_LBLUE || grand(3) == 0)
2455 xb = TRANS_DBLUE;
2456 if (grand(5) == 0)
2457 xb = TRANS_DGREY; */
2458 ya = TRANS_WHITE;
2459 xb = TRANS_LBLUE;
2460 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2461 triangle(bmp, x + xpart(xa, x2), y + ypart(xa, x2),
2462 x + xpart(xa + ANGLE_FULL / 3, x2), y + ypart(xa + ANGLE_FULL / 3, x2),
2463 x + xpart(xa - ANGLE_FULL / 3, x2), y + ypart(xa - ANGLE_FULL / 3, x2),
2464 ya);
2465 triangle(bmp, x + xpart(xa, y2), y + ypart(xa, y2),
2466 x + xpart(xa + ANGLE_FULL / 3, y2), y + ypart(xa + ANGLE_FULL / 3, y2),
2467 x + xpart(xa - ANGLE_FULL / 3, y2), y + ypart(xa - ANGLE_FULL / 3, y2),
2468 xb);
2469 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2470 break;
2471 case BULLET_ZIGZAG2:
2472 cs = bullet[dr].colours [0];
2473 if (bullet[dr].special2 <= 3)
2474 cs = bullet[dr].colours [1];
2475 if (bullet[dr].special2 <= 2)
2476 cs = bullet[dr].colours [2];
2477 if (bullet[dr].special2 <= 1)
2478 cs = bullet[dr].colours [3];
2479 int points2 [8];
2480 int c2 = bullet[dr].special4 + ANGLE_QUARTER;
2481 int xd = 4 + bullet[dr].special2 / 2;
2482 x2 = ((bullet[dr].x2) - (actor[player[play].actor_controlled].x)) / GRAIN + (max_x / 2);
2483 y2 = ((bullet[dr].y2) - (actor[player[play].actor_controlled].y)) / GRAIN + (max_y / 2);
2484 points2 [0] = x + xpart(c2, xd);
2485 points2 [1] = y + ypart(c2, xd);
2486 points2 [2] = x - xpart(c2, xd);
2487 points2 [3] = y - ypart(c2, xd);
2488 points2 [4] = x2 - xpart(c2, xd);
2489 points2 [5] = y2 - ypart(c2, xd);
2490 points2 [6] = x2 + xpart(c2, xd);
2491 points2 [7] = y2 + ypart(c2, xd);
2492 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2493 polygon(bmp, 4, points2, cs);
2494 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2495 break;
2496 case BULLET_MANIFOLD_ORB:
2497 case BULLET_FURIOUS_ORB:
2498 circlefill(bmp, x, y, 3, GC_GREY2);
2499 circlefill(bmp, x, y, 2, GC_GREY6);
2500 // case BULLET_BOMB:
2501 // draw_sprite(bmp, small2_bmp [BMP_SMALL2_BOMB], (x) - 3, (y) - 3);
2502 break;
2503 case BULLET_MANIFOLD_ORB_SMALL:
2504 case BULLET_FURIOUS_ORB_SMALL:
2505 circlefill(bmp, x, y, 2, GC_GREY2);
2506 circlefill(bmp, x, y, 1, GC_GREY6);
2507 // circlefill(bmp, x, y, 1, GC_GREY2);
2508 // putpixel(bmp, x, y, GC_GREY6);
2509 break;
2510 case BULLET_EYE_DESOLATION:
2511 switch((bullet[dr].angle % ANGLE_FULL) / ANGLE_QUARTER)
2512 { // divisor was 42
2513 case 0:
2514 xa = (bullet[dr].angle % ANGLE_FULL) / 42;
2515 if (xa > 6) xa = 6;
2516 if (xa < 0) xa = 0;
2517 draw_sprite(bmp, small4_bmp [BMP_SMALL4_EYE_7 - xa], (x) - 4, (y) - 5);
2518 break;
2519 case 1:
2520 xa = (bullet[dr].angle - ANGLE_QUARTER) / 42;
2521 if (xa > 6) xa = 6;
2522 if (xa < 0) xa = 0;
2523 draw_sprite_v_flip(bmp, small4_bmp [BMP_SMALL4_EYE_1 + xa], (x) - 4, (y) - 5);
2524 break;
2525 case 2:
2526 xa = (bullet[dr].angle - ANGLE_HALF) / 42;
2527 if (xa > 6) xa = 6;
2528 if (xa < 0) xa = 0;
2529 draw_sprite_vh_flip(bmp, small4_bmp [BMP_SMALL4_EYE_7 - xa], (x) - 4, (y) - 5);
2530 break;
2531 case 3:
2532 xa = (bullet[dr].angle - ANGLE_HALF - ANGLE_QUARTER) / 42;
2533 if (xa > 6) xa = 6;
2534 if (xa < 0) xa = 0;
2535 draw_sprite_h_flip(bmp, small4_bmp [BMP_SMALL4_EYE_1 + xa], (x) - 4, (y) - 5);
2536 break;
2537
2538 }
2539 break;
2540 case BULLET_BURNING_EYE:
2541 switch((bullet[dr].angle % ANGLE_FULL) / ANGLE_QUARTER)
2542 { // divisor was 42
2543 case 0:
2544 xa = (bullet[dr].angle % ANGLE_FULL) / 42;
2545 if (xa > 6) xa = 6;
2546 if (xa < 0) xa = 0;
2547 draw_sprite(bmp, small4_bmp [BMP_SMALL4_BEYE_7 - xa], (x) - 4, (y) - 5);
2548 break;
2549 case 1:
2550 xa = (bullet[dr].angle - ANGLE_QUARTER) / 42;
2551 if (xa > 6) xa = 6;
2552 if (xa < 0) xa = 0;
2553 draw_sprite_v_flip(bmp, small4_bmp [BMP_SMALL4_BEYE_1 + xa], (x) - 4, (y) - 5);
2554 break;
2555 case 2:
2556 xa = (bullet[dr].angle - ANGLE_HALF) / 42;
2557 if (xa > 6) xa = 6;
2558 if (xa < 0) xa = 0;
2559 draw_sprite_vh_flip(bmp, small4_bmp [BMP_SMALL4_BEYE_7 - xa], (x) - 4, (y) - 5);
2560 break;
2561 case 3:
2562 xa = (bullet[dr].angle - ANGLE_HALF - ANGLE_QUARTER) / 42;
2563 if (xa > 6) xa = 6;
2564 if (xa < 0) xa = 0;
2565 draw_sprite_h_flip(bmp, small4_bmp [BMP_SMALL4_BEYE_1 + xa], (x) - 4, (y) - 5);
2566 break;
2567 }
2568 break;
2569 /* case BULLET_BOMBLET:
2570 case BULLET_BOMB_SIDE:
2571 draw_sprite(bmp, small2_bmp [BMP_SMALL2_SIDE_BOMB], (x) - 3, (y) - 3);
2572 break;
2573 case BULLET_FROZEN_TOOTH:
2574 // circlefill(bmp, x, y, 1, COLOUR_WHITE);
2575 break; */
2576 /* case BULLET_MISSILE:
2577 switch((bullet[dr].angle % ANGLE_FULL) / ANGLE_QUARTER)
2578 {
2579 case 0:
2580 xa = (bullet[dr].angle % ANGLE_FULL) / 42;
2581 if (xa > 6) xa = 6;
2582 if (xa < 0) xa = 0;
2583 draw_sprite(bmp, small2_bmp [BMP_SMALL2_MISSILE_7 - xa], (x) - 3, (y) - 3);
2584 break;
2585 case 1:
2586 xa = (bullet[dr].angle - ANGLE_QUARTER) / 42;
2587 if (xa > 6) xa = 6;
2588 if (xa < 0) xa = 0;
2589 draw_sprite_v_flip(bmp, small2_bmp [BMP_SMALL2_MISSILE_1 + xa], (x) - 3, (y) - 3);
2590 break;
2591 case 2:
2592 xa = (bullet[dr].angle - ANGLE_HALF) / 42;
2593 if (xa > 6) xa = 6;
2594 if (xa < 0) xa = 0;
2595 draw_sprite_vh_flip(bmp, small2_bmp [BMP_SMALL2_MISSILE_7 - xa], (x) - 3, (y) - 3);
2596 break;
2597 case 3:
2598 xa = (bullet[dr].angle - ANGLE_HALF - ANGLE_QUARTER) / 42;
2599 if (xa > 6) xa = 6;
2600 if (xa < 0) xa = 0;
2601 draw_sprite_h_flip(bmp, small2_bmp [BMP_SMALL2_MISSILE_1 + xa], (x) - 3, (y) - 3);
2602 break;
2603
2604 }
2605 // circlefill(bmp, (x), y, 2, COLOUR_GREY6);
2606 break;
2607 case BULLET_PREMINE:
2608 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_PREMINE], (x) - 3, (y) - 3);
2609 break;
2610 case BULLET_MINE:
2611 // if (dr % 2 == 0) // as it's purely for display, this horrible thing is okay
2612 // draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_MINE1 + (bullet[dr].timeout / 16) % 3], (x) - 5, (y) - 5);
2613 // else
2614 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_MINE3 - (bullet[dr].timeout / (16)) % 3], (x) - 3, (y) - 3);
2615 break;
2616 case BULLET_PRESEEKMINE:
2617 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_PRESEEKMINE], (x) - 3, (y) - 3);
2618 break;
2619 case BULLET_SEEKMINE:
2620 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_SEEKMINE3 - (bullet[dr].timeout / (12)) % 3], (x) - 3, (y) - 3);
2621 break;
2622 case BULLET_MISSILE_MINI:
2623 circlefill(bmp, (x), y, 1, COLOUR_GREY5);
2624 break;
2625 case BULLET_NICE_ORBITAL:
2626 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2627 circlefill(bmp, x, y, bullet[dr].special1 / 2 + 1, bullet[dr].colours [0]);
2628 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2629 draw_a_light(bmp, 2 + grand(3) + bullet[dr].special1, x, y);
2630 break;*/
2631 case BULLET_TOXIC_SUN:
2632 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2633 circlefill(bmp, x, y, 5 + grand(3), TRANS_YELLOW); //bullet[dr].colours [0]);
2634 circlefill(bmp, x, y, 6 + grand(3), TRANS_LGREEN); //bullet[dr].colours [1]);
2635 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2636 draw_a_light(bmp, 21 + grand(5), x, y);
2637 break;
2638 case BULLET_TOXIC_FLARE:
2639 // drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2640 // circlefill(bmp, x, y, 2 + grand(2), //bullet[dr].colours [0]);
2641 // circlefill(bmp, x, y, 3 + grand(2), //bullet[dr].colours [1]);
2642 // drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2643 draw_a_light(bmp, 7 + grand(4), x, y);
2644 break;
2645 // case BULLET_PETAL1:
2646 //case BULLET_PETAL2:
2647 // draw_a_light(bmp, 11 + grand(4), x, y);
2648 break;
2649 case BULLET_BLAST:
2650 case BULLET_BOLT:
2651 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2652 circlefill(bmp, x, y, 3 + grand(2), bullet[dr].colours [0]);
2653 circlefill(bmp, x, y, 4 + grand(2), bullet[dr].colours [1]);
2654 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2655 draw_a_light(bmp, 8 + grand(4), x, y);
2656 break;
2657 case BULLET_NOVA:
2658 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2659 if (bullet[dr].timeout > 140)
2660 {
2661 xa = bullet[dr].timeout - 139;
2662 if (xa > 15)
2663 xa = 14;
2664 circlefill(bmp, x, y, xa + grand(4), TRANS_WHITE);
2665 }
2666 if (bullet[dr].timeout > 100)
2667 {
2668 xa = bullet[dr].timeout - 99;
2669 if (xa > 18)
2670 xa = 18;
2671 circlefill(bmp, x, y, xa + grand(4), TRANS_YELLOW);
2672 }
2673 if (bullet[dr].timeout > 50 && bullet[dr].timeout < 140)
2674 {
2675 xa = bullet[dr].timeout - 49;
2676 if (xa > 20)
2677 xa = 20;
2678 circlefill(bmp, x, y, xa + grand(4), TRANS_ORANGE);
2679 }
2680 if (bullet[dr].timeout > 20 && bullet[dr].timeout < 70)
2681 {
2682 xa = bullet[dr].timeout - 20;
2683 if (xa > 20)
2684 xa = 20;
2685 circlefill(bmp, x, y, xa + grand(4), TRANS_LRED);
2686 }
2687 if (bullet[dr].timeout < 40)
2688 {
2689 xa = xpart(bullet[dr].timeout * 11 - ANGLE_QUARTER, 50);
2690 // if (xa > 20)
2691 // xa = 20;
2692 circlefill(bmp, x, y, xa + grand(4), TRANS_DRED);
2693 }
2694 // circlefill(bmp, x, y, bullet[dr].special1 + grand(3), bullet[dr].colours [0]);
2695 // circlefill(bmp, x, y, bullet[dr].special2 + grand(3), bullet[dr].colours [1]);
2696 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2697 draw_a_light(bmp, bullet[dr].special1 + 6 + grand(4), x, y);
2698 break;
2699 case BULLET_HOLE:
2700 xa = x + grand(3) - grand(3);
2701 ya = y + grand(3) - grand(3);
2702 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2703 circlefill(bmp, xa, ya, 4 + grand(4), TRANS_YELLOW);
2704 circlefill(bmp, xa, ya, 4 + grand(4), TRANS_LRED);
2705 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2706 circlefill(bmp, xa, ya, 5 + grand(4), GC_BLACK);
2707 draw_a_light(bmp, 8 + grand(4), xa, ya);
2708 break;
2709 case BULLET_BIGBALL1:
2710 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2711 circlefill(bmp, x, y, bullet[dr].special1 + grand(3), bullet[dr].colours [0]);
2712 circlefill(bmp, x, y, bullet[dr].special2 + grand(3), bullet[dr].colours [1]);
2713 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2714 draw_a_light(bmp, bullet[dr].special1 + 6 + grand(4), x, y);
2715 break;
2716 case BULLET_SWIRL1:
2717 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2718 circlefill(bmp, x, y, 4 + grand(3), bullet[dr].colours [0]);
2719 circlefill(bmp, x, y, 5 + grand(3), bullet[dr].colours [1]);
2720 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2721 draw_a_light(bmp, 11 + grand(4), x, y);
2722 break;
2723 case BULLET_BFLAK2:
2724 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2725 circlefill(bmp, x, y, 2 + grand(3), TRANS_WHITE);
2726 circlefill(bmp, x, y, 3 + grand(3), TRANS_YELLOW);
2727 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2728 draw_a_light(bmp, 6 + grand(4), x, y);
2729 break;
2730 case BULLET_SPORE:
2731 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2732 circlefill(bmp, x, y, 3 + pulsate(64, 2, bullet[dr].timeout), TRANS_YELLOW);
2733 circlefill(bmp, x, y, 4 - pulsate(64, 2, bullet[dr].timeout), TRANS_ORANGE);
2734 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2735 draw_a_light(bmp, 8 + pulsate(64, 2, bullet[dr].timeout), x, y);
2736 break;
2737 case BULLET_FLOWER:
2738 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2739 circlefill(bmp, x, y, 3 + pulsate(64, 2, bullet[dr].timeout), TRANS_LGREEN);
2740 circlefill(bmp, x, y, 4 - pulsate(64, 2, bullet[dr].timeout), TRANS_DGREEN);
2741 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2742 draw_a_light(bmp, 8 + pulsate(64, 2, bullet[dr].timeout), x, y);
2743 break;
2744 case BULLET_FLOWER2:
2745 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
2746 circlefill(bmp, x, y, 3 + pulsate(64, 2, bullet[dr].timeout), TRANS_LRED);
2747 circlefill(bmp, x, y, 4 - pulsate(64, 2, bullet[dr].timeout), TRANS_ORANGE);
2748 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
2749 draw_a_light(bmp, 8 + pulsate(64, 2, bullet[dr].timeout), x, y);
2750 break;
2751 case BULLET_BLUE_BLOB:
2752 circlefill(bmp, (x), y, 3, COLOUR_BLUE8);
2753 break;
2754 // circlefill(bmp, (x), y, 5, bullet[dr].colours [0]);
2755 case BULLET_FLAK:
2756 case BULLET_RED_BLOB:
2757 if ((counter / 3) % 4 == 1)
2758 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_RED_BLOB_S], (x) - 5, (y) - 5);
2759 if ((counter / 3) % 2 == 0)
2760 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_RED_BLOB_M], (x) - 5, (y) - 5);
2761 if ((counter / 3) % 4 == 3)
2762 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_RED_BLOB_L], (x) - 5, (y) - 5);
2763 break;
2764 case BULLET_YELLOW_BLOB:
2765 case BULLET_TORPEDO:
2766 // circlefill(bmp, (x), y, 3, COLOUR_YELLOW8);
2767 if ((counter / 3) % 4 == 1)
2768 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_YELLOW_BLOB_S], (x) - 5, (y) - 5);
2769 if ((counter / 3) % 2 == 0)
2770 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_YELLOW_BLOB_M], (x) - 5, (y) - 5);
2771 if ((counter / 3) % 4 == 3)
2772 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_YELLOW_BLOB_L], (x) - 5, (y) - 5);
2773 break;
2774 // case BULLET_ORBIT:
2775 // circle(bmp, x,y,7, COLOUR_WHITE);
2776 // break;
2777 case BULLET_CURVE:
2778 case BULLET_PURPLE_BLOB:
2779 if ((counter / 3) % 4 == 1)
2780 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_PURPLE_BLOB_S], (x) - 5, (y) - 5);
2781 if ((counter / 3) % 2 == 0)
2782 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_PURPLE_BLOB_M], (x) - 5, (y) - 5);
2783 if ((counter / 3) % 4 == 3)
2784 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_PURPLE_BLOB_L], (x) - 5, (y) - 5);
2785 break;
2786 case BULLET_ORANGE_BLOB:
2787 if ((counter / 3) % 4 == 1)
2788 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_ORANGE_BLOB_S], (x) - 5, (y) - 5);
2789 if ((counter / 3) % 2 == 0)
2790 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_ORANGE_BLOB_M], (x) - 5, (y) - 5);
2791 if ((counter / 3) % 4 == 3)
2792 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_ORANGE_BLOB_L], (x) - 5, (y) - 5);
2793 break;
2794 case BULLET_SEEKER_BLOB3:
2795 case BULLET_SEEKER_BLOB:
2796 if ((counter / 3) % 4 == 1)
2797 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_BLUE_BLOB_S], (x) - 5, (y) - 5);
2798 if ((counter / 3) % 2 == 0)
2799 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_BLUE_BLOB_M], (x) - 5, (y) - 5);
2800 if ((counter / 3) % 4 == 3)
2801 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_BLUE_BLOB_L], (x) - 5, (y) - 5);
2802 break;
2803 case BULLET_SEEKER_BLOB2:
2804 if ((counter / 3) % 4 == 1)
2805 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_GREEN_BLOB_S], (x) - 5, (y) - 5);
2806 if ((counter / 3) % 2 == 0)
2807 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_GREEN_BLOB_M], (x) - 5, (y) - 5);
2808 if ((counter / 3) % 4 == 3)
2809 draw_rle_sprite(bmp, small1_rle [RLE_SMALL1_GREEN_BLOB_L], (x) - 5, (y) - 5);
2810 break;
2811 case BULLET_PRONG:
2812 cs = bullet[dr].angle;
2813 if (bullet[dr].special1 == 1)
2814 cs = ANGLE_FULL - bullet[dr].angle;
2815 xa = x + xpart(cs, 2);
2816 ya = y + ypart(cs, 2);
2817 xb = x - xpart(cs, 2);
2818 yb = y - ypart(cs, 2);
2819 pline(bmp, xa, ya, xb, yb, bullet[dr].colours [0]);
2820 break;
2821 case BULLET_CRYSTAL1:
2822 case BULLET_CRYSTAL2:
2823 clear_bitmap(crystal_bmp);
2824 // circlefill(crystal_bmp, 10 + grand(2) - grand(2), 10 + grand(2) - grand(2), 9 + grand(2) - grand(2), TRANS_LRED);
2825 // circlefill(crystal_bmp, 10, 10, 7 + grand(2) - grand(2), bullet[dr].colours [0 + grand(4)]);
2826 circlefill(crystal_bmp, 10, 10, 7 + grand(2) - grand(2), bullet[dr].colours [0 + abs(xpart(bullet[dr].timeout * 22, 4))]);
2827 circlefill(crystal_bmp, 10 + grand(2) - grand(2), 10 + grand(2) - grand(2), 3 + grand(2) - grand(2), 0);
2828 draw_trans_sprite(bmp, crystal_bmp, x - 10 + grand(2) - grand(2), y - 10 + grand(2) - grand(2));
2829 break;
2830 }
2831
2832
2833 }
2834
2835 /*
2836 void draw_sidekicks(BITMAP *bmp, int max_x, int max_y, int play, int a)
2837 {
2838 // NOTE: not xpart/ypart optimised at all
2839
2840 int i, x, y, x1, x2,x3, y1, y2, y3;
2841 float radangle;
2842
2843 for (i = 0; i < actor[a].sidekicks; i ++)
2844 {
2845 if (actor[a].sidekick_x [i] + 2000 < actor[player[play].actor_controlled].x - (max_x / 2) * GRAIN
2846 || actor[a].sidekick_x [i] - 2000 > actor[player[play].actor_controlled].x + (max_x / 2) * GRAIN
2847 || actor[a].sidekick_y [i] + 2000 < actor[player[play].actor_controlled].y - (max_y / 2) * GRAIN
2848 || actor[a].sidekick_y [i] - 2000 > actor[player[play].actor_controlled].y + (max_y / 2) * GRAIN)
2849 continue;
2850
2851 x = ((actor[a].sidekick_x [i] / GRAIN) - (actor[player[play].actor_controlled].x / GRAIN)) + max_x / 2;
2852 y = ((actor[a].sidekick_y [i] / GRAIN) - (actor[player[play].actor_controlled].y / GRAIN)) + max_y / 2;
2853
2854 // circle(bmp, x + max_x / 2, y + max_y / 2, 3, COLOUR_GREEN7);
2855 radangle = angle_to_radians(actor[a].sidekick_angle [i]);
2856 x1 = (x) + ((float) cos(radangle + PI) * 3);
2857 y1 = (y) + ((float) sin(radangle + PI) * 3);
2858 x2 = (x) + ((float) cos(radangle + PI + (PI * 2) / 3) * 4);
2859 y2 = (y) + ((float) sin(radangle + PI + (PI * 2) / 3) * 4);
2860 x3 = (x) + ((float) cos(radangle + PI - (PI * 2) / 3) * 4);
2861 y3 = (y) + ((float) sin(radangle + PI - (PI * 2) / 3) * 4);
2862 triangle(bmp, x1, y1, x2, y2, x3, y3, COLOUR_GREY5);
2863 line(bmp, x1, y1, x2, y2, COLOUR_GREY4);
2864 line(bmp, x1, y1, x3, y3, COLOUR_GREY4);
2865 line(bmp, x2, y2, x3, y3, COLOUR_GREY4);
2866
2867 }
2868
2869
2870 }
2871 */
2872
2873 void draw_enemies(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
2874 {
2875
2876 int e, et;
2877
2878 // we need to do this a few times so the bigger enemies are always drawn at the back.
2879 // also, draw_an_enemy_inter2 makes sure turrets are drawn along with their owner.
2880 for (e = 0; e < NO_ENEMIES; e ++)
2881 {
2882 et = enemy[e].type;
2883 if (et == ENEMY_NONE)
2884 continue;
2885 if (eclass[et].role == ROLE_BOSS)
2886 draw_an_enemy_inter(bmp, e, max_x, max_y, play, centre_x, centre_y);
2887 }
2888
2889 for (e = 0; e < NO_ENEMIES; e ++)
2890 {
2891 et = enemy[e].type;
2892 if (et == ENEMY_NONE)
2893 continue;
2894 if (eclass[et].role == ROLE_MINIBOSS)
2895 draw_an_enemy_inter(bmp, e, max_x, max_y, play, centre_x, centre_y);
2896 }
2897
2898 for (e = 0; e < NO_ENEMIES; e ++)
2899 {
2900 et = enemy[e].type;
2901 if (et == ENEMY_NONE)
2902 continue;
2903 if (eclass[et].role != ROLE_TURRET
2904 && eclass[et].role != ROLE_BOSS
2905 && eclass[et].role != ROLE_MINIBOSS)
2906 draw_an_enemy_inter(bmp, e, max_x, max_y, play, centre_x, centre_y);
2907 }
2908
2909 }
2910
2911
2912 void draw_an_enemy_inter(BITMAP *bmp, int e, int max_x, int max_y, int play, int centre_x, int centre_y)
2913 {
2914
2915 int i;
2916
2917 draw_an_enemy_inter2(bmp, e, max_x, max_y, play, centre_x, centre_y);
2918
2919 if (eclass[enemy[e].type].turrets > 0)
2920 {
2921 for (i = 0; i < MAX_TURRETS; i ++)
2922 {
2923 if (enemy[e].turret [i] != -1)
2924 draw_an_enemy_inter2(bmp, enemy[e].turret [i], max_x, max_y, play, centre_x, centre_y);
2925 }
2926 }
2927
2928 }
2929
2930 void draw_an_enemy_inter2(BITMAP *bmp, int e, int max_x, int max_y, int play, int centre_x, int centre_y)
2931 {
2932
2933 if (enemy[e].x + enemy[e].edge_radius + 9000 < centre_x - (max_x / 2) * GRAIN
2934 || enemy[e].x - enemy[e].edge_radius - 9000 > centre_x + (max_x / 2) * GRAIN
2935 || enemy[e].y + enemy[e].edge_radius + 9000 < centre_y - (max_y / 2) * GRAIN
2936 || enemy[e].y - enemy[e].edge_radius - 9000 > centre_y + (max_y / 2) * GRAIN)
2937 return;
2938
2939
2940 int x = ((enemy[e].x / GRAIN) - (centre_x / GRAIN));// / GRAIN;
2941 int y = ((enemy[e].y / GRAIN) - (centre_y / GRAIN));// / GRAIN;
2942
2943 draw_an_enemy(bmp, e, x + max_x / 2, y + max_y / 2);
2944
2945 }
2946
2947 // assumes that distortion_mask bitmap set up
2948 // x,y is the centre of the mask, wx,wy is width, dx,dy is degree of distortion
2949 void distortion(BITMAP *bmp, int x, int y, int wx, int wy, int dx, int dy)
2950 {
2951
2952 int i, j;
2953
2954 int xp = 1, yp = 1;
2955
2956 if (dx < 0)
2957 {
2958 xp = -1;
2959 wx *= -1;
2960 }
2961 if (dy < 0)
2962 {
2963 yp = -1;
2964 wy *= -1;
2965 }
2966
2967 for (i = wx * -1; i != wx; i += xp)
2968 {
2969 for (j = wy * -1; j != wy; j += yp)
2970 {
2971 if (x + i + dx >= bmp->w
2972 || x + i + dx < 0
2973 || y + j + dy >= bmp->h
2974 || y + j + dy < 0)
2975 {
2976 putpixel(bmp, x + i, y + j, 0);
2977 continue;
2978 }
2979 if (getpixel(distortion_mask, 100 + i, 100 + j) != 0)
2980 putpixel(bmp, x + i, y + j, getpixel(bmp, x + i + dx, y + j + dy));
2981 }
2982 }
2983
2984 }
2985
2986 /*
2987
2988 void draw_lock(BITMAP *bmp, int dr, int x, int y, int rad)
2989 {
2990 // if (enemy[dr].type == ENEMY_NONE)
2991 // return;
2992 int lock_colour = COLOUR_YELLOW8 - (counter / 2) % 4;
2993
2994 int angle = (counter * 8) % 256;
2995 arc(bmp, x, y, itofix(angle), itofix(angle + 64), rad, lock_colour);
2996 arc(bmp, x, y, itofix(angle + 128), itofix(angle + 192), rad, lock_colour);
2997 int fangle = ANGLE_FULL - (( - counter) * 8) % ANGLE_FULL;
2998 int x1 = x + xpart(fangle, rad + 1);
2999 int x2 = x + xpart(fangle, rad + 7);
3000 int y1 = y + ypart(fangle, rad + 1);
3001 int y2 = y + ypart(fangle, rad + 7);
3002 pline(bmp, x1, y1, x2, y2, lock_colour);
3003 x1 = x + xpart(fangle + ANGLE_QUARTER, rad + 1);
3004 x2 = x + xpart(fangle + ANGLE_QUARTER, rad + 7);
3005 y1 = y + ypart(fangle + ANGLE_QUARTER, rad + 1);
3006 y2 = y + ypart(fangle + ANGLE_QUARTER, rad + 7);
3007 pline(bmp, x1, y1, x2, y2, lock_colour);
3008 x1 = x + xpart(fangle + ANGLE_HALF, rad + 1);
3009 x2 = x + xpart(fangle + ANGLE_HALF, rad + 7);
3010 y1 = y + ypart(fangle + ANGLE_HALF, rad + 1);
3011 y2 = y + ypart(fangle + ANGLE_HALF, rad + 7);
3012 pline(bmp, x1, y1, x2, y2, lock_colour);
3013 x1 = x + xpart(fangle - ANGLE_QUARTER, rad + 1);
3014 x2 = x + xpart(fangle - ANGLE_QUARTER, rad + 7);
3015 y1 = y + ypart(fangle - ANGLE_QUARTER, rad + 1);
3016 y2 = y + ypart(fangle - ANGLE_QUARTER, rad + 7);
3017 pline(bmp, x1, y1, x2, y2, lock_colour);
3018 x1 = x + xpart(fangle + ANGLE_1_EIGHTH, rad + 1);
3019 x2 = x + xpart(fangle + ANGLE_1_EIGHTH, rad + 7);
3020 y1 = y + ypart(fangle + ANGLE_1_EIGHTH, rad + 1);
3021 y2 = y + ypart(fangle + ANGLE_1_EIGHTH, rad + 7);
3022 pline(bmp, x1, y1, x2, y2, lock_colour);
3023 x1 = x + xpart(fangle - ANGLE_1_EIGHTH, rad + 1);
3024 x2 = x + xpart(fangle - ANGLE_1_EIGHTH, rad + 7);
3025 y1 = y + ypart(fangle - ANGLE_1_EIGHTH, rad + 1);
3026 y2 = y + ypart(fangle - ANGLE_1_EIGHTH, rad + 7);
3027 pline(bmp, x1, y1, x2, y2, lock_colour);
3028 x1 = x + xpart(fangle + ANGLE_3_EIGHTHS, rad + 1);
3029 x2 = x + xpart(fangle + ANGLE_3_EIGHTHS, rad + 7);
3030 y1 = y + ypart(fangle + ANGLE_3_EIGHTHS, rad + 1);
3031 y2 = y + ypart(fangle + ANGLE_3_EIGHTHS, rad + 7);
3032 pline(bmp, x1, y1, x2, y2, lock_colour);
3033 x1 = x + xpart(fangle - ANGLE_3_EIGHTHS, rad + 1);
3034 x2 = x + xpart(fangle - ANGLE_3_EIGHTHS, rad + 7);
3035 y1 = y + ypart(fangle - ANGLE_3_EIGHTHS, rad + 1);
3036 y2 = y + ypart(fangle - ANGLE_3_EIGHTHS, rad + 7);
3037 pline(bmp, x1, y1, x2, y2, lock_colour);
3038 }
3039
3040
3041 void draw_turret_lock(BITMAP *bmp, int dr, int x, int y, int rad)
3042 {
3043 // float fangle = angle_to_radians(ANGLE_FULL - (( - counter) * 8) % ANGLE_FULL);
3044 int col = COLOUR_YELLOW8 - (counter / 2) % 4;
3045 float fangle = angle_to_radians((counter * 6) % ANGLE_FULL);
3046 int x1 = x + cos(fangle + PI / 8) * (rad + 1);
3047 int y1 = y + sin(fangle + PI / 8) * (rad + 1);
3048 int x2 = x + cos(fangle - PI / 8) * (rad + 1);
3049 int y2 = y + sin(fangle - PI / 8) * (rad + 1);
3050 pline(bmp, x1, y1, x2, y2, col);
3051 x1 = x + cos(fangle + PI / 2 + PI / 8) * (rad + 1);
3052 y1 = y + sin(fangle + PI / 2 + PI / 8) * (rad + 1);
3053 x2 = x + cos(fangle + PI / 2 - PI / 8) * (rad + 1);
3054 y2 = y + sin(fangle + PI / 2 - PI / 8) * (rad + 1);
3055 pline(bmp, x1, y1, x2, y2, col);
3056 x1 = x + cos(fangle + PI + PI / 8) * (rad + 1);
3057 y1 = y + sin(fangle + PI + PI / 8) * (rad + 1);
3058 x2 = x + cos(fangle + PI - PI / 8) * (rad + 1);
3059 y2 = y + sin(fangle + PI - PI / 8) * (rad + 1);
3060 pline(bmp, x1, y1, x2, y2, col);
3061 x1 = x + cos(fangle - PI / 2 + PI / 8) * (rad + 1);
3062 y1 = y + sin(fangle - PI / 2 + PI / 8) * (rad + 1);
3063 x2 = x + cos(fangle - PI / 2 - PI / 8) * (rad + 1);
3064 y2 = y + sin(fangle - PI / 2 - PI / 8) * (rad + 1);
3065 pline(bmp, x1, y1, x2, y2, col);
3066
3067 }
3068
3069 */
3070
3071 void draw_an_enemy(BITMAP *bmp, int dr, int x, int y)
3072 {
3073 // x += 500;
3074 // y += 500;
3075
3076 int xa;//, ya;
3077 int col1, col2, col3, col4;
3078
3079 int x1,y1,x2,y2,x3,y3;
3080
3081 // float radangle;
3082
3083 col1 = enemy[dr].colours [0];
3084 col2 = enemy[dr].colours [1];
3085 if (enemy[dr].hurt_pulse > 0)
3086 {
3087 // col1 = enemy[dr].hurt_pulse_colour2 + enemy[dr].hurt_pulse;
3088 // col2 = enemy[dr].hurt_pulse_colour1 + enemy[dr].hurt_pulse / 2;
3089 switch(enemy[dr].hurt_pulse / 2)
3090 {
3091 default:
3092 case 3:
3093 col1 = COLOUR_WHITE;
3094 col2 = COLOUR_WHITE;
3095 break;
3096 case 2:
3097 col1 += 2;
3098 col2 += 2;
3099 break;
3100 case 1:
3101 case 0:
3102 col1 += 1;
3103 col2 += 1;
3104 break;
3105 }
3106 }
3107 /*#ifdef DEBUG_ENEMY_SIZE
3108 int store_x = x;
3109 int store_y = y;
3110 #endif*/
3111
3112 #ifdef DEBUG_DISPLAY
3113 int store_x = x;
3114 int store_y = y;
3115 #endif
3116
3117
3118 switch(enemy[dr].type)
3119 {
3120 default:
3121 textprintf_ex(bmp, font, x,y, COLOUR_WHITE, -1, "ERROR: %i %i", dr, enemy[dr].type);
3122 break;
3123 case ENEMY_GUARDIAN1:
3124 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_GUARDIAN1], (x) - 29, (y) - 24);
3125 circlefill(bmp, (x), y, 19, col1);
3126 circle(bmp, (x), y, 19, col2);
3127 x = x + xpart(enemy[dr].angle, 12);
3128 y = y + ypart(enemy[dr].angle, 12);
3129 // col1 = GC_GREEN6;
3130 circlefill(bmp, (x), y, 3, col1);
3131 circle(bmp, (x), y, 3, col2);
3132 break;
3133 case ENEMY_GUARDIAN2:
3134 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_GUARDIAN2], (x) - 25, (y) - 34);
3135 circlefill(bmp, (x), y, 19, col1);
3136 circle(bmp, (x), y, 19, col2);
3137 x = x + xpart(enemy[dr].angle, 12);
3138 y = y + ypart(enemy[dr].angle, 12);
3139 circlefill(bmp, (x), y, 3, col1);
3140 circle(bmp, (x), y, 3, col2);
3141 // textprintf_ex(bmp, small_font, x,y, COLOUR_WHITE, -1, "%i %i", enemy[dr].angle, xpart(enemy[dr].angle, 12));
3142 break;
3143 case ENEMY_GUARDIAN3:
3144 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_GUARDIAN3], (x) - 29, (y) - 24);
3145 circlefill(bmp, (x), y, 19, col1);
3146 circle(bmp, (x), y, 19, col2);
3147 x = x + xpart(enemy[dr].angle, 12);
3148 y = y + ypart(enemy[dr].angle, 12);
3149 circlefill(bmp, (x), y, 3, col1);
3150 circle(bmp, (x), y, 3, col2);
3151 // textprintf_ex(bmp, small_font, x,y, COLOUR_WHITE, -1, "%i %i", enemy[dr].angle, xpart(enemy[dr].angle, 12));
3152 break;
3153 case ENEMY_GUARDIAN4:
3154 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_GUARDIAN4], (x) - 34, (y) - 32);
3155 circlefill(bmp, (x), y, 19, col1);
3156 circle(bmp, (x), y, 19, col2);
3157 x = x + xpart(enemy[dr].angle, 12);
3158 y = y + ypart(enemy[dr].angle, 12);
3159 circlefill(bmp, (x), y, 3, col1);
3160 circle(bmp, (x), y, 3, col2);
3161 // textprintf_ex(bmp, small_font, x,y, COLOUR_WHITE, -1, "%i %i", enemy[dr].angle, xpart(enemy[dr].angle, 12));
3162 break;
3163 case ENEMY_GUARDIAN5:
3164 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_GUARDIAN5], (x) - 34, (y) - 29);
3165 circlefill(bmp, (x), y, 19, col1);
3166 circle(bmp, (x), y, 19, col2);
3167 x = x + xpart(enemy[dr].angle, 12);
3168 y = y + ypart(enemy[dr].angle, 12);
3169 circlefill(bmp, (x), y, 3, col1);
3170 circle(bmp, (x), y, 3, col2);
3171 // textprintf_ex(bmp, small_font, x,y, COLOUR_WHITE, -1, "%i %i", enemy[dr].angle, xpart(enemy[dr].angle, 12));
3172 break;
3173 case ENEMY_MULTI1:
3174 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_MULTI1], (x) - 34, (y) - 34);
3175 circlefill(bmp, (x), y, 15, col1);
3176 circle(bmp, (x), y, 15, col2);
3177 x1 = x + xpart(enemy[dr].angle, 8);
3178 y1 = y + ypart(enemy[dr].angle, 8);
3179 circlefill(bmp, x1, y1, 5, col1);
3180 circle(bmp, x1, y1, 5, col2);
3181 /* x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH, 10);
3182 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH, 10);
3183 circlefill(bmp, x1, y1, 2, col1);
3184 circle(bmp, x1, y1, 2, col2);
3185 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH, 10);
3186 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH, 10);
3187 circlefill(bmp, x1, y1, 2, col1);
3188 circle(bmp, x1, y1, 2, col2);*/
3189 break;
3190 case ENEMY_MULTI2:
3191 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_MULTI2], (x) - 33, (y) - 33);
3192 circlefill(bmp, (x), y, 13, col1);
3193 circle(bmp, (x), y, 13, col2);
3194 x1 = x + xpart(enemy[dr].angle, 8);
3195 y1 = y + ypart(enemy[dr].angle, 8);
3196 circlefill(bmp, x1, y1, 4, col1);
3197 circle(bmp, x1, y1, 4, col2);
3198 break;
3199 case ENEMY_MULTI3:
3200 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_MULTI3], (x) - 32, (y) - 32);
3201 circlefill(bmp, (x), y, 13, col1);
3202 circle(bmp, (x), y, 13, col2);
3203 x1 = x + xpart(enemy[dr].angle, 10);
3204 y1 = y + ypart(enemy[dr].angle, 10);
3205 circlefill(bmp, x1, y1, 4, col1);
3206 circle(bmp, x1, y1, 4, col2);
3207 break;
3208 case ENEMY_PULSER1:
3209 x1 = (enemy[dr].attribute [0] / 4) % 8;
3210 if (x1 >= 4)
3211 x1 = 8 - x1;
3212 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER1_V], (x) - 11, (y) - 35 - x1);
3213 draw_sprite_v_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER1_V], (x) - 11, (y) + 8 + x1);
3214 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER1_H], (x) + 8 + x1, (y) - 11);
3215 draw_sprite_h_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER1_H], (x) - 35 - x1, (y) - 11);
3216 circlefill(bmp, (x), y, 17, col1);
3217 circle(bmp, (x), y, 17, col2);
3218 // x = x + xpart(enemy[dr].angle, 12);
3219 // y = y + ypart(enemy[dr].angle, 12);
3220 // col1 = GC_GREEN6;
3221 // circlefill(bmp, (x), y, 3, col1);
3222 // circle(bmp, (x), y, 3, col2);
3223 break;
3224 case ENEMY_PULSER2:
3225 x1 = (enemy[dr].attribute [0] / 4) % 8;
3226 if (x1 >= 4)
3227 x1 = 8 - x1;
3228 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER2_V], (x) - 12, (y) - 35 - x1);
3229 draw_sprite_v_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER2_V], (x) - 12, (y) + 8 + x1);
3230 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER2_H], (x) + 8 + x1, (y) - 12);
3231 draw_sprite_h_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER2_H], (x) - 35 - x1, (y) - 12);
3232 circlefill(bmp, (x), y, 17, col1);
3233 circle(bmp, (x), y, 17, col2);
3234 // x = x + xpart(enemy[dr].angle, 12);
3235 // y = y + ypart(enemy[dr].angle, 12);
3236 // col1 = GC_GREEN6;
3237 // circlefill(bmp, (x), y, 3, col1);
3238 // circle(bmp, (x), y, 3, col2);
3239 break;
3240 case ENEMY_FORKER1:
3241 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_FORKER1], (x) - 26, (y) - 26);
3242 circlefill(bmp, (x), y, 13, col1);
3243 circle(bmp, (x), y, 13, col2);
3244 x1 = x + xpart(enemy[dr].angle, 7);
3245 y1 = y + ypart(enemy[dr].angle, 7);
3246 x2 = x + xpart(enemy[dr].angle, 12);
3247 y2 = y + ypart(enemy[dr].angle, 12);
3248 // col1 = GC_GREEN6;
3249 pline(bmp, x1, y1, x2, y2, col2);
3250 circlefill(bmp, x1, y1, 3, col1);
3251 circle(bmp, x1, y1, 3, col2);
3252 break;
3253 case ENEMY_FORKER2:
3254 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_FORKER2], (x) - 26, (y) - 26);
3255 circlefill(bmp, (x), y, 13, col1);
3256 circle(bmp, (x), y, 13, col2);
3257 x1 = x + xpart(enemy[dr].angle, 7);
3258 y1 = y + ypart(enemy[dr].angle, 7);
3259 x2 = x + xpart(enemy[dr].angle, 12);
3260 y2 = y + ypart(enemy[dr].angle, 12);
3261 // col1 = GC_GREEN6;
3262 pline(bmp, x1, y1, x2, y2, col2);
3263 circlefill(bmp, x1, y1, 3, col1);
3264 circle(bmp, x1, y1, 3, col2);
3265 break;
3266 case ENEMY_MINER1:
3267 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_MINER1], (x) - 19, (y) - 18);
3268 circlefill(bmp, (x), y, 14, col1);
3269 circle(bmp, (x), y, 14, col2);
3270 break;
3271 case ENEMY_MINER2:
3272 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_MINER2], (x) - 24, (y) - 24);
3273 circlefill(bmp, (x), y, 14, col1);
3274 circle(bmp, (x), y, 14, col2);
3275 break;
3276 case ENEMY_MINER3:
3277 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_MINER3], (x) - 24, (y) - 42);
3278 circlefill(bmp, (x), y, 14, col1);
3279 circle(bmp, (x), y, 14, col2);
3280 break;
3281 case ENEMY_MINER3_TURRET:
3282 circlefill(bmp, (x), y, 7, col1);
3283 circle(bmp, (x), y, 7, col2);
3284 xa = 7;
3285 if (enemy[dr].attribute [0] > 0)
3286 xa = 7 - enemy[dr].attribute [0];
3287 if (enemy[dr].attribute [0] >= 6)
3288 xa = 6;
3289 x1 = x + xpart(enemy[dr].angle, xa);
3290 y1 = y + ypart(enemy[dr].angle, xa);
3291 circlefill(bmp, (x1), y1, 2, col1);
3292 circle(bmp, (x1), y1, 2, col2);
3293 break;
3294 case ENEMY_CIRCLER1:
3295 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_CIRCLER1], (x) - 34, (y) - 24);
3296 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
3297 x1 = ((enemy[dr].counter + 224) / 16) % 9 + 1;
3298 x1 *= 8;
3299 rectfill(bmp, x - 32, y - 9, x - 26, y + 7, x1);
3300 rectfill(bmp, x + 26, y - 9, x + 32, y + 7, x1);
3301 x1 = ((enemy[dr].counter + 240) / 16) % 9 + 1;
3302 x1 *= 8;
3303 rectfill(bmp, x - 24, y - 9, x - 18, y + 7, x1);
3304 rectfill(bmp, x + 18, y - 9, x + 24, y + 7, x1);
3305 x1 = ((enemy[dr].counter + 256) / 16) % 9 + 1;
3306 x1 *= 8;
3307 rectfill(bmp, x - 16, y - 9, x - 10, y + 7, x1);
3308 rectfill(bmp, x + 10, y - 9, x + 16, y + 7, x1);
3309 // 60, 15
3310 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
3311 circlefill(bmp, (x), y, 10, col1);
3312 circle(bmp, (x), y, 10, col2);
3313 if (enemy[dr].attribute [0] > 0)
3314 {
3315 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
3316 x1 = 50 - enemy[dr].attribute [0];
3317 if (x1 < 24)
3318 circle(bmp, x, y, x1 * 2, get_circler_colour(x1 / 6));
3319 if (x1 < 32 && x1 > 12)
3320 circle(bmp, x, y, (x1 - 12) * 2, get_circler_colour((x1 - 12) / 6));
3321 if (x1 < 48 && x1 > 24)
3322 circle(bmp, x, y, (x1 - 24) * 2, get_circler_colour((x1 - 24) / 6));
3323 /*
3324 x1 = 66 - enemy[dr].attribute [0];
3325 if (x1 < 32)
3326 circle(bmp, x, y, x1, get_circler_colour(x1 / 8));
3327 if (x1 < 48 && x1 > 16)
3328 circle(bmp, x, y, (x1 - 16), get_circler_colour((x1 - 16) / 8));
3329 if (x1 < 64 && x1 > 32)
3330 circle(bmp, x, y, (x1 - 32), get_circler_colour((x1 - 32) / 8));
3331 */
3332 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
3333 }
3334 break;
3335 case ENEMY_PUFFER1:
3336 draw_puffer(bmp, x, y, enemy[dr].attribute [2], 3, 16, enemy[dr].attribute [0] / 105 + 6, GC_GREEN5, GC_GREEN2);
3337
3338 /* xa = enemy[dr].attribute [0] / 105 + 6;
3339 x1 = x + xpart((enemy[dr].attribute [2] * 8) % 1024, 16);
3340 y1 = y + ypart((enemy[dr].attribute [2] * 8) % 1024, 16);
3341 circlefill(bmp, (x1), y1, xa, GC_GREEN5);
3342 circle(bmp, (x1), y1, xa, GC_GREEN2);
3343 x1 = x + xpart(((enemy[dr].attribute [2] + 85) * 8) % 1024, 16);
3344 y1 = y + ypart(((enemy[dr].attribute [2] + 85) * 8) % 1024, 16);
3345 circlefill(bmp, (x1), y1, xa, GC_GREEN5);
3346 circle(bmp, (x1), y1, xa, GC_GREEN2);
3347 x1 = x + xpart(((enemy[dr].attribute [2] - 85) * 8) % 1024, 16);
3348 y1 = y + ypart(((enemy[dr].attribute [2] - 85) * 8) % 1024, 16);
3349 circlefill(bmp, (x1), y1, xa, GC_GREEN5);
3350 circle(bmp, (x1), y1, xa, GC_GREEN2);*/
3351 circlefill(bmp, (x), y, 15, col1);
3352 circle(bmp, (x), y, 15, col2);
3353 x = x + xpart(enemy[dr].angle, 10);
3354 y = y + ypart(enemy[dr].angle, 10);
3355 circlefill(bmp, (x), y, 2, col1);
3356 circle(bmp, (x), y, 2, col2);
3357 break;
3358 case ENEMY_PUFFER2:
3359 draw_puffer(bmp, x, y, enemy[dr].attribute [2], 4, 18, enemy[dr].attribute [0] / 105 + 6, GC_RED5, GC_RED2);
3360 /* xa = enemy[dr].attribute [0] / 105 + 6;
3361 x1 = x + xpart((enemy[dr].attribute [2] * 8) % 1024, 18);
3362 y1 = y + ypart((enemy[dr].attribute [2] * 8) % 1024, 18);
3363 circlefill(bmp, (x1), y1, xa, GC_RED5);
3364 circle(bmp, (x1), y1, xa, GC_RED2);
3365 x1 = x + xpart(((enemy[dr].attribute [2] + 32) * 8) % 1024, 18);
3366 y1 = y + ypart(((enemy[dr].attribute [2] + 32) * 8) % 1024, 18);
3367 circlefill(bmp, (x1), y1, xa, GC_RED5);
3368 circle(bmp, (x1), y1, xa, GC_RED2);
3369 x1 = x + xpart(((enemy[dr].attribute [2] - 32) * 8) % 1024, 18);
3370 y1 = y + ypart(((enemy[dr].attribute [2] - 32) * 8) % 1024, 18);
3371 circlefill(bmp, (x1), y1, xa, GC_RED5);
3372 circle(bmp, (x1), y1, xa, GC_RED2);
3373 x1 = x + xpart(((enemy[dr].attribute [2] + 64) * 8) % 1024, 18);
3374 y1 = y + ypart(((enemy[dr].attribute [2] + 64) * 8) % 1024, 18);
3375 circlefill(bmp, (x1), y1, xa, GC_RED5);
3376 circle(bmp, (x1), y1, xa, GC_RED2);*/
3377 circlefill(bmp, (x), y, 18, col1);
3378 circle(bmp, (x), y, 18, col2);
3379 x = x + xpart(enemy[dr].angle, 13);
3380 y = y + ypart(enemy[dr].angle, 13);
3381 circlefill(bmp, (x), y, 2, col1);
3382 circle(bmp, (x), y, 2, col2);
3383 break;
3384 case ENEMY_PUFFER3:
3385 draw_puffer(bmp, x, y, enemy[dr].attribute [2], 3, 16, enemy[dr].attribute [0] / 105 + 6, GC_YELLOW5, GC_YELLOW2);
3386 circlefill(bmp, (x), y, 14, col1);
3387 circle(bmp, (x), y, 14, col2);
3388 x = x + xpart(enemy[dr].angle, 11);
3389 y = y + ypart(enemy[dr].angle, 11);
3390 circlefill(bmp, (x), y, 2, col1);
3391 circle(bmp, (x), y, 2, col2);
3392 break;
3393 case ENEMY_PUFFER4:
3394 draw_puffer(bmp, x, y, enemy[dr].attribute [2], 5, 23, enemy[dr].attribute [0] / 105 + 7, GC_GREEN5, GC_GREEN2);
3395 circlefill(bmp, (x), y, 21, col1);
3396 circle(bmp, (x), y, 21, col2);
3397 x = x + xpart(enemy[dr].angle, 16);
3398 y = y + ypart(enemy[dr].angle, 16);
3399 circlefill(bmp, (x), y, 2, col1);
3400 circle(bmp, (x), y, 2, col2);
3401 break;
3402
3403 case ENEMY_BLATTER1:
3404 draw_blatter(bmp, x, y, 5, 19, enemy[dr].attribute [0], 9, GC_GREEN2, GC_GREEN5);
3405 circlefill(bmp, (x), y, 16, col1);
3406 circle(bmp, (x), y, 16, col2);
3407 x = x + xpart(enemy[dr].angle, 12);
3408 y = y + ypart(enemy[dr].angle, 12);
3409 circlefill(bmp, (x), y, 2, col1);
3410 circle(bmp, (x), y, 2, col2);
3411 break;
3412 case ENEMY_BLATTER2:
3413 draw_blatter(bmp, x, y, 3, 16, enemy[dr].attribute [0], 12, GC_ORANGE2, GC_ORANGE5);
3414 circlefill(bmp, (x), y, 16, col1);
3415 circle(bmp, (x), y, 16, col2);
3416 x = x + xpart(enemy[dr].angle, 14);
3417 y = y + ypart(enemy[dr].angle, 14);
3418 circlefill(bmp, (x), y, 3, col1);
3419 circle(bmp, (x), y, 3, col2);
3420 break;
3421 case ENEMY_BLATTER3:
3422 draw_blatter(bmp, x, y, 4, 16, enemy[dr].attribute [0], 9, GC_YELLOW2, GC_YELLOW5);
3423 circlefill(bmp, x, y, 16, col1);
3424 circle(bmp, x, y, 16, col2);
3425 x1 = x + xpart(enemy[dr].angle, 14);
3426 y1 = y + ypart(enemy[dr].angle, 14);
3427 circlefill(bmp, x1, y1, 3, col1);
3428 circle(bmp, x1, y1, 3, col2);
3429 x1 = x + xpart(enemy[dr].angle - ANGLE_QUARTER, 14);
3430 y1 = y + ypart(enemy[dr].angle - ANGLE_QUARTER, 14);
3431 circlefill(bmp, x1, y1, 3, col1);
3432 circle(bmp, x1, y1, 3, col2);
3433 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH, 14);
3434 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH, 14);
3435 circlefill(bmp, x1, y1, 3, col1);
3436 circle(bmp, x1, y1, 3, col2);
3437 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH, 14);
3438 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH, 14);
3439 circlefill(bmp, x1, y1, 3, col1);
3440 circle(bmp, x1, y1, 3, col2);
3441 break;
3442 case ENEMY_BLATTER4:
3443 draw_blatter(bmp, x, y, 5, 19, enemy[dr].attribute [0], 9, GC_BLUE2, GC_BLUE6);
3444 circlefill(bmp, (x), y, 16, col1);
3445 circle(bmp, (x), y, 16, col2);
3446 // x1 = x + xpart(enemy[dr].angle, 12);
3447 // y1 = y + ypart(enemy[dr].angle, 12);
3448 // x2 = x + xpart(enemy[dr].angle, 16);
3449 // y2 = y + ypart(enemy[dr].angle, 16);
3450 // col1 = GC_GREEN6;
3451 // pline(bmp, x1, y1, x2, y2, col2);
3452 x1 = x + xpart(enemy[dr].angle, 11);
3453 y1 = y + ypart(enemy[dr].angle, 11);
3454 circlefill(bmp, x1, y1, 3, col1);
3455 circle(bmp, x1, y1, 3, col2);
3456 break;
3457 case ENEMY_BLATTER5:
3458 draw_blatter(bmp, x, y, 4, 12, enemy[dr].attribute [0], 9, GC_RED2, GC_RED5);
3459 circlefill(bmp, (x), y, 11, col1);
3460 circle(bmp, (x), y, 11, col2);
3461 x = x + xpart(enemy[dr].angle, 11);
3462 y = y + ypart(enemy[dr].angle, 11);
3463 circlefill(bmp, (x), y, 3, col1);
3464 circle(bmp, (x), y, 3, col2);
3465 break;
3466 case ENEMY_BLOATER1:
3467 // draw_blatter(bmp, x, y, 3, 15 + pulsate(16, 6, enemy[dr].counter), enemy[dr].attribute [0], 10 + pulsate(32, 5, enemy[dr].counter), GC_GREEN2, GC_GREEN5);
3468 draw_blatter(bmp, x, y, 3, 15 + pulsate(32, 6, enemy[dr].counter), enemy[dr].attribute [0], 10 + pulsate(16, 3, enemy[dr].counter), GC_GREEN2, GC_GREEN5);
3469 x1 = 17 - pulsate(32, 3, enemy[dr].counter);
3470 circlefill(bmp, (x), y, x1, col1);
3471 circle(bmp, (x), y, x1, col2);
3472 break;
3473 case ENEMY_BLOATER2:
3474 draw_blatter(bmp, x, y, 5, 15 + pulsate(32, 6, enemy[dr].counter), enemy[dr].attribute [0], 8 + pulsate(16, 3, enemy[dr].counter), GC_ORANGE2, GC_ORANGE5);
3475 x1 = 17 - pulsate(32, 3, enemy[dr].counter);
3476 circlefill(bmp, (x), y, x1, col1);
3477 circle(bmp, (x), y, x1, col2);
3478 break;
3479 case ENEMY_MINEFIELDER1:
3480 x1 = pulsate(32, 4, enemy[dr].counter);
3481 y1 = y - 5 - x1;
3482 y2 = y - 25 - x1;
3483 rectfill(bmp, x - 20, y1, x + 20, y2, GC_RED5);
3484 rect(bmp, x - 20, y1, x + 20, y2, GC_RED2);
3485 y1 = y + 5 + x1;
3486 y2 = y + 25 + x1;
3487 rectfill(bmp, x - 20, y1, x + 20, y2, GC_RED5);
3488 rect(bmp, x - 20, y1, x + 20, y2, GC_RED2);
3489 circlefill(bmp, (x), y, 15, col1);
3490 circle(bmp, (x), y, 15, col2);
3491 break;
3492 case ENEMY_SPINNER1:
3493 draw_spinner(bmp, x, y, enemy[dr].attribute [0], 32, 10, ANGLE_1_32, 1024 / 3, 3, GC_YELLOW2, GC_YELLOW6);
3494 circlefill(bmp, (x), y, 10, col1);
3495 circle(bmp, (x), y, 10, col2);
3496 break;
3497 case ENEMY_SPINNER2:
3498 draw_spinner(bmp, x, y, enemy[dr].attribute [0], 38, 10, ANGLE_1_SIXTEENTH, 1024 / 3, 3, GC_ORANGE2, GC_ORANGE7);
3499 circlefill(bmp, (x), y, 10, col1);
3500 circle(bmp, (x), y, 10, col2);
3501 break;
3502 case ENEMY_SPINNER3:
3503 draw_spinner(bmp, x, y, enemy[dr].attribute [0], 42, 10, ANGLE_1_SIXTEENTH, 1024 / 4, 4, GC_BLUE2, GC_BLUE8);
3504 circlefill(bmp, (x), y, 15, col1);
3505 circle(bmp, (x), y, 15, col2);
3506 break;
3507 case ENEMY_SPINNER4:
3508 draw_spinner(bmp, x, y, enemy[dr].attribute [0], 42, 10, ANGLE_1_32, 1024 / 3, 3, GC_YELLOW2, GC_YELLOW7);
3509 circlefill(bmp, (x), y, 10, col1);
3510 circle(bmp, (x), y, 10, col2);
3511 break;
3512 case ENEMY_SPINNER5:
3513 draw_spinner(bmp, x, y, enemy[dr].attribute [0], 45, 5, ANGLE_1_32, 1024 / 4, 4, GC_BLUE2, GC_BLUE8);
3514 circlefill(bmp, (x), y, 10, col1);
3515 circle(bmp, (x), y, 10, col2);
3516 break;
3517 case ENEMY_OVERSPINNER:
3518 draw_overspinner(bmp, x, y, enemy[dr].attribute [2], 70, 10, ANGLE_1_32, 1024 / 6, 6, GC_BLUE2, GC_BLUE6);
3519 draw_overspinner(bmp, x, y, enemy[dr].attribute [0], 110, 10, 48, 1024 / 5, 5, GC_ORANGE2, GC_ORANGE6);
3520 circlefill(bmp, (x), y, 30, col1);
3521 circle(bmp, (x), y, 30, col2);
3522 break;
3523 case ENEMY_OVERSPIKEY:
3524 draw_spikey(bmp, x, y, enemy[dr].attribute [2], 70, 20, ANGLE_QUARTER, 1024 / 6, 6, GC_RED2, GC_RED6, -2, -3);
3525 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 110, 20, ANGLE_QUARTER, 1024 / 5, 5, GC_BLUE2, GC_BLUE6, -2, -3);
3526 circlefill(bmp, (x), y, 30, col1);
3527 circle(bmp, (x), y, 30, col2);
3528 break;
3529 case ENEMY_UNDERSPIKEY:
3530 draw_spikey(bmp, x, y, enemy[dr].attribute [2], 70, 25, ANGLE_QUARTER, 1024 / 6, 6, GC_YELLOW2, GC_YELLOW6, -2, -3);
3531 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 110, 15, ANGLE_QUARTER, 1024 / 5, 5, GC_GREEN2, GC_GREEN6, -2, -3);
3532 circlefill(bmp, (x), y, 26, col1);
3533 circle(bmp, (x), y, 26, col2);
3534 x = x + xpart(enemy[dr].angle, 23);
3535 y = y + ypart(enemy[dr].angle, 23);
3536 circlefill(bmp, (x), y, 7, col1);
3537 circle(bmp, (x), y, 7, col2);
3538 break;
3539 case ENEMY_UNDERSPIKEY2:
3540 draw_spikey(bmp, x, y, enemy[dr].attribute [2], 80, 25, ANGLE_QUARTER, 1024 / 3, 3, GC_ORANGE2, GC_ORANGE6, -2, -3);
3541 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 100, 25, ANGLE_QUARTER, 1024 / 4, 4, GC_RED2, GC_RED6, -2, -3);
3542 circlefill(bmp, (x), y, 26, col1);
3543 circle(bmp, (x), y, 26, col2);
3544 x = x + xpart(enemy[dr].angle, 21);
3545 y = y + ypart(enemy[dr].angle, 21);
3546 circlefill(bmp, (x), y, 7, col1);
3547 circle(bmp, (x), y, 7, col2);
3548 break;
3549 case ENEMY_UNDERSPIKEY3:
3550 draw_overspinner(bmp, x, y, enemy[dr].attribute [2], 70, 5, ANGLE_1_SIXTEENTH, 1024 / 4, 4, GC_RED2, GC_RED6);
3551 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 90, 26, ANGLE_QUARTER, 1024 / 4, 4, GC_YELLOW2, GC_YELLOW6, -2, -3);
3552 circlefill(bmp, (x), y, 26, col1);
3553 circle(bmp, (x), y, 26, col2);
3554 x = x + xpart(enemy[dr].angle, 21);
3555 y = y + ypart(enemy[dr].angle, 21);
3556 circlefill(bmp, (x), y, 7, col1);
3557 circle(bmp, (x), y, 7, col2);
3558 break;
3559 case ENEMY_OVERSPIKEY2:
3560 draw_overspinner(bmp, x, y, enemy[dr].attribute [2], 80, 5, ANGLE_1_32 + 4, 1024 / 6, 6, GC_BLUE2, GC_BLUE6);
3561 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 110, 26, ANGLE_1_EIGHTH + ANGLE_1_32, 1024 / 5, 5, GC_RED2, GC_RED6, -2, -3);
3562 circlefill(bmp, (x), y, 27, col1);
3563 circle(bmp, (x), y, 27, col2);
3564 x = x + xpart(enemy[dr].angle, 22);
3565 y = y + ypart(enemy[dr].angle, 22);
3566 circlefill(bmp, (x), y, 7, col1);
3567 circle(bmp, (x), y, 7, col2);
3568 break;
3569 case ENEMY_OVERBLATTER:
3570 draw_blatter(bmp, x, y, 4, 50, enemy[dr].attribute [0], 13, GC_RED2, GC_RED5);
3571 // draw_overspinner(bmp, x, y, ANGLE_FULL - enemy[dr].angle, 52, 10, ANGLE_1_32, 1024 / 6, 4, GC_RED2, GC_RED6);
3572 draw_blatter(bmp, x, y, 5, 50, enemy[dr].attribute [2], 15, GC_YELLOW2, GC_YELLOW6);
3573 case ENEMY_OVERBLATTER2:
3574 if (enemy[dr].type == ENEMY_OVERBLATTER2)
3575 {
3576 draw_blatter(bmp, x, y, 6, 52, enemy[dr].attribute [0], 13, GC_BLUE2, GC_BLUE6);
3577 draw_blatter(bmp, x, y, 4, 49, enemy[dr].attribute [2], 15, GC_GREY2, GC_GREY6);
3578 }
3579 circlefill(bmp, (x), y, 26, col1);
3580 circle(bmp, (x), y, 26, col2);
3581 x1 = x + xpart(enemy[dr].angle + ANGLE_QUARTER, 26);
3582 y1 = y + ypart(enemy[dr].angle + ANGLE_QUARTER, 26);
3583 circlefill(bmp, x1, y1, 7, col1);
3584 circle(bmp, x1, y1, 7, col2);
3585 xa = 7;
3586 if (enemy[dr].attribute [8] > 0)
3587 xa = 7 - enemy[dr].attribute [8];
3588 if (enemy[dr].attribute [8] >= 6)
3589 xa = 3;
3590 x1 = x1 + xpart(enemy[dr].attribute [6], xa);
3591 y1 = y1 + ypart(enemy[dr].attribute [6], xa);
3592 circlefill(bmp, x1, y1, 3, col1);
3593 circle(bmp, x1, y1, 3, col2);
3594 x1 = x + xpart(enemy[dr].angle - ANGLE_QUARTER, 26);
3595 y1 = y + ypart(enemy[dr].angle - ANGLE_QUARTER, 26);
3596 circlefill(bmp, x1, y1, 7, col1);
3597 circle(bmp, x1, y1, 7, col2);
3598 xa = 7;
3599 if (enemy[dr].attribute [9] > 0)
3600 xa = 7 - enemy[dr].attribute [9];
3601 if (enemy[dr].attribute [9] >= 6)
3602 xa = 3;
3603 x1 = x1 + xpart(enemy[dr].attribute [7], xa);
3604 y1 = y1 + ypart(enemy[dr].attribute [7], xa);;
3605 circlefill(bmp, x1, y1, 3, col1);
3606 circle(bmp, x1, y1, 3, col2);
3607 break;
3608 case ENEMY_WAVER1:
3609 // draw_spinner(bmp, x, y, enemy[dr].attribute [0], 32, 10, ANGLE_1_32, 1024 / 3, 3, GC_YELLOW2, GC_YELLOW6);
3610 draw_waver(bmp, x, y, enemy[dr].attribute [0], 34, 15, ANGLE_1_32, 1024 / 4, 4, GC_RED1, GC_RED5, waver1_circle, 20);
3611 // int outward, int inward, int angle1, int angle2, int arms, int col1, int col2, RLE_SPRITE *waver_rle, int waver_rle_size)
3612 circlefill(bmp, (x), y, 15, col1);
3613 circle(bmp, (x), y, 15, col2);
3614 break;
3615 case ENEMY_WAVER2:
3616 // draw_spinner(bmp, x, y, enemy[dr].attribute [0], 32, 10, ANGLE_1_32, 1024 / 3, 3, GC_YELLOW2, GC_YELLOW6);
3617 draw_waver(bmp, x, y, enemy[dr].attribute [0], 41, 15, ANGLE_1_32, 1024 / 3, 3, GC_GREEN1, GC_GREEN5, waver2_circle, 20);
3618 circlefill(bmp, (x), y, 15, col1);
3619 circle(bmp, (x), y, 15, col2);
3620 break;
3621 case ENEMY_SPIKEY1:
3622 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 32, 10, ANGLE_1_EIGHTH, 1024 / 3, 3, GC_GREEN2, GC_GREEN6, -2, -3);
3623 circlefill(bmp, (x), y, 10, col1);
3624 circle(bmp, (x), y, 10, col2);
3625 x = x + xpart(enemy[dr].angle, 9);
3626 y = y + ypart(enemy[dr].angle, 9);
3627 circlefill(bmp, (x), y, 3, col1);
3628 circle(bmp, (x), y, 3, col2);
3629 break;
3630 case ENEMY_SPIKEY2:
3631 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 36, 15, ANGLE_1_EIGHTH, 1024 / 4, 4, GC_YELLOW2, GC_YELLOW6, -2, -3);
3632 circlefill(bmp, (x), y, 10, col1);
3633 circle(bmp, (x), y, 10, col2);
3634 x = x + xpart(enemy[dr].angle, 9);
3635 y = y + ypart(enemy[dr].angle, 9);
3636 circlefill(bmp, (x), y, 3, col1);
3637 circle(bmp, (x), y, 3, col2);
3638 break;
3639 case ENEMY_SPIKEY3:
3640 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 32, 10, ANGLE_1_EIGHTH, 1024 / 3, 3, GC_YELLOW2, GC_YELLOW6, -2, -3);
3641 circlefill(bmp, (x), y, 15, col1);
3642 circle(bmp, (x), y, 15, col2);
3643 /* x1 = x + xpart(enemy[dr].angle - ANGLE_1_32, 13);
3644 y1 = y + ypart(enemy[dr].angle - ANGLE_1_32, 13);
3645 circlefill(bmp, x1, y1, 3, col1);
3646 circle(bmp, x1, y1, 3, col2);
3647 x1 = x + xpart(enemy[dr].angle + ANGLE_1_32, 13);
3648 y1 = y + ypart(enemy[dr].angle + ANGLE_1_32, 13);
3649 circlefill(bmp, x1, y1, 3, col1);
3650 circle(bmp, x1, y1, 3, col2);*/
3651 x1 = x + xpart(enemy[dr].angle, 13);
3652 y1 = y + ypart(enemy[dr].angle, 13);
3653 circlefill(bmp, x1, y1, 4, col1);
3654 circle(bmp, x1, y1, 4, col2);
3655 break;
3656 case ENEMY_SPIKEY4:
3657 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 39, 10, ANGLE_1_EIGHTH, 1024 / 3, 3, GC_YELLOW2, GC_YELLOW6, -2, -3);
3658 draw_spikey(bmp, x, y, ANGLE_FULL - enemy[dr].attribute [0], 28, 5, ANGLE_1_EIGHTH, ANGLE_HALF, 2, GC_YELLOW2, GC_YELLOW6, -2, -3);
3659 circlefill(bmp, (x), y, 10, col1);
3660 circle(bmp, (x), y, 10, col2);
3661 break;
3662 case ENEMY_SPIKEY5:
3663 draw_spikey(bmp, x, y, enemy[dr].attribute [0], 45, 10, ANGLE_1_SIXTEENTH + ANGLE_1_32, 1024 / 4, 4, GC_GREY1, GC_GREY6, -2, -3);
3664 circlefill(bmp, (x), y, 10, col1);
3665 circle(bmp, (x), y, 10, col2);
3666 x = x + xpart(enemy[dr].angle, 9);
3667 y = y + ypart(enemy[dr].angle, 9);
3668 circlefill(bmp, (x), y, 3, col1);
3669 circle(bmp, (x), y, 3, col2);
3670 break;
3671 /* case ENEMY_SPINNER1:
3672 void draw_spinner(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2)
3673 draw_spinner(bmp, x, y, enemy[dr].attribute [0], size1, size2, radius, col1, col2, angle1, angle2
3674 xa = enemy[dr].attribute [0];
3675 col3 = GC_YELLOW2;
3676 col4 = GC_YELLOW6;
3677 bordered_triangle(bmp,
3678 x + xpart(enemy[dr].attribute [0] + ANGLE_1_32, 32),
3679 y + ypart(enemy[dr].attribute [0] + ANGLE_1_32, 32),
3680 x + xpart(enemy[dr].attribute [0] - ANGLE_1_32, 32),
3681 y + ypart(enemy[dr].attribute [0] - ANGLE_1_32, 32),
3682 x - xpart(enemy[dr].attribute [0], 10),
3683 y - ypart(enemy[dr].attribute [0], 10),
3684 col3, col4);
3685 bordered_triangle(bmp,
3686 x + xpart(enemy[dr].attribute [0] + ANGLE_1_32 + (1024 / 3), 32),
3687 y + ypart(enemy[dr].attribute [0] + ANGLE_1_32 + (1024 / 3), 32),
3688 x + xpart(enemy[dr].attribute [0] - ANGLE_1_32 + (1024 / 3), 32),
3689 y + ypart(enemy[dr].attribute [0] - ANGLE_1_32 + (1024 / 3), 32),
3690 x - xpart(enemy[dr].attribute [0] + (1024 / 3), 10),
3691 y - ypart(enemy[dr].attribute [0] + (1024 / 3), 10),
3692 col3, col4);
3693 bordered_triangle(bmp,
3694 x + xpart(enemy[dr].attribute [0] + ANGLE_1_32 - (1024 / 3), 32),
3695 y + ypart(enemy[dr].attribute [0] + ANGLE_1_32 - (1024 / 3), 32),
3696 x + xpart(enemy[dr].attribute [0] - ANGLE_1_32 - (1024 / 3), 32),
3697 y + ypart(enemy[dr].attribute [0] - ANGLE_1_32 - (1024 / 3), 32),
3698 x - xpart(enemy[dr].attribute [0] - (1024 / 3), 10),
3699 y - ypart(enemy[dr].attribute [0] - (1024 / 3), 10),
3700 col3, col4);
3701 circlefill(bmp, (x), y, 12, col1);
3702 circle(bmp, (x), y, 12, col2);
3703 // x = x + xpart(enemy[dr].angle, 10);
3704 // y = y + ypart(enemy[dr].angle, 10);
3705 // circlefill(bmp, (x), y, 2, col1);
3706 // circle(bmp, (x), y, 2, col2);
3707 break;*/
3708 case ENEMY_DEFENDER3_TURRET1:
3709 circlefill(bmp, (x), y, 12, col1);
3710 circle(bmp, (x), y, 12, col2);
3711 x1 = x + xpart(enemy[dr].attribute [1], 12);
3712 y1 = y + ypart(enemy[dr].attribute [1], 12);
3713 circlefill(bmp, (x1), y1, 4, col1);
3714 circle(bmp, (x1), y1, 4, col2);
3715 x2 = x - xpart(enemy[dr].attribute [1], 12);
3716 y2 = y - ypart(enemy[dr].attribute [1], 12);
3717 circlefill(bmp, x2, y2, 4, col1);
3718 circle(bmp, x2, y2, 4, col2);
3719 if (enemy[dr].attribute [0] > 0)
3720 {
3721 col2 = enemy[dr].attribute [0] / 3;
3722 switch(col2)
3723 {
3724 default: col1 = TRANS_WHITE; break;
3725 case 2: col1 = TRANS_LBLUE; break;
3726 case 1: col1 = TRANS_DBLUE; break;
3727 case 0: col1 = TRANS_DGREY; break;
3728 }
3729 draw_spark_jump(bmp, x1, y1, x2, y2, 4, col2 + 6, col1, 1);
3730 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x1, y1);
3731 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x2, y2);
3732 }
3733 break;
3734 case ENEMY_DEFENDER3_TURRET2:
3735 circlefill(bmp, (x), y, 12, col1);
3736 circle(bmp, (x), y, 12, col2);
3737 draw_orbiter(bmp, x, y, enemy[dr].attribute [1], 8, 14, 20, ANGLE_1_SIXTEENTH, ANGLE_HALF, 2, GC_RED1, GC_RED6);
3738 break;
3739 case ENEMY_DEFENDER3_TURRET3:
3740 circlefill(bmp, (x), y, 12, col1);
3741 circle(bmp, (x), y, 12, col2);
3742 x1 = xpart(enemy[dr].attribute [1], 12);
3743 y1 = ypart(enemy[dr].attribute [1], 12);
3744 circlefill(bmp, x + x1, y + y1, 3, col1);
3745 circle(bmp, x + x1, y + y1, 3, col2);
3746 circlefill(bmp, x - x1, y - y1, 3, col1);
3747 circle(bmp, x - x1, y - y1, 3, col2);
3748 x1 = xpart(enemy[dr].attribute [1] + ANGLE_QUARTER, 12);
3749 y1 = ypart(enemy[dr].attribute [1] + ANGLE_QUARTER, 12);
3750 circlefill(bmp, x - x1, y - y1, 3, col1);
3751 circle(bmp, x - x1, y - y1, 3, col2);
3752 circlefill(bmp, x + x1, y + y1, 3, col1);
3753 circle(bmp, x + x1, y + y1, 3, col2);
3754 break;
3755 case ENEMY_DEFENDER3_TURRET4:
3756 circlefill(bmp, (x), y, 12, col1);
3757 circle(bmp, (x), y, 12, col2);
3758 x = x + xpart(enemy[dr].angle, 11);
3759 y = y + ypart(enemy[dr].angle, 11);
3760 circlefill(bmp, (x), y, 3, col1);
3761 circle(bmp, (x), y, 3, col2);
3762 break;
3763 case ENEMY_DEFENDER3_TURRET5:
3764 circlefill(bmp, (x), y, 12, col1);
3765 circle(bmp, (x), y, 12, col2);
3766 x1 = xpart(enemy[dr].angle, 11);
3767 y1 = ypart(enemy[dr].angle, 11);
3768 circlefill(bmp, x + x1, y + y1, 3, col1);
3769 circle(bmp, x + x1, y + y1, 3, col2);
3770 circlefill(bmp, x - x1, y - y1, 3, col1);
3771 circle(bmp, x - x1, y - y1, 3, col2);
3772 break;
3773 case ENEMY_DEFENDER3_TURRET6:
3774 circlefill(bmp, (x), y, 12, col1);
3775 circle(bmp, (x), y, 12, col2);
3776 x = x + xpart(enemy[dr].angle, 11);
3777 y = y + ypart(enemy[dr].angle, 11);
3778 circlefill(bmp, (x), y, 4, col1);
3779 circle(bmp, (x), y, 4, col2);
3780 break;
3781 case ENEMY_SHIELDER1:
3782 // draw_spikey(bmp, x, y, enemy[dr].attribute [0], 45, 10, ANGLE_1_SIXTEENTH + ANGLE_1_32, 1024 / 4, 4, GC_GREY1, GC_GREY6);
3783 circlefill(bmp, (x), y, 15, col1);
3784 circle(bmp, (x), y, 15, col2);
3785
3786 x1 = x + xpart(enemy[dr].attribute [1], 15);
3787 y1 = y + ypart(enemy[dr].attribute [1], 15);
3788 circlefill(bmp, (x1), y1, 4, col1);
3789 circle(bmp, (x1), y1, 4, col2);
3790 x2 = x - xpart(enemy[dr].attribute [1], 15);
3791 y2 = y - ypart(enemy[dr].attribute [1], 15);
3792 circlefill(bmp, x2, y2, 4, col1);
3793 circle(bmp, x2, y2, 4, col2);
3794 draw_squarey(bmp, x, y, ANGLE_FULL - enemy[dr].attribute [1], 40, 22, ANGLE_1_SIXTEENTH, ANGLE_FULL / 3, 3, GC_BLUE1, GC_BLUE6);
3795 if (enemy[dr].attribute [0] > 0)
3796 {
3797 col2 = enemy[dr].attribute [0] / 3;
3798 switch(col2)
3799 {
3800 default: col1 = TRANS_WHITE; break;
3801 case 2: col1 = TRANS_LBLUE; break;
3802 case 1: col1 = TRANS_DBLUE; break;
3803 case 0: col1 = TRANS_DGREY; break;
3804 }
3805 draw_spark_jump(bmp, x1, y1, x2, y2, 4, col2 + 6, col1, 1);
3806 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x1, y1);
3807 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x2, y2);
3808 }
3809 break;
3810 case ENEMY_ZAPPER1:
3811 circlefill(bmp, (x), y, 13, col1);
3812 circle(bmp, (x), y, 13, col2);
3813 x1 = x + xpart(enemy[dr].angle + ANGLE_QUARTER, 13);
3814 y1 = y + ypart(enemy[dr].angle + ANGLE_QUARTER, 13);
3815 circlefill(bmp, (x1), y1, 4, col1);
3816 circle(bmp, (x1), y1, 4, col2);
3817 x2 = x + xpart(enemy[dr].angle - ANGLE_QUARTER, 13);
3818 y2 = y + ypart(enemy[dr].angle - ANGLE_QUARTER, 13);
3819 circlefill(bmp, x2, y2, 4, col1);
3820 circle(bmp, x2, y2, 4, col2);
3821 for (xa = 0; xa < 8; xa ++)
3822 {
3823 x3 = x + xpart(enemy[dr].attribute [4] + (xa * ANGLE_1_EIGHTH), 35);
3824 y3 = y + ypart(enemy[dr].attribute [4] + (xa * ANGLE_1_EIGHTH), 35);
3825 col1 = COLOUR_GREY1;
3826 col3 = 0;
3827 col4 = ((ANGLE_FULL - (enemy[dr].attribute [4] * 2)) & 1023);
3828 if (col4 / ANGLE_1_EIGHTH == (xa + 2) % 8
3829 || col4 / ANGLE_1_EIGHTH == (xa + 6) % 8)
3830 {
3831 if (enemy[dr].attribute [5] < 0)
3832 {
3833 col3 = 18 + grand(3) - (col4 % ANGLE_1_EIGHTH) / 10;
3834 col1 = COLOUR_YELLOW8 - (col4 % ANGLE_1_EIGHTH) / 16;
3835 }
3836 else
3837 {
3838 col3 = 11 + grand(3) + (col4 % ANGLE_1_EIGHTH) / 10;
3839 col1 = COLOUR_YELLOW1 + (col4 % ANGLE_1_EIGHTH) / 16;
3840 }
3841 }
3842 circlefill(bmp, x3, y3, 7, col1);
3843 circle(bmp, x3, y3, 7, GC_GREY3);
3844 if (col3 > 0)
3845 draw_a_light(bmp, col3, x3, y3);
3846 }
3847 // draw_squarey(bmp, x, y, ANGLE_FULL - enemy[dr].attribute [1], 40, 22, ANGLE_1_SIXTEENTH, ANGLE_FULL / 3, 3, GC_BLUE1, GC_BLUE6);
3848 if (enemy[dr].attribute [0] == 1)
3849 {
3850 col2 = 3 - (counter / 4) % 4;//grand(4); //enemy[dr].attribute [1];
3851 switch(col2)
3852 {
3853 default: col1 = TRANS_YELLOW; break;
3854 case 2: col1 = TRANS_LGREEN; break;
3855 case 1: col1 = TRANS_DGREEN; break;
3856 case 0: col1 = TRANS_DGREEN; break;
3857 /* default: col1 = TRANS_WHITE; break;
3858 case 2: col1 = TRANS_LBLUE; break;
3859 case 1: col1 = TRANS_DBLUE; break;
3860 case 0: col1 = TRANS_DGREY; break;*/
3861 }
3862 x3 = (enemy[dr].attribute [1] / GRAIN) - (enemy[dr].x / GRAIN) + x;
3863 y3 = (enemy[dr].attribute [2] / GRAIN) - (enemy[dr].y / GRAIN) + y;
3864 draw_spark_jump(bmp, x1, y1, x3, y3, 7 + enemy[dr].attribute [3] / 15, col2 + 5 + enemy[dr].attribute [3] / 50, col1, 1);
3865 draw_spark_jump(bmp, x2, y2, x3, y3, 7 + enemy[dr].attribute [3] / 15, col2 + 5 + enemy[dr].attribute [3] / 50, col1, 1);
3866 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x1, y1);
3867 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x2, y2);
3868 draw_a_light(bmp, col2 * 2 + 3 + grand(7), x3, y3);
3869 }
3870 break;
3871 case ENEMY_OVERZAPPER:
3872 circlefill(bmp, (x), y, 30, col1);
3873 circle(bmp, (x), y, 30, col2);
3874 x1 = x + xpart(enemy[dr].angle + ANGLE_QUARTER, 30);
3875 y1 = y + ypart(enemy[dr].angle + ANGLE_QUARTER, 30);
3876 circlefill(bmp, (x1), y1, 5, col1);
3877 circle(bmp, (x1), y1, 5, col2);
3878 x2 = x + xpart(enemy[dr].angle - ANGLE_QUARTER, 30);
3879 y2 = y + ypart(enemy[dr].angle - ANGLE_QUARTER, 30);
3880 circlefill(bmp, x2, y2, 5, col1);
3881 circle(bmp, x2, y2, 5, col2);
3882 for (xa = 0; xa < 8; xa ++)
3883 {
3884 x3 = x + xpart(enemy[dr].attribute [4] + (xa * ANGLE_1_EIGHTH), 60);
3885 y3 = y + ypart(enemy[dr].attribute [4] + (xa * ANGLE_1_EIGHTH), 60);
3886 col1 = COLOUR_GREY1;
3887 col3 = 0;
3888 col4 = ((ANGLE_FULL - (enemy[dr].attribute [4] * 2)) & 1023);
3889 if (col4 / ANGLE_1_EIGHTH == (xa + 2) % 8
3890 || col4 / ANGLE_1_EIGHTH == (xa + 6) % 8)
3891 {
3892 if (enemy[dr].attribute [5] < 0)
3893 {
3894 col3 = 18 + grand(3) - (col4 % ANGLE_1_EIGHTH) / 10;
3895 col1 = COLOUR_YELLOW8 - (col4 % ANGLE_1_EIGHTH) / 16;
3896 }
3897 else
3898 {
3899 col3 = 11 + grand(3) + (col4 % ANGLE_1_EIGHTH) / 10;
3900 col1 = COLOUR_YELLOW1 + (col4 % ANGLE_1_EIGHTH) / 16;
3901 }
3902 }
3903 circlefill(bmp, x3, y3, 9, col1);
3904 circle(bmp, x3, y3, 9, GC_GREY3);
3905 if (col3 > 0)
3906 draw_a_light(bmp, col3, x3, y3);
3907 }
3908 break;
3909 case ENEMY_ATTRACTOR:
3910 circlefill(bmp, (x), y, 15, col1);
3911 circle(bmp, (x), y, 15, col2);
3912 break;
3913 case ENEMY_ORBITER1:
3914 circlefill(bmp, (x), y, 13, col1);
3915 circle(bmp, (x), y, 13, col2);
3916 draw_orbiter(bmp, x, y, enemy[dr].attribute [1], 17, 22, 40, ANGLE_1_SIXTEENTH, ANGLE_FULL / 3, 3, GC_RED1, GC_RED6);
3917 break;
3918 case ENEMY_ORBITER2:
3919 circlefill(bmp, (x), y, 11, col1);
3920 circle(bmp, (x), y, 11, col2);
3921 draw_orbiter(bmp, x, y, enemy[dr].attribute [1], 16, 21, 44, ANGLE_1_SIXTEENTH, ANGLE_HALF, 2, GC_ORANGE1, GC_ORANGE6);
3922 draw_orbiter(bmp, x, y, enemy[dr].attribute [3], 15, 21, 41, ANGLE_1_SIXTEENTH, ANGLE_HALF, 2, GC_ORANGE1, GC_ORANGE6);
3923 break;
3924 case ENEMY_ORBITER3:
3925 circlefill(bmp, (x), y, 15, col1);
3926 circle(bmp, (x), y, 15, col2);
3927 draw_orbiter(bmp, x, y, enemy[dr].attribute [1], 17, 25, 56, ANGLE_1_SIXTEENTH, ANGLE_QUARTER, 4, GC_BLUE1, GC_BLUE5);
3928 break;
3929 case ENEMY_BRACKET1:
3930 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_BRACKET1], (x) - 25, (y) - 19);
3931 circlefill(bmp, (x), y, 11, col1);
3932 circle(bmp, (x), y, 11, col2);
3933 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3934 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3935 // circlefill(bmp, (x), y, 2, col1);
3936 circle(bmp, x1, y1, 2, col2);
3937 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3938 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3939 // circlefill(bmp, (x), y, 2, col1);
3940 circle(bmp, x1, y1, 2, col2);
3941 break;
3942 case ENEMY_BRACKET2:
3943 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_BRACKET2], (x) - 27, (y) - 16);
3944 circlefill(bmp, (x), y, 10, col1);
3945 circle(bmp, (x), y, 10, col2);
3946 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 5);
3947 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 5);
3948 // circlefill(bmp, (x), y, 2, col1);
3949 circle(bmp, x1, y1, 2, col2);
3950 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 5);
3951 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 5);
3952 // circlefill(bmp, (x), y, 2, col1);
3953 circle(bmp, x1, y1, 2, col2);
3954 break;
3955 case ENEMY_BRACKET3:
3956 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_BRACKET3], (x) - 28, (y) - 19);
3957 circlefill(bmp, (x), y, 11, col1);
3958 circle(bmp, (x), y, 11, col2);
3959 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3960 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3961 // circlefill(bmp, (x), y, 2, col1);
3962 circle(bmp, x1, y1, 2, col2);
3963 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3964 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3965 // circlefill(bmp, (x), y, 2, col1);
3966 circle(bmp, x1, y1, 2, col2);
3967 break;
3968 case ENEMY_BRACKET4:
3969 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_BRACKET4], (x) - 34, (y) - 24);
3970 circlefill(bmp, (x), y, 10, col1);
3971 circle(bmp, (x), y, 10, col2);
3972 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3973 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3974 circle(bmp, x1, y1, 2, col2);
3975 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3976 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3977 circle(bmp, x1, y1, 2, col2);
3978 break;
3979 case ENEMY_BRACKET4_TURRET:
3980 circlefill(bmp, (x), y, 7, col1);
3981 circle(bmp, (x), y, 7, col2);
3982 x = x + xpart(enemy[dr].angle, 7);
3983 y = y + ypart(enemy[dr].angle, 7);
3984 circlefill(bmp, (x), y, 3, col1);
3985 circle(bmp, (x), y, 3, col2);
3986 break;
3987 case ENEMY_BRACKET5:
3988 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_BRACKET5], (x) - 31, (y) - 45);
3989 circlefill(bmp, (x), y, 11, col1);
3990 circle(bmp, (x), y, 11, col2);
3991 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3992 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 6);
3993 circle(bmp, x1, y1, 2, col2);
3994 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3995 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 6);
3996 circle(bmp, x1, y1, 2, col2);
3997 break;
3998 case ENEMY_CURVE1:
3999 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_CURVE1], (x) - 34, (y) - 26);
4000 circlefill(bmp, (x), y, 13, col1);
4001 circle(bmp, (x), y, 13, col2);
4002 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4003 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4004 circlefill(bmp, x1, y1, 3, col1);
4005 circle(bmp, x1, y1, 3, col2);
4006 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4007 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4008 circlefill(bmp, x1, y1, 3, col1);
4009 circle(bmp, x1, y1, 3, col2);
4010 break;
4011 case ENEMY_CURVE2:
4012 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_CURVE2], (x) - 34, (y) - 26);
4013 if (enemy[dr].armour <= 500 && grand(500) > enemy[dr].armour)
4014 {
4015 x1 = 3;//2 + (300 - enemy[dr].armour) / 70;
4016 x += grand(x1) - grand(x1);
4017 y += grand(x1) - grand(x1);
4018 }
4019 circlefill(bmp, x, y, 13, col1);
4020 circle(bmp, x, y, 13, col2);
4021 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4022 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4023 circlefill(bmp, x1, y1, 3, col1);
4024 circle(bmp, x1, y1, 3, col2);
4025 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4026 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4027 circlefill(bmp, x1, y1, 3, col1);
4028 circle(bmp, x1, y1, 3, col2);
4029 break;
4030 case ENEMY_CURVE3:
4031 draw_rle_sprite(bmp, enemy6_rle [RLE_ENEMY6_CURVE3], (x) - 34, (y) - 26);
4032 if (enemy[dr].armour <= 500 && grand(500) > enemy[dr].armour)
4033 {
4034 x1 = 3;//2 + (300 - enemy[dr].armour) / 70;
4035 x += grand(x1) - grand(x1);
4036 y += grand(x1) - grand(x1);
4037 }
4038 circlefill(bmp, (x), y, 13, col1);
4039 circle(bmp, (x), y, 13, col2);
4040 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4041 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4042 circlefill(bmp, x1, y1, 3, col1);
4043 circle(bmp, x1, y1, 3, col2);
4044 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4045 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4046 circlefill(bmp, x1, y1, 3, col1);
4047 circle(bmp, x1, y1, 3, col2);
4048 break;
4049 case ENEMY_DEAD_TRI1:
4050 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER1], x - 36, y - 36);
4051 break;
4052 case ENEMY_DEAD_TRI2:
4053 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER2], x - 35, y - 35);
4054 break;
4055 case ENEMY_DEAD_TRI3:
4056 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER3], x - 35, y - 35);
4057 break;
4058 case ENEMY_TRIANGLER1:
4059 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER1], (x) - 36, (y) - 36);
4060 circlefill(bmp, (x), y, 16, col1);
4061 circle(bmp, (x), y, 16, col2);
4062 x1 = 3;
4063 y1 = 3;
4064 if (enemy[dr].attribute [0] == 1)
4065 x1 -= enemy[dr].attribute [1] / 3;
4066 else
4067 y1 -= enemy[dr].attribute [1] / 3;
4068 draw_launchers(bmp, x, y, enemy[dr].angle, 15, 14, 96, x1, y1, COLOUR_YELLOW1, COLOUR_YELLOW6);
4069 // x = x + xpart(enemy[dr].angle, 18);
4070 // y = y + ypart(enemy[dr].angle, 18);
4071 // circlefill(bmp, (x), y, 4, col1);
4072 // circle(bmp, (x), y, 4, col2);
4073 break;
4074 case ENEMY_TRIANGLER2:
4075 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER2], (x) - 35, (y) - 35);
4076 circlefill(bmp, (x), y, 18, col1);
4077 circle(bmp, (x), y, 18, col2);
4078 x1 = 3;
4079 y1 = 3;
4080 if (enemy[dr].attribute [0] == 1)
4081 x1 -= enemy[dr].attribute [1] / 3;
4082 else
4083 y1 -= enemy[dr].attribute [1] / 3;
4084 draw_launchers(bmp, x, y, enemy[dr].angle, 17, 13, 105, x1, y1, COLOUR_ORANGE1, COLOUR_ORANGE6);
4085 break;
4086 case ENEMY_TRIANGLER3:
4087 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER3], (x) - 35, (y) - 35);
4088 circlefill(bmp, (x), y, 15, col1);
4089 circle(bmp, (x), y, 15, col2);
4090 x1 = 3;
4091 y1 = 3;
4092 if (enemy[dr].attribute [0] == 1)
4093 x1 -= enemy[dr].attribute [1] / 3;
4094 else
4095 y1 -= enemy[dr].attribute [1] / 3;
4096 draw_launchers(bmp, x, y, enemy[dr].angle, 16, 12, 112, x1, y1, COLOUR_BLUE1, COLOUR_BLUE6);
4097 break;
4098 case ENEMY_OVERTRIANGLER:
4099 draw_rle_sprite(bmp, enemy5_rle [RLE_ENEMY5_OVERTRIANGLER], (x) - 52, (y) - 52);
4100 circlefill(bmp, (x), y, 33, col1);
4101 circle(bmp, (x), y, 33, col2);
4102 x1 = 3;
4103 y1 = 3;
4104 if (enemy[dr].attribute [0] == 1)
4105 x1 -= enemy[dr].attribute [1];
4106 else
4107 y1 -= enemy[dr].attribute [1];
4108 draw_launchers(bmp, x, y, enemy[dr].angle, 29, 25, 96, x1, y1, COLOUR_RED1, COLOUR_RED6);
4109 break;
4110 case ENEMY_OVERTRIANGLER_TURRET:
4111 circlefill(bmp, (x), y, 10, col1);
4112 circle(bmp, (x), y, 10, col2);
4113 x = x + xpart(enemy[dr].angle, 9);
4114 y = y + ypart(enemy[dr].angle, 9);
4115 circlefill(bmp, (x), y, 3, col1);
4116 circle(bmp, (x), y, 3, col2);
4117 break;
4118 case ENEMY_DISRUPTER1:
4119 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_DISRUPTER1], (x) - 44, (y) - 12);
4120 circlefill(bmp, (x), y, 15, col1);
4121 circle(bmp, (x), y, 15, col2);
4122 x = x + xpart(enemy[dr].angle, 15);
4123 y = y + ypart(enemy[dr].angle, 15);
4124 circlefill(bmp, (x), y, 4, col1);
4125 circle(bmp, (x), y, 4, col2);
4126 break;
4127 case ENEMY_DISRUPTER2:
4128 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_DISRUPTER2], (x) - 14, (y) - 46);
4129 circlefill(bmp, (x), y, 15, col1);
4130 circle(bmp, (x), y, 15, col2);
4131 x = x + xpart(enemy[dr].angle, 15);
4132 y = y + ypart(enemy[dr].angle, 15);
4133 circlefill(bmp, (x), y, 4, col1);
4134 circle(bmp, (x), y, 4, col2);
4135 break;
4136 case ENEMY_DISRUPTER3:
4137 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_DISRUPTER3], (x) - 44, (y) - 16);
4138 circlefill(bmp, (x), y, 15, col1);
4139 circle(bmp, (x), y, 15, col2);
4140 x = x + xpart(enemy[dr].angle, 15);
4141 y = y + ypart(enemy[dr].angle, 15);
4142 circlefill(bmp, (x), y, 4, col1);
4143 circle(bmp, (x), y, 4, col2);
4144 break;
4145 case ENEMY_WORMER1:
4146 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_WORMER1], (x) - 31, (y) - 29);
4147 circlefill(bmp, (x), y, enemy[dr].radius / GRAIN, col1);
4148 circle(bmp, (x), y, enemy[dr].radius / GRAIN, col2);
4149 break;
4150 case ENEMY_WORMER2:
4151 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_WORMER2], (x) - 30, (y) - 21);
4152 circlefill(bmp, (x), y, enemy[dr].radius / GRAIN, col1);
4153 circle(bmp, (x), y, enemy[dr].radius / GRAIN, col2);
4154 break;
4155 case ENEMY_WORMER3:
4156 draw_rle_sprite(bmp, enemy4_rle [RLE_ENEMY4_WORMER3], (x) - 32, (y) - 32);
4157 circlefill(bmp, (x), y, enemy[dr].radius / GRAIN, col1);
4158 circle(bmp, (x), y, enemy[dr].radius / GRAIN, col2);
4159 break;
4160 case ENEMY_WORMER4:
4161 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_WORMER4], (x) - 41, (y) - 41);
4162 circlefill(bmp, (x), y, enemy[dr].radius / GRAIN, col1);
4163 circle(bmp, (x), y, enemy[dr].radius / GRAIN, col2);
4164 break;
4165 case ENEMY_HEAD1:
4166 draw_rle_sprite(bmp, enemy5_rle [RLE_ENEMY5_HEAD1], (x) - 40, (y) - 20);
4167 circlefill(bmp, (x), y, 13, col1);
4168 circle(bmp, (x), y, 13, col2);
4169 break;
4170 case ENEMY_HEAD1_EYE1:
4171 circlefill(bmp, (x), y, 8, col1);
4172 circle(bmp, (x), y, 8, col2);
4173 x = x + xpart(enemy[dr].angle, 4);
4174 y = y + ypart(enemy[dr].angle, 4);
4175 // circlefill(bmp, (x), y, 2, col1);
4176 circle(bmp, (x), y, 2, col2);
4177 break;
4178 case ENEMY_HEAD1_EYE2:
4179 circlefill(bmp, (x), y, 8, col1);
4180 circle(bmp, (x), y, 8, col2);
4181 x = x + xpart(enemy[dr].angle, 4);
4182 y = y + ypart(enemy[dr].angle, 4);
4183 // circlefill(bmp, (x), y, 2, col1);
4184 circlefill(bmp, (x), y, 2, COLOUR_BLUE6);
4185 circle(bmp, (x), y, 2, COLOUR_BLUE1);
4186 break;
4187 case ENEMY_HEAD1_EYE3:
4188 circlefill(bmp, (x), y, 8, col1);
4189 circle(bmp, (x), y, 8, col2);
4190 x = x + xpart(enemy[dr].angle, 4);
4191 y = y + ypart(enemy[dr].angle, 4);
4192 // circlefill(bmp, (x), y, 2, col1);
4193 circlefill(bmp, (x), y, 3, COLOUR_RED6);
4194 circle(bmp, (x), y, 3, COLOUR_RED1);
4195 break;
4196 case ENEMY_DEFENDER1:
4197 draw_rle_sprite(bmp, enemy5_rle [RLE_ENEMY5_DEFENDER1], (x) - 65, (y) - 33);
4198 circlefill(bmp, (x), y, 25, col1);
4199 circle(bmp, (x), y, 25, col2);
4200 x = x + xpart(enemy[dr].angle, 21);
4201 y = y + ypart(enemy[dr].angle, 21);
4202 circlefill(bmp, (x), y, 7, col1);
4203 circle(bmp, (x), y, 7, col2);
4204 break;
4205 case ENEMY_DEFENDER1_TURRET1:
4206 circlefill(bmp, (x), y, 12, col1);
4207 circle(bmp, (x), y, 12, col2);
4208 x = x + xpart(enemy[dr].angle, 9);
4209 y = y + ypart(enemy[dr].angle, 9);
4210 circlefill(bmp, (x), y, 5, col1);
4211 circle(bmp, (x), y, 5, col2);
4212 break;
4213 case ENEMY_DEFENDER1_TURRET2:
4214 circlefill(bmp, (x), y, 12, col1);
4215 circle(bmp, (x), y, 12, col2);
4216 x = x + xpart(enemy[dr].angle, 9);
4217 y = y + ypart(enemy[dr].angle, 9);
4218 circlefill(bmp, (x), y, 3, col1);
4219 circle(bmp, (x), y, 3, col2);
4220 break;
4221 case ENEMY_DEFENDER1_TURRET3:
4222 circlefill(bmp, (x), y, 12, col1);
4223 circle(bmp, (x), y, 12, col2);
4224 x = x + xpart(enemy[dr].angle, 9);
4225 y = y + ypart(enemy[dr].angle, 9);
4226 circlefill(bmp, (x), y, 3, col1);
4227 circle(bmp, (x), y, 3, col2);
4228 break;
4229 case ENEMY_DEFENDER2:
4230 draw_rle_sprite(bmp, enemy5_rle [RLE_ENEMY5_DEFENDER2], (x) - 33, (y) - 60);
4231 circlefill(bmp, (x), y, 25, col1);
4232 circle(bmp, (x), y, 25, col2);
4233 x = x + xpart(enemy[dr].angle, 21);
4234 y = y + ypart(enemy[dr].angle, 21);
4235 circlefill(bmp, (x), y, 7, col1);
4236 circle(bmp, (x), y, 7, col2);
4237 break;
4238 case ENEMY_DEFENDER2_TURRET1:
4239 case ENEMY_DEFENDER2_TURRET2:
4240 // case ENEMY_DEFENDER2_TURRET3:
4241 circlefill(bmp, (x), y, 9, col1);
4242 circle(bmp, (x), y, 9, col2);
4243 // x = x + xpart(enemy[dr].angle, 9);
4244 // y = y + ypart(enemy[dr].angle, 9);
4245 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 5);
4246 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 5);
4247 circle(bmp, x1, y1, 2, col2);
4248 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 5);
4249 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 5);
4250 circle(bmp, x1, y1, 2, col2);
4251 break;
4252 case ENEMY_DEFENDER3:
4253 draw_rle_sprite(bmp, enemy5_rle [RLE_ENEMY5_DEFENDER3], (x) - 65, (y) - 33);
4254 circlefill(bmp, (x), y, 25, col1);
4255 circle(bmp, (x), y, 25, col2);
4256 x = x + xpart(enemy[dr].angle, 21);
4257 y = y + ypart(enemy[dr].angle, 21);
4258 circlefill(bmp, (x), y, 7, col1);
4259 circle(bmp, (x), y, 7, col2);
4260 break;
4261 case ENEMY_OVERDISRUPTER:
4262 draw_rle_sprite(bmp, enemy5_rle [RLE_ENEMY5_OVERDISRUPTER], (x) - 20, (y) - 69);
4263 circlefill(bmp, (x), y, 25, col1);
4264 circle(bmp, (x), y, 25, col2);
4265 x = x + xpart(enemy[dr].angle, 23);
4266 y = y + ypart(enemy[dr].angle, 23);
4267 circlefill(bmp, (x), y, 7, col1);
4268 circle(bmp, (x), y, 7, col2);
4269 break;
4270 case ENEMY_BEAMER1:
4271 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BEAMER1], (x) - 92, (y) - 69);
4272 circlefill(bmp, (x), y, 35, col1);
4273 circle(bmp, (x), y, 35, col2);
4274 x1 = x + xpart(enemy[dr].angle, 31);
4275 y1 = y + ypart(enemy[dr].angle, 31);
4276 circlefill(bmp, x1, y1, 8, COLOUR_ORANGE5);
4277 circle(bmp, x1, y1, 8, COLOUR_ORANGE1);
4278 x1 = x + xpart(enemy[dr].angle, 32);
4279 y1 = y + ypart(enemy[dr].angle, 32);
4280 circlefill(bmp, x1, y1, 3, col1);
4281 circle(bmp, x1, y1, 3, col2);
4282 xa = abs(xpart(enemy[dr].counter * 8, 7));
4283 if (xa == 0)
4284 xa = 1;
4285 col3 = COLOUR_BLUE1 + xa;
4286 circlefill(bmp, x, y - 59, 7, col3);
4287 circle(bmp, x, y - 59, 7, GC_GREY1);
4288 draw_a_light(bmp, abs(xpart(enemy[dr].counter * 8, 21)) + 4, x, y - 59);
4289 col3 = COLOUR_BLUE8 - xa;
4290 circlefill(bmp, x, y + 59, 7, col3);
4291 circle(bmp, x, y + 59, 7, GC_GREY1);
4292 draw_a_light(bmp, abs(xpart(enemy[dr].counter * 8 + ANGLE_QUARTER, 21)) + 4, x, y + 59);
4293 break;
4294 case ENEMY_BEAMER2:
4295 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BEAMER2], (x) - 92, (y) - 69);
4296 circlefill(bmp, (x), y, 35, col1);
4297 circle(bmp, (x), y, 35, col2);
4298 x1 = x + xpart(enemy[dr].angle, 31);
4299 y1 = y + ypart(enemy[dr].angle, 31);
4300 circlefill(bmp, x1, y1, 8, COLOUR_GREY5);
4301 circle(bmp, x1, y1, 8, COLOUR_GREY1);
4302 x1 = x + xpart(enemy[dr].angle, 32);
4303 y1 = y + ypart(enemy[dr].angle, 32);
4304 circlefill(bmp, x1, y1, 3, col1);
4305 circle(bmp, x1, y1, 3, col2);
4306 xa = abs(xpart(enemy[dr].counter * 8, 7));
4307 if (xa == 0)
4308 xa = 1;
4309 col3 = COLOUR_YELLOW1 + xa;
4310 circlefill(bmp, x, y - 59, 7, col3);
4311 circle(bmp, x, y - 59, 7, GC_GREY1);
4312 draw_a_light(bmp, abs(xpart(enemy[dr].counter * 8, 21)) + 4, x, y - 59);
4313 col3 = COLOUR_YELLOW8 - xa;
4314 circlefill(bmp, x, y + 59, 7, col3);
4315 circle(bmp, x, y + 59, 7, GC_GREY1);
4316 draw_a_light(bmp, abs(xpart(enemy[dr].counter * 8 + ANGLE_QUARTER, 21)) + 4, x, y + 59);
4317 break;
4318 case ENEMY_BOSS1_1:
4319 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BOSS1_1], (x) - 94, (y) - 111);
4320 circlefill(bmp, (x), y, 55, col1);
4321 circle(bmp, (x), y, 55, col2);
4322 break;
4323 case ENEMY_BOSS1_2:
4324 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BOSS1_2], (x) - 114, (y) - 30);
4325 circlefill(bmp, (x), y, 40, col1);
4326 circle(bmp, (x), y, 40, col2);
4327 break;
4328 case ENEMY_BOSS1_3:
4329 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BOSS1_3], (x) - 114, (y) - 115);
4330 circlefill(bmp, (x), y, 40, col1);
4331 circle(bmp, (x), y, 40, col2);
4332 x = x + xpart(enemy[dr].angle, 35);
4333 y = y + ypart(enemy[dr].angle, 35);
4334 circlefill(bmp, (x), y, 7, col1);
4335 circle(bmp, (x), y, 7, col2);
4336 break;
4337 case ENEMY_BOSS1_TURRET1:
4338 circlefill(bmp, (x), y, 15, col1);
4339 circle(bmp, (x), y, 15, col2);
4340 x1 = x + xpart(enemy[dr].angle, 9);
4341 y1 = y + ypart(enemy[dr].angle, 9);
4342 circle(bmp, x1, y1, 3, col2);
4343 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH, 9);
4344 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH, 9);
4345 circle(bmp, x1, y1, 3, col2);
4346 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH, 9);
4347 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH, 9);
4348 circle(bmp, x1, y1, 3, col2);
4349 break;
4350 case ENEMY_BOSS1_TURRET2:
4351 circlefill(bmp, (x), y, 15, col1);
4352 circle(bmp, (x), y, 15, col2);
4353 x = x + xpart(enemy[dr].angle, 9);
4354 y = y + ypart(enemy[dr].angle, 9);
4355 // circlefill(bmp, (x), y, 2, col1);
4356 circle(bmp, (x), y, 3, col2);
4357 break;
4358 case ENEMY_BOSS1_TURRET3:
4359 circlefill(bmp, (x), y, 15, col1);
4360 circle(bmp, (x), y, 15, col2);
4361 x = x + xpart(enemy[dr].angle, 9);
4362 y = y + ypart(enemy[dr].angle, 9);
4363 // circlefill(bmp, (x), y, 2, col1);
4364 circle(bmp, (x), y, 3, col2);
4365 break;
4366 case ENEMY_BOSS3_1:
4367 draw_rle_sprite(bmp, enemy8_rle [RLE_ENEMY8_BOSS3], (x) - 119, (y) - 119);
4368 circlefill(bmp, (x), y, 35, col1);
4369 circle(bmp, (x), y, 35, col2);
4370 break;
4371 case ENEMY_BOSS3_3:
4372 draw_rle_sprite(bmp, enemy8_rle [RLE_ENEMY8_BOSS3_3], (x) - 140, (y) - 111);
4373 circlefill(bmp, x, y, 35, col1);
4374 circle(bmp, x, y, 35, col2);
4375 x1 = x - xpart(enemy[dr].angle, 33);
4376 y1 = y - ypart(enemy[dr].angle, 33);
4377 circlefill(bmp, x1, y1, 7, col1);
4378 circle(bmp, x1, y1, 7, col2);
4379 x1 = x + xpart(enemy[dr].angle + ANGLE_QUARTER, 35);
4380 y1 = y + ypart(enemy[dr].angle + ANGLE_QUARTER, 35);
4381 circlefill(bmp, x1, y1, 3, col1);
4382 circle(bmp, x1, y1, 3, col2);
4383 x1 = x + xpart(enemy[dr].angle - ANGLE_QUARTER, 35);
4384 y1 = y + ypart(enemy[dr].angle - ANGLE_QUARTER, 35);
4385 circlefill(bmp, x1, y1, 3, col1);
4386 circle(bmp, x1, y1, 3, col2);
4387 x1 = x + xpart(enemy[dr].angle - ANGLE_QUARTER + ANGLE_1_EIGHTH, 35);
4388 y1 = y + ypart(enemy[dr].angle - ANGLE_QUARTER + ANGLE_1_EIGHTH, 35);
4389 circlefill(bmp, x1, y1, 3, col1);
4390 circle(bmp, x1, y1, 3, col2);
4391 x1 = x + xpart(enemy[dr].angle + ANGLE_QUARTER - ANGLE_1_EIGHTH, 35);
4392 y1 = y + ypart(enemy[dr].angle + ANGLE_QUARTER - ANGLE_1_EIGHTH, 35);
4393 circlefill(bmp, x1, y1, 3, col1);
4394 circle(bmp, x1, y1, 3, col2);
4395 break;
4396 case ENEMY_BOSS2:
4397 draw_rle_sprite(bmp, enemy8_rle [RLE_ENEMY8_BOSS2], (x) - 124, (y) - 124);
4398 circlefill(bmp, (x), y, 35, col1);
4399 circle(bmp, (x), y, 35, col2);
4400 break;
4401 case ENEMY_BOSS2_2:
4402 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BOSS2_2], (x) - 115, (y) - 127);
4403 if (enemy[dr].attribute [0] > 20 && grand(40) < enemy[dr].attribute [0])
4404 {
4405 x += grand(enemy[dr].attribute [0] / 10) - grand(enemy[dr].attribute [0] / 10);
4406 y += grand(enemy[dr].attribute [0] / 10) - grand(enemy[dr].attribute [0] / 10);
4407 }
4408 circlefill(bmp, (x), y, 35, col1);
4409 circle(bmp, (x), y, 35, col2);
4410 x = x + xpart(enemy[dr].angle, 32);
4411 y = y + ypart(enemy[dr].angle, 32);
4412 circlefill(bmp, (x), y, 7, col1);
4413 circle(bmp, (x), y, 7, col2);
4414 if (enemy[dr].recycle <= 1)
4415 {
4416 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4417 circlefill(bmp, x, y, 6 + enemy[dr].attribute [0] / 3 + grand(8), TRANS_LBLUE);
4418 circlefill(bmp, x, y, 3 + enemy[dr].attribute [0] / 3 + grand(4), TRANS_WHITE);
4419 draw_a_light(bmp, 6 + enemy[dr].attribute [0] / 3 + grand(8), x, y);
4420 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
4421 }
4422 break;
4423 case ENEMY_BOSS2_3:
4424 draw_rle_sprite(bmp, enemy8_rle [RLE_ENEMY8_BOSS2_3], (x) - 132, (y) - 120);
4425 circlefill(bmp, (x), y, 35, col1);
4426 circle(bmp, (x), y, 35, col2);
4427 break;
4428 case ENEMY_BOSS2_TURRET1:
4429 circlefill(bmp, (x), y, 12, col1);
4430 circle(bmp, (x), y, 12, col2);
4431 x = x + xpart(enemy[dr].angle, 11);
4432 y = y + ypart(enemy[dr].angle, 11);
4433 circlefill(bmp, (x), y, 4, col1);
4434 circle(bmp, (x), y, 4, col2);
4435 break;
4436 case ENEMY_BOSS2_TURRET3:
4437 circlefill(bmp, (x), y, 12, col1);
4438 circle(bmp, (x), y, 12, col2);
4439 x = x + xpart(enemy[dr].angle, 10);
4440 y = y + ypart(enemy[dr].angle, 10);
4441 circlefill(bmp, (x), y, 6, col1);
4442 circle(bmp, (x), y, 6, col2);
4443 break;
4444 case ENEMY_BOSS2_TURRET4:
4445 circlefill(bmp, (x), y, 12, col1);
4446 circle(bmp, (x), y, 12, col2);
4447 xa = 11;
4448 if (enemy[dr].attribute [0] > 0)
4449 xa = 11 - enemy[dr].attribute [0] / 8;
4450 if (enemy[dr].attribute [0] >= 48)
4451 xa = 5;
4452 x = x + xpart(enemy[dr].angle, xa);
4453 y = y + ypart(enemy[dr].angle, xa);
4454 circlefill(bmp, (x), y, 4, col1);
4455 circle(bmp, (x), y, 4, col2);
4456 break;
4457 case ENEMY_BOSS2_TURRET2:
4458 circlefill(bmp, (x), y, 12, col1);
4459 circle(bmp, (x), y, 12, col2);
4460 x = x + xpart(enemy[dr].angle, 11);
4461 y = y + ypart(enemy[dr].angle, 11);
4462 circlefill(bmp, (x), y, 3, col1);
4463 circle(bmp, (x), y, 3, col2);
4464 break;
4465 case ENEMY_BOSS3_2:
4466 draw_rle_sprite(bmp, enemy7_rle [RLE_ENEMY7_BOSS3_2], (x) - 115, (y) - 120);
4467 circlefill(bmp, (x), y, 35, col1);
4468 circle(bmp, (x), y, 35, col2);
4469 x = x + xpart(enemy[dr].angle, 31);
4470 y = y + ypart(enemy[dr].angle, 31);
4471 circlefill(bmp, (x), y, 7, col1);
4472 circle(bmp, (x), y, 7, col2);
4473 break;
4474 case ENEMY_BOSS3_TURRET1:
4475 circlefill(bmp, (x), y, 14, col1);
4476 circle(bmp, (x), y, 14, col2);
4477 x = x + xpart(enemy[dr].angle, 13);
4478 y = y + ypart(enemy[dr].angle, 13);
4479 circlefill(bmp, (x), y, 5, col1);
4480 circle(bmp, (x), y, 5, col2);
4481 break;
4482 case ENEMY_BOSS3_TURRET2:
4483 circlefill(bmp, (x), y, 14, col1);
4484 circle(bmp, (x), y, 14, col2);
4485 x1 = x + xpart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 7);
4486 y1 = y + ypart(enemy[dr].angle + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 7);
4487 circlefill(bmp, x1, y1, 2, col1);
4488 circle(bmp, x1, y1, 2, col2);
4489 x1 = x + xpart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 7);
4490 y1 = y + ypart(enemy[dr].angle - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 7);
4491 circlefill(bmp, x1, y1, 2, col1);
4492 circle(bmp, x1, y1, 2, col2);
4493 break;
4494 case ENEMY_BOSS3_TURRET3:
4495 circlefill(bmp, (x), y, 14, col1);
4496 circle(bmp, (x), y, 14, col2);
4497 xa = 13;
4498 if (enemy[dr].attribute [0] > 0)
4499 xa = 11 - enemy[dr].attribute [0] / 8;
4500 if (enemy[dr].attribute [0] >= 48)
4501 xa = 5;
4502 x = x + xpart(enemy[dr].angle, xa);
4503 y = y + ypart(enemy[dr].angle, xa);
4504 circlefill(bmp, (x), y, 4, col1);
4505 circle(bmp, (x), y, 4, col2);
4506 break;
4507 case ENEMY_FIGHTER5:
4508 case ENEMY_FIGHTER4:
4509 case ENEMY_FIGHTER3:
4510 case ENEMY_FIGHTER2:
4511 case ENEMY_FIGHTER1:
4512 circlefill(bmp, (x), y, 8, col1);
4513 circle(bmp, (x), y, 8, col2);
4514 // x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 10);
4515 // y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 10);
4516 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 10);
4517 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 10);
4518 circlefill(bmp, (x1), y1, 3, col1);
4519 circle(bmp, (x1), y1, 3, col2);
4520 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH, 10);
4521 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH, 10);
4522 circlefill(bmp, (x1), y1, 3, col1);
4523 circle(bmp, (x1), y1, 3, col2);
4524 break;
4525 case ENEMY_LEAPER2:
4526 case ENEMY_LEAPER1:
4527 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER, 25);
4528 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER, 25);
4529 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER + ANGLE_1_EIGHTH, 19);
4530 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER + ANGLE_1_EIGHTH, 19);
4531 triangle(bmp, x, y, x1, y1, x2, y2, eclass[enemy[dr].type].colour1 - 1);
4532 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER , 26);
4533 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER, 26);
4534 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER + ANGLE_1_EIGHTH + 16, 20);
4535 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER + ANGLE_1_EIGHTH + 16, 20);
4536 line(bmp, x, y, x1, y1, GC_GREY1); // was col2
4537 line(bmp, x2, y2, x1, y1, GC_GREY1);
4538 line(bmp, x, y, x2, y2, GC_GREY1);
4539 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER, 25);
4540 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER, 25);
4541 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER - ANGLE_1_EIGHTH, 19);
4542 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER - ANGLE_1_EIGHTH, 19);
4543 triangle(bmp, x, y, x1, y1, x2, y2, eclass[enemy[dr].type].colour1 - 1);
4544 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER, 26);
4545 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER, 26);
4546 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER - ANGLE_1_EIGHTH - 16, 20);
4547 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER - ANGLE_1_EIGHTH - 16, 20);
4548 line(bmp, x, y, x1, y1, GC_GREY1);
4549 line(bmp, x2, y2, x1, y1, GC_GREY1);
4550 line(bmp, x, y, x2, y2, GC_GREY1);
4551 circlefill(bmp, (x), y, 9, col1);
4552 circle(bmp, (x), y, 9, col2);
4553 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 11);
4554 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 11);
4555 circlefill(bmp, (x1), y1, 4, col1);
4556 circle(bmp, (x1), y1, 4, col2);
4557 break;
4558 case ENEMY_MESSENGER:
4559 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4560 x1 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 25);
4561 y1 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 25);
4562 x2 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_SIXTEENTH, 23);
4563 y2 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_SIXTEENTH, 23);
4564 triangle(bmp, x, y, x1, y1, x2, y2, TRANS_DBLUE); //, eclass[enemy[dr].type].colour1 - 2);
4565 x1 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 26);
4566 y1 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 26);
4567 x2 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_SIXTEENTH + 16, 23);
4568 y2 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF - ANGLE_1_SIXTEENTH + 16, 23);
4569 // line(bmp, x, y, x1, y1, GC_GREY1); // was col2
4570 // line(bmp, x2, y2, x1, y1, GC_GREY1);
4571 // line(bmp, x, y, x2, y2, GC_GREY1);
4572 x1 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 25);
4573 y1 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 25);
4574 x2 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_SIXTEENTH, 23);
4575 y2 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_SIXTEENTH, 23);
4576 triangle(bmp, x, y, x1, y1, x2, y2, TRANS_DBLUE);//eclass[enemy[dr].type].colour1 - 2);
4577 x1 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 26);
4578 y1 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 26);
4579 x2 = x + xpart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_SIXTEENTH - 16, 23);
4580 y2 = y + ypart(enemy[dr].attribute [1] + ANGLE_HALF + ANGLE_1_SIXTEENTH - 16, 23);
4581 // line(bmp, x, y, x1, y1, GC_GREY1); // was col2
4582 // line(bmp, x2, y2, x1, y1, GC_GREY1);
4583 // line(bmp, x, y, x2, y2, GC_GREY1);
4584 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_SIXTEENTH, 22);
4585 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_SIXTEENTH, 22);
4586 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_SIXTEENTH, 22);
4587 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_SIXTEENTH, 22);
4588 triangle(bmp, x, y, x1, y1, x2, y2, TRANS_LBLUE);//, eclass[enemy[dr].type].colour1 - 1);
4589 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_SIXTEENTH, 23);
4590 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_SIXTEENTH, 23);
4591 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_SIXTEENTH - 12, 23);
4592 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_SIXTEENTH - 12, 23);
4593 // line(bmp, x, y, x1, y1, GC_GREY1); // was col2
4594 // line(bmp, x2, y2, x1, y1, GC_GREY1);
4595 // line(bmp, x, y, x2, y2, GC_GREY1);
4596 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
4597 circlefill(bmp, (x), y, 7, col1);
4598 circle(bmp, (x), y, 7, col2);
4599 /* x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 11);
4600 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 11);
4601 circlefill(bmp, (x1), y1, 4, col1);
4602 circle(bmp, (x1), y1, 4, col2);*/
4603 break;
4604 case ENEMY_BOMBER1:
4605 circlefill(bmp, (x), y, 10, col1);
4606 circle(bmp, (x), y, 10, col2);
4607 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4608 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4609 circlefill(bmp, (x1), y1, 3, COLOUR_ORANGE5);
4610 circle(bmp, (x1), y1, 3, COLOUR_ORANGE1);
4611 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4612 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4613 circlefill(bmp, (x1), y1, 3, COLOUR_ORANGE5);
4614 circle(bmp, (x1), y1, 3, COLOUR_ORANGE1);
4615 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 11);
4616 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 11);
4617 circlefill(bmp, (x1), y1, 3, COLOUR_ORANGE5);
4618 circle(bmp, (x1), y1, 3, COLOUR_ORANGE1);
4619 break;
4620 case ENEMY_BOMBER2:
4621 col3 = COLOUR_ORANGE5;//enemy[dr].colours [1];
4622 col4 = COLOUR_ORANGE2;//enemy[dr].colours [0] - 2;
4623 // radangle = angle_to_radians(enemy[dr].angle);
4624 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 16);
4625 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 16);
4626 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3) + 5, 23);
4627 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3) + 5, 23);
4628 x3 = x + xpart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3) - 5, 23);
4629 y3 = y + ypart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3) - 5, 23);
4630 triangle(bmp, x1, y1, x2, y2, x3, y3, col3);
4631 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 17);
4632 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 17);
4633 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3), 25);
4634 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3), 25);
4635 x3 = x + xpart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3), 25);
4636 y3 = y + ypart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3), 25);
4637 pline(bmp, x1, y1, x2, y2, col4);
4638 pline(bmp, x1, y1, x3, y3, col4);
4639 pline(bmp, x2, y2, x3, y3, col4);
4640 // circlefill(bmp, (x1), y1, 3, col1);
4641 // circle(bmp, (x1), y1, 3, col2);
4642 // circlefill(bmp, (x), y, 7, col1);
4643 // circle(bmp, (x), y, 7, col2);
4644 // x1 = x + cos(angle_to_radians(enemy[dr].angle + ANGLE_HALF)) * 6;
4645 // y1 = y + sin(angle_to_radians(enemy[dr].angle + ANGLE_HALF)) * 6;
4646 circlefill(bmp, (x), y, 10, col1);
4647 circle(bmp, (x), y, 10, col2);
4648 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4649 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4650 circlefill(bmp, (x1), y1, 3, COLOUR_BLUE5);
4651 circle(bmp, (x1), y1, 3, COLOUR_BLUE1);
4652 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4653 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4654 circlefill(bmp, (x1), y1, 3, COLOUR_BLUE5);
4655 circle(bmp, (x1), y1, 3, COLOUR_BLUE1);
4656 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 11);
4657 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 11);
4658 circlefill(bmp, (x1), y1, 3, COLOUR_BLUE5);
4659 circle(bmp, (x1), y1, 3, COLOUR_BLUE1);
4660 break;
4661 case ENEMY_BOMBER3:
4662 col3 = COLOUR_ORANGE5;//enemy[dr].colours [1];
4663 col4 = COLOUR_ORANGE2;//enemy[dr].colours [0] - 2;
4664 // radangle = angle_to_radians(enemy[dr].angle);
4665 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 16);
4666 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 16);
4667 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3), 23);
4668 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3), 23);
4669 x3 = x + xpart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3), 23);
4670 y3 = y + ypart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3), 23);
4671 triangle(bmp, x1, y1, x2, y2, x3, y3, col3);
4672 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 17);
4673 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 17);
4674 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3), 25);
4675 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF + (ANGLE_FULL / 3), 25);
4676 x3 = x + xpart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3), 25);
4677 y3 = y + ypart(enemy[dr].angle + ANGLE_HALF - (ANGLE_FULL / 3), 25);
4678 pline(bmp, x1, y1, x2, y2, col4);
4679 pline(bmp, x1, y1, x3, y3, col4);
4680 pline(bmp, x2, y2, x3, y3, col4);
4681 circlefill(bmp, (x), y, 10, col1);
4682 circle(bmp, (x), y, 10, col2);
4683 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4684 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_SIXTEENTH, 12);
4685 circlefill(bmp, (x1), y1, 3, COLOUR_GREY5);
4686 circle(bmp, (x1), y1, 3, COLOUR_GREY1);
4687 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4688 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_SIXTEENTH, 12);
4689 circlefill(bmp, (x1), y1, 3, COLOUR_GREY5);
4690 circle(bmp, (x1), y1, 3, COLOUR_GREY1);
4691 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF, 11);
4692 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF, 11);
4693 circlefill(bmp, (x1), y1, 3, COLOUR_GREY5);
4694 circle(bmp, (x1), y1, 3, COLOUR_GREY1);
4695 break;
4696 case ENEMY_CRUISER4:
4697 case ENEMY_CRUISER3:
4698 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER, 21);
4699 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_QUARTER, 21);
4700 circlefill(bmp, (x1), y1, 6, col1 - 1);
4701 circle(bmp, (x1), y1, 6, col2);
4702 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER, 21);
4703 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_QUARTER, 21);
4704 circlefill(bmp, (x1), y1, 6, col1 - 1);
4705 circle(bmp, (x1), y1, 6, col2);
4706 case ENEMY_CRUISER1:
4707 case ENEMY_CRUISER2:
4708 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 21);
4709 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 21);
4710 circlefill(bmp, (x1), y1, 6, col1 - 1);
4711 circle(bmp, (x1), y1, 6, col2);
4712 x1 = x + xpart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH, 21);
4713 y1 = y + ypart(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH, 21);
4714 circlefill(bmp, (x1), y1, 6, col1 - 1);
4715 circle(bmp, (x1), y1, 6, col2);
4716 circlefill(bmp, (x), y, 19, col1);
4717 circle(bmp, (x), y, 19, col2);
4718 // x1 = x + xpart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 10);
4719 // y1 = y + ypart(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH, 10);
4720 // textprintf_ex(bmp, small_font, x, y, COLOUR_GREY6, -1, "%i: %i %i %i %i", dr, enemy[dr].turret [0], enemy[dr].turret [1], enemy[dr].turret [2], enemy[dr].turret [3]);
4721 break;
4722 case ENEMY_DEFENDER2_TURRET3:
4723 case ENEMY_CRUISER2_TURRET:
4724 case ENEMY_CRUISER3_TURRET:
4725 case ENEMY_CRUISER4_TURRET:
4726 circlefill(bmp, (x), y, 9, col1);
4727 circle(bmp, (x), y, 9, col2);
4728 xa = 9;
4729 if (enemy[dr].attribute [0] > 0)
4730 xa = 9 - enemy[dr].attribute [0];
4731 if (enemy[dr].attribute [0] >= 6)
4732 xa = 6;
4733 x1 = x + xpart(enemy[dr].angle, xa);
4734 y1 = y + ypart(enemy[dr].angle, xa);
4735 circlefill(bmp, (x1), y1, 3, col1);
4736 circle(bmp, (x1), y1, 3, col2);
4737 // textprintf_ex(bmp, small_font, x, y, COLOUR_GREY6, -1, "m%i i%i %i %i %i %i", enemy[dr].turret_main, enemy[dr].turret_index, enemy[dr].turret [0], enemy[dr].turret [1], enemy[dr].turret [2], enemy[dr].turret [3]);
4738 break;
4739 case ENEMY_CRUISER1_TURRET:
4740 circlefill(bmp, (x), y, 9, col1);
4741 circle(bmp, (x), y, 9, col2);
4742 xa = 9;
4743 if (enemy[dr].attribute [0] > 0)
4744 xa = 9 - enemy[dr].attribute [0];
4745 if (enemy[dr].attribute [0] >= 6)
4746 xa = 6;
4747 x1 = x + xpart(enemy[dr].angle, xa);
4748 y1 = y + ypart(enemy[dr].angle, xa);
4749 circlefill(bmp, (x1), y1, 3, col1);
4750 circle(bmp, (x1), y1, 3, col2);
4751 // textprintf_ex(bmp, small_font, x, y, COLOUR_GREY6, -1, "m%i i%i %i %i %i %i", enemy[dr].turret_main, enemy[dr].turret_index, enemy[dr].turret [0], enemy[dr].turret [1], enemy[dr].turret [2], enemy[dr].turret [3]);
4752 break;
4753 case ENEMY_SHADOW1:
4754 if (enemy[dr].attribute [0] == 0)
4755 break; // invisible! this is nasty
4756 if (enemy[dr].attribute [0] > 9)
4757 {
4758 col3 = GC_BLUE4;
4759 col4 = GC_BLUE1;
4760 if (enemy[dr].attribute [0] > 70)
4761 {
4762 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4763 col1 = TRANS_WHITE;
4764 col2 = TRANS_WHITE;
4765 col3 = TRANS_WHITE;
4766 col4 = TRANS_WHITE;
4767 if (enemy[dr].attribute [0] > 72)
4768 {
4769 col1 = TRANS_LGREY;
4770 col2 = TRANS_LGREY;
4771 col3 = TRANS_LGREY;
4772 col4 = TRANS_LGREY;
4773 }
4774 if (enemy[dr].attribute [0] > 75)
4775 {
4776 col1 = TRANS_DGREY;
4777 col2 = TRANS_DGREY;
4778 col3 = TRANS_DGREY;
4779 col4 = TRANS_DGREY;
4780 }
4781 }
4782 }
4783 else
4784 {
4785 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4786 col1 = TRANS_DBLUE;
4787 col2 = TRANS_DBLUE;
4788 col3 = TRANS_DBLUE;
4789 col4 = TRANS_DBLUE;
4790 if (enemy[dr].attribute [0] > 3)
4791 {
4792 col1 = TRANS_LBLUE;
4793 col2 = TRANS_DBLUE;
4794 col3 = TRANS_LBLUE;
4795 col4 = TRANS_DBLUE;
4796 }
4797 if (enemy[dr].attribute [0] > 6)
4798 {
4799 col1 = TRANS_WHITE;
4800 col2 = TRANS_WHITE;
4801 col3 = TRANS_WHITE;
4802 col4 = TRANS_DGREY;
4803 }
4804 if (enemy[dr].hurt_pulse > 0)
4805 col1 = TRANS_WHITE;
4806 }
4807 triangle(bmp, x - 4, y - 4, x - 50, y - 4, x - 4, y - 27, col3);
4808 pline(bmp, x - 4, y - 4, x - 50, y - 4, col4);
4809 pline(bmp, x - 4, y - 4, x - 4, y - 27, col4);
4810 pline(bmp, x - 4, y - 27, x - 50, y - 4, col4);
4811 triangle(bmp, x + 4, y - 4, x + 50, y - 4, x + 4, y - 27, col3);
4812 pline(bmp, x + 4, y - 4, x + 50, y - 4, col4);
4813 pline(bmp, x + 4, y - 4, x + 4, y - 27, col4);
4814 pline(bmp, x + 4, y - 27, x + 50, y - 4, col4);
4815 triangle(bmp, x + 4, y + 4, x + 50, y + 4, x + 4, y + 27, col3);
4816 pline(bmp, x + 4, y + 4, x + 50, y + 4, col4);
4817 pline(bmp, x + 4, y + 4, x + 4, y + 27, col4);
4818 pline(bmp, x + 4, y + 27, x + 50, y + 4, col4);
4819 triangle(bmp, x - 4, y + 4, x - 50, y + 4, x - 4, y + 27, col3);
4820 pline(bmp, x - 4, y + 4, x - 50, y + 4, col4);
4821 pline(bmp, x - 4, y + 4, x - 4, y + 27, col4);
4822 pline(bmp, x - 4, y + 27, x - 50, y + 4, col4);
4823 circlefill(bmp, (x), y, 12, col1);
4824 circle(bmp, (x), y, 12, col2);
4825 x1 = x + xpart(enemy[dr].angle, 11);
4826 y1 = y + ypart(enemy[dr].angle, 11);
4827 circlefill(bmp, (x1), y1, 3, col1);
4828 circle(bmp, (x1), y1, 3, col2);
4829 // if (enemy[dr].attribute [0] <= 15)
4830 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
4831 break;
4832 case ENEMY_SHADOW2:
4833 if (enemy[dr].attribute [0] == 0)
4834 break; // invisible! this is nasty
4835 if (enemy[dr].attribute [0] > 9)
4836 {
4837 col3 = GC_GREY4;
4838 col4 = GC_GREY1;
4839 if (enemy[dr].attribute [0] > 50)
4840 {
4841 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4842 col1 = TRANS_WHITE;
4843 col2 = TRANS_WHITE;
4844 col3 = TRANS_WHITE;
4845 col4 = TRANS_WHITE;
4846 if (enemy[dr].attribute [0] > 52)
4847 {
4848 col1 = TRANS_LGREY;
4849 col2 = TRANS_LGREY;
4850 col3 = TRANS_LGREY;
4851 col4 = TRANS_LGREY;
4852 }
4853 if (enemy[dr].attribute [0] > 55)
4854 {
4855 col1 = TRANS_DGREY;
4856 col2 = TRANS_DGREY;
4857 col3 = TRANS_DGREY;
4858 col4 = TRANS_DGREY;
4859 }
4860 }
4861 }
4862 else
4863 {
4864 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4865 col1 = TRANS_DGREY;
4866 col2 = TRANS_DGREY;
4867 col3 = TRANS_DGREY;
4868 col4 = TRANS_DGREY;
4869 if (enemy[dr].attribute [0] > 3)
4870 {
4871 col1 = TRANS_LGREY;
4872 col2 = TRANS_DGREY;
4873 col3 = TRANS_LGREY;
4874 col4 = TRANS_DGREY;
4875 }
4876 if (enemy[dr].attribute [0] > 6)
4877 {
4878 col1 = TRANS_WHITE;
4879 col2 = TRANS_WHITE;
4880 col3 = TRANS_WHITE;
4881 col4 = TRANS_DGREY;
4882 }
4883 if (enemy[dr].hurt_pulse > 0)
4884 col1 = TRANS_WHITE;
4885 }
4886 triangle(bmp, x - 4, y - 4, x - 30, y - 4, x - 4, y - 52, col3);
4887 pline(bmp, x - 4, y - 4, x - 30, y - 4, col4);
4888 pline(bmp, x - 4, y - 4, x - 4, y - 52, col4);
4889 pline(bmp, x - 4, y - 52, x - 30, y - 4, col4);
4890 triangle(bmp, x + 4, y - 4, x + 30, y - 4, x + 4, y - 52, col3);
4891 pline(bmp, x + 4, y - 4, x + 30, y - 4, col4);
4892 pline(bmp, x + 4, y - 4, x + 4, y - 52, col4);
4893 pline(bmp, x + 4, y - 52, x + 30, y - 4, col4);
4894 triangle(bmp, x + 4, y + 4, x + 30, y + 4, x + 4, y + 52, col3);
4895 pline(bmp, x + 4, y + 4, x + 30, y + 4, col4);
4896 pline(bmp, x + 4, y + 4, x + 4, y + 52, col4);
4897 pline(bmp, x + 4, y + 52, x + 30, y + 4, col4);
4898 triangle(bmp, x - 4, y + 4, x - 30, y + 4, x - 4, y + 52, col3);
4899 pline(bmp, x - 4, y + 4, x - 30, y + 4, col4);
4900 pline(bmp, x - 4, y + 4, x - 4, y + 52, col4);
4901 pline(bmp, x - 4, y + 52, x - 30, y + 4, col4);
4902 circlefill(bmp, (x), y, 12, col1);
4903 circle(bmp, (x), y, 12, col2);
4904 x1 = x + xpart(enemy[dr].angle, 11);
4905 y1 = y + ypart(enemy[dr].angle, 11);
4906 circlefill(bmp, (x1), y1, 4, col1);
4907 circle(bmp, (x1), y1, 4, col2);
4908 // if (enemy[dr].attribute [0] <= 15)
4909 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
4910 break;
4911
4912
4913 /* case ENEMY_BOUNCER:
4914 circlefill(bmp, (x), y, 7, col1);
4915 circle(bmp, (x), y, 7, col2);
4916 break;
4917 case ENEMY_BOUNCER2:
4918 col4 = enemy[dr].colours [0] - 2;
4919 x1 = x + xpart(enemy[dr].angle, 12);
4920 y1 = y + ypart(enemy[dr].angle, 12);
4921 x2 = x + xpart(enemy[dr].angle + ANGLE_HALF, 12);
4922 y2 = y + ypart(enemy[dr].angle + ANGLE_HALF, 12);
4923 pline(bmp, x1, y1, x2, y2, col4);
4924 circlefill(bmp, (x), y, 7, col1);
4925 circle(bmp, (x), y, 7, col2);
4926 break;
4927 case ENEMY_FIGHTER:
4928 circlefill(bmp, (x), y, 8, col1);
4929 circle(bmp, (x), y, 8, col2);
4930 x1 = x + cos(angle_to_radians(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH)) * 6;
4931 y1 = y + sin(angle_to_radisans(enemy[dr].angle + ANGLE_HALF - ANGLE_1_EIGHTH)) * 6;
4932 circlefill(bmp, (x1), y1, 3, col1);
4933 circle(bmp, (x1), y1, 3, col2);
4934 x1 = x + cos(angle_to_radians(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH)) * 6;
4935 y1 = y + sin(angle_to_radians(enemy[dr].angle + ANGLE_HALF + ANGLE_1_EIGHTH)) * 6;
4936 circlefill(bmp, (x1), y1, 3, col1);
4937 circle(bmp, (x1), y1, 3, col2);
4938 break;
4939 case ENEMY_BOSS2:
4940 col3 = enemy[dr].colours [1];
4941 col4 = enemy[dr].colours [0] - 2;
4942 circlefill(bmp, (x), y, 90, col3);
4943 circle(bmp, (x), y, 90, col4);
4944 x1 = cos(angle_to_radians(enemy[dr].angle)) * (90);
4945 y1 = sin(angle_to_radians(enemy[dr].angle)) * (90);
4946 line(bmp, x + x1, y + y1, x - x1, y - y1, col4);
4947 x1 = cos(angle_to_radians(enemy[dr].angle + ANGLE_QUARTER)) * (90);
4948 y1 = sin(angle_to_radians(enemy[dr].angle + ANGLE_QUARTER)) * (90);
4949 line(bmp, x + x1, y + y1, x - x1, y - y1, col4);
4950 circlefill(bmp, (x), y, 27, col1);
4951 circle(bmp, (x), y, 27, col2);
4952 break;
4953 case ENEMY_BOSS2_TURRET:
4954 if (enemy[dr].recycle < 20 && enemy[dr].recycle % 4 < 2)// && enemy[dr].burst_fire <= 0)
4955 col1 += 3;
4956 circlefill(bmp, (x), y, 15, col1);
4957 circle(bmp, (x), y, 15, col2);
4958 break;
4959 case ENEMY_SWERVER:
4960 col3 = enemy[dr].colours [1];
4961 col4 = enemy[dr].colours [0] - 2;
4962 radangle = angle_to_radians(enemy[dr].angle);
4963 x1 = (x) + cos(radangle) * (13);
4964 y1 = (y) + sin(radangle) * (13);
4965 x2 = (x) + cos(radangle + (PI * 2) / 3) * 11;
4966 y2 = (y) + sin(radangle + (PI * 2) / 3) * 11;
4967 x3 = (x) + cos(radangle - (PI * 2) / 3) * 11;
4968 y3 = (y) + sin(radangle - (PI * 2) / 3) * 11;
4969 triangle(bmp, x1, y1, x2, y2, x3, y3, col3);
4970 line(bmp, x1, y1, x2, y2, col4);
4971 line(bmp, x1, y1, x3, y3, col4);
4972 line(bmp, x2, y2, x3, y3, col4);
4973 circlefill(bmp, (x), y, 7, col1);
4974 circle(bmp, (x), y, 7, col2);
4975 break;
4976 case ENEMY_SWERVER2:
4977 col3 = enemy[dr].colours [1];
4978 col4 = enemy[dr].colours [0] - 2;
4979 radangle = angle_to_radians(enemy[dr].angle);
4980 x1 = (x) + cos(radangle + PI) * (11);
4981 y1 = (y) + sin(radangle + PI) * (11);
4982 x2 = (x) + cos(radangle + PI + (PI * 2) / 3) * 14;
4983 y2 = (y) + sin(radangle + PI + (PI * 2) / 3) * 14;
4984 x3 = (x) + cos(radangle + PI - (PI * 2) / 3) * 14;
4985 y3 = (y) + sin(radangle + PI - (PI * 2) / 3) * 14;
4986 triangle(bmp, x1, y1, x2, y2, x3, y3, col3);
4987 line(bmp, x1, y1, x2, y2, col4);
4988 line(bmp, x1, y1, x3, y3, col4);
4989 line(bmp, x2, y2, x3, y3, col4);
4990 circlefill(bmp, (x), y, 7, col1);
4991 circle(bmp, (x), y, 7, col2);
4992 break;
4993 case ENEMY_CLOAKER:
4994 col1 = COLOUR_BLACK;
4995 col2 = COLOUR_BLACK;
4996 col3 = COLOUR_BLACK;
4997 col4 = COLOUR_BLACK;
4998 if (enemy[dr].attribute [ATTRIB_CLOAKER_PULSE] > 0)
4999 {
5000 col1 = enemy[dr].colours [0] + enemy[dr].attribute [ATTRIB_CLOAKER_PULSE] / 12;
5001 col2 = enemy[dr].colours [1] + enemy[dr].attribute [ATTRIB_CLOAKER_PULSE] / 6;
5002 if (col1 > enemy[dr].colours [0] + 7)
5003 col1 = enemy[dr].colours [0] + 7;
5004 if (col2 > enemy[dr].colours [1] + 7)
5005 col2 = enemy[dr].colours [1] + 7;
5006 col3 = enemy[dr].colours [0] + enemy[dr].attribute [ATTRIB_CLOAKER_PULSE] / 6;
5007 col4 = enemy[dr].colours [1] + enemy[dr].attribute [ATTRIB_CLOAKER_PULSE] / 3;
5008 if (col3 > enemy[dr].colours [0] + 7)
5009 col3 = enemy[dr].colours [0] + 7;
5010 if (col4 > enemy[dr].colours [1] + 7)
5011 col4 = enemy[dr].colours [1] + 7;
5012 }
5013 triangle(bmp, x - 2, y - 2, x - 30, y - 2, x - 2, y - 15, col1);
5014 pline(bmp, x - 2, y - 2, x - 30, y - 2, col2);
5015 pline(bmp, x - 2, y - 2, x - 2, y - 15, col2);
5016 pline(bmp, x - 2, y - 15, x - 30, y - 2, col2);
5017 triangle(bmp, x + 2, y - 2, x + 30, y - 2, x + 2, y - 15, col1);
5018 pline(bmp, x + 2, y - 2, x + 30, y - 2, col2);
5019 pline(bmp, x + 2, y - 2, x + 2, y - 15, col2);
5020 pline(bmp, x + 2, y - 15, x + 30, y - 2, col2);
5021 triangle(bmp, x + 2, y + 2, x + 30, y + 2, x + 2, y + 15, col1);
5022 pline(bmp, x + 2, y + 2, x + 30, y + 2, col2);
5023 pline(bmp, x + 2, y + 2, x + 2, y + 15, col2);
5024 pline(bmp, x + 2, y + 15, x + 30, y + 2, col2);
5025 triangle(bmp, x - 2, y + 2, x - 30, y + 2, x - 2, y + 15, col1);
5026 pline(bmp, x - 2, y + 2, x - 30, y + 2, col2);
5027 pline(bmp, x - 2, y + 2, x - 2, y + 15, col2);
5028 pline(bmp, x - 2, y + 15, x - 30, y + 2, col2);
5029 circlefill(bmp, (x), y, 9, col3);
5030 circle(bmp, (x), y, 9, col4);
5031 break;
5032 case ENEMY_SUPERJELLY:
5033 x1 = (enemy[dr].attribute [ATTRIB_JELLY_PULSE] / 4) % 8;
5034 if (x1 >= 4)
5035 x1 = 8 - x1;
5036 draw_sprite(bmp, superjelly_bmp [0], (x) - 10, (y) - 24 - x1);
5037 draw_sprite_v_flip(bmp, superjelly_bmp [0], (x) - 10, (y) + 4 + x1);
5038 draw_sprite(bmp, superjelly_bmp [1], (x) + 4 + x1, (y) - 10);
5039 draw_sprite_h_flip(bmp, superjelly_bmp [1], (x) - 24 - x1, (y) - 10);
5040 circlefill(bmp, (x), y, 9, col1);
5041 circle(bmp, (x), y, 9, col2);
5042 break;
5043 case ENEMY_BEE:
5044 thing = grand(ANGLE_QUARTER);
5045 col4 = COLOUR_GREY4;
5046 radangle = angle_to_radians(enemy[dr].angle);
5047 x1 = x + cos(angle_to_radians(enemy[dr].angle + ANGLE_HALF - thing)) * 9;
5048 y1 = y + sin(angle_to_radians(enemy[dr].angle + ANGLE_HALF - thing)) * 9;
5049 line(bmp, x, y, x1, y1, col4);
5050 x1 = x + cos(angle_to_radians(enemy[dr].angle + ANGLE_HALF + thing)) * 9;
5051 y1 = y + sin(angle_to_radians(enemy[dr].angle + ANGLE_HALF + thing)) * 9;
5052 line(bmp, x, y, x1, y1, col4);
5053 x1 = x + cos(angle_to_radians(enemy[dr].angle + ANGLE_HALF)) * 4;
5054 y1 = y + sin(angle_to_radians(enemy[dr].angle + ANGLE_HALF)) * 4;
5055 col3 = enemy[dr].colours [1];
5056 col4 = enemy[dr].colours [0] - 2;
5057 circlefill(bmp, (x1), y1, 3, col3);
5058 circle(bmp, (x1), y1, 3, col4);
5059 circlefill(bmp, (x), y, 3, col1);
5060 circle(bmp, (x), y, 3, col2);
5061 break;
5062 case ENEMY_JELLY:
5063 draw_rle_sprite(bmp, enemy1_rle [RLE_ENEMY1_JELLY1 + (enemy[dr].counter / 3) % 6], (x) - 22, (y) - 8); // 11
5064 circlefill(bmp, (x), y, 12, col1);
5065 circle(bmp, (x), y, 12, col2);
5066 break;
5067 */
5068 }
5069 #ifdef DEBUG_ENEMY_SIZE
5070 circle(bmp, store_x, store_y, eclass[enemy[dr].type].radius / GRAIN, COLOUR_YELLOW2 + counter % 6);
5071 #endif
5072
5073 #ifdef DEBUG_DISPLAY
5074 if (debug_info == 1)
5075 textprintf_centre_ex(bmp, small_font, store_x, store_y, COLOUR_GREEN8, COLOUR_GREY2, "%i", enemy[dr].type);
5076 #endif
5077
5078
5079 }
5080
5081 void draw_spark_jump(BITMAP *bmp, int x1, int y1, int x2, int y2, int parts, int scatter, int col, int transy)
5082 {
5083
5084 if (transy)
5085 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5086
5087 // int sangle = radians_to_angle(atan2(y1 - y2, x1 - x2));
5088 int xstep = (x2 - x1) / parts;
5089 int ystep = (y2 - y1) / parts;
5090
5091 int i, sx1 = x1, sy1 = y1, sx2, sy2;
5092
5093 for (i = 0; i < parts; i ++)
5094 {
5095 sx2 = x1 + xstep * i;
5096 sy2 = y1 + ystep * i;
5097
5098 sx2 += grand(scatter) - grand(scatter);
5099 sy2 += grand(scatter) - grand(scatter);
5100
5101 line(bmp, sx1, sy1, sx2, sy2, col);
5102
5103 sx1 = sx2;
5104 sy1 = sy2;
5105 }
5106
5107 line(bmp, sx1, sy1, x2, y2, col);
5108
5109 if (transy)
5110 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5111
5112
5113 }
5114
5115 void draw_tri(BITMAP *bmp, int x, int y, int angle, int length1, int length2, int angle2, int col1, int col2)
5116 {
5117 int points [6];
5118
5119 points [0] = x + xpart(angle, length1);
5120 points [1] = y + ypart(angle, length1);
5121 points [2] = x + xpart(angle + angle2, length2);
5122 points [3] = y + ypart(angle + angle2, length2);
5123 points [4] = x + xpart(angle - angle2, length2);
5124 points [5] = y + ypart(angle - angle2, length2);
5125
5126 triangle(bmp, points [0], points [1], points [2], points [3], points [4], points [5], col2);
5127
5128 points [0] = x + xpart(angle, length1 + 1);
5129 points [1] = y + ypart(angle, length1 + 1);
5130 points [2] = x + xpart(angle + angle2, length2 + 1);
5131 points [3] = y + ypart(angle + angle2, length2 + 1);
5132 points [4] = x + xpart(angle - angle2, length2 + 1);
5133 points [5] = y + ypart(angle - angle2, length2 + 1);
5134 line(bmp, points [0], points [1], points [2], points [3], col1);
5135 line(bmp, points [0], points [1], points [4], points [5], col1);
5136 line(bmp, points [2], points [3], points [4], points [5], col1);
5137
5138 }
5139
5140
5141
5142 void draw_launchers(BITMAP *bmp, int x, int y, int angle, int d_f_centre, int diagonal, int interior_angle, int recoil1, int recoil2, int col1, int col2)
5143 {
5144
5145 int i;
5146 int points [8];
5147 int p1_x, p1_y;
5148
5149 for (i = 0; i < 2; i ++)
5150 {
5151 if (i == 0)
5152 {
5153 p1_x = x + xpart(angle + ANGLE_QUARTER, d_f_centre);
5154 p1_y = y + ypart(angle + ANGLE_QUARTER, d_f_centre);
5155 p1_x += xpart(angle, recoil1);
5156 p1_y += ypart(angle, recoil1);
5157 }
5158 else
5159 {
5160 p1_x = x + xpart(angle - ANGLE_QUARTER, d_f_centre);
5161 p1_y = y + ypart(angle - ANGLE_QUARTER, d_f_centre);
5162 p1_x += xpart(angle, recoil2);
5163 p1_y += ypart(angle, recoil2);
5164 }
5165
5166
5167 points [0] = p1_x + xpart(angle + interior_angle, diagonal);
5168 points [1] = p1_y + ypart(angle + interior_angle, diagonal);
5169 points [2] = p1_x + xpart(angle - interior_angle, diagonal);
5170 points [3] = p1_y + ypart(angle - interior_angle, diagonal);
5171 points [4] = p1_x - xpart(angle + interior_angle, diagonal);
5172 points [5] = p1_y - ypart(angle + interior_angle, diagonal);
5173 points [6] = p1_x - xpart(angle - interior_angle, diagonal);
5174 points [7] = p1_y - ypart(angle - interior_angle, diagonal);
5175 polygon(bmp, 4, points, col2);
5176
5177 points [0] = p1_x + xpart(angle + interior_angle, diagonal + 1);
5178 points [1] = p1_y + ypart(angle + interior_angle, diagonal + 1);
5179 points [2] = p1_x + xpart(angle - interior_angle, diagonal + 1);
5180 points [3] = p1_y + ypart(angle - interior_angle, diagonal + 1);
5181 points [4] = p1_x - xpart(angle + interior_angle, diagonal + 1);
5182 points [5] = p1_y - ypart(angle + interior_angle, diagonal + 1);
5183 points [6] = p1_x - xpart(angle - interior_angle, diagonal + 1);
5184 points [7] = p1_y - ypart(angle - interior_angle, diagonal + 1);
5185 /* points [0] = x + xpart(attribute + angle1 + (i * angle2), outward);
5186 points [1] = y + ypart(attribute + angle1 + (i * angle2), outward);
5187 points [2] = x + xpart(attribute + angle1 + (i * angle2), inward - 2);
5188 points [3] = y + ypart(attribute + angle1 + (i * angle2), inward - 2);
5189 points [4] = x + xpart(attribute - angle1 + (i * angle2), inward - 2);
5190 points [5] = y + ypart(attribute - angle1 + (i * angle2), inward - 2);
5191 points [6] = x + xpart(attribute - angle1 + (i * angle2), outward);
5192 points [7] = y + ypart(attribute - angle1 + (i * angle2), outward);*/
5193
5194
5195 pline(bmp, points [0], points [1], points [2], points [3], col1);
5196 pline(bmp, points [2], points [3], points [4], points [5], col1);
5197 pline(bmp, points [4], points [5], points [6], points [7], col1);
5198 pline(bmp, points [0], points [1], points [6], points [7], col1);
5199
5200 }
5201 }
5202
5203
5204 void draw_squarey(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2)
5205 {
5206
5207 int i;
5208 int points [8];
5209
5210 for (i = 0; i < arms; i ++)
5211 {
5212
5213 points [0] = x + xpart(attribute + angle1 + (i * angle2) - 2, outward - 1);
5214 points [1] = y + ypart(attribute + angle1 + (i * angle2) - 2, outward - 1);
5215 points [2] = x + xpart(attribute + angle1 + (i * angle2) - 2, inward - 1);
5216 points [3] = y + ypart(attribute + angle1 + (i * angle2) - 2, inward - 1);
5217 points [4] = x + xpart(attribute - angle1 + (i * angle2) + 2, inward - 1);
5218 points [5] = y + ypart(attribute - angle1 + (i * angle2) + 2, inward - 1);
5219 points [6] = x + xpart(attribute - angle1 + (i * angle2) + 2, outward - 1);
5220 points [7] = y + ypart(attribute - angle1 + (i * angle2) + 2, outward - 1);
5221 polygon(bmp, 4, points, col2);
5222
5223 points [0] = x + xpart(attribute + angle1 + (i * angle2), outward);
5224 points [1] = y + ypart(attribute + angle1 + (i * angle2), outward);
5225 points [2] = x + xpart(attribute + angle1 + (i * angle2), inward - 2);
5226 points [3] = y + ypart(attribute + angle1 + (i * angle2), inward - 2);
5227 points [4] = x + xpart(attribute - angle1 + (i * angle2), inward - 2);
5228 points [5] = y + ypart(attribute - angle1 + (i * angle2), inward - 2);
5229 points [6] = x + xpart(attribute - angle1 + (i * angle2), outward);
5230 points [7] = y + ypart(attribute - angle1 + (i * angle2), outward);
5231
5232
5233 pline(bmp, points [0], points [1], points [2], points [3], col1);
5234 pline(bmp, points [2], points [3], points [4], points [5], col1);
5235 pline(bmp, points [4], points [5], points [6], points [7], col1);
5236 pline(bmp, points [0], points [1], points [6], points [7], col1);
5237
5238 }
5239 }
5240
5241 void draw_orbiter(BITMAP *bmp, int x, int y, int attribute, int out1, int out2, int out3, int angle1, int angle2, int arms, int col1, int col2)
5242 {
5243
5244 int i;
5245 int points [8];
5246
5247 for (i = 0; i < arms; i ++)
5248 {
5249
5250 points [0] = x + xpart(attribute + (i * angle2) - 2, out1 + 1);
5251 points [1] = y + ypart(attribute + (i * angle2) - 2, out1 + 1);
5252 points [2] = x + xpart(attribute + angle1 + (i * angle2) - 10, out2 - 0);
5253 points [3] = y + ypart(attribute + angle1 + (i * angle2) - 10, out2 - 0);
5254 points [4] = x + xpart(attribute + (i * angle2) - 2, out3 - 1);
5255 points [5] = y + ypart(attribute + (i * angle2) - 2, out3 - 1);
5256 points [6] = x + xpart(attribute - angle1 + (i * angle2) + 10, out2 - 0);
5257 points [7] = y + ypart(attribute - angle1 + (i * angle2) + 10, out2 - 0);
5258 polygon(bmp, 4, points, col2);
5259
5260 points [0] = x + xpart(attribute + (i * angle2), out1);
5261 points [1] = y + ypart(attribute + (i * angle2), out1);
5262 points [2] = x + xpart(attribute + angle1 + (i * angle2), out2);
5263 points [3] = y + ypart(attribute + angle1 + (i * angle2), out2);
5264 points [4] = x + xpart(attribute + (i * angle2), out3);
5265 points [5] = y + ypart(attribute + (i * angle2), out3);
5266 points [6] = x + xpart(attribute - angle1 + (i * angle2), out2);
5267 points [7] = y + ypart(attribute - angle1 + (i * angle2), out2);
5268 pline(bmp, points [0], points [1], points [2], points [3], col1);
5269 pline(bmp, points [2], points [3], points [4], points [5], col1);
5270 pline(bmp, points [4], points [5], points [6], points [7], col1);
5271 pline(bmp, points [0], points [1], points [6], points [7], col1);
5272
5273 }
5274 }
5275
5276
5277
5278 void draw_puffer(BITMAP *bmp, int x, int y, int angle, int number, int distance, int size, int incol, int outcol)
5279 {
5280
5281 int i, x1, y1, apart = 128 / number;
5282
5283 for (i = 0; i < number; i ++)
5284 {
5285 x1 = x + xpart(((angle + i * apart) * 8) % 1024, distance);
5286 y1 = y + ypart(((angle + i * apart) * 8) % 1024, distance);
5287 circlefill(bmp, x1, y1, size, incol);
5288 circle(bmp, x1, y1, size, outcol);
5289 }
5290
5291 }
5292
5293 void draw_spinner(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2)
5294 {
5295
5296 int i, x1, x2, x3, y1, y2, y3;
5297
5298 for (i = 0; i < arms; i ++)
5299 {
5300 x1 = x + xpart(attribute + angle1 + (i * angle2) - 8, outward - 1);
5301 y1 = y + ypart(attribute + angle1 + (i * angle2) - 8, outward - 1);
5302 x2 = x + xpart(attribute - angle1 + (i * angle2) + 8, outward - 1);
5303 y2 = y + ypart(attribute - angle1 + (i * angle2) + 8, outward - 1);
5304 x3 = x - xpart(attribute + (i * angle2), inward - 3);
5305 y3 = y - ypart(attribute + (i * angle2), inward - 3);
5306 triangle(bmp, x1, y1, x2, y2, x3, y3, col2);
5307 x1 = x + xpart(attribute + angle1 + (i * angle2), outward);
5308 y1 = y + ypart(attribute + angle1 + (i * angle2), outward);
5309 x2 = x + xpart(attribute - angle1 + (i * angle2), outward);
5310 y2 = y + ypart(attribute - angle1 + (i * angle2), outward);
5311 x3 = x - xpart(attribute + (i * angle2), inward);
5312 y3 = y - ypart(attribute + (i * angle2), inward);
5313 pline(bmp, x1, y1, x2, y2, col1);
5314 pline(bmp, x1, y1, x3, y3, col1);
5315 pline(bmp, x2, y2, x3, y3, col1);
5316
5317
5318 }
5319 }
5320
5321 void draw_overspinner(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2)
5322 {
5323
5324 int i, x1, x2, x3, y1, y2, y3;
5325
5326 for (i = 0; i < arms; i ++)
5327 {
5328
5329 x1 = x + xpart(attribute + angle1 + (i * angle2) - 1, outward - 0);
5330 y1 = y + ypart(attribute + angle1 + (i * angle2) - 1, outward - 0);
5331 x2 = x + xpart(attribute - angle1 + (i * angle2) + 1, outward - 0);
5332 y2 = y + ypart(attribute - angle1 + (i * angle2) + 1, outward - 0);
5333 x3 = x - xpart(attribute + (i * angle2), inward - 1);
5334 y3 = y - ypart(attribute + (i * angle2), inward - 1);
5335 triangle(bmp, x1, y1, x2, y2, x3, y3, col2);
5336 x1 = x + xpart(attribute + angle1 + (i * angle2), outward + 1);
5337 y1 = y + ypart(attribute + angle1 + (i * angle2), outward + 1);
5338 x2 = x + xpart(attribute - angle1 + (i * angle2), outward + 1);
5339 y2 = y + ypart(attribute - angle1 + (i * angle2), outward + 1);
5340 x3 = x - xpart(attribute + (i * angle2), inward);
5341 y3 = y - ypart(attribute + (i * angle2), inward);
5342 pline(bmp, x1, y1, x2, y2, col1);
5343 pline(bmp, x1, y1, x3, y3, col1);
5344 pline(bmp, x2, y2, x3, y3, col1);
5345
5346 }
5347 }
5348
5349 void draw_waver(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2, RLE_SPRITE *waver_rle, int waver_rle_size)
5350 {
5351
5352 int i, x1, x2, x3, y1, y2, y3;
5353
5354 for (i = 0; i < arms; i ++)
5355 {
5356 x1 = x + xpart(attribute + (i * angle2), outward - 1 + waver_rle_size / 2 + 6) - waver_rle_size;
5357 y1 = y + ypart(attribute + (i * angle2), outward - 1 + waver_rle_size / 2 + 6) - waver_rle_size;
5358 draw_rle_sprite(bmp, waver_rle, x1, y1);
5359 x1 = x + xpart(attribute + angle1 + (i * angle2) - 4, outward - 1);
5360 y1 = y + ypart(attribute + angle1 + (i * angle2) - 4, outward - 1);
5361 x2 = x + xpart(attribute - angle1 + (i * angle2) + 4, outward - 1);
5362 y2 = y + ypart(attribute - angle1 + (i * angle2) + 4, outward - 1);
5363 x3 = x - xpart(attribute + (i * angle2), inward - 3);
5364 y3 = y - ypart(attribute + (i * angle2), inward - 3);
5365 triangle(bmp, x1, y1, x2, y2, x3, y3, col2);
5366 x1 = x + xpart(attribute + angle1 + (i * angle2), outward - 2);
5367 y1 = y + ypart(attribute + angle1 + (i * angle2), outward - 2);
5368 x2 = x + xpart(attribute - angle1 + (i * angle2), outward - 2);
5369 y2 = y + ypart(attribute - angle1 + (i * angle2), outward - 2);
5370 x3 = x - xpart(attribute + (i * angle2), inward);
5371 y3 = y - ypart(attribute + (i * angle2), inward);
5372 // pline(bmp, x1, y1, x2, y2, col1);
5373 pline(bmp, x1, y1, x3, y3, col1);
5374 pline(bmp, x2, y2, x3, y3, col1);
5375
5376
5377 }
5378 }
5379
5380
5381 void draw_spikey(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2, int in_correction, int out_correction)
5382 {
5383
5384 int i, x1, x2, x3, y1, y2, y3;
5385
5386 for (i = 0; i < arms; i ++)
5387 {
5388 /* bordered_triangle(bmp,
5389 x - xpart(attribute + angle1 + (i * angle2), inward),
5390 y - ypart(attribute + angle1 + (i * angle2), inward),
5391 x - xpart(attribute - angle1 + (i * angle2), inward),
5392 y - ypart(attribute - angle1 + (i * angle2), inward),
5393 x + xpart(attribute + (i * angle2), outward),
5394 y + ypart(attribute + (i * angle2), outward),
5395 col2, col1);*/
5396 x1 = x - xpart(attribute + angle1 + (i * angle2), inward + in_correction);
5397 y1 = y - ypart(attribute + angle1 + (i * angle2), inward + in_correction);
5398 x2 = x - xpart(attribute - angle1 + (i * angle2), inward + in_correction);
5399 y2 = y - ypart(attribute - angle1 + (i * angle2), inward + in_correction);
5400 x3 = x + xpart(attribute + (i * angle2), outward + out_correction);
5401 y3 = y + ypart(attribute + (i * angle2), outward + out_correction);
5402 triangle(bmp, x1, y1, x2, y2, x3, y3, col2);
5403 x1 = x - xpart(attribute + angle1 + (i * angle2), inward);
5404 y1 = y - ypart(attribute + angle1 + (i * angle2), inward);
5405 x2 = x - xpart(attribute - angle1 + (i * angle2), inward);
5406 y2 = y - ypart(attribute - angle1 + (i * angle2), inward);
5407 x3 = x + xpart(attribute + (i * angle2), outward);
5408 y3 = y + ypart(attribute + (i * angle2), outward);
5409 pline(bmp, x1, y1, x2, y2, col1);
5410 pline(bmp, x1, y1, x3, y3, col1);
5411 pline(bmp, x2, y2, x3, y3, col1);
5412
5413 }
5414 }
5415
5416 void draw_blatter(BITMAP *bmp, int x, int y, int number, int distance, int rotation, int size, int col1, int col2)
5417 {
5418 int i, xp, yp;
5419 int angle_difference = ANGLE_FULL / number;
5420
5421 for (i = 0; i < number; i ++)
5422 {
5423 xp = x + xpart(rotation + angle_difference * i, distance);
5424 yp = y + ypart(rotation + angle_difference * i, distance);
5425 circlefill(bmp, xp, yp, size, col2);
5426 circle(bmp, xp, yp, size, col1);
5427 }
5428
5429 }
5430
5431
5432 int get_circler_colour(int x1)
5433 {
5434 switch(x1)
5435 {
5436 case 0: return TRANS_YELLOW;
5437 case 1: return TRANS_ORANGE;
5438 case 2: return TRANS_LGREY;
5439 case 3: return TRANS_DGREY;
5440 }
5441
5442 return TRANS_PURPLE;
5443 }
5444
5445 void draw_clouds(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
5446 {
5447
5448 int i, x, y, x2 = 0, y2 = 0;
5449
5450 for (i = 0; i < NO_CLOUDS; i ++)
5451 {
5452 if (cloud[i].type == CLOUD_NONE)
5453 continue;
5454 if (cloud[i].x + 24000 < centre_x - (max_x / 2) * GRAIN
5455 || cloud[i].x - 24000 > centre_x + (max_x / 2) * GRAIN
5456 || cloud[i].y + 24000 < centre_y - (max_y / 2) * GRAIN
5457 || cloud[i].y - 24000 > centre_y + (max_y / 2) * GRAIN)
5458 continue;
5459 x = (cloud[i].x / GRAIN) - (centre_x / GRAIN);
5460 y = (cloud[i].y / GRAIN) - (centre_y / GRAIN);
5461 x2 = (cloud[i].x2 / GRAIN) - (centre_x / GRAIN);
5462 y2 = (cloud[i].y2 / GRAIN) - (centre_y / GRAIN);
5463 draw_a_cloud(bmp, i, x + (max_x / 2), y + (max_y / 2), x2 + (max_x / 2), y2 + (max_y / 2));
5464
5465 }
5466
5467 }
5468
5469
5470
5471 void draw_a_cloud(BITMAP *bmp, int dr, int x, int y, int x2, int y2)
5472 {
5473 int xa, ya, xb, yb, xd, yd, cs, c2, points [8];
5474
5475 #ifdef DEBUG_DISPLAY
5476 if (debug_info == 1)
5477 textprintf_ex(bmp, small_font, x, y, COLOUR_BLUE8, COLOUR_BLACK, "ty%i to%i ", cloud[dr].type, cloud[dr].timeout);
5478 #endif
5479
5480 switch(cloud[dr].type)
5481 {
5482 case CLOUD_SHATTER1:
5483 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5484 for (cs = 0; cs < 8 ; cs ++)
5485 {
5486 c2 = (cloud[dr].timeout * 12) + cs * ANGLE_FULL / 8;
5487 if (dr % 2 == 0)
5488 c2 = ANGLE_FULL - ((cloud[dr].timeout * 12) + cs * ANGLE_FULL / 8);
5489 /* switch(cs)
5490 {
5491 default:
5492 case 0: xa = TRANS_LBLUE; break;
5493 case 1: xa = TRANS_DBLUE; break;
5494 case 2: xa = TRANS_DRED; break;
5495 case 3: xa = TRANS_LRED; break;
5496 case 4: xa = TRANS_ORANGE; break;
5497 case 5: xa = TRANS_PURPLE; break;
5498 }*/
5499 xa = TRANS_DRED;
5500 if (cs % 2 == 1)
5501 xa = TRANS_ORANGE;
5502 xb = cloud[dr].timeout;
5503 // if (xb > 12) xb = 12;
5504 if (cs % 2 == 0)
5505 xb = (xb * 13) / 10;
5506 triangle(bmp, x, y,
5507 x + xpart(c2, xb), y + ypart(c2, xb),
5508 x + xpart(c2 + ANGLE_FULL / 8, xb), y + ypart(c2 + ANGLE_FULL / 8, xb),
5509 xa);
5510 }
5511 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5512 break;
5513 case CLOUD_SHATTER2:
5514 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5515 c2 = cloud[dr].angle;
5516 xa = TRANS_WHITE;
5517 xb = cloud[dr].timeout;
5518 if (xb < 12)
5519 xa = TRANS_LBLUE; // purple
5520 if (xb < 9)
5521 xa = TRANS_LBLUE;
5522 if (xb < 5)
5523 xa = TRANS_DBLUE;
5524 x2 = 34 - xb;
5525 if (x2 < 0)
5526 x2 = 0;
5527 y2 = xb * 2; // angle - starts at 128 and falls
5528 if (y2 > 64)
5529 y2 = 64;
5530 ya = 47 - xb / 3;
5531 for (cs = 0; cs < 8 ; cs ++)
5532 {
5533 triangle(bmp, x + xpart(c2 + (cs * ANGLE_1_EIGHTH), x2), y + ypart(c2 + (cs * ANGLE_1_EIGHTH), x2),
5534 x + xpart(c2 - y2 + (cs * ANGLE_1_EIGHTH), ya), y + ypart(c2 - y2 + (cs * ANGLE_1_EIGHTH), ya),
5535 x + xpart(c2 + y2 + (cs * ANGLE_1_EIGHTH), ya), y + ypart(c2 + y2 + (cs * ANGLE_1_EIGHTH), ya),
5536 xa);
5537 }
5538 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5539 break;
5540 case CLOUD_TWISTY_CIRCLE:
5541 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5542 c2 = cloud[dr].timeout / 5;
5543 yd = (50 - cloud[dr].timeout) / 2;
5544 xb = cloud[dr].colour [0];
5545 if (cloud[dr].timeout < 20)
5546 xb = cloud[dr].colour [1];
5547 if (cloud[dr].timeout < 15)
5548 xb = cloud[dr].colour [2];
5549 if (cloud[dr].timeout < 10)
5550 xb = cloud[dr].colour [3];
5551 for (xa = 0; xa < 6; xa ++)
5552 {
5553 cs = (((cloud[dr].timeout % 32) * 32) + cloud[dr].angle + xa * (ANGLE_FULL / 6)) * cloud[dr].status;
5554 cs += ANGLE_FULL;
5555 cs %= ANGLE_FULL;
5556 circlefill(bmp,
5557 x + (xpart(cs, yd)),
5558 y + (ypart(cs, yd)),
5559 c2, xb);
5560 }
5561 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5562
5563 break;
5564 case CLOUD_TWIRLY_CIRCLE:
5565 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5566 c2 = cloud[dr].timeout / 5;
5567 yd = (50 - cloud[dr].timeout);
5568 xb = TRANS_YELLOW;
5569 if (cloud[dr].timeout < 20)
5570 xb = TRANS_ORANGE;
5571 if (cloud[dr].timeout < 15)
5572 xb = TRANS_LRED;
5573 if (cloud[dr].timeout < 10)
5574 xb = TRANS_DRED;
5575 for (xa = 0; xa < 6; xa ++)
5576 {
5577 cs = 50 - cloud[dr].timeout + xa * (ANGLE_FULL / 6);
5578 circlefill(bmp,
5579 x + (xpart(cs, yd)),
5580 y + (ypart(cs, yd)),
5581 c2, xb);
5582 }
5583 circlefill(bmp, x, y, cloud[dr].timeout / 4 + 1, TRANS_YELLOW);
5584 circlefill(bmp, x, y, cloud[dr].timeout / 3 + 1, TRANS_LGREEN);
5585 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5586 break;
5587 case CLOUD_FLAK_BURST:
5588 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5589 switch((int) cloud[dr].timeout / 10)
5590 {
5591 default:
5592 // case 0: xa = TRANS_DGREY; break;
5593 case 1: xa = TRANS_DRED; break;
5594 case 2: xa = TRANS_LRED; break;
5595 case 3: xa = TRANS_ORANGE; break;
5596 case 4: xa = TRANS_YELLOW; break;
5597 case 5: xa = TRANS_WHITE; break;
5598 }
5599 // circlefill(bmp, x, y, 8 + cloud[dr].status * (7 - (cloud[dr].timeout / 10)), xa);
5600 circlefill(bmp, x, y, 3 + cloud[dr].status * (7 - (cloud[dr].timeout / 10)), xa);
5601 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5602 break;
5603 case CLOUD_BLUE_BLOB:
5604 if (cloud[dr].timeout > 7)
5605 {
5606 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_3 + counter % 2], (x) - 2, (y) - 2);
5607 break;
5608 }
5609 if (cloud[dr].timeout > 4)
5610 {
5611 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_5], (x) - 1, (y) - 1);
5612 break;
5613 }
5614 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5615 if (cloud[dr].timeout > 2)
5616 putpixel(bmp, x, y, TRANS_LBLUE);
5617 else
5618 putpixel(bmp, x, y, TRANS_DBLUE);
5619 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5620 break;
5621 case CLOUD_ORANGE_BLOB:
5622 /* if (cloud[dr].timeout > 7)
5623 {
5624 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_3], (x) - 2, (y) - 2);
5625 break;
5626 }
5627 if (cloud[dr].timeout > 4)
5628 {
5629 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_5], (x) - 1, (y) - 1);
5630 break;
5631 } */
5632 if (cloud[dr].timeout > 2)
5633 {
5634 x2 = (cloud[dr].timeout - 2) / 2;
5635 if (x2 > 2) x2 = 2;
5636 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_7 - x2], (x) - 1 - x2, (y) - 1 - x2);
5637 break;
5638 }
5639 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5640 if (cloud[dr].timeout > 0)
5641 putpixel(bmp, x, y, TRANS_LRED);
5642 else
5643 putpixel(bmp, x, y, TRANS_DRED);
5644 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5645 break;
5646 case CLOUD_ORANGE_BLOB2:
5647 if (cloud[dr].timeout > 4)
5648 {
5649 x2 = (cloud[dr].timeout - 4);// / 2;
5650 if (x2 > 6) x2 = 6;
5651 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_ORANGE_BLOB_7 - x2], (x) - 1 - x2 / 2, (y) - 1 - x2 / 2
5652 );
5653 break;
5654 }
5655 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5656 if (cloud[dr].timeout > 2)
5657 putpixel(bmp, x, y, TRANS_LRED);
5658 else
5659 putpixel(bmp, x, y, TRANS_DRED);
5660 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5661 break;
5662 case CLOUD_BLUE_BLOB2:
5663 if (cloud[dr].timeout > 4)
5664 {
5665 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_1], (x) - 3, (y) - 3);
5666 break;
5667 }
5668 if (cloud[dr].timeout > 3)
5669 {
5670 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_3], (x) - 2, (y) - 2);
5671 break;
5672 }
5673 if (cloud[dr].timeout > 2)
5674 {
5675 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_5], (x) - 1, (y) - 1);
5676 break;
5677 }
5678 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5679 if (cloud[dr].timeout > 1)
5680 putpixel(bmp, x, y, TRANS_LBLUE);
5681 else
5682 putpixel(bmp, x, y, TRANS_DBLUE);
5683 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5684 break;
5685 case CLOUD_GREEN_BLOB:
5686 if (cloud[dr].timeout > 2)
5687 {
5688 x2 = (cloud[dr].timeout - 2) / 2;
5689 if (x2 > 2) x2 = 2;
5690 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_GREEN_BLOB_7 - x2], (x) - 1 - x2, (y) - 1 - x2);
5691 break;
5692 }
5693 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5694 if (cloud[dr].timeout > 0)
5695 putpixel(bmp, x, y, TRANS_LGREEN);
5696 else
5697 putpixel(bmp, x, y, TRANS_DGREEN);
5698 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5699 break;
5700 case CLOUD_GREEN_BLOB2:
5701 if (cloud[dr].timeout > 4)
5702 {
5703 x2 = (cloud[dr].timeout - 4);// / 2;
5704 if (x2 > 6) x2 = 6;
5705 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_GREEN_BLOB_7 - x2], (x) - 1 - x2 / 2, (y) - 1 - x2 / 2
5706 );
5707 break;
5708 }
5709 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5710 if (cloud[dr].timeout > 2)
5711 putpixel(bmp, x, y, TRANS_LGREEN);
5712 else
5713 putpixel(bmp, x, y, TRANS_DGREEN);
5714 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5715 break;
5716 /* case CLOUD_BLUE_BLOB2:
5717 if (cloud[dr].timeout > 4)
5718 {
5719 x2 = (cloud[dr].timeout - 4);// / 2;
5720 if (x2 > 6) x2 = 6;
5721 draw_trans_rle_sprite(bmp, small3_rle [RLE_SMALL3_BLUE_BLOB_7 - x2], (x) - 1 - x2 / 2, (y) - 1 - x2 / 2
5722 );
5723 break;
5724 }
5725 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5726 if (cloud[dr].timeout > 2)
5727 putpixel(bmp, x, y, TRANS_LBLUE);
5728 else
5729 putpixel(bmp, x, y, TRANS_DBLUE);
5730 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5731 break;*/
5732 case CLOUD_BANG:
5733 xa = cloud[dr].timeout / 10;
5734 if (xa > 50)
5735 xa = 50;
5736 draw_trans_sprite(bmp, redbang_bmp [xa], x - xa, y - xa);
5737 break;
5738 case CLOUD_TRAIL1:
5739 circlefill(bmp, x, y, cloud[dr].timeout / 20 + 1, COLOUR_RED8);
5740 break;
5741 case CLOUD_FADING_LINE:
5742 if ((cloud[dr].timeout / 2) > 3)
5743 xa = cloud[dr].colour [3];
5744 else
5745 {
5746 if (cloud[dr].timeout == 1)
5747 xa = cloud[dr].colour [0];
5748 else
5749 xa = cloud[dr].colour [(cloud[dr].timeout) / 2 - 1];
5750 }
5751 // if (cloud[dr].timeout > 4)
5752 // xa = cloud[dr].colour [0];
5753 // else
5754 // xa = cloud[dr].colour [4 - cloud[dr].timeout];
5755 pline(bmp, x, y, x2, y2, xa);
5756 break;
5757 case CLOUD_TRANS_FADING_LINE:
5758 if ((cloud[dr].timeout / 2) > 3)
5759 xa = cloud[dr].colour [3];
5760 else
5761 {
5762 if (cloud[dr].timeout == 1)
5763 xa = cloud[dr].colour [0];
5764 else
5765 xa = cloud[dr].colour [(cloud[dr].timeout) / 2 - 1];
5766 }
5767 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5768 pline(bmp, x, y, x2, y2, xa);
5769 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5770 break;
5771 case CLOUD_SHRINKING_FADING_CIRCLE:
5772 cs = cloud[dr].timeout / 100;
5773 if (cloud[dr].tickrate < 0)
5774 {
5775 xa = cloud[dr].colour [0];
5776 }
5777 else
5778 {
5779 xa = cloud[dr].colour [3];
5780 if (cs > 10)
5781 xa = cloud[dr].colour [2];
5782 if (cs > 20)
5783 xa = cloud[dr].colour [1];
5784 if (cs > 35)
5785 xa = cloud[dr].colour [0];
5786 }
5787 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5788 circle(bmp, x, y, cs, xa);
5789 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5790 break;
5791 case CLOUD_SHRINKING_CIRCLE:
5792 cs = cloud[dr].timeout / 100;
5793 if (cs > 7)
5794 cs = 7;
5795 xa = cloud[dr].colour [0] - 7 + cs;
5796 circle(bmp, x, y, cloud[dr].timeout / 100, xa);
5797 break;
5798 case CLOUD_SMALL_SHRINKING_CIRCLE:
5799 cs = cloud[dr].timeout / 100;
5800 if (cs > 3)
5801 cs = 3;
5802 xa = cloud[dr].colour [0] - 6 + cs * 2;
5803 circle(bmp, x, y, cloud[dr].timeout / 100, xa);
5804 break;
5805 case CLOUD_SHRINKING_LINE:
5806 // colour [0] must be transparent, [1] non-transparent
5807 cs = cloud[dr].colour [0];
5808 if (cloud[dr].timeout < 140)
5809 {
5810 cs = cloud[dr].colour [1];
5811 cs -= 6;
5812 cs += cloud[dr].timeout / 20;
5813 }
5814 else
5815 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5816 xa = x + xpart(cloud[dr].angle, cloud[dr].timeout / 10);
5817 ya = y + ypart(cloud[dr].angle, cloud[dr].timeout / 10);
5818 // drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5819 pline(bmp, x, y, xa, ya, cs);
5820 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5821 break;
5822 case CLOUD_LINE_SHADOW:
5823 cs = cloud[dr].angle + ANGLE_QUARTER;
5824 c2 = cloud[dr].timeout / 10;
5825 xa = x + xpart(cs, c2);
5826 ya = y + ypart(cs, c2);
5827 xb = x - xpart(cs, c2);
5828 yb = y - ypart(cs, c2);
5829 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5830 pline(bmp, xa, ya, xb, yb, cloud[dr].colour [0]);
5831 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5832 break;
5833 case CLOUD_SHIELD_LINE:
5834 cs = cloud[dr].angle - ANGLE_QUARTER;
5835 c2 = cloud[dr].timeout / 3;
5836 xa = x + xpart(cs, c2);
5837 ya = y + ypart(cs, c2);
5838 xb = x - xpart(cs, c2);
5839 yb = y - ypart(cs, c2);
5840 xd = cloud[dr].timeout / 20;
5841 if (xd > 4)
5842 xd = 4;
5843 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5844 pline(bmp, xa, ya, xb, yb, cloud[dr].colour [xd]);
5845 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5846
5847 /* case CLOUD_SHIELD_LINE:
5848 cs = ANGLE_FULL - ((cloud[dr].angle - ANGLE_HALF) % ANGLE_FULL);
5849 c2 = cloud[dr].timeout / 3;
5850 // xa = x + xpart(cs, c2);
5851 // ya = y + ypart(cs, c2);
5852 // xb = x - xpart(cs, c2);
5853 // yb = y - ypart(cs, c2);
5854 xd = cloud[dr].timeout / 20;
5855 if (xd > 4)
5856 xd = 4;
5857 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5858 arc(bmp, x, y, itofix(cs / 4 - c2), itofix(cs / 4 + c2), cloud[dr].status / GRAIN, cloud[dr].colour [xd]);
5859 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5860 */
5861 break;
5862 case CLOUD_SQUAREY:
5863 points [0] = x + xpart(cloud[dr].angle + ANGLE_1_SIXTEENTH - 2, 40 - 1);
5864 points [1] = y + ypart(cloud[dr].angle + ANGLE_1_SIXTEENTH - 2, 40 - 1);
5865 points [2] = x + xpart(cloud[dr].angle + ANGLE_1_SIXTEENTH - 2, 22 - 1);
5866 points [3] = y + ypart(cloud[dr].angle + ANGLE_1_SIXTEENTH - 2, 22 - 1);
5867 points [4] = x + xpart(cloud[dr].angle - ANGLE_1_SIXTEENTH + 2, 22 - 1);
5868 points [5] = y + ypart(cloud[dr].angle - ANGLE_1_SIXTEENTH + 2, 22 - 1);
5869 points [6] = x + xpart(cloud[dr].angle - ANGLE_1_SIXTEENTH + 2, 40 - 1);
5870 points [7] = y + ypart(cloud[dr].angle - ANGLE_1_SIXTEENTH + 2, 40 - 1);
5871 polygon(bmp, 4, points, GC_BLUE5);
5872
5873 points [0] = x + xpart(cloud[dr].angle + ANGLE_1_SIXTEENTH, 40);
5874 points [1] = y + ypart(cloud[dr].angle + ANGLE_1_SIXTEENTH, 40);
5875 points [2] = x + xpart(cloud[dr].angle + ANGLE_1_SIXTEENTH, 22 - 2);
5876 points [3] = y + ypart(cloud[dr].angle + ANGLE_1_SIXTEENTH, 22 - 2);
5877 points [4] = x + xpart(cloud[dr].angle - ANGLE_1_SIXTEENTH, 22 - 2);
5878 points [5] = y + ypart(cloud[dr].angle - ANGLE_1_SIXTEENTH, 22 - 2);
5879 points [6] = x + xpart(cloud[dr].angle - ANGLE_1_SIXTEENTH, 40);
5880 points [7] = y + ypart(cloud[dr].angle - ANGLE_1_SIXTEENTH, 40);
5881
5882 /* points [0] = x + xpart(ANGLE_1_SIXTEENTH + cloud[dr].angle - 2, 40 - 1);
5883 points [1] = y + ypart(ANGLE_1_SIXTEENTH + cloud[dr].angle - 2, 40 - 1);
5884 points [2] = x + xpart(ANGLE_1_SIXTEENTH + cloud[dr].angle - 2, 22 - 1);
5885 points [3] = y + ypart(ANGLE_1_SIXTEENTH + cloud[dr].angle - 2, 22 - 1);
5886 points [4] = x + xpart(ANGLE_1_SIXTEENTH - cloud[dr].angle + 2, 22 - 1);
5887 points [5] = y + ypart(ANGLE_1_SIXTEENTH - cloud[dr].angle + 2, 22 - 1);
5888 points [6] = x + xpart(ANGLE_1_SIXTEENTH - cloud[dr].angle + 2, 40 - 1);
5889 points [7] = y + ypart(ANGLE_1_SIXTEENTH - cloud[dr].angle + 2, 40 - 1);
5890 polygon(bmp, 4, points, GC_BLUE5);
5891
5892 points [0] = x + xpart(ANGLE_1_SIXTEENTH + cloud[dr].angle, 40);
5893 points [1] = y + ypart(ANGLE_1_SIXTEENTH + cloud[dr].angle, 40);
5894 points [2] = x + xpart(ANGLE_1_SIXTEENTH + cloud[dr].angle, 22 - 2);
5895 points [3] = y + ypart(ANGLE_1_SIXTEENTH + cloud[dr].angle, 22 - 2);
5896 points [4] = x + xpart(ANGLE_1_SIXTEENTH - cloud[dr].angle, 22 - 2);
5897 points [5] = y + ypart(ANGLE_1_SIXTEENTH - cloud[dr].angle, 22 - 2);
5898 points [6] = x + xpart(ANGLE_1_SIXTEENTH - cloud[dr].angle, 40);
5899 points [7] = y + ypart(ANGLE_1_SIXTEENTH - cloud[dr].angle, 40);
5900 */
5901 pline(bmp, points [0], points [1], points [2], points [3], GC_BLUE1);
5902 pline(bmp, points [2], points [3], points [4], points [5], GC_BLUE1);
5903 pline(bmp, points [4], points [5], points [6], points [7], GC_BLUE1);
5904 pline(bmp, points [0], points [1], points [6], points [7], GC_BLUE1);
5905 break;
5906 case CLOUD_BLOCK1:
5907 cs = cloud[dr].colour [0];
5908 if (cloud[dr].timeout <= 7)
5909 cs = cloud[dr].colour [1];
5910 if (cloud[dr].timeout <= 5)
5911 cs = cloud[dr].colour [2];
5912 if (cloud[dr].timeout <= 2)
5913 cs = cloud[dr].colour [3];
5914 points [0] = x + xpart(cloud[dr].angle + ANGLE_QUARTER, cloud[dr].timeout);
5915 points [1] = y + ypart(cloud[dr].angle + ANGLE_QUARTER, cloud[dr].timeout);
5916 points [2] = x + xpart(cloud[dr].angle - ANGLE_QUARTER, cloud[dr].timeout);
5917 points [3] = y + ypart(cloud[dr].angle - ANGLE_QUARTER, cloud[dr].timeout);
5918 points [4] = x2 + xpart(cloud[dr].angle - ANGLE_QUARTER, cloud[dr].timeout);
5919 points [5] = y2 + ypart(cloud[dr].angle - ANGLE_QUARTER, cloud[dr].timeout);
5920 points [6] = x2 + xpart(cloud[dr].angle + ANGLE_QUARTER, cloud[dr].timeout);
5921 points [7] = y2 + ypart(cloud[dr].angle + ANGLE_QUARTER, cloud[dr].timeout);
5922 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5923 polygon(bmp, 4, points, cs);
5924 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5925 break;
5926 case CLOUD_BLOCK2:
5927 cs = cloud[dr].colour [0];
5928 if (cloud[dr].timeout <= 60)
5929 cs = cloud[dr].colour [1];
5930 if (cloud[dr].timeout <= 40)
5931 cs = cloud[dr].colour [2];
5932 if (cloud[dr].timeout <= 20)
5933 cs = cloud[dr].colour [3];
5934 int points2 [8];
5935 c2 = (cloud[dr].timeout * 5) % ANGLE_FULL;
5936 if (cloud[dr].status == 1)
5937 c2 = ANGLE_FULL - c2;
5938 xd = cloud[dr].timeout / 3;
5939 points2 [0] = x + xpart(c2, xd);
5940 points2 [1] = y + ypart(c2, xd);
5941 points2 [2] = x + xpart(c2 + ANGLE_QUARTER, xd);
5942 points2 [3] = y + ypart(c2 + ANGLE_QUARTER, xd);
5943 points2 [4] = x + xpart(c2 + ANGLE_HALF, xd);
5944 points2 [5] = y + ypart(c2 + ANGLE_HALF, xd);
5945 points2 [6] = x + xpart(c2 - ANGLE_QUARTER, xd);
5946 points2 [7] = y + ypart(c2 - ANGLE_QUARTER, xd);
5947 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5948 polygon(bmp, 4, points2, cs);
5949 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5950 break;
5951 case CLOUD_BLOCK3:
5952 cs = cloud[dr].colour [0];
5953 if (cloud[dr].timeout <= 60)
5954 cs = cloud[dr].colour [1];
5955 if (cloud[dr].timeout <= 40)
5956 cs = cloud[dr].colour [2];
5957 if (cloud[dr].timeout <= 20)
5958 cs = cloud[dr].colour [3];
5959 int points3 [8];
5960 c2 = (cloud[dr].timeout + cloud[dr].angle) % ANGLE_FULL;
5961 if (cloud[dr].status == 1)
5962 c2 = ANGLE_FULL - c2;
5963 // c2 = ANGLE_FULL - cloud[dr].angle;
5964 xd = cloud[dr].timeout / 3;
5965 yd = (100 - cloud[dr].timeout) / 2;
5966 if (yd < 3) yd = 3;
5967 points3 [0] = x + xpart(c2, xd);
5968 points3 [1] = y + ypart(c2, xd);
5969 points3 [2] = x + xpart(c2 + ANGLE_QUARTER, xd);
5970 points3 [3] = y + ypart(c2 + ANGLE_QUARTER, xd);
5971 points3 [4] = x + xpart(c2 + ANGLE_HALF, xd);
5972 points3 [5] = y + ypart(c2 + ANGLE_HALF, xd);
5973 points3 [6] = x + xpart(c2 - ANGLE_QUARTER, xd);
5974 points3 [7] = y + ypart(c2 - ANGLE_QUARTER, xd);
5975 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
5976 polygon(bmp, 4, points3, cs);
5977 xd /= 2;
5978 c2 += ANGLE_1_EIGHTH;
5979 points3 [0] = x + xpart(c2, xd);
5980 points3 [1] = y + ypart(c2, xd);
5981 points3 [2] = x + xpart(c2 + ANGLE_QUARTER, yd);
5982 points3 [3] = y + ypart(c2 + ANGLE_QUARTER, yd);
5983 points3 [4] = x + xpart(c2 + ANGLE_HALF, xd);
5984 points3 [5] = y + ypart(c2 + ANGLE_HALF, xd);
5985 points3 [6] = x + xpart(c2 - ANGLE_QUARTER, yd);
5986 points3 [7] = y + ypart(c2 - ANGLE_QUARTER, yd);
5987 polygon(bmp, 4, points3, cs);
5988 points3 [0] = x + xpart(c2, yd);
5989 points3 [1] = y + ypart(c2, yd);
5990 points3 [2] = x + xpart(c2 + ANGLE_QUARTER, xd);
5991 points3 [3] = y + ypart(c2 + ANGLE_QUARTER, xd);
5992 points3 [4] = x + xpart(c2 + ANGLE_HALF, yd);
5993 points3 [5] = y + ypart(c2 + ANGLE_HALF, yd);
5994 points3 [6] = x + xpart(c2 - ANGLE_QUARTER, xd);
5995 points3 [7] = y + ypart(c2 - ANGLE_QUARTER, xd);
5996 polygon(bmp, 4, points3, cs);
5997 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
5998 /* cs = cloud[dr].colour [0];
5999 if (cloud[dr].timeout <= 60)
6000 cs = cloud[dr].colour [1];
6001 if (cloud[dr].timeout <= 40)
6002 cs = cloud[dr].colour [2];
6003 if (cloud[dr].timeout <= 20)
6004 cs = cloud[dr].colour [3];
6005 int points2 [8];
6006 c2 = (cloud[dr].timeout * 5) % ANGLE_FULL;
6007 if (cloud[dr].status == 1)
6008 c2 = ANGLE_FULL - c2;
6009 xd = cloud[dr].timeout / 3;
6010 yd = 100 - cloud[dr].timeout;
6011 if (yd < 3) yd = 3;
6012 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6013 rectfill(bmp, x - xd, y - xd, x + xd, y + xd, cs);
6014 rectfill(bmp, x - xd / 4, y - yd * 2, x + xd / 4, y + yd * 2, cs);
6015 rectfill(bmp, x - yd * 2, y - xd / 4, x + yd * 2, y + xd / 4, cs);
6016 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);*/
6017 break;
6018 case CLOUD_BLOCK4:
6019 cs = cloud[dr].colour [0];
6020 if (cloud[dr].timeout <= 7)
6021 cs = cloud[dr].colour [1];
6022 if (cloud[dr].timeout <= 5)
6023 cs = cloud[dr].colour [2];
6024 if (cloud[dr].timeout <= 3)
6025 cs = cloud[dr].colour [3];
6026 int points4 [8];
6027 xd = cloud[dr].timeout / 2;
6028 points4 [0] = x + xpart(cloud[dr].angle + ANGLE_QUARTER, xd);
6029 points4 [1] = y + ypart(cloud[dr].angle + ANGLE_QUARTER, xd);
6030 points4 [2] = x + xpart(cloud[dr].angle - ANGLE_QUARTER, xd);
6031 points4 [3] = y + ypart(cloud[dr].angle - ANGLE_QUARTER, xd);
6032 points4 [4] = x2 + xpart(cloud[dr].angle - ANGLE_QUARTER, xd);
6033 points4 [5] = y2 + ypart(cloud[dr].angle - ANGLE_QUARTER, xd);
6034 points4 [6] = x2 + xpart(cloud[dr].angle + ANGLE_QUARTER, xd);
6035 points4 [7] = y2 + ypart(cloud[dr].angle + ANGLE_QUARTER, xd);
6036 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6037 polygon(bmp, 4, points4, cs);
6038 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6039 break;
6040 case CLOUD_BLOCK5:
6041 cs = cloud[dr].colour [0];
6042 if (cloud[dr].timeout <= 70)
6043 cs = cloud[dr].colour [1];
6044 if (cloud[dr].timeout <= 50)
6045 cs = cloud[dr].colour [2];
6046 if (cloud[dr].timeout <= 30)
6047 cs = cloud[dr].colour [3];
6048 int points5 [8];
6049 xd = cloud[dr].status;
6050 points5 [0] = x + xpart(cloud[dr].angle + ANGLE_QUARTER, xd);
6051 points5 [1] = y + ypart(cloud[dr].angle + ANGLE_QUARTER, xd);
6052 points5 [2] = x + xpart(cloud[dr].angle - ANGLE_QUARTER, xd);
6053 points5 [3] = y + ypart(cloud[dr].angle - ANGLE_QUARTER, xd);
6054 points5 [4] = x2 + xpart(cloud[dr].angle - ANGLE_QUARTER, xd);
6055 points5 [5] = y2 + ypart(cloud[dr].angle - ANGLE_QUARTER, xd);
6056 points5 [6] = x2 + xpart(cloud[dr].angle + ANGLE_QUARTER, xd);
6057 points5 [7] = y2 + ypart(cloud[dr].angle + ANGLE_QUARTER, xd);
6058 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6059 polygon(bmp, 4, points5, cs);
6060 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6061 break;
6062 case CLOUD_THICK_SHOCK_CIRCLE:
6063 cs = cloud[dr].colour [0];
6064 if (cloud[dr].timeout <= 7)
6065 cs = cloud[dr].colour [1];
6066 if (cloud[dr].timeout <= 5)
6067 cs = cloud[dr].colour [2];
6068 if (cloud[dr].timeout <= 3)
6069 cs = cloud[dr].colour [3];
6070 xd = cloud[dr].timeout;// / 2;
6071 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6072 circlefill(bmp, x, y, xd, cs);
6073 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6074 break;
6075
6076 case CLOUD_SPECK:
6077 xa = cloud[dr].colour [0];
6078 if (cloud[dr].timeout < 14)
6079 xa = cloud[dr].colour [1];
6080 if (cloud[dr].timeout < 11)
6081 xa = cloud[dr].colour[2];
6082 if (cloud[dr].timeout < 8)
6083 xa = cloud[dr].colour[3];
6084 if (cloud[dr].timeout < 4)
6085 xa = cloud[dr].colour[4];
6086 putpixel(bmp, x, y, xa);
6087 break;
6088 case CLOUD_FLECK:
6089 cs = cloud[dr].colour [0];
6090 if (cloud[dr].timeout < 8)
6091 cs = cloud[dr].colour [1];
6092 if (cloud[dr].timeout < 6)
6093 cs = cloud[dr].colour[2];
6094 if (cloud[dr].timeout < 4)
6095 cs = cloud[dr].colour[3];
6096 if (cloud[dr].timeout < 2)
6097 cs = cloud[dr].colour[4];
6098 xb = x - xpart(cloud[dr].angle, cloud[dr].timeout);
6099 yb = y - ypart(cloud[dr].angle, cloud[dr].timeout);
6100 pline(bmp, x, y, xb, yb, cs);
6101 // circlefill(bmp, x, y, 4, cs);
6102 break;
6103 case CLOUD_SMALL_FADING_CIRCLE:
6104 cs = cloud[dr].colour [0];
6105 if (cloud[dr].timeout <= 30)
6106 cs -= (30 - cloud[dr].timeout) / 5;
6107 // cs -= 2;
6108 // else
6109 // if (cloud[dr].timeout <= 20)
6110 // cs -= 4;
6111 // else
6112 // if (cloud[dr].timeout <= 10)
6113 // cs -= 6;
6114 // cs += (cloud[dr].timeout * 8) / cloud[dr].status - 8;
6115 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6116 break;
6117 case CLOUD_LARGE_FADING_CIRCLE:
6118 cs = cloud[dr].colour [0];
6119 if (cloud[dr].timeout < 300)
6120 cs -= (300 - cloud[dr].timeout) / 50;
6121 // cs -= 2;
6122 // else
6123 // if (cloud[dr].timeout <= 200)
6124 // cs -= 4;
6125 // else
6126 // if (cloud[dr].timeout <= 100)
6127 // cs -= 6;
6128 // cs += (cloud[dr].timeout * 8) / cloud[dr].status - 8;
6129 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6130 break;
6131 case CLOUD_FLAME_CIRCLE:
6132 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6133 circlefill(bmp, x, y, cloud[dr].timeout / 20, cloud[dr].colour [0]);
6134 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6135 break;
6136 case CLOUD_BIG_BLAST_CIRCLE: // drags
6137 cs = cloud[dr].colour [0];
6138 if (cloud[dr].timeout <= 60)
6139 cs = cloud[dr].colour [1];
6140 if (cloud[dr].timeout <= 45)
6141 cs = cloud[dr].colour [2];
6142 if (cloud[dr].timeout <= 30)
6143 cs = cloud[dr].colour [3];
6144 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6145 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6146 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6147 break;
6148 case CLOUD_LARGE_TRANS_FADING_CIRCLE:
6149 cs = cloud[dr].colour [0];
6150 if (cloud[dr].timeout <= 50)
6151 cs = cloud[dr].colour [1];
6152 if (cloud[dr].timeout <= 35)
6153 cs = cloud[dr].colour [2];
6154 if (cloud[dr].timeout <= 20)
6155 cs = cloud[dr].colour [3];
6156 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6157 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6158 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6159 break;
6160 case CLOUD_DRIVE_CIRCLE: // identical except for drag
6161 case CLOUD_TRANS_FADING_CIRCLE:
6162 cs = cloud[dr].colour [0];
6163 if (cloud[dr].timeout <= 22)
6164 cs = cloud[dr].colour [1];
6165 if (cloud[dr].timeout <= 19)
6166 cs = cloud[dr].colour [2];
6167 if (cloud[dr].timeout <= 14)
6168 cs = cloud[dr].colour [3];
6169 // cs -= 2;
6170 // else
6171 // if (cloud[dr].timeout <= 20)
6172 // cs -= 4;
6173 // else
6174 // if (cloud[dr].timeout <= 10)
6175 // cs -= 6;
6176 // cs += (cloud[dr].timeout * 8) / cloud[dr].status - 8;
6177 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6178 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6179 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6180 break;
6181 case CLOUD_SEEKER_CIRCLE: // just like below but drags
6182 case CLOUD_MED_TRANS_FADING_CIRCLE:
6183 cs = cloud[dr].colour [0];
6184 if (cloud[dr].timeout <= 32)
6185 cs = cloud[dr].colour [1];
6186 if (cloud[dr].timeout <= 25)
6187 cs = cloud[dr].colour [2];
6188 if (cloud[dr].timeout <= 16)
6189 cs = cloud[dr].colour [3];
6190 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6191 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6192 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6193 break;
6194 case CLOUD_BLAST_CIRCLE:
6195 cs = cloud[dr].colour [0];
6196 if (cloud[dr].timeout <= 25)
6197 cs = cloud[dr].colour [1];
6198 // else
6199 // {
6200 if (cloud[dr].timeout <= 15)
6201 cs = cloud[dr].colour [2];
6202 // else
6203 // {
6204 if (cloud[dr].timeout <= 9)
6205 cs = cloud[dr].colour [3];
6206 // }
6207 // }
6208 // cs += (cloud[dr].timeout * 8) / cloud[dr].status - 8;
6209 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6210 circlefill(bmp, x, y, cloud[dr].timeout / 10, cs);
6211 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6212 break;
6213 case CLOUD_SMALL_TRANS_CIRCLE:
6214 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6215 circlefill(bmp, x, y, cloud[dr].timeout / 100, cloud[dr].colour [0]);
6216 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6217 break;
6218 case CLOUD_SMALL_CIRCLE:
6219 circlefill(bmp, x, y, cloud[dr].timeout / 100, cloud[dr].colour [0]);
6220 break;
6221 case CLOUD_MED_TRANS_CIRCLE:
6222 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6223 circlefill(bmp, x, y, cloud[dr].timeout / 70, cloud[dr].colour [0]);
6224 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6225 break;
6226 case CLOUD_DISTORT:
6227 clear_bitmap(distortion_mask);
6228 circlefill(distortion_mask, cloud[dr].timeout / 70, cloud[dr].timeout / 70, 9, 1);
6229 distortion(bmp, x, y, 19, 19, grand(31) - 15, grand(31) - 15);
6230 break;
6231 case CLOUD_MED_CIRCLE:
6232 circlefill(bmp, x, y, cloud[dr].timeout / 70, cloud[dr].colour [0]);
6233 break;
6234 case CLOUD_LARGE_TRANS_CIRCLE:
6235 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6236 circlefill(bmp, x, y, cloud[dr].timeout / 40, cloud[dr].colour [0]);
6237 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6238 break;
6239 case CLOUD_LARGE_CIRCLE:
6240 circlefill(bmp, x, y, cloud[dr].timeout / 40, cloud[dr].colour [0]);
6241 break;
6242 case CLOUD_SHOCKWAVE:
6243 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6244 // if (cloud[dr].timeout > 80)
6245 // circle(bmp, x, y, (cloud[dr].status - cloud[dr].timeout) / 10, cloud[dr].colour [4]);
6246 if (cloud[dr].timeout > 90)
6247 circle(bmp, x, y, (cloud[dr].status - cloud[dr].timeout) / 10 + 4, cloud[dr].colour [3]);
6248 if (cloud[dr].timeout > 60)
6249 circle(bmp, x, y, (cloud[dr].status - cloud[dr].timeout) / 10 + 3, cloud[dr].colour [2]);
6250 if (cloud[dr].timeout > 30)
6251 circle(bmp, x, y, (cloud[dr].status - cloud[dr].timeout) / 10 + 2, cloud[dr].colour [1]);
6252 circle(bmp, x, y, (cloud[dr].status - cloud[dr].timeout) / 10 + 1, cloud[dr].colour [0]);
6253 // text_mode(COLOUR_RED8);
6254 // textprintf_ex(bmp, small_font, x, y, COLOUR_BLUE8, COLOUR_BLACK, "s %i t% i ", cloud[dr].status, cloud[dr].timeout);
6255 // text_mode(-1);
6256 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6257 break;
6258 case CLOUD_GROWING_CIRCLE:
6259 cs = cloud[dr].colour [0];
6260 c2 = (cloud[dr].timeout - cloud[dr].status) / 10;
6261 if (c2 < -5)
6262 c2 = -5;
6263 cs += c2;
6264 circle(bmp, x, y, (cloud[dr].status - cloud[dr].timeout) / 10 + 4, cs);
6265 break;
6266 case CLOUD_PULSER1_V:
6267 if (cloud[dr].status == 1)
6268 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER1_V], x, y);
6269 else
6270 draw_sprite_v_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER1_V], x, y);
6271 break;
6272 case CLOUD_PULSER1_H:
6273 if (cloud[dr].status == 0)
6274 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER1_H], x, y);
6275 else
6276 draw_sprite_h_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER1_H], x, y);
6277 break;
6278 case CLOUD_PULSER2_V:
6279 if (cloud[dr].status == 1)
6280 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER2_V], x, y);
6281 else
6282 draw_sprite_v_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER2_V], x, y);
6283 break;
6284 case CLOUD_PULSER2_H:
6285 if (cloud[dr].status == 0)
6286 draw_sprite(bmp, enemy_bmps [BMP_ENEMY_PULSER2_H], x, y);
6287 else
6288 draw_sprite_h_flip(bmp, enemy_bmps [BMP_ENEMY_PULSER2_H], x, y);
6289 break;
6290 /* case CLOUD_TRI1:
6291 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER1], x - 36, y - 36);
6292 break;
6293 case CLOUD_TRI2:
6294 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER2], x - 35, y - 35);
6295 break;
6296 case CLOUD_TRI3:
6297 draw_rle_sprite(bmp, enemy9_rle [RLE_ENEMY9_TRIANGLER3], x - 35, y - 35);
6298 break;*/
6299
6300 }
6301
6302 }
6303
6304
6305
6306
6307 void draw_lights(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
6308 {
6309
6310 int i, x, y;
6311
6312 for (i = 0; i < NO_LIGHTS; i ++)
6313 {
6314 if (light[i].type == LIGHT_NONE)
6315 break;
6316
6317 if (light[i].x + light[i].size * GRAIN < centre_x - (max_x / 2) * GRAIN
6318 || light[i].x - light[i].size * GRAIN > centre_x + (max_x / 2) * GRAIN
6319 || light[i].y + light[i].size * GRAIN < centre_y - (max_y / 2) * GRAIN
6320 || light[i].y - light[i].size * GRAIN > centre_y + (max_y / 2) * GRAIN)
6321 continue;
6322 x = (light[i].x / GRAIN) - (centre_x / GRAIN);
6323 y = (light[i].y / GRAIN) - (centre_y / GRAIN);
6324 draw_a_light(bmp, light[i].size, x + (max_x / 2), y + (max_y / 2));
6325
6326 }
6327
6328 }
6329
6330 void draw_effects(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
6331 {
6332
6333 int i, x, y, x1 = 0, y1 = 0, x2 = 0, y2 = 0;
6334
6335
6336 for (i = 0; i < MAX_EFFECTS; i ++)
6337 {
6338 if (effect[i].type == EFFECT_NONE)
6339 continue;
6340 if (effect[i].x1 > effect[i].x2)
6341 {
6342 x1 = effect[i].x2;
6343 x2 = effect[i].x1;
6344 }
6345 else
6346 {
6347 x1 = effect[i].x1;
6348 x2 = effect[i].x2;
6349 }
6350 if (effect[i].y1 > effect[i].y2)
6351 {
6352 y1 = effect[i].y2;
6353 y2 = effect[i].y1;
6354 }
6355 else
6356 {
6357 y1 = effect[i].y1;
6358 y2 = effect[i].y2;
6359 }
6360 if (x2 < centre_x - (max_x / 2) * GRAIN
6361 || x1 > centre_x + (max_x / 2) * GRAIN
6362 || y2 < centre_y - (max_y / 2) * GRAIN
6363 || y1 > centre_y + (max_y / 2) * GRAIN)
6364 continue;
6365 x = (effect[i].x / GRAIN) - (centre_x / GRAIN);
6366 y = (effect[i].y / GRAIN) - (centre_y / GRAIN);
6367 draw_an_effect(bmp, i, x + (max_x / 2), y + (max_y / 2));
6368
6369 }
6370
6371 }
6372
6373 void draw_wave(BITMAP *bmp, int x, int y, int count, int size)
6374 {
6375 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6376 int a = (count / 2) % 16;
6377 int b = size + a - 8;
6378 int c;
6379 switch((int) a / 2 + grand(3) - grand(3))
6380 {
6381 default:
6382 case 7:
6383 case 0: c = TRANS_DGREY; break;
6384 case 6:
6385 case 1: c = TRANS_DGREEN; break;
6386 case 2:
6387 case 5: c = TRANS_LGREEN; break;
6388 case 3:
6389 case 4: c = TRANS_YELLOW; break;
6390 /* case 7:
6391 case 0: c = TRANS_DGREEN; break;
6392 case 6:
6393 case 1: c = TRANS_LGREEN; break;
6394 case 4:
6395 case 5:
6396 case 3:
6397 default:
6398 case 2: c = TRANS_YELLOW; break;*/
6399 }
6400 circle(bmp, x, y, b, c);
6401 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6402 }
6403
6404 void draw_an_effect(BITMAP *bmp, int dr, int x, int y)
6405 {
6406 int x1, y1, a,b,c;
6407
6408 switch(effect[dr].type)
6409 {
6410 case EFFECT_WAVE1:
6411 case EFFECT_WAVE2:
6412 draw_wave(bmp, x, y, effect [dr].things [0], effect [dr].things [1]);
6413 a = effect [dr].things [0] - 16 + 255;
6414 draw_wave(bmp, x, y, a, effect [dr].things [1]);
6415 break;
6416 case EFFECT_ZAP_AIM:
6417 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6418 b = xpart(enemy[dr].counter * 32, 6);
6419 x1 = TRANS_LBLUE;
6420 for (c = 0; c < 6; c ++)
6421 {
6422 b *= -1;
6423 a = (effect[dr].things [0] * 4 + c * (ANGLE_FULL / 6)) & 1023;
6424 triangle(bmp,
6425 x + xpart(a, 25 + b), y + ypart(a, 25 + b),
6426 x + xpart(a + ANGLE_1_32, 42 + b), y + ypart(a + ANGLE_1_32, 42 + b),
6427 x + xpart(a - ANGLE_1_32, 42 + b), y + ypart(a - ANGLE_1_32, 42 + b),
6428 x1);
6429 }
6430 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6431 break;
6432 case EFFECT_REDBEAM:
6433 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6434 if (effect[dr].things [0] > 100)
6435 a = (150 - effect[dr].things [0]) * 6;
6436 else
6437 a = 300;
6438 if (effect[dr].things [0] < 25)
6439 a = effect[dr].things [0] * 12;
6440 if (effect[dr].things [0] > 100)
6441 b = (150 - effect[dr].things [0]) / 6 + 2;// + pulsate(64, 4, effect[dr].things [2]);
6442 else
6443 b = 10 + grand(3);//pulsate(32, 2, effect[dr].things [2]);
6444 if (effect[dr].things [0] < 40)
6445 b = effect[dr].things [0] / 4 + + grand(3);//pulsate(32, 2, effect[dr].things [2]);
6446 if (b < 1)
6447 b = 1;
6448 if (effect[dr].things [0] > 100)
6449 c = (150 - effect[dr].things [0]) / 12 + 1;// + pulsate(64, 2, effect[dr].things [2]);
6450 else
6451 c = 5 + grand(3);// + pulsate(64, 1, effect[dr].things [2]);
6452 if (effect[dr].things [0] < 40)
6453 c = effect[dr].things [0] / 8 + grand(3);
6454 if (c < 1)
6455 c = 1;
6456 circlefill(bmp, x, y, b, TRANS_YELLOW);
6457 circlefill(bmp, x, y, (b * 13) / 10, TRANS_LRED);
6458 circlefill(bmp, x, y, (b * 15) / 10, TRANS_DRED);
6459 draw_a_light(bmp, (b * 25) / 10, x, y);
6460 x1 = x + xpart(effect[dr].things [1], a);
6461 y1 = y + ypart(effect[dr].things [1], a);
6462 circlefill(bmp, x1, y1, b * 2, TRANS_YELLOW);
6463 circlefill(bmp, x1, y1, (b * 13) / 5, TRANS_LRED);
6464 circlefill(bmp, x1, y1, (b * 15) / 5, TRANS_DRED);
6465 draw_a_light(bmp, (b * 25) / 5, x1, y1);
6466 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], c, c * 2, TRANS_YELLOW);
6467 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], (c + 1), (c + 1) * 2, TRANS_DRED);
6468 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], c + 3, (c + 3) * 2, LIGHT_1);
6469 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], c + 6, (c + 6) * 2, LIGHT_2);
6470 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6471 break;
6472 case EFFECT_BLUEBEAM:
6473 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6474 if (effect[dr].things [0] > 100)
6475 a = (150 - effect[dr].things [0]) * 6;
6476 else
6477 a = 300;
6478 if (effect[dr].things [0] < 25)
6479 a = effect[dr].things [0] * 12;
6480 if (effect[dr].things [0] > 100)
6481 b = (150 - effect[dr].things [0]) / 6 + 2;// + pulsate(64, 4, effect[dr].things [2]);
6482 else
6483 b = 10 + grand(3);//pulsate(32, 2, effect[dr].things [2]);
6484 if (effect[dr].things [0] < 40)
6485 b = effect[dr].things [0] / 4 + + grand(3);//pulsate(32, 2, effect[dr].things [2]);
6486 if (b < 1)
6487 b = 1;
6488 if (effect[dr].things [0] > 100)
6489 c = (150 - effect[dr].things [0]) / 12 + 1;// + pulsate(64, 2, effect[dr].things [2]);
6490 else
6491 c = 5 + grand(3);// + pulsate(64, 1, effect[dr].things [2]);
6492 if (effect[dr].things [0] < 40)
6493 c = effect[dr].things [0] / 8 + grand(3);
6494 if (c < 1)
6495 c = 1;
6496 circlefill(bmp, x, y, b, TRANS_WHITE);
6497 circlefill(bmp, x, y, (b * 13) / 10, TRANS_LBLUE);
6498 circlefill(bmp, x, y, (b * 15) / 10, TRANS_DBLUE);
6499 draw_a_light(bmp, (b * 25) / 10, x, y);
6500 x1 = x + xpart(effect[dr].things [1], a);
6501 y1 = y + ypart(effect[dr].things [1], a);
6502 circlefill(bmp, x1, y1, b * 2, TRANS_WHITE);
6503 circlefill(bmp, x1, y1, (b * 13) / 5, TRANS_LBLUE);
6504 circlefill(bmp, x1, y1, (b * 15) / 5, TRANS_DBLUE);
6505 draw_a_light(bmp, (b * 25) / 5, x1, y1);
6506 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], c, c * 2, TRANS_WHITE);
6507 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], (c + 1), (c + 1) * 2, TRANS_LBLUE);
6508 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], c + 3, (c + 3) * 2, LIGHT_1);
6509 beam_points(bmp, x, y, x1, y1, effect[dr].things [1], c + 6, (c + 6) * 2, LIGHT_2);
6510 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6511 break;
6512 }
6513
6514 }
6515
6516 void beam_points(BITMAP *bmp, int x1, int y1, int x2, int y2, int angle, int out1, int out2, int colour)
6517 {
6518 int points [8];
6519
6520 points [0] = x1 + xpart(angle - ANGLE_QUARTER, out1);
6521 points [1] = y1 + ypart(angle - ANGLE_QUARTER, out1);
6522 points [2] = x1 + xpart(angle + ANGLE_QUARTER, out1);
6523 points [3] = y1 + ypart(angle + ANGLE_QUARTER, out1);
6524 points [4] = x2 + xpart(angle + ANGLE_QUARTER, out2);
6525 points [5] = y2 + ypart(angle + ANGLE_QUARTER, out2);
6526 points [6] = x2 + xpart(angle - ANGLE_QUARTER, out2);
6527 points [7] = y2 + ypart(angle - ANGLE_QUARTER, out2);
6528
6529 polygon(bmp, 4, points, colour);
6530
6531 }
6532
6533 void draw_a_light(BITMAP *bmp, int size, int x, int y)
6534 {
6535 // int i = light[dr].size;
6536 if (size > 99)
6537 size = 99;
6538
6539 // switch(light[dr].type)
6540 // {
6541 // case LIGHT_NORMAL:
6542 /* drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6543 circlefill(bmp, x, y, light[dr].size + 1, LIGHT_1);
6544 circlefill(bmp, x, y, ((light[dr].size * 9) / 10) + 1, LIGHT_2);
6545 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);*/
6546 draw_trans_rle_sprite(bmp, light_rle [size], x - size - 1, y - size - 1);
6547 // break;
6548 // }
6549
6550 }
6551
6552
6553
6554
6555 void draw_pickups(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
6556 {
6557
6558 int i, x, y;
6559
6560 for (i = 0; i < NO_PICKUPS; i ++)
6561 {
6562 if (pickup[i].type == PICKUP_NONE)
6563 continue;
6564 if (pickup[i].x + 12000 < centre_x - (max_x / 2) * GRAIN
6565 || pickup[i].x - 12000 > centre_x + (max_x / 2) * GRAIN
6566 || pickup[i].y + 12000 < centre_y - (max_y / 2) * GRAIN
6567 || pickup[i].y - 12000 > centre_y + (max_y / 2) * GRAIN)
6568 continue;
6569 x = (pickup[i].x / GRAIN) - (centre_x / GRAIN);
6570 y = (pickup[i].y / GRAIN) - (centre_y / GRAIN);
6571
6572 draw_a_pickup(bmp, i, x + (max_x / 2), y + (max_y / 2));
6573
6574 }
6575
6576 }
6577
6578 void get_pickup_colour(int st, int cols [3])
6579 {
6580 if (game.mode_purple == 1)
6581 {
6582 cols [0] = TRANS_PURPLE;
6583 cols [1] = TRANS_PURPLE;
6584 return;
6585 }
6586 switch(st)
6587 {
6588 case ABILITY_PRIMARY:
6589 cols [0] = TRANS_YELLOW;
6590 cols [1] = TRANS_ORANGE;
6591 // cols [0] = COLOUR_YELLOW7;
6592 return;
6593 case ABILITY_DRIVE:
6594 cols [0] = TRANS_LGREEN;
6595 cols [1] = TRANS_DGREEN;
6596 return;
6597 case ABILITY_DEFENCE:
6598 cols [0] = TRANS_LBLUE;
6599 cols [1] = TRANS_DBLUE;
6600 // cols [0] = COLOUR_BLUE7;
6601 return;
6602 case ABILITY_SECONDARY:
6603 cols [0] = TRANS_DRED;
6604 cols [1] = TRANS_DRED;
6605 // cols [0] = COLOUR_RED7;
6606 return;
6607 }
6608 }
6609
6610
6611 void draw_a_pickup(BITMAP *bmp, int dr, int x, int y)
6612 {
6613 int x1, y1, x2;
6614
6615 int col;
6616 int cols [3] = {COLOUR_YELLOW8, COLOUR_YELLOW4, COLOUR_RED4};
6617 char dstr [30];
6618
6619 switch(pickup[dr].type)
6620 {
6621 case PICKUP_SQUARE:
6622 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6623 int points [8];
6624 get_pickup_colour(pickup[dr].subtype, cols);
6625 x1 = (counter * 16) & 1023;
6626 x2 = 8 + pulsate(32, 4, counter);
6627 points [0] = x + xpart(x1, x2);
6628 points [1] = y + ypart(x1, x2);
6629 points [2] = x + xpart(x1 + ANGLE_QUARTER, x2);
6630 points [3] = y + ypart(x1 + ANGLE_QUARTER, x2);
6631 points [4] = x - xpart(x1, x2);
6632 points [5] = y - ypart(x1, x2);
6633 points [6] = x - xpart(x1 + ANGLE_QUARTER, x2);
6634 points [7] = y - ypart(x1 + ANGLE_QUARTER, x2);
6635 polygon(bmp, 4, points, cols [0]);
6636 x1 = 1024 - ((counter * 8) & 1023);
6637 x2 = 10;// + pulsate(64, 4, counter);
6638 points [0] = x + xpart(x1, x2);
6639 points [1] = y + ypart(x1, x2);
6640 points [2] = x + xpart(x1 + ANGLE_QUARTER, x2);
6641 points [3] = y + ypart(x1 + ANGLE_QUARTER, x2);
6642 points [4] = x - xpart(x1, x2);
6643 points [5] = y - ypart(x1, x2);
6644 points [6] = x - xpart(x1 + ANGLE_QUARTER, x2);
6645 points [7] = y - ypart(x1 + ANGLE_QUARTER, x2);
6646 pline(bmp, points [0], points [1], points [2], points [3], cols [0]);
6647 pline(bmp, points [2], points [3], points [4], points [5], cols [0]);
6648 pline(bmp, points [4], points [5], points [6], points [7], cols [0]);
6649 pline(bmp, points [6], points [7], points [0], points [1], cols [0]);
6650 draw_a_light(bmp, 15 + pulsate(32, 4, counter), x, y);
6651 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6652 if (options.colour_text == 1)
6653 write_colour_text(bmp, x, y, pickup[dr].subtype);
6654 break;
6655 case PICKUP_CIRCLE:
6656 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6657 get_pickup_colour(pickup[dr].subtype, cols);
6658 circlefill(bmp, x, y, 4 + pulsate(32, 3, counter), cols[0]);
6659 circlefill(bmp, x + xpart(counter * 16, 10), y + ypart(counter * 16, 10), 3 - pulsate(16, 2, counter), cols[0]);
6660 circlefill(bmp, x + xpart(counter * 16 + ANGLE_HALF, 10), y + ypart(counter * 16 + ANGLE_HALF, 10), 3 - pulsate(16, 2, counter), cols[0]);
6661 // circle(bmp, x, y, 7, cols [0]);
6662 draw_a_light(bmp, 15 + pulsate(32, 4, counter), x, y);
6663 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6664 if (options.colour_text == 1)
6665 write_colour_text(bmp, x, y, pickup[dr].subtype);
6666 break;
6667 case PICKUP_TRIANGLE:
6668 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6669 get_pickup_colour(pickup[dr].subtype, cols);
6670 x1 = counter * 16 % 1023;
6671 x2 = 9 + pulsate(16, 3, counter);
6672 triangle(bmp, x + xpart(x1, x2), y + ypart(x1, x2),
6673 x + xpart(x1 + ANGLE_FULL / 3, x2), y + ypart(x1 + ANGLE_FULL / 3, x2),
6674 x + xpart(x1 - ANGLE_FULL / 3, x2), y + ypart(x1 - ANGLE_FULL / 3, x2),
6675 cols[0]);
6676 x1 = ANGLE_FULL - x1;
6677 x2 = 15 - pulsate(16, 5, counter);
6678 triangle(bmp, x + xpart(x1, x2), y + ypart(x1, x2),
6679 x + xpart(x1 + ANGLE_FULL / 3, 4), y + ypart(x1 + ANGLE_FULL / 3, 4),
6680 x + xpart(x1 - ANGLE_FULL / 3, 4), y + ypart(x1 - ANGLE_FULL / 3, 4),
6681 cols[0]);
6682 triangle(bmp, x + xpart(x1, 4), y + ypart(x1, 4),
6683 x + xpart(x1 + ANGLE_FULL / 3, x2), y + ypart(x1 + ANGLE_FULL / 3, x2),
6684 x + xpart(x1 - ANGLE_FULL / 3, 4), y + ypart(x1 - ANGLE_FULL / 3, 4),
6685 cols[0]);
6686 triangle(bmp, x + xpart(x1, 4), y + ypart(x1, 4),
6687 x + xpart(x1 + ANGLE_FULL / 3, 4), y + ypart(x1 + ANGLE_FULL / 3, 4),
6688 x + xpart(x1 - ANGLE_FULL / 3, x2), y + ypart(x1 - ANGLE_FULL / 3, x2),
6689 cols[0]);
6690 // triangle(bmp, x, y - 5, x - 4, y + 2, x + 4, y + 2, cols [0]);
6691 // circlefill(bmp, x, y, 7, TRANS_LRED);
6692 // circle(bmp, x, y, 7, TRANS_YELLOW);
6693 draw_a_light(bmp, 15 + pulsate(32, 4, counter), x, y);
6694 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6695 if (options.colour_text == 1)
6696 write_colour_text(bmp, x, y, pickup[dr].subtype);
6697 break;
6698 /* case PICKUP_CROSS:
6699 // drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6700 get_pickup_colour(pickup[dr].subtype, cols);
6701 rectfill(bmp, x - 2, y - 5, x + 2, y + 5, cols [0]);
6702 rectfill(bmp, x - 5, y - 2, x + 5, y + 2, cols [0]);
6703 // rect(bmp, x - 5, y - 5, x + 5, y + 5, TRANS_DBLUE);
6704 // line(bmp, x - 5, y - 5,
6705 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6706 break;*/
6707 // drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6708 case PICKUP_PRESYMBOL:
6709 // drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6710 // rectfill(bmp, x - 2, y - 5, x + 2, y + 5, COLOUR_WHITE);
6711 // rectfill(bmp, x - 5, y - 2, x + 5, y + 2, COLOUR_WHITE);
6712 // rect(bmp, x - 5, y - 5, x + 5, y + 5, TRANS_DBLUE);
6713 // line(bmp, x - 5, y - 5,
6714 // drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6715
6716 // circlefill(bmp, x + xpart(counter * 16, 10), y + ypart(counter * 16, 10), 3 - pulsate(16, 2, counter), cols[0]);
6717 // circlefill(bmp, x + xpart(counter * 16 + ANGLE_HALF, 10), y + ypart(counter * 16 + ANGLE_HALF, 10), 3 - pulsate(16, 2, counter), cols[0]);
6718 // putpixel(bmp, x + xpart(counter * 16, 10), y + ypart(counter * 16, 10), COLOUR_GREY5 + pulsate(64, 2, counter));
6719 // putpixel(bmp, x + xpart(counter * 16 + ANGLE_QUARTER, 10), y + ypart(counter * 16 + ANGLE_QUARTER, 10), COLOUR_GREY5 + pulsate(64, 2, counter));
6720 // putpixel(bmp, x - xpart(counter * 16, 10), y - ypart(counter * 16, 10), COLOUR_GREY5 + pulsate(64, 2, counter));
6721 // putpixel(bmp, x - xpart(counter * 16 + ANGLE_QUARTER, 10), y - ypart(counter * 16 + ANGLE_QUARTER, 10), COLOUR_GREY5 + pulsate(64, 2, counter));
6722 x1 = pickup[dr].timeout / 3 + 3;
6723 x2 = (64 - pickup[dr].timeout) / 18;
6724 cols [0] = COLOUR_WHITE - pickup[dr].timeout / 20;//COLOUR_GREY5 + pulsate(64, 2, counter);
6725 circlefill(bmp, x + xpart(counter * 32, x1), y + ypart(counter * 32, x1), x2, cols[0]);
6726 circlefill(bmp, x + xpart(counter * 32 + ANGLE_QUARTER, x1), y + ypart(counter * 32 + ANGLE_QUARTER, x1), x2, cols[0]);
6727 circlefill(bmp, x - xpart(counter * 32, x1), y - ypart(counter * 32, x1), x2, cols[0]);
6728 circlefill(bmp, x - xpart(counter * 32 + ANGLE_QUARTER, x1), y - ypart(counter * 32 + ANGLE_QUARTER, x1), x2, cols[0]);
6729 // circlefill(bmp, x + xpart(counter * 16, x1), y + ypart(counter * 16, x1), 3 - pulsate(16, 2, counter), cols[0]);
6730 // circlefill(bmp, x + xpart(counter * 16 + ANGLE_QUARTER, x1), y + ypart(counter * 16 + ANGLE_QUARTER, x1), 3 - pulsate(16, 2, counter), cols[0]);
6731 // circlefill(bmp, x - xpart(counter * 16, x1), y - ypart(counter * 16, x1), 3 - pulsate(16, 2, counter), cols[0]);
6732 // circlefill(bmp, x - xpart(counter * 16 + ANGLE_QUARTER, x1), y - ypart(counter * 16 + ANGLE_QUARTER, x1), 3 - pulsate(16, 2, counter), cols[0]);
6733 // draw_a_light(bmp, 15 + pulsate(64, 4, counter), x, y);
6734 draw_a_light(bmp, 8 + (64 - pickup[dr].timeout) / 5, x, y);
6735 break;
6736 case PICKUP_PRESECONDARY:
6737 // circlefill(bmp, x, y, 10 + xpart((counter * 64) % ANGLE_FULL, 5), COLOUR_GREY4);
6738 x1 = TRANS_DGREY;
6739 x2 = counter % 32;
6740 if (x2 < 20) x1 = TRANS_LGREY;
6741 if (x2 < 10) x1 = TRANS_WHITE;
6742 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6743 circle(bmp, x, y, 3 + x2 / 2, x1);
6744 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6745 secondary_name(pickup[dr].subtype, dstr);
6746 textprintf_centre_ex(bmp, small_font, x, y + 12, COLOUR_GREY3, -1, dstr);
6747 break;
6748 case PICKUP_SECONDARY:
6749 x1 = TRANS_DGREY;
6750 x2 = counter % 32;
6751 if (x2 < 29) x1 = TRANS_LGREY;
6752 // if (x2 < 26) x1 = TRANS_DRED;
6753 if (x2 < 23) x1 = TRANS_LRED;
6754 if (x2 < 18) x1 = TRANS_ORANGE;
6755 if (x2 < 13) x1 = TRANS_YELLOW;
6756 if (x2 < 8) x1 = TRANS_WHITE;
6757 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6758 circle(bmp, x, y, 3 + x2 / 2, x1);
6759 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6760 circlefill(bmp, x, y, 3 + pulsate(64, 2, counter), COLOUR_YELLOW4 + pulsate(64, 3, counter));
6761 secondary_name(pickup[dr].subtype, dstr);
6762 textprintf_centre_ex(bmp, small_font, x, y + 12, COLOUR_YELLOW4 + pulsate(16, 2, counter), -1, dstr);
6763 draw_a_light(bmp, 10 + pulsate(64, 5, counter), x, y);
6764 break;
6765 case PICKUP_REPAIR:
6766 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6767 rectfill(bmp, x - 6 - pulsate(64, 3, counter), y - 3, x + 6 + pulsate(64, 3, counter), y + 3, TRANS_ORANGE);
6768 rectfill(bmp, x - 3, y - 6 - pulsate(64, 3, counter), x + 3, y + 6 + pulsate(64, 3, counter), TRANS_ORANGE);
6769 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6770 draw_a_light(bmp, 10 + pulsate(64, 3, counter), x, y);
6771 break;
6772
6773
6774 default:
6775 // case PICKUP_UPGRADE3:
6776 col = COLOUR_PURPLE8;
6777 // case PICKUP_UPGRADE2:
6778 // if (pickup[dr].type == PICKUP_UPGRADE2)
6779 // col = COLOUR_RED8;
6780 // case PICKUP_UPGRADE1:
6781 // circlefill(bmp, x, y, 4, COLOUR_YELLOW4 + (pickup[dr].counter / 8) % 4);
6782 // circlefill(bmp, x, y, 1 + (pickup[dr].counter / 4) % 5, COLOUR_YELLOW6 + (pickup[dr].counter / 8) % 3);
6783 circlefill(bmp, x, y, 2, col - (pickup[dr].counter / 8) % 2);
6784 x1 = cos(angle_to_radians(pickup[dr].counter * 9)) * 7;
6785 y1 = sin(angle_to_radians(pickup[dr].counter * 9)) * 7;
6786 // circlefill(bmp, x + x1, y + y1, 1, COLOUR_YELLOW8 - (pickup[dr].counter / 8) % 3);
6787 // circlefill(bmp, x - x1, y - y1, 1, COLOUR_YELLOW8 - (pickup[dr].counter / 8) % 3);
6788 putpixel(bmp, x + x1, y + y1, col - (pickup[dr].counter / 8) % 3);
6789 putpixel(bmp, x - x1, y - y1, col - (pickup[dr].counter / 8) % 3);
6790 x1 = cos(angle_to_radians(pickup[dr].counter * 9) - PI / 4) * 7;
6791 y1 = sin(angle_to_radians(pickup[dr].counter * 9) - PI / 4) * 7;
6792 putpixel(bmp, x + x1, y + y1, col - 4 - (pickup[dr].counter / 8) % 3);
6793 putpixel(bmp, x - x1, y - y1, col - 4 - (pickup[dr].counter / 8) % 3);
6794 x1 = cos(angle_to_radians(pickup[dr].counter * 9) - PI / 8) * 7;
6795 y1 = sin(angle_to_radians(pickup[dr].counter * 9) - PI / 8) * 7;
6796 putpixel(bmp, x + x1, y + y1, col - 2 - (pickup[dr].counter / 8) % 3);
6797 putpixel(bmp, x - x1, y - y1, col - 2 - (pickup[dr].counter / 8) % 3);
6798 break;
6799 /* case PICKUP_SHIP:
6800 col = COLOUR_BLUE8;
6801 x1 = cos(angle_to_radians(pickup[dr].counter * 9)) * 8;
6802 y1 = sin(angle_to_radians(pickup[dr].counter * 9)) * 8;
6803 putpixel(bmp, x + x1, y + y1, col - (pickup[dr].counter / 8) % 3);
6804 putpixel(bmp, x - x1, y - y1, col - (pickup[dr].counter / 8) % 3);
6805 x1 = cos(angle_to_radians(pickup[dr].counter * 9) - PI / 4) * 8;
6806 y1 = sin(angle_to_radians(pickup[dr].counter * 9) - PI / 4) * 8;
6807 putpixel(bmp, x + x1, y + y1, col - 4 - (pickup[dr].counter / 8) % 3);
6808 putpixel(bmp, x - x1, y - y1, col - 4 - (pickup[dr].counter / 8) % 3);
6809 x1 = cos(angle_to_radians(pickup[dr].counter * 9) - PI / 8) * 8;
6810 y1 = sin(angle_to_radians(pickup[dr].counter * 9) - PI / 8) * 8;
6811 putpixel(bmp, x + x1, y + y1, col - 2 - (pickup[dr].counter / 8) % 3);
6812 putpixel(bmp, x - x1, y - y1, col - 2 - (pickup[dr].counter / 8) % 3);
6813 rectfill(bmp, x - 4, y - 4, x + 4, y + 5, COLOUR_PURPLE1);
6814 rect(bmp, x - 4, y - 4, x + 4, y + 5, COLOUR_PURPLE6);
6815 textprintf_ex(bmp, small_font, x - 2, y - 5, col - (pickup[dr].counter / 8) % 4, -1, "X");
6816 break;*/
6817 }
6818
6819 }
6820
6821 void write_colour_text(BITMAP *bmp, int x, int y, int which)
6822 {
6823 if (game.mode_purple == 1)
6824 {
6825 textprintf_centre_ex(bmp, small_font, x, y, COLOUR_WHITE, -1, "Purple"); // heh
6826 return;
6827 }
6828
6829 switch(which)
6830 {
6831 case ABILITY_PRIMARY:
6832 textprintf_centre_ex(bmp, small_font, x, y, COLOUR_WHITE, -1, "Yellow");
6833 break;
6834 case ABILITY_SECONDARY:
6835 textprintf_centre_ex(bmp, small_font, x, y, COLOUR_WHITE, -1, "Red");
6836 break;
6837 case ABILITY_DRIVE:
6838 textprintf_centre_ex(bmp, small_font, x, y, COLOUR_WHITE, -1, "Green");
6839 break;
6840 case ABILITY_DEFENCE:
6841 textprintf_centre_ex(bmp, small_font, x, y, COLOUR_WHITE, -1, "Blue");
6842 break;
6843 }
6844 }
6845
6846 void draw_eyes(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
6847 {
6848
6849 if (arena.hostile == 0)
6850 return;
6851
6852 int i, x, y;
6853 i = grand(arena.eyes_on_level);
6854 if (arena.eye_x [i] == 0)
6855 return;
6856
6857 for (i = 0; i < arena.eyes_on_level; i ++)
6858 {
6859 if (arena.eye_x [i] == 0)
6860 continue; // probably unnecessary
6861 if (arena.eye_x [i] + 3000 < centre_x - (max_x / 2) * GRAIN
6862 || arena.eye_x [i] - 3000 > centre_x + (max_x / 2) * GRAIN
6863 || arena.eye_y [i] + 3000 < centre_y - (max_y / 2) * GRAIN
6864 || arena.eye_y [i] - 3000 > centre_y + (max_y / 2) * GRAIN)
6865 continue;
6866 x = (arena.eye_x [i] / GRAIN) - (centre_x / GRAIN);
6867 y = (arena.eye_y [i] / GRAIN) - (centre_y / GRAIN);
6868
6869 draw_an_eye(bmp, i, x + (max_x / 2), y + (max_y / 2));
6870
6871 }
6872
6873 }
6874
6875
6876 void draw_an_eye(BITMAP *bmp, int i, int x, int y)
6877 {
6878
6879 // int eye_colours [5] = {TRANS_DRED, TRANS_LRED, TRANS_ORANGE, TRANS_YELLOW, TRANS_WHITE};
6880 // need to put this in arena so we can have eyes of different colours
6881
6882 // int angle;
6883 // int angle_plus;
6884
6885 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
6886 /* angle = (counter * 16) & 1023;
6887 if (i % 2 == 0)
6888 angle = ANGLE_FULL - angle;
6889 for (j = 0; j < 4; j ++)
6890 {
6891 circlefill(bmp, x + grand(3) - 1 + xpart(angle + (j * ANGLE_QUARTER), 13 + pulsate(64, 4, counter)),
6892 y + grand(3) - 1 + ypart(angle + (j * ANGLE_QUARTER), 13 + pulsate(64, 4, counter)),
6893 6 + grand(3), TRANS_DRED);
6894 }*/
6895
6896 circlefill(bmp, x + grand(3) - 1, y + grand(3) - 1, 13 + pulsate(64, 4, counter), arena.eye_colour3);
6897 circlefill(bmp, x + grand(3) - 1, y + grand(3) - 1, 9 + pulsate(64, 3, counter), arena.eye_colour2);
6898 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
6899 draw_a_light(bmp, 19 + pulsate(64, 3, counter) + grand(3), x + grand(3) - 1, y + grand(3) - 1);
6900 circlefill(bmp, x + grand(3) - 1, y + grand(3) - 1, 2 + grand(2), arena.eye_colour1);
6901
6902 }
6903
6904
6905
6906 void draw_grid(BITMAP *bmp, int max_x, int max_y, int play, int colour, int edge_colour, int x_offset, int centre_x, int centre_y, int finetune_x, int finetune_y)
6907 {
6908
6909
6910 int i;//, x, y;
6911
6912
6913 int no_x = max_x / GRID_WIDTH + 2;
6914 int no_y = max_y / GRID_WIDTH + 2 + special_600_y;
6915
6916 int ax = centre_x;// + inflicteda;
6917 int ay = centre_y;// + inflictede;
6918
6919 int min_x = 0;
6920 int min_y = 0;
6921 int dmax_x = max_x;
6922 int dmax_y = max_y;
6923 int draw_x = 0;
6924 int draw_y = 0;
6925
6926 // char highlight = 0;
6927
6928 int j;
6929 int tiled;
6930 int tx, ty;
6931
6932 if (ax / GRAIN < max_x / 2)
6933 {
6934 min_x = (max_x / 2) - ax / GRAIN;
6935 }
6936 if (ax / GRAIN > arena.max_x / GRAIN - max_x / 2)
6937 {
6938 dmax_x = (max_x / 2) + arena.max_x / GRAIN - ax / GRAIN;
6939 }
6940 if (ay / GRAIN < max_y / 2)
6941 {
6942 min_y = (max_y / 2) - ay / GRAIN;
6943 }
6944 if (ay / GRAIN > arena.max_y / GRAIN - max_y / 2)
6945 {
6946 dmax_y = (max_y / 2) + arena.max_y / GRAIN - ay / GRAIN;
6947 }
6948
6949 // parallax background:
6950 if (FALSE) //game.mode_void == 1)
6951 {
6952 clear_to_color(bmp, GC_GREY2);
6953 return;
6954 }
6955 else
6956 draw_rle_sprite(bmp, tile_background, 0 - (ax / (int) (GRAIN * 1.2)) % GRID_WIDTH, 0 - (ay / (int) (GRAIN * 1.2)) % GRID_WIDTH);
6957 //#ifdef DEBUG_DISPLAY
6958 // textprintf_centre_ex(bmp, small_font, 200,
6959 // 200, COLOUR_WHITE, -1, "(%i, %i)", 0 - (ax / (int) (GRAIN * 1.2)) % GRID_WIDTH, 0 - (ay / (int) (GRAIN * 1.2)) % GRID_WIDTH);
6960 //#endif
6961
6962 // parallax background: (old, slower way)
6963 /*
6964 for (i = -1; i < no_x; i ++)
6965 {
6966 // if ((i - 3) * GRID_WIDTH + ax / GRAIN >= arena.max_x / GRAIN + max_x / 2 - 94)
6967 if ((i - 3) * GRID_WIDTH + ax / GRAIN >= arena.max_x / GRAIN + max_x / 2 - 124 - finetune_x)
6968 {
6969 // if ((i - 3) * GRID_WIDTH + ax / GRAIN >= arena.max_x / GRAIN + max_x / 2 - 94)
6970 if ((i - 3) * GRID_WIDTH + ax / GRAIN >= arena.max_x / GRAIN + max_x / 2 - 124 - finetune_x)
6971 break;
6972 }
6973 if ((i + 1) * GRID_WIDTH <= min_x - 31)
6974 {
6975 continue;
6976 }
6977 if ((i + 1) * GRID_WIDTH <= min_x - 21 && min_x != 0)
6978 {
6979 continue;
6980 }
6981 for (j = 0; j < no_y; j ++)
6982 {
6983 if ((j - 1) * GRID_WIDTH + ay / GRAIN >= arena.max_y / GRAIN + max_y / 2 + 15)//+ 64)
6984 {
6985 if ((j - 1) * GRID_WIDTH + ay / GRAIN >= arena.max_y / GRAIN + max_y / 2 + 15) //64)
6986 break;
6987 }
6988 // if (min_y > 0 && (j + 1) * GRID_WIDTH <= min_y + 9 + (special_600_y * (ay < GRAIN * GRID_WIDTH)))
6989 if (min_y > 0 && (j + 1) * GRID_WIDTH <= min_y + 9) // with special_600_y removed so it can be used in calculation of no_y instead
6990 {
6991 continue;
6992 }
6993 {
6994 draw_rle_sprite(bmp, tile_rle [0], (i * GRID_WIDTH) - (ax / (int) (GRAIN * 1.2)) % GRID_WIDTH + 15 + finetune_x, (j * GRID_WIDTH) - (ay / (int) (GRAIN * 1.2)) % GRID_WIDTH - 15 + finetune_y);
6995 }
6996 }
6997 }
6998
6999 // end parallax background
7000 */
7001
7002 for (i = -1; i < no_x; i ++)
7003 {
7004 for (j = 0; j < no_y; j ++)
7005 {
7006 draw_x = (i * GRID_WIDTH) - (ax / GRAIN) % GRID_WIDTH + 15 + finetune_x;
7007 draw_y = (j * GRID_WIDTH) - (ay / GRAIN) % GRID_WIDTH - 15 + finetune_y;
7008 if (draw_x < -GRID_WIDTH || draw_x > scr_x)
7009 continue;
7010 if (draw_y < -GRID_WIDTH || draw_y > scr_y)
7011 continue;
7012 tx = ((ax / GRID_WIDTH) / GRAIN) + x_offset + i - (max_x / GRID_WIDTH) + 8;
7013 ty = ((ay / GRID_WIDTH) / GRAIN) + j - (max_y / GRID_WIDTH) + 6;
7014 if (tx < 0 || tx > arena.max_x / 50000 + 4 || ty < 0 || ty > arena.max_y / 50000 + 4)
7015 {
7016 tiled = getpixel(level_bmp, 0, 0);
7017 }
7018 else
7019 tiled = getpixel(level_bmp, tx, ty);
7020 if (tiled < 0 || tiled > NO_TILE_RLES || tile_rle [tiled] == NULL)
7021 {
7022 // draw_rle_sprite(bmp, tile_rle [], (i * GRID_WIDTH) - (ax / GRAIN) % GRID_WIDTH + 15 + finetune_x, (j * GRID_WIDTH) - (ay / GRAIN) % GRID_WIDTH - 15 + finetune_y);
7023 #ifdef DEBUG_DISPLAY
7024 textprintf_centre_ex(bmp, small_font, (i * GRID_WIDTH) - (ax / GRAIN) % GRID_WIDTH + 40,
7025 (j * GRID_WIDTH) - (ay / GRAIN) % GRID_WIDTH + 10, COLOUR_WHITE, -1, "%i %i %i", tx, ty, tiled);
7026 #endif
7027 }
7028 else
7029 {
7030 if (tiled > 0)
7031 draw_rle_sprite(bmp, tile_rle [tiled], draw_x, draw_y);
7032 }
7033 // textprintf_centre_ex(bmp, small_font, draw_x,
7034 // draw_y, COLOUR_WHITE, -1, "%i %i %i", tx, ty, tiled);
7035 }
7036 }
7037 return;
7038
7039 /*
7040 for (i = -1; i < no_x; i ++)
7041 {
7042 if ((i + 2) * GRID_WIDTH + ax / GRAIN >= arena.max_x / GRAIN + max_x / 2 - 14)
7043 {
7044 // highlight = 1; // was - 2
7045 if ((i - 3) * GRID_WIDTH + ax / GRAIN >= arena.max_x / GRAIN + max_x / 2 - 14)
7046 break;
7047 }
7048 if ((i + 2) * GRID_WIDTH <= min_x - 71)
7049 {
7050 // highlight = 1;
7051 continue;
7052 }
7053 if ((i + 2) * GRID_WIDTH <= min_x - 21 && min_x != 0)
7054 {
7055 // highlight = 1;
7056 continue;
7057 }
7058 for (j = 0; j < no_y; j ++)
7059 {
7060 if ((j + 2) * GRID_WIDTH + ay / GRAIN >= arena.max_y / GRAIN + max_y / 2 + visible_grids_y)//+ 64)
7061 {
7062 if ((j - 2) * GRID_WIDTH + ay / GRAIN >= arena.max_y / GRAIN + max_y / 2 + visible_grids_y) //64)
7063 break;
7064 }
7065 if (min_y > 0 && (j + 2) * GRID_WIDTH <= min_y + 9 + (special_600_y * (ay < GRAIN * GRID_WIDTH)))
7066 {
7067 continue;
7068 }
7069 tx = ((ax / GRID_WIDTH) / GRAIN) + x_offset + i - (max_x / GRID_WIDTH) + 8;
7070 ty = ((ay / GRID_WIDTH) / GRAIN) + j - (max_y / GRID_WIDTH) + 6;
7071 tiled = getpixel(level_bmp, tx, ty);
7072 if (tiled < 0 || tiled > NO_TILE_RLES || tile_rle [tiled] == NULL)
7073 {
7074 #ifdef DEBUG_DISPLAY
7075 textprintf_centre_ex(bmp, small_font, (i * GRID_WIDTH) - (ax / GRAIN) % GRID_WIDTH + 40,
7076 (j * GRID_WIDTH) - (ay / GRAIN) % GRID_WIDTH + 10, COLOUR_WHITE, -1, "%i %i %i", tx, ty, tiled);
7077 #endif
7078 }
7079 else
7080 {
7081 if (tiled > 0)
7082 // draw_rle_sprite(bmp, tile_rle [tiled], (i * GRID_WIDTH) - (ax / GRAIN) % GRID_WIDTH + 15 + finetune, (j * GRID_WIDTH) - (ay / GRAIN) % GRID_WIDTH - 15);
7083 draw_rle_sprite(bmp, tile_rle [tiled], (i * GRID_WIDTH) - (ax / GRAIN) % GRID_WIDTH + 15 + finetune_x, (j * GRID_WIDTH) - (ay / GRAIN) % GRID_WIDTH - 15 + finetune_y);
7084 }
7085 }
7086 }
7087 return;
7088 */
7089 /*
7090 old lacewing line drawing?
7091
7092 // float star_angle;
7093 // int distance;
7094
7095 for (i = 0; i < no_x; i ++)
7096 {
7097 if ((i + 1) * GRID_WIDTH + ax / GRAIN > arena.max_x / GRAIN + max_x / 2 + 50)
7098 {
7099 highlight = 1;
7100 if (i * GRID_WIDTH + ax / GRAIN > arena.max_x / GRAIN + max_x / 2 + 50)
7101 break;
7102 }
7103 if (i * GRID_WIDTH <= min_x - 6)
7104 {
7105 highlight = 1;
7106 continue;
7107 }
7108 x = i * GRID_WIDTH - ((ax + x_offset) / GRAIN) % GRID_WIDTH;
7109 // x = i * GRID_WIDTH - (actor[player[play].actor_controlled].y / GRAIN) % GRID_WIDTH;
7110 if (highlight == 1)
7111 {
7112 pline(bmp, x, min_y - 4, x, dmax_y, edge_colour);
7113 highlight = 0;
7114 }
7115 else
7116 pline(bmp, x, min_y - 4, x, dmax_y, colour);
7117 }
7118
7119 for (i = 0; i < no_y; i ++)
7120 {
7121 if ((i + 1) * GRID_WIDTH + ay / GRAIN > arena.max_y / GRAIN + max_y / 2 + 64)
7122 {
7123 highlight = 1;
7124 if (i * GRID_WIDTH + ay / GRAIN > arena.max_y / GRAIN + max_y / 2 + 64)
7125 break;
7126 }
7127 if (min_y > 0 && i * GRID_WIDTH <= min_y + 9 + (special_600_y * (ay < GRAIN * GRID_WIDTH)))
7128 {
7129 highlight = 1;
7130 continue;
7131 }
7132 y = i * GRID_WIDTH - ((ay + grid_offset_y) / GRAIN) % GRID_WIDTH;
7133 // y = i * GRID_WIDTH + (actor[player[play].actor_controlled].x / GRAIN) % GRID_WIDTH;
7134 if (highlight == 1)
7135 {
7136 pline(bmp, min_x - 4, y - 15, dmax_x, y - 15, edge_colour);
7137 highlight = 0;
7138 }
7139 else
7140 pline(bmp, min_x - 4, y - 15, dmax_x, y - 15, colour);
7141 }
7142
7143 */
7144 /*
7145
7146 WITHOUT TILES
7147 int i, x, y;
7148
7149 int no_x = max_x / GRID_WIDTH + 2;
7150 int no_y = max_y / GRID_WIDTH + 2;
7151
7152 int ax = actor[player[play].actor_controlled].x;// + inflicteda;
7153 int ay = actor[player[play].actor_controlled].y;// + inflictede;
7154
7155 int min_x = 0;
7156 int min_y = 0;
7157 int dmax_x = max_x;
7158 int dmax_y = max_y;
7159
7160 char highlight = 0;
7161
7162 if (ax / GRAIN < max_x / 2)
7163 {
7164 min_x = (max_x / 2) - ax / GRAIN;
7165 }
7166 if (ax / GRAIN > arena.max_x / GRAIN - max_x / 2)
7167 {
7168 dmax_x = (max_x / 2) + arena.max_x / GRAIN - ax / GRAIN;
7169 }
7170 if (ay / GRAIN < max_y / 2)
7171 {
7172 min_y = (max_y / 2) - ay / GRAIN;
7173 }
7174 if (ay / GRAIN > arena.max_y / GRAIN - max_y / 2)
7175 {
7176 dmax_y = (max_y / 2) + arena.max_y / GRAIN - ay / GRAIN;
7177 }
7178
7179
7180 // float star_angle;
7181 // int distance;
7182
7183 for (i = 0; i < no_x; i ++)
7184 {
7185 if ((i + 1) * GRID_WIDTH + ax / GRAIN > arena.max_x / GRAIN + max_x / 2 + 50)
7186 {
7187 highlight = 1;
7188 if (i * GRID_WIDTH + ax / GRAIN > arena.max_x / GRAIN + max_x / 2 + 50)
7189 break;
7190 }
7191 if (i * GRID_WIDTH <= min_x - 6)
7192 {
7193 highlight = 1;
7194 continue;
7195 }
7196 x = i * GRID_WIDTH - ((ax + x_offset) / GRAIN) % GRID_WIDTH;
7197 // x = i * GRID_WIDTH - (actor[player[play].actor_controlled].y / GRAIN) % GRID_WIDTH;
7198 if (highlight == 1)
7199 {
7200 pline(bmp, x, min_y - 4, x, dmax_y, edge_colour);
7201 highlight = 0;
7202 }
7203 else
7204 pline(bmp, x, min_y - 4, x, dmax_y, colour);
7205 }
7206
7207 for (i = 0; i < no_y; i ++)
7208 {
7209 if ((i + 1) * GRID_WIDTH + ay / GRAIN > arena.max_y / GRAIN + max_y / 2 + 64)
7210 {
7211 highlight = 1;
7212 if (i * GRID_WIDTH + ay / GRAIN > arena.max_y / GRAIN + max_y / 2 + 64)
7213 break;
7214 }
7215 if (min_y > 0 && i * GRID_WIDTH <= min_y + 9 + (special_600_y * (ay < GRAIN * GRID_WIDTH)))
7216 {
7217 highlight = 1;
7218 continue;
7219 }
7220 y = i * GRID_WIDTH - ((ay + grid_offset_y) / GRAIN) % GRID_WIDTH;
7221 // y = i * GRID_WIDTH + (actor[player[play].actor_controlled].x / GRAIN) % GRID_WIDTH;
7222 if (highlight == 1)
7223 {
7224 pline(bmp, min_x - 4, y - 15, dmax_x, y - 15, edge_colour);
7225 highlight = 0;
7226 }
7227 else
7228 pline(bmp, min_x - 4, y - 15, dmax_x, y - 15, colour);
7229 }
7230
7231 */
7232 }
7233
7234
7235 int pline(BITMAP *bmp, int x1, int y1, int x2, int y2, int colour)
7236 {
7237 if (x1 < -100 || y1 < -100 || x1 > 1300 || y1 > 1000
7238 || x2 < -100 || y2 < -100 || x2 > 1300 || y2 > 1000)
7239 return 0;
7240 line(bmp, x1, y1, x2, y2, colour);
7241 return 1;
7242 }
7243
7244 void bordered_rect(BITMAP *bmp, int x1, int y1, int x2, int y2, int colour1, int colour2)
7245 {
7246 rectfill(bmp, x1, y1, x2, y2, colour1);
7247 rect(bmp, x1, y1, x2, y2, colour2);
7248 // hline(bmp, x1, y1, x2, colour2);
7249 /// hline(bmp, x1, y2, x2, colour2);
7250 // vline(bmp, x1, y1, y2, colour2);
7251 // vline(bmp, x2, y1, y2, colour2);
7252
7253 }
7254
7255 void bordered_triangle(BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, int y3, int col1, int col2)
7256 {
7257 triangle(bmp, x1, y1, x2, y2, x3, y3, col1);
7258 pline(bmp, x1, y1, x2, y2, col2);
7259 pline(bmp, x1, y1, x3, y3, col2);
7260 pline(bmp, x2, y2, x3, y3, col2);
7261 }
7262
7263 void indicate_fps(BITMAP *bmp, int play)
7264 {
7265 // textprintf_ex(bmp, small_font, 20, 110, 5, "Xs %i Ys %i TS %f DS %f Drag %i",
7266 // actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed, hypot(actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed), hypot(actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed) * game.drag, actor[player[play].actor_controlled].drag_amount);
7267 // textprintf_ex(bmp, small_font, 20, 60, 5, "Stack %i", stackavail());
7268 // textprintf(bmp, small_font, 20, 90, 5, "Slack %i", slacktime);
7269 // textprintf(bmp, small_font, 20, 100, 5, "Lock %i", actor[0].lock);
7270 //textprintf_ex(bmp, small_font, 20, 100, COLOUR_GREY5, -1, "Fps %i", frames_per_second);
7271 // textprintf_ex(bmp, small_font, 20, 50, 5, -1, "Fps} %i", frames_per_second);
7272 #ifdef DEBUG_DISPLAY
7273 textprintf_ex(bmp, small_font, 20, 90, 5, -1, "Fps %i", frames_per_second);
7274 textprintf_ex(bmp, small_font, 20, 100, 5, -1, "Slack %i", slacktime);
7275 textprintf_ex(bmp, small_font, 20, 110, 5, -1, "LSlack %i", long_slacktime_store);
7276 int i, c = 0;
7277 for (i = 0; i < NO_ENEMIES; i ++)
7278 {
7279 if (enemy[i].type != ENEMY_NONE)
7280 c++;
7281 }
7282 textprintf_ex(bmp, small_font, 20, 120, 5, -1, "e %i", c);
7283 c = 0;
7284 for (i = 0; i < NO_BULLETS; i ++)
7285 {
7286 if (bullet[i].type != BULLET_NONE)
7287 c++;
7288 }
7289 textprintf_ex(bmp, small_font, 20, 130, 5, -1, "b %i", c);
7290 c = 0;
7291 for (i = 0; i < NO_CLOUDS; i ++)
7292 {
7293 if (cloud[i].type != CLOUD_NONE)
7294 c++;
7295 }
7296 textprintf_ex(bmp, small_font, 20, 140, 5, -1, "c %i", c);
7297
7298 textprintf_ex(bmp, small_font, 20, 150, 5, -1, "%i %i %i %i", debug_sound [0], debug_sound [1], debug_sound [2], debug_sound [3]);
7299
7300
7301 if (slack_graph_pos < 0 || slack_graph_pos > 99)
7302 slack_graph_pos = 0;
7303
7304 slack_graph [slack_graph_pos] = slacktime;
7305
7306 c = slack_graph_pos;
7307 for (i = 0; i < 100; i ++)
7308 {
7309 if (slack_graph [c] <= 5)
7310 vline(bmp, 110 - i, 300, 160, COLOUR_RED5);
7311 else
7312 vline(bmp, 110 - i, 300, 300 - (slack_graph [c] / 6000), COLOUR_YELLOW8);
7313 c --;
7314 if (c < 0)
7315 c = 99;
7316 }
7317
7318 slack_graph_pos ++;
7319
7320
7321
7322
7323
7324
7325 if (fps_graph_pos < 0 || fps_graph_pos > 99)
7326 fps_graph_pos = 0;
7327
7328 fps_graph [fps_graph_pos] = frames_per_second;
7329
7330 c = fps_graph_pos;
7331 for (i = 0; i < 100; i ++)
7332 {
7333 if (fps_graph [c] <= 25)
7334 vline(bmp, 110 - i, 360, 310, COLOUR_RED5);
7335 else
7336 vline(bmp, 110 - i, 360, 360 - (fps_graph [c] - 25) * 4, COLOUR_GREEN8);
7337 c --;
7338 if (c < 0)
7339 c = 99;
7340 }
7341
7342 hline(bmp, 10, 324, 110, COLOUR_WHITE);
7343
7344 fps_graph_pos ++;
7345
7346
7347
7348
7349 /* textprintf_ex(bmp, small_font, 20, 120, 5, -1, "Var1 %i", var1);
7350 textprintf_ex(bmp, small_font, 20, 130, 5, -1, "Var2 %i", var2);
7351 textprintf_ex(bmp, small_font, 20, 140, 5, -1, "Var3 %i", var3);*/
7352 #endif
7353 /* textprintf(bmp, font, 20, 110, 5, "Xs} %i Ys} %i Drag} %i",
7354 actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed, actor[player[play].actor_controlled].drag_amount);
7355 textprintf(bmp, font, 20, 140, 5, "X} %i Y} %i ",
7356 actor[player[play].actor_controlled].x, actor[player[play].actor_controlled].y);
7357 textprintf(bmp, font, 20, 170, 5, "Angle} %i Wants} %i Att} %i Rec} %i ",
7358 enemy[0].angle, enemy[0].attribute [ATTRIB_SWERVER_ANGLE], enemy[0].attacking, enemy[0].recycle);
7359 textprintf(bmp, font, 20, 200, 5, "Lock} %i ", actor[0].lock);*/
7360 /* textprintf(bmp, small_font, 20, 50, 5, "FPS %i", frames_per_second);
7361 textprintf(bmp, small_font, 20, 60, 5, "SLACK %i", slacktime);
7362 textprintf(bmp, small_font, 20, 70, 5, "XS %i YS %i DRAG %i",
7363 actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed, actor[player[play].actor_controlled].drag_amount);
7364 textprintf(bmp, small_font, 20, 80, 5, "X %i Y %i ",
7365 actor[player[play].actor_controlled].x, actor[player[play].actor_controlled].y);
7366 textprintf(bmp, small_font, 20, 90, 5, "ANGLE %i WANTS %i ATT %i REC %i ",
7367 enemy[0].angle, enemy[0].attribute [ATTRIB_SWERVER_ANGLE], enemy[0].attacking, enemy[0].recycle);
7368 textprintf(bmp, small_font, 20, 100, 5, "LOCK %i ", actor[0].lock);
7369 textprintf(bmp, small_font, 20, 110, 5, "Angle %i ", actor[0].angle / 16);*/
7370 // textprintf(bmp, font, 20, 160, 5, "inflicteda %i inflictede %i ", inflicteda, inflictede);
7371 // textprintf(bmp, font, 20, 170, 5, "angle %i wants %i mode %i attacking %i ",
7372 // enemy[0].angle, 0, enemy[0].attribute [ATTRIB_FIGHTER_MODE], enemy[0].attacking);
7373 /* textprintf(bmp, font, 20, 180, 5, "hive %i mode %i attack %i hive at13 %i hive at24 %i xd %i yd %i",
7374 enemy[1].attribute [ATTRIB_BEE_HIVE], enemy[1].attribute [ATTRIB_BEE_MODE], enemy[1].attacking,
7375 enemy[enemy[1].attribute [ATTRIB_BEE_HIVE]].attribute [ATTRIB_HIVE_ATTACK13], enemy[enemy[1].attribute [ATTRIB_BEE_HIVE]].attribute [ATTRIB_HIVE_ATTACK24],
7376 enemy[1].attribute [ATTRIB_BEE_X_DEST], enemy[1].attribute [ATTRIB_BEE_Y_DEST]);*/
7377 }
7378
7379 // no inter-level announcements any more, but this still clears the bitmaps
7380 void level_announcement(void)
7381 {
7382
7383 clear_bitmap(screen);
7384 if (player1 != NULL)
7385 clear_bitmap(player1);
7386 if (player2 != NULL)
7387 clear_bitmap(player2);
7388
7389
7390 return;
7391
7392 // int waiting = 30;
7393
7394 // if (arena.level == 1)
7395 // waiting = 60;
7396 // else
7397 // return; // actually, it's better not to have a big level sign thing... it's an annoying delay.
7398
7399 //#ifdef DEBUG_DISPLAY
7400 // waiting = 2;
7401 //#endif
7402 /*
7403 ticked = 0;
7404
7405 do
7406 {
7407 while(ticked > 0)
7408 {
7409 waiting --;
7410 ticked --;
7411 };
7412 // if ((waiting / 5) % 2 == 0)
7413 {
7414 textprintf_centre_ex(screen, font2, 320 + text_offset_x, 220 + text_offset_y, COLOUR_YELLOW8 - (waiting / 2) % 4, -1, "{___get___ready___}");
7415 textprintf_centre_ex(screen, font, 320 + text_offset_x, 220 + text_offset_y, -1, -1, "{___get___ready___}");
7416 }
7417 // else
7418 // {
7419 // textprintf_centre_ex(screen, font2, 320 + text_offset_x, 220 + text_offset_y, COLOUR_BLACK, -1, "{___get___ready___}");
7420 // textprintf_centre_ex(screen, font, 320 + text_offset_x, 220 + text_offset_y, COLOUR_BLACK, -1, "{___get___ready___}");
7421 // }
7422 // textprintf_centre_ex(screen, font2, 320 + text_offset_x, 180 + text_offset_y, COLOUR_ORANGE8 - (waiting / 3) % 4, -1, "__{level__%i__}", arena.level);
7423 // textprintf_centre_ex(screen, font, 320 + text_offset_x, 180 + text_offset_y, -1, -1, "{__level__%i__}", arena.level);
7424
7425
7426 } while (waiting > 0);
7427 */
7428 /*
7429 int v;
7430
7431 for (v = 0; v < 20; v ++)
7432 {
7433 textprintf_ex(screen, small_font, 20, v * 10 + 20, COLOUR_GREEN8, -1, "%i %f %i %i %i", v, cos_table [v], v & 1023, cos_table [v & 1023], xpart(v, 1000));
7434
7435 }
7436
7437 textprintf_ex(screen, small_font, 20, v * 10 + 30, COLOUR_GREEN8, -1, "X to continue...");
7438
7439 do
7440 {
7441
7442 } while (key [KEY_X] == 0);
7443 */
7444
7445 // clear_bitmap(screen);
7446
7447 }
7448
7449
7450
7451 /*void display_messages(BITMAP *bmp, int play, int max_x, int max_y)
7452 {
7453
7454 // return;
7455
7456 int i, j;
7457 int col1, col2;
7458 int y_loc;
7459 // int x_offset;
7460
7461 // FONT *msgfont1;
7462 // FONT *msgfont2;
7463
7464 for (i = 0; i < NO_MESSAGES; i ++)
7465 {
7466 if (strlen(messages [play] [i]) == 0)
7467 continue;
7468 if (message_counter [play] [i] > 100)
7469 {
7470 kill_message(play, i);
7471 continue;
7472 } // can be killed later also
7473
7474 message_counter [play] [i] ++;
7475 int count = message_counter [play] [i];
7476 y_loc = 150 + i * 12;
7477 // msgfont1 = font;
7478 // msgfont2 = font2;
7479
7480
7481 if (count > 40)
7482 {
7483 kill_message(play, i);
7484 continue;
7485 }
7486
7487 switch(count / 5)
7488 {
7489 case 0: col1 = COLOUR_WHITE;
7490 break;
7491 // case 1: col1 = message_style [play] [i];
7492 // break;
7493 default: col1 = message_style [play] [i] - (count / 5) + 1;
7494 col2 = message_style [play] [i] - 4;
7495 break;
7496 }
7497 for (j = 0; j < 4; j ++)
7498 {
7499 // textprintf_centre_ex(bmp, small_font, max_x / 2 + xpart(counter + j * ANGLE_QUARTER, 25), y_loc + ypart(counter + j * ANGLE_QUARTER, 12), col1, -1, messages [play] [i]);
7500 // county = 1;
7501 // if (
7502 // textprintf_centre_ex(bmp, small_font, max_x / 2 + xpart((counter * 12) + j * ANGLE_QUARTER, 25), y_loc + ypart((counter * 16) + j * ANGLE_QUARTER, 12), col2, -1, messages [play] [i]);
7503 // textprintf_centre_ex(bmp, small_font, max_x / 2 + xpart((counter * 12) + j * ANGLE_QUARTER, 40 - count), y_loc + ypart((counter * 16) + j * ANGLE_QUARTER, 20 - (count / 2)), col2, -1, messages [play] [i]);
7504 textprintf_centre_ex(bmp, small_font, max_x / 2 + xpart((counter * 12) + j * ANGLE_QUARTER, 80 - (count * 2)), y_loc + ypart((counter * 16) + j * ANGLE_QUARTER, 40 - count), col2, -1, messages [play] [i]);
7505 }
7506 textprintf_centre_ex(bmp, small_font, max_x / 2, y_loc, col1, -1, messages [play] [i]);
7507 } // end loop
7508 }
7509
7510 void kill_message(int play, int i)
7511 {
7512 // return;
7513
7514 messages [play] [i] [0] = '\0';
7515
7516 }
7517
7518
7519 void init_messages(void)
7520 {
7521 // return;
7522
7523 int i;
7524
7525 for (i = 0; i < 4; i ++)
7526 {
7527 strcpy(messages [0] [i], "");
7528 strcpy(messages [1] [i], "");
7529 message_style [0] [i] = STYLE_NONE;
7530 message_style [1] [i] = STYLE_NONE;
7531 message_counter [0] [i] = 0;
7532 message_counter [1] [i] = 0;
7533 }
7534
7535 }
7536
7537 // It's okay to send a message to a non-existent player
7538 void send_message(int play, const char *msg, int style)
7539 {
7540 return;
7541 // return;
7542 // return;
7543
7544 int i;
7545
7546 for (i = 0; i < 4; i ++)
7547 {
7548 if (messages [play] [i] [0] == 0 || i == 3)
7549 break;
7550 }
7551 // slot 3 will be overwritten if there're no gaps
7552
7553 strcpy(messages [play] [i], msg);
7554 message_style [play] [i] = style;
7555 message_counter [play] [i] = 0;
7556 if (game.users > 1)
7557 {
7558 message_counter [play] [i] = 10;
7559 }
7560
7561 }
7562
7563 */
7564 void display_quit_query(void)
7565 {
7566 if (game.mode_void == 0)
7567 {
7568 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
7569 rectfill(screen, 140 + text_offset_x, 150 + text_offset_y, 500 + text_offset_x, 280 + text_offset_y, TRANS_DGREY);
7570 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
7571 }
7572
7573 rect(screen, 140 + text_offset_x, 150 + text_offset_y, 500 + text_offset_x, 280 + text_offset_y, COLOUR_BLUE2);
7574 rect(screen, 139 + text_offset_x, 149 + text_offset_y, 501 + text_offset_x, 281 + text_offset_y, COLOUR_BLUE3);
7575 rect(screen, 138 + text_offset_x, 148 + text_offset_y, 502 + text_offset_x, 282 + text_offset_y, COLOUR_BLUE4);
7576 rect(screen, 137 + text_offset_x, 147 + text_offset_y, 503 + text_offset_x, 283 + text_offset_y, COLOUR_BLUE5);
7577 rect(screen, 136 + text_offset_x, 146 + text_offset_y, 504 + text_offset_x, 284 + text_offset_y, COLOUR_BLUE6);
7578
7579 textprintf_centre_ex(screen, font2, 320 + text_offset_x, 180 + text_offset_y, COLOUR_GREEN6, -1, "{__quit__}");
7580 textprintf_centre_ex(screen, font, 320 + text_offset_x, 180 + text_offset_y, -1, -1, "{__quit__}");
7581 textprintf_centre_ex(screen, font2, 320 + text_offset_x, 230 + text_offset_y, COLOUR_BLUE8, -1, "{_y__or__n_}");
7582 textprintf_centre_ex(screen, font, 320 + text_offset_x, 230 + text_offset_y, -1, -1, "{_y__or__n_}");
7583
7584 }
7585
7586 // needed because the box overlaps the space between p1 and p2 screens
7587 void clear_quit_query(void)
7588 {
7589
7590 // vsync();
7591 // clear_bitmap(screen);
7592
7593 rectfill(screen, 140 + text_offset_x, 140 + text_offset_y, 510 + text_offset_x, 290 + text_offset_y, 0);
7594
7595 }
7596
7597
7598
7599
7600
7601
0 void run_display(void);
1 void level_announcement(void);
2 void display_quit_query(void);
3 void clear_quit_query(void);
4
5 #define GB_SHIP_TYPES 8
6
7 #define NO_TILE_RLES 40
8
9
10 enum
11 {
12 BMP_WHATEVER,
13
14 ENEMY1_BMPS
15 };
16
17 enum
18 {
19 RLE_ENEMY1_STINGER,
20 RLE_ENEMY1_DRIFTER,
21 RLE_ENEMY1_WANDERER,
22 RLE_ENEMY1_SUN,
23 RLE_ENEMY1_SUN_WHITE,
24 RLE_ENEMY1_JELLY1,
25 RLE_ENEMY1_JELLY2,
26 RLE_ENEMY1_JELLY3,
27 RLE_ENEMY1_JELLY4,
28 RLE_ENEMY1_JELLY5,
29 RLE_ENEMY1_JELLY6,
30 RLE_ENEMY1_MINETHROWER,
31 RLE_ENEMY1_MINETHROWER2,
32 RLE_ENEMY1_CURVER,
33 RLE_ENEMY1_STINGER2,
34 RLE_ENEMY1_BLASTER,
35 RLE_ENEMY1_STINGER3,
36 RLE_ENEMY1_FLAKKER,
37 RLE_ENEMY1_SUPERJELLY,
38 RLE_ENEMY1_HIVE,
39 RLE_ENEMY1_STINGER4,
40 RLE_ENEMY1_FLAKKER2,
41 RLE_ENEMY1_BOLTER,
42 RLE_ENEMY1_BOLTER2,
43 RLE_ENEMY1_TORPER1_1,
44 RLE_ENEMY1_TORPER1_2,
45 RLE_ENEMY1_TORPER1_3,
46 RLE_ENEMY1_TORPER1_4,
47 RLE_ENEMY1_HURLER,
48 RLE_ENEMY1_HURLER2,
49 ENEMY1_RLES
50 };
51
52 enum
53 {
54 BMP_ENEMY_PULSER1_V,
55 BMP_ENEMY_PULSER1_H,
56 BMP_ENEMY_PULSER2_V,
57 BMP_ENEMY_PULSER2_H,
58 ENEMY_BMPS
59 };
60
61 enum
62 {
63 RLE_ENEMY2_CRAWLER2_D,
64 RLE_ENEMY2_CRAWLER2_L,
65 RLE_ENEMY2_CRAWLER2_R,
66 RLE_ENEMY2_CRAWLER3_D,
67 RLE_ENEMY2_CRAWLER3_L,
68 RLE_ENEMY2_CRAWLER3_R,
69 RLE_ENEMY2_CRAWLER4_D,
70 RLE_ENEMY2_CRAWLER4_L,
71 RLE_ENEMY2_CRAWLER4_R,
72 ENEMY2_RLES
73 };
74
75 enum
76 {
77 RLE_ENEMY3_FIREBASE,
78 RLE_ENEMY3_FIREBASE2,
79 RLE_ENEMY3_FIREBASE3,
80 RLE_ENEMY3_BOSS1,
81 RLE_ENEMY3_BOSS3,
82 RLE_ENEMY3_BOSS4,
83 ENEMY3_RLES
84 };
85
86 enum
87 {
88 RLE_ENEMY4_GUARDIAN1,
89 RLE_ENEMY4_BRACKET1,
90 RLE_ENEMY4_WORMER1,
91 RLE_ENEMY4_BRACKET2,
92 RLE_ENEMY4_BRACKET3,
93 RLE_ENEMY4_BRACKET4,
94 RLE_ENEMY4_GUARDIAN2,
95 RLE_ENEMY4_GUARDIAN3,
96 RLE_ENEMY4_WORMER2,
97 RLE_ENEMY4_WORMER3,
98 RLE_ENEMY4_FORKER1,
99 RLE_ENEMY4_FORKER2,
100 RLE_ENEMY4_MINER1,
101 RLE_ENEMY4_MINER2,
102 ENEMY4_RLES
103 };
104
105 enum
106 {
107 RLE_ENEMY6_MINER3,
108 RLE_ENEMY6_CIRCLER1,
109 RLE_ENEMY6_MULTI1,
110 RLE_ENEMY6_MULTI2,
111 RLE_ENEMY6_MULTI3,
112 RLE_ENEMY6_GUARDIAN4,
113 RLE_ENEMY6_GUARDIAN5,
114 RLE_ENEMY6_BRACKET5,
115 RLE_ENEMY6_CURVE1,
116 RLE_ENEMY6_CURVE2,
117 RLE_ENEMY6_CURVE3,
118 ENEMY6_RLES
119 };
120
121 enum
122 {
123 RLE_ENEMY5_HEAD1,
124 RLE_ENEMY5_OVERTRIANGLER,
125 RLE_ENEMY5_DEFENDER1,
126 RLE_ENEMY5_DEFENDER2,
127 RLE_ENEMY5_DEFENDER3,
128 RLE_ENEMY5_OVERDISRUPTER,
129 ENEMY5_RLES
130 };
131
132 enum
133 {
134 RLE_ENEMY7_BOSS1_1,
135 RLE_ENEMY7_BOSS1_2,
136 RLE_ENEMY7_BOSS1_3,
137 RLE_ENEMY7_BOSS2_2,
138 RLE_ENEMY7_BOSS3_2,
139 RLE_ENEMY7_BEAMER1,
140 RLE_ENEMY7_BEAMER2,
141 ENEMY7_RLES
142 };
143
144 enum
145 {
146 RLE_ENEMY8_BOSS3,
147 RLE_ENEMY8_BOSS2,
148 RLE_ENEMY8_BOSS2_3,
149 RLE_ENEMY8_BOSS3_3,
150 ENEMY8_RLES
151 };
152
153 enum
154 {
155 RLE_ENEMY9_DISRUPTER1,
156 RLE_ENEMY9_DISRUPTER2,
157 RLE_ENEMY9_DISRUPTER3,
158 RLE_ENEMY9_TRIANGLER1,
159 RLE_ENEMY9_TRIANGLER2,
160 RLE_ENEMY9_TRIANGLER3,
161 RLE_ENEMY9_WORMER4,
162 ENEMY9_RLES
163 };
164
165 enum
166 {
167 RLE_SMALL1_GREEN_BLOB_L,
168 RLE_SMALL1_GREEN_BLOB_M,
169 RLE_SMALL1_GREEN_BLOB_S,
170 RLE_SMALL1_BLUE_BLOB_L,
171 RLE_SMALL1_BLUE_BLOB_M,
172 RLE_SMALL1_BLUE_BLOB_S,
173 RLE_SMALL1_ORANGE_BLOB_L,
174 RLE_SMALL1_ORANGE_BLOB_M,
175 RLE_SMALL1_ORANGE_BLOB_S,
176 RLE_SMALL1_YELLOW_BLOB_L,
177 RLE_SMALL1_YELLOW_BLOB_M,
178 RLE_SMALL1_YELLOW_BLOB_S,
179 RLE_SMALL1_PREMINE,
180 RLE_SMALL1_MINE1,
181 RLE_SMALL1_MINE2,
182 RLE_SMALL1_MINE3,
183 RLE_SMALL1_PRESEEKMINE,
184 RLE_SMALL1_SEEKMINE1,
185 RLE_SMALL1_SEEKMINE2,
186 RLE_SMALL1_SEEKMINE3,
187 RLE_SMALL1_PURPLE_BLOB_L,
188 RLE_SMALL1_PURPLE_BLOB_M,
189 RLE_SMALL1_PURPLE_BLOB_S,
190 RLE_SMALL1_RED_BLOB_L,
191 RLE_SMALL1_RED_BLOB_M,
192 RLE_SMALL1_RED_BLOB_S,
193
194 SMALL1_RLES
195 };
196
197 enum
198 {
199 RLE_SMALL3_BLUE_BLOB_1,
200 RLE_SMALL3_BLUE_BLOB_2,
201 RLE_SMALL3_BLUE_BLOB_3,
202 RLE_SMALL3_BLUE_BLOB_4,
203 RLE_SMALL3_BLUE_BLOB_5,
204 RLE_SMALL3_BLUE_BLOB_6,
205 RLE_SMALL3_BLUE_BLOB_7,
206 RLE_SMALL3_ORANGE_BLOB_1,
207 RLE_SMALL3_ORANGE_BLOB_2,
208 RLE_SMALL3_ORANGE_BLOB_3,
209 RLE_SMALL3_ORANGE_BLOB_4,
210 RLE_SMALL3_ORANGE_BLOB_5,
211 RLE_SMALL3_ORANGE_BLOB_6,
212 RLE_SMALL3_ORANGE_BLOB_7,
213 RLE_SMALL3_GREEN_BLOB_1,
214 RLE_SMALL3_GREEN_BLOB_2,
215 RLE_SMALL3_GREEN_BLOB_3,
216 RLE_SMALL3_GREEN_BLOB_4,
217 RLE_SMALL3_GREEN_BLOB_5,
218 RLE_SMALL3_GREEN_BLOB_6,
219 RLE_SMALL3_GREEN_BLOB_7,
220 RLE_SMALL3_YELLOW_BLOB_1,
221 RLE_SMALL3_YELLOW_BLOB_2,
222 RLE_SMALL3_YELLOW_BLOB_3,
223 RLE_SMALL3_YELLOW_BLOB_4,
224 RLE_SMALL3_YELLOW_BLOB_5,
225 RLE_SMALL3_YELLOW_BLOB_6,
226 RLE_SMALL3_YELLOW_BLOB_7,
227 RLE_SMALL3_PULSE1,
228 RLE_SMALL3_PULSE2,
229 RLE_SMALL3_PULSE3,
230 RLE_SMALL3_PULSE4,
231 RLE_SMALL3_PULSE2_1,
232 RLE_SMALL3_PULSE2_2,
233 RLE_SMALL3_PULSE2_3,
234 RLE_SMALL3_PULSE2_4,
235 SMALL3_RLES
236 };
237
238 enum
239 {
240 BMP_SMALL4_EYE_1,
241 BMP_SMALL4_EYE_2,
242 BMP_SMALL4_EYE_3,
243 BMP_SMALL4_EYE_4,
244 BMP_SMALL4_EYE_5,
245 BMP_SMALL4_EYE_6,
246 BMP_SMALL4_EYE_7,
247 BMP_SMALL4_BEYE_1,
248 BMP_SMALL4_BEYE_2,
249 BMP_SMALL4_BEYE_3,
250 BMP_SMALL4_BEYE_4,
251 BMP_SMALL4_BEYE_5,
252 BMP_SMALL4_BEYE_6,
253 BMP_SMALL4_BEYE_7,
254 BMP_SMALL4_SHIELD_1,
255 BMP_SMALL4_SHIELD_2,
256 BMP_SMALL4_SHIELD_3,
257 BMP_SMALL4_SHIELD_4,
258 BMP_SMALL4_SHIELD_5,
259 BMP_SMALL4_SHIELD_6,
260 BMP_SMALL4_SHIELD_7,
261 BMP_SMALL4_SHIELD_8,
262 SMALL4_BMPS
263 };
264
265 enum
266 {
267 BMP_SHIELD_UR1,
268 BMP_SHIELD_UR2,
269 BMP_SHIELD_UR3,
270 BMP_SHIELD_UR4,
271 BMP_SHIELD_UR5,
272 BMP_SHIELD_UR6,
273 BMP_SHIELD_UR7,
274 BMP_SHIELD_UR8,
275 BMP_SHIELD_DR1,
276 BMP_SHIELD_DR2,
277 BMP_SHIELD_DR3,
278 BMP_SHIELD_DR4,
279 BMP_SHIELD_DR5,
280 BMP_SHIELD_DR6,
281 BMP_SHIELD_DR7,
282 BMP_SHIELD_DL2,
283 BMP_SHIELD_DL3,
284 BMP_SHIELD_DL4,
285 BMP_SHIELD_DL5,
286 BMP_SHIELD_DL6,
287 BMP_SHIELD_DL7,
288 BMP_SHIELD_DL8,
289 SHIELD_BMPS
290 };
291
292 enum
293 {
294 BMP_SMALL2_MISSILE_1,
295 BMP_SMALL2_MISSILE_2,
296 BMP_SMALL2_MISSILE_3,
297 BMP_SMALL2_MISSILE_4,
298 BMP_SMALL2_MISSILE_5,
299 BMP_SMALL2_MISSILE_6,
300 BMP_SMALL2_MISSILE_7,
301 BMP_SMALL2_BOMB,
302 BMP_SMALL2_SIDE_BOMB,
303
304 SMALL2_BMPS
305 };
306
307 enum
308 {
309 RLE_LSHIP_BLUE,
310 RLE_LSHIP_GREEN,
311 RLE_LSHIP_YELLOW,
312 RLE_LSHIP_RED,
313 RLE_LSHIP_LINES
314 };
315
316
317 enum
318 {
319 STYLE_NONE,
320 STYLE_HURRY,
321 STYLE_ONLINE,
322 STYLE_UPGRADE1,
323 STYLE_UPGRADE2,
324 STYLE_UPGRADE3,
325 STYLE_UPGRADE4,
326 STYLE_UPGRADE5,
327 STYLE_NEWLEVEL
328 };
329
330
331 enum
332 {
333 PRETILE_BG_CHECK,
334 PRETILE_OUTER1_D,
335 PRETILE_OUTER1_DR,
336 PRETILE_OUTER1_OUT, // 10
337 PRETILE_EYE1_CLOSED,
338 PRETILE_EYE1_OPEN,
339 PRETILE_BG_DIAMOND,
340 PRETILE_BG_MESH1,
341 PRETILE_BG_MESH2,
342 PRETILE_BG_FLOWERS,
343 PRETILE_BG_SQUARES,
344 PRETILE_OUTER2_D,
345 PRETILE_OUTER2_DR,
346 PRETILE_OUTER2_OUT,
347 PRETILE_BG_DIAMOND2,
348 PRETILE_BG_CROSS,
349 PRETILE_BG_SQUARES2, // 30
350 PRETILE_BG_CIRCLES,
351 PRETILE_BG_GRID,
352 PRETILE_BG_THING,
353 PRETILE_BG_PATTERN,
354 PRETILE_EYE2_CLOSED,
355 PRETILE_EYE2_OPEN,
356 PRETILE_EYE3_CLOSED,
357 PRETILE_EYE3_OPEN,
358 PRETILE_EYE4_CLOSED,
359 PRETILE_EYE4_OPEN,
360 PRETILE_OUTER3_D,
361 PRETILE_OUTER3_DR,
362 PRETILE_OUTER3_OUT,
363 PRETILE_OUTER4_D,
364 PRETILE_OUTER4_DR,
365 PRETILE_OUTER4_OUT,
366 PRETILE_OUTER5_D,
367 PRETILE_OUTER5_DR,
368 PRETILE_OUTER5_OUT,
369 PRETILE_OUTER6_D,
370 PRETILE_OUTER6_DR,
371 PRETILE_OUTER6_OUT,
372 PRETILE_OUTER7_D,
373 PRETILE_OUTER7_DR,
374 PRETILE_OUTER7_OUT,
375 NO_PRETILE_BMPS
376 // need to compile display_in to put new ones in
377 };
378
379 enum
380 {
381 PRETILE_M_UD,
382 PRETILE_M_LR,
383 PRETILE_M_UR,
384 PRETILE_M_ULR,
385 PRETILE_M_UDLR,
386 PRETILE_M_U,
387 PRETILE_M_NODE,
388 PRETILE_M_EYE_UDLR,
389 NO_PRETILE_M_BMPS
390 // plus specials...
391 };
392
393 enum
394 {
395 MAZE_STRAIGHT,
396 MAZE_ZIGZAG,
397 MAZE_CIRCLES,
398 MAZE_ZIP,
399 MAZE_RINGS,
400 MAZE_TRIANGLES,
401 MAZE_PIPES,
402 MAZE_BOXES,
403 MAZE_WIRES,
404 MAZE_SQUARES,
405 MAZE_TUBES,
406 MAZE_STUDDED,
407 MAZE_DIAMONDS,
408 NO_MAZES
409 };
410
411 //void init_messages(void);
412 void send_message(int play, const char *msg, int style);
413
414
415 struct effects_struct
416 {
417 int type;
418 int x;
419 int y;
420 int x1;
421 int x2;
422 int y1;
423 int y2;
424 int things [5];
425 };
426
427 #define MAX_EFFECTS 15
428
429 enum
430 {
431 EFFECT_NONE,
432 EFFECT_REDBEAM,
433 EFFECT_BLUEBEAM,
434 EFFECT_RED_ARC,
435 EFFECT_ZAP_AIM,
436 EFFECT_WAVE1,
437 EFFECT_WAVE2
438 };
439
440 #ifndef COMPILING_DISPLAYC
441 extern int graphics_mode;
442 extern int scr_x;
443 extern int scr_y;
444 extern int sp_window_width;
445 extern int tp_window_width;
446 extern int grid_offset_x_1p;
447 extern int grid_offset_x_2p;
448 extern int grid_offset_y;
449 extern int special_600_y;
450 extern int text_offset_x_1p;
451 extern int text_offset_x_2p;
452 extern int text_offset_y;
453 extern int text_offset_x;
454 extern struct effects_struct effect [MAX_EFFECTS];
455 extern int grid_finetune_x_1p;
456 extern int grid_finetune_x_2p;
457 extern int grid_finetune_y;
458 extern int visible_grids_y;
459 #endif
460
461 enum
462 {
463 GMODE_640_480,
464 GMODE_800_600,
465 GMODE_1024_768
466 };
467
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: eclass.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - the enemy structure
30
31 */
32
33 #include "config.h"
34
35 #include "globvars.h"
36 #include "palette.h"
37
38 #define HIGH_DRAG 0.06
39 #define MED_DRAG 0.03
40 #define LOW_DRAG 0.01
41 #define VERY_LOW_DRAG 0.005
42
43 #define GEN_LOW 3
44 #define GEN_MED 5
45 #define GEN_HIGH 8
46
47 struct enemy_classification eclass [NO_ENEMY_TYPES] =
48 {
49 {
50 0, // int max_armour;
51 0, // level
52 0, // common
53 0, // score
54 0, // int radius;
55 0, // int edge_radius;
56 0, // drag
57 0, // mass
58 AI_NONE, // ai_type
59 0, // acceleration
60 0, // colour1
61 0, // colour2
62 0, // turrets
63 0, // attributes
64 0, // generous
65 0, // range
66 0 // slew
67 },
68 { // guardian1
69 350, // int max_armour;
70 1, // level
71 3, // common
72 10, // score
73 19000, // int radius;
74 60000, // int edge_radius;
75 MED_DRAG, // drag
76 200, // mass
77 AI_DRIFTER, // AI
78 GEN_LOW, // generous
79 COLOUR_GREEN6, // col1
80 COLOUR_GREEN1, // col2
81 0, // turrets
82 PITCH_GUARDIAN, // attributes
83 30, // acceleration
84 0, // impulse delay
85 900000, // range
86 3, // slew
87 ROLE_TARGET
88 },
89 { // puffer
90 300, // int max_armour;
91 1, // level
92 3, // common
93 20, // score
94 15000, // int radius;
95 23000, // int edge_radius;
96 LOW_DRAG, // drag
97 150, // mass
98 AI_PERIODIC_STINGER, // AI
99 GEN_LOW, // generous
100 COLOUR_YELLOW6, // col1
101 COLOUR_YELLOW1, // col2
102 0, // turrets
103 PITCH_MEDIUM, // pitch
104 2500, // acceleration
105 99, // impulse delay
106 900000, // range
107 5, // slew
108 ROLE_TARGET
109 },
110 { // Bracket1
111 500, // int max_armour;
112 5, // level
113 2, // common
114 30, // score
115 11000, // int radius;
116 54000, // int edge_radius;
117 MED_DRAG, // drag
118 250, // mass
119 AI_DRIFTER, // AI
120 GEN_LOW, // generous
121 COLOUR_YELLOW6, // col1
122 COLOUR_YELLOW1, // col2
123 0, // turrets
124 PITCH_BRACKET, // pitch
125 30, // acceleration
126 0, // impulse delay
127 900000, // range
128 5, // slew
129 ROLE_TARGET
130 },
131 { // wormer1
132 500, // int max_armour;
133 8, // level
134 2, // common
135 100, // score
136 10000, // int radius;
137 23000, // int edge_radius;
138 LOW_DRAG, // drag
139 400, // mass
140 AI_DRIFTER, // AI
141 GEN_LOW, // generous
142 COLOUR_ORANGE6, // col1
143 COLOUR_ORANGE1, // col2
144 0, // turrets
145 PITCH_GUARDIAN, // pitch
146 15, // acceleration
147 99, // impulse delay
148 900000, // range
149 0, // slew
150 ROLE_TARGET
151 },
152 { // head1
153 800, // int max_armour;
154 4, // level
155 0, // common
156 100, // score
157 13000, // int radius;
158 81000, // int edge_radius;
159 HIGH_DRAG, // drag
160 2400, // mass
161 AI_DRIFTER, // AI
162 GEN_HIGH, // generous
163 COLOUR_ORANGE6, // col1
164 COLOUR_ORANGE1, // col2
165 2, // turrets
166 PITCH_MINIBOSS1, // pitch
167 35, // acceleration
168 99, // impulse delay
169 900000, // range
170 4, // slew
171 ROLE_MINIBOSS
172 },
173 { // head1_eye1
174 300, // int max_armour;
175 0, // level
176 0, // common
177 100, // score
178 8000, // int radius;
179 0, // int edge_radius;
180 0, // drag
181 400, // mass
182 AI_TURRET, // AI
183 0, // generous
184 COLOUR_ORANGE6, // col1
185 COLOUR_ORANGE1, // col2
186 0, // turrets
187 PITCH_TURRET1, // pitch
188 0, // acceleration
189 0, // impulse delay
190 900000, // range
191 7, // slew
192 ROLE_TURRET
193 },
194 { // head1_eye2
195 300, // int max_armour;
196 0, // level
197 0, // common
198 100, // score
199 8000, // int radius;
200 0, // int edge_radius;
201 0, // drag
202 400, // mass
203 AI_TURRET, // AI
204 0, // generous
205 COLOUR_ORANGE6, // col1
206 COLOUR_ORANGE1, // col2
207 0, // turrets
208 PITCH_TURRET1, // pitch
209 0, // acceleration
210 0, // impulse delay
211 900000, // range
212 7, // slew
213 ROLE_TURRET
214 },
215 { // head1_eye3
216 300, // int max_armour;
217 0, // level
218 0, // common
219 100, // score
220 8000, // int radius;
221 0, // int edge_radius;
222 0, // drag
223 400, // mass
224 AI_TURRET, // AI
225 0, // generous
226 COLOUR_ORANGE6, // col1
227 COLOUR_ORANGE1, // col2
228 0, // turrets
229 PITCH_TURRET1, // pitch
230 0, // acceleration
231 0, // impulse delay
232 900000, // range
233 7, // slew
234 ROLE_TURRET
235 },
236 { // puffer2
237 600, // int max_armour;
238 6, // level
239 2, // common
240 200, // score
241 18000, // int radius;
242 27000, // int edge_radius;
243 LOW_DRAG, // drag
244 300, // mass
245 AI_PERIODIC_STINGER, // AI
246 GEN_LOW, // generous
247 COLOUR_ORANGE6, // col1
248 COLOUR_ORANGE1, // col2
249 0, // turrets
250 PITCH_GUARDIAN, // pitch
251 2500, // acceleration
252 99, // impulse delay
253 900000, // range
254 2, // slew
255 ROLE_TARGET
256 },
257 { // spinner1
258 350, // int max_armour;
259 4, // level
260 3, // common
261 200, // score
262 10000, // int radius;
263 25000, // int edge_radius;
264 HIGH_DRAG, // drag
265 500, // mass
266 AI_DRIFTER, // AI
267 GEN_MED, // generous
268 COLOUR_GREEN6, // col1
269 COLOUR_GREEN1, // col2
270 0, // turrets
271 PITCH_SMALL_SPINNER, // pitch
272 0, // acceleration
273 0, // impulse delay
274 900000, // range
275 1, // slew
276 ROLE_EXTRA
277 },
278 // NOTE: Spinners have same stats as spikeys
279 { // spinner2
280 500, // int max_armour;
281 8, // level
282 3, // common
283 400, // score
284 10000, // int radius;
285 25000, // int edge_radius;
286 HIGH_DRAG, // drag
287 500, // mass
288 AI_DRIFTER, // AI
289 GEN_MED, // generous
290 COLOUR_YELLOW6, // col1
291 COLOUR_YELLOW1, // col2
292 0, // turrets
293 PITCH_SMALL_SPINNER, // pitch
294 0, // acceleration
295 0, // impulse delay
296 900000, // range
297 1, // slew
298 ROLE_EXTRA
299 },
300 { // spinner3
301 600, // int max_armour;
302 10, // level
303 3, // common
304 800, // score
305 15000, // int radius;
306 25000, // int edge_radius;
307 HIGH_DRAG, // drag
308 500, // mass
309 AI_DRIFTER, // AI
310 GEN_MED, // generous
311 COLOUR_ORANGE6, // col1
312 COLOUR_ORANGE1, // col2
313 0, // turrets
314 PITCH_LARGE_SPINNER, // pitch
315 0, // acceleration
316 0, // impulse delay
317 900000, // range
318 1, // slew
319 ROLE_EXTRA
320 },
321 { // spinner4
322 700, // int max_armour;
323 12, // level
324 3, // common
325 1200, // score
326 10000, // int radius;
327 25000, // int edge_radius;
328 HIGH_DRAG, // drag
329 500, // mass
330 AI_DRIFTER, // AI
331 GEN_MED, // generous
332 COLOUR_RED6, // col1
333 COLOUR_RED2, // col2
334 0, // turrets
335 PITCH_SMALL_SPINNER, // pitch
336 0, // acceleration
337 0, // impulse delay
338 900000, // range
339 1, // slew
340 ROLE_EXTRA
341 },
342 { // spinner5
343 800, // int max_armour;
344 14, // level
345 3, // common
346 1500, // score
347 10000, // int radius;
348 25000, // int edge_radius;
349 HIGH_DRAG, // drag
350 500, // mass
351 AI_DRIFTER, // AI
352 GEN_MED, // generous
353 COLOUR_GREY5, // col1
354 COLOUR_GREY2, // col2
355 0, // turrets
356 PITCH_SMALL_SPINNER, // pitch
357 0, // acceleration
358 0, // impulse delay
359 900000, // range
360 16, // slew
361 ROLE_EXTRA
362 },
363 { // Bracket2
364 800, // int max_armour;
365 7, // level
366 2, // common
367 500, // score
368 10000, // int radius;
369 54000, // int edge_radius;
370 MED_DRAG, // drag
371 350, // mass
372 AI_DRIFTER, // AI
373 GEN_LOW, // generous
374 COLOUR_RED6, // col1
375 COLOUR_RED1, // col2
376 0, // turrets
377 PITCH_BRACKET, // pitch
378 30, // acceleration
379 0, // impulse delay
380 900000, // range
381 4, // slew
382 ROLE_TARGET
383 },
384 { // Bracket3
385 900, // int max_armour;
386 10, // level
387 2, // common
388 800, // score
389 11000, // int radius;
390 54000, // int edge_radius;
391 MED_DRAG, // drag
392 350, // mass
393 AI_DRIFTER, // AI
394 GEN_LOW, // generous
395 COLOUR_BLUE6, // col1
396 COLOUR_BLUE1, // col2
397 0, // turrets
398 PITCH_BRACKET, // pitch
399 30, // acceleration
400 0, // impulse delay
401 900000, // range
402 4, // slew
403 ROLE_TARGET
404 },
405 { // Bracket4
406 900, // int max_armour;
407 12, // level
408 2, // common
409 800, // score
410 10000, // int radius;
411 54000, // int edge_radius;
412 MED_DRAG, // drag
413 350, // mass
414 AI_DRIFTER, // AI
415 GEN_LOW, // generous
416 COLOUR_BLUE6, // col1
417 COLOUR_BLUE1, // col2
418 2, // turrets
419 PITCH_BRACKET, // pitch
420 15, // acceleration
421 0, // impulse delay
422 1900000, // range
423 4, // slew
424 ROLE_TARGET
425 },
426 { // Bracket4 turret
427 400, // int max_armour;
428 12, // level
429 0, // common
430 200, // score
431 7000, // int radius;
432 10000, // int edge_radius;
433 MED_DRAG, // drag
434 100, // mass
435 AI_TURRET, // AI
436 0, // generous
437 COLOUR_BLUE5, // col1
438 COLOUR_BLUE1, // col2
439 0, // turrets
440 PITCH_TURRET1, // pitch
441 0, // acceleration
442 0, // impulse delay
443 900000, // range
444 2, // slew
445 ROLE_TURRET
446 },
447 { // Fighter1
448 200, // int max_armour;
449 2, // level
450 2, // common
451 50, // score
452 8000, // int radius;
453 10000, // int edge_radius;
454 LOW_DRAG, // drag
455 150, // mass
456 AI_FIGHTER, // AI
457 GEN_LOW, // generous
458 COLOUR_GREEN6, // col1
459 COLOUR_GREEN1, // col2
460 0, // turrets
461 PITCH_FIGHTER, // pitch
462 50, // acceleration
463 0, // impulse delay
464 500000, // range
465 16, // slew
466 ROLE_EXTRA
467 },
468 { // Fighter2 note fighter2 is higher-level than 3
469 300, // int max_armour;
470 8, // level
471 2, // common
472 50, // score
473 8000, // int radius;
474 10000, // int edge_radius;
475 LOW_DRAG, // drag
476 150, // mass
477 AI_FIGHTER, // AI
478 GEN_LOW, // generous
479 COLOUR_ORANGE6, // col1
480 COLOUR_ORANGE1, // col2
481 0, // turrets
482 PITCH_FIGHTER, // pitch
483 60, // acceleration
484 0, // impulse delay
485 500000, // range
486 16, // slew
487 ROLE_EXTRA
488 },
489 { // Fighter3
490 250, // int max_armour;
491 5, // level
492 2, // common
493 50, // score
494 8000, // int radius;
495 10000, // int edge_radius;
496 LOW_DRAG, // drag
497 150, // mass
498 AI_FIGHTER, // AI
499 GEN_LOW, // generous
500 COLOUR_YELLOW6, // col1
501 COLOUR_YELLOW1, // col2
502 0, // turrets
503 PITCH_FIGHTER, // pitch
504 55, // acceleration
505 0, // impulse delay
506 500000, // range
507 16, // slew
508 ROLE_EXTRA
509 },
510 { // Fighter4
511 400, // int max_armour;
512 10, // level
513 2, // common
514 50, // score
515 8000, // int radius;
516 10000, // int edge_radius;
517 LOW_DRAG, // drag
518 150, // mass
519 AI_FIGHTER, // AI
520 GEN_LOW, // generous
521 COLOUR_RED6, // col1
522 COLOUR_RED1, // col2
523 0, // turrets
524 PITCH_FIGHTER, // pitch
525 70, // acceleration
526 0, // impulse delay
527 500000, // range
528 18, // slew
529 ROLE_EXTRA
530 },
531 { // Fighter5
532 450, // int max_armour;
533 13, // level
534 2, // common
535 50, // score
536 8000, // int radius;
537 10000, // int edge_radius;
538 LOW_DRAG, // drag
539 150, // mass
540 AI_FIGHTER, // AI
541 GEN_LOW, // generous
542 COLOUR_BLUE6, // col1
543 COLOUR_BLUE1, // col2
544 0, // turrets
545 PITCH_FIGHTER, // pitch
546 75, // acceleration
547 0, // impulse delay
548 500000, // range
549 20, // slew
550 ROLE_EXTRA
551 },
552 { // Bomber1
553 400, // int max_armour;
554 4, // level
555 2, // common
556 150, // score
557 10000, // int radius;
558 12000, // int edge_radius;
559 MED_DRAG, // drag
560 250, // mass
561 AI_BOMBER, // AI
562 GEN_MED, // generous
563 COLOUR_ORANGE6, // col1
564 COLOUR_ORANGE1, // col2
565 0, // turrets
566 PITCH_SMALL_SPINNER, // pitch
567 80, // acceleration
568 0, // impulse delay
569 500000, // range
570 8, // slew
571 ROLE_EXTRA
572 },
573 { // Bomber2
574 500, // int max_armour;
575 8, // level
576 2, // common
577 150, // score
578 10000, // int radius;
579 12000, // int edge_radius;
580 MED_DRAG, // drag
581 250, // mass
582 AI_BOMBER, // AI
583 GEN_MED, // generous
584 COLOUR_RED6, // col1
585 COLOUR_RED1, // col2
586 0, // turrets
587 PITCH_SMALL_SPINNER, // pitch
588 100, // acceleration
589 0, // impulse delay
590 500000, // range
591 8, // slew
592 ROLE_EXTRA
593 },
594 { // Bomber3
595 600, // int max_armour;
596 12, // level
597 2, // common
598 250, // score
599 10000, // int radius;
600 12000, // int edge_radius;
601 MED_DRAG, // drag
602 250, // mass
603 AI_BOMBER, // AI
604 GEN_MED, // generous
605 COLOUR_BLUE6, // col1
606 COLOUR_BLUE1, // col2
607 0, // turrets
608 PITCH_SMALL_SPINNER, // pitch
609 110, // acceleration
610 0, // impulse delay
611 500000, // range
612 8, // slew
613 ROLE_EXTRA
614 },
615 { // Cruiser1
616 900, // int max_armour;
617 6, // level
618 2, // common
619 500, // score
620 19000, // int radius;
621 17000, // int edge_radius;
622 MED_DRAG, // drag
623 500, // mass
624 AI_CRUISER, // AI
625 0, // generous
626 COLOUR_YELLOW6, // col1
627 COLOUR_YELLOW1, // col2
628 1, // turrets
629 PITCH_GUARDIAN, // pitch
630 80, // acceleration
631 0, // impulse delay
632 400000, // range
633 5, // slew
634 ROLE_TARGET
635 },
636 { // cruiser1 turret
637 400, // int max_armour;
638 6, // level
639 0, // common
640 100, // score
641 9000, // int radius;
642 12000, // int edge_radius;
643 0, // drag
644 400, // mass
645 AI_TURRET, // AI
646 0, // generous
647 COLOUR_YELLOW6, // col1
648 COLOUR_YELLOW1, // col2
649 0, // turrets
650 PITCH_TURRET1, // pitch
651 0, // acceleration
652 0, // impulse delay
653 400000, // range
654 7, // slew
655 ROLE_TURRET
656 },
657 { // guardian2
658 600, // int max_armour;
659 7, // level
660 3, // common
661 150, // score
662 19000, // int radius;
663 60000, // int edge_radius;
664 MED_DRAG, // drag
665 200, // mass
666 AI_DRIFTER, // AI
667 GEN_LOW, // generous
668 COLOUR_YELLOW6, // col1
669 COLOUR_YELLOW1, // col2
670 0, // turrets
671 PITCH_GUARDIAN, // pitch
672 35, // acceleration
673 0, // impulse delay
674 900000, // range
675 4, // slew
676 ROLE_TARGET
677 },
678 { // guardian3
679 800, // int max_armour;
680 10, // level
681 3, // common
682 500, // score
683 19000, // int radius;
684 60000, // int edge_radius;
685 MED_DRAG, // drag
686 200, // mass
687 AI_DRIFTER, // AI
688 GEN_LOW, // generous
689 COLOUR_ORANGE6, // col1
690 COLOUR_ORANGE1, // col2
691 0, // turrets
692 PITCH_GUARDIAN, // pitch
693 37, // acceleration
694 0, // impulse delay
695 900000, // range
696 3, // slew
697 ROLE_TARGET
698 },
699 { // spikey1
700 300, // int max_armour;
701 3, // level
702 3, // common
703 200, // score
704 10000, // int radius;
705 25000, // int edge_radius;
706 HIGH_DRAG, // drag
707 500, // mass
708 AI_DRIFTER, // AI
709 GEN_MED, // generous
710 COLOUR_GREEN6, // col1
711 COLOUR_GREEN1, // col2
712 0, // turrets
713 PITCH_SMALL_SPINNER, // pitch
714 0, // acceleration
715 0, // impulse delay
716 9000000, // range
717 6, // slew
718 ROLE_EXTRA
719 },
720 { // spikey2
721 400, // int max_armour;
722 7, // level
723 3, // common
724 400, // score
725 10000, // int radius;
726 25000, // int edge_radius;
727 HIGH_DRAG, // drag
728 500, // mass
729 AI_DRIFTER, // AI
730 GEN_MED, // generous
731 COLOUR_YELLOW6, // col1
732 COLOUR_YELLOW1, // col2
733 0, // turrets
734 PITCH_SMALL_SPINNER, // pitch
735 0, // acceleration
736 0, // impulse delay
737 9000000, // range
738 4, // slew
739 ROLE_EXTRA
740 },
741 { // spikey3
742 500, // int max_armour;
743 9, // level
744 3, // common
745 800, // score
746 15000, // int radius;
747 25000, // int edge_radius;
748 HIGH_DRAG, // drag
749 500, // mass
750 AI_DRIFTER, // AI
751 GEN_MED, // generous
752 COLOUR_ORANGE6, // col1
753 COLOUR_ORANGE1, // col2
754 0, // turrets
755 PITCH_LARGE_SPINNER, // pitch
756 0, // acceleration
757 0, // impulse delay
758 9000000, // range
759 4, // slew
760 ROLE_EXTRA
761 },
762 { // spikey4
763 600, // int max_armour;
764 12, // level
765 3, // common
766 1200, // score
767 10000, // int radius;
768 25000, // int edge_radius;
769 HIGH_DRAG, // drag
770 500, // mass
771 AI_DRIFTER, // AI
772 GEN_MED, // generous
773 COLOUR_RED6, // col1
774 COLOUR_RED2, // col2
775 0, // turrets
776 PITCH_SMALL_SPINNER, // pitch
777 0, // acceleration
778 0, // impulse delay
779 9000000, // range
780 4, // slew
781 ROLE_EXTRA
782 },
783 { // spikey5
784 750, // int max_armour;
785 14, // level
786 3, // common
787 1500, // score
788 10000, // int radius;
789 25000, // int edge_radius;
790 HIGH_DRAG, // drag
791 500, // mass
792 AI_DRIFTER, // AI
793 GEN_MED, // generous
794 COLOUR_BLUE6, // col1
795 COLOUR_BLUE2, // col2
796 0, // turrets
797 PITCH_SMALL_SPINNER, // pitch
798 0, // acceleration
799 0, // impulse delay
800 9000000, // range
801 1, // slew
802 ROLE_EXTRA
803 },
804 { // wormer2
805 800, // int max_armour;
806 10, // level
807 2, // common
808 300, // score
809 10000, // int radius;
810 23000, // int edge_radius;
811 LOW_DRAG, // drag
812 400, // mass
813 AI_DRIFTER, // AI
814 GEN_LOW, // generous
815 COLOUR_BLUE6, // col1
816 COLOUR_BLUE1, // col2
817 0, // turrets
818 PITCH_GUARDIAN, // pitch
819 18, // acceleration
820 99, // impulse delay
821 900000, // range
822 0, // slew
823 ROLE_TARGET
824 },
825 { // wormer3
826 1000, // int max_armour;
827 13, // level
828 2, // common
829 600, // score
830 10000, // int radius;
831 23000, // int edge_radius;
832 LOW_DRAG, // drag
833 400, // mass
834 AI_DRIFTER, // AI
835 GEN_LOW, // generous
836 COLOUR_GREY5, // col1
837 COLOUR_GREY2, // col2
838 0, // turrets
839 PITCH_GUARDIAN, // pitch
840 15, // acceleration
841 99, // impulse delay
842 900000, // range
843 0, // slew
844 ROLE_TARGET
845 },
846 { // forker1
847 600, // int max_armour;
848 9, // level
849 2, // common
850 1200, // score
851 13000, // int radius;
852 27000, // int edge_radius;
853 LOW_DRAG, // drag
854 400, // mass
855 AI_STINGER, // AI
856 GEN_LOW, // generous
857 COLOUR_BLUE6, // col1
858 COLOUR_BLUE1, // col2
859 0, // turrets
860 PITCH_MEDIUM, // pitch
861 2200, // acceleration
862 40, // impulse delay
863 900000, // range
864 3, // slew
865 ROLE_TARGET
866 },
867 { // forker2
868 800, // int max_armour;
869 13, // level
870 2, // common
871 1500, // score
872 13000, // int radius;
873 27000, // int edge_radius;
874 LOW_DRAG, // drag
875 500, // mass
876 AI_STINGER, // AI
877 GEN_LOW, // generous
878 COLOUR_GREY5, // col1
879 COLOUR_GREY1, // col2
880 0, // turrets
881 PITCH_MEDIUM, // pitch
882 2000, // acceleration
883 35, // impulse delay
884 900000, // range
885 4, // slew
886 ROLE_TARGET
887 },
888 { // miner1
889 450, // int max_armour;
890 5, // level
891 2, // common
892 20, // score
893 14000, // int radius;
894 60000, // int edge_radius;
895 HIGH_DRAG, // drag
896 400, // mass
897 AI_DRIFTER, // AI
898 GEN_LOW, // generous
899 COLOUR_YELLOW6, // col1
900 COLOUR_YELLOW1, // col2
901 0, // turrets
902 PITCH_HEAVY, // pitch
903 50, // acceleration
904 0, // impulse delay
905 2900000, // range
906 0, // slew
907 ROLE_TARGET
908 },
909 { // miner2
910 650, // int max_armour;
911 8, // level
912 2, // common
913 120, // score
914 14000, // int radius;
915 60000, // int edge_radius;
916 HIGH_DRAG, // drag
917 500, // mass
918 AI_DRIFTER, // AI
919 GEN_LOW, // generous
920 COLOUR_RED6, // col1
921 COLOUR_RED1, // col2
922 0, // turrets
923 PITCH_HEAVY, // pitch
924 55, // acceleration
925 0, // impulse delay
926 2900000, // range
927 0, // slew
928 ROLE_TARGET
929 },
930 { // miner3
931 800, // int max_armour;
932 11, // level
933 2, // common
934 450, // score
935 14000, // int radius;
936 60000, // int edge_radius;
937 HIGH_DRAG, // drag
938 600, // mass
939 AI_DRIFTER, // AI
940 GEN_LOW, // generous
941 COLOUR_BLUE6, // col1
942 COLOUR_BLUE1, // col2
943 1, // turrets
944 PITCH_HEAVY, // pitch
945 50, // acceleration
946 0, // impulse delay
947 2900000, // range
948 0, // slew
949 ROLE_TARGET
950 },
951 { // Miner3 turret
952 400, // int max_armour;
953 11, // level
954 0, // common
955 200, // score
956 7000, // int radius;
957 10000, // int edge_radius;
958 MED_DRAG, // drag
959 100, // mass
960 AI_TURRET, // AI
961 0, // generous
962 COLOUR_BLUE6, // col1
963 COLOUR_BLUE1, // col2
964 0, // turrets
965 PITCH_TURRET1, // pitch
966 0, // acceleration
967 0, // impulse delay
968 900000, // range
969 5, // slew
970 ROLE_TURRET
971 },
972 { // Cruiser2
973 1000, // int max_armour;
974 9, // level
975 2, // common
976 1000, // score
977 19000, // int radius;
978 17000, // int edge_radius;
979 MED_DRAG, // drag
980 500, // mass
981 AI_CRUISER, // AI
982 0, // generous
983 COLOUR_RED6, // col1
984 COLOUR_RED1, // col2
985 1, // turrets
986 PITCH_GUARDIAN, // pitch
987 85, // acceleration
988 0, // impulse delay
989 400000, // range
990 6, // slew
991 ROLE_TARGET
992 },
993 { // cruiser2 turret
994 350, // int max_armour;
995 9, // level
996 0, // common
997 150, // score
998 9000, // int radius;
999 12000, // int edge_radius;
1000 0, // drag
1001 400, // mass
1002 AI_TURRET, // AI
1003 0, // generous
1004 COLOUR_RED6, // col1
1005 COLOUR_RED1, // col2
1006 0, // turrets
1007 PITCH_TURRET1, // pitch
1008 0, // acceleration
1009 0, // impulse delay
1010 400000, // range
1011 6, // slew
1012 ROLE_TURRET
1013 },
1014 { // Cruiser3
1015 1200, // int max_armour;
1016 12, // level
1017 2, // common
1018 1300, // score
1019 19000, // int radius;
1020 17000, // int edge_radius;
1021 MED_DRAG, // drag
1022 500, // mass
1023 AI_CRUISER, // AI
1024 0, // generous
1025 COLOUR_BLUE6, // col1
1026 COLOUR_BLUE1, // col2
1027 1, // turrets
1028 PITCH_GUARDIAN, // pitch
1029 80, // acceleration
1030 0, // impulse delay
1031 400000, // range
1032 6, // slew
1033 ROLE_TARGET
1034 },
1035 { // cruiser3 turret
1036 400, // int max_armour;
1037 12, // level
1038 0, // common
1039 200, // score
1040 9000, // int radius;
1041 12000, // int edge_radius;
1042 0, // drag
1043 400, // mass
1044 AI_TURRET, // AI
1045 0, // generous
1046 COLOUR_BLUE6, // col1
1047 COLOUR_BLUE1, // col2
1048 0, // turrets
1049 PITCH_TURRET1, // pitch
1050 0, // acceleration
1051 0, // impulse delay
1052 200000, // range
1053 4, // slew
1054 ROLE_TURRET
1055 },
1056 { // Cruiser4
1057 1300, // int max_armour;
1058 15, // level
1059 2, // common
1060 1500, // score
1061 19000, // int radius;
1062 17000, // int edge_radius;
1063 MED_DRAG, // drag
1064 500, // mass
1065 AI_CRUISER, // AI
1066 0, // generous
1067 COLOUR_GREY5, // col1
1068 COLOUR_GREY1, // col2
1069 1, // turrets
1070 PITCH_GUARDIAN, // pitch
1071 78, // acceleration
1072 0, // impulse delay
1073 400000, // range
1074 6, // slew
1075 ROLE_TARGET
1076 },
1077 { // cruiser4 turret
1078 550, // int max_armour;
1079 15, // level
1080 0, // common
1081 250, // score
1082 9000, // int radius;
1083 12000, // int edge_radius;
1084 0, // drag
1085 400, // mass
1086 AI_TURRET, // AI
1087 0, // generous
1088 COLOUR_GREY5, // col1
1089 COLOUR_GREY1, // col2
1090 0, // turrets
1091 PITCH_TURRET1, // pitch
1092 0, // acceleration
1093 0, // impulse delay
1094 400000, // range
1095 3, // slew
1096 ROLE_TURRET
1097 },
1098 { // Boss1_1
1099 2000, // int max_armour;
1100 5, // level
1101 10, // common
1102 500, // score
1103 55000, // int radius;
1104 118000, // int edge_radius;
1105 HIGH_DRAG, // drag
1106 3000, // mass
1107 AI_DRIFTER, // AI
1108 GEN_HIGH, // generous
1109 COLOUR_YELLOW6, // col1
1110 COLOUR_YELLOW1, // col2
1111 4, // turrets
1112 PITCH_BOSS1, // pitch
1113 35, // acceleration
1114 99, // impulse delay
1115 900000, // range
1116 4, // slew
1117 ROLE_BOSS
1118 },
1119 { // Boss1_2
1120 2000, // int max_armour;
1121 5, // level
1122 10, // common
1123 500, // score
1124 40000, // int radius;
1125 168000, // int edge_radius;
1126 HIGH_DRAG, // drag
1127 3000, // mass
1128 AI_STINGER, // AI
1129 GEN_HIGH, // generous
1130 COLOUR_YELLOW6, // col1
1131 COLOUR_YELLOW1, // col2
1132 3, // turrets
1133 PITCH_BOSS1, // pitch
1134 3800, // acceleration
1135 60, // impulse delay
1136 1900000, // range
1137 4, // slew
1138 ROLE_BOSS
1139 },
1140 { // Boss1_3
1141 2000, // int max_armour;
1142 5, // level
1143 10, // common
1144 500, // score
1145 40000, // int radius;
1146 118000, // int edge_radius;
1147 HIGH_DRAG, // drag
1148 3000, // mass
1149 AI_DRIFTER, // AI
1150 GEN_HIGH, // generous
1151 COLOUR_YELLOW6, // col1
1152 COLOUR_YELLOW1, // col2
1153 3, // turrets
1154 PITCH_BOSS1, // pitch
1155 43, // acceleration
1156 99, // impulse delay
1157 900000, // range
1158 3, // slew
1159 ROLE_BOSS
1160 },
1161 { // Boss1_turret1
1162 500, // int max_armour;
1163 5, // level
1164 0, // common
1165 150, // score
1166 15000, // int radius;
1167 18000, // int edge_radius;
1168 0, // drag
1169 200, // mass
1170 AI_TURRET, // AI
1171 0, // generous
1172 COLOUR_ORANGE6, // col1
1173 COLOUR_ORANGE1, // col2
1174 0, // turrets
1175 PITCH_TURRET2, // pitch
1176 0, // acceleration
1177 0, // impulse delay
1178 900000, // range
1179 6, // slew
1180 ROLE_TURRET
1181 },
1182 { // Boss1_turret2
1183 500, // int max_armour;
1184 5, // level
1185 0, // common
1186 150, // score
1187 15000, // int radius;
1188 18000, // int edge_radius;
1189 0, // drag
1190 200, // mass
1191 AI_TURRET, // AI
1192 0, // generous
1193 COLOUR_GREEN6, // col1
1194 COLOUR_GREEN1, // col2
1195 0, // turrets
1196 PITCH_TURRET2, // pitch
1197 0, // acceleration
1198 0, // impulse delay
1199 900000, // range
1200 6, // slew
1201 ROLE_TURRET
1202 },
1203 { // Boss1_turret3
1204 500, // int max_armour;
1205 5, // level
1206 0, // common
1207 150, // score
1208 15000, // int radius;
1209 18000, // int edge_radius;
1210 0, // drag
1211 200, // mass
1212 AI_TURRET, // AI
1213 0, // generous
1214 COLOUR_YELLOW6, // col1
1215 COLOUR_YELLOW1, // col2
1216 0, // turrets
1217 PITCH_TURRET2, // pitch
1218 0, // acceleration
1219 0, // impulse delay
1220 900000, // range
1221 6, // slew
1222 ROLE_TURRET
1223 },
1224 { // circler1
1225 1000, // int max_armour;
1226 10, // level
1227 2, // 2, // common
1228 500, // score
1229 10000, // int radius;
1230 39000, // int edge_radius;
1231 MED_DRAG, // drag
1232 200, // mass
1233 AI_DRIFTER, // AI
1234 GEN_LOW, // generous
1235 COLOUR_RED6, // col1
1236 COLOUR_RED1, // col2
1237 0, // turrets
1238 PITCH_BRACKET, // pitch
1239 37, // acceleration
1240 0, // impulse delay
1241 900000, // range
1242 0, // slew
1243 ROLE_TARGET
1244 },
1245 { // blatter1
1246 350, // int max_armour;
1247 4, // level
1248 3, // common
1249 200, // score
1250 16000, // int radius;
1251 25000, // int edge_radius;
1252 HIGH_DRAG, // drag
1253 500, // mass
1254 AI_DRIFTER, // AI
1255 GEN_MED, // generous
1256 COLOUR_GREEN6, // col1
1257 COLOUR_GREEN1, // col2
1258 0, // turrets
1259 PITCH_LARGE_SPINNER, // pitch
1260 0, // acceleration
1261 0, // impulse delay
1262 300000, // range
1263 8, // slew
1264 ROLE_EXTRA
1265 },
1266 { // blatter2
1267 500, // int max_armour;
1268 6, // level
1269 3, // common
1270 400, // score
1271 16000, // int radius;
1272 25000, // int edge_radius;
1273 HIGH_DRAG, // drag
1274 500, // mass
1275 AI_DRIFTER, // AI
1276 GEN_MED, // generous
1277 COLOUR_YELLOW6, // col1
1278 COLOUR_YELLOW1, // col2
1279 0, // turrets
1280 PITCH_LARGE_SPINNER, // pitch
1281 0, // acceleration
1282 0, // impulse delay
1283 300000, // range
1284 6, // slew
1285 ROLE_EXTRA
1286 },
1287 { // blatter3
1288 600, // int max_armour;
1289 9, // level
1290 3, // common
1291 600, // score
1292 16000, // int radius;
1293 25000, // int edge_radius;
1294 HIGH_DRAG, // drag
1295 500, // mass
1296 AI_DRIFTER, // AI
1297 GEN_MED, // generous
1298 COLOUR_ORANGE6, // col1
1299 COLOUR_ORANGE1, // col2
1300 0, // turrets
1301 PITCH_LARGE_SPINNER, // pitch
1302 0, // acceleration
1303 0, // impulse delay
1304 300000, // range
1305 3, // slew
1306 ROLE_EXTRA
1307 },
1308 { // blatter4
1309 700, // int max_armour;
1310 11, // level
1311 3, // common
1312 800, // score
1313 16000, // int radius;
1314 25000, // int edge_radius;
1315 HIGH_DRAG, // drag
1316 500, // mass
1317 AI_DRIFTER, // AI
1318 GEN_MED, // generous
1319 COLOUR_RED6, // col1
1320 COLOUR_RED2, // col2
1321 0, // turrets
1322 PITCH_LARGE_SPINNER, // pitch
1323 0, // acceleration
1324 0, // impulse delay
1325 300000, // range
1326 8, // slew
1327 ROLE_EXTRA
1328 },
1329 { // blatter5
1330 800, // int max_armour;
1331 14, // level
1332 3, // common
1333 1000, // score
1334 11000, // int radius;
1335 25000, // int edge_radius;
1336 HIGH_DRAG, // drag
1337 500, // mass
1338 AI_DRIFTER, // AI
1339 GEN_MED, // generous
1340 COLOUR_BLUE6, // col1
1341 COLOUR_BLUE2, // col2
1342 0, // turrets
1343 PITCH_SMALL_SPINNER, // pitch
1344 0, // acceleration
1345 0, // impulse delay
1346 400000, // range
1347 4, // slew
1348 ROLE_EXTRA
1349 },
1350 { // minefielder1
1351 800, // int max_armour;
1352 12, // level
1353 5, // common
1354 1000, // score
1355 15000, // int radius;
1356 25000, // int edge_radius;
1357 HIGH_DRAG, // drag
1358 800, // mass
1359 AI_DRIFTER, // AI
1360 GEN_MED, // generous
1361 COLOUR_RED6, // col1
1362 COLOUR_RED2, // col2
1363 0, // turrets
1364 PITCH_HEAVY_SPINNER, // pitch
1365 0, // acceleration
1366 0, // impulse delay
1367 2900000, // range
1368 3, // slew
1369 ROLE_EXTRA
1370 },
1371 { // bloater1
1372 100, // int max_armour;
1373 8, // level
1374 2, // common
1375 1000, // score
1376 16000, // int radius;
1377 25000, // int edge_radius;
1378 HIGH_DRAG, // drag
1379 100, // mass
1380 AI_DRIFTER, // AI
1381 GEN_MED, // generous
1382 COLOUR_ORANGE6, // col1
1383 COLOUR_ORANGE2, // col2
1384 0, // turrets
1385 PITCH_LARGE_SPINNER, // pitch
1386 0, // acceleration
1387 0, // impulse delay
1388 100, // range
1389 0, // slew
1390 ROLE_EXTRA
1391 },
1392 { // bloater2
1393 100, // int max_armour;
1394 13, // level
1395 2, // common
1396 1000, // score
1397 16000, // int radius;
1398 25000, // int edge_radius;
1399 HIGH_DRAG, // drag
1400 100, // mass
1401 AI_DRIFTER, // AI
1402 GEN_MED, // generous
1403 COLOUR_ORANGE6, // col1
1404 COLOUR_ORANGE2, // col2
1405 0, // turrets
1406 PITCH_LARGE_SPINNER, // pitch
1407 0, // acceleration
1408 0, // impulse delay
1409 100, // range
1410 0, // slew
1411 ROLE_EXTRA
1412 },
1413 { // Boss2
1414 3000, // int max_armour;
1415 10, // level
1416 0, // common
1417 500, // score
1418 35000, // int radius;
1419 125000, // int edge_radius;
1420 HIGH_DRAG, // drag
1421 5000, // mass
1422 AI_DRIFTER, // AI
1423 GEN_HIGH, // generous
1424 COLOUR_RED6, // col1
1425 COLOUR_RED1, // col2
1426 4, // turrets
1427 PITCH_BOSS2, // pitch
1428 65, // acceleration
1429 99, // impulse delay
1430 1900000, // range
1431 0, // slew
1432 ROLE_BOSS
1433 },
1434 { // Boss2_turret1
1435 600, // int max_armour;
1436 10, // level
1437 0, // common
1438 400, // score
1439 12000, // int radius;
1440 15000, // int edge_radius;
1441 0, // drag
1442 200, // mass
1443 AI_TURRET, // AI
1444 0, // generous
1445 COLOUR_RED6, // col1
1446 COLOUR_RED1, // col2
1447 0, // turrets
1448 PITCH_TURRET2, // pitch
1449 0, // acceleration
1450 0, // impulse delay
1451 900000, // range
1452 6, // slew
1453 ROLE_TURRET
1454 },
1455 { // Boss2_turret2
1456 600, // int max_armour;
1457 10, // level
1458 0, // common
1459 400, // score
1460 12000, // int radius;
1461 15000, // int edge_radius;
1462 0, // drag
1463 200, // mass
1464 AI_TURRET, // AI
1465 0, // generous
1466 COLOUR_YELLOW6, // col1
1467 COLOUR_YELLOW1, // col2
1468 0, // turrets
1469 PITCH_TURRET2, // pitch
1470 0, // acceleration
1471 0, // impulse delay
1472 900000, // range
1473 4, // slew
1474 ROLE_TURRET
1475 },
1476 { // Boss2_turret3
1477 600, // int max_armour;
1478 10, // level
1479 0, // common
1480 400, // score
1481 12000, // int radius;
1482 15000, // int edge_radius;
1483 0, // drag
1484 200, // mass
1485 AI_TURRET, // AI
1486 0, // generous
1487 COLOUR_ORANGE6, // col1
1488 COLOUR_ORANGE1, // col2
1489 0, // turrets
1490 PITCH_TURRET2, // pitch
1491 0, // acceleration
1492 0, // impulse delay
1493 900000, // range
1494 4, // slew
1495 ROLE_TURRET
1496 },
1497 { // Boss2_turret4
1498 600, // int max_armour;
1499 10, // level
1500 0, // common
1501 400, // score
1502 12000, // int radius;
1503 15000, // int edge_radius;
1504 0, // drag
1505 200, // mass
1506 AI_TURRET, // AI
1507 0, // generous
1508 COLOUR_BLUE6, // col1
1509 COLOUR_BLUE1, // col2
1510 0, // turrets
1511 PITCH_TURRET2, // pitch
1512 0, // acceleration
1513 0, // impulse delay
1514 900000, // range
1515 4, // slew
1516 ROLE_TURRET
1517 },
1518 { // shielder1
1519 750, // int max_armour;
1520 11, // level
1521 3, // common
1522 1000, // score
1523 15000, // int radius;
1524 25000, // int edge_radius;
1525 MED_DRAG, // drag
1526 500, // mass
1527 AI_DRIFTER, // AI
1528 GEN_MED, // generous
1529 COLOUR_BLUE6, // col1
1530 COLOUR_BLUE2, // col2
1531 0, // turrets
1532 PITCH_LARGE_SPINNER, // pitch
1533 20, // acceleration
1534 0, // impulse delay
1535 1000000, // range
1536 4, // slew
1537 ROLE_EXTRA
1538 },
1539 { // puffer3
1540 900, // int max_armour;
1541 11, // level
1542 2, // common
1543 800, // score
1544 14000, // int radius;
1545 24000, // int edge_radius;
1546 LOW_DRAG, // drag
1547 300, // mass
1548 AI_PERIODIC_STINGER, // AI
1549 GEN_LOW, // generous
1550 COLOUR_RED6, // col1
1551 COLOUR_RED1, // col2
1552 0, // turrets
1553 PITCH_MEDIUM, // pitch
1554 3300, // acceleration
1555 66, // impulse delay
1556 1400000, // range
1557 2, // slew
1558 ROLE_TARGET
1559 },
1560 { // puffer4
1561 1200, // int max_armour;
1562 15, // level
1563 2, // common
1564 1300, // score
1565 21000, // int radius;
1566 29000, // int edge_radius;
1567 LOW_DRAG, // drag
1568 500, // mass
1569 AI_PERIODIC_STINGER, // AI
1570 GEN_LOW, // generous
1571 COLOUR_BLUE6, // col1
1572 COLOUR_BLUE1, // col2
1573 0, // turrets
1574 PITCH_GUARDIAN, // pitch
1575 2600, // acceleration
1576 66, // impulse delay
1577 1400000, // range
1578 2, // slew
1579 ROLE_TARGET
1580 },
1581 { // pulser1
1582 800, // int max_armour;
1583 6, // level
1584 3, // common
1585 90, // score
1586 17000, // int radius;
1587 25000, // int edge_radius;
1588 HIGH_DRAG, // drag
1589 400, // mass
1590 AI_DRIFTER, // AI
1591 GEN_LOW, // generous
1592 COLOUR_YELLOW6, // col1
1593 COLOUR_YELLOW1, // col2
1594 0, // turrets
1595 PITCH_GUARDIAN, // pitch
1596 30, // acceleration
1597 0, // impulse delay
1598 9000000, // range
1599 3, // slew
1600 ROLE_TARGET
1601 },
1602 { // pulser2
1603 1200, // int max_armour;
1604 11, // level
1605 3, // common
1606 500, // score
1607 17000, // int radius;
1608 25000, // int edge_radius;
1609 HIGH_DRAG, // drag
1610 400, // mass
1611 AI_DRIFTER, // AI
1612 GEN_LOW, // generous
1613 COLOUR_RED6, // col1
1614 COLOUR_RED1, // col2
1615 0, // turrets
1616 PITCH_GUARDIAN, // pitch
1617 25, // acceleration
1618 0, // impulse delay
1619 9000000, // range
1620 3, // slew
1621 ROLE_TARGET
1622 },
1623 { // zapper1
1624 600, // int max_armour;
1625 11, // level
1626 3, // common
1627 500, // score
1628 13000, // int radius;
1629 25000, // int edge_radius;
1630 LOW_DRAG, // drag
1631 200, // mass
1632 AI_DRIFTER, // AI
1633 GEN_LOW, // generous
1634 COLOUR_BLUE6, // col1
1635 COLOUR_BLUE1, // col2
1636 0, // turrets
1637 PITCH_LARGE_SPINNER, // pitch
1638 0, // acceleration
1639 0, // impulse delay
1640 200000, // range
1641 16, // slew
1642 ROLE_EXTRA
1643 },
1644 { // multi1
1645 250, // int max_armour;
1646 1, // level
1647 3, // common
1648 10, // score
1649 15000, // int radius;
1650 29000, // int edge_radius;
1651 MED_DRAG, // drag
1652 200, // mass
1653 AI_DRIFTER, // AI
1654 GEN_LOW, // generous
1655 COLOUR_GREEN6, // col1
1656 COLOUR_GREEN1, // col2
1657 0, // turrets
1658 PITCH_MEDIUM, // pitch
1659 24, // acceleration
1660 0, // impulse delay
1661 900000, // range
1662 2, // slew
1663 ROLE_TARGET
1664 },
1665 { // multi2
1666 600, // int max_armour;
1667 8, // level
1668 3, // common
1669 150, // score
1670 13000, // int radius;
1671 60000, // int edge_radius;
1672 MED_DRAG, // drag
1673 200, // mass
1674 AI_DRIFTER, // AI
1675 GEN_LOW, // generous
1676 COLOUR_RED6, // col1
1677 COLOUR_RED1, // col2
1678 0, // turrets
1679 PITCH_MEDIUM, // pitch
1680 30, // acceleration
1681 0, // impulse delay
1682 900000, // range
1683 2, // slew
1684 ROLE_TARGET
1685 },
1686 { // multi3
1687 1000, // int max_armour;
1688 12, // level
1689 3, // common
1690 500, // score
1691 13000, // int radius;
1692 60000, // int edge_radius;
1693 MED_DRAG, // drag
1694 200, // mass
1695 AI_DRIFTER, // AI
1696 GEN_LOW, // generous
1697 COLOUR_BLUE6, // col1
1698 COLOUR_BLUE1, // col2
1699 0, // turrets
1700 PITCH_MEDIUM, // pitch
1701 32, // acceleration
1702 0, // impulse delay
1703 900000, // range
1704 2, // slew
1705 ROLE_TARGET
1706 },
1707 { // defender1
1708 1200, // int max_armour;
1709 4, // level
1710 3, // common
1711 100, // score
1712 25000, // int radius;
1713 131000, // int edge_radius;
1714 HIGH_DRAG, // drag
1715 3000, // mass
1716 AI_DRIFTER, // AI
1717 GEN_HIGH, // generous
1718 COLOUR_GREEN6, // col1
1719 COLOUR_GREEN1, // col2
1720 2, // turrets
1721 PITCH_MINIBOSS1, // pitch
1722 35, // acceleration
1723 0, // impulse delay
1724 2000000, // range
1725 3, // slew
1726 ROLE_MINIBOSS
1727 },
1728 { // defender1_turret1
1729 500, // int max_armour;
1730 4, // level
1731 0, // common
1732 100, // score
1733 12000, // int radius;
1734 15000, // int edge_radius;
1735 0, // drag
1736 400, // mass
1737 AI_TURRET, // AI
1738 0, // generous
1739 COLOUR_GREEN6, // col1
1740 COLOUR_GREEN1, // col2
1741 0, // turrets
1742 PITCH_TURRET2, // pitch
1743 0, // acceleration
1744 0, // impulse delay
1745 900000, // range
1746 3, // slew
1747 ROLE_TURRET
1748 },
1749 { // defender1_turret2
1750 500, // int max_armour;
1751 4, // level
1752 0, // common
1753 100, // score
1754 12000, // int radius;
1755 15000, // int edge_radius;
1756 0, // drag
1757 400, // mass
1758 AI_TURRET, // AI
1759 0, // generous
1760 COLOUR_GREEN6, // col1
1761 COLOUR_GREEN1, // col2
1762 0, // turrets
1763 PITCH_TURRET2, // pitch
1764 0, // acceleration
1765 0, // impulse delay
1766 900000, // range
1767 3, // slew
1768 ROLE_TURRET
1769 },
1770 { // defender1_turret3
1771 500, // int max_armour;
1772 4, // level
1773 0, // common
1774 100, // score
1775 12000, // int radius;
1776 15000, // int edge_radius;
1777 0, // drag
1778 400, // mass
1779 AI_TURRET, // AI
1780 0, // generous
1781 COLOUR_GREEN6, // col1
1782 COLOUR_GREEN1, // col2
1783 0, // turrets
1784 PITCH_TURRET2, // pitch
1785 0, // acceleration
1786 0, // impulse delay
1787 900000, // range
1788 0, // slew
1789 ROLE_TURRET
1790 },
1791 { // overspinner
1792 3500, // int max_armour;
1793 13, // level
1794 3, // common
1795 2500, // score
1796 30000, // int radius;
1797 120000, // int edge_radius;
1798 HIGH_DRAG, // drag
1799 2500, // mass
1800 AI_DRIFTER, // AI
1801 GEN_HIGH, // generous
1802 COLOUR_RED6, // col1
1803 COLOUR_RED1, // col2
1804 0, // turrets
1805 PITCH_MINIBOSS2, // pitch
1806 0, // acceleration
1807 0, // impulse delay
1808 9000000, // range
1809 16, // slew
1810 ROLE_MINIBOSS
1811 },
1812 { // overspikey
1813 3500, // int max_armour;
1814 13, // level
1815 3, // common
1816 2500, // score
1817 30000, // int radius;
1818 120000, // int edge_radius;
1819 HIGH_DRAG, // drag
1820 2500, // mass
1821 AI_DRIFTER, // AI
1822 GEN_HIGH, // generous
1823 COLOUR_ORANGE6, // col1
1824 COLOUR_ORANGE1, // col2
1825 0, // turrets
1826 PITCH_MINIBOSS2, // pitch
1827 0, // acceleration
1828 0, // impulse delay
1829 9000000, // range
1830 16, // slew
1831 ROLE_MINIBOSS
1832 },
1833 { // underspikey
1834 1500, // int max_armour;
1835 5, // level
1836 3, // common
1837 1000, // score
1838 26000, // int radius;
1839 120000, // int edge_radius;
1840 HIGH_DRAG, // drag
1841 2000, // mass
1842 AI_DRIFTER, // AI
1843 GEN_HIGH, // generous
1844 COLOUR_YELLOW6, // col1
1845 COLOUR_YELLOW1, // col2
1846 0, // turrets
1847 PITCH_MINIBOSS1, // pitch
1848 0, // acceleration
1849 0, // impulse delay
1850 9000000, // range
1851 3, // slew
1852 ROLE_MINIBOSS
1853 },
1854 { // overblatter
1855 3000, // int max_armour;
1856 7, // level
1857 3, // common
1858 1000, // score
1859 26000, // int radius;
1860 120000, // int edge_radius;
1861 HIGH_DRAG, // drag
1862 2000, // mass
1863 AI_DRIFTER, // AI
1864 GEN_HIGH, // generous
1865 COLOUR_RED6, // col1
1866 COLOUR_RED1, // col2
1867 0, // turrets
1868 PITCH_MINIBOSS1, // pitch
1869 0, // acceleration
1870 0, // impulse delay
1871 400000, // range
1872 2, // slew
1873 ROLE_MINIBOSS
1874 }
1875 ,
1876 { // defender2
1877 1600, // int max_armour;
1878 10, // level
1879 3, // common
1880 900, // score
1881 25000, // int radius;
1882 131000, // int edge_radius;
1883 HIGH_DRAG, // drag
1884 3000, // mass
1885 AI_DRIFTER, // AI
1886 GEN_HIGH, // generous
1887 COLOUR_RED6, // col1
1888 COLOUR_RED1, // col2
1889 2, // turrets
1890 PITCH_MINIBOSS2, // pitch
1891 45, // acceleration
1892 0, // impulse delay
1893 2000000, // range
1894 4, // slew
1895 ROLE_MINIBOSS
1896 },
1897 { // defender2_turret1
1898 700, // int max_armour;
1899 10, // level
1900 0, // common
1901 100, // score
1902 9000, // int radius;
1903 15000, // int edge_radius;
1904 0, // drag
1905 400, // mass
1906 AI_TURRET, // AI
1907 0, // generous
1908 COLOUR_RED6, // col1
1909 COLOUR_RED1, // col2
1910 0, // turrets
1911 PITCH_TURRET2, // pitch
1912 0, // acceleration
1913 0, // impulse delay
1914 900000, // range
1915 5, // slew
1916 ROLE_TURRET
1917 },
1918 { // defender2_turret2
1919 700, // int max_armour;
1920 10, // level
1921 0, // common
1922 100, // score
1923 9000, // int radius;
1924 15000, // int edge_radius;
1925 0, // drag
1926 400, // mass
1927 AI_TURRET, // AI
1928 0, // generous
1929 COLOUR_ORANGE6, // col1
1930 COLOUR_ORANGE1, // col2
1931 0, // turrets
1932 PITCH_TURRET2, // pitch
1933 0, // acceleration
1934 0, // impulse delay
1935 900000, // range
1936 5, // slew
1937 ROLE_TURRET
1938 },
1939 { // defender2_turret3
1940 700, // int max_armour;
1941 10, // level
1942 0, // common
1943 100, // score
1944 9000, // int radius;
1945 15000, // int edge_radius;
1946 0, // drag
1947 400, // mass
1948 AI_TURRET, // AI
1949 0, // generous
1950 COLOUR_RED6, // col1
1951 COLOUR_RED1, // col2
1952 0, // turrets
1953 PITCH_TURRET2, // pitch
1954 0, // acceleration
1955 0, // impulse delay
1956 900000, // range
1957 3, // slew
1958 ROLE_TURRET
1959 },
1960 { // defender3
1961 2500, // int max_armour;
1962 13, // level
1963 3, // common
1964 900, // score
1965 25000, // int radius;
1966 131000, // int edge_radius;
1967 HIGH_DRAG, // drag
1968 3000, // mass
1969 AI_DRIFTER, // AI
1970 GEN_HIGH, // generous
1971 COLOUR_RED6, // col1
1972 COLOUR_RED1, // col2
1973 2, // turrets
1974 PITCH_MINIBOSS2, // pitch
1975 50, // acceleration
1976 0, // impulse delay
1977 2000000, // range
1978 5, // slew
1979 ROLE_MINIBOSS
1980 },
1981 { // defender3_turret1 - shielder
1982 500, // int max_armour;
1983 12, // level
1984 0, // common
1985 100, // score
1986 12000, // int radius;
1987 15000, // int edge_radius;
1988 0, // drag
1989 400, // mass
1990 AI_TURRET, // AI
1991 0, // generous
1992 COLOUR_BLUE6, // col1
1993 COLOUR_BLUE1, // col2
1994 0, // turrets
1995 PITCH_TURRET2, // pitch
1996 0, // acceleration
1997 0, // impulse delay
1998 900000, // range
1999 0, // slew
2000 ROLE_TURRET
2001 },
2002 { // defender3_turret2 - orbital
2003 700, // int max_armour;
2004 12, // level
2005 0, // common
2006 100, // score
2007 12000, // int radius;
2008 15000, // int edge_radius;
2009 0, // drag
2010 400, // mass
2011 AI_TURRET, // AI
2012 0, // generous
2013 COLOUR_ORANGE6, // col1
2014 COLOUR_ORANGE1, // col2
2015 0, // turrets
2016 PITCH_TURRET2, // pitch
2017 0, // acceleration
2018 0, // impulse delay
2019 900000, // range
2020 0, // slew
2021 ROLE_TURRET
2022 },
2023 { // defender3_turret3 - slivers
2024 700, // int max_armour;
2025 12, // level
2026 0, // common
2027 100, // score
2028 12000, // int radius;
2029 15000, // int edge_radius;
2030 0, // drag
2031 400, // mass
2032 AI_TURRET, // AI
2033 0, // generous
2034 COLOUR_RED6, // col1
2035 COLOUR_RED1, // col2
2036 0, // turrets
2037 PITCH_TURRET2, // pitch
2038 0, // acceleration
2039 0, // impulse delay
2040 400000, // range
2041 8, // slew
2042 ROLE_TURRET
2043 },
2044 { // defender3_turret4 - ball2
2045 700, // int max_armour;
2046 12, // level
2047 0, // common
2048 100, // score
2049 12000, // int radius;
2050 15000, // int edge_radius;
2051 0, // drag
2052 400, // mass
2053 AI_TURRET, // AI
2054 0, // generous
2055 COLOUR_RED6, // col1
2056 COLOUR_RED1, // col2
2057 0, // turrets
2058 PITCH_TURRET2, // pitch
2059 0, // acceleration
2060 0, // impulse delay
2061 600000, // range
2062 3, // slew
2063 ROLE_TURRET
2064 },
2065 { // defender3_turret5
2066 700, // int max_armour;
2067 12, // level
2068 0, // common
2069 100, // score
2070 12000, // int radius;
2071 15000, // int edge_radius;
2072 0, // drag
2073 400, // mass
2074 AI_TURRET, // AI
2075 0, // generous
2076 COLOUR_YELLOW6, // col1
2077 COLOUR_YELLOW1, // col2
2078 0, // turrets
2079 PITCH_TURRET2, // pitch
2080 0, // acceleration
2081 0, // impulse delay
2082 900000, // range
2083 0, // slew
2084 ROLE_TURRET
2085 },
2086 { // defender3_turret6
2087 700, // int max_armour;
2088 12, // level
2089 0, // common
2090 100, // score
2091 12000, // int radius;
2092 15000, // int edge_radius;
2093 0, // drag
2094 400, // mass
2095 AI_TURRET, // AI
2096 0, // generous
2097 COLOUR_ORANGE6, // col1
2098 COLOUR_ORANGE1, // col2
2099 0, // turrets
2100 PITCH_TURRET2, // pitch
2101 0, // acceleration
2102 0, // impulse delay
2103 900000, // range
2104 4, // slew
2105 ROLE_TURRET
2106 },
2107 { // orbiter1
2108 800, // int max_armour;
2109 8, // level
2110 3, // common
2111 800, // score
2112 13000, // int radius;
2113 25000, // int edge_radius;
2114 HIGH_DRAG, // drag
2115 500, // mass
2116 AI_AUTO, // AI
2117 GEN_MED, // generous
2118 COLOUR_YELLOW6, // col1
2119 COLOUR_YELLOW1, // col2
2120 0, // turrets
2121 PITCH_SMALL_SPINNER, // pitch
2122 0, // acceleration
2123 0, // impulse delay
2124 900000, // range
2125 1, // slew
2126 ROLE_EXTRA
2127 },
2128 { // orbiter2
2129 1000, // int max_armour;
2130 10, // level
2131 3, // common
2132 1200, // score
2133 10000, // int radius;
2134 25000, // int edge_radius;
2135 HIGH_DRAG, // drag
2136 500, // mass
2137 AI_AUTO, // AI
2138 GEN_MED, // generous
2139 COLOUR_RED6, // col1
2140 COLOUR_RED2, // col2
2141 0, // turrets
2142 PITCH_SMALL_SPINNER, // pitch
2143 0, // acceleration
2144 0, // impulse delay
2145 900000, // range
2146 1, // slew
2147 ROLE_EXTRA
2148 },
2149 { // orbiter3
2150 1100, // int max_armour;
2151 13, // level
2152 3, // common
2153 1500, // score
2154 15000, // int radius;
2155 29000, // int edge_radius;
2156 HIGH_DRAG, // drag
2157 500, // mass
2158 AI_AUTO, // AI
2159 GEN_MED, // generous
2160 COLOUR_BLUE5, // col1
2161 COLOUR_BLUE2, // col2
2162 0, // turrets
2163 PITCH_LARGE_SPINNER, // pitch
2164 0, // acceleration
2165 0, // impulse delay
2166 900000, // range
2167 16, // slew
2168 ROLE_EXTRA
2169 },
2170 { // attractor
2171 900, // int max_armour;
2172 12, // level
2173 3, // common
2174 1500, // score
2175 15000, // int radius;
2176 29000, // int edge_radius;
2177 HIGH_DRAG, // drag
2178 1500, // mass
2179 AI_AUTO, // AI
2180 GEN_MED, // generous
2181 COLOUR_BLUE5, // col1
2182 COLOUR_BLUE2, // col2
2183 0, // turrets
2184 PITCH_HEAVY_SPINNER, // pitch
2185 0, // acceleration
2186 0, // impulse delay
2187 900000, // range
2188 0, // slew
2189 ROLE_EXTRA
2190 },
2191 { // Disrupter1
2192 900, // int max_armour;
2193 9, // level
2194 2, // common
2195 800, // score
2196 15000, // int radius;
2197 54000, // int edge_radius;
2198 LOW_DRAG, // drag
2199 350, // mass
2200 AI_DRIFTER, // AI
2201 GEN_LOW, // generous
2202 COLOUR_ORANGE6, // col1
2203 COLOUR_ORANGE1, // col2
2204 0, // turrets
2205 PITCH_GUARDIAN, // pitch
2206 15, // acceleration
2207 0, // impulse delay
2208 1500000, // range
2209 4, // slew
2210 ROLE_TARGET
2211 },
2212 { // Disrupter2
2213 1000, // int max_armour;
2214 12, // level
2215 2, // common
2216 1200, // score
2217 15000, // int radius;
2218 54000, // int edge_radius;
2219 LOW_DRAG, // drag
2220 450, // mass
2221 AI_DRIFTER, // AI
2222 GEN_LOW, // generous
2223 COLOUR_BLUE6, // col1
2224 COLOUR_BLUE1, // col2
2225 0, // turrets
2226 PITCH_GUARDIAN, // pitch
2227 15, // acceleration
2228 0, // impulse delay
2229 1500000, // range
2230 4, // slew
2231 ROLE_TARGET
2232 },
2233 { // Disrupter3
2234 1200, // int max_armour;
2235 14, // level
2236 2, // common
2237 800, // score
2238 15000, // int radius;
2239 54000, // int edge_radius;
2240 LOW_DRAG, // drag
2241 550, // mass
2242 AI_DRIFTER, // AI
2243 GEN_LOW, // generous
2244 COLOUR_GREY5, // col1
2245 COLOUR_GREY1, // col2
2246 0, // turrets
2247 PITCH_GUARDIAN, // pitch
2248 15, // acceleration
2249 0, // impulse delay
2250 1500000, // range
2251 4, // slew
2252 ROLE_TARGET
2253 },
2254 { // triangler1
2255 750, // int max_armour;
2256 9, // level
2257 3, // common
2258 200, // score
2259 16000, // int radius;
2260 60000, // int edge_radius;
2261 HIGH_DRAG, // drag
2262 600, // mass
2263 AI_DRIFTER, // AI
2264 GEN_LOW, // generous
2265 COLOUR_YELLOW6, // col1
2266 COLOUR_YELLOW1, // col2
2267 0, // turrets
2268 PITCH_HEAVY, // pitch
2269 30, // acceleration
2270 0, // impulse delay
2271 2000000, // range
2272 2, // slew
2273 ROLE_TARGET
2274 },
2275 { // triangler2
2276 1250, // int max_armour;
2277 12, // level
2278 3, // common
2279 500, // score
2280 18000, // int radius;
2281 60000, // int edge_radius;
2282 HIGH_DRAG, // drag
2283 800, // mass
2284 AI_DRIFTER, // AI
2285 GEN_LOW, // generous
2286 COLOUR_ORANGE6, // col1
2287 COLOUR_ORANGE1, // col2
2288 0, // turrets
2289 PITCH_HEAVY, // pitch
2290 30, // acceleration
2291 0, // impulse delay
2292 3000000, // range
2293 3, // slew
2294 ROLE_TARGET
2295 },
2296 { // triangler3
2297 1350, // int max_armour;
2298 15, // level
2299 3, // common
2300 500, // score
2301 15000, // int radius;
2302 60000, // int edge_radius;
2303 HIGH_DRAG, // drag
2304 800, // mass
2305 AI_DRIFTER, // AI
2306 GEN_LOW, // generous
2307 COLOUR_BLUE6, // col1
2308 COLOUR_BLUE1, // col2
2309 0, // turrets
2310 PITCH_HEAVY, // pitch
2311 30, // acceleration
2312 0, // impulse delay
2313 2000000, // range
2314 4, // slew
2315 ROLE_TARGET
2316 },
2317 { // overtriangler
2318 2800, // int max_armour;
2319 15, // level
2320 3, // common
2321 500, // score
2322 330000, // int radius;
2323 60000, // int edge_radius;
2324 HIGH_DRAG, // drag
2325 1400, // mass
2326 AI_DRIFTER, // AI
2327 GEN_LOW, // generous
2328 COLOUR_RED6, // col1
2329 COLOUR_RED1, // col2
2330 1, // turrets
2331 PITCH_MINIBOSS2, // pitch
2332 23, // acceleration
2333 0, // impulse delay
2334 2000000, // range
2335 2, // slew
2336 ROLE_MINIBOSS
2337 },
2338 { // overtriangler_turret
2339 600, // int max_armour;
2340 12, // level
2341 0, // common
2342 400, // score
2343 10000, // int radius;
2344 13000, // int edge_radius;
2345 0, // drag
2346 200, // mass
2347 AI_TURRET, // AI
2348 0, // generous
2349 COLOUR_RED6, // col1
2350 COLOUR_RED1, // col2
2351 0, // turrets
2352 PITCH_TURRET2, // pitch
2353 0, // acceleration
2354 0, // impulse delay
2355 400000, // range
2356 6, // slew
2357 ROLE_TURRET
2358 },
2359 { // leaper1
2360 300, // int max_armour;
2361 7, // level
2362 2, // common
2363 250, // score
2364 9000, // int radius;
2365 10000, // int edge_radius;
2366 MED_DRAG, // drag
2367 150, // mass
2368 AI_LEAPER, // AI
2369 GEN_LOW, // generous
2370 COLOUR_ORANGE6, // col1
2371 COLOUR_ORANGE1, // col2
2372 0, // turrets
2373 PITCH_FIGHTER, // pitch
2374 5000, // acceleration
2375 60, // impulse delay
2376 500000, // range
2377 12, // slew
2378 ROLE_EXTRA
2379 },
2380 { // leaper2
2381 400, // int max_armour;
2382 11, // level
2383 2, // common
2384 500, // score
2385 9000, // int radius;
2386 10000, // int edge_radius;
2387 MED_DRAG, // drag
2388 190, // mass
2389 AI_LEAPER, // AI
2390 GEN_LOW, // generous
2391 COLOUR_BLUE6, // col1
2392 COLOUR_BLUE1, // col2
2393 0, // turrets
2394 PITCH_FIGHTER, // pitch
2395 7000, // acceleration
2396 50, // impulse delay
2397 500000, // range
2398 12, // slew
2399 ROLE_EXTRA
2400 },
2401 { // wormer4
2402 900, // int max_armour;
2403 12, // level
2404 2, // common
2405 500, // score
2406 10000, // int radius;
2407 23000, // int edge_radius;
2408 LOW_DRAG, // drag
2409 400, // mass
2410 AI_DRIFTER, // AI
2411 GEN_LOW, // generous
2412 COLOUR_BLUE5, // col1
2413 COLOUR_BLUE2, // col2
2414 0, // turrets
2415 PITCH_GUARDIAN, // pitch
2416 15, // acceleration
2417 99, // impulse delay
2418 900000, // range
2419 0, // slew
2420 ROLE_TARGET
2421 },
2422 { // beamer1
2423 2500, // int max_armour;
2424 12, // level
2425 2, // common
2426 900, // score
2427 35000, // int radius;
2428 131000, // int edge_radius;
2429 HIGH_DRAG, // drag
2430 4000, // mass
2431 AI_DRIFTER, // AI
2432 GEN_HIGH, // generous
2433 COLOUR_RED6, // col1
2434 COLOUR_RED1, // col2
2435 2, // turrets
2436 PITCH_MINIBOSS1, // pitch
2437 40, // acceleration
2438 0, // impulse delay
2439 1000000, // range
2440 4, // slew
2441 ROLE_MINIBOSS
2442 },
2443 { // beamer2
2444 3500, // int max_armour;
2445 14, // level
2446 2, // common
2447 1200, // score
2448 35000, // int radius;
2449 131000, // int edge_radius;
2450 HIGH_DRAG, // drag
2451 5000, // mass
2452 AI_DRIFTER, // AI
2453 GEN_HIGH, // generous
2454 COLOUR_BLUE6, // col1
2455 COLOUR_BLUE1, // col2
2456 2, // turrets
2457 PITCH_MINIBOSS2, // pitch
2458 40, // acceleration
2459 0, // impulse delay
2460 1000000, // range
2461 5, // slew
2462 ROLE_MINIBOSS
2463 },
2464 { // overblatter2
2465 3000, // int max_armour;
2466 13, // level
2467 3, // common
2468 2000, // score
2469 26000, // int radius;
2470 120000, // int edge_radius;
2471 HIGH_DRAG, // drag
2472 2500, // mass
2473 AI_DRIFTER, // AI
2474 GEN_HIGH, // generous
2475 COLOUR_BLUE6, // col1
2476 COLOUR_BLUE1, // col2
2477 0, // turrets
2478 PITCH_MINIBOSS2, // pitch
2479 0, // acceleration
2480 0, // impulse delay
2481 400000, // range
2482 2, // slew
2483 ROLE_MINIBOSS
2484 },
2485 { // overdisrupter
2486 2500, // int max_armour;
2487 14, // level
2488 2, // common
2489 900, // score
2490 25000, // int radius;
2491 131000, // int edge_radius;
2492 HIGH_DRAG, // drag
2493 3000, // mass
2494 AI_DRIFTER, // AI
2495 GEN_HIGH, // generous
2496 COLOUR_BLUE6, // col1
2497 COLOUR_BLUE1, // col2
2498 2, // turrets
2499 PITCH_MINIBOSS2, // pitch
2500 40, // acceleration
2501 0, // impulse delay
2502 2000000, // range
2503 5, // slew
2504 ROLE_MINIBOSS
2505 },
2506 { // guardian4
2507 1000, // int max_armour;
2508 13, // level
2509 3, // common
2510 800, // score
2511 19000, // int radius;
2512 60000, // int edge_radius;
2513 MED_DRAG, // drag
2514 250, // mass
2515 AI_DRIFTER, // AI
2516 GEN_LOW, // generous
2517 COLOUR_RED5, // col1
2518 COLOUR_RED1, // col2
2519 0, // turrets
2520 PITCH_GUARDIAN, // pitch
2521 36, // acceleration
2522 0, // impulse delay
2523 900000, // range
2524 4, // slew
2525 ROLE_TARGET
2526 },
2527 { // guardian5
2528 1100, // int max_armour;
2529 15, // level
2530 3, // common
2531 900, // score
2532 19000, // int radius;
2533 60000, // int edge_radius;
2534 MED_DRAG, // drag
2535 250, // mass
2536 AI_DRIFTER, // AI
2537 GEN_LOW, // generous
2538 COLOUR_BLUE5, // col1
2539 COLOUR_BLUE1, // col2
2540 0, // turrets
2541 PITCH_GUARDIAN, // pitch
2542 32, // acceleration
2543 0, // impulse delay
2544 900000, // range
2545 4, // slew
2546 ROLE_TARGET
2547 },
2548 { // overzapper
2549 3500, // int max_armour;
2550 13, // level
2551 3, // common
2552 2500, // score
2553 30000, // int radius;
2554 120000, // int edge_radius;
2555 HIGH_DRAG, // drag
2556 2500, // mass
2557 AI_DRIFTER, // AI
2558 GEN_HIGH, // generous
2559 COLOUR_BLUE6, // col1
2560 COLOUR_BLUE1, // col2
2561 1, // turrets
2562 PITCH_MINIBOSS2, // pitch
2563 0, // acceleration
2564 0, // impulse delay
2565 2000000, // range
2566 2, // slew
2567 ROLE_MINIBOSS
2568 },
2569 { // Bracket5
2570 1000, // int max_armour;
2571 13, // level
2572 2, // common
2573 800, // score
2574 11000, // int radius;
2575 54000, // int edge_radius;
2576 MED_DRAG, // drag
2577 350, // mass
2578 AI_DRIFTER, // AI
2579 GEN_LOW, // generous
2580 COLOUR_RED6, // col1
2581 COLOUR_RED1, // col2
2582 0, // turrets
2583 PITCH_BRACKET, // pitch
2584 32, // acceleration
2585 0, // impulse delay
2586 700000, // range
2587 2, // slew
2588 ROLE_TARGET
2589 },
2590 { // Boss2_2
2591 3000, // int max_armour;
2592 10, // level
2593 0, // common
2594 500, // score
2595 35000, // int radius;
2596 125000, // int edge_radius;
2597 HIGH_DRAG, // drag
2598 5000, // mass
2599 AI_DRIFTER, // AI
2600 GEN_HIGH, // generous
2601 COLOUR_RED6, // col1
2602 COLOUR_RED1, // col2
2603 3, // turrets
2604 PITCH_BOSS2, // pitch
2605 65, // acceleration
2606 99, // impulse delay
2607 1900000, // range
2608 3, // slew
2609 ROLE_BOSS
2610 },
2611 { // Boss2_3
2612 3000, // int max_armour;
2613 10, // level
2614 0, // common
2615 500, // score
2616 35000, // int radius;
2617 125000, // int edge_radius;
2618 HIGH_DRAG, // drag
2619 5000, // mass
2620 AI_DRIFTER, // AI
2621 GEN_HIGH, // generous
2622 COLOUR_ORANGE6, // col1
2623 COLOUR_ORANGE1, // col2
2624 4, // turrets
2625 PITCH_BOSS3, // pitch
2626 65, // acceleration
2627 99, // impulse delay
2628 1900000, // range
2629 3, // slew
2630 ROLE_BOSS
2631 },
2632 { // Boss3_1
2633 4000, // int max_armour;
2634 15, // level
2635 0, // common
2636 500, // score
2637 35000, // int radius;
2638 125000, // int edge_radius;
2639 HIGH_DRAG, // drag
2640 5000, // mass
2641 AI_DRIFTER, // AI
2642 GEN_HIGH, // generous
2643 COLOUR_BLUE5, // col1
2644 COLOUR_BLUE1, // col2
2645 4, // turrets
2646 PITCH_BOSS3, // pitch
2647 65, // acceleration
2648 99, // impulse delay
2649 1900000, // range
2650 3, // slew
2651 ROLE_BOSS
2652 },
2653 { // Boss3_2
2654 4000, // int max_armour;
2655 15, // level
2656 0, // common
2657 500, // score
2658 35000, // int radius;
2659 125000, // int edge_radius;
2660 HIGH_DRAG, // drag
2661 5000, // mass
2662 AI_DRIFTER, // AI
2663 GEN_HIGH, // generous
2664 COLOUR_BLUE5, // col1
2665 COLOUR_BLUE1, // col2
2666 3, // turrets
2667 PITCH_BOSS3, // pitch
2668 65, // acceleration
2669 99, // impulse delay
2670 1900000, // range
2671 3, // slew
2672 ROLE_BOSS
2673 },
2674 { // Boss3_3
2675 4000, // int max_armour;
2676 15, // level
2677 0, // common
2678 500, // score
2679 35000, // int radius;
2680 125000, // int edge_radius;
2681 HIGH_DRAG, // drag
2682 5000, // mass
2683 AI_DRIFTER, // AI
2684 GEN_HIGH, // generous
2685 COLOUR_RED6, // col1
2686 COLOUR_RED1, // col2
2687 4, // turrets
2688 PITCH_BOSS3, // pitch
2689 65, // acceleration
2690 99, // impulse delay
2691 1900000, // range
2692 2, // slew
2693 ROLE_BOSS
2694 },
2695 { // Messenger
2696 200, // int max_armour;
2697 15, // level
2698 0, // common
2699 50, // score
2700 7000, // int radius;
2701 10000, // int edge_radius;
2702 LOW_DRAG, // drag
2703 150, // mass
2704 AI_FIGHTER, // AI
2705 GEN_LOW, // generous
2706 COLOUR_BLUE6, // col1
2707 COLOUR_BLUE1, // col2
2708 0, // turrets
2709 PITCH_FIGHTER, // pitch
2710 65, // acceleration
2711 0, // impulse delay
2712 500000, // range
2713 12, // slew
2714 ROLE_EXTRA
2715 },
2716 { // shadow1
2717 400, // int max_armour;
2718 9, // level
2719 2, // common
2720 10, // score
2721 12000, // int radius;
2722 60000, // int edge_radius;
2723 MED_DRAG, // drag
2724 200, // mass
2725 AI_DRIFTER, // AI
2726 GEN_LOW, // generous
2727 COLOUR_BLUE6, // col1
2728 COLOUR_BLUE1, // col2
2729 0, // turrets
2730 PITCH_MEDIUM, // pitch
2731 26, // acceleration
2732 0, // impulse delay
2733 900000, // range
2734 4, // slew
2735 ROLE_TARGET
2736 },
2737 { // shadow2
2738 500, // int max_armour;
2739 13, // level
2740 2, // common
2741 900, // score
2742 12000, // int radius;
2743 60000, // int edge_radius;
2744 MED_DRAG, // drag
2745 200, // mass
2746 AI_DRIFTER, // AI
2747 GEN_LOW, // generous
2748 COLOUR_GREY6, // col1
2749 COLOUR_GREY1, // col2
2750 0, // turrets
2751 PITCH_MEDIUM, // pitch
2752 30, // acceleration
2753 0, // impulse delay
2754 900000, // range
2755 4, // slew
2756 ROLE_TARGET
2757 },
2758 { // Boss3_turret1
2759 700, // int max_armour;
2760 15, // level
2761 0, // common
2762 400, // score
2763 14000, // int radius;
2764 17000, // int edge_radius;
2765 0, // drag
2766 200, // mass
2767 AI_TURRET, // AI
2768 0, // generous
2769 COLOUR_RED6, // col1
2770 COLOUR_RED1, // col2
2771 0, // turrets
2772 PITCH_TURRET2, // pitch
2773 0, // acceleration
2774 0, // impulse delay
2775 900000, // range
2776 3, // slew
2777 ROLE_TURRET
2778 },
2779 { // Boss3_turret2
2780 700, // int max_armour;
2781 15, // level
2782 0, // common
2783 400, // score
2784 14000, // int radius;
2785 17000, // int edge_radius;
2786 0, // drag
2787 200, // mass
2788 AI_TURRET, // AI
2789 0, // generous
2790 COLOUR_BLUE6, // col1
2791 COLOUR_BLUE1, // col2
2792 0, // turrets
2793 PITCH_TURRET2, // pitch
2794 0, // acceleration
2795 0, // impulse delay
2796 900000, // range
2797 6, // slew
2798 ROLE_TURRET
2799 },
2800 { // Boss3_turret3
2801 700, // int max_armour;
2802 15, // level
2803 0, // common
2804 400, // score
2805 14000, // int radius;
2806 17000, // int edge_radius;
2807 0, // drag
2808 200, // mass
2809 AI_TURRET, // AI
2810 0, // generous
2811 COLOUR_GREY5, // col1
2812 COLOUR_GREY1, // col2
2813 0, // turrets
2814 PITCH_TURRET2, // pitch
2815 0, // acceleration
2816 0, // impulse delay
2817 900000, // range
2818 6, // slew
2819 ROLE_TURRET
2820 },
2821 { // waver1
2822 800, // int max_armour;
2823 7, // level
2824 2, // common
2825 800, // score
2826 15000, // int radius;
2827 55000, // int edge_radius;
2828 HIGH_DRAG, // drag
2829 500, // mass
2830 AI_AUTO, // AI
2831 GEN_MED, // generous
2832 COLOUR_ORANGE6, // col1
2833 COLOUR_ORANGE1, // col2
2834 0, // turrets
2835 PITCH_LARGE_SPINNER, // pitch
2836 0, // acceleration
2837 0, // impulse delay
2838 900000, // range
2839 0, // slew
2840 ROLE_EXTRA
2841 },
2842 { // waver2
2843 1000, // int max_armour;
2844 11, // level
2845 2, // common
2846 1200, // score
2847 15000, // int radius;
2848 60000, // int edge_radius;
2849 HIGH_DRAG, // drag
2850 500, // mass
2851 AI_AUTO, // AI
2852 GEN_MED, // generous
2853 COLOUR_RED6, // col1
2854 COLOUR_RED2, // col2
2855 0, // turrets
2856 PITCH_LARGE_SPINNER, // pitch
2857 0, // acceleration
2858 0, // impulse delay
2859 900000, // range
2860 0, // slew
2861 ROLE_EXTRA
2862 },
2863 { // Curve1
2864 250, // int max_armour;
2865 1, // level
2866 2, // common
2867 10, // score
2868 13000, // int radius;
2869 54000, // int edge_radius;
2870 MED_DRAG, // drag
2871 200, // mass
2872 AI_DRIFTER, // AI
2873 GEN_LOW, // generous
2874 COLOUR_GREEN6, // col1
2875 COLOUR_GREEN1, // col2
2876 0, // turrets
2877 PITCH_BRACKET, // pitch
2878 17, // acceleration
2879 0, // impulse delay
2880 900000, // range
2881 1, // slew
2882 ROLE_TARGET
2883 },
2884 { // Curve2
2885 1050, // int max_armour;
2886 5, // level
2887 2, // common
2888 10, // score
2889 13000, // int radius;
2890 54000, // int edge_radius;
2891 MED_DRAG, // drag
2892 300, // mass
2893 AI_DRIFTER, // AI
2894 GEN_LOW, // generous
2895 COLOUR_RED6, // col1
2896 COLOUR_RED1, // col2
2897 0, // turrets
2898 PITCH_BRACKET, // pitch
2899 17, // acceleration
2900 0, // impulse delay
2901 1500000, // range
2902 1, // slew
2903 ROLE_TARGET
2904 },
2905 { // Curve3
2906 1250, // int max_armour;
2907 8, // level
2908 2, // common
2909 10, // score
2910 13000, // int radius;
2911 54000, // int edge_radius;
2912 MED_DRAG, // drag
2913 250, // mass
2914 AI_DRIFTER, // AI
2915 GEN_LOW, // generous
2916 COLOUR_BLUE6, // col1
2917 COLOUR_BLUE1, // col2
2918 0, // turrets
2919 PITCH_BRACKET, // pitch
2920 17, // acceleration
2921 0, // impulse delay
2922 1500000, // range
2923 1, // slew
2924 ROLE_TARGET
2925 },
2926 { // underspikey2
2927 2000, // int max_armour;
2928 7, // level
2929 2, // common
2930 1000, // score
2931 26000, // int radius;
2932 120000, // int edge_radius;
2933 HIGH_DRAG, // drag
2934 2500, // mass
2935 AI_DRIFTER, // AI
2936 GEN_HIGH, // generous
2937 COLOUR_YELLOW6, // col1
2938 COLOUR_YELLOW1, // col2
2939 0, // turrets
2940 PITCH_MINIBOSS1, // pitch
2941 0, // acceleration
2942 0, // impulse delay
2943 9000000, // range
2944 2, // slew
2945 ROLE_MINIBOSS
2946 },
2947 { // underspikey3
2948 1700, // int max_armour;
2949 6, // level
2950 2, // common
2951 1000, // score
2952 26000, // int radius;
2953 120000, // int edge_radius;
2954 HIGH_DRAG, // drag
2955 2500, // mass
2956 AI_DRIFTER, // AI
2957 GEN_HIGH, // generous
2958 COLOUR_YELLOW6, // col1
2959 COLOUR_YELLOW1, // col2
2960 0, // turrets
2961 PITCH_MINIBOSS1, // pitch
2962 0, // acceleration
2963 0, // impulse delay
2964 9000000, // range
2965 3, // slew
2966 ROLE_MINIBOSS
2967 },
2968 { // overspikey2
2969 3500, // int max_armour;
2970 12, // level
2971 2, // common
2972 2500, // score
2973 27000, // int radius;
2974 120000, // int edge_radius;
2975 HIGH_DRAG, // drag
2976 2500, // mass
2977 AI_DRIFTER, // AI
2978 GEN_HIGH, // generous
2979 COLOUR_BLUE6, // col1
2980 COLOUR_BLUE1, // col2
2981 0, // turrets
2982 PITCH_MINIBOSS2, // pitch
2983 0, // acceleration
2984 0, // impulse delay
2985 9000000, // range
2986 4, // slew
2987 ROLE_MINIBOSS
2988 },
2989 { // dead_tri1
2990 1, // int max_armour;
2991 0, // level
2992 0, // common
2993 200, // score
2994 0, // int radius;
2995 60000, // int edge_radius;
2996 LOW_DRAG, // drag
2997 1, // mass
2998 AI_DRIFTER, // AI
2999 0, // generous
3000 COLOUR_YELLOW6, // col1
3001 COLOUR_YELLOW1, // col2
3002 0, // turrets
3003 PITCH_HEAVY, // pitch
3004 0, // acceleration
3005 0, // impulse delay
3006 0, // range
3007 0, // slew
3008 ROLE_DEAD
3009 },
3010 { // dead_tri2
3011 1, // int max_armour;
3012 0, // level
3013 0, // common
3014 200, // score
3015 0, // int radius;
3016 60000, // int edge_radius;
3017 LOW_DRAG, // drag
3018 1, // mass
3019 AI_DRIFTER, // AI
3020 0, // generous
3021 COLOUR_YELLOW6, // col1
3022 COLOUR_YELLOW1, // col2
3023 0, // turrets
3024 PITCH_HEAVY, // pitch
3025 0, // acceleration
3026 0, // impulse delay
3027 0, // range
3028 0, // slew
3029 ROLE_DEAD
3030 },
3031 { // dead_tri3
3032 1, // int max_armour;
3033 0, // level
3034 0, // common
3035 200, // score
3036 0, // int radius;
3037 60000, // int edge_radius;
3038 LOW_DRAG, // drag
3039 1, // mass
3040 AI_DRIFTER, // AI
3041 0, // generous
3042 COLOUR_YELLOW6, // col1
3043 COLOUR_YELLOW1, // col2
3044 0, // turrets
3045 PITCH_HEAVY, // pitch
3046 0, // acceleration
3047 0, // impulse delay
3048 0, // range
3049 0, // slew
3050 ROLE_DEAD
3051 }
3052
3053 };
3054 // black enemy?
3055
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: enemy.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - most functions relating to enemies
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36
37 #include "config.h"
38 #include "globvars.h"
39
40 #include "stuff.h"
41 #include "cloud.h"
42 #include "palette.h"
43 #include "bullet.h"
44 #include "pickup.h"
45 #include "sound.h"
46 #include "actor.h"
47 #include "levels.h"
48 #include "cmds.h"
49 #include "display.h"
50
51 #define HIVE_MIN_RANGE 200000
52 #define HIVE_MAX_RANGE 500000
53
54 #define DAM_GREEN_BLAT 90
55 #define DAM_SMALL_GREEN_SEEKER 150
56 #define DAM_LARGE_GREEN_SEEKER 200
57 #define DAM_YELLOW_SEEKER 200
58 #define DAM_BLUE_BLAT 70
59 #define DAM_WORMS1 150
60 #define DAM_WORMS2 250
61 #define MINE_SIZE 3000
62
63 #define COLOURISE_GREEN_SEEKER1 -1
64 #define COLOURISE_GREEN_SEEKER2 -2
65 #define COLOURISE_BLUE_SEEKER -3
66 #define COLOURISE_YELLOW_SEEKER -4
67
68 #define TA_TURRET_TIMEOUT -17
69
70
71
72 extern FONT *small_font;
73
74 int create_enemy(int type, int subtype, int x, int y,
75 int x_speed, int y_speed, int angle, int carrying_pickup, int special [10],
76 int target);
77
78 int create_turret(int type, int base, int turret_counter);
79
80 void manage_enemy(int e);
81 int move_enemy(int e);
82 int detect_collision(int e);//, int things [2]);
83 void enemy_explodes(int e, int bang);
84 void register_destroyed(int e, int cause);
85
86 void destroy_enemy(int e);
87 int metamorphosis(int e);
88
89 int enemy_turn_towards_angle(int angle, int tangle, int turning, int forbid);
90 int enemy_turn_towards_xy(int x1, int y1, int x2, int y2, int angle, int turning, int forbid);
91 //int turn_towards_angle(int angle, int tangle, int turning);
92 //int turn_towards_xy(int x1, int y1, int x2, int y2, int angle, int turning);
93 void accelerate_enemy(int e, int angle, int impulse);
94 void drag_enemy(int e, float drag_amount);
95 int track_target(int e, int attacking, int turning, int forbid);
96 int track_target_any_angle(int x, int y, int target_x, int target_y, int turning, int forbid, int angle);
97 void standard_attack(int e, int angle);
98 int near_angle(int angle1, int angle2);
99 void enemy_vanish(int e);
100
101 void find_firebase_start_point(int location [2]);
102 void find_crawly_start_point(int location [2]);
103 void find_target_start_point(int location [2], int et);
104 int spawn_enemy(int type, int subtype, int carrying_pickup, int target);
105 void move_sun(int e);
106 int hurt_enemy(int e, int hurty, int source, char pulse);
107 void score_kill(int etype, int subtype, int p);
108 int check_for_targets(void);
109 void check_enemy_pickup_drop(int e);
110 void worm_new_target(int b);
111 void manage_turret(int e, int t, int x, int y, int rotate);
112 void fighter_exhaust(int e, int ax, int ay, int distance [4], int angle [4], int base_colour);
113 void zap_attack(int e);
114 int enemy_sound_pitch(int ec);
115 void puffer_bang(int x, int y, int rot, int number, int dist, int colours [5]);
116
117 int move_drifter_ai(int e);
118 int move_auto_ai(int e);
119 int move_stinger_ai(int e);
120 int move_periodic_stinger_ai(int e);
121 int move_turret_ai(int e);
122 int move_fighter_ai(int e);
123 int move_bomber_ai(int e);
124 int move_cruiser_ai(int e);
125 int move_leaper_ai(int e);
126 void run_boss3_1(int e);
127 void run_boss3_3(int e);
128
129 void wormer_pulsates(int e);
130
131 void colourise_bullet(int arr [4], int tc);
132
133 enum
134 {
135 ESOUND_NONE,
136 ESOUND_EXPLODE1,
137 ESOUND_EXPLODE2,
138 ESOUND_WOBBLE,
139 ESOUND_LONG_WOBBLE,
140 ESOUND_WARP_IN,
141 ESOUND_STING,
142 ESOUND_HARD_ZAP,
143 ESOUND_BOSS2,
144 ESOUND_BLORT,
145 ESOUND_STING4,
146 ESOUND_BLAST,
147 ESOUND_ZAPNOTE1,
148 ESOUND_ZAPNOTE2,
149 ESOUND_MINE,
150 ESOUND_SHORTZAP,
151 ESOUND_SHORTZAP2,
152 ESOUND_BLAT,
153 ESOUND_SUN,
154 ESOUND_BOSS1,
155 ESOUND_CROAK,
156 ESOUND_GREENSEEKER1,
157 ESOUND_GREENSEEKER2,
158 ESOUND_TORPEDO,
159 ESOUND_BOSS3_1,
160 ESOUND_BOSS3_2,
161 ESOUND_BOSS3_3,
162 ESOUND_PLASMA,
163 ESOUND_SEEKMINE,
164 ESOUND_ORBITAL,
165 ESOUND_MISSILE,
166 ESOUND_MINEBANG,
167 ESOUND_MUTATE
168
169 };
170
171 void enemy_sound(int e, int sound);
172 void enemy_soundf(int e, int sound, int freq);
173 void enemy_soundvf(int e, int sound, int vol, int freq);
174 void enemy_sound_fire(int e, int sound, int freq, int vol, int dist);
175
176 void init_enemies(void)
177 {
178
179 int e;
180
181 for (e = 0; e < NO_ENEMIES; e++)
182 {
183 enemy[e].type = ENEMY_NONE;
184 enemy[e].target = TARGET_NO;
185 }
186
187 }
188
189
190 int create_enemy(int type, int subtype, int x, int y,
191 int x_speed, int y_speed, int angle, int carrying_pickup, int special [10],
192 int target)
193 {
194 // REMEMBER: enemies are also created in create_turret()
195
196 int e = 0;
197 int i, j;
198
199
200 for (e = 0; e < NO_ENEMIES; e++)
201 {
202 if (e == NO_ENEMIES - 1) return -1;
203 if (enemy[e].type == ENEMY_NONE) break;
204 }
205
206 enemy[e].type = type;
207 enemy[e].x = x;
208 enemy[e].y = y;
209 enemy[e].x_speed = x_speed;
210 enemy[e].y_speed = y_speed;
211 enemy[e].angle = grand(ANGLE_FULL); //angle;
212 enemy[e].moving_angle = angle;
213 enemy[e].armour = eclass[type].max_armour;
214 enemy[e].hurt_pulse = 0;
215 enemy[e].radius = eclass[type].radius;
216 enemy[e].edge_radius = eclass[type].edge_radius;
217 // enemy[e].shield = eclass[type].max_shield;
218 enemy[e].mass = eclass[type].mass;
219 enemy[e].drag_amount = 0;
220 enemy[e].subtype = subtype;
221 enemy[e].attacking = ATTACK_NONE;
222 enemy[e].counter = 256 - counter;
223 enemy[e].recycle = 50 + grand(50);
224 // enemy[e].attacking = 0;
225 enemy[e].just_collided = 0;
226 enemy[e].carrying_pickup = carrying_pickup;
227 enemy[e].target = target;
228 enemy[e].burst_fire = 0;
229 enemy[e].slew_dir = 0;
230 enemy[e].next_impulse = eclass[type].impulse_delay;
231 enemy[e].turret_main = -1;
232 enemy[e].turret_index = -1;
233 if (eclass[enemy[e].type].role == ROLE_TARGET || eclass[enemy[e].type].role == ROLE_EXTRA)
234 enemy[e].ta_time_left = 2000;// == 60 seconds
235 else
236 enemy[e].ta_time_left = 99999;// == 30 seconds
237 // enemy[e].ta_time_left = 150;// == 60 seconds
238
239 // REMEMBER: enemies are also created in create_turret()
240 for (i = 0; i < MAX_TURRETS; i ++)
241 {
242 enemy[e].turret [i] = -1;
243 }
244
245 enemy[e].colours [0] = eclass[type].colour1;
246 enemy[e].colours [1] = eclass[type].colour2;
247
248 enemy[e].hurt_pulse_colour1 = enemy[e].colours [0];
249 enemy[e].hurt_pulse_colour2 = enemy[e].colours [1];
250
251 for (i = 0; i < NO_ENEMY_ATTRIBUTES; i ++)
252 {
253 enemy[e].attribute [i] = 0; //eclass[type].default_attributes [i];
254 }
255
256 // REMEMBER: enemies are also created in create_turret()
257
258 switch(enemy[e].type)
259 {
260 case ENEMY_DEAD_TRI1:
261 case ENEMY_DEAD_TRI2:
262 case ENEMY_DEAD_TRI3:
263 for (i = 0; i < NO_ENEMY_ATTRIBUTES; i ++)
264 {
265 enemy[e].attribute [i] = special [i];
266 }
267 break;
268
269 case ENEMY_MESSENGER:
270 enemy[e].burst_fire = 3 + grand(3);
271 enemy[e].attribute [4] = special [4];
272 break;
273 case ENEMY_SPIKEY2:
274 case ENEMY_SPINNER4:
275 case ENEMY_BLATTER1:
276 case ENEMY_BLATTER2:
277 case ENEMY_BLATTER3:
278 case ENEMY_BLATTER4:
279 case ENEMY_BLATTER5:
280 enemy[e].burst_fire = 3;
281 case ENEMY_BLOATER1:
282 case ENEMY_BLOATER2:
283 case ENEMY_SPINNER1:
284 case ENEMY_SPINNER2:
285 case ENEMY_SPINNER3:
286 case ENEMY_SPINNER5:
287 case ENEMY_SPIKEY1:
288 case ENEMY_SPIKEY3:
289 case ENEMY_SPIKEY4:
290 case ENEMY_SPIKEY5:
291 case ENEMY_WAVER1:
292 case ENEMY_WAVER2:
293 if (grand(2) == 0)
294 enemy[e].attribute [1] = -8 - grand(8);
295 else
296 enemy[e].attribute [1] = 8 + grand(8);
297 enemy[e].attribute [0] = grand(ANGLE_FULL);
298 break;
299 case ENEMY_OVERBLATTER:
300 case ENEMY_OVERBLATTER2:
301 // enemy[e].burst_fire = 6;
302 enemy[e].attribute [6] = 0;
303 enemy[e].attribute [7] = 0;
304 enemy[e].attribute [4] = 0;
305 case ENEMY_OVERSPINNER:
306 case ENEMY_OVERSPIKEY:
307 case ENEMY_UNDERSPIKEY:
308 case ENEMY_UNDERSPIKEY2:
309 case ENEMY_UNDERSPIKEY3:
310 case ENEMY_OVERSPIKEY2:
311 if (grand(2) == 0)
312 enemy[e].attribute [1] = -6 - grand(6);
313 else
314 enemy[e].attribute [1] = 6 + grand(6);
315 enemy[e].attribute [0] = grand(ANGLE_FULL);
316 enemy[e].attribute [2] = grand(ANGLE_FULL);
317 break;
318 case ENEMY_PUFFER1:
319 case ENEMY_PUFFER2:
320 case ENEMY_PUFFER3:
321 case ENEMY_PUFFER4:
322 if (grand(2) == 0)
323 enemy[e].attribute [1] = -1;
324 else
325 enemy[e].attribute [1] = 1;
326 break;
327 case ENEMY_BRACKET1:
328 case ENEMY_BRACKET3:
329 case ENEMY_BRACKET4:
330 enemy[e].burst_fire = 3 + grand(3);
331 break;
332 case ENEMY_BRACKET2:
333 enemy[e].burst_fire = 6 + grand(6);
334 break;
335 case ENEMY_WORMER1:
336 case ENEMY_WORMER2:
337 case ENEMY_WORMER3:
338 case ENEMY_WORMER4:
339 wormer_pulsates(e);
340 break;
341 case ENEMY_FIGHTER2:
342 case ENEMY_FIGHTER5:
343 enemy[e].burst_fire = 3 + grand(3);
344 enemy[e].attribute [0] = FIGHTER_MOVE;
345 break;
346 case ENEMY_LEAPER1:
347 case ENEMY_LEAPER2:
348 enemy[e].burst_fire = 3;
349 enemy[e].attribute [0] = FIGHTER_MOVE;
350 break;
351 case ENEMY_BOMBER1:
352 case ENEMY_BOMBER3:
353 enemy[e].burst_fire = 3;
354 enemy[e].attribute [0] = FIGHTER_MOVE;
355 break;
356 case ENEMY_SHIELDER1: // note see also some turrets
357 enemy[e].attribute [2] = 6;
358 if (grand(2) == 0)
359 enemy[e].attribute [2] = -6;
360 enemy[e].attribute [0] = 0;
361 break;
362 case ENEMY_ORBITER1:
363 enemy[e].attribute [2] = 12;
364 if (grand(2) == 0)
365 enemy[e].attribute [2] = -12;
366 break;
367 case ENEMY_ORBITER2:
368 enemy[e].attribute [2] = 12;
369 if (grand(2) == 0)
370 enemy[e].attribute [2] = -12;
371 enemy[e].attribute [4] = 14 + grand(4);
372 if (grand(2) == 0)
373 enemy[e].attribute [4] = -14 - grand(4);
374 break;
375 case ENEMY_ORBITER3:
376 enemy[e].attribute [2] = 11;
377 if (grand(2) == 0)
378 enemy[e].attribute [2] = -11;
379 break;
380 case ENEMY_ZAPPER1:
381 case ENEMY_OVERZAPPER:
382 enemy[e].attribute [0] = 0;
383 enemy[e].attribute [5] = 6;
384 if (grand(2) == 0)
385 enemy[e].attribute [5] = -6;
386 enemy[e].attribute [8] = enemy[e].x;
387 enemy[e].attribute [9] = enemy[e].y;
388 break;
389 case ENEMY_SHADOW1:
390 case ENEMY_SHADOW2:
391 enemy[e].attribute [0] = 35;
392 enemy[e].burst_fire = 3;
393 break;
394 /* case ENEMY_DRIFTER2:
395 enemy[e].attribute [ATTRIB_DRIFTER_RANGE] = 125000;
396 enemy[e].attribute [ATTRIB_DRIFTER_ACCEL] = 185;
397 enemy[e].angle = grand(ANGLE_FULL);
398 enemy[e].attribute [ATTRIB_DRIFTER_X_DEST] = grand(arena.max_x - 300000) + 150000;
399 enemy[e].attribute [ATTRIB_DRIFTER_Y_DEST] = grand(arena.max_y - 300000) + 150000;
400 break;*/
401 }
402
403
404 switch(eclass[type].ai_type)
405 {
406 case AI_DRIFTER:
407 enemy[e].angle = grand(ANGLE_FULL);
408 enemy[e].x_dest = grand(arena.max_x - enemy[e].edge_radius * 4) + enemy[e].edge_radius * 2;
409 enemy[e].y_dest = grand(arena.max_y - enemy[e].edge_radius * 4) + enemy[e].edge_radius * 2;
410 break;
411 case AI_AUTO:
412 enemy[e].angle = grand(ANGLE_FULL);
413 break;
414 case AI_PERIODIC_STINGER:
415 break;
416 case AI_BOMBER:
417 case AI_FIGHTER:
418 case AI_LEAPER:
419 case AI_CRUISER:
420 enemy[e].angle = grand(ANGLE_FULL);
421 enemy[e].x_dest = grand(arena.max_x - enemy[e].edge_radius * 4) + enemy[e].edge_radius * 2;
422 enemy[e].y_dest = grand(arena.max_y - enemy[e].edge_radius * 4) + enemy[e].edge_radius * 2;
423 break;
424 }
425
426 if (eclass[type].turrets > 0)
427 {
428 for (i = 0; i < eclass[type].turrets; i ++)
429 {
430 switch(type)
431 {
432 case ENEMY_HEAD1:
433 if (i == 0 || grand(10) == 0)
434 j = ENEMY_HEAD1_EYE1 + grand(3);
435 break;
436 case ENEMY_DEFENDER1:
437 if (i == 0)// || grand(10) == 0)
438 j = ENEMY_DEFENDER1_TURRET1 + grand(3);
439 break;
440 case ENEMY_DEFENDER2:
441 if (i == 0)// || grand(10) == 0)
442 j = ENEMY_DEFENDER2_TURRET1 + grand(3);
443 break;
444 case ENEMY_DEFENDER3:
445 case ENEMY_BEAMER2:
446 case ENEMY_OVERZAPPER:
447 case ENEMY_OVERTRIANGLER:
448 case ENEMY_BEAMER1:
449 if (i == 0 || grand(20) == 0)
450 j = ENEMY_DEFENDER3_TURRET1 + grand(6);
451 break;
452 case ENEMY_OVERDISRUPTER: // 2 different turrets
453 j = ENEMY_DEFENDER3_TURRET1 + grand(6);
454 break;
455 case ENEMY_BRACKET4:
456 j = ENEMY_BRACKET4_TURRET;
457 break;
458 case ENEMY_CRUISER1:
459 j = ENEMY_CRUISER1_TURRET;
460 break;
461 case ENEMY_CRUISER2:
462 j = ENEMY_CRUISER2_TURRET;
463 break;
464 case ENEMY_CRUISER3:
465 j = ENEMY_CRUISER3_TURRET;
466 break;
467 case ENEMY_CRUISER4:
468 j = ENEMY_CRUISER4_TURRET;
469 break;
470 case ENEMY_MINER3:
471 j = ENEMY_MINER3_TURRET;
472 break;
473 case ENEMY_BOSS1_1:
474 case ENEMY_BOSS1_2:
475 case ENEMY_BOSS1_3:
476 if (i == 0 || grand(10) == 0)
477 j = ENEMY_BOSS1_TURRET1 + grand(3);
478 break;
479 case ENEMY_BOSS2:
480 case ENEMY_BOSS2_2:
481 case ENEMY_BOSS2_3:
482 if (i == 0 || grand(12) == 0)
483 j = ENEMY_BOSS2_TURRET1 + grand(4);
484 // j = ENEMY_BOSS2_TURRET1;
485 // j = ENEMY_BOSS2_TURRET1 + grand(4);
486 break;
487 case ENEMY_BOSS3_1:
488 case ENEMY_BOSS3_2:
489 case ENEMY_BOSS3_3:
490 if (i == 0 || grand(12) == 0)
491 j = ENEMY_BOSS3_TURRET1 + grand(3);
492 break;
493 }
494 enemy[e].turret [i] = create_turret(j, e, i);
495 }
496 }
497 /* else
498 {
499 for (i = 0; i < MAX_TURRETS; i ++)
500 {
501 enemy[e].turret [i] = -1;
502 }
503 }*/
504
505 return e;
506
507 }
508
509 int create_turret(int type, int base, int turret_counter)
510 {
511
512 int e = 0;
513
514 for (e = 0; e < NO_ENEMIES; e++)
515 {
516 if (e == NO_ENEMIES - 1) return -1;
517 if (enemy[e].type == ENEMY_NONE) break;
518 }
519
520 enemy[e].type = type;
521 enemy[e].x = enemy[base].x;
522 enemy[e].y = enemy[base].y;
523 enemy[e].x_speed = enemy[base].x_speed;
524 enemy[e].y_speed = enemy[base].y_speed;
525 enemy[e].angle = enemy[base].angle;
526 enemy[e].moving_angle = enemy[base].angle;
527 enemy[e].armour = eclass[type].max_armour;
528 enemy[e].hurt_pulse = 0;
529 enemy[e].radius = eclass[type].radius;
530 enemy[e].edge_radius = eclass[type].edge_radius;
531 // enemy[e].shield = eclass[type].max_shield;
532 enemy[e].mass = eclass[type].mass;
533 enemy[e].drag_amount = 0;
534 enemy[e].subtype = 0;
535 enemy[e].attacking = ATTACK_NONE;
536 enemy[e].counter = 256 - counter + turret_counter * 10;
537 enemy[e].recycle = enemy[e].counter % 50 + 50;
538 // enemy[e].attacking = 0;
539 enemy[e].just_collided = 0;
540 enemy[e].carrying_pickup = 0;
541 enemy[e].target = TARGET_NO;
542 enemy[e].burst_fire = 0;
543 enemy[e].slew_dir = 0;
544 enemy[e].next_impulse = 0;//eclass[type].impulse_delay;
545 enemy[e].ta_time_left = 99999;
546
547 int i;
548
549 for (i = 0; i < MAX_TURRETS; i ++)
550 {
551 enemy[e].turret [i] = -1;
552 }
553
554 // int i;
555
556 // for (i = 0; i < NO_ENEMY_ATTRIBUTES; i ++)
557 // {
558 // enemy[e].attribute [i] = eclass[type].default_attributes [i];
559 // }
560
561 enemy[e].colours [0] = eclass[type].colour1;
562 enemy[e].colours [1] = eclass[type].colour2;
563
564 enemy[e].turret_main = base;
565 enemy[e].turret_index = turret_counter;
566 // enemy[e].attribute [ATTRIB_FI4TURRET_MAIN] = base;
567 // enemy[e].attribute [ATTRIB_FI4TURRET_MAIN_DEAD] = 0;
568
569 enemy[e].hurt_pulse_colour1 = enemy[e].colours [0];
570 enemy[e].hurt_pulse_colour2 = enemy[e].colours [1];
571
572 enemy[e].angle = grand(ANGLE_FULL);
573
574 switch(enemy[e].type)
575 {
576 case ENEMY_BOSS2_TURRET2:
577 case ENEMY_BOSS3_TURRET2:
578 enemy[e].burst_fire = 6 + grand(6);
579 break;
580 case ENEMY_MINER3_TURRET:
581 enemy[e].burst_fire = 3 + grand(3);
582 break;
583 case ENEMY_CRUISER1_TURRET:
584 enemy[e].burst_fire = 3 + grand(3);
585 break;
586 case ENEMY_DEFENDER1_TURRET3:
587 case ENEMY_DEFENDER3_TURRET5:
588 enemy[e].attribute [0] = 6;
589 if (grand(2) == 0)
590 enemy[e].attribute [0] = -6;
591 break;
592 case ENEMY_DEFENDER3_TURRET1:
593 enemy[e].attribute [2] = 6;
594 if ((base + turret_counter) % 2 == 0)
595 enemy[e].attribute [2] = -6;
596 enemy[e].attribute [0] = 0;
597 break;
598 case ENEMY_DEFENDER3_TURRET2:
599 enemy[e].attribute [2] = 7;
600 if (grand(2) == 0)
601 enemy[e].attribute [2] = -7;
602 break;
603 case ENEMY_DEFENDER3_TURRET3:
604 enemy[e].attribute [2] = 5;
605 if (grand(2) == 0)
606 enemy[e].attribute [2] = -5;
607 break;
608
609 }
610
611 return e;
612
613 }
614
615
616
617 void run_enemies(void)
618 {
619
620 int e;
621
622 for (e = 0; e < NO_ENEMIES; e++)
623 {
624 if (enemy[e].type != ENEMY_NONE)
625 manage_enemy(e);
626 }
627
628 }
629
630
631 void manage_enemy(int e)
632 {
633
634 if (enemy[e].hurt_pulse > 0)
635 enemy[e].hurt_pulse --;
636 if (enemy[e].recycle > 0)
637 enemy[e].recycle --;
638 if (enemy[e].just_collided > 0)
639 enemy[e].just_collided --;
640
641 enemy[e].counter ++; // assumed: this wraps at 256 (unsigned char)
642
643 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
644 {
645 enemy[e].ta_time_left --;
646 if (enemy[e].ta_time_left <= 0)
647 {
648 enemy_vanish(e);
649 return;
650 }
651 }
652
653 // char need_move_enemy = 1;
654
655 switch(eclass[enemy[e].type].ai_type)
656 {
657 case AI_DRIFTER:
658 move_drifter_ai(e);
659 break;
660 case AI_AUTO:
661 move_auto_ai(e);
662 break;
663 case AI_STINGER:
664 move_stinger_ai(e);
665 break;
666 case AI_PERIODIC_STINGER:
667 move_periodic_stinger_ai(e);
668 break;
669 case AI_TURRET:
670 move_turret_ai(e);
671 break;
672 case AI_FIGHTER:
673 move_fighter_ai(e);
674 break;
675 case AI_LEAPER:
676 move_leaper_ai(e);
677 break;
678 case AI_BOMBER:
679 move_bomber_ai(e);
680 break;
681 case AI_CRUISER:
682 move_cruiser_ai(e);
683 break;
684 }
685
686 if (enemy[e].type != ENEMY_NONE)// && need_move_enemy == 1)
687 move_enemy(e);
688
689 }
690
691
692 int hurt_enemy(int e, int hurty, int source, char pulse)
693 {
694
695 if (e <= -1 || enemy[e].type <= ENEMY_NONE || enemy[e].type >= NO_ENEMY_TYPES)
696 {
697 #ifdef SANITY_CHECK
698 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
699 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "hurt e %i, s %i", e, source);
700 if (e != -1)
701 textprintf_centre_ex(screen, small_font, 400, 260, COLOUR_WHITE, -1, "hurt t %i", enemy[e].type);
702 rest(2000);
703 #endif
704 return -1;
705 // exit(type);
706 }
707
708 if (enemy[e].type == ENEMY_NONE)
709 return 0;
710
711 if (hurty >= enemy[e].armour)
712 {
713 // switch(enemy[e].type)
714 // {
715 // }
716 register_destroyed(e, source);
717 enemy_explodes(e, 1);
718 // can also happen in enemy_vanish, just below
719 return 0;
720 }
721
722 enemy[e].armour -= hurty;
723 if (pulse > enemy[e].hurt_pulse)
724 enemy[e].hurt_pulse = pulse;
725
726 if (enemy[e].type == ENEMY_CURVE2 || enemy[e].type == ENEMY_CURVE3)
727 {
728 if (enemy[e].armour <= 500)
729 enemy[e].attribute [0] = source;
730 }
731
732 return 1;
733
734 }
735
736
737
738 void enemy_vanish(int e)
739 {
740
741
742 #ifdef SANITY_CHECK
743 if (e <= -1 || enemy[e].type <= ENEMY_NONE || enemy[e].type >= NO_ENEMY_TYPES)
744 {
745 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
746 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "vanish e %i", e);
747 if (e != -1)
748 textprintf_centre_ex(screen, small_font, 400, 260, COLOUR_WHITE, -1, "vanish t %i", enemy[e].type);
749 rest(2000);
750 return;
751 // exit(type);
752 }
753 #endif
754
755 int passing_colours [5] = {GC_GREEN8, GC_GREEN8, GC_GREEN8, GC_GREEN8, GC_GREEN8};
756 int passing_colours2 [5] = {TRANS_DGREEN, TRANS_LGREEN, TRANS_YELLOW, TRANS_YELLOW, TRANS_YELLOW};
757
758 int cloud_size = 200 + crandom(250) + eclass[enemy[e].type].radius / 10;
759
760 switch(enemy[e].type)
761 {
762 default:
763 passing_colours2 [0] = TRANS_DRED;
764 passing_colours2 [1] = TRANS_LRED;
765 passing_colours2 [2] = TRANS_YELLOW;
766 passing_colours [0] = GC_RED8;
767 break;
768 }
769
770
771 create_cloud(CLOUD_SHRINKING_CIRCLE,
772 enemy[e].x,
773 enemy[e].y,
774 0, 0,
775 0, 0,
776 500, -150 - eclass[enemy[e].type].radius / 100, 10, 0, 0, 0, passing_colours);
777
778 place_explosion(enemy[e].x, enemy[e].y, 0,0,
779 cloud_size, passing_colours2);
780
781 register_destroyed(e, -2);
782 enemy_explodes(e, 0);
783 // see also hurt_enemy.
784
785 // if (standard_sound == 1)
786 // enemy_soundf(e, ESOUND_WARP_IN, 800 + grand(800) - eclass[enemy[e].type].mass);
787 enemy_soundf(e, NWAV_PHASE, enemy_sound_pitch(enemy[e].type) + grand(250)); //800 + grand(200) - enemy_pitch(enemy[k].type));
788
789 }
790
791
792
793 void enemy_explodes(int e, int bang)
794 {
795 int j, k, l;
796 // int xs = enemy[e].x_speed;
797 // int ys = enemy[e].y_speed;
798
799 if (enemy[e].type == ENEMY_NONE)
800 return;
801
802 if (eclass[enemy[e].type].role == ROLE_TURRET
803 && (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
804 && enemy[e].ta_time_left == TA_TURRET_TIMEOUT)
805 bang = 0;
806
807 int passing_colours [5];
808 int bullet_colours [4];
809 // int special [10];
810
811 // int standard_sound = NWAV_BURST;
812
813 if (bang)
814 {
815 shake_all_screens(enemy[e].mass / 50);
816
817 switch(enemy[e].type)
818 {
819 case ENEMY_SPIKEY1:
820 case ENEMY_SPIKEY2:
821 case ENEMY_SPIKEY3:
822 case ENEMY_SPIKEY4:
823 case ENEMY_SPIKEY5:
824 case ENEMY_SPINNER1:
825 case ENEMY_SPINNER2:
826 case ENEMY_SPINNER3:
827 case ENEMY_SPINNER4:
828 case ENEMY_SPINNER5:
829 case ENEMY_BLATTER1:
830 case ENEMY_BLATTER2:
831 case ENEMY_BLATTER3:
832 case ENEMY_BLATTER4:
833 case ENEMY_BLATTER5:
834 case ENEMY_GUARDIAN1:
835 case ENEMY_GUARDIAN2:
836 case ENEMY_GUARDIAN3:
837 // case ENEMY_GUARDIAN4:
838 case ENEMY_GUARDIAN5:
839 case ENEMY_CIRCLER1:
840 case ENEMY_OVERTRIANGLER_TURRET:
841 passing_colours[0] = TRANS_DRED;
842 passing_colours[1] = TRANS_LRED;
843 passing_colours[2] = TRANS_YELLOW;
844 place_explosion(enemy[e].x, enemy[e].y, 0,0,
845 1200 + crandom(250), passing_colours);
846 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
847 4, passing_colours);
848 break;
849 case ENEMY_GUARDIAN4:
850 passing_colours[0] = TRANS_ORANGE;
851 passing_colours[1] = TRANS_YELLOW;
852 passing_colours[2] = TRANS_WHITE;
853 place_explosion(enemy[e].x, enemy[e].y, 0,0,
854 1600 + crandom(250), passing_colours);
855 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
856 4, passing_colours);
857 break;
858 case ENEMY_WAVER1:
859 passing_colours[0] = TRANS_DGREEN;
860 passing_colours[1] = TRANS_LGREEN;
861 passing_colours[2] = TRANS_YELLOW;
862 place_explosion(enemy[e].x, enemy[e].y, 0,0,
863 1400 + crandom(250), passing_colours);
864 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
865 4, passing_colours);
866 for (j = 0; j < 4; j ++)
867 {
868 place_explosion(enemy[e].x + xpart(enemy[e].attribute [0] + j * ANGLE_QUARTER, 43 * GRAIN),
869 enemy[e].y + ypart(enemy[e].attribute [0] + j * ANGLE_QUARTER, 43 * GRAIN), 0,0,
870 1200 + crandom(250), passing_colours);
871 }
872 break;
873 case ENEMY_WAVER2:
874 passing_colours[0] = TRANS_DGREEN;
875 passing_colours[1] = TRANS_LGREEN;
876 passing_colours[2] = TRANS_YELLOW;
877 place_explosion(enemy[e].x, enemy[e].y, 0,0,
878 1400 + crandom(250), passing_colours);
879 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
880 4, passing_colours);
881 for (j = 0; j < 3; j ++)
882 {
883 place_explosion(enemy[e].x + xpart(enemy[e].attribute [0] + j * ANGLE_FULL / 3, 51 * GRAIN),
884 enemy[e].y + ypart(enemy[e].attribute [0] + j * ANGLE_FULL / 3, 51 * GRAIN), 0,0,
885 1200 + crandom(250), passing_colours);
886 }
887 break;
888 case ENEMY_DEAD_TRI1:
889 case ENEMY_DEAD_TRI2:
890 case ENEMY_DEAD_TRI3:
891 passing_colours [0] = enemy[e].attribute [2];
892 passing_colours [1] = enemy[e].attribute [3];
893 passing_colours [2] = enemy[e].attribute [4];
894 place_explosion(enemy[e].x, enemy[e].y, 0,0,
895 1800 + crandom(250), passing_colours);
896 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
897 4, passing_colours);
898 break;
899 case ENEMY_TRIANGLER1:
900 passing_colours [0] = TRANS_DRED;
901 passing_colours [1] = TRANS_LRED;
902 passing_colours [2] = TRANS_YELLOW;
903 /* create_cloud(CLOUD_TRI1,
904 enemy[e].x, enemy[e].y, 0, 0, enemy[e].x_speed, enemy[e].y_speed,
905 20 + grand(50), 1, 0, 0, 25000, 0, passing_colours);*/
906 enemy[e].attribute [0] = 20 + grand(80);
907 enemy[e].attribute [1] = 25000;
908 enemy[e].attribute [2] = TRANS_DRED;
909 enemy[e].attribute [3] = TRANS_LRED;
910 enemy[e].attribute [4] = TRANS_YELLOW;
911 create_enemy(ENEMY_DEAD_TRI1, 0, enemy[e].x, enemy[e].y,
912 enemy[e].x_speed, enemy[e].y_speed, 0, 0, enemy[e].attribute,
913 TARGET_NO);
914 place_explosion(enemy[e].x, enemy[e].y, 0,0,
915 900 + crandom(250), passing_colours);
916 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
917 4, passing_colours);
918 break;
919 case ENEMY_TRIANGLER2:
920 passing_colours[0] = TRANS_DBLUE;
921 passing_colours[1] = TRANS_LBLUE;
922 passing_colours[2] = TRANS_WHITE;
923 /* create_cloud(CLOUD_TRI2,
924 enemy[e].x, enemy[e].y, 0, 0, enemy[e].x_speed, enemy[e].y_speed,
925 20 + grand(50), 1, 0, 0, 20000, 0, passing_colours);*/
926 enemy[e].attribute [0] = 20 + grand(80);
927 enemy[e].attribute [1] = 20000;
928 enemy[e].attribute [2] = TRANS_DBLUE;
929 enemy[e].attribute [3] = TRANS_LBLUE;
930 enemy[e].attribute [4] = TRANS_WHITE;
931 create_enemy(ENEMY_DEAD_TRI2, 0, enemy[e].x, enemy[e].y,
932 enemy[e].x_speed, enemy[e].y_speed, 0, 0, enemy[e].attribute,
933 TARGET_NO);
934 place_explosion(enemy[e].x, enemy[e].y, 0,0,
935 1000 + crandom(250), passing_colours);
936 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
937 4, passing_colours);
938 break;
939 case ENEMY_TRIANGLER3:
940 passing_colours[0] = TRANS_ORANGE;
941 passing_colours[1] = TRANS_YELLOW;
942 passing_colours[2] = TRANS_WHITE;
943 /* create_cloud(CLOUD_TRI3,
944 enemy[e].x, enemy[e].y, 0, 0, enemy[e].x_speed, enemy[e].y_speed,
945 20 + grand(50), 1, 0, 0, 18000, 0, passing_colours);*/
946 enemy[e].attribute [0] = 20 + grand(80);
947 enemy[e].attribute [1] = 18000;
948 enemy[e].attribute [2] = TRANS_ORANGE;
949 enemy[e].attribute [3] = TRANS_YELLOW;
950 enemy[e].attribute [4] = TRANS_WHITE;
951 create_enemy(ENEMY_DEAD_TRI3, 0, enemy[e].x, enemy[e].y,
952 enemy[e].x_speed, enemy[e].y_speed, 0, 0, enemy[e].attribute,
953 TARGET_NO);
954 place_explosion(enemy[e].x, enemy[e].y, 0,0,
955 900 + crandom(250), passing_colours);
956 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
957 4, passing_colours);
958 break;
959 case ENEMY_CURVE1:
960 case ENEMY_CURVE2:
961 case ENEMY_MULTI1:
962 case ENEMY_MULTI2:
963 case ENEMY_MULTI3:
964 case ENEMY_ORBITER1:
965 case ENEMY_ORBITER2:
966 case ENEMY_ORBITER3:
967 passing_colours[0] = TRANS_DRED;
968 passing_colours[1] = TRANS_LRED;
969 passing_colours[2] = TRANS_YELLOW;
970 place_explosion(enemy[e].x, enemy[e].y, 0,0,
971 1400 + crandom(250), passing_colours);
972 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
973 4, passing_colours);
974 break;
975 case ENEMY_DISRUPTER1:
976 case ENEMY_DISRUPTER3:
977 passing_colours[0] = TRANS_LRED;
978 passing_colours[1] = TRANS_ORANGE;
979 passing_colours[2] = TRANS_YELLOW;
980 place_explosion(enemy[e].x, enemy[e].y, 0,0,
981 1200 + crandom(250), passing_colours);
982 place_explosion(enemy[e].x - 30000, enemy[e].y, 0,0,
983 300 + crandom(150), passing_colours);
984 place_explosion(enemy[e].x + 30000, enemy[e].y, 0,0,
985 300 + crandom(150), passing_colours);
986 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
987 4, passing_colours);
988 break;
989 case ENEMY_DISRUPTER2:
990 passing_colours[0] = TRANS_LRED;
991 passing_colours[1] = TRANS_ORANGE;
992 passing_colours[2] = TRANS_YELLOW;
993 place_explosion(enemy[e].x, enemy[e].y, 0,0,
994 1200 + crandom(250), passing_colours);
995 place_explosion(enemy[e].x, enemy[e].y - 30000, 0,0,
996 300 + crandom(150), passing_colours);
997 place_explosion(enemy[e].x, enemy[e].y + 30000, 0,0,
998 300 + crandom(150), passing_colours);
999 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
1000 4, passing_colours);
1001 break;
1002 case ENEMY_ATTRACTOR:
1003 passing_colours[0] = TRANS_DRED;
1004 passing_colours[1] = TRANS_LRED;
1005 passing_colours[2] = TRANS_YELLOW;
1006 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1007 1400 + crandom(250), passing_colours);
1008 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
1009 4, passing_colours);
1010 simple_shockwave(TRANS_PURPLE, enemy[e].x, enemy[e].y, 0, 0, 500 + crandom(50), 15);
1011 blast(enemy[e].x, enemy[e].y, 60000, 0, 5000, OWNER_ENEMY);
1012 line_blast(enemy[e].x, enemy[e].y, BULLET_ATTRACTOR_LINE, e);
1013 break;
1014
1015 case ENEMY_PULSER1:
1016 case ENEMY_PULSER2:
1017 passing_colours[0] = TRANS_DRED;
1018 passing_colours[1] = TRANS_LRED;
1019 passing_colours[2] = TRANS_YELLOW;
1020 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1021 1200 + crandom(250), passing_colours);
1022 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1023 4, passing_colours);
1024 k = (enemy[e].attribute [0] / 4) % 8;
1025 l = CLOUD_PULSER1_V;
1026 if (enemy[e].type == ENEMY_PULSER2)
1027 l = CLOUD_PULSER2_V;
1028 if (k >= 4)
1029 k = 8 - k;
1030 for (j = 0; j < 2; j ++)
1031 {
1032 create_cloud(l,
1033 enemy[e].x - (11 + (enemy[e].type == ENEMY_PULSER2)) * GRAIN,
1034 // enemy[e].x,
1035 enemy[e].y + (k + (k * (j == 0) * -1) - (35 * j) + (8 * j == 0)) * GRAIN,
1036 enemy[e].x, enemy[e].y,
1037 enemy[e].x_speed,
1038 enemy[e].y_speed - (1000 + grand(2000)) * (j - (j == 0)),
1039 3 + grand(10), 1,
1040 0, 0,
1041 j, 0, passing_colours);
1042 }
1043 l = CLOUD_PULSER1_H;
1044 if (enemy[e].type == ENEMY_PULSER2)
1045 l = CLOUD_PULSER2_H;
1046 for (j = 0; j < 2; j ++)
1047 {
1048 create_cloud(l,
1049 enemy[e].x + (k + (k * (j == 0) * -1) - (35 * j) + (8 * j == 0)) * GRAIN,
1050 enemy[e].y - (11 + (enemy[e].type == ENEMY_PULSER2)) * GRAIN,
1051 // enemy[e].y,
1052 enemy[e].x, enemy[e].y,
1053 enemy[e].x_speed - (1000 + grand(2000)) * (j - (j == 0)),
1054 enemy[e].y_speed,
1055 3 + grand(10), 1,
1056 0, 0,
1057 j, 0, passing_colours);
1058 }
1059 break;
1060 case ENEMY_FORKER1:
1061 case ENEMY_FORKER2:
1062 passing_colours[0] = TRANS_DBLUE;
1063 passing_colours[1] = TRANS_PURPLE;
1064 passing_colours[2] = TRANS_ORANGE;
1065 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1066 1200 + crandom(250), passing_colours);
1067 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1068 4, passing_colours);
1069 break;
1070 case ENEMY_SHADOW1:
1071 case ENEMY_SHADOW2:
1072 case ENEMY_CURVE3:
1073 passing_colours[0] = TRANS_DBLUE;
1074 passing_colours[1] = TRANS_LBLUE;
1075 passing_colours[2] = TRANS_WHITE;
1076 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1077 2000 + crandom(250), passing_colours);
1078 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1079 4, passing_colours);
1080 break;
1081 case ENEMY_SHIELDER1:
1082 passing_colours[0] = TRANS_DBLUE;
1083 passing_colours[1] = TRANS_PURPLE;
1084 passing_colours[2] = TRANS_ORANGE;
1085 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1086 1200 + crandom(250), passing_colours);
1087 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1088 4, passing_colours);
1089 for (j = 0; j < 3; j ++)
1090 {
1091 create_cloud(CLOUD_SQUAREY, enemy[e].x, enemy[e].y,
1092 enemy[e].x - xpart(enemy[e].attribute [1], 30),
1093 enemy[e].y - ypart(enemy[e].attribute [1], 30),
1094 enemy[e].x_speed + xpart(enemy[e].attribute [1] + ((j * ANGLE_FULL / 3) & 1023), 500 + grand(3000)), //grand(5000) - grand(5000),
1095 enemy[e].y_speed + ypart(enemy[e].attribute [1] + ((j * ANGLE_FULL / 3) & 1023), 500 + grand(3000)),//grand(5000) - grand(5000),
1096 3 + grand(50), 1,
1097 0, enemy[e].attribute [1] + ((j * ANGLE_FULL / 3) & 1023),
1098 enemy[e].attribute [2], 0, passing_colours);
1099 }
1100 break;
1101 case ENEMY_ZAPPER1:
1102 passing_colours[0] = TRANS_DBLUE;
1103 passing_colours[1] = TRANS_LBLUE;
1104 passing_colours[2] = TRANS_WHITE;
1105 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1106 1200 + crandom(250), passing_colours);
1107 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1108 4, passing_colours);
1109 passing_colours[0] = TRANS_DRED;
1110 passing_colours[1] = TRANS_LRED;
1111 passing_colours[2] = TRANS_YELLOW;
1112 for (j = 0; j < 8; j ++)
1113 {
1114 k = enemy[e].x + xpart(enemy[e].attribute [4] + (j * ANGLE_1_EIGHTH), 35 * GRAIN);
1115 l = enemy[e].y + ypart(enemy[e].attribute [4] + (j * ANGLE_1_EIGHTH), 35 * GRAIN);
1116 place_explosion(k, l, 0,0,
1117 100 + crandom(50), passing_colours);
1118 place_burstlet_burst(k, l, 0, 0, 2 + grand(2), 2, 6, 1200, 1800,
1119 4, passing_colours);
1120 }
1121 break;
1122 case ENEMY_OVERZAPPER:
1123 passing_colours[0] = TRANS_DBLUE;
1124 passing_colours[1] = TRANS_LBLUE;
1125 passing_colours[2] = TRANS_WHITE;
1126 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1127 3000 + crandom(250), passing_colours);
1128 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2300, 2800,
1129 4, passing_colours);
1130 passing_colours[0] = TRANS_DRED;
1131 passing_colours[1] = TRANS_LRED;
1132 passing_colours[2] = TRANS_YELLOW;
1133 for (j = 0; j < 8; j ++)
1134 {
1135 k = enemy[e].x + xpart(enemy[e].attribute [4] + (j * ANGLE_1_EIGHTH), 60 * GRAIN);
1136 l = enemy[e].y + ypart(enemy[e].attribute [4] + (j * ANGLE_1_EIGHTH), 60 * GRAIN);
1137 place_explosion(k, l, 0,0,
1138 250 + crandom(50), passing_colours);
1139 place_burstlet_burst(k, l, 0, 0, 2 + grand(2), 2, 6, 2000, 2500,
1140 4, passing_colours);
1141 }
1142 break;
1143 case ENEMY_PUFFER1:
1144 passing_colours[0] = TRANS_DRED;
1145 passing_colours[1] = TRANS_LRED;
1146 passing_colours[2] = TRANS_YELLOW;
1147 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1148 1000 + crandom(250), passing_colours);
1149 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1150 4, passing_colours);
1151 passing_colours[0] = TRANS_DGREEN;
1152 passing_colours[1] = TRANS_LGREEN;
1153 passing_colours[2] = TRANS_YELLOW;
1154 puffer_bang(enemy[e].x, enemy[e].y, enemy[e].attribute [2], 3, 17, passing_colours);
1155 /* place_explosion_no_light(enemy[e].x + xpart((enemy[e].attribute [2] * 8) % 1024, 16 * GRAIN),
1156 enemy[e].y + ypart((enemy[e].attribute [2] * 8) % 1024, 16 * GRAIN),
1157 0 + xpart((enemy[e].attribute [2] * 8) % 1024, GRAIN / 2),
1158 0 + ypart((enemy[e].attribute [2] * 8) % 1024, GRAIN / 2),
1159 300 + crandom(250), passing_colours);
1160 place_explosion_no_light(enemy[e].x + xpart(((enemy[e].attribute [2] + 85) * 8) % 1024, 16 * GRAIN),
1161 enemy[e].y + ypart(((enemy[e].attribute [2] + 85) * 8) % 1024, 16 * GRAIN),
1162 0 + xpart(((enemy[e].attribute [2] + 85) * 8) % 1024, GRAIN / 2),
1163 0 + ypart(((enemy[e].attribute [2] + 85) * 8) % 1024, GRAIN / 2),
1164 300 + crandom(250), passing_colours);
1165 place_explosion_no_light(enemy[e].x + xpart(((enemy[e].attribute [2] - 85) * 8) % 1024, 16 * GRAIN),
1166 enemy[e].y + ypart(((enemy[e].attribute [2] - 85) * 8) % 1024, 16 * GRAIN),
1167 0 + xpart(((enemy[e].attribute [2] - 85) * 8) % 1024, GRAIN / 2),
1168 0 + ypart(((enemy[e].attribute [2] - 85) * 8) % 1024, GRAIN / 2),
1169 300 + crandom(250), passing_colours);*/
1170 // place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1171 // 4, passing_colours);
1172 break;
1173 case ENEMY_PUFFER3:
1174 passing_colours[0] = TRANS_DGREEN;
1175 passing_colours[1] = TRANS_LGREEN;
1176 passing_colours[2] = TRANS_YELLOW;
1177 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1178 1100 + crandom(250), passing_colours);
1179 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1180 4, passing_colours);
1181 passing_colours[0] = TRANS_DRED;
1182 passing_colours[1] = TRANS_LRED;
1183 passing_colours[2] = TRANS_YELLOW;
1184 puffer_bang(enemy[e].x, enemy[e].y, enemy[e].attribute [2], 3, 19, passing_colours);
1185 break;
1186 case ENEMY_PUFFER4:
1187 passing_colours[0] = TRANS_DRED;
1188 passing_colours[1] = TRANS_LRED;
1189 passing_colours[2] = TRANS_YELLOW;
1190 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1191 1600 + crandom(250), passing_colours);
1192 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1193 4, passing_colours);
1194 passing_colours[0] = TRANS_DBLUE;
1195 passing_colours[1] = TRANS_LBLUE;
1196 passing_colours[2] = TRANS_WHITE;
1197 puffer_bang(enemy[e].x, enemy[e].y, enemy[e].attribute [2], 5, 25, passing_colours);
1198 break;
1199 case ENEMY_PUFFER2:
1200 passing_colours[0] = TRANS_DRED;
1201 passing_colours[1] = TRANS_LRED;
1202 passing_colours[2] = TRANS_YELLOW;
1203 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1204 1300 + crandom(250), passing_colours);
1205 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1206 4, passing_colours);
1207 passing_colours[0] = TRANS_ORANGE;
1208 passing_colours[1] = TRANS_YELLOW;
1209 passing_colours[2] = TRANS_WHITE;
1210 puffer_bang(enemy[e].x, enemy[e].y, enemy[e].attribute [2], 4, 20, passing_colours);
1211 /* place_explosion_no_light(enemy[e].x + xpart((enemy[e].attribute [2] * 8) % 1024, 18 * GRAIN),
1212 enemy[e].y + ypart((enemy[e].attribute [2] * 8) % 1024, 18 * GRAIN),
1213 0 + xpart((enemy[e].attribute [2] * 8) % 1024, GRAIN / 2),
1214 0 + ypart((enemy[e].attribute [2] * 8) % 1024, GRAIN / 2),
1215 300 + crandom(250), passing_colours);
1216 place_explosion_no_light(enemy[e].x + xpart(((enemy[e].attribute [2] + 32) * 8) % 1024, 18 * GRAIN),
1217 enemy[e].y + ypart(((enemy[e].attribute [2] + 64) * 8) % 1024, 18 * GRAIN),
1218 0 + xpart(((enemy[e].attribute [2] + 64) * 8) % 1024, GRAIN / 2),
1219 0 + ypart(((enemy[e].attribute [2] + 64) * 8) % 1024, GRAIN / 2),
1220 300 + crandom(250), passing_colours);
1221 place_explosion_no_light(enemy[e].x + xpart(((enemy[e].attribute [2] - 32) * 18) % 1024, 8 * GRAIN),
1222 enemy[e].y + ypart(((enemy[e].attribute [2] - 64) * 18) % 1024, 8 * GRAIN),
1223 0 + xpart(((enemy[e].attribute [2] - 64) * 8) % 1024, GRAIN / 2),
1224 0 + ypart(((enemy[e].attribute [2] - 64) * 8) % 1024, GRAIN / 2),
1225 300 + crandom(250), passing_colours);
1226 place_explosion_no_light(enemy[e].x + xpart(((enemy[e].attribute [2] + 64) * 8) % 1024, 18 * GRAIN),
1227 enemy[e].y + ypart(((enemy[e].attribute [2] + 128) * 8) % 1024, 18 * GRAIN),
1228 0 + xpart(((enemy[e].attribute [2] + 128) * 8) % 1024, GRAIN / 2),
1229 0 + ypart(((enemy[e].attribute [2] + 128) * 8) % 1024, GRAIN / 2),
1230 300 + crandom(250), passing_colours);
1231 // place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1232 // 4, passing_colours);*/
1233 break;
1234 case ENEMY_BRACKET1:
1235 case ENEMY_BRACKET2:
1236 passing_colours[0] = TRANS_LRED;
1237 passing_colours[1] = TRANS_ORANGE;
1238 passing_colours[2] = TRANS_YELLOW;
1239 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1240 1000 + crandom(250), passing_colours);
1241 passing_colours[0] = TRANS_DGREEN;
1242 passing_colours[1] = TRANS_LGREEN;
1243 passing_colours[2] = TRANS_YELLOW;
1244 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1245 4, passing_colours);
1246 break;
1247 case ENEMY_BRACKET3:
1248 case ENEMY_BRACKET4:
1249 case ENEMY_BRACKET5:
1250 passing_colours[0] = TRANS_LRED;
1251 passing_colours[1] = TRANS_ORANGE;
1252 passing_colours[2] = TRANS_YELLOW;
1253 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1254 1900 + crandom(250), passing_colours);
1255 passing_colours[0] = TRANS_DGREEN;
1256 passing_colours[1] = TRANS_LGREEN;
1257 passing_colours[2] = TRANS_YELLOW;
1258 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1259 4, passing_colours);
1260 break;
1261 case ENEMY_WORMER1:
1262 case ENEMY_WORMER2:
1263 case ENEMY_WORMER3:
1264 case ENEMY_WORMER4:
1265 passing_colours[0] = TRANS_DRED;
1266 passing_colours[1] = TRANS_LRED;
1267 passing_colours[2] = TRANS_YELLOW;
1268 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1269 1600 + crandom(250), passing_colours);
1270 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2500, 2500,
1271 4, passing_colours);
1272 break;
1273 case ENEMY_HEAD1:
1274 passing_colours[0] = TRANS_DRED;
1275 passing_colours[1] = TRANS_ORANGE;
1276 passing_colours[2] = TRANS_YELLOW;
1277 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1278 1800 + crandom(250), passing_colours);
1279 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1280 4, passing_colours);
1281 break;
1282 case ENEMY_OVERTRIANGLER:
1283 passing_colours[0] = TRANS_DRED;
1284 passing_colours[1] = TRANS_ORANGE;
1285 passing_colours[2] = TRANS_YELLOW;
1286 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1287 3500 + crandom(250), passing_colours);
1288 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1289 4, passing_colours);
1290 create_cloud(CLOUD_SPAWNER,
1291 enemy[e].x, enemy[e].y,
1292 0, 0, 0, 0, //enemy[e].x_speed + , enemy[e].y_speed,
1293 60,2,0, 0, 900, 4, passing_colours);
1294 break;
1295 case ENEMY_DEFENDER1:
1296 case ENEMY_DEFENDER3:
1297 case ENEMY_BEAMER1:
1298 case ENEMY_BEAMER2:
1299 passing_colours[0] = TRANS_DRED;
1300 passing_colours[1] = TRANS_ORANGE;
1301 passing_colours[2] = TRANS_YELLOW;
1302 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1303 3500 + crandom(250), passing_colours);
1304 place_explosion(enemy[e].x - 60000, enemy[e].y, 0,0,
1305 2500 + crandom(250), passing_colours);
1306 place_explosion(enemy[e].x + 60000, enemy[e].y, 0,0,
1307 2500 + crandom(250), passing_colours);
1308 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1309 4, passing_colours);
1310 create_cloud(CLOUD_SPAWNER,
1311 enemy[e].x + 40 * GRAIN, enemy[e].y,
1312 0, 0, 2 * GRAIN, 0, //enemy[e].x_speed + , enemy[e].y_speed,
1313 50,2,0, 0, 600, 4, passing_colours);
1314 create_cloud(CLOUD_SPAWNER,
1315 enemy[e].x - 40 * GRAIN, enemy[e].y,
1316 0, 0, -2 * GRAIN, 0, //enemy[e].x_speed + , enemy[e].y_speed,
1317 50,2,0, 0, 600, 4, passing_colours);
1318 break;
1319 case ENEMY_DEFENDER2:
1320 passing_colours[0] = TRANS_ORANGE;
1321 passing_colours[1] = TRANS_YELLOW;
1322 passing_colours[2] = TRANS_WHITE;
1323 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1324 3500 + crandom(250), passing_colours);
1325 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1326 4, passing_colours);
1327 create_cloud(CLOUD_SPAWNER,
1328 enemy[e].x, enemy[e].y + 40 * GRAIN,
1329 0, 0, 0, 2 * GRAIN, //enemy[e].x_speed + , enemy[e].y_speed,
1330 50,2,0, 0, 600, 4, passing_colours);
1331 create_cloud(CLOUD_SPAWNER,
1332 enemy[e].x, enemy[e].y - 40 * GRAIN,
1333 0, 0, 0, -2 * GRAIN, //enemy[e].x_speed + , enemy[e].y_speed,
1334 50,2,0, 0, 600, 4, passing_colours);
1335 break;
1336 case ENEMY_OVERDISRUPTER:
1337 passing_colours[0] = TRANS_DGREY;
1338 passing_colours[1] = TRANS_DBLUE;
1339 passing_colours[2] = TRANS_LBLUE;
1340 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1341 3500 + crandom(250), passing_colours);
1342 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1343 4, passing_colours);
1344 create_cloud(CLOUD_SPAWNER,
1345 enemy[e].x, enemy[e].y + 40 * GRAIN,
1346 0, 0, 0, 2 * GRAIN, //enemy[e].x_speed + , enemy[e].y_speed,
1347 50,2,0, 0, 600, 4, passing_colours);
1348 create_cloud(CLOUD_SPAWNER,
1349 enemy[e].x, enemy[e].y - 40 * GRAIN,
1350 0, 0, 0, -2 * GRAIN, //enemy[e].x_speed + , enemy[e].y_speed,
1351 50,2,0, 0, 600, 4, passing_colours);
1352 break;
1353 case ENEMY_OVERBLATTER:
1354 case ENEMY_OVERBLATTER2:
1355 passing_colours[0] = TRANS_DRED;
1356 passing_colours[1] = TRANS_ORANGE;
1357 passing_colours[2] = TRANS_YELLOW;
1358 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1359 4000 + crandom(550), passing_colours);
1360 // place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 8000, 8500,
1361 // 4, passing_colours);
1362 create_cloud(CLOUD_SPAWNER,
1363 enemy[e].x, enemy[e].y,
1364 0, 0, 0, 0,
1365 60,2,0, 0, 1000, 4, passing_colours);
1366 /* for (j = 0; j < 4; j ++)
1367 {
1368 place_explosion_no_light(enemy[e].x + xpart((enemy[e].attribute [2] + k * ANGLE_QUARTER) % ANGLE_FULL, 50 * GRAIN),
1369 enemy[e].y + ypart((enemy[e].attribute [2] + k * ANGLE_QUARTER) % ANGLE_FULL, 50 * GRAIN),
1370 0, 0, 400 + crandom(250), passing_colours);
1371 }*/
1372 // draw_blatter(bmp, x, y, 5, 50, enemy[dr].attribute [2], 15, GC_YELLOW2, GC_YELLOW5);
1373 break;
1374 case ENEMY_OVERSPINNER:
1375 case ENEMY_UNDERSPIKEY:
1376 case ENEMY_UNDERSPIKEY2:
1377 case ENEMY_UNDERSPIKEY3:
1378 case ENEMY_OVERSPIKEY2:
1379 passing_colours[0] = TRANS_DRED;
1380 passing_colours[1] = TRANS_ORANGE;
1381 passing_colours[2] = TRANS_YELLOW;
1382 case ENEMY_OVERSPIKEY:
1383 if (enemy[e].type == ENEMY_OVERSPIKEY)
1384 {
1385 passing_colours[0] = TRANS_DGREEN;
1386 passing_colours[1] = TRANS_LGREEN;
1387 passing_colours[2] = TRANS_YELLOW;
1388 }
1389 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1390 5500 + crandom(550), passing_colours);
1391 // place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 8000, 8500,
1392 // 4, passing_colours);
1393 create_cloud(CLOUD_SPAWNER,
1394 enemy[e].x, enemy[e].y,
1395 0, 0, 0, 0,
1396 120,2,0, 0, 1300, 4, passing_colours);
1397 break;
1398 case ENEMY_BOSS1_1:
1399 case ENEMY_BOSS1_2:
1400 case ENEMY_BOSS1_3:
1401 passing_colours[0] = TRANS_DRED;
1402 passing_colours[1] = TRANS_ORANGE;
1403 passing_colours[2] = TRANS_YELLOW;
1404 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1405 8500 + crandom(550), passing_colours);
1406 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 8000, 8500,
1407 4, passing_colours);
1408 create_cloud(CLOUD_SPAWNER,
1409 enemy[e].x, enemy[e].y,
1410 0, 0, 0, 0,
1411 360,2,0, 0, 1600, 4, passing_colours);
1412 break;
1413 case ENEMY_BOSS2:
1414 case ENEMY_BOSS2_2:
1415 case ENEMY_BOSS2_3:
1416 passing_colours[0] = TRANS_DGREEN;
1417 passing_colours[1] = TRANS_LGREEN;
1418 passing_colours[2] = TRANS_YELLOW;
1419 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1420 8500 + crandom(550), passing_colours);
1421 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 8000, 8500,
1422 4, passing_colours);
1423 create_cloud(CLOUD_SPAWNER,
1424 enemy[e].x, enemy[e].y,
1425 0, 0, 0, 0,
1426 360,2,0, 0, 1600, 4, passing_colours);
1427 break;
1428 case ENEMY_BOSS3_1:
1429 case ENEMY_BOSS3_2:
1430 case ENEMY_BOSS3_3:
1431 passing_colours[0] = TRANS_DBLUE;
1432 passing_colours[1] = TRANS_LBLUE;
1433 passing_colours[2] = TRANS_WHITE;
1434 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1435 8500 + crandom(550), passing_colours);
1436 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 8000, 8500,
1437 4, passing_colours);
1438 create_cloud(CLOUD_SPAWNER,
1439 enemy[e].x, enemy[e].y,
1440 0, 0, 0, 0,
1441 360,2,0, 0, 1600, 4, passing_colours);
1442 break;
1443 case ENEMY_HEAD1_EYE1:
1444 case ENEMY_HEAD1_EYE2:
1445 case ENEMY_HEAD1_EYE3:
1446 case ENEMY_BOSS1_TURRET1:
1447 case ENEMY_BOSS1_TURRET2:
1448 case ENEMY_BOSS1_TURRET3:
1449 case ENEMY_BRACKET4_TURRET:
1450 case ENEMY_CRUISER1_TURRET:
1451 case ENEMY_CRUISER2_TURRET:
1452 case ENEMY_CRUISER3_TURRET:
1453 case ENEMY_CRUISER4_TURRET:
1454 case ENEMY_MINER3_TURRET:
1455 passing_colours[0] = TRANS_DRED;
1456 passing_colours[1] = TRANS_LRED;
1457 passing_colours[2] = TRANS_YELLOW;
1458 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1459 400 + crandom(250), passing_colours);
1460 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1461 4, passing_colours);
1462 break;
1463 case ENEMY_DEFENDER1_TURRET1:
1464 case ENEMY_DEFENDER1_TURRET2:
1465 case ENEMY_DEFENDER1_TURRET3:
1466 case ENEMY_DEFENDER2_TURRET1:
1467 case ENEMY_DEFENDER2_TURRET2:
1468 case ENEMY_DEFENDER2_TURRET3:
1469 case ENEMY_DEFENDER3_TURRET1:
1470 case ENEMY_DEFENDER3_TURRET2:
1471 case ENEMY_DEFENDER3_TURRET3:
1472 case ENEMY_DEFENDER3_TURRET4:
1473 case ENEMY_DEFENDER3_TURRET5:
1474 case ENEMY_DEFENDER3_TURRET6:
1475 case ENEMY_BOSS2_TURRET1:
1476 case ENEMY_BOSS2_TURRET2:
1477 case ENEMY_BOSS2_TURRET3:
1478 case ENEMY_BOSS2_TURRET4:
1479 passing_colours[0] = TRANS_DGREEN;
1480 passing_colours[1] = TRANS_LGREEN;
1481 passing_colours[2] = TRANS_YELLOW;
1482 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1483 500 + crandom(250), passing_colours);
1484 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1485 4, passing_colours);
1486 break;
1487 case ENEMY_BOSS3_TURRET1:
1488 case ENEMY_BOSS3_TURRET2:
1489 case ENEMY_BOSS3_TURRET3:
1490 passing_colours[0] = TRANS_DBLUE;
1491 passing_colours[1] = TRANS_LBLUE;
1492 passing_colours[2] = TRANS_WHITE;
1493 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1494 700 + crandom(250), passing_colours);
1495 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1496 4, passing_colours);
1497 break;
1498 case ENEMY_LEAPER1:
1499 case ENEMY_LEAPER2:
1500 passing_colours[0] = TRANS_DRED;
1501 passing_colours[1] = TRANS_LRED;
1502 passing_colours[2] = TRANS_YELLOW;
1503 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1504 800 + crandom(250), passing_colours);
1505 place_burstlet_burst(enemy[e].x, enemy[e].y, 0, 0, 4 + grand(3), 2, 6, 2000, 2500,
1506 4, passing_colours);
1507 break;
1508 case ENEMY_FIGHTER1:
1509 case ENEMY_FIGHTER2:
1510 case ENEMY_FIGHTER3:
1511 case ENEMY_FIGHTER5:
1512 case ENEMY_MESSENGER:
1513 passing_colours[0] = TRANS_DRED;
1514 passing_colours[1] = TRANS_LRED;
1515 passing_colours[2] = TRANS_YELLOW;
1516 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1517 400 + crandom(250), passing_colours);
1518 place_burstlet_burst(enemy[e].x, enemy[e].y, enemy[e].x_speed, enemy[e].y_speed, 4 + grand(3), 2, 6, 2000, 2500,
1519 4, passing_colours);
1520 break;
1521 case ENEMY_FIGHTER4:
1522 passing_colours[0] = TRANS_DGREEN;
1523 passing_colours[1] = TRANS_LGREEN;
1524 passing_colours[2] = TRANS_YELLOW;
1525 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1526 400 + crandom(250), passing_colours);
1527 place_burstlet_burst(enemy[e].x, enemy[e].y, enemy[e].x_speed, enemy[e].y_speed, 4 + grand(3), 2, 6, 2000, 2500,
1528 4, passing_colours);
1529 break;
1530 case ENEMY_BOMBER1:
1531 case ENEMY_BOMBER2:
1532 case ENEMY_BOMBER3:
1533 passing_colours[0] = TRANS_DRED;
1534 passing_colours[1] = TRANS_LRED;
1535 passing_colours[2] = TRANS_YELLOW;
1536 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1537 400 + crandom(250), passing_colours);
1538 place_burstlet_burst(enemy[e].x, enemy[e].y, enemy[e].x_speed, enemy[e].y_speed, 4 + grand(3), 2, 6, 2000, 2500,
1539 4, passing_colours);
1540 create_cloud(CLOUD_SPAWNER,
1541 enemy[e].x, enemy[e].y,
1542 0, 0, enemy[e].x_speed, enemy[e].y_speed,
1543 50 + grand(15) * 2,2,0, 0, 250, 4, passing_colours);
1544 // remember: tickrate must be a factor of 16, and timeout must be even
1545 break;
1546 case ENEMY_CRUISER1:
1547 case ENEMY_CRUISER2:
1548 case ENEMY_CRUISER3:
1549 case ENEMY_CRUISER4:
1550 passing_colours[0] = TRANS_DRED;
1551 passing_colours[1] = TRANS_LRED;
1552 passing_colours[2] = TRANS_YELLOW;
1553 place_explosion(enemy[e].x, enemy[e].y, 0,0,
1554 1400 + crandom(250), passing_colours);
1555 place_burstlet_burst(enemy[e].x, enemy[e].y, enemy[e].x_speed, enemy[e].y_speed, 4 + grand(3), 2, 6, 2000, 2500,
1556 4, passing_colours);
1557 create_cloud(CLOUD_SPAWNER,
1558 enemy[e].x, enemy[e].y,
1559 0, 0, enemy[e].x_speed, enemy[e].y_speed,
1560 50 + grand(15) * 2,2,0, 0, 250, 4, passing_colours);
1561 // remember: tickrate must be a factor of 16, and timeout must be even
1562 break;
1563 case ENEMY_MINER1:
1564 case ENEMY_MINEFIELDER1:
1565 case ENEMY_MINER2:
1566 case ENEMY_MINER3:
1567 k = 5 + grand(7);
1568 l = BULLET_MINE1 + (enemy[e].type == ENEMY_MINER2) + (2 * (enemy[e].type == ENEMY_MINER3));
1569 for (j = 0; j < k; j ++)
1570 {
1571 create_bullet(l, enemy[e].x, enemy[e].y,
1572 enemy[e].x_speed + grand(12001) - 6000, enemy[e].y_speed + grand(12001) - 6000,
1573 OWNER_ENEMY, 1, 300 + grand(100), 20, 0,
1574 0, MINE_SIZE, bullet_colours, 1,0,0,0,0,0);
1575 }
1576 passing_colours[0] = TRANS_DRED;
1577 passing_colours[1] = TRANS_LRED;
1578 passing_colours[2] = TRANS_YELLOW;
1579 place_explosion(enemy[e].x, enemy[e].y, 0, 0,
1580 1200 + crandom(250), passing_colours);
1581 break;
1582 case ENEMY_BLOATER1:
1583 k = 4 + grand(3);
1584 bullet_colours [0] = TRANS_LGREEN;
1585 bullet_colours [1] = TRANS_LGREEN;
1586 bullet_colours [2] = TRANS_LGREEN;
1587 bullet_colours [3] = TRANS_DGREEN;
1588 for (j = 0; j < k; j ++)
1589 {
1590 create_bullet(BULLET_SEEKER2, enemy[e].x + grand(12001) - 6000, enemy[e].y + grand(12001) - 6000,
1591 enemy[e].x_speed + grand(6001) - 3000, enemy[e].y_speed + grand(6001) - 3000,
1592 OWNER_ENEMY, DAM_LARGE_GREEN_SEEKER, 220 + grand(50), 120, grand(ANGLE_FULL),
1593 0, 0, bullet_colours, 1,closest_target(enemy[e].x, enemy[e].y),38,48,180,7001);
1594 }
1595 passing_colours[0] = TRANS_DGREEN;
1596 passing_colours[1] = TRANS_LGREEN;
1597 passing_colours[2] = TRANS_YELLOW;
1598 place_explosion(enemy[e].x, enemy[e].y, 0, 0,
1599 1200 + crandom(250), passing_colours);
1600 break;
1601 case ENEMY_BLOATER2:
1602 k = 4 + grand(3);
1603 bullet_colours [0] = TRANS_YELLOW;
1604 bullet_colours [1] = TRANS_ORANGE;
1605 bullet_colours [2] = TRANS_LRED;
1606 bullet_colours [3] = TRANS_DRED;
1607 for (j = 0; j < k; j ++)
1608 {
1609 create_bullet(BULLET_SEEKER2, enemy[e].x + grand(12001) - 6000, enemy[e].y + grand(12001) - 6000,
1610 enemy[e].x_speed + grand(12001) - 6000, enemy[e].y_speed + grand(12001) - 6000,
1611 OWNER_ENEMY, DAM_LARGE_GREEN_SEEKER + 50, 220 + grand(50), 120, j * ANGLE_FULL / 6, //and(ANGLE_FULL),
1612 0, 0, bullet_colours, 1,closest_target(enemy[e].x, enemy[e].y),48,48,200,7001);
1613 }
1614 passing_colours[0] = TRANS_DGREEN;
1615 passing_colours[1] = TRANS_LGREEN;
1616 passing_colours[2] = TRANS_YELLOW;
1617 place_explosion(enemy[e].x, enemy[e].y, 0, 0,
1618 1200 + crandom(250), passing_colours);
1619 /* k = 5 + grand(4);
1620 bullet_colours [0] = COLOUR_RED5;
1621 bullet_colours [1] = COLOUR_ORANGE6;
1622 bullet_colours [2] = COLOUR_YELLOW6;
1623 bullet_colours [3] = COLOUR_YELLOW8;
1624 for (j = 0; j < k; j ++)
1625 {
1626 create_bullet(BULLET_EVIL_WORM, enemy[e].x + grand(12001) - 6000, enemy[e].y + grand(12001) - 6000,
1627 // enemy[e].x_speed + grand(6001) - 3000, enemy[e].y_speed + grand(6001) - 3000,
1628 enemy[e].x_speed, enemy[e].y_speed,
1629 OWNER_ENEMY, DAM_WORMS2, 180, 80, grand(ANGLE_FULL),
1630 0, 0, bullet_colours, 1,600,60,closest_target(enemy[e].x, enemy[e].y),8,0);
1631 }
1632 passing_colours[0] = TRANS_DGREEN;
1633 passing_colours[1] = TRANS_LGREEN;
1634 passing_colours[2] = TRANS_YELLOW;
1635 place_explosion(enemy[e].x, enemy[e].y, 0, 0,
1636 1200 + crandom(250), passing_colours);*/
1637 break;
1638
1639 }
1640 // if (standard_sound != ESOUND_NONE)
1641 if (eclass[enemy[e].type].role != ROLE_BOSS)
1642 enemy_soundf(e, NWAV_BANG, enemy_sound_pitch(enemy[e].type));
1643 else
1644 enemy_soundf(e, NWAV_BIGBANG, enemy_sound_pitch(enemy[e].type));
1645
1646 check_enemy_pickup_drop(e);
1647
1648 } // end if bang
1649
1650 destroy_enemy(e);
1651
1652 }
1653
1654 void destroy_enemy(int e)
1655 {
1656 enemy[e].type = ENEMY_NONE;
1657 // calculate_ambience();
1658 }
1659
1660 void puffer_bang(int x, int y, int rot, int number, int dist, int colours [5])
1661 {
1662
1663 int i;
1664 int each_rot = ANGLE_FULL / number;
1665
1666 dist *= GRAIN;
1667
1668 for (i = 0; i < number; i ++)
1669 {
1670 place_explosion_no_light(x + xpart(((rot * 8) + i * each_rot) % 1024, dist),
1671 y + ypart(((rot * 8) + i * each_rot) % 1024, dist),
1672 0 + xpart(((rot * 8) + i * each_rot) % 1024, GRAIN / 2),
1673 0 + ypart(((rot * 8) + i * each_rot) % 1024, GRAIN / 2),
1674 300 + crandom(250), colours);
1675 }
1676
1677 }
1678
1679
1680
1681 int enemy_sound_pitch(int ec)
1682 {
1683 switch (eclass[ec].pitch)
1684 {
1685 case PITCH_GUARDIAN:
1686 return 900 + grand(200);
1687 case PITCH_FIGHTER:
1688 return 1800 + grand(300);
1689 case PITCH_SMALL_SPINNER:
1690 return 1400 + grand(200);
1691 case PITCH_LARGE_SPINNER:
1692 return 700 + grand(100);
1693 case PITCH_HEAVY_SPINNER:
1694 return 600 + grand(100);
1695 case PITCH_BOSS1:
1696 return 400 + grand(50);
1697 case PITCH_BOSS2:
1698 return 350 + grand(50);
1699 case PITCH_BOSS3:
1700 return 320 + grand(50);
1701 case PITCH_MINIBOSS1:
1702 return 600 + grand(50);
1703 case PITCH_MINIBOSS2:
1704 return 500 + grand(50);
1705 case PITCH_TURRET1:
1706 return 1600 + grand(200);
1707 case PITCH_TURRET2:
1708 return 1400 + grand(200);
1709 case PITCH_MEDIUM:
1710 return 1300 + grand(100);
1711 case PITCH_HEAVY:
1712 return 700 + grand(80);
1713 }
1714 return 1000;
1715 }
1716
1717
1718
1719
1720 void check_enemy_pickup_drop(int e)
1721 {
1722
1723 int create_symbol = 0;
1724 int create_other = 0;
1725 int symbol_count_needed;
1726
1727 if (eclass[enemy[e].type].role == ROLE_TURRET)
1728 return;
1729
1730 /*
1731
1732 if (enemy[e].carrying_pickup != PICKUP_NONE)
1733 {
1734 if (enemy[e].carrying_pickup >= PICKUP_SQUARE
1735 && enemy[e].carrying_pickup <= PICKUP_TRIANGLE)
1736 create_pickup(enemy[e].carrying_pickup, -1, enemy[e].x, enemy[e].y, SYMBOL_TIMEOUT);
1737 else
1738 create_pickup(enemy[e].carrying_pickup, -1, enemy[e].x, enemy[e].y, 333);
1739 }
1740 */
1741 // if (enemy[e].target == TARGET_PRIMARY)
1742 {
1743 // if (arena.targets_left_total <= arena.total_targets / 4
1744 // && arena.targets_left_total + 1 > arena.total_targets / 4)
1745 // create_pickup(PICKUP_SQUARE + grand(3), -1, enemy[e].x, enemy[e].y, SYMBOL_TIMEOUT);
1746 // create_pickup(PICKUP_REPAIR, 0, enemy[e].x, enemy[e].y, 330);
1747 // char get_second = enemy[e].target == TARGET_PRIMARY && arena.targets_left_total == 7;
1748
1749 if (arena.total_targets > 1)
1750 {
1751 // if ((enemy[e].target == TARGET_PRIMARY && arena.targets_left_total % (arena.total_targets / 3) == 1)
1752 if (game.type == GAME_DUEL
1753 || game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
1754 {
1755 if (enemy[e].target == TARGET_PRIMARY || game.type == GAME_DUEL)
1756 {
1757 game.ta_symbol_count ++;
1758 if (eclass[enemy[e].type].role == ROLE_MINIBOSS)
1759 game.ta_symbol_count += 2;
1760 if (eclass[enemy[e].type].role == ROLE_BOSS)
1761 game.ta_symbol_count += 3;
1762 symbol_count_needed = 9;
1763 if (game.symbols_given <= 25)
1764 symbol_count_needed = 5;
1765 if (game.symbols_given <= 15)
1766 symbol_count_needed = 3;
1767 if (game.type == GAME_TIME_ATTACK_COOP || game.type == GAME_DUEL)
1768 {
1769 symbol_count_needed --;
1770 if (game.symbols_given >= 50)
1771 symbol_count_needed = 99;
1772 }
1773 else
1774 {
1775 if (game.symbols_given >= 30)
1776 symbol_count_needed = 99;
1777 }
1778 if (game.ta_symbol_count >= symbol_count_needed && grand(4) != 0)
1779 // don't worry, you'll still get the symbol, just a little later.
1780 {
1781 create_symbol = 1;
1782 game.symbols_given ++;
1783 game.ta_symbol_count -= symbol_count_needed;
1784 }
1785 }
1786
1787 }
1788 else
1789 {
1790 // if ((enemy[e].target == TARGET_PRIMARY && arena.symbol_list [arena.symbol_index - 1] == 1))
1791 if ((enemy[e].target == TARGET_PRIMARY && arena.symbol_list [arena.symbol_index] == 1))
1792 create_symbol = 1;
1793 if (enemy[e].target == TARGET_PRIMARY)
1794 arena.symbol_index ++;
1795 }
1796
1797
1798
1799 if (create_symbol)
1800 create_pickup(PICKUP_PRESYMBOL, PICKUP_SQUARE + grand(3), enemy[e].x, enemy[e].y, SYMBOL_TIMEOUT);
1801 else
1802 {
1803 if (grand(10) < eclass[enemy[e].type].generous)
1804 create_other = 1;
1805 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
1806 {
1807 if (grand(15) < eclass[enemy[e].type].generous)
1808 create_other = 1; // increased chance, to make up for lack of between-level repair
1809 }
1810 }
1811
1812 if (create_other)
1813 {
1814 switch(grand(3))
1815 {
1816 case 0: create_pickup(PICKUP_REPAIR, 0, enemy[e].x, enemy[e].y, 330); break;
1817 case 1:
1818 case 2:
1819 switch(grand(13))
1820 {
1821 case 0: create_pickup(PICKUP_PRESECONDARY, SECOND_FURIOUS_ORB, enemy[e].x, enemy[e].y, 100); break;
1822 case 1: create_pickup(PICKUP_PRESECONDARY, SECOND_MANIFOLD_ORB, enemy[e].x, enemy[e].y, 100); break;
1823 case 2: create_pickup(PICKUP_PRESECONDARY, SECOND_PANIC_EELS, enemy[e].x, enemy[e].y, 100); break;
1824 case 3: //if (grand(2) == 0)
1825 create_pickup(PICKUP_PRESECONDARY, SECOND_WORMS_SORROW, enemy[e].x, enemy[e].y, 100); break;
1826 case 4: create_pickup(PICKUP_PRESECONDARY, SECOND_WORMS_AGONY, enemy[e].x, enemy[e].y, 100); break;
1827 case 5: create_pickup(PICKUP_PRESECONDARY, SECOND_EYE_DESOLATION, enemy[e].x, enemy[e].y, 100); break;
1828 case 6: create_pickup(PICKUP_PRESECONDARY, SECOND_FROZEN_TEETH, enemy[e].x, enemy[e].y, 100); break;
1829 //default:
1830 case 7: create_pickup(PICKUP_PRESECONDARY, SECOND_FROZEN_STARS, enemy[e].x, enemy[e].y, 100); break;
1831 case 8: create_pickup(PICKUP_PRESECONDARY, SECOND_BURNING_EYE, enemy[e].x, enemy[e].y, 100); break;
1832 case 9: create_pickup(PICKUP_PRESECONDARY, SECOND_TOXIC_SUN, enemy[e].x, enemy[e].y, 100); break;
1833 case 10: create_pickup(PICKUP_PRESECONDARY, SECOND_FLOWER, enemy[e].x, enemy[e].y, 100); break;
1834 case 11: create_pickup(PICKUP_PRESECONDARY, SECOND_SPORES, enemy[e].x, enemy[e].y, 100); break;
1835 case 12: create_pickup(PICKUP_PRESECONDARY, SECOND_CLAWS, enemy[e].x, enemy[e].y, 100); break;
1836 }
1837 break;
1838 }
1839 }
1840 }
1841 /* else
1842 {
1843 switch(grand(6))
1844 {
1845 case 0: create_pickup(PICKUP_PRESECONDARY, SECOND_FURIOUS_ORB, enemy[e].x, enemy[e].y, 100); break;
1846 case 1: create_pickup(PICKUP_PRESECONDARY, SECOND_MANIFOLD_ORB, enemy[e].x, enemy[e].y, 100); break;
1847 case 2: create_pickup(PICKUP_PRESECONDARY, SECOND_PANIC_EELS, enemy[e].x, enemy[e].y, 100); break;
1848 case 3: create_pickup(PICKUP_PRESECONDARY, SECOND_WORMS_SORROW, enemy[e].x, enemy[e].y, 100); break;
1849 case 4: create_pickup(PICKUP_PRESECONDARY, SECOND_WORMS_AGONY, enemy[e].x, enemy[e].y, 100); break;
1850 default: create_pickup(PICKUP_PRESECONDARY, SECOND_BURNING_EYE, enemy[e].x, enemy[e].y, 100); break;
1851 }
1852 }*/
1853 }
1854 /* else
1855 {
1856 if (grand(10) < eclass[enemy[e].type].generous)
1857 {
1858 switch(grand(2))
1859 {
1860 case 0: create_pickup(PICKUP_REPAIR, 0, enemy[e].x, enemy[e].y, 330); break;
1861 case 1:
1862 switch(grand(6))
1863 {
1864 case 0: create_pickup(PICKUP_PRESECONDARY, SECOND_FURIOUS_ORB, enemy[e].x, enemy[e].y, 100); break;
1865 case 1: create_pickup(PICKUP_PRESECONDARY, SECOND_MANIFOLD_ORB, enemy[e].x, enemy[e].y, 100); break;
1866 case 2: create_pickup(PICKUP_PRESECONDARY, SECOND_PANIC_EELS, enemy[e].x, enemy[e].y, 100); break;
1867 case 3: create_pickup(PICKUP_PRESECONDARY, SECOND_WORMS_SORROW, enemy[e].x, enemy[e].y, 100); break;
1868 case 4: create_pickup(PICKUP_PRESECONDARY, SECOND_WORMS_AGONY, enemy[e].x, enemy[e].y, 100); break;
1869 default: create_pickup(PICKUP_PRESECONDARY, SECOND_BURNING_EYE, enemy[e].x, enemy[e].y, 100); break;
1870 }
1871 break;
1872 }
1873 }
1874 }
1875 */
1876 }
1877
1878
1879 // REMEMBER this can be called from collision detection in actor.c
1880 int move_enemy(int e)
1881 {
1882
1883 if (enemy[e].x_speed == 0 && enemy[e].y_speed == 0) return 1;
1884
1885 if (enemy[e].x + enemy[e].x_speed <= enemy[e].radius + 2000 // test - not edge_radius
1886 || enemy[e].x + enemy[e].x_speed >= arena.max_x - enemy[e].radius - 2000)
1887 {
1888 enemy[e].x_speed *= -1;
1889 }
1890 if (enemy[e].y + enemy[e].y_speed <= enemy[e].radius + 2000
1891 || enemy[e].y + enemy[e].y_speed >= arena.max_y - enemy[e].radius - 2000)
1892 {
1893 enemy[e].y_speed *= -1;
1894 }
1895
1896
1897 //enemy[mbull].x2 += bullet[mbull].x_speed;
1898 //bullet[mbull].y2 += bullet[mbull].y_speed;
1899
1900 enemy[e].x += enemy[e].x_speed;
1901 enemy[e].y += enemy[e].y_speed;
1902
1903 // if an enemy is subject to drag, this happens in its own function
1904
1905 return 1;
1906
1907
1908 }
1909
1910 /*
1911 int move_torper(int e)
1912 {
1913
1914 if (grand(15) == 0)
1915 {
1916 accelerate_enemy(e, grand(ANGLE_FULL + 1), 1000 + grand(1000));
1917 }
1918
1919 drag_enemy(e, 0.03);
1920
1921 if (enemy[e].counter % 16 == 0)
1922 {
1923 enemy[e].attacking = nearby_target(500000, enemy[e].x, enemy[e].y);
1924 }
1925
1926 if (enemy[e].attacking != ATTACK_NONE)
1927 {
1928 enemy[e].angle = track_target(e, enemy[e].attacking, 32);
1929 if (enemy[e].recycle == 0)
1930 standard_attack(e, enemy[e].angle);
1931 }
1932
1933 return 1;
1934
1935 }
1936
1937 */
1938
1939
1940 /*
1941 int move_stinger2(int e)
1942 {
1943 if (grand(10) == 0)
1944 {
1945 accelerate_enemy(e, grand(ANGLE_FULL + 1), 800 + grand(800));
1946 }
1947
1948 drag_enemy(e, 0.02);
1949
1950 if (enemy[e].counter % 16 == 0)
1951 {
1952 enemy[e].attacking = nearby_target(400000, enemy[e].x, enemy[e].y);
1953 }
1954
1955 if (enemy[e].attacking != ATTACK_NONE)
1956 {
1957 if (enemy[e].burst_fire > 0)
1958 enemy[e].angle = track_target(e, enemy[e].attacking, 16);
1959 else
1960 enemy[e].angle = track_target(e, enemy[e].attacking, 32);
1961 if (enemy[e].recycle == 0)
1962 standard_attack(e, enemy[e].angle);
1963 }
1964
1965 return 1;
1966
1967 }
1968 */
1969
1970
1971 /*
1972 int move_swerver3(int e)
1973 {
1974
1975 // int tangle = enemy[e].attribute [ATTRIB_SWERVER3_ANGLE2];
1976 int tangle = enemy[e].attribute [ATTRIB_SWERVER_ANGLE];
1977
1978 if (enemy[e].counter % 32 == 0)
1979 enemy[e].attacking = closest_target(enemy[e].x, enemy[e].y);
1980
1981 enemy[e].angle = turn_towards_angle(enemy[e].angle,
1982 enemy[e].attribute [ATTRIB_SWERVER_ANGLE],
1983 enemy[e].attribute [ATTRIB_SWERVER_TURN]);
1984
1985 if (enemy[e].attacking != ATTACK_NONE
1986 && (tangle / 100 == enemy[e].angle / 100
1987 || tangle / 100 == (enemy[e].angle + ANGLE_HALF) / 100
1988 || tangle / 100 == (enemy[e].angle - ANGLE_HALF) / 100))
1989 {
1990 enemy[e].attribute [ATTRIB_SWERVER_ANGLE] = grand(ANGLE_FULL + 1);
1991 if (grand(2) == 0)
1992 {
1993 enemy[e].attribute [ATTRIB_SWERVER_ANGLE] =
1994 radians_to_angle(atan2((actor[enemy[e].attacking].y - enemy[e].y), (actor[enemy[e].attacking].x - enemy[e].x)));
1995 if (enemy[e].attribute [ATTRIB_SWERVER_ANGLE] < 0)
1996 enemy[e].attribute [ATTRIB_SWERVER_ANGLE] += ANGLE_FULL;
1997 if (enemy[e].attribute [ATTRIB_SWERVER_ANGLE] > ANGLE_FULL)
1998 enemy[e].attribute [ATTRIB_SWERVER_ANGLE] -= ANGLE_FULL;
1999 }
2000 }
2001
2002 enemy[e].x_speed = cos(angle_to_radians(enemy[e].angle)) * enemy[e].attribute [ATTRIB_SWERVER_SPEED];
2003 enemy[e].y_speed = sin(angle_to_radians(enemy[e].angle)) * enemy[e].attribute [ATTRIB_SWERVER_SPEED];
2004
2005 if (enemy[e].x + enemy[e].x_speed <= enemy[e].edge_radius
2006 || enemy[e].x + enemy[e].x_speed >= arena.max_x - enemy[e].edge_radius - 4000)
2007 {
2008 enemy[e].x_speed *= -1;
2009 enemy[e].angle += ANGLE_HALF;
2010 enemy[e].attribute [ATTRIB_SWERVER_ANGLE] = grand(ANGLE_FULL + 1);
2011 }
2012 if (enemy[e].y + enemy[e].y_speed <= enemy[e].edge_radius
2013 || enemy[e].y + enemy[e].y_speed >= arena.max_y - enemy[e].edge_radius - 5000)
2014 {
2015 enemy[e].y_speed *= -1;
2016 enemy[e].angle -= ANGLE_HALF;
2017 enemy[e].attribute [ATTRIB_SWERVER_ANGLE] = grand(ANGLE_FULL + 1);
2018 }
2019
2020 enemy[e].x += enemy[e].x_speed;
2021 enemy[e].y += enemy[e].y_speed;
2022
2023 if (enemy[e].counter % 16 == 0)
2024 {
2025 enemy[e].attribute [ATTRIB_SWERVER3_ATTACKING] = nearby_target(400000, enemy[e].x, enemy[e].y);
2026 // exit(2);
2027 }
2028
2029 // if (enemy[e].attacking != ATTACK_NONE)
2030 if (enemy[e].attribute [ATTRIB_SWERVER3_ATTACKING] != ATTACK_NONE)
2031 {
2032 // exit(3);
2033 // enemy[e].attribute [ATTRIB_SWERVER3_ANGLE2] = track_target(e, enemy[e].attribute [ATTRIB_SWERVER3_ATTACKING], 16);
2034 enemy[e].attribute [ATTRIB_SWERVER3_ANGLE2] = turn_towards_xy(enemy[e].x, enemy[e].y, actor[enemy[e].attribute [ATTRIB_SWERVER3_ATTACKING]].x, actor[enemy[e].attribute [ATTRIB_SWERVER3_ATTACKING]].y, enemy[e].attribute [ATTRIB_SWERVER3_ANGLE2], 16);
2035 if (enemy[e].recycle == 0)
2036 standard_attack(e, enemy[e].attribute [ATTRIB_SWERVER3_ANGLE2]);
2037 }
2038
2039 return 1;
2040
2041 }
2042 */
2043 /*
2044 int move_bouncers(int e)
2045 {
2046
2047 if (enemy[e].type == ENEMY_BOUNCER4)
2048 {
2049 if (enemy[e].counter % 16 == 0)
2050 {
2051 enemy[e].attacking = nearby_target(500000, enemy[e].x, enemy[e].y);
2052 }
2053
2054 if (enemy[e].attacking != ATTACK_NONE)
2055 {
2056 enemy[e].attribute [ATTRIB_BOUNCER_ANGLE2] = turn_towards_xy(enemy[e].x, enemy[e].y, actor[enemy[e].attacking].x, actor[enemy[e].attacking].y, enemy[e].attribute [ATTRIB_BOUNCER_ANGLE2], 4);
2057 if (enemy[e].recycle == 0)
2058 standard_attack(e, enemy[e].attribute [ATTRIB_BOUNCER_ANGLE2]);
2059 }
2060 return 1;
2061 }
2062
2063 enemy[e].angle += enemy[e].attribute [ATTRIB_BOUNCER_SPIN];
2064 if (enemy[e].angle < 0)
2065 enemy[e].angle += ANGLE_FULL;
2066 if (enemy[e].angle < ANGLE_FULL)
2067 enemy[e].angle -= ANGLE_FULL;
2068
2069 enemy[e].attribute [ATTRIB_BOUNCER_SPIN] += enemy[e].attribute [ATTRIB_BOUNCER_DELTA_SPIN];
2070 if (enemy[e].attribute [ATTRIB_BOUNCER_SPIN] > 50)
2071 enemy[e].attribute [ATTRIB_BOUNCER_SPIN] = 50;
2072 if (enemy[e].attribute [ATTRIB_BOUNCER_SPIN] < -50)
2073 enemy[e].attribute [ATTRIB_BOUNCER_SPIN] = -50;
2074
2075 if (grand(10) == 0)
2076 {
2077 enemy[e].attribute [ATTRIB_BOUNCER_DELTA_SPIN] = grand(5) - 2;
2078 }
2079
2080 return 1;
2081
2082 }
2083 */
2084
2085 void wormer_pulsates(int e)
2086 {
2087 enemy[e].radius = 9000 + (100000 * (120 - enemy[e].recycle)) / 1500
2088 + pulsate(48, 1200, enemy[e].recycle);
2089 if (enemy[e].recycle > 110)
2090 enemy[e].radius = 17000 - (120 - enemy[e].recycle) * GRAIN
2091 + pulsate(48, 1200, enemy[e].recycle);
2092 }
2093 /*
2094 void enemy_pulsates(int e, int amount)
2095 {
2096 pulsate(8, 3500, enemy[e].recycle)
2097 }
2098 */
2099
2100 int move_drifter_ai(int e)
2101 {
2102 int ec = enemy[e].type;
2103 int slew_amount = eclass[ec].slew;
2104 int bullet_colours [4];
2105 int i;
2106
2107 if (enemy[e].x / 100000 == enemy[e].x_dest / 100000
2108 && enemy[e].y / 100000 == enemy[e].y_dest / 100000)
2109 {
2110 enemy[e].x_dest = grand(arena.max_x - enemy[e].edge_radius * 2) + enemy[e].edge_radius;
2111 enemy[e].y_dest = grand(arena.max_y - enemy[e].edge_radius * 2) + enemy[e].edge_radius;
2112 // enemy[e].x_dest = grand(arena.max_x - enemy[e].edge_radius * 4) + enemy[e].edge_radius * 2;
2113 // enemy[e].y_dest = grand(arena.max_y - enemy[e].edge_radius * 4) + enemy[e].edge_radius * 2;
2114 // enemy[e].attribute [ATTRIB_DRIFTER_DELTA_SPIN] = grand(5) - 2;
2115 }
2116
2117 float target_angle = atan2(enemy[e].y_dest - enemy[e].y,
2118 enemy[e].x_dest - enemy[e].x);
2119
2120 accelerate_enemy(e, radians_to_angle(target_angle), eclass[ec].acceleration);
2121 /*
2122 enemy[e].attribute [ATTRIB_DRIFTER_SPIN] += enemy[e].attribute [ATTRIB_DRIFTER_DELTA_SPIN];
2123 if (enemy[e].attribute [ATTRIB_DRIFTER_SPIN] > 32)
2124 enemy[e].attribute [ATTRIB_DRIFTER_SPIN] = 32;
2125 if (enemy[e].attribute [ATTRIB_DRIFTER_SPIN] < -32)
2126 enemy[e].attribute [ATTRIB_DRIFTER_SPIN] = -32;
2127 enemy[e].attribute [ATTRIB_DRIFTER_LUMP_ANGLE] += enemy[e].attribute [ATTRIB_DRIFTER_SPIN];
2128 */
2129 drag_enemy(e, eclass[ec].drag_amount);
2130
2131 int distance, xa, xb, xc, xd;
2132
2133 switch(enemy[e].type)
2134 {
2135 case ENEMY_CURVE2:
2136 case ENEMY_CURVE3:
2137 if (enemy[e].armour <= 500 && enemy[e].counter % 2 == 0 && grand(1000) > enemy[e].armour)
2138 {
2139 int passing_colours [5] = {TRANS_DRED, TRANS_LRED, TRANS_YELLOW, 0, 0};
2140 if (enemy[e].type == ENEMY_CURVE3)
2141 {
2142 passing_colours [0] = TRANS_DBLUE;
2143 passing_colours [1] = TRANS_LBLUE;
2144 passing_colours [2] = TRANS_WHITE;
2145 }
2146 xa = grand(ANGLE_FULL);
2147 xb = grand(16 * GRAIN);
2148 place_small_explosion(enemy[e].x + xpart(xa, xb), enemy[e].y + ypart(xa, xb), enemy[e].x_speed, enemy[e].y_speed,
2149 200 + crandom(200), passing_colours);
2150 hurt_enemy(e, 10 + grand(20), enemy[e].attribute [0], 1);
2151 }
2152 break;
2153 case ENEMY_BEAMER2:
2154 if (enemy[e].attribute [0] > 0)
2155 {
2156 create_effect(EFFECT_BLUEBEAM,
2157 enemy[e].x + xpart(enemy[e].angle, 31 * GRAIN),
2158 enemy[e].y + ypart(enemy[e].angle, 31 * GRAIN),
2159 enemy[e].x, enemy[e].y,
2160 enemy[e].x + xpart(enemy[e].angle, 400 * GRAIN),
2161 enemy[e].y + ypart(enemy[e].angle, 400 * GRAIN),
2162 enemy[e].attribute [0], enemy[e].angle,enemy[e].counter,0,0);
2163 if (enemy[e].attribute [0] > 100)
2164 enemy[e].attribute [0] -= 2;
2165 else
2166 enemy[e].attribute [0]--;
2167 enemy_beam(enemy[e].x, enemy[e].y, enemy[e].angle, enemy[e].attribute [0], EFFECT_BLUEBEAM, e);
2168 slew_amount = 2;
2169 }
2170 manage_turret(e, 0, 74 * GRAIN, 0, 0);
2171 manage_turret(e, 1, -74 * GRAIN, 0, 0);
2172 break;
2173 case ENEMY_BEAMER1:
2174 if (enemy[e].attribute [0] > 0)
2175 {
2176 create_effect(EFFECT_REDBEAM,
2177 enemy[e].x + xpart(enemy[e].angle, 31 * GRAIN),
2178 enemy[e].y + ypart(enemy[e].angle, 31 * GRAIN),
2179 enemy[e].x, enemy[e].y,
2180 enemy[e].x + xpart(enemy[e].angle, 400 * GRAIN),
2181 enemy[e].y + ypart(enemy[e].angle, 400 * GRAIN),
2182 enemy[e].attribute [0], enemy[e].angle,enemy[e].counter,0,0);
2183 enemy[e].attribute [0] --;
2184 enemy_beam(enemy[e].x, enemy[e].y, enemy[e].angle, enemy[e].attribute [0], EFFECT_REDBEAM, e);
2185 slew_amount = 1;
2186 }
2187 manage_turret(e, 0, 74 * GRAIN, 0, 0);
2188 manage_turret(e, 1, -74 * GRAIN, 0, 0);
2189 break;
2190 case ENEMY_OVERZAPPER:
2191 enemy[e].attribute [0] = 0;
2192 enemy[e].attribute [4] += enemy[e].attribute [5];
2193 enemy[e].attribute [4] &= 1023;
2194 if (enemy[e].attacking != -1)
2195 {
2196 xa = radians_to_angle(atan2((actor[enemy[e].attacking].y - enemy[e].attribute [9]), (actor[enemy[e].attacking].x - enemy[e].attribute [8])));
2197 if (xa < 0)
2198 xa += ANGLE_FULL;
2199 if (xa > ANGLE_FULL)
2200 xa -= ANGLE_FULL;
2201 enemy[e].attribute [8] += xpart(xa, 2000);
2202 enemy[e].attribute [9] += ypart(xa, 2000);
2203 if (hypot(enemy[e].attribute [8] - enemy[e].x, enemy[e].attribute [9] - enemy[e].y) > 350000)
2204 {
2205 xa = radians_to_angle(atan2((enemy[e].attribute [9] - enemy[e].y), (enemy[e].attribute [8] - enemy[e].x)));
2206 if (xa < 0)
2207 xa += ANGLE_FULL;
2208 if (xa > ANGLE_FULL)
2209 xa -= ANGLE_FULL;
2210 enemy[e].attribute [8] -= xpart(xa, 2000);
2211 enemy[e].attribute [9] -= ypart(xa, 2000);
2212 }
2213 }
2214 if (enemy[e].attribute [6] <= 0)
2215 {
2216 for (xa = 0; xa < NO_ACTORS; xa ++)
2217 {
2218 if (actor[xa].in_play == 0)
2219 continue;
2220 if (actor[xa].grace_period > 0)
2221 continue;
2222 if (hypot(enemy[e].attribute [8] - actor[xa].x, enemy[e].attribute [9] - actor[xa].y) < 30000)
2223 {
2224 zap_attack(e);
2225 enemy[e].attribute [6] = 40;
2226 break;
2227 }
2228 }
2229 }
2230 else
2231 enemy[e].attribute [6] --;
2232 manage_turret(e, 0, xpart(enemy[e].angle, -30000), ypart(enemy[e].angle, -30000), 0);
2233 create_effect(EFFECT_ZAP_AIM,
2234 enemy[e].attribute [8],
2235 enemy[e].attribute [9],
2236 enemy[e].attribute [8] - 30,
2237 enemy[e].attribute [9] - 30,
2238 enemy[e].attribute [8] + 30,
2239 enemy[e].attribute [9] + 30,
2240 enemy[e].attribute [7], enemy[e].angle,enemy[e].counter,0,0);
2241 enemy[e].recycle = 100; // attribute [6] used instead
2242 enemy[e].attribute [7] += xpart(enemy[e].counter * 4, 6);
2243 break;
2244 case ENEMY_OVERTRIANGLER:
2245 manage_turret(e, 0, xpart(enemy[e].angle, -30000), ypart(enemy[e].angle, -30000), 0);
2246 // fall-through...
2247 case ENEMY_TRIANGLER1:
2248 case ENEMY_TRIANGLER2:
2249 case ENEMY_TRIANGLER3:
2250 if (enemy[e].attribute [1] > 0)
2251 {
2252 enemy[e].attribute [1] += enemy[e].attribute [2];
2253 enemy[e].attribute [2] --;
2254 if (enemy[e].attribute [2] < -1)
2255 enemy[e].attribute [2] = -1;
2256 }
2257
2258 if (enemy[e].attribute [1] < 0)
2259 enemy[e].attribute [1] = 0;
2260 /* if (enemy[e].attribute [2] != 0)
2261 {
2262 if (enemy[e].attribute [1] < 24)
2263 {
2264 enemy[e].attribute [1] += enemy[e].attribute [2];
2265 }
2266 if (enemy[e].attribute [1] >= 24)
2267 enemy[e].attribute [2] = -6;
2268 if (enemy[e].attribute [1] <= 0)
2269 enemy[e].attribute [2] = 0;
2270 }*/
2271 break;
2272 case ENEMY_DEAD_TRI1:
2273 case ENEMY_DEAD_TRI2:
2274 case ENEMY_DEAD_TRI3:
2275 // drag_enemy(e, .01);
2276 if (enemy[e].attribute [0] % 2 == 0)
2277 {
2278 int passing_colours [5];
2279 int cangle = grand(ANGLE_FULL);
2280 int cx = enemy[e].x + xpart(cangle, grand(enemy[e].attribute [1]));
2281 int cy = enemy[e].y + ypart(cangle, grand(enemy[e].attribute [1]));
2282 passing_colours [0] = enemy[e].attribute [3];
2283 create_cloud(CLOUD_MED_TRANS_CIRCLE,
2284 cx, cy, 0, 0, enemy[e].x_speed, enemy[e].y_speed,
2285 200 + grand(350),0,2, 0, 0, 0, passing_colours);
2286 passing_colours [0] = enemy[e].attribute [4];
2287 create_cloud(CLOUD_MED_TRANS_CIRCLE,
2288 cx, cy, 0, 0, enemy[e].x_speed, enemy[e].y_speed,
2289 300 + grand(450),0,6, 0, 0, 0, passing_colours);
2290 simple_light(cx, cy, enemy[e].x_speed, enemy[e].y_speed, 600);
2291 }
2292 enemy[e].attribute [0] --;
2293 if (enemy[e].attribute [0] <= 0)
2294 {
2295 hurt_enemy(e, 99999, OWNER_ENEMY, 0);
2296 return 0;
2297 }
2298 break;
2299 case ENEMY_CIRCLER1:
2300 if (enemy[e].attribute [0] > 0)
2301 enemy[e].attribute [0]--;
2302 break;
2303 case ENEMY_WORMER1:
2304 case ENEMY_WORMER2:
2305 case ENEMY_WORMER3:
2306 case ENEMY_WORMER4:
2307 wormer_pulsates(e);
2308 break;
2309 case ENEMY_HEAD1:
2310 manage_turret(e, 0, 25 * GRAIN, 27 * GRAIN, 0);
2311 manage_turret(e, 1, -25 * GRAIN, 27 * GRAIN, 0);
2312 break;
2313 case ENEMY_DEFENDER1:
2314 manage_turret(e, 0, 49 * GRAIN, 0, 0);
2315 manage_turret(e, 1, -49 * GRAIN, 0, 0);
2316 break;
2317 case ENEMY_DEFENDER2:
2318 manage_turret(e, 0, 0, 48 * GRAIN, 0);
2319 manage_turret(e, 1, 0, -48 * GRAIN, 0);
2320 break;
2321 case ENEMY_DEFENDER3:
2322 manage_turret(e, 0, 52 * GRAIN, 0, 0);
2323 manage_turret(e, 1, -52 * GRAIN, 0, 0);
2324 break;
2325 case ENEMY_OVERDISRUPTER:
2326 manage_turret(e, 0, 0, 50 * GRAIN, 0);
2327 manage_turret(e, 1, 0, -50 * GRAIN, 0);
2328 break;
2329 case ENEMY_BOSS1_1:
2330 manage_turret(e, 0, 50 * GRAIN, 65 * GRAIN, 0);
2331 manage_turret(e, 1, -50 * GRAIN, 65 * GRAIN, 0);
2332 manage_turret(e, 2, -50 * GRAIN, -65 * GRAIN, 0);
2333 manage_turret(e, 3, 50 * GRAIN, -65 * GRAIN, 0);
2334 // manage_turret(e, 0, 0, 60 * GRAIN);
2335 // manage_turret(e, 1, 62 * GRAIN, -13 * GRAIN);
2336 // manage_turret(e, 2, -62 * GRAIN, -13 * GRAIN);
2337 break;
2338 case ENEMY_BOSS1_3:
2339 manage_turret(e, 0, -83 * GRAIN, 59 * GRAIN, 0);
2340 manage_turret(e, 1, 83 * GRAIN, 59 * GRAIN, 0);
2341 manage_turret(e, 2, 0, -80 * GRAIN, 0);
2342 break;
2343 case ENEMY_BOSS2:
2344 enemy[e].angle += 5 + grand(10);
2345 enemy[e].angle &= ANGLE_FULL - 1;
2346 enemy[e].attribute [0] -= 5 + grand(10);
2347 enemy[e].attribute [0] &= ANGLE_FULL - 1;
2348 manage_turret(e, 0, - 62 * GRAIN, -62 * GRAIN, 0);
2349 manage_turret(e, 1, 62 * GRAIN, -62 * GRAIN, 0);
2350 manage_turret(e, 2, - 62 * GRAIN, 62 * GRAIN, 0);
2351 manage_turret(e, 3, 62 * GRAIN, 62 * GRAIN, 0);
2352 break;
2353 case ENEMY_BOSS2_2:
2354 manage_turret(e, 0, - 79 * GRAIN, 44 * GRAIN, 0);
2355 manage_turret(e, 1, 79 * GRAIN, 44 * GRAIN, 0);
2356 manage_turret(e, 2, 0 * GRAIN, -89 * GRAIN, 0);
2357 break;
2358 case ENEMY_BOSS2_3:
2359 manage_turret(e, 0, - 109 * GRAIN, 0 * GRAIN, 0);
2360 manage_turret(e, 1, 109 * GRAIN, 0 * GRAIN, 0);
2361 manage_turret(e, 2, 0 * GRAIN, 97 * GRAIN, 0);
2362 manage_turret(e, 3, 0 * GRAIN, -97 * GRAIN, 0);
2363 break;
2364 case ENEMY_BOSS3_1:
2365 manage_turret(e, 0, - 69 * GRAIN, -69 * GRAIN, 0);
2366 manage_turret(e, 1, 69 * GRAIN, -69 * GRAIN, 0);
2367 manage_turret(e, 2, -69 * GRAIN, 69 * GRAIN, 0);
2368 manage_turret(e, 3, 69 * GRAIN, 69 * GRAIN, 0);
2369 run_boss3_1(e);
2370 break;
2371 case ENEMY_BOSS3_2:
2372 manage_turret(e, 0, - 78 * GRAIN, 57 * GRAIN, 0);
2373 manage_turret(e, 1, 78 * GRAIN, 57 * GRAIN, 0);
2374 manage_turret(e, 2, 0 * GRAIN, -78 * GRAIN, 0);
2375 break;
2376 case ENEMY_BOSS3_3:
2377 manage_turret(e, 0, - 88 * GRAIN, -62 * GRAIN, 0);
2378 manage_turret(e, 1, 88 * GRAIN, -62 * GRAIN, 0);
2379 manage_turret(e, 2, -88 * GRAIN, 62 * GRAIN, 0);
2380 manage_turret(e, 3, 88 * GRAIN, 62 * GRAIN, 0);
2381 run_boss3_3(e);
2382 break;
2383 case ENEMY_BRACKET4:
2384 manage_turret(e, 0, 26 * GRAIN, 0, 0);
2385 manage_turret(e, 1, -26 * GRAIN, 0, 0);
2386 break;
2387 case ENEMY_MINER3:
2388 manage_turret(e, 0, 0, -30 * GRAIN, 0);
2389 break;
2390 /* case ENEMY_CRUISER1:
2391 case ENEMY_CRUISER2:
2392 case ENEMY_CRUISER3:
2393 case ENEMY_CRUISER4:
2394 manage_turret(e, 0, xpart(enemy[e].angle, 22000), ypart(enemy[e].angle, 22000));
2395 break;
2396 see cruiser_ai
2397 */
2398
2399 case ENEMY_OVERBLATTER:
2400 case ENEMY_OVERBLATTER2:
2401 /* if (enemy[e].attribute [4] != 0)
2402 {
2403 enemy[e].attribute [3] += enemy[e].attribute [4];
2404 enemy[e].angle = enemy[e].attribute [3];
2405 } */
2406 xa = 5; // slew
2407 if (enemy[e].type == ENEMY_OVERBLATTER2)
2408 xa = 6;
2409 if (enemy[e].attribute [8] > 0)
2410 enemy[e].attribute [8] --;
2411 if (enemy[e].attribute [9] > 0)
2412 enemy[e].attribute [9] --;
2413 if (enemy[e].attacking != -1)
2414 {
2415 enemy[e].attribute [6] =
2416 track_target_any_angle(enemy[e].x + xpart(enemy[e].angle + ANGLE_QUARTER, 26 * GRAIN),
2417 enemy[e].y + ypart(enemy[e].angle + ANGLE_QUARTER, 26 * GRAIN),
2418 actor[enemy[e].attacking].x, actor[enemy[e].attacking].y, xa, 0,
2419 enemy[e].attribute [6]);
2420 enemy[e].attribute [7] =
2421 track_target_any_angle(enemy[e].x + xpart(enemy[e].angle - ANGLE_QUARTER, 26 * GRAIN),
2422 enemy[e].y + ypart(enemy[e].angle - ANGLE_QUARTER, 26 * GRAIN),
2423 actor[enemy[e].attacking].x, actor[enemy[e].attacking].y, xa, 0,
2424 enemy[e].attribute [7]);
2425 }
2426 // break; fall through
2427 case ENEMY_OVERSPINNER:
2428 case ENEMY_OVERSPIKEY:
2429 case ENEMY_UNDERSPIKEY:
2430 case ENEMY_UNDERSPIKEY2:
2431 case ENEMY_UNDERSPIKEY3:
2432 case ENEMY_OVERSPIKEY2:
2433 enemy[e].attribute [0] += enemy[e].attribute [1];
2434 enemy[e].attribute [0] &= ANGLE_FULL - 1;
2435 enemy[e].attribute [2] -= (enemy[e].attribute [1] / 3);
2436 enemy[e].attribute [2] &= ANGLE_FULL - 1;
2437 break;
2438 case ENEMY_SPINNER1:
2439 case ENEMY_SPINNER2:
2440 case ENEMY_SPINNER3:
2441 case ENEMY_SPINNER4:
2442 case ENEMY_SPINNER5:
2443 case ENEMY_SPIKEY1:
2444 case ENEMY_SPIKEY2:
2445 case ENEMY_SPIKEY3:
2446 case ENEMY_SPIKEY4:
2447 case ENEMY_SPIKEY5:
2448 case ENEMY_BLATTER1:
2449 case ENEMY_BLATTER2:
2450 case ENEMY_BLATTER3:
2451 case ENEMY_BLATTER4:
2452 case ENEMY_BLATTER5:
2453 case ENEMY_BLOATER1:
2454 case ENEMY_BLOATER2:
2455 enemy[e].attribute [0] += enemy[e].attribute [1];
2456 enemy[e].attribute [0] &= ANGLE_FULL - 1;
2457 break;
2458 // if (enemy[e].attribute [0] > 0)
2459 // enemy[e].attribute [0] --;
2460 // break;
2461 case ENEMY_SHIELDER1: // mirrored for some turrets in move_turret
2462 if (enemy[e].attribute [0] > 0)
2463 enemy[e].attribute [0] --;
2464 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2465 break;
2466 case ENEMY_ORBITER1:
2467 xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 150000);
2468 xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 150000);
2469 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2470 bullet_colours [0] = TRANS_YELLOW;
2471 bullet_colours [1] = TRANS_ORANGE;
2472 bullet_colours [2] = TRANS_LRED;
2473 bullet_colours [3] = TRANS_DRED;
2474 for (i = 0; i < 3; i ++)
2475 {
2476 create_bullet(BULLET_ORBIT,
2477 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_FULL / 3) * i, 150000),
2478 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_FULL / 3) * i, 150000),
2479 0, 0,
2480 OWNER_ENEMY, 100, 2, 100, 0,
2481 0, 5000, bullet_colours, 1,
2482 xa,
2483 xb,5,7,0);
2484 }
2485 break;
2486 case ENEMY_ORBITER2:
2487 xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 150000);
2488 xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 150000);
2489 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2490 enemy[e].attribute [3] = (enemy[e].attribute [3] + enemy[e].attribute [4]) & 1023;
2491 bullet_colours [0] = TRANS_YELLOW;
2492 bullet_colours [1] = TRANS_ORANGE;
2493 bullet_colours [2] = TRANS_LRED;
2494 bullet_colours [3] = TRANS_DRED;
2495 for (i = 0; i < 2; i ++)
2496 {
2497 create_bullet(BULLET_ORBIT,
2498 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_HALF) * i, 150000),
2499 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_HALF) * i, 150000),
2500 0, 0,
2501 OWNER_ENEMY, 100, 2, 100, 0,
2502 0, 5000, bullet_colours, 1,
2503 xa,
2504 xb,5,7,0);
2505 }
2506 for (i = 0; i < 2; i ++)
2507 {
2508 create_bullet(BULLET_ORBIT,
2509 enemy[e].x + xpart(enemy[e].attribute [3] + (ANGLE_HALF) * i, 100000),
2510 enemy[e].y + ypart(enemy[e].attribute [3] + (ANGLE_HALF) * i, 100000),
2511 0, 0,
2512 OWNER_ENEMY, 100, 2, 100, 0,
2513 0, 5000, bullet_colours, 1,
2514 xa,
2515 xb,5,7,0);
2516 }
2517 break;
2518 case ENEMY_ORBITER3:
2519 // xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 150000);
2520 // xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 150000);
2521 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2522 // bullet_colours [0] = TRANS_WHITE;
2523 /* bullet_colours [0] = TRANS_PURPLE;
2524 bullet_colours [1] = TRANS_LBLUE;
2525 bullet_colours [2] = TRANS_DBLUE;
2526 bullet_colours [3] = TRANS_DBLUE;*/
2527 bullet_colours [0] = TRANS_WHITE;
2528 bullet_colours [1] = TRANS_LGREY;
2529 bullet_colours [2] = TRANS_LGREY;
2530 bullet_colours [3] = TRANS_DGREY;
2531 enemy[e].attribute [3] = (enemy[e].attribute [3] + 1) & 0xff;
2532 for (i = 0; i < 4; i ++)
2533 {
2534 xc = pulsate(32, 32, (enemy[e].attribute [3] + i * 64) & 0xff);
2535 xd = pulsate(32, 32, (enemy[e].attribute [3] - 1 + i * 64) & 0xff);
2536 create_bullet(BULLET_ORBIT,
2537 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_QUARTER) * i, 150000 + xc * GRAIN),
2538 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_QUARTER) * i, 150000 + xc * GRAIN),
2539 0, 0,
2540 OWNER_ENEMY, 150, 2, 100, 0,
2541 0, 4000, bullet_colours, 1,
2542 enemy[e].x - enemy[e].x_speed + xpart((enemy[e].attribute [1] + (ANGLE_QUARTER) * i - enemy[e].attribute [2]) & 1023, 150000 + xd * GRAIN),
2543 enemy[e].y - enemy[e].y_speed + ypart((enemy[e].attribute [1] + (ANGLE_QUARTER) * i - enemy[e].attribute [2]) & 1023, 150000 + xd * GRAIN),
2544 4,6,0);
2545 }
2546 break;
2547 case ENEMY_ZAPPER1:
2548 enemy[e].recycle = 10;
2549 enemy[e].attribute [0] = 0;
2550 enemy[e].attribute [4] += enemy[e].attribute [5];
2551 enemy[e].attribute [4] &= 1023;
2552 if (enemy[e].attacking != ATTACK_NONE && actor[enemy[e].attacking].in_play == 1)
2553 {
2554 if ((distance = hypot(actor[enemy[e].attacking].x - enemy[e].x, actor[enemy[e].attacking].y - enemy[e].y)) < eclass[ec].range)
2555 {
2556 enemy[e].attribute [0] = 1;
2557 enemy[e].attribute [1] = actor[enemy[e].attacking].x;
2558 enemy[e].attribute [2] = actor[enemy[e].attacking].y;
2559 enemy[e].attribute [3] = distance / GRAIN;
2560 if (actor[enemy[e].attacking].grace_period == 0)
2561 hurt_actor(enemy[e].attacking, OWNER_ENEMY, 3);
2562 }
2563 }
2564 break;
2565 case ENEMY_PULSER1:
2566 case ENEMY_PULSER2:
2567 enemy[e].attribute [0] ++;
2568 if (enemy[e].armour < 400)
2569 enemy[e].attribute [0] ++;
2570 if (enemy[e].armour < 200)
2571 enemy[e].attribute [0] ++;
2572 enemy[e].attribute [0] &= 255;
2573 break;
2574 case ENEMY_SHADOW1:
2575 if (enemy[e].attribute [0] > 0)
2576 enemy[e].attribute [0] --;
2577 else
2578 {
2579 if (enemy[e].hurt_pulse > 0)
2580 enemy[e].attribute [0] = 9;
2581 }
2582 if (enemy[e].recycle == 10)
2583 enemy[e].attribute [0] = 78;
2584 break;
2585 case ENEMY_SHADOW2:
2586 if (enemy[e].attribute [0] > 0)
2587 enemy[e].attribute [0] --;
2588 else
2589 {
2590 if (enemy[e].hurt_pulse > 0)
2591 enemy[e].attribute [0] = 9;
2592 }
2593 if (enemy[e].recycle == 10)
2594 enemy[e].attribute [0] = 58;
2595 break;
2596 }
2597
2598
2599
2600 if (enemy[e].counter % 16 == 0)
2601 {
2602 enemy[e].attacking = nearby_target(eclass[ec].range, enemy[e].x, enemy[e].y);
2603 }
2604
2605 if (enemy[e].attacking != ATTACK_NONE)// && enemy[e].counter % 5 == 0)
2606 {
2607 if (enemy[e].counter % 8 == 0)
2608 enemy[e].slew_dir = 0;
2609 enemy[e].angle = track_target(e, enemy[e].attacking, slew_amount, enemy[e].slew_dir * -1);
2610 if (enemy[e].recycle == 0)
2611 standard_attack(e, enemy[e].angle);
2612 }
2613
2614 // ifnemy[e].type != ENEMY_DRIFTER3)
2615 // return 1;
2616 /*
2617 int colours [4], ox, oy;
2618
2619 enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] += enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL_DIR];
2620 if (enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] > ANGLE_FULL)
2621 enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] -= ANGLE_FULL;
2622 if (enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] < 0)
2623 enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] += ANGLE_FULL;
2624
2625 colours [0] = GC_BLUE4;
2626
2627 ox = enemy[e].x + cos(angle_to_radians(enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL])) * 40000;
2628 oy = enemy[e].y + sin(angle_to_radians(enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL])) * 40000;
2629
2630 create_bullet(BULLET_ORBITAL, ox, oy,
2631 0, 0,
2632 OWNER_ENEMY, 50, 2, 100, 0,
2633 0, 0, colours, 1,0,0,0,0,0);
2634
2635
2636 ox = enemy[e].x + cos(angle_to_radians(enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] + ANGLE_HALF)) * 40000;
2637 oy = enemy[e].y + sin(angle_to_radians(enemy[e].attribute [ATTRIB_DRIFTER3_ORBITAL] + ANGLE_HALF)) * 40000;
2638
2639 create_bullet(BULLET_ORBITAL, ox, oy,
2640 0, 0,
2641 OWNER_ENEMY, 50, 2, 100, 0,
2642 0, 0, colours, 1,0,0,0,0,0);
2643
2644 return 1;
2645 */
2646 return 1;
2647 }
2648
2649
2650
2651 int move_auto_ai(int e)
2652 {
2653 int ec = enemy[e].type;
2654 int bullet_colours [4];
2655 int i;
2656
2657 drag_enemy(e, eclass[ec].drag_amount);
2658
2659 int xa, xb, xc, xd;
2660
2661 switch(enemy[e].type)
2662 {
2663 case ENEMY_ATTRACTOR:
2664 blast(enemy[e].x, enemy[e].y, 300000, 0, -90, OWNER_ENEMY);
2665 break;
2666 case ENEMY_ORBITER1:
2667 xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 150000);
2668 xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 150000);
2669 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2670 bullet_colours [0] = TRANS_YELLOW;
2671 bullet_colours [1] = TRANS_ORANGE;
2672 bullet_colours [2] = TRANS_LRED;
2673 bullet_colours [3] = TRANS_DRED;
2674 for (i = 0; i < 3; i ++)
2675 {
2676 create_bullet(BULLET_ORBIT,
2677 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_FULL / 3) * i, 150000),
2678 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_FULL / 3) * i, 150000),
2679 0, 0,
2680 OWNER_ENEMY, 100, 2, 100, 0,
2681 0, 5000, bullet_colours, 1,
2682 xa,
2683 xb,0,0,0);
2684 }
2685 break;
2686 case ENEMY_ORBITER2:
2687 xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 150000);
2688 xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 150000);
2689 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2690 enemy[e].attribute [3] = (enemy[e].attribute [3] + enemy[e].attribute [4]) & 1023;
2691 bullet_colours [0] = TRANS_YELLOW;
2692 bullet_colours [1] = TRANS_ORANGE;
2693 bullet_colours [2] = TRANS_LRED;
2694 bullet_colours [3] = TRANS_DRED;
2695 for (i = 0; i < 2; i ++)
2696 {
2697 create_bullet(BULLET_ORBIT,
2698 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_HALF) * i, 150000),
2699 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_HALF) * i, 150000),
2700 0, 0,
2701 OWNER_ENEMY, 100, 2, 100, 0,
2702 0, 5000, bullet_colours, 1,
2703 xa,
2704 xb,0,0,0);
2705 }
2706 for (i = 0; i < 2; i ++)
2707 {
2708 create_bullet(BULLET_ORBIT,
2709 enemy[e].x + xpart(enemy[e].attribute [3] + (ANGLE_HALF) * i, 100000),
2710 enemy[e].y + ypart(enemy[e].attribute [3] + (ANGLE_HALF) * i, 100000),
2711 0, 0,
2712 OWNER_ENEMY, 100, 2, 100, 0,
2713 0, 5000, bullet_colours, 1,
2714 xa,
2715 xb,0,0,0);
2716 }
2717 break;
2718 case ENEMY_ORBITER3:
2719 // xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 150000);
2720 // xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 150000);
2721 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2722 // bullet_colours [0] = TRANS_WHITE;
2723 /* bullet_colours [0] = TRANS_PURPLE;
2724 bullet_colours [1] = TRANS_LBLUE;
2725 bullet_colours [2] = TRANS_DBLUE;
2726 bullet_colours [3] = TRANS_DBLUE;*/
2727 bullet_colours [0] = TRANS_WHITE;
2728 bullet_colours [1] = TRANS_LGREY;
2729 bullet_colours [2] = TRANS_LGREY;
2730 bullet_colours [3] = TRANS_DGREY;
2731 enemy[e].attribute [3] = (enemy[e].attribute [3] + 1) & 0xff;
2732 for (i = 0; i < 4; i ++)
2733 {
2734 xc = pulsate(32, 32, (enemy[e].attribute [3] + i * 64) & 0xff);
2735 xd = pulsate(32, 32, (enemy[e].attribute [3] - 1 + i * 64) & 0xff);
2736 create_bullet(BULLET_ORBIT,
2737 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_QUARTER) * i, 150000 + xc * GRAIN),
2738 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_QUARTER) * i, 150000 + xc * GRAIN),
2739 0, 0,
2740 OWNER_ENEMY, 150, 2, 100, 0,
2741 0, 5000, bullet_colours, 1,
2742 enemy[e].x - enemy[e].x_speed + xpart((enemy[e].attribute [1] + (ANGLE_QUARTER) * i - enemy[e].attribute [2]) & 1023, 150000 + xd * GRAIN),
2743 enemy[e].y - enemy[e].y_speed + ypart((enemy[e].attribute [1] + (ANGLE_QUARTER) * i - enemy[e].attribute [2]) & 1023, 150000 + xd * GRAIN),
2744 0,0,0);
2745 }
2746 break;
2747 case ENEMY_WAVER1:
2748 create_effect(EFFECT_WAVE1,
2749 enemy[e].x,
2750 enemy[e].y,
2751 enemy[e].x - 160 * GRAIN, enemy[e].y - 160 * GRAIN,
2752 enemy[e].x + 160 * GRAIN,
2753 enemy[e].y + 160 * GRAIN,
2754 enemy[e].counter, 150,0,0,0);
2755 enemy[e].attribute [0] += enemy[e].attribute [1];
2756 enemy[e].attribute [0] &= ANGLE_FULL - 1;
2757 arena.waver_on_level = 1;
2758 break;
2759 case ENEMY_WAVER2:
2760 create_effect(EFFECT_WAVE2,
2761 enemy[e].x,
2762 enemy[e].y,
2763 enemy[e].x - 210 * GRAIN, enemy[e].y - 210 * GRAIN,
2764 enemy[e].x + 210 * GRAIN,
2765 enemy[e].y + 210 * GRAIN,
2766 enemy[e].counter, 200,0,0,0);
2767 enemy[e].attribute [0] += enemy[e].attribute [1];
2768 enemy[e].attribute [0] &= ANGLE_FULL - 1;
2769 arena.waver_on_level = 1;
2770 // if sizes are changed here, must also change them in bullet.c
2771 break;
2772 }
2773
2774
2775 if (enemy[e].recycle == 0)
2776 standard_attack(e, enemy[e].angle);
2777 return 1;
2778 }
2779
2780
2781 int move_stinger_ai(int e)
2782 {
2783 int ec = enemy[e].type;
2784
2785
2786 if (grand(eclass[ec].impulse_delay) == 0)
2787 {
2788 accelerate_enemy(e, grand(ANGLE_FULL), eclass[ec].acceleration);
2789 // switch(enemy[e].type)
2790 // //{
2791 // }
2792 }
2793
2794 drag_enemy(e, eclass[ec].drag_amount);
2795
2796 switch(enemy[e].type)
2797 {
2798 case ENEMY_BOSS1_2:
2799 manage_turret(e, 0, -80 * GRAIN, 0 * GRAIN, 0);
2800 manage_turret(e, 1, 80 * GRAIN, 0 * GRAIN, 0);
2801 manage_turret(e, 2, 0, 75 * GRAIN, 0);
2802 break;
2803 }
2804
2805 if (enemy[e].counter % 16 == 0)
2806 {
2807 enemy[e].attacking = nearby_target(eclass[ec].range, enemy[e].x, enemy[e].y);
2808 }
2809
2810 if (enemy[e].attacking != ATTACK_NONE)
2811 {
2812 if (enemy[e].counter % 8 == 0)
2813 enemy[e].slew_dir = 0;
2814 enemy[e].angle = track_target(e, enemy[e].attacking, eclass[ec].slew, enemy[e].slew_dir * -1);
2815 if (enemy[e].recycle == 0)
2816 standard_attack(e, enemy[e].angle);
2817 }
2818
2819 return 1;
2820 }
2821
2822
2823
2824 int move_periodic_stinger_ai(int e)
2825 {
2826 int ec = enemy[e].type;
2827
2828
2829 if (enemy[e].next_impulse == 0)
2830 {
2831 accelerate_enemy(e, grand(ANGLE_FULL), eclass[ec].acceleration);
2832 enemy[e].next_impulse = eclass[enemy[e].type].impulse_delay;
2833 switch(enemy[e].type)
2834 {
2835 case ENEMY_PUFFER1:
2836 case ENEMY_PUFFER2:
2837 case ENEMY_PUFFER3:
2838 case ENEMY_PUFFER4:
2839 if (enemy[e].attribute [1] == -1)
2840 enemy[e].attribute [1] = 1;
2841 else
2842 enemy[e].attribute [1] = -1;
2843 break;
2844 }
2845 }
2846 else
2847 enemy[e].next_impulse --;
2848
2849
2850 drag_enemy(e, eclass[ec].drag_amount);
2851
2852 switch(enemy[e].type)
2853 {
2854 case ENEMY_PUFFER1:
2855 case ENEMY_PUFFER2:
2856 case ENEMY_PUFFER3:
2857 case ENEMY_PUFFER4:
2858 enemy[e].attribute [0] = (100 * (eclass[enemy[e].type].impulse_delay - enemy[e].next_impulse)) / 12;
2859 if (eclass[enemy[e].type].impulse_delay - enemy[e].next_impulse < 8)
2860 enemy[e].attribute [0] = ((100 * (eclass[enemy[e].type].impulse_delay)) / 12)
2861 / (eclass[enemy[e].type].impulse_delay - enemy[e].next_impulse + 1);
2862 enemy[e].attribute [2] += enemy[e].attribute [1];
2863 if (enemy[e].attribute [2] <= 0)
2864 enemy[e].attribute [2] += 1024;
2865 break;
2866 }
2867
2868 if (enemy[e].counter % 16 == 0)
2869 {
2870 enemy[e].attacking = nearby_target(eclass[ec].range, enemy[e].x, enemy[e].y);
2871 }
2872
2873 if (enemy[e].attacking != ATTACK_NONE)
2874 {
2875 if (enemy[e].counter % 8 == 0)
2876 enemy[e].slew_dir = 0;
2877 enemy[e].angle = track_target(e, enemy[e].attacking, eclass[ec].slew, enemy[e].slew_dir * -1);
2878 if (enemy[e].recycle == 0)
2879 standard_attack(e, enemy[e].angle);
2880 }
2881
2882 return 1;
2883 }
2884
2885
2886 int move_turret_ai(int e)
2887 {
2888
2889 // switch(enemy[e].type)
2890 // {
2891 // }
2892 int xa, xb, i, bullet_colours [4];
2893
2894 if (enemy[e].turret_main == -1)
2895 {
2896 hurt_enemy(e, 99999, OWNER_ENEMY, 0);
2897 return -1; // should never happen!
2898 }
2899
2900 if (enemy[e].counter % 16 == 0)
2901 {
2902 enemy[e].attacking = nearby_target(eclass[enemy[e].type].range, enemy[e].x, enemy[e].y);
2903 }
2904
2905 if (enemy[e].attacking != ATTACK_NONE)
2906 {
2907 if (enemy[e].counter % 8 == 0)
2908 enemy[e].slew_dir = 0;
2909 enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, enemy[e].slew_dir * -1);
2910 if (enemy[e].recycle == 0)
2911 standard_attack(e, enemy[e].angle);
2912 }
2913
2914 switch(enemy[e].type)
2915 {
2916 case ENEMY_CRUISER1_TURRET:
2917 case ENEMY_CRUISER2_TURRET:
2918 case ENEMY_DEFENDER2_TURRET3:
2919 case ENEMY_CRUISER3_TURRET:
2920 case ENEMY_CRUISER4_TURRET:
2921 case ENEMY_MINER3_TURRET:
2922 case ENEMY_BOSS2_TURRET4:
2923 case ENEMY_BOSS3_TURRET3:
2924 if (enemy[e].attribute [0] > 0)
2925 enemy[e].attribute [0] --;
2926 break;
2927 case ENEMY_DEFENDER1_TURRET3:
2928 case ENEMY_DEFENDER3_TURRET5:
2929 enemy[e].angle += enemy[e].attribute [0];
2930 break;
2931 case ENEMY_DEFENDER3_TURRET1:
2932 if (enemy[e].attribute [0] > 0)
2933 enemy[e].attribute [0] --;
2934 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2935 break;
2936 case ENEMY_DEFENDER3_TURRET2:
2937 xa = enemy[e].x - enemy[e].x_speed + xpart(enemy[e].attribute [1], 100000);
2938 xb = enemy[e].y - enemy[e].y_speed + ypart(enemy[e].attribute [1], 100000);
2939 enemy[e].attribute [1] = (enemy[e].attribute [1] + enemy[e].attribute [2]) & 1023;
2940 bullet_colours [0] = TRANS_YELLOW;
2941 bullet_colours [1] = TRANS_YELLOW;
2942 bullet_colours [2] = TRANS_LGREEN;
2943 bullet_colours [3] = TRANS_DGREEN;
2944 for (i = 0; i < 2; i ++)
2945 {
2946 create_bullet(BULLET_ORBIT,
2947 enemy[e].x + xpart(enemy[e].attribute [1] + (ANGLE_HALF) * i, 100000),
2948 enemy[e].y + ypart(enemy[e].attribute [1] + (ANGLE_HALF) * i, 100000),
2949 0, 0,
2950 OWNER_ENEMY, 60, 2, 100, 0,
2951 0, 4000, bullet_colours, 1,
2952 xa,
2953 xb,4,6,0);
2954 }
2955 break;
2956 case ENEMY_DEFENDER3_TURRET3:
2957 enemy[e].attribute [1] += enemy[e].attribute [2];
2958 enemy[e].attribute [1] &= 1023;
2959 break;
2960 }
2961
2962 return 1;
2963
2964 }
2965
2966
2967
2968 void manage_turret(int e, int t, int x, int y, int rotate)
2969 {
2970 if (enemy[e].turret [t] == -1)
2971 return;
2972
2973 int te = enemy[e].turret [t];
2974
2975 if (enemy[e].type == ENEMY_NONE)
2976 return;
2977
2978 enemy[te].x = enemy[e].x + x;
2979 enemy[te].y = enemy[e].y + y;
2980 enemy[te].x_speed = enemy[e].x_speed;
2981 enemy[te].y_speed = enemy[e].y_speed;
2982 enemy[te].angle += rotate;
2983
2984
2985 }
2986
2987
2988
2989
2990 int move_fighter_ai(int e)
2991 {
2992
2993 if (enemy[e].attribute [0] == FIGHTER_MOVE)
2994 {
2995 if (enemy[e].x / 100000 == enemy[e].x_dest / 100000
2996 && enemy[e].y / 100000 == enemy[e].y_dest / 100000)
2997 {
2998 // enemy[e].attacking = nearby_target(400000, enemy[e].x, enemy[e].y);
2999 enemy[e].attacking = closest_target(enemy[e].x, enemy[e].y);
3000 if (enemy[e].attacking != ATTACK_NONE)
3001 enemy[e].attribute [0] = FIGHTER_ATTACK;
3002 else
3003 {
3004 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3005 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3006 enemy[e].attacking = ATTACK_NONE;
3007 enemy[e].attribute [0] = FIGHTER_MOVE;
3008 }
3009 }
3010
3011 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y,
3012 enemy[e].x_dest, enemy[e].y_dest,
3013 enemy[e].angle, eclass[enemy[e].type].slew);
3014 }
3015 else
3016 {
3017 if (enemy[e].attacking == ATTACK_NONE
3018 || actor[enemy[e].attacking].in_play == 0)
3019 // assumes second condition not processed if first met.
3020 {
3021 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3022 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3023 enemy[e].attribute [0] = FIGHTER_MOVE;
3024 enemy[e].attacking = ATTACK_NONE;
3025 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y, enemy[e].x_dest, enemy[e].y_dest, enemy[e].angle, eclass[enemy[e].type].slew);
3026 }
3027 }
3028
3029 drag_enemy(e, eclass[enemy[e].type].drag_amount);
3030
3031 int ax, ay;
3032 // int x1, y1;
3033 // int passing_colour [5];
3034
3035 ax = xpart(enemy[e].angle, eclass[enemy[e].type].acceleration);
3036 ay = ypart(enemy[e].angle, eclass[enemy[e].type].acceleration);
3037
3038 enemy[e].x_speed += ax;
3039 enemy[e].y_speed += ay;
3040
3041 /* if (enemy[e].type == ENEMY_FIGHTER3)
3042 {
3043 passing_colour [0] = TRANS_LGREY;
3044 passing_colour [1] = TRANS_DGREEN;
3045 passing_colour [2] = TRANS_LGREEN;
3046 }
3047 else*/
3048
3049 if (enemy[e].attribute [0] == FIGHTER_ATTACK
3050 && enemy[e].attacking != ATTACK_NONE)
3051 {
3052 if (enemy[e].counter % 8 == 0)
3053 enemy[e].slew_dir = 0;
3054 enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, enemy[e].slew_dir * -1);
3055 // enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, 0);
3056 if (enemy[e].recycle == 0
3057 && hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) < 90000)
3058 {
3059 standard_attack(e, enemy[e].angle);
3060 if (enemy[e].burst_fire <= 1) // experimental!
3061 {
3062 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3063 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3064 enemy[e].attribute [0] = FIGHTER_MOVE;
3065 enemy[e].attacking = ATTACK_NONE;
3066 }
3067 }
3068 }
3069 else
3070 if (enemy[e].recycle == 0 && enemy[e].burst_fire > 0)
3071 {
3072 standard_attack(e, enemy[e].angle);
3073 }
3074
3075 int base_colour = TRANS_YELLOW;
3076 int xa = 0;
3077 switch(enemy[e].type)
3078 {
3079 case ENEMY_FIGHTER3:
3080 base_colour = TRANS_ORANGE;
3081 break;
3082 case ENEMY_FIGHTER4:
3083 base_colour = TRANS_LGREEN;
3084 break;
3085 case ENEMY_MESSENGER:
3086 // att [0] = fighter ai
3087 // att [1] = fin angle
3088 // att [2] = motion dir
3089 // att [3] = fin slew_dir
3090 enemy[e].attribute [2] = radians_to_angle(atan2(enemy[e].y_speed, enemy[e].x_speed)) & 1023;
3091 xa = enemy_turn_towards_angle(enemy[e].attribute [1], enemy[e].attribute [2], 16, enemy[e].attribute [3]);
3092 /* if (xa < enemy[e].attribute [1] || (enemy[e].attribute [1] < 100 && xa > (ANGLE_FULL - 100)))
3093 enemy[e].attribute [3] = 1;
3094 else
3095 enemy[e].attribute [3] = -1; // wingfin slew_dir*/
3096 if (enemy[e].counter % 16 == 0)
3097 enemy[e].attribute [3] = 0;
3098 enemy[e].attribute [1] = xa;
3099 if (enemy[e].attribute [0] == FIGHTER_MOVE)
3100 {
3101 if (enemy[e].attribute [4] != -1 && enemy[enemy[e].attribute [4]].type == ENEMY_BOSS3_1 && enemy[e].counter % 97 == 0)
3102 {
3103 enemy[e].x_dest = enemy[enemy[e].attribute [4]].x;
3104 enemy[e].y_dest = enemy[enemy[e].attribute [4]].y;
3105 }
3106 }
3107 return 1; // no exhaust
3108 }
3109 int distance [4] = {10000, 10000, 0, 0};
3110 int angle [4] = {ANGLE_HALF - ANGLE_1_EIGHTH, ANGLE_HALF + ANGLE_1_EIGHTH, 0, 0};
3111 fighter_exhaust(e, ax, ay, distance, angle, base_colour);
3112
3113 return 1;
3114
3115 }
3116
3117 int move_leaper_ai(int e)
3118 {
3119
3120 if (enemy[e].attribute [0] == FIGHTER_MOVE)
3121 {
3122 if (enemy[e].x / 100000 == enemy[e].x_dest / 100000
3123 && enemy[e].y / 100000 == enemy[e].y_dest / 100000)
3124 {
3125 enemy[e].attacking = closest_target(enemy[e].x, enemy[e].y);
3126 if (enemy[e].attacking != ATTACK_NONE)
3127 enemy[e].attribute [0] = FIGHTER_ATTACK;
3128 else
3129 {
3130 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3131 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3132 enemy[e].attacking = ATTACK_NONE;
3133 enemy[e].attribute [0] = FIGHTER_MOVE;
3134 }
3135 }
3136
3137 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y,
3138 enemy[e].x_dest, enemy[e].y_dest,
3139 enemy[e].angle, eclass[enemy[e].type].slew);
3140 }
3141 else
3142 {
3143 if (enemy[e].attacking == ATTACK_NONE
3144 || actor[enemy[e].attacking].in_play == 0)
3145 // assumes second condition not processed if first met.
3146 {
3147 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3148 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3149 enemy[e].attribute [0] = FIGHTER_MOVE;
3150 enemy[e].attacking = ATTACK_NONE;
3151 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y, enemy[e].x_dest, enemy[e].y_dest, enemy[e].angle, eclass[enemy[e].type].slew);
3152 }
3153 }
3154
3155 drag_enemy(e, eclass[enemy[e].type].drag_amount);
3156
3157 // int ax, ay;
3158
3159 if (enemy[e].next_impulse == 0)
3160 {
3161 accelerate_enemy(e, enemy[e].angle, eclass[enemy[e].type].acceleration);
3162 enemy[e].next_impulse = eclass[enemy[e].type].impulse_delay;
3163 simple_cloud_trans(TRANS_YELLOW, enemy[e].x + xpart(enemy[e].angle + ANGLE_HALF, 12000),
3164 enemy[e].y + ypart(enemy[e].angle + ANGLE_HALF, 12000),
3165 enemy[e].x_speed + xpart(enemy[e].angle + ANGLE_HALF, 4000),
3166 enemy[e].y_speed + ypart(enemy[e].angle + ANGLE_HALF, 4000),
3167 900);
3168 simple_cloud_trans(TRANS_ORANGE, enemy[e].x + xpart(enemy[e].angle + ANGLE_HALF, 12000),
3169 enemy[e].y + ypart(enemy[e].angle + ANGLE_HALF, 12000),
3170 enemy[e].x_speed + xpart(enemy[e].angle + ANGLE_HALF, 4000),
3171 enemy[e].y_speed + ypart(enemy[e].angle + ANGLE_HALF, 4000),
3172 1200);
3173 simple_light(enemy[e].x + xpart(enemy[e].angle + ANGLE_HALF, 12000),
3174 enemy[e].y + ypart(enemy[e].angle + ANGLE_HALF, 12000),
3175 enemy[e].x_speed + xpart(enemy[e].angle + ANGLE_HALF, 4000),
3176 enemy[e].y_speed + ypart(enemy[e].angle + ANGLE_HALF, 4000),
3177 1400);
3178
3179
3180 }
3181 else
3182 enemy[e].next_impulse --;
3183
3184
3185 if (enemy[e].attribute [0] == FIGHTER_ATTACK
3186 && enemy[e].attacking != ATTACK_NONE)
3187 {
3188 if (enemy[e].counter % 16 == 0)
3189 enemy[e].slew_dir = 0;
3190 enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, enemy[e].slew_dir * -1);
3191 if (enemy[e].recycle == 0
3192 && hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) < 90000)
3193 {
3194 standard_attack(e, enemy[e].angle);
3195 if (enemy[e].burst_fire <= 1) // experimental!
3196 {
3197 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3198 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3199 enemy[e].attribute [0] = FIGHTER_MOVE;
3200 enemy[e].attacking = ATTACK_NONE;
3201 }
3202 }
3203 }
3204 else
3205 if (enemy[e].recycle == 0 && enemy[e].burst_fire > 0)
3206 {
3207 standard_attack(e, enemy[e].angle);
3208 }
3209
3210
3211 return 1;
3212
3213 }
3214
3215
3216
3217 int move_bomber_ai(int e)
3218 {
3219
3220 if (enemy[e].attribute [0] == FIGHTER_MOVE)
3221 {
3222 if (enemy[e].x / 100000 == enemy[e].x_dest / 100000
3223 && enemy[e].y / 100000 == enemy[e].y_dest / 100000)
3224 {
3225 // enemy[e].attacking = nearby_target(400000, enemy[e].x, enemy[e].y);
3226 enemy[e].attacking = closest_target(enemy[e].x, enemy[e].y);
3227 if (enemy[e].attacking != ATTACK_NONE)
3228 enemy[e].attribute [0] = FIGHTER_ATTACK;
3229 else
3230 {
3231 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3232 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3233 enemy[e].attacking = ATTACK_NONE;
3234 enemy[e].attribute [0] = FIGHTER_MOVE;
3235 }
3236 }
3237
3238 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y,
3239 enemy[e].x_dest, enemy[e].y_dest,
3240 enemy[e].angle, eclass[enemy[e].type].slew);
3241 }
3242 else
3243 {
3244 if (enemy[e].attacking == ATTACK_NONE
3245 || actor[enemy[e].attacking].in_play == 0)
3246 // assumes second condition not processed if first met.
3247 {
3248 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3249 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3250 enemy[e].attribute [0] = FIGHTER_MOVE;
3251 enemy[e].attacking = ATTACK_NONE;
3252 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y, enemy[e].x_dest, enemy[e].y_dest, enemy[e].angle, eclass[enemy[e].type].slew);
3253 }
3254 }
3255
3256 drag_enemy(e, eclass[enemy[e].type].drag_amount);
3257
3258 int ax, ay;
3259 // int x1, y1;
3260 // int passing_colour [5];
3261
3262 ax = xpart(enemy[e].angle, eclass[enemy[e].type].acceleration);
3263 ay = ypart(enemy[e].angle, eclass[enemy[e].type].acceleration);
3264
3265 enemy[e].x_speed += ax;
3266 enemy[e].y_speed += ay;
3267
3268 /* if (enemy[e].type == ENEMY_FIGHTER3)
3269 {
3270 passing_colour [0] = TRANS_LGREY;
3271 passing_colour [1] = TRANS_DGREEN;
3272 passing_colour [2] = TRANS_LGREEN;
3273 }
3274 else*/
3275 /* switch(enemy[e].type)
3276 {
3277 default:
3278 passing_colour [0] = TRANS_DRED;
3279 passing_colour [1] = TRANS_LRED;
3280 passing_colour [2] = TRANS_YELLOW;
3281 break;
3282 }
3283
3284 if (grand(3) == 0)
3285 {
3286 x1 = enemy[e].x + xpart(enemy[e].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_32, 12000);
3287 y1 = enemy[e].y + ypart(enemy[e].angle + ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_32, 12000);
3288 place_rocket_trail(x1 + grand(3001) - 1500, y1 + grand(3001) - 1500, enemy[e].x_speed - ax*10, enemy[e].y_speed - ay*10, 160, passing_colour);
3289 }
3290 if (grand(3) == 0)
3291 {
3292 x1 = enemy[e].x + xpart(enemy[e].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_32, 12000);
3293 y1 = enemy[e].y + ypart(enemy[e].angle + ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_32, 12000);
3294 place_rocket_trail(x1 + grand(3001) - 1500, y1 + grand(3001) - 1500, enemy[e].x_speed - ax*10, enemy[e].y_speed - ay*10, 160, passing_colour);
3295 }
3296 if (grand(3) == 0)
3297 {
3298 x1 = enemy[e].x + xpart(enemy[e].angle + ANGLE_HALF, 12000);
3299 y1 = enemy[e].y + ypart(enemy[e].angle + ANGLE_HALF, 12000);
3300 place_rocket_trail(x1 + grand(3001) - 1500, y1 + grand(3001) - 1500, enemy[e].x_speed - ax*10, enemy[e].y_speed - ay*10, 160, passing_colour);
3301 }
3302 */
3303
3304 if (enemy[e].attribute [0] == FIGHTER_ATTACK
3305 && enemy[e].attacking != ATTACK_NONE)
3306 {
3307 if (enemy[e].counter % 8 == 0)
3308 enemy[e].slew_dir = 0;
3309 enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, enemy[e].slew_dir * -1);
3310 // enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, 0);
3311 if (enemy[e].recycle == 0
3312 && hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) < 150000)
3313 {
3314 standard_attack(e, enemy[e].angle);
3315 if (enemy[e].burst_fire <= 1) // experimental!
3316 {
3317 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3318 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3319 enemy[e].attribute [0] = FIGHTER_MOVE;
3320 enemy[e].attacking = ATTACK_NONE;
3321 }
3322 }
3323 }
3324 else
3325 if (enemy[e].recycle == 0 && enemy[e].burst_fire > 0)
3326 {
3327 standard_attack(e, enemy[e].angle);
3328 }
3329
3330 int base_colour = TRANS_YELLOW;
3331 switch(enemy[e].type)
3332 {
3333 /* case ENEMY_FIGHTER3:
3334 base_colour = TRANS_ORANGE;
3335 break;
3336 case ENEMY_FIGHTER4:
3337 base_colour = TRANS_LGREEN;
3338 break;*/
3339 }
3340 int distance [4] = {12000, 12000, 12000, 0};
3341 int angle [4] = {ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_32, ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_32, ANGLE_HALF, 0};
3342 fighter_exhaust(e, ax, ay, distance, angle, base_colour);
3343
3344
3345 return 1;
3346
3347 }
3348
3349 int move_cruiser_ai(int e)
3350 {
3351
3352 if (enemy[e].x / 100000 == enemy[e].x_dest / 100000
3353 && enemy[e].y / 100000 == enemy[e].y_dest / 100000)
3354 {
3355 // enemy[e].attacking = nearby_target(400000, enemy[e].x, enemy[e].y);
3356 /* enemy[e].attacking = closest_target(enemy[e].x, enemy[e].y);
3357 if (enemy[e].attacking != ATTACK_NONE)
3358 enemy[e].attribute [0] = FIGHTER_ATTACK;
3359 else
3360 {
3361 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3362 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3363 enemy[e].attacking = ATTACK_NONE;
3364 enemy[e].attribute [0] = FIGHTER_MOVE;
3365 }*/
3366 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3367 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3368 }
3369 int angles = enemy[e].angle;
3370
3371 enemy[e].angle = turn_towards_xy(enemy[e].x, enemy[e].y,
3372 enemy[e].x_dest, enemy[e].y_dest,
3373 enemy[e].angle, eclass[enemy[e].type].slew);
3374
3375 angles = enemy[e].angle - angles;//angle_difference(enemy[e].angle, angles);
3376 if (angles >= ANGLE_HALF)
3377 angles -= ANGLE_FULL;
3378
3379 drag_enemy(e, eclass[enemy[e].type].drag_amount);
3380
3381 int ax, ay;
3382 // int x1, y1;
3383 // int passing_colour [5];
3384
3385 ax = xpart(enemy[e].angle, eclass[enemy[e].type].acceleration);
3386 ay = ypart(enemy[e].angle, eclass[enemy[e].type].acceleration);
3387
3388 enemy[e].x_speed += ax;
3389 enemy[e].y_speed += ay;
3390
3391 // if (enemy[e].attribute [0] == FIGHTER_ATTACK
3392 // && enemy[e].attacking != ATTACK_NONE)
3393 // {
3394 // if (enemy[e].counter % 8 == 0)
3395 // enemy[e].slew_dir = 0;
3396 // enemy[e].angle = track_target(e, enemy[e].attacking, eclass[enemy[e].type].slew, enemy[e].slew_dir * -1);
3397
3398
3399 if (enemy[e].counter % 16 == 0)
3400 {
3401 enemy[e].attacking = nearby_target(eclass[enemy[e].type].range, enemy[e].x, enemy[e].y);
3402 }
3403
3404 if (enemy[e].recycle == 0
3405 && hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) < 150000)
3406 {
3407 standard_attack(e, enemy[e].angle);
3408 /* if (enemy[e].burst_fire <= 1) // experimental!
3409 {
3410 enemy[e].x_dest = grand(arena.max_x - 40000) + 20000;
3411 enemy[e].y_dest = grand(arena.max_y - 40000) + 20000;
3412 enemy[e].attribute [0] = FIGHTER_MOVE;
3413 enemy[e].attacking = ATTACK_NONE;
3414 }*/
3415 }
3416 // }
3417 // else
3418
3419 /* if (enemy[e].recycle == 0)// && enemy[e].burst_fire > 0)
3420 {
3421 standard_attack(e, enemy[e].angle);
3422 }*/
3423
3424 int base_colour = TRANS_YELLOW;
3425 int distance [4] = {25000, 25000, 0, 0};
3426 // int angle [4] = {ANGLE_HALF - ANGLE_1_EIGHTH - ANGLE_1_32, ANGLE_HALF + ANGLE_1_EIGHTH + ANGLE_1_32, 0, 0};
3427 int angle [4] = {ANGLE_HALF - ANGLE_1_EIGHTH, ANGLE_HALF + ANGLE_1_EIGHTH, 0, 0};
3428 switch(enemy[e].type)
3429 {
3430 case ENEMY_CRUISER4:
3431 case ENEMY_CRUISER3:
3432 base_colour = TRANS_ORANGE;
3433 distance [2] = 25000;
3434 distance [3] = 25000;
3435 angle [2] = ANGLE_QUARTER;
3436 angle [3] = -ANGLE_QUARTER;
3437 break;
3438 }
3439
3440 fighter_exhaust(e, ax, ay, distance, angle, base_colour);
3441
3442 switch(enemy[e].type)
3443 {
3444 case ENEMY_CRUISER1:
3445 case ENEMY_CRUISER2:
3446 case ENEMY_CRUISER3:
3447 case ENEMY_CRUISER4:
3448 manage_turret(e, 0, xpart(enemy[e].angle + ANGLE_HALF, 18000), ypart(enemy[e].angle + ANGLE_HALF, 18000), angles);
3449 break;
3450 }
3451
3452
3453 return 1;
3454
3455 }
3456
3457
3458 void fighter_exhaust(int e, int ax, int ay, int distance [4], int angle [4], int base_colour)
3459 {
3460 int passing_colour [5];
3461
3462 switch(base_colour)
3463 {
3464 case TRANS_YELLOW:
3465 passing_colour [0] = TRANS_DRED;
3466 passing_colour [1] = TRANS_LRED;
3467 passing_colour [2] = TRANS_YELLOW;
3468 break;
3469 case TRANS_ORANGE:
3470 passing_colour [0] = TRANS_LRED;
3471 passing_colour [1] = TRANS_ORANGE;
3472 passing_colour [2] = TRANS_YELLOW;
3473 break;
3474 case TRANS_LGREEN:
3475 passing_colour [0] = TRANS_DGREEN;
3476 passing_colour [1] = TRANS_LGREEN;
3477 passing_colour [2] = TRANS_YELLOW;
3478 break;
3479 /* case ENEMY_FIGHTER3:
3480 passing_colour [0] = TRANS_LRED;
3481 passing_colour [1] = TRANS_ORANGE;
3482 passing_colour [2] = TRANS_YELLOW;
3483 break;
3484 case ENEMY_FIGHTER4:
3485 passing_colour [0] = TRANS_DGREEN;
3486 passing_colour [1] = TRANS_LGREEN;
3487 passing_colour [2] = TRANS_YELLOW;
3488 break;*/
3489 }
3490
3491 int i, x1, y1;
3492
3493 for (i = 0; i < 4; i ++)
3494 {
3495 if (distance [i] == 0 || grand(2) != 0)
3496 continue;
3497 x1 = enemy[e].x + xpart(enemy[e].angle + angle [i], distance [i]);
3498 y1 = enemy[e].y + ypart(enemy[e].angle + angle [i], distance [i]);
3499 place_rocket_trail(x1 + grand(3001) - 1500, y1 + grand(3001) - 1500, enemy[e].x_speed - ax*10, enemy[e].y_speed - ay*10, 160, passing_colour);
3500 }
3501
3502
3503 }
3504
3505
3506 void run_boss3_1(int e)
3507 {
3508
3509 enemy[e].recycle = 10;
3510 if (enemy[e].counter % 32 != 0)
3511 return;
3512
3513 if (enemy[e].attribute [0] < 10)
3514 {
3515 enemy[e].attribute [0] ++;
3516 return;
3517 }
3518
3519 int i, mess = 0;
3520
3521 for (i = 0; i < NO_ENEMIES; i ++)
3522 {
3523 if (enemy[i].type == ENEMY_MESSENGER)
3524 mess ++;
3525 }
3526
3527 if (mess >= 4)
3528 return;
3529
3530 int special [10];
3531
3532 special [4] = e;
3533
3534 create_enemy(ENEMY_MESSENGER, 0, enemy[e].x, enemy[e].y,
3535 enemy[e].x_speed, enemy[e].y_speed, grand(ANGLE_FULL), 0, special, TARGET_NO);
3536
3537 int passing_colours [5];
3538
3539 passing_colours[0] = TRANS_DBLUE;
3540 passing_colours[1] = TRANS_PURPLE;
3541 passing_colours[2] = TRANS_WHITE;
3542 place_explosion(enemy[e].x, enemy[e].y, 0,0,
3543 700 + crandom(250), passing_colours);
3544 place_burstlet_burst(enemy[e].x, enemy[e].y, enemy[e].x_speed, enemy[e].y_speed, 4 + grand(3), 2, 6, 2000, 2500,
3545 4, passing_colours);
3546
3547
3548 enemy[e].attribute [0] = 0;
3549
3550 }
3551
3552
3553 void run_boss3_3(int e)
3554 {
3555
3556 if (enemy[e].attribute [0] == 0)
3557 return;
3558
3559 enemy[e].attribute [0] --;
3560
3561 if (enemy[e].attribute [0] % 5 != 0)
3562 return;
3563
3564 int i, b = -1, ang;
3565
3566 for (i = 0; i < NO_BULLETS; i ++)
3567 {
3568 if (bullet[i].type == BULLET_SWIRL1)
3569 {
3570 b = i;
3571 break;
3572 }
3573 }
3574
3575 if (b == -1)
3576 return;
3577
3578 int colours [4] = {COLOUR_RED6, COLOUR_ORANGE6, COLOUR_ORANGE8, COLOUR_YELLOW8};
3579
3580 for (i = 0; i < 4; i ++)
3581 {
3582
3583 switch(i)
3584 {
3585 default:
3586 case 0: ang = - ANGLE_QUARTER + ANGLE_1_EIGHTH; break;
3587 case 1: ang = + ANGLE_QUARTER - ANGLE_1_EIGHTH; break;
3588 case 2: ang = ANGLE_QUARTER; break;
3589 case 3: ang = - ANGLE_QUARTER; break;
3590 }
3591
3592 create_bullet(BULLET_SWIRL2,
3593 enemy[e].x + xpart(enemy[e].angle + ang, 35000),
3594 enemy[e].y + ypart(enemy[e].angle + ang, 35000),
3595 enemy[e].x_speed + xpart(enemy[e].angle + ang, 3000),
3596 enemy[e].y_speed + ypart(enemy[e].angle + ang, 3000),
3597 OWNER_ENEMY, 100, 100 + grand(30), 10, enemy[e].angle + ang + ANGLE_QUARTER,
3598 0, 1000, colours, 1,
3599 1290,0,b,36,3);
3600
3601 simple_cloud_trans(TRANS_YELLOW, enemy[e].x + xpart(enemy[e].angle + ang, 35000),
3602 enemy[e].y + ypart(enemy[e].angle + ang, 35000),
3603 0,0,
3604 // enemy[e].x_speed + xpart(enemy[e].angle + ang, 1000),
3605 // enemy[e].y_speed + ypart(enemy[e].angle + ang, 1000),
3606 400);
3607
3608 }
3609
3610 }
3611
3612 /*
3613 int move_firebase(int e)
3614 {
3615
3616 enemy[e].x_speed = 0;
3617 enemy[e].y_speed = 0;
3618
3619 if (enemy[e].counter % 32 == 0)
3620 enemy[e].attacking = closest_target(enemy[e].x, enemy[e].y);
3621
3622 if (enemy[e].attacking != ATTACK_NONE)
3623 {
3624 enemy[e].angle = track_target(e, enemy[e].attacking, 16);
3625 if (enemy[e].recycle == 0)
3626 standard_attack(e, enemy[e].angle);
3627 }
3628
3629 return 1;
3630
3631 }
3632
3633 int move_firebase_turret(int e)
3634 {
3635
3636 if (enemy[e].attribute [ATTRIB_FBTURRET_MAIN_DEAD] == 1)
3637 {
3638 hurt_enemy(e, 99999, OWNER_ENEMY, 0);
3639 return -1;
3640 }
3641
3642 enemy[e].x_speed = 0;
3643 enemy[e].y_speed = 0;
3644
3645 if (enemy[e].counter % 16 == 0)
3646 {
3647 enemy[e].attacking = nearby_target(200000, enemy[e].x, enemy[e].y);
3648 }
3649
3650 if (enemy[e].attacking != ATTACK_NONE)
3651 {
3652 enemy[e].angle = track_target(e, enemy[e].attacking, 16);
3653 if (enemy[e].recycle == 0)
3654 standard_attack(e, enemy[e].angle);
3655 }
3656
3657 return 1;
3658
3659 }
3660 */
3661
3662
3663 void colourise_bullet(int arr [4], int tc)
3664 {
3665 switch(tc)
3666 {
3667 case TRANS_YELLOW:
3668 arr [0] = TRANS_WHITE;
3669 arr [1] = TRANS_YELLOW;
3670 arr [2] = TRANS_ORANGE;
3671 arr [3] = TRANS_LRED;
3672 break;
3673 case TRANS_LBLUE:
3674 arr [0] = TRANS_WHITE;
3675 arr [1] = TRANS_LBLUE;
3676 arr [2] = TRANS_DBLUE;
3677 arr [3] = TRANS_DGREY;
3678 break;
3679 case TRANS_PURPLE:
3680 arr [0] = TRANS_WHITE;
3681 arr [1] = TRANS_PURPLE;
3682 arr [2] = TRANS_LBLUE;
3683 arr [3] = TRANS_DBLUE;
3684 break;
3685 case TRANS_LGREEN:
3686 arr [0] = TRANS_YELLOW;
3687 arr [1] = TRANS_LGREEN;
3688 arr [2] = TRANS_DGREEN;
3689 arr [3] = TRANS_DGREY;
3690 break;
3691 case TRANS_ORANGE:
3692 arr [0] = TRANS_YELLOW;
3693 arr [1] = TRANS_ORANGE;
3694 arr [2] = TRANS_LRED;
3695 arr [3] = TRANS_DRED;
3696 break;
3697 case COLOURISE_GREEN_SEEKER1:
3698 arr [0] = TRANS_YELLOW;
3699 arr [1] = TRANS_YELLOW;
3700 arr [2] = TRANS_LGREEN;
3701 arr [3] = TRANS_LGREEN;
3702 break;
3703 case COLOURISE_GREEN_SEEKER2:
3704 arr [0] = TRANS_LGREEN;
3705 arr [1] = TRANS_LGREEN;
3706 arr [2] = TRANS_LGREEN;
3707 arr [3] = TRANS_DGREEN;
3708 break;
3709 case COLOURISE_BLUE_SEEKER:
3710 arr [0] = TRANS_LBLUE;
3711 arr [1] = TRANS_LBLUE;
3712 arr [2] = TRANS_LBLUE;
3713 arr [3] = TRANS_DBLUE;
3714 break;
3715 case COLOURISE_YELLOW_SEEKER:
3716 arr [0] = TRANS_WHITE;
3717 arr [1] = TRANS_WHITE;
3718 arr [2] = TRANS_YELLOW;
3719 arr [3] = TRANS_ORANGE;
3720 break;
3721
3722 }
3723
3724 }
3725
3726
3727 void standard_attack(int e, int angle)
3728 {
3729
3730 int timer;
3731 int timer_rand = 0;
3732 int special_angle = -1;
3733 int special_angle2 = -1;
3734
3735 int speed = 0;
3736 int speed_rand = 0;
3737 int speed_div = 5;
3738 int mass;
3739 int status;
3740 int displaced = 0;
3741 int colours [4] = {GC_GREEN8, GC_GREEN6, GC_GREEN4, GC_GREEN2};
3742 int colours_for_cloud [5] = {GC_GREEN8, GC_GREEN6, GC_GREEN4, GC_GREEN2, GC_GREEN1};
3743 int firing_distance = 0;
3744 int btype;
3745 int damage;
3746 int angle_rand = 0;
3747 int special1 = 0;
3748 int special2 = 0;
3749 int special3 = 0;
3750 int special4 = 0;
3751 int special5 = 0;
3752 int scatter = 0;
3753
3754 int multiple = 1;
3755 int angle_increment = 0;
3756
3757 int displace_series [4] = {0,0,0,0};
3758
3759 int firing_angle;
3760
3761 int recoil = 0;
3762 int size = 0;
3763 // int t;
3764
3765 if (enemy[e].burst_fire == 1)
3766 enemy[e].burst_fire = 0;
3767
3768 switch(enemy[e].type)
3769 {
3770 case ENEMY_BEAMER1:
3771 enemy[e].attribute [0] = 150;
3772 enemy[e].recycle = 250;
3773 return;
3774 // NOTE return! not break
3775 case ENEMY_BEAMER2:
3776 enemy[e].attribute [0] = 150;
3777 enemy[e].recycle = 230;
3778 return;
3779 // NOTE return! not break
3780 case ENEMY_CIRCLER1:
3781 if (enemy[e].attacking != 0 && enemy[e].attacking != 1)
3782 return;
3783 if (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) > 350000)
3784 return;
3785 // create_cloud(
3786 create_bullet(BULLET_CIRCLER, actor[enemy[e].attacking].x + actor[enemy[e].attacking].x_speed * (30 + grand(30)) + grand(25001) - 12500,
3787 actor[enemy[e].attacking].y + actor[enemy[e].attacking].y_speed * (30 + grand(30)) + grand(25001) - 12500,
3788 0, 0, OWNER_ENEMY,
3789 0, 50, 0, 0, // 50 was 66
3790 0, 0, colours, 1, special1,special2,special3,special4,special5);
3791 enemy[e].recycle = 80;
3792 enemy[e].attribute [0] = 50; // was 66
3793 return;
3794 // NOTE return! not break
3795 case ENEMY_GUARDIAN1:
3796 btype = BULLET_BALL1;
3797 damage = 150;
3798 timer = 40;
3799 timer_rand = 20;
3800 mass = 10;
3801 speed = 5000;
3802 /* colours [0] = GC_GREEN8;
3803 colours [1] = GC_GREEN6;
3804 colours [2] = GC_GREEN4;
3805 colours [3] = GC_GREEN2;*/
3806 firing_distance = 14000;
3807 enemy[e].recycle = 80;
3808 speed_div = 3;
3809 multiple = 1;
3810 // angle_increment = ANGLE_1_EIGHTH;
3811 recoil = 700;
3812 size = 3000;
3813 enemy_soundf(e, NWAV_BALL1, 500 + grand(30));
3814 break;
3815 case ENEMY_GUARDIAN2:
3816 btype = BULLET_TWIRLY1;
3817 size = 7000;
3818 damage = 200;
3819 timer = 40;
3820 timer_rand = 30;
3821 mass = 25;
3822 speed = 6000;
3823 colours [0] = TRANS_YELLOW;
3824 colours [1] = TRANS_ORANGE;
3825 colours [2] = TRANS_LRED;
3826 colours [3] = TRANS_DRED;
3827 firing_distance = 14000;
3828 enemy[e].recycle = 60;
3829 speed_div = 3;
3830 multiple = 1;
3831 // angle_increment = ANGLE_1_EIGHTH;
3832 recoil = 700;
3833 special1 = grand(2);
3834 enemy_soundf(e, NWAV_BALL1, 400 + grand(30));
3835 break;
3836 case ENEMY_GUARDIAN3:
3837 btype = BULLET_TWISTY;
3838 size = 5000; // see bullet.c; this changes
3839 damage = 200;
3840 timer = 35;
3841 timer_rand = 15;
3842 mass = 40;
3843 speed = 7000;
3844 colours [0] = TRANS_YELLOW;
3845 colours [1] = TRANS_ORANGE;
3846 colours [2] = TRANS_LRED;
3847 colours [3] = TRANS_DRED;
3848 firing_distance = 14000;
3849 enemy[e].recycle = 50;
3850 speed_div = 3;
3851 multiple = 1;
3852 recoil = 700;
3853 special1 = 0;
3854 special2 = 1;
3855 if (grand(2) == 0)
3856 special2 = -1;
3857 enemy_soundf(e, NWAV_BALL1, 600 + grand(30));
3858 break;
3859 case ENEMY_GUARDIAN4:
3860 btype = BULLET_TWIRLY2;
3861 size = 5000;
3862 damage = 250;
3863 timer = 43;
3864 timer_rand = 30;
3865 mass = 40;
3866 speed = 7000;
3867 colours [0] = TRANS_WHITE;
3868 colours [1] = TRANS_YELLOW;
3869 colours [2] = TRANS_ORANGE;
3870 colours [3] = TRANS_LRED;
3871 firing_distance = 14000;
3872 enemy[e].recycle = 55;
3873 speed_div = 3;
3874 multiple = 1;
3875 recoil = 700;
3876 enemy_soundf(e, NWAV_BALL1, 700 + grand(30));
3877 break;
3878 case ENEMY_GUARDIAN5:
3879 btype = BULLET_TWIRLY3;
3880 size = 12000;
3881 damage = 400;
3882 timer = 43;
3883 timer_rand = 30;
3884 mass = 50;
3885 speed = 6000;
3886 colours [0] = TRANS_YELLOW;
3887 colours [1] = TRANS_LGREEN;
3888 colours [2] = TRANS_DGREEN;
3889 colours [3] = TRANS_DGREEN;
3890 firing_distance = 14000;
3891 enemy[e].recycle = 60;
3892 speed_div = 3;
3893 multiple = 1;
3894 recoil = 1200;
3895 special2 = 0;
3896 if (grand(2) == 0)
3897 special2 = 1;
3898 enemy_soundf(e, NWAV_BALL1, 300 + grand(10));
3899 break;
3900 // case ENEMY_HEAD1_EYE1:
3901 //case ENEMY_HEAD1:
3902 case ENEMY_CURVE1:
3903 btype = BULLET_BLAST;
3904 damage = 200;
3905 timer = 150;
3906 timer_rand = 20;
3907 mass = 40;
3908 speed = 3000;
3909 colours [0] = TRANS_YELLOW;
3910 colours [1] = TRANS_ORANGE;
3911 colours [2] = TRANS_LRED;
3912 colours [3] = TRANS_DRED;
3913 firing_distance = 1000;
3914 enemy[e].recycle = 150;
3915 speed_div = 3;
3916 multiple = 2;
3917 displaced = 12;
3918 displace_series [0] = 1;
3919 displace_series [1] = -1;
3920 recoil = 1200;
3921 enemy_soundf(e, NWAV_LZAP, 900 + grand(100));
3922 size = 2000;
3923 break;
3924 case ENEMY_CURVE2:
3925 btype = BULLET_LINE_PULSE;
3926 damage = 250;
3927 timer = 150;
3928 timer_rand = 20;
3929 mass = 40;
3930 speed = 6000;
3931 colours [0] = TRANS_YELLOW;
3932 colours [1] = TRANS_YELLOW;
3933 colours [2] = TRANS_ORANGE;
3934 colours [3] = TRANS_LRED;
3935 /* colours [0] = TRANS_LBLUE;
3936 colours [1] = TRANS_LBLUE;
3937 colours [2] = TRANS_DBLUE;
3938 colours [3] = TRANS_DGREY;*/
3939 firing_distance = 1000;
3940 enemy[e].recycle = 100;
3941 speed_div = 3;
3942 multiple = 2;
3943 displaced = 12;
3944 displace_series [0] = 1;
3945 displace_series [1] = -1;
3946 recoil = 1200;
3947 enemy_soundf(e, NWAV_LZAP, 400 + grand(50));
3948 // enemy_soundf(e, NWAV_MULTI, 400 + grand(10));
3949 size = 3000;
3950 break;
3951 case ENEMY_CURVE3:
3952 btype = BULLET_CURVEY;
3953 damage = 300;
3954 timer = 150;
3955 timer_rand = 20;
3956 mass = 40;
3957 speed = 9000;
3958 colours [0] = TRANS_WHITE;
3959 colours [1] = TRANS_LGREY;
3960 colours [2] = TRANS_DGREY;
3961 colours [3] = TRANS_DGREY;
3962 /* colours [0] = TRANS_LBLUE;
3963 colours [1] = TRANS_LBLUE;
3964 colours [2] = TRANS_DBLUE;
3965 colours [3] = TRANS_DGREY;*/
3966 firing_distance = 1000;
3967 enemy[e].recycle = 100;
3968 speed_div = 3;
3969 multiple = 2;
3970 displaced = 12;
3971 displace_series [0] = 1;
3972 displace_series [1] = -1;
3973 recoil = 1200;
3974 enemy_soundf(e, NWAV_LZAP, 200 + grand(20));
3975 // enemy_soundf(e, NWAV_MULTI, 400 + grand(10));
3976 size = 3000;
3977 break;
3978 case ENEMY_MULTI1:
3979 btype = BULLET_BALL1;
3980 damage = 150;
3981 timer = 40;
3982 timer_rand = 10;
3983 mass = 10;
3984 speed = 4000;
3985 /* colours [0] = GC_GREEN8;
3986 colours [1] = GC_GREEN6;
3987 colours [2] = GC_GREEN4;
3988 colours [3] = GC_GREEN2;*/
3989 firing_distance = 10000;
3990 enemy[e].recycle = 110;
3991 speed_div = 3;
3992 multiple = 3;
3993 angle_increment = ANGLE_1_EIGHTH;
3994 angle -= ANGLE_1_EIGHTH;
3995 recoil = 900;
3996 size = 3000;
3997 enemy_soundf(e, NWAV_MULTI, 500 + grand(10));
3998 break;
3999 case ENEMY_MULTI2:
4000 btype = BULLET_BLAST;
4001 damage = 200;
4002 timer = 60;
4003 timer_rand = 20;
4004 mass = 40;
4005 speed = 5000;
4006 colours [0] = TRANS_YELLOW;
4007 colours [1] = TRANS_ORANGE;
4008 colours [2] = TRANS_LRED;
4009 colours [3] = TRANS_DRED;
4010 firing_distance = 8000;
4011 enemy[e].recycle = 90;
4012 speed_div = 3;
4013 multiple = 4;
4014 angle_increment = ANGLE_1_SIXTEENTH;
4015 angle -= (ANGLE_1_SIXTEENTH + ANGLE_1_32);
4016 recoil = 1200;
4017 enemy_soundf(e, NWAV_MULTI, 400 + grand(10));
4018 size = 2000;
4019 break;
4020 case ENEMY_MULTI3:
4021 btype = BULLET_BLAST;
4022 damage = 250;
4023 timer = 60;
4024 timer_rand = 20;
4025 mass = 40;
4026 speed = 6000;
4027 colours [0] = TRANS_YELLOW;
4028 colours [1] = TRANS_LGREEN;
4029 colours [2] = TRANS_DGREEN;
4030 colours [3] = TRANS_DGREY;
4031 firing_distance = 11000;
4032 enemy[e].recycle = 100;
4033 speed_div = 3;
4034 multiple = 5;
4035 angle_increment = ANGLE_1_SIXTEENTH;
4036 angle -= ANGLE_1_EIGHTH;//(ANGLE_1_SIXTEENTH + ANGLE_1_32);
4037 recoil = 1800;
4038 enemy_soundf(e, NWAV_MULTI, 300 + grand(10));
4039 size = 2000;
4040 break;
4041 case ENEMY_PUFFER1:
4042 btype = BULLET_BURNING_SPIRIT;
4043 damage = 150;
4044 timer = 40;
4045 timer_rand = 20;
4046 mass = 10;
4047 speed = 6000;
4048 firing_distance = 11000;
4049 enemy[e].recycle = 90;
4050 speed_div = 3;
4051 multiple = 1;
4052 colours_for_cloud [0] = TRANS_DRED;
4053 colours_for_cloud [1] = TRANS_LRED;
4054 colours_for_cloud [2] = TRANS_YELLOW;
4055 recoil = 1200;
4056 enemy_soundf(e, NWAV_PUFF, 900 + grand(200));
4057 break;
4058 case ENEMY_PUFFER2:
4059 btype = BULLET_BURST;
4060 damage = 1;
4061 size = 3000;
4062 timer = 30;
4063 timer_rand = 35;
4064 mass = 10;
4065 speed = 7000;
4066 firing_distance = 14000;
4067 enemy[e].recycle = 110;
4068 speed_div = 3;
4069 multiple = 1;
4070 colours_for_cloud [0] = TRANS_DRED;
4071 colours_for_cloud [1] = TRANS_LRED;
4072 colours_for_cloud [2] = TRANS_YELLOW;
4073 recoil = 1700;
4074 enemy_soundf(e, NWAV_PUFF, 700 + grand(150));
4075 break;
4076 case ENEMY_PUFFER3:
4077 btype = BULLET_PUFFY3;
4078 damage = 1;
4079 size = 3000;
4080 timer = 30;
4081 timer_rand = 35;
4082 mass = 10;
4083 speed = 7000;
4084 firing_distance = 11000;
4085 enemy[e].recycle = 110;
4086 speed_div = 3;
4087 multiple = 1;
4088 colours_for_cloud [0] = TRANS_DGREEN;
4089 colours_for_cloud [1] = TRANS_LGREEN;
4090 colours_for_cloud [2] = TRANS_YELLOW;
4091 colours [0] = TRANS_DGREEN;
4092 colours [1] = TRANS_LGREEN;
4093 colours [2] = TRANS_YELLOW;
4094 colours [3] = TRANS_YELLOW;
4095 recoil = 1700;
4096 enemy_soundf(e, NWAV_PUFF, 1300 + grand(200));
4097 break;
4098 case ENEMY_PUFFER4:
4099 btype = BULLET_PUFFY4;
4100 damage = 1;
4101 size = 3000;
4102 timer = 30;
4103 timer_rand = 35;
4104 mass = 10;
4105 speed = 8000;
4106 firing_distance = 20000;
4107 enemy[e].recycle = 110;
4108 speed_div = 3;
4109 multiple = 1;
4110 /* colours [0] = COLOUR_BLUE8;
4111 colours [1] = COLOUR_BLUE7;
4112 colours [2] = COLOUR_BLUE6;
4113 colours [3] = COLOUR_BLUE5;*/
4114 colours [0] = COLOUR_GREY6;
4115 colours [1] = COLOUR_BLUE8;
4116 colours [2] = COLOUR_BLUE7;
4117 colours [3] = COLOUR_BLUE5;
4118 colours_for_cloud [0] = TRANS_DBLUE;
4119 colours_for_cloud [1] = TRANS_LBLUE;
4120 colours_for_cloud [2] = TRANS_WHITE;
4121 // colours [4] = COLOUR_BLUE4;
4122 recoil = 1700;
4123 enemy_soundf(e, NWAV_PUFF, 500 + grand(50));
4124 break;
4125 case ENEMY_SHADOW1:
4126 btype = BULLET_CRYSTAL1;
4127 damage = 1;
4128 size = 6000;
4129 timer = 30;
4130 timer_rand = 35;
4131 mass = 10;
4132 speed = 8000;
4133 firing_distance = 12000;
4134 speed_div = 3;
4135 multiple = 1;
4136 colours [0] = TRANS_YELLOW;
4137 colours [1] = TRANS_ORANGE;
4138 colours [2] = TRANS_LRED;
4139 colours [3] = TRANS_DRED;
4140 recoil = 1100;
4141 scatter = ANGLE_1_32;
4142 if (enemy[e].burst_fire > 0)
4143 {
4144 enemy[e].recycle = 7;
4145 enemy[e].burst_fire --;
4146 }
4147 else
4148 {
4149 enemy[e].recycle = 150 + grand(150);
4150 enemy[e].burst_fire = 3; // also in creation
4151 }
4152 // enemy[e].attribute [0] = 60;
4153 enemy_soundf(e, NWAV_SHADOW, 1500 + grand(50));
4154 break;
4155 case ENEMY_SHADOW2:
4156 btype = BULLET_CRYSTAL2;
4157 damage = 1;
4158 size = 6000;
4159 timer = 30;
4160 timer_rand = 35;
4161 mass = 10;
4162 speed = 9000;
4163 firing_distance = 12000;
4164 speed_div = 3;
4165 multiple = 1;
4166 colours [0] = TRANS_WHITE;
4167 colours [1] = TRANS_LBLUE;
4168 colours [2] = TRANS_LBLUE;
4169 colours [3] = TRANS_DBLUE;
4170 recoil = 1100;
4171 scatter = ANGLE_1_32;
4172 if (enemy[e].burst_fire > 0)
4173 {
4174 enemy[e].recycle = 5;
4175 enemy[e].burst_fire --;
4176 }
4177 else
4178 {
4179 enemy[e].recycle = 150 + grand(150);
4180 enemy[e].burst_fire = 3; // also in creation
4181 }
4182 // enemy[e].attribute [0] = 60;
4183 enemy_soundf(e, NWAV_SHADOW, 1300 + grand(50));
4184 break;
4185 case ENEMY_DISRUPTER1:
4186 case ENEMY_DISRUPTER2:
4187 case ENEMY_DISRUPTER3:
4188 case ENEMY_OVERDISRUPTER:
4189 firing_distance = 12000;
4190 if (enemy[e].type == ENEMY_OVERDISRUPTER)
4191 firing_distance = 26000;
4192 if (enemy[e].type == ENEMY_DISRUPTER1 || (enemy[e].type == ENEMY_OVERDISRUPTER && grand(3) == 0))
4193 {
4194 btype = BULLET_DISRUPT2;
4195 damage = 1;
4196 size = 3000;
4197 timer = 100;
4198 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4199 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 4000);
4200 timer_rand = 5;
4201 mass = 10;
4202 speed = 4000;
4203 enemy[e].recycle = 120;
4204 colours_for_cloud [0] = TRANS_REVERSE;
4205 speed_div = 3;
4206 multiple = 1;
4207 recoil = -1200;
4208 enemy_soundf(e, NWAV_CHIME, 1000 + grand(50));
4209 break;
4210 }
4211 if (enemy[e].type == ENEMY_DISRUPTER2 || (enemy[e].type == ENEMY_OVERDISRUPTER && grand(2) == 0))
4212 {
4213 btype = BULLET_DISRUPT1;
4214 damage = 1;
4215 size = 3000;
4216 timer = 100;
4217 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4218 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 3000);
4219 timer_rand = 5;
4220 mass = 10;
4221 speed = 3000;
4222 enemy[e].recycle = 120;
4223 // colours_for_cloud [0] = TRANS_REVERSE;
4224 speed_div = 3;
4225 multiple = 1;
4226 recoil = 1200;
4227 enemy_soundf(e, NWAV_CYMBAL, 1000 + grand(50));
4228 break;
4229 }
4230 btype = BULLET_DISRUPT3;
4231 damage = 1;
4232 size = 3000;
4233 timer = 100;
4234 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4235 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 7000);
4236 timer_rand = 5;
4237 mass = 10;
4238 speed = 7000;
4239 colours_for_cloud [0] = TRANS_DARKEN;
4240 enemy[e].recycle = 120;
4241 speed_div = 3;
4242 multiple = 1;
4243 recoil = 1200;
4244 enemy_soundf(e, NWAV_CHIME, 400 + grand(50));
4245 break;
4246 case ENEMY_BRACKET1:
4247 recoil = 300;
4248 case ENEMY_DEFENDER2_TURRET1:
4249 btype = BULLET_GREEN_BLAT;
4250 damage = DAM_GREEN_BLAT;
4251 timer = 30;
4252 timer_rand = 15;
4253 mass = 10;
4254 speed = 10000;
4255 firing_distance = 1000;
4256 // enemy[e].recycle = 90;
4257 speed_div = 3;
4258 multiple = 2;
4259 displaced = 6;
4260 displace_series [0] = 1;
4261 displace_series [1] = -1;
4262 colours_for_cloud [0] = TRANS_DGREEN;
4263 colours_for_cloud [1] = TRANS_LGREEN;
4264 colours_for_cloud [2] = TRANS_YELLOW;
4265 if (enemy[e].burst_fire > 0)
4266 {
4267 enemy[e].recycle = 7;
4268 enemy[e].burst_fire --;
4269 }
4270 else
4271 {
4272 enemy[e].recycle = 160;
4273 enemy[e].burst_fire = 3 + grand(3); // also in creation
4274 }
4275 enemy_soundf(e, NWAV_GBLAT, 400);
4276 break;
4277 case ENEMY_BRACKET2:
4278 recoil = 150;
4279 case ENEMY_DEFENDER2_TURRET2:
4280 btype = BULLET_GREEN_BLAT;
4281 damage = DAM_GREEN_BLAT;
4282 timer = 30;
4283 timer_rand = 15;
4284 mass = 10;
4285 speed = 13000;
4286 firing_distance = 2000;
4287 // enemy[e].recycle = 90;
4288 speed_div = 3;
4289 multiple = 1;
4290 displaced = 5;
4291 displace_series [0] = 1;
4292 if (enemy[e].burst_fire % 2 == 0)
4293 {
4294 displace_series [0] = -1;
4295 enemy[e].angle -= grand(ANGLE_1_SIXTEENTH);
4296 }
4297 else
4298 enemy[e].angle += grand(ANGLE_1_SIXTEENTH);
4299 colours_for_cloud [0] = TRANS_DGREEN;
4300 colours_for_cloud [1] = TRANS_LGREEN;
4301 colours_for_cloud [2] = TRANS_YELLOW;
4302 if (enemy[e].burst_fire > 0)
4303 {
4304 enemy[e].recycle = 4;
4305 enemy[e].burst_fire --;
4306 }
4307 else
4308 {
4309 enemy[e].recycle = 140;
4310 enemy[e].burst_fire = 6 + grand(6); // also in creation
4311 }
4312 enemy_soundf(e, NWAV_GBLAT, 500);
4313 break;
4314 case ENEMY_BRACKET4:
4315 case ENEMY_BRACKET3:
4316 recoil = 100;
4317 // case ENEMY_DEFENDER2_TURRET3:
4318 btype = BULLET_GREEN_BLAT;
4319 damage = DAM_GREEN_BLAT;
4320 timer = 40;
4321 timer_rand = 15;
4322 mass = 10;
4323 speed = 12000;
4324 firing_distance = 2000;
4325 speed_div = 3;
4326 multiple = 2;
4327 displaced = 6;
4328 displace_series [0] = 1;
4329 displace_series [1] = -1;
4330 colours_for_cloud [0] = TRANS_DGREEN;
4331 colours_for_cloud [1] = TRANS_LGREEN;
4332 colours_for_cloud [2] = TRANS_YELLOW;
4333 enemy[e].recycle = 15;
4334 enemy_soundf(e, NWAV_GBLAT, 400);
4335 break;
4336 case ENEMY_BRACKET5:
4337 btype = BULLET_YELLOW_FLAK;
4338 damage = 100;
4339 timer = 4;
4340 timer_rand = 19;
4341 mass = 10;
4342 speed = 9000;
4343 firing_distance = 2000;
4344 speed_div = 3;
4345 multiple = 1;
4346 colours_for_cloud [0] = TRANS_ORANGE;
4347 colours_for_cloud [1] = TRANS_YELLOW;
4348 colours_for_cloud [2] = TRANS_WHITE;
4349 recoil = 300;
4350 enemy[e].recycle = 15;
4351 // enemy[e].attribute [0] = 7;
4352 speed_div = 3;
4353 multiple = 2;
4354 displaced = 6;
4355 displace_series [0] = 1;
4356 displace_series [1] = -1;
4357 enemy_soundf(e, NWAV_GBLAT, 300);
4358 break;
4359 case ENEMY_TRIANGLER1:
4360 recoil = 100;
4361 btype = BULLET_TRI1;
4362 damage = 1;
4363 timer = 60;
4364 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4365 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 6500) + 3;
4366 timer_rand = 15;
4367 mass = 10;
4368 speed = 2000;
4369 firing_distance = 15000;
4370 speed_div = 3;
4371 multiple = 1;
4372 displaced = 15;
4373 displace_series [0] = 1;
4374 enemy[e].attribute [1] = 13;
4375 enemy[e].attribute [2] = 7;
4376 if (enemy[e].attribute [0] == 1)
4377 {
4378 displace_series [0] = -1;
4379 enemy[e].attribute [0] = 0;
4380 // enemy[e].attribute [1] = 5;
4381 // enemy[e].attribute [2] = 5;
4382 }
4383 else
4384 {
4385 enemy[e].attribute [0] = 1;
4386 // enemy[e].attribute [1] = 5;
4387 // enemy[e].attribute [2] = 5;
4388 }
4389 colours_for_cloud [0] = TRANS_DRED;
4390 colours_for_cloud [1] = TRANS_ORANGE;
4391 colours_for_cloud [2] = TRANS_YELLOW;
4392 enemy[e].recycle = 65;
4393 size = 6000;
4394 enemy_soundf(e, NWAV_LAUNCH, 400);
4395 break;
4396 case ENEMY_TRIANGLER2:
4397 recoil = 100;
4398 btype = BULLET_TRI2;
4399 damage = 1;
4400 timer = 60;
4401 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4402 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 7000) + 3;
4403 timer_rand = 15;
4404 mass = 10;
4405 speed = 2000;
4406 firing_distance = 15000;
4407 speed_div = 3;
4408 multiple = 1;
4409 displaced = 17;
4410 displace_series [0] = 1;
4411 enemy[e].attribute [1] = 13;
4412 enemy[e].attribute [2] = 7;
4413 if (enemy[e].attribute [0] == 1)
4414 {
4415 displace_series [0] = -1;
4416 enemy[e].attribute [0] = 0;
4417 // enemy[e].attribute [1] = 5;
4418 // enemy[e].attribute [2] = 5;
4419 }
4420 else
4421 {
4422 enemy[e].attribute [0] = 1;
4423 // enemy[e].attribute [1] = 5;
4424 // enemy[e].attribute [2] = 5;
4425 }
4426 colours_for_cloud [0] = TRANS_DBLUE;
4427 colours_for_cloud [1] = TRANS_LBLUE;
4428 colours_for_cloud [2] = TRANS_WHITE;
4429 enemy[e].recycle = 75;
4430 size = 6000;
4431 enemy_soundf(e, NWAV_LAUNCH, 300);
4432 break;
4433 case ENEMY_TRIANGLER3:
4434 recoil = 100;
4435 btype = BULLET_TRI3;
4436 damage = 1;
4437 timer = 60;
4438 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4439 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 8000) + 3;
4440 timer_rand = 15;
4441 mass = 10;
4442 speed = 2000;
4443 firing_distance = 15000;
4444 speed_div = 3;
4445 multiple = 1;
4446 displaced = 16;
4447 displace_series [0] = 1;
4448 enemy[e].attribute [1] = 13;
4449 enemy[e].attribute [2] = 7;
4450 if (enemy[e].attribute [0] == 1)
4451 {
4452 displace_series [0] = -1;
4453 enemy[e].attribute [0] = 0;
4454 // enemy[e].attribute [1] = 5;
4455 // enemy[e].attribute [2] = 5;
4456 }
4457 else
4458 {
4459 enemy[e].attribute [0] = 1;
4460 // enemy[e].attribute [1] = 5;
4461 // enemy[e].attribute [2] = 5;
4462 }
4463 colours_for_cloud [0] = TRANS_ORANGE;
4464 colours_for_cloud [1] = TRANS_YELLOW;
4465 colours_for_cloud [2] = TRANS_WHITE;
4466 enemy[e].recycle = 99;
4467 size = 6000;
4468 enemy_soundf(e, NWAV_LAUNCH, 200);
4469 break;
4470 case ENEMY_OVERTRIANGLER:
4471 recoil = 100;
4472 btype = BULLET_OVERTRI;
4473 damage = 1;
4474 timer = 60;
4475 if (enemy[e].attacking == 0 || enemy[e].attacking == 1)
4476 timer = (hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x) / 5000) + 3;
4477 timer_rand = 15;
4478 mass = 10;
4479 speed = 2000;
4480 firing_distance = 15000;
4481 speed_div = 3;
4482 multiple = 1;
4483 displaced = 26;
4484 displace_series [0] = 1;
4485 enemy[e].attribute [1] = 13;
4486 enemy[e].attribute [2] = 7;
4487 if (enemy[e].attribute [0] == 1)
4488 {
4489 displace_series [0] = -1;
4490 enemy[e].attribute [0] = 0;
4491 }
4492 else
4493 {
4494 enemy[e].attribute [0] = 1;
4495 }
4496 colours_for_cloud [0] = TRANS_LGREEN;
4497 colours_for_cloud [1] = TRANS_YELLOW;
4498 colours_for_cloud [2] = TRANS_WHITE;
4499 enemy[e].recycle = 65;
4500 size = 9000;
4501 enemy_soundf(e, NWAV_LAUNCH, 150);
4502 break;
4503 case ENEMY_ATTRACTOR:
4504 btype = BULLET_ATTRACTOR_LINE;
4505 damage = 0;//DAM_WORMS1;
4506 timer = 80;
4507 timer_rand = 30;
4508 mass = 60;
4509 speed = 0;//12000;
4510 firing_distance = 15000 + grand(60000);
4511 enemy[e].recycle = 1;
4512 speed_div = 3;
4513 multiple = 1;
4514 angle = grand(ANGLE_FULL);
4515 // displaced = grand(110);
4516 // displace_series [0] = 1;
4517 // angle_increment = 102;//ANGLE_1_SIXTEENTH;
4518 colours [0] = TRANS_DBLUE;
4519 colours [1] = TRANS_LBLUE;
4520 colours [2] = TRANS_PURPLE;
4521 colours [3] = TRANS_WHITE;
4522 recoil = 0;
4523 special2 = e;
4524 break;
4525 case ENEMY_WORMER1:
4526 btype = BULLET_EVIL_EEL;
4527 damage = DAM_WORMS1;
4528 timer = 80;
4529 timer_rand = 30;
4530 mass = 60;
4531 speed = 6000;
4532 firing_distance = 11000;
4533 enemy[e].recycle = 120;
4534 speed_div = 3;
4535 multiple = 10;
4536 angle_increment = 102;//ANGLE_1_SIXTEENTH;
4537 colours [0] = COLOUR_ORANGE4;
4538 colours [1] = COLOUR_ORANGE6;
4539 colours [2] = COLOUR_YELLOW6;
4540 colours [3] = COLOUR_YELLOW8;
4541 recoil = 0;
4542 special2 = 64;
4543 if (grand(2) == 0)
4544 special2 = -64;
4545 special3 = 3 + grand(3);
4546 special1 = 900;
4547 enemy_soundf(e, NWAV_WHINE, 1000 + grand(50));
4548 break;
4549 case ENEMY_WORMER2:
4550 btype = BULLET_SQUIRMY;
4551 damage = DAM_WORMS2;
4552 timer = 80;
4553 timer_rand = 30;
4554 mass = 80;
4555 speed = 6000;
4556 firing_distance = 11000;
4557 enemy[e].recycle = 90;
4558 speed_div = 3;
4559 multiple = 10;
4560 angle_increment = 102;//ANGLE_1_SIXTEENTH;
4561 colours [0] = COLOUR_GREEN4;
4562 colours [1] = COLOUR_GREEN6;
4563 colours [2] = COLOUR_YELLOW6;
4564 colours [3] = COLOUR_YELLOW8;
4565 recoil = 0;
4566 special2 = 94;
4567 // if (grand(2) == 0)
4568 // special2 = -74;
4569 special4 = 8;
4570 special3 = special4;
4571 special1 = 1500;
4572 enemy_soundf(e, NWAV_WHINE, 700 + grand(50));
4573 break;
4574 case ENEMY_WORMER3:
4575 btype = BULLET_EVIL_WORM;
4576 damage = DAM_WORMS2;
4577 timer = 80;
4578 timer_rand = 0;
4579 mass = 80;
4580 speed = 6000;
4581 firing_distance = 11000;
4582 enemy[e].recycle = 120;
4583 speed_div = 3;
4584 multiple = 6;
4585 angle_increment = ANGLE_FULL / 6;
4586 colours [0] = COLOUR_RED5;
4587 colours [1] = COLOUR_ORANGE6;
4588 colours [2] = COLOUR_YELLOW6;
4589 colours [3] = COLOUR_YELLOW8;
4590 /* colours [0] = COLOUR_BLUE5;
4591 colours [1] = COLOUR_BLUE6;
4592 colours [2] = COLOUR_GREEN6;
4593 colours [3] = COLOUR_YELLOW8;*/
4594 recoil = 0;
4595 special1 = 390; // accel
4596 special2 = 60; // time of lock-on
4597 special3 = -1; // lock
4598 special4 = 6; // turn
4599 enemy_soundf(e, NWAV_WHINE, 500 + grand(50));
4600 break;
4601 case ENEMY_WORMER4:
4602 btype = BULLET_TURN_WORM;
4603 damage = DAM_WORMS2;
4604 timer = 100 + grand(40); // deliberately not timer_rand
4605 timer_rand = 0;
4606 mass = 80;
4607 speed = 6000;
4608 firing_distance = 11000;
4609 enemy[e].recycle = 120;
4610 speed_div = 3;
4611 multiple = 8;
4612 angle_increment = ANGLE_FULL / 8;
4613 colours [0] = COLOUR_ORANGE5;
4614 colours [1] = COLOUR_YELLOW6;
4615 colours [2] = COLOUR_YELLOW7;
4616 colours [3] = COLOUR_WHITE;
4617 recoil = 0;
4618 special1 = 1100 + grand(300); // accel
4619 special2 = 5 + grand(9); // turn
4620 if (grand(2) == 0)
4621 special2 *= -1;
4622 enemy_soundf(e, NWAV_WHINE, 400 + grand(50));
4623 break;
4624 /* case ENEMY_HEAD1:
4625 btype = BULLET_YELLOW_PULSE;
4626 damage = 1;
4627 timer = 80;
4628 timer_rand = 30;
4629 mass = 60;
4630 speed = 7000;
4631 firing_distance = 11000;
4632 enemy[e].recycle = 150;
4633 speed_div = 3;
4634 multiple = 8;
4635 angle_increment = ANGLE_1_EIGHTH;
4636 colours [0] = COLOUR_YELLOW8;
4637 // colours [1] = COLOUR_ORANGE6;
4638 // colours [2] = COLOUR_YELLOW6;
4639 // colours [3] = COLOUR_YELLOW8;
4640 recoil = 0;
4641 special1 = 250; // damage
4642 special2 = 200; // visible explosion size
4643 special3 = 50000; // blast size
4644 special4 = 500; // blast force
4645 break;
4646 case ENEMY_HEAD1_EYE1:
4647 btype = BULLET_CIRCLES;
4648 damage = 200;
4649 timer = 120;
4650 timer_rand = 30;
4651 mass = 120;
4652 speed = 5000;
4653 firing_distance = 4000;
4654 enemy[e].recycle = 90 + grand(70);
4655 speed_div = 3;
4656 multiple = 1;
4657 angle_increment = 0;
4658 colours [0] = COLOUR_GREEN8;
4659 recoil = 500;
4660 size = 5000;
4661 break;*/
4662 case ENEMY_BRACKET4_TURRET:
4663 // case ENEMY_HEAD1_EYE2:
4664 btype = BULLET_SHOCK;
4665 damage = 100;
4666 timer = 80;
4667 timer_rand = 30;
4668 mass = 20;
4669 speed = 15000;
4670 firing_distance = 4000;
4671 enemy[e].recycle = 60 + grand(50);
4672 speed_div = 3;
4673 multiple = 1;
4674 angle_increment = 0;
4675 colours [0] = COLOUR_ORANGE4;
4676 colours [1] = COLOUR_ORANGE6;
4677 colours [2] = COLOUR_YELLOW6;
4678 colours [3] = COLOUR_YELLOW8;
4679 recoil = 500;
4680 enemy_soundf(e, NWAV_SZAP, 100 + grand(5));
4681 break;
4682 /* case ENEMY_HEAD1_EYE3:
4683 btype = BULLET_SQUIRMY;
4684 damage = DAM_WORMS2;
4685 timer = 80;
4686 timer_rand = 30;
4687 mass = 50;
4688 speed = 500;
4689 firing_distance = 4000;
4690 enemy[e].recycle = 50 + grand(30);
4691 speed_div = 3;
4692 multiple = 1;
4693 angle_increment = 0;
4694 colours [0] = COLOUR_GREEN4;
4695 colours [1] = COLOUR_GREEN6;
4696 colours [2] = COLOUR_YELLOW6;
4697 colours [3] = COLOUR_YELLOW8;
4698 recoil = 500;
4699 special2 = 94;
4700 // if (grand(2) == 0)
4701 // special2 = -74;
4702 special4 = 8;
4703 special3 = special4;
4704 special1 = 1500;
4705 break;*/
4706 case ENEMY_SPINNER1:
4707 btype = BULLET_SEEKER1;
4708 damage = DAM_SMALL_GREEN_SEEKER;
4709 timer = 220;
4710 timer_rand = 50;
4711 mass = 50;
4712 speed = 7000;
4713 firing_distance = 11000;
4714 enemy[e].recycle = 180;
4715 speed_div = 3;
4716 multiple = 1;
4717 // colours [0] = COLOUR_GREEN8;
4718 colourise_bullet(colours, COLOURISE_GREEN_SEEKER1);
4719 recoil = 50;
4720 special1 = closest_target(enemy[e].x, enemy[e].y);
4721 special2 = 30;
4722 special3 = 32;
4723 special4 = 100;
4724 special5 = 4001;
4725 enemy_soundf(e, NWAV_SEEKER, 700 + grand(150));
4726 break;
4727 case ENEMY_SPINNER2:
4728 btype = BULLET_SEEKER2;
4729 damage = DAM_LARGE_GREEN_SEEKER;
4730 timer = 220;
4731 timer_rand = 50;
4732 mass = 120;
4733 speed = 7000;
4734 firing_distance = 11000;
4735 enemy[e].recycle = 330;
4736 speed_div = 3;
4737 multiple = 1;
4738 colourise_bullet(colours, COLOURISE_GREEN_SEEKER2);
4739 recoil = 50;
4740 special1 = closest_target(enemy[e].x, enemy[e].y);
4741 special2 = 43;
4742 special3 = 48;
4743 special4 = 180;
4744 special5 = 7001;
4745 enemy_soundf(e, NWAV_SEEKER, 600 + grand(20));
4746 break;
4747 case ENEMY_SPINNER3:
4748 btype = BULLET_SEEKER3;
4749 damage = 1;
4750 timer = 220;
4751 timer_rand = 50;
4752 mass = 120;
4753 speed = 7000;
4754 firing_distance = 11000;
4755 enemy[e].recycle = 250;
4756 speed_div = 3;
4757 multiple = 1;
4758 colourise_bullet(colours, COLOURISE_BLUE_SEEKER);
4759 recoil = 50;
4760 special1 = closest_target(enemy[e].x, enemy[e].y);
4761 special2 = 45;
4762 special3 = 32;
4763 special4 = 120;
4764 special5 = 5001;
4765 enemy_soundf(e, NWAV_SEEKER, 800 + grand(20));
4766 break;
4767 case ENEMY_SPINNER4:
4768 btype = BULLET_SEEKER1;
4769 damage = DAM_SMALL_GREEN_SEEKER;
4770 timer = 220;
4771 timer_rand = 50;
4772 mass = 50;
4773 speed = 7000;
4774 firing_distance = 11000;
4775 enemy[e].recycle = 200;
4776 speed_div = 3;
4777 multiple = 1;
4778 colourise_bullet(colours, COLOURISE_GREEN_SEEKER1);
4779 recoil = 50;
4780 special1 = closest_target(enemy[e].x, enemy[e].y);
4781 special2 = 30;
4782 special3 = 32;
4783 special4 = 100;
4784 special5 = 4001;
4785 if (enemy[e].burst_fire > 0)
4786 {
4787 enemy[e].recycle = 7;
4788 enemy[e].burst_fire --;
4789 enemy[e].angle = grand(ANGLE_FULL);
4790 }
4791 else
4792 {
4793 enemy[e].recycle = 210;
4794 enemy[e].burst_fire = 3; // also in creation
4795 }
4796 enemy_soundf(e, NWAV_SEEKER, 700 + grand(150));
4797 break;
4798 // case ENEMY_FIGHTER5:
4799 case ENEMY_SPINNER5:
4800 btype = BULLET_SEEKER1;
4801 damage = DAM_YELLOW_SEEKER;
4802 timer = 220;
4803 timer_rand = 50;
4804 mass = 50;
4805 speed = 7000;
4806 firing_distance = 11000;
4807 enemy[e].recycle = 100;
4808 speed_div = 3;
4809 multiple = 1;
4810 colourise_bullet(colours, COLOURISE_YELLOW_SEEKER);
4811 recoil = 250;
4812 special1 = closest_target(enemy[e].x, enemy[e].y);
4813 special2 = 20;
4814 special3 = 6;
4815 special4 = 200;
4816 special5 = 4001;
4817 enemy_soundf(e, NWAV_SEEKER, 1000 + grand(20));
4818 break;
4819 case ENEMY_OVERSPINNER:
4820 btype = BULLET_BIGSEEKER;
4821 damage = 1;
4822 timer = 330;
4823 timer_rand = 50;
4824 mass = 120;
4825 speed = 7000;
4826 size = 4000;
4827 firing_distance = 30000;
4828 enemy[e].recycle = 200;
4829 speed_div = 3;
4830 multiple = 1;
4831 colourise_bullet(colours, TRANS_PURPLE);//COLOURISE__SEEKER);
4832 recoil = 150;
4833 special1 = closest_target(enemy[e].x, enemy[e].y);
4834 // special2 = 45;
4835 // special3 = 32;
4836 // special4 = 120;
4837 // special5 = 5001;
4838 scatter = ANGLE_FULL;
4839 enemy_soundf(e, NWAV_SEEKER, 300 + grand(20));
4840 break;
4841 case ENEMY_OVERSPIKEY:
4842 btype = BULLET_BIGWINGS1;
4843 damage = 1;
4844 timer = 30;
4845 timer_rand = 0;
4846 mass = 20;
4847 speed = 1200;
4848 firing_distance = 30000;
4849 enemy[e].recycle = 50;
4850 speed_div = 3;
4851 multiple = 1;
4852 angle_increment = 0;//ANGLE_1_32;
4853 colourise_bullet(colours, TRANS_LGREEN);
4854 recoil = 1;
4855 size = 5000;
4856 special1 = closest_target(enemy[e].x, enemy[e].y);
4857 angle_rand = ANGLE_FULL;
4858 break;
4859 case ENEMY_UNDERSPIKEY:
4860 btype = BULLET_BIGCIRCLES;
4861 damage = 250;
4862 timer = 120;
4863 timer_rand = 30;
4864 mass = 120;
4865 speed = 5500;
4866 firing_distance = 27000;
4867 enemy[e].recycle = 45;
4868 speed_div = 3;
4869 multiple = 1;
4870 angle_increment = 0;
4871 colours [0] = COLOUR_ORANGE8;
4872 recoil = 100;
4873 size = 9000;
4874 enemy_soundf(e, NWAV_CHIME2, 750 + grand(10));
4875 break;
4876 case ENEMY_UNDERSPIKEY2:
4877 btype = BULLET_OVERBLOCKS;
4878 damage = 250;
4879 timer = 120;
4880 timer_rand = 30;
4881 mass = 120;
4882 speed = 11000;
4883 firing_distance = 27000;
4884 enemy[e].recycle = 120;
4885 speed_div = 3;
4886 multiple = 1;
4887 angle_increment = 0;
4888 colours [0] = TRANS_ORANGE;
4889 colours [1] = TRANS_LRED;
4890 colours [2] = TRANS_LRED;
4891 colours [3] = TRANS_DRED;
4892 recoil = 100;
4893 size = 9000;
4894 special1 = 0;
4895 // enemy_soundf(e, NWAV_CHIME2, 750 + grand(10));
4896 enemy_soundf(e, NWAV_BLOCK, 700 + grand(100));
4897 break;
4898 case ENEMY_UNDERSPIKEY3:
4899 btype = BULLET_ZIGZAG2;
4900 damage = 250;
4901 timer = 120;
4902 timer_rand = 30;
4903 mass = 120;
4904 speed = 6000;
4905 firing_distance = 27000;
4906 enemy[e].recycle = 90;
4907 speed_div = 3;
4908 multiple = 1;
4909 angle_increment = 0;
4910 colours [0] = TRANS_WHITE;
4911 colours [1] = TRANS_LBLUE;
4912 colours [2] = TRANS_DBLUE;
4913 colours [3] = TRANS_DBLUE;
4914 /* colours [0] = TRANS_WHITE;
4915 colours [1] = TRANS_YELLOW;
4916 colours [2] = TRANS_YELLOW;
4917 colours [3] = TRANS_ORANGE;*/
4918 recoil = 100;
4919 size = 9000;
4920 special1 = ANGLE_QUARTER;
4921 if (grand(2) == 0)
4922 special1 = -ANGLE_QUARTER;
4923 special2 = 12;
4924 special3 = 7000;
4925 special4 = enemy[e].angle;
4926 special5 = 0;
4927 // enemy_soundf(e, NWAV_CHIME2, 750 + grand(10));
4928 // special4 = enemy[e].x + xpart(enemy[e].angle, firing_distance);
4929 // special5 = enemy[e].y + ypart(enemy[e].angle, firing_distance);
4930 enemy_soundf(e, NWAV_BLOCK, 500 + grand(100));
4931 break;
4932 case ENEMY_OVERSPIKEY2:
4933 btype = BULLET_ZIGZAG2;
4934 damage = 350;
4935 timer = 120;
4936 timer_rand = 30;
4937 mass = 120;
4938 speed = 8000;
4939 firing_distance = 27000;
4940 enemy[e].recycle = 60;
4941 speed_div = 3;
4942 multiple = 1;
4943 angle_increment = 0;
4944 colours [0] = TRANS_YELLOW;
4945 colours [1] = TRANS_ORANGE;
4946 colours [2] = TRANS_LRED;
4947 colours [3] = TRANS_DRED;
4948 /* colours [0] = TRANS_WHITE;
4949 colours [1] = TRANS_YELLOW;
4950 colours [2] = TRANS_YELLOW;
4951 colours [3] = TRANS_ORANGE;*/
4952 recoil = 100;
4953 size = 9000;
4954 special1 = ANGLE_QUARTER;
4955 if (grand(2) == 0)
4956 special1 = -ANGLE_QUARTER;
4957 special2 = 12;
4958 special3 = 7000;
4959 special4 = enemy[e].angle;
4960 special5 = 1;
4961 // enemy_soundf(e, NWAV_CHIME2, 750 + grand(10));
4962 // special4 = enemy[e].x + xpart(enemy[e].angle, firing_distance);
4963 // special5 = enemy[e].y + ypart(enemy[e].angle, firing_distance);
4964 enemy_soundf(e, NWAV_BLOCK, 600 + grand(100));
4965 break;
4966 case ENEMY_BLATTER1:
4967 btype = BULLET_GREEN_BLAT;
4968 damage = DAM_GREEN_BLAT;
4969 timer = 30;
4970 timer_rand = 15;
4971 mass = 10;
4972 speed = 10000;
4973 firing_distance = 12000;
4974 // enemy[e].recycle = 90;
4975 speed_div = 3;
4976 multiple = 1;
4977 colours_for_cloud [0] = TRANS_DGREEN;
4978 colours_for_cloud [1] = TRANS_LGREEN;
4979 colours_for_cloud [2] = TRANS_YELLOW;
4980 recoil = 100;
4981 if (enemy[e].burst_fire > 0)
4982 {
4983 enemy[e].recycle = 7;
4984 enemy[e].burst_fire --;
4985 }
4986 else
4987 {
4988 enemy[e].recycle = 60;
4989 enemy[e].burst_fire = 3 + grand(3); // also in creation
4990 }
4991 enemy_soundf(e, NWAV_GBLAT, 500);
4992 break;
4993 case ENEMY_OVERBLATTER:
4994 btype = BULLET_BALL2;
4995 damage = 200;
4996 timer = 60;
4997 timer_rand = 10;
4998 mass = 10;
4999 speed = 5000;
5000 // speed_rand = 4000;
5001 firing_distance = 6000;
5002 // enemy[e].recycle = 50;
5003 colours_for_cloud [0] = TRANS_DRED;
5004 colours_for_cloud [1] = TRANS_LRED;
5005 colours_for_cloud [2] = TRANS_YELLOW;
5006 speed_div = 3;
5007 displaced = 26;
5008 if (enemy[e].attribute [4] == 1)
5009 {
5010 displace_series [0] = -1;
5011 enemy[e].attribute [4] = 0;
5012 special_angle = enemy[e].attribute [7];
5013 enemy[e].attribute [9] = 7;
5014 }
5015 else
5016 {
5017 displace_series [0] = 1;
5018 enemy[e].attribute [4] = 1;
5019 special_angle = enemy[e].attribute [6];
5020 enemy[e].attribute [8] = 7;
5021 }
5022 recoil = 100;
5023 size = 3000;
5024 enemy[e].recycle = 14;
5025 enemy_soundf(e, NWAV_MULTI, 1000 + grand(30));
5026 break;
5027 case ENEMY_BOSS2_TURRET3:
5028 btype = BULLET_BALL2;
5029 damage = 200;
5030 timer = 40;
5031 timer_rand = 13;
5032 mass = 10;
5033 speed = 4500;
5034 // speed_rand = 4000;
5035 firing_distance = 12000;
5036 // enemy[e].recycle = 50;
5037 colours_for_cloud [0] = TRANS_DRED;
5038 colours_for_cloud [1] = TRANS_LRED;
5039 colours_for_cloud [2] = TRANS_YELLOW;
5040 speed_div = 3;
5041 recoil = 0;
5042 size = 3000;
5043 multiple = 3;
5044 angle_increment = ANGLE_1_SIXTEENTH;
5045 enemy[e].recycle = 80;
5046 enemy_soundf(e, NWAV_MULTI, 600 + grand(10));
5047 break;
5048 case ENEMY_OVERBLATTER2:
5049 btype = BULLET_BOLT;
5050 damage = 300;
5051 timer = 30;
5052 timer_rand = 10;
5053 mass = 20;
5054 speed = 7500;
5055 colours [0] = TRANS_WHITE;
5056 colours [1] = TRANS_LBLUE;
5057 colours [2] = TRANS_DBLUE;
5058 colours [3] = TRANS_DGREY;
5059 colours_for_cloud [0] = TRANS_DBLUE;
5060 colours_for_cloud [1] = TRANS_LBLUE;
5061 colours_for_cloud [2] = TRANS_WHITE;
5062 firing_distance = 6000;
5063 speed_div = 3;
5064 displaced = 26;
5065 size = 3000;
5066 if (enemy[e].attribute [4] == 1)
5067 {
5068 displace_series [0] = -1;
5069 enemy[e].attribute [4] = 0;
5070 special_angle = enemy[e].attribute [7];
5071 enemy[e].attribute [9] = 7;
5072 }
5073 else
5074 {
5075 displace_series [0] = 1;
5076 enemy[e].attribute [4] = 1;
5077 special_angle = enemy[e].attribute [6];
5078 enemy[e].attribute [8] = 7;
5079 }
5080 recoil = 100;
5081 size = 3000;
5082 enemy[e].recycle = 20;
5083 enemy_soundf(e, NWAV_MULTI, 200 + grand(10));
5084 break;
5085 // case ENEMY_OVERTRIANGLER_TURRET:
5086 case ENEMY_BLATTER2:
5087 btype = BULLET_BALL2;
5088 damage = 200;
5089 timer = 25;
5090 timer_rand = 10;
5091 mass = 10;
5092 speed = 5500;
5093 firing_distance = 14000;
5094 enemy[e].recycle = 25;
5095 // if (enemy[e].type == ENEMY_DEFENDER3_TURRET4)
5096 // {
5097 // firing_distance = 12000;
5098 // }
5099 // enemy[e].recycle = 35;
5100 speed_div = 3;
5101 multiple = 1;
5102 recoil = 100;
5103 size = 3000;
5104 enemy_soundf(e, NWAV_BALL1, 800 + grand(10));
5105 break;
5106 case ENEMY_BLATTER3:
5107 btype = BULLET_BALL1;
5108 damage = 150;
5109 timer = 40;
5110 timer_rand = 20;
5111 mass = 10;
5112 speed = 5000;
5113 firing_distance = 14000;
5114 enemy[e].recycle = 20;
5115 speed_div = 3;
5116 multiple = 4;
5117 angle_increment = ANGLE_1_EIGHTH;
5118 angle -= ANGLE_QUARTER;
5119 recoil = 100;
5120 size = 3000;
5121 enemy_soundf(e, NWAV_MULTI, 700 + grand(10));
5122 break;
5123 case ENEMY_DEFENDER3_TURRET4:
5124 btype = BULLET_FLAME;
5125 damage = 0;
5126 timer = 30;
5127 timer_rand = 5;
5128 mass = 40;
5129 speed = 5000;
5130 /* colours [0] = TRANS_WHITE;
5131 colours [1] = TRANS_LBLUE;
5132 colours [2] = TRANS_DBLUE;*/
5133 colours [0] = TRANS_YELLOW;
5134 colours [1] = TRANS_LGREEN;
5135 colours [2] = TRANS_DGREEN;
5136 firing_distance = 11000;
5137 enemy[e].recycle = 90;
5138 speed_div = 3;
5139 multiple = 1;
5140 recoil = 0;
5141 size = 2000;
5142 enemy_soundf(e, NWAV_SHORTBURST, 200 + grand(50));
5143 break;
5144 case ENEMY_BLATTER4:
5145 btype = BULLET_FLAME;
5146 damage = 0;
5147 timer = 25;
5148 timer_rand = 5;
5149 mass = 40;
5150 speed = 8000;
5151 colours [0] = TRANS_YELLOW;
5152 colours [1] = TRANS_ORANGE;
5153 colours [2] = TRANS_LRED;
5154 colours [3] = TRANS_DRED;
5155 firing_distance = 11000;
5156 enemy[e].recycle = 90;
5157 speed_div = 3;
5158 multiple = 1;
5159 recoil = 500;
5160 size = 2000;
5161 enemy_soundf(e, NWAV_SHORTBURST, 150 + grand(50));
5162 // enemy_soundf(e, NWAV_LZAP, 900 + grand(100));
5163 /* btype = BULLET_FORK3;
5164 damage = 100;
5165 timer = 15;
5166 timer_rand = 6;
5167 mass = 20;
5168 speed = 8000;
5169 firing_distance = 21000;
5170 speed_div = 3;
5171 multiple = 1;
5172 angle_increment = 0;
5173 colours [0] = COLOUR_RED5;
5174 colours [1] = COLOUR_RED6;
5175 colours [2] = COLOUR_ORANGE8;
5176 colours [3] = COLOUR_YELLOW8;
5177 recoil = 50;
5178 // size = 1000;
5179 special1 = COLOUR_YELLOW8;
5180 scatter = ANGLE_1_SIXTEENTH;
5181 if (enemy[e].burst_fire > 0)
5182 {
5183 enemy[e].recycle = 4;
5184 enemy[e].burst_fire --;
5185 }
5186 else
5187 {
5188 enemy[e].recycle = 90;
5189 enemy[e].burst_fire = 4 + grand(4); // also in creation
5190 }*/
5191 break;
5192 case ENEMY_BLATTER5:
5193 btype = BULLET_ZAP;
5194 damage = 100;
5195 timer = 19;
5196 timer_rand = 12;
5197 mass = 10;
5198 speed = 3000;
5199 speed_rand = 7000;
5200 firing_distance = 10000;
5201 enemy[e].recycle = 55;
5202 colours [0] = COLOUR_YELLOW8;
5203 colours [1] = COLOUR_GREEN8;
5204 colours [2] = COLOUR_GREEN6;
5205 colours [3] = COLOUR_GREEN4;
5206 speed_div = 3;
5207 multiple = 10;
5208 scatter = ANGLE_1_EIGHTH;
5209 recoil = 500;
5210 enemy_soundf(e, NWAV_DNO, 1200 + grand(150));
5211 break;
5212 case ENEMY_PULSER1:
5213 btype = BULLET_PULSE1;
5214 damage = 150;
5215 timer = 220;
5216 timer_rand = 50;
5217 mass = 50;
5218 speed = 1000;
5219 firing_distance = 18000;
5220 enemy[e].recycle = 75;
5221 speed_div = 3;
5222 multiple = 1;
5223 colours_for_cloud [0] = TRANS_LRED;
5224 colours_for_cloud [1] = TRANS_ORANGE;
5225 colours_for_cloud [2] = TRANS_YELLOW;
5226 recoil = 50;
5227 special1 = closest_target(enemy[e].x, enemy[e].y);
5228 // special2 = 20;
5229 // special3 = 32;
5230 // special4 = 100;
5231 // special5 = 4001;
5232 enemy_soundf(e, NWAV_CHIRP, 1000 + grand(100));
5233 break;
5234 case ENEMY_PULSER2:
5235 btype = BULLET_PULSE2;
5236 damage = 250;
5237 timer = 220;
5238 timer_rand = 50;
5239 mass = 150;
5240 speed = 1000;
5241 firing_distance = 18000;
5242 enemy[e].recycle = 75;
5243 speed_div = 3;
5244 multiple = 1;
5245 colours_for_cloud [0] = TRANS_DBLUE;
5246 colours_for_cloud [1] = TRANS_LBLUE;
5247 colours_for_cloud [2] = TRANS_WHITE;
5248 recoil = 50;
5249 special1 = closest_target(enemy[e].x, enemy[e].y);
5250 // special2 = 20;
5251 // special3 = 32;
5252 // special4 = 100;
5253 // special5 = 4001;
5254 enemy_soundf(e, NWAV_CHIRP, 700 + grand(100));
5255 break;
5256 case ENEMY_BOSS2_3:
5257 btype = BULLET_OVERPULSE;
5258 damage = 300;
5259 timer = 220;
5260 timer_rand = 50;
5261 mass = 300;
5262 speed = 1000;
5263 firing_distance = 36000;
5264 enemy[e].recycle = 80;
5265 speed_div = 3;
5266 multiple = 1;
5267 colours_for_cloud [0] = TRANS_DGREEN;
5268 colours_for_cloud [1] = TRANS_LGREEN;
5269 colours_for_cloud [2] = TRANS_YELLOW;
5270 recoil = 250;
5271 special1 = closest_target(enemy[e].x, enemy[e].y);
5272 special2 = grand(2);
5273 enemy_soundf(e, NWAV_CHIRP, 200 + grand(30));
5274 break;
5275 case ENEMY_CRUISER1_TURRET:
5276 btype = BULLET_GREEN_BLAT;
5277 damage = DAM_GREEN_BLAT;
5278 timer = 30;
5279 timer_rand = 15;
5280 mass = 10;
5281 speed = 10000;
5282 firing_distance = 12000;
5283 // enemy[e].recycle = 90;
5284 speed_div = 3;
5285 multiple = 1;
5286 colours_for_cloud [0] = TRANS_DGREEN;
5287 colours_for_cloud [1] = TRANS_LGREEN;
5288 colours_for_cloud [2] = TRANS_YELLOW;
5289 recoil = 300;
5290 if (enemy[e].burst_fire > 0)
5291 {
5292 enemy[e].recycle = 7;
5293 enemy[e].burst_fire --;
5294 enemy[e].attribute [0] = 7;
5295 }
5296 else
5297 {
5298 enemy[e].recycle = 90;
5299 enemy[e].burst_fire = 3 + grand(3); // also in creation
5300 enemy[e].attribute [0] = 7;
5301 }
5302 enemy_soundf(e, NWAV_GBLAT, 500);
5303 break;
5304 case ENEMY_CRUISER1:
5305 btype = BULLET_BLAST;
5306 damage = 200;
5307 timer = 40;
5308 timer_rand = 20;
5309 mass = 40;
5310 speed = 4000;
5311 colours [0] = TRANS_YELLOW;
5312 colours [1] = TRANS_ORANGE;
5313 colours [2] = TRANS_LRED;
5314 colours [3] = TRANS_DRED;
5315 firing_distance = 14000;
5316 enemy[e].recycle = 66;
5317 speed_div = 3;
5318 multiple = 2;
5319 multiple = 2;
5320 displaced = 9;
5321 displace_series [0] = 1;
5322 displace_series [1] = -1;
5323 recoil = 100;
5324 size = 2000;
5325 enemy_soundf(e, NWAV_LZAP, 900 + grand(100));
5326 break;
5327 case ENEMY_CRUISER2_TURRET:
5328 case ENEMY_DEFENDER2_TURRET3:
5329 btype = BULLET_YELLOW_FLAK;
5330 damage = 100;
5331 timer = 8;
5332 timer_rand = 15;
5333 mass = 10;
5334 speed = 6000;
5335 firing_distance = 12000;
5336 // enemy[e].recycle = 90;
5337 speed_div = 3;
5338 multiple = 1;
5339 colours_for_cloud [0] = TRANS_ORANGE;
5340 colours_for_cloud [1] = TRANS_YELLOW;
5341 colours_for_cloud [2] = TRANS_WHITE;
5342 recoil = 300;
5343 enemy[e].recycle = 34;
5344 enemy[e].attribute [0] = 7;
5345 enemy_soundf(e, NWAV_GBLAT, 300 + grand(50));
5346 break;
5347 case ENEMY_CRUISER2:
5348 btype = BULLET_BLAST;
5349 damage = 300;
5350 timer = 40;
5351 timer_rand = 20;
5352 mass = 40;
5353 speed = 7000;
5354 colours [0] = TRANS_WHITE;
5355 colours [1] = TRANS_LBLUE;
5356 colours [2] = TRANS_LBLUE;
5357 colours [3] = TRANS_DBLUE;
5358 firing_distance = 14000;
5359 enemy[e].recycle = 45;
5360 speed_div = 3;
5361 // multiple = 2;
5362 multiple = 2;
5363 displaced = 9;
5364 displace_series [0] = 1;
5365 displace_series [1] = -1;
5366 recoil = 100;
5367 // scatter = ANGLE_1_EIGHTH;
5368 size = 2000;
5369 enemy_soundf(e, NWAV_LZAP, 1200 + grand(100));
5370 break;
5371 case ENEMY_CRUISER3_TURRET:
5372 btype = BULLET_ZAP_DRAG;
5373 damage = 50;
5374 timer = 15;
5375 timer_rand = 6;
5376 mass = 5;
5377 speed = 9000;
5378 // speed_rand = 7000;
5379 firing_distance = 9000;
5380 enemy[e].recycle = 6;
5381 colours [0] = COLOUR_ORANGE8;
5382 colours [1] = COLOUR_RED8;
5383 colours [2] = COLOUR_RED6;
5384 colours [3] = COLOUR_RED4;
5385 speed_div = 3;
5386 // multiple = 10;
5387 scatter = ANGLE_1_32;
5388 recoil = 50;
5389 enemy[e].attribute [0] = 7;
5390 special1 = -1;
5391 enemy_soundf(e, NWAV_SZAP, 1200 + grand(50));
5392 break;
5393 case ENEMY_CRUISER3:
5394 btype = BULLET_BLAST;
5395 damage = 200;
5396 timer = 40;
5397 timer_rand = 20;
5398 mass = 40;
5399 speed = 4000;
5400 colours [0] = TRANS_YELLOW;
5401 colours [1] = TRANS_ORANGE;
5402 colours [2] = TRANS_LRED;
5403 colours [3] = TRANS_DRED;
5404 firing_distance = 14000;
5405 enemy[e].recycle = 66;
5406 speed_div = 3;
5407 multiple = 4;
5408 displaced = 7;
5409 angle_increment = ANGLE_1_SIXTEENTH;
5410 angle -= ANGLE_1_32 + ANGLE_1_SIXTEENTH;
5411 displace_series [0] = -2;
5412 displace_series [1] = -1;
5413 displace_series [2] = 1;
5414 displace_series [3] = 2;
5415 recoil = 100;
5416 size = 2000;
5417 enemy_soundf(e, NWAV_LZAP, 600 + grand(100));
5418 break;
5419 case ENEMY_CRUISER4: // similar to guardian1
5420 btype = BULLET_BLAST;
5421 damage = 250;
5422 timer = 30;
5423 timer_rand = 10;
5424 mass = 50;
5425 speed = 7000;
5426 colours [0] = TRANS_YELLOW;
5427 colours [1] = TRANS_LGREEN;
5428 colours [2] = TRANS_DGREEN;
5429 colours [3] = TRANS_DGREEN;
5430 firing_distance = 14000;
5431 enemy[e].recycle = 66;
5432 speed_div = 3;
5433 multiple = 4;
5434 displaced = 7;
5435 angle_increment = ANGLE_1_SIXTEENTH;
5436 angle -= ANGLE_1_32 + ANGLE_1_SIXTEENTH;
5437 displace_series [0] = -2;
5438 displace_series [1] = -1;
5439 displace_series [2] = 1;
5440 displace_series [3] = 2;
5441 recoil = 150;
5442 size = 2000;
5443 enemy_soundf(e, NWAV_LZAP, 500 + grand(100));
5444 break;
5445 case ENEMY_CRUISER4_TURRET:
5446 btype = BULLET_SHOCK;
5447 damage = 100;
5448 timer = 10;
5449 timer_rand = 3;
5450 mass = 20;
5451 speed = 15000;
5452 firing_distance = 7000;
5453 enemy[e].recycle = 35;
5454 speed_div = 3;
5455 multiple = 1;
5456 angle_increment = 0;
5457 colours [0] = COLOUR_GREEN4;
5458 colours [1] = COLOUR_GREEN6;
5459 colours [2] = COLOUR_YELLOW6;
5460 colours [3] = COLOUR_YELLOW8;
5461 recoil = 100;
5462 enemy[e].attribute [0] = 7;
5463 enemy_soundf(e, NWAV_LZAP, 1200 + grand(100));
5464 break;
5465 case ENEMY_LEAPER1:
5466 btype = BULLET_BLAST;
5467 damage = 200;
5468 timer = 40;
5469 timer_rand = 20;
5470 mass = 40;
5471 speed = 4000;
5472 colours [0] = TRANS_YELLOW;
5473 colours [1] = TRANS_ORANGE;
5474 colours [2] = TRANS_LRED;
5475 colours [3] = TRANS_DRED;
5476 firing_distance = 9000;
5477 enemy[e].recycle = 40;
5478 speed_div = 3;
5479 multiple = 1;
5480 recoil = 500;
5481 if (enemy[e].burst_fire > 0)
5482 {
5483 enemy[e].recycle = 20;
5484 enemy[e].burst_fire --;
5485 }
5486 else
5487 {
5488 enemy[e].recycle = 100;
5489 enemy[e].burst_fire = 3; // also in creation
5490 }
5491 size = 2000;
5492 enemy_soundf(e, NWAV_LZAP, 1200 + grand(100));
5493 break;
5494 case ENEMY_LEAPER2:
5495 btype = BULLET_BLAST;
5496 damage = 250;
5497 timer = 40;
5498 timer_rand = 20;
5499 mass = 40;
5500 speed = 6000;
5501 colours [0] = TRANS_YELLOW;
5502 colours [1] = TRANS_LGREEN;
5503 colours [2] = TRANS_DGREEN;
5504 colours [3] = TRANS_DGREY;
5505 firing_distance = 9000;
5506 enemy[e].recycle = 40;
5507 speed_div = 3;
5508 multiple = 1;
5509 recoil = 500;
5510 if (enemy[e].burst_fire > 0)
5511 {
5512 enemy[e].recycle = 20;
5513 enemy[e].burst_fire --;
5514 }
5515 else
5516 {
5517 enemy[e].recycle = 100;
5518 enemy[e].burst_fire = 3; // also in creation
5519 }
5520 size = 2000;
5521 enemy_soundf(e, NWAV_LZAP, 1100 + grand(100));
5522 break;
5523 case ENEMY_FIGHTER1:
5524 btype = BULLET_BLAST;
5525 damage = 200;
5526 timer = 40;
5527 timer_rand = 20;
5528 mass = 40;
5529 speed = 4000;
5530 colours [0] = TRANS_YELLOW;
5531 colours [1] = TRANS_ORANGE;
5532 colours [2] = TRANS_LRED;
5533 colours [3] = TRANS_DRED;
5534 firing_distance = 10000;
5535 enemy[e].recycle = 40;
5536 speed_div = 3;
5537 multiple = 1;
5538 recoil = 500;
5539 size = 2000;
5540 enemy_soundf(e, NWAV_LZAP, 900 + grand(100));
5541 break;
5542 case ENEMY_FIGHTER2:
5543 btype = BULLET_BLUE_BLAT;
5544 damage = DAM_BLUE_BLAT;
5545 timer = 30;
5546 timer_rand = 15;
5547 mass = 10;
5548 speed = 10000;
5549 firing_distance = 1000;
5550 // enemy[e].recycle = 90;
5551 speed_div = 3;
5552 multiple = 2;
5553 displaced = 6;
5554 displace_series [0] = 1;
5555 displace_series [1] = -1;
5556 colours_for_cloud [0] = TRANS_DBLUE;
5557 colours_for_cloud [1] = TRANS_LBLUE;
5558 colours_for_cloud [2] = TRANS_WHITE;
5559 recoil = 300;
5560 if (enemy[e].burst_fire > 0)
5561 {
5562 enemy[e].recycle = 7;
5563 enemy[e].burst_fire --;
5564 }
5565 else
5566 {
5567 enemy[e].recycle = 160;
5568 enemy[e].burst_fire = 4 + grand(4); // also in creation
5569 }
5570 enemy_soundf(e, NWAV_GBLAT, 1800);
5571 break;
5572 case ENEMY_FIGHTER3:
5573 btype = BULLET_SEEKER1;
5574 damage = DAM_SMALL_GREEN_SEEKER;
5575 timer = 220;
5576 timer_rand = 50;
5577 mass = 50;
5578 speed = 7000;
5579 firing_distance = 11000;
5580 enemy[e].recycle = 150;
5581 speed_div = 3;
5582 multiple = 2;
5583 // displaced = 6;
5584 // displace_series [0] = 1;
5585 // displace_series [1] = -1;
5586 angle_increment = ANGLE_1_SIXTEENTH;
5587 colourise_bullet(colours, COLOURISE_GREEN_SEEKER1);
5588 recoil = 50;
5589 special1 = closest_target(enemy[e].x, enemy[e].y);
5590 special2 = 30;
5591 special3 = 32;
5592 special4 = 100;
5593 special5 = 4001;
5594 enemy_soundf(e, NWAV_SEEKER, 700 + grand(150));
5595 break;
5596 case ENEMY_FIGHTER4:
5597 btype = BULLET_BLAST;
5598 damage = 250;
5599 timer = 20;
5600 timer_rand = 10;
5601 mass = 40;
5602 speed = 5000;
5603 colours [0] = TRANS_YELLOW;
5604 colours [1] = TRANS_LGREEN;
5605 colours [2] = TRANS_DGREEN;
5606 colours [3] = TRANS_DGREY;
5607 firing_distance = 14000;
5608 enemy[e].recycle = 80;
5609 speed_div = 3;
5610 multiple = 2;
5611 angle -= ANGLE_1_32;
5612 // angle_rand = 64;
5613 angle_increment = ANGLE_1_SIXTEENTH;
5614 recoil = 1200;
5615 size = 2000;
5616 enemy_soundf(e, NWAV_LZAP, 1000 + grand(100));
5617 break;
5618 case ENEMY_FIGHTER5:
5619 btype = BULLET_SEEKER1;
5620 damage = DAM_YELLOW_SEEKER;
5621 timer = 220;
5622 timer_rand = 50;
5623 mass = 50;
5624 speed = 7000;
5625 firing_distance = 11000;
5626 // enemy[e].recycle = 50;
5627 speed_div = 3;
5628 multiple = 1;
5629 colourise_bullet(colours, COLOURISE_YELLOW_SEEKER);
5630 recoil = 250;
5631 special1 = closest_target(enemy[e].x, enemy[e].y);
5632 special2 = 20;
5633 special3 = 6;
5634 special4 = 200;
5635 special5 = 4001;
5636 if (enemy[e].burst_fire > 0)
5637 {
5638 enemy[e].recycle = 15;
5639 enemy[e].burst_fire --;
5640 }
5641 else
5642 {
5643 enemy[e].recycle = 160;
5644 enemy[e].burst_fire = 3 + grand(3); // also in creation
5645 }
5646 enemy_soundf(e, NWAV_SEEKER, 1000 + grand(20));
5647 break;
5648 case ENEMY_MESSENGER:
5649 btype = BULLET_ZAP_DRAG;
5650 damage = 100;
5651 timer = 30;
5652 timer_rand = 10;
5653 mass = 10;
5654 speed = 8000;
5655 firing_distance = 7000;
5656 speed_div = 3;
5657 multiple = 2;
5658 displaced = 5;
5659 displace_series [0] = -1;
5660 displace_series [1] = 1;
5661 colours [0] = COLOUR_YELLOW8;
5662 colours [1] = COLOUR_YELLOW7;
5663 colours [2] = COLOUR_GREEN6;
5664 colours [3] = COLOUR_GREEN4;
5665 recoil = 0;
5666 scatter = 0;
5667 // angle = enemy[e].attribute [2];
5668 if (enemy[e].burst_fire > 0)
5669 {
5670 enemy[e].recycle = 5;
5671 enemy[e].burst_fire --;
5672 }
5673 else
5674 {
5675 enemy[e].recycle = 90;
5676 enemy[e].burst_fire = 3 + grand(3); // also in creation
5677 }
5678 special1 = -1;
5679 enemy_soundf(e, NWAV_SZAP, 700 + grand(50));
5680 /* btype = BULLET_MBOMB;
5681 damage = 1;
5682 timer = 50;
5683 // timer_rand = 20;
5684 mass = 40;
5685 speed = 1000;
5686 colours [0] = COLOUR_YELLOW8;
5687 //// colours [1] = TRANS_ORANGE;
5688 // colours [2] = TRANS_LRED;
5689 // colours [3] = TRANS_DRED;
5690 firing_distance = 1000;
5691 enemy[e].recycle = 60;
5692 speed_div = 3;
5693 multiple = 1;
5694 recoil = 0;*/
5695 break;
5696 case ENEMY_BOMBER1:
5697 btype = BULLET_E_BOMB;
5698 damage = 1;
5699 timer = 50;
5700 // timer_rand = 20;
5701 mass = 40;
5702 speed = 1000;
5703 colours [0] = COLOUR_YELLOW8;
5704 //// colours [1] = TRANS_ORANGE;
5705 // colours [2] = TRANS_LRED;
5706 // colours [3] = TRANS_DRED;
5707 firing_distance = 1000;
5708 enemy[e].recycle = 40;
5709 speed_div = 3;
5710 multiple = 1;
5711 recoil = 0;
5712 if (enemy[e].burst_fire > 0)
5713 {
5714 enemy[e].recycle = 15;
5715 enemy[e].burst_fire --;
5716 }
5717 else
5718 {
5719 enemy[e].recycle = 160;
5720 enemy[e].burst_fire = 3; // also in creation
5721 }
5722 enemy_soundf(e, NWAV_SPLERK, 1500 + grand(50));
5723 break;
5724 case ENEMY_BOMBER2:
5725 btype = BULLET_E_BOMB;
5726 damage = 1;
5727 timer = 15;
5728 timer_rand = 65;
5729 mass = 40;
5730 speed = 0;
5731 speed_rand = 5000;
5732 colours [0] = COLOUR_YELLOW8;
5733 //// colours [1] = TRANS_ORANGE;
5734 // colours [2] = TRANS_LRED;
5735 // colours [3] = TRANS_DRED;
5736 firing_distance = 1000;
5737 enemy[e].recycle = 40;
5738 speed_div = 3;
5739 multiple = 4;
5740 angle_rand = 150;
5741 recoil = 0;
5742 enemy_soundf(e, NWAV_SPLERK, 1300 + grand(50));
5743 /* if (enemy[e].burst_fire > 0)
5744 {
5745 enemy[e].recycle = 15;
5746 enemy[e].burst_fire --;
5747 }
5748 else
5749 {
5750 enemy[e].recycle = 160;
5751 enemy[e].burst_fire = 3; // also in creation
5752 }*/
5753 break;
5754 case ENEMY_BOMBER3:
5755 btype = BULLET_E_BOMB2;
5756 damage = 1;
5757 timer = 50;
5758 timer_rand = 100;
5759 mass = 10;
5760 speed = 6000;
5761 // speed_rand = 8000;
5762 // colours [0] = COLOUR_YELLOW8;
5763 firing_distance = 5000;
5764 // enemy[e].recycle = 40;
5765 speed_div = 3;
5766 multiple = 1;
5767 angle_rand = ANGLE_FULL;
5768 recoil = 100;
5769 if (enemy[e].burst_fire > 0)
5770 {
5771 enemy[e].recycle = 7;
5772 enemy[e].burst_fire --;
5773 }
5774 else
5775 {
5776 enemy[e].recycle = 160;
5777 enemy[e].burst_fire = 6 + grand(6); // also in creation
5778 }
5779 enemy_soundf(e, NWAV_TEETH, 1200 + grand(50));
5780 break;
5781 case ENEMY_SPIKEY1:
5782 btype = BULLET_CIRCLES2;
5783 damage = 150;
5784 timer = 120;
5785 timer_rand = 30;
5786 mass = 50;
5787 speed = 5000;
5788 firing_distance = 4000;
5789 enemy[e].recycle = 150;
5790 speed_div = 3;
5791 multiple = 1;
5792 angle_increment = 0;
5793 colours [0] = COLOUR_YELLOW8;
5794 recoil = 100;
5795 size = 5000;
5796 enemy_soundf(e, NWAV_CHIME2, 1400 + grand(50));
5797 break;
5798 case ENEMY_SPIKEY3:
5799 btype = BULLET_CIRCLES2;
5800 damage = 150;
5801 timer = 120;
5802 timer_rand = 30;
5803 mass = 50;
5804 speed = 7000;
5805 firing_distance = 4000;
5806 enemy[e].recycle = 150;
5807 speed_div = 3;
5808 multiple = 3;
5809 angle_increment = ANGLE_1_32;
5810 colours [0] = COLOUR_YELLOW8;
5811 recoil = 150;
5812 size = 5000;
5813 enemy_soundf(e, NWAV_CHIME2, 1000 + grand(50));
5814 break;
5815 case ENEMY_SPIKEY2:
5816 btype = BULLET_BLOCKS;
5817 damage = 200;
5818 timer = 120;
5819 timer_rand = 30;
5820 mass = 25;
5821 speed = 7000 + grand(2000);
5822 firing_distance = 9000;
5823 speed_div = 3;
5824 multiple = 1;
5825 colours [0] = TRANS_YELLOW;
5826 colours [1] = TRANS_LGREEN;
5827 colours [2] = TRANS_DGREEN;
5828 colours [3] = TRANS_DGREY;
5829 // angle_increment = ANGLE_1_32;
5830 // colours [0] = COLOUR_YELLOW8;
5831 recoil = 150;
5832 size = 4000;
5833 /* if (enemy[e].burst_fire > 0)
5834 {
5835 enemy[e].recycle = 16;
5836 enemy[e].burst_fire --;
5837 }
5838 else
5839 {
5840 enemy[e].recycle = 160;
5841 enemy[e].burst_fire = 3 + grand(3); // also in creation
5842 }*/
5843 enemy[e].recycle = 80;
5844 enemy_soundf(e, NWAV_BLOCK, 900 + grand(100));
5845 break;
5846 case ENEMY_SPIKEY5:
5847 btype = BULLET_THICK_SHOCK;
5848 damage = 300;
5849 timer = 120;
5850 timer_rand = 30;
5851 mass = 50;
5852 speed = 13000;
5853 firing_distance = 6000;
5854 enemy[e].recycle = 180;
5855 speed_div = 3;
5856 multiple = 1;
5857 angle_increment = 0;//ANGLE_1_32;
5858 colours [0] = TRANS_YELLOW;
5859 colours [1] = TRANS_ORANGE;
5860 colours [2] = TRANS_LRED;
5861 colours [3] = TRANS_DRED;
5862 /* colours [0] = COLOUR_YELLOW8;
5863 colours [1] = COLOUR_YELLOW7;
5864 colours [2] = COLOUR_YELLOW5;
5865 colours [3] = COLOUR_YELLOW3;*/
5866 recoil = 350;
5867 size = 6000;
5868 enemy_soundf(e, NWAV_BLOCK, 200 + grand(50));
5869 break;
5870 case ENEMY_SPIKEY4:
5871 btype = BULLET_WINGS1;
5872 damage = 1;
5873 timer = 30;
5874 timer_rand = 0;
5875 mass = 20;
5876 speed = 1200;
5877 firing_distance = 6000;
5878 enemy[e].recycle = 40;
5879 speed_div = 3;
5880 multiple = 1;
5881 angle_increment = 0;//ANGLE_1_32;
5882 recoil = 1;
5883 size = 2000;
5884 special1 = closest_target(enemy[e].x, enemy[e].y);
5885 angle_rand = ANGLE_FULL;
5886 break;
5887 case ENEMY_FORKER1:
5888 btype = BULLET_FORK2;
5889 damage = 150;
5890 timer = 20;
5891 timer_rand = 10;
5892 mass = 20;
5893 speed = 5000;
5894 firing_distance = 15000;
5895 enemy[e].recycle = 55;
5896 speed_div = 3;
5897 multiple = 1;
5898 angle_increment = 0;
5899 colours [0] = COLOUR_GREY3;
5900 colours [1] = COLOUR_GREY4;
5901 colours [2] = COLOUR_GREY6;
5902 colours [3] = COLOUR_WHITE;
5903 recoil = 500;
5904 // size = 1000;
5905 special1 = COLOUR_WHITE;
5906 enemy_soundf(e, NWAV_BLOCK, 500 + grand(50));
5907 break;
5908 case ENEMY_FORKER2:
5909 btype = BULLET_FORK1;
5910 damage = 150;
5911 timer = 10;
5912 timer_rand = 20;
5913 mass = 20;
5914 speed = 6000;
5915 firing_distance = 15000;
5916 enemy[e].recycle = 50;
5917 speed_div = 3;
5918 multiple = 1;
5919 angle_increment = 0;
5920 colours [0] = COLOUR_BLUE5;
5921 colours [1] = COLOUR_BLUE8;
5922 colours [2] = COLOUR_GREY6;
5923 colours [3] = COLOUR_WHITE;
5924 recoil = 500;
5925 // size = 1000;
5926 special1 = COLOUR_WHITE;
5927 enemy_soundf(e, NWAV_BLOCK, 500 + grand(50));
5928 break;
5929 case ENEMY_MINEFIELDER1:
5930 btype = BULLET_MINE1;
5931 damage = 1;
5932 timer = 500;
5933 timer_rand = 100;
5934 mass = 30;
5935 speed = 10000;
5936 speed_rand = 7000;
5937 firing_distance = 14000;
5938 enemy[e].recycle = 35;
5939 speed_div = 3;
5940 multiple = 1;
5941 angle_increment = 0;
5942 angle_rand = ANGLE_FULL;
5943 // colours [0] = COLOUR_YELLOW8;
5944 recoil = 50;
5945 size = MINE_SIZE;
5946 colours_for_cloud [0] = TRANS_LRED;
5947 colours_for_cloud [1] = TRANS_ORANGE;
5948 colours_for_cloud [2] = TRANS_YELLOW;
5949 enemy_soundf(e, NWAV_SPLERK, 900 + grand(100));
5950 break;
5951 case ENEMY_MINER1:
5952 btype = BULLET_MINE1;
5953 damage = 1;
5954 timer = 300;
5955 timer_rand = 100;
5956 mass = 30;
5957 speed = 7000;
5958 speed_rand = 5000;
5959 firing_distance = 11000;
5960 enemy[e].recycle = 35;
5961 speed_div = 3;
5962 multiple = 1;
5963 angle_increment = 0;
5964 angle_rand = ANGLE_FULL;
5965 // colours [0] = COLOUR_YELLOW8;
5966 recoil = 200;
5967 size = MINE_SIZE;
5968 colours_for_cloud [0] = TRANS_LRED;
5969 colours_for_cloud [1] = TRANS_ORANGE;
5970 colours_for_cloud [2] = TRANS_YELLOW;
5971 enemy_soundf(e, NWAV_SPLERK, 900 + grand(100));
5972 break;
5973 case ENEMY_MINER2:
5974 btype = BULLET_MINE2;
5975 damage = 1;
5976 timer = 300;
5977 timer_rand = 100;
5978 mass = 30;
5979 speed = 7000;
5980 speed_rand = 6000;
5981 firing_distance = 11000;
5982 enemy[e].recycle = 35;
5983 speed_div = 3;
5984 multiple = 1;
5985 angle_increment = 0;
5986 angle_rand = ANGLE_FULL;
5987 // colours [0] = COLOUR_YELLOW8;
5988 recoil = 200;
5989 size = MINE_SIZE;
5990 colours_for_cloud [0] = TRANS_DRED;
5991 colours_for_cloud [1] = TRANS_LRED;
5992 colours_for_cloud [2] = TRANS_ORANGE;
5993 enemy_soundf(e, NWAV_SPLERK, 500 + grand(50));
5994 break;
5995 case ENEMY_MINER3:
5996 btype = BULLET_MINE3;
5997 damage = 1;
5998 timer = 300;
5999 timer_rand = 100;
6000 mass = 30;
6001 speed = 7000;
6002 speed_rand = 6000;
6003 firing_distance = 11000;
6004 enemy[e].recycle = 35;
6005 speed_div = 3;
6006 multiple = 1;
6007 angle_increment = 0;
6008 angle_rand = ANGLE_FULL;
6009 // colours [0] = COLOUR_YELLOW8;
6010 recoil = 200;
6011 size = MINE_SIZE;
6012 colours_for_cloud [0] = TRANS_ORANGE;
6013 colours_for_cloud [1] = TRANS_YELLOW;
6014 colours_for_cloud [2] = TRANS_WHITE;
6015 enemy_soundf(e, NWAV_SPLERK, 1100 + grand(40));
6016 break;
6017 case ENEMY_MINER3_TURRET:
6018 btype = BULLET_BLUE_BLAT;
6019 damage = 50;
6020 timer = 30;
6021 timer_rand = 15;
6022 mass = 10;
6023 speed = 10000;
6024 firing_distance = 10000;
6025 speed_div = 3;
6026 multiple = 1;
6027 colours_for_cloud [0] = TRANS_DBLUE;
6028 colours_for_cloud [1] = TRANS_LBLUE;
6029 colours_for_cloud [2] = TRANS_WHITE;
6030 recoil = 300;
6031 if (enemy[e].burst_fire > 0)
6032 {
6033 enemy[e].recycle = 7;
6034 enemy[e].burst_fire --;
6035 enemy[e].attribute [0] = 7;
6036 }
6037 else
6038 {
6039 enemy[e].recycle = 90;
6040 enemy[e].burst_fire = 4 + grand(4); // also in creation
6041 enemy[e].attribute [0] = 7;
6042 }
6043 scatter = 64;
6044 enemy_soundf(e, NWAV_GBLAT, 1500);
6045 break;
6046 case ENEMY_BOSS1_1:
6047 btype = BULLET_BALL1;
6048 damage = 150;
6049 timer = 40;
6050 timer_rand = 20;
6051 mass = 10;
6052 speed = 5000;
6053 firing_distance = 56000;
6054 enemy[e].recycle = 65;
6055 speed_div = 3;
6056 multiple = 8;
6057 angle_increment = ANGLE_1_EIGHTH;
6058 angle -= ANGLE_QUARTER;
6059 recoil = 0;
6060 size = 3000;
6061 enemy_soundf(e, NWAV_BALL1, 300 + grand(30));
6062 break;
6063 case ENEMY_BOSS1_2:
6064 btype = BULLET_SEEKER1;
6065 damage = DAM_SMALL_GREEN_SEEKER;
6066 timer = 100;
6067 timer_rand = 50;
6068 mass = 50;
6069 speed = 7000;
6070 firing_distance = 41000;
6071 enemy[e].recycle = 33;
6072 speed_div = 3;
6073 multiple = 1;
6074 colourise_bullet(colours, COLOURISE_GREEN_SEEKER1);
6075 colours_for_cloud [0] = TRANS_DGREEN;
6076 colours_for_cloud [1] = TRANS_LGREEN;
6077 colours_for_cloud [2] = TRANS_YELLOW;
6078 recoil = 5;
6079 special1 = closest_target(enemy[e].x, enemy[e].y);
6080 special2 = 30;
6081 special3 = 32;
6082 special4 = 100;
6083 special5 = 4001;
6084 angle = grand(ANGLE_FULL);
6085 enemy_soundf(e, NWAV_SEEKER, 700 + grand(150));
6086 break;
6087 case ENEMY_BOSS1_3:
6088 btype = BULLET_BOLT;
6089 damage = 150;
6090 timer = 60;
6091 timer_rand = 20;
6092 mass = 100;
6093 speed = 8000;
6094 // speed_rand = 3000;
6095 colours [0] = TRANS_YELLOW;
6096 colours [1] = TRANS_ORANGE;
6097 colours [2] = TRANS_LRED;
6098 colours [3] = TRANS_DRED;
6099 colours_for_cloud [0] = TRANS_DRED;
6100 colours_for_cloud [1] = TRANS_LRED;
6101 colours_for_cloud [2] = TRANS_YELLOW;
6102 firing_distance = 35000;
6103 // enemy[e].recycle = 6 + grand(4);
6104 enemy[e].recycle = 55;
6105 speed_div = 3;
6106 multiple = 1;
6107 // angle_increment = enemy[e].attribute [0] - enemy[e].angle;
6108 size = 2000;
6109 recoil = 2000;
6110 enemy_sound_fire(e, NWAV_BURSTZ, 1200, 150, firing_distance);
6111 break;
6112 case ENEMY_BOSS1_TURRET1:
6113 btype = BULLET_BALL1;
6114 damage = 150;
6115 timer = 40;
6116 timer_rand = 20;
6117 mass = 10;
6118 speed = 5000;
6119 firing_distance = 9000;
6120 enemy[e].recycle = 100;
6121 speed_div = 3;
6122 multiple = 3;
6123 angle_increment = ANGLE_1_EIGHTH;
6124 angle -= ANGLE_1_EIGHTH;
6125 recoil = 100;
6126 size = 3000;
6127 enemy_soundf(e, NWAV_MULTI, 300 + grand(10));
6128 break;
6129 case ENEMY_BOSS1_TURRET2:
6130 btype = BULLET_CIRCLES2;
6131 damage = 150;
6132 timer = 120;
6133 timer_rand = 30;
6134 mass = 50;
6135 speed = 5000;
6136 firing_distance = 9000;
6137 enemy[e].recycle = 100;
6138 speed_div = 3;
6139 multiple = 1;
6140 angle_increment = 0;
6141 colours [0] = COLOUR_YELLOW8;
6142 recoil = 100;
6143 size = 5000;
6144 enemy_soundf(e, NWAV_CHIME2, 1200 + grand(50));
6145 break;
6146 case ENEMY_BOSS1_TURRET3:
6147 btype = BULLET_BALL2;
6148 damage = 200;
6149 timer = 45;
6150 timer_rand = 20;
6151 mass = 10;
6152 speed = 5500;
6153 firing_distance = 9000;
6154 enemy[e].recycle = 55;
6155 speed_div = 3;
6156 multiple = 1;
6157 recoil = 100;
6158 size = 3000;
6159 enemy_soundf(e, NWAV_BALL1, 800 + grand(30));
6160 break;
6161 case ENEMY_BOSS2:
6162 btype = BULLET_BOLT;
6163 damage = 250;
6164 timer = 60;
6165 timer_rand = 20;
6166 mass = 100;
6167 speed = 5000;
6168 speed_rand = 3000;
6169 colours [0] = TRANS_YELLOW;
6170 colours [1] = TRANS_LGREEN;
6171 colours [2] = TRANS_LGREEN;
6172 colours [3] = TRANS_DGREEN;
6173 colours_for_cloud [0] = TRANS_DGREEN;
6174 colours_for_cloud [1] = TRANS_LGREEN;
6175 colours_for_cloud [2] = TRANS_YELLOW;
6176 firing_distance = 35000;
6177 // enemy[e].recycle = 6 + grand(4);
6178 enemy[e].recycle = 21 + grand(6);
6179 speed_div = 3;
6180 multiple = 2;
6181 angle_increment = enemy[e].attribute [0] - enemy[e].angle;
6182 size = 1000;
6183 recoil = 100;
6184 enemy_soundvf(e, NWAV_BURSTZ, 190, 1500);
6185 break;
6186 case ENEMY_BOSS2_2:
6187 enemy[e].attribute [0] ++;
6188 if (enemy[e].attribute [0] >= 60)
6189 {
6190 btype = BULLET_CHARGE;
6191 damage = 1;
6192 timer = 60;
6193 timer_rand = 20;
6194 mass = 100;
6195 speed = 21000;
6196 // speed_rand = 3000;
6197 colours [0] = TRANS_WHITE;
6198 colours [1] = TRANS_LBLUE;
6199 colours [2] = TRANS_DBLUE;
6200 colours [3] = TRANS_DGREY;
6201 colours_for_cloud [0] = TRANS_DBLUE;
6202 colours_for_cloud [1] = TRANS_LBLUE;
6203 colours_for_cloud [2] = TRANS_WHITE;
6204 /* colours [0] = TRANS_YELLOW;
6205 colours [1] = TRANS_LGREEN;
6206 colours [2] = TRANS_DGREEN;
6207 colours [3] = TRANS_DGREY;
6208 colours_for_cloud [0] = TRANS_DGREEN;
6209 colours_for_cloud [1] = TRANS_LGREEN;
6210 colours_for_cloud [2] = TRANS_YELLOW;*/
6211 firing_distance = 35000;
6212 // enemy[e].recycle = 6 + grand(4);
6213 enemy[e].recycle = 99;
6214 enemy[e].attribute [0] = 0;
6215 speed_div = 3;
6216 size = 13000;
6217 recoil = 2900;
6218 line_blast(enemy[e].x + xpart(enemy[e].angle, firing_distance), enemy[e].y + ypart(enemy[e].angle, firing_distance), BULLET_CHARGE_LINE, e);
6219 enemy_sound_fire(e, NWAV_BURSTZL, 500, 255, firing_distance);
6220 }
6221 else
6222 {
6223 if (enemy[e].attribute [0] % 5 == 0)
6224 enemy_sound_fire(e, NWAV_SZAP, 50 + enemy[e].attribute [0] * 1, 100, 35000);
6225 if (enemy[e].attribute [0] <= 32)// && grand(2) == 0)
6226 {
6227 btype = BULLET_CHARGE_LINE;
6228 damage = 0;//DAM_WORMS1;
6229 timer = 80;
6230 timer_rand = 30;
6231 mass = 1;
6232 speed = 0;//12000;
6233 firing_distance = 5000 + grand(120000);
6234 enemy[e].recycle = 1;
6235 speed_div = 3;
6236 multiple = 1;
6237 // angle = grand(ANGLE_FULL);
6238 // displaced = grand(110);
6239 // displace_series [0] = 1;
6240 // angle_increment = 102;//ANGLE_1_SIXTEENTH;
6241 colours [0] = TRANS_DBLUE;
6242 colours [1] = TRANS_LBLUE;
6243 colours [2] = TRANS_LBLUE;
6244 colours [3] = TRANS_WHITE;
6245 /* colours [0] = TRANS_DGREEN;
6246 colours [1] = TRANS_DGREEN;
6247 colours [2] = TRANS_LGREEN;
6248 colours [3] = TRANS_YELLOW;*/
6249 recoil = 0;
6250 enemy[e].recycle = 1;
6251 special2 = e;
6252 scatter = ANGLE_HALF;
6253 }
6254 else
6255 return;
6256 }
6257 break;
6258 case ENEMY_BOSS3_2:
6259 btype = BULLET_NOVA;
6260 damage = 0; // uses blast for damage
6261 timer = 200;
6262 // timer_rand = 20;
6263 mass = 100;
6264 speed = 25000;
6265 speed_rand = 10000;
6266 colours [3] = TRANS_YELLOW; // used for hole lines
6267 colours [2] = TRANS_ORANGE;
6268 colours [1] = TRANS_LRED;
6269 colours [0] = TRANS_DRED;
6270 /* colours_for_cloud [0] = TRANS_DGREEN;
6271 colours_for_cloud [1] = TRANS_LGREEN;
6272 colours_for_cloud [2] = TRANS_YELLOW;*/
6273 firing_distance = 35000;
6274 // enemy[e].recycle = 6 + grand(4);
6275 enemy[e].recycle = 350;
6276 speed_div = 3;
6277 // multiple = 2;
6278 // angle_increment = enemy[e].attribute [0] - enemy[e].angle;
6279 size = 1000;
6280 recoil = 3500;
6281 enemy_sound_fire(e, NWAV_BURSTZL, 300, 255, firing_distance);
6282 break;
6283 case ENEMY_BOSS3_3:
6284 btype = BULLET_SWIRL1;
6285 damage = 250;
6286 timer = 150;
6287 timer_rand = 0;
6288 mass = 120;
6289 speed = 4500 + grand(3000);
6290 size = 5000;
6291 colours [0] = TRANS_YELLOW;
6292 colours [1] = TRANS_ORANGE;
6293 colours [2] = TRANS_LRED;
6294 colours [3] = TRANS_DRED;
6295 firing_distance = -35000;
6296 enemy[e].recycle = 152; // should only have 1 swirl1 at once
6297 speed_div = 3;
6298 recoil = 1200;
6299 enemy[e].attribute [0] = 16;
6300 enemy_sound_fire(e, NWAV_BURSTZL, 400, 255, firing_distance);
6301 break;
6302 case ENEMY_BOSS2_TURRET1:
6303 btype = BULLET_BIGBALL1;
6304 damage = 250;
6305 timer = 50;
6306 timer_rand = 30;
6307 mass = 80;
6308 speed = 5000;
6309 size = 4000;
6310 colours [0] = TRANS_YELLOW;
6311 colours [1] = TRANS_ORANGE;
6312 colours [2] = TRANS_LRED;
6313 colours [3] = TRANS_DRED;
6314 firing_distance = 13000;
6315 enemy[e].recycle = 60;
6316 speed_div = 3;
6317 recoil = 600;
6318 special1 = 5; // radius of circle
6319 special2 = 7; // radius of outer circle
6320 enemy_soundf(e, NWAV_BALL1, 100 + grand(10));
6321 break;
6322 case ENEMY_BOSS2_TURRET2:
6323 btype = BULLET_ZAP_DRAG;
6324 damage = 100;
6325 timer = 30;
6326 timer_rand = 10;
6327 mass = 10;
6328 speed = 9000;
6329 firing_distance = 12000;
6330 speed_div = 3;
6331 multiple = 1;
6332 colours [0] = COLOUR_BLUE8;
6333 colours [1] = COLOUR_BLUE7;
6334 colours [2] = COLOUR_BLUE6;
6335 colours [3] = COLOUR_BLUE4;
6336 recoil = 0;
6337 scatter = ANGLE_1_32;
6338 if (enemy[e].burst_fire > 0)
6339 {
6340 enemy[e].recycle = 8;
6341 enemy[e].burst_fire --;
6342 }
6343 else
6344 {
6345 enemy[e].recycle = 90;
6346 enemy[e].burst_fire = 6 + grand(5); // also in creation
6347 }
6348 special1 = -2;
6349 enemy_soundf(e, NWAV_SZAP, 1000 + grand(50));
6350 break;
6351 case ENEMY_BOSS2_TURRET4:
6352 btype = BULLET_BFLAK;
6353 damage = 50;
6354 timer = 30;
6355 timer_rand = 3;
6356 if (enemy[e].attacking != ATTACK_NONE
6357 && actor[enemy[e].attacking].in_play == 1)
6358 {
6359 timer = hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x);
6360 timer /= 7000;
6361 // timer = t / 7;
6362 if (timer < 5)
6363 timer = 5;
6364 if (timer > 45)
6365 timer = 45;
6366 }
6367 mass = 10;
6368 speed = 12000;
6369 colours_for_cloud [0] = TRANS_WHITE;
6370 colours_for_cloud [1] = TRANS_PURPLE;
6371 colours_for_cloud [2] = TRANS_LBLUE;
6372 firing_distance = 14000;
6373 enemy[e].recycle = 85;
6374 speed_div = 3;
6375 enemy[e].attribute [0] = 56;
6376 enemy_soundf(e, NWAV_DNO, 300 + grand(100));
6377 break;
6378 case ENEMY_BOSS3_TURRET2:
6379 btype = BULLET_ZAP_DRAG;
6380 damage = 100;
6381 timer = 30;
6382 timer_rand = 10;
6383 mass = 10;
6384 speed = 12000;
6385 firing_distance = 6000;
6386 speed_div = 3;
6387 multiple = 1;
6388 colours [0] = COLOUR_BLUE8;
6389 colours [1] = COLOUR_BLUE7;
6390 colours [2] = COLOUR_BLUE6;
6391 colours [3] = COLOUR_BLUE4;
6392 recoil = 0;
6393 scatter = ANGLE_1_32;
6394 displaced = 7;
6395 displace_series [0] = -1;
6396 if (enemy[e].burst_fire % 2 == 0)
6397 displace_series [0] = 1;
6398 if (enemy[e].burst_fire > 0)
6399 {
6400 enemy[e].recycle = 4;
6401 enemy[e].burst_fire --;
6402 }
6403 else
6404 {
6405 enemy[e].recycle = 90;
6406 enemy[e].burst_fire = 6 + grand(5); // also in creation
6407 }
6408 special1 = -1;
6409 enemy_soundf(e, NWAV_SZAP, 700 + grand(50));
6410 break;
6411 case ENEMY_BOSS3_TURRET1:
6412 btype = BULLET_BLAST;
6413 damage = 250;
6414 timer = 60;
6415 timer_rand = 20;
6416 mass = 40;
6417 speed = 6000;
6418 colours [0] = TRANS_YELLOW;
6419 colours [1] = TRANS_LGREEN;
6420 colours [2] = TRANS_DGREEN;
6421 colours [3] = TRANS_DGREY;
6422 firing_distance = 11000;
6423 enemy[e].recycle = 100;
6424 speed_div = 3;
6425 multiple = 3;
6426 angle_increment = ANGLE_1_SIXTEENTH;
6427 angle -= ANGLE_1_SIXTEENTH;//(ANGLE_1_SIXTEENTH + ANGLE_1_32);
6428 enemy_soundf(e, NWAV_MULTI, 500 + grand(10));
6429 // recoil = 1800;
6430 size = 2000;
6431 enemy_soundf(e, NWAV_LZAP, 900 + grand(100));
6432 break;
6433 case ENEMY_BOSS3_TURRET3:
6434 btype = BULLET_BFLAK2;
6435 damage = 1;
6436 timer = 50;
6437 timer_rand = 25;
6438 /* if (enemy[e].attacking != ATTACK_NONE
6439 && actor[enemy[e].attacking].in_play == 1)
6440 {
6441 timer = hypot(enemy[e].y - actor[enemy[e].attacking].y, enemy[e].x - actor[enemy[e].attacking].x);
6442 timer /= 7000;
6443 // timer = t / 7;
6444 if (timer < 5)
6445 timer = 5;
6446 if (timer > 45)
6447 timer = 45;
6448 }*/
6449 colours [0] = COLOUR_YELLOW8;
6450 colours [1] = COLOUR_YELLOW6;
6451 colours [2] = COLOUR_ORANGE6;
6452 colours [3] = COLOUR_RED5;
6453 mass = 10;
6454 speed = 12000;
6455 colours_for_cloud [0] = TRANS_WHITE;
6456 colours_for_cloud [1] = TRANS_YELLOW;
6457 colours_for_cloud [2] = TRANS_ORANGE;
6458 firing_distance = 16000;
6459 enemy[e].recycle = 60;
6460 speed_div = 3;
6461 enemy[e].attribute [0] = 56;
6462 enemy_soundf(e, NWAV_DNO, 150 + grand(50));
6463 break;
6464 case ENEMY_DEFENDER1:
6465 btype = BULLET_BIGBALL1;
6466 damage = 200;
6467 timer = 120;
6468 timer_rand = 20;
6469 mass = 150;
6470 speed = 2500;
6471 size = 6000;
6472 colours [0] = TRANS_YELLOW;
6473 colours [1] = TRANS_LGREEN;
6474 colours [2] = TRANS_DGREEN;
6475 colours [3] = TRANS_DGREY;
6476 firing_distance = 23000;
6477 enemy[e].recycle = 43;
6478 speed_div = 3;
6479 recoil = 600;
6480 special1 = 6; // radius of circle
6481 special2 = 8; // radius of outer circle
6482 // enemy_soundf(e, NWAV_LZAP, 300 + grand(10));
6483 enemy_soundf(e, NWAV_BALL1, 100 + grand(10));
6484 break;
6485 case ENEMY_DEFENDER1_TURRET1:
6486 btype = BULLET_BALL1;
6487 damage = 150;
6488 timer = 40;
6489 timer_rand = 20;
6490 mass = 10;
6491 speed = 5000;
6492 firing_distance = 9000;
6493 enemy[e].recycle = 120;
6494 speed_div = 3;
6495 multiple = 3;
6496 angle_increment = ANGLE_1_EIGHTH;
6497 angle -= ANGLE_1_EIGHTH;
6498 recoil = 100;
6499 size = 3000;
6500 enemy_soundf(e, NWAV_MULTI, 300 + grand(10));
6501 break;
6502 case ENEMY_DEFENDER1_TURRET2:
6503 btype = BULLET_BALL2;
6504 damage = 200;
6505 timer = 45;
6506 timer_rand = 20;
6507 mass = 10;
6508 speed = 5500;
6509 firing_distance = 9000;
6510 enemy[e].recycle = 65;
6511 speed_div = 3;
6512 multiple = 1;
6513 recoil = 100;
6514 size = 3000;
6515 enemy_soundf(e, NWAV_BALL1, 800 + grand(30));
6516 break;
6517 case ENEMY_DEFENDER1_TURRET3:
6518 btype = BULLET_BALL1;
6519 damage = 150;
6520 timer = 40;
6521 timer_rand = 20;
6522 mass = 10;
6523 speed = 5000;
6524 firing_distance = 9000;
6525 enemy[e].recycle = 21;
6526 speed_div = 3;
6527 recoil = 100;
6528 size = 3000;
6529 enemy_soundf(e, NWAV_BALL1, 800 + grand(30));
6530 break;
6531 case ENEMY_DEFENDER2:
6532 btype = BULLET_BIGBALL1;
6533 damage = 300;
6534 timer = 120;
6535 timer_rand = 20;
6536 mass = 200;
6537 speed = 3500;
6538 size = 9000;
6539 colours [0] = TRANS_YELLOW;
6540 colours [1] = TRANS_ORANGE;
6541 colours [2] = TRANS_LRED;
6542 colours [3] = TRANS_DRED;
6543 firing_distance = 23000;
6544 enemy[e].recycle = 40;
6545 speed_div = 3;
6546 recoil = 600;
6547 special1 = 9; // radius of circle
6548 special2 = 11; // radius of outer circle
6549 // enemy_soundf(e, NWAV_LZAP, 200 + grand(10));
6550 enemy_soundf(e, NWAV_BALL1, 80 + grand(10));
6551 break;
6552 case ENEMY_DEFENDER3:
6553 btype = BULLET_BIGBALL1;
6554 damage = 400;
6555 timer = 120;
6556 timer_rand = 20;
6557 mass = 250;
6558 speed = 4000;
6559 size = 12000;
6560 colours [0] = TRANS_WHITE;
6561 colours [1] = TRANS_LBLUE;
6562 colours [2] = TRANS_DBLUE;
6563 colours [3] = TRANS_DGREY;
6564 firing_distance = 23000;
6565 enemy[e].recycle = 38;
6566 speed_div = 3;
6567 recoil = 600;
6568 special1 = 12; // radius of circle
6569 special2 = 15; // radius of outer circle
6570 // enemy_soundf(e, NWAV_LZAP, 150 + grand(10));
6571 enemy_soundf(e, NWAV_BALL1, 70 + grand(5));
6572 break;
6573 case ENEMY_DEFENDER3_TURRET3:
6574 btype = BULLET_SLIVER;
6575 damage = 100;
6576 timer = 30;
6577 timer_rand = 23;
6578 mass = 10;
6579 speed = 3500;
6580 speed_rand = 1000;
6581 // enemy[e].recycle = 50;
6582 // colours_for_cloud [0] = TRANS_DRED;
6583 // colours_for_cloud [1] = TRANS_LRED;
6584 // colours_for_cloud [2] = TRANS_YELLOW;
6585 colours [0] = TRANS_YELLOW;
6586 colours [1] = COLOUR_YELLOW8;
6587 speed_div = 3;
6588 /* switch(enemy[e].attribute [0])
6589 {
6590 default:
6591 case 0:
6592 firing_distance = 12000;
6593 break;
6594 case 1:
6595 displaced = 12;
6596 displace_series [0] = 1;
6597 break;
6598 case 2:
6599 firing_distance = -12000;
6600 break;
6601 case 3:
6602 displaced = 12;
6603 displace_series [0] = -1;
6604 break;
6605 }*/
6606 firing_distance = 12000;
6607 if (enemy[e].attribute [2] > 0)
6608 {
6609 enemy[e].attribute [0] --;
6610 if (enemy[e].attribute [0] == -1)
6611 enemy[e].attribute [0] = 3;
6612 }
6613 else
6614 {
6615 enemy[e].attribute [0] ++;
6616 if (enemy[e].attribute [0] >= 4)
6617 enemy[e].attribute [0] = 0;
6618 }
6619 /* special1 = grand(ANGLE_FULL);
6620 special2 = -100;
6621 if (grand(2) == 0)
6622 special2 = 100;*/
6623 special_angle2 = enemy[e].attribute [1] + enemy[e].attribute [0] * ANGLE_QUARTER;
6624 special_angle = angle;
6625
6626 special2 = grand(2);
6627 // special_angle = angle;
6628 // special_angle2 = enemy[e].attribute [1];
6629 // angle = enemy[e].attribute [1];
6630 enemy[e].recycle = 5;
6631 enemy_sound(e, NWAV_CLICK);
6632 break;
6633 case ENEMY_DEFENDER3_TURRET5:
6634 btype = BULLET_BALL2;
6635 damage = 200;
6636 timer = 65;
6637 timer_rand = 20;
6638 mass = 10;
6639 speed = 3500;
6640 firing_distance = 12000;
6641 enemy[e].recycle = 22;
6642 speed_div = 3;
6643 multiple = 2;
6644 angle_increment = ANGLE_HALF;
6645 recoil = 100;
6646 size = 3000;
6647 enemy_soundf(e, NWAV_MULTI, 900 + grand(10));
6648 break;
6649 case ENEMY_DEFENDER3_TURRET6:
6650 btype = BULLET_ZIGZAG1;
6651 damage = 200;
6652 timer = 19;
6653 timer_rand = 5;
6654 mass = 20;
6655 speed = 12000;
6656 firing_distance = 12000;
6657 enemy[e].recycle = 35;
6658 speed_div = 3;
6659 multiple = 1;
6660 angle_increment = 0;
6661 colours [0] = COLOUR_ORANGE4;
6662 colours [1] = COLOUR_ORANGE6;
6663 colours [2] = COLOUR_YELLOW6;
6664 colours [3] = COLOUR_YELLOW8;
6665 recoil = 100;
6666 enemy[e].attribute [0] = 7;
6667 special1 = 4000;
6668 size = 2000;
6669 enemy_soundf(e, NWAV_BLOCK, 1900 + grand(100));
6670 break;
6671 /* btype = BULLET_ZAP_DRAG;
6672 damage = 100;
6673 timer = 27;
6674 // timer_rand = 12;
6675 mass = 10;
6676 speed = 13000;
6677 // speed_rand = 7000;
6678 firing_distance = 12000;
6679 enemy[e].recycle = 55;
6680 colours [0] = COLOUR_YELLOW8;
6681 colours [1] = COLOUR_YELLOW7;
6682 colours [2] = COLOUR_ORANGE7;
6683 colours [3] = COLOUR_RED6;
6684 speed_div = 3;
6685 multiple = 8;
6686 // scatter = ANGLE_1_SIXTEENTH;
6687 angle_increment = ANGLE_1_32;
6688 angle -= ANGLE_1_EIGHTH;
6689 recoil = 500;
6690 break;*/
6691
6692 /* case ENEMY_STINGER2:
6693 btype = BULLET_STING;
6694 damage = 150;
6695 timer = 30;
6696 timer_rand = 20;
6697 mass = 10;
6698 speed = 3000;
6699 colours [0] = GC_YELLOW8;
6700 colours [1] = GC_YELLOW6;
6701 colours [2] = GC_YELLOW4;
6702 colours [3] = GC_YELLOW2;
6703 firing_distance = 4000;
6704 speed_div = 5;
6705 if (enemy[e].burst_fire > 0)
6706 {
6707 enemy[e].recycle = 15;
6708 enemy[e].burst_fire --;
6709 }
6710 else
6711 {
6712 enemy[e].recycle = 120;
6713 enemy[e].burst_fire = 4 + grand(4);
6714 }
6715 break;
6716 case ENEMY_STINGER3:
6717 btype = BULLET_STING;
6718 damage = 150;
6719 timer = 20;
6720 timer_rand = 15;
6721 mass = 10;
6722 speed = 4000;
6723 // colours [0] = GC_RED8;
6724 // colours [1] = GC_RED6;
6725 // colours [2] = GC_RED4;
6726 // colours [3] = GC_RED2;
6727 colours [0] = GC_WHITE;
6728 colours [1] = GC_RED8;
6729 colours [2] = GC_RED5;
6730 colours [3] = GC_RED3;
6731 firing_distance = 4000;
6732 speed_div = 4;
6733 enemy[e].recycle = 66;
6734 multiple = 3;
6735 angle_increment = ANGLE_1_SIXTEENTH;
6736 angle -= ANGLE_1_SIXTEENTH;
6737 enemy_soundf(e, ESOUND_STING, 900 + grand(400));
6738 break;*/
6739 default:
6740 return;
6741 }
6742
6743 // float cos_angle;
6744 // float sin_angle;
6745
6746 int xs;
6747 int ys;
6748
6749 int x;
6750 int y;
6751 int i;
6752
6753 for (i = 0; i < multiple; i ++)
6754 {
6755 /*
6756 firing_angle = angle + i * angle_increment;
6757
6758 cos_angle = cos(angle_to_radians(firing_angle));
6759 sin_angle = sin(angle_to_radians(firing_angle));
6760
6761 xs = enemy[e].x_speed + cos_angle * speed;
6762 ys = enemy[e].y_speed + sin_angle * speed;
6763
6764 x = enemy[e].x + cos_angle * firing_distance;
6765 y = enemy[e].y + sin_angle * firing_distance;
6766
6767 */
6768
6769 firing_angle = angle + i * angle_increment + grand(angle_rand * 2) - angle_rand + grand(scatter) - grand(scatter);
6770
6771 // cos_angle = cos(angle_to_radians(firing_angle));
6772 // sin_angle = sin(angle_to_radians(firing_angle));
6773
6774 if (special_angle != -1) // overblatter, some others
6775 {
6776 if (special_angle2 != -1)
6777 firing_angle = special_angle2;
6778 x = enemy[e].x + xpart(firing_angle, firing_distance);
6779 y = enemy[e].y + ypart(firing_angle, firing_distance);
6780 if (displaced != 0)
6781 {
6782 x += xpart(firing_angle + (ANGLE_QUARTER * displace_series [i]), GRAIN * displaced);
6783 y += ypart(firing_angle + (ANGLE_QUARTER * displace_series [i]), GRAIN * displaced);
6784 }
6785 firing_angle = special_angle;
6786 xs = enemy[e].x_speed + xpart(firing_angle, speed + grand(speed_rand));
6787 ys = enemy[e].y_speed + ypart(firing_angle, speed + grand(speed_rand));
6788 if (special_angle2 == -1)
6789 {
6790 x += xpart(firing_angle, firing_distance);
6791 y += ypart(firing_angle, firing_distance);
6792 }
6793 }
6794 else
6795 {
6796 xs = enemy[e].x_speed + xpart(firing_angle, speed + grand(speed_rand));
6797 ys = enemy[e].y_speed + ypart(firing_angle, speed + grand(speed_rand));
6798
6799 x = enemy[e].x + xpart(firing_angle, firing_distance);
6800 y = enemy[e].y + ypart(firing_angle, firing_distance);
6801
6802 if (displaced != 0)
6803 {
6804 // x += cos(angle_to_radians(firing_angle + (ANGLE_QUARTER * displace_series [i]))) * GRAIN * displaced;
6805 // y += sin(angle_to_radians(firing_angle + (ANGLE_QUARTER * displace_series [i]))) * GRAIN * displaced;
6806 x += xpart(firing_angle + (ANGLE_QUARTER * displace_series [i]), GRAIN * displaced);
6807 y += ypart(firing_angle + (ANGLE_QUARTER * displace_series [i]), GRAIN * displaced);
6808 }
6809 }
6810
6811
6812 /* // Note: recoil is added for every single bullet fired,
6813 // so make it low for multiple bullets
6814 if (recoil != 0)
6815 {
6816 accelerate_enemy(e, firing_angle + ANGLE_HALF, recoil);
6817 }
6818 */
6819
6820 switch(btype)
6821 {
6822 case BULLET_DISRUPT2:
6823 colours [0] = TRANS_REVERSE;
6824 create_cloud(CLOUD_MED_TRANS_CIRCLE,
6825 x, y, 0, 0, 0, 0, 1000, -9, 3, 0, 0, 0, colours);
6826 break;
6827 case BULLET_DISRUPT3:
6828 colours [0] = TRANS_DARKEN;
6829 create_cloud(CLOUD_MED_TRANS_CIRCLE,
6830 x, y, 0, 0, 0, 0, 1000, -9, 3, 0, 0, 0, colours);
6831 break;
6832 case BULLET_DISRUPT1:
6833 create_cloud(CLOUD_DISTORT,
6834 x, y, 0, 0, 0, 0, 1000, -9, 3, 0, 0, 0, colours);
6835 break;
6836 }
6837
6838 switch(enemy[e].type)
6839 {
6840 case ENEMY_DEFENDER3:
6841 create_cloud(CLOUD_BLAST_CIRCLE,
6842 x, y, 0, 0,
6843 enemy[e].x_speed + xpart(enemy[e].angle - ANGLE_HALF + ANGLE_1_EIGHTH, 13000),
6844 enemy[e].y_speed + ypart(enemy[e].angle - ANGLE_HALF + ANGLE_1_EIGHTH, 13000),
6845 200 + grand(10), 10, 0, 0, 0, 0, colours);
6846 create_cloud(CLOUD_BLAST_CIRCLE,
6847 x, y, 0, 0,
6848 enemy[e].x_speed + xpart(enemy[e].angle - ANGLE_HALF - ANGLE_1_EIGHTH, 13000),
6849 enemy[e].y_speed + ypart(enemy[e].angle - ANGLE_HALF - ANGLE_1_EIGHTH, 13000),
6850 200 + grand(10), 10, 0, 0, 0, 0, colours);
6851 case ENEMY_DEFENDER1:
6852 case ENEMY_DEFENDER2:
6853 case ENEMY_BOSS2_TURRET1:
6854 create_cloud(CLOUD_BLAST_CIRCLE,
6855 x, y, 0, 0,
6856 enemy[e].x_speed + xpart(enemy[e].angle + ANGLE_QUARTER, 9000),
6857 enemy[e].y_speed + ypart(enemy[e].angle + ANGLE_QUARTER, 9000),
6858 200 + grand(10), 10, 0, 0, 0, 0, colours);
6859 create_cloud(CLOUD_BLAST_CIRCLE,
6860 x, y, 0, 0,
6861 enemy[e].x_speed + xpart(enemy[e].angle - ANGLE_QUARTER, 9000),
6862 enemy[e].y_speed + ypart(enemy[e].angle - ANGLE_QUARTER, 9000),
6863 200 + grand(10), 10, 0, 0, 0, 0, colours);
6864 create_cloud(CLOUD_BLAST_CIRCLE,
6865 x, y, 0, 0,
6866 enemy[e].x_speed + xpart(enemy[e].angle - ANGLE_HALF, 9000),
6867 enemy[e].y_speed + ypart(enemy[e].angle - ANGLE_HALF, 9000),
6868 200 + grand(10), 10, 0, 0, 0, 0, colours);
6869 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 1200);
6870 break;
6871 case ENEMY_OVERSPINNER:
6872 create_cloud(CLOUD_BLAST_CIRCLE,
6873 x, y, 0, 0,
6874 enemy[e].x_speed,
6875 enemy[e].y_speed,
6876 400 + grand(10), 10, 2, 0, 0, 0, colours);
6877 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 800);
6878 break;
6879 case ENEMY_OVERSPIKEY:
6880 create_cloud(CLOUD_BLAST_CIRCLE,
6881 x, y, 0, 0,
6882 enemy[e].x_speed,
6883 enemy[e].y_speed,
6884 200 + grand(10), 10, 2, 0, 0, 0, colours);
6885 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 400);
6886 break;
6887 case ENEMY_WORMER1:
6888 case ENEMY_WORMER2:
6889 case ENEMY_WORMER3:
6890 case ENEMY_WORMER4:
6891 if (i == 0)
6892 simple_light(enemy[e].x, enemy[e].y, enemy[e].x_speed, enemy[e].y_speed, 900);
6893 // NOT x,y, because then it won't be centred
6894 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 320);
6895 // if (grand(2) == 0)
6896 // special2 *= -1;
6897 // special3 = 3 + grand(3);
6898 break;
6899 case ENEMY_DISRUPTER2:
6900 case ENEMY_DISRUPTER3:
6901 simple_cloud_trans(colours_for_cloud [0], x, y, 0, 0, 520);
6902 break;
6903 case ENEMY_BOMBER2:
6904 if (i != 0) break;
6905 case ENEMY_BOMBER1:
6906 colours [0] = TRANS_YELLOW;
6907 colours [1] = TRANS_ORANGE;
6908 colours [2] = TRANS_LRED;
6909 colours [3] = TRANS_DRED;
6910 create_cloud(CLOUD_TRANS_FADING_CIRCLE,
6911 x, y,
6912 0, 0,
6913 enemy[e].x_speed, enemy[e].y_speed,
6914 50, -9, 3, 0, 0, 0, colours);
6915 break;
6916 case ENEMY_LEAPER1:
6917 case ENEMY_FIGHTER1:
6918 case ENEMY_SPIKEY4:
6919 case ENEMY_CRUISER1:
6920 case ENEMY_CRUISER3:
6921 // case ENEMY_CRUISER2_TURRET:
6922 colours [0] = TRANS_YELLOW;
6923 colours [1] = TRANS_ORANGE;
6924 colours [2] = TRANS_LRED;
6925 colours [3] = TRANS_DRED;
6926 create_cloud(CLOUD_TRANS_FADING_CIRCLE,
6927 x, y,
6928 0, 0,
6929 enemy[e].x_speed, enemy[e].y_speed,
6930 30, -9, 3, 0, 0, 0, colours);
6931 break;
6932 case ENEMY_CRUISER3_TURRET:
6933 create_cloud(CLOUD_SMALL_CIRCLE,
6934 x, y,
6935 0, 0,
6936 enemy[e].x_speed, enemy[e].y_speed,
6937 530, 150, 50, 0, 0, 0, colours);
6938 break;
6939 case ENEMY_BOMBER3:
6940 case ENEMY_BOSS2_TURRET2:
6941 case ENEMY_BOSS3_TURRET2:
6942 colours [0] = TRANS_WHITE;
6943 colours [1] = TRANS_LBLUE;
6944 colours [2] = TRANS_DBLUE;
6945 colours [3] = TRANS_DBLUE;
6946 create_cloud(CLOUD_TRANS_FADING_CIRCLE,
6947 x, y,
6948 0, 0,
6949 enemy[e].x_speed, enemy[e].y_speed,
6950 30, -9, 3, 0, 0, 0, colours);
6951 break;
6952 case ENEMY_CRUISER1_TURRET:
6953 case ENEMY_CRUISER2_TURRET:
6954 case ENEMY_DEFENDER2_TURRET3:
6955 case ENEMY_CRUISER4_TURRET:
6956 place_burstlet_burst(x, y, enemy[e].x_speed, enemy[e].y_speed, 2 + grand(2), 2, 2, 1000, 1500,
6957 1, colours_for_cloud);
6958 simple_light(x, y, 0, 0, 400);
6959 //simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 400);
6960 break;
6961 case ENEMY_DEFENDER2_TURRET1:
6962 case ENEMY_DEFENDER2_TURRET2:
6963 // case ENEMY_DEFENDER2_TURRET3:
6964 case ENEMY_BRACKET1:
6965 case ENEMY_BRACKET2:
6966 case ENEMY_BRACKET3:
6967 case ENEMY_BRACKET4:
6968 case ENEMY_BRACKET5:
6969 case ENEMY_BLATTER1:
6970 case ENEMY_LEAPER2:
6971 case ENEMY_DEFENDER3_TURRET3:
6972 colours [0] = TRANS_YELLOW;
6973 colours [1] = TRANS_LGREEN;
6974 colours [2] = TRANS_DGREEN;
6975 colours [3] = TRANS_DGREEN;
6976 create_cloud(CLOUD_TRANS_FADING_CIRCLE,
6977 x, y,
6978 0, 0,
6979 enemy[e].x_speed, enemy[e].y_speed,
6980 30, -9, 3, 0, 0, 0, colours);
6981 // 300, -100, 40, 0, 0, 0, colours);
6982 break;
6983 case ENEMY_BLATTER5:
6984 if (i > 0) break;
6985 colours [0] = TRANS_YELLOW;
6986 colours [1] = TRANS_LGREEN;
6987 colours [2] = TRANS_DGREEN;
6988 colours [3] = TRANS_DGREEN;
6989 create_cloud(CLOUD_TRANS_FADING_CIRCLE,
6990 x, y,
6991 0, 0,
6992 enemy[e].x_speed, enemy[e].y_speed,
6993 80, -9, 3, 0, 0, 0, colours);
6994 break;
6995 case ENEMY_FIGHTER2:
6996 case ENEMY_MINER3_TURRET:
6997 colours [0] = TRANS_WHITE;
6998 colours [1] = TRANS_LBLUE;
6999 colours [2] = TRANS_DBLUE;
7000 colours [3] = TRANS_DBLUE;
7001 create_cloud(CLOUD_TRANS_FADING_CIRCLE,
7002 x, y,
7003 0, 0,
7004 enemy[e].x_speed, enemy[e].y_speed,
7005 30, -9, 3, 0, 0, 0, colours);
7006 break;
7007 case ENEMY_HEAD1:
7008 case ENEMY_HEAD1_EYE1:
7009 case ENEMY_HEAD1_EYE2:
7010 case ENEMY_HEAD1_EYE3:
7011 case ENEMY_BRACKET4_TURRET:
7012 case ENEMY_SHADOW1:
7013 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 320);
7014 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 320);
7015 break;
7016 case ENEMY_SPINNER1:
7017 case ENEMY_SPINNER2:
7018 case ENEMY_SPINNER4:
7019 simple_cloud(COLOUR_GREEN8, x, y, enemy[e].x_speed, enemy[e].y_speed, 520);
7020 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 520);
7021 break;
7022 case ENEMY_SPINNER3:
7023 simple_cloud(COLOUR_BLUE8, x, y, enemy[e].x_speed, enemy[e].y_speed, 720);
7024 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 720);
7025 break;
7026 case ENEMY_SPINNER5:
7027 simple_cloud(COLOUR_YELLOW8, x, y, enemy[e].x_speed, enemy[e].y_speed, 520);
7028 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 520);
7029 break;
7030 case ENEMY_FORKER1:
7031 case ENEMY_FORKER2:
7032 simple_cloud(COLOUR_WHITE, x, y, enemy[e].x_speed, enemy[e].y_speed, 520);
7033 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 520);
7034 break;
7035 case ENEMY_OVERBLATTER:
7036 if (i != 0) break;
7037 case ENEMY_BOSS1_1:
7038 case ENEMY_GUARDIAN1:
7039 case ENEMY_OVERTRIANGLER_TURRET:
7040 case ENEMY_DEFENDER3_TURRET4:
7041 case ENEMY_BLATTER2:
7042 case ENEMY_BLATTER3:
7043 case ENEMY_BOSS1_TURRET1:
7044 case ENEMY_BOSS1_TURRET3:
7045 case ENEMY_DEFENDER1_TURRET1:
7046 case ENEMY_DEFENDER1_TURRET2:
7047 case ENEMY_DEFENDER1_TURRET3:
7048 case ENEMY_DEFENDER3_TURRET5:
7049 case ENEMY_MULTI1:
7050 case ENEMY_CURVE1:
7051 case ENEMY_BOSS2_TURRET3:
7052 case ENEMY_DEFENDER3_TURRET6:
7053 // if (i == 0)
7054 {
7055 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7056 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7057 }
7058 break;
7059 case ENEMY_BLATTER4:
7060 simple_cloud_trans(colours [1], x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7061 simple_cloud_trans(colours [0], x, y, enemy[e].x_speed, enemy[e].y_speed, 350);
7062 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7063 break;
7064 case ENEMY_GUARDIAN3:
7065 create_cloud(CLOUD_TWISTY_CIRCLE,
7066 x, y,
7067 0, 0,
7068 enemy[e].x_speed, enemy[e].y_speed,
7069 50, 1, 0, enemy[e].angle, special2, 0, colours);
7070 break;
7071 case ENEMY_GUARDIAN5:
7072 create_cloud(CLOUD_TWIRLY_CIRCLE,
7073 x, y,
7074 0, 0,
7075 enemy[e].x_speed, enemy[e].y_speed,
7076 50, 1, 0, enemy[e].angle, special2, 0, colours);
7077 break;
7078 case ENEMY_GUARDIAN4:
7079 case ENEMY_GUARDIAN2:
7080 case ENEMY_MULTI2:
7081 case ENEMY_MULTI3:
7082 case ENEMY_BOSS3_TURRET1:
7083 // if (i == 0)
7084 {
7085 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 950);
7086 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7087 }
7088 break;
7089 case ENEMY_BOSS1_3:
7090 case ENEMY_BOSS2:
7091 case ENEMY_TRIANGLER1:
7092 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 1150);
7093 // case ENEMY_BOSS2_TURRET1:
7094 case ENEMY_BOSS1_2:
7095 case ENEMY_MINEFIELDER1:
7096 case ENEMY_MINER1:
7097 case ENEMY_MINER2:
7098 case ENEMY_MINER3:
7099 case ENEMY_PUFFER1:
7100 case ENEMY_PUFFER2:
7101 case ENEMY_PUFFER3:
7102 case ENEMY_PUFFER4:
7103 case ENEMY_PULSER1:
7104 case ENEMY_PULSER2:
7105 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 2, 1000, 1500,
7106 4, colours_for_cloud);
7107 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 900);
7108 // if (i == 0)
7109 // {
7110 // simple_cloud_trans(TRANS_ORANGE, x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7111 // simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 550);
7112 // }
7113 break;
7114 case ENEMY_BOSS2_3:
7115 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 2000);
7116 simple_cloud_trans(TRANS_LGREEN, x, y, enemy[e].x_speed, enemy[e].y_speed, 2550);
7117 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 3, 3000, 4500,
7118 1, colours_for_cloud);
7119 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 1700);
7120 break;
7121 case ENEMY_BOSS3_2:
7122 case ENEMY_BOSS3_3:
7123 simple_cloud_trans(TRANS_WHITE, x, y, enemy[e].x_speed, enemy[e].y_speed, 3000);
7124 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 3550);
7125 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 3, 3000, 5000,
7126 1, colours_for_cloud);
7127 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 1700);
7128 break;
7129 case ENEMY_TRIANGLER2:
7130 case ENEMY_OVERBLATTER2:
7131 case ENEMY_BOSS2_TURRET4:
7132 case ENEMY_SHADOW2:
7133 simple_cloud_trans(TRANS_WHITE, x, y, enemy[e].x_speed, enemy[e].y_speed, 900);
7134 simple_cloud_trans(TRANS_LBLUE, x, y, enemy[e].x_speed, enemy[e].y_speed, 1150);
7135 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 2, 1000, 1500,
7136 4, colours_for_cloud);
7137 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 900);
7138 break;
7139 /* case ENEMY_MESSENGER:
7140 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 500);
7141 simple_cloud_trans(TRANS_LRED, x, y, enemy[e].x_speed, enemy[e].y_speed, 750);
7142 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 600);
7143 break;*/
7144 case ENEMY_TRIANGLER3:
7145 case ENEMY_BOSS3_TURRET3:
7146 simple_cloud_trans(TRANS_WHITE, x, y, enemy[e].x_speed, enemy[e].y_speed, 900);
7147 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 1150);
7148 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 2, 1000, 1500,
7149 4, colours_for_cloud);
7150 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 1000);
7151 break;
7152 case ENEMY_OVERTRIANGLER:
7153 simple_cloud_trans(TRANS_WHITE, x, y, enemy[e].x_speed, enemy[e].y_speed, 1500);
7154 simple_cloud_trans(TRANS_YELLOW, x, y, enemy[e].x_speed, enemy[e].y_speed, 1950);
7155 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 2, 1000, 3400,
7156 4, colours_for_cloud);
7157 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 2000);
7158 break;
7159 case ENEMY_BOSS2_2:
7160 if (btype == BULLET_CHARGE)
7161 {
7162 simple_cloud_trans(TRANS_WHITE, x, y, enemy[e].x_speed, enemy[e].y_speed, 3000);
7163 simple_cloud_trans(TRANS_LBLUE, x, y, enemy[e].x_speed, enemy[e].y_speed, 3550);
7164 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 2, 3000, 5000,
7165 4, colours_for_cloud);
7166 simple_light(x, y, enemy[e].x_speed, enemy[e].y_speed, 2000);
7167 }
7168 break;
7169 case ENEMY_SPIKEY5:
7170 // colours [0] = bullet[b].colours [0];
7171 create_cloud(CLOUD_LARGE_FADING_CIRCLE,
7172 x, y, 0, 0, 0, 0, 100 + grand(50), -3, 2, 0, 100 + grand(50), 0, colours);
7173 break;
7174
7175 /* case ENEMY_JELLY:
7176 place_burstlet_burst(x, y, 0, 0, 3 + grand(3), 4, 2, 1000, 1500,
7177 4, colours_for_cloud);
7178 break;*/
7179
7180 }
7181
7182 create_bullet(btype, x, y,
7183 xs, ys, OWNER_ENEMY,
7184 damage, timer + grand(timer_rand), mass, firing_angle,
7185 status, size, colours, speed_div, special1,special2,special3,special4,special5);
7186
7187 }
7188
7189 if (recoil != 0)
7190 {
7191 if (enemy[e].turret_main != -1)
7192 {
7193 accelerate_enemy(enemy[e].turret_main, angle + ANGLE_HALF, recoil);
7194 }
7195 else
7196 accelerate_enemy(e, angle + ANGLE_HALF, recoil);
7197 }
7198
7199 }
7200
7201 void zap_attack(int e)
7202 {
7203
7204 int xs = enemy[e].attribute [8], ys = enemy[e].attribute [9];
7205 int i,j, xa, ya;
7206
7207 int passing_colours [3] = {TRANS_ORANGE, TRANS_YELLOW, TRANS_WHITE};
7208
7209 place_explosion(xs, ys, 0, 0, 400 + grand(300), passing_colours);
7210 blast(xs, ys, 50000, 400, 6000, OWNER_ENEMY);
7211 // bullet_soundf(b, NWAV_BURSTZL, 300 + grand(100));
7212 play_wav_pos(NWAV_BURSTZL, 600, 255, xs, ys);
7213
7214 for (j = 0; j < 5; j ++)
7215 {
7216 xa = xs + grand(40001) - 20000;
7217 ya = ys + grand(40001) - 20000;
7218 place_explosion_no_light(xa, ya, 0, 0, 100 + grand(150), passing_colours);
7219 }
7220 place_burstlet_burst(xs, ys, 0, 0, 6,
7221 6, 4, 1500, 1500, 7, passing_colours);
7222
7223 int zigs = hypot(xs - enemy[e].x, ys - enemy[e].y) / 10000;
7224 int passing_colours2 [4] = {TRANS_DRED, TRANS_DRED, TRANS_LRED, TRANS_WHITE};
7225 int angle;
7226 int xprog, yprog, xb, yb, xc, yc;
7227
7228 for (i = 0; i < 2; i ++)
7229 {
7230 if (i == 0)
7231 {
7232 xa = enemy[e].x + xpart(enemy[e].angle + ANGLE_QUARTER, 30000);
7233 ya = enemy[e].y + ypart(enemy[e].angle + ANGLE_QUARTER, 30000);
7234 }
7235 else
7236 {
7237 xa = enemy[e].x + xpart(enemy[e].angle - ANGLE_QUARTER, 30000);
7238 ya = enemy[e].y + ypart(enemy[e].angle - ANGLE_QUARTER, 30000);
7239 }
7240
7241 create_cloud(CLOUD_LIGHT,
7242 xa,
7243 ya,
7244 0, 0, 0, 0, 800 + crandom(105),20,0, 0, 0, 0, passing_colours2);
7245
7246
7247 angle = radians_to_angle(atan2(ys - ya, xs - xa));
7248 angle &= 1023;
7249
7250 xprog = xpart(angle, 10000);
7251 yprog = ypart(angle, 10000);
7252
7253 xc = xa;
7254 yc = ya;
7255
7256 for (j = 0; j < zigs; j ++)
7257 {
7258 xa += xprog;
7259 ya += yprog;
7260 xb = xa + grand(9001) - 4500;
7261 yb = ya + grand(9001) - 4500;
7262 create_cloud(CLOUD_TRANS_FADING_LINE,
7263 xb,
7264 yb,
7265 xc,
7266 yc,
7267 0,
7268 0,
7269 21, 1,0, 0, 0, 0, passing_colours2);
7270 xc = xb;
7271 yc = yb;
7272 }
7273 }
7274
7275
7276
7277 }
7278
7279
7280 // no leading...
7281 int track_target(int e, int attacking, int turning, int forbid)
7282 {
7283 int retval = enemy_turn_towards_xy(enemy[e].x, enemy[e].y, actor[attacking].x, actor[attacking].y, enemy[e].angle, turning, forbid);
7284
7285 if (retval < enemy[e].angle || (enemy[e].angle < 100 && retval > (ANGLE_FULL - 100)))
7286 enemy[e].slew_dir = -1;
7287 else
7288 enemy[e].slew_dir = 1;
7289
7290 return retval;
7291 }
7292
7293 // this is used by overblatter
7294 int track_target_any_angle(int x, int y, int target_x, int target_y, int turning, int forbid, int angle)
7295 {
7296 int retval = enemy_turn_towards_xy(x, y, target_x, target_y, angle, turning, forbid);
7297
7298 // if (retval < angle || (angle < 100 && retval > (ANGLE_FULL - 100)))
7299
7300 return retval;
7301 }
7302
7303 int near_angle(int angle1, int angle2)
7304 {
7305
7306 if (angle1 / 200 == angle2 / 200)
7307 return 1;
7308
7309 if (angle1 < 100 && angle2 > ANGLE_FULL - 100)
7310 return 1;
7311 if (angle2 < 100 && angle1 > ANGLE_FULL - 100)
7312 return 1;
7313
7314 return 0;
7315
7316 }
7317
7318
7319
7320 void accelerate_enemy(int e, int angle, int impulse)
7321 {
7322
7323 enemy[e].x_speed += cos(angle_to_radians(angle)) * impulse;
7324 enemy[e].y_speed += sin(angle_to_radians(angle)) * impulse;
7325
7326 }
7327
7328 void drag_enemy(int e, float drag_amount)
7329 {
7330 enemy[e].x_speed *= (float) 1 - drag_amount;
7331 enemy[e].y_speed *= (float) 1 - drag_amount;
7332 // enemy[e].x_speed *= (float) 1 - drag_amount;
7333 // enemy[e].y_speed *= (float) 1 - drag_amount;
7334 }
7335
7336
7337
7338 int spawn_enemy(int type, int subtype, int carrying_pickup, int target)
7339 {
7340
7341 #ifdef SANITY_CHECK
7342 if (type <= ENEMY_NONE || type >= NO_ENEMY_TYPES)
7343 {
7344 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
7345 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "%i", type);
7346 rest(1000);
7347 // exit(type);
7348 }
7349 #endif
7350 //if (type <= ENEMY_NONE || type >= NO_ENEMY_TYPES)
7351 // return -1; // sanity check
7352
7353 // textprintf_ex(screen, small_font, 100,100, COLOUR_WHITE, -1, "type %i target %i Press I", type, target);
7354
7355 // do
7356 // {
7357 // ticked = 0;
7358 // } while (key [KEY_I] == 0);
7359
7360 int special [10];
7361 int location [2];
7362 int passing_colours [5] = {COLOUR_GREEN8, COLOUR_GREEN8, COLOUR_GREEN8, COLOUR_GREEN8, COLOUR_GREEN8};
7363 int passing_colours2 [5] = {TRANS_DGREEN, TRANS_LGREEN, TRANS_YELLOW, TRANS_YELLOW, TRANS_YELLOW};
7364
7365 // char standard_sound = 1;
7366 int cloud_size = 200 + crandom(250) + eclass[type].radius / 10;
7367
7368 switch(type)
7369 {
7370 default:
7371 find_target_start_point(location, type);
7372 break;
7373 // case (immobile enemies)
7374 // find_firebase_start_point(location);
7375 // break;
7376 }
7377
7378 /* switch(type)
7379 {
7380 default:*/
7381 passing_colours2 [0] = TRANS_DGREEN;
7382 passing_colours2 [1] = TRANS_LGREEN;
7383 passing_colours2 [2] = TRANS_YELLOW;
7384 passing_colours [0] = COLOUR_GREEN8;
7385 /* break;
7386 case ENEMY_HEAD1:
7387 passing_colours2 [0] = TRANS_LRED;
7388 passing_colours2 [1] = TRANS_ORANGE;
7389 passing_colours2 [2] = TRANS_YELLOW;
7390 passing_colours [0] = COLOUR_YELLOW8;
7391 cloud_size = 2000;
7392 break;*/
7393 /* passing_colours [0] = GC_YELLOW8;
7394 passing_colours2 [0] = TRANS_ORANGE;
7395 passing_colours2 [1] = TRANS_YELLOW;
7396 passing_colours2 [2] = TRANS_WHITE;
7397 break;
7398 passing_colours [0] = GC_ORANGE8;
7399 passing_colours2 [0] = TRANS_ORANGE;
7400 passing_colours2 [1] = TRANS_ORANGE;
7401 passing_colours2 [2] = TRANS_YELLOW;
7402 break;
7403 passing_colours [0] = GC_RED8;
7404 passing_colours2 [0] = TRANS_DRED;
7405 passing_colours2 [1] = TRANS_LRED;
7406 passing_colours2 [2] = TRANS_YELLOW;
7407 break;
7408 passing_colours [0] = GC_BLUE8;
7409 passing_colours2 [0] = TRANS_DBLUE;
7410 passing_colours2 [1] = TRANS_LBLUE;
7411 passing_colours2 [2] = TRANS_WHITE;
7412 break;
7413 passing_colours [0] = GC_PURPLE8;
7414 passing_colours2 [0] = TRANS_LBLUE;
7415 passing_colours2 [1] = TRANS_PURPLE;
7416 passing_colours2 [2] = TRANS_WHITE;
7417 break;*/
7418 // }
7419
7420
7421 create_cloud(CLOUD_SHRINKING_CIRCLE,
7422 location [0],
7423 location [1],
7424 0, 0,
7425 0, 0,
7426 500, -150 - eclass[type].radius / 100, 10, 0, 0, 0, passing_colours);
7427
7428 place_explosion(location [0], location [1], 0,0,
7429 cloud_size, passing_colours2);
7430
7431 // break;
7432
7433 // }
7434
7435 // if (target == TARGET_CRAWLY)
7436 //arena.crawlies_created ++;
7437
7438 int e = create_enemy(type, subtype, location [0], location [1],
7439 0, 0, grand(ANGLE_FULL), carrying_pickup, special, target);
7440
7441 // if (standard_sound == 1)
7442 // enemy_soundf(e, ESOUND_WARP_IN, 800 + grand(800) - eclass[type].mass);
7443 /* if (eclass[enemy[e].type].role == ROLE_BOSS || eclass[enemy[e].type].role == ROLE_MINIBOSS)
7444 {
7445 enemy_soundf(e, NWAV_SPAWN, enemy_sound_pitch(enemy[e].type) / 2 + grand(200)); //800 + grand(200) - enemy_pitch(enemy[k].type));
7446 }
7447 else*/
7448 enemy_soundf(e, NWAV_PHASE, enemy_sound_pitch(enemy[e].type) / 2 + 200 + grand(200)); //800 + grand(200) - enemy_pitch(enemy[k].type));
7449
7450 //calculate_beat();
7451
7452 return e;
7453 // need to make sure: either that creatures made up of multiple
7454
7455 }
7456
7457 void find_target_start_point(int location [2], int et)
7458 {
7459 int timeout = 0;
7460
7461 /* if (eclass[et].role == ROLE_BOSS)// || eclass[et].role == ROLE_MINIBOSS)
7462 {
7463 location [0] = arena.max_x / 2;
7464 location [1] = arena.max_y / 2;
7465 return;
7466 }*/
7467
7468 do
7469 {
7470 location [0] = grand(arena.max_x - 20000 - eclass[et].edge_radius * 2) + 10000 + eclass[et].edge_radius;
7471 location [1] = grand(arena.max_y - 20000 - eclass[et].edge_radius * 2) + 10000 + eclass[et].edge_radius;
7472 // location [1] = grand(arena.max_y - 300000) + 150000;
7473 timeout ++;
7474 if (timeout >= 1000)
7475 break; // Oh well.
7476 if (actor[0].in_play == 1)
7477 if (location [0] > actor[0].x - 150000 && location [0] < actor[0].x + 150000
7478 && location [1] > actor[0].y - 150000 && location [1] < actor[0].y + 150000)
7479 continue;
7480 if (actor[1].in_play == 1)
7481 if (location [0] > actor[1].x - 150000 && location [0] < actor[1].x + 150000
7482 && location [1] > actor[1].y - 150000 && location [1] < actor[1].y + 150000)
7483 continue;
7484
7485 break;
7486 }
7487 while (TRUE);
7488
7489 }
7490
7491 void find_crawly_start_point(int location [2])
7492 {
7493 location [1] = 10000;
7494 int timeout = 0;
7495
7496 do
7497 {
7498 location [0] = grand(arena.max_x - 100000) + 50000;
7499 location [0] /= GRID_WIDTH * GRAIN;
7500 location [0] *= GRID_WIDTH * GRAIN;
7501 location [0] -= 5000;
7502 timeout ++;
7503 if (timeout >= 1000)
7504 break; // Oh well.
7505 if (actor[0].in_play == 1 && actor[0].y < 100000)
7506 if (location [0] > actor[0].x - 50000 && location [0] < actor[0].x + 50000)
7507 continue;
7508 if (actor[1].in_play == 1 && actor[1].y < 100000)
7509 if (location [0] > actor[1].x - 50000 && location [0] < actor[1].x + 50000)
7510 continue;
7511
7512 break;
7513 }
7514 while (TRUE);
7515
7516 }
7517
7518 void find_firebase_start_point(int location [2])
7519 {
7520 int timeout = 0;
7521
7522 do
7523 {
7524 location [0] = grand(arena.max_x - 200000) + 100000;
7525 location [0] /= GRID_WIDTH * GRAIN;
7526 location [0] *= GRID_WIDTH * GRAIN;
7527 location [0] -= 4000;
7528 location [1] = grand(arena.max_y - 200000) + 100000;
7529 location [1] /= GRID_WIDTH * GRAIN;
7530 location [1] *= GRID_WIDTH * GRAIN;
7531 location [1] -= 4000;
7532 timeout ++;
7533 if (timeout >= 1000)
7534 break; // Oh well.
7535 break;
7536 }
7537 while (TRUE);
7538
7539 }
7540
7541
7542 void worm_new_target(int b)
7543 {
7544
7545 bullet[b].special3 = -1;
7546
7547 /*
7548 enemy not yet actually destroyed, so this doesn't work:
7549 if (game.type == GAME_DUEL)
7550 {
7551 bullet[b].special3 = closest_enemy_or_actor(bullet[b].owner, bullet[b].x, bullet[b].y,
7552 500000, 1);
7553 }
7554 else
7555 bullet[b].special3 = closest_enemy(bullet[b].x, bullet[b].y, 1000000, 1);
7556 */
7557 }
7558
7559
7560
7561 void register_destroyed(int e, int cause)
7562 {
7563 int i, scoring = -1;
7564
7565 #ifdef SANITY_CHECK
7566 if (e <= -1 || enemy[e].type <= ENEMY_NONE || enemy[e].type >= NO_ENEMY_TYPES)
7567 {
7568 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
7569 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "register e %i, c %i", e, cause);
7570 if (e != -1)
7571 textprintf_centre_ex(screen, small_font, 400, 260, COLOUR_WHITE, -1, "register t %i", enemy[e].type);
7572 rest(2000);
7573 return;
7574 // exit(type);
7575 }
7576 #endif
7577
7578 if (enemy[e].type == ENEMY_NONE)
7579 return;
7580
7581
7582
7583 if (cause >= 0)
7584 scoring = actor[cause].controller;
7585
7586 for (i = 0; i < NO_BULLETS; i ++)
7587 {
7588 if (bullet[i].special3 == e)
7589 {
7590 if (bullet[i].type == BULLET_WORM_SORROW
7591 || bullet[i].type == BULLET_WORM_AGONY
7592 || bullet[i].type == BULLET_SPORE)
7593 {
7594 worm_new_target(i);
7595 }
7596 }
7597 // clear up any locks that missiles have on the enemy
7598 }
7599 /*
7600 for (i = 0; i < NO_ACTORS; i ++)
7601 {
7602 if (actor[i].lock == e)
7603 actor[i].lock = -1;
7604 }
7605
7606 for (i = 0; i < NO_ACTORS; i ++)
7607 {
7608 if (actor[i].turret_lock == e)
7609 actor[i].turret_lock = -1;
7610 }*/
7611
7612 for (i = 0; i < MAX_TURRETS; i ++)
7613 {
7614 if (enemy[e].turret [i] != -1)
7615 {
7616 if (scoring >= 0)
7617 score_kill(enemy[enemy[e].turret [i]].type, SUBTYPE_NONE, scoring);
7618 // score_kill(i, enemy[e].turret [i], enemy[enemy[e].turret [i]].turret_main);
7619 enemy[enemy[e].turret [i]].turret_main = -1;
7620 if (cause == -2)
7621 enemy[enemy[e].turret [i]].ta_time_left = TA_TURRET_TIMEOUT;
7622 }
7623 }
7624
7625 if (enemy[e].turret_main != -1)
7626 {
7627 enemy[enemy[e].turret_main].turret [enemy[e].turret_index] = -1;
7628 }
7629
7630 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
7631 {
7632 if (cause == -2)
7633 return; // warped out
7634 // more time...
7635 if (eclass[enemy[e].type].role == ROLE_TARGET)
7636 arena.time_left += 33.333 * 12;
7637 if (eclass[enemy[e].type].role == ROLE_MINIBOSS)
7638 arena.time_left += 33.333 * 36;
7639 if (eclass[enemy[e].type].role == ROLE_BOSS)
7640 arena.time_left += 33.333 * 60;
7641 return;
7642 }
7643
7644
7645 // Because time_attack can return before this, can't have anything important to all
7646 // game modes below.
7647 if (cause >= 0)
7648 {
7649 scoring = actor[cause].controller;
7650 score_kill(enemy[e].type, enemy[e].subtype, scoring);
7651 }
7652 else scoring = -1;
7653
7654 if (enemy[e].target == TARGET_PRIMARY && arena.game_over == 0)//enemy[e].target == TARGET_PRIMARY && arena.game_over == 0)
7655 {
7656 if (eclass[enemy[e].type].role == ROLE_MINIBOSS)
7657 arena.targets_left_total -= 2; // ie 3 in total
7658
7659 if (eclass[enemy[e].type].role == ROLE_BOSS)
7660 arena.targets_left_total -= 3; // ie 4 in total
7661
7662 arena.targets_left_total --;
7663
7664 if (arena.targets_left_total <= 0)
7665 {
7666 finish_level();
7667 }
7668 }
7669
7670 }
7671
7672
7673 int check_for_targets(void)
7674 {
7675 // int i;
7676
7677 /* for (i = 0; i < NO_ENEMIES; i ++)
7678 {
7679 if (enemy[i].type != ENEMY_NONE && enemy[i].target == TARGET_PRIMARY)
7680 return 1;
7681 }*/
7682
7683 // if (arena.targets_left [0] > 0 || arena.targets_left [1] > 0 || arena.targets_left [2] > 0)
7684 // return 1;
7685
7686 return 0;
7687
7688 }
7689
7690
7691 void enemy_sound(int e, int sound)
7692 {
7693
7694 play_wav_pos(sound, 1000, 255, enemy[e].x, enemy[e].y);
7695
7696 }
7697
7698 void enemy_soundf(int e, int sound, int freq)
7699 {
7700
7701 play_wav_pos(sound, freq, 255, enemy[e].x, enemy[e].y);
7702
7703 }
7704
7705 void enemy_soundvf(int e, int sound, int vol, int freq)
7706 {
7707
7708 play_wav_pos(sound, freq, vol, enemy[e].x, enemy[e].y);
7709
7710 }
7711
7712 void enemy_sound_fire(int e, int sound, int freq, int vol, int dist)
7713 {
7714
7715 play_wav_pos(sound, freq, vol, enemy[e].x + xpart(enemy[e].angle, dist), enemy[e].y + ypart(enemy[e].angle, dist));
7716
7717 }
7718
7719
7720 void score_kill(int etype, int subtype, int p)
7721 {
7722 // textprintf_centre_ex(screen, small_font, 400, 200 + grand(50), COLOUR_WHITE, -1, "%i %i %i", etype, subtype, p);
7723 // rest(500);
7724
7725 // return;
7726
7727 if (p <= -1)
7728 return;
7729
7730 if (etype <= -1)
7731 return;
7732
7733 int score_gained = eclass[etype].level * 10;
7734 //eclass[etype].level * eclass[etype].level * 10;
7735
7736
7737 switch(eclass[etype].role)
7738 {
7739 case ROLE_MINIBOSS:
7740 score_gained *= 3;
7741 break;
7742 case ROLE_BOSS:
7743 score_gained *= 5;
7744 break;
7745 case ROLE_TURRET:
7746 score_gained /= 4;
7747 break;
7748 case ROLE_EXTRA:
7749 score_gained /= 2;
7750 break;
7751 }
7752
7753 gain_score(p, score_gained);
7754
7755 /* if (subtype == SUBTYPE_NONE)
7756 {
7757 gain_score(p, eclass[etype].score);
7758 }
7759 else
7760 gain_score(p, eclass[etype].score * subtype * subtype);*/
7761
7762 }
7763
7764
7765
7766
7767 int enemy_turn_towards_angle(int angle, int tangle, int turning, int forbid)
7768 {
7769
7770 if ((angle < tangle && tangle > angle + ANGLE_HALF)
7771 || (angle > tangle && tangle > angle - ANGLE_HALF))
7772 {
7773 if (forbid == -1)
7774 return angle;
7775 angle -= turning;
7776 if (angle < 0)
7777 angle += ANGLE_FULL;
7778 }
7779 else
7780 {
7781 if (forbid == 1)
7782 return angle;
7783 angle += turning;
7784 if (angle > ANGLE_FULL)
7785 angle -= ANGLE_FULL;
7786 }
7787
7788 return angle;
7789
7790 }
7791
7792
7793 int enemy_turn_towards_xy(int x1, int y1, int x2, int y2, int angle, int turning, int forbid)
7794 {
7795
7796 int tangle =
7797 radians_to_angle(atan2((y2 - y1), (x2 - x1)));
7798 if (tangle < 0)
7799 tangle += ANGLE_FULL;
7800 if (tangle > ANGLE_FULL)
7801 tangle -= ANGLE_FULL;
7802
7803 return enemy_turn_towards_angle(angle, tangle, turning, forbid);
7804
7805 }
0
1 void init_enemies(void);
2
3 int create_enemy(int type, int subtype, int x, int y,
4 int x_speed, int y_speed, int angle, int carrying_pickup, int special [10],
5 unsigned char target);
6
7 void run_enemies(void);
8
9 int hurt_enemy(int e, int hurty, int source, char pulse);
10
11 int spawn_enemy(int type, int subtype, int carrying_pickup, int target);
12
13 int enemy_sound_pitch(int ec);
14
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: game.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - main game loop and a bit of miscellany
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36
37 #include "config.h"
38 #include "globvars.h"
39
40 #include "stuff.h"
41
42 #include "palette.h"
43
44 #include "input.h"
45 #include "bullet.h"
46 #include "cloud.h"
47 #include "actor.h"
48 #include "enemy.h"
49 #include "actor.h"
50 #include "levels.h"
51 #include "display.h"
52 #include "displ_in.h"
53 #include "cmds.h"
54 //#include "ships.h"
55 #include "pickup.h"
56 #include "light.h"
57 #include "sound.h"
58 #include "tile.h"
59
60 void begin_game(void);
61 void init_structs_etc(void);
62 void make_arena_hostile(void);
63 void run_hostile_level();
64 void quit_query(void);
65
66
67
68 extern volatile unsigned char ticked;
69 extern volatile int framecounter;
70 extern int slacktime;
71 int long_slacktime;
72 int long_slacktime_store;
73
74
75 void game_loop(void)
76 {
77 int playing = 1;
78
79 counter = 0;
80
81 do
82 {
83 if (player[0].link_toggle_delay > 0)
84 player[0].link_toggle_delay --;
85 if (player[1].link_toggle_delay > 0)
86 player[1].link_toggle_delay --;
87
88 reset_lights();
89 get_input();
90 enact_commands();
91 run_actors();
92 run_bullets(); // should be between actors and enemies for orbitals to work
93 arena.waver_on_level = 0;
94 run_clouds();
95 // run_stars();
96 run_enemies();
97 run_pickups();
98 play_beats();
99 if (counter % 35 == 0)
100 run_level();
101 if (arena.game_over > 0)
102 {
103 arena.game_over --;
104 if (arena.game_over == 1)
105 {
106 playing = 0;
107 kill_gameover_loop();
108 }
109 if (arena.game_over == 120)
110 play_gameover_loop(1000);
111 } else
112 {
113 if (arena.new_level_sign > 0)
114 arena.new_level_sign --;
115 if (arena.time_left > 0)
116 {
117 if (game.type != GAME_DUEL
118 || (game.duel_mode != DUEL_10_POINTS && game.duel_mode != DUEL_30_POINTS))
119 arena.time_left --;
120 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
121 game.ta_total_time ++;
122 }
123 else
124 {
125 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
126 {
127 arena.game_over = 132;
128 hurt_actor(0, 0, 100000);
129 hurt_actor(1, 0, 100000);
130 // it's okay to call hurt_actor on non-existent actors.
131 }
132 if (game.type == GAME_DUEL)
133 {
134 if (arena.game_over == 0)
135 {
136 arena.game_over = 132;
137 game.duel_winner = -1;
138 if (player[0].duel_score > player[1].duel_score)
139 game.duel_winner = 0;
140 if (player[1].duel_score > player[0].duel_score)
141 game.duel_winner = 1;
142 }
143 }
144 else
145 {
146 if (arena.level_finished == 1)
147 {
148 if (arena.level == 15)
149 {
150 arena.level = 16;
151 // play_gameover_loop(2200);
152 // play_wavf(NWAV_SWARBLE, 1500);
153 playing = 0;
154 break;
155 }
156 init_level();
157 if (actor[0].in_play == 1)
158 actor_new_level(0);
159 if (actor[1].in_play == 1)
160 actor_new_level(1);
161 ticked = 0;
162 }
163 else
164 {
165 if (arena.hostile == 0)
166 {
167 make_arena_hostile();
168 }
169 else
170 {
171 if (arena.hostile < 10000)
172 arena.hostile ++;
173 run_hostile_level();
174 }
175 }
176 }
177 }
178 /* if (arena.time_left == 334)
179 {
180 send_message(0, "Hurry} Up}!", STYLE_HURRY);
181 send_message(1, "Hurry} Up}!", STYLE_HURRY);
182 }*/
183 if (arena.time_left == 330 && (game.type != GAME_DUEL
184 || (game.duel_mode != DUEL_10_POINTS && game.duel_mode != DUEL_30_POINTS)))
185 play_wavf(NWAV_ALARM, 900);
186
187 if (arena.hostile == 10 || arena.hostile == 40 || arena.hostile == 70)
188 play_wavf(NWAV_ALARM, 700);
189
190
191 }
192
193 if (ticked == 0)
194 {
195 run_display();
196 framecounter++;
197 }
198
199 init_effects();
200
201 slacktime = 0;
202
203 do
204 {
205 slacktime ++;
206 } while(ticked == 0);
207 ticked --;
208
209 counter ++;
210
211 if (counter % 32 == 0)
212 {
213 long_slacktime_store = long_slacktime;
214 long_slacktime = 0;
215 }
216
217 long_slacktime += slacktime / 100;
218
219
220 if (key [KEY_ESC])
221 quit_query();
222
223 } while(playing == 1);
224
225 }
226
227 void quit_query(void)
228 {
229
230 if (arena.game_over > 0)
231 return;
232
233 display_quit_query();
234
235 do
236 {
237
238 if (key [KEY_Y])
239 {
240 arena.game_over = 44;
241 if (game.type == GAME_DUEL)
242 {
243 game.duel_winner = -1;
244 if (player[0].duel_score > player[1].duel_score)
245 game.duel_winner = 0;
246 if (player[1].duel_score > player[0].duel_score)
247 game.duel_winner = 1;
248 }
249 clear_quit_query();
250 return;
251 }
252
253 if (key [KEY_N])
254 {
255 clear_quit_query();
256 return;
257 }
258
259 play_beats();
260
261 do
262 {
263 slacktime ++;
264 slacktime = 0;
265 } while(ticked == 0);
266
267 ticked = 0;
268
269 }
270 while(TRUE);
271
272 }
273
274
275
276
277 void make_arena_hostile(void)
278 {
279 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
280 return;
281 explode_all_pickups();
282 arena.hostile = 1;
283 // arena.colour3 = COLOUR_RED1;
284 // calculate_beat();
285 open_eyes();
286 shake_all_screens(150);
287 play_wav(NWAV_BANG);
288 // send_message(0, "Defences} On}-Line}!", STYLE_HURRY);
289 // send_message(1, "Defences} On}-Line}!", STYLE_HURRY);
290 }
291
292
293
294 void run_hostile_level()
295 {
296 int hostile_attack, i, angle;
297 int x, y, xs, ys;
298
299
300 // colours_for_cloud [0] = TRANS_DRED;
301
302 for (i = 0; i < arena.eyes_on_level; i ++)
303 {
304 angle = grand(ANGLE_FULL);
305 xs = 2000 + grand(2000);
306 simple_cloud_trans(arena.eye_colour3, arena.eye_x [i], arena.eye_y [i],
307 xpart(angle, xs), ypart(angle, xs), 400);
308 }
309
310
311 // if (counter % 8 != 0 || grand(3) != 0)
312 if (counter % 8 != 0 || grand(2000) > arena.hostile)
313 return;
314
315 hostile_attack = grand(5) + arena.hostile / 100;
316
317 if (hostile_attack > 5)
318 hostile_attack = 5;
319
320 int colours [4] = {COLOUR_BLUE3, COLOUR_BLUE5, COLOUR_BLUE7, COLOUR_WHITE};
321
322 // play_wavf(WAV_);
323 // enemy_soundf(e, NWAV_SZAP, 100 + grand(5));
324 // play_wav_pos(NWAV_BURSTZL, 600, 255, xs, ys);
325
326 // do
327 // {
328 i = grand(arena.eyes_on_level);
329 if (arena.eye_x [i] == 0)
330 return;
331 // } while (arena.eye_x [i] != 0);
332
333 // angle = grand(ANGLE_FULL);
334 int target = -1;
335 if (actor[0].in_play == 1 && actor[1].in_play == 1)
336 target = grand(2);
337 else
338 {
339 if (actor[0].in_play == 1)
340 target = 0;
341 if (actor[1].in_play == 1)
342 target = 1;
343 }
344
345 if (target == -1)
346 return;
347
348 angle = radians_to_angle(atan2(actor[target].y - arena.eye_y [i], actor[target].x - arena.eye_x [i]));
349
350 x = arena.eye_x [i] + xpart(angle, 5000);
351 y = arena.eye_y [i] + ypart(angle, 5000);
352
353 play_wav_pos(NWAV_SZAP, 50 + grand(10), 200, x, y);
354
355 xs = xpart(angle, 15000);
356 ys = ypart(angle, 15000);
357 simple_cloud_trans(TRANS_WHITE, x, y, 0, 0, 400);
358
359 create_bullet(BULLET_HOSTILE, x, y,
360 xs, ys, OWNER_ENEMY,
361 400, 2000, 40, 0,
362 0, 0, colours, 3,0,0,0,0,0);
363
364 }
365
366
367 void begin_game(void)
368 {
369 int i;
370
371 counter = 0;
372
373 init_structs_etc();
374
375 for (i = 0; i < NO_ACTORS; i ++)
376 {
377 actor[i].in_play = 0;
378 }
379
380 player[0].score = 0;
381 player[1].score = 0;
382
383 if (game.type == GAME_SINGLE || game.type == GAME_TIME_ATTACK)
384 {
385 game.users = 1;
386
387 actor[0].in_play = 0;
388 player[game.single_player].actor_controlled = 0;
389 // player[0].ships_left = 3;
390 game.ships_left = 3;
391 actor[0].controller = game.single_player;
392 init_actor(0, player[game.single_player].ship); //ACTORTYPE_SHIP);
393 }
394
395 if (game.type == GAME_COOP || game.type == GAME_DUEL || game.type == GAME_TIME_ATTACK_COOP)
396 {
397 game.users = 2;
398
399 actor[0].in_play = 0;
400 player[0].actor_controlled = 0;
401 // player[0].ships_left = 3;
402 actor[0].controller = 0;
403 init_actor(0, player[0].ship); //ACTORTYPE_SHIP);
404
405 actor[1].in_play = 0;
406 player[1].actor_controlled = 1;
407 // player[1].ships_left = 3;
408 actor[1].controller = 1;
409 init_actor(1, player[1].ship); //ACTORTYPE_SHIP);
410 game.ships_left = 6;
411 }
412
413
414 init_bullets();
415 init_clouds();
416 // init_stars();
417 init_enemies();
418 prepare_display();
419
420 game.drag = 0.013;//955;//9999;
421 /*
422 arena.max_x = 894000;
423 arena.max_y = 895000;
424 */
425
426 arena.level = 0;
427 game.symbols_given = 0;
428
429 init_level();
430
431 long_slacktime = 0;
432 arena.waver_on_level = 0;
433
434 }
435
436 void init_structs_etc(void)
437 {
438
439 int i, j;
440
441 for (i = 0; i < NO_ACTORS; i ++)
442 {
443 actor[i].type = ACTORTYPE_NONE;
444 actor[i].controller = -1;
445 actor[i].in_play = 0;
446 for (j = 0; j < NO_CMDS; j ++)
447 {
448 actor[i].actor_cmd [j] = 0;
449 }
450 }
451
452 for (i = 0; i < NO_PLAYERS; i ++)
453 {
454 player[i].actor_controlled = -1;
455 player[i].user = -1;
456 player[i].link_fire = 1;
457 player[i].link_toggle_delay = 0;
458 // for (j = 0; j < NO_CMDS; j ++)
459 // {
460 // actor[i].player_cmd [j] = 0;
461 // }
462 }
463
464 for (i = 0; i < NO_BULLETS; i ++)
465 {
466 bullet[i].type = BULLET_NONE;
467 }
468
469 for (i = 0; i < NO_CLOUDS; i ++)
470 {
471 cloud[i].type = CLOUD_NONE;
472 }
473
474 init_pickups();
475
476 }
477
478
0 void game_loop(void);
1 void begin_game(void);
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 // Global variables:
1
2 extern struct gamestruct game;
3
4 extern struct playerstruct player [NO_PLAYERS];
5
6 extern struct actorstruct actor [NO_ACTORS];
7
8 extern struct bulletstruct bullet [NO_BULLETS];
9
10 extern struct cloudstruct cloud [NO_CLOUDS];
11
12 extern struct starstruct star [NO_STARS];
13
14 extern unsigned char counter;
15
16 extern struct armoury weapons [NO_WEAPONS];
17
18 extern struct arenastruct arena;
19
20 extern struct enemystruct enemy [NO_ENEMIES];
21
22 extern struct enemy_classification eclass [NO_ENEMY_TYPES];
23
24 extern struct pickupstruct pickup [NO_PICKUPS];
25
26 // --- end global variables
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: input.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - keyboard input. Commands are passed to cmds.c - see intro to that file
30 for a bit more information.
31
32 */
33
34 #include <math.h>
35
36 #include "allegro.h"
37
38 #include "config.h"
39
40 #include "globvars.h"
41
42 #include "sound.h"
43
44 //#define DEBUG_KEYS 1
45
46 #ifdef DEBUG_KEYS
47 #include "actor.h"
48 #include "enemy.h"
49 #include <string.h>
50 #include "palette.h"
51 extern RGB palet [256];
52 void gain_symbol(int a, int abil, int symb);
53 extern struct optionstruct options;
54
55 int scrs;
56 int sshot_counter;
57 extern int debug_info;
58
59 #endif
60
61
62 extern int inflicteda, inflictede;
63
64 void get_input(void)
65 {
66
67
68 int i;
69
70 if (player[0].actor_controlled != -1)
71 {
72 for (i = 0; i < NO_CMDS; i ++)
73 {
74 if (key [player[0].keys [i]])
75 actor[player[0].actor_controlled].actor_cmd [i] = 1;
76 else
77 actor[player[0].actor_controlled].actor_cmd [i] = 0;
78 }
79 }
80
81 if (player[1].actor_controlled != -1)
82 {
83 for (i = 0; i < NO_CMDS; i ++)
84 {
85 if (key [player[1].keys [i]])
86 actor[player[1].actor_controlled].actor_cmd [i] = 1;
87 else
88 actor[player[1].actor_controlled].actor_cmd [i] = 0;
89 }
90 }
91
92 if (key [player[0].keys [CMD_LINK]])
93 {
94 if (player[0].link_toggle_delay == 0)
95 {
96 if (player[0].link_fire == 0)
97 player[0].link_fire = 1;
98 else
99 player[0].link_fire = 0;
100 player[0].link_toggle_delay = 20;
101 play_wav(NWAV_MENU);
102 }
103 }
104
105 if (key [player[1].keys [CMD_LINK]])
106 {
107 if (player[1].link_toggle_delay == 0)
108 {
109 if (player[1].link_fire == 0)
110 player[1].link_fire = 1;
111 else
112 player[1].link_fire = 0;
113 player[1].link_toggle_delay = 20;
114 play_wav(NWAV_MENU);
115 }
116 }
117
118
119
120 /*
121 if (key [KEY_8_PAD])
122 actor[player[0].actor_controlled].actor_cmd [CMD_THRUST] = 1;
123 if (key [KEY_4_PAD])
124 actor[player[0].actor_controlled].actor_cmd [CMD_LEFT] = 1;
125 if (key [KEY_6_PAD])
126 actor[player[0].actor_controlled].actor_cmd [CMD_RIGHT] = 1;
127 if (key [KEY_0_PAD])
128 actor[player[0].actor_controlled].actor_cmd [CMD_FIRE1] = 1;
129 if (key [KEY_ENTER_PAD])
130 actor[player[0].actor_controlled].actor_cmd [CMD_FIRE2] = 1;
131 if (key [KEY_PLUS_PAD])
132 actor[player[0].actor_controlled].actor_cmd [CMD_UPGRADE] = 1;
133 if (key [KEY_1_PAD])
134 actor[player[0].actor_controlled].actor_cmd [CMD_LEFT1] = 1;
135 if (key [KEY_3_PAD])
136 actor[player[0].actor_controlled].actor_cmd [CMD_RIGHT1] = 1;
137 if (key [KEY_2_PAD])
138 actor[player[0].actor_controlled].actor_cmd [CMD_BRAKE] = 1;*/
139 #ifdef DEBUG_KEYS
140 char sfile [20];
141 char istr [20];
142
143 if (sshot_counter > 0)
144 sshot_counter --;
145
146 if (key [KEY_F1] && sshot_counter <= 0)
147 {
148 BITMAP *scrshot_bmp;
149 if (options.resolution == 0)
150 {
151 scrshot_bmp = create_bitmap(640, 480);
152 blit(screen, scrshot_bmp, 0,0,0,0,640,480);
153 }
154 else
155 {
156 scrshot_bmp = create_bitmap(800, 600);
157 blit(screen, scrshot_bmp, 0,0,0,0,800,600);
158 }
159
160 strcpy(sfile, "sshot");
161 strcat(sfile, itoa(scrs, istr, 10));
162 strcat(sfile, ".bmp");
163 save_bitmap(sfile, scrshot_bmp, palet);
164 clear_to_color(screen, COLOUR_WHITE);
165 play_wav(NWAV_MENU);
166 scrs ++;
167 sshot_counter = 15;
168 destroy_bitmap(scrshot_bmp);
169 }
170
171 if (key [KEY_F2] && counter % 6 == 0)
172 {
173 actor[0].secondary ++;
174 actor[0].secondary %= TOTAL_SECONDS;
175 }
176
177 if (key [KEY_MINUS_PAD] && counter % 10 == 0)
178 {
179 gain_symbol(player[0].actor_controlled, ABILITY_DRIVE, SYMBOL_SQUARE);
180 gain_symbol(player[0].actor_controlled, ABILITY_DRIVE, SYMBOL_TRIANGLE);
181 gain_symbol(player[0].actor_controlled, ABILITY_DRIVE, SYMBOL_CIRCLE);
182 gain_symbol(player[0].actor_controlled, ABILITY_DEFENCE, SYMBOL_SQUARE);
183 // gain_upgrade_points(player[0].actor_controlled, 1);
184 }
185
186 int pl = player[0].actor_controlled;
187
188 if (counter % 7 == 0)
189 {
190 if (key [KEY_SLASH])
191 {
192 if (debug_info == 0)
193 debug_info = 1;
194 else
195 debug_info = 0;
196 }
197 if (key [KEY_BACKSPACE])
198 arena.time_left = 350;
199 if (key [KEY_INSERT])
200 arena.time_left = 10000;
201 if (key [KEY_1])
202 gain_symbol(pl, 0, 0);
203 if (key [KEY_2])
204 gain_symbol(pl, 0, 1);
205 if (key [KEY_3])
206 gain_symbol(pl, 0, 2);
207 if (key [KEY_4])
208 gain_symbol(pl, 0, 3);
209 if (key [KEY_5])
210 gain_symbol(pl, 1, 0);
211 if (key [KEY_6])
212 gain_symbol(pl, 1, 1);
213 if (key [KEY_7])
214 gain_symbol(pl, 1, 2);
215 if (key [KEY_8])
216 gain_symbol(pl, 1, 3);
217 if (key [KEY_Q])
218 gain_symbol(pl, 2, 0);
219 if (key [KEY_W])
220 gain_symbol(pl, 2, 1);
221 if (key [KEY_E])
222 gain_symbol(pl, 2, 2);
223 if (key [KEY_R])
224 gain_symbol(pl, 2, 3);
225 if (key [KEY_T])
226 gain_symbol(pl, 3, 0);
227 if (key [KEY_Y])
228 gain_symbol(pl, 3, 1);
229 if (key [KEY_U])
230 gain_symbol(pl, 3, 2);
231 if (key [KEY_I])
232 gain_symbol(pl, 3, 3);
233 if (key [KEY_MINUS])
234 player[0].score += 500;
235 if (key [KEY_F12])
236 calculate_beat();
237 }
238
239 if (key [KEY_TILDE])
240 {
241 hurt_actor(0, OWNER_ENEMY, 2000);
242 }
243 if (key [KEY_TAB])
244 {
245 arena.targets_left_total = 1;
246 for (i = 0; i < NO_ENEMIES; i ++)
247 {
248 if (enemy[i].type != ENEMY_NONE)
249 hurt_enemy(i, 9999, 0,0);
250 }
251
252 }
253 /* if (key [KEY_2] && counter % 15 == 0)
254 {
255 actor[0].type ++;
256 }
257 if (key [KEY_1] && counter % 15 == 0)
258 {
259 actor[0].type --;
260 }*/
261 /* if (key [KEY_E])
262 {
263 inflicteda ++;
264 }
265 if (key [KEY_R])
266 {
267 inflicteda --;
268 }
269 if (key [KEY_D])
270 {
271 inflictede ++;
272 }
273 if (key [KEY_F])
274 {
275 inflictede --;
276 }*/
277 if (key [KEY_7_PAD])
278 {
279 // actor[player[0].actor_controlled].armour += 10;
280 // if (actor[player[0].actor_controlled].armour > actor[player[0].actor_controlled].max_armour)
281 // actor[player[0].actor_controlled].armour = actor[player[0].actor_controlled].max_armour;
282 actor[player[0].actor_controlled].repairing = 100;
283 }
284
285 #endif
286 // int special [10];
287 // if (key [KEY_5_PAD] && counter % 10 == 0)
288 // {
289 // create_enemy(ENEMY_BOUNCER, 10000 + random() % 50000, 10000 + random() % 50000,
290 // 1000 - random() % 2000, 1000 - random() % 2000, 0, special);
291 // create_enemy(ENEMY_STINGER, grand(3), 10000 + random() % 300000, 90000,
292 // 0, 0, 0, special);
293 // }
294 /*
295 if (key [KEY_UP])
296 actor[player[1].actor_controlled].actor_cmd [CMD_THRUST] = 1;
297 if (key [KEY_LEFT])
298 actor[player[1].actor_controlled].actor_cmd [CMD_LEFT] = 1;
299 if (key [KEY_RIGHT])
300 actor[player[1].actor_controlled].actor_cmd [CMD_RIGHT] = 1;
301 if (key [KEY_DOWN])
302 actor[player[1].actor_controlled].actor_cmd [CMD_BRAKE] = 1;
303 if (key [KEY_SPACE])
304 actor[player[1].actor_controlled].actor_cmd [CMD_FIRE1] = 1;
305 if (key [KEY_Z])
306 actor[player[1].actor_controlled].actor_cmd [CMD_FIRE2] = 1;
307 if (key [KEY_X])
308 actor[player[1].actor_controlled].actor_cmd [CMD_UPGRADE] = 1;
309 */
310 }
311
312
313
314
315
0 void get_input(void);
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: levels.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - initialising and managing of the levels
30
31 */
32
33 #include "allegro.h"
34
35 #include "config.h"
36 #include "globvars.h"
37
38
39
40 #include "stuff.h"
41
42 #include "palette.h"
43 #include "enemy.h"
44 #include "display.h"
45 #include "displ_in.h"
46 #include "cloud.h"
47 #include "bullet.h"
48 #include "enemy.h"
49 #include "pickup.h"
50 #include "actor.h"
51 #include "sound.h"
52 #include "light.h"
53 #include "tile.h"
54
55 #ifdef SANITY_CHECK
56 extern FONT *small_font;
57 int e_index = 0;
58 #endif
59
60 int test_ta_enemies;
61
62 int choose_enemy(int e1, int e2, int e3, int e4);
63
64 void init_time_attack_level(void);
65 void run_time_attack_level(void);
66 void time_attack_enemies(void);
67
68 void init_duel_level(void);
69 void run_duel_level(void);
70
71 void muster_enemies(int enemy_type [15], int types, int role, int enemy_level);
72 void make_enemy_list(void);
73 void tilemap(void);
74
75 extern BITMAP *level_bmp;
76
77 int extra_list [3];
78
79 void start_at_level_1(void)
80 {
81 arena.level = 0;
82 }
83
84 void init_level(void)
85 {
86
87 /* if (level_bmp != NULL)
88 {
89 destroy_bitmap(level_bmp);
90 level_bmp = NULL;
91 }*/
92
93 level_announcement();
94 // in display.c. currently just clears the player display bmps
95
96 if (game.type == GAME_DUEL)
97 {
98 init_duel_level();
99 return;
100 }
101
102 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
103 {
104 init_time_attack_level(); // only called once per game.
105 return;
106 }
107
108 arena.level ++;
109
110 arena.new_level_sign = 80;
111
112 init_bullets();
113 init_clouds();
114 init_enemies();
115 reset_lights();
116 init_effects(); // cloud.c
117
118 calculate_beat();
119
120 arena.max_x = 594000 + (((int) (arena.level / 3)) + grand(arena.level / 2)) * 100000;
121 arena.max_y = 595000 + (((int) (arena.level / 3)) + grand(arena.level / 2)) * 100000;
122 // placement of actor in actor.c depends on level 1 being 594000x595000
123
124 /* if (arena.level % 4 == 0)
125 {
126 arena.max_x = 794000;
127 arena.max_y = 795000;
128 }*/
129 if (arena.max_x > 1000000)
130 {
131 arena.max_x = 994000;
132 }
133 if (arena.max_y > 1000000)
134 {
135 arena.max_y = 995000;
136 }
137 /* if (arena.max_x > 1300000)
138 {
139 arena.max_x = 1294000;
140 }
141 if (arena.max_y > 1300000)
142 {
143 arena.max_y = 1295000;
144 }*/
145 // arena.max_x = 994000;
146 // arena.max_y = 995000;
147
148 arena.max_targets_in_level = 4 + (arena.level - 1) / 5;
149 arena.max_non_targets_in_level = 4 + (arena.level - 1) / 5;
150 if (arena.level == 1)
151 arena.max_non_targets_in_level = 0;
152 if (arena.level == 2)
153 arena.max_non_targets_in_level = 2;
154 make_enemy_list();
155
156 arena.time_left = 33.333 * 180;
157 if (arena.level < 11)
158 arena.time_left = 33.33 * 150;
159 if (arena.level < 6)
160 arena.time_left = 33.33 * 120;
161 // arena.time_left = 33.33 * 120;
162
163 // arena.time_left = 600;
164 // arena.time_left = 50;
165 // arena.time_left = 280;
166 arena.level_finished = 0;
167 arena.next_target = grand(3) + 2;
168 arena.next_non_target = grand(4) + 15;
169 arena.hostile = 0;
170 init_pickups();
171
172 tilemap();
173 #ifdef SANITY_CHECK
174 e_index = 0;
175 #endif
176
177 }
178
179
180 void tilemap(void)
181 {
182 int lx, ly;
183
184 lx = arena.max_x / 50000 + 5; // if changed, change in open_eyes in tile.c also
185 ly = arena.max_y / 50000 + 5;
186 /*
187 level_bmp = create_bitmap(lx, ly);
188
189 if (!level_bmp)
190 {
191 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
192 allegro_message("Bitmap creation error (level_bmp %i x %i) \n%s\n", lx, ly, allegro_error);
193 exit(1);
194 }
195 */
196 clear_to_color(level_bmp, 1);
197
198 make_tile_map(lx, ly);
199
200
201 }
202
203 // called about every second
204 void run_level(void)
205 {
206
207 if (game.type == GAME_DUEL)
208 {
209 run_duel_level();
210 return;
211 }
212
213 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
214 {
215 run_time_attack_level();
216 return;
217 }
218
219 int i;
220 int current_targets = 0;
221 int current_non_targets = 0;
222 int subtype = SUBTYPE_NONE;
223
224 arena.next_target --;
225 arena.next_non_target --;
226
227 if (arena.next_target > 0 && arena.next_non_target > 0)
228 return;
229 // Don't bother placing new enemies if now's not the time
230
231 for (i = 0; i < NO_ENEMIES; i ++)
232 {
233 if (enemy[i].type == ENEMY_NONE)
234 continue;
235 if (enemy[i].target == TARGET_PRIMARY)
236 current_targets ++;
237 if (enemy[i].target == TARGET_EXTRA)
238 current_non_targets ++;
239 }
240
241
242 if (arena.next_target <= 0)
243 {
244 if (arena.targets_left_total > 0
245 && current_targets < arena.max_targets_in_level
246 && arena.enemy_list [arena.list_index] != ENEMY_LIST_END
247 && (arena.enemy_list [arena.list_index] != ENEMY_LIST_WAIT
248 || current_targets == 0))
249 {
250 while (arena.enemy_list [arena.list_index] == ENEMY_LIST_WAIT)
251 {
252 arena.list_index ++;
253 }
254
255 // spawn_enemy(arena.enemy_list [arena.list_index], subtype, PICKUP_NONE, TARGET_PRIMARY);
256 if (spawn_enemy(arena.enemy_list [arena.list_index], subtype, PICKUP_NONE, TARGET_PRIMARY) != -1)
257 arena.list_index ++;
258
259 while (arena.enemy_list [arena.list_index] == ENEMY_LIST_EMPTY)
260 {
261 arena.list_index ++;
262 }
263 // arena.targets_left_total --;
264 }
265 arena.next_target = 2;
266 }
267
268 int etype = -1;
269
270 if (arena.next_non_target <= 0)
271 {
272 if (current_non_targets < arena.max_non_targets_in_level)
273 {
274 etype = extra_list [grand(2)];
275 /* extern FONT *small_font;
276 textprintf_ex(screen, small_font, 150, 150, COLOUR_WHITE, -1, "type %i", etype);
277 do
278 {
279
280 }
281 while (key [KEY_K] == 0);*/
282 spawn_enemy(etype, 0, PICKUP_NONE, TARGET_EXTRA);
283 // if (spawn_enemy(arena.extra_list [grand(2)], subtype, PICKUP_NONE, TARGET_NO) != -1)
284 // arena.list_index ++;
285 }
286 arena.next_non_target = 30;
287 }
288
289 /*
290 if (arena.next_non_target == 0)
291 {
292 if (current_non_targets < arena.max_non_targets_in_level
293 && arena.enemy_list [arena.list_index] != ENEMY_LIST_END) // this last shouldn't happen
294 {
295 if (spawn_enemy(arena.enemy_list [arena.list_index], subtype, PICKUP_NONE, TARGET_PRIMARY) != -1)
296 {
297 arena.targets_left_total --;
298 arena.list_index ++;
299 }
300 }
301 }
302 arena.next_non_target = 5;
303 }
304 */
305
306 }
307
308
309 void make_enemy_list(void)
310 {
311
312 arena.list_index = 0;
313 arena.symbol_index = 0;
314 int i;
315 int enemy_type [15];
316 int miniboss_type [15];
317
318 arena.battle_type = BATTLE_NORMAL;
319 if (arena.level == 5 || arena.level == 10 || arena.level == 15)
320 arena.battle_type = BATTLE_BOSS;
321
322 if (game.mode_god == 1 && arena.level > 3 && grand(3) == 0)
323 arena.battle_type = BATTLE_BOSS;
324
325 int csym = 0;
326 int total_actual_targets = 0;
327
328 for (i = 0; i < 50; i ++)
329 {
330 arena.symbol_list [i] = 0;
331 }
332
333 for (i = 0; i < 25; i ++)
334 {
335 arena.enemy_list [i] = ENEMY_LIST_END;
336 }
337
338 switch(arena.battle_type)
339 {
340 default:
341 case BATTLE_NORMAL:
342 // first process the targets:
343 arena.total_targets = 9;// + arena.level / 5;
344 arena.targets_left_total = 9;// + arena.level / 5;
345 arena.max_targets_in_level = 4 + arena.level / 5;
346 muster_enemies(enemy_type, 3, ROLE_TARGET, arena.level);
347 muster_enemies(miniboss_type, 3, ROLE_MINIBOSS, arena.level);
348 for (i = 0; i < arena.total_targets; i ++)
349 {
350 if (arena.level == 1)
351 {
352 arena.enemy_list [i] = ENEMY_MULTI1;
353 if (grand(2) == 0) arena.enemy_list [i] = ENEMY_GUARDIAN1;
354 if (grand(3) == 0) arena.enemy_list [i] = ENEMY_CURVE1;
355 // total_actual_targets ++;
356 // arena.enemy_list [i] = ENEMY_CRUISER1;
357 }
358 else
359 {
360 if (arena.battle_type == BATTLE_BOSS)
361 {
362 if (i == 5)
363 {
364 arena.enemy_list [i] = ENEMY_BOSS1_1 + grand(3);
365 if (arena.level > 7)
366 {
367 switch(grand(3))
368 {
369 case 0: arena.enemy_list [i] = ENEMY_BOSS2; break;
370 case 1: arena.enemy_list [i] = ENEMY_BOSS2_2; break;
371 case 2: arena.enemy_list [i] = ENEMY_BOSS2_3; break;
372 }
373 }
374 if (arena.level > 12)
375 {
376 switch(grand(3))
377 {
378 case 0: arena.enemy_list [i] = ENEMY_BOSS3_1; break;
379 case 1: arena.enemy_list [i] = ENEMY_BOSS3_2; break;
380 case 2: arena.enemy_list [i] = ENEMY_BOSS3_3; break;
381 }
382 }
383 arena.enemy_list [i + 1] = ENEMY_LIST_EMPTY;
384 arena.enemy_list [i + 2] = ENEMY_LIST_EMPTY;
385 arena.enemy_list [i + 3] = ENEMY_LIST_EMPTY;
386 arena.enemy_list [i + 4] = ENEMY_LIST_EMPTY;
387 i = arena.total_targets;
388 // total_actual_targets ++;
389 break; // out of i loop
390 }
391 }
392 else
393 {
394 // maybe a miniboss or two...
395 if ((arena.level > 2 || game.mode_god == 1)
396 && ((i == arena.total_targets - 4 && (grand(5) == 0 || game.mode_god == 1))
397 || (i > 2 && i < arena.total_targets - 3 && (grand(20) == 0 || (grand(4) == 0 && game.mode_god == 1)))))
398 {
399 arena.enemy_list [i] = miniboss_type [grand(3)];
400 arena.enemy_list [i + 1] = ENEMY_LIST_EMPTY;
401 arena.enemy_list [i + 2] = ENEMY_LIST_EMPTY;
402 i += 2; // gets +1 from just going through the loop
403 // total_actual_targets ++;
404 continue; // through i loop
405 }
406 }
407 arena.enemy_list [i] = enemy_type [grand(3)];
408 // we have to guarantee at least 5 enemies per level, as 4 symbols are given in a coop game.
409 // total_actual_targets ++;
410 }
411 }
412
413 // arena.enemy_list [0] = ENEMY_SPIKEY4;
414 // arena.enemy_list [1] = ENEMY_OVERSPIKEY;
415 /* arena.enemy_list [1] = ENEMY_SHADOW1;
416 arena.enemy_list [2] = ENEMY_SHADOW2;*/
417
418 /* arena.enemy_list [0] = ENEMY_TRIANGLER1;
419 arena.enemy_list [1] = ENEMY_TRIANGLER1;
420 arena.enemy_list [2] = ENEMY_TRIANGLER2;
421 arena.enemy_list [3] = ENEMY_TRIANGLER2;
422 arena.enemy_list [4] = ENEMY_TRIANGLER3;*/
423
424 /* arena.enemy_list [0] = ENEMY_DEFENDER1;
425 arena.enemy_list [1] = ENEMY_LIST_WAIT;
426 arena.enemy_list [2] = ENEMY_DEFENDER2;
427 arena.enemy_list [3] = ENEMY_LIST_WAIT;
428 arena.enemy_list [4] = ENEMY_DEFENDER3;
429 arena.enemy_list [5] = ENEMY_LIST_WAIT;
430 arena.enemy_list [6] = ENEMY_OVERTRIANGLER;*/
431 /* arena.enemy_list [0] = ENEMY_SPIKEY2;
432 arena.enemy_list [1] = ENEMY_UNDERSPIKEY;
433 arena.enemy_list [2] = ENEMY_UNDERSPIKEY2;
434 arena.enemy_list [3] = ENEMY_UNDERSPIKEY3;*/
435 /* arena.enemy_list [0] = ENEMY_CRUISER1;
436 arena.enemy_list [1] = ENEMY_CRUISER1;
437 arena.enemy_list [1] = ENEMY_CRUISER1;
438 arena.enemy_list [2] = ENEMY_CRUISER1 + grand(5);
439 arena.enemy_list [3] = ENEMY_CRUISER1 + grand(5);
440 arena.enemy_list [4] = ENEMY_CRUISER1 + grand(5);
441 arena.enemy_list [5] = ENEMY_CRUISER1 + grand(5);*/
442 // arena.enemy_list [0] = ENEMY_BOSS3_1 + grand(3);
443 /* arena.enemy_list [0] = ENEMY_GUARDIAN1;
444 arena.enemy_list [1] = ENEMY_GUARDIAN2;
445 arena.enemy_list [2] = ENEMY_GUARDIAN3;
446 arena.enemy_list [3] = ENEMY_GUARDIAN4;
447 arena.enemy_list [4] = ENEMY_GUARDIAN5;*/
448 // arena.enemy_list [3] = ENEMY_LIST_WAIT;
449 break;
450 }
451 // should this be in the i loop?
452 // I'm not sure.
453 arena.enemy_list [i] = ENEMY_LIST_END;
454 arena.next_target_upgrade = grand(arena.total_targets / 3) + 1;
455 // now process the extras:
456 muster_enemies(enemy_type, 3, ROLE_EXTRA, arena.level);
457 extra_list [0] = enemy_type [0];
458 extra_list [1] = enemy_type [1];
459
460 total_actual_targets = 0;
461
462 for (i = 0; i < 25; i ++)
463 {
464 if (arena.enemy_list [i] == ENEMY_LIST_END)
465 break;
466 if (arena.enemy_list [i] != ENEMY_LIST_EMPTY && arena.enemy_list [i] != ENEMY_LIST_WAIT)
467 total_actual_targets ++;
468 }
469
470 int total_symbols = 3;
471
472 if (arena.level > 5)
473 total_symbols = 2;
474
475 if (arena.level > 10)
476 total_symbols = 1;
477
478 if (game.type == GAME_COOP)
479 total_symbols ++;
480
481 for (i = 0; i < total_symbols; i ++)
482 {
483 do
484 {
485 csym = grand(total_actual_targets - 1); // never choose last index - last enemy shouldn't produce a symbol as there mightn't be enough time to collect it.
486 } while (arena.symbol_list [csym] == 1);
487 // || arena.enemy_list [csym] == ENEMY_LIST_WAIT
488 // || arena.enemy_list [csym] == ENEMY_LIST_EMPTY
489 // || arena.enemy_list [csym] == ENEMY_LIST_END);
490
491 arena.symbol_list [csym] = 1;
492 }
493
494 /* switch(arena.level)
495 {
496 case 5:
497 arena.enemy_list [0] = ENEMY_BOSS1_1 + grand(3);
498 arena.enemy_list [1] = ENEMY_LIST_END;
499 arena.total_targets = 1;
500 arena.targets_left_total = 1;
501 arena.max_targets_in_level = 1;
502 break;
503 case 10:
504 case 15:
505 arena.battle_type = BATTLE_BOSS; break;
506 }
507 */
508
509 }
510
511
512 void muster_enemies(int enemy_type [15], int types, int role, int enemy_level)
513 {
514
515 int muster [400]; // arbitrarily high value
516
517 int i, j, m, k = 0;
518
519 m = 0;
520
521 for (i = 0; i < NO_ENEMY_TYPES; i ++)
522 {
523 if (eclass[i].common == 0 || eclass[i].role != role)
524 continue;
525 // if (i != ENEMY_BOSS1_3) //i != ENEMY_CRUISER2 && i != ENEMY_CRUISER3 && i != ENEMY_CRUISER4)
526 // continue;
527 if (abs(eclass[i].level - (enemy_level + k)) < eclass[i].common)
528 {
529 for (j = 0; j < eclass[i].common - abs(eclass[i].level - enemy_level); j ++)
530 {
531 if (m > 200)
532 break;
533 muster [m] = i;
534 m ++;
535 }
536 }
537 }
538
539 for (k = 0; k < types; k ++)
540 {
541 enemy_type [k] = muster [grand(m)];
542 }
543
544
545 }
546
547
548
549
550 int choose_enemy(int e1, int e2, int e3, int e4)
551 {
552 switch(grand(4))
553 {
554 case 0: return e1;
555 case 1: return e2;
556 case 2: return e3;
557 case 3: return e4;
558 }
559
560 return e1;
561
562 }
563
564 void finish_level(void)
565 {
566 arena.level_finished = 1;
567 arena.seconds_left_when_finished = 0;
568 arena.time_bonus = 0;
569 if (arena.hostile == 0)
570 {
571 arena.seconds_left_when_finished = arena.time_left / 33.3333;
572 // arena.time_bonus = arena.seconds_left_when_finished * (arena.level + 2); //(arena.seconds_left_when_finished) * (arena.level + 4);
573 arena.time_bonus = arena.seconds_left_when_finished * 15;
574 if (arena.level <= 10)
575 arena.time_bonus = arena.seconds_left_when_finished * 10;
576 if (arena.level <= 5)
577 arena.time_bonus = arena.seconds_left_when_finished * 5;
578 if (game.users == 1)
579 gain_score(game.single_player, arena.time_bonus);
580 else
581 {
582 gain_score(0, arena.time_bonus);
583 gain_score(1, arena.time_bonus);
584 }
585 }
586 arena.time_left = 166;
587 arena.colour1 = COLOUR_GREY2;
588 arena.colour2 = COLOUR_GREY6;
589 if (arena.hostile > 0)
590 {
591 arena.hostile = 0;
592 arena.colour3 = COLOUR_GREY1;
593 }
594
595 // play_gameover_loop(2000);
596 // play_wavf(NWAV_SUCCESS, 300 + arena.level * 30);
597 // play_sound(WAV_LEVEL_END);
598 }
599
600
601
602
603
604 // is called once at the start of each game
605 void init_time_attack_level(void)
606 {
607 /*
608 if (level_bmp != NULL)
609 {
610 destroy_bitmap(level_bmp); // assumes that it'll have been set to NULL at startup
611 level_bmp = NULL;
612 }*/
613
614 arena.new_level_sign = 80;
615 arena.total_targets = 9;
616
617 game.ta_level = 1;
618 game.ta_symbol_count = 0;
619 game.symbols_given = 0;
620 game.ta_total_time = 0;
621 game.ta_enemy_index = 0;
622
623 init_bullets();
624 init_clouds();
625 init_enemies();
626 reset_lights();
627 init_effects(); // cloud.c
628
629 calculate_beat();
630
631 arena.max_x = 794000;
632 arena.max_y = 795000;
633
634 game.ta_enemy_index = 0;
635 time_attack_enemies(); // ie make_enemy_list
636
637 arena.time_left = 33.333 * 60;
638
639 arena.level_finished = 0;
640 arena.hostile = 0;
641 arena.next_target = grand(3) + 2;
642 arena.next_non_target = grand(4) + 15;
643 init_pickups();
644
645 tilemap();
646
647 }
648
649 void run_time_attack_level(void)
650 {
651
652 int i;
653
654 int current_targets = 0;
655 int current_non_targets = 0;
656
657 arena.next_target --;
658 if (game.ta_level > 1)
659 arena.next_non_target --;
660
661 if (arena.next_target > 0 && arena.next_non_target > 0)
662 return;
663 // Don't bother placing new enemies if now's not the time
664
665 for (i = 0; i < NO_ENEMIES; i ++)
666 {
667 if (enemy[i].type == ENEMY_NONE)
668 continue;
669 if (enemy[i].target == TARGET_PRIMARY)
670 {
671 current_targets ++;
672 if (eclass[enemy[i].type].role == ROLE_MINIBOSS)
673 current_targets += 2; // ie +3 in total
674 }
675 if (enemy[i].target == TARGET_EXTRA)
676 current_non_targets ++;
677 }
678
679
680 if (arena.next_target <= 0)
681 {
682 if (current_targets < 5)
683 {
684 #ifdef SANITY_CHECK
685 if (game.ta_enemy_index >= 20 || game.ta_enemy_index <= -1 || game.ta_enemies [game.ta_enemy_index] < 0)
686 {
687 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
688 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "run_ta_level %i", game.ta_enemy_index);
689 if (game.ta_enemy_index >= 0)
690 textprintf_centre_ex(screen, small_font, 400, 260, COLOUR_WHITE, -1, "%i", game.ta_enemies [game.ta_enemy_index]);
691 rest(2000);
692 return;
693 // exit(type);
694 }
695 #endif
696 if (spawn_enemy(game.ta_enemies [game.ta_enemy_index], 0, PICKUP_NONE, TARGET_PRIMARY) != -1)
697 game.ta_enemy_index ++;
698 if (game.ta_enemies [game.ta_enemy_index] == ENEMY_LIST_END)
699 {
700 if (game.ta_level < 13)
701 game.ta_level ++; // 13 rather than 15 because it gives a wider range of enemies
702 game.ta_enemy_index = 0;
703 time_attack_enemies();
704 }
705 }
706 arena.next_target = 3;
707 }
708
709 int etype;
710
711 if (arena.next_non_target <= 0)
712 {
713 if (current_non_targets < 3)
714 {
715 etype = game.ta_extra_list [grand(2)];
716 #ifdef SANITY_CHECK
717 if (etype <= -1 || etype >= NO_ENEMY_TYPES)
718 {
719 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
720 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "run_ta_level extra %i", etype);
721 rest(2000);
722 return;
723 }
724 #endif
725 spawn_enemy(etype, 0, PICKUP_NONE, TARGET_EXTRA);
726 }
727 arena.next_non_target = 30;
728 }
729
730
731
732 }
733
734
735 void time_attack_enemies(void)
736 {
737
738 int enemy_type [15];
739 int miniboss_type [15];
740
741 muster_enemies(enemy_type, 3, ROLE_TARGET, game.ta_level);
742 muster_enemies(miniboss_type, 3, ROLE_MINIBOSS, game.ta_level);
743 muster_enemies(game.ta_extra_list, 2, ROLE_EXTRA, game.ta_level);
744
745 /* enemy_type [0] = ENEMY_CRUISER1;
746 enemy_type [1] = ENEMY_CRUISER2;
747 enemy_type [2] = ENEMY_CRUISER3;*/
748
749
750 int i, list_index = 0;
751
752 for (i = 0; i < 9; i ++)
753 {
754 #ifdef SANITY_CHECK
755 if (list_index > 10)
756 {
757 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
758 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "time_attack_enemies %i", list_index);
759 rest(2000);
760 return;
761 // exit(type);
762 }
763 #endif
764
765 game.ta_enemies [list_index] = enemy_type [grand(3)];
766
767
768 /*
769
770 do
771 {
772 e_index++;
773 }
774 while (eclass[e_index].role != ROLE_TARGET || eclass[e_index].common == 0);
775 game.ta_enemies [list_index] = e_index;
776 list_index ++;
777 continue;
778 */
779
780 if (game.ta_level == 1)
781 {
782 if (grand(2) == 0)
783 game.ta_enemies [list_index] = ENEMY_GUARDIAN1;
784 else
785 game.ta_enemies [list_index] = ENEMY_MULTI1;
786 }
787 if (game.ta_level >= 3)
788 {
789 if (i == 7 && (grand(5) == 0 || game.mode_god == 1))
790 {
791 game.ta_enemies [list_index] = miniboss_type [grand(3)];
792 game.ta_enemies [list_index + 1] = ENEMY_LIST_END;
793 i += 2;
794 }
795 if (i == 3 && (grand(2) == 0 || (game.mode_god == 1 && grand(3) != 0))) // was (5)
796 {
797 game.ta_enemies [list_index] = miniboss_type [grand(3)];
798 i += 2;
799 }
800 }
801 #ifdef SANITY_CHECK
802 if (game.ta_enemies [list_index] <= -1 || game.ta_enemies [list_index] >= NO_ENEMY_TYPES)
803 {
804 rectfill(screen, 370, 230, 430, 280, COLOUR_RED3);
805 textprintf_centre_ex(screen, small_font, 400, 250, COLOUR_WHITE, -1, "time_attack_enemies ta_enemies %i", game.ta_enemies [list_index]);
806 rest(2000);
807 return;
808 // exit(type);
809 }
810 #endif
811 /*
812 do
813 {
814 test_ta_enemies ++;
815 } while(eclass[test_ta_enemies].common == 0);
816 game.ta_enemies [list_index] = test_ta_enemies;
817 */
818
819 list_index ++;
820 }
821
822 game.ta_enemies [list_index] = ENEMY_LIST_END;
823
824 }
825
826
827 void init_duel_level(void)
828 {
829
830 init_bullets();
831 init_clouds();
832 init_enemies();
833 reset_lights();
834
835 player[0].duel_score = 0;
836 player[1].duel_score = 0;
837 game.symbols_given = 0;
838
839 game.duel_level = 0;
840
841 calculate_beat();
842
843 // arena.colour1 = COLOUR_YELLOW2;
844 // arena.colour2 = COLOUR_YELLOW6;
845 // arena.colour3 = COLOUR_GREY1;
846
847 arena.max_x = 794000 + grand(6) * 100000;
848 arena.max_y = 795000 + grand(6) * 100000;
849 if (arena.max_x > 1200000)
850 {
851 arena.max_x = 1194000;
852 }
853 if (arena.max_y > 1200000)
854 {
855 arena.max_y = 1195000;
856 }
857 switch(game.duel_crawlies)
858 {
859 case 0:
860 arena.max_non_targets_in_level = 0;
861 arena.between_crawly_upgrades = 0;
862 break;
863 case 1:
864 arena.max_non_targets_in_level = 3;
865 arena.between_crawly_upgrades = 2;
866 break;
867 case 2:
868 arena.max_non_targets_in_level = 6;
869 arena.between_crawly_upgrades = 2;
870 break;
871 case 3:
872 arena.max_non_targets_in_level = 9;
873 arena.between_crawly_upgrades = 2;
874 break;
875 }
876 arena.time_left = 33.333 * 180;
877 if (game.duel_mode == DUEL_10_MINUTES)
878 arena.time_left = 33.333 * 600;
879
880 arena.level_finished = 0;
881 arena.next_non_target = grand(5) + 1;
882 // arena.next_crawly_upgrade = grand(arena.between_crawly_upgrades) + 1;
883 arena.hostile = 0;
884 arena.crawlies_created = 0;
885 init_pickups();
886
887 make_enemy_list();
888
889 tilemap();
890
891 }
892
893
894
895 // called about every second
896 void run_duel_level(void)
897 {
898
899 int i;
900 int current_enemies = 0;
901 // int subtype = SUBTYPE_NONE;
902 // int carrying_pickup = PICKUP_NONE;
903 int target_index = -1;
904 int level_raised = 0;
905
906 arena.next_non_target --;
907
908 if (arena.next_non_target > 0 || game.duel_crawlies == 0)
909 return;
910
911 for (i = 0; i < NO_ENEMIES; i ++)
912 {
913 if (enemy[i].type == ENEMY_NONE)
914 continue;
915 // if (enemy[i].target == TARGET_CRAWLY)
916 current_enemies ++;
917 }
918
919 if (current_enemies < arena.max_non_targets_in_level)
920 {
921 // if (grand(3) == 0)
922 switch(grand(4))
923 {
924 case 0: target_index = ENEMY_SPINNER1; break;
925 case 1: target_index = ENEMY_SPIKEY1; break;
926 case 2: target_index = ENEMY_FIGHTER1; break;
927 case 3: target_index = ENEMY_BLATTER1; break;
928 }
929 if (game.duel_level > 8)
930 {
931 // level_raised = grand((game.duel_level - 8) / 2 + 1);
932 level_raised = grand((game.duel_level - 8) / 3 + 1);
933 if (level_raised > 4)
934 level_raised = 4;
935 target_index += level_raised;
936 }
937 if (game.duel_level > 15)
938 {
939 if (grand(6) == 0)
940 target_index = ENEMY_MINEFIELDER1;
941 }
942 spawn_enemy(target_index, 0, 0, TARGET_NO);
943 game.duel_level++;
944 }
945 switch(game.duel_crawlies)
946 {
947 default:
948 case 0:
949 arena.next_non_target = 0;
950 break;
951 case 1:
952 arena.next_non_target = 24;
953 break;
954 case 2:
955 arena.next_non_target = 12;
956 break;
957 case 3:
958 arena.next_non_target = 6;
959 break;
960 }
961
962
963 /* if (arena.next_crawly == 0)
964 {
965 if (current_crawlies < arena.max_crawlies_in_level)
966 {
967 arena.next_crawly_upgrade --;
968 if (arena.next_crawly_upgrade == 0)
969 {
970 arena.next_crawly_upgrade = grand(arena.between_crawly_upgrades) + 1;
971 carrying_pickup = PICKUP_SQUARE + grand(4);
972 }
973 else
974 {
975 if (grand(12) == 0)
976 carrying_pickup = PICKUP_REPAIR;
977 }
978 target_index = ENEMY_CRAWLER;
979 if (grand(3) == 0 && arena.crawlies_created > 16)
980 target_index = ENEMY_CRAWLER3;
981 if (grand(3) == 0 && arena.crawlies_created > 8)
982 target_index = ENEMY_CRAWLER2;
983 if (grand(3) == 0)
984 target_index = ENEMY_FALLER;
985
986 subtype = SUBTYPE_GREEN;
987 subtype += grand(arena.crawlies_created) / 8;
988 if (subtype > SUBTYPE_PURPLE)
989 subtype = SUBTYPE_PURPLE;
990 spawn_enemy(target_index, subtype, carrying_pickup, TARGET_CRAWLY);
991 }
992 switch(game.duel_crawlies)
993 {
994 case 0:
995 arena.next_crawly = 0;
996 break;
997 case 1:
998 arena.next_crawly = 24;
999 break;
1000 case 2:
1001 arena.next_crawly = 12;
1002 break;
1003 case 3:
1004 arena.next_crawly = 6;
1005 break;
1006 }
1007 }
1008
1009 */
1010 }
1011
1012
1013
0
1 void init_level(void);
2 void run_level(void);
3 void finish_level(void);
4
0 GNU GENERAL PUBLIC LICENSE
1 Version 2, June 1991
2
3 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
4 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The licenses for most software are designed to take away your
11 freedom to share and change it. By contrast, the GNU General Public
12 License is intended to guarantee your freedom to share and change free
13 software--to make sure the software is free for all its users. This
14 General Public License applies to most of the Free Software
15 Foundation's software and to any other program whose authors commit to
16 using it. (Some other Free Software Foundation software is covered by
17 the GNU Library General Public License instead.) You can apply it to
18 your programs, too.
19
20 When we speak of free software, we are referring to freedom, not
21 price. Our General Public Licenses are designed to make sure that you
22 have the freedom to distribute copies of free software (and charge for
23 this service if you wish), that you receive source code or can get it
24 if you want it, that you can change the software or use pieces of it
25 in new free programs; and that you know you can do these things.
26
27 To protect your rights, we need to make restrictions that forbid
28 anyone to deny you these rights or to ask you to surrender the rights.
29 These restrictions translate to certain responsibilities for you if you
30 distribute copies of the software, or if you modify it.
31
32 For example, if you distribute copies of such a program, whether
33 gratis or for a fee, you must give the recipients all the rights that
34 you have. You must make sure that they, too, receive or can get the
35 source code. And you must show them these terms so they know their
36 rights.
37
38 We protect your rights with two steps: (1) copyright the software, and
39 (2) offer you this license which gives you legal permission to copy,
40 distribute and/or modify the software.
41
42 Also, for each author's protection and ours, we want to make certain
43 that everyone understands that there is no warranty for this free
44 software. If the software is modified by someone else and passed on, we
45 want its recipients to know that what they have is not the original, so
46 that any problems introduced by others will not reflect on the original
47 authors' reputations.
48
49 Finally, any free program is threatened constantly by software
50 patents. We wish to avoid the danger that redistributors of a free
51 program will individually obtain patent licenses, in effect making the
52 program proprietary. To prevent this, we have made it clear that any
53 patent must be licensed for everyone's free use or not licensed at all.
54
55 The precise terms and conditions for copying, distribution and
56 modification follow.
57
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63 a notice placed by the copyright holder saying it may be distributed
64 under the terms of this General Public License. The "Program", below,
65 refers to any such program or work, and a "work based on the Program"
66 means either the Program or any derivative work under copyright law:
67 that is to say, a work containing the Program or a portion of it,
68 either verbatim or with modifications and/or translated into another
69 language. (Hereinafter, translation is included without limitation in
70 the term "modification".) Each licensee is addressed as "you".
71
72 Activities other than copying, distribution and modification are not
73 covered by this License; they are outside its scope. The act of
74 running the Program is not restricted, and the output from the Program
75 is covered only if its contents constitute a work based on the
76 Program (independent of having been made by running the Program).
77 Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80 source code as you receive it, in any medium, provided that you
81 conspicuously and appropriately publish on each copy an appropriate
82 copyright notice and disclaimer of warranty; keep intact all the
83 notices that refer to this License and to the absence of any warranty;
84 and give any other recipients of the Program a copy of this License
85 along with the Program.
86
87 You may charge a fee for the physical act of transferring a copy, and
88 you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91 of it, thus forming a work based on the Program, and copy and
92 distribute such modifications or work under the terms of Section 1
93 above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114
115 These requirements apply to the modified work as a whole. If
116 identifiable sections of that work are not derived from the Program,
117 and can be reasonably considered independent and separate works in
118 themselves, then this License, and its terms, do not apply to those
119 sections when you distribute them as separate works. But when you
120 distribute the same sections as part of a whole which is a work based
121 on the Program, the distribution of the whole must be on the terms of
122 this License, whose permissions for other licensees extend to the
123 entire whole, and thus to each and every part regardless of who wrote it.
124
125 Thus, it is not the intent of this section to claim rights or contest
126 your rights to work written entirely by you; rather, the intent is to
127 exercise the right to control the distribution of derivative or
128 collective works based on the Program.
129
130 In addition, mere aggregation of another work not based on the Program
131 with the Program (or with a work based on the Program) on a volume of
132 a storage or distribution medium does not bring the other work under
133 the scope of this License.
134
135 3. You may copy and distribute the Program (or a work based on it,
136 under Section 2) in object code or executable form under the terms of
137 Sections 1 and 2 above provided that you also do one of the following:
138
139 a) Accompany it with the complete corresponding machine-readable
140 source code, which must be distributed under the terms of Sections
141 1 and 2 above on a medium customarily used for software interchange; or,
142
143 b) Accompany it with a written offer, valid for at least three
144 years, to give any third party, for a charge no more than your
145 cost of physically performing source distribution, a complete
146 machine-readable copy of the corresponding source code, to be
147 distributed under the terms of Sections 1 and 2 above on a medium
148 customarily used for software interchange; or,
149
150 c) Accompany it with the information you received as to the offer
151 to distribute corresponding source code. (This alternative is
152 allowed only for noncommercial distribution and only if you
153 received the program in object code or executable form with such
154 an offer, in accord with Subsection b above.)
155
156 The source code for a work means the preferred form of the work for
157 making modifications to it. For an executable work, complete source
158 code means all the source code for all modules it contains, plus any
159 associated interface definition files, plus the scripts used to
160 control compilation and installation of the executable. However, as a
161 special exception, the source code distributed need not include
162 anything that is normally distributed (in either source or binary
163 form) with the major components (compiler, kernel, and so on) of the
164 operating system on which the executable runs, unless that component
165 itself accompanies the executable.
166
167 If distribution of executable or object code is made by offering
168 access to copy from a designated place, then offering equivalent
169 access to copy the source code from the same place counts as
170 distribution of the source code, even though third parties are not
171 compelled to copy the source along with the object code.
172
173
174 4. You may not copy, modify, sublicense, or distribute the Program
175 except as expressly provided under this License. Any attempt
176 otherwise to copy, modify, sublicense or distribute the Program is
177 void, and will automatically terminate your rights under this License.
178 However, parties who have received copies, or rights, from you under
179 this License will not have their licenses terminated so long as such
180 parties remain in full compliance.
181
182 5. You are not required to accept this License, since you have not
183 signed it. However, nothing else grants you permission to modify or
184 distribute the Program or its derivative works. These actions are
185 prohibited by law if you do not accept this License. Therefore, by
186 modifying or distributing the Program (or any work based on the
187 Program), you indicate your acceptance of this License to do so, and
188 all its terms and conditions for copying, distributing or modifying
189 the Program or works based on it.
190
191 6. Each time you redistribute the Program (or any work based on the
192 Program), the recipient automatically receives a license from the
193 original licensor to copy, distribute or modify the Program subject to
194 these terms and conditions. You may not impose any further
195 restrictions on the recipients' exercise of the rights granted herein.
196 You are not responsible for enforcing compliance by third parties to
197 this License.
198
199 7. If, as a consequence of a court judgment or allegation of patent
200 infringement or for any other reason (not limited to patent issues),
201 conditions are imposed on you (whether by court order, agreement or
202 otherwise) that contradict the conditions of this License, they do not
203 excuse you from the conditions of this License. If you cannot
204 distribute so as to satisfy simultaneously your obligations under this
205 License and any other pertinent obligations, then as a consequence you
206 may not distribute the Program at all. For example, if a patent
207 license would not permit royalty-free redistribution of the Program by
208 all those who receive copies directly or indirectly through you, then
209 the only way you could satisfy both it and this License would be to
210 refrain entirely from distribution of the Program.
211
212 If any portion of this section is held invalid or unenforceable under
213 any particular circumstance, the balance of the section is intended to
214 apply and the section as a whole is intended to apply in other
215 circumstances.
216
217 It is not the purpose of this section to induce you to infringe any
218 patents or other property right claims or to contest validity of any
219 such claims; this section has the sole purpose of protecting the
220 integrity of the free software distribution system, which is
221 implemented by public license practices. Many people have made
222 generous contributions to the wide range of software distributed
223 through that system in reliance on consistent application of that
224 system; it is up to the author/donor to decide if he or she is willing
225 to distribute software through any other system and a licensee cannot
226 impose that choice.
227
228 This section is intended to make thoroughly clear what is believed to
229 be a consequence of the rest of this License.
230
231
232 8. If the distribution and/or use of the Program is restricted in
233 certain countries either by patents or by copyrighted interfaces, the
234 original copyright holder who places the Program under this License
235 may add an explicit geographical distribution limitation excluding
236 those countries, so that distribution is permitted only in or among
237 countries not thus excluded. In such case, this License incorporates
238 the limitation as if written in the body of this License.
239
240 9. The Free Software Foundation may publish revised and/or new versions
241 of the General Public License from time to time. Such new versions will
242 be similar in spirit to the present version, but may differ in detail to
243 address new problems or concerns.
244
245 Each version is given a distinguishing version number. If the Program
246 specifies a version number of this License which applies to it and "any
247 later version", you have the option of following the terms and conditions
248 either of that version or of any later version published by the Free
249 Software Foundation. If the Program does not specify a version number of
250 this License, you may choose any version ever published by the Free Software
251 Foundation.
252
253 10. If you wish to incorporate parts of the Program into other free
254 programs whose distribution conditions are different, write to the author
255 to ask for permission. For software which is copyrighted by the Free
256 Software Foundation, write to the Free Software Foundation; we sometimes
257 make exceptions for this. Our decision will be guided by the two goals
258 of preserving the free status of all derivatives of our free software and
259 of promoting the sharing and reuse of software generally.
260
261 NO WARRANTY
262
263 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
264 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
265 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
266 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
267 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
268 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
269 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
270 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
271 REPAIR OR CORRECTION.
272
273 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
274 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
275 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
276 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
277 ARISING
278 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
279 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
280 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
281 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
282 POSSIBILITY OF SUCH DAMAGES.
283
284 END OF TERMS AND CONDITIONS
285
286
287 How to Apply These Terms to Your New Programs
288
289 If you develop a new program, and you want it to be of the greatest
290 possible use to the public, the best way to achieve this is to make it
291 free software which everyone can redistribute and change under these terms.
292
293 To do so, attach the following notices to the program. It is safest
294 to attach them to the start of each source file to most effectively
295 convey the exclusion of warranty; and each file should have at least
296 the "copyright" line and a pointer to where the full notice is found.
297
298 <one line to give the program's name and a brief idea of what it does.>
299 Copyright (C) <year> <name of author>
300
301 This program is free software; you can redistribute it and/or modify
302 it under the terms of the GNU General Public License as published by
303 the Free Software Foundation; either version 2 of the License, or
304 (at your option) any later version.
305
306 This program is distributed in the hope that it will be useful,
307 but WITHOUT ANY WARRANTY; without even the implied warranty of
308 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
309 GNU General Public License for more details.
310
311 You should have received a copy of the GNU General Public License
312 along with this program; if not, write to the Free Software
313 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
314
315
316 Also add information on how to contact you by electronic and paper mail.
317
318 If the program is interactive, make it output a short notice like this
319 when it starts in an interactive mode:
320
321 Gnomovision version 69, Copyright (C) year name of author
322 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
323 This is free software, and you are welcome to redistribute it
324 under certain conditions; type `show c' for details.
325
326 The hypothetical commands `show w' and `show c' should show the appropriate
327 parts of the General Public License. Of course, the commands you use may
328 be called something other than `show w' and `show c'; they could even be
329 mouse-clicks or menu items--whatever suits your program.
330
331 You should also get your employer (if you work as a programmer) or your
332 school, if any, to sign a "copyright disclaimer" for the program, if
333 necessary. Here is a sample; alter the names:
334
335 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
336 `Gnomovision' (which makes passes at compilers) written by James Hacker.
337
338 <signature of Ty Coon>, 1 April 1989
339 Ty Coon, President of Vice
340
341 This General Public License does not permit incorporating your program into
342 proprietary programs. If your program is a subroutine library, you may
343 consider it more useful to permit linking proprietary applications with the
344 library. If this is what you want to do, use the GNU Library General
345 Public License instead of this License.
346
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: light.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - functions relating to light sources
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36
37 #include "config.h"
38 #include "globvars.h"
39
40 #include "stuff.h"
41 //#include "palette.h"
42
43 #include "light.h"
44
45 struct lightstruct light [NO_LIGHTS];
46
47 void reset_lights(void)
48 {
49 light[0].type = LIGHT_NONE;
50 }
51
52 int add_light(int ltype, int lsize, int lx, int ly)
53 {
54 int i = 0;
55
56 do
57 {
58 if (light[i].type == LIGHT_NONE)
59 {
60 light[i].x = lx;
61 light[i].y = ly;
62 light[i].type = ltype;
63 light[i].size = lsize;
64 light[i + 1].type = LIGHT_NONE;
65 return 1;
66 }
67 if (i >= NO_LIGHTS - 2)
68 return -1;
69 i++;
70 }
71 while(TRUE);
72
73 return -1;
74
75 }
76
77
78
79
0 #define NO_LIGHTS 100
1
2 struct lightstruct
3 {
4 int x;
5 int y;
6 int size;
7 int type;
8
9 };
10
11 enum
12 {
13 LIGHT_NONE,
14 LIGHT_NORMAL
15
16 };
17
18 void reset_lights(void);
19 int add_light(int ltype, int lsize, int lx, int ly);
20
21
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: Main.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - main()
30 - various initialisation functions
31 - miscellaneous stuff
32
33
34 */
35
36 /*
37
38 Your guide to source files:
39 (for more information visit the files themselves)
40
41 actor.c
42 - functions for dealing with actors (ie players' ships)
43 bullet.c
44 - creation, movement and collision of bullets
45 cloud.c
46 - clouds - ie non-bullet special effects
47 cmds.c
48 - makes actors implement commands issued in input.c
49 displ_in.c
50 - initialises the display and loads bitmaps
51 display.c
52 - shows things on the screen
53 eclass.c
54 - big struct containing enemy data
55 enemy.c
56 - horrible code for all enemies
57 game.c
58 - the game loop and a few special functions
59 input.c
60 - takes keyboard input
61 levels.c
62 - initialises and manages the levels, enemy spawning etc
63 light.c
64 - like cloud.c but for lights
65 main.c
66 - this file
67 menu.c
68 - the front-end interface
69 palette.c
70 - the palette and transparency functions
71 pickup.c
72 - pickups are symbols/repair/weapons
73 score.c
74 - deals with scoring
75 sound.c
76 - initialises and plays sounds
77 stuff.c
78 - small, very generic functions (like grand)
79 tile.c
80 - generates the background graphics, which are displayed in display.c
81
82
83 Most .h files just contain function definitions. But some are special:
84
85 config.h
86 - structs, enums and #defines
87 globvar.h
88 - extern declarations of global variables
89 sound.h
90 - the WAV_xxx sound enum
91 palette.h
92 - the COLOUR_xxx and TRANS_xxx enums
93 display.h
94 - all the graphics enums
95
96 */
97
98
99 #include "allegro.h"
100
101 //#include <conio.h>
102 #include <string.h>
103 //#include <stdlib.h>
104 //#include <stdio.h>
105 //#include <pc.h>
106 #include <math.h>
107
108 #include "config.h"
109
110 #include "palette.h"
111
112 #include "displ_in.h"
113 #include "display.h"
114 #include "cmds.h"
115 #include "input.h"
116 #include "actor.h"
117 //#include "stars.h"
118 #include "bullet.h"
119 #include "cloud.h"
120 //#include "ships.h"
121 #include "enemy.h"
122 #include "levels.h"
123 #include "menu.h"
124 #include "sound.h"
125 #include "stuff.h"
126
127 // Global variables:
128
129 struct gamestruct game;
130
131 struct playerstruct player [NO_PLAYERS];
132
133 struct actorstruct actor [NO_ACTORS];
134
135 struct bulletstruct bullet [NO_BULLETS];
136
137 struct cloudstruct cloud [NO_CLOUDS];
138
139 struct starstruct star [NO_STARS];
140
141 struct arenastruct arena;
142
143 struct enemystruct enemy [NO_ENEMIES];
144
145 unsigned char counter;
146
147 struct pickupstruct pickup [NO_PICKUPS];
148
149 // --- end global variables
150
151 // timer interupt functions and variables:
152 void framecount(void);
153
154 volatile int framecounter;
155 volatile int frames_per_second;
156
157 volatile int inputcounter = 0;
158 volatile int inputs_per_second = 0;
159
160 volatile int turncounter = 0;
161 volatile int turns_per_second = 0;
162
163 void tickover(void);
164
165 volatile unsigned char ticked;
166 //volatile unsigned char tick_counter;
167 int slacktime;
168 // --- end timer interupt
169
170 extern int grid_offset_x_2p_finetune;
171
172 // init functions
173 void init_at_startup(void);
174 void begin_game(void);
175 // --- end init functions
176
177
178 void game_loop(void);
179
180 struct optionstruct options;
181
182
183 void framecount(void)
184 {
185 frames_per_second = framecounter;
186 framecounter = 0;
187 // turns_per_second = turncounter;
188 // turncounter = 0;
189 // inputs_per_second = inputcounter;
190 // inputcounter = 0;
191 // arena.time_left --;
192 }
193 END_OF_FUNCTION (framecount);
194
195
196 void tickover(void)
197 {
198 ticked ++;
199 // tick_counter++; // assumes it'll wrap at 256
200 }
201 END_OF_FUNCTION (tickover);
202
203
204
205 int main(void)
206 {
207
208 int allint = allegro_init();
209 if (allint == -1)
210 {
211 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
212 allegro_message("Failed to initialise Allegro! This isn't going to work, sorry.");
213 exit(1);
214 }
215
216 set_config_file("lacew.cfg");
217
218 install_keyboard();
219 install_timer();
220
221 three_finger_flag = 0;
222 key_led_flag = 0;
223
224
225 init_at_startup();
226
227 menu_loop();
228
229 return 0;
230
231 }
232
233 END_OF_MAIN();
234
235
236 void init_at_startup(void)
237 {
238
239
240 LOCK_FUNCTION (framecount);
241 LOCK_FUNCTION (tickover);
242 LOCK_VARIABLE (ticked);
243 // LOCK_VARIABLE (tick_counter);
244 LOCK_VARIABLE (frames_per_second);
245 LOCK_VARIABLE (framecounter);
246 LOCK_VARIABLE (turns_per_second);
247 LOCK_VARIABLE (turncounter);
248 // LOCK_VARIABLE (inputs_per_second);
249 // LOCK_VARIABLE (inputcounter);
250
251 install_int (framecount, 1000);
252 install_int (tickover, 30);
253
254 set_color_depth(8);
255
256 set_config_file("overgod.cfg");
257
258 options.resolution = get_config_int("Options", "Resolution", 0);
259
260 int randseed = get_config_int("Misc", "Seed", 0);
261 srand(randseed);
262
263 int windowed = GFX_AUTODETECT_FULLSCREEN;
264
265 switch(options.resolution)
266 {
267 // case 640:
268 case 0:
269 graphics_mode = GMODE_640_480;
270 break;
271 case 1:
272 graphics_mode = GMODE_800_600;
273 break;
274 case 2:
275 graphics_mode = GMODE_640_480;
276 windowed = GFX_AUTODETECT_WINDOWED;
277 break;
278 case 3:
279 graphics_mode = GMODE_800_600;
280 windowed = GFX_AUTODETECT_WINDOWED;
281 break;
282 /* case 1024:
283 graphics_mode = GMODE_1024_768;
284 break;*/
285 }
286
287 scr_x = 640;
288 scr_y = 480;
289 tp_window_width = 315;
290 grid_offset_x_1p = 0;//35000;
291 grid_offset_x_2p = -3;//32000;
292 // grid_offset_x_2p = 32000 + 850000;
293 grid_offset_x_2p_finetune = -13;
294 grid_offset_y = 0;
295 special_600_y = 0;
296 text_offset_x_1p = 0;
297 text_offset_x_2p = 0;
298 text_offset_x = 0;
299 text_offset_y = 0;
300 grid_finetune_x_1p = 0;
301 grid_finetune_y = 0;
302 visible_grids_y = 15;
303
304 switch(graphics_mode)
305 {
306 case GMODE_800_600:
307 scr_x = 800;
308 scr_y = 600;
309 tp_window_width = 395;
310 grid_offset_x_1p = 3;//5000;
311 grid_offset_x_2p = -3;//8000;//-2000;
312 grid_finetune_x_1p = 31;
313 grid_finetune_x_2p = 10;
314 grid_offset_x_2p_finetune = -22;
315 grid_finetune_y = -90;
316 grid_offset_y = -10000;
317 special_600_y = -5;
318 text_offset_y = 60;
319 text_offset_x = 80;
320 visible_grids_y = 60;
321 special_600_y = 2;
322 break;
323 /* case GMODE_1024_768:
324 scr_x = 1024;
325 scr_y = 768;
326 tp_window_width = 507;
327 grid_offset_x_1p = 43000;
328 grid_offset_x_2p = 2000;
329 grid_offset_y = 6000;
330 special_600_y = 0;
331 text_offset_y = 144;
332 text_offset_x = 192;
333 break;
334 not working
335 */
336 }
337
338 if (set_gfx_mode(windowed, scr_x, scr_y, 0, 0) != 0)
339 // if (set_gfx_mode(GFX_DIRECTX_FULLSCREEN, scr_x, scr_y, 0, 0) != 0)
340 {
341 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
342 allegro_message("Unable to set %ix%i display mode\n%s\n", scr_x, scr_y, allegro_error);
343 exit(1);
344 }
345
346 init_trig(); // can't use any integer trig before this!
347
348 init_palette();
349
350 init_display();
351 init_menus_once_only();
352
353 init_sound(); // must come after init_menus_once_only, as that's where
354 // options.sound_enabled is set.
355
356
357
358 }
359
360
361
+4763
-0
menu.c less more
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: menu.c
25 History:
26 11/9/2003 - Version 1.0 finalised
27
28 This file contains:
29 - the front end GUI. One of the few files other than display.c & displ_in.c
30 which are authorised to write directly to the screen.
31
32 */
33
34 #include "allegro.h"
35
36 //#include <stdlib.h>
37 #include <string.h>
38
39 #include "config.h"
40 #include "globvars.h"
41
42 #include "stuff.h"
43
44 #include "palette.h"
45
46 #include "game.h"
47 //#include "upgrades.h"
48 #include "display.h"
49 #include "sound.h"
50
51 #define NO_SCORES 15
52 #define SCORE_LENGTH 15
53
54 #define GRID_GRAIN 100
55 //#define NO_BOUNCIES 16
56
57 #define NO_KEY KEY_TILDE
58
59 #define KP_WAIT_LONG 33
60 #define KP_WAIT_SHORT 5
61
62 // let's try to prevent at least the most obvious form of abuse
63 #define UNLOCK_PURPLE 23498
64 #define UNLOCK_VOID 132
65 #define UNLOCK_GOD 357
66
67 extern struct optionstruct options;
68
69
70 //#define FIX_TITLE
71
72 //#ifdef FIX_TITLE
73 //extern RGB palet [256];
74 //#endif
75
76 enum
77 {
78 MENU_NONE,
79 MENU_MAIN,
80 MENU_OPTIONS,
81 MENU_SCORES,
82 MENU_ENTER_SCORES,
83 MENU_SPECIAL,
84 MENU_DUEL
85 };
86
87 enum
88 {
89 DUEL_OPTIONS,
90 DUEL_START,
91 DUEL_MODE,
92 DUEL_ENEMIES,
93 DUEL_HANDICAP_P1,
94 DUEL_HANDICAP_P2,
95 DUEL_LEADER_HANDICAP,
96 DUEL_EXIT,
97 DUEL_END
98
99 };
100
101 enum
102 {
103 SPECIAL_TIME_ATTACK,
104 SPECIAL_DUEL,
105 SPECIAL_SPACE1,
106 SPECIAL_MODES,
107 SPECIAL_PURPLE,
108 SPECIAL_VOID,
109 SPECIAL_GOD,
110 SPECIAL_SPACE2,
111 SPECIAL_EXIT,
112 SPECIAL_END
113
114 };
115
116 enum
117 {
118 RANK_SLAVE,
119 RANK_DOUBTER,
120 RANK_UNBELIEVER,
121 RANK_BLASPHEMER,
122 RANK_APOSTATE,
123 RANK_HERETIC,
124 RANK_HERESIARCH,
125 RANK_SECULARIST,
126 RANK_DEICIDE,
127 RANK_DEMIGOD,
128 RANK_GODLING,
129 RANK_UNDERGOD,
130 RANK_LESSER_GOD,
131 RANK_GREATER_GOD,
132 RANK_OVERGOD,
133 RANK_SUPREME_BEING
134 };
135
136 enum
137 {
138 MS_SPINNER,
139 MS_SPIKEY,
140 MS_SQUAREY,
141 MS_BLATTER,
142 MS_ORBITER,
143 MS_TYPES
144 };
145
146 int ms_circle_rad;
147 int ms_circle_col;
148 int ms_arm_col [2];
149 int ms_arm_out [2];
150 int ms_arm_angle[2];
151 int ms_arm_inward [2];
152 int ms_arm_number [2];
153 int ms_arm_rot [2];
154 int ms_arm_rot_delta [2];
155 int ms_arm_type [2];
156 int ms_arm_blatter_size [2];
157
158
159 void menu_display(void);
160 void start_game_from_menu(int game_type);
161 void menu_input(void);
162
163 void menu_display_main(void);
164 void menu_display_options(void);
165 void menu_display_duel(void);
166 void menu_display_special(void);
167 void menu_display_scores(void);
168 void menu_trigger(void);
169 void display_victory_screen(void);
170 void menu_to_screen(void);
171
172 int acceptable_char(int scode);
173 int acceptable_name_char(int ascode);
174 void scancode_to_keyname(int scanc, char sstr [30]);
175 char scancode_to_asc(int scanc);
176 char get_shifted_number(char inputted);
177
178 void test_speakers(void);
179 void resolution_change(void);
180
181 void menu_sound1(void);
182 void menu_sound2(void);
183
184 // in display.c
185 void draw_overspinner(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2);
186 void draw_spikey(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2, int in_correction, int out_correction);
187 void draw_blatter(BITMAP *bmp, int x, int y, int number, int distance, int rotation, int size, int col1, int col2);
188 void draw_squarey(BITMAP *bmp, int x, int y, int attribute, int outward, int inward, int angle1, int angle2, int arms, int col1, int col2);
189 void draw_orbiter(BITMAP *bmp, int x, int y, int attribute, int out1, int out2, int out3, int angle1, int angle2, int arms, int col1, int col2);
190 void make_ms_move(void);
191 int ms_colour(void);
192
193 void anum(char *str, int num);
194
195 BITMAP *menu_bmp;
196 extern volatile unsigned char ticked;
197 extern int slacktime;
198
199 extern FONT *font2;
200 extern FONT *small_font;
201
202 //BITMAP *title_in;
203 //BITMAP *title_out;
204 //RLE_SPRITE *rle_title_i;
205 RLE_SPRITE *rle_title_o;
206 RLE_SPRITE *menu_tile;
207 //RLE_SPRITE *rle_title_s;
208
209 BITMAP *upgrade_box1;
210 BITMAP *upgrade_box2;
211 BITMAP *upgrade_box3;
212
213 int menu_index;
214 int menu_index_max;
215 int menu_index_min;
216 int keypress_wait;
217 int last_key;
218 int check_key(int scode);
219 int check_key_disregard_last_key(int scode);
220 unsigned char menu_counter;
221
222 int which_menu;
223
224 void quit_game(void);
225
226 void change_menu(int to_which);
227 int option_index(void);
228 void enter_keystroke(void);
229 int option_jump(int direction);
230 int special_jump(int direction);
231 void init_config(void);
232 void save_config(void);
233
234 void choose_ships(void);
235 void display_ship_choice(int players, int p1a, int p2a, int p1c, int p2c);
236 void display_ship_choice2(int ship, int y, int chosen);
237
238 void jam_keys(void);
239
240 //char *ship_name_long(int ship);
241 //char *ship_name_short(int ship);
242 void ship_description1(int ship, char dstr [200]);
243 void ship_description2(int ship, char dstr [200]);
244 //char *upgrade_name_long(int i);
245
246 int get_rank(int score, int level);
247 void rank_name(int rank, char sstr [30]);
248
249 void init_ms(void);
250 void draw_ms(void);
251
252 extern RLE_SPRITE *large_ships [12] [5];
253
254 struct score_list
255 {
256 int score;
257 int ship;
258 int level;
259 char name [25];
260 };
261
262 struct score_list hs_single [NO_SCORES];
263 struct score_list hs_coop [NO_SCORES];
264
265 int best_ta_time;
266 char best_ta_name [50];
267
268 struct score_list *hscore;
269
270 void check_high_scores(void);
271 int enter_score_name_single(int s);
272 int enter_score_name_coop(int s);
273 int enter_score_name_ta(void);
274 void push_scores_single(int insert, int play);
275 void push_scores_coop(int insert, int play);
276 void congratulations(int player);
277 void unlock_screen(int which);
278
279 int entering_score;
280 int entering_score2;
281 void draw_scrolling_grid(int min_x, int min_y, int max_x, int max_y, int colour);
282 void show_grid(int grid_colour, int border_colour);
283 void make_grid_scroll(void);
284
285 int grid_x_speed, grid_y_speed, grid_x, grid_y, grid_x_accel, grid_y_accel;
286
287 struct bouncy_list
288 {
289 int x;
290 int y;
291 int x_speed;
292 int y_speed;
293 int colour1;
294 int colour2;
295 };
296
297
298 struct pyrostruct
299 {
300 int type;
301 int x;
302 int y;
303 int x_speed;
304 int y_speed;
305 int colours [4];
306 int timeout;
307 int size;
308 int dist;
309 };
310
311 struct sparklestruct
312 {
313 int type;
314 int x;
315 int y;
316 int x_speed;
317 int y_speed;
318 // int colours [4];
319 int size;
320 int tickrate;
321 int colour;
322 };
323
324 #define NO_PYROS 30
325 #define NO_SPARKLES 1000
326
327 enum
328 {
329 PYRO_NONE,
330 PYRO_ENDING,
331 PYRO_SPLIT1,
332 PYRO_SPLIT2,
333 PYRO_RANDSPLIT
334 };
335
336 enum
337 {
338 SPARKLE_NONE,
339 SPARKLE_CIRCLE
340 };
341
342 struct pyrostruct pyro [NO_PYROS];
343 struct sparklestruct sparkle [NO_SPARKLES];
344 int next_pyro;
345
346 void init_pyro(void);
347 void run_pyros(void);
348 void manage_pyros(void);
349 void create_pyro(int x, int y, int xs, int ys, int type, int colours [4], int size, int dist, int timeout);
350 void run_sparkles(void);
351 void draw_sparkles(void);
352 void create_sparkle(int x, int y, int xs, int ys, int type, int colour, int size, int tickrate);
353 void destroy_pyro(int p);
354 void destroy_sparkle(int s);
355 void drag_pyro(int p);
356 void drag_sparkle(int s);
357 void colourify(int col [4]);
358 void pyro_burst(int p);
359 void draw_a_light(BITMAP *bmp, int size, int x, int y); // in display.cc
360 void pyro_sound(int x, int size);
361
362
363 //struct bouncy_list bouncy [NO_BOUNCIES];
364
365 //void init_bouncies(void);
366 //void make_bouncies_move(void);
367 //void draw_bouncies(void);
368
369 //RGB title_colour1;
370 //RGB title_colour2;
371
372 void init_menus_once_only(void)
373 {
374 // text_mode(-1);
375 init_config();
376
377 menu_bmp = create_bitmap(640, 480);
378
379 if (!menu_bmp)
380 {
381 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
382 allegro_message("Unable to create menu bitmap! \n\r%s\n\r", allegro_error);
383 exit(1);
384 }
385
386 menu_counter = 0;
387 entering_score = 0;
388
389 grid_x_speed = grand(6001) - 3000;
390 grid_y_speed = grand(6001) - 3000;
391 grid_x_accel = 0;
392 grid_y_accel = 0;
393
394 RGB temp_palette [256];
395
396 /* BITMAP *temp_bmp = load_bitmap("gfx\\title_i.bmp", temp_palette);
397
398 if (!temp_bmp)
399 {
400 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
401 allegro_message("Unable to load title_i.bmp! \n\r%s\n\r", allegro_error);
402 exit(1);
403 }
404
405 rle_title_i = get_rle_sprite(temp_bmp);
406
407 if (!rle_title_i)
408 {
409 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
410 allegro_message("Unable to create rle_title_i! \n\r%s\n\r", allegro_error);
411 exit(1);
412 }
413
414 destroy_bitmap(temp_bmp);
415 */
416 BITMAP *temp_bmp = load_bitmap("gfx//gb_title.bmp", temp_palette);
417
418 if (!temp_bmp)
419 {
420 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
421 allegro_message("Unable to load gb_title.bmp! \n\r%s\n\r", allegro_error);
422 exit(1);
423 }
424
425 //#ifdef FIX_TITLE
426 // save_bitmap("gb_title2.bmp", temp_bmp, palet);
427 //#endif
428 int i, j;
429
430 for (i = 0; i < 1000; i ++)
431 {
432 for (j = 0; j < 1000; j ++)
433 {
434 switch(getpixel(temp_bmp, i, j))
435 {
436 case 0:
437 case 255: break; //putpixel(temp_bmp, i, j, 0);
438 case 160: putpixel(temp_bmp, i, j, COLOUR_GREY1); break;
439 default: putpixel(temp_bmp, i, j, COLOUR_GREY4); break;
440 }
441 }
442 }
443
444 rle_title_o = get_rle_sprite(temp_bmp);
445
446 if (!rle_title_o)
447 {
448 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
449 allegro_message("Unable to create rle_title_o! \n\r%s\n\r", allegro_error);
450 exit(1);
451 }
452
453 destroy_bitmap(temp_bmp);
454
455 /* temp_bmp = create_bitmap(50, 50);
456
457 clear_bitmap(temp_bmp);
458
459 circlefill(temp_bmp, 25, 25, 8, COLOUR_GREEN3);
460
461 menu_tile = get_rle_sprite(temp_bmp);
462
463 destroy_bitmap(temp_bmp);*/
464
465 /*
466 temp_bmp = load_bitmap("gfx//title_s.bmp", temp_palette);
467
468 if (!temp_bmp)
469 {
470 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
471 allegro_message("Unable to load title_s.bmp! \n\r%s\n\r", allegro_error);
472 exit(1);
473 }
474
475 rle_title_s = get_rle_sprite(temp_bmp);
476
477 if (!rle_title_s)
478 {
479 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
480 allegro_message("Unable to create rle_title_s! \n\r%s\n\r", allegro_error);
481 exit(1);
482 }
483
484 destroy_bitmap(temp_bmp);
485 */
486 /* upgrade_box1 = load_bitmap("gfx//upg_box.bmp", temp_palette);
487
488 if (!upgrade_box1)
489 {
490 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
491 allegro_message("Unable to load upg_box.bmp! \n\r%s\n\r", allegro_error);
492 exit(1);
493 }
494
495 upgrade_box2 = load_bitmap("gfx//upg_box2.bmp", temp_palette);
496
497 if (!upgrade_box2)
498 {
499 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
500 allegro_message("Unable to load upg_box2.bmp! \n\r%s\n\r", allegro_error);
501 exit(1);
502 }
503
504 upgrade_box3 = load_bitmap("gfx//upg_box3.bmp", temp_palette);
505
506 if (!upgrade_box3)
507 {
508 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
509 allegro_message("Unable to load upg_box3.bmp! \n\r%s\n\r", allegro_error);
510 exit(1);
511 }
512 */
513 last_key = NO_KEY; // something meaningless
514
515 game.duel_mode = 0;
516 game.duel_handicap [0] = 1;
517 game.duel_handicap [1] = 1;
518 game.duel_leader_handicap = 0;
519 game.duel_crawlies = 1;
520
521 }
522
523 void menu_loop(void)
524 {
525
526 which_menu = MENU_MAIN;
527 menu_index_max = 4;
528 menu_index_min = 0;
529 keypress_wait = KP_WAIT_LONG;
530 game.type = GAME_SINGLE;
531
532 do
533 {
534 // grand(100);
535 menu_counter++;
536 // srand(menu_counter);
537
538 set_config_int("Misc", "Seed", grand(10000));
539
540 if (check_key_disregard_last_key(last_key) == 0)
541 keypress_wait = 0;
542
543 if (keypress_wait > 0)
544 {
545 keypress_wait --;
546 }
547
548 make_grid_scroll();
549 // if (which_menu == MENU_MAIN || which_menu == MENU_SCORES || which_menu == MENU_ENTER_SCORES)
550 if (which_menu == MENU_SCORES || which_menu == MENU_ENTER_SCORES)
551 make_ms_move();
552
553 if (ticked == 0)
554 {
555 clear_bitmap(menu_bmp);
556 menu_display();
557 menu_to_screen();
558 }
559
560 menu_input();
561
562 slacktime = 0;
563 do
564 {
565 slacktime ++;
566 } while(ticked == 0);
567 ticked --;
568
569 } while(TRUE);
570
571
572 }
573
574
575 void menu_display(void)
576 {
577 // text_mode(-1);
578
579 switch(which_menu)
580 {
581 case MENU_MAIN:
582 menu_display_main();
583 break;
584 case MENU_OPTIONS:
585 menu_display_main();
586 menu_display_options();
587 break;
588 case MENU_SPECIAL:
589 menu_display_main();
590 menu_display_special();
591 break;
592 case MENU_DUEL:
593 menu_display_main();
594 menu_display_duel();
595 break;
596 case MENU_SCORES:
597 menu_display_scores();
598 break;
599 case MENU_ENTER_SCORES:
600 menu_display_scores();
601 break;
602 }
603
604 }
605
606
607 void menu_display_main(void)
608 {
609
610 // text_mode(-1);
611
612 // vsync();
613
614 // RGB title_colour [1];
615 static RGB title_colour [1] = {{16,16,16}};
616 /*
617 int mcn = menu_counter * 2;
618 int mcn2 = menu_counter;// / 2;
619 int mcn3 = menu_counter / 2;
620
621 if (mcn % 64 < 32)
622 {
623 title_colour[0].r = mcn % 64;
624 }
625 else
626 {
627 title_colour[0].r = 63 - (mcn % 64);
628 }
629
630 if (mcn2 % 64 < 32)
631 {
632 title_colour[0].g = (63 - mcn2 % 64) / 4;
633 }
634 else
635 {
636 title_colour[0].g = (mcn2 % 64) / 4;
637 }
638
639 if (mcn3 % 64 < 32)
640 {
641 title_colour[0].b = ((mcn3 + 32) % 64);// / 2;
642 }
643 else
644 {
645 title_colour[0].b = (63 - ((mcn3 + 32) % 64));// / 2;
646 }
647
648
649
650 set_color(252, title_colour);*/
651 /*
652 mcn = menu_counter * 2;
653 mcn2 = menu_counter;// / 2;
654 mcn3 = menu_counter / 2;
655
656 if (mcn % 64 >= 32)
657 {
658 title_colour[0].b = (mcn + 32) % 64;
659 }
660 else
661 {
662 title_colour[0].b = 63 - ((mcn + 32) % 64);
663 }
664
665 if (mcn2 % 64 >= 32)
666 {
667 title_colour[0].g = (63 - mcn2 % 64);// / 2;
668 }
669 else
670 {
671 title_colour[0].g = (mcn2 % 64);// / 2;
672 }
673
674 if (mcn3 % 64 >= 32)
675 {
676 title_colour[0].r = mcn3 % 64;
677 }
678 else
679 {
680 title_colour[0].r = 63 - (mcn3 % 64);
681 }
682 */
683
684 static RGB change [1] = {{1, 0, 0}};
685
686
687 // if (title_colour [1].r >= 60 || title_colour [1].r <= 5
688 // ||
689 /*
690 if (title_colour [0].r >= 60)
691 change[0].r = -1 - grand(5);
692 if (title_colour [0].g >= 60)
693 change[0].g = -1 - grand(5);
694 if (title_colour [0].b >= 60)
695 change[0].b = -1 - grand(5);
696
697 if (title_colour [0].r <= 10)
698 change[0].r = 1 + grand(5);
699 if (title_colour [0].g <= 10)
700 change[0].g = 1 + grand(5);
701 if (title_colour [0].b <= 10)
702 change[0].b = 1 + grand(5);
703
704 title_colour [0].r += change [0].r;
705 title_colour [0].g += change [0].g;
706 title_colour [0].b += change [0].b;
707
708 if (title_colour [0].r > 63)
709 title_colour [0].r = 63;
710 if (title_colour [0].g > 63)
711 title_colour [0].g = 63;
712 if (title_colour [0].b > 63)
713 title_colour [0].b = 63;
714 */
715 /*
716 if (title_colour [0].r >= 60)
717 {
718 change[0].r = -1 - grand(5);
719 change[0].g *= -1;
720 change[0].b *= -1;
721 }
722 if (title_colour [0].g >= 60)
723 {
724 change[0].r *= -1;
725 change[0].g = -1 - grand(5);
726 change[0].b *= -1;
727 }
728 if (title_colour [0].b >= 60)
729 {
730 change[0].r *= -1;
731 change[0].g *= -1;
732 change[0].b = -1 - grand(5);
733 }
734
735 if (title_colour [0].r <= 10)
736 {
737 change[0].r = 1 + grand(5);
738 change[0].g *= -1;
739 change[0].b *= -1;
740 }
741 if (title_colour [0].g <= 10)
742 {
743 change[0].r *= -1;
744 change[0].g = 1 + grand(5);
745 change[0].b *= -1;
746 }
747 if (title_colour [0].b <= 10)
748 {
749 change[0].r *= -1;
750 change[0].g *= -1;
751 change[0].b = 1 + grand(5);
752 }
753
754 title_colour [0].r += change [0].r;
755 title_colour [0].g += change [0].g;
756 title_colour [0].b += change [0].b;
757 */
758
759 if (menu_counter % 2 == 0)
760 {
761
762 if (title_colour [0].r >= 55
763 || title_colour [0].g >= 55
764 || title_colour [0].b >= 55)
765 {
766 change [0].r = abs(change[0].r) * -1;
767 change [0].g = abs(change[0].g) * -1;
768 change [0].b = abs(change[0].b) * -1;
769 if (grand(5) == 0)
770 {
771 change[0].r = grand(3) * -1;
772 change[0].g = grand(3) * -1;
773 change[0].b = grand(3) * -1;
774 }
775 // change [0].r *= -1;
776 // change [0].g *= -1;
777 // change [0].b *= -1;
778 }
779
780 if (title_colour [0].r <= 10
781 || title_colour [0].g <= 10
782 || title_colour [0].b <= 10)
783 {
784 if (title_colour [0].r <= 15
785 && title_colour [0].g <= 15
786 && title_colour [0].b <= 15)
787 {
788 change[0].r = 0;
789 change[0].g = 0;
790 change[0].b = 0;
791 }
792 if (grand(3) != 0)
793 {
794 change[0].r = grand(3);
795 change[0].g *= -1;
796 change[0].b *= -1;
797 }
798 else
799 {
800 if (grand(3) == 0)
801 {
802 change[0].r *= -1;
803 change[0].g = grand(3);
804 change[0].b *= -1;
805 }
806 else
807 {
808 if (grand(3) == 0)
809 {
810 change[0].r *= -1;
811 change[0].g *= -1;
812 change[0].b = grand(3);
813 }
814 }
815 }
816 if (change[0].r + change[0].g + change[0].b == 0)
817 change[0].r = 1;
818
819 }
820
821 title_colour [0].r += change [0].r;
822 title_colour [0].g += change [0].g;
823 title_colour [0].b += change [0].b;
824
825 if (title_colour [0].r > 55)
826 title_colour [0].r = 55;
827 if (title_colour [0].g > 55)
828 title_colour [0].g = 55;
829 if (title_colour [0].b > 55)
830 title_colour [0].b = 55;
831
832 }
833
834 set_color(255, title_colour);
835
836 /* int mcn = menu_counter;
837 int mcn2 = menu_counter / 2;
838 int mcn3 = menu_counter / 4;
839
840 if (mcn % 64 < 32)
841 {
842 title_colour[0].r = mcn % 64;
843 title_colour[0].g = (63 - mcn2 % 64) / 4;
844 title_colour[0].b = ((mcn3 + 32) % 64);// / 2;
845 }
846 else
847 {
848 title_colour[0].r = 63 - (mcn % 64);
849 title_colour[0].g = (mcn2 % 64) / 4;
850 title_colour[0].b = (63 - ((mcn3 + 32) % 64));// / 2;
851 }
852
853 set_color(252, title_colour);
854
855 mcn = menu_counter / 4;
856 mcn2 = menu_counter / 8;
857 mcn3 = menu_counter / 16;
858
859 if (mcn % 64 >= 32)
860 {
861 title_colour[0].r = mcn3 % 64;
862 title_colour[0].g = (63 - mcn2 % 64);// / 2;
863 title_colour[0].b = (mcn + 32) % 64;
864 }
865 else
866 {
867 title_colour[0].r = 63 - (mcn3 % 64);
868 title_colour[0].g = (mcn2 % 64);// / 2;
869 title_colour[0].b = 63 - ((mcn + 32) % 64);
870 }
871
872 set_color(255, title_colour);*/
873 // RGB title_colour1;
874 //RGB title_colour2;
875
876 /* rectfill(menu_bmp, 10, 10, 630, 470, COLOUR_GREY1);
877 rect(menu_bmp, 10, 10, 630, 470, COLOUR_GREEN4);
878 rect(menu_bmp, 9, 9, 631, 471, COLOUR_GREEN6);
879 rect(menu_bmp, 8, 8, 632, 472, COLOUR_GREEN8);
880
881 draw_scrolling_grid(11, 11, 629, 469, COLOUR_GREEN3);
882 */
883 show_grid(COLOUR_GREEN3, COLOUR_GREEN8);
884
885 // textprintf_centre_ex(menu_bmp, font, 300, 50, COLOUR_YELLOW8 - (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
886 // textprintf_centre_ex(menu_bmp, font2, 300, 50, COLOUR_RED1 + (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
887
888
889 // draw_rle_sprite(menu_bmp, rle_title_i, 30, 0);
890 draw_rle_sprite(menu_bmp, rle_title_o, 10, 105);
891 // draw_rle_sprite(menu_bmp, rle_title_s, 280, 173);
892
893 rectfill(menu_bmp, 340, 0, 346, 480, 255);
894 rectfill(menu_bmp, 0, 200, 15, 205, 255);
895 rectfill(menu_bmp, 640, 200, 615, 205, 255);
896
897 // int col1 = COLOUR_GREY3;
898 // int col2 = COLOUR_GREY5;
899 int scol1 = COLOUR_GREEN8 - (menu_counter / 3) % 3;
900 int scol2 = COLOUR_BLUE6 + (menu_counter / 3) % 3;
901
902 scol1 = 255;
903 scol2 = 255;
904
905 int mx = 340;
906 // int my = 212;
907 int my = 5;
908 int my2 = 200;
909 int mys = 55;
910
911 if (menu_index == 0 && which_menu == MENU_MAIN)
912 {
913 textprintf_right_ex(menu_bmp, font2, mx, my, scol1, -1, "{____start__game___");
914 textprintf_right_ex(menu_bmp, font, mx, my, -1, -1, "{____start__game___");
915 // textprintf_right_ex(menu_bmp, font2, 400, 120, COLOUR_WHITE, "Start} Game}");
916 // textprintf_right_ex(menu_bmp, font, 400, 120, COLOUR_WHITE, "Start} Game}");
917 }
918 else
919 textprintf_right_ex(menu_bmp, font, mx, my, -1, -1, "{____start__game___");
920
921 if (menu_index == 1 && which_menu == MENU_MAIN)
922 {
923 textprintf_right_ex(menu_bmp, font2, mx, my + mys, scol1, -1, "{____special___");
924 textprintf_right_ex(menu_bmp, font, mx, my + mys, -1, -1, "{____special___");
925 }
926 else
927 textprintf_right_ex(menu_bmp, font, mx, my + mys, -1, -1, "{____special___");
928
929 if (menu_index == 2 && which_menu == MENU_MAIN)
930 {
931 textprintf_right_ex(menu_bmp, font2, mx, my2 + mys * 2, scol1, -1, "{____options___");
932 textprintf_right_ex(menu_bmp, font, mx, my2 + mys * 2, -1, -1, "{____options___");
933 }
934 else
935 textprintf_right_ex(menu_bmp, font, mx, my2 + mys * 2, -1, -1, "{____options___");
936
937 if (menu_index == 3 && which_menu == MENU_MAIN)
938 {
939 textprintf_right_ex(menu_bmp, font2, mx, my2 + mys * 3, scol1, -1, "{____high__scores___");
940 textprintf_right_ex(menu_bmp, font, mx, my2 + mys * 3, -1, -1, "{____high__scores___");
941 }
942 else
943 textprintf_right_ex(menu_bmp, font, mx, my2 + mys * 3, -1, -1, "{____high__scores___");
944
945 if (menu_index == 4 && which_menu == MENU_MAIN)
946 {
947 textprintf_right_ex(menu_bmp, font2, mx, my2 + mys * 4, scol1, -1, "{____exit___");
948 textprintf_right_ex(menu_bmp, font, mx, my2 + mys * 4, -1, -1, "{____exit___");
949 }
950 else
951 textprintf_right_ex(menu_bmp, font, mx, my2 + mys * 4, -1, -1, "{____exit___");
952
953 /* textprintf_centre_ex(menu_bmp, font, 300, 300, COLOUR_YELLOW7, "Space} For} 1P} Enter} For} 2P}...");
954 textprintf_centre_ex(menu_bmp, font2, 300, 300, COLOUR_RED7, "Space} For} 1P} Enter} For} 2P}...");*/
955
956 }
957
958 void menu_display_options(void)
959 {
960
961 rectfill(menu_bmp, 180, 50, 440, 400, COLOUR_YELLOW1);
962 rect(menu_bmp, 180, 50, 440, 400, COLOUR_YELLOW6);
963 rect(menu_bmp, 179, 49, 441, 401, COLOUR_YELLOW7);
964 rect(menu_bmp, 178, 48, 442, 402, COLOUR_YELLOW8);
965
966 int i;
967
968 int ox = 350, oy = 11, oys = 75;
969 int col;
970
971 char ostr [50];
972 // char istr [10];
973 char sstr [30];
974
975 for (i = 0; i < 28; i ++)
976 {
977
978 col = COLOUR_GREEN4;
979
980 if (i == menu_index)
981 col = COLOUR_ORANGE8;
982
983 switch(i)
984 {
985 case 0:
986 col = COLOUR_GREY6;
987 strcpy(ostr, "General Options");
988 break;
989 case 1:
990 strcpy(ostr, "Sound - ");
991 if (options.sound_init == 0)
992 strcat(ostr, "Disabled in config file");
993 else
994 {
995 switch(options.sound_mode)
996 {
997 case SOUNDMODE_OFF:
998 strcat(ostr, "Off");
999 break;
1000 case SOUNDMODE_MONO:
1001 strcat(ostr, "On (Mono)");
1002 break;
1003 case SOUNDMODE_STEREO:
1004 strcat(ostr, "On (Stereo)");
1005 break;
1006 case SOUNDMODE_REVERSED:
1007 strcat(ostr, "On (Reverse Stereo)");
1008 break;
1009 default:
1010 strcat(ostr, "Buggy sound settings?");
1011 break;
1012 }
1013 }
1014 break;
1015 case 2:
1016 strcpy(ostr, "Sound Effects Volume - ");
1017 if (options.sound_volume == 0)
1018 {
1019 strcat(ostr, "Off");
1020 }
1021 else
1022 // strcat(ostr, itoa(options.sound_volume, istr, 10));
1023 anum(ostr, options.sound_volume);
1024 break;
1025 case 3:
1026 strcpy(ostr, "Ambience Volume - ");
1027 if (options.ambience_volume == 0)
1028 {
1029 strcat(ostr, "Off");
1030 }
1031 else
1032 // strcat(ostr, itoa(options.ambience_volume, istr, 10));
1033 anum(ostr, options.ambience_volume);
1034 break;
1035 case 4:
1036 strcpy(ostr, "Video Sync - ");
1037 if (options.run_vsync == 0)
1038 strcat(ostr, "Off");
1039 else
1040 strcat(ostr, "On");
1041 break;
1042 case 5:
1043 strcpy(ostr, "Test Speakers");
1044 break;
1045 case 6:
1046 strcpy(ostr, "Test Keys");
1047 break;
1048 case 7:
1049 strcpy(ostr, "Resolution - ");
1050 switch(options.resolution)
1051 {
1052 case 0:
1053 strcat(ostr, "640x480 full");
1054 break;
1055 case 1:
1056 strcat(ostr, "800x600 full");
1057 break;
1058 case 2:
1059 strcat(ostr, "640x480 window");
1060 break;
1061 case 3:
1062 strcat(ostr, "800x600 window");
1063 break;
1064 }
1065 break;
1066 case 8:
1067 strcpy(ostr, "Colour Text - ");
1068 if (options.colour_text == 0)
1069 strcat(ostr, "Off");
1070 else
1071 strcat(ostr, "On");
1072 break;
1073 case 9:
1074 strcpy(ostr, "");
1075 break;
1076 case 10:
1077 col = COLOUR_GREY6;
1078 strcpy(ostr, "Player 1 Keys");
1079 break;
1080 case 11:
1081 strcpy(ostr, "Forwards - ");
1082 scancode_to_keyname(player[0].keys [CMD_THRUST], sstr);
1083 strcat(ostr, sstr);
1084 break;
1085 case 12:
1086 strcpy(ostr, "Left - ");
1087 scancode_to_keyname(player[0].keys [CMD_LEFT], sstr);
1088 strcat(ostr, sstr);
1089 break;
1090 case 13:
1091 strcpy(ostr, "Right - ");
1092 scancode_to_keyname(player[0].keys [CMD_RIGHT], sstr);
1093 strcat(ostr, sstr);
1094 break;
1095 case 14:
1096 strcpy(ostr, "Brake - ");
1097 scancode_to_keyname(player[0].keys [CMD_BRAKE], sstr);
1098 strcat(ostr, sstr);
1099 break;
1100 case 15:
1101 strcpy(ostr, "Fire Darts - ");
1102 scancode_to_keyname(player[0].keys [CMD_FIRE1], sstr);
1103 strcat(ostr, sstr);
1104 break;
1105 case 16:
1106 strcpy(ostr, "Fire Secondary - ");
1107 scancode_to_keyname(player[0].keys [CMD_FIRE2], sstr);
1108 strcat(ostr, sstr);
1109 break;
1110 /* case 15:
1111 strcpy(ostr, "Upgrade - ");
1112 strcat(ostr, scancode_to_keyname(player[0].keys [CMD_UPGRADE]));
1113 break;
1114 case 16:
1115 strcpy(ostr, "Slide Left - ");
1116 strcat(ostr, scancode_to_keyname(player[0].keys [CMD_LEFT1]));
1117 break;
1118 case 17:
1119 strcpy(ostr, "Slide Right - ");
1120 strcat(ostr, scancode_to_keyname(player[0].keys [CMD_RIGHT1]));
1121 break;*/
1122 case 17:
1123 strcpy(ostr, "Toggle Linked Fire - ");
1124 scancode_to_keyname(player[0].keys [CMD_LINK], sstr);
1125 strcat(ostr, sstr);
1126 break;
1127 case 18:
1128 col = COLOUR_GREY6;
1129 strcpy(ostr, "Player 2 Keys");
1130 break;
1131 case 19:
1132 strcpy(ostr, "Forwards - ");
1133 scancode_to_keyname(player[1].keys [CMD_THRUST], sstr);
1134 strcat(ostr, sstr);
1135 break;
1136 case 20:
1137 strcpy(ostr, "Left - ");
1138 scancode_to_keyname(player[1].keys [CMD_LEFT], sstr);
1139 strcat(ostr, sstr);
1140 break;
1141 case 21:
1142 strcpy(ostr, "Right - ");
1143 scancode_to_keyname(player[1].keys [CMD_RIGHT], sstr);
1144 strcat(ostr, sstr);
1145 break;
1146 case 22:
1147 strcpy(ostr, "Brake - ");
1148 scancode_to_keyname(player[1].keys [CMD_BRAKE], sstr);
1149 strcat(ostr, sstr);
1150 break;
1151 case 23:
1152 strcpy(ostr, "Fire Darts - ");
1153 scancode_to_keyname(player[1].keys [CMD_FIRE1], sstr);
1154 strcat(ostr, sstr);
1155 break;
1156 case 24:
1157 strcpy(ostr, "Fire Secondary - ");
1158 scancode_to_keyname(player[1].keys [CMD_FIRE2], sstr);
1159 strcat(ostr, sstr);
1160 break;
1161 /* case 23:
1162 strcpy(ostr, "Upgrade - ");
1163 strcat(ostr, scancode_to_keyname(player[1].keys [CMD_UPGRADE]));
1164 break;
1165 case 27:
1166 strcpy(ostr, "Slide Left - ");
1167 strcat(ostr, scancode_to_keyname(player[1].keys [CMD_LEFT1]));
1168 break;
1169 case 28:
1170 strcpy(ostr, "Slide Right - ");
1171 strcat(ostr, scancode_to_keyname(player[1].keys [CMD_RIGHT1]));
1172 break;*/
1173 case 25:
1174 strcpy(ostr, "Toggle Linked Fire - ");
1175 scancode_to_keyname(player[1].keys [CMD_LINK], sstr);
1176 strcat(ostr, sstr);
1177 break;
1178 case 26:
1179 strcpy(ostr, "");
1180 // strcat(ostr, scancode_to_keyname(player[1].keys [CMD_LINK])
1181 break;
1182 case 27:
1183 strcpy(ostr, "Exit");
1184 break;
1185
1186 }
1187
1188 textprintf_right_ex(menu_bmp, small_font, ox, oys + oy * i, col, -1, ostr);
1189
1190 }
1191
1192 /*
1193 textprintf_centre_ex(menu_bmp, font, 300, 200, COLOUR_YELLOW8 - (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
1194 textprintf_centre_ex(menu_bmp, font2, 300, 200, COLOUR_RED1 + (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
1195 textprintf_centre_ex(menu_bmp, font, 300, 300, COLOUR_YELLOW7, "Space} For} 1P} Enter} For} 2P}...");
1196 textprintf_centre_ex(menu_bmp, font2, 300, 300, COLOUR_RED7, "Space} For} 1P} Enter} For} 2P}...");
1197 */
1198 }
1199
1200 int special_jump(int direction)
1201 {
1202
1203 if (which_menu != MENU_SPECIAL)
1204 return 0;
1205
1206 switch(menu_index)// + direction)
1207 {
1208 // case 5:
1209 // case 6:
1210 case SPECIAL_MODES:
1211 case SPECIAL_SPACE1:
1212 case SPECIAL_SPACE2:
1213 return 1;
1214 case SPECIAL_PURPLE:
1215 if (options.unlock_purple != UNLOCK_PURPLE)
1216 return 1;
1217 return 0;
1218 case SPECIAL_VOID:
1219 if (options.unlock_void != UNLOCK_VOID)
1220 return 1;
1221 return 0;
1222 case SPECIAL_GOD:
1223 if (options.unlock_god != UNLOCK_GOD)
1224 return 1;
1225 return 0;
1226
1227 }
1228
1229 return 0;
1230
1231 }
1232
1233
1234 int option_jump(int direction)
1235 {
1236
1237 if (which_menu == MENU_SPECIAL)
1238 return special_jump(direction);
1239
1240 if (which_menu != MENU_OPTIONS)
1241 return 0;
1242
1243 switch(menu_index)// + direction)
1244 {
1245 // case 5:
1246 // case 6:
1247 case 9:
1248 case 10:
1249 case 18:
1250 case 26:
1251 return 1;
1252 }
1253
1254 return 0;
1255
1256 }
1257
1258
1259
1260 void menu_display_duel(void)
1261 {
1262
1263 rectfill(menu_bmp, 180, 50, 440, 400, COLOUR_GREEN1);
1264 rect(menu_bmp, 180, 50, 440, 400, COLOUR_GREEN6);
1265 rect(menu_bmp, 179, 49, 441, 401, COLOUR_GREEN7);
1266 rect(menu_bmp, 178, 48, 442, 402, COLOUR_GREEN8);
1267
1268
1269 textprintf_centre_ex(menu_bmp, font2, 320, 90, COLOUR_RED8 - (menu_counter / 4) % 4, -1, "{_duel_}");
1270 textprintf_centre_ex(menu_bmp, font, 320, 90, -1, -1, "{_duel_}");
1271 // textprintf_centre_ex(menu_bmp, font, 320, 110, COLOUR_ORANGE8, "K_e_y_s}");
1272 // textprintf_centre_ex(menu_bmp, font2, 320, 110, COLOUR_YELLOW8, "K_e_y_s}");
1273
1274
1275 int i;
1276
1277 int ox = 320, oy = 11, oys = 200;
1278 int col;
1279
1280 char ostr [50];
1281
1282 for (i = 0; i < DUEL_END; i ++)
1283 {
1284
1285 col = COLOUR_GREEN6;
1286
1287 if (i == menu_index)
1288 col = COLOUR_YELLOW8;
1289
1290 switch(i)
1291 {
1292 case DUEL_OPTIONS:
1293 col = COLOUR_GREY6;
1294 strcpy(ostr, "Duel Options - Space or Enter to select");
1295 break;
1296 case DUEL_MODE:
1297 strcpy(ostr, "Victory goes to the ");
1298 switch(game.duel_mode)
1299 {
1300 case DUEL_3_MINUTES:
1301 strcat(ostr, "winner after 3 minutes");
1302 break;
1303 case DUEL_10_MINUTES:
1304 strcat(ostr, "winner after 10 minutes");
1305 break;
1306 case DUEL_10_POINTS:
1307 strcat(ostr, "first to 10 points");
1308 break;
1309 case DUEL_30_POINTS:
1310 strcat(ostr, "first to 30 points");
1311 break;
1312 }
1313 break;
1314 case DUEL_ENEMIES:
1315 strcpy(ostr, "Enemies - ");
1316 switch(game.duel_crawlies)
1317 {
1318 case 0:
1319 strcat(ostr, "None");
1320 break;
1321 case 1:
1322 strcat(ostr, "A few");
1323 break;
1324 case 2:
1325 strcat(ostr, "Plentiful");
1326 break;
1327 case 3:
1328 strcat(ostr, "Swarming");
1329 break;
1330 }
1331 break;
1332 case DUEL_LEADER_HANDICAP:
1333 strcpy(ostr, "Leader Handicap - ");
1334 switch(game.duel_leader_handicap)
1335 {
1336 case 0:
1337 strcat(ostr, "None");
1338 break;
1339 case 1:
1340 strcat(ostr, "A little");
1341 break;
1342 case 2:
1343 strcat(ostr, "A lot");
1344 break;
1345 }
1346 break;
1347 case DUEL_HANDICAP_P1:
1348 strcpy(ostr, "Player 1 Hull - ");
1349 switch(game.duel_handicap [0])
1350 {
1351 case 0:
1352 strcat(ostr, "75%%");
1353 break;
1354 case 1:
1355 strcat(ostr, "100%%");
1356 break;
1357 case 2:
1358 strcat(ostr, "120%%");
1359 break;
1360 case 3:
1361 strcat(ostr, "150%%");
1362 break;
1363 }
1364 break;
1365 case DUEL_HANDICAP_P2:
1366 strcpy(ostr, "Player 2 Hull - ");
1367 switch(game.duel_handicap [1])
1368 {
1369 case 0:
1370 strcat(ostr, "75%%");
1371 break;
1372 case 1:
1373 strcat(ostr, "100%%");
1374 break;
1375 case 2:
1376 strcat(ostr, "120%%");
1377 break;
1378 case 3:
1379 strcat(ostr, "150%%");
1380 break;
1381 }
1382 break;
1383 case DUEL_START:
1384 strcpy(ostr, "Start Duel");
1385 break;
1386 case DUEL_EXIT:
1387 strcpy(ostr, "Exit");
1388 break;
1389
1390 }
1391
1392 textprintf_centre_ex(menu_bmp, small_font, ox, oys + oy * i, col, -1, ostr);
1393
1394 }
1395
1396 /*
1397 textprintf_centre_ex(menu_bmp, font, 300, 200, COLOUR_YELLOW8 - (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
1398 textprintf_centre_ex(menu_bmp, font2, 300, 200, COLOUR_RED1 + (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
1399 textprintf_centre_ex(menu_bmp, font, 300, 300, COLOUR_YELLOW7, "Space} For} 1P} Enter} For} 2P}...");
1400 textprintf_centre_ex(menu_bmp, font2, 300, 300, COLOUR_RED7, "Space} For} 1P} Enter} For} 2P}...");
1401 */
1402 }
1403
1404 void menu_display_special(void)
1405 {
1406
1407 rectfill(menu_bmp, 180, 50, 440, 400, COLOUR_BLUE1);
1408 rect(menu_bmp, 180, 50, 440, 400, COLOUR_BLUE6);
1409 rect(menu_bmp, 179, 49, 441, 401, COLOUR_BLUE7);
1410 rect(menu_bmp, 178, 48, 442, 402, COLOUR_BLUE8);
1411
1412
1413 textprintf_centre_ex(menu_bmp, font2, 320, 90, COLOUR_YELLOW8 - (menu_counter / 4) % 4, -1, "{_special_}");
1414 textprintf_centre_ex(menu_bmp, font, 320, 90, -1, -1, "{_special_}");
1415
1416
1417 int i;
1418
1419 int ox = 320, oy = 11, oys = 200;
1420 int col;
1421
1422 char ostr [50];
1423
1424 for (i = 0; i < SPECIAL_END; i ++)
1425 {
1426
1427 col = COLOUR_GREY5;
1428
1429 if (i == menu_index)
1430 col = COLOUR_RED8;
1431
1432 switch(i)
1433 {
1434 case SPECIAL_TIME_ATTACK:
1435 strcpy(ostr, "Start Time Attack");
1436 break;
1437 case SPECIAL_DUEL:
1438 strcpy(ostr, "Start 2-Player Duel");
1439 break;
1440 case SPECIAL_MODES:
1441 strcpy(ostr, "Special Modes");
1442 col = COLOUR_GREY4;
1443 break;
1444 case SPECIAL_PURPLE:
1445 if (options.unlock_purple != UNLOCK_PURPLE)
1446 {
1447 strcpy(ostr, "You haven't unlocked Purple Mode");
1448 col = COLOUR_GREY3;
1449 if (i == menu_index)
1450 col = COLOUR_RED6;
1451 break;
1452 }
1453 strcpy(ostr, "Purple Mode - ");
1454 switch(game.mode_purple)
1455 {
1456 case 0:
1457 strcat(ostr, "Off");
1458 break;
1459 case 1:
1460 strcat(ostr, "On!");
1461 col = TRANS_PURPLE;
1462 if (i == menu_index)
1463 col = COLOUR_BLUE8;
1464 break;
1465 }
1466 break;
1467 case SPECIAL_VOID:
1468 if (options.unlock_void != UNLOCK_VOID)
1469 {
1470 strcpy(ostr, "You haven't unlocked Night Mode");
1471 col = COLOUR_GREY3;
1472 if (i == menu_index)
1473 col = COLOUR_RED6;
1474 break;
1475 }
1476 strcpy(ostr, "Night Mode - "); // renamed after I added the palette effect - before it just made the background GC_GREY1 and disabled the scanner
1477 switch(game.mode_void)
1478 {
1479 case 0:
1480 strcat(ostr, "Off");
1481 break;
1482 case 1:
1483 strcat(ostr, "On!");
1484 if (i == menu_index)
1485 col = COLOUR_RED6;
1486 break;
1487 }
1488 break;
1489 case SPECIAL_GOD:
1490 if (options.unlock_god != UNLOCK_GOD)
1491 {
1492 strcpy(ostr, "You haven't unlocked God Mode");
1493 col = COLOUR_GREY3;
1494 if (i == menu_index)
1495 col = COLOUR_RED6;
1496 break;
1497 }
1498 strcpy(ostr, "God Mode - ");
1499 switch(game.mode_god)
1500 {
1501 case 0:
1502 strcat(ostr, "Off");
1503 break;
1504 case 1:
1505 strcat(ostr, "On!");
1506 if (i == menu_index)
1507 col = COLOUR_RED8;
1508 break;
1509 }
1510 break;
1511 case SPECIAL_SPACE1:
1512 case SPECIAL_SPACE2:
1513 strcpy(ostr, "");
1514 break;
1515 case SPECIAL_EXIT:
1516 strcpy(ostr, "Exit");
1517 break;
1518 }
1519 textprintf_centre_ex(menu_bmp, small_font, ox, oys + oy * i, col, -1, ostr);
1520
1521 }
1522
1523 }
1524
1525
1526 int check_key(int scode)
1527 {
1528 if (keypress_wait == 0)
1529 last_key = NO_KEY;
1530
1531 if (last_key == scode)
1532 {
1533 if (key [scode])
1534 return 0;
1535 else
1536 last_key = NO_KEY;
1537 }
1538
1539 if (key [scode])
1540 {
1541 last_key = scode;
1542 return 1;
1543 }
1544 return 0;
1545 }
1546
1547 int check_key_disregard_last_key(int scode)
1548 {
1549 if (key [scode])
1550 return 1;
1551
1552 return 0;
1553 }
1554
1555
1556
1557
1558
1559
1560 void menu_input(void)
1561 {
1562
1563 clear_keybuf();
1564
1565 if (keypress_wait > 0)
1566 return;
1567
1568 if (which_menu == MENU_ENTER_SCORES)
1569 {
1570 int done = 0;
1571
1572 if (check_key(KEY_ESC))
1573 {
1574 save_config();
1575 change_menu(MENU_SCORES);
1576 // last_key = KEY_ESC;
1577 // menu_sound2();
1578 menu_sound2();
1579 return;
1580 }
1581
1582 if (game.type == GAME_SINGLE)
1583 done = enter_score_name_single(entering_score);//hs_single[entering_score].name);
1584 if (game.type == GAME_COOP)
1585 done = enter_score_name_coop(entering_score);//hs_coop[entering_score].name);
1586 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
1587 done = enter_score_name_ta();
1588
1589 if (done == 1)
1590 {
1591 save_config();
1592 change_menu(MENU_SCORES);
1593 }
1594 return;
1595 }
1596
1597
1598 if (check_key(KEY_2_PAD) || check_key(KEY_DOWN))
1599 {
1600 do
1601 {
1602 if (menu_index < menu_index_max)
1603 menu_index ++;
1604 else
1605 menu_index = menu_index_min;
1606 } while (option_jump(1) == 1);
1607 keypress_wait = KP_WAIT_SHORT;
1608 menu_sound1();
1609 // menu_sound1();
1610 }
1611
1612 if (check_key(KEY_8_PAD) || check_key(KEY_UP))
1613 {
1614 do
1615 {
1616 if (menu_index > menu_index_min)
1617 menu_index --;
1618 else
1619 menu_index = menu_index_max;
1620 } while (option_jump(-1) == 1);
1621 keypress_wait = KP_WAIT_SHORT;
1622 menu_sound1();
1623 // menu_sound1();
1624 }
1625
1626 if (check_key(KEY_ESC))
1627 {
1628 switch(which_menu)
1629 {
1630 case MENU_MAIN:
1631 if (keypress_wait == 0 && last_key != KEY_ESC)
1632 {
1633 menu_sound2();
1634 quit_game();
1635 }
1636 break;
1637 case MENU_DUEL:
1638 case MENU_OPTIONS:
1639 case MENU_SPECIAL:
1640 change_menu(MENU_MAIN);
1641 keypress_wait = KP_WAIT_LONG;
1642 menu_sound2();
1643 break;
1644 case MENU_SCORES:
1645 change_menu(MENU_MAIN);
1646 keypress_wait = KP_WAIT_LONG;
1647 menu_sound2();
1648 break;
1649 }
1650 }
1651
1652 // this has to be after the key_esc thing or pressing escape in some
1653 // sub-menus will trigger it, as key_waiting won't be checked after
1654 // the submenus return the menu_trigger call.
1655 // if (key [KEY_ENTER] || key [KEY_ENTER_PAD] || key [KEY_SPACE])
1656 //if (check_key(KEY_ENTER) || check_key(KEY_ENTER_PAD) || check_key(KEY_SPACE))
1657 if (check_key(KEY_ENTER) || check_key(KEY_SPACE))
1658 {
1659 menu_trigger();
1660 }
1661
1662
1663 }
1664
1665
1666 void menu_trigger(void)
1667 {
1668
1669 keypress_wait = KP_WAIT_LONG;
1670
1671 switch(which_menu)
1672 {
1673 case MENU_MAIN:
1674 switch(menu_index)
1675 {
1676 case 0:
1677 menu_sound2();
1678 choose_ships();
1679 // start_game_from_menu(GAME_SINGLE);
1680 // if it's going to be coop, this is set after each player has had a chance to join
1681 break;
1682 // case 1:
1683 // start_game_from_menu(GAME_COOP);
1684 // break;
1685 case 1:
1686 change_menu(MENU_SPECIAL);
1687 menu_sound2();
1688 // display_victory_screen();
1689 break;
1690 case 2:
1691 change_menu(MENU_OPTIONS);
1692 menu_sound2();
1693 break;
1694 case 3:
1695 change_menu(MENU_SCORES);
1696 menu_sound2();
1697 // high_score_list();
1698 break;
1699 case 4:
1700 menu_sound2();
1701 quit_game();
1702 break;
1703 }
1704 break;
1705 case MENU_OPTIONS:
1706 if (menu_index == 27)
1707 {
1708 menu_sound2();
1709 change_menu(MENU_MAIN);
1710 break;
1711 }
1712 if (menu_index < 10)
1713 {
1714 switch(menu_index)
1715 {
1716 case 1:
1717 if (options.sound_mode == SOUNDMODE_REVERSED)
1718 options.sound_mode = SOUNDMODE_OFF;
1719 else
1720 options.sound_mode++;
1721 menu_sound1();
1722 return;
1723 case 2:
1724 if (options.sound_volume >= 100)
1725 options.sound_volume = 0;
1726 else
1727 options.sound_volume += 20;
1728 menu_sound1();
1729 return;
1730 case 3:
1731 if (options.ambience_volume >= 100)
1732 options.ambience_volume = 0;
1733 else
1734 options.ambience_volume += 20;
1735 menu_sound1();
1736 return;
1737 case 4:
1738 if (options.run_vsync == 1)
1739 options.run_vsync = 0;
1740 else
1741 options.run_vsync = 1;
1742 menu_sound1();
1743 return;
1744 case 5:
1745 test_speakers();
1746 ticked = 0;
1747 // test speakers
1748 return;
1749 case 6:
1750 menu_sound2();
1751 jam_keys();
1752 return;
1753 case 7:
1754 if (options.resolution == 3)
1755 options.resolution = 0;
1756 else
1757 options.resolution ++;
1758 /* if (options.resolution == GMODE_800_600)
1759 options.resolution = GMODE_640_480;
1760 else
1761 options.resolution = GMODE_800_600;*/
1762 resolution_change();
1763 menu_sound1();
1764 break;
1765 case 8:
1766 if (options.colour_text == 1)
1767 options.colour_text = 0;
1768 else
1769 options.colour_text = 1;
1770 menu_sound1();
1771 return;
1772
1773 }
1774 }
1775 if (option_index() != -1)
1776 {
1777 menu_sound2();
1778 enter_keystroke();
1779 menu_sound2();
1780 }
1781 break;
1782 case MENU_SCORES:
1783 menu_sound2();
1784 change_menu(MENU_MAIN);
1785 break;
1786 case MENU_ENTER_SCORES:
1787 menu_sound2();
1788 change_menu(MENU_MAIN);
1789 break; // return from this through enter_scores (or whatever)
1790 case MENU_SPECIAL:
1791 switch(menu_index)
1792 {
1793 case SPECIAL_DUEL:
1794 menu_sound2();
1795 change_menu(MENU_DUEL);
1796 break;
1797 case SPECIAL_TIME_ATTACK:
1798 game.type = GAME_TIME_ATTACK;
1799 menu_sound2();
1800 choose_ships();
1801 break;
1802 case SPECIAL_EXIT:
1803 menu_sound2();
1804 change_menu(MENU_MAIN);
1805 break;
1806 case SPECIAL_PURPLE:
1807 if (options.unlock_purple == 0)
1808 break;
1809 if (game.mode_purple == 0)
1810 game.mode_purple = 1;
1811 else
1812 game.mode_purple = 0;
1813 menu_sound2();
1814 break;
1815 case SPECIAL_VOID:
1816 if (options.unlock_void == 0)
1817 break;
1818 if (game.mode_void == 0)
1819 {
1820 game.mode_void = 1;
1821 set_dark_palette();
1822 }
1823 else
1824 {
1825 game.mode_void = 0;
1826 set_light_palette();
1827 }
1828 menu_sound2();
1829 break;
1830 case SPECIAL_GOD:
1831 if (options.unlock_god == 0)
1832 break;
1833 if (game.mode_god == 0)
1834 game.mode_god = 1;
1835 else
1836 game.mode_god = 0;
1837 menu_sound2();
1838 break;
1839 }
1840 break;
1841 case MENU_DUEL:
1842 switch(menu_index)
1843 {
1844 case DUEL_START:
1845 game.type = GAME_DUEL;
1846 menu_sound2();
1847 choose_ships();
1848 break;
1849 case DUEL_ENEMIES:
1850 if (game.duel_crawlies < 3)
1851 game.duel_crawlies ++;
1852 else
1853 game.duel_crawlies = 0;
1854 menu_sound2();
1855 break;
1856 case DUEL_MODE:
1857 if (game.duel_mode < 3)
1858 game.duel_mode ++;
1859 else
1860 game.duel_mode = 0;
1861 menu_sound2();
1862 break;
1863 case DUEL_LEADER_HANDICAP:
1864 if (game.duel_leader_handicap < 2)
1865 game.duel_leader_handicap ++;
1866 else
1867 game.duel_leader_handicap = 0;
1868 menu_sound2();
1869 break;
1870 case DUEL_HANDICAP_P1:
1871 if (game.duel_handicap [0] < 3)
1872 game.duel_handicap [0] ++;
1873 else
1874 game.duel_handicap [0] = 0;
1875 menu_sound2();
1876 break;
1877 case DUEL_HANDICAP_P2:
1878 if (game.duel_handicap [1] < 3)
1879 game.duel_handicap [1] ++;
1880 else
1881 game.duel_handicap [1] = 0;
1882 menu_sound2();
1883 break;
1884 case DUEL_EXIT:
1885 change_menu(MENU_MAIN);
1886 menu_sound2();
1887 break;
1888 }
1889 break;
1890
1891 }
1892
1893 }
1894
1895
1896 void enter_keystroke(void)
1897 {
1898 rectfill(screen, 400, 210, 550, 280, COLOUR_GREY2);
1899 rect(screen, 400, 210, 550, 280, COLOUR_GREY6);
1900 rect(screen, 401, 211, 549, 279, COLOUR_GREY5);
1901 rect(screen, 402, 212, 548, 278, COLOUR_GREY4);
1902 rect(screen, 403, 213, 547, 277, COLOUR_GREY3);
1903 textprintf_right_ex(screen, small_font, 500, 240, COLOUR_WHITE, -1, "Press a key...");
1904
1905 clear_keybuf();
1906 int inputted = KEY_ESC;
1907
1908 int i;
1909
1910 rest(200); // to clear the enter or space key
1911
1912 do
1913 {
1914 for (i = KEY_A; i < KEY_CAPSLOCK + 1; i ++)
1915 {
1916 if (check_key(i))
1917 {
1918 inputted = i;
1919 }
1920 }
1921 }
1922 while(acceptable_char(inputted) == 0);
1923 /*
1924 do
1925 {
1926 inputted = readkey();
1927 }
1928 while(acceptable_char(inputted >> 8) == 0);
1929
1930 inputted = inputted >> 8;
1931 */
1932 if (option_index() == -1)
1933 return;
1934
1935 if (menu_index < 19)
1936 player[0].keys [option_index()] = inputted;
1937 else
1938 player[1].keys [option_index()] = inputted;
1939
1940 ticked = 0;
1941
1942
1943 }
1944
1945 int option_index(void)
1946 {
1947 switch(menu_index)
1948 {
1949 case 11:
1950 case 19:
1951 return CMD_THRUST;
1952 case 12:
1953 case 20:
1954 return CMD_LEFT;
1955 case 13:
1956 case 21:
1957 return CMD_RIGHT;
1958 case 14:
1959 case 22:
1960 return CMD_BRAKE;
1961 case 15:
1962 case 23:
1963 return CMD_FIRE1;
1964 case 16:
1965 case 24:
1966 return CMD_FIRE2;
1967 // case 15:
1968 // case 26:
1969 // return CMD_UPGRADE;
1970 // case 16:
1971 // case 27:
1972 // return CMD_LEFT1;
1973 // case 17:
1974 // case 28:
1975 // return CMD_RIGHT1;
1976 case 17:
1977 case 25:
1978 return CMD_LINK;
1979 }
1980
1981 return -1;
1982
1983 }
1984
1985
1986 void test_speakers(void)
1987 {
1988 rectfill(screen, 400, 210, 550, 280, COLOUR_GREY2);
1989 rect(screen, 400, 210, 550, 280, COLOUR_GREY6);
1990 rect(screen, 401, 211, 549, 279, COLOUR_GREY5);
1991 rect(screen, 402, 212, 548, 278, COLOUR_GREY4);
1992 rect(screen, 403, 213, 547, 277, COLOUR_GREY3);
1993 if (options.sound_init == 0)
1994 {
1995 textprintf_right_ex(screen, small_font, 520, 240, COLOUR_WHITE, -1, "Sound disabled.");
1996 rest(1000);
1997 return;
1998 }
1999 textprintf_right_ex(screen, small_font, 520, 240, COLOUR_WHITE, -1, "Testing left speaker. . .");
2000 if (options.sound_mode == SOUNDMODE_REVERSED)
2001 play_wav2(NWAV_PPIPE, 800, 255, 0);
2002 else
2003 play_wav2(NWAV_PPIPE, 800, 255, 255);
2004
2005
2006 rest(1000);
2007 rectfill(screen, 404, 214, 546, 276, COLOUR_GREY2);
2008 textprintf_right_ex(screen, small_font, 520, 240, COLOUR_WHITE, -1, "Testing right speaker. . .");
2009 if (options.sound_mode == SOUNDMODE_REVERSED)
2010 play_wav2(NWAV_PPIPE, 800, 255, 255);
2011 else
2012 play_wav2(NWAV_PPIPE, 800, 255, 0);
2013 rest(1000);
2014 }
2015
2016 void resolution_change(void)
2017 {
2018 rectfill(screen, 300, 210, 600, 340, COLOUR_BLUE2);
2019 rect(screen, 300, 210, 600, 340, COLOUR_BLUE6);
2020 rect(screen, 301, 211, 599, 339, COLOUR_BLUE5);
2021 rect(screen, 302, 212, 598, 338, COLOUR_BLUE4);
2022 rect(screen, 303, 213, 597, 337, COLOUR_BLUE3);
2023 textprintf_centre_ex(screen, small_font, 450, 240, COLOUR_WHITE, -1, "Screen resolution changed.");
2024 textprintf_centre_ex(screen, small_font, 450, 250, COLOUR_WHITE, -1, "You have to restart the game");
2025 textprintf_centre_ex(screen, small_font, 450, 260, COLOUR_WHITE, -1, "for this change to take effect.");
2026 textprintf_centre_ex(screen, small_font, 450, 280, COLOUR_WHITE, -1, "If it doesn't work, edit the file");
2027 textprintf_centre_ex(screen, small_font, 450, 290, COLOUR_WHITE, -1, "overgod.cfg in this directory and");
2028 textprintf_centre_ex(screen, small_font, 450, 300, COLOUR_WHITE, -1, "change the resolution setting to zero.");
2029 rest(100);
2030 textprintf_centre_ex(screen, small_font, 450, 320, COLOUR_GREY6, -1, "Press 'Y' to continue.");
2031 do
2032 {}
2033 while (key[KEY_Y] == 0);
2034
2035 // last_key = KEY_SPACE;
2036 // keypress_wait = KP_WAIT_LONG;
2037 }
2038
2039 void start_game_from_menu(int game_type)
2040 {
2041
2042 game.type = game_type;
2043
2044 vsync();
2045 clear_bitmap(screen);
2046
2047 begin_game();
2048
2049 ticked = 0;
2050
2051 game_loop();
2052
2053 clear_bitmap(screen);
2054
2055 if (arena.level == 16)
2056 {
2057 display_victory_screen();
2058 }
2059
2060 if (arena.level > 5 && options.unlock_purple == 0)
2061 {
2062 options.unlock_purple = UNLOCK_PURPLE;
2063 set_config_int("Unlock", "Purple", UNLOCK_PURPLE);
2064 unlock_screen(UNLOCK_PURPLE);
2065 }
2066 if (arena.level > 10 && options.unlock_void == 0)
2067 {
2068 options.unlock_void = UNLOCK_VOID;
2069 set_config_int("Unlock", "Void", UNLOCK_VOID);
2070 unlock_screen(UNLOCK_VOID);
2071 }
2072 if (arena.level > 15 && options.unlock_god == 0)
2073 {
2074 options.unlock_god = UNLOCK_GOD;
2075 set_config_int("Unlock", "God", UNLOCK_GOD);
2076 unlock_screen(UNLOCK_GOD);
2077 }
2078
2079
2080 check_high_scores();
2081
2082 }
2083
2084
2085 void change_menu(int to_which)
2086 {
2087
2088 which_menu = to_which;
2089 keypress_wait = KP_WAIT_LONG;
2090
2091 switch(which_menu)
2092 {
2093 default:
2094 case MENU_MAIN:
2095 game.type = GAME_SINGLE;
2096 which_menu = MENU_MAIN;
2097 menu_index = 0;
2098 menu_index_max = 4;
2099 menu_index_min = 0;
2100 save_config();
2101 break;
2102 case MENU_OPTIONS:
2103 which_menu = MENU_OPTIONS;
2104 menu_index = 1;
2105 menu_index_max = 27;
2106 menu_index_min = 1;
2107 break;
2108 case MENU_SPECIAL:
2109 which_menu = MENU_SPECIAL;
2110 menu_index = 0;
2111 menu_index_max = SPECIAL_END - 1;
2112 menu_index_min = 0;
2113 break;
2114 case MENU_DUEL:
2115 which_menu = MENU_DUEL;
2116 menu_index = 1;
2117 menu_index_max = DUEL_END - 1;
2118 menu_index_min = 1;
2119 break;
2120 case MENU_SCORES:
2121 init_ms();
2122 which_menu = MENU_SCORES;
2123 menu_index = 1;
2124 menu_index_max = 31;
2125 menu_index_min = 1;
2126 break;
2127 case MENU_ENTER_SCORES:
2128 init_ms();
2129 which_menu = MENU_ENTER_SCORES;
2130 menu_index = 1;
2131 menu_index_max = 31;
2132 menu_index_min = 1;
2133 break;
2134 }
2135
2136 }
2137
2138
2139
2140
2141
2142
2143 void choose_ships(void)
2144 {
2145
2146 player[0].ship = 0;
2147 player[1].ship = 0;
2148 game.single_player = 0;
2149 game.users = 1;
2150
2151 int county = 0;
2152
2153 int keypress_wait1 = KP_WAIT_SHORT;
2154 int keypress_wait2 = KP_WAIT_SHORT;
2155 int waiting = 5;
2156
2157 int p1_active = 0;
2158 int p2_active = 0;
2159 int p1_chosen = 0;
2160 int p2_chosen = 0;
2161
2162 int game_type = -1;
2163
2164 if (game.type == GAME_DUEL)
2165 {
2166 p1_active = 1;
2167 p2_active = 1;
2168 }
2169
2170 ticked = 0;
2171
2172 do
2173 {
2174 menu_counter ++;
2175
2176 if (p1_active && !p1_chosen)// && keypress_wait1 == 0)
2177 {
2178 if (check_key(player[0].keys [CMD_LEFT]))
2179 {
2180 if (player[0].ship == 0)
2181 player[0].ship = 8;
2182 else
2183 player[0].ship --;
2184 menu_sound1();
2185 keypress_wait1 = waiting;
2186 }
2187 if (check_key(player[0].keys [CMD_RIGHT]))
2188 {
2189 player[0].ship ++;
2190 if (player[0].ship == 9)
2191 player[0].ship = 0;
2192 keypress_wait1 = waiting;
2193 menu_sound1();
2194 }
2195 if (check_key(player[0].keys [CMD_FIRE1]))
2196 {
2197 p1_chosen = 1;
2198 keypress_wait1 = waiting;
2199 menu_sound2();
2200 }
2201 if (check_key(player[0].keys [CMD_THRUST]))
2202 {
2203 if (player[0].ship < 3)
2204 player[0].ship += 6;
2205 else
2206 player[0].ship -= 3;
2207 keypress_wait1 = waiting;
2208 menu_sound1();
2209 }
2210 if (check_key(player[0].keys [CMD_BRAKE]))
2211 {
2212 if (player[0].ship > 5)
2213 player[0].ship -= 6;
2214 else
2215 player[0].ship += 3;
2216 keypress_wait1 = waiting;
2217 menu_sound1();
2218 }
2219 }
2220 else
2221 {
2222 if (check_key(player[0].keys [CMD_FIRE1]))// && keypress_wait1 == 0)
2223 {
2224 p1_active = 1;
2225 keypress_wait1 = waiting;
2226 menu_sound2();
2227 }
2228 }
2229
2230 if (p2_active && !p2_chosen)// && keypress_wait2 == 0)
2231 {
2232 if (check_key(player[1].keys [CMD_LEFT]))
2233 {
2234 if (player[1].ship == 0)
2235 player[1].ship = 8;
2236 else
2237 player[1].ship --;
2238 keypress_wait2 = waiting;
2239 menu_sound1();
2240 }
2241 if (check_key(player[1].keys [CMD_RIGHT]))
2242 {
2243 player[1].ship ++;
2244 if (player[1].ship == 9)
2245 player[1].ship = 0;
2246 keypress_wait2 = waiting;
2247 menu_sound1();
2248 }
2249 if (check_key(player[1].keys [CMD_FIRE1]))
2250 {
2251 p2_chosen = 1;
2252 keypress_wait2 = waiting;
2253 menu_sound2();
2254 }
2255 if (check_key(player[1].keys [CMD_THRUST]))
2256 {
2257 if (player[1].ship < 3)
2258 player[1].ship += 6;
2259 else
2260 player[1].ship -= 3;
2261 keypress_wait2 = waiting;
2262 menu_sound1();
2263 }
2264 if (check_key(player[1].keys [CMD_BRAKE]))
2265 {
2266 if (player[1].ship > 5)
2267 player[1].ship -= 6;
2268 else
2269 player[1].ship += 3;
2270 keypress_wait2 = waiting;
2271 menu_sound1();
2272 }
2273 }
2274 else
2275 {
2276 if (check_key(player[1].keys [CMD_FIRE1]))// && keypress_wait2 == 0)
2277 {
2278 p2_active = 1;
2279 keypress_wait2 = waiting;
2280 menu_sound2();
2281 }
2282 }
2283
2284 if (keypress_wait1 > 0)
2285 keypress_wait1 --;
2286 if (keypress_wait2 > 0)
2287 keypress_wait2 --;
2288
2289 make_grid_scroll();
2290
2291 if (ticked == 0)
2292 {
2293 display_ship_choice(0, p1_active, p2_active, p1_chosen, p2_chosen);
2294 menu_to_screen();
2295 }
2296
2297 do
2298 {
2299 county ++;
2300 } while (ticked == 0);
2301
2302 ticked --;
2303
2304 if (p1_chosen == 1 && p2_active == 0)
2305 {
2306 if (game.type == GAME_TIME_ATTACK)
2307 game_type = GAME_TIME_ATTACK;
2308 else
2309 game_type = GAME_SINGLE;
2310 game.single_player = 0;
2311 }
2312 if (p2_chosen == 1 && p1_active == 0)
2313 {
2314 if (game.type == GAME_TIME_ATTACK)
2315 game_type = GAME_TIME_ATTACK;
2316 else
2317 game_type = GAME_SINGLE;
2318 game.single_player = 1;
2319 }
2320 if (p1_chosen == 1 && p2_chosen == 1)
2321 {
2322 game_type = GAME_COOP;
2323 if (game.type == GAME_DUEL)
2324 game_type = GAME_DUEL;
2325 if (game.type == GAME_TIME_ATTACK)
2326 game_type = GAME_TIME_ATTACK_COOP;
2327 }
2328
2329 if (game_type == GAME_TIME_ATTACK_COOP || game_type == GAME_TIME_ATTACK)
2330 change_menu(MENU_MAIN);
2331
2332 if (game_type != -1)
2333 {
2334 if (player[0].ship == 8)
2335 player[0].ship = grand(8);
2336 if (player[1].ship == 8)
2337 player[1].ship = grand(8);
2338 start_game_from_menu(game_type);
2339 return;
2340 }
2341
2342 if (check_key(KEY_ESC))
2343 {
2344 keypress_wait = KP_WAIT_LONG;
2345 last_key = KEY_ESC;
2346 // rest(200);
2347 game.type = GAME_SINGLE;
2348 menu_sound2();
2349 return;
2350 }
2351 }
2352 while(TRUE);
2353 }
2354
2355
2356 void display_ship_choice(int players, int p1a, int p2a, int p1c, int p2c)
2357 {
2358
2359 clear_bitmap(menu_bmp);
2360
2361 show_grid(COLOUR_GREEN3, COLOUR_GREEN8);
2362
2363 // int i, j;
2364
2365 if (!p1a)
2366 {
2367 textprintf_centre_ex(menu_bmp, font2, 320, 120, COLOUR_GREEN2 + (menu_counter / 4) % 7, -1, "{player__one__fire__to__start}");
2368 textprintf_centre_ex(menu_bmp, font, 320, 120, -1, -1, "{player__one__fire__to__start}");
2369 }
2370 else
2371 {
2372 display_ship_choice2(player [0].ship, 0, p1c);
2373 }
2374
2375 if (!p2a)
2376 {
2377 textprintf_centre_ex(menu_bmp, font2, 320, 360, COLOUR_GREEN2 + (menu_counter / 4) % 7, -1, "{player__two__fire__to__start}");
2378 textprintf_centre_ex(menu_bmp, font, 320, 360, -1, -1, "{player__two__fire__to__start}");
2379 }
2380 else
2381 {
2382 display_ship_choice2(player [1].ship, 225, p2c);
2383 }
2384
2385
2386 }
2387
2388
2389 void display_ship_choice2(int ship, int y, int chosen)
2390 {
2391 int i,j;
2392
2393 int bx, by;
2394 int col, sprite_drawn = 0;
2395 int line_colour = COLOUR_ORANGE8 - (menu_counter / 4) % 6;
2396 int height = 0;
2397
2398 char descr_string [200];
2399 // show_grid(COLOUR_GREEN3, COLOUR_GREEN8);
2400 int x1 = 436, y1 = 80 + y;
2401
2402 for (i = 0; i < 3; i ++)
2403 {
2404 for (j = 0; j < 3; j ++)
2405 {
2406 bx = 10 + i * 64;
2407 by = y + 10 + j * 64 + i * 5;
2408 col = COLOUR_YELLOW1;
2409 sprite_drawn = RLE_LSHIP_GREEN;
2410 if (i + j * 3 == ship)
2411 {
2412 col = COLOUR_YELLOW3;
2413 sprite_drawn = RLE_LSHIP_YELLOW;
2414 if (chosen)
2415 {
2416 col = COLOUR_GREEN3;
2417 sprite_drawn = RLE_LSHIP_GREEN;
2418 }
2419 rectfill(menu_bmp, bx, by, bx + 49, by + 49, col);
2420 draw_rle_sprite(menu_bmp, large_ships [i + j * 3] [sprite_drawn], bx, by);
2421 height = by + 1;
2422 hline(menu_bmp, bx - 1, by - 1, bx + 15, line_colour);
2423 hline(menu_bmp, bx + 50, by - 1, bx + 34, line_colour);
2424 hline(menu_bmp, bx - 1, by + 50, bx + 15, line_colour);
2425 hline(menu_bmp, bx + 50, by + 50, bx + 34, line_colour);
2426 vline(menu_bmp, bx - 1, by - 1, by + 50, line_colour);
2427 vline(menu_bmp, bx + 50, by - 1, by + 50, line_colour);
2428 hline(menu_bmp, bx + 50, height, x1 - 180, line_colour);
2429 }
2430 else
2431 {
2432 rectfill(menu_bmp, bx, by, bx + 49, by + 49, col);
2433 draw_rle_sprite(menu_bmp, large_ships [i + j * 3] [sprite_drawn], bx, by);
2434 }
2435 }
2436 }
2437
2438 // rectfill(menu_bmp, x1 - 100, y1 - 60, x1 + 100, y1 + 60, COLOUR_GREY1);
2439 // rectfill(menu_bmp, x1 - 95, y1 - 55, x1 + 95, y1 + 55, COLOUR_GREY5);
2440 rectfill(menu_bmp, x1 - 155, y1 - 40, x1 + 155, y1 + 40, COLOUR_GREY1);
2441 rect(menu_bmp, x1 - 154, y1 - 39, x1 + 154, y1 + 39, COLOUR_GREY4);
2442 rect(menu_bmp, x1 - 153, y1 - 38, x1 + 153, y1 + 38, COLOUR_GREY4);
2443 rect(menu_bmp, x1 - 151, y1 - 36, x1 + 151, y1 + 36, COLOUR_GREY4);
2444 rect(menu_bmp, x1 - 150, y1 - 35, x1 + 150, y1 + 35, COLOUR_GREY4);
2445
2446 rect(menu_bmp, x1 - 152, y1 - 37, x1 + 152, y1 + 37, line_colour);
2447 hline(menu_bmp, x1 - 152, y1, x1 - 180, line_colour);
2448 vline(menu_bmp, x1 - 180, y1, height, line_colour);
2449
2450 if (chosen)
2451 {
2452 // textprintf_centre_ex(menu_bmp, font, 436, y + 20, COLOUR_YELLOW8 - (menu_counter / 4) % 4, -1, ship_name_long(ship));
2453 // textprintf_centre_ex(menu_bmp, font2, 436, y + 20, COLOUR_ORANGE4 + (menu_counter / 8) % 4, -1, ship_name_long(ship));
2454 // textprintf_centre_ex(menu_bmp, font2, 436, y + 20, COLOUR_YELLOW8 - (menu_counter / 4) % 4, -1, ship_name_long(ship));
2455 // textprintf_centre_ex(menu_bmp, font, 436, y + 20, -1, -1, ship_name_long(ship));
2456 }
2457 else
2458 {
2459 // textprintf_centre_ex(menu_bmp, font2, 436, y + 20, COLOUR_RED8 - (menu_counter / 4) % 4, -1, ship_name_long(ship));
2460 // textprintf_centre_ex(menu_bmp, font2, 436, y + 20, COLOUR_BLUE4 + (menu_counter / 8) % 4, -1, ship_name_long(ship));
2461 // textprintf_centre_ex(menu_bmp, font, 436, y + 20, -1, -1, ship_name_long(ship));
2462 }
2463 // textprintf_ex(menu_bmp, font2, 280, y + 20, COLOUR_WHITE, "%i", ship);
2464
2465 ship_description1(ship, descr_string);
2466 textprintf_centre_ex(menu_bmp, small_font, 436, y + 70, COLOUR_YELLOW7, -1, descr_string);
2467 ship_description2(ship, descr_string);
2468 textprintf_centre_ex(menu_bmp, small_font, 436, y + 80, COLOUR_YELLOW7, -1, descr_string);
2469 /*
2470 int line_colour = 255;
2471 int box_colour = 255;
2472
2473 RGB lcolour [1];
2474 int mcn = menu_counter * 2;
2475
2476 if (mcn % 128 < 64)
2477 {
2478 lcolour[0].r = 8 + (63 - mcn % 64) / 7;
2479 // lcolour[0].g = (63 - mcn % 64);
2480 lcolour[0].g = 8 + (63 - mcn % 64) / 4;
2481 lcolour[0].b = 0;//((mcn + 32) % 64);// / 2;
2482 }
2483 else
2484 {
2485 lcolour[0].r = 8 + (mcn % 64) / 7;
2486 // lcolour[0].g = (mcn % 64);
2487 lcolour[0].g = 8 + (mcn % 64) / 4;
2488 lcolour[0].b = 0;//(63 - ((mcn + 32) % 64));// / 2;
2489 }
2490
2491 // vsync(); MAY NEED TO REPLACE THIS!!!
2492
2493 set_color(255, lcolour);
2494
2495 if (ship != 15)
2496 {
2497 line(menu_bmp, 431, y + 110, 431, y + 125, line_colour);
2498 line(menu_bmp, 439, y + 110, 439, y + 125, line_colour);
2499 line(menu_bmp, 431, y + 125, 439, y + 125, line_colour);
2500 line(menu_bmp, 435, y + 125, 435, y + 135, line_colour);
2501 line(menu_bmp, 435, y + 135, 250, y + 135, line_colour);
2502 line(menu_bmp, 250, y + 135, 250, y + 160, line_colour);
2503 line(menu_bmp, 250, y + 160, 615, y + 160, line_colour);
2504 line(menu_bmp, 615, y + 160, 615, y + 185, line_colour);
2505 line(menu_bmp, 615, y + 185, 250, y + 185, line_colour);
2506 line(menu_bmp, 250, y + 185, 250, y + 210, line_colour);
2507 line(menu_bmp, 250, y + 210, 590, y + 210, line_colour);
2508
2509 rectfill(menu_bmp, 397, y + 103, 472, y + 117, box_colour);
2510 draw_sprite(menu_bmp, upgrade_box3, 395, y + 93);
2511
2512 for (i = 0; i < 4; i ++)
2513 {
2514 rectfill(menu_bmp, 263 + i * 90, y + 153, 336 + i * 90, y + 168, box_colour);
2515 rectfill(menu_bmp, 263 + i * 90, y + 203, 336 + i * 90, y + 218, box_colour);
2516 draw_sprite(menu_bmp, upgrade_box1, 260 + i * 90, y + 143);
2517 if (i == 3)
2518 draw_sprite(menu_bmp, upgrade_box2, 260 + i * 90, y + 193);
2519 else
2520 draw_sprite(menu_bmp, upgrade_box1, 260 + i * 90, y + 193);
2521 }
2522
2523 }
2524 */
2525
2526 }
2527
2528
2529 void show_grid(int grid_colour, int border_colour)
2530 {
2531
2532 // rectfill(menu_bmp, 10, 10, 630, 470, COLOUR_GREY1);
2533 // rect(menu_bmp, 10, 10, 630, 470, border_colour - 4);
2534 // rect(menu_bmp, 9, 9, 631, 471, border_colour - 2);
2535 // rect(menu_bmp, 8, 8, 632, 472, border_colour);
2536
2537 draw_scrolling_grid(11, 11, 629, 469, grid_colour);
2538
2539 }
2540
2541
2542 void menu_display_scores(void)
2543 {
2544
2545 /* rectfill(menu_bmp, 10, 50, 540, 400, COLOUR_GREEN1);
2546 rect(menu_bmp, 10, 50, 540, 400, COLOUR_GREEN4);
2547 rect(menu_bmp, 9, 49, 541, 401, COLOUR_GREEN6);
2548 rect(menu_bmp, 8, 48, 542, 402, COLOUR_GREEN8);*/
2549
2550 show_grid(COLOUR_YELLOW3, COLOUR_YELLOW8);
2551 draw_ms();
2552
2553
2554 textprintf_centre_ex(menu_bmp, font2, 320, 20, COLOUR_ORANGE8 - (menu_counter / 2) % 4, -1, "{___high___scores___}");
2555 textprintf_centre_ex(menu_bmp, font, 320, 20, -1, -1, "{___high___scores___}");
2556
2557
2558
2559 int i;
2560
2561 int ox = 205, oy = 10, oys = 95;
2562 int col;
2563
2564 textprintf_centre_ex(menu_bmp, small_font, 320, oys - 30, COLOUR_ORANGE8, -1, "Single Player");
2565
2566 textprintf_ex(menu_bmp, small_font, ox, oys - 10, COLOUR_YELLOW8, -1, "Name");
2567 textprintf_right_ex(menu_bmp, small_font, ox + 90, oys - 10, COLOUR_YELLOW8, -1, "Level");
2568 // textprintf_right_ex(menu_bmp, small_font, ox + 190, oys - 10, COLOUR_YELLOW8, -1, "Craft");
2569 textprintf_right_ex(menu_bmp, small_font, ox + 200, oys - 10, COLOUR_YELLOW8, -1, "Score");
2570 textprintf_ex(menu_bmp, small_font, ox + 220, oys - 10, COLOUR_YELLOW8, -1, "Rank");
2571
2572
2573 char sstr [50];
2574 // char istr [20];
2575
2576 for (i = 0; i < NO_SCORES; i ++)
2577 {
2578
2579 col = COLOUR_GREEN5;
2580
2581 if (which_menu == MENU_ENTER_SCORES)
2582 col = COLOUR_GREEN3;
2583
2584 if (game.type == GAME_SINGLE && i == entering_score && which_menu == MENU_ENTER_SCORES)
2585 col = COLOUR_YELLOW4 + (menu_counter / 4) % 4;
2586
2587 strcpy(sstr, hs_single[i].name);
2588 textprintf_ex(menu_bmp, small_font, ox, oys + oy * i, col, -1, sstr);
2589
2590 if (hs_single[i].level == 16)
2591 strcpy(sstr, "<V>");
2592 else
2593 // strcpy(sstr, itoa(hs_single[i].level, istr, 10));
2594 {
2595 strcpy(sstr, "");
2596 anum(sstr, hs_single[i].level);
2597 }
2598 textprintf_right_ex(menu_bmp, small_font, ox + 90, oys + oy * i, col, -1, sstr);
2599
2600 // strcpy(sstr, ship_name_short(hs_single[i].ship));
2601 // textprintf_right_ex(menu_bmp, small_font, ox + 190, oys + oy * i, col, -1, sstr);
2602
2603 // strcpy(sstr, itoa(hs_single[i].score, istr, 10));
2604 // strcpy(sstr, "");
2605 // anum(sstr, );
2606 textprintf_right_ex(menu_bmp, small_font, ox + 200, oys + oy * i, col, -1, "%i", hs_single[i].score);
2607
2608 rank_name(get_rank(hs_single[i].score, hs_single[i].level), sstr);
2609 if (hs_single[i].level == 16)
2610 col = COLOUR_YELLOW8;
2611 textprintf_ex(menu_bmp, small_font, ox + 220, oys + oy * i, col, -1, sstr);
2612
2613
2614 }
2615
2616 oys = 290;
2617
2618 textprintf_centre_ex(menu_bmp, small_font, 320, oys - 30, COLOUR_ORANGE8, -1, "Cooperative - best player only");
2619
2620 textprintf_ex(menu_bmp, small_font, ox, oys - 10, COLOUR_YELLOW8, -1, "Name");
2621 textprintf_right_ex(menu_bmp, small_font, ox + 90, oys - 10, COLOUR_YELLOW8, -1, "Level");
2622 // textprintf_right_ex(menu_bmp, small_font, ox + 190, oys - 10, COLOUR_YELLOW8, -1, "Craft");
2623 textprintf_right_ex(menu_bmp, small_font, ox + 200, oys - 10, COLOUR_YELLOW8, -1, "Score");
2624 textprintf_ex(menu_bmp, small_font, ox + 220, oys - 10, COLOUR_YELLOW8, -1, "Rank");
2625
2626 for (i = 0; i < NO_SCORES; i ++)
2627 {
2628
2629 col = COLOUR_GREEN5;
2630
2631 if (which_menu == MENU_ENTER_SCORES)
2632 col = COLOUR_GREEN3;
2633
2634 if (game.type == GAME_COOP && i == entering_score && which_menu == MENU_ENTER_SCORES)
2635 col = COLOUR_YELLOW4 + (menu_counter / 2) % 4;
2636
2637 strcpy(sstr, hs_coop[i].name);
2638 textprintf_ex(menu_bmp, small_font, ox, oys + oy * i, col, -1, sstr);
2639
2640 if (hs_coop[i].level == 16)
2641 strcpy(sstr, "<V>");
2642 else
2643 {
2644 strcpy(sstr, "");
2645 anum(sstr, hs_coop[i].level);
2646 }
2647 // strcpy(sstr, itoa(hs_coop[i].level, istr, 10));
2648 /* if (game.mode_purple == 1)
2649 textprintf_right_ex(menu_bmp, small_font, ox + 98, oys + oy * i, TRANS_PURPLE, -1, "p");
2650 if (game.mode_void == 1)
2651 textprintf_right_ex(menu_bmp, small_font, ox + 106, oys + oy * i, COLOUR_WHITE, -1, "v");
2652 if (game.mode_god == 1)
2653 textprintf_right_ex(menu_bmp, small_font, ox + 114, oys + oy * i, COLOUR_WHITE, -1, "g");*/
2654 textprintf_right_ex(menu_bmp, small_font, ox + 90, oys + oy * i, col, -1, sstr);
2655
2656 // strcpy(sstr, ship_name_short(hs_coop[i].ship));
2657 // textprintf_right_ex(menu_bmp, small_font, ox + 190, oys + oy * i, col, -1, sstr);
2658
2659 // strcpy(sstr, itoa(hs_coop[i].score, istr, 10));
2660 // strcpy(sstr, "");
2661 // anum(sstr, hs_coop[i].score);
2662 textprintf_right_ex(menu_bmp, small_font, ox + 200, oys + oy * i, col, -1, "%i", hs_coop[i].score);
2663
2664 if (hs_coop[i].level == 16)
2665 col = COLOUR_YELLOW8;
2666 rank_name(get_rank(hs_coop[i].score, hs_coop[i].level), sstr);
2667 textprintf_ex(menu_bmp, small_font, ox + 220, oys + oy * i, col, -1, sstr);
2668
2669 }
2670
2671 char tastr [100];
2672
2673 int hours;
2674 int minutes;
2675 int seconds;
2676
2677 strcpy(tastr, "Longest Time Attack survivor - ");
2678 strcat(tastr, best_ta_name);
2679 strcat(tastr, " (");
2680 hours = best_ta_time / 120000;
2681 minutes = best_ta_time / 2000 - (hours * 60);
2682 seconds = (best_ta_time / 33.3333) - (minutes * 60);
2683 /* if (hours > 0)
2684 {
2685 strcat(tastr, itoa(hours, istr, 10));
2686 strcat(tastr, ":");
2687 if (minutes < 10)
2688 strcat(tastr, "0");
2689 }
2690 strcat(tastr, itoa(minutes, istr, 10));
2691 strcat(tastr, ":");
2692 if (seconds < 10)
2693 strcat(tastr, "0");
2694 strcat(tastr, itoa(seconds, istr, 10));
2695 strcat(tastr, ")");*/
2696
2697 col = COLOUR_GREY5;
2698
2699 if ((game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
2700 && which_menu == MENU_ENTER_SCORES)
2701 col = COLOUR_YELLOW4 + (menu_counter / 2) % 4;
2702
2703 // textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, tastr);
2704 if (hours > 0)
2705 {
2706 if (minutes < 10)
2707 {
2708 if (seconds < 10)
2709 {
2710 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s%i:0%i:0%i)", tastr, hours, minutes, seconds);
2711 }
2712 else
2713 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s%i:0%i:%i)", tastr, hours, minutes, seconds);
2714 }
2715 else
2716 {
2717 if (seconds < 10)
2718 {
2719 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s%i:%i:0%i)", tastr, hours, minutes, seconds);
2720 }
2721 else
2722 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s%i:%i:%i)", tastr, hours, minutes, seconds);
2723 }
2724 }
2725 else
2726 {
2727 if (minutes < 10)
2728 {
2729 if (seconds < 10)
2730 {
2731 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s0%i:0%i)", tastr, minutes, seconds);
2732 }
2733 else
2734 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s0%i:%i)", tastr, minutes, seconds);
2735 }
2736 else
2737 {
2738 if (seconds < 10)
2739 {
2740 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s%i:0%i)", tastr, minutes, seconds);
2741 }
2742 else
2743 textprintf_centre_ex(menu_bmp, small_font, 320, 460, col, -1, "%s%i:%i)", tastr, minutes, seconds);
2744 }
2745 }
2746
2747
2748 /*
2749 textprintf_centre_ex(menu_bmp, font, 300, 200, COLOUR_YELLOW8 - (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
2750 textprintf_centre_ex(menu_bmp, font2, 300, 200, COLOUR_RED1 + (menu_counter / 4) % 7, "L___a___c___e___w___i___n___g}");
2751 textprintf_centre_ex(menu_bmp, font, 300, 300, COLOUR_YELLOW7, "Space} For} 1P} Enter} For} 2P}...");
2752 textprintf_centre_ex(menu_bmp, font2, 300, 300, COLOUR_RED7, "Space} For} 1P} Enter} For} 2P}...");
2753 */
2754 }
2755
2756 int get_rank(int score, int level)
2757 {
2758
2759
2760 if (level == 16)
2761 {
2762 if (score < 18000)
2763 return RANK_DEMIGOD;
2764 if (score < 19000)
2765 return RANK_GODLING;
2766 if (score < 20000)
2767 return RANK_UNDERGOD;
2768 if (score < 21000)
2769 return RANK_LESSER_GOD;
2770 if (score < 23000)
2771 return RANK_GREATER_GOD;
2772 if (score < 26000)
2773 return RANK_OVERGOD;
2774 return RANK_SUPREME_BEING;
2775 }
2776
2777 if (score < 500)
2778 return RANK_SLAVE;
2779 if (score < 1000)
2780 return RANK_DOUBTER;
2781 if (score < 2000)
2782 return RANK_UNBELIEVER;
2783 if (score < 4000)
2784 return RANK_BLASPHEMER;
2785 if (score < 8000)
2786 return RANK_APOSTATE;
2787 if (score < 12000)
2788 return RANK_HERETIC;
2789 if (score < 15000)
2790 return RANK_HERESIARCH;
2791 if (score < 20000)
2792 return RANK_SECULARIST;
2793 return RANK_DEICIDE;
2794
2795 }
2796
2797
2798 void rank_name(int rank, char sstr [30])
2799 {
2800
2801 switch(rank)
2802 {
2803 case RANK_SLAVE:
2804 strcpy(sstr, "Slave");
2805 break;
2806 case RANK_DOUBTER:
2807 strcpy(sstr, "Doubter");
2808 break;
2809 case RANK_UNBELIEVER:
2810 strcpy(sstr, "Unbeliever");
2811 break;
2812 case RANK_BLASPHEMER:
2813 strcpy(sstr, "Blasphemer");
2814 break;
2815 case RANK_APOSTATE:
2816 strcpy(sstr, "Apostate");
2817 break;
2818 case RANK_HERETIC:
2819 strcpy(sstr, "Heretic");
2820 break;
2821 case RANK_HERESIARCH: // jlb
2822 strcpy(sstr, "Heresiarch");
2823 break;
2824 case RANK_SECULARIST:
2825 strcpy(sstr, "Secularist");
2826 break;
2827 case RANK_DEICIDE:
2828 strcpy(sstr, "Deicide");
2829 break;
2830 case RANK_DEMIGOD:
2831 strcpy(sstr, "DEMIGOD");
2832 break;
2833 case RANK_GODLING:
2834 strcpy(sstr, "GODLING");
2835 break;
2836 case RANK_UNDERGOD:
2837 strcpy(sstr, "UNDERGOD");
2838 break;
2839 case RANK_LESSER_GOD:
2840 strcpy(sstr, "LESSER GOD");
2841 break;
2842 case RANK_GREATER_GOD:
2843 strcpy(sstr, "GREATER GOD");
2844 break;
2845 case RANK_OVERGOD:
2846 strcpy(sstr, "OVERGOD");
2847 break;
2848 case RANK_SUPREME_BEING:
2849 strcpy(sstr, "SUPREME BEING");
2850 break;
2851
2852 }
2853
2854 }
2855
2856 void draw_scrolling_grid(int min_x, int min_y, int max_x, int max_y, int colour)
2857 {
2858
2859 int i, j, x1, y1;
2860
2861 int x_offset = (grid_x / GRAIN) % 50;
2862 int y_offset = (grid_y / GRAIN) % 50;
2863
2864 for (i = -3; i < 16; i ++)
2865 {
2866 for (j = -3; j < 16; j ++)
2867 {
2868 x1 = i * 50 + x_offset;
2869 if (x1 < min_x - 80 || x1 > max_x + 50)
2870 continue;
2871 y1 = j * 50 + y_offset;
2872 if (y1 < min_y - 80 || y1 > max_y + 50)
2873 continue;
2874 draw_rle_sprite(menu_bmp, menu_tile, x1, y1);
2875 }
2876 }
2877
2878 /* for (i = 0; i < 15; i ++)
2879 {
2880 x1 = i * 50 + x_offset;
2881 if (x1 < min_x - 50 || x1 > max_x + 50)
2882 continue;
2883 draw_rle_sprite(menu_bmp, menu_tile, x1
2884 // vline(menu_bmp, x1, min_y, max_y, colour);
2885 }
2886 for (j = 0; j < 12; j ++)
2887 {
2888 y1 = j * 50 + y_offset;
2889 if (y1 < min_y - 50 || y1 > max_y + 50)
2890 continue;
2891 // hline(menu_bmp, min_x, y1, max_x, colour);
2892 }
2893 */
2894 }
2895
2896
2897 void menu_to_screen(void)
2898 {
2899 switch(graphics_mode)
2900 {
2901 default: // 640x480
2902 blit(menu_bmp, screen, 0, 0, 0, 0, 640, 480);
2903 break;
2904 case GMODE_800_600:
2905 blit(menu_bmp, screen, 0, 0, 80, 60, 640, 480);
2906 break;
2907 case GMODE_1024_768:
2908 blit(menu_bmp, screen, 0, 0, 192, 144, 640, 480);
2909 break;
2910 }
2911 }
2912
2913
2914 void make_grid_scroll(void)
2915 {
2916
2917 grid_x += grid_x_speed;
2918 grid_y += grid_y_speed;
2919
2920 grid_x %= 50000;
2921 grid_y %= 50000;
2922
2923 grid_x_speed += grid_x_accel;
2924 if (grid_x_speed > 3000) grid_x_speed = 3000;
2925 if (grid_x_speed < -3000) grid_x_speed = -3000;
2926 grid_y_speed += grid_y_accel;
2927 if (grid_y_speed > 3000) grid_y_speed = 3000;
2928 if (grid_y_speed < -3000) grid_y_speed = -3000;
2929
2930 if (menu_counter % 64 == 0)
2931 {
2932 grid_x_accel = grand(301) - 150;
2933 // if (grid_x_speed > 3000) grid_x_speed = 3000;
2934 // if (grid_x_speed < -3000) grid_x_speed = -3000;
2935
2936 grid_y_accel = grand(301) - 150;
2937 // if (grid_y_speed > 3000) grid_y_speed = 3000;
2938 // if (grid_y_speed < -3000) grid_y_speed = -3000;
2939 }
2940
2941 }
2942
2943 /*void init_bouncies(void)
2944 {
2945 int i;
2946
2947 for (i = 0; i < NO_BOUNCIES; i ++)
2948 {
2949
2950 bouncy[i].x = (grand(500) + 20) * GRAIN;
2951 bouncy[i].y = (grand(400) + 20) * GRAIN;
2952 bouncy[i].x_speed = (900 + grand(800));
2953 if (grand(2) == 0)
2954 bouncy[i].x_speed *= -1;
2955 bouncy[i].y_speed = (900 + grand(800));
2956 if (grand(2) == 0)
2957 bouncy[i].y_speed *= -1;
2958 bouncy[i].colour1 = COLOUR_GREEN1;
2959 bouncy[i].colour2 = COLOUR_GREEN6;
2960 if (grand(25) == 0)
2961 {
2962 bouncy[i].colour1 = COLOUR_GREY1;
2963 bouncy[i].colour2 = COLOUR_GREY6;
2964 }
2965 if (grand(15) == 0)
2966 {
2967 bouncy[i].colour1 = COLOUR_PURPLE1;
2968 bouncy[i].colour2 = COLOUR_PURPLE6;
2969 }
2970 if (grand(8) == 0)
2971 {
2972 bouncy[i].colour1 = COLOUR_BLUE1;
2973 bouncy[i].colour2 = COLOUR_BLUE6;
2974 }
2975 if (grand(5) == 0)
2976 {
2977 bouncy[i].colour1 = COLOUR_RED1;
2978 bouncy[i].colour2 = COLOUR_RED6;
2979 }
2980 if (grand(5) == 0)
2981 {
2982 bouncy[i].colour1 = COLOUR_ORANGE1;
2983 bouncy[i].colour2 = COLOUR_ORANGE6;
2984 }
2985 if (grand(5) == 0)
2986 {
2987 bouncy[i].colour1 = COLOUR_YELLOW1;
2988 bouncy[i].colour2 = COLOUR_YELLOW6;
2989 }
2990 }
2991
2992
2993 }
2994
2995 void make_bouncies_move(void)
2996 {
2997 int i;
2998 // int j;
2999
3000 for (i = 0; i < NO_BOUNCIES; i ++)
3001 {
3002 if (bouncy[i].x_speed == 0 && bouncy[i].y_speed == 0) return;
3003
3004 if (bouncy[i].x + bouncy[i].x_speed <= 18 * GRAIN
3005 || bouncy[i].x + bouncy[i].x_speed >= 622 * GRAIN)
3006 {
3007 bouncy[i].x_speed *= -1;
3008 }
3009 if (bouncy[i].y + bouncy[i].y_speed <= 18 * GRAIN
3010 || bouncy[i].y + bouncy[i].y_speed >= 462 * GRAIN)
3011 {
3012 bouncy[i].y_speed *= -1;
3013 }
3014
3015
3016 bouncy[i].x += bouncy[i].x_speed;
3017 bouncy[i].y += bouncy[i].y_speed;
3018
3019 }
3020
3021 }
3022
3023
3024 void draw_bouncies(void)
3025 {
3026
3027 int i;
3028
3029 for (i = 0; i < NO_BOUNCIES; i ++)
3030 {
3031 circlefill(menu_bmp, bouncy[i].x / GRAIN, bouncy[i].y / GRAIN, 7, bouncy[i].colour1);
3032 circle(menu_bmp, bouncy[i].x / GRAIN, bouncy[i].y / GRAIN, 7, bouncy[i].colour2);
3033 }
3034
3035 }
3036
3037 */
3038
3039
3040 void check_high_scores(void)
3041 {
3042
3043 int i;
3044 int entry = -1;
3045 int better_player = 0;
3046
3047 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
3048 {
3049 if (game.ta_total_time > best_ta_time)
3050 {
3051 best_ta_time = game.ta_total_time;
3052 strcpy(best_ta_name, "_");
3053 change_menu(MENU_ENTER_SCORES);
3054 }
3055 else
3056 change_menu(MENU_SCORES);
3057 return;
3058 }
3059
3060 if (game.type == GAME_SINGLE)
3061 {
3062 for (i = 0; i < NO_SCORES; i ++)
3063 {
3064 if (player[game.single_player].score > hs_single[i].score)
3065 {
3066 entry = i;
3067 break;
3068 }
3069 }
3070 if (entry != -1)
3071 {
3072 push_scores_single(entry, game.single_player);
3073 entering_score = entry;
3074 // exit(88);
3075 // change_menu(MENU_SCORES);
3076 // congratulations(-1);
3077 change_menu(MENU_ENTER_SCORES);
3078 }
3079 else
3080 change_menu(MENU_SCORES);
3081 }
3082
3083 if (game.type == GAME_COOP)
3084 {
3085 if (player[0].score > player[1].score) better_player = 0;
3086 else better_player = 1;
3087
3088 for (i = 0; i < NO_SCORES; i ++)
3089 {
3090 if (player[better_player].score > hs_coop[i].score)
3091 {
3092 entry = i;
3093 break;
3094 }
3095 }
3096 for (i = 0; i < NO_SCORES; i ++)
3097 {
3098 if (player[better_player].score > hs_coop[i].score)
3099 {
3100 entry = i;
3101 break;
3102 }
3103 }
3104 if (entry != -1)
3105 {
3106 push_scores_coop(entry, better_player);
3107 entering_score = entry;
3108 // exit(88);
3109 // change_menu(MENU_SCORES);
3110 // entering_score2 = better_player;
3111 change_menu(MENU_ENTER_SCORES);
3112 }
3113 else
3114 change_menu(MENU_SCORES);
3115
3116 /* if (game.type == GAME_COOP)
3117 {
3118 for (i = 0; i < NO_SCORES; i ++)
3119 {
3120 if (player[0].score > hs_single[i].score)
3121 {
3122 entry = i;
3123 break;
3124 }
3125 }
3126 for (i = 0; i < NO_SCORES; i ++)
3127 {
3128 if (player[1].score > hs_single[i].score)
3129 {
3130 entry = i;
3131 break;
3132 }
3133 }
3134 if (entry != -1 || entry2 != -1)
3135 {
3136 push_scores_coop(entry, game.single_player);
3137 entering_score = entry;
3138 // exit(88);
3139 // change_menu(MENU_SCORES);
3140 change_menu(MENU_ENTER_SCORES);
3141 }
3142 else
3143 change_menu(MENU_SCORES);
3144 */
3145
3146 }
3147
3148
3149 }
3150
3151
3152 void congratulations(int player)
3153 {
3154
3155 rectfill(screen, 140, 150, 500, 280, COLOUR_ORANGE1);
3156 rect(screen, 140, 150, 500, 280, COLOUR_ORANGE2);
3157 rect(screen, 139, 149, 501, 281, COLOUR_ORANGE3);
3158 rect(screen, 138, 148, 502, 282, COLOUR_ORANGE4);
3159 rect(screen, 137, 147, 503, 283, COLOUR_ORANGE5);
3160 rect(screen, 136, 146, 504, 284, COLOUR_ORANGE6);
3161
3162
3163
3164
3165 if (player == -1)
3166 {
3167 textprintf_centre_ex(screen, font2, 320, 180, COLOUR_ORANGE6, -1, "congratulations}!");
3168 textprintf_centre_ex(screen, font, 320, 180, COLOUR_YELLOW8, -1, "congratulations}!");
3169 textprintf_centre_ex(screen, font2, 320, 230, COLOUR_ORANGE8, -1, "you} got} a} high} score}!");
3170 textprintf_centre_ex(screen, font, 320, 230, COLOUR_YELLOW6, -1, "you} got} a} high} score}!");
3171 // textprintf_right_ex(screen, small_font, 500, 240, COLOUR_WHITE, "Press a key...");
3172 }
3173 else
3174 {
3175 textprintf_centre_ex(screen, font2, 320, 180, COLOUR_ORANGE6, -1, "congratulations}!");
3176 textprintf_centre_ex(screen, font, 320, 180, COLOUR_YELLOW8, -1, "congratulations}!");
3177 textprintf_centre_ex(screen, font2, 320, 230, COLOUR_ORANGE8, -1, "player} %i got} a} high} score}!", player + 1);
3178 textprintf_centre_ex(screen, font, 320, 230, COLOUR_YELLOW6, -1, "player} %i got} a} high} score}!", player + 1);
3179 }
3180
3181 rest(200);
3182
3183 rect(screen, 140, 150, 500, 280, COLOUR_YELLOW2);
3184 rect(screen, 139, 149, 501, 281, COLOUR_YELLOW3);
3185 rect(screen, 138, 148, 502, 282, COLOUR_YELLOW4);
3186 rect(screen, 137, 147, 503, 283, COLOUR_YELLOW5);
3187 rect(screen, 136, 146, 504, 284, COLOUR_YELLOW6);
3188
3189 clear_keybuf();
3190
3191 readkey();
3192
3193 keypress_wait = KP_WAIT_SHORT;
3194
3195 }
3196
3197 void congratulations_ta(void)
3198 {
3199
3200 rectfill(screen, 140, 150, 500, 280, COLOUR_ORANGE1);
3201 rect(screen, 140, 150, 500, 280, COLOUR_ORANGE2);
3202 rect(screen, 139, 149, 501, 281, COLOUR_ORANGE3);
3203 rect(screen, 138, 148, 502, 282, COLOUR_ORANGE4);
3204 rect(screen, 137, 147, 503, 283, COLOUR_ORANGE5);
3205 rect(screen, 136, 146, 504, 284, COLOUR_ORANGE6);
3206
3207
3208
3209
3210 textprintf_centre_ex(screen, font2, 320, 180, COLOUR_ORANGE6, -1, "congratulations}!");
3211 textprintf_centre_ex(screen, font, 320, 180, COLOUR_YELLOW8, -1, "congratulations}!");
3212 textprintf_centre_ex(screen, small_font, 320, 230, COLOUR_ORANGE8, -1, "You made a new Time Attack record!");
3213
3214 rest(200);
3215
3216 rect(screen, 140, 150, 500, 280, COLOUR_YELLOW2);
3217 rect(screen, 139, 149, 501, 281, COLOUR_YELLOW3);
3218 rect(screen, 138, 148, 502, 282, COLOUR_YELLOW4);
3219 rect(screen, 137, 147, 503, 283, COLOUR_YELLOW5);
3220 rect(screen, 136, 146, 504, 284, COLOUR_YELLOW6);
3221
3222 clear_keybuf();
3223
3224 readkey();
3225
3226 keypress_wait = KP_WAIT_SHORT;
3227
3228 }
3229
3230
3231 void push_scores_single(int insert, int play)
3232 {
3233
3234 int i = NO_SCORES - 2;
3235
3236 if (insert < NO_SCORES - 1)
3237 {
3238 for (i = NO_SCORES - 2; i > insert - 1; i --)
3239 {
3240 hs_single[i + 1].score = hs_single[i].score;
3241 hs_single[i + 1].level = hs_single[i].level;
3242 hs_single[i + 1].ship = hs_single[i].ship;
3243 strcpy(hs_single[i + 1].name, hs_single[i].name);
3244 }
3245 }
3246
3247 i ++;
3248
3249 hs_single[i].score = player[play].score;
3250 hs_single[i].level = arena.level;
3251 hs_single[i].ship = actor[player[play].actor_controlled].ship;
3252 strcpy(hs_single[i].name, "_");
3253
3254 }
3255
3256 // my attempt to use one push_scores function with pointers failed.
3257 void push_scores_coop(int insert, int play)
3258 {
3259
3260 int i = NO_SCORES - 2;
3261
3262 if (insert < NO_SCORES - 1)
3263 {
3264 for (i = NO_SCORES - 2; i > insert - 1; i --)
3265 {
3266 hs_coop[i + 1].score = hs_coop[i].score;
3267 hs_coop[i + 1].level = hs_coop[i].level;
3268 hs_coop[i + 1].ship = hs_coop[i].ship;
3269 strcpy(hs_coop[i + 1].name, hs_coop[i].name);
3270 }
3271 }
3272
3273 i ++;
3274
3275 // char istr [10];
3276
3277 hs_coop[i].score = player[play].score;
3278 hs_coop[i].level = arena.level;
3279 hs_coop[i].ship = actor[player[play].actor_controlled].ship;
3280 strcpy(hs_coop[i].name, "P");
3281 if (play == 0)
3282 strcat(hs_coop[i].name, "1");
3283 else
3284 strcat(hs_coop[i].name, "2");
3285 strcat(hs_coop[i].name, "_");
3286
3287 }
3288
3289
3290
3291 int enter_score_name_single(int s)
3292 {
3293 /* rectfill(screen, 400, 210, 550, 280, COLOUR_GREY2);
3294 rect(screen, 400, 210, 550, 280, COLOUR_GREY6);
3295 rect(screen, 401, 211, 549, 279, COLOUR_GREY5);
3296 rect(screen, 402, 212, 548, 278, COLOUR_GREY4);
3297 rect(screen, 403, 213, 547, 277, COLOUR_GREY3);
3298 textprintf_right_ex(screen, small_font, 500, 240, COLOUR_WHITE, "Press a key...");
3299 */
3300
3301
3302 // clear_keybuf();
3303
3304 char inputted; // = KEY_ESC;
3305 int shifter = key [KEY_LSHIFT] + key [KEY_RSHIFT];
3306
3307 // int i;
3308
3309 // rest(200); // to clear the enter or space key
3310
3311 // if (keypressed() != TRUE)
3312 // return 0;
3313
3314 int i;
3315
3316 for (i = KEY_A; i < KEY_CAPSLOCK + 1; i ++)
3317 {
3318 if (check_key(i))
3319 {
3320 break;
3321 }
3322 if (i == KEY_CAPSLOCK)
3323 return 0;
3324 }
3325
3326 if (i == KEY_ESC || i == KEY_ENTER || i == KEY_ENTER_PAD) // escape, enter
3327 {
3328 hs_single[s].name [strlen(hs_single[s].name) - 1] = '\0'; // remove the _
3329 keypress_wait = KP_WAIT_SHORT;
3330 menu_sound2();
3331 return 1;
3332 }
3333
3334 if (i == KEY_BACKSPACE) // backspace
3335 {
3336 if (strlen(hs_single[s].name) > 1)
3337 {
3338 hs_single[s].name [strlen(hs_single[s].name) - 2] = '\0';
3339 strcat(hs_single[s].name, "_");
3340 keypress_wait = KP_WAIT_SHORT;
3341 menu_sound1();
3342 return 0;
3343 }
3344 }
3345
3346 // inputted = readkey() & 0xff;
3347
3348 inputted = scancode_to_asc(i);
3349
3350 if (inputted == '\0')
3351 return 0;
3352
3353 // if (acceptable_name_char(inputted) == 0)
3354 // return 0;
3355
3356 if (strlen(hs_single[s].name) > SCORE_LENGTH || text_length(small_font, hs_single[s].name) > 75)
3357 return 0;
3358
3359 if (shifter != 0)
3360 {
3361 if (inputted >= 'a' && inputted <= 'z')
3362 inputted = 'A' + inputted - 'a';
3363 if (inputted >= '0' && inputted <= '9')
3364 inputted = get_shifted_number(inputted);
3365 }
3366
3367 int slen = strlen(hs_single[s].name);
3368
3369 hs_single[s].name [slen - 1] = inputted;
3370 hs_single[s].name [slen] = '\0';
3371
3372 strcat(hs_single[s].name, "_");
3373
3374 keypress_wait = KP_WAIT_SHORT;
3375 menu_sound1();
3376
3377 return 0;
3378
3379 }
3380
3381
3382 // obviously there should be 1 function for this, not 3. But I had trouble with that so here we are.
3383 int enter_score_name_ta(void)
3384 {
3385
3386 char inputted;
3387 int shifter = key [KEY_LSHIFT] + key [KEY_RSHIFT];
3388
3389 int i;
3390
3391 for (i = KEY_A; i < KEY_CAPSLOCK + 1; i ++)
3392 {
3393 if (check_key(i))
3394 {
3395 break;
3396 }
3397 if (i == KEY_CAPSLOCK)
3398 return 0;
3399 }
3400
3401 if (i == KEY_ESC || i == KEY_ENTER || i == KEY_ENTER_PAD) // escape, enter
3402 {
3403 best_ta_name [strlen(best_ta_name) - 1] = '\0'; // remove the _
3404 keypress_wait = KP_WAIT_SHORT;
3405 menu_sound2();
3406 return 1;
3407 }
3408
3409 if (i == KEY_BACKSPACE) // backspace
3410 {
3411 if (strlen(best_ta_name) > 1)
3412 {
3413 best_ta_name [strlen(best_ta_name) - 2] = '\0';
3414 strcat(best_ta_name, "_");
3415 keypress_wait = KP_WAIT_SHORT;
3416 menu_sound1();
3417 return 0;
3418 }
3419 }
3420
3421
3422 inputted = scancode_to_asc(i);
3423
3424 if (inputted == '\0')
3425 return 0;
3426
3427 if (strlen(best_ta_name) > SCORE_LENGTH || text_length(small_font, best_ta_name) > 75)
3428 return 0;
3429
3430 if (shifter != 0)
3431 {
3432 if (inputted >= 'a' && inputted <= 'z')
3433 inputted = 'A' + inputted - 'a';
3434 if (inputted >= '0' && inputted <= '9')
3435 inputted = get_shifted_number(inputted);
3436 }
3437
3438 int slen = strlen(best_ta_name);
3439
3440 best_ta_name [slen - 1] = inputted;
3441 best_ta_name [slen] = '\0';
3442
3443 strcat(best_ta_name, "_");
3444
3445 keypress_wait = KP_WAIT_SHORT;
3446 menu_sound1();
3447
3448 return 0;
3449
3450 }
3451
3452
3453
3454 int enter_score_name_coop(int s)
3455 {
3456
3457 char inputted;
3458 int shifter = key [KEY_LSHIFT] + key [KEY_RSHIFT];
3459
3460 int i;
3461
3462 for (i = KEY_A; i < KEY_CAPSLOCK + 1; i ++)
3463 {
3464 if (check_key(i))
3465 {
3466 break;
3467 }
3468 if (i == KEY_CAPSLOCK)
3469 return 0;
3470 }
3471
3472 if (i == KEY_ESC || i == KEY_ENTER || i == KEY_ENTER_PAD) // escape, enter
3473 {
3474 hs_coop[s].name [strlen(hs_coop[s].name) - 1] = '\0'; // remove the _
3475 keypress_wait = KP_WAIT_LONG;
3476 menu_sound2();
3477 return 1;
3478 }
3479
3480 if (i == KEY_BACKSPACE) // backspace
3481 {
3482 if (strlen(hs_coop[s].name) > 1)
3483 {
3484 hs_coop[s].name [strlen(hs_coop[s].name) - 2] = '\0';
3485 strcat(hs_coop[s].name, "_");
3486 keypress_wait = KP_WAIT_SHORT;
3487 menu_sound1();
3488 return 0;
3489 }
3490 }
3491
3492 inputted = scancode_to_asc(i);
3493
3494 if (inputted == '\0')
3495 return 0;
3496
3497 if (strlen(hs_coop[s].name) > SCORE_LENGTH || text_length(small_font, hs_coop[s].name) > 75)
3498 return 0;
3499
3500 if (shifter != 0)
3501 {
3502 if (inputted >= 'a' && inputted <= 'z')
3503 inputted = 'A' + inputted - 'a';
3504 if (inputted >= '0' && inputted <= '9')
3505 inputted = get_shifted_number(inputted);
3506 // if (inputted >= '0' && inputted <= '9')
3507 // inputted -= 15;
3508 }
3509
3510 int slen = strlen(hs_coop[s].name);
3511
3512 hs_coop[s].name [slen - 1] = inputted;
3513 hs_coop[s].name [slen] = '\0';
3514
3515 strcat(hs_coop[s].name, "_");
3516
3517 keypress_wait = KP_WAIT_SHORT;
3518 menu_sound1();
3519
3520 return 0;
3521
3522 }
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532 void quit_game(void)
3533 {
3534
3535 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
3536 // clrscr();
3537 // allegro_message("\n\rBye bye! ");
3538 // free(palet);/
3539 exit(0);
3540
3541 }
3542
3543 char get_shifted_number(char inputted)
3544 {
3545
3546 switch(inputted)
3547 {
3548 case '1': return '!';
3549 case '2': return '@';
3550 case '3': return '#';
3551 case '4': return '$';
3552 case '5': return '$';
3553 case '6': return '^';
3554 case '7': return '&';
3555 case '8': return '*';
3556 case '9': return '(';
3557 case '0': return ')';
3558 }
3559
3560 return inputted;
3561
3562 }
3563
3564 void jam_keys(void)
3565 {
3566
3567 char sstr [30];
3568
3569 do
3570 {
3571
3572 rectfill(menu_bmp, 180, 50, 440, 400, COLOUR_GREEN1);
3573 rect(menu_bmp, 180, 50, 440, 400, COLOUR_GREEN4);
3574 rect(menu_bmp, 179, 49, 441, 401, COLOUR_GREEN6);
3575 rect(menu_bmp, 178, 48, 442, 402, COLOUR_GREEN8);
3576
3577 textprintf_centre_ex(menu_bmp, font2, 320, 90, COLOUR_YELLOW8, -1, "{t_e_s_t}");
3578 textprintf_centre_ex(menu_bmp, font, 320, 90, -1, -1, "{t_e_s_t}");
3579 textprintf_centre_ex(menu_bmp, font2, 320, 130, COLOUR_YELLOW8, -1, "{k_e_y_s}");
3580 textprintf_centre_ex(menu_bmp, font, 320, 130, -1, -1, "{k_e_y_s}");
3581
3582 textprintf_ex(menu_bmp, small_font, 200, 210, COLOUR_YELLOW8, -1, "Most keyboards refuse to register certain");
3583 textprintf_ex(menu_bmp, small_font, 200, 220, COLOUR_YELLOW8, -1, "combinations of keys. Try pressing the keys you want");
3584 textprintf_ex(menu_bmp, small_font, 200, 230, COLOUR_YELLOW8, -1, "to use to test for conflicts. Press Escape to exit.");
3585
3586 int i;
3587 int row = 0;
3588
3589 for (i = 0; i < KEY_CAPSLOCK + 1; i ++)
3590 {
3591 if (key [i] != 0)
3592 {
3593 scancode_to_keyname(i, sstr);
3594 textprintf_ex(menu_bmp, small_font, 200, 250 + row * 10, COLOUR_ORANGE8, -1, sstr);
3595 row ++;
3596 }
3597 }
3598
3599 menu_to_screen();
3600 }
3601 while(!key [KEY_ESC]);
3602
3603 keypress_wait = KP_WAIT_LONG;
3604 last_key = KEY_ESC;
3605
3606 ticked = 0;
3607
3608 }
3609
3610
3611
3612
3613 int acceptable_char(int scode)
3614 {
3615 // if (ascode >= 32 && ascode <= 126) return 1;
3616 switch(scode)
3617 {
3618 case KEY_ESC:
3619 keypress_wait = KP_WAIT_SHORT;
3620 return 0;
3621 case KEY_ENTER:
3622 case KEY_ENTER_PAD:
3623 keypress_wait = KP_WAIT_SHORT;
3624 return 0;
3625 }
3626 return 1;
3627 }
3628
3629 int acceptable_name_char(int ascode)
3630 {
3631 if (ascode >= 32 && ascode <= 126) return 1;
3632
3633 return 0;
3634 }
3635
3636
3637 void scancode_to_keyname(int scanc, char sstr [30])
3638 {
3639
3640 switch(scanc)
3641 {
3642 case KEY_A: strcpy(sstr, " a"); break;
3643 case KEY_B: strcpy(sstr, " b"); break;
3644 case KEY_C: strcpy(sstr, " c"); break;
3645 case KEY_D: strcpy(sstr, " d"); break;
3646 case KEY_E: strcpy(sstr, " e"); break;
3647 case KEY_F: strcpy(sstr, " f"); break;
3648 case KEY_G: strcpy(sstr, " g"); break;
3649 case KEY_H: strcpy(sstr, " h"); break;
3650 case KEY_I: strcpy(sstr, " i"); break;
3651 case KEY_J: strcpy(sstr, " j"); break;
3652 case KEY_K: strcpy(sstr, " k"); break;
3653 case KEY_L: strcpy(sstr, " l"); break;
3654 case KEY_M: strcpy(sstr, " m"); break;
3655 case KEY_N: strcpy(sstr, " n"); break;
3656 case KEY_O: strcpy(sstr, " o"); break;
3657 case KEY_P: strcpy(sstr, " p"); break;
3658 case KEY_Q: strcpy(sstr, " q"); break;
3659 case KEY_R: strcpy(sstr, " r"); break;
3660 case KEY_S: strcpy(sstr, " s"); break;
3661 case KEY_T: strcpy(sstr, " t"); break;
3662 case KEY_U: strcpy(sstr, " u"); break;
3663 case KEY_V: strcpy(sstr, " v"); break;
3664 case KEY_W: strcpy(sstr, " w"); break;
3665 case KEY_X: strcpy(sstr, " x"); break;
3666 case KEY_Y: strcpy(sstr, " y"); break;
3667 case KEY_Z: strcpy(sstr, " z"); break;
3668 case KEY_0: strcpy(sstr, " 0"); break;
3669 case KEY_1: strcpy(sstr, " 1"); break;
3670 case KEY_2: strcpy(sstr, " 2"); break;
3671 case KEY_3: strcpy(sstr, " 3"); break;
3672 case KEY_4: strcpy(sstr, " 4"); break;
3673 case KEY_5: strcpy(sstr, " 5"); break;
3674 case KEY_6: strcpy(sstr, " 6"); break;
3675 case KEY_7: strcpy(sstr, " 7"); break;
3676 case KEY_8: strcpy(sstr, " 8"); break;
3677 case KEY_9: strcpy(sstr, " 9"); break;
3678 case KEY_0_PAD: strcpy(sstr, " Numpad Ins"); break;
3679 case KEY_1_PAD: strcpy(sstr, " Numpad 1"); break;
3680 case KEY_2_PAD: strcpy(sstr, " Numpad 2"); break;
3681 case KEY_3_PAD: strcpy(sstr, " Numpad 3"); break;
3682 case KEY_4_PAD: strcpy(sstr, " Numpad 4"); break;
3683 case KEY_5_PAD: strcpy(sstr, " Numpad 5"); break;
3684 case KEY_6_PAD: strcpy(sstr, " Numpad 6"); break;
3685 case KEY_7_PAD: strcpy(sstr, " Numpad 7"); break;
3686 case KEY_8_PAD: strcpy(sstr, " Numpad 8"); break;
3687 case KEY_9_PAD: strcpy(sstr, " Numpad 9"); break;
3688 case KEY_F1: strcpy(sstr, " F1"); break;
3689 case KEY_F2: strcpy(sstr, " F2"); break;
3690 case KEY_F3: strcpy(sstr, " F3"); break;
3691 case KEY_F4: strcpy(sstr, " F4"); break;
3692 case KEY_F5: strcpy(sstr, " F5"); break;
3693 case KEY_F6: strcpy(sstr, " F6"); break;
3694 case KEY_F7: strcpy(sstr, " F7"); break;
3695 case KEY_F8: strcpy(sstr, " F8"); break;
3696 case KEY_F9: strcpy(sstr, " F9"); break;
3697 case KEY_F10: strcpy(sstr, " F10"); break;
3698 case KEY_F11: strcpy(sstr, " F11"); break;
3699 case KEY_F12: strcpy(sstr, " F12"); break;
3700 case KEY_ESC: strcpy(sstr, " Escape"); break; // invalid!
3701 case KEY_TILDE: strcpy(sstr, " `"); break;
3702 case KEY_MINUS: strcpy(sstr, " -"); break;
3703 case KEY_EQUALS: strcpy(sstr, " ="); break;
3704 case KEY_BACKSPACE: strcpy(sstr, " Backspace"); break;
3705 case KEY_TAB: strcpy(sstr, " Tab"); break;
3706 case KEY_OPENBRACE: strcpy(sstr, " {"); break;
3707 case KEY_CLOSEBRACE: strcpy(sstr, " }"); break;
3708 case KEY_ENTER: strcpy(sstr, " Enter"); break;
3709 case KEY_COLON: strcpy(sstr, " ;"); break;
3710 case KEY_QUOTE: strcpy(sstr, " '"); break;
3711 case KEY_BACKSLASH: strcpy(sstr, " \\"); break;
3712 case KEY_BACKSLASH2: strcpy(sstr, " \\"); break; // ????
3713 case KEY_COMMA: strcpy(sstr, " ,"); break;
3714 case KEY_STOP: strcpy(sstr, " ."); break;
3715 case KEY_SLASH: strcpy(sstr, " /"); break;
3716 case KEY_SPACE: strcpy(sstr, " Space"); break;
3717 case KEY_INSERT: strcpy(sstr, " Insert"); break;
3718 case KEY_DEL: strcpy(sstr, " Delete"); break;
3719 case KEY_HOME: strcpy(sstr, " Home"); break;
3720 case KEY_END: strcpy(sstr, " End"); break;
3721 case KEY_PGUP: strcpy(sstr, " Page Up"); break;
3722 case KEY_PGDN: strcpy(sstr, " Page Down"); break;
3723 case KEY_LEFT: strcpy(sstr, " Left"); break;
3724 case KEY_RIGHT: strcpy(sstr, " Right"); break;
3725 case KEY_UP: strcpy(sstr, " Up"); break;
3726 case KEY_DOWN: strcpy(sstr, " Down"); break;
3727 case KEY_SLASH_PAD: strcpy(sstr, " Keypad /"); break;
3728 case KEY_ASTERISK: strcpy(sstr, " Keypad *"); break;
3729 case KEY_MINUS_PAD: strcpy(sstr, " Keypad -"); break;
3730 case KEY_PLUS_PAD: strcpy(sstr, " Keypad +"); break;
3731 case KEY_DEL_PAD: strcpy(sstr, " Keypad ."); break;
3732 case KEY_ENTER_PAD: strcpy(sstr, " Keypad Enter"); break;
3733 case KEY_PRTSCR: strcpy(sstr, " Print Screen"); break;
3734 case KEY_PAUSE: strcpy(sstr, " Pause"); break;
3735 case KEY_ABNT_C1: strcpy(sstr, " Weird Foreign Key"); break; // may as well put these in
3736 case KEY_YEN: strcpy(sstr, " Yen"); break;
3737 case KEY_KANA: strcpy(sstr, " Kana"); break;
3738 case KEY_CONVERT: strcpy(sstr, " Convert"); break;
3739 case KEY_NOCONVERT: strcpy(sstr, " NOCONVERT"); break;
3740 case KEY_AT: strcpy(sstr, " At"); break;
3741 case KEY_CIRCUMFLEX: strcpy(sstr, " Circumflex"); break;
3742 case KEY_COLON2: strcpy(sstr, " 2nd Colon"); break;
3743 case KEY_KANJI: strcpy(sstr, " Kanji"); break;
3744 case KEY_LSHIFT: strcpy(sstr, " Left Shift"); break;
3745 case KEY_RSHIFT: strcpy(sstr, " Right Shift"); break;
3746 case KEY_LCONTROL: strcpy(sstr, " Left Control"); break;
3747 case KEY_RCONTROL: strcpy(sstr, " Right Control"); break;
3748 case KEY_ALT: strcpy(sstr, " Left Alt"); break;
3749 case KEY_ALTGR: strcpy(sstr, " Right Alt"); break;
3750 case KEY_LWIN: strcpy(sstr, " Left Win"); break;
3751 case KEY_RWIN: strcpy(sstr, " Right Win"); break;
3752 case KEY_MENU: strcpy(sstr, " Menu"); break;
3753 case KEY_SCRLOCK: strcpy(sstr, " Scroll Lock"); break;
3754 case KEY_NUMLOCK: strcpy(sstr, " Num Lock"); break;
3755 case KEY_CAPSLOCK: strcpy(sstr, " Caps Lock"); break;
3756 //case KEY_: strcpy(sstr, " "); break;
3757
3758 default: strcpy(sstr, " unknown key"); break;
3759
3760 /*
3761
3762 KEY_ESC, KEY_TILDE, KEY_MINUS, KEY_EQUALS,
3763 KEY_BACKSPACE, KEY_TAB, KEY_OPENBRACE, KEY_CLOSEBRACE,
3764 KEY_ENTER, KEY_COLON, KEY_QUOTE, KEY_BACKSLASH,
3765 KEY_BACKSLASH2, KEY_COMMA, KEY_STOP, KEY_SLASH,
3766 KEY_SPACE,
3767
3768 */
3769
3770 }
3771
3772
3773 }
3774
3775
3776
3777 char scancode_to_asc(int scanc)
3778 {
3779
3780 switch(scanc)
3781 {
3782 case KEY_A: return 'a';
3783 case KEY_B: return 'b';
3784 case KEY_C: return 'c';
3785 case KEY_D: return 'd';
3786 case KEY_E: return 'e';
3787 case KEY_F: return 'f';
3788 case KEY_G: return 'g';
3789 case KEY_H: return 'h';
3790 case KEY_I: return 'i';
3791 case KEY_J: return 'j';
3792 case KEY_K: return 'k';
3793 case KEY_L: return 'l';
3794 case KEY_M: return 'm';
3795 case KEY_N: return 'n';
3796 case KEY_O: return 'o';
3797 case KEY_P: return 'p';
3798 case KEY_Q: return 'q';
3799 case KEY_R: return 'r';
3800 case KEY_S: return 's';
3801 case KEY_T: return 't';
3802 case KEY_U: return 'u';
3803 case KEY_V: return 'v';
3804 case KEY_W: return 'w';
3805 case KEY_X: return 'x';
3806 case KEY_Y: return 'y';
3807 case KEY_Z: return 'z';
3808 case KEY_0: return '0';
3809 case KEY_1: return '1';
3810 case KEY_2: return '2';
3811 case KEY_3: return '3';
3812 case KEY_4: return '4';
3813 case KEY_5: return '5';
3814 case KEY_6: return '6';
3815 case KEY_7: return '7';
3816 case KEY_8: return '8';
3817 case KEY_9: return '9';
3818 case KEY_TILDE: return '`';
3819 case KEY_MINUS: return '-';
3820 case KEY_EQUALS: return '=';
3821 case KEY_OPENBRACE: return '{';
3822 case KEY_CLOSEBRACE: return '}';
3823 case KEY_COLON: return ';';
3824 case KEY_QUOTE: return '\'';
3825 case KEY_BACKSLASH: return '\\';
3826 case KEY_BACKSLASH2: return '\\'; // ????
3827 case KEY_COMMA: return ',';
3828 case KEY_STOP: return '.';
3829 case KEY_SLASH: return '/';
3830 case KEY_SPACE: return ' ';
3831 case KEY_SLASH_PAD: return '/';
3832 case KEY_ASTERISK: return '*';
3833 case KEY_MINUS_PAD: return '-';
3834 case KEY_PLUS_PAD: return '+';
3835
3836 default: return '\0';
3837
3838 /*
3839
3840 KEY_ESC, KEY_TILDE, KEY_MINUS, KEY_EQUALS,
3841 KEY_BACKSPACE, KEY_TAB, KEY_OPENBRACE, KEY_CLOSEBRACE,
3842 KEY_ENTER, KEY_COLON, KEY_QUOTE, KEY_BACKSLASH,
3843 KEY_BACKSLASH2, KEY_COMMA, KEY_STOP, KEY_SLASH,
3844 KEY_SPACE,
3845
3846 */
3847
3848 }
3849
3850 return '\0';
3851
3852
3853 }
3854
3855 void init_config(void)
3856 {
3857
3858 // set_config is in main.c
3859
3860 char miscstring [40];
3861 char wstring [40];
3862 char itstring [40];
3863 int i;
3864
3865
3866 options.sound_init = get_config_int("Options", "Sound_init", 1);
3867 options.sound_mode = get_config_int("Options", "Sound_mode", SOUNDMODE_STEREO);
3868 options.run_vsync = get_config_int("Options", "Run_vsync", 0);
3869 options.sound_volume = get_config_int("Options", "Sound_volume", 100);
3870 options.ambience_volume = get_config_int("Options", "Ambience_volume", 100);
3871 options.colour_text = get_config_int("Options", "Colour_text", 0);
3872
3873 options.unlock_purple = get_config_int("Unlock", "Purple", 0);
3874 options.unlock_void = get_config_int("Unlock", "Void", 0);
3875 options.unlock_god = get_config_int("Unlock", "God", 0);
3876 // resolution is got in main.c
3877
3878 for (i = 0; i < NO_CMDS; i ++)
3879 {
3880 strcpy(wstring, "Player1Keys");
3881 strcpy(miscstring, "Key");
3882 // strcpy(itstring, "");
3883 anum(miscstring, i);
3884 // strcat(miscstring, itoa(i, itstring, 10));
3885 player[0].keys [i] = get_config_int(wstring, miscstring, KEY_X);
3886 }
3887
3888 for (i = 0; i < NO_CMDS; i ++)
3889 {
3890 strcpy(wstring, "Player2Keys");
3891 strcpy(miscstring, "Key");
3892 // strcpy(itstring, "");
3893 // strcat(miscstring, itoa(i, itstring, 10));
3894 anum(miscstring, i);
3895 player[1].keys [i] = get_config_int(wstring, miscstring, KEY_SPACE);
3896 }
3897
3898 for (i = 0; i < NO_SCORES; i ++)
3899 {
3900 strcpy(wstring, "Highscores_single");
3901 strcpy(miscstring, "Score");
3902 strcpy(itstring, "");
3903 // strcat(miscstring, itoa(i, itstring, 10));
3904 anum(miscstring, i);
3905 hs_single[i].score = get_config_int(wstring, miscstring, 100);
3906 strcpy(miscstring, "Level");
3907 strcpy(itstring, "");
3908 // strcat(miscstring, itoa(i, itstring, 10));
3909 anum(miscstring, i);
3910 hs_single[i].level = get_config_int(wstring, miscstring, 1);
3911 strcpy(miscstring, "Ship");
3912 strcpy(itstring, "");
3913 // strcat(miscstring, itoa(i, itstring, 10));
3914 anum(miscstring, i);
3915 hs_single[i].ship = 0;//get_config_int(wstring, miscstring, SHIP_POINTY);
3916 strcpy(miscstring, "Name");
3917 strcpy(itstring, "");
3918 // strcat(miscstring, itoa(i, itstring, 10));
3919 anum(miscstring, i);
3920 strcpy(hs_single[i].name, get_config_string(wstring, miscstring, "Nobody"));
3921 strcpy(wstring, "Highscores_Coop");
3922 strcpy(miscstring, "Score");
3923 strcpy(itstring, "");
3924 // strcat(miscstring, itoa(i, itstring, 10));
3925 anum(miscstring, i);
3926 hs_coop[i].score = get_config_int(wstring, miscstring, 100);
3927 strcpy(miscstring, "Level");
3928 strcpy(itstring, "");
3929 // strcat(miscstring, itoa(i, itstring, 10));
3930 anum(miscstring, i);
3931 hs_coop[i].level = get_config_int(wstring, miscstring, 1);
3932 strcpy(miscstring, "Ship");
3933 strcpy(itstring, "");
3934 // strcat(miscstring, itoa(i, itstring, 10));
3935 anum(miscstring, i);
3936 hs_coop[i].ship = 0;//get_config_int(wstring, miscstring, SHIP_POINTY);
3937 strcpy(miscstring, "Name");
3938 strcpy(itstring, "");
3939 // strcat(miscstring, itoa(i, itstring, 10));
3940 anum(miscstring, i);
3941 strcpy(hs_coop[i].name, get_config_string(wstring, miscstring, "Nobody"));
3942 }
3943
3944 best_ta_time = get_config_int("Highscores_TA", "best_time", 1000);
3945 strcpy(best_ta_name, get_config_string("Highscores_TA", "best_name", "Nobody"));
3946
3947 }
3948
3949 void save_config(void)
3950 {
3951 char miscstring [40];
3952 char wstring [40];
3953 char itstring [40];
3954 int i;
3955
3956 // options.sound_init = get_config_int("Options", "Sound_init", 1);
3957 set_config_int("Options", "Sound_mode", options.sound_mode);
3958 set_config_int("Options", "Run_vsync", options.run_vsync);
3959 set_config_int("Options", "Sound_volume", options.sound_volume);
3960 set_config_int("Options", "Ambience_volume", options.ambience_volume);
3961 set_config_int("Options", "Resolution", options.resolution);
3962 set_config_int("Options", "Colour_text", options.colour_text);
3963
3964 for (i = 0; i < NO_CMDS; i ++)
3965 {
3966 strcpy(wstring, "Player1Keys");
3967 strcpy(miscstring, "Key");
3968 strcpy(itstring, "");
3969 // strcat(miscstring, itoa(i, itstring, 10));
3970 anum(miscstring, i);
3971 set_config_int(wstring, miscstring, player[0].keys [i]);
3972 }
3973
3974 for (i = 0; i < NO_CMDS; i ++)
3975 {
3976 strcpy(wstring, "Player2Keys");
3977 strcpy(miscstring, "Key");
3978 strcpy(itstring, "");
3979 // strcat(miscstring, itoa(i, itstring, 10));
3980 anum(miscstring, i);
3981 set_config_int(wstring, miscstring, player[1].keys [i]);
3982 }
3983
3984
3985 for (i = 0; i < NO_SCORES; i ++)
3986 {
3987 strcpy(wstring, "Highscores_single");
3988 strcpy(miscstring, "Score");
3989 strcpy(itstring, "");
3990 // strcat(miscstring, itoa(i, itstring, 10));
3991 anum(miscstring, i);
3992 set_config_int(wstring, miscstring, hs_single[i].score);
3993 strcpy(miscstring, "Level");
3994 strcpy(itstring, "");
3995 // strcat(miscstring, itoa(i, itstring, 10));
3996 anum(miscstring, i);
3997 set_config_int(wstring, miscstring, hs_single[i].level);
3998 /* strcpy(miscstring, "Ship");
3999 strcpy(itstring, "");
4000 strcat(miscstring, itoa(i, itstring, 10));
4001 set_config_int(wstring, miscstring, hs_single[i].ship);*/
4002 strcpy(miscstring, "Name");
4003 strcpy(itstring, "");
4004 // strcat(miscstring, itoa(i, itstring, 10));
4005 anum(miscstring, i);
4006 set_config_string(wstring, miscstring, hs_single[i].name);
4007
4008 strcpy(wstring, "Highscores_Coop");
4009 strcpy(miscstring, "Score");
4010 strcpy(itstring, "");
4011 // strcat(miscstring, itoa(i, itstring, 10));
4012 anum(miscstring, i);
4013 set_config_int(wstring, miscstring, hs_coop[i].score);
4014 strcpy(miscstring, "Level");
4015 strcpy(itstring, "");
4016 // strcat(miscstring, itoa(i, itstring, 10));
4017 anum(miscstring, i);
4018 set_config_int(wstring, miscstring, hs_coop[i].level);
4019 /* strcpy(miscstring, "Ship");
4020 strcpy(itstring, "");
4021 strcat(miscstring, itoa(i, itstring, 10));
4022 set_config_int(wstring, miscstring, hs_coop[i].ship);*/
4023 strcpy(miscstring, "Name");
4024 strcpy(itstring, "");
4025 // strcat(miscstring, itoa(i, itstring, 10));
4026 anum(miscstring, i);
4027 set_config_string(wstring, miscstring, hs_coop[i].name);
4028 }
4029
4030 set_config_int("Highscores_TA", "best_time", best_ta_time);
4031 set_config_string("Highscores_TA", "best_name", best_ta_name);
4032
4033 }
4034
4035
4036 char *ship_name_long(int ship)
4037 {
4038
4039 switch(ship)
4040 {
4041 /* case SHIP_LACEWING: return "lacewing}";
4042 case SHIP_CAPYBARA: return "capybara}";
4043 case SHIP_DESPOT: return "despot}";
4044 case SHIP_HOOKWORM: return "hookworm}";
4045 case SHIP_LENTIL: return "lentil}";
4046 case SHIP_PORKUPINE: return "porkupine}";
4047 case SHIP_PRONG: return "prong}";
4048 case SHIP_SCORPION: return "false} scorpion}";
4049 case SHIP_TORTFEASOR: return "tortfeasor}";
4050 case SHIP_AETHER: return "aether} squid}";
4051 case SHIP_RUMSFELD: return "rumsfeld's} delight}";
4052 case SHIP_GODBOTHERER: return "godbotherer}";
4053 case SHIP_BOTULUS: return "botulus}";
4054 case SHIP_SLIDEWINDER: return "slidewinder}";
4055 case SHIP_DOOM: return "doom} fork}";*/
4056 default: return "{random}";
4057 }
4058 }
4059
4060 char *ship_name_short(int ship)
4061 {
4062
4063 switch(ship)
4064 {
4065 /* case SHIP_LACEWING: return "Lacewing";
4066 case SHIP_CAPYBARA: return "Capybara";
4067 case SHIP_DESPOT: return "Despot";
4068 case SHIP_HOOKWORM: return "Hookworm";
4069 case SHIP_LENTIL: return "Lentil";
4070 case SHIP_PORKUPINE: return "Porkupine";
4071 case SHIP_PRONG: return "Prong";
4072 case SHIP_SCORPION: return "False Scorpion";
4073 case SHIP_TORTFEASOR: return "Tortfeasor";
4074 case SHIP_AETHER: return "Aether Squid";
4075 case SHIP_RUMSFELD: return "Rumsfeld's Delight";
4076 case SHIP_GODBOTHERER: return "Godbotherer";
4077 case SHIP_BOTULUS: return "Botulus";
4078 case SHIP_SLIDEWINDER: return "Slidewinder";
4079 case SHIP_DOOM: return "Doom Fork";*/
4080 default: return "Unknown";
4081 }
4082 }
4083
4084 void ship_description1(int ship, char dstr [200])
4085 {
4086 strcpy(dstr, "");
4087
4088 switch(ship)
4089 {
4090 case SHIP_POINTY: strcpy(dstr, "This vehicle uses special silver darts"); break;
4091 case SHIP_HORSESHOE: strcpy(dstr, "This vehicle's secondary weapon"); break;
4092 case SHIP_ROUND: strcpy(dstr, "This vehicle is capable of"); break;
4093 case SHIP_RETRO: strcpy(dstr, "This vehicle has an extra"); break;
4094 case SHIP_SMALL: strcpy(dstr, "This vehicle is especially small"); break;
4095 case SHIP_FINS: strcpy(dstr, "This vehicle has an additional set of"); break;
4096 case SHIP_ORBITAL: strcpy(dstr, "This vehicle carries a device which reduces"); break;
4097 case SHIP_CURVE: strcpy(dstr, "This vehicle causes an explosion on contact with an enemy."); break;
4098 default: strcpy(dstr, "Choose a random vehicle.");
4099 }
4100
4101
4102 }
4103
4104 void ship_description2(int ship, char dstr [200])
4105 {
4106 strcpy(dstr, "");
4107
4108 switch(ship)
4109 {
4110 case SHIP_POINTY: strcpy(dstr, "which are particularly painful to your enemies."); break;
4111 case SHIP_HORSESHOE: strcpy(dstr, "replenishes itself at an unusually rapid rate."); break;
4112 case SHIP_ROUND: strcpy(dstr, "repairing damaged armour or structure."); break;
4113 case SHIP_RETRO: strcpy(dstr, "engine outlet instead of a brake."); break;
4114 case SHIP_SMALL: strcpy(dstr, "and difficult for enemies to hit."); break;
4115 case SHIP_FINS: strcpy(dstr, "dart-throwers mounted to face backwards"); break;
4116 case SHIP_ORBITAL: strcpy(dstr, "acceleration from being struck by objects or energy."); break;
4117 case SHIP_CURVE: strcpy(dstr, "The power of the explosion increases as you accumulate symbols."); break;
4118 default: return;
4119 }
4120 }
4121
4122
4123
4124
4125
4126
4127 void display_victory_screen(void)
4128 {
4129
4130 int county = 0;
4131 int county2 = 0;
4132
4133 init_ms();
4134 init_pyro();
4135
4136 do
4137 {
4138 menu_counter ++;
4139 make_grid_scroll();
4140 run_pyros();
4141 run_sparkles();
4142 make_ms_move();
4143
4144 if (ticked == 0)
4145 {
4146 clear_bitmap(menu_bmp);
4147 show_grid(COLOUR_PURPLE3, COLOUR_PURPLE8);
4148 draw_ms();
4149 draw_sparkles();
4150 textprintf_centre_ex(menu_bmp, font2, 320, 40, COLOUR_YELLOW8 - (menu_counter / 4) % 4, -1, "{__victory__}");
4151 textprintf_centre_ex(menu_bmp, font, 320, 40, -1, -1, "{__victory__}");
4152 textprintf_centre_ex(menu_bmp, small_font, 320, 100, COLOUR_YELLOW8, -1, "You have defeated the enslavers of humanity");
4153 textprintf_centre_ex(menu_bmp, small_font, 320, 115, COLOUR_YELLOW8, -1, "and may now take your place among those who survive!");
4154 // textprintf_centre_ex(menu_bmp, small_font, 320, 230, COLOUR_YELLOW8, -1, "You may now take your place ");
4155 textprintf_centre_ex(menu_bmp, small_font, 320, 135, COLOUR_YELLOW8, -1, "Congratulations!");
4156
4157 if (county2 > 99)
4158 textprintf_centre_ex(menu_bmp, small_font, 320, 420, COLOUR_YELLOW5, -1, "Press Space to continue.");
4159 vsync();
4160 menu_to_screen();
4161 }
4162
4163 do
4164 {
4165 county ++;
4166 } while (ticked == 0);
4167
4168 ticked --;
4169
4170 county2 ++;
4171
4172 if (county2 > 99 && key [KEY_SPACE] != 0)
4173 {
4174 last_key = KEY_SPACE;
4175 break;
4176 }
4177
4178 }
4179 while(TRUE);
4180 }
4181
4182
4183 // pyrotechnics!
4184 void init_pyro(void)
4185 {
4186 int i;
4187
4188 for (i = 0; i < NO_PYROS; i ++)
4189 {
4190 pyro[i].type = PYRO_NONE;
4191 }
4192
4193 for (i = 0; i < NO_SPARKLES; i ++)
4194 {
4195 sparkle[i].type = SPARKLE_NONE;
4196 }
4197
4198 next_pyro = 10 + grand(20);
4199
4200 }
4201
4202 void run_pyros(void)
4203 {
4204
4205 next_pyro --;
4206
4207 if (next_pyro <= 0)
4208 {
4209 int angle = grand(ANGLE_FULL);
4210 int speed = 7000 + grand(4000);
4211 int colours [4] = {TRANS_YELLOW, TRANS_ORANGE, TRANS_LRED, TRANS_DRED};
4212 colourify(colours);
4213 int x = 320000 + xpart(angle, ms_circle_rad * GRAIN);
4214 int y = 240000 + ypart(angle, ms_circle_rad * GRAIN);
4215 int size = 50 + grand(50);
4216 int type = PYRO_SPLIT1;
4217 if (grand(5) == 0)
4218 type = PYRO_ENDING;
4219 if (grand(10) == 0)
4220 type = PYRO_SPLIT2;
4221 create_pyro(x, y,
4222 xpart(angle, speed), ypart(angle, speed), type, colours, size, 3000 + grand(6000), 30 + grand(20));
4223 pyro_sound(x, size);
4224 size *= 3;
4225 create_sparkle(x, y, 0, 0, SPARKLE_CIRCLE, colours [0], size, 12 + grand(2));
4226 create_sparkle(x, y, 0, 0, SPARKLE_CIRCLE, colours [1], size + 2, 10 + grand(2));
4227 create_sparkle(x, y, 0, 0, SPARKLE_CIRCLE, colours [2], size + 4, 8 + grand(2));
4228 create_sparkle(x, y, 0, 0, SPARKLE_CIRCLE, colours [3], size + 6, 6 + grand(2));
4229 next_pyro = 20 + grand(40);
4230 }
4231
4232 manage_pyros();
4233
4234 }
4235
4236 void colourify(int col [4])
4237 {
4238
4239 switch(grand(16))
4240 {
4241 default:
4242 case 0:
4243 case 1:
4244 case 2:
4245 case 3:
4246 case 4:
4247 case 5:
4248 col [0] = TRANS_YELLOW;
4249 col [1] = TRANS_ORANGE;
4250 col [2] = TRANS_LRED;
4251 col [3] = TRANS_DRED;
4252 break;
4253 case 6:
4254 case 7:
4255 case 8:
4256 case 9:
4257 col [0] = TRANS_WHITE;
4258 col [1] = TRANS_YELLOW;
4259 col [2] = TRANS_ORANGE;
4260 col [3] = TRANS_LRED;
4261 break;
4262 case 10:
4263 case 11:
4264 col [0] = TRANS_YELLOW;
4265 col [1] = TRANS_LGREEN;
4266 col [2] = TRANS_DGREEN;
4267 col [3] = TRANS_DGREEN;
4268 break;
4269 case 12:
4270 col [0] = TRANS_WHITE;
4271 col [1] = TRANS_YELLOW;
4272 col [2] = TRANS_LGREEN;
4273 col [3] = TRANS_DGREEN;
4274 break;
4275 case 13:
4276 col [0] = TRANS_WHITE;
4277 col [1] = TRANS_LBLUE;
4278 col [2] = TRANS_DBLUE;
4279 col [3] = TRANS_DBLUE;
4280 break;
4281 case 14:
4282 col [0] = TRANS_WHITE;
4283 col [1] = TRANS_LGREY;
4284 col [2] = TRANS_DGREY;
4285 col [3] = TRANS_DGREY;
4286 break;
4287 case 15:
4288 col [0] = TRANS_WHITE;
4289 col [1] = TRANS_PURPLE;
4290 col [2] = TRANS_LBLUE;
4291 col [3] = TRANS_DBLUE;
4292 break;
4293 }
4294
4295 }
4296
4297 void manage_pyros(void)
4298 {
4299 int i, x, y, size;
4300
4301 for (i = 0; i < NO_PYROS; i ++)
4302 {
4303 if (pyro[i].type == PYRO_NONE)
4304 continue;
4305 pyro[i].x += pyro[i].x_speed;
4306 pyro[i].y += pyro[i].y_speed;
4307 drag_pyro(i);
4308 x = pyro[i].x + grand(pyro[i].dist) - grand(pyro[i].dist);
4309 y = pyro[i].y + grand(pyro[i].dist) - grand(pyro[i].dist);
4310 size = pyro[i].size + grand(pyro[i].size);
4311 create_sparkle(x, y, pyro[i].x_speed, pyro[i].y_speed, SPARKLE_CIRCLE, pyro[i].colours [0], size, 12 + grand(4));
4312 create_sparkle(x, y, pyro[i].x_speed, pyro[i].y_speed, SPARKLE_CIRCLE, pyro[i].colours [1], size, 7 + grand(3));
4313 create_sparkle(x, y, pyro[i].x_speed, pyro[i].y_speed, SPARKLE_CIRCLE, pyro[i].colours [2], size, 4 + grand(2));
4314 create_sparkle(x, y, pyro[i].x_speed, pyro[i].y_speed, SPARKLE_CIRCLE, pyro[i].colours [3], size, 2 + grand(2));
4315 pyro[i].timeout --;
4316 if (pyro[i].timeout <= 0)
4317 {
4318 if (pyro[i].type != PYRO_ENDING)
4319 pyro_burst(i);
4320 destroy_pyro(i);
4321 }
4322 }
4323
4324 }
4325
4326 void pyro_burst(int p)
4327 {
4328 int i;
4329 int number = 2 + grand(5);
4330 int angle_dist = ANGLE_FULL / number;
4331 int start_angle = grand(ANGLE_FULL);
4332 int rand_angle = 0;
4333 if (grand(4) == 0)
4334 rand_angle = grand(ANGLE_QUARTER);
4335 int size = (pyro[p].size / 2) + grand(pyro[p].size / 2);
4336 int dist = (pyro[p].size / 2) + grand(pyro[p].size / 2);
4337 int timeout = 20 + grand(15);
4338 int rand_timeout = 0;
4339 if (grand(4) == 0)
4340 rand_timeout = grand(20);
4341 int speed = 5000 + grand(3000);
4342 int rand_speed = 0;
4343 if (grand(4) == 0)
4344 rand_speed = grand(5000);
4345 int rand_colour = 0;
4346 if (grand(8) == 0)
4347 rand_colour = 1;
4348
4349
4350 int angle = 0;
4351 int type = PYRO_ENDING;
4352 if (pyro[p].type == PYRO_SPLIT2)
4353 type = PYRO_SPLIT1;
4354
4355 if (grand(4) == 0)
4356 colourify(pyro[p].colours);
4357
4358 for (i = 0; i < number; i ++)
4359 {
4360 angle = start_angle + (i * angle_dist) + grand(rand_angle) - grand(rand_angle);
4361 if (pyro[p].type == PYRO_RANDSPLIT)
4362 {
4363 type = PYRO_ENDING;
4364 if (grand(3) == 0)
4365 type = PYRO_SPLIT1;
4366 if (grand(19) == 0)
4367 type = PYRO_SPLIT2;
4368 }
4369 if (rand_colour == 1)
4370 colourify(pyro[p].colours);
4371 create_pyro(pyro[p].x, pyro[p].y, xpart(angle, speed + grand(rand_speed)), ypart(angle, speed + grand(rand_speed)), type, pyro[p].colours, size, dist, timeout + grand(rand_timeout));
4372 }
4373
4374 pyro_sound(pyro[p].x, pyro[p].size);
4375
4376
4377 }
4378
4379 void create_pyro(int x, int y, int xs, int ys, int type, int colours [4], int size, int dist, int timeout)
4380 {
4381 int i;
4382 for (i = 0; i < NO_PYROS; i ++)
4383 {
4384 if (i == NO_PYROS - 1)
4385 return;
4386 if (pyro[i].type == PYRO_NONE)
4387 break;
4388 }
4389
4390 pyro[i].x = x;
4391 pyro[i].y = y;
4392 pyro[i].x_speed = xs;
4393 pyro[i].y_speed = ys;
4394 pyro[i].colours [0] = colours [0];
4395 pyro[i].colours [1] = colours [1];
4396 pyro[i].colours [2] = colours [2];
4397 pyro[i].colours [3] = colours [3];
4398 pyro[i].size = size;
4399 pyro[i].dist = dist;
4400 pyro[i].timeout = timeout;
4401 pyro[i].type = type;
4402
4403 // textprintf_centre_ex(screen, small_font, 320, 300, COLOUR_YELLOW8, -1, "new pyro %i %i %i %i %i %i", x, y, xs, ys, size, timeout);
4404 // rest(500);
4405
4406 }
4407
4408 void pyro_sound(int x, int size)
4409 {
4410 int pan = 127;
4411
4412 if (options.sound_mode == SOUNDMODE_STEREO || options.sound_mode == SOUNDMODE_REVERSED)
4413 {
4414 x = x / 640;
4415 x *= 255;
4416 x /= 1000;
4417 // x -= 127;
4418 pan = x;
4419 if (pan <= 0)
4420 pan = 0;
4421 if (pan >= 255)
4422 pan = 255;
4423 if (options.sound_mode != SOUNDMODE_REVERSED)
4424 pan = 255 - pan;
4425 }
4426
4427 int pitch = 1400 + grand(100) - (size * 10);
4428 if (pitch <= 100)
4429 pitch = 100;
4430
4431 // textprintf_centre_ex(screen, small_font, 320, 300, COLOUR_YELLOW8, -1, "%i", pan);
4432 // rest(300);
4433 play_wav2(NWAV_BURST, pitch, 150 + grand(100), pan);
4434
4435 }
4436
4437 void run_sparkles(void)
4438 {
4439 int i;
4440
4441 for (i = 0; i < NO_SPARKLES; i ++)
4442 {
4443 if (sparkle[i].type == SPARKLE_NONE)
4444 continue;
4445 sparkle[i].x += sparkle[i].x_speed;
4446 sparkle[i].y += sparkle[i].y_speed;
4447 drag_sparkle(i);
4448 sparkle[i].size -= sparkle[i].tickrate;//= 10;
4449 if (sparkle[i].size <= 0)
4450 destroy_sparkle(i);
4451 }
4452 }
4453
4454 void draw_sparkles(void)
4455 {
4456 int i;
4457
4458 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
4459
4460 for (i = 0; i < NO_SPARKLES; i ++)
4461 {
4462 if (sparkle[i].type == SPARKLE_NONE)
4463 continue;
4464 // circlefill(menu_bmp, sparkle[i].x / GRAIN, sparkle[i].y / GRAIN, 10, TRANS_YELLOW);
4465 circlefill(menu_bmp, sparkle[i].x / GRAIN, sparkle[i].y / GRAIN, sparkle[i].size / 10, sparkle[i].colour);
4466 }
4467
4468 for (i = 0; i < NO_PYROS; i ++)
4469 {
4470 if (pyro[i].type != PYRO_NONE)
4471 draw_a_light(menu_bmp, (pyro[i].size / 5) + grand(15), pyro[i].x / GRAIN, pyro[i].y / GRAIN); // in display.cc
4472 }
4473
4474
4475 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
4476
4477 }
4478
4479
4480 void create_sparkle(int x, int y, int xs, int ys, int type, int colour, int size, int tickrate)
4481 {
4482 int i;
4483 for (i = 0; i < NO_SPARKLES; i ++)
4484 {
4485 if (i == NO_SPARKLES - 1)
4486 return;
4487 if (sparkle[i].type == SPARKLE_NONE)
4488 break;
4489 }
4490
4491 sparkle[i].x = x;
4492 sparkle[i].y = y;
4493 sparkle[i].x_speed = xs;
4494 sparkle[i].y_speed = ys;
4495 sparkle[i].type = type;
4496 sparkle[i].colour = colour;
4497 sparkle[i].size = size;
4498 sparkle[i].tickrate = tickrate;
4499
4500 // textprintf_centre_ex(screen, small_font, 320, 300, COLOUR_YELLOW8, -1, "new sparkle %i %i %i", x, y, size);
4501 // rest(200);
4502 }
4503
4504
4505 void destroy_pyro(int p)
4506 {
4507 pyro[p].type = PYRO_NONE;
4508 }
4509
4510 void destroy_sparkle(int s)
4511 {
4512 sparkle[s].type = SPARKLE_NONE;
4513 }
4514
4515 void drag_pyro(int p)
4516 {
4517 pyro[p].x_speed *= (float) 0.95;
4518 pyro[p].y_speed *= (float) 0.95;
4519 }
4520
4521 void drag_sparkle(int s)
4522 {
4523 sparkle[s].x_speed *= (float) 0.50;
4524 sparkle[s].y_speed *= (float) 0.50;
4525 }
4526
4527 void unlock_screen(int which)
4528 {
4529
4530 int county = 0;
4531 int county2 = 0;
4532
4533 do
4534 {
4535 menu_counter ++;
4536 make_grid_scroll();
4537
4538 if (ticked == 0)
4539 {
4540 clear_bitmap(menu_bmp);
4541 show_grid(COLOUR_PURPLE3, COLOUR_PURPLE8);
4542 textprintf_centre_ex(menu_bmp, font2, 320, 120, COLOUR_YELLOW8 - (menu_counter / 4) % 4, -1, "{__unlock__}");
4543 textprintf_centre_ex(menu_bmp, font, 320, 120, -1, -1, "{__unlock__}");
4544 textprintf_centre_ex(menu_bmp, small_font, 320, 200, COLOUR_YELLOW8, -1, "You have unlocked");
4545 switch(which)
4546 {
4547 case UNLOCK_PURPLE:
4548 textprintf_centre_ex(menu_bmp, small_font, 320, 230, TRANS_PURPLE, -1, "Purple Mode!");
4549 break;
4550 case UNLOCK_VOID:
4551 textprintf_centre_ex(menu_bmp, small_font, 320, 230, COLOUR_GREY5, -1, "Night Mode!");
4552 break;
4553 case UNLOCK_GOD:
4554 textprintf_centre_ex(menu_bmp, small_font, 320, 230, COLOUR_WHITE, -1, "God Mode!");
4555 break;
4556 }
4557 textprintf_centre_ex(menu_bmp, small_font, 320, 260, COLOUR_YELLOW8, -1, "Switch it on in the Special Menu.");
4558 // textprintf_centre_ex(menu_bmp, small_font, 320, 290, COLOUR_YELLOW8, "Now you can do something useful with");
4559 // textprintf_centre_ex(menu_bmp, small_font, 320, 305, COLOUR_YELLOW8, "your time, like ");
4560 if (county2 > 99)
4561 textprintf_centre_ex(menu_bmp, small_font, 320, 380, COLOUR_YELLOW5, -1, "Press Space to continue.");
4562 vsync();
4563 menu_to_screen();
4564 }
4565
4566 do
4567 {
4568 county ++;
4569 } while (ticked == 0);
4570
4571 ticked --;
4572
4573 county2 ++;
4574
4575 if (county2 > 99 && key [KEY_SPACE] != 0)
4576 {
4577 last_key = KEY_SPACE;
4578 break;
4579 }
4580
4581 }
4582 while(TRUE);
4583 }
4584
4585 int ms_colour(void)
4586 {
4587
4588 switch(grand(6))
4589 {
4590 case 0:
4591 return GC_GREY3;
4592 case 1:
4593 return GC_GREEN4;
4594 case 2:
4595 return GC_YELLOW4;
4596 case 3:
4597 return GC_RED4;
4598 case 4:
4599 return GC_BLUE4;
4600 case 5:
4601 return GC_ORANGE4;
4602
4603 }
4604
4605 return GC_ORANGE3;
4606
4607 }
4608
4609 void init_ms(void)
4610 {
4611 ms_circle_rad = 30 + grand(15);
4612 ms_circle_col = ms_colour() + 2;
4613 if (game.mode_void == 1)
4614 ms_circle_col += 46;
4615 int i;
4616
4617 for (i = 0; i < 2; i ++)
4618 {
4619 ms_arm_col [i] = ms_colour();
4620 if (game.mode_void == 1)
4621 ms_arm_col [i] += 46;
4622 ms_arm_out [i] = ms_circle_rad + (i * 40) + grand(50) + 40;
4623 ms_arm_angle [i] = ANGLE_1_SIXTEENTH + grand(ANGLE_1_EIGHTH);
4624 ms_arm_inward [i] = 15 + grand(20);
4625 ms_arm_rot [i] = grand(ANGLE_FULL);
4626 ms_arm_type [i] = grand(MS_TYPES);
4627 // ms_arm_type [i] = MS_SPINNER;
4628 // if (grand(2) == 0)
4629 // ms_arm_type [i] = MS_SQUAREY;
4630 ms_arm_number [i] = 2 + grand(4);
4631 ms_arm_blatter_size [i] = 8 + grand(20);
4632 if (ms_arm_number [i] > 3)
4633 ms_arm_angle [i] /= 2;
4634 switch(ms_arm_type [i])
4635 {
4636 case MS_SPINNER:
4637 ms_arm_inward [i] = 0;
4638 ms_arm_angle [i] = 1;
4639 ms_arm_angle [i] = ANGLE_1_32 + grand(ANGLE_1_SIXTEENTH);
4640 break;
4641 case MS_SPIKEY:
4642 ms_arm_angle [i] = ANGLE_1_SIXTEENTH + grand(ANGLE_QUARTER);
4643 break;
4644 case MS_ORBITER:
4645 ms_arm_inward [i] = 35 + grand(20);
4646 if (ms_arm_inward [i] >= ms_arm_out [i] - 10)
4647 ms_arm_inward [i] = ms_circle_rad;
4648 break;
4649 case MS_SQUAREY:
4650 ms_arm_angle [i] = 1;
4651 ms_arm_angle [i] = ANGLE_1_32 + grand(ANGLE_1_SIXTEENTH);
4652 ms_arm_inward [i] = 35 + grand(20);
4653 if (ms_arm_inward [i] >= ms_arm_out [i] - 10)
4654 ms_arm_inward [i] = ms_circle_rad;
4655 break;
4656 }
4657 ms_arm_rot_delta [i] = 3 + grand(5);
4658 if (grand(2) == 0)
4659 ms_arm_rot_delta [i] *= -1;
4660 }
4661
4662 if (ms_arm_rot_delta [0] == ms_arm_rot_delta [1])
4663 ms_arm_rot_delta [0] *= -1;
4664
4665 }
4666
4667 void draw_ms(void)
4668 {
4669 int i, x = 320, y = 240, col1 = GC_GREY1, col2;
4670
4671 for (i = 0; i < 2; i ++)
4672 {
4673 col2 = ms_arm_col [i];
4674 // col1 = col2;
4675 switch(ms_arm_type [i])
4676 {
4677 case MS_SPINNER:
4678 draw_overspinner(menu_bmp, x, y, ms_arm_rot [i], ms_arm_out [i], ms_arm_inward [i], ms_arm_angle [i], ANGLE_FULL / ms_arm_number [i], ms_arm_number [i], col1, col2);
4679 break;
4680 case MS_SPIKEY:
4681 draw_spikey(menu_bmp, x, y, ms_arm_rot [i], ms_arm_out [i], ms_arm_inward [i], ms_arm_angle [i], ANGLE_FULL / ms_arm_number [i], ms_arm_number [i], col1, col2, 0, 0);
4682 break;
4683 case MS_SQUAREY:
4684 draw_squarey(menu_bmp, x, y, ms_arm_rot [i], ms_arm_out [i], ms_arm_inward [i], ms_arm_angle [i], ANGLE_FULL / ms_arm_number [i], ms_arm_number [i], col1, col2);
4685 break;
4686 case MS_BLATTER:
4687 draw_blatter(menu_bmp, x, y, ms_arm_number [i], ms_arm_out [i], ms_arm_rot [i], ms_arm_blatter_size [i], col1, col2);
4688 break;
4689 case MS_ORBITER:
4690 draw_orbiter(menu_bmp, x, y, ms_arm_rot [i], ms_arm_out [i], ms_arm_inward [i], ms_arm_blatter_size [i], ms_arm_angle [i], ANGLE_FULL / ms_arm_number [i], ms_arm_number [i], col1, col2);
4691 // draw_orbiter(BITMAP *bmp, int x, int y, int attribute, int out1, int out2, int out3, int angle1, int angle2, int arms, int col1, int col2);
4692 break;
4693
4694 }
4695
4696 }
4697
4698 circlefill(menu_bmp, 320, 240, ms_circle_rad, ms_circle_col);
4699 circle(menu_bmp, 320, 240, ms_circle_rad, GC_GREY1);
4700
4701 }
4702
4703 void make_ms_move(void)
4704 {
4705 ms_arm_rot [0] += ms_arm_rot_delta [0];
4706 ms_arm_rot [0] &= 1023;
4707 ms_arm_rot [1] += ms_arm_rot_delta [1];
4708 ms_arm_rot [1] &= 1023;
4709
4710 }
4711
4712 void menu_sound1(void)
4713 {
4714 play_wav2(NWAV_MENU, 600, 255, 127);
4715 }
4716
4717 void menu_sound2(void)
4718 {
4719 play_wav2(NWAV_MENU, 300, 255, 127);
4720 }
4721
4722 // appends a number to a string. Unforgivable hack needed to avoid using itoa for portability reasons, and to avoid learning how to use snprintf() for laziness reasons. Also I wrote it while hungover
4723 void anum(char *str, int num)
4724 {
4725 switch(num)
4726 {
4727 case 0: strcat(str, "0"); break;
4728 case 1: strcat(str, "1"); break;
4729 case 2: strcat(str, "2"); break;
4730 case 3: strcat(str, "3"); break;
4731 case 4: strcat(str, "4"); break;
4732 case 5: strcat(str, "5"); break;
4733 case 6: strcat(str, "6"); break;
4734 case 7: strcat(str, "7"); break;
4735 case 8: strcat(str, "8"); break;
4736 case 9: strcat(str, "9"); break;
4737 case 10: strcat(str, "10"); break;
4738 case 11: strcat(str, "11"); break;
4739 case 12: strcat(str, "12"); break;
4740 case 13: strcat(str, "13"); break;
4741 case 14: strcat(str, "14"); break;
4742 case 15: strcat(str, "15"); break;
4743 case 16: strcat(str, "16"); break;
4744 case 17: strcat(str, "17"); break;
4745 case 18: strcat(str, "18"); break;
4746 case 19: strcat(str, "19"); break;
4747 case 20: strcat(str, "20"); break;
4748 case 30: strcat(str, "30"); break;
4749 case 40: strcat(str, "40"); break;
4750 case 50: strcat(str, "50"); break;
4751 case 60: strcat(str, "60"); break;
4752 case 70: strcat(str, "70"); break;
4753 case 80: strcat(str, "80"); break;
4754 case 90: strcat(str, "90"); break;
4755 case 100: strcat(str, "100"); break;
4756 default: strcat(str, "num"); break;
4757
4758 }
4759
4760 }
4761
4762
0 void init_menus_once_only(void);
1
2 void menu_loop(void);
0 [Misc]
1 Seed = 9871
2
3 [Options]
4 Sound_mode = 2
5 Run_vsync = 1
6 Sound_volume = 100
7 Ambience_volume = 100
8 Resolution = 2
9 # If the game crashes, change the Resolution setting to 0, which means 640x480 fullscreen.
10 # 1 means 800x600, but that might not work on all computers.
11 # Values: 0 = 640x480 fullscreen; 1 = 800x600 fullscreen; 2 = 640x480 windowed; 3 = 800x600 windowed
12 Colour_text = 0
13
14 [Player1Keys]
15 Key0 = 84
16 Key1 = 82
17 Key2 = 83
18 Key3 = 1
19 Key4 = 19
20 Key5 = 85
21 Key6 = 24
22 Key7 = 24
23 Key8 = 24
24 Key9 = 4
25
26 [Player2Keys]
27 Key0 = 9
28 Key1 = 10
29 Key2 = 12
30 Key3 = 20
31 Key4 = 26
32 Key5 = 11
33 Key6 = 75
34 Key7 = 75
35 Key8 = 75
36 Key9 = 21
37
38 [Highscores_single]
39 Name0 = Xom
40 Score0 = 10000
41 Level0 = 10
42 Name1 = Michi
43 Score1 = 1410
44 Level1 = 4
45 Name2 = Vehumet
46 Score2 = 1000
47 Level2 = 7
48 Score3 = 950
49 Level3 = 6
50 Name3 = Makhleb
51 Score4 = 900
52 Level4 = 6
53 Name4 = Kikubaaqudgha
54 Score5 = 890
55 Level5 = 3
56 Name5 = Michi
57 Score6 = 850
58 Level6 = 5
59 Name6 = Yredelemnul
60 Score7 = 800
61 Level7 = 5
62 Name7 = Nemelex Xobeh
63 Score8 = 750
64 Level8 = 5
65 Name8 = The Shining One
66 Score9 = 700
67 Level9 = 4
68 Name9 = Zin
69 Score10 = 650
70 Level10 = 4
71 Name10 = Sif Muna
72 Score11 = 600
73 Level11 = 4
74 Name11 = Elyvilon
75 Score12 = 550
76 Level12 = 4
77 Name12 = Okawaru
78 Score13 = 500
79 Level13 = 3
80 Name13 = Trog
81 Score14 = 450
82 Level14 = 2
83 Name14 = Sigmund
84
85 [Highscores_Coop]
86 Score0 = 1000
87 Level0 = 3
88 Name0 = Schnorkel
89 Score1 = 950
90 Level1 = 3
91 Name1 = Moloch
92 Score2 = 900
93 Level2 = 3
94 Name2 = Belial
95 Score3 = 850
96 Level3 = 2
97 Name3 = Zoz
98 Score4 = 800
99 Level4 = 2
100 Name4 = Hagon
101 Score5 = 750
102 Level5 = 2
103 Name5 = Lemming
104 Score6 = 700
105 Level6 = 2
106 Name6 = Potto
107 Score7 = 650
108 Level7 = 2
109 Name7 = Lemur
110 Score8 = 600
111 Level8 = 1
112 Name8 = Sloth
113 Score9 = 550
114 Level9 = 1
115 Name9 = Eggplant
116 Score10 = 500
117 Level10 = 1
118 Name10 = CaptainP
119 Score11 = 450
120 Level11 = 1
121 Name11 = CaptainP
122 Score12 = 400
123 Level12 = 1
124 Name12 = CaptainP
125 Score13 = 350
126 Level13 = 1
127 Name13 = CaptainP
128 Score14 = 300
129 Level14 = 1
130 Name14 = CaptainP
131
132 [Highscores_TA]
133 best_time = 4696
134 best_name = Sluggish
135
136 [Unlock]
137 Purple = 0
138 Void = 0
139 God = 0
140 #don't even try
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: palette.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - palette and transparency stuff.
30 Various enums are in palette.h.
31
32 */
33
34 /*
35 Lacewing
36 Copyright (C) 2003 Captain Pork
37
38 This program is free software; you can redistribute it and/or modify
39 it under the terms of the GNU General Public Licence as published by
40 the Free Software Foundation; either version 2 of the Licence, or
41 (at your option) any later version.
42
43 This program is distributed in the hope that it will be useful,
44 but WITHOUT ANY WARRANTY; without even the implied warranty of
45 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46 GNU General Public Licence for more details.
47
48 You should have received a copy of the GNU General Public Licence
49 along with this program; if not, write to the Free Software
50 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
51
52 The GPL version 2 is included in this distribution in a file called
53 LICENCE.TXT. Use any text editor or the TYPE command to read it.
54
55 You should be able to reach Captain Pork by sending an email to
56 captainpork@fastmail.fm or sending a letter to
57 Captain Pork, 3/4 Kensington Rd, Rose Park, SA 5067 Australia
58 but my lease is a short-term one so email is probably your best bet.
59
60 File: Palette.c
61 History:
62 1/5/03 - Started (Capt Pork)
63
64 This file contains:
65 The palette functions
66
67 */
68
69 #include "allegro.h"
70
71
72 #include "config.h"
73 #include "palette.h"
74 #include "globvars.h"
75
76 COLOR_MAP trans_table;
77 int blend_function(int x, int y, RGB *rgbl);
78 int limit_colour(int colour_input);
79 int average_colours(int colour1, int colour2);
80
81 RGB other_palet [1324];
82 RGB palet [256];
83 RGB light_palet [256];
84 RGB dark_palet [256];
85 RGB other_palet2 [2048];
86 // what seems to be a weird bug in Allegro forces me to put padding around
87 // the palet array, or it becomes corrupted. The same thing happened in
88 // World of Violence and I have no idea why.
89
90 int adjust_lit_colour(int col, int lit);
91 int add_light_to_colour(int col, int lit);
92 void pork_create_color_table(COLOR_MAP *table, AL_CONST PALETTE pal);
93 int get_lower_colour(int y);
94 int colour_illumination(int y);
95 int base_colour(int y);
96 int colour_brightness(int y);
97 void init_light_palette(void);
98 void init_dark_palette(void);
99
100 void colour_table(const char *which_call);
101 //void colour_table(void);
102
103 //RGB mono_palet [256];
104
105
106 int base_palette [48] [3] =
107 {
108 // DON't modify this palette - it may mess up image loading
109 {0, 0, 0},
110 {0, 0, 1},
111 {10, 10, 10},
112 {20, 20, 20},
113 {30, 30, 30},
114 {40, 40, 40},
115 {50, 50, 50},
116 {63, 63, 63}, // greys
117 {0, 8, 0},
118 {0, 16, 0},
119 {3, 24, 3},
120 {6, 32, 6},
121 {8, 40, 8},
122 {12, 48, 12},
123 {16, 56, 16},
124 {20, 63, 20}, // Greens
125 {8, 8, 0},
126 {16, 16, 0},
127 {24, 24, 4},
128 {32, 32, 8},
129 {40, 40, 12},
130 {48, 48, 16},
131 {56, 56, 20},
132 {63, 63, 24}, // yellows
133 // DON't modify this palette - it may mess up image loading
134 {8, 3, 0},
135 {16, 6, 0},
136 {24, 9, 0},
137 {32, 12, 0},
138 {40, 15, 0},
139 {48, 18, 0},
140 {56, 21, 0},
141 {63, 24, 0}, // Oranges
142 {8, 0, 0},
143 {16, 0, 0},
144 {24, 0, 0},
145 {32, 3, 3},
146 {40, 5, 5},
147 {48, 7, 7},
148 {56, 9, 9},
149 {63, 11, 11}, // Reds
150 {0, 0, 8},
151 {0, 0, 16},
152 {4, 4, 24},
153 {8, 8, 32},
154 {12, 12, 40},
155 {16, 16, 48},
156 {20, 20, 56},
157 {24, 24, 63} // Blues
158 // DON't modify this palette - it may mess up image loading
159
160 };
161
162 int base_palette2 [48] [3] =
163 {
164 // Modifying this palette is okay
165 {0, 0, 0},
166 {0, 0, 1},
167 {10, 10, 10},
168 {20, 20, 20},
169 {33, 33, 33},
170 {46, 46, 46},
171 {55, 55, 55},
172 {63, 63, 63}, // greys
173 {2, 8, 2},
174 {4, 16, 4},
175 {8, 24, 8},
176 {16, 32, 16},
177 {24, 40, 24},
178 {30, 48, 30},
179 {33, 56, 33},
180 {36, 63, 36}, // Greens
181 {8, 6, 3},
182 {16, 17, 6},
183 {24, 20, 12},
184 {32, 30, 16},
185 {40, 37, 22},
186 {48, 45, 30},
187 {56, 52, 36},
188 {63, 60, 40}, // yellows
189 /*
190 {8, 4, 1},
191 {16, 6, 3},
192 {24, 9, 6},
193 {32, 12, 9},
194 {40, 20, 12},
195 {48, 25, 15},
196 {56, 30, 18},
197 {63, 35, 21}, // Oranges
198 {8, 3, 3},
199 {16, 6, 6},
200 {24, 9, 9},
201 {32, 12, 12},
202 {40, 15, 15},
203 {48, 18, 18},
204 {56, 21, 21},
205 {63, 25, 25}, // Reds
206 */
207 {8, 5, 3},
208 {16, 9, 7},
209 {24, 13, 9},
210 {32, 17, 13},
211 {40, 24, 16},
212 {48, 28, 19},
213 {56, 34, 21},
214 {63, 40, 25}, // Oranges
215 {8, 3, 3},
216 {16, 6, 6},
217 {24, 9, 9},
218 {32, 12, 12},
219 {40, 15, 15},
220 {48, 18, 18},
221 {56, 21, 21},
222 {63, 25, 25}, // Reds
223 {4, 4, 8},
224 {8, 8, 16},
225 {15, 15, 24},
226 {20, 20, 32},
227 {24, 24, 40},
228 {28, 28, 48},
229 {36, 36, 56},
230 {42, 42, 63} // Blues
231 // Modifying this palette is okay
232
233 };
234
235
236 #define END_TRANSPARENCIES 104
237
238 /*
239 0 - black
240 1-104 - transparencies
241 105-152 - dark
242 153-200 - lighter
243 201-248 - brightest
244 249-255 - ???
245
246 Colours:
247 1 - grey/white
248 2 - Green
249 3 - yellow
250 4 - orange
251 5 - red
252 6 - blue
253
254 Transparencies:
255 1 - white
256 2 - purple
257 3 - lblue
258 4 - dblue
259 5 - yellow
260 6 - lgreen
261 7 - dgreen
262 8 - orange
263 9 - red
264 10 - dred
265 11 - white2
266 12 - lgrey
267 13 - dgrey
268
269
270 13 * 8 = 104
271 256 - 104 = 152
272 152 / 48 = 3 + 8
273 */
274
275 void process_palette(RGB *proc_palet)
276 {
277 // int i;
278 }
279
280
281 void init_palette(void)
282 {
283
284 int i;
285
286
287 // colour_table("First");
288
289 for (i = 0; i < 48; i ++)
290 {
291 /* // base (ambient)
292 palet[i + 105].r = limit_colour(base_palette [i] [0] * 3) / 4;
293 palet[i + 105].g = limit_colour(base_palette [i] [1] * 3) / 4;
294 palet[i + 105].b = limit_colour(base_palette [i] [2] * 3) / 4;
295
296 // bright
297 palet[i + 153].r = limit_colour(base_palette [i] [0]);
298 palet[i + 153].g = limit_colour(base_palette [i] [1]);
299 palet[i + 153].b = limit_colour(base_palette [i] [2]);
300
301 // brightest
302 palet[i + 201].r = limit_colour((base_palette [i] [0] * 4) / 3);
303 palet[i + 201].g = limit_colour((base_palette [i] [1] * 4) / 3);
304 palet[i + 201].b = limit_colour((base_palette [i] [2] * 4) / 3);
305
306 */
307
308 // base (ambient)
309 palet[i + 105].r = limit_colour(((base_palette [i] [0] * 4) / 5) - 5);
310 palet[i + 105].g = limit_colour(((base_palette [i] [1] * 4) / 5) - 5);
311 palet[i + 105].b = limit_colour(((base_palette [i] [2] * 4) / 5) - 5);
312
313 // bright
314 palet[i + 153].r = limit_colour(base_palette [i] [0]);
315 palet[i + 153].g = limit_colour(base_palette [i] [1]);
316 palet[i + 153].b = limit_colour(base_palette [i] [2]);
317
318 // brightest
319 palet[i + 201].r = limit_colour(((base_palette [i] [0] * 5) / 4));
320 palet[i + 201].g = limit_colour(((base_palette [i] [1] * 5) / 4));
321 palet[i + 201].b = limit_colour(((base_palette [i] [2] * 5) / 4));
322
323
324 }
325
326
327 palet [252].r = 23;
328 palet [252].g = 53;
329 palet [252].b = 23;
330 palet [255].r = 53;
331 palet [255].g = 23;
332 palet [255].b = 23;
333
334 for (i = 0; i < 8; i ++)
335 {
336
337 // NOT REAL PALETTE - see below
338
339 // White - should be same as WHITE2 (below)
340 palet[i + 1].r = limit_colour(48 + i * 2);
341 palet[i + 1].g = limit_colour(48 + i * 2);
342 palet[i + 1].b = limit_colour(48 + i * 2);
343
344 // Yellow
345 palet[i + 9].r = limit_colour(47 + i * 3);
346 palet[i + 9].g = limit_colour(47 + i * 3);
347 palet[i + 9].b = limit_colour(10 + i * 3);
348
349 // LGreen
350 palet[i + 17].r = limit_colour(i * 3);
351 palet[i + 17].g = limit_colour(32 + i * 4);
352 palet[i + 17].b = limit_colour(i * 3);
353
354 // Orange
355 palet[i + 25].r = limit_colour(47 + i * 3);
356 palet[i + 25].g = limit_colour(20 + i * 3);
357 palet[i + 25].b = limit_colour(5 + i * 2);
358
359 // Red
360 palet[i + 33].r = limit_colour(41 + i * 4);
361 palet[i + 33].g = limit_colour(15 + i * 2);
362 palet[i + 33].b = limit_colour(5 + i * 2);
363
364 // DGreen
365 palet[i + 41].r = limit_colour(i * 2);
366 palet[i + 41].g = limit_colour(21 + i * 4);
367 palet[i + 41].b = limit_colour(i * 2);
368
369 // DRed
370 palet[i + 49].r = limit_colour(20 + i * 4);
371 palet[i + 49].g = limit_colour(i * 2);
372 palet[i + 49].b = limit_colour(i * 2);
373
374 // Purple
375 palet[i + 57].r = limit_colour(32 + i * 4);
376 palet[i + 57].g = limit_colour(i * 3);
377 palet[i + 57].b = limit_colour(32 + i * 4);
378
379 // LBlue
380 palet[i + 65].r = limit_colour(10 + i * 3);
381 palet[i + 65].g = limit_colour(10 + i * 3);
382 palet[i + 65].b = limit_colour(47 + i * 2);
383
384 // DBlue
385 palet[i + 73].r = limit_colour(i * 2);
386 palet[i + 73].g = limit_colour(i * 2);
387 palet[i + 73].b = limit_colour(21 + i * 4);
388
389 // White2 - should be same as WHITE (above)
390 palet[i + 81].r = limit_colour(48 + i * 2);
391 palet[i + 81].g = limit_colour(48 + i * 2);
392 palet[i + 81].b = limit_colour(48 + i * 2);
393
394 // LGrey
395 palet[i + 89].r = limit_colour(24 + i * 4);
396 palet[i + 89].g = limit_colour(24 + i * 4);
397 palet[i + 89].b = limit_colour(24 + i * 4);
398
399 // DGrey
400 palet[i + 97].r = limit_colour(12 + i * 4);
401 palet[i + 97].g = limit_colour(12 + i * 4);
402 palet[i + 97].b = limit_colour(12 + i * 4);
403
404 }
405
406 palet[0].r = 0;
407 palet[0].g = 0;
408 palet[0].b = 0;
409
410
411 /* for (i = 1; i < 256; i ++)
412 {
413 if (palet[i].r < 20
414 && palet[i].b < 20
415 && palet[i].g < 20)
416 {
417 light_palet[i].r = palet[i].r;
418 light_palet[i].g = palet[i].g;
419 light_palet[i].b = palet[i].b;
420 }
421 else
422 {
423 light_palet[i].r = limit_colour((palet[i].r * 32) / 63 + 25);
424 light_palet[i].b = limit_colour((palet[i].b * 32) / 63 + 25);
425 light_palet[i].g = limit_colour((palet[i].g * 32) / 63 + 25);
426 }
427 }
428 */
429 /* for (i = 0; i < 192; i ++)
430 {
431 palet[i].r = 0;
432 palet[i].b = 0;
433 palet[i].g = 0;
434 }*/
435
436
437 set_palette(palet);
438
439 pork_create_color_table(&trans_table, palet);
440
441 color_map = &trans_table;
442
443 set_palette(palet);
444
445 init_light_palette();
446 init_dark_palette(); // after light_palette
447
448 /* BITMAP *pbmp = create_bitmap(16, 16);
449
450 int x, y;
451
452 for (x = 0; x < 16; x ++)
453 {
454 for (y = 0; y < 16; y ++)
455 {
456 putpixel(pbmp, y, x, y + (x * 16));
457 // if (y + (x * 16) < 192)
458 // putpixel(pbmp, y, x, 0);
459 }
460 }
461
462 save_bitmap("palgod.pcx", pbmp, palet);
463 */
464 /* for (x = 192; x < 256; x ++)
465 {
466 rectfill(screen, (x - 192) * 6, 1, (x - 192) * 6 + 6, 10, x);
467 }
468
469 do
470 {
471
472 } while (key [KEY_U] == 0);
473 */
474 // int j;
475
476 /* for (i = 0; i < 256; i ++)
477 {
478 j = limit_colour((palet[i].r + palet[i].g + palet[i].b) / 3);
479 mono_palet [i].r = j;
480 mono_palet [i].g = j;
481 mono_palet [i].b = j;
482 }
483
484 mono_palet [222].r = 60;
485 mono_palet [222].g = 40;
486 mono_palet [222].b = 0;
487 mono_palet [223].r = 0;
488 mono_palet [223].g = 60;
489 mono_palet [223].b = 10; // these colours used for 'you win'/'game over'
490 */
491 }
492
493 int limit_colour(int colour_input)
494 {
495
496 if (colour_input < 0) return 0;
497 if (colour_input > 63) return 63;
498 return colour_input;
499
500 }
501
502 int average_colours(int colour1, int colour2)
503 {
504
505 int avge = colour1 + colour2 / 2;
506 if (avge < 0) return 0;
507 if (avge > 63) return 63;
508 return avge;
509
510 }
511
512
513 int blend_function(int x, int y, RGB *rgbl)
514 {
515
516 // if (x % 8 == 0)
517 // {
518 // return y;
519 // }
520
521
522
523 if (x == TRANS_REVERSE)
524 {
525 return ((int) y / 8) * 8 + (8 - ((y-1) % 8));
526 }
527
528 if (x == TRANS_DARKEN)
529 {
530 // return ((int) y / 8) * 8 + (((y-1) % 8) / 2);
531 if ((y-1) % 8 < 1)
532 x = 1;
533 else x = 7;
534
535 if (y < GC_BLACK)
536 return ((int) y / 8) * 8 + x;
537
538 return COLOUR_BLACK + x;
539 }
540
541 /* if (x == TRANS_GREY)
542 {
543 if (y < 192)
544 return y;
545
546 return y - 64;
547 }*/
548
549 // if (x >= TRANS_WHITE && x < TRANS_END)
550 /* if (x == TRANS_WHITE
551 || x == TRANS_PURPLE
552 || x == TRANS_LBLUE
553 || x == TRANS_DBLUE
554 || x == TRANS_YELLOW
555 || x == TRANS_LGREEN
556 || x == TRANS_DGREEN
557 || x == TRANS_ORANGE
558 || x == TRANS_LRED
559 || x == TRANS_DRED
560 || x == TRANS_WHITE2
561 || x == TRANS_LGREY
562 || x == TRANS_DGREY)*/
563
564 if (x > GC_BLACK && x <= COLOUR_BLUE8) // ie isn't a transparency or a bright lit
565 {
566 if (x % 8 == 1 && x < COLOUR_BLACK) // ie is a GC (lowest-light) colour
567 {
568 // if (y > GC_BLACK && y <= GC_WHITE) // ie is part of GC grey scale
569 // y = x + ((y-1) % 8) - 4;
570 if (y > GC_BLACK && y <= GC_BLUE8) // ie is part of GC grey scale
571 y = x + ((y-5) % 8);
572 return y;
573 // if (x == CONVERT_YELLOW1 && y % 8 != 0)
574 // y --;
575 }
576 if (x > COLOUR_BLACK && x % 8 == 1 && x <= COLOUR_BLUE8) // ie is a COLOUR (middle-light) colour
577 {
578 if (y > COLOUR_BLACK && y <= COLOUR_BLUE8) // ie is part of COLOUR grey scale
579 // y = x + ((y-5) % 8) - 48;// - 48;
580 y = x + ((y-5) % 8) - 48;// - 48;
581 // if (x == CONVERT_YELLOW2 && y % 8 != 0)
582 // y --;
583 return y;
584 }
585 }
586
587 if (x <= END_TRANSPARENCIES && x % 8 == 0 && x > 0)
588 {
589
590 // if ((y - 1) / 8 < ((x / 8) - TRANS_WHITE)
591 if (y < x - 7
592 && y < END_TRANSPARENCIES)
593 return y; // don't overwrite lower transparencies*/
594
595
596 //return 100;
597
598 // if ((y - 1) % 8 == 0)
599 // return (y - 1) % 8 + (x - TRANS_WHITE) * 8 + 1;
600 return (y - 1) % 8 + x - 7;
601
602
603 // return (y - 1) % 8 + (x - TRANS_WHITE) * 8 + 1;
604
605 }
606
607 if (x == LIGHT_1)
608 {
609 if (y <= END_TRANSPARENCIES)
610 return y; // leaves transparencies alone
611 if (y >= 105 && y <= 152)
612 {
613 return y + 48;
614 } // only lightens areas only lit by ambient light.
615 return y;
616 }
617
618 if (x == LIGHT_2)
619 {
620 if (y <= END_TRANSPARENCIES)
621 return y; // leaves transparencies alone
622 if (y >= 105 && y <= 152)
623 {
624 return y + 96;
625 } // lightens level 1 light to level 3
626 if (y >= 153 && y <= 200)
627 {
628 return y + 48;
629 } // lightens level 2 light to level 3
630 return y;
631 }
632
633 return y;
634
635 }
636
637
638
639 int get_lower_colour(int y)
640 {
641
642 if (y % 32 == COLOUR_WHITE % 32)
643 return 7;
644
645 if (y % 32 >= COLOUR_BLACK % 32 && y % 32 <= COLOUR_WHITE % 32)
646 return (y % 32);
647
648 if (y % 32 >= COLOUR_ORANGE1 % 32 && y % 32 <= COLOUR_BLUE4 % 32)
649 return ((((y % 32) - (COLOUR_ORANGE1 % 32)) % 4 + 1) * 3) / 2;
650
651 return 7;
652
653 }
654
655 int colour_to_trans(int y)
656 {
657
658 switch(y)
659 {
660 case COLOUR_GREY1:
661 case COLOUR_GREY2:
662 case COLOUR_GREY3:
663 case COLOUR_GREY4:
664 return TRANS_LGREY;
665 case COLOUR_GREY5:
666 case COLOUR_GREY6:
667 case COLOUR_WHITE:
668 return TRANS_WHITE;
669 case COLOUR_ORANGE1:
670 case COLOUR_ORANGE2:
671 case COLOUR_ORANGE3:
672 case COLOUR_ORANGE4:
673 return TRANS_ORANGE;
674 case COLOUR_ORANGE5:
675 case COLOUR_ORANGE6:
676 case COLOUR_ORANGE7:
677 case COLOUR_ORANGE8:
678 return TRANS_ORANGE;
679 case COLOUR_BLUE1:
680 case COLOUR_BLUE2:
681 case COLOUR_BLUE3:
682 case COLOUR_BLUE4:
683 return TRANS_DBLUE;
684 case COLOUR_BLUE5:
685 case COLOUR_BLUE6:
686 case COLOUR_BLUE7:
687 case COLOUR_BLUE8:
688 return TRANS_LBLUE;
689 case COLOUR_RED1:
690 case COLOUR_RED2:
691 case COLOUR_RED3:
692 case COLOUR_RED4:
693 return TRANS_DRED;
694 case COLOUR_RED5:
695 case COLOUR_RED6:
696 case COLOUR_RED7:
697 case COLOUR_RED8:
698 return TRANS_LRED;
699 case COLOUR_YELLOW1:
700 case COLOUR_YELLOW2:
701 case COLOUR_YELLOW3:
702 case COLOUR_YELLOW4:
703 return TRANS_YELLOW;
704 case COLOUR_YELLOW5:
705 case COLOUR_YELLOW6:
706 case COLOUR_YELLOW7:
707 case COLOUR_YELLOW8:
708 return TRANS_YELLOW;
709 case COLOUR_GREEN1:
710 case COLOUR_GREEN2:
711 case COLOUR_GREEN3:
712 case COLOUR_GREEN4:
713 return TRANS_DGREEN;
714 case COLOUR_GREEN5:
715 case COLOUR_GREEN6:
716 case COLOUR_GREEN7:
717 case COLOUR_GREEN8:
718 return TRANS_LGREEN;
719 /* case COLOUR_PURPLE1:
720 case COLOUR_PURPLE2:
721 case COLOUR_PURPLE3:
722 case COLOUR_PURPLE4:
723 case COLOUR_PURPLE5:
724 case COLOUR_PURPLE6:
725 case COLOUR_PURPLE7:
726 case COLOUR_PURPLE8:
727 return TRANS_PURPLE;*/
728
729 default:
730 return TRANS_WHITE;
731
732 }
733
734 }
735
736
737 int base_colour(int y)
738 {
739 switch(y % 32)
740 {
741 case COLOUR_GREY1:
742 case COLOUR_GREY2:
743 case COLOUR_GREY3:
744 case COLOUR_GREY4:
745 case COLOUR_GREY5:
746 case COLOUR_GREY6:
747 case COLOUR_WHITE:
748 return COLOUR_GREY1;
749 case COLOUR_ORANGE1:
750 case COLOUR_ORANGE2:
751 case COLOUR_ORANGE3:
752 case COLOUR_ORANGE4:
753 return COLOUR_ORANGE1;
754 case COLOUR_BLUE1:
755 case COLOUR_BLUE2:
756 case COLOUR_BLUE3:
757 case COLOUR_BLUE4:
758 return COLOUR_BLUE1;
759 case COLOUR_RED1:
760 case COLOUR_RED2:
761 case COLOUR_RED3:
762 case COLOUR_RED4:
763 return COLOUR_RED1;
764 case COLOUR_YELLOW1:
765 case COLOUR_YELLOW2:
766 case COLOUR_YELLOW3:
767 case COLOUR_YELLOW4:
768 return COLOUR_YELLOW1;
769 case COLOUR_GREEN1:
770 case COLOUR_GREEN2:
771 case COLOUR_GREEN3:
772 case COLOUR_GREEN4:
773 return COLOUR_GREEN1;
774 }
775
776 return COLOUR_BLACK;
777
778 }
779
780
781 /*
782 This function had to be modified from the allegro create_color_table
783 because the allegro version used bestfit_color, whereas we need
784 specific color values (eg so that there can be multiple blacks to carry
785 information in areas of the screen that haven't been lightsourced yet)
786 */
787 void pork_create_color_table(COLOR_MAP *table, AL_CONST PALETTE pal)
788 //void pork_create_color_table(COLOR_MAP *table, AL_CONST PALETTE pal, (int *)(blend)(AL_CONST PALETTE pal, int x, int y, RGB *rgb), void (*callback)(int pos))
789 {
790 int x, y, z;
791 RGB c;
792
793 for (x=0; x<PAL_SIZE; x++) {
794 for (y=0; y<PAL_SIZE; y++) {
795 z = blend_function(x, y, &c);
796
797 // if (rgb_map)
798 table->data[x][y] = z;//rgb_map->data[c.r>>1][c.g>>1][c.b>>1];
799 // else
800 // table->data[x][y] = bestfit_color(pal, c.r, c.g, c.b);
801 }
802
803 }
804 }
805
806
807
808 void init_light_palette(void)
809 {
810
811 int i;
812
813
814 for (i = 0; i < 48; i ++)
815 {
816
817 // base (ambient)
818 light_palet[i + 105].r = limit_colour(((base_palette2 [i] [0] * 4) / 5) - 5);
819 light_palet[i + 105].g = limit_colour(((base_palette2 [i] [1] * 4) / 5) - 5);
820 light_palet[i + 105].b = limit_colour(((base_palette2 [i] [2] * 4) / 5) - 5);
821
822 // bright
823 light_palet[i + 153].r = limit_colour(base_palette2 [i] [0]);
824 light_palet[i + 153].g = limit_colour(base_palette2 [i] [1]);
825 light_palet[i + 153].b = limit_colour(base_palette2 [i] [2]);
826
827 // brightest
828 light_palet[i + 201].r = limit_colour(((base_palette2 [i] [0] * 5) / 4));
829 light_palet[i + 201].g = limit_colour(((base_palette2 [i] [1] * 5) / 4));
830 light_palet[i + 201].b = limit_colour(((base_palette2 [i] [2] * 5) / 4));
831
832
833 }
834
835
836 light_palet [252].r = 23;
837 light_palet [252].g = 53;
838 light_palet [252].b = 23;
839 light_palet [255].r = 53;
840 light_palet [255].g = 23;
841 light_palet [255].b = 23;
842
843 for (i = 0; i < 8; i ++)
844 {
845
846 // White - should be same as WHITE2 (below)
847 light_palet[i + 1].r = limit_colour(48 + i * 2);
848 light_palet[i + 1].g = limit_colour(48 + i * 2);
849 light_palet[i + 1].b = limit_colour(48 + i * 2);
850
851 // Yellow
852 light_palet[i + 9].r = limit_colour(47 + i * 3);
853 light_palet[i + 9].g = limit_colour(43 + i * 3);
854 light_palet[i + 9].b = limit_colour(10 + i * 3);
855
856 // LGreen
857 light_palet[i + 17].r = limit_colour(i * 3);
858 light_palet[i + 17].g = limit_colour(32 + i * 4);
859 light_palet[i + 17].b = limit_colour(i * 3);
860
861 // Orange
862 light_palet[i + 25].r = limit_colour(47 + i * 3);
863 light_palet[i + 25].g = limit_colour(20 + i * 3);
864 light_palet[i + 25].b = limit_colour(5 + i * 2);
865
866 // Red
867 light_palet[i + 33].r = limit_colour(41 + i * 4);
868 light_palet[i + 33].g = limit_colour(15 + i * 2);
869 light_palet[i + 33].b = limit_colour(5 + i * 2);
870
871 // DGreen
872 light_palet[i + 41].r = limit_colour(i * 2);
873 light_palet[i + 41].g = limit_colour(21 + i * 4);
874 light_palet[i + 41].b = limit_colour(i * 2);
875
876 // DRed
877 light_palet[i + 49].r = limit_colour(20 + i * 4);
878 // light_palet[i + 49].g = limit_colour(i * 2);
879 // light_palet[i + 49].b = limit_colour(i * 2);
880 light_palet[i + 49].g = limit_colour(5 + i * 2);
881 light_palet[i + 49].b = limit_colour(1 + i * 2);
882
883 // Purple
884 light_palet[i + 57].r = limit_colour(32 + i * 4);
885 light_palet[i + 57].g = limit_colour(i * 3);
886 light_palet[i + 57].b = limit_colour(32 + i * 4);
887
888 // LBlue
889 light_palet[i + 65].r = limit_colour(10 + i * 3);
890 light_palet[i + 65].g = limit_colour(10 + i * 3);
891 light_palet[i + 65].b = limit_colour(47 + i * 2);
892
893 // DBlue
894 light_palet[i + 73].r = limit_colour(i * 2);
895 light_palet[i + 73].g = limit_colour(i * 2);
896 light_palet[i + 73].b = limit_colour(21 + i * 4);
897
898 // White2 - should be same as WHITE (above)
899 light_palet[i + 81].r = limit_colour(48 + i * 2);
900 light_palet[i + 81].g = limit_colour(48 + i * 2);
901 light_palet[i + 81].b = limit_colour(48 + i * 2);
902
903 // LGrey
904 light_palet[i + 89].r = limit_colour(24 + i * 4);
905 light_palet[i + 89].g = limit_colour(24 + i * 4);
906 light_palet[i + 89].b = limit_colour(24 + i * 4);
907
908 // DGrey
909 light_palet[i + 97].r = limit_colour(12 + i * 4);
910 light_palet[i + 97].g = limit_colour(12 + i * 4);
911 light_palet[i + 97].b = limit_colour(12 + i * 4);
912
913 }
914
915 light_palet[0].r = 0;
916 light_palet[0].g = 0;
917 light_palet[0].b = 0;
918
919 }
920
921
922 void init_dark_palette(void)
923 {
924
925 int i;
926
927 for (i = 0; i < 256; i ++)
928 {
929 dark_palet [i].r = light_palet [i].r;
930 dark_palet [i].g = light_palet [i].g;
931 dark_palet [i].b = light_palet [i].b;
932 if (i >= GC_BLACK && i <= GC_BLUE8)
933 {
934 // if (i % 8 <= 5)
935 // {
936 dark_palet[i].r = 1;
937 dark_palet[i].g = 1;
938 dark_palet[i].b = 1;
939 // }
940 // if (i % 8 >= 6)// || i % 8 == 5)
941 // {
942 // dark_palet[i].r = limit_colour(light_palet [i].r / 2 - 2);
943 // dark_palet[i].g = limit_colour(light_palet [i].g / 2 - 2);
944 // dark_palet[i].b = limit_colour(light_palet [i].b / 2 - 2);
945 // }
946 }
947 if (i >= COLOUR_BLACK && i <= COLOUR_BLUE8)
948 {
949 dark_palet[i].r = limit_colour(((light_palet[i].r * 4) / 5) - 3);
950 dark_palet[i].g = limit_colour(((light_palet[i].g * 4) / 5) - 3);
951 dark_palet[i].b = limit_colour(((light_palet[i].b * 4) / 5) - 3);
952 }
953 }
954 }
955
956
957 void set_dark_palette(void)
958 {
959 vsync();
960 set_palette(dark_palet);
961 }
962
963 void set_light_palette(void)
964 {
965 vsync();
966 set_palette(light_palet);
967 }
968
0 void init_palette(void);
1 //int adjust_lit_colour(int col, int lit);
2 void set_dark_palette(void);
3 void set_light_palette(void);
4
5
6 /*
7 OLD:
8 1 - white
9 2 - purple
10 3 - lblue
11 4 - dblue
12 5 - yellow
13 6 - lgreen
14 7 - dgreen
15 8 - orange
16 9 - red
17 10 - dred
18 11 - white2
19 12 - lgrey
20 13 - dgrey
21
22 CURRENT:
23 1 - white
24 2 - yellow
25 3 - lgreen
26 4 - orange
27 5 - red
28 6 - dgreen
29 7 - dred
30 8 - purple
31 9 - lblue
32 10 - dblue
33 11 - white2
34 12 - lgrey
35 13 - dgrey
36 */
37
38 enum
39 {
40 TRANS_WHITE = 8,
41 TRANS_YELLOW = 16, // 199
42 TRANS_LGREEN = 24, // 200
43 TRANS_ORANGE = 32, // 202
44 TRANS_LRED = 40, // 203
45 TRANS_DGREEN = 48, // 201
46 TRANS_DRED = 56, // 204
47 TRANS_PURPLE = 64, // 196
48 TRANS_LBLUE = 72, // 197
49 TRANS_DBLUE = 80, // 198
50 TRANS_WHITE2 = 88, // 205
51 // Special white which doesn't overwrite other colours (for shockwaves etc)
52 TRANS_LGREY = 96, // 206
53 TRANS_DGREY = 104, // 207
54 TRANS_END = 105 //208
55 // must be the last trans + 1
56 };
57
58 #define LIGHT_1 220
59 #define LIGHT_2 221
60 #define DARK_1 222
61 #define DARK_2 223
62 #define TRANS_REVERSE 224
63 #define TRANS_DARKEN 225
64 #define TRANS_MONO 226
65
66 /*extern int trans_colours_array [7];
67 extern int actor_colours_array [7];*/
68
69 int colour_to_trans(int y);
70
71
72 enum
73 {
74 COLOUR_BLACK = 153,
75 COLOUR_GREY1,
76 COLOUR_GREY2,
77 COLOUR_GREY3,
78 COLOUR_GREY4,
79 COLOUR_GREY5,
80 COLOUR_GREY6,
81 //COLOUR_GREY7,
82 COLOUR_WHITE,
83 COLOUR_GREEN1,
84 COLOUR_GREEN2,
85 COLOUR_GREEN3,
86 COLOUR_GREEN4,
87 COLOUR_GREEN5,
88 COLOUR_GREEN6,
89 COLOUR_GREEN7,
90 COLOUR_GREEN8,
91 COLOUR_YELLOW1,
92 COLOUR_YELLOW2,
93 COLOUR_YELLOW3,
94 COLOUR_YELLOW4,
95 COLOUR_YELLOW5,
96 COLOUR_YELLOW6,
97 COLOUR_YELLOW7,
98 COLOUR_YELLOW8,
99 COLOUR_ORANGE1,
100 COLOUR_ORANGE2,
101 COLOUR_ORANGE3,
102 COLOUR_ORANGE4,
103 COLOUR_ORANGE5,
104 COLOUR_ORANGE6,
105 COLOUR_ORANGE7,
106 COLOUR_ORANGE8,
107 COLOUR_RED1,
108 COLOUR_RED2,
109 COLOUR_RED3,
110 COLOUR_RED4,
111 COLOUR_RED5,
112 COLOUR_RED6,
113 COLOUR_RED7,
114 COLOUR_RED8,
115 COLOUR_BLUE1,
116 COLOUR_BLUE2,
117 COLOUR_BLUE3,
118 COLOUR_BLUE4,
119 COLOUR_BLUE5,
120 COLOUR_BLUE6,
121 COLOUR_BLUE7,
122 COLOUR_BLUE8,
123 COLOUR_PURPLE1 = 10,
124 COLOUR_PURPLE2,
125 COLOUR_PURPLE3,
126 COLOUR_PURPLE4,
127 COLOUR_PURPLE5,
128 COLOUR_PURPLE6,
129 COLOUR_PURPLE7,
130 COLOUR_PURPLE8,
131 COLOUR_X1,
132 COLOUR_X2,
133 COLOUR_X3,
134 COLOUR_X4,
135 COLOUR_X5,
136 COLOUR_X6,
137 COLOUR_X7,
138 COLOUR_X8
139 //COLOUR_WRITING,
140 //COLOUR_BROWN
141
142 };
143
144
145
146 enum
147 {
148 GC_BLACK = 105,
149 GC_GREY1,
150 GC_GREY2,
151 GC_GREY3,
152 GC_GREY4,
153 GC_GREY5,
154 GC_GREY6,
155 //GC_GREY7,
156 GC_WHITE,
157 GC_GREEN1,
158 GC_GREEN2,
159 GC_GREEN3,
160 GC_GREEN4,
161 GC_GREEN5,
162 GC_GREEN6,
163 GC_GREEN7,
164 GC_GREEN8,
165 GC_YELLOW1,
166 GC_YELLOW2,
167 GC_YELLOW3,
168 GC_YELLOW4,
169 GC_YELLOW5,
170 GC_YELLOW6,
171 GC_YELLOW7,
172 GC_YELLOW8,
173 GC_ORANGE1,
174 GC_ORANGE2,
175 GC_ORANGE3,
176 GC_ORANGE4,
177 GC_ORANGE5,
178 GC_ORANGE6,
179 GC_ORANGE7,
180 GC_ORANGE8,
181 GC_RED1,
182 GC_RED2,
183 GC_RED3,
184 GC_RED4,
185 GC_RED5,
186 GC_RED6,
187 GC_RED7,
188 GC_RED8,
189 GC_BLUE1,
190 GC_BLUE2,
191 GC_BLUE3,
192 GC_BLUE4,
193 GC_BLUE5,
194 GC_BLUE6,
195 GC_BLUE7,
196 GC_BLUE8,
197 GC_PURPLE1 = 10,
198 GC_PURPLE2,
199 GC_PURPLE3,
200 GC_PURPLE4,
201 GC_PURPLE5,
202 GC_PURPLE6,
203 GC_PURPLE7,
204 GC_PURPLE8,
205 GC_X1,
206 GC_X2,
207 GC_X3,
208 GC_X4,
209 GC_X5,
210 GC_X6,
211 GC_X7,
212 GC_X8
213 //GC_WRITING,
214 //GC_BROWN
215
216 };
217
218 #define CONVERT_GREEN1 GC_GREEN1
219 #define CONVERT_YELLOW1 GC_YELLOW1
220 #define CONVERT_ORANGE1 GC_ORANGE1
221 #define CONVERT_BLUE1 GC_BLUE1
222 #define CONVERT_RED1 GC_RED1
223
224 #define CONVERT_GREEN2 COLOUR_GREEN1
225 #define CONVERT_YELLOW2 COLOUR_YELLOW1
226 #define CONVERT_ORANGE2 COLOUR_ORANGE1
227 #define CONVERT_BLUE2 COLOUR_BLUE1
228 #define CONVERT_RED2 COLOUR_RED1
229
230
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: pickup.c
25 History:
26 11/9/2003 - Version 1.0 finalised
27
28 This file contains:
29 - pickups (energy, repair etc)
30
31 */
32
33 #include "allegro.h"
34
35 #include "config.h"
36 #include "globvars.h"
37
38 #include "stuff.h"
39 #include "palette.h"
40 #include "cloud.h"
41
42 void manage_pickup(int p);
43
44 void destroy_pickup(int p);
45 void pickup_explodes(int p, int taken);
46
47
48
49 void init_pickups(void)
50 {
51
52 int p;
53
54 for (p = 0; p < NO_PICKUPS; p++)
55 {
56 pickup[p].type = PICKUP_NONE;
57 }
58
59 }
60
61 int create_pickup(int type, int subtype, int x, int y, int timeout)
62 {
63
64 if (arena.hostile > 0)
65 return -1;
66
67 int p;
68
69 for (p = 0; p < NO_PICKUPS; p++)
70 {
71 if (p == NO_PICKUPS - 1) return -1;
72 if (pickup[p].type == PICKUP_NONE) break;
73 }
74
75 pickup[p].type = type;
76 if (subtype == -1)
77 {
78 switch(type)
79 {
80 case PICKUP_SQUARE:
81 case PICKUP_CIRCLE:
82 case PICKUP_TRIANGLE:
83 subtype = grand(4);
84 break;
85 case PICKUP_SECONDARY:
86 subtype = 1 + grand(6);
87 break;
88 }
89 }
90 pickup[p].subtype = subtype;
91 pickup[p].x = x;
92 pickup[p].y = y;
93 pickup[p].radius = 8000; // generous
94 pickup[p].timeout = timeout;
95 pickup[p].counter = 256 - counter;
96
97 return p;
98
99 }
100
101
102
103 void run_pickups(void)
104 {
105
106 int p;
107
108 for (p = 0; p < NO_PICKUPS; p++)
109 {
110 if (pickup[p].type != PICKUP_NONE)
111 manage_pickup(p);
112 }
113
114 }
115
116
117 void manage_pickup(int p)
118 {
119 pickup[p].timeout --;
120 pickup[p].counter ++;
121 if (pickup[p].timeout <= 0)
122 {
123 switch(pickup[p].type)
124 {
125 case PICKUP_SQUARE:
126 // case PICKUP_CROSS:
127 case PICKUP_CIRCLE:
128 case PICKUP_TRIANGLE:
129 if (pickup[p].subtype == ABILITY_DEFENCE)
130 pickup[p].subtype = ABILITY_PRIMARY;
131 else
132 pickup[p].subtype ++;
133 pickup[p].timeout = SYMBOL_TIMEOUT;
134 break;
135 case PICKUP_PRESYMBOL:
136 if (arena.hostile > 0)
137 {
138 pickup_explodes(p, 0);
139 break;
140 }
141 pickup[p].type = pickup[p].subtype;
142 pickup[p].subtype = grand(4);
143 pickup[p].timeout = SYMBOL_TIMEOUT;
144 int passing_colours [4] = {TRANS_DRED, TRANS_ORANGE, TRANS_YELLOW, TRANS_WHITE};
145 create_cloud(CLOUD_SHOCKWAVE,
146 pickup[p].x,
147 pickup[p].y,
148 0, 0,
149 0,
150 0,
151 150,10,0, 0, 150, 0, passing_colours);
152 break;
153 case PICKUP_PRESECONDARY:
154 if (arena.hostile > 0)
155 {
156 pickup_explodes(p, 0);
157 break;
158 }
159 pickup[p].type = PICKUP_SECONDARY;
160 pickup[p].timeout = 900;
161 break;
162 default:
163 pickup_explodes(p, 0);
164 return;
165 }
166 }
167 }
168
169 void pickup_explodes(int p, int taken)
170 {
171 int passing_colours [5];
172
173 if (pickup[p].type == PICKUP_SECONDARY)
174 {
175 passing_colours [0] = TRANS_YELLOW;
176 passing_colours [1] = TRANS_ORANGE;
177 passing_colours [2] = TRANS_LRED;
178 passing_colours [3] = TRANS_DRED;
179 create_cloud(CLOUD_SHRINKING_FADING_CIRCLE,
180 pickup[p].x,
181 pickup[p].y,
182 0, 0, 0, 0,
183 300, -200, 5, 0, 0, 0, passing_colours);
184 create_cloud(CLOUD_SHRINKING_FADING_CIRCLE,
185 pickup[p].x,
186 pickup[p].y,
187 0, 0, 0, 0,
188 300, -300, 10, 0, 0, 0, passing_colours);
189 create_cloud(CLOUD_SHRINKING_FADING_CIRCLE,
190 pickup[p].x,
191 pickup[p].y,
192 0, 0, 0, 0,
193 300, -400, 15, 0, 0, 0, passing_colours);
194 destroy_pickup(p);
195 return;
196 }
197
198 if (pickup[p].type == PICKUP_PRESECONDARY
199 || pickup[p].type == PICKUP_PRESYMBOL)
200 {
201 destroy_pickup(p);
202 return;
203 // presymbol can be exploded if time expires
204 }
205
206 if (pickup[p].type == PICKUP_REPAIR)
207 {
208 passing_colours [0] = TRANS_ORANGE;
209 passing_colours [1] = TRANS_ORANGE;
210 passing_colours [2] = TRANS_LRED;
211 passing_colours [3] = TRANS_DRED;
212 }
213 else
214 switch(pickup[p].subtype)
215 {
216 case ABILITY_PRIMARY:
217 passing_colours [0] = TRANS_YELLOW;
218 passing_colours [1] = TRANS_YELLOW;
219 passing_colours [2] = TRANS_YELLOW;
220 passing_colours [3] = TRANS_ORANGE;
221 break;
222 case ABILITY_SECONDARY:
223 passing_colours [0] = TRANS_DRED;
224 passing_colours [1] = TRANS_DRED;
225 passing_colours [2] = TRANS_DRED;
226 passing_colours [3] = TRANS_DGREY;
227 break;
228 case ABILITY_DRIVE:
229 passing_colours [0] = TRANS_LGREEN;
230 passing_colours [1] = TRANS_LGREEN;
231 passing_colours [2] = TRANS_DGREEN;
232 passing_colours [3] = TRANS_DGREY;
233 break;
234 case ABILITY_DEFENCE:
235 passing_colours [0] = TRANS_LBLUE;
236 passing_colours [1] = TRANS_LBLUE;
237 passing_colours [2] = TRANS_DBLUE;
238 passing_colours [3] = TRANS_DGREY;
239 break;
240 }
241
242 int i, angle, xs;
243
244 for (i = 0; i < 20; i ++)
245 {
246 angle = grand(ANGLE_FULL);
247 xs = 2000 + grand(6000);
248 create_cloud(CLOUD_BLAST_CIRCLE,
249 pickup[p].x,
250 pickup[p].y,
251 0, 0,
252 xpart(angle, xs),
253 ypart(angle, xs),
254 55 + grand(20),2,0, 0, 0, 0, passing_colours);
255 }
256
257 create_cloud(CLOUD_LIGHT,
258 pickup[p].x,
259 pickup[p].y,
260 0, 0, 0, 0,
261 800 + grand(300),10,3, 0, 0, 0, passing_colours);
262
263 /*
264 create_cloud(CLOUD_SHOCKWAVE,
265 pickup[p].x,
266 pickup[p].y,
267 0, 0,
268 0,
269 0,
270 150,10,0, 0, 150, 0, passing_colours);
271 */
272
273 // can return earlier
274 destroy_pickup(p);
275 return;
276 }
277
278 void destroy_pickup(int p)
279 {
280 pickup[p].type = PICKUP_NONE;
281 }
282
283
284 void explode_all_pickups(void)
285 {
286
287 int p;
288
289 for (p = 0; p < NO_PICKUPS; p++)
290 {
291 if (pickup[p].type != PICKUP_NONE)
292 pickup_explodes(p, 0);
293 }
294
295 }
296
297 /*
298
299 Upgrades:
300
301
302 */
0 void init_pickups(void);
1 void destroy_pickup(int p);
2 void pickup_explodes(int p, int taken);
3 void run_pickups(void);
4 int create_pickup(int type, int subtype, int x, int y, int timeout);
5 void explode_all_pickups(void);
6
0 *******************************************
1
2 OVERGOD
3
4 Version 1.0
5
6 Copyright 2005 Linley Henzell
7
8 *******************************************
9
10
11
12 Overgod is distributed under the terms of the Free Software Foundation's General Public Licence (GPL) - see the file LICENCE.TXT. It comes with no warranty, and no liability is accepted for any harm it may do to you or your computer. In the unlikely event that it causes you some injury, contact your MP or other local representative. Read the licence for more information.
13
14 The source code should be available from http://users.olis.net.au/zel/
15 If it's not there, try contacting l_henzell at yahoo.com.au to find out where it's gone.
16 Also use that address for any comments, complaints, threats etc.
17
18 If you like Overgod, you might also like some of my other games:
19 - Lacewing (quite similar to this game, because it's built on the same engine)
20 - Captain Pork's World of Violence (a not-very-good Liero clone, which I wrote to teach myself Allegro and networking)
21 - Captain Pork's Revenge (a slightly better Liero clone, but still not very good)
22 - Crawl (A 'rogue-like' adventure game, a bit like Nethack. Try the Japanese graphical version if you don't like text mode)
23
24
25
26 *******************************************
27 Contents
28 *******************************************
29
30 1. Acknowledgements
31 2. Introduction
32 3. Controls
33 4. Upgrading
34 5. Configuration
35 6. PAQ
36
37
38
39 *******************************************
40 1. Acknowledgements
41 *******************************************
42
43 Overgod was made with:
44 - The MingW version of the Gnu Compiler Collection C compiler
45 - Bloodshed Software's Dev-C++
46 - The Allegro libraries
47 - The GIMP (for graphics)
48 - Psycle (for sound) and various VSTs, including a set by Erik Wollo
49 - Audacity (for sample editing)
50
51 Many thanks to anyone who worked on any of these excellent free programs!
52
53
54
55 *******************************************
56 2. Introduction
57 *******************************************
58
59
60 For too long has the world been ruled by cruel and disputatious gods! It's time someone did something about it. You have constructed a vehicle in which to visit the outer layers of the Celestial Oversphere and do battle with those who sit in judgement on the Universe. Failure means oblivion, or worse. Success will strike a blow at the shackles which bind humanity, and let you join or even supplant those you have conquered!
61
62 Your vehicle is a marvel of transplanar engineering, capable of travelling to worlds beyond our knowledge and making use of the strange energies which there exist. Long years of research and intricate labour have allowed you to build weapons capable of tearing through the substance of even the most exalted ones, and you have made the appropriate pacts to enable your craft to reconstitute itself a limited number of times should its substance fail you. Now it is ready to leave this place behind and venture to where your existence is forbidden.
63
64 Your task will not be an easy one. On each layer of the Oversphere you must fight your way through the lesser gods, greater gods, elder gods, younger gods, demigods, demiurges, idols, sub-idols, undergods and overgods, and all of their children, slaves, servants, soldiers, sentinels, guardians, messengers and machines. Most of the enemies you meet must be destroyed for you to reach the next layer. The larger enemies are worth several of their smaller kin, while there are some whose destruction may be useful but is not required. A secret ritual has shut the fearsome Eyes of the Watchful Ones, although only for a time. You will have from two to three minutes in each layer before they open again, so don't tarry!
65
66 You can tell which enemies you need to destroy by looking at your overview on the bottom right of the screen. Essential targets are large yellow dots, while unimportant ones are small and orange. The amount of time you have, and your progress through the layer, are indicated on the top left of the screen, while on the bottom left you can check how well your vehicle is holding up against the fury of your enemies and how many lives you have.
67
68 To start a game, select the Start Game option and, when prompted, press fire. If you want to play a cooperative game, both players press fire. Each vehicle you can choose has a particular speciality.
69
70 If the normal game isn't frantic enough for you, go to the Special menu and choose a Time Attack game. Here the goal is to survive for as long as possible. Every essential target you destroy gets you a few extra seconds, and the bigger targets give more time. You don't get extra time for taking out non-essential targets or the smaller parts of a larger enemy, and you lose 30 seconds when you're destroyed. Each enemy lasts for about one minute then disappears, so make sure you get them before they go! You can also play Time Attack cooperatively.
71
72 The Special menu also includes Duel Mode, which lets two players fight it out between them, although the game isn't very well-balanced for this. The options here are pretty obvious, except for the Handicap option - it amplifies all damage taken by the leading player.
73
74 Below Duel Mode are some challenge mode settings which you have to unlock by playing the main game. They make things even more difficult than they need to be.
75
76
77
78 *******************************************
79 3. Controls
80 *******************************************
81
82
83 You can set up the controls in the Options menu. Here is what each command does:
84
85 - Forwards
86 Accelerates you forwards. Your vehicle encounters an increasing amount of drag as it speeds up, so it won't keep accelerating forever.
87
88 - Left and Right
89 Turns your craft.
90
91 - Brakes
92 Operates a special field which greatly increases drag. Use this to stop quickly or execute quick turns.
93
94 - Fire Darts
95 Fires your vehicle's main weapon.
96
97 - Fire Secondary
98 Fires your vehicle's secondary weapon, if you have one and if it's ready.
99
100 - Toggle Link Fire
101 If Link fire is on, firing your darts also fires your secondary weapon as soon as it's ready. This is useful or annoying depending on which weapon you have, so turn it on or off accordingly.
102
103 - Escape
104 The Escape key always pauses the game and lets you quit.
105
106
107
108 *******************************************
109 4. Upgrading
110 *******************************************
111
112
113 Your vehicle is pretty weak to start off with, so you'll need to upgrade it to have a chance of success. There are a few types of object you can gather from the dust, ashes and froth left by your departed enemies in order to accumulate enough power to push through the layers:
114
115 - Repairs
116 These are orange crosses, and they fix your craft up a bit.
117
118 - Secondary Weapons
119 Weapons to back up your darts. There are several different types, some of them more useful than others. Generally, the easier a weapon is to hit with the less damage it will do, so Orbs do a lot more damage than Worms, for example. You lose your current weapon when you are destroyed.
120
121 - Symbols
122 These are important! Symbols come in three shapes, and they cycle through various colours for a grand total of twelve different types. As you pick them up, they are added to the row along the bottom of your screen. Here is what each type does:
123
124 Yellow Symbols
125 Square - makes your darts fire more often.
126 Circle - lets you fire extra darts, which do half the damage of your main darts.
127 Triangle - makes your darts fly faster.
128
129 Green Symbols
130 Square - increases the thrust produced by your engine(s), but also adds extra drag while you are accelerating (not at other times). This increases manoeuvreability but can reduce top speed. It makes your vehicle handle more like a car.
131 Circle - lets you turn more quickly.
132 Triangle - increases the thrust produced by your engine(s) by a little bit, and also reduces drag all the time. It makes your vehicle handle more like a hovercraft.
133
134 Red Symbols
135 Square - increases the damage your secondary weapon does by about a third (so with one red square it will do 133% damage, and with two it will do 166%, etc).
136 Circle - increases the number of times your weapon fires or the number of submunitions it produces, depending on which weapon you have.
137 Triangle - generally increases speed and range, and may affect duration. Increases the destructive radius of exploding weapons.
138
139 Blue Symbols
140 Square - adds armour to the outside of your vehicle. You can see how much armour you have by looking at the bottom left of the screen.
141 Circle - lets your vehicle generate a protective sheath.
142 Triangle - increases the rate at which your sheath restores itself.
143
144
145 Symbols are stable for longer than each level lasts, so you don't have to worry about them expiring before you run out of time. They do go away when the Eyes open, though.
146
147 You don't lose symbols when your craft is destroyed.
148
149
150
151 *******************************************
152 5. Configuration
153 *******************************************
154
155
156 The Options menu has a whole lot of interface options you can set. Here is what they do.
157
158 - Sound
159 Lets you turn the game's sound on or off, or choose whether to play it in mono or stereo. In a one-player game the stereo option pans the sound according to where it's coming from. You can also reverse the stereo if you have your speakers set up that way.
160
161 - Volume
162 Lets you set the volume for sound effects and 'music'. If you set the music volume to zero it won't play at all, which might improve performance a little.
163
164 - Video Sync
165 Turning this on synchronises the display with your monitor's vertical retrace. This prevents a kind of shearing flicker effect which some people find annoying, but makes the game skip frames on slower computers.
166
167 - Test Speakers
168 Find out where the left and right speakers are.
169
170 - Test Keys
171 Most keyboards have a problem which prevents them detecting certain combinations of keypresses, making cooperative and duel modes almost unplayable. Use Test Keys to work out which combinations work best.
172
173 - Resolution
174 Choose between 640x480 and 800x600, windowed and fullscreen. You'll have to restart the game for this to take effect. If you switch resolutions and the game crashes on start-up (Allegro has trouble with some video cards), edit the overgod.cfg file and change
175 Resolution=1 [or 2, 3, 4]
176 to
177 Resolution=0
178
179 - Colour Text
180 If you have trouble distinguishing colours, this option will tell you what colour a symbol is.
181
182
183
184 *******************************************
185 6. PAQ
186 *******************************************
187
188
189 I haven't been asked any questions about Overgod yet, so I can't have a proper FAQ. Instead, here is a list of Pre-emptively Answered Questions:
190
191
192 Q: What are the system requirements?
193 A: It runs well on my Celeron 500MHz with 128MB RAM, and it will run on something less powerful without too much trouble. I'd say 300MHz would be about it, and memory isn't likely to be a problem (8-bit sprites don't take up so much space). It doesn't require any kind of special graphics card, just SVGA.
194
195
196 Q: I get a file-not-found error message, or something.
197 A: Did you decompress the game with the 'preserve subdirectories' option? If you did, there should be a gfx and a wavs directory from the main directory. If you didn't, delete it and try again.
198
199
200 Q: The game crashes on start-up.
201 A: Edit the overgod.cfg file and set both the Sound_init and Resolution options to zero. This might work. If it doesn't, sorry.
202
203
204 Q: The game looks jerky.
205 A: This is probably because your computer is having trouble keeping up with the graphics, so it's skipping frames. The best way to speed things up is to switch to 640x480 fullscreen resolution, although that doesn't let you see as far. Turning off Video Sync will also help a lot if you don't mind the shearing effect (doesn't bother me). Turning off the 'music' may help a little bit, too.
206
207
208 Q: The sound is a bit dodgy, and misses effects every now and then.
209 A: This seems to be a problem with Allegro's sound support under Win95 and Win98. Nothing I can do, sorry. Turning off the 'music' may help a bit, as your sound card won't be so heavily spammed with samples.
210
211
212 Q: Is it actually possible to finish this game?
213 A: Yes, just very difficult. Keep on practising! Time Attack never ends, though.
214
215
216 Q: This game is so unfair! One time I got mostly circles, so I had plenty of worms but they never hit anything and when they did they didn't hurt it, and the next game I didn't get any circles at all. Also I keep on getting the hard enemies.
217 A: It is unfair, isn't it? Just like life.
218
219
220 Q: Why don't you add a password or saved game system?
221 A: Overgod is unfair because it's random, and it's random because that makes it different each time you play. This means that every time you face a different challenge, so save games are unnecessary. In my opinion. Besides, it takes less than half an hour to play all the way through, so you hardly need to span your playing sessions over multiple days.
222
223
224 Q: Why doesn't this game have joystick support?
225 A: Because I don't have one to test it on. Anyone who wants to write joystick support and send it to me is encouraged to do so!
226
227
228 Q: Why don't you write a networked version?
229 A: Because that would be really hard.
230
231
232 Q: I want to write a patch/port/fork.
233 A: Great! If you would like to patch or port Overgod, please contact me first to make sure you have the most recent version of the source code. If you want to fork it, go crazy. Contact me if you have any questions about the source (I should warn you that I learned to program in Commodore 64 BASIC and taught myself C from the Borland Turbo C++ manual, which explains a lot about the quality of Overgod's code. At least I no longer use goto).
234
235
236
237 Have fun!
238
239 - Linley
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: score.c
25 History:
26 11/9/2003 - Version 1.0 finalised
27
28 This file contains:
29 - functions dealing with keeping score
30
31 */
32
33 #include "allegro.h"
34
35 //#include <stdlib.h>
36 #include <string.h>
37
38 #include "config.h"
39 #include "globvars.h"
40
41 #include "stuff.h"
42
43 #include "palette.h"
44
45 #include "game.h"
46 //#include "upgrades.h"
47 #include "display.h"
48
49 #define NO_SCORES 20
50 // also #def'd in menu.c
51
52
53 struct score_list
54 {
55 int score;
56 int ship;
57 int level;
58 char name [20];
59 };
60
61 extern struct score_list hs_single [NO_SCORES];
62 extern struct score_list hs_coop [NO_SCORES];
63
64 extern struct score_list *hscore;
65
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: sound.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - sound initialisation and playing.
30 enums in sound.h
31
32 */
33
34 #include "allegro.h"
35
36 #include <string.h>
37
38 #include "sound.h"
39
40 #include "config.h"
41 #include "globvars.h"
42
43 #include "math.h"
44 #include "stuff.h"
45 //DATAFILE *soundf;
46
47 //SAMPLE *sound_list [10];
48
49 //#define SOUND_OFF
50
51 #define BEAT 64
52 #define HALF_BEAT 32
53 #define QUARTER_BEAT 16
54 #define Q3_BEAT 48
55 #define SMALLEST_BEAT 16
56
57 #define MAX_PHRASES 80
58 #define MAX_PHRASE_LENGTH 150
59 #define MAX_OVERPHRASES 100
60
61 #define NO_TONES 56
62 #define BASE_TONE 50
63 // if 100, max tone = 43
64
65 int debug_sound [5];
66
67 enum
68 {
69 CHORD_MAJOR,
70 CHORD_MINOR,
71 CHORD_3,
72 NO_CHORDS
73 };
74
75 #define NO_JUMPS 7
76
77 #define NO_LONGPROGS 6
78 #define SIZE_LONGPROGS 25
79
80 enum
81 {
82 NOTE_0C,
83 NOTE_0CS,
84 NOTE_0D,
85 NOTE_0DS,
86 NOTE_0E,
87 NOTE_0F,
88 NOTE_0FS,
89 NOTE_0G,
90 NOTE_0GS,
91 NOTE_0A,
92 NOTE_0AS,
93 NOTE_0B,
94 NOTE_1C,
95 NOTE_1CS,
96 NOTE_1D,
97 NOTE_1DS,
98 NOTE_1E,
99 NOTE_1F,
100 NOTE_1FS,
101 NOTE_1G,
102 NOTE_1GS,
103 NOTE_1A,
104 NOTE_1AS,
105 NOTE_1B,
106 NOTE_2C,
107 NOTE_2CS,
108 NOTE_2D,
109 NOTE_2DS,
110 NOTE_2E,
111 NOTE_2F,
112 NOTE_2FS,
113 NOTE_2G,
114 NOTE_2GS,
115 NOTE_2A,
116 NOTE_2AS,
117 NOTE_2B,
118 NOTE_ENDNOTE
119
120 };
121
122 int long_prog [NO_LONGPROGS] [SIZE_LONGPROGS] =
123 {
124 {NOTE_1C, NOTE_1E, NOTE_1G, NOTE_2C, NOTE_1G, NOTE_1E, NOTE_0AS, NOTE_1D, NOTE_1F, NOTE_1AS, NOTE_1F, NOTE_0AS, NOTE_ENDNOTE},
125 {NOTE_1C, NOTE_1DS, NOTE_1C, NOTE_1F, NOTE_1C, NOTE_1FS, NOTE_1C, NOTE_1G, NOTE_1C, NOTE_1AS, NOTE_1C, NOTE_2C, NOTE_ENDNOTE},
126 {NOTE_1C, NOTE_2C, NOTE_1AS, NOTE_1G, NOTE_1FS, NOTE_1F, NOTE_1DS, NOTE_ENDNOTE},
127 {NOTE_1C, NOTE_1G, NOTE_2C, NOTE_1C, NOTE_1G, NOTE_2C, NOTE_1C, NOTE_2C, NOTE_ENDNOTE},
128 {NOTE_1C, NOTE_1E, NOTE_1G, NOTE_2C, NOTE_2E, NOTE_1G, NOTE_2C, NOTE_2E, NOTE_ENDNOTE},
129 {NOTE_1DS, NOTE_0G, NOTE_0AS, NOTE_0FS, NOTE_0G, NOTE_1C, NOTE_1FS, NOTE_1F, NOTE_ENDNOTE}
130 //{NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1,
131 //{NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1,
132 //{NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1, NOTE_1,
133 };
134
135 int chord_jumps [NO_CHORDS] [NO_JUMPS] =
136 {
137 {NOTE_1C, NOTE_1D, NOTE_1E, NOTE_1F, NOTE_1G, NOTE_1GS, NOTE_2C},
138 {NOTE_1C, NOTE_1D, NOTE_1DS, NOTE_1G, NOTE_1GS, NOTE_1B, NOTE_2C},
139 {NOTE_1C, NOTE_1D, NOTE_1E, NOTE_1F, NOTE_1G, NOTE_1GS, NOTE_2C}
140 };
141
142 int success_note [3];
143 int success_samp;
144 int success_step;
145 int success_base;
146
147
148 int tone [NO_TONES];
149
150 #define PROG_LENGTH 40
151 #define NO_PROGS 4
152
153 int progression [NO_PROGS] [PROG_LENGTH];
154 int prog_pos [NO_PROGS];
155 int prog_base [NO_PROGS];
156 int prog_length [NO_PROGS];
157
158 enum
159 {
160 BEAT_DRUM1,
161 BEAT_DRUM2,
162 BEAT_LOWDRUM,
163 BEAT_STICK,
164 BEAT_BELL_S,
165 BEAT_BASS,
166 BEAT_BASS2,
167 BEAT_STRING,
168
169 BEAT_TWIRM, // here and above: common beats. Below: rarer beats
170 BEAT_ZAPDRUM1,
171 BEAT_ZAPDRUM2,
172 BEAT_PPIPE,
173 BEAT_SPARKLE,
174 BEAT_BELL_L,
175 BEAT_MOSQ,
176 BEAT_SPACE,
177 BEAT_SWEEP,
178 BEAT_TING,
179 //BEAT_OBOE,
180 BEAT_REVERSE,
181 BEAT_SAW,
182 //BEAT_BASSOON,
183 BEAT_BRASS,
184 BEAT_CHOIR,
185 BEAT_FLUTE,
186 BEAT_ODD,
187 BEAT_REVERSE2,
188 BEAT_ACCORD,
189
190
191 NO_BEATS,
192 BEAT_EMPTY
193 };
194
195
196 struct beat_phrase_struct
197 {
198 int samp;
199 int pitch;
200 int rand_pitch;
201 int pan;
202 int rand_pan;
203 int melody;
204 int vol;
205 };
206
207 struct beat_phrase_struct beat_phrase [MAX_PHRASES] [MAX_PHRASE_LENGTH];
208
209 int over_beat_phrase [MAX_OVERPHRASES];
210
211 int bpos;
212 int over_bpos;
213
214 int phrase_length;
215 int over_phrase_length;
216 int over_phrase_loop_point;
217
218 #define MAX_MELODIES 5
219 #define MAX_MELODY_LENGTH 400
220 #define MAX_OVERMELODIES 20
221
222 enum
223 {
224 OVERMELODY_REPEAT,
225 OVERMELODY_FILL
226 }; // for overmelody_mode
227
228 struct overmelody_struct
229 {
230 int mel;
231 int key;
232 int start;
233 };
234
235
236 struct overmelody_struct overmelody [MAX_OVERMELODIES];
237
238 struct beat_phrase_struct melody [MAX_MELODIES] [MAX_MELODY_LENGTH];
239
240 int melody_active [MAX_MELODIES];
241 int mpos [MAX_MELODIES];
242 int over_mpos;
243 int over_mpos2;
244 int overmelodies;
245 int overmelody_mode;
246 int overmelody_fill_length;
247 int melodies_played;
248 int melody_length [MAX_MELODIES];
249 int mdelay [MAX_MELODIES];
250 //int total_melody_delay;
251
252 extern struct optionstruct options;
253
254
255 SAMPLE *beat [NO_BEATS];
256
257
258
259 //SAMPLE *sounds [NO_WAVS];
260 SAMPLE *new_sounds [NO_NWAVS];
261
262 char sound_active;
263
264 void check_sound(SAMPLE *samp);
265 void load_sample_in(int samp, const char *sfile);
266 void load_new_sample_in(int samp, const char *sfile);
267 void copy_phrase(int target, int source);
268 //void play_beat(int samp);
269 //void play_beatf(int samp, int freq);
270 void play_beatfvp(int samp, int freq, int vol, int pan);
271 void play_successfvp(int samp, int freq, int vol, int pan);
272 void init_beat(void);
273 void load_beat_sample_in(int samp, const char *sfile);
274 void calculate_beat(void);
275 void calculate_melody(int active);
276 void play_melody(void);
277 void copy_melody(int t, int s);
278 void add_note(int beat, int bp1, int bp2, int pitch, int rand_pitch, int pan, int vol, int mel);
279 void add_over_phrase(int phrase, int start, int finish);
280 void add_melody_note(int samp, int melody, int mp2, int pitch, int rand_pitch, int pan, int vol);
281 void add_melody_string1(int samp, int mp1, int length, int chords);
282 //void assign_beat(int index, int beaty, int subtype);
283 void create_progression(int which, int length, int key);
284 void play_success_sound(void);
285
286 //int ppos;
287 //int plength;
288
289
290
291 void init_sound(void)
292 {
293 #ifdef SOUND_OFF
294 return;
295 #endif
296
297
298 int i, j;
299 float t;
300
301 for (i = 0; i < NO_TONES; i ++)
302 {
303 t = (float) BASE_TONE;
304 for (j = 0; j < i; j ++)
305 {
306 t *= (float) (1000 + (1000 / 13)) / 1000;
307 }
308 tone [i] = t;
309 // saves me from having to remember how to use the pow function
310 }
311
312 sound_active = 1;
313
314 if (options.sound_init == 0)
315 {
316 // cprintf("\n\r\n\rSound disabled in proj.cfg.");
317 // allegro_message("\n\r\n\rSound disabled in config file.\n\r");
318 // allegro_message("\n\r\n\rSound disabled in config file.\n\r");
319 // rest(500);
320 sound_active = 0;
321 return;
322 }
323
324 reserve_voices(16, 0);
325 if (install_sound (DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) == -1)
326 {
327 // allegro_message("\n\r\n\rSound autodetect failed.");
328 sound_active = 0;
329 // rest(300);
330 // do
331 // {
332 // } while (keypressed() == 0);
333 }
334 set_volume(255, 0);
335
336 load_new_sample_in(NWAV_ALARM, "alarm");
337 load_new_sample_in(NWAV_BANG, "bang");
338 load_new_sample_in(NWAV_BIGBANG, "bigbang");
339 load_new_sample_in(NWAV_BLAST, "blast");
340 load_new_sample_in(NWAV_BLOCK, "block");
341 load_new_sample_in(NWAV_BUMP, "bump");
342 load_new_sample_in(NWAV_BUMP2, "bump2");
343 load_new_sample_in(NWAV_BURST, "burst");
344 load_new_sample_in(NWAV_SHORTBURST, "bursts");
345 load_new_sample_in(NWAV_BURSTZ, "burstz");
346 load_new_sample_in(NWAV_BURSTZL, "burstzl");
347 load_new_sample_in(NWAV_CHIME, "chime");
348 load_new_sample_in(NWAV_CHIME2, "chime2");
349 load_new_sample_in(NWAV_CHIRP, "chirp2");
350 load_new_sample_in(NWAV_CLICK, "click");
351 load_new_sample_in(NWAV_CYMBAL, "cymbal");
352 load_new_sample_in(NWAV_DART, "dart");
353 load_new_sample_in(NWAV_DNO, "dno");
354 load_new_sample_in(NWAV_DRIVE, "drive");
355 // load_sample_in(WAV_ENGINE, "engine");
356 load_new_sample_in(NWAV_EXTRA, "extra");
357 load_new_sample_in(NWAV_EYE, "eye");
358 load_new_sample_in(NWAV_GAMEOVER, "gameover");
359 load_new_sample_in(NWAV_GBLAT, "gblat");
360 load_new_sample_in(NWAV_JET, "jet");
361 load_new_sample_in(NWAV_LAUNCH, "launch");
362 load_new_sample_in(NWAV_LZAP, "longzap");
363 load_new_sample_in(NWAV_MENU, "menu");
364 load_new_sample_in(NWAV_MINEBANG, "minebang"); // not mines - pulser arms
365 load_new_sample_in(NWAV_PHASE, "phase");
366 load_new_sample_in(NWAV_PPIPE, "ppipe");
367 load_new_sample_in(NWAV_PUFF, "puff");
368 load_new_sample_in(NWAV_REPAIR, "repair");
369 load_new_sample_in(NWAV_SEEKER, "seeker");
370 load_new_sample_in(NWAV_SHADOW, "shadow");
371 load_new_sample_in(NWAV_SZAP, "sharpzap");//szap");
372 load_new_sample_in(NWAV_SHIELD, "shield");
373 load_new_sample_in(NWAV_SHIELDE, "shielde");
374 load_new_sample_in(NWAV_SPAWN, "spawn");
375 load_new_sample_in(NWAV_SPLERK, "splerk");
376 load_new_sample_in(NWAV_BALL1, "squelch1");
377 load_new_sample_in(NWAV_MULTI, "squelch2");
378 load_new_sample_in(NWAV_SUCCESS, "success");
379 load_new_sample_in(NWAV_SYMBOL, "symbol");
380 load_new_sample_in(NWAV_TEETH, "teeth");
381 load_new_sample_in(NWAV_TWING, "twing"); // ouch sound
382 load_new_sample_in(NWAV_WARBLE, "warble");
383 load_new_sample_in(NWAV_WARBLEB, "warbleb");
384 load_new_sample_in(NWAV_WHINE, "whine4");
385 load_new_sample_in(NWAV_WORMS, "worms");
386 load_new_sample_in(NWAV_ZAPSTEP, "zapstep");
387
388
389
390 // load_new_sample_in(NWAV_, "");
391
392 /*
393 load_sample_in(WAV_CANNON, "zap");
394 load_sample_in(WAV_WOBBLE, "wobble");
395 load_sample_in(WAV_LONG_WOBBLE, "longwob");
396 load_sample_in(WAV_WARP_IN, "warp_in");
397 load_sample_in(WAV_BANG1, "bangs");
398 load_sample_in(WAV_WHINE, "whine");
399 load_sample_in(WAV_BUMP, "bump");
400 load_sample_in(WAV_BOSS2, "boss2");//_2");
401 load_sample_in(WAV_STING, "sting");
402 load_sample_in(WAV_HARD_ZAP, "hardzap");
403 load_sample_in(WAV_BLORT, "blort");
404 load_sample_in(WAV_BLAST, "blast");
405 load_sample_in(WAV_ALARM, "alarm");
406 load_sample_in(WAV_MISSILE, "missile");
407 load_sample_in(WAV_ZAPNOTE1, "zapnote1");
408 load_sample_in(WAV_ZAPNOTE2, "zapnote2");
409 load_sample_in(WAV_MINE, "mine");
410 load_sample_in(WAV_SHORTZAP, "shortzap");
411 load_sample_in(WAV_BLAT, "blat");
412 load_sample_in(WAV_SHORTZAP2, "shortz2");
413 load_sample_in(WAV_SUN, "sun");
414 load_sample_in(WAV_THRUM, "thrum");
415 load_sample_in(WAV_CROAK, "croak");
416 load_sample_in(WAV_MINEBANG, "minebang");
417 load_sample_in(WAV_ASPAWN, "aspawn");
418 load_sample_in(WAV_GAME_OVER, "gover2");
419 load_sample_in(WAV_TUBE, "tube");
420 load_sample_in(WAV_UPGRADE, "upgr");
421 load_sample_in(WAV_SHIELD, "shield");
422 load_sample_in(WAV_REPAIR, "repair");
423 load_sample_in(WAV_SEEKMINE, "seekmine");
424 load_sample_in(WAV_PLASMA, "plasma");
425
426 load_sample_in(WAV_LEVEL_END, "finish");
427 load_sample_in(WAV_MENU1, "menu1");
428 load_sample_in(WAV_MENU2, "menu2");
429 load_sample_in(WAV_EXTRA_SHIP, "extra");
430 load_sample_in(WAV_ORBITAL, "orbital");
431 load_sample_in(WAV_PICKUP_UPGRADE, "pickup");
432 load_sample_in(WAV_SEEKBLOB_BANG, "seekb");
433 load_sample_in(WAV_BUMP2, "bump2");
434 load_sample_in(WAV_HIT, "hit");
435 load_sample_in(WAV_HOSTILE, "buzzzap");
436 // load_sample_in(WAV_MUTATE, "mutate");
437 // load_sample_in(WAV_, "");
438 */
439 init_beat();
440
441 // priority->sound_list[WAV_POP] = 1;
442
443 }
444
445 void load_new_sample_in(int samp, const char *sfile)
446 {
447
448 char sfile_name [50];
449
450 strcpy(sfile_name, ".//wavs//");
451 strcat(sfile_name, sfile);
452 strcat(sfile_name, ".wav");
453
454 new_sounds [samp] = load_sample(sfile_name);
455
456 if (new_sounds [samp] == NULL)
457 {
458 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
459 allegro_message("Fatal Error: Unable to load sound file: %s", sfile_name);
460 exit(1);
461 }
462 }
463
464 /*void load_sample_in(int samp, const char *sfile)
465 {
466
467 char sfile_name [50];
468
469 strcpy(sfile_name, ".//sound//");
470 strcat(sfile_name, sfile);
471 strcat(sfile_name, ".wav");
472
473 sounds [samp] = load_sample(sfile_name);
474
475 if (sounds [samp] == NULL)
476 {
477 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
478 allegro_message("Fatal Error: Unable to load sound file: %s", sfile_name);
479 exit(1);
480 }
481 }
482
483 */
484 /*
485 void load_sample_in(SAMPLE *samp)
486 {
487 if (samp == NULL)
488 {
489 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
490 allegro_message("Fatal Error: Unable to load sound file");
491 exit(1);
492 }
493 }
494 */
495 /*
496 void play_sound(int sample)
497 {
498 #ifdef SOUND_OFF
499 return;
500 #endif
501
502 if (sound_active == 0 || options.sound_volume == 0) return;
503 play_sample(sounds [sample], (int) (250 * options.sound_volume) / 100, 127, 1000, 0);
504
505 }
506 */
507 /*
508 void play_sound2(int sample, int frq, int vol, int pan)
509 {
510 #ifdef SOUND_OFF
511 return;
512 #endif
513
514 if (sound_active == 0 || options.sound_volume == 0) return;
515 play_sample(sounds [sample], (vol * options.sound_volume) / 100, pan, frq, 0);
516
517
518 }
519
520 void play_soundf(int sample, int frq)
521 {
522
523 #ifdef SOUND_OFF
524 return;
525 #endif
526
527 if (sound_active == 0 || options.sound_volume == 0) return;
528 play_sample(sounds [sample], (int) (255 * options.sound_volume) / 100, 127, frq, 0);
529
530
531 }
532
533 void play_sound_pos(int sample, int frq, int vol, int x2, int y2)
534 {
535 #ifdef SOUND_OFF
536 return;
537 #endif
538
539 if (sound_active == 0 || options.sound_volume == 0) return;
540
541 int pan = 127;
542
543 int vol2 = vol;
544 int distance;
545
546 int x1 = actor[player[game.single_player].actor_controlled].x;
547 int y1 = actor[player[game.single_player].actor_controlled].y;
548
549 distance = hypot(abs(x2 - x1), abs(y2 - y1)) / GRAIN;
550 if (distance > 1000)
551 return;
552 if (distance > 300)
553 {
554 distance -= 300;
555 distance = 1000 - distance;
556 vol2 *= distance; //(800 - (distance - 300));
557 vol2 /= 1000;
558 }
559
560
561
562 if (options.sound_mode == SOUNDMODE_MONO || game.users == 2)
563 pan = 127;
564 else
565 {
566 if (x1 == x2)
567 {
568 pan = 127;
569 }
570 else
571 {
572 if (x1 < x2 - (300 * GRAIN))
573 pan = 0;
574 else
575 {
576 if (x1 > x2 + (300 * GRAIN))
577 pan = 255;
578 else
579 {
580 if (x1 > x2)
581 {
582 pan = 127 + ((x1 - x2) * 125) / (300 * GRAIN);
583 }
584 else
585 {
586 pan = 127 - ((x2 - x1) * 125) / (300 * GRAIN);
587 }
588 }
589 }
590 }
591 if (options.sound_mode == SOUNDMODE_REVERSED)
592 pan = 255 - pan;
593 }
594
595
596
597 // stop_sample(sounds [sample]);
598
599 play_sample(sounds [sample], (vol2 * options.sound_volume) / 100, pan, frq, 0);
600
601 }
602
603 */
604
605 void set_engine_sound(int a, int drive, int setting)
606 {
607
608 #ifdef SOUND_OFF
609 return;
610 #endif
611
612 }
613
614 void kill_drive_sounds(void)
615 {
616 #ifdef SOUND_OFF
617 return;
618 #endif
619
620 if (sound_active == 0)
621 return;
622
623 // if (actor[a].drive_sound [DRIVE_THRUST] > 0)
624 {
625 // stop_sample(sounds [WAV_ENGINE]);
626 }
627 }
628
629
630
631 /*
632 ************************
633
634 Beat functions
635
636 ************************
637 */
638
639
640 void play_beats(void)
641 {
642
643 if (arena.level_finished == 1 && sound_active != 0)
644 {
645 play_success_sound();
646 return;
647 } // this is in play_beats, but it goes through whichever volume control is higher
648
649
650
651 if (sound_active == 0 || options.ambience_volume == 0)
652 return;
653 // if (options.ambience_volume == 0)
654 // return;
655
656
657 play_melody();
658
659
660 bpos ++;
661 if (bpos >= phrase_length)
662 {
663 bpos = 0;
664 over_bpos ++;
665 if (over_bpos >= over_phrase_length)
666 over_bpos = over_phrase_loop_point;
667 }
668
669 if (beat_phrase [over_beat_phrase [over_bpos]] [bpos].samp == BEAT_EMPTY)
670 return;
671
672
673 int tone_play = beat_phrase [over_beat_phrase [over_bpos]] [bpos].pitch;
674
675 if (beat_phrase [over_beat_phrase [over_bpos]] [bpos].rand_pitch != -1)
676 {
677 if (grand(5) != 0)
678 tone_play += chord_jumps [beat_phrase [over_beat_phrase [over_bpos]] [bpos].rand_pitch] [grand(NO_JUMPS)];
679 else
680 tone_play -= chord_jumps [beat_phrase [over_beat_phrase [over_bpos]] [bpos].rand_pitch] [grand(NO_JUMPS)];
681 }
682
683 /* int mel = beat_phrase [over_beat_phrase [over_bpos]] [bpos].melody;
684
685 if (mel != -1)
686 {
687 tone_play = prog_base [mel] + progression [mel] [prog_pos [mel]];
688 prog_pos [mel] ++;
689 if (prog_pos [mel] >= prog_length [mel])
690 prog_pos [mel] = 0;
691 }*/
692
693 if (beat_phrase [over_beat_phrase [over_bpos]] [bpos].samp != BEAT_EMPTY)
694 // if (FALSE)
695 {
696 play_beatfvp(beat_phrase [over_beat_phrase [over_bpos]] [bpos].samp,
697 // beat_phrase [over_beat_phrase [over_bpos]] [bpos].pitch + grand(beat_phrase [over_beat_phrase [over_bpos]] [bpos].rand_pitch),
698 tone [tone_play],
699 // note [beat_phrase [over_beat_phrase [over_bpos]] [bpos].pitch],
700 beat_phrase [over_beat_phrase [over_bpos]] [bpos].vol,
701 beat_phrase [over_beat_phrase [over_bpos]] [bpos].pan);
702
703 }
704 /*
705 if (ppos == 12 || ppos == 24)
706 play_beat(BEAT_LOWDRUM);
707
708 if (ppos == 17)
709 play_beat(BEAT_ZAPDRUM1);
710 */
711
712
713 }
714
715
716 void calculate_beat(void)
717 {
718
719 if (sound_active == 0)
720 return;
721
722 int success_chord = grand(NO_CHORDS);
723
724 success_base = 1;
725
726 success_note [0] = chord_jumps [success_chord] [0];
727 success_note [1] = chord_jumps [success_chord] [grand(NO_JUMPS)];
728 success_note [2] = chord_jumps [success_chord] [grand(NO_JUMPS)];
729
730 success_samp = BEAT_STRING;
731
732 switch(grand(6))
733 {
734 case 0: success_samp = BEAT_STRING; break;
735 case 1: success_samp = BEAT_BELL_S; break;
736 case 2: success_samp = BEAT_BELL_L; break;
737 case 3: success_samp = BEAT_STRING; break;
738 case 4: success_samp = BEAT_SPARKLE; break;
739 case 5: success_samp = BEAT_ZAPDRUM2; break;
740 }
741
742 success_step = 1 + grand(3);
743
744 if (options.ambience_volume == 0)
745 return;
746
747 int i, j;
748 int basic_beat [5];
749
750 int split_phrase = 0;
751 if (grand(3) != 0)
752 split_phrase = 1;
753 if (grand(4) == 0)
754 split_phrase = 2;
755
756
757 for (i = 0; i < MAX_PHRASES; i ++)
758 {
759 for (j = 0; j < MAX_PHRASE_LENGTH; j ++)
760 {
761 beat_phrase[i] [j].samp = BEAT_EMPTY;
762 beat_phrase[i] [j].pitch = 1000;
763 beat_phrase[i] [j].rand_pitch = 0;
764 beat_phrase[i] [j].pan = 127;
765 beat_phrase[i] [j].rand_pan = 0;
766 beat_phrase[i] [j].melody = 0;
767 beat_phrase[i] [j].vol = 200;
768 }
769 }
770
771 // phrase_length = (20 + grand(25)) * (split_phrase + 1);
772 phrase_length = (15 + grand(20)) * (split_phrase + 1);
773 // phrase_length = (12 + grand(10)) * (split_phrase + 1);
774 if (grand(5) == 0)
775 phrase_length += 15;
776 // phrase_length = (10) * (split_phrase + 1);
777
778 /* basic_beat [0] = grand(BEAT_TWIRM + 1);
779 basic_beat [1] = grand(BEAT_TWIRM + 1);
780 basic_beat [2] = grand(BEAT_TWIRM + 1);
781 basic_beat [3] = grand(BEAT_TWIRM + 1);
782 basic_beat [4] = grand(BEAT_TWIRM + 1);*/
783
784 basic_beat [0] = grand(BEAT_TWIRM + 1);
785 basic_beat [1] = grand(BEAT_TWIRM + 1);
786
787 if (grand(4) == 0)
788 basic_beat [0] = grand(NO_BEATS);
789 if (grand(4) == 0)
790 basic_beat [1] = grand(NO_BEATS);
791 basic_beat [2] = grand(NO_BEATS);
792 basic_beat [3] = grand(NO_BEATS);
793 basic_beat [4] = grand(NO_BEATS);
794
795 int rand_note = -1;
796 // int prog_note = -1;
797 //nt no_progs = 0;
798 // int prog_active [NO_PROGS] = {0,0,0,0};
799 int base_phrase_length = phrase_length;
800 int num_phrases = 0;
801 // int mel_delay = 0;
802 // int mel_length;
803 // int mel_start;
804 // int mel_pos;
805 // int mel_delay_rand;
806
807 if (split_phrase == 1)
808 base_phrase_length /= 2;
809 if (split_phrase == 3)
810 base_phrase_length /= 3;
811
812 int basenote = 25;
813 int randnote = 27;
814
815 add_note(basic_beat [0], 0, grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
816 add_note(basic_beat [0], 0, grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
817 if (split_phrase > 0)
818 {
819 add_note(basic_beat [0], 0, base_phrase_length + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
820 add_note(basic_beat [0], 0, base_phrase_length + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
821 }
822 if (split_phrase > 1)
823 {
824 add_note(basic_beat [0], 0, (base_phrase_length * 2) + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
825 add_note(basic_beat [0], 0, (base_phrase_length * 2) + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
826 }
827 num_phrases ++;
828
829 copy_phrase(1, 0);
830 add_note(basic_beat [1], 1, grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
831 add_note(basic_beat [1], 1, grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
832 if (split_phrase > 0)
833 {
834 add_note(basic_beat [1], 1, base_phrase_length + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
835 add_note(basic_beat [1], 1, base_phrase_length + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
836 }
837 if (split_phrase > 1)
838 {
839 add_note(basic_beat [1], 0, (base_phrase_length * 2) + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
840 add_note(basic_beat [1], 0, (base_phrase_length * 2) + grand(base_phrase_length), basenote + grand(randnote), -1, 127, 200, 0);
841 }
842 num_phrases ++;
843
844 copy_phrase(2, 1);
845 rand_note = grand(NO_CHORDS);
846 if (grand(15) != 0)
847 rand_note = -1;
848 add_note(basic_beat [2], 2, grand(base_phrase_length), basenote + grand(randnote), rand_note, 127, 200, -1);
849 if (split_phrase > 0)
850 add_note(basic_beat [2], 2, base_phrase_length + grand(base_phrase_length), basenote + grand(randnote), rand_note, 127, 200, -1);
851 if (split_phrase > 1)
852 add_note(basic_beat [2], 2, (base_phrase_length * 2) + grand(base_phrase_length), basenote + grand(randnote), rand_note, 127, 200, -1);
853 num_phrases ++;
854
855 // prog_note = -1;
856 if (grand(2) == 0)
857 {
858 calculate_melody(1);
859 }
860 else
861 {
862 calculate_melody(0);
863 copy_phrase(3, 2);
864 rand_note = grand(NO_CHORDS);
865 if (grand(15) != 0)
866 rand_note = -1;
867 add_note(basic_beat [3], 3, grand(base_phrase_length), basenote + grand(randnote), rand_note, 127, 200, -1);
868 if (split_phrase > 0)
869 add_note(basic_beat [3], 3, base_phrase_length + grand(base_phrase_length), basenote + grand(randnote), rand_note, 127, 200, -1);
870 if (split_phrase > 1)
871 add_note(basic_beat [3], 3, (base_phrase_length * 2) + grand(base_phrase_length), basenote + grand(randnote), rand_note, 127, 200, -1);
872 // add_note(basic_beat [0], 0, grand(phrase_length), 15 + grand(10), 0, 127, 200);
873 }
874
875 if (grand(2) == 0)
876 num_phrases ++;
877
878 /*
879 prog_note = -1;
880 copy_phrase(4, 3);
881 rand_note = grand(NO_CHORDS);
882 if (grand(3) != 0)
883 rand_note = -1;
884 if (grand(3) != 0)
885 {
886 prog_note = 2;
887 prog_active [2] = 1;
888 }
889 // if (prog_note == 2)
890 // no_progs ++;
891 add_note(basic_beat [4], 4, grand(base_phrase_length), 15 + grand(10), rand_note, 127, 200, prog_note);
892 if (split_phrase > 0)
893 add_note(basic_beat [4], 4, base_phrase_length + grand(base_phrase_length), 15 + grand(10), rand_note, 127, 200, prog_note);
894 if (split_phrase > 1)
895 add_note(basic_beat [4], 4, (base_phrase_length * 2) + grand(base_phrase_length), 15 + grand(10), rand_note, 127, 200, prog_note);
896 // add_note(basic_beat [1], 0, grand(phrase_length), 15 + grand(10), 0, 127, 200);
897 */
898
899 int oplength = 7 + grand(5);
900 int pause_length = grand(3);
901 int up_to = 0, next_op = 0;
902
903 add_over_phrase(0, 0, MAX_OVERPHRASES);
904
905
906 if (split_phrase == 1)
907 {
908 // if (grand(3) != 0)
909 // no_progs *= 2;
910 oplength = 4 + grand(3);
911 }
912 if (split_phrase == 2)
913 {
914 // if (grand(3) != 0)
915 // no_progs *= 3;
916 oplength = 2 + grand(3);
917 }
918
919 // if (grand(8) == 0)
920 // no_progs = 4 + grand(3) - grand(3);
921 /* prog_length [0] = 8 + grand(3) - grand(3);
922 prog_length [1] = prog_length [0];
923 prog_length [2] = prog_length [0];
924 prog_length [3] = prog_length [0];
925
926 create_progression(0, prog_length [0], grand(NO_CHORDS));
927 create_progression(1, prog_length [1], grand(NO_CHORDS));
928 create_progression(2, prog_length [2], grand(NO_CHORDS));
929 create_progression(3, prog_length [3], grand(NO_CHORDS));
930 */
931 // prog_length = no_progs;
932
933 for (i = 0; i < num_phrases; i ++)
934 {
935 next_op = up_to + oplength;
936 add_over_phrase(i, up_to + pause_length, next_op);
937 up_to = next_op;
938 }
939
940 /* add_over_phrase(0, 0, 9);
941 add_over_phrase(1, 10, 20);
942 add_over_phrase(2, 21, 30);
943 add_over_phrase(3, 31, 40);
944 add_over_phrase(4, 41, 50);*/
945
946 over_phrase_length = up_to;
947 over_phrase_loop_point = oplength * (1 + grand(3));
948
949 bpos = 0;
950 over_bpos = 0;
951
952 /* for (i = 0; i < NO_PROGS; i ++)
953 {
954 prog_pos [i] = 0;
955 prog_base [i] = 10 + grand(15);
956 } */
957
958
959 }
960
961 void add_note(int beat, int bp1, int bp2, int pitch, int rand_pitch, int pan, int vol, int mel)
962 {
963 if (bp1 >= MAX_PHRASES || bp2 >= MAX_PHRASE_LENGTH)
964 return;
965 if (pitch <= 0 || pitch >= NO_TONES)
966 return;
967 beat_phrase[bp1] [bp2].samp = beat;
968 beat_phrase[bp1] [bp2].pitch = pitch;
969 beat_phrase[bp1] [bp2].rand_pitch = rand_pitch;
970 if (grand(3) == 0)
971 beat_phrase[bp1] [bp2].pan = grand(255);
972 else
973 beat_phrase[bp1] [bp2].pan = pan;
974 if (options.sound_mode == SOUNDMODE_MONO)
975 beat_phrase[bp1] [bp2].pan = 127; // don't worry about reversing stereo; it doesn't matter
976 beat_phrase[bp1] [bp2].vol = vol;
977 beat_phrase[bp1] [bp2].melody = mel;
978 }
979
980 void add_over_phrase(int phrase, int start, int finish)
981 {
982 int i;
983 for (i = start; i < finish + 1; i ++)
984 {
985 if (i >= MAX_OVERPHRASES)
986 return;
987 over_beat_phrase [i] = phrase;
988 }
989
990 }
991
992 void copy_phrase(int target, int source)
993 {
994 int j;
995 if (source >= MAX_PHRASES || target >= MAX_PHRASES)
996 return;
997
998 for (j = 0; j < MAX_PHRASE_LENGTH; j ++)
999 {
1000 beat_phrase[target] [j].samp = beat_phrase[source] [j].samp;
1001 beat_phrase[target] [j].pitch = beat_phrase[source] [j].pitch;
1002 beat_phrase[target] [j].rand_pitch = beat_phrase[source] [j].rand_pitch;
1003 beat_phrase[target] [j].pan = beat_phrase[source] [j].pan;
1004 beat_phrase[target] [j].rand_pan = beat_phrase[source] [j].rand_pan;
1005 beat_phrase[target] [j].melody = beat_phrase[source] [j].melody;
1006 }
1007 }
1008
1009 void create_progression(int which, int length, int key)
1010 {
1011 int i;
1012 int n = grand(NO_JUMPS);
1013 int longprogpos = 0;
1014
1015 if (FALSE) //grand(4) == 0)
1016 {
1017 for (i = 0; i < length; i ++)
1018 {
1019 progression [which] [i] = chord_jumps [key] [n];
1020 n += grand(4);
1021 if (grand(3) == 0)
1022 n -= grand(4);
1023 n %= NO_JUMPS;
1024 }
1025 return;
1026 }
1027
1028 for (i = 0; i < length; i ++)
1029 {
1030 progression [which] [i] = long_prog [0] [longprogpos];
1031 longprogpos ++;
1032 if (long_prog [0] [longprogpos] == NOTE_ENDNOTE)
1033 longprogpos = 0;
1034 }
1035
1036 }
1037
1038 void play_melody(void)
1039 {
1040 //return;
1041
1042 int i = 0;
1043
1044 if (overmelody_mode == OVERMELODY_REPEAT)
1045 {
1046 for (i = 0; i < MAX_MELODIES; i ++)
1047 {
1048 if (melody_active [i] == 0)
1049 continue;
1050 if (mdelay [i] > 0)
1051 {
1052 mdelay [i] --;
1053 continue;
1054 }
1055 mpos [i] ++;
1056 if (mpos [i] >= melody_length [i])
1057 {
1058 mpos [i] = 0;
1059 over_mpos ++;
1060 if (over_mpos >= overmelodies)
1061 over_mpos = 0;
1062 melodies_played ++;
1063 }
1064 // }
1065 if (melody [i] [mpos [i]].samp != BEAT_EMPTY
1066 && overmelody [over_mpos].start <= melodies_played)
1067 {
1068
1069 debug_sound [0] = over_mpos;
1070 debug_sound [1] = over_mpos2; //mpos [i];
1071 debug_sound [2] = melody [i] [mpos [i]].pitch + overmelody [over_mpos].key;
1072 debug_sound [3] = tone [melody [i] [mpos [i]].pitch + overmelody [over_mpos].key];
1073 if (melody [i] [mpos [i]].pitch + overmelody [over_mpos].key <= 0
1074 || melody [i] [mpos [i]].pitch + overmelody [over_mpos].key >= NO_TONES)
1075 return;
1076 play_beatfvp(melody [i] [mpos [i]].samp,
1077 // melody [i] [mpos [i]].pitch + overmelody [over_mpos], //grand(melody [i] [mpos [i]].rand_pitch),
1078 tone [melody [i] [mpos [i]].pitch + overmelody [over_mpos].key], //grand(melody [i] [mpos [i]].rand_pitch),
1079 melody [i] [mpos [i]].vol,
1080 melody [i] [mpos [i]].pan);
1081
1082 }
1083 }
1084
1085
1086 }
1087
1088 if (overmelody_mode == OVERMELODY_FILL)
1089 {
1090 mpos [0] ++;
1091 if (mpos [0] >= melody_length [0])
1092 {
1093 over_mpos2 ++;
1094 mpos [0] = 0;
1095 if (over_mpos2 >= overmelody_fill_length)
1096 {
1097 over_mpos2 = 0;
1098 over_mpos ++;
1099 if (over_mpos >= overmelodies)
1100 over_mpos = 1;
1101 }
1102 if (mdelay [0] > 0)
1103 mdelay [0] --;
1104 }
1105
1106 if (mdelay [0] > 0)
1107 {
1108 return;
1109 }
1110
1111
1112 if (melody [over_mpos] [mpos [0]].samp != BEAT_EMPTY)
1113 {
1114
1115 debug_sound [0] = mpos [0];
1116 debug_sound [1] = over_mpos; //mpos [i];
1117 debug_sound [2] = over_mpos2;
1118 debug_sound [3] = tone [melody [over_mpos] [mpos [0]].pitch + overmelody [over_mpos].key];
1119 if (melody [over_mpos] [mpos [0]].pitch + overmelody [over_mpos].key <= 0
1120 || melody [over_mpos] [mpos [0]].pitch + overmelody [over_mpos].key >= NO_TONES)
1121 return;
1122 play_beatfvp(melody [over_mpos] [mpos [0]].samp,
1123 // melody [i] [mpos [i]].pitch + overmelody [over_mpos], //grand(melody [i] [mpos [i]].rand_pitch),
1124 tone [melody [over_mpos] [mpos [0]].pitch + overmelody [over_mpos].key], //grand(melody [i] [mpos [i]].rand_pitch),
1125 melody [over_mpos] [mpos [0]].vol,
1126 melody [over_mpos] [mpos [0]].pan);
1127
1128 }
1129
1130 }
1131
1132
1133
1134 }
1135
1136
1137
1138 void calculate_melody(int active)
1139 {
1140 // now, we assume that the beat is fully set up, so we can use all of the beat-related globals.
1141
1142 int i, j;
1143 int overlength = 1 + grand(3);
1144 int melody_note = BEAT_ZAPDRUM1;
1145 // if (grand(2) == 0)
1146 melody_note = grand(NO_BEATS - BEAT_TWIRM) + BEAT_TWIRM;//BEAT_OBOE;
1147
1148 j = 0;
1149
1150 melody_active [0] = 0;
1151 melody_active [1] = 0;
1152 melody_active [2] = 0;
1153 melody_active [3] = 0;
1154
1155 for (i = 0; i < MAX_OVERMELODIES; i ++)
1156 {
1157 overmelody [i].mel = 0;
1158 overmelody [i].key = NOTE_1C;
1159 overmelody [i].start = 0;
1160 }
1161
1162
1163 for (i = 0; i < MAX_MELODIES; i ++)
1164 {
1165 melody_length [i] = phrase_length * overlength;
1166 for (j = 0; j < MAX_MELODY_LENGTH; j ++)
1167 {
1168 melody [i] [j].samp = BEAT_EMPTY;
1169 }
1170 }
1171
1172 if (!active)
1173 return; // just clear it
1174
1175 int chord = CHORD_MAJOR; //grand(NO_CHORDS);
1176
1177 j = 0;
1178
1179
1180
1181
1182
1183 /* add_melody_string1(melody_note, 1, melody_length [1], chord);
1184 add_melody_string1(melody_note, 2, melody_length [2], chord);
1185 add_melody_string1(melody_note, 3, melody_length [3], chord);
1186 */
1187 /* add_melody_note(melody_note, j, 8, 0, 0, 127, 200);
1188 add_melody_note(melody_note, j, 16, 5, 0, 127, 200);
1189 add_melody_note(melody_note, j, 24, 8, 0, 127, 200);
1190 add_melody_note(melody_note, j, 32, 11, 0, 127, 200);
1191 add_melody_note(melody_note, j, 40, 8, 0, 127, 200);*/
1192 /* add_melody_note(melody_note, j, grand(melody_length [j]), 5, 0, 127, 200);
1193 add_melody_note(melody_note, j, grand(melody_length [j]), 10, 0, 127, 200);
1194 add_melody_note(melody_note, j, grand(melody_length [j]), 15, 0, 127, 200);
1195 add_melody_note(melody_note, j, grand(melody_length [j]), 20, 0, 127, 200);
1196 add_melody_note(melody_note, j, grand(melody_length [j]), 25, 0, 127, 200);
1197 add_melody_note(melody_note, j, grand(melody_length [j]), 30, 0, 127, 200);*/
1198 /*
1199 add_melody_note(melody_note, j, grand(melody_length [j]), 0, 0, 127, 200);
1200 add_melody_note(melody_note, j, grand(melody_length [j]), 5, 0, 127, 200);
1201 add_melody_note(melody_note, j, grand(melody_length [j]), 10, 0, 127, 200);
1202 add_melody_note(melody_note, j, grand(melody_length [j]), 15, 0, 127, 200);
1203 add_melody_note(melody_note, j, grand(melody_length [j]), 20, 0, 127, 200);
1204 add_melody_note(melody_note, j, grand(melody_length [j]), 25, 0, 127, 200);
1205 add_melody_note(melody_note, j, grand(melody_length [j]), 30, 0, 127, 200);
1206 */
1207 switch(grand(2))
1208 {
1209 case 0:
1210 overmelody_mode = OVERMELODY_REPEAT;
1211 melody_active [0] = 1;
1212 overmelodies = 4;
1213 add_melody_string1(melody_note, 0, melody_length [0], chord);
1214 overmelody [0].mel = 0;
1215 overmelody [0].key = 0;
1216 overmelody [0].start = 3;
1217 overmelody [1].mel = 0;
1218 overmelody [1].key = chord_jumps [chord] [grand(4)];
1219 overmelody [1].start = 5;
1220 overmelody [2].mel = 0;
1221 overmelody [2].key = chord_jumps [chord] [grand(4)];
1222 overmelody [2].start = 7;
1223 overmelody [3].mel = 0;
1224 overmelody [3].key = chord_jumps [chord] [grand(4)];
1225 overmelody [3].start = 9;
1226 break;
1227 case 1:
1228 overmelody_mode = OVERMELODY_FILL;
1229 overmelodies = 3;
1230 overmelody_fill_length = 4;
1231 if (melody_length [0] < 120)
1232 overmelody_fill_length = 6 + grand(3);
1233 if (melody_length [0] < 80)
1234 overmelody_fill_length = 8 + grand(3);
1235 if (melody_length [0] < 50)
1236 overmelody_fill_length = 10 + grand(3);
1237 melody_active [0] = 1;
1238 melody_active [1] = 1;
1239 melody_active [2] = 1;
1240 melody_length [2] = melody_length [0];
1241 add_melody_string1(melody_note, 2, melody_length [0], chord);
1242 copy_melody(1, 2);
1243 j = 0;
1244 for (i = 0; i < MAX_MELODY_LENGTH; i ++)
1245 {
1246 if (melody [1] [i].samp != BEAT_EMPTY)
1247 {
1248 j ++;
1249 if (j % 2 != 0)
1250 melody [1] [i].samp = BEAT_EMPTY;
1251 }
1252 }
1253 copy_melody(0, 1);
1254 j = 0;
1255 for (i = 0; i < MAX_MELODY_LENGTH; i ++)
1256 {
1257 if (melody [0] [i].samp != BEAT_EMPTY)
1258 {
1259 j ++;
1260 if (j % 3 == 0)
1261 melody [0] [i].samp = BEAT_EMPTY;
1262 }
1263 }
1264 overmelody [0].mel = 0;
1265 overmelody [0].key = 0;
1266 overmelody [0].start = 4;
1267 overmelody [1].mel = 1;
1268 overmelody [1].key = 0;
1269 overmelody [1].start = 7;
1270 overmelody [2].mel = 2;
1271 overmelody [2].key = 0;
1272 overmelody [2].start = 10;
1273 mdelay [0] = 4 + grand(4);
1274 break;
1275 }
1276
1277
1278 mpos [0] = 0;
1279 over_mpos = 0;
1280 over_mpos2 = 0;
1281 melodies_played = 0;
1282
1283 int k;
1284
1285 for (i = 0; i < MAX_MELODIES; i ++)
1286 {
1287 for (j = 0; j < melody_length [i]; j ++)
1288 {
1289 for (k = 0; k < MAX_OVERMELODIES; k ++)
1290 {
1291 if (melody [i] [j].pitch + overmelody [k].key <= 0
1292 || melody [i] [j].pitch + overmelody [k].key >= NO_TONES)
1293 melody [i] [j].samp = BEAT_EMPTY;
1294 }
1295 }
1296 }
1297
1298
1299 }
1300
1301 void copy_melody(int t, int s)
1302 {
1303 int i;
1304
1305 for (i = 0; i < MAX_MELODY_LENGTH; i ++)
1306 {
1307 melody [t] [i].samp = melody [s] [i].samp;
1308 melody [t] [i].pitch = melody [s] [i].pitch;
1309 melody [t] [i].rand_pitch = melody [s] [i].rand_pitch;
1310 melody [t] [i].pan = melody [s] [i].pan;
1311 melody [t] [i].vol = melody [s] [i].vol;
1312 }
1313
1314 melody_length [t] = melody_length [s];
1315 mdelay [t] = mdelay [s];
1316
1317 }
1318
1319
1320 void add_melody_note(int samp, int mp1, int mp2, int pitch, int rand_pitch, int pan, int vol)
1321 {
1322 if (options.sound_mode == SOUNDMODE_MONO)
1323 pan = 127;
1324 melody [mp1] [mp2].samp = samp;
1325 melody [mp1] [mp2].pitch = pitch;
1326 melody [mp1] [mp2].rand_pitch = rand_pitch;
1327 melody [mp1] [mp2].pan = pan;
1328 melody [mp1] [mp2].vol = vol;
1329
1330 }
1331
1332
1333 void add_melody_string1(int samp, int mp1, int length, int chords)
1334 {
1335 int mstring [100];
1336 int nm = 0;
1337 int i;
1338 int disp = 0;
1339 /// int jump = 0;
1340
1341 for (i = 0; i < 100; i ++)
1342 {
1343 mstring [i] = -1;
1344 }
1345
1346 int basenote = 0 + grand(13);
1347
1348 /* nm = 3 + grand(6);
1349 if (length < 35)
1350 nm = 2 + grand(3); */
1351
1352 nm = length / (10 + grand(6));
1353
1354 if (nm >= 100)
1355 nm = 99;
1356
1357 mstring [0] = BEAT_EMPTY; //basenote;
1358
1359 int which_longprog = grand(NO_LONGPROGS);
1360 int longprogpos = 0;
1361 int lplength = 0;
1362
1363 for (i = 0; i < SIZE_LONGPROGS; i ++)
1364 {
1365 lplength = i;
1366 if (long_prog [which_longprog] [i] == NOTE_ENDNOTE)
1367 break;
1368 }
1369
1370 longprogpos = grand(lplength);
1371
1372 for (i = 0; i < nm; i ++)
1373 // i = 1, not 0
1374 {
1375 mstring [i] = basenote + long_prog [which_longprog] [longprogpos];
1376 // mstring [i] = 40 + i;
1377 longprogpos ++;
1378 if (long_prog [which_longprog] [longprogpos] == NOTE_ENDNOTE)
1379 longprogpos = 0;
1380
1381 // jump = chord_jumps [chords] [grand(NO_JUMPS)];
1382 /* switch(grand(6))
1383 {
1384 case 0: jump = 0; break;
1385 case 1: jump = 5; break;
1386 case 2: jump = 8; break;
1387 case 3: jump = 11; break;
1388 case 4: jump = 13; break;
1389 case 5: jump = 9; break;
1390 }*/
1391 /* if (grand(2) == 0)
1392 jump *= -1;
1393 if (grand(3) == 0)
1394 mstring [i] = mstring [i - 1] + jump;
1395 else
1396 mstring [i] = basenote + jump;
1397 if (mstring [i] < 0 || mstring [i] >= NO_TONES
1398 || (mstring [i - 1] != basenote && grand(3) == 0))
1399 mstring [i] = basenote;
1400 if (grand(10) == 0)
1401 mstring [i] = -1; */
1402 }
1403
1404 disp = length / nm;
1405 if (disp < 5)
1406 disp = 5;
1407 int j = 0;
1408 int base_disp = disp / 2;
1409 int rand_disp = grand(base_disp);
1410
1411 if (grand(2) == 0)
1412 {
1413 base_disp = disp;
1414 rand_disp = 0;
1415 }
1416
1417 for (i = 0; i < nm; i ++)
1418 {
1419 if (mstring [i] != -1)
1420 add_melody_note(samp, mp1, j, mstring [i], 0, 127, 200);
1421 // add_melody_note(samp, mp1, mstring [i], j, 0, 127, 200);
1422 j += base_disp + grand(rand_disp);
1423 if (j >= MAX_MELODY_LENGTH)
1424 break;
1425 }
1426
1427
1428 }
1429
1430
1431 /*
1432 void play_beat(int samp)
1433 {
1434
1435 play_sample(beat [samp], (255 * options.sound_volume) / 100, 127, 1000, 0);
1436 }
1437
1438 void play_beatf(int samp, int freq)
1439 {
1440
1441 play_sample(beat [samp], (255 * options.sound_volume) / 100, 127, freq, 0);
1442 }
1443 */
1444 void play_beatfvp(int samp, int freq, int vol, int pan)
1445 {
1446 play_sample(beat [samp], (vol * options.ambience_volume) / 100, pan, freq, 0);
1447 }
1448
1449 void play_successfvp(int samp, int freq, int vol, int pan)
1450 {
1451 int volum = options.ambience_volume;
1452 if (options.sound_volume > volum)
1453 volum = options.sound_volume;
1454 if (volum == 0)
1455 return;
1456 play_sample(beat [samp], (vol * volum) / 100, pan, freq, 0);
1457 }
1458
1459
1460
1461 void play_success_sound(void)
1462 {
1463 if (arena.game_over != 0)
1464 return;
1465 int ss = 166 - arena.time_left;
1466
1467 // if (ss < 40 || ss >= 160)
1468 if (ss >= 160)
1469 return;
1470
1471 if (ss % 10 != 0)
1472 return;
1473
1474 ss /= 10;
1475
1476 ss += 2;
1477
1478 int freq = success_base;//NOTE_1C;
1479
1480 freq += (ss / 3) * success_step;
1481
1482 if (ss % 3 == 0)
1483 freq += success_note [0];
1484 if (ss % 3 == 1)
1485 freq += success_note [1];
1486 if (ss % 3 == 2)
1487 freq += success_note [2];
1488
1489 // play_beatfvp(BEAT_BASS, tone [freq], 200, 127);
1490 play_successfvp(success_samp, tone [freq], 200, 127);
1491
1492 }
1493
1494
1495
1496 void init_beat(void)
1497 {
1498
1499 if (sound_active == 0)
1500 return;
1501
1502 load_beat_sample_in(BEAT_DRUM1, "drum1");
1503 load_beat_sample_in(BEAT_DRUM2, "drum2");
1504 load_beat_sample_in(BEAT_LOWDRUM, "lowdrum");
1505 load_beat_sample_in(BEAT_STICK, "stick");
1506 load_beat_sample_in(BEAT_TWIRM, "twirm");
1507 load_beat_sample_in(BEAT_ZAPDRUM1, "zapdrum1");
1508 load_beat_sample_in(BEAT_ZAPDRUM2, "zapdrum2");
1509 load_beat_sample_in(BEAT_PPIPE, "ppipe");
1510 load_beat_sample_in(BEAT_BELL_S, "bell_s");
1511 load_beat_sample_in(BEAT_BELL_L, "bell_l");
1512 load_beat_sample_in(BEAT_SPARKLE, "sparkle");
1513 load_beat_sample_in(BEAT_MOSQ, "mosq");
1514 load_beat_sample_in(BEAT_SPACE, "space");
1515 load_beat_sample_in(BEAT_SWEEP, "sweep");
1516 load_beat_sample_in(BEAT_TING, "ting");
1517 load_beat_sample_in(BEAT_REVERSE, "reverse");
1518 load_beat_sample_in(BEAT_SAW, "saw");
1519 load_beat_sample_in(BEAT_BASS, "bass");
1520 // load_beat_sample_in(BEAT_OBOE, "oboe");
1521 load_beat_sample_in(BEAT_BASS2, "bass2");
1522 // load_beat_sample_in(BEAT_BASSOON, "bassoon");
1523 load_beat_sample_in(BEAT_BRASS, "brass");
1524 load_beat_sample_in(BEAT_CHOIR, "choir");
1525 load_beat_sample_in(BEAT_FLUTE, "flute");
1526 load_beat_sample_in(BEAT_ODD, "odd");
1527 load_beat_sample_in(BEAT_REVERSE2, "reverse2");
1528 load_beat_sample_in(BEAT_ACCORD, "accord");
1529 load_beat_sample_in(BEAT_STRING, "string");
1530
1531
1532
1533 // load_beat_sample_in(BEAT_, "");
1534
1535 // ppos = 0;
1536 // plength = 0;
1537
1538
1539 }
1540
1541
1542
1543
1544 void load_beat_sample_in(int samp, const char *sfile)
1545 {
1546
1547 char sfile_name [50];
1548
1549 strcpy(sfile_name, ".//wavs//beat//");
1550 strcat(sfile_name, sfile);
1551 strcat(sfile_name, ".wav");
1552
1553 beat [samp] = load_sample(sfile_name);
1554
1555 if (beat [samp] == NULL)
1556 {
1557 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
1558 allegro_message("Fatal Error: Unable to load sound file: %s", sfile_name);
1559 exit(1);
1560 }
1561 }
1562
1563
1564
1565
1566
1567
1568
1569
1570 void play_wav(int sample)
1571 {
1572 #ifdef SOUND_OFF
1573 return;
1574 #endif
1575
1576 if (sound_active == 0 || options.sound_volume == 0) return;
1577
1578 play_sample(new_sounds [sample], (int) (250 * options.sound_volume) / 100, 127, 1000, 0);
1579
1580 }
1581
1582 void play_wav2(int sample, int frq, int vol, int pan)
1583 {
1584 #ifdef SOUND_OFF
1585 return;
1586 #endif
1587
1588 if (sound_active == 0 || options.sound_volume == 0) return;
1589 /*
1590 stop_sample(soundf[WAV_POP].dat);
1591 stop_sample(soundf[WAV_RICOCHET].dat);
1592 if (sample == WAV_S_PULSE)
1593 stop_sample(soundf[WAV_S_PULSE].dat);*/
1594 // stop_sample(sounds [sample]);
1595 play_sample(new_sounds [sample], (vol * options.sound_volume) / 100, pan, frq, 0);
1596
1597
1598 }
1599
1600 void play_wavf(int sample, int frq)
1601 {
1602
1603 #ifdef SOUND_OFF
1604 return;
1605 #endif
1606
1607 if (sound_active == 0 || options.sound_volume == 0) return;
1608 play_sample(new_sounds [sample], (int) (255 * options.sound_volume) / 100, 127, frq, 0);
1609
1610
1611 }
1612
1613 /*
1614 Positional sound for stereo effects.
1615 y2 currently unused, but may be in future for some kind of
1616 triangulation.
1617 */
1618 void play_wav_pos(int sample, int frq, int vol, int x2, int y2)
1619 {
1620 #ifdef SOUND_OFF
1621 return;
1622 #endif
1623
1624 if (sound_active == 0 || options.sound_volume == 0) return;
1625
1626 /* stop_sample(soundf[WAV_POP].dat);
1627 stop_sample(soundf[WAV_RICOCHET].dat);
1628 if (sample == WAV_S_PULSE)
1629 stop_sample(soundf[WAV_S_PULSE].dat);*/
1630
1631 /* if (options[0].positional_sound == 0 || game.users > 1)
1632 {
1633 play_sample(soundf[sample].dat, vol, 127, frq, 0);
1634 }*/
1635
1636
1637 int pan = 127;
1638
1639 int vol2 = vol;
1640 int distance;
1641
1642 int x1 = actor[player[game.single_player].actor_controlled].x;
1643 int y1 = actor[player[game.single_player].actor_controlled].y;
1644
1645 distance = hypot(abs(x2 - x1), abs(y2 - y1)) / GRAIN;
1646 if (distance > 1000)
1647 return;
1648 if (distance > 300)
1649 {
1650 distance -= 300;
1651 distance = 1000 - distance;
1652 vol2 *= distance; //(800 - (distance - 300));
1653 vol2 /= 1000;
1654 }
1655
1656
1657
1658 if (options.sound_mode == SOUNDMODE_MONO || game.users == 2)
1659 pan = 127;
1660 else
1661 {
1662 if (x1 == x2)
1663 {
1664 pan = 127;
1665 }
1666 else
1667 {
1668 if (x1 < x2 - (300 * GRAIN))
1669 pan = 0;
1670 else
1671 {
1672 if (x1 > x2 + (300 * GRAIN))
1673 pan = 255;
1674 else
1675 {
1676 if (x1 > x2)
1677 {
1678 pan = 127 + ((x1 - x2) * 125) / (300 * GRAIN);
1679 }
1680 else
1681 {
1682 pan = 127 - ((x2 - x1) * 125) / (300 * GRAIN);
1683 }
1684 }
1685 }
1686 }
1687 if (options.sound_mode == SOUNDMODE_REVERSED)
1688 pan = 255 - pan;
1689 }
1690
1691 play_sample(new_sounds [sample], (vol2 * options.sound_volume) / 100, pan, frq, 0);
1692
1693 }
1694
1695 void play_gameover_loop(int freq)
1696 {
1697
1698 play_sample(new_sounds [NWAV_GAMEOVER], (200 * options.sound_volume) / 100, 127, freq, 1);
1699
1700 }
1701
1702 void kill_gameover_loop(void)
1703 {
1704 stop_sample(new_sounds [NWAV_GAMEOVER]);
1705 }
1706
1707
0
1 void init_sound(void);
2 void play_sound(int sample);
3 void play_sound2(int sample, int frq, int vol, int pan);
4 void play_soundf(int sample, int frq);
5 void play_sound_pos(int sample, int frq, int vol, int x2, int y2);
6
7 void play_wav(int sample);
8 void play_wav2(int sample, int frq, int vol, int pan);
9 void play_wavf(int sample, int frq);
10 void play_wav_pos(int sample, int frq, int vol, int x2, int y2);
11
12 void kill_drive_sounds(void);
13
14 void play_beats(void);
15 void calculate_beat(void);
16
17 void play_gameover_loop(int freq);
18 void kill_gameover_loop(void);
19
20
21 enum
22 {
23 SOUNDMODE_OFF,
24 SOUNDMODE_MONO,
25 SOUNDMODE_STEREO,
26 SOUNDMODE_REVERSED
27 };
28
29 enum
30 {
31 NWAV_NONE,
32 NWAV_BURST,
33 NWAV_GBLAT,
34 NWAV_CHIRP,
35 NWAV_CLICK,
36 NWAV_DNO,
37 NWAV_PPIPE,
38 NWAV_WARBLE,
39 NWAV_WARBLEB,
40 NWAV_WHINE,
41 NWAV_ZAPSTEP,
42 NWAV_SHORTBURST,
43 NWAV_CYMBAL,
44 NWAV_CHIME,
45 NWAV_CHIME2,
46 NWAV_BALL1,
47 NWAV_BANG,
48 NWAV_MULTI,
49 NWAV_SZAP,
50 NWAV_TWING,
51 NWAV_PUFF,
52 NWAV_DRIVE,
53 NWAV_DART,
54 NWAV_PHASE,
55 NWAV_SPLERK,
56 NWAV_LZAP,
57 NWAV_SEEKER,
58 NWAV_WORMS,
59 NWAV_REPAIR,
60 NWAV_GAMEOVER,
61 NWAV_BIGBANG,
62 NWAV_SYMBOL,
63 NWAV_MENU,
64 NWAV_EYE,
65 NWAV_TEETH,
66 NWAV_SPAWN,
67 NWAV_BLOCK,
68 NWAV_LAUNCH,
69 NWAV_SUCCESS,
70 NWAV_EXTRA,
71 NWAV_SHIELD,
72 NWAV_BURSTZ,
73 NWAV_BURSTZL,
74 NWAV_SHIELDE,
75 NWAV_SHADOW,
76 NWAV_JET,
77 NWAV_ALARM,
78 NWAV_BLAST,
79 NWAV_BUMP,
80 NWAV_BUMP2,
81 NWAV_MINEBANG,
82 NO_NWAVS
83 };
84
85 /*enum
86 {
87 WAV_NONE,
88 WAV_CANNON,
89 WAV_ENGINE,
90 WAV_WOBBLE,
91 WAV_LONG_WOBBLE,
92 WAV_WARP_IN,
93 WAV_BANG1,
94 WAV_WHINE,
95 WAV_HARD_ZAP,
96 WAV_BOSS2,
97 WAV_STING,
98 WAV_BUMP,
99 WAV_BOMBS,
100 WAV_BLORT,
101 WAV_STING4,
102 WAV_MISSILE,
103 WAV_ALARM,
104 WAV_ZAPNOTE1,
105 WAV_ZAPNOTE2,
106 WAV_BLAST,
107 WAV_MINE,
108 WAV_SHORTZAP,
109 WAV_BLAT,
110 WAV_SHORTZAP2,
111 WAV_SUN,
112 WAV_THRUM,
113 WAV_CROAK,
114 WAV_MINEBANG,
115 WAV_GREENSEEKER1,
116 WAV_GREENSEEKER2,
117 WAV_TORPEDO,
118 WAV_BOSS3_1,
119 WAV_BOSS3_2,
120 WAV_BOSS3_3,
121 WAV_ASPAWN,
122 WAV_GAME_OVER,
123 WAV_TUBE,
124 WAV_UPGRADE,
125 WAV_SHIELD,
126 WAV_REPAIR,
127 WAV_SEEKMINE,
128 WAV_PLASMA,
129 WAV_LEVEL_END,
130 WAV_MENU1,
131 WAV_MENU2,
132 WAV_EXTRA_SHIP,
133 WAV_ORBITAL,
134 WAV_PICKUP_UPGRADE,
135 WAV_SEEKBLOB_BANG,
136 WAV_BUMP2,
137 WAV_HIT,
138 WAV_HOSTILE,
139 WAV_MUTATE,
140 NO_WAVS
141
142 };
143 */
144
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: stuff.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - a few common functions
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36 //#include <stdlib.h>
37
38 #include "config.h"
39
40 int turn_towards_angle(int angle, int tangle, int turning);
41
42 float lcos(int angle);
43 float lsin(int angle);
44 float angle_to_radians(int angle);
45
46 // I have no idea why, but the first few elements of cos_table always get corrupted
47 // unless I put a big fat decoy array just above. A similar thing happens to the
48 // palette arrays; there seems to be a problem with global arrays like these.
49 float decoy_table [ANGLE_FULL]; // not used
50 float cos_table [ANGLE_FULL];
51 float sin_table [ANGLE_FULL];
52
53 inline int xpart(int angle, int length);
54
55 void init_trig(void)
56 {
57 int i;
58
59 for (i = 0; i < ANGLE_FULL; i ++)
60 {
61 cos_table [i] = cos(angle_to_radians(i));// * ANGLE_FULL;
62 sin_table [i] = sin(angle_to_radians(i));// * ANGLE_FULL;
63 }
64
65
66 }
67
68 inline int xpart(int angle, int length)
69 {
70 // return (lcos(angle) * length);// / ANGLE_FULL;
71 return (cos_table [angle & 1023] * length);// / ANGLE_FULL;
72 }
73
74 inline int ypart(int angle, int length)
75 {
76 return (sin_table [angle & 1023] * length);// / ANGLE_FULL;
77 }
78
79 float lcos(int angle)
80 {
81 return cos_table [angle & 1023]; //0x4ffffffff];
82
83 }
84
85 float lsin(int angle)
86 {
87 return sin_table [angle & 1023]; //0x4ffffffff];
88
89 }
90
91
92 float angle_to_radians(int angle)
93 {
94 return ((float) angle * PI * 2) / ANGLE_FULL;
95 // return ((float) angle / ANGLE_FULL) * PI * 2;
96 }
97
98 int radians_to_angle(float angle)
99 {
100 return (int) ((angle * ANGLE_FULL) / (PI * 2));
101 }
102
103 fixed angle_to_fixed(int angle)
104 {
105 return itofix(angle / ANGLE_TO_FIXED);
106 }
107
108 int grand(int number)
109 {
110 if (number == 0)
111 return 0;
112 return ((rand() + (rand() << 16)) & 0x7fffffff) % number;
113 }
114
115 int crandom(int number)
116 {
117 if (number == 0)
118 return 0;
119 return ((rand() + (rand() << 16)) & 0x7fffffff) % number;
120 // return (rand() + (rand() << 16)) % number;
121 }
122
123 int turn_towards_angle(int angle, int tangle, int turning)
124 {
125
126 if ((angle < tangle && tangle > angle + ANGLE_HALF)
127 || (angle > tangle && tangle > angle - ANGLE_HALF))
128 {
129 angle -= turning;
130 if (angle < 0)
131 angle += ANGLE_FULL;
132 }
133 else
134 {
135 angle += turning;
136 if (angle > ANGLE_FULL)
137 angle -= ANGLE_FULL;
138 }
139
140 return angle;
141
142 }
143
144
145 int turn_towards_xy(int x1, int y1, int x2, int y2, int angle, int turning)
146 {
147
148 int tangle =
149 radians_to_angle(atan2((y2 - y1), (x2 - x1)));
150 if (tangle < 0)
151 tangle += ANGLE_FULL;
152 if (tangle > ANGLE_FULL)
153 tangle -= ANGLE_FULL;
154
155 return turn_towards_angle(angle, tangle, turning);
156
157 }
158
159
160 // speed must be at least 4, and a factor of 1024
161 int pulsate(int speed, int amount, int county)
162 {
163 return xpart((county * speed) & 1023, amount);
164 }
165
166 void error_message_out(const char *errm)
167 {
168 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
169 allegro_message(errm);
170 exit(1);
171 }
172
173
174 int angle_difference(int a1, int a2)
175 {
176 int d1, d2;
177
178 d1 = (a1 - a2 + ANGLE_FULL) % ANGLE_FULL;
179 d2 = (a2 - a1 + ANGLE_FULL) % ANGLE_FULL;
180
181 if (d1 < d2)
182 return abs(d1);
183
184 return abs(d2);
185 }
186
187
0 void init_trig(void);
1
2 float angle_to_radians(int angle);
3 int radians_to_angle(float angle);
4 fixed angle_to_fixed(int angle);
5 int grand(int number);
6 int crandom(int number);
7 int turn_towards_angle(int angle, int tangle, int turning);
8 int turn_towards_xy(int x1, int y1, int x2, int y2, int angle, int turning);
9 inline int xpart(int angle, int length);
10 inline int ypart(int angle, int length);
11 int pulsate(int speed, int amount, int county);
12 int angle_difference(int a1, int a2);
13
14 void error_message_out(const char *errm);
+1159
-0
tile.c less more
0 /*
1 Overgod
2 Copyright (C) 2005 Linley Henzell
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public Licence as published by
6 the Free Software Foundation; either version 2 of the Licence, or
7 (at your option) any later version.
8
9 This program 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 Licence for more details.
13
14 You should have received a copy of the GNU General Public Licence
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The GPL version 2 is included in this distribution in a file called
19 LICENCE.TXT. Use any text editor or the TYPE command to read it.
20
21 You should be able to reach me by sending an email to
22 l_henzell@yahoo.com.au.
23
24 File: stuff.c
25 History:
26 11/9/2005 - Version 1.0 finalised
27
28 This file contains:
29 - generation of the tiled background
30
31 */
32
33 #include "allegro.h"
34
35 #include <math.h>
36 #include <string.h>
37
38 //#include <stdlib.h>
39
40 #include "config.h"
41 #include "globvars.h"
42 #include "palette.h"
43 #include "cloud.h"
44
45 #include "display.h"
46
47 #include "stuff.h"
48
49 #define ROTATE_90 64
50 #define ROTATE_180 128
51 #define ROTATE_270 192
52
53
54 #define CONNECT_U 1
55 #define CONNECT_D 2
56 #define CONNECT_L 4
57 #define CONNECT_R 8
58
59
60 enum
61 {
62 MAZE_NOTHING,
63 MAZE_UD,
64 MAZE_UL,
65 MAZE_UR,
66 MAZE_DL,
67 MAZE_DR,
68 MAZE_LR,
69 MAZE_ULR,
70 MAZE_DLR,
71 MAZE_UDL,
72 MAZE_UDR,
73 MAZE_UDLR,
74 MAZE_U,
75 MAZE_D,
76 MAZE_L,
77 MAZE_R,
78 MAZE_OUTER_U,
79 MAZE_OUTER_D,
80 MAZE_OUTER_L,
81 MAZE_OUTER_R,
82 MAZE_OUTER_UL,
83 MAZE_OUTER_DL,
84 MAZE_OUTER_UR,
85 MAZE_OUTER_DR,
86 MAZE_OUTER2,
87 MAZE_REMOTE_NODE,
88 MAZE_EYE_CLOSED_NODE,
89 MAZE_EYE_OPEN_NODE,
90 MAZE_EYE_CLOSED_REMOTE_NODE,
91 MAZE_EYE_OPEN_REMOTE_NODE
92 };
93
94
95 extern FONT *small_font;
96 extern struct optionstruct options;
97
98 //BITMAP *make_bmp(int x, int y);
99 BITMAP *make_bmp(int x, int y, const char errtxt []);
100 void make_maze_map(int x, int y);
101 RLE_SPRITE *make_tile(int index, int index2, int colourise1, int colourise2, int rotation);
102 RLE_SPRITE *make_m_tile(int index, int tmaze, int index2, int colourise1, int colourise2, int rotation);
103 RLE_SPRITE *make_complex_tile(int index, int index2, int tmaze, int colourise1, int colourise2, int colourise2_1, int colourise2_2, int rotation);
104 void draw_maze_1(BITMAP *level_bmp, int x, int y);
105 void draw_maze_2(BITMAP *level_bmp, int x, int y);
106
107 void put_eyes_in_maze(BITMAP *level_bmp, int x, int y);
108 void find_place_for_eye(int x_min, int y_min, int x_max, int y_max, int eye);
109 int draw_eye_path(BITMAP *level_bmp, int x, int y, int ex, int ey, int xd, int yd, int draw);
110
111 // these eye functions are obsolete:
112 void place_eyes(BITMAP *level_bmp, int x, int y);
113 void put_eye(int x1, int y1, int x2, int y2, int k, int node_x [100], int node_y [100]);
114 void put_eye2(int x, int y);
115 int eye_okay(int i, int j);
116
117
118 void make_tile_background_rle(void);
119
120 void tile_progress_update(const char progtxt []);
121
122 extern BITMAP *level_bmp;
123
124 extern RLE_SPRITE *tile_background;
125 extern int scr_x; // so we know how big to make tile_background
126 extern int scr_y;
127
128 extern BITMAP *pretile_bmp [NO_PRETILE_BMPS];
129 extern BITMAP *pretile_m_bmp [NO_MAZES] [NO_PRETILE_M_BMPS];
130 extern RLE_SPRITE *tile_rle [NO_TILE_RLES];
131 extern RLE_SPRITE *menu_tile;
132
133 int next_eye;
134
135 void init_tiles(void)
136 {
137 int i;
138 for (i = 0; i < NO_TILE_RLES; i ++)
139 {
140 tile_rle [i] = NULL;
141 }
142
143 menu_tile = make_tile(0, -1, CONVERT_GREEN1 + grand(5) * 8, CONVERT_GREEN2 + grand(5) * 8, 0);
144
145 }
146
147 void make_tile_map(int x, int y)
148 {
149
150 int i;
151
152 // Must remember to make sure that an empty tile_rle always is NULL!
153 // This should be done in init_tiles at first, then here during preparation for each level.
154 for (i = 0; i < NO_TILE_RLES; i ++)
155 {
156 if (tile_rle [i] != NULL)
157 {
158 destroy_rle_sprite(tile_rle [i]);
159 tile_rle [i] = NULL;
160 }
161 }
162
163 // BITMAP *temp_bitmap = make_bmp(50, 50, "temp_bitmap (make_tile_map)");
164
165 make_maze_map(x, y);
166
167 make_tile_background_rle();
168
169 }
170
171
172
173 void make_maze_map(int x, int y)
174 {
175 int col1 = CONVERT_GREEN1 + grand(5) * 8;
176 int col2 = CONVERT_GREEN2 + grand(5) * 8;
177 int bcol1 = CONVERT_GREEN1;
178 int bcol2 = CONVERT_GREEN1;
179
180 int hcola1, hcola2, hcolb1, hcolb2, adjusted_level;
181
182 col1 = CONVERT_RED1;
183 col2 = CONVERT_RED2;
184 hcola1 = CONVERT_BLUE1;
185 hcola2 = CONVERT_BLUE2;
186 hcolb1 = CONVERT_BLUE1;
187 hcolb2 = CONVERT_BLUE2;
188 adjusted_level = arena.level - 10;
189
190
191 if (arena.level <= 10)
192 {
193 col1 = CONVERT_YELLOW1;
194 col2 = CONVERT_YELLOW2;
195 hcola1 = CONVERT_ORANGE1;
196 hcola2 = CONVERT_ORANGE2;
197 hcolb1 = CONVERT_ORANGE1;
198 hcolb2 = CONVERT_ORANGE2;
199 adjusted_level = arena.level - 5;
200 }
201
202 if (arena.level <= 5)
203 {
204 col1 = CONVERT_GREEN1;
205 col2 = CONVERT_GREEN2;
206 hcola1 = CONVERT_YELLOW1;
207 hcola2 = CONVERT_YELLOW2;
208 hcolb1 = CONVERT_ORANGE1;
209 hcolb2 = CONVERT_ORANGE2;
210 adjusted_level = arena.level;
211 }
212
213
214 if (grand(5) + 1 < adjusted_level)
215 col1 = hcola1;
216 if (grand(5) + 1 < adjusted_level)
217 col2 = hcola2;
218 if (grand(10) + 2 < adjusted_level)
219 col1 = hcolb1;
220 if (grand(10) + 2 < adjusted_level)
221 col2 = hcolb2;
222
223 bcol1 = col1;
224 if (grand(5) + 1 < adjusted_level)
225 bcol1 = hcola1;
226 if (grand(10) + 2 < adjusted_level)
227 bcol1 = hcolb1;
228
229 bcol2 = col2;
230 if (grand(5) + 1 < adjusted_level)
231 bcol2 = hcola2;
232 if (grand(10) + 2 < adjusted_level)
233 bcol2 = hcolb2;
234
235 if (grand(3) == 0)
236 {
237 switch(col1)
238 {
239 case CONVERT_GREEN1: bcol1 = CONVERT_GREEN1; break;
240 case CONVERT_YELLOW1: bcol1 = CONVERT_YELLOW1; break;
241 case CONVERT_ORANGE1: bcol1 = CONVERT_ORANGE1; break;
242 case CONVERT_RED1: bcol1 = CONVERT_RED1; break;
243 case CONVERT_BLUE1: bcol1 = CONVERT_BLUE1; break;
244 }
245 }
246
247 if (grand(50) == 0)
248 {
249 bcol1 = CONVERT_GREEN1 + grand(5) * 8;
250 bcol2 = CONVERT_GREEN2 + grand(5) * 8;
251 col1 = CONVERT_GREEN1 + grand(5) * 8;
252 col2 = CONVERT_GREEN2 + grand(5) * 8;
253 }
254
255 if (arena.level == 1)
256 {
257 col1 = CONVERT_GREEN1;
258 col2 = CONVERT_GREEN2;
259 bcol1 = CONVERT_GREEN1;
260 bcol2 = CONVERT_GREEN2;
261 }
262
263
264 /*
265 if (arena.level == 1)
266 {
267 col1 = CONVERT_ORANGE1;
268 col2 = CONVERT_ORANGE2;
269 bcol = CONVERT_ORANGE1;
270 }
271
272 if (arena.level == 2)
273 {
274 col1 = CONVERT_RED1;
275 col2 = CONVERT_RED2;
276 bcol = CONVERT_RED1;
277 }
278 */
279 // tile_progress_update("making");
280 // int base_index = PRETILE_STRAIGHT_UD;
281 // if (grand(3) == 0)
282 // base_index = PRETILE_ZIG_UD;
283 // tile_rle [MAZE_NOTHING] = make_tile(0, col1, col2, 0);
284 // if (grand(3) == 0)
285 // tile_rle [MAZE_NOTHING] = make_tile(PRETILE_BG_CHECK, -1, bcol, 0, 0);
286 // else
287 // tile_rle [MAZE_NOTHING] = make_tile(PRETILE_BG_DIAMOND + grand(5), -1, bcol, 0, 0);
288
289 int back_tile = PRETILE_BG_CHECK;
290 if (arena.level > 1)
291 {
292 switch(grand(5))
293 {
294 case 0: back_tile = PRETILE_BG_CHECK; break;
295 case 1: back_tile = PRETILE_BG_DIAMOND; break;
296 case 2: back_tile = PRETILE_BG_MESH1; break;
297 case 3: back_tile = PRETILE_BG_MESH2; break;
298 case 4: back_tile = PRETILE_BG_GRID; break;
299 }
300 }
301 if (arena.level > 5 && grand(2) == 0)
302 {
303 switch(grand(8))
304 {
305 case 0: back_tile = PRETILE_BG_FLOWERS; break;
306 case 1: back_tile = PRETILE_BG_SQUARES; break;
307 case 2: back_tile = PRETILE_BG_DIAMOND2; break;
308 case 3: back_tile = PRETILE_BG_CROSS; break;
309 case 4: back_tile = PRETILE_BG_SQUARES2; break;
310 case 5: back_tile = PRETILE_BG_CIRCLES; break;
311 case 6: back_tile = PRETILE_BG_THING; break;
312 case 7: back_tile = PRETILE_BG_PATTERN; break;
313 }
314 }
315
316 tile_rle [MAZE_NOTHING] = make_tile(back_tile, -1, bcol1, bcol2, 0);
317
318 int tmaze;
319
320 if (arena.level <= 4)
321 {
322 switch(grand(4))
323 {
324 case 0: tmaze = MAZE_STRAIGHT; break;
325 case 1: tmaze = MAZE_ZIGZAG; break;
326 case 2: tmaze = MAZE_CIRCLES; break;
327 case 3: tmaze = MAZE_TUBES; break;
328 }
329 }
330 else
331 {
332 tmaze = grand(NO_MAZES);
333 }
334
335
336 // screenshot
337 //tmaze = MAZE_RINGS;
338
339 tile_rle [MAZE_UD] = make_m_tile(PRETILE_M_UD, tmaze, -1, col1, col2, 0);
340 tile_rle [MAZE_UL] = make_m_tile(PRETILE_M_UR, tmaze, -1, col1, col2, ROTATE_270);
341 tile_rle [MAZE_UR] = make_m_tile(PRETILE_M_UR, tmaze, -1, col1, col2, 0);
342 tile_rle [MAZE_DL] = make_m_tile(PRETILE_M_UR, tmaze, -1, col1, col2, ROTATE_180);
343 tile_rle [MAZE_DR] = make_m_tile(PRETILE_M_UR, tmaze, -1, col1, col2, ROTATE_90);
344 tile_rle [MAZE_LR] = make_m_tile(PRETILE_M_LR, tmaze, -1, col1, col2, 0); // index + 1 is redundant. Too late...
345 tile_rle [MAZE_ULR] = make_m_tile(PRETILE_M_ULR, tmaze, -1, col1, col2, 0);
346 tile_rle [MAZE_DLR] = make_m_tile(PRETILE_M_ULR, tmaze, -1, col1, col2, ROTATE_180);
347 tile_rle [MAZE_UDL] = make_m_tile(PRETILE_M_ULR, tmaze, -1, col1, col2, ROTATE_270);
348 tile_rle [MAZE_UDR] = make_m_tile(PRETILE_M_ULR, tmaze, -1, col1, col2, ROTATE_90);
349 tile_rle [MAZE_UDLR] = make_m_tile(PRETILE_M_UDLR, tmaze, -1, col1, col2, 0);
350 tile_rle [MAZE_U] = make_m_tile(PRETILE_M_U, tmaze, -1, col1, col2, 0);
351 tile_rle [MAZE_D] = make_m_tile(PRETILE_M_U, tmaze, -1, col1, col2, ROTATE_180);
352 tile_rle [MAZE_L] = make_m_tile(PRETILE_M_U, tmaze, -1, col1, col2, ROTATE_270);
353 tile_rle [MAZE_R] = make_m_tile(PRETILE_M_U, tmaze, -1, col1, col2, ROTATE_90);
354
355 int outer_base = PRETILE_OUTER1_D;
356 int base_choose = grand(3);
357 if (arena.level > 5)
358 base_choose = grand(6);
359 if (grand(2) == 0 && arena.level > 1)
360 {
361 switch(base_choose)
362 {
363 case 0: outer_base = PRETILE_OUTER1_D; break;
364 case 1: outer_base = PRETILE_OUTER2_D; break;
365 case 2: outer_base = PRETILE_OUTER3_D; break;
366 case 3: outer_base = PRETILE_OUTER4_D; break;
367 case 4: outer_base = PRETILE_OUTER5_D; break;
368 case 5: outer_base = PRETILE_OUTER6_D; break;
369 }
370 }
371 // col1 = CONVERT_RED1;
372 // col2 = CONVERT_BLUE2;
373 // outer_base = PRETILE_OUTER5_D;
374 tile_rle [MAZE_OUTER_U] = make_tile(outer_base, -1, col1, col2, ROTATE_180);
375 tile_rle [MAZE_OUTER_D] = make_tile(outer_base, -1, col1, col2, 0);
376 tile_rle [MAZE_OUTER_L] = make_tile(outer_base, -1, col1, col2, ROTATE_90);
377 tile_rle [MAZE_OUTER_R] = make_tile(outer_base, -1, col1, col2, ROTATE_270);
378 tile_rle [MAZE_OUTER_UR] = make_tile(outer_base + 1, -1, col1, col2, ROTATE_270);
379 tile_rle [MAZE_OUTER_DR] = make_tile(outer_base + 1, -1, col1, col2, 0);
380 tile_rle [MAZE_OUTER_UL] = make_tile(outer_base + 1, -1, col1, col2, ROTATE_180);
381 tile_rle [MAZE_OUTER_DL] = make_tile(outer_base + 1, -1, col1, col2, ROTATE_90);
382 tile_rle [MAZE_OUTER2] = make_tile(outer_base + 2, -1, col1, col2, 0);
383 arena.colour3 = col1 + 1;
384
385 tile_rle [MAZE_REMOTE_NODE] = make_m_tile(PRETILE_M_NODE, tmaze, -1, col1, col2, 0);
386 // col1 = CONVERT_GREEN1 + grand(5) * 8;
387 // col2 = CONVERT_GREEN2 + grand(5) * 8;
388 int col3 = col1; //CONVERT_GREEN1 + grand(5) * 8;
389 int col4 = CONVERT_GREEN2 + grand(5) * 8;
390
391 int eye_base = PRETILE_EYE4_CLOSED;
392 // if (arena.level == 2)
393 // eye_base = PRETILE_EYE3_CLOSED;
394
395 switch(grand(4))
396 {
397 case 0: eye_base = PRETILE_EYE1_CLOSED; break;
398 case 1: eye_base = PRETILE_EYE2_CLOSED; break;
399 case 2: eye_base = PRETILE_EYE3_CLOSED; break;
400 case 3: eye_base = PRETILE_EYE4_CLOSED; break;
401 }
402
403 // screenshot
404 //eye_base = PRETILE_EYE3_CLOSED;
405
406 tile_rle [MAZE_EYE_CLOSED_NODE] = make_complex_tile(eye_base, PRETILE_M_EYE_UDLR, tmaze, col1, col2, col3, col4, 0);
407 tile_rle [MAZE_EYE_OPEN_NODE] = make_complex_tile(eye_base + 1, PRETILE_M_EYE_UDLR, tmaze, col1, col2, col3, col4, 0);
408 tile_rle [MAZE_EYE_CLOSED_REMOTE_NODE] = make_complex_tile(eye_base, PRETILE_M_NODE, tmaze, col1, col2, col3, col4, 0);
409 tile_rle [MAZE_EYE_OPEN_REMOTE_NODE] = make_complex_tile(eye_base + 1, PRETILE_M_NODE, tmaze, col1, col2, col3, col4, 0);
410
411 int i, j, k;
412 // tile_progress_update("wiping");
413
414 // First we wipe the whole map:
415 for (i = 0; i < x; i ++)
416 {
417 for (j = 0; j < y; j ++)
418 {
419 // putpixel(level_bmp, i, j, i % 10); //grand(MAZE_UDLR));
420 // putpixel(level_bmp, i, j, grand(MAZE_OUTER));
421 putpixel(level_bmp, i, j, 0); //MAZE_NOTHING);
422 }
423 }
424
425 // tile_progress_update("drawing");
426 draw_maze_1(level_bmp, x, y);
427
428 put_eyes_in_maze(level_bmp, x, y);
429
430 // tile_progress_update("fixing");
431 for (i = 0; i < x; i ++)
432 {
433 for (j = 0; j < y; j ++)
434 {
435 if (i <= 1 || j <= 1 || i >= x - 2 || j >= y - 2)
436 putpixel(level_bmp, i, j, MAZE_OUTER2);
437 }
438 }
439
440 int connections, putty;
441
442 // then we fix the map so that the paths join up properly:
443 for (i = 0; i < x; i ++)
444 {
445 for (j = 0; j < y; j ++)
446 {
447 if (getpixel(level_bmp, i, j) == 0)
448 continue;
449 if (getpixel(level_bmp, i, j) == MAZE_OUTER2)
450 {
451 if (i == 0 || j == 0 || i == x - 1 || j == y - 1)
452 {
453 putpixel(level_bmp, i, j, MAZE_OUTER2);
454 continue;
455 }
456 if (i == 1)
457 putpixel(level_bmp, i, j, MAZE_OUTER_L);
458 if (j == 1)
459 putpixel(level_bmp, i, j, MAZE_OUTER_U);
460 if (i == x - 2)
461 putpixel(level_bmp, i, j, MAZE_OUTER_R);
462 if (j == y - 2)
463 putpixel(level_bmp, i, j, MAZE_OUTER_D);
464 if (i == 1 && j == 1)
465 putpixel(level_bmp, i, j, MAZE_OUTER_UL);
466 if (i == 1 && j == y - 2)
467 putpixel(level_bmp, i, j, MAZE_OUTER_DL);
468 if (i == x - 2 && j == y - 2)
469 putpixel(level_bmp, i, j, MAZE_OUTER_DR);
470 if (i == x - 2 && j == 1)
471 putpixel(level_bmp, i, j, MAZE_OUTER_UR);
472 // putpixel(level_bmp, i, j, MAZE_OUTER_U);
473 continue;
474 }
475
476 connections = 0;
477 putty = 0;
478 if (getpixel(level_bmp, i - 1, j) > 0)// && getpixel(level_bmp, i - 1, j) != MAZE_OUTER2)
479 connections += CONNECT_L;
480 if (getpixel(level_bmp, i + 1, j) > 0)// && getpixel(level_bmp, i + 1, j) != MAZE_OUTER2)
481 connections += CONNECT_R;
482 if (getpixel(level_bmp, i, j - 1) > 0)// && getpixel(level_bmp, i, j - 1) != MAZE_OUTER2)
483 connections += CONNECT_U;
484 if (getpixel(level_bmp, i, j + 1) > 0)// && getpixel(level_bmp, i, j + 1) != MAZE_OUTER2)
485 connections += CONNECT_D;
486 switch(connections)
487 {
488 case 1: putty = MAZE_U; break;
489 case 2: putty = MAZE_D; break;
490 case 4: putty = MAZE_L; break;
491 case 8: putty = MAZE_R; break;
492 case 3: putty = MAZE_UD; break;
493 case 12: putty = MAZE_LR; break;
494 case 5: putty = MAZE_UL; break;
495 case 6: putty = MAZE_DL; break;
496 case 9: putty = MAZE_UR; break;
497 case 10: putty = MAZE_DR; break;
498 case 13: putty = MAZE_ULR; break;
499 case 14: putty = MAZE_DLR; break;
500 case 7: putty = MAZE_UDL; break;
501 case 11: putty = MAZE_UDR; break;
502 case 15: putty = MAZE_UDLR;
503 for (k = 0; k < arena.eyes_on_level; k ++)
504 {
505 // for now, arena.eye_x is in GRID_WIDTH, not GRAIN. It gets changed to GRAIN later.
506 if (arena.eye_x [k] == i && arena.eye_y [k] == j)
507 {
508 putty = MAZE_EYE_CLOSED_NODE; // assumes all eyes are on udlr
509 break;
510 }
511 }
512 break;
513 }
514 putpixel(level_bmp, i, j, putty);
515 }
516 }
517
518 // place_eyes(level_bmp, x, y);
519
520 // tile_progress_update("fixed");
521
522 // now let's change arena.eye_x from GRID_WIDTH to GRAIN:
523 for (k = 0; k < arena.eyes_on_level; k ++)
524 {
525 arena.eye_x [k] = (arena.eye_x [k] - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN;
526 arena.eye_y [k] = (arena.eye_y [k] - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN;
527 }
528
529 }
530
531 void place_eyes(BITMAP *level_bmp, int x, int y)
532 {
533 /*
534 int i, j, k = 0;
535 int node_x [100];
536 int node_y [100];
537
538 for (i = 0; i < x; i ++)
539 {
540 for (j = 0; j < y; j ++)
541 {
542 if (k >= 100)
543 break;
544 if (getpixel(level_bmp, i, j) == MAZE_UDLR)
545 {
546 node_x [k] = i;
547 node_y [k] = j;
548 k++;
549 // putpixel(level_bmp, i, j, MAZE_EYE_CLOSED_NODE);
550 }
551 }
552 }
553
554 // int no_eyes = 4;
555
556 for (i = 0; i < MAX_EYES; i ++)
557 {
558 arena.eye_x [i] = 0;
559 arena.eye_y [i] = 0;
560 }
561 arena.eyes_on_level = 0;
562
563 next_eye = 0;
564
565 put_eye(2, 2, x / 2, y / 2, k, node_x, node_y);
566 put_eye(x - x / 2, 2, x - 2, y / 2, k, node_x, node_y);
567 put_eye(x - x / 2, y - y / 2, x - 2, y - 2, k, node_x, node_y);
568 put_eye(2, y - y / 2, x / 2, y - 2, k, node_x, node_y);
569
570
571 arena.eye_colour1 = 0; // pupil - absolute black. won't be overwritten by transparencies
572
573 arena.eye_colour2 = TRANS_YELLOW;
574 arena.eye_colour3 = TRANS_LRED;
575 if (grand(3) == 0)
576 {
577 arena.eye_colour2 = TRANS_ORANGE;
578 arena.eye_colour3 = TRANS_DRED;
579 }
580
581 if (arena.level > 5 && grand(3) != 0)
582 {
583 arena.eye_colour2 = TRANS_WHITE;
584 arena.eye_colour3 = TRANS_LBLUE;
585 if (grand(5) == 0)
586 arena.eye_colour3 = TRANS_PURPLE;
587 if (grand(5) == 0)
588 arena.eye_colour3 = TRANS_DBLUE;
589 }
590
591 if (arena.level > 10 && grand(3) != 0)
592 {
593 arena.eye_colour2 = TRANS_YELLOW;
594 arena.eye_colour3 = TRANS_LGREEN;
595 if (grand(3) == 0)
596 {
597 arena.eye_colour2 = TRANS_LGREEN;
598 arena.eye_colour3 = TRANS_DGREEN;
599 }
600 }
601
602 // not the usual order of colours.
603 */
604 }
605
606 void put_eye(int x1, int y1, int x2, int y2, int k, int node_x [100], int node_y [100])
607 {
608
609 int i, j;
610
611 for (i = 0; i < k; i ++)
612 {
613 if (node_x [i] > x1 && node_x [i] < x2 && node_y [i] > y1 && node_y [i] < y2)
614 {
615 put_eye2(node_x [i], node_y [i]);
616 return;
617 }
618 }
619 // okay, we couldn't find a node in that area. We'll have to make one:
620 int timeout = 0;
621
622 do
623 {
624 i = x1 + grand(x2 - x1 + 1);
625 j = y1 + grand(y2 - y1 + 1);
626 if (eye_okay(i, j))
627 {
628 put_eye2(i, j);
629 return;
630 }
631 timeout ++;
632 } while(timeout < 10000);
633
634 // that didn't work, so let's find any suitable position:
635 for (i = x1; i < x2; i ++)
636 {
637 for (j = y1; j < y2; j ++)
638 {
639 if (eye_okay(i, j))
640 {
641 put_eye2(i, j);
642 return;
643 }
644 }
645 }
646
647 }
648
649 void put_eye2(int x, int y)
650 {
651 int placed = 0;
652 if (getpixel(level_bmp, x, y) == MAZE_UDLR)
653 {
654 putpixel(level_bmp, x, y, MAZE_EYE_CLOSED_NODE);
655 placed = 1;
656 }
657 if (getpixel(level_bmp, x, y) == 0)
658 {
659 putpixel(level_bmp, x, y, MAZE_EYE_CLOSED_REMOTE_NODE);
660 placed = 1;
661 }
662 if (placed == 1)
663 {
664 // arena.eye_x [next_eye] = x * GRID_WIDTH * GRAIN;
665 // arena.eye_y [next_eye] = y * GRID_WIDTH * GRAIN;
666 arena.eye_x [next_eye] = (x - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN;
667 arena.eye_y [next_eye] = (y - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN;
668 arena.eyes_on_level ++;
669 next_eye ++;
670 }
671 }
672
673 int eye_okay(int i, int j)
674 {
675 if (getpixel(level_bmp, i, j) != 0)
676 return 0;
677 if (getpixel(level_bmp, i + 1, j) == 0
678 && getpixel(level_bmp, i - 1, j) == 0
679 && getpixel(level_bmp, i, j + 1) == 0
680 && getpixel(level_bmp, i, j - 1) == 0)
681 return 1;
682
683 return 0;
684 }
685
686 void open_eyes(void)
687 {
688 int i,j, opened;
689 int passing_colours [5];
690
691 int x = arena.max_x / 50000 + 5;
692 int y = arena.max_y / 50000 + 5;
693
694 for (i = 0; i < x; i ++)
695 {
696 for (j = 0; j < y; j ++)
697 {
698 opened = 0;
699 if (getpixel(level_bmp, i, j) == MAZE_EYE_CLOSED_NODE)
700 {
701 putpixel(level_bmp, i, j, MAZE_EYE_OPEN_NODE);
702 opened = 1;
703 }
704 if (getpixel(level_bmp, i, j) == MAZE_EYE_CLOSED_REMOTE_NODE)
705 {
706 putpixel(level_bmp, i, j, MAZE_EYE_OPEN_REMOTE_NODE);
707 opened = 1;
708 }
709 if (opened == 1)
710 {
711 passing_colours [0] = TRANS_DBLUE;
712 passing_colours [1] = TRANS_LBLUE;
713 passing_colours [2] = TRANS_WHITE;
714 place_explosion((i - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN + grand(3001) - 1500, (j - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN + grand(3001) - 1500, 0, 0, 700 + grand(300), passing_colours);
715 passing_colours [0] = TRANS_LBLUE;
716 passing_colours [1] = COLOUR_BLUE8;
717 place_line_burst((i - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN, (j - 2) * GRID_WIDTH * GRAIN + (GRID_WIDTH / 2.5) * GRAIN, 0, 0, 7 + grand(4), 15, 15, 2500, 300, passing_colours);
718 }
719 }
720 }
721 }
722
723 void draw_maze_1(BITMAP *level_bmp, int x, int y)
724 {
725 // now we draw various paths onto the map with value 1:
726
727 int m, n, i, j;
728 int path_length = 5 + grand(30);
729 int no_paths = 3 + grand(4);
730
731 for (m = 0; m < no_paths; m ++)
732 {
733 i = grand(x - 2) + 2;
734 j = grand(y - 2) + 2;
735 for (n = 0; n < path_length; n ++)
736 {
737 putpixel(level_bmp, i, j, 1);
738 if (grand(2) == 0)
739 {
740 if (grand(2) == 0) i ++;
741 else i --;
742 }
743 else
744 {
745 if (grand(2) == 0) j ++;
746 else j --;
747 }
748 if (i < 2 || i > x - 2)
749 i = grand(x - 2) + 2;
750 if (j < 2 || j > y - 2)
751 j = grand(y - 2) + 2;
752 }
753 }
754
755 }
756
757 void draw_maze_2(BITMAP *level_bmp, int x, int y)
758 {
759
760 // now we draw various paths onto the map with value 1:
761
762 int m;//, n, i, j;
763 // int path_length = 5 + grand(30);
764 int no_paths = 8 + grand(4);
765
766 for (m = 0; m < no_paths; m ++)
767 {
768 if (grand(2) == 0)
769 hline(level_bmp, grand(x - 2) + 2, grand(y - 2) + 2, grand(x - 2) + 2, 1);
770 else
771 vline(level_bmp, grand(x - 2) + 2, grand(y - 2) + 2, grand(y - 2) + 2, 1);
772 }
773
774 }
775
776 void put_eyes_in_maze(BITMAP *level_bmp, int x, int y)
777 {
778 int i;
779
780 for (i = 0; i < MAX_EYES; i ++)
781 {
782 arena.eye_x [i] = 0;
783 arena.eye_y [i] = 0;
784 }
785 arena.eyes_on_level = 4;
786
787 arena.eye_colour1 = 0; // pupil - absolute black. won't be overwritten by transparencies
788
789 arena.eye_colour2 = TRANS_YELLOW;
790 arena.eye_colour3 = TRANS_LRED;
791 if (grand(3) == 0)
792 {
793 arena.eye_colour2 = TRANS_ORANGE;
794 arena.eye_colour3 = TRANS_DRED;
795 }
796
797 if (arena.level > 5 && grand(3) != 0)
798 {
799 arena.eye_colour2 = TRANS_WHITE;
800 arena.eye_colour3 = TRANS_LBLUE;
801 if (grand(5) == 0)
802 arena.eye_colour3 = TRANS_PURPLE;
803 if (grand(5) == 0)
804 arena.eye_colour3 = TRANS_DBLUE;
805 }
806
807 if (arena.level > 10 && grand(3) != 0)
808 {
809 arena.eye_colour2 = TRANS_YELLOW;
810 arena.eye_colour3 = TRANS_LGREEN;
811 if (grand(3) == 0)
812 {
813 arena.eye_colour2 = TRANS_LGREEN;
814 arena.eye_colour3 = TRANS_DGREEN;
815 }
816 }
817
818 // not the usual order of colours.
819
820
821
822 find_place_for_eye(3, 3, x / 2, y / 2, 0);
823 find_place_for_eye(x / 2, y / 2, x - 3, y - 3, 1);
824 find_place_for_eye(3, y / 2, x / 2, y - 3, 2);
825 find_place_for_eye(x / 2, 3, x - 3, y / 2, 3);
826
827 if (grand(2) == 0)
828 {
829 find_place_for_eye(3, 3, x / 2, y / 2, 3);
830 find_place_for_eye(x / 2, y / 2, x - 3, y - 3, 2);
831 find_place_for_eye(3, y / 2, x / 2, y - 3, 1);
832 find_place_for_eye(x / 2, 3, x - 3, y / 2, 0);
833 }
834
835 for (i = 0; i < arena.eyes_on_level; i ++)
836 {
837 putpixel(level_bmp, arena.eye_x [i], arena.eye_y [i], 1);
838
839 /* draw_eye_path(level_bmp, x, y, arena.eye_x [i] + 1, arena.eye_y [i], 1, 0, 1); // same but draw = 1
840 draw_eye_path(level_bmp, x, y, arena.eye_x [i] - 1, arena.eye_y [i], -1, 0, 1); // same but draw = 1
841 draw_eye_path(level_bmp, x, y, arena.eye_x [i], arena.eye_y [i] + 1, 0, 1, 1); // same but draw = 1
842 draw_eye_path(level_bmp, x, y, arena.eye_x [i], arena.eye_y [i] - 1, 0, -1, 1); // same but draw = 1*/
843 putpixel(level_bmp, arena.eye_x [i] + 1, arena.eye_y [i], 1);
844 putpixel(level_bmp, arena.eye_x [i] - 1, arena.eye_y [i], 1);
845 putpixel(level_bmp, arena.eye_x [i], arena.eye_y [i] + 1, 1);
846 putpixel(level_bmp, arena.eye_x [i], arena.eye_y [i] - 1, 1);
847 if (draw_eye_path(level_bmp, x, y, arena.eye_x [i] + 1, arena.eye_y [i], 1, 0, 0))
848 draw_eye_path(level_bmp, x, y, arena.eye_x [i] + 1, arena.eye_y [i], 1, 0, 1); // same but draw = 1
849 else
850 putpixel(level_bmp, arena.eye_x [i] + 1, arena.eye_y [i], 1);
851
852 if (draw_eye_path(level_bmp, x, y, arena.eye_x [i] - 1, arena.eye_y [i], -1, 0, 0))
853 draw_eye_path(level_bmp, x, y, arena.eye_x [i] - 1, arena.eye_y [i], -1, 0, 1); // same but draw = 1
854 else
855 putpixel(level_bmp, arena.eye_x [i] - 1, arena.eye_y [i], 1);
856
857 if (draw_eye_path(level_bmp, x, y, arena.eye_x [i], arena.eye_y [i] + 1, 0, 1, 0))
858 draw_eye_path(level_bmp, x, y, arena.eye_x [i], arena.eye_y [i] + 1, 0, 1, 1); // same but draw = 1
859 else
860 putpixel(level_bmp, arena.eye_x [i], arena.eye_y [i] + 1, 1);
861
862 if (draw_eye_path(level_bmp, x, y, arena.eye_x [i], arena.eye_y [i] - 1, 0, -1, 0))
863 draw_eye_path(level_bmp, x, y, arena.eye_x [i], arena.eye_y [i] - 1, 0, -1, 1); // same but draw = 1
864 else
865 putpixel(level_bmp, arena.eye_x [i], arena.eye_y [i] - 1, 1);
866
867 }
868
869 }
870
871 void find_place_for_eye(int x_min, int y_min, int x_max, int y_max, int eye)
872 {
873 // _min values should be at least 1
874
875 arena.eye_x [eye] = x_min + grand(x_max - x_min);
876 arena.eye_y [eye] = y_min + grand(y_max - y_min);
877 // arena.eye_x [eye] = x_min + 3 + grand(x_max - x_min - 6);
878 // arena.eye_y [eye] = y_min + 3 + grand(y_max - y_min - 6);
879 // arena.eye_x [eye] = x_max - 1;
880 // arena.eye_y [eye] = y_max - 1;
881
882 }
883
884 // if draw is zero, it doesn't change anything.
885 // returns zero if it hits the wall before it finds another path to join.
886 int draw_eye_path(BITMAP *level_bmp, int x, int y, int ex, int ey, int xd, int yd, int draw)
887 {
888
889 int i, j;
890
891 while (TRUE)
892 {
893
894 for (i = -1; i < 2; i ++)
895 {
896 for (j = -1; j < 2; j ++)
897 {
898 if (i == 0 && j == 0)
899 continue; // no centre
900 if (i != 0 && j != 0)
901 continue; // no diagonals
902 if (i == xd * -1 && j == yd * -1)
903 continue; // so not the one we just drew
904 if (getpixel(level_bmp, ex + i, ey + j) != 0)
905 {
906 if (draw)
907 putpixel(level_bmp, ex, ey, 1);
908 return 1;
909 }
910 }
911 }
912 ex += xd;
913 ey += yd;
914 if (ex <= 1 || ex >= x - 2 || ey <= 1 || ey >= y - 2)
915 return 0; // hit the wall!
916 if (draw)
917 putpixel(level_bmp, ex, ey, 1);
918 }
919
920
921 }
922
923
924 RLE_SPRITE *make_tile(int index, int index2, int colourise1, int colourise2, int rotation)
925 {
926
927 BITMAP *temp_bmp = make_bmp(50, 50, "make_tile (temp_bmp)");
928
929 clear_bitmap(temp_bmp);
930
931
932 if (index2 != -1)
933 {
934 if (index2 >= NO_PRETILE_BMPS || pretile_bmp [index2] == NULL)
935 {
936 do
937 {
938 textprintf_centre_ex(screen, small_font, 200, 200, COLOUR_WHITE, COLOUR_GREY1, "Pretile error index2 %i: X to continue", index2);
939 }
940 while (key [KEY_X] == 0);
941 }
942 else
943 rotate_sprite(temp_bmp, pretile_bmp [index2], 0, 0, itofix(rotation));
944 }
945
946 if (index >= NO_PRETILE_BMPS || pretile_bmp [index] == NULL)
947 {
948 do
949 {
950 textprintf_centre_ex(screen, small_font, 200, 200, COLOUR_WHITE, COLOUR_GREY1, "Pretile error index %i: X to continue", index);
951 }
952 while (key [KEY_X] == 0);
953 }
954 else
955 rotate_sprite(temp_bmp, pretile_bmp [index], 0, 0, itofix(rotation));
956
957 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
958 if (colourise1 != 0)
959 rectfill(temp_bmp, 0, 0, 50, 50, colourise1);
960 if (colourise2 != 0)
961 rectfill(temp_bmp, 0, 0, 50, 50, colourise2);
962 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
963
964 RLE_SPRITE *return_sprite = get_rle_sprite(temp_bmp);
965
966 destroy_bitmap(temp_bmp);
967
968 return return_sprite;
969
970
971
972 }
973
974 RLE_SPRITE *make_m_tile(int index, int tmaze, int index2, int colourise1, int colourise2, int rotation)
975 {
976
977 BITMAP *temp_bmp = make_bmp(50, 50, "make_m_tile (temp_bmp)");
978
979 clear_bitmap(temp_bmp);
980
981
982 if (index2 != -1)
983 {
984 if (index2 >= NO_PRETILE_M_BMPS || pretile_m_bmp [tmaze] [index2] == NULL)
985 {
986 do
987 {
988 textprintf_centre_ex(screen, small_font, 200, 200, COLOUR_WHITE, COLOUR_GREY1, "Pretile m error index2 %i, %i: Space to continue", index2, tmaze);
989 }
990 while (key [KEY_SPACE] == 0);
991 }
992 else
993 rotate_sprite(temp_bmp, pretile_m_bmp [tmaze] [index2], 0, 0, itofix(rotation));
994 }
995
996 if (index >= NO_PRETILE_M_BMPS || pretile_m_bmp [tmaze] [index] == NULL)
997 {
998 do
999 {
1000 textprintf_centre_ex(screen, small_font, 200, 200, COLOUR_WHITE, COLOUR_GREY1, "Pretile m error index %i, %i: Space to continue", index, tmaze);
1001 }
1002 while (key [KEY_SPACE] == 0);
1003 }
1004 else
1005 rotate_sprite(temp_bmp, pretile_m_bmp [tmaze] [index], 0, 0, itofix(rotation));
1006
1007 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1008 if (colourise1 != 0)
1009 rectfill(temp_bmp, 0, 0, 50, 50, colourise1);
1010 if (colourise2 != 0)
1011 rectfill(temp_bmp, 0, 0, 50, 50, colourise2);
1012 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1013
1014 RLE_SPRITE *return_sprite = get_rle_sprite(temp_bmp);
1015
1016 destroy_bitmap(temp_bmp);
1017
1018 return return_sprite;
1019
1020
1021
1022 }
1023
1024 // index must be in pretile array; index2 must be in pretile_m array referred to by tmaze
1025 RLE_SPRITE *make_complex_tile(int index, int index2, int tmaze, int colourise1, int colourise2, int colourise2_1, int colourise2_2, int rotation)
1026 {
1027
1028 BITMAP *temp_bmp = make_bmp(50, 50, "make_complex_tile (temp_bmp)");
1029 clear_bitmap(temp_bmp);
1030 BITMAP *temp_bmp2 = make_bmp(50, 50, "make_complex_tile (temp_bmp2)");
1031 clear_bitmap(temp_bmp2);
1032
1033 if (index2 != -1)
1034 {
1035 if (index2 >= NO_PRETILE_M_BMPS || pretile_m_bmp [tmaze] [index2] == NULL)
1036 {
1037 do
1038 {
1039 textprintf_centre_ex(screen, small_font, 200, 200, COLOUR_WHITE, COLOUR_GREY1, "make_complex_tile pretile m error index2 %i: Space to continue", index2);
1040 }
1041 while (key [KEY_SPACE] == 0);
1042 }
1043 else
1044 rotate_sprite(temp_bmp, pretile_m_bmp [tmaze] [index2], 0, 0, itofix(rotation));
1045 }
1046
1047 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1048 if (colourise1 != 0)
1049 rectfill(temp_bmp, 0, 0, 50, 50, colourise1);
1050 if (colourise2 != 0)
1051 rectfill(temp_bmp, 0, 0, 50, 50, colourise2);
1052 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1053
1054
1055 if (index >= NO_PRETILE_BMPS || pretile_bmp [index] == NULL)
1056 {
1057 do
1058 {
1059 textprintf_centre_ex(screen, small_font, 200, 200, COLOUR_WHITE, COLOUR_GREY1, "make_complex_tile pretile error index %i: Space to continue", index);
1060 }
1061 while (key [KEY_SPACE] == 0);
1062 }
1063 else
1064 rotate_sprite(temp_bmp2, pretile_bmp [index], 0, 0, itofix(rotation));
1065
1066 drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
1067 if (colourise1 != 0)
1068 rectfill(temp_bmp2, 0, 0, 50, 50, colourise2_1);
1069 if (colourise2 != 0)
1070 rectfill(temp_bmp2, 0, 0, 50, 50, colourise2_2);
1071 drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
1072
1073 draw_sprite(temp_bmp, temp_bmp2, 0, 0);
1074 // circle(temp_bmp2, 25, 25, 5, COLOUR_GREEN6);
1075
1076 RLE_SPRITE *return_sprite = get_rle_sprite(temp_bmp);
1077
1078 destroy_bitmap(temp_bmp);
1079 destroy_bitmap(temp_bmp2);
1080
1081 return return_sprite;
1082
1083
1084 }
1085
1086 BITMAP *make_bmp(int x, int y, const char errtxt [])
1087 {
1088
1089 BITMAP *bmp_made = create_bitmap(x, y);
1090
1091 if (bmp_made == NULL)
1092 {
1093 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
1094 allegro_message("Bitmap creation error \n%s\n\n\r%s", allegro_error, errtxt);
1095 exit(1);
1096 }
1097
1098 return bmp_made;
1099 }
1100
1101
1102
1103 void tile_progress_update(const char progtxt [])
1104 {
1105 static int ypos = 10, xpos = 10;
1106 textprintf_centre_ex(screen, small_font, 320, ypos, COLOUR_GREEN8, -1, progtxt);
1107 ypos += 10;
1108 if (ypos > 470)
1109 {
1110 if (xpos > 620)
1111 {
1112 xpos = 10;
1113 ypos = 10;
1114 }
1115 ypos = 10;
1116 xpos += 30;
1117 }
1118 }
1119
1120
1121 void make_tile_background_rle(void)
1122 {
1123
1124 if (tile_background != NULL)
1125 destroy_rle_sprite(tile_background);
1126
1127 // BITMAP *tile_back_temp = make_bmp(scr_x + GRID_WIDTH, scr_y + GRID_WIDTH, "make_tile_background_rle");
1128 BITMAP *tile_back_temp = make_bmp(scr_x + GRID_WIDTH, scr_y + GRID_WIDTH, "make_tile_background_rle");
1129
1130 int i, j, xw;
1131
1132 xw = (scr_x + GRID_WIDTH) / GRID_WIDTH;
1133
1134 if (game.users == 2)
1135 {
1136 xw /= 2;
1137 xw ++; // even in 640x480
1138 }
1139
1140 if (options.resolution != GMODE_800_600)
1141 xw ++;
1142
1143 for (i = 0; i < xw; i ++)
1144 {
1145 for (j = 0; j < (scr_y + GRID_WIDTH) / GRID_WIDTH + 1; j ++)
1146 {
1147 draw_rle_sprite(tile_back_temp, tile_rle [0], i * GRID_WIDTH, j * GRID_WIDTH);
1148 // circlefill(tile_back_temp, i * GRID_WIDTH, j * GRID_WIDTH, 7, COLOUR_WHITE);
1149 }
1150 }
1151
1152 tile_background = get_rle_sprite(tile_back_temp);
1153
1154 destroy_bitmap(tile_back_temp);
1155 }
1156
1157
1158
0 void init_tiles(void);
1 void make_tile_map(int x, int y);
2 void open_eyes(void);
3
4
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown