-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisplay.c
7602 lines (7013 loc) · 275 KB
/
display.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Overgod
Copyright (C) 2005 Linley Henzell
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Licence as published by
the Free Software Foundation; either version 2 of the Licence, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public Licence for more details.
You should have received a copy of the GNU General Public Licence
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The GPL version 2 is included in this distribution in a file called
LICENCE.TXT. Use any text editor or the TYPE command to read it.
You should be able to reach me by sending an email to
l_henzell@yahoo.com.au.
File: display.c
History:
11/9/2005 - Version 1.0 finalised
This file contains:
- functions which put stuff onto the screen
*/
#include "allegro.h"
#include <math.h>
#include <string.h>
#include "config.h"
#include "globvars.h"
#include "palette.h"
#include "stuff.h"
#include "light.h"
#define COMPILING_DISPLAYC
#include "display.h"
#undef COMPILING_DISPLAYC
//#define DEBUG_DISPLAY
int debug_info;
extern struct lightstruct light [NO_LIGHTS];
int pline(BITMAP *bmp, int x1, int y1, int x2, int y2, int colour);
//#define DEBUG_ENEMY_SIZE
BITMAP *player1;
BITMAP *player2;
#ifdef DEBUG_DISPLAY
#include <stdlib.h>
// for itoa, used in the screenshot code but not needed for ports etc
extern volatile int frames_per_second;
extern volatile int ticked;
extern int slacktime;
extern int long_slacktime_store;
extern int debug_sound [5];
int slack_graph [100];
int slack_graph_pos;
int fps_graph [100];
int fps_graph_pos;
#endif
extern struct optionstruct options;
//BITMAP *ship_bitmaps [2] [65]; // externed in displ_in.c
BITMAP *ship_bitmaps [NO_SHIP_TYPES] [17];
BITMAP *gb_ship_bitmaps [GB_SHIP_TYPES] [17];
BITMAP *enemy1_bmp [ENEMY1_BMPS];
RLE_SPRITE *enemy1_rle [ENEMY1_RLES];
RLE_SPRITE *small1_rle [SMALL1_RLES];
RLE_SPRITE *small3_rle [SMALL3_RLES];
RLE_SPRITE *enemy2_rle [ENEMY2_RLES];
RLE_SPRITE *enemy3_rle [ENEMY3_RLES];
RLE_SPRITE *enemy4_rle [ENEMY4_RLES];
RLE_SPRITE *enemy5_rle [ENEMY5_RLES];
RLE_SPRITE *enemy6_rle [ENEMY6_RLES];
RLE_SPRITE *enemy7_rle [ENEMY7_RLES];
RLE_SPRITE *enemy8_rle [ENEMY8_RLES];
RLE_SPRITE *enemy9_rle [ENEMY9_RLES];
BITMAP *small2_bmp [SMALL2_BMPS];
BITMAP *small4_bmp [SMALL4_BMPS];
BITMAP *enemy_bmps [ENEMY_BMPS];
//extern float cos_table [ANGLE_FULL];
BITMAP *pretile_bmp [NO_PRETILE_BMPS];
BITMAP *pretile_m_bmp [NO_MAZES] [NO_PRETILE_M_BMPS];
RLE_SPRITE *tile_rle [NO_TILE_RLES];
BITMAP *level_bmp;
BITMAP *redbang_bmp [50];
RLE_SPRITE *light_rle [100];
BITMAP *superjelly_bmp [2];
BITMAP *shield_bmp [SHIELD_BMPS];
RLE_SPRITE *waver1_circle;
RLE_SPRITE *waver2_circle;
RLE_SPRITE *large_ships [16] [5];
RLE_SPRITE *tile_background;
FONT *font2;
FONT *small_font;
struct effects_struct effect [MAX_EFFECTS];
int var1, var2, var3; // debug display vars, externed as necessary
int graphics_mode;
int scr_x;
int scr_y;
int grid_offset_x_1p;
int grid_offset_x_2p;
int grid_offset_x_2p_finetune;
int grid_offset_y;
int special_600_y;
int text_offset_x;
int text_offset_x_1p;
int text_offset_x_2p;
int text_offset_y;
int grid_finetune_x_1p;
int grid_finetune_x_2p;
int grid_finetune_y;
int visible_grids_y;
int tp_window_width;
void indicate_fps(BITMAP *bmp, int play);
void draw_effects(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_an_effect(BITMAP *bmp, int dr, int x, int y);
void beam_points(BITMAP *bmp, int x1, int y1, int x2, int y2, int angle, int out1, int out2, int colour);
//void draw_lock(BITMAP *bmp, int dr, int x, int y, int rad);
//void draw_turret_lock(BITMAP *bmp, int dr, int x, int y, int rad);
void draw_locks(BITMAP *bmp, int p);
float angle_to_radians(int angle);
int inflicteda, inflictede;
//void draw_grid(BITMAP *bmp, int xloc, int yloc, int max_x, int max_y, int colour);
void draw_stars(BITMAP *bmp, int max_x, int max_y, int player);
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);
void draw_actors(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_hud(BITMAP *bmp, int x, int y, int i);
void draw_eyes(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_an_eye(BITMAP *bmp, int i, int x, int y);
void draw_an_actor(BITMAP *bmp, int dr, int x, int y, int play);
void draw_ship_bitmap(BITMAP *bmp, int x, int y, int angle, int which_ship, int width, int height);
void draw_triangle_ship(BITMAP *bmp, int dr, int size, int pointiness, int x, int y, unsigned char colour1, unsigned char colour2);
//void draw_scan(BITMAP *bmp, int max_x, int max_y, int play, char range);
//void draw_scan_dot(BITMAP *bmp, int x, int y, int type);
void draw_status2(BITMAP *bmp, int max_x, int max_y, int play);
void draw_bullets(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_a_bullet(BITMAP *bmp, int dr, int x, int y, int x2, int y2, int max_x, int max_y, int play);
void draw_enemies(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_an_enemy_inter(BITMAP *bmp, int e, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_an_enemy_inter2(BITMAP *bmp, int e, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_an_enemy(BITMAP *bmp, int dr, int x, int y);
void draw_clouds(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_a_cloud(BITMAP *bmp, int dr, int x, int y, int x2, int y2);
void draw_pickups(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_a_pickup(BITMAP *bmp, int dr, int x, int y);
void get_pickup_colour(int st, int cols [3]);
void write_colour_text(BITMAP *bmp, int x, int y, int which);
void draw_static_symbol(BITMAP *bmp, int x, int y, int col, int symb);
void draw_crosshair(BITMAP *bmp, int dr, int x, int y);
int get_circler_colour(int x1);
void draw_wave(BITMAP *bmp, int x, int y, int count, int size);
//void draw_sidekicks(BITMAP *bmp, int max_x, int max_y, int play, int a);
void draw_ship_status(BITMAP *bmp, int x, int y, int a, int style);
void draw_upgrades(BITMAP *bmp, int x, int y, int play);
char *upgrade_name(int i);
char *primary_name(int i);
void secondary_name(int i, char dstr [30]);
void draw_crawler_legs(BITMAP *bmp, int x, int y, int e, int col);
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);
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);
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);
void draw_blatter(BITMAP *bmp, int x, int y, int number, int distance, int rotation, int size, int col1, int col2);
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);
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);
void draw_puffer(BITMAP *bmp, int x, int y, int angle, int number, int distance, int size, int incol, int outcol);
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);
void draw_tri(BITMAP *bmp, int x, int y, int angle, int length1, int length2, int angle2, int col1, int col2);
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);
void distortion(BITMAP *bmp, int x, int y, int wx, int wy, int dx, int dy);
BITMAP *distortion_mask;
BITMAP *crystal_bmp;
int set_lock_x [2];
int set_lock_y [2];
int set_lock_radius [2];
int set_turret_lock_x [2];
int set_turret_lock_y [2];
int set_turret_lock_radius [2];
#define NO_MESSAGES 10
char messages [2] [NO_MESSAGES] [70];
int message_style [2] [NO_MESSAGES];
int message_counter [2] [NO_MESSAGES];
char scroll_text [10] [50];
int scroll_position [10];
int scroll_colour [10];
void display_messages(BITMAP *bmp, int play, int max_x, int max_y);
void kill_message(int play, int i);
void draw_lights(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y);
void draw_a_light(BITMAP *bmp, int size, int x, int y);
void bordered_rect(BITMAP *bmp, int x1, int y1, int x2, int y2, int colour1, int colour2);
void bordered_triangle(BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, int y3, int col1, int col2);
void draw_spark_jump(BITMAP *bmp, int x1, int y1, int x2, int y2, int parts, int scatter, int col, int transy);
//char prim_name [4] [10]
/*
void display_scrollbar(BITMAP *bmp, int play, int max_x, int max_y)
{
}
void new_scroll(const char *msg, int colour)
{
}
void run_scrollbar(int play)
{
}
*/
void run_display(void)
{
static int counter;
counter++;
if (counter > 40000)
counter = 0;
// int i;
int centre_x, centre_y;
// draw_grid(player1, 150 + counter, 150 + counter, scr_x, scr_y, 100, 2);
// draw_grid(player1, actor[0].x / GRAIN, actor[0].y / GRAIN, scr_x, scr_y, actor[0].angle, 2);
if (game.users == 1)
{
centre_x = actor[player[game.single_player].actor_controlled].x + player[game.single_player].screen_shake_x;
centre_y = actor[player[game.single_player].actor_controlled].y + player[game.single_player].screen_shake_y;
set_lock_x [game.single_player] = 0;
set_lock_y [game.single_player] = 0;
set_lock_radius [game.single_player] = 0;
set_turret_lock_x [game.single_player] = 0;
set_turret_lock_y [game.single_player] = 0;
set_turret_lock_radius [game.single_player] = 0;
// draw_stars(player1, scr_x, scr_y, 0);
// clear_to_color(player1, arena.colour3);
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);
draw_pickups(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_enemies(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_actors(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_bullets(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_effects(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_clouds(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_eyes(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
draw_lights(player1, scr_x, scr_y, game.single_player, centre_x, centre_y);
// after here, it's just HUD and screen_shake isn't applied:
draw_upgrades(player1, scr_x / 2 - 120, scr_y - 45, game.single_player);
draw_status2(player1, scr_x, scr_y, game.single_player);
draw_locks(player1, game.single_player);
/* if (actor[player[game.single_player].actor_controlled].lock != -1
&& enemy[actor[player[game.single_player].actor_controlled].lock].type != ENEMY_NONE
&& set_lock_radius [game.single_player] != 0)
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]);
if (actor[player[game.single_player].actor_controlled].turret_lock != -1
&& enemy[actor[player[game.single_player].actor_controlled].turret_lock].type != ENEMY_NONE)
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]);*/
indicate_fps(player1, game.single_player);
// display_messages(player1, game.single_player, scr_x, scr_y);
/* drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
for (i = 195; i < 206; i ++)
{
rectfill(player1, 10 + (i-195) * 30, 100, 30 + (i-195) * 30, 150, i);
}
drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);*/
if (options.run_vsync > 0)
vsync();
// textprintf_ex(player1, font, 100, 100, COLOUR_GREY5, COLOUR_YELLOW1, "%i", grand(500));
blit(player1, screen, 0, 0, 0, 0, scr_x, scr_y);
}
else
{
// grid_offset_x_2p =
centre_x = actor[player[0].actor_controlled].x + player[0].screen_shake_x;
centre_y = actor[player[0].actor_controlled].y + player[0].screen_shake_y;
set_lock_x [0] = 0;
set_lock_y [0] = 0;
set_lock_radius [0] = 0;
set_turret_lock_x [0] = 0;
set_turret_lock_y [0] = 0;
set_turret_lock_radius [0] = 0;
set_lock_x [1] = 0;
set_lock_y [1] = 0;
set_lock_radius [1] = 0;
set_turret_lock_x [1] = 0;
set_turret_lock_y [1] = 0;
set_turret_lock_radius [1] = 0;
// draw_stars(player1, 310, scr_y, 0);
// clear_to_color(player1, arena.colour3);
// clear_to_color(player2, arena.colour3);
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);
draw_pickups(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_enemies(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_actors(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_bullets(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_effects(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_clouds(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_eyes(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
draw_lights(player1, tp_window_width, scr_y, 0, centre_x, centre_y);
// draw_scan(player1, 50, 50, actor[player[0].actor_controlled].angle, 0, 0);
// draw_scan(player1, 260, 50, actor[player[0].actor_controlled].angle, 0, 1);
// draw_hud(player1, 155, 360, player[0].actor_controlled);
// draw_upgrades(player1, 40, 420, 0);
// draw_upgrades(player1, 16, 460, 0);
draw_upgrades(player1, tp_window_width / 2 - 120, scr_y - 20, 0);//game.single_player);
draw_status2(player1, tp_window_width, scr_y, 0);
indicate_fps(player1, 0);
// display_messages(player1, 0, 310, scr_y);
centre_x = actor[player[1].actor_controlled].x + player[1].screen_shake_x;
centre_y = actor[player[1].actor_controlled].y + player[1].screen_shake_y;
// draw_stars(player2, 310, scr_y, 1);
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);
draw_eyes(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_pickups(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_enemies(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_actors(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_bullets(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_effects(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_clouds(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_eyes(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
draw_lights(player2, tp_window_width, scr_y, 1, centre_x, centre_y);
// draw_scan(player2, 50, 50, actor[player[1].actor_controlled].angle, 1, 0);
// draw_scan(player2, 260, 50, actor[player[1].actor_controlled].angle, 1, 1);
// draw_hud(player2, 155, 360, player[1].actor_controlled);
draw_upgrades(player2, tp_window_width / 2 - 120, scr_y - 20, 1);
draw_status2(player2, tp_window_width, scr_y, 1);
// draw_locks(player1, 0);
// draw_locks(player2, 1);
indicate_fps(player2, 1);
// display_messages(player2, 1, tp_window_width, scr_y);
if (options.run_vsync > 0)
vsync();
blit(player1, screen, 0, 0, 0, 0, tp_window_width, scr_y);
blit(player2, screen, 0, 0, tp_window_width + 10, 0, tp_window_width, scr_y);
// clear_bitmap(player1);
// clear_bitmap(player2);
}
}
void draw_locks(BITMAP *bmp, int p)
{
/* int a = player[p].actor_controlled;
if (actor[a].lock == LOCK_ACTOR0)
{
// if (actor[0].in_play != 0)
// draw_lock(bmp, a, set_lock_x [p], set_lock_y [p], set_lock_radius [p]);
}
else
{
if (actor[a].lock == LOCK_ACTOR1)
{
// if (actor[1].in_play != 0)
// draw_lock(bmp, a, set_lock_x [p], set_lock_y [p], set_lock_radius [p]);
}
else
{
// if (actor[a].lock != -1
// && enemy[actor[a].lock].type != ENEMY_NONE
// && set_lock_radius [p] != 0)
// draw_lock(bmp, a, set_lock_x [p], set_lock_y [p], set_lock_radius [p]);
}
}
if (actor[a].turret_lock == LOCK_ACTOR0)
{
if (actor[0].in_play != 0)
draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
}
else
{
if (actor[a].turret_lock == LOCK_ACTOR1)
{
if (actor[1].in_play != 0)
draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
}
else
{
if (actor[a].turret_lock != -1
&& enemy[actor[a].turret_lock].type != ENEMY_NONE
&& set_turret_lock_radius [p] != 0)
draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
}
}
*/
// if (actor[a].turret_lock != -1
// && enemy[actor[a].turret_lock].type != ENEMY_NONE)
// draw_turret_lock(bmp, a, set_turret_lock_x [p], set_turret_lock_y [p], set_turret_lock_radius [p]);
}
void draw_actors(BITMAP *bmp, int max_x, int max_y, int play, int centre_x, int centre_y)
{
int i, x, y;
for (i = 0; i < NO_ACTORS; i ++)
{
if (actor[i].in_play == 0)
continue;
// if (actor[i].upgraded_system [UPG_SIDEKICK] > 0)
// draw_sidekicks(bmp, max_x, max_y, play, i);
if (i == player[play].actor_controlled)
{
// draw_an_actor(bmp, player[play].actor_controlled, max_x / 2, max_y / 2, play);
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);
draw_crosshair(bmp, player[play].actor_controlled, max_x / 2, max_y / 2);
continue;
}
if (actor[i].x < centre_x - (max_x / 2) * GRAIN - 7000
|| actor[i].x > centre_x + (max_x / 2) * GRAIN + 7000
|| actor[i].y < centre_y - (max_y / 2) * GRAIN - 7000
|| actor[i].y > centre_y + (max_y / 2) * GRAIN + 7000)
continue;
x = (actor[i].x / GRAIN) - (centre_x / GRAIN);
y = (actor[i].y / GRAIN) - (centre_y / GRAIN);
draw_an_actor(bmp, i, x + max_x / 2, y + max_y / 2, play);
}
}
void draw_an_actor(BITMAP *bmp, int dr, int x, int y, int play)
{
int i;
int angle2 = 0;
int angle = 0;
if (angle < 0)
angle += ANGLE_FULL;
if (angle2 < 0)
angle2 += ANGLE_FULL;
draw_ship_bitmap(bmp, x, y, actor[dr].ship, actor[dr].angle, 12, 11);
switch(actor[dr].ship)
{
// case SHIP_LACEWING:
// draw_ship_bitmap(bmp, x, y, 0, actor[dr].angle, 12, 11);
// break;
// case SHIP_CAPYBARA:
// draw_ship_bitmap(bmp, x, y, 1, actor[dr].angle, 10, 10);
// break;
/* case SHIP_RUMSFELD:
draw_ship_bitmap(bmp, x, y, 1, actor[dr].angle, 10, 10);
break;
case SHIP_LENTIL:
draw_ship_bitmap(bmp, x, y, 2, actor[dr].angle, 10, 10);
break;
case SHIP_CAPYBARA:
draw_ship_bitmap(bmp, x, y, 3, actor[dr].angle, 10, 10);
break;
case SHIP_HOOKWORM:
draw_ship_bitmap(bmp, x, y, 4, actor[dr].angle, 10, 10);
break;
case SHIP_PORKUPINE:
draw_ship_bitmap(bmp, x, y, 5, actor[dr].angle, 10, 10);
break;
case SHIP_PRONG:
draw_ship_bitmap(bmp, x, y, 6, actor[dr].angle, 10, 10);
break;
case SHIP_AETHER:
draw_ship_bitmap(bmp, x, y, 7, actor[dr].angle, 10, 10);
break;
case SHIP_DESPOT:
draw_ship_bitmap(bmp, x, y, 8, actor[dr].angle, 10, 10);
break;
case SHIP_LACEWING:
// draw_ship_bitmap(bmp, x, y, 9, actor[dr].angle, 10, 10);
draw_ship_bitmap(bmp, x, y, 0, actor[dr].angle, 12, 11);
// circle(bmp, x, y, 8, COLOUR_YELLOW6);
break;
case SHIP_TORTFEASOR:
draw_ship_bitmap(bmp, x, y, 10, actor[dr].angle, 10, 10);
break;
case SHIP_SCORPION:
draw_ship_bitmap(bmp, x, y, 11, actor[dr].angle, 10, 10);
break;
case SHIP_GODBOTHERER:
draw_ship_bitmap(bmp, x, y, 12, actor[dr].angle, 10, 10);
break;
case SHIP_BOTULUS:
draw_ship_bitmap(bmp, x, y, 13, actor[dr].angle, 10, 10);
break;
case SHIP_SLIDEWINDER:
draw_ship_bitmap(bmp, x, y, 14, actor[dr].angle, 10, 10);
break;
case SHIP_DOOM:
draw_ship_bitmap(bmp, x, y, 15, actor[dr].angle, 10, 10);
break;
*/
}
int x1, x2, y2;//, y1;
if (actor[dr].shield_pulse > 0)
{
/* int scol = COLOUR_WHITE;
if (actor[dr].shield_pulse == 9)
scol = COLOUR_GREY6;
if (actor[dr].shield_pulse == 8)
scol = COLOUR_GREY5;
if (actor[dr].shield_pulse < 8)
scol = COLOUR_GREEN1 + actor[dr].shield_pulse;*/
x1 = actor[dr].shield_pulse;
if (actor[dr].shield_pulse > 7)
x1 = 7;
x1 = grand(x1 + 1);
x2 = x + grand(3) - grand(3);
y2 = y + grand(3) - grand(3);
draw_trans_sprite(bmp, small4_bmp [BMP_SMALL4_SHIELD_1 + x1], x2 - 10, y2 - 10);
draw_trans_sprite(bmp, shield_bmp [x1], x2, y2 - 10);
draw_trans_sprite(bmp, shield_bmp [x1 + 8], x2, y2);
draw_trans_sprite(bmp, shield_bmp [x1 + 16], x2 - 10, y2);
/* draw_trans_sprite(bmp, small4_bmp [BMP_SMALL4_SHIELD_1 + grand(x1 + 1)], x - 10, y - 10);
draw_trans_sprite(bmp, shield_bmp [grand(x1 + 1)], x, y - 10);
draw_trans_sprite(bmp, shield_bmp [grand(x1 + 1) + 8], x, y);
draw_trans_sprite(bmp, shield_bmp [grand(x1 + 1) + 16], x - 10, y);*/
//circle(bmp, x + grand(5) - 2, y + grand(5) - 2, 10, scol);
}
int gd;
int y1, s1, s2, s3;
if (actor[dr].grace_period > 0)
{
gd = actor[dr].grace_period / 3;
if (gd > 15)
gd = 15;
y1 = 0;
// x1 = gd + (actor[dr].grace_period / 3) % 4 + 3;
// if (((actor[dr].grace_period / 3) / 4) % 2 == 0)
// x1 = gd + 4 - (actor[dr].grace_period / 3) % 4 + 3;
drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
// x1 = gd + (actor[dr].grace_period / 3) % 4 + 3;
x1 = (actor[dr].grace_period * 30) & 1023;
y1 = gd / 4;
if (arena.level % 2 == 0)
{
x1 = ANGLE_FULL - x1;
s1 = y1 - 2;
s2 = y1 - 1;
s3 = y1;
}
else
{
s3 = y1 - 2;
s2 = y1 - 1;
s1 = y1;
}
// gd *= 3;
for (i = 0; i < 3; i ++)
{
if (s1 > 0)
circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 3) * i, gd),
y + ypart(x1 + (ANGLE_FULL / 3) * i, gd),
s1, TRANS_WHITE);
if (s2 > 0)
circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_SIXTEENTH, gd),
y + ypart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_SIXTEENTH, gd),
s2, TRANS_WHITE);
if (s3 > 0)
circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_EIGHTH, gd),
y + ypart(x1 + (ANGLE_FULL / 3) * i + ANGLE_1_EIGHTH, gd),
s3, TRANS_WHITE);
}
// circle(bmp, x, y, x1, TRANS_YELLOW);
drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
// circle(bmp, x, y, x1, COLOUR_YELLOW3 + gd);
}
else
if (actor[dr].repairing > 0)
{
gd = actor[dr].repairing / 3;
if (gd > 15)
gd = 15;
y1 = 0;
drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
x1 = actor[dr].repairing * 35;
y1 = gd / 4;
if (arena.level % 2 == 1)
{
x1 = ANGLE_FULL - x1;
s1 = y1 - 2;
s2 = y1 - 1;
s3 = y1;
}
else
{
s3 = y1 - 2;
s2 = y1 - 1;
s1 = y1;
}
// gd = 15;
for (i = 0; i < 4; i ++)
{
if (s1 > 0)
circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 4) * i, gd + grand(2)),
y + ypart(x1 + (ANGLE_FULL / 4) * i, gd),
s1, TRANS_ORANGE);
if (s2 > 0)
circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_SIXTEENTH, gd),
y + ypart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_SIXTEENTH, gd),
s2, TRANS_ORANGE);
if (s3 > 0)
circlefill(bmp, x + xpart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_EIGHTH, gd),
y + ypart(x1 + (ANGLE_FULL / 4) * i + ANGLE_1_EIGHTH, gd),
s3, TRANS_ORANGE);
}
// circle(bmp, x, y, x1, TRANS_YELLOW);
drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
// circle(bmp, x, y, x1, COLOUR_YELLOW3 + gd);
}
// circle(bmp, x + grand(3) - 1, y + grand(3) - 1, gd * 2 + grand(3), COLOUR_YELLOW1 + gd + grand(3));
/* if (gd > 10)
gd = 10;
if (actor[dr].grace_period > 0)
{
x1 = x + cos(angle_to_radians(counter * 8)) * gd;
y1 = y + sin(angle_to_radians(counter * 8)) * gd;
putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
x1 = x + cos(angle_to_radians(counter * 8) + PI / 2) * gd;
y1 = y + sin(angle_to_radians(counter * 8) + PI / 2) * gd;
putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
x1 = x + cos(angle_to_radians(counter * 8) + PI) * gd;
y1 = y + sin(angle_to_radians(counter * 8) + PI) * gd;
putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
x1 = x + cos(angle_to_radians(counter * 8) - PI / 2) * gd;
y1 = y + sin(angle_to_radians(counter * 8) - PI / 2) * gd;
putpixel(bmp, x1, y1, COLOUR_GREY2 + grand(5));
}*/
if (dr == 0 && actor[player[play].actor_controlled].lock == LOCK_ACTOR0)
{
set_lock_x [play] = x;// + (max_x / 2);
set_lock_y [play] = y;// + (max_y / 2);
set_lock_radius [play] = 12;
}
if (dr == 1 && actor[player[play].actor_controlled].lock == LOCK_ACTOR1)
{
set_lock_x [play] = x;// + (max_x / 2);
set_lock_y [play] = y;// + (max_y / 2);
set_lock_radius [play] = 12;
}
if (dr == 0 && actor[player[play].actor_controlled].turret_lock == LOCK_ACTOR0)
{
set_turret_lock_x [play] = x;// + (max_x / 2);
set_turret_lock_y [play] = y;// + (max_y / 2);
set_turret_lock_radius [play] = 12;
}
if (dr == 1 && actor[player[play].actor_controlled].turret_lock == LOCK_ACTOR1)
{
set_turret_lock_x [play] = x;// + (max_x / 2);
set_turret_lock_y [play] = y;// + (max_y / 2);
set_turret_lock_radius [play] = 12;
}
}
void draw_crosshair(BITMAP *bmp, int dr, int x, int y)
{
int xc, yc;
int col = COLOUR_YELLOW8;
if (actor[dr].recycle1 > 0)
col = COLOUR_GREY6;
xc = x + xpart(actor[dr].angle + 28 - ANGLE_QUARTER, 48);
yc = y + ypart(actor[dr].angle + 28 - ANGLE_QUARTER, 48);
putpixel(bmp, xc, yc, col);
xc = x + xpart(actor[dr].angle - 28 - ANGLE_QUARTER, 48);
yc = y + ypart(actor[dr].angle - 28 - ANGLE_QUARTER, 48);
putpixel(bmp, xc, yc, col);
/* xc = x + xpart(actor[dr].angle + 32 - ANGLE_QUARTER, 32);
yc = y + ypart(actor[dr].angle + 32 - ANGLE_QUARTER, 32);
putpixel(bmp, xc, yc, col);
xc = x + xpart(actor[dr].angle - 32 - ANGLE_QUARTER, 32);
yc = y + ypart(actor[dr].angle - 32 - ANGLE_QUARTER, 32);
putpixel(bmp, xc, yc, col);
xc = x + xpart(actor[dr].angle - ANGLE_QUARTER, 30);
yc = y + ypart(actor[dr].angle - ANGLE_QUARTER, 30);
putpixel(bmp, xc, yc, col);
xc = x + xpart(actor[dr].angle - ANGLE_QUARTER, 34);
yc = y + ypart(actor[dr].angle - ANGLE_QUARTER, 34);
putpixel(bmp, xc, yc, col);
*/
if (actor[dr].secondary != SECOND_NONE)
{
col = COLOUR_RED8;
if (actor[dr].recycle2 > 0)
col = COLOUR_GREY3;
xc = x + xpart(actor[dr].angle + 16 - ANGLE_QUARTER, 45);
yc = y + ypart(actor[dr].angle + 16 - ANGLE_QUARTER, 45);
putpixel(bmp, xc, yc, col);
xc = x + xpart(actor[dr].angle - 16 - ANGLE_QUARTER, 45);
yc = y + ypart(actor[dr].angle - 16 - ANGLE_QUARTER, 45);
putpixel(bmp, xc, yc, col);
}
}
void draw_ship_bitmap(BITMAP *bmp, int x, int y, int which_ship, int angle, int width, int height)
{
/* int draw_angle = angle / 4;
if (draw_angle < 64)
{
draw_sprite(bmp, ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
return;
}
if (draw_angle < 128)
{
draw_sprite_v_flip(bmp, ship_bitmaps [which_ship] [128 - draw_angle], x - width, y - height - 1);
return;
}
if (draw_angle < 192)
{
draw_sprite_vh_flip(bmp, ship_bitmaps [which_ship] [draw_angle - 128], x - width - 2, y - height - 1);
return;
}
draw_sprite_h_flip(bmp, ship_bitmaps [which_ship] [256 - draw_angle], x - width - 2, y - height);
*/
int draw_angle = angle / 17.0666;
// draw_angle ++;
if (draw_angle > 60)
draw_angle = 0;
// draw_angle = draw_angle / 2);
// which_ship = 1;
// Adding a new ship? Remember GB_SHIP_TYPES!
if (draw_angle < 15)
{
draw_sprite(bmp, gb_ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
return;
}
if (draw_angle < 30)
{
draw_sprite_v_flip(bmp, gb_ship_bitmaps [which_ship] [30 - draw_angle], x - width, y - height - 1);
return;
}
if (draw_angle < 45)
{
draw_sprite_vh_flip(bmp, gb_ship_bitmaps [which_ship] [draw_angle - 30], x - width, y - height - 1);
return;
}
draw_sprite_h_flip(bmp, gb_ship_bitmaps [which_ship] [60 - draw_angle], x - width, y - height);
/* int draw_angle = angle / 16;
// draw_angle ++;
if (draw_angle > 64)
draw_angle = 0;
// draw_angle = draw_angle / 2);
// which_ship = 1;
// Adding a new ship? Remember GB_SHIP_TYPES!
if (draw_angle < 16)
{
draw_sprite(bmp, gb_ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
return;
}
if (draw_angle < 32)
{
draw_sprite_v_flip(bmp, gb_ship_bitmaps [which_ship] [32 - draw_angle], x - width, y - height - 1);
return;
}
if (draw_angle < 48)
{
draw_sprite_vh_flip(bmp, gb_ship_bitmaps [which_ship] [draw_angle - 32], x - width, y - height - 1);
return;
}
draw_sprite_h_flip(bmp, gb_ship_bitmaps [which_ship] [64 - draw_angle], x - width, y - height);
*/
/* draw_angle ++;
if (draw_angle > 64)
draw_angle = 0;
draw_angle = (draw_angle / 2);
which_ship = 0;
if (draw_angle < 16)
{
draw_sprite(bmp, gb_ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
return;
}
if (draw_angle < 32)
{
draw_sprite_v_flip(bmp, gb_ship_bitmaps [which_ship] [32 - draw_angle], x - width, y - height);
return;
}
if (draw_angle < 48)
{
draw_sprite_vh_flip(bmp, gb_ship_bitmaps [which_ship] [draw_angle - 32], x - width, y - height);
return;
}
draw_sprite_h_flip(bmp, gb_ship_bitmaps [which_ship] [64 - draw_angle], x - width, y - height);
*/
/*
if (draw_angle < 16)
{
draw_sprite(bmp, ship_bitmaps [which_ship] [draw_angle], x - width, y - height);
return;
}
if (draw_angle < 32)
{
draw_sprite_v_flip(bmp, ship_bitmaps [which_ship] [32 - draw_angle], x - width, y - height);
return;
}
if (draw_angle < 48)
{
draw_sprite_vh_flip(bmp, ship_bitmaps [which_ship] [draw_angle - 32], x - width, y - height);
return;
}
draw_sprite_h_flip(bmp, ship_bitmaps [which_ship] [64 - draw_angle], x - width, y - height);
*/
}
/*
void draw_triangle_ship(BITMAP *bmp, int dr, int size, int pointiness, int x, int y, unsigned char colour1, unsigned char colour2)
{
int x1,y1,x2,y2,x3,y3;
float radangle = angle_to_radians(actor[dr].angle);
// float radangle = angle_to_radians(actor[dr].angle);
x1 = x + cos(radangle) * (size + pointiness);
y1 = y + sin(radangle) * (size + pointiness);
x2 = x + cos(radangle + (PI * 2) / 3) * size;
y2 = y + sin(radangle + (PI * 2) / 3) * size;
x3 = x + cos(radangle - (PI * 2) / 3) * size;
y3 = y + sin(radangle - (PI * 2) / 3) * size;
triangle(bmp, x1, y1, x2, y2, x3, y3, colour2);
line(bmp, x1, y1, x2, y2, colour1);
line(bmp, x1, y1, x3, y3, colour1);
line(bmp, x2, y2, x3, y3, colour1);
}
*/
void draw_status2(BITMAP *bmp, int max_x, int max_y, int play)
{
int dcol1;
int dcol2;
int i, x, y;
int a = player[play].actor_controlled;
int minutes_left = arena.time_left / 2000;
int seconds_left = (arena.time_left / 33.3333) - (minutes_left * 60);
int centiseconds_left = (arena.time_left) - (minutes_left * 2000) - seconds_left * 33.333;
centiseconds_left *= 3;
int time_colour = COLOUR_GREY6;
// int time_colour2 = COLOUR_YELLOW3 + centiseconds_left / 25;
int time_colour2 = COLOUR_YELLOW1 + (centiseconds_left % 50) / 7;
int time_x = 80;
int time_y = 20;
// char timestring [10] = "{";
// char istr [5];
if (seconds_left < 0)
seconds_left = 0;
if (minutes_left < 0)
minutes_left = 0;
if (centiseconds_left < 0)
centiseconds_left = 0;
if (game.type != GAME_DUEL || game.duel_mode == DUEL_3_MINUTES || game.duel_mode == DUEL_10_MINUTES)
{
if (arena.level_finished == 1)
{
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__}");
textprintf_centre_ex(bmp, font, max_x / 2, 170, -1, -1, "{__l_e_v_e_l____c_l_e_a_r__}");
time_colour = COLOUR_YELLOW8;
time_colour2 = COLOUR_YELLOW4;
if (arena.time_bonus > 0)
{
if (arena.seconds_left_when_finished == 1)
{
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);
textprintf_centre_ex(bmp, font, max_x / 2, 280 + text_offset_y, -1, -1, "{_%i__second__left_}", arena.seconds_left_when_finished);
}
else
{
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);
textprintf_centre_ex(bmp, font, max_x / 2, 280 + text_offset_y, -1, -1, "{_%i__seconds__left_}", arena.seconds_left_when_finished);
}
textprintf_centre_ex(bmp, font2, max_x / 2, 320 + text_offset_y, COLOUR_RED8 - (counter / 4) % 4, -1, "{_bonus:__%i_}", arena.time_bonus);
textprintf_centre_ex(bmp, font, max_x / 2, 320 + text_offset_y, -1, -1, "{_bonus:__%i_}", arena.time_bonus);
}
else
{
textprintf_centre_ex(bmp, font2, max_x / 2, 320 + text_offset_y, COLOUR_GREEN8 - (counter / 4) % 4, -1, "{_no__bonus_}");
textprintf_centre_ex(bmp, font, max_x / 2, 320 + text_offset_y, -1, -1, "{_no__bonus_}");
}
}
else
{
if (minutes_left == 0 && seconds_left < 10)
{
// time_colour = COLOUR_RED8 - (counter / 4) % 4;
// time_colour2 = COLOUR_RED4 + (counter / 4) % 4;
time_colour2 = COLOUR_RED1 + (centiseconds_left % 50) / 7;
}
}