Debian Codegraph @

Descent3/huddisplay.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/huddisplay.cpp $
21 * $Revision: 59 $
22 * $Date: 4/19/00 5:16p $
23 * $Author: Matt $
24 *
25 * Hud message and stat display file.
26 *
27 * $Log: /DescentIII/main/huddisplay.cpp $
28 *
29 * 59 4/19/00 5:16p Matt
30 * From Duane for 1.4
31 * Removed Mac OpenGL hack
32 *
33 * 58 10/21/99 6:39p Matt
34 * Mac merge
35 * This change is mostly setting & clearing the variable
36 * use_opengl_1555_format around some blocks of code. Duane says this
37 * won't affect the Windows version.
38 *
39 * 57 7/28/99 4:11p Kevin
40 * Mac
41 *
42 * 56 6/10/99 9:07p Samir
43 * fixed weapon string name localization issues.
44 *
45 * 55 5/20/99 12:38p Matt
46 * Fixed centering of the timer HUD display.
47 *
48 * 54 5/20/99 2:26a Matt
49 * Don't use sprintf() for custom_text2 type items, so imbedded percents
50 * work.
51 *
52 * 53 5/19/99 1:23p Matt
53 * Moved the timer display down a bit, and made the time round up.
54 *
55 * 52 5/19/99 11:25a Matt
56 * Added multisafe functions & Dallas actions for showing a timer on the
57 * screen and adding custom HUD messages.
58 *
59 * 51 5/13/99 7:00p Samir
60 * print score in co-op or robo-anarchy
61 *
62 * 50 5/10/99 10:22p Ardussi
63 * changes to compile on Mac
64 *
65 * 49 5/09/99 6:21a Jeff
66 * added missing restore of ZBuffer state
67 *
68 * 48 5/05/99 5:46p Samir
69 * fixed RenderHUDGetTextWidth. Hopefully didn't break for higher
70 * resolutions.
71 *
72 * 47 4/29/99 5:08p Jason
73 * fixed wrapping bug with RenderHudQuad
74 *
75 * 46 4/28/99 5:23a Jeff
76 * use new inventory function that gets a list of inventory items to
77 * display inventory and countermeasure on the hud (fixes weird selection
78 * bug)
79 *
80 * 45 4/24/99 10:38p Samir
81 * cleaned up hud text problems in 'small mode'
82 *
83 * 44 4/24/99 8:43p Samir
84 * when shrinking screen hud messages get rendered in black region.
85 *
86 * 43 4/22/99 11:19a Samir
87 * render hud text functions shouldn't nest formatted text.
88 *
89 * 42 4/21/99 9:29p Samir
90 * don't draw score in multiplayer.
91 *
92 * 41 4/20/99 3:06p Jeff
93 * fixed inventory displaying of non-usable items
94 *
95 * 40 4/20/99 1:14p Samir
96 * non usable hud inventory.
97 *
98 * 39 4/20/99 11:47a Samir
99 * shrinking hud fixes.
100 *
101 * 38 4/16/99 10:54p Jeff
102 * fixed min() for Linux
103 *
104 * 37 4/06/99 6:02p Matt
105 * Added score system
106 *
107 * 36 4/06/99 11:39a Samir
108 * added more formatting options for hud items (added two other full
109 * screen hud infs for different ships)
110 *
111 * 35 3/02/99 6:26p Samir
112 * hires font madness.
113 *
114 * 34 3/01/99 12:55a Matt
115 * Deleted some obsolete strings from the string table, and moved some
116 * formatting info from the table to the code.
117 *
118 * 33 2/06/99 6:59p Jeff
119 * created RenderHUDGetTextLineWidth and RenderHUDGetTextHeight
120 *
121 * 32 1/31/99 7:26p Matt
122 * Renamed a bunch of functions to have HUD capitalized
123 *
124 * 31 1/29/99 2:08p Jeff
125 * localization
126 *
127 * 30 11/01/98 1:57a Jeff
128 * converted the vsprintf calls to use the Pvsprintf, which is a safe
129 * vsprintf, no buffer overflows allowed
130 *
131 * 29 10/22/98 11:30p Matt
132 * Centered the names of non-ammo weapon names with respect to the weapon
133 * icon.
134 *
135 * 28 10/20/98 1:46p Samir
136 * made text version of inventory.
137 *
138 * 27 10/14/98 4:27p Samir
139 * improved HUD_ITEM_CUSTOMTEXT
140 *
141 * 26 10/13/98 4:16p Matt
142 * Fixed stupid bug
143 *
144 * 25 10/13/98 12:56p Matt
145 * Finished (hopefully) with the ammo system. Added support for napalm
146 * fuel.
147 *
148 * 24 9/30/98 4:34p Samir
149 * hack to prevent display of lock warning at Gametime = 0.
150 *
151 * 23 8/25/98 7:08p Samir
152 * hud primary weapon ammo.
153 *
154 * 22 8/07/98 12:54p Jeff
155 * removed () in countermeasures :)
156 *
157 * 21 8/07/98 12:54p Jeff
158 * inventory doesn't show count if count==1 countermeasure have () around
159 * count
160 *
161 * 20 7/06/98 7:34p Samir
162 * added countermeasures.
163 *
164 * 19 6/24/98 7:38p Samir
165 * redid graphical/text/cockpit hud item management.
166 *
167 * 18 6/17/98 6:31p Samir
168 * Added anti-grav warning when dying.
169 *
170 * 17 6/16/98 11:10a Jeff
171 * fixed merges goofs
172 *
173 * 16 6/16/98 10:54a Jeff
174 *
175 * 15 6/15/98 6:54p Samir
176 * added invulnerability and cloak effect.
177 *
178 * 14 6/15/98 2:14p Samir
179 * afterburner hud image scale modified.
180 *
181 * 13 6/10/98 4:03p Samir
182 * restored old hud config.
183 *
184 * 12 5/26/98 8:01p Samir
185 * don't display placeholder small icon for weapon.
186 *
187 * 11 5/26/98 5:06p Samir
188 * repositioned shield and energy sub hud items due to new design.
189 *
190 * 10 5/25/98 8:31p Samir
191 * added call to render hud text with cerntering options.
192 *
193 * 9 5/25/98 6:38p Matt
194 * Added needed include.
195 *
196 * 8 5/22/98 6:25p Samir
197 * implemented a lot of hud items.
198 *
199 * 7 5/07/98 12:23p Samir
200 * RenderHUDText functions added to hud.h
201 *
202 * 6 5/05/98 6:28p Samir
203 * moved hud_x and hud_y macros to hud.h.
204 *
205 * 5 4/27/98 1:14p Jason
206 * cleaned up afterburner stuff
207 *
208 * 4 4/24/98 5:32p Samir
209 * added saturation option to DrawHudQuad.
210 *
211 * 3 4/24/98 8:02a Samir
212 * display weapon names properly.
213 *
214 * 2 4/23/98 4:13a Samir
215 * new hud system.
216 *
217 * 1 4/23/98 4:05a Samir
218 * initial revision.
219 *
220 * $NoKeywords: $
221 */
222
223 #include <cstdarg>
224 #include <cstdio>
225
226 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
227 #include "grtext.h"cxx . . $ `<file>/grtext/grtext.h`/
228 #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/
229 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
230 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
231 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
232 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
233 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
234 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
235 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
236 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
237 #include "config.h"cxx . . $ `<file>/Descent3/config.h`/
238 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
239 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
240
241 #include <algorithm>
242
243 //////////////////////////////////////////////////////////////////////////////
244 // Data
245
246 // renders the description for the current inventory item
247 static void RenderHUDInventorycxx . . $ RenderHUDInventory(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
248
249 // renders the shield rating for the ship
250 static void RenderHUDShieldValuecxx . . $ RenderHUDShieldValue(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
251
252 // renders the energy rating for the ship
253 static void RenderHUDEnergyValuecxx . . $ RenderHUDEnergyValue(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
254
255 // draws the afterburner hud gauge.
256 static void RenderHUDAfterburnercxx . . $ RenderHUDAfterburner(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
257
258 // draws the primary weapon current in.
259 static void RenderHUDPrimarycxx . . $ RenderHUDPrimary(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
260
261 // draw secondary weapon current in.
262 static void RenderHUDSecondarycxx . . $ RenderHUDSecondary(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
263
264 // renders ship status.
265 static void RenderHUDShipStatuscxx . . $ RenderHUDShipStatus(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
266
267 // renders warnings like system failures or missile locks.
268 static void RenderHUDWarningscxx . . $ RenderHUDWarnings(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
269
270 // render hud countermeasures
271 static void RenderHUDCountermeasurescxx . . $ RenderHUDCountermeasures(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item);
272
273 // returns the weapon's icon.
274 static inline int get_weapon_iconcxx . . $ get_weapon_icon(9b79fb6aee4c0440).(int player, int type) {
275 player_weaponcxx . . $ player_weapon# *pw = &Playerscxx . . $ Players.[player].weaponcxx . . $ player#weapon.[type];
276 weaponcxx . . $ weapon# *wpn = GetWeaponFromIndexcxx . . $ GetWeaponFromIndex(8877214bf23c386e).(player, pw->indexcxx . . $ player_weapon#index.);
277 int bmp;
278
279 if (wpn) {
280 bmp = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(wpn->icon_handlecxx . . $ weapon#icon_handle., 0);
281 if (bmp > 0)
282 return bmp;
283 }
284
285 return HUD_resourcescxx . . $ HUD_resources..wpn_bmpcxx . . $ sHUDResources#wpn_bmp.;
286 }
287
288 static void RenderHUDTextFlagsNoFormatcxx . . $ RenderHUDTextFlagsNoFormat(6d19b2d3c7e26a36).(int flags, ddgr_colorcxx . . $ ddgr_color# col, uint8_tcxx . . $ uint8_t# alpha, int sat_count, int x, int y, const char *str);
289
290 //////////////////////////////////////////////////////////////////////////////
291 // Hud item display routines.
292
293 void HudDisplayRoutercxx . . $ HudDisplayRouter(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
294 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(192);
295 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
296
297 switch (item->typecxx . . $ tHUDItem#type.) {
298 case HUD_ITEM_PRIMARYcxx . . $ `Descent3/hud.h:432:9`!:
299 RenderHUDPrimarycxx . . $ RenderHUDPrimary(c7a20e4e05358911).(item);
300 break;
301
302 case HUD_ITEM_SECONDARYcxx . . $ `Descent3/hud.h:433:9`!:
303 RenderHUDSecondarycxx . . $ RenderHUDSecondary(c7a20e4e05358911).(item);
304 break;
305
306 case HUD_ITEM_SHIELDcxx . . $ `Descent3/hud.h:434:9`!:
307 RenderHUDShieldValuecxx . . $ RenderHUDShieldValue(c7a20e4e05358911).(item);
308 break;
309
310 case HUD_ITEM_ENERGYcxx . . $ `Descent3/hud.h:435:9`!:
311 RenderHUDEnergyValuecxx . . $ RenderHUDEnergyValue(c7a20e4e05358911).(item);
312 break;
313
314 case HUD_ITEM_AFTERBURNERcxx . . $ `Descent3/hud.h:436:9`!:
315 RenderHUDAfterburnercxx . . $ RenderHUDAfterburner(c7a20e4e05358911).(item);
316 break;
317
318 case HUD_ITEM_INVENTORYcxx . . $ `Descent3/hud.h:437:9`!:
319 RenderHUDInventorycxx . . $ RenderHUDInventory(c7a20e4e05358911).(item);
320 break;
321
322 case HUD_ITEM_SHIPSTATUScxx . . $ `Descent3/hud.h:438:9`!:
323 RenderHUDShipStatuscxx . . $ RenderHUDShipStatus(c7a20e4e05358911).(item);
324 break;
325
326 case HUD_ITEM_WARNINGScxx . . $ `Descent3/hud.h:439:9`!:
327 RenderHUDWarningscxx . . $ RenderHUDWarnings(c7a20e4e05358911).(item);
328 break;
329
330 case HUD_ITEM_CNTRMEASUREcxx . . $ `Descent3/hud.h:442:9`!:
331 RenderHUDCountermeasurescxx . . $ RenderHUDCountermeasures(c7a20e4e05358911).(item);
332 break;
333
334 case HUD_ITEM_CUSTOMTEXTcxx . . $ `Descent3/hud.h:444:9`!:
335 if (item->datacxx . . $ tHUDItem#data..textcxx . . $ tHUDItem#$anonymous_type_1#text.) {
336 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y., item->datacxx . . $ tHUDItem#data..textcxx . . $ tHUDItem#$anonymous_type_1#text.);
337 }
338 break;
339
340 case HUD_ITEM_CUSTOMTEXT2cxx . . $ `Descent3/hud.h:447:9`!:
341 if (item->datacxx . . $ tHUDItem#data..textcxx . . $ tHUDItem#$anonymous_type_1#text.) {
342 RenderHUDTextFlagsNoFormatcxx . . $ RenderHUDTextFlagsNoFormat(6d19b2d3c7e26a36).(0, item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., 2, 240, item->datacxx . . $ tHUDItem#data..textcxx . . $ tHUDItem#$anonymous_type_1#text.);
343 }
344 break;
345
346 case HUD_ITEM_CUSTOMIMAGEcxx . . $ `Descent3/hud.h:445:9`!:
347 break;
348
349 default:
350 Int3cxx . . $ `misc/pserror.h:247:9`!();
351 }
352 }
353
354 //////////////////////////////////////////////////////////////////////////////
355 // Hud item functions.
356
357 // renders the description for the current inventory item
358 void RenderHUDInventorycxx . . $ RenderHUDInventory(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
359 tInvenListcxx . . $ tInvenList# ilist[MAX_UNIQUE_INVEN_ITEMScxx . . $ `Descent3/Inventory.h:189:9`!];
360 int cur_sel;
361 int count = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetInventoryItemListcxx . . $ Inventory#GetInventoryItemList(e2f4838e36fa1452).(ilist, MAX_UNIQUE_INVEN_ITEMScxx . . $ `Descent3/Inventory.h:189:9`!, &cur_sel);
362 if (!count)
363 return;
364
365 int y;
366 float img_w = 0;
367
368 if (cur_sel != -1) {
369 ASSERTcxx . . $ `misc/pserror.h:246:9`!(cur_sel < MAX_UNIQUE_INVEN_ITEMScxx . . $ `Descent3/Inventory.h:189:9`!);
370
371 // render currently selected item
372 if (ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name.) {
373 img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..arrow_bmpcxx . . $ sHUDResources#arrow_bmp., 0) * HUD_ARROW_SCALEcxx . . $ `Descent3/hud.h:521:9`!;
374
375 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y. + 2, img_w, bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..arrow_bmpcxx . . $ sHUDResources#arrow_bmp., 0) * HUD_ARROW_SCALEcxx . . $ `Descent3/hud.h:521:9`!, 0, 0, 1, 1,
376 HUD_resourcescxx . . $ HUD_resources..arrow_bmpcxx . . $ sHUDResources#arrow_bmp., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
377
378 if (ilist[cur_sel].amountcxx . . $ tInvenList#amount. > 1)
379 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + img_w, item->ycxx . . $ tHUDItem#y., "%s (%d)",
380 ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name., ilist[cur_sel].amountcxx . . $ tInvenList#amount.);
381 else
382 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + img_w, item->ycxx . . $ tHUDItem#y., "%s",
383 ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name.);
384 }
385 }
386
387 // render non usable list.
388 if (cur_sel != -1 && ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name.) {
389 y = item->ycxx . . $ tHUDItem#y. + RenderHUDGetTextHeightcxx . . $ RenderHUDGetTextHeight(5c4306d8553b3696).(ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name.) + 6;
390 } else {
391 y = item->ycxx . . $ tHUDItem#y. + 16;
392 }
393
394 for (int i = 0; i < count; i++) {
395 if (cur_sel == i)
396 continue;
397 if (ilist[i].selectablecxx . . $ tInvenList#selectable.)
398 continue;
399 if (!ilist[i].hud_namecxx . . $ tInvenList#hud_name.)
400 continue;
401
402 if (ilist[i].amountcxx . . $ tInvenList#amount. > 1) {
403 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + img_w, y, "%s (%d)", ilist[i].hud_namecxx . . $ tInvenList#hud_name.,
404 ilist[i].amountcxx . . $ tInvenList#amount.);
405 } else {
406 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + img_w, y, "%s", ilist[i].hud_namecxx . . $ tInvenList#hud_name.);
407 }
408
409 y += RenderHUDGetTextHeightcxx . . $ RenderHUDGetTextHeight(5c4306d8553b3696).(ilist[i].hud_namecxx . . $ tInvenList#hud_name.);
410 }
411
412 /*
413 Inventory *inventory = &Players[Player_num].inventory;
414
415 if(inventory->Size()) //make sure there is at least one item in the inventory
416 {
417 int size, y;
418 int current_inv_pos = inventory->GetPos();
419 float img_w = bm_w(HUD_resources.arrow_bmp,0)*HUD_ARROW_SCALE;
420 char *name = inventory->GetPosName();
421
422 if(name && inventory->IsUsable()) {
423 RenderHUDQuad(item->x, item->y+2, img_w, bm_h(HUD_resources.arrow_bmp,0)*HUD_ARROW_SCALE,
424 0,0,1,1,HUD_resources.arrow_bmp, item->alpha, item->saturation_count); int count = inventory->GetPosCount();
425 if(count>1)
426 RenderHUDText(item->color, item->alpha, item->saturation_count, item->x+img_w, item->y, "%s
427 (%d)", name,count); else RenderHUDText(item->color, item->alpha, item->saturation_count, item->x+img_w, item->y, "%s",
428 name);
429 }
430
431
432 // render non usable list.
433 inventory->ResetPos();
434 size = inventory->Size();
435 if (name) {
436 y = item->y + RenderHUDGetTextHeight(name) + 6;
437 }
438 else {
439 y = item->y + 16;
440 }
441 while (size)
442 {
443 if (!inventory->IsUsable()) {
444 name = inventory->GetPosName();
445 if(name) {
446 int count = inventory->GetPosCount();
447 if(count>1) {
448 RenderHUDText(item->color, item->alpha, item->saturation_count, item->x+img_w,
449 y, "%s (%d)", name,count);
450 }
451 else {
452 RenderHUDText(item->color, item->alpha, item->saturation_count, item->x+img_w,
453 y, "%s", name);
454 }
455 y+= RenderHUDGetTextHeight(name);
456 }
457 }
458 inventory->NextPos(true);
459 size--;
460 }
461
462 // restore inventory position
463 inventory->GotoPos(current_inv_pos);
464 }
465 */
466 }
467
468 // renders the shield rating for the ship
469 void RenderHUDShieldValuecxx . . $ RenderHUDShieldValue(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
470 const int SHIELD_NUM_X = 86, SHIELD_NUM_Y = 14;
471 const int SHIELD_IMG_X = 21, SHIELD_IMG_Y = 57;
472 const int WARNING_IMG_X = 110, WARNING_IMG_Y = 8;
473 float alpha_mod = (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields.) / (float)INITIAL_SHIELDScxx . . $ `Descent3/player_external.h:69:9`!;
474
475 if (alpha_mod > 1.0f)
476 alpha_mod = 1.0f;
477
478 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
479 // GRAPHICAL VERSION
480 // display text and warning dot
481 int img = (int)ceilcxx . . $ ceil(fbcf3211dfe1bfd1).((1.0f - alpha_mod - 0.1f) * NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!);
482 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_SHIELD_SCALEcxx . . $ `Descent3/hud.h:525:9`!;
483 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_SHIELD_SCALEcxx . . $ `Descent3/hud.h:525:9`!;
484
485 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + SHIELD_NUM_X, item->ycxx . . $ tHUDItem#y. + SHIELD_NUM_Y,
486 "%03d", (int)Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields.);
487
488 if (alpha_mod <= 0.20f) {
489 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + WARNING_IMG_X, item->ycxx . . $ tHUDItem#y. + WARNING_IMG_Y, bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!,
490 bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., item->alphacxx . . $ tHUDItem#alpha., 1);
491 }
492
493 if (img < NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!) {
494 if (img < 0)
495 img = 0;
496 img = HUD_resourcescxx . . $ HUD_resources..shield_bmpcxx . . $ sHUDResources#shield_bmp.[img];
497 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + SHIELD_IMG_X, item->ycxx . . $ tHUDItem#y. + SHIELD_IMG_Y, bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(img, 0) * grscalex, bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(img, 0) * grscaley, 0,
498 0, 1, 1, img, item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
499 }
500 } else if (item->statcxx . . $ tHUDItem#stat. & STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`!) {
501 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y., "%03d",
502 (int)Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields.);
503
504 if (alpha_mod <= 0.20f) {
505 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + 30, item->ycxx . . $ tHUDItem#y. - 10, bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!,
506 bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., item->alphacxx . . $ tHUDItem#alpha., 1);
507 }
508 } else {
509 // TEXT VERSION
510 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., (alpha_mod <= .20f) ? item->saturation_countcxx . . $ tHUDItem#saturation_count. + 1 : item->saturation_countcxx . . $ tHUDItem#saturation_count.,
511 item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., "%s: %03d", TXT_HUD_SHIELDScxx . . $ `Descent3/stringtable.h:581:9`!, (int)Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields.);
512 }
513 }
514
515 // renders the energy rating for the ship
516 void RenderHUDEnergyValuecxx . . $ RenderHUDEnergyValue(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
517 float normalized_energy = (float)Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].energycxx . . $ player#energy. / (float)INITIAL_ENERGYcxx . . $ `Descent3/player_external.h:68:9`!;
518
519 // cap off energy to 1.0 normalized
520 if (normalized_energy > 1.0f)
521 normalized_energy = 1.0f;
522
523 // display text and warning dot
524 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
525 const int ENERGY_NUM_X = 15, ENERGY_NUM_Y = 14;
526 // int ENERGY_IMG_X = 3, ENERGY_IMG_Y = 74;
527 // int ENERGY_IMG_X2 = 119;
528 const int WARNING_IMG_X = 6, WARNING_IMG_Y = 8;
529 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_ENERGY_SCALEcxx . . $ `Descent3/hud.h:524:9`!;
530 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_ENERGY_SCALEcxx . . $ `Descent3/hud.h:524:9`!;
531
532 float img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 0) * grscalex;
533 float img_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 0) * grscaley;
534 int img_energy_h;
535
536 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + ENERGY_NUM_X, item->ycxx . . $ tHUDItem#y. + ENERGY_NUM_Y,
537 "%03d", (int)Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].energycxx . . $ player#energy.);
538
539 if (normalized_energy <= 0.20f) {
540 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + WARNING_IMG_X, item->ycxx . . $ tHUDItem#y. + WARNING_IMG_Y, bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!,
541 bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., item->alphacxx . . $ tHUDItem#alpha., 1);
542 }
543
544 img_energy_h = (int)floorcxx . . $ floor(fbcf3211dfe1bfd1).((normalized_energy * img_h) + 0.5f);
545
546 // draw energy gauge, showing how much energy below 100% you have. draw energy spent faded.
547 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + item->xacxx . . $ tHUDItem#xa., item->ycxx . . $ tHUDItem#y. + item->yacxx . . $ tHUDItem#ya., img_w, img_h - img_energy_h, 0, 0, 1.0,
548 1.0f - normalized_energy, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., item->alphacxx . . $ tHUDItem#alpha. / 4, 0);
549
550 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + item->xbcxx . . $ tHUDItem#xb. - img_w, item->ycxx . . $ tHUDItem#y. + item->ybcxx . . $ tHUDItem#yb., img_w, img_h - img_energy_h, 1.0, 0, 0,
551 1.0f - normalized_energy, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., item->alphacxx . . $ tHUDItem#alpha. / 4, 0);
552
553 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + item->xacxx . . $ tHUDItem#xa., item->ycxx . . $ tHUDItem#y. + item->yacxx . . $ tHUDItem#ya. + (int)(img_h - img_energy_h), img_w, img_energy_h, 0,
554 1.0f - normalized_energy, 1, 1, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
555
556 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + item->xbcxx . . $ tHUDItem#xb. - img_w, item->ycxx . . $ tHUDItem#y. + item->ybcxx . . $ tHUDItem#yb. + (int)(img_h - img_energy_h), img_w, img_energy_h, 1,
557 1.0f - normalized_energy, 0, 1, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
558 } else if (item->statcxx . . $ tHUDItem#stat. & STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`!) {
559 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y., "%03d",
560 (int)Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].energycxx . . $ player#energy.);
561
562 if (normalized_energy <= 0.20f) {
563 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. - 10, item->ycxx . . $ tHUDItem#y. - 10, bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!,
564 bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., 0) * HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`!, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..dot_bmpcxx . . $ sHUDResources#dot_bmp., item->alphacxx . . $ tHUDItem#alpha., 1);
565 }
566 } else {
567 // TEXT VERSION
568 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha.,
569 (normalized_energy <= .20f) ? item->saturation_countcxx . . $ tHUDItem#saturation_count. + 1 : item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty.,
570 "%s: %03d", TXT_HUD_ENERGYcxx . . $ `Descent3/stringtable.h:582:9`!, (int)Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].energycxx . . $ player#energy.);
571 }
572 }
573
574 // draws the afterburner hud gauge.
575 void RenderHUDAfterburnercxx . . $ RenderHUDAfterburner(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
576 float val = (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].afterburn_time_leftcxx . . $ player#afterburn_time_left. / AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`!);
577 char str[8];
578
579 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
580 const int BURNER_NUM_X = 24;
581 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_BURN_SCALEcxx . . $ `Descent3/hud.h:528:9`!;
582 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_BURN_SCALEcxx . . $ `Descent3/hud.h:528:9`!;
583 float img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp., 0) * grscalex;
584 float img_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp., 0) * grscaley;
585 int img_burn_w = (int)floorcxx . . $ floor(fbcf3211dfe1bfd1).((val * img_w) + 0.5f);
586
587 // draw afterburn spent.
588 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + item->xacxx . . $ tHUDItem#xa. + img_burn_w, item->ycxx . . $ tHUDItem#y. + item->yacxx . . $ tHUDItem#ya., img_w - img_burn_w, img_h, val, 0, 1, 1,
589 HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp., item->alphacxx . . $ tHUDItem#alpha. / 4, 0);
590
591 // draw afterburn left
592 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + item->xacxx . . $ tHUDItem#xa., item->ycxx . . $ tHUDItem#y. + item->yacxx . . $ tHUDItem#ya., img_burn_w, img_h, 0, 0, val, 1, HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp.,
593 item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
594
595 snprintf(str, sizeof(str), "%d%%", (int)(val * 100.0f));
596 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + BURNER_NUM_X, item->ycxx . . $ tHUDItem#y., str);
597 } else if (item->statcxx . . $ tHUDItem#stat. & STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`!) {
598 snprintf(str, sizeof(str), "%d%%", (int)(val * 100.0f));
599 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y., str);
600 } else {
601 // TEXT VERSION
602 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., (val <= .30f) ? item->saturation_countcxx . . $ tHUDItem#saturation_count. + 1 : item->saturation_countcxx . . $ tHUDItem#saturation_count.,
603 item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., "%s: %d%%", TXT_HUD_AFTERBURNERcxx . . $ `Descent3/stringtable.h:583:9`!, (int)(val * 100.0f));
604 }
605 }
606
607 // draws the primary weapon current in.
608 void RenderHUDPrimarycxx . . $ RenderHUDPrimary(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
609 int index = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weaponcxx . . $ player#weapon.[PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!].indexcxx . . $ player_weapon#index.;
610 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.];
611 otype_wb_infocxx . . $ otype_wb_info# *wb = &ship->static_wbcxx . . $ ship#static_wb.[index];
612 const char *text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_names_msg[index]);
613 float txt_w = (int)(grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(text) / Hud_aspect_xcxx . . $ Hud_aspect_x.) + 4;
614 char ammo_string[10];
615
616 if (!wb)
617 return;
618
619 if (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage.) {
620 int ammo = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weapon_ammocxx . . $ player#weapon_ammo.[index];
621 if (ship->fire_flagscxx . . $ ship#fire_flags.[index] & SFF_TENTHScxx . . $ `Descent3/ship.h:133:9`!)
622 snprintf(ammo_string, sizeof(ammo_string), "%d.%d", ammo / 10, ammo % 10);
623 else
624 snprintf(ammo_string, sizeof(ammo_string), "%d", ammo);
625 }
626
627 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
628 const int WPN_INFO_W = 100;
629 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_WPN_SCALEcxx . . $ `Descent3/hud.h:522:9`!;
630 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_WPN_SCALEcxx . . $ `Descent3/hud.h:522:9`!;
631
632 float img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..wpn_bmpcxx . . $ sHUDResources#wpn_bmp., 0) * grscalex;
633 int icon;
634
635 int y = item->ycxx . . $ tHUDItem#y.;
636
637 if (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage.) {
638 int w2 = (int)(grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!("00000") / Hud_aspect_xcxx . . $ Hud_aspect_x.) + 2;
639 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + WPN_INFO_W - img_w - w2, y + 13,
640 ammo_string);
641 } else
642 y += 13 / 2; // If just one line, move it down
643
644 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + WPN_INFO_W - img_w - txt_w, y, "%s",
645 text);
646
647 icon = get_weapon_iconcxx . . $ get_weapon_icon(9b79fb6aee4c0440).(Player_numcxx . . $ Player_num., PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!);
648
649 if (icon != HUD_resourcescxx . . $ HUD_resources..wpn_bmpcxx . . $ sHUDResources#wpn_bmp.) {
650 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + WPN_INFO_W - img_w, item->ycxx . . $ tHUDItem#y., img_w, bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(icon, 0) * grscaley, 0, 0, 1, 1, icon,
651 item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
652 }
653 } else if (item->statcxx . . $ tHUDItem#stat. & STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`!) {
654
655 } else {
656 // TEXT VERSION
657 if (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage.) {
658 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., "%s %s", text, ammo_string);
659 } else {
660 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., "%s", text);
661 }
662 }
663 }
664
665 // draw secondary weapon current in.
666 void RenderHUDSecondarycxx . . $ RenderHUDSecondary(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
667 int index = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weaponcxx . . $ player#weapon.[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].indexcxx . . $ player_weapon#index.;
668 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.];
669 otype_wb_infocxx . . $ otype_wb_info# *wb = &ship->static_wbcxx . . $ ship#static_wb.[index];
670 weaponcxx . . $ weapon# *wpn = GetWeaponFromIndexcxx . . $ GetWeaponFromIndex(8877214bf23c386e).(Player_numcxx . . $ Player_num., index);
671 const char *text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_names_msg[index]);
672 float txt_w = (int)(grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(text) / Hud_aspect_xcxx . . $ Hud_aspect_x.) + 2;
673
674 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
675 int icon;
676 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_WPN_SCALEcxx . . $ `Descent3/hud.h:522:9`!;
677 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_WPN_SCALEcxx . . $ `Descent3/hud.h:522:9`!;
678
679 float img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..wpn_bmpcxx . . $ sHUDResources#wpn_bmp., 0) * grscalex;
680
681 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + img_w + 2, item->ycxx . . $ tHUDItem#y., "%s", text);
682 if (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage.) {
683 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + img_w + 16, item->ycxx . . $ tHUDItem#y. + 13, "%d",
684 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weapon_ammocxx . . $ player#weapon_ammo.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weaponcxx . . $ player#weapon.[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].indexcxx . . $ player_weapon#index.]);
685 }
686
687 icon = get_weapon_iconcxx . . $ get_weapon_icon(9b79fb6aee4c0440).(Player_numcxx . . $ Player_num., PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!);
688
689 if (icon != HUD_resourcescxx . . $ HUD_resources..wpn_bmpcxx . . $ sHUDResources#wpn_bmp.) {
690 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y., img_w, bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(icon, 0) * grscaley, 0, 0, 1, 1, icon, item->alphacxx . . $ tHUDItem#alpha.,
691 item->saturation_countcxx . . $ tHUDItem#saturation_count.);
692 }
693 } else if (item->statcxx . . $ tHUDItem#stat. & STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`!) {
694
695 } else {
696 // TEXT VERSION
697 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., "%s %d", text,
698 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weapon_ammocxx . . $ player#weapon_ammo.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weaponcxx . . $ player#weapon.[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].indexcxx . . $ player_weapon#index.]);
699 }
700 }
701
702 void RenderHUDShipStatuscxx . . $ RenderHUDShipStatus(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
703 float clk_time_frame, inv_time_frame;
704 uint8_tcxx . . $ uint8_t# clk_alpha = 0, inv_alpha;
705
706 // render text status
707 if (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!) {
708 clk_time_frame = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].effect_infocxx . . $ object#effect_info.->cloak_timecxx . . $ effect_info_s#cloak_time.;
709 if (clk_time_frame < HUD_CLOAKEND_TIMEcxx . . $ `Descent3/hud.h:530:9`!)
710 clk_alpha = 128 - 127 * FixCoscxx . . $ FixCos(9a38df040a81ca35).(65536.0f * (clk_time_frame - (int)clk_time_frame));
711 else
712 clk_alpha = 0;
713 }
714 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_INVULNERABLEcxx . . $ `Descent3/player_external.h:79:9`!) {
715 // do invulnerablity animation.
716 inv_time_frame = (Gametimecxx . . $ Gametime. - (int)Gametimecxx . . $ Gametime.);
717 inv_alpha = (255 * inv_time_frame);
718 }
719
720 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
721 const int STATUS_IMG_X = 0, STATUS_IMG_Y = 68;
722 const int STATUS_TXT_X = 8;
723 const int STATUS_TXT_Y = -1, STATUS_TXT_Y2 = 9;
724 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_SHIP_SCALEcxx . . $ `Descent3/hud.h:523:9`!;
725 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_SHIP_SCALEcxx . . $ `Descent3/hud.h:523:9`!;
726
727 int x = item->xcxx . . $ tHUDItem#x. + STATUS_IMG_X;
728 int y = item->ycxx . . $ tHUDItem#y. + STATUS_IMG_Y;
729 int w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp., 0) * grscalex;
730 int h = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp., 0) * grscaley;
731
732 if (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!) {
733 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(x, y, w, h, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp., clk_alpha, item->saturation_countcxx . . $ tHUDItem#saturation_count.);
734 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., 255 - clk_alpha, item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + STATUS_TXT_X,
735 item->ycxx . . $ tHUDItem#y. + STATUS_TXT_Y2, TXT_CLKcxx . . $ `Descent3/stringtable.h:152:9`!);
736 } else {
737 // non cloaked ship
738 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(x, y, w, h, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
739 }
740
741 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_INVULNERABLEcxx . . $ `Descent3/player_external.h:79:9`!) {
742 x = x - (w * inv_time_frame * 0.5f);
743 y = y - (h * inv_time_frame * 0.5f);
744
745 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(x, y, (1.0f + inv_time_frame) * w, (1.0f + inv_time_frame) * h, 0, 0, 1, 1,
746 HUD_resourcescxx . . $ HUD_resources..invpulse_bmpcxx . . $ sHUDResources#invpulse_bmp., inv_alpha, item->saturation_countcxx . . $ tHUDItem#saturation_count.);
747 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x. + STATUS_TXT_X + 2,
748 item->ycxx . . $ tHUDItem#y. + STATUS_TXT_Y, TXT_INVcxx . . $ `Descent3/stringtable.h:151:9`!);
749 }
750 } else if (item->statcxx . . $ tHUDItem#stat. & STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`!) {
751
752 } else {
753 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_INVULNERABLEcxx . . $ `Descent3/player_external.h:79:9`!)
754 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., 255 - clk_alpha, item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., TXT_HUD_INVULNcxx . . $ `Descent3/stringtable.h:584:9`!);
755 if (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)
756 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., 255 - clk_alpha, item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty. + 12, TXT_HUD_CLOAKEDcxx . . $ `Descent3/stringtable.h:585:9`!);
757 }
758 }
759
760 // renders warnings like system failures or missile locks.
761 void RenderHUDWarningscxx . . $ RenderHUDWarnings(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
762 objectcxx . . $ object# *playerobj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.];
763
764 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!) {
765 const int LOCK_IMG_X = 8, LOCK_IMG_Y = 2;
766 const int ANTIGRAV_X = 8, ANTIGRAV_Y = 64;
767
768 float img_w, img_h;
769 float grscalex = (item->grscalexcxx . . $ tHUDItem#grscalex. != 0.0f) ? item->grscalexcxx . . $ tHUDItem#grscalex. : HUD_LOCK_SCALEcxx . . $ `Descent3/hud.h:527:9`!;
770 float grscaley = (item->grscaleycxx . . $ tHUDItem#grscaley. != 0.0f) ? item->grscaleycxx . . $ tHUDItem#grscaley. : HUD_LOCK_SCALEcxx . . $ `Descent3/hud.h:527:9`!;
771
772 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].last_homing_warning_sound_timecxx . . $ player#last_homing_warning_sound_time. == Gametimecxx . . $ Gametime. && Gametimecxx . . $ Gametime. > 0.0f) {
773 // draw graphical rep of missile lock warning.
774 img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..lock_bmpcxx . . $ sHUDResources#lock_bmp.[0], 0) * grscalex;
775 img_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..lock_bmpcxx . . $ sHUDResources#lock_bmp.[1], 0) * grscaley;
776
777 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + LOCK_IMG_X, item->ycxx . . $ tHUDItem#y. + LOCK_IMG_Y, img_w, img_h, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..lock_bmpcxx . . $ sHUDResources#lock_bmp.[0],
778 item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
779 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + LOCK_IMG_X + img_w, item->ycxx . . $ tHUDItem#y. + LOCK_IMG_Y, img_w, img_h, 0, 0, 1, 1,
780 HUD_resourcescxx . . $ HUD_resources..lock_bmpcxx . . $ sHUDResources#lock_bmp.[1], item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
781 }
782
783 if (playerobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`!) {
784 // draw graphical rep of missile lock warning.
785 img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..antigrav_bmpcxx . . $ sHUDResources#antigrav_bmp.[0], 0) * grscalex;
786 img_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..antigrav_bmpcxx . . $ sHUDResources#antigrav_bmp.[1], 0) * grscaley;
787
788 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + ANTIGRAV_X, item->ycxx . . $ tHUDItem#y. + ANTIGRAV_Y, img_w, img_h, 0, 0, 1, 1, HUD_resourcescxx . . $ HUD_resources..antigrav_bmpcxx . . $ sHUDResources#antigrav_bmp.[0],
789 item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
790 RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(item->xcxx . . $ tHUDItem#x. + ANTIGRAV_X + img_w, item->ycxx . . $ tHUDItem#y. + ANTIGRAV_Y, img_w, img_h, 0, 0, 1, 1,
791 HUD_resourcescxx . . $ HUD_resources..antigrav_bmpcxx . . $ sHUDResources#antigrav_bmp.[1], item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count.);
792 }
793 } else {
794 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].last_homing_warning_sound_timecxx . . $ player#last_homing_warning_sound_time. == Gametimecxx . . $ Gametime.)
795 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., TXT_HUDITM_LOCKcxx . . $ `Descent3/stringtable.h:344:9`!);
796 if (playerobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`!)
797 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->tcolorcxx . . $ tHUDItem#tcolor., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty. + 12, TXT_HUDITM_ANTIGRAVcxx . . $ `Descent3/stringtable.h:343:9`!);
798 }
799 }
800
801 // render hud countermeasures
802 void RenderHUDCountermeasurescxx . . $ RenderHUDCountermeasures(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
803 tInvenListcxx . . $ tInvenList# ilist[MAX_UNIQUE_INVEN_ITEMScxx . . $ `Descent3/Inventory.h:189:9`!];
804 int cur_sel;
805 int count = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].counter_measurescxx . . $ player#counter_measures..GetInventoryItemListcxx . . $ Inventory#GetInventoryItemList(e2f4838e36fa1452).(ilist, MAX_UNIQUE_INVEN_ITEMScxx . . $ `Descent3/Inventory.h:189:9`!, &cur_sel);
806 if (!count)
807 return;
808
809 if (cur_sel != -1) {
810 ASSERTcxx . . $ `misc/pserror.h:246:9`!(cur_sel < MAX_UNIQUE_INVEN_ITEMScxx . . $ `Descent3/Inventory.h:189:9`!);
811
812 // render currently selected item
813 if (ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name.) {
814 if (item->statcxx . . $ tHUDItem#stat. & STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`!)
815 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->xcxx . . $ tHUDItem#x., item->ycxx . . $ tHUDItem#y., "%s %d",
816 ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name., ilist[cur_sel].amountcxx . . $ tInvenList#amount.);
817 else
818 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., item->alphacxx . . $ tHUDItem#alpha., item->saturation_countcxx . . $ tHUDItem#saturation_count., item->txcxx . . $ tHUDItem#tx., item->tycxx . . $ tHUDItem#ty., "%s %d",
819 ilist[cur_sel].hud_namecxx . . $ tInvenList#hud_name., ilist[cur_sel].amountcxx . . $ tInvenList#amount.);
820 }
821 }
822 }
823
824 //////////////////////////////////////////////////////////////////////////////
825 // Hud rendering functions
826
827 extern tFontTemplatecxx . . $ tFontTemplate# Hud_font_templatecxx . . $ Hud_font_template.; // retain hud font template
828
829 // returns scaled line width
830 int RenderHUDGetTextLineWidthcxx . . $ RenderHUDGetTextLineWidth(5c4306d8553b3696).(const char *string) {
831 float aspect_x;
832 int str_width_curfont = grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(string);
833
834 if (grtext_GetFontcxx . . $ grtext_GetFont(b126dc7c1de90089).() == HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!) {
835 aspect_x = ((float)grtext_GetLineWidthTemplatecxx . . $ `grtext/grtext.h:176:9`!(&Hud_font_template, string)) / ((float)str_width_curfont);
836 } else {
837 aspect_x = 1.0f;
838 }
839
840 if (aspect_x == 1.0f) {
841 aspect_x = aspect_x * DEFAULT_HUD_WIDTHcxx . . $ `Descent3/hud.h:261:9`! / Max_window_wcxx . . $ Max_window_w.;
842 }
843
844 return (int)((str_width_curfont * aspect_x));
845 }
846
847 // returns scaled text height
848 int RenderHUDGetTextHeightcxx . . $ RenderHUDGetTextHeight(5c4306d8553b3696).(const char *string) {
849 float aspect_y;
850 int str_height_curfont = grtext_GetHeightcxx . . $ `grtext/grtext.h:164:9`!(string);
851
852 if (grtext_GetFontcxx . . $ grtext_GetFont(b126dc7c1de90089).() == HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!) {
853 aspect_y = ((float)grtext_GetHeightTemplatecxx . . $ `grtext/grtext.h:168:9`!(&Hud_font_template, string)) / ((float)str_height_curfont);
854 } else {
855 aspect_y = 1.0f;
856 }
857
858 return (int)((str_height_curfont * aspect_y));
859 }
860
861 void RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(int x, int y, int w, int h, float u0, float v0, float u1, float v1, int bm, uint8_tcxx . . $ uint8_t# alpha,
862 int sat_count) {
863 int i;
864
865 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
866 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
867 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha);
868 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
869 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
870
871 if (sat_count)
872 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
873 else
874 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
875
876 x = HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(x);
877 y = HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(y);
878 w = HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(w);
879 h = HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(h);
880
881 for (i = 0; i < sat_count + 1; i++) {
882 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x, y, x + w, y + h, bm, u0, v0, u1, v1);
883 }
884
885 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1);
886 }
887
888 // renders text, scaled, alphaed, saturated,
889 void RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(ddgr_colorcxx . . $ ddgr_color# col, uint8_tcxx . . $ uint8_t# alpha, int sat_count, int x, int y, const char *fmt, ...) {
890 stdcxx . . $ std/::va_listcxx . . $ std/va_list# arglist;
891 char buf[128];
892
893 va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(arglist, fmt);
894 stdcxx . . $ std/::vsnprintfcxx . . $ std/vsnprintf(348eb892742d8727).(buf, 128, fmt, arglist);
895 va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(arglist);
896
897 RenderHUDTextFlagsNoFormatcxx . . $ RenderHUDTextFlagsNoFormat(6d19b2d3c7e26a36).(0, col, alpha, sat_count, x, y, buf);
898 }
899
900 // renders text, scaled, alphaed, saturated,
901 void RenderHUDTextFlagsNoFormatcxx . . $ RenderHUDTextFlagsNoFormat(6d19b2d3c7e26a36).(int flags, ddgr_colorcxx . . $ ddgr_color# col, uint8_tcxx . . $ uint8_t# alpha, int sat_count, int x, int y, const char *str) {
902 int i;
903
904 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(alpha);
905
906 if (sat_count)
907 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
908 else
909 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
910
911 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(col);
912
913 x = HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(x);
914 y = HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(y);
915
916 for (i = 0; i < sat_count + 1; i++) {
917 if (flags & HUDTEXT_CENTEREDcxx . . $ `Descent3/hud.h:604:9`!)
918 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, y, str);
919 else
920 grtext_Putscxx . . $ grtext_Puts(3139f19a0dbb8edf).(x, y, str);
921 }
922 }
923
924 // renders text, scaled, alphaed, saturated,
925 void RenderHUDTextFlagscxx . . $ RenderHUDTextFlags(15b906afa0252220).(int flags, ddgr_colorcxx . . $ ddgr_color# col, uint8_tcxx . . $ uint8_t# alpha, int sat_count, int x, int y, const char *fmt, ...) {
926 stdcxx . . $ std/::va_listcxx . . $ std/va_list# arglist;
927 char buf[128];
928 int i;
929
930 va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(arglist, fmt);
931 stdcxx . . $ std/::vsnprintfcxx . . $ std/vsnprintf(348eb892742d8727).(buf, 128, fmt, arglist);
932 va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(arglist);
933
934 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(alpha);
935
936 if (sat_count)
937 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
938 else
939 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
940
941 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(col);
942
943 x = HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(x);
944 y = HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(y);
945
946 for (i = 0; i < sat_count + 1; i++) {
947 if (flags & HUDTEXT_CENTEREDcxx . . $ `Descent3/hud.h:604:9`!)
948 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, y, buf);
949 else
950 grtext_Putscxx . . $ grtext_Puts(3139f19a0dbb8edf).(x, y, buf);
951 }
952 }
953
954 // Show the score
955 void RenderHUDScorecxx . . $ RenderHUDScore(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
956 char buf[100];
957 int win_w;
958
959 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
960 if (!(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_USE_ROBOTScxx . . $ `Descent3/multi_external.h:228:9`!)) {
961 return;
962 }
963 }
964
965 snprintf(buf, sizeof(buf), "%s: %d ", TXT_SCOREcxx . . $ `Descent3/stringtable.h:797:9`!, Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].scorecxx . . $ player#score.);
966
967 win_w = (Max_window_wcxx . . $ Max_window_w. - Game_window_wcxx . . $ Game_window_w.) * (Hud_aspect_xcxx . . $ Hud_aspect_x.);
968 // if (Game_video_resolution==RES_512X384) { win_w = win_w + 10; }
969
970 int w = RenderHUDGetTextLineWidthcxx . . $ RenderHUDGetTextLineWidth(5c4306d8553b3696).(buf); // * win_w)/(Game_window_w);
971 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., HUD_ALPHAcxx . . $ `Descent3/hud.h:308:9`!, 0, item->xcxx . . $ tHUDItem#x. - w - win_w, item->ycxx . . $ tHUDItem#y., buf);
972
973 if (Score_added_timercxx . . $ Score_added_timer. > 0.0) {
974 int text_height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!);
975 snprintf(buf, sizeof(buf), "%d ", Score_addedcxx . . $ Score_added.);
976 w = RenderHUDGetTextLineWidthcxx . . $ RenderHUDGetTextLineWidth(5c4306d8553b3696).(buf); // * win_w/Game_window_w;
977 uint8_tcxx . . $ uint8_t# alpha = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(HUD_ALPHAcxx . . $ `Descent3/hud.h:308:9`!, HUD_ALPHAcxx . . $ `Descent3/hud.h:308:9`! * 4 * Score_added_timercxx . . $ Score_added_timer. / SCORE_ADDED_TIMEcxx . . $ `Descent3/player.h:445:9`!);
978 RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(item->colorcxx . . $ tHUDItem#color., alpha, 0, item->xcxx . . $ tHUDItem#x. - w - win_w, item->ycxx . . $ tHUDItem#y. + text_height, buf);
979 Score_added_timercxx . . $ Score_added_timer. -= Frametimecxx . . $ Frametime.;
980 }
981 }
982
983 extern float Osiris_TimerTimeRemainingcxx . . $ Osiris_TimerTimeRemaining(5cde91ea12d43f46).(int handle);
984
985 // Show the timer
986 void RenderHUDTimercxx . . $ RenderHUDTimer(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item) {
987 float time;
988 int min, secs;
989 char buf[100];
990
991 time = Osiris_TimerTimeRemainingcxx . . $ Osiris_TimerTimeRemaining(5cde91ea12d43f46).(item->datacxx . . $ tHUDItem#data..timer_handlecxx . . $ tHUDItem#$anonymous_type_1#timer_handle.);
992
993 // If no more time, kill item
994 if (time < 0) {
995 item->statcxx . . $ tHUDItem#stat. = 0;
996 return;
997 }
998
999 // round up
1000 time = ceilcxx . . $ ceil(fbcf3211dfe1bfd1).(time);
1001
1002 min = time / 60;
1003 secs = time - (60 * min);
1004
1005 snprintf(buf, sizeof(buf), "T-%d:%02d", min, secs);
1006
1007 int h = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!);
1008 RenderHUDTextFlagsNoFormatcxx . . $ RenderHUDTextFlagsNoFormat(6d19b2d3c7e26a36).(HUDTEXT_CENTEREDcxx . . $ `Descent3/hud.h:604:9`!, item->colorcxx . . $ tHUDItem#color., HUD_ALPHAcxx . . $ `Descent3/hud.h:308:9`!, 0, 0, h * 4, buf);
1009 }
1010
1011 ////////////////////////////////////////////////////////////////////////////////////////
1012 void t_dirty_rectcxx . . $ t_dirty_rect#::fillcxx . . $ t_dirty_rect#fill(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col) {
1013 int i;
1014 for (i = 2; i >= 0; i--) {
1015 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
1016 if (rcxx . . $ t_dirty_rect#r.[i].lcxx . . $ t_dirty_rect#$anonymous_type_0#l. >= 0 && rcxx . . $ t_dirty_rect#r.[i].rcxx . . $ t_dirty_rect#$anonymous_type_0#r. >= 0) {
1017 rend_FillRectcxx . . $ rend_FillRect(fe09a4b73d8d396f).(col, rcxx . . $ t_dirty_rect#r.[i].lcxx . . $ t_dirty_rect#$anonymous_type_0#l., rcxx . . $ t_dirty_rect#r.[i].tcxx . . $ t_dirty_rect#$anonymous_type_0#t., rcxx . . $ t_dirty_rect#r.[i].rcxx . . $ t_dirty_rect#$anonymous_type_0#r., rcxx . . $ t_dirty_rect#r.[i].bcxx . . $ t_dirty_rect#$anonymous_type_0#b.);
1018 }
1019 if (i > 0) {
1020 rcxx . . $ t_dirty_rect#r.[i].lcxx . . $ t_dirty_rect#$anonymous_type_0#l. = rcxx . . $ t_dirty_rect#r.[i - 1].lcxx . . $ t_dirty_rect#$anonymous_type_0#l.;
1021 rcxx . . $ t_dirty_rect#r.[i].tcxx . . $ t_dirty_rect#$anonymous_type_0#t. = rcxx . . $ t_dirty_rect#r.[i - 1].tcxx . . $ t_dirty_rect#$anonymous_type_0#t.;
1022 rcxx . . $ t_dirty_rect#r.[i].rcxx . . $ t_dirty_rect#$anonymous_type_0#r. = rcxx . . $ t_dirty_rect#r.[i - 1].rcxx . . $ t_dirty_rect#$anonymous_type_0#r.;
1023 rcxx . . $ t_dirty_rect#r.[i].bcxx . . $ t_dirty_rect#$anonymous_type_0#b. = rcxx . . $ t_dirty_rect#r.[i - 1].bcxx . . $ t_dirty_rect#$anonymous_type_0#b.;
1024 }
1025 }
1026 rcxx . . $ t_dirty_rect#r.[0].lcxx . . $ t_dirty_rect#$anonymous_type_0#l. = -1;
1027 rcxx . . $ t_dirty_rect#r.[0].tcxx . . $ t_dirty_rect#$anonymous_type_0#t. = -1;
1028 rcxx . . $ t_dirty_rect#r.[0].rcxx . . $ t_dirty_rect#$anonymous_type_0#r. = -1;
1029 rcxx . . $ t_dirty_rect#r.[0].bcxx . . $ t_dirty_rect#$anonymous_type_0#b. = -1;
1030 }
1031
1032 void t_dirty_rectcxx . . $ t_dirty_rect#::resetcxx . . $ t_dirty_rect#reset(49f6e7a06ebc5aa8).() {
1033 int i;
1034 for (i = 0; i < 3; i++) {
1035 rcxx . . $ t_dirty_rect#r.[i].lcxx . . $ t_dirty_rect#$anonymous_type_0#l. = -1;
1036 rcxx . . $ t_dirty_rect#r.[i].tcxx . . $ t_dirty_rect#$anonymous_type_0#t. = -1;
1037 rcxx . . $ t_dirty_rect#r.[i].bcxx . . $ t_dirty_rect#$anonymous_type_0#b. = -1;
1038 rcxx . . $ t_dirty_rect#r.[i].rcxx . . $ t_dirty_rect#$anonymous_type_0#r. = -1;
1039 }
1040 }