annotate dashboard.c @ 1:ff5e05767bd3 ALPHA

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:28 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1 /* $Id: dashboard.c,v 1.1.1.1 1997/12/06 05:41:28 darius Exp $ */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
2
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
3 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
4 * dashboard.c - graphic tstatw - 6/2/93
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
5 *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
6 * copyright 1993 Lars Bernhardsson (lab@mtek.chalmers.se)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
7 * Free to use as long as this notice is left here.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
8 *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
9 * Color by Nick Trown.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
10 * Paradise shoehorning by Bill Dyess.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
11 * Rainbow dashboard by Bill Dyess
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
12 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
13
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
14 #include "copyright.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
15
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
16 #include <stdio.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
17 #include <time.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
18 #include "Wlib.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
19 #include "defs.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
20 #include "struct.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
21 #include "data.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
22 #include "proto.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
23 #include "sound.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
24
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
25 #define DB_NOFILL 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
26 #define DB_LINE 1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
27 #define DB_FILL 2
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
28
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
29 #define DB_3DIGITS 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
30 #define DB_5DIGITS 1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
31
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
32 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
33 #define BAR_LENGTH 56
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
34 #define BAR_LENGTH_THIRD 18
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
35 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
36 #define TSTATW_BASEX 32
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
37
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
38 #define SPACING 4
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
39
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
40 int BAR_LENGTH = 56;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
41 int BAR_LENGTH_THIRD = 18;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
42
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
43 int column[4];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
44
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
45 #ifdef PACKET_LIGHTS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
46 /* code to draw and erase packet lights 2/5/94 [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
47
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
48 #define SENDX 7
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
49 #define SENDY 1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
50 #define RECEIVEX 3
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
51 #define RECEIVEY 1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
52
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
53 int send_lit = 0, receive_lit = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
54
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
55 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
56 light_send()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
57 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
58 if (packetLights == 0 || send_lit)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
59 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
60 send_lit = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
61 W_DrawPoint(tstatw, SENDX, SENDY, W_Green);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
62 W_DrawPoint(tstatw, SENDX + 1, SENDY, W_Green);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
63 W_DrawPoint(tstatw, SENDX, SENDY + 1, W_Green);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
64 W_DrawPoint(tstatw, SENDX + 1, SENDY + 1, W_Green);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
65 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
66
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
67 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
68 light_receive()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
69 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
70 if (packetLights == 0 || receive_lit)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
71 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
72 receive_lit = 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
73 W_DrawPoint(tstatw, RECEIVEX, RECEIVEY, W_Yellow);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
74 W_DrawPoint(tstatw, RECEIVEX + 1, RECEIVEY, W_Yellow);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
75 W_DrawPoint(tstatw, RECEIVEX, RECEIVEY + 1, W_Yellow);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
76 W_DrawPoint(tstatw, RECEIVEX + 1, RECEIVEY + 1, W_Yellow);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
77 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
78
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
79 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
80 light_erase()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
81 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
82 if (receive_lit == 1) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
83 W_DrawPoint(tstatw, RECEIVEX, RECEIVEY, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
84 W_DrawPoint(tstatw, RECEIVEX + 1, RECEIVEY, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
85 W_DrawPoint(tstatw, RECEIVEX, RECEIVEY + 1, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
86 W_DrawPoint(tstatw, RECEIVEX + 1, RECEIVEY + 1, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
87 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
88 if (receive_lit)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
89 receive_lit--;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
90 if (send_lit == 1) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
91 W_DrawPoint(tstatw, SENDX, SENDY, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
92 W_DrawPoint(tstatw, SENDX + 1, SENDY, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
93 W_DrawPoint(tstatw, SENDX, SENDY + 1, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
94 W_DrawPoint(tstatw, SENDX + 1, SENDY + 1, backColor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
95 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
96 if (send_lit)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
97 send_lit--;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
98 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
99 #endif /* PACKET_LIGHTS */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
100
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
101 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
102 db_box(x, y, w, h, f, color)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
103 int x, y, w, h, f, color;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
104 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
105 int border = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
106
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
107 if (color == W_Red)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
108 border = color;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
109
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
110 if (w == 0 || h == 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
111 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
112
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
113 switch (f) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
114 case DB_FILL:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
115 W_FillArea(tstatw, x, y, w + 1, h + 1, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
116 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
117 case DB_LINE:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
118 W_MakeLine(tstatw, x + w, y, x + w, y + h, border);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
119 W_MakeLine(tstatw, x + w, y + 4, x + BAR_LENGTH, y + 4, border);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
120 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
121 case DB_NOFILL:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
122 W_MakeLine(tstatw, x, y, x + w, y, border);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
123 W_MakeLine(tstatw, x + w, y, x + w, y + h, border);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
124 W_MakeLine(tstatw, x + w, y + h, x, y + h, border);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
125 W_MakeLine(tstatw, x, y + h, x, y, border);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
126 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
127 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
128 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
129
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
130 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
131 db_bar(lab, x, y, value, tmpmax, max, digits, color)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
132 char *lab;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
133 int x, y, value, tmpmax, max, digits, color;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
134 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
135 register int wt, wv, tw, tc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
136 char valstr[32];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
137
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
138 switch (digits) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
139 case DB_3DIGITS:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
140 tc = 11;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
141 tw = W_Textwidth * tc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
142 sprintf(valstr, "%2.2s[%3d/%3d]", lab, value, tmpmax);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
143 W_ClearArea(tstatw, x, y, tw + BAR_LENGTH, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
144 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
145 case DB_5DIGITS:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
146 default:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
147 tc = 15;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
148 tw = W_Textwidth * tc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
149 sprintf(valstr, "%2.2s[%5d/%5d]", lab, value, tmpmax);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
150 W_ClearArea(tstatw, x, y, tw + BAR_LENGTH, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
151 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
152 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
153
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
154 if (max) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
155 wt = (BAR_LENGTH * tmpmax) / max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
156 wv = (BAR_LENGTH * value) / max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
157 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
158 wt = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
159 wv = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
160 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
161 if (wt > BAR_LENGTH)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
162 wt = BAR_LENGTH;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
163 if (wv > BAR_LENGTH)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
164 wv = BAR_LENGTH;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
165
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
166 W_WriteText(tstatw, x, y, textColor, valstr, tc, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
167
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
168 db_box(x + tw, y, BAR_LENGTH, W_Textheight - 1, DB_NOFILL, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
169 if (wt >= wv && wt > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
170 db_box(x + tw, y, wt, W_Textheight - 1, DB_LINE, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
171
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
172 if (wv > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
173 db_box(x + tw, y, wv, W_Textheight - 1, DB_FILL, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
174 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
175
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
176 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
177 db_color_bar(lab, x, y, barvalue, numvalue, tmpmax, max, digits)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
178 char *lab;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
179 int x, y, barvalue, numvalue, tmpmax, max, digits;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
180 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
181 register int wt, wv, tw, tc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
182 char valstr[32];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
183 int color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
184
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
185 switch (digits) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
186 case DB_3DIGITS:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
187 tc = 11;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
188 tw = W_Textwidth * tc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
189 sprintf(valstr, "%2.2s[%3d/%3d]", lab, numvalue, tmpmax);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
190 W_ClearArea(tstatw, x, y, tw + BAR_LENGTH, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
191 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
192 case DB_5DIGITS:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
193 default:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
194 tc = 15;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
195 tw = W_Textwidth * tc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
196 sprintf(valstr, "%2.2s[%5d/%5d]", lab, numvalue, tmpmax);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
197 W_ClearArea(tstatw, x, y, tw + BAR_LENGTH, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
198 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
199 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
200
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
201 if (max) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
202 wt = (int) ((float) BAR_LENGTH * ((float) tmpmax / (float) max));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
203 wv = (int) ((float) BAR_LENGTH * ((float) barvalue / (float) max));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
204 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
205 wt = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
206 wv = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
207 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
208 #if 0 /* this code turns the color to red when it
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
209 exceeds the bar length */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
210 if (wv > wt)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
211 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
212 #endif /* 0 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
213 if (wt > BAR_LENGTH)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
214 wt = BAR_LENGTH;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
215 if (wv > BAR_LENGTH)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
216 wv = BAR_LENGTH;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
217
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
218 W_WriteText(tstatw, x, y, color, valstr, tc, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
219
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
220 db_box(x + tw, y, BAR_LENGTH, W_Textheight - 1, DB_NOFILL, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
221 if (wt >= wv && wt > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
222 db_box(x + tw, y, wt, W_Textheight - 1, DB_LINE, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
223
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
224 /* draw rainbow bars */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
225 if (wv > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
226 db_box(x + tw, y, wv > BAR_LENGTH_THIRD ? BAR_LENGTH_THIRD : wv, W_Textheight - 1, DB_FILL, W_Green);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
227 if (wv > BAR_LENGTH_THIRD)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
228 db_box(x + tw + BAR_LENGTH_THIRD, y, wv > 2 * BAR_LENGTH_THIRD ? BAR_LENGTH_THIRD
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
229 : wv - BAR_LENGTH_THIRD, W_Textheight - 1, DB_FILL, W_Yellow);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
230 if (wv > 2 * BAR_LENGTH_THIRD)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
231 db_box(x + tw + 2 * BAR_LENGTH_THIRD, y, (wv > BAR_LENGTH ? BAR_LENGTH : wv) -
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
232 2 * BAR_LENGTH_THIRD, W_Textheight - 1, DB_FILL, W_Red);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
233
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
234 #if 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
235 /* draw rainbow bars */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
236 if (wv > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
237 db_box((x += 1) + tw, y += 1, wv > BAR_LENGTH_THIRD ? BAR_LENGTH_THIRD : wv, 7, DB_FILL, W_Green);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
238 if (wv > BAR_LENGTH_THIRD)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
239 db_box(x + tw + BAR_LENGTH_THIRD, y, wv > 2 * BAR_LENGTH_THIRD ? BAR_LENGTH_THIRD
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
240 : wv - BAR_LENGTH_THIRD, 7, DB_FILL, W_Yellow);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
241 if (wv > 2 * BAR_LENGTH_THIRD)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
242 db_box(x + tw + 2 * BAR_LENGTH_THIRD, y, (wv > BAR_LENGTH ? BAR_LENGTH : wv) -
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
243 2 * BAR_LENGTH_THIRD - 2, 7, DB_FILL, W_Red);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
244 #endif /* 0 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
245 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
246
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
247 #ifdef TIMER
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
248 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
249 db_timer(fr, xloc, yloc)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
250 int fr, xloc, yloc;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
251 /* handles the dashboard timer [BDyess] 10/29/93 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
252 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
253 static time_t oldtime = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
254 static int lastTimerType = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
255 time_t now = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
256 static char lasttimer[TIMESTRLEN], *timer;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
257 int left, right, x, pos;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
258
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
259 #ifdef RECORDER
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
260 if(playback) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
261 pb_framectr(xloc, yloc);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
262 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
263 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
264 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
265 if (timerType != lastTimerType || fr) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
266 fr = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
267 lastTimerType = timerType;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
268 switch (timerType) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
269 case T_NONE:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
270 W_ClearArea(tstatw, xloc, yloc, (TIMESTRLEN+3) * W_Textwidth,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
271 W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
272 memset(lasttimer, ' ', TIMESTRLEN);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
273 strcpy(lasttimer, " ");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
274 oldtime = now;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
275 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
276 case T_DAY:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
277 W_WriteText(tstatw, xloc, yloc, textColor, "NOW", 3, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
278 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
279 case T_SERVER:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
280 W_WriteText(tstatw, xloc, yloc, textColor, "SRV", 3, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
281 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
282 case T_SHIP:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
283 W_WriteText(tstatw, xloc, yloc, textColor, "SHP", 3, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
284 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
285 case T_USR:
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
286 W_WriteText(tstatw, xloc, yloc, textColor, "TMR", 3, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
287 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
288 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
289 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
290 if (!timerType)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
291 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
292 now = time(NULL);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
293 if (now != oldtime || fr) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
294 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
295 get the timer string and start comparing it with the old one. Only
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
296 print the differences
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
297 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
298 timer = timeString(now - timeBank[timerType]);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
299 x = xloc + 4 * W_Textwidth;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
300 left = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
301 right = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
302 pos = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
303
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
304 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
305 run through the string to find any differences. Print any
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
306 continuous differences with one W_WriteText call.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
307 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
308 if (fr) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
309 W_WriteText(tstatw, x, yloc, textColor, timer,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
310 TIMESTRLEN, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
311 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
312 while (pos < TIMESTRLEN) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
313 if (timer[pos] == lasttimer[pos]) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
314 if (left <= right)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
315 W_WriteText(tstatw, x + left * W_Textwidth,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
316 yloc, textColor, timer + left,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
317 right - left + 1, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
318 left = pos + 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
319 right = pos;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
320 } else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
321 right++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
322 pos++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
323 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
324 if (left <= right)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
325 W_WriteText(tstatw, x + left * W_Textwidth, yloc, textColor,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
326 timer + left, right - left + 1, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
327 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
328 oldtime = now;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
329 strcpy(lasttimer, timer);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
330 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
331 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
332 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
333 #endif /* TIMER */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
334
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
335 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
336 db_flags(fr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
337 int fr;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
338 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
339 static float old_kills = -1.0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
340 static int old_torp = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
341 static int old_drone = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
342 static int old_totmissiles = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
343 static unsigned int old_flags = ~(unsigned int) 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
344 static int old_tourn = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
345 static int old_spd = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
346 unsigned char current_tourn;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
347 int i;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
348 char buf[26];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
349
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
350 #ifdef UNIX_SOUND
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
351 if ((me->p_etemp > me->p_ship->s_maxegntemp) && (me->p_flags & PFENG))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
352 maybe_play_sound (SND_THERMAL); /* Engines Over Thermal Limit, play ONLY once */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
353 else sound_completed (SND_THERMAL); /* Done with Etmp, Replay Sound if we Etmp Again */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
354 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
355
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
356 if (fr || me->p_flags != old_flags) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
357 buf[0] = (me->p_flags & PFSHIELD ? 'S' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
358
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
359 if (me->p_flags & PFGREEN)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
360 buf[1] = 'G';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
361 else if (me->p_flags & PFYELLOW)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
362 buf[1] = 'Y';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
363 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
364 buf[1] = 'R';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
365 buf[2] = (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
366 buf[3] = (me->p_flags & PFREPAIR ? 'R' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
367 buf[4] = (me->p_flags & PFBOMB ? 'B' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
368 buf[5] = (me->p_flags & PFORBIT ? 'O' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
369 buf[6] = (me->p_flags & (PFDOCK | PFDOCKOK)) ? 'D' : ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
370 buf[7] = (me->p_flags & PFCLOAK ? 'C' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
371 buf[8] = (me->p_flags & PFWEP ? 'W' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
372 buf[9] = (me->p_flags & PFENG ? 'E' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
373 if (me->p_flags & PFPRESS)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
374 buf[10] = 'P';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
375 else if (me->p_flags & PFTRACT)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
376 buf[10] = 'T';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
377 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
378 buf[10] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
379 if (me->p_flags & PFBEAMUP)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
380 buf[11] = 'u';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
381 else if (me->p_flags & PFBEAMDOWN)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
382 buf[11] = 'd';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
383 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
384 buf[11] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
385
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
386 /* Flags turn red with etemped/wtemped [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
387 if (me->p_flags & (PFWEP | PFENG))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
388 W_WriteText(tstatw, 2, 3, W_Red, "Flags", 5, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
389 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
390 W_WriteText(tstatw, 2, 3, textColor, "Flags", 5, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
391 /* blue 'Warp' text [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
392 if (me->p_flags & PFWARP)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
393 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, W_Cyan, " Warp", 8,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
394 W_BoldFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
395 /* red 'Afterbrn' text [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
396 else if (me->p_flags & PFAFTER)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
397 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, W_Red, "Afterbrn", 8,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
398 W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
399 /* yellow 'WarpPrep' or 'WrpPause' text [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
400 else if (me->p_flags & PFWARPPREP)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
401 if (me->p_flags & PFWPSUSPENDED)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
402 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, W_Yellow, "WrpPause",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
403 8, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
404 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
405 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, W_Yellow, "WarpPrep",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
406 8, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
407 /* green 'Impulse' text [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
408 else if (me->p_speed > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
409 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, W_Green, " Impulse", 8,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
410 W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
411 /* white 'Stopped' text [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
412 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
413 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, textColor, " Stopped", 8,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
414 W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
415 W_WriteText(tstatw, 2, 3 + (W_Textheight + SPACING), textColor, buf, 12, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
416 #if 0 /* colored G/Y/R status flags. Looked stupid */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
417 if (me->p_flags & PFGREEN)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
418 W_WriteText(tstatw, 2 + W_Textwidth, 3 + W_Textheight + SPACING, W_Green, "G", 1, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
419 else if (me->p_flags & PFYELLOW)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
420 W_WriteText(tstatw, 2 + W_Textwidth, 3 + W_Textheight + SPACING, W_Yellow, "Y", 1, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
421 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
422 W_WriteText(tstatw, 2 + W_Textwidth, 3 + W_Textheight + SPACING, W_Red, "R", 1, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
423 #endif /* 0 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
424 old_flags = me->p_flags;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
425 old_spd = me->p_speed;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
426 } else if ( (me->p_speed == 0 && old_spd) ||
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
427 (me->p_speed && old_spd == 0) ) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
428 if (me->p_speed > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
429 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, W_Yellow, " Impulse", 8,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
430 W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
431 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
432 W_WriteText(tstatw, 2 + 6 * W_Textwidth, 3, textColor, " Stopped", 8,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
433 W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
434 old_spd = me->p_speed;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
435 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
436 current_tourn = paradise ? status2->tourn : status->tourn;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
437
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
438 if (fr || current_tourn != old_tourn) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
439 if (current_tourn)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
440 W_WriteText(tstatw, 74, 3 + W_Textheight + SPACING, textColor, "T", 1, W_BoldFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
441 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
442 W_WriteText(tstatw, 74, 3 + W_Textheight + SPACING, textColor, " ", 1, W_BoldFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
443
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
444 old_tourn = current_tourn;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
445 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
446 if (fr || me->p_kills != old_kills) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
447 if (me->p_kills > 0.0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
448 /* W_WriteText (tstatw, column[3], 3+W_Textheight + SPACING, textColor, "Kills:", 6, W_RegularFont);*/
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
449 sprintf(buf, "Kills: %5.2f", me->p_kills);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
450 W_WriteText(tstatw, column[3], 3 + W_Textheight + SPACING, textColor, buf, strlen(buf), W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
451 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
452 W_ClearArea(tstatw, column[3], 3 + W_Textheight + SPACING, 12 * W_Textwidth, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
453 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
454 old_kills = me->p_kills;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
455 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
456 if (fr || me->p_ntorp != old_torp) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
457 if (me->p_ntorp > 0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
458 /* W_WriteText (tstatw, column[3]+17*W_Textwidth, 3+W_Textheight + SPACING, textColor, "Torps:",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
459 6, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
460 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
461 sprintf(buf, "Torps: %d", me->p_ntorp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
462 W_WriteText(tstatw, column[3] + 17 * W_Textwidth, 3 + W_Textheight + SPACING, textColor, buf,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
463 strlen(buf), W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
464 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
465 W_ClearArea(tstatw, column[3] + 17 * W_Textwidth, 3 + W_Textheight + SPACING, 8 * W_Textwidth, 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
466 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
467 old_torp = me->p_ntorp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
468 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
469 /* code to show the number of drones out */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
470 strcpy(buf, "Missiles ");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
471 if (fr || me->p_totmissiles != old_totmissiles || me->p_ndrone != old_drone) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
472 if (me->p_totmissiles > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
473 sprintf(buf + strlen(buf), "Left: %d ", me->p_totmissiles);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
474 old_totmissiles = me->p_totmissiles;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
475 if (me->p_ndrone > 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
476 sprintf(buf + strlen(buf), "Out: %d ", me->p_ndrone);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
477 old_drone = me->p_ndrone;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
478 if (!me->p_totmissiles && !me->p_ndrone) { /* clear missile text */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
479 W_ClearArea(tstatw, column[3], 3 + 2 * (W_Textheight + SPACING), 24 * W_Textwidth, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
480 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
481 for (i = strlen(buf); i < 24; i++)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
482 buf[i] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
483 buf[24] = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
484 W_WriteText(tstatw, column[3], 3 + 2 * (W_Textheight + SPACING), textColor, buf, 24, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
485 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
486 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
487 #if 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
488 if (fr || me->p_ndrone != old_drone) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
489 if (me->p_ndrone > 0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
490 if (!missile_text) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
491 W_WriteText(tstatw, column[3], 30, textColor,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
492 "Missiles", 8, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
493 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
494 sprintf(buf, "Out: %d", me->p_ndrone);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
495 W_WriteText(tstatw, column[3] + W_Textwidth * 18, 30, textColor, buf, strlen(buf), W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
496 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
497 W_ClearArea(tstatw, column[3] + W_Textwidth * 18, 30, 7 * W_Textwidth, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
498 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
499 old_drone = me->p_ndrone;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
500 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
501 if (fr || me->p_totmissiles != old_totmissiles) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
502 if (me->p_totmissiles > 0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
503 if (!missile_text) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
504 W_WriteText(tstatw, column[3], 30, textColor,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
505 "Missiles", 8, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
506 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
507 sprintf(buf, "Left: %d", me->p_totmissiles);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
508 W_WriteText(tstatw, column[3] + W_Textwidth * 9, 3 + 2 * (W_Textheight + SPACING),
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
509 textColor, buf, strlen(buf), W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
510 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
511 W_ClearArea(tstatw, column[3], 3 + 2 * (W_Textheight + SPACING), 8 * W_Textwidth, W_Textheight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
512 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
513 old_totmissiles = me->p_totmissiles;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
514 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
515 if (missile_text && !me->p_totmissiles && !me->p_ndrone) /* clear missile text */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
516 W_ClearArea(tstatw, column[3], 30, 9 * W_Textwidth, 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
517 #endif /* 0 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
518 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
519
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
520 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
521 db_redraw_krp(fr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
522 int fr;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
523 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
524 static int old_spd = -1, old_cur_spd = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
525 static int old_shl = -1, old_dam = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
526 static int old_arm = -1, old_cur_arm = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
527 static int old_wpn = -1, old_egn = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
528 static int old_ful = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
529 register int cur_max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
530 register int value;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
531 int color;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
532 int index = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
533 register int mid;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
534
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
535 if (me->p_ship->s_type == STARBASE) /* SB */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
536 index = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
537
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
538 if (fr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
539 W_ClearWindow(tstatw);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
540
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
541 db_flags(fr);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
542
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
543 #ifdef TIMER
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
544 db_timer(fr, 1, 3 + 2 * (W_Textheight + SPACING));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
545 #endif /* TIMER */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
546
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
547 #ifdef PACKET_LIGHTS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
548 light_erase();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
549 #endif /* PACKET_LIGHTS */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
550
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
551 if (paradise)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
552 cur_max = me->p_ship->s_maxspeed - (int) ((float) me->p_ship->s_maxspeed
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
553 * (float) me->p_damage / (float) me->p_ship->s_maxdamage);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
554 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
555 cur_max = (me->p_ship->s_maxspeed + 1) - ((me->p_ship->s_maxspeed + 1) * me->p_damage)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
556 / me->p_ship->s_maxdamage;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
557 if (cur_max > me->p_ship->s_maxspeed)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
558 cur_max = me->p_ship->s_maxspeed;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
559 if (cur_max < 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
560 cur_max = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
561
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
562 if (fr || me->p_speed != old_spd || cur_max != old_cur_spd) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
563 if (me->p_speed >= me->p_ship->s_maxspeed - 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
564 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
565 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
566 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
567 db_bar("Sp", column[1], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
568 me->p_speed, cur_max, me->p_ship->s_maxspeed, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
569 old_spd = me->p_speed;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
570 old_cur_spd = cur_max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
571 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
572 if (fr || me->p_shield != old_shl) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
573 value = (100 * me->p_shield) / me->p_ship->s_maxshield;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
574 if (value <= 16)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
575 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
576 else if (value <= 66)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
577 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
578 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
579 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
580 db_bar("Sh", column[1], 3 + W_Textheight + SPACING,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
581 me->p_shield, me->p_ship->s_maxshield, me->p_ship->s_maxshield,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
582 DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
583 old_shl = me->p_shield;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
584 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
585 if (fr || me->p_damage != old_dam) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
586 value = (100 * (me->p_ship->s_maxdamage - me->p_damage)) / me->p_ship->s_maxdamage;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
587 if (value <= 16)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
588 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
589 else if (value <= 66)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
590 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
591 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
592 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
593 db_bar("Hu", column[1], 3 + 2 * (W_Textheight + SPACING),
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
594 (me->p_ship->s_maxdamage - me->p_damage),
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
595 me->p_ship->s_maxdamage, me->p_ship->s_maxdamage,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
596 DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
597 old_dam = me->p_damage;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
598 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
599 if (me->p_ship->s_type == ASSAULT)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
600 cur_max = (((me->p_kills * 3) > me->p_ship->s_maxarmies) ?
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
601 me->p_ship->s_maxarmies : (int) (me->p_kills * 3));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
602 else if (me->p_ship->s_type == STARBASE)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
603 cur_max = me->p_ship->s_maxarmies;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
604 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
605 cur_max = (((me->p_kills * 2) > me->p_ship->s_maxarmies) ?
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
606 me->p_ship->s_maxarmies : (int) (me->p_kills * 2));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
607
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
608 if (fr || me->p_armies != old_arm || cur_max != old_cur_arm) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
609 value = me->p_armies;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
610 mid = me->p_ship->s_maxarmies / 3;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
611 if (value <= mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
612 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
613 else if (value > mid * 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
614 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
615 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
616 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
617 db_bar("Ar", column[2], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
618 me->p_armies, cur_max, me->p_ship->s_maxarmies, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
619 old_arm = me->p_armies;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
620 old_cur_arm = cur_max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
621 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
622 if (fr || me->p_wtemp != old_wpn) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
623 value = (100 * me->p_wtemp) / me->p_ship->s_maxwpntemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
624 if (value <= 16)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
625 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
626 else if (value <= 66)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
627 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
628 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
629 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
630 db_bar("Wt", column[2], 3 + W_Textheight + SPACING,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
631 me->p_wtemp / 10, me->p_ship->s_maxwpntemp / 10, me->p_ship->s_maxwpntemp / 10, DB_3DIGITS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
632 ,color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
633 old_wpn = me->p_wtemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
634 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
635 if (fr || me->p_etemp != old_egn) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
636 value = (100 * me->p_etemp) / me->p_ship->s_maxegntemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
637 if (value <= 16)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
638 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
639 else if (value <= 66)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
640 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
641 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
642 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
643 db_bar("Et", column[2], 3 + 2 * (W_Textheight + SPACING),
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
644 me->p_etemp / 10, me->p_ship->s_maxegntemp / 10, me->p_ship->s_maxegntemp / 10, DB_3DIGITS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
645 ,color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
646 old_egn = me->p_etemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
647 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
648 if (fr || me->p_fuel != old_ful) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
649 value = ((100 * me->p_fuel) / me->p_ship->s_maxfuel);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
650 if (value <= 16)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
651 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
652 else if (value <= 66)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
653 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
654 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
655 color = W_Green;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
656 db_bar("Fu", column[3], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
657 me->p_fuel, me->p_ship->s_maxfuel, me->p_ship->s_maxfuel, DB_5DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
658 old_ful = me->p_fuel;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
659 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
660 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
661
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
662
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
663 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
664 db_redraw_BRM(fr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
665 int fr;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
666 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
667 static int old_spd = -1, old_cur_spd = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
668 static int old_shl = -1, old_dam = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
669 static int old_arm = -1, old_cur_arm = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
670 static int old_wpn = -1, old_egn = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
671 static int old_ful = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
672 register int cur_max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
673 register int value;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
674 int color;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
675 int index = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
676 register int mid;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
677 register int tmp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
678
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
679 if (me->p_ship->s_type == STARBASE) /* SB */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
680 index = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
681
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
682 if (fr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
683 W_ClearWindow(tstatw);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
684
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
685 db_flags(fr);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
686
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
687 #ifdef TIMER
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
688 db_timer(fr, 1, 3 + 2 * (W_Textheight + SPACING));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
689 #endif /* TIMER */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
690 #ifdef PACKET_LIGHTS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
691 light_erase();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
692 #endif /* PACKET_LIGHTS */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
693
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
694 cur_max = (me->p_ship->s_maxspeed + 1) - ((me->p_ship->s_maxspeed + 1) * me->p_damage)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
695 / me->p_ship->s_maxdamage;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
696 if (cur_max > me->p_ship->s_maxspeed)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
697 cur_max = me->p_ship->s_maxspeed;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
698 if (cur_max < 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
699 cur_max = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
700
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
701 if (fr || me->p_speed != old_spd || cur_max != old_cur_spd) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
702 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
703 db_color_bar("Sp", column[1], 3, me->p_speed, me->p_speed, cur_max,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
704 me->p_ship->s_maxspeed, DB_3DIGITS);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
705 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
706 if (me->p_speed >= me->p_ship->s_maxspeed - 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
707 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
708 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
709 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
710 db_bar("Sp", column[1], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
711 me->p_speed, cur_max, me->p_ship->s_maxspeed, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
712 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
713 old_spd = me->p_speed;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
714 old_cur_spd = cur_max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
715 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
716 if (fr || me->p_shield != old_shl) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
717 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
718 tmp = me->p_ship->s_maxshield - me->p_shield;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
719 db_color_bar("Sh", column[1], 3 + W_Textheight + SPACING, tmp, tmp,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
720 me->p_ship->s_maxshield, me->p_ship->s_maxshield,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
721 DB_3DIGITS);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
722 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
723 value = (100 * me->p_shield) / me->p_ship->s_maxshield;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
724 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
725 mid = (distress[index].max_shld - distress[index].min_shld) /
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
726 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
727 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
728 mid = 33;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
729 if (value <= mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
730 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
731 /* else if (value < distress[index].max_shld) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
732 else if (value < mid * 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
733 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
734 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
735 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
736 db_bar("Sh", column[1], 3 + W_Textheight + SPACING, me->p_ship->s_maxshield - me->p_shield,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
737 me->p_ship->s_maxshield, me->p_ship->s_maxshield, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
738 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
739 old_shl = me->p_shield;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
740 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
741 if (fr || me->p_damage != old_dam) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
742 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
743 db_color_bar("Hu", column[1], 3 + 2 * (W_Textheight + SPACING),
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
744 me->p_damage, me->p_damage, me->p_ship->s_maxdamage,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
745 me->p_ship->s_maxdamage, DB_3DIGITS);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
746 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
747 value = (100 * me->p_damage) / me->p_ship->s_maxdamage;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
748 /* mid = (distress[index].max_dam - distress[index].min_dam) / 2; */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
749 mid = 33;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
750 /* if (value <= distress[index].min_dam) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
751 if (value <= mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
752 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
753 else if (value > mid * 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
754 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
755 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
756 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
757 db_bar("Hu", column[1], 3 + 2 * (W_Textheight + SPACING),
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
758 me->p_damage, me->p_ship->s_maxdamage, me->p_ship->s_maxdamage, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
759 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
760 old_dam = me->p_damage;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
761 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
762 if (me->p_ship->s_type == ASSAULT)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
763 cur_max = (((me->p_kills * 3) > me->p_ship->s_maxarmies) ?
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
764 me->p_ship->s_maxarmies : (int) (me->p_kills * 3));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
765 else if (me->p_ship->s_type == STARBASE)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
766 cur_max = me->p_ship->s_maxarmies;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
767 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
768 cur_max = (((me->p_kills * 2) > me->p_ship->s_maxarmies) ?
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
769 me->p_ship->s_maxarmies : (int) (me->p_kills * 2));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
770
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
771 /* doing rainbow colors for armies makes little since, so I don't */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
772 if (fr || me->p_armies != old_arm || cur_max != old_cur_arm) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
773 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
774 db_bar("Ar", column[2], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
775 me->p_armies, cur_max, me->p_ship->s_maxarmies, DB_3DIGITS, W_White);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
776 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
777 value = me->p_armies;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
778 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
779 mid = (distress[index].max_arms - distress[index].min_arms) /
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
780 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
781 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
782 mid = me->p_ship->s_maxarmies / 3;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
783 /* if (value <= distress[index].min_arms) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
784 if (value <= mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
785 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
786 else if (value > mid * 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
787 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
788 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
789 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
790 db_bar("Ar", column[2], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
791 me->p_armies, cur_max, me->p_ship->s_maxarmies, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
792 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
793 old_arm = me->p_armies;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
794 old_cur_arm = cur_max;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
795 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
796 if (fr || me->p_wtemp != old_wpn) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
797 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
798 tmp = me->p_wtemp / 10;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
799 db_color_bar("Wt", column[2], 3 + W_Textheight + SPACING, tmp, tmp,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
800 me->p_ship->s_maxwpntemp / 10,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
801 me->p_ship->s_maxwpntemp / 10, DB_3DIGITS);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
802 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
803 value = (100 * me->p_wtemp) / me->p_ship->s_maxwpntemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
804 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
805 mid = (distress[index].max_wtmp - distress[index].min_wtmp) /
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
806 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
807 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
808 mid = 67;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
809 if (value > mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
810 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
811 /* else if (value <= distress[index].min_wtmp) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
812 else if (value <= mid / 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
813 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
814 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
815 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
816 db_bar("Wt", column[2], 3 + W_Textheight + SPACING, me->p_wtemp / 10, me->p_ship->s_maxwpntemp / 10,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
817 me->p_ship->s_maxwpntemp / 10, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
818 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
819 old_wpn = me->p_wtemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
820 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
821 if (fr || me->p_etemp != old_egn) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
822 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
823 tmp = me->p_etemp / 10;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
824 db_color_bar("Et", column[2], 3 + 2 * (W_Textheight + SPACING), tmp, tmp,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
825 me->p_ship->s_maxegntemp / 10,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
826 me->p_ship->s_maxegntemp / 10, DB_3DIGITS);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
827 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
828 value = (100 * me->p_etemp) / me->p_ship->s_maxegntemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
829 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
830 mid = (distress[index].max_etmp - distress[index].min_etmp) /
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
831 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
832 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
833 mid = 67;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
834 if (value <= mid / 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
835 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
836 /* else if (value < mid / 2 + mid) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
837 else if (value < mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
838 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
839 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
840 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
841 db_bar("Et", column[2], 3 + 2 * (W_Textheight + SPACING), me->p_etemp / 10, me->p_ship->s_maxegntemp / 10,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
842 me->p_ship->s_maxegntemp / 10, DB_3DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
843 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
844 old_egn = me->p_etemp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
845 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
846 if (fr || me->p_fuel != old_ful) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
847 if (Dashboard == 3) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
848 db_color_bar("Fu", column[3], 3, me->p_ship->s_maxfuel - me->p_fuel,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
849 me->p_fuel, me->p_ship->s_maxfuel, me->p_ship->s_maxfuel,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
850 DB_5DIGITS);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
851 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
852 value = ((100 * me->p_fuel) / me->p_ship->s_maxfuel);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
853 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
854 mid = (distress[index].max_fuel - distress[index].min_fuel) /
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
855 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
856 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
857 mid = 33;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
858 if (value <= mid)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
859 color = W_Red;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
860 /* else if (value > distress[index].max_fuel) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
861 else if (value > mid * 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
862 color = W_White;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
863 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
864 color = W_Yellow;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
865 db_bar("Fu", column[3], 3,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
866 me->p_fuel, me->p_ship->s_maxfuel, me->p_ship->s_maxfuel, DB_5DIGITS, color);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
867 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
868 old_ful = me->p_fuel;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
869 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
870 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
871
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
872 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
873 db_redraw(fr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
874 int fr;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
875 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
876 static int oldDashboard = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
877
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
878 if (oldDashboard < 0) { /* 1st time only? */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
879 BAR_LENGTH = ((W_WindowWidth(tstatw) - 90 - 4 * W_Textwidth) / 3) - W_Textwidth * 12;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
880 BAR_LENGTH_THIRD = BAR_LENGTH / 3;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
881 column[0] = 2; /* not used */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
882 column[1] = 90;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
883 column[2] = 90 + 11 * W_Textwidth + BAR_LENGTH + 6;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
884 column[3] = column[2] + 11 * W_Textwidth + BAR_LENGTH + 6;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
885 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
886 if (Dashboard != oldDashboard) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
887 oldDashboard = Dashboard;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
888 fr = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
889 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
890 if (Dashboard == 2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
891 db_redraw_krp(fr);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
892 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
893 db_redraw_BRM(fr);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
894 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
895
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
896 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
897 stline(flag)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
898 int flag;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
899 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
900 static char buf1[80];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
901 static char buf2[80];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
902 static char whichbuf = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
903 static int lastDashboard;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
904
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
905 register char *buf, *oldbuf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
906 register char *s;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
907 register int i, j;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
908 int k;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
909
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
910 /* if you don't do something like this, then switching in the options menu
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
911 is 'entertaining' */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
912 if (Dashboard != lastDashboard) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
913 lastDashboard = Dashboard;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
914 redrawTstats();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
915 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
916 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
917 /* use the new dashboard if we can */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
918 if (Dashboard) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
919 db_redraw(flag);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
920 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
921 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
922 #ifdef TIMER
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
923 /* Do da clock */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
924 db_timer(flag, W_WindowWidth(tstatw) - (12 * W_Textwidth + 5), 27);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
925 #endif /* TIMER */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
926 #ifdef PACKET_LIGHTS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
927 light_erase();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
928 #endif /* PACKET_LIGHTS */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
929
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
930
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
931 /* Instead of one sprintf, we do all this by hand for optimization */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
932
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
933 if (flag)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
934 whichbuf = 0; /* We must completely refresh */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
935
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
936 if (whichbuf != 2) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
937 buf = buf1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
938 oldbuf = buf2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
939 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
940 buf = buf2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
941 oldbuf = buf1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
942 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
943 buf[0] = (me->p_flags & PFSHIELD ? 'S' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
944 if (me->p_flags & PFGREEN)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
945 buf[1] = 'G';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
946 else if (me->p_flags & PFYELLOW)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
947 buf[1] = 'Y';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
948 else if (me->p_flags & PFRED)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
949 buf[1] = 'R';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
950 buf[2] = (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
951 buf[3] = (me->p_flags & PFREPAIR ? 'R' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
952 buf[4] = (me->p_flags & PFBOMB ? 'B' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
953 buf[5] = (me->p_flags & PFORBIT ? 'O' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
954 buf[6] = (me->p_flags & PFDOCKOK ? 'D' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
955 /* buf[6] = (me->p_flags & PFDOCK ? 'D' : ' ');*/
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
956 buf[7] = (me->p_flags & PFCLOAK ? 'C' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
957 buf[8] = (me->p_flags & PFWEP ? 'W' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
958 buf[9] = (me->p_flags & PFENG ? 'E' : ' ');
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
959 if (me->p_flags & PFPRESS)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
960 buf[10] = 'P';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
961 else if (me->p_flags & PFTRACT)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
962 buf[10] = 'T';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
963 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
964 buf[10] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
965 if (me->p_flags & PFBEAMUP)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
966 buf[11] = 'u';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
967 else if (me->p_flags & PFBEAMDOWN)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
968 buf[11] = 'd';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
969 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
970 buf[11] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
971 if (!paradise)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
972 buf[12] = (status->tourn) ? 't' : ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
973 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
974 buf[12] = (status2->tourn) ? 't' : ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
975
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
976 buf[13] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
977
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
978 #if 1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
979 /* w/i indicator is a kludge - it just guesses based on the speed of
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
980 the ship */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
981 sprintf(buf + 14, "%2d%c %3d %3d %1d %6.2f %3d %6d %4d %4d ",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
982 me->p_speed, /* (me->p_speed > me->p_ship->s_maxspeed+2) */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
983 me->p_flags & PFWARP ? 'w' : me->p_flags & PFAFTER ? 'a' : 'i',
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
984 me->p_damage, me->p_shield, me->p_ntorp, me->p_kills,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
985 me->p_armies, me->p_fuel, me->p_wtemp / 10, me->p_etemp / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
986 #else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
987 #if 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
988 TWODIGIT_L(&buf[14], me->p_speed);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
989 buf[16] = 'i';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
990 buf[17] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
991 buf[18] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
992 buf[19] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
993 THREEDIGIT_R(&buf[20], me->p_damage);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
994 buf[23] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
995 THREEDIGIT_R(&buf[24], me->p_shield);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
996 buf[27] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
997 TWODIGIT_R(&buf[28], me->p_ntorp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
998 buf[30] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
999 buf[31] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1000 SIXnTWOf_R(&buf[32], me->p_kills);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1001 buf[38] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1002 THREEDIGIT_C(&buf[39], me->p_armies);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1003 buf[42] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1004 SIXDIGIT_R(&buf[43], me->p_fuel);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1005 buf[49] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1006 buf[50] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1007 FOURDIGIT_R(&buf[51], me->p_wtemp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1008 buf[55] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1009 FOURDIGIT_R(&buf[56], me->p_wtemp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1010 buf[60] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1011 buf[61] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1012 #else /* 0 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1013 buf[14] = '0' + ((me->p_speed % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1014 if (buf[14] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1015 buf[14] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1016 buf[15] = '0' + (me->p_speed % 10); /* speed */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1017 buf[16] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1018 buf[17] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1019 buf[18] = '0' + (me->p_damage / 100);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1020 if (buf[18] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1021 buf[18] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1022 buf[19] = '0' + ((me->p_damage % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1023 if ((buf[19] == '0') && (me->p_damage < 100))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1024 buf[19] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1025 buf[20] = '0' + (me->p_damage % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1026 buf[21] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1027 buf[22] = '0' + (me->p_shield / 100);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1028 if (buf[22] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1029 buf[22] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1030 buf[23] = '0' + ((me->p_shield % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1031 if ((buf[23] == '0') && (me->p_shield < 100))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1032 buf[23] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1033 buf[24] = '0' + (me->p_shield % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1034 buf[25] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1035 buf[26] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1036 buf[27] = '0' + ((me->p_ntorp % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1037 if (buf[27] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1038 buf[27] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1039 buf[28] = '0' + (me->p_ntorp % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1040 buf[29] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1041 buf[30] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1042 buf[31] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1043 buf[32] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1044 buf[33] = '0' + ((int) (me->p_kills / 10));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1045 if (buf[33] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1046 buf[33] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1047 buf[34] = '0' + (((int) me->p_kills) % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1048 buf[35] = '.';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1049 buf[36] = '0' + (((int) (me->p_kills * 10)) % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1050 buf[37] = '0' + (((int) (me->p_kills * 100)) % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1051 buf[38] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1052 buf[39] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1053 buf[40] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1054 buf[41] = '0' + ((me->p_armies % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1055 if (buf[41] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1056 buf[41] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1057 buf[42] = '0' + (me->p_armies % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1058 buf[43] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1059 buf[44] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1060 buf[45] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1061
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1062 buf[46] = '0' + (me->p_fuel / 100000);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1063 if (buf[46] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1064 buf[46] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1065 buf[47] = '0' + ((me->p_fuel % 100000) / 10000);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1066 if ((buf[47] == '0') && (me->p_fuel < 100000))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1067 buf[47] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1068 buf[48] = '0' + ((me->p_fuel % 10000) / 1000);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1069 if ((buf[48] == '0') && (me->p_fuel < 10000))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1070 buf[48] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1071 buf[49] = '0' + ((me->p_fuel % 1000) / 100);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1072 if ((buf[49] == '0') && (me->p_fuel < 1000))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1073 buf[49] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1074 buf[50] = '0' + ((me->p_fuel % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1075 if ((buf[50] == '0') && (me->p_fuel < 100))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1076 buf[50] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1077 buf[51] = '0' + (me->p_fuel % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1078 buf[52] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1079 buf[53] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1080 buf[54] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1081
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1082 buf[55] = '0' + ((me->p_wtemp / 10) / 100);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1083 if (buf[55] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1084 buf[55] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1085 buf[56] = '0' + (((me->p_wtemp / 10) % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1086 if ((buf[56] == '0') && (me->p_wtemp < 1000))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1087 buf[56] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1088 buf[57] = '0' + ((me->p_wtemp / 10) % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1089
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1090 buf[58] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1091 buf[59] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1092 buf[60] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1093 buf[61] = '0' + ((me->p_etemp / 10) / 1000);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1094 if (buf[61] == '0')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1095 buf[61] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1096 buf[62] = '0' + (((me->p_etemp / 10) % 1000) / 100);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1097 if (buf[62] == '0' && me->p_etemp < 1000)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1098 buf[62] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1099 buf[63] = '0' + (((me->p_etemp / 10) % 100) / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1100 if ((buf[63] == '0') && (me->p_etemp < 1000))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1101 buf[63] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1102 buf[64] = '0' + ((me->p_etemp / 10) % 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1103 buf[65] = ' ';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1104 #endif /* 0 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1105 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1106
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1107 if (whichbuf == 0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1108 /* Draw status line */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1109 W_WriteText(tstatw, TSTATW_BASEX, 16, textColor, buf, 66, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1110 whichbuf = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1111 } else { /* Hacks to make it print only what is
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1112 necessary */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1113 whichbuf = 3 - whichbuf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1114 j = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1115 for (i = 0; i < 66; i++) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1116 if (*(buf++) != *(oldbuf++)) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1117 /* Different string */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1118 if (j == -1) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1119 k = i;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1120 s = buf - 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1121 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1122 j = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1123 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1124 /* Same string */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1125 if (j == -1)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1126 continue;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1127 j++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1128 if (j == 20) { /* Random number */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1129 W_WriteText(tstatw, TSTATW_BASEX + W_Textwidth * k, 16, textColor,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1130 s, i - k - 19, W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1131 j = -1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1132 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1133 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1134 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1135 if (j != -1) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1136 W_WriteText(tstatw, TSTATW_BASEX + W_Textwidth * k, 16, textColor, s, i - k - j,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1137 W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1138 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1139 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1140 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1141
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1142 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1143 redrawTstats()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1144 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1145 char buf[100];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1146
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1147 W_ClearWindow(tstatw);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1148 /* use new dashboard if possible */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1149 if (Dashboard) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1150 db_redraw(1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1151 return;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1152 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1153 stline(1); /* This is for refresh. We redraw player
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1154 stats too */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1155 strcpy(buf, "Flags Speed Dam Shd Trp Kills Ams Fuel Wtmp Etmp Special" /* "Flags Warp
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1156 Dam Shd Torps Kills
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1157 Armies Fuel Wtemp
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1158 Etemp" */ );
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1159 W_WriteText(tstatw, TSTATW_BASEX, 5, textColor, buf, strlen(buf), W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1160 sprintf(buf,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1161 "Maximum: %2d %3d %3d 8 %3d %6d %4d %4d ",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1162 me->p_ship->s_maxspeed, me->p_ship->s_maxdamage,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1163 me->p_ship->s_maxshield, me->p_ship->s_maxarmies,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1164 me->p_ship->s_maxfuel, me->p_ship->s_maxwpntemp / 10,
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1165 me->p_ship->s_maxegntemp / 10);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1166 W_WriteText(tstatw, TSTATW_BASEX, 27, textColor, buf, strlen(buf), W_RegularFont);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1167 }