comparison varydamage.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
comparison
equal deleted inserted replaced
2:fba0b6e6cdc7 3:5a977ccbc7a9
1 /* $Id: varydamage.c,v 1.1.1.1 1997/12/06 05:41:31 darius Exp $ */
2
3 /*
4 * redraw.c
5 */
6 #include "copyright.h"
7
8 #include <stdio.h>
9 #include <signal.h>
10 #include <math.h>
11 #include "Wlib.h"
12 #include "defs.h"
13 #include "struct.h"
14 #include "data.h"
15 #include "packets.h"
16 #include "proto.h"
17 #include "gameconf.h"
18
19 void
20 doShields(dx, dy, ship_bits, j)
21 int dx, dy;
22 struct ship_shape *ship_bits;
23 struct player *j;
24 {
25 if (showShields && (j->p_flags & PFSHIELD)) {
26 /*-----------Colored shields by shield damage--------*/
27
28 int color = playerColor(j);
29 if (show_shield_dam && j == me) {
30 float ft;
31
32 ft = (float) j->p_shield / (float) j->p_ship->s_maxshield;
33 if (ft > 0.66)
34 color = gColor;
35 else if (ft > 0.33)
36 color = yColor;
37 else if (j->p_shield > 5)
38 color = rColor;
39 else
40 color = unColor;
41 }
42 #if 0 /* shields the alert color, ick */
43 switch (me->p_flags & (PFGREEN | PFYELLOW | PFRED)) {
44 case PFGREEN:
45 color = gColor;
46 break;
47 case PFYELLOW:
48 color = yColor;
49 break;
50 /* red shield tough to see */
51 case PFRED:
52 color = playerColor(j);
53 break;
54 }
55 #endif
56 W_WriteBitmap(dx - (ship_bits->width / 2),
57 dy - (ship_bits->height / 2),
58 ship_bits->shield, color);
59 }
60 }
61
62 #ifdef VARY_HULL
63 void
64 doHull(dx, dy, ship_bits, j)
65 int dx, dy;
66 struct ship_shape *ship_bits;
67 struct player *j;
68 {
69 if (j == me && vary_hull) {
70 int hull_left = (100 * (me->p_ship->s_maxdamage -
71 me->p_damage)) / me->p_ship->s_maxdamage, hull_num = 7;
72 int hull_color;
73
74 if (hull_left <= 16) {
75 hull_num = 0;
76 hull_color = W_Red;
77 } else if (hull_left <= 28) {
78 hull_num = 1;
79 hull_color = W_Red;
80 } else if (hull_left <= 40) {
81 hull_num = 2;
82 hull_color = W_Red;
83 } else if (hull_left <= 52) {
84 hull_num = 3;
85 hull_color = W_Yellow;
86 } else if (hull_left <= 64) {
87 hull_num = 4;
88 hull_color = W_Yellow;
89 } else if (hull_left <= 76) {
90 hull_num = 5;
91 hull_color = W_Yellow;
92 } else if (hull_left <= 88) {
93 hull_num = 6;
94 hull_color = W_Green;
95 } else
96 hull_color = W_Green /* playerColor (j) */ ;
97
98 W_WriteBitmap(dx - (ship_bits->width / 2 + 1),
99 dy - (ship_bits->height / 2 + 1),
100 hull[hull_num], hull_color);
101 }
102 }
103 #endif /* VARY_HULL */