Debian Codegraph @

Descent3/gauges.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/gauges.cpp $
21 * $Revision: 47 $
22 * $Date: 4/19/00 5:13p $
23 * $Author: Matt $
24 *
25 * Gauge rendering
26 *
27 * $Log: /DescentIII/main/gauges.cpp $
28 *
29 * 47 4/19/00 5:13p Matt
30 * From Duane for 1.4
31 * Added checks, asserts, and fixes for bad return values
32 * Removed Mac OpenGL hack
33 *
34 * 46 10/21/99 6:37p Matt
35 * Mac merge
36 * This change is mostly setting & clearing the variable
37 * use_opengl_1555_format around some blocks of code. Duane says this
38 * won't affect the Windows version. (BTW, I think it would have been
39 * cleaner to use a rend_set() function to do this.)
40 *
41 * 45 4/24/99 10:38p Samir
42 * cleaned up hud text problems in 'small mode'
43 *
44 * 44 4/20/99 11:47a Samir
45 * shrinking hud fixes.
46 *
47 * 43 3/04/99 8:07p Samir
48 * render gauge text at correct scale.
49 *
50 * 42 1/31/99 7:26p Matt
51 * Renamed a bunch of functions to have HUD capitalized
52 *
53 * 41 10/23/98 12:52p Samir
54 * fixed bug in secondary monitors, projecting wrong point.
55 *
56 * 40 10/20/98 12:42p Matt
57 * Made the small views work on the cockpit.
58 *
59 * 39 10/13/98 12:56p Matt
60 * Finished (hopefully) with the ammo system. Added support for napalm
61 * fuel.
62 *
63 * 38 8/25/98 7:07p Samir
64 * display ammo in primary monitor.
65 *
66 * 37 8/25/98 12:22p Jason
67 * more changes for cockpits
68 *
69 * 36 8/24/98 3:25p Samir
70 * took out reordering.
71 *
72 * 35 8/24/98 3:04p Samir
73 * added reordering of monitor verts.
74 *
75 * 34 6/24/98 7:37p Samir
76 * fixed energy/shield gauges (must still do invulnerability!)
77 *
78 * 33 6/16/98 10:38a Jeff
79 * localization, strings pulled out to stringtable.h and d3.str
80 *
81 * 32 5/26/98 5:05p Samir
82 * shield frames now contained in hud structure and share common graphics
83 * between gauges and hud.
84 *
85 * 31 5/25/98 8:30p Samir
86 * fixed bug when weapon gauges drawn in multiplayer.
87 *
88 * 30 5/25/98 6:38p Matt
89 * Added needed include.
90 *
91 * 29 5/22/98 6:26p Samir
92 * moved text over a bit on left monitor.
93 *
94 * 28 5/18/98 4:52p Samir
95 * fixed hud image for weapons.
96 *
97 * 27 5/15/98 5:36p Samir
98 * use correct font scale for lores screens.
99 *
100 * 26 5/05/98 6:28p Samir
101 * gauges should render properly when cockpit is resized.
102 *
103 * 25 4/24/98 8:03a Samir
104 * draw weapon names using short names, and pass alpha array to
105 * drawgaugemonitor.
106 *
107 * 24 3/27/98 11:59a Samir
108 * moved weapon hud text from hud to weapon monitor gauges.
109 *
110 * 23 3/22/98 5:03p Samir
111 * updated cockpit.
112 *
113 * 22 3/20/98 8:23p Samir
114 * Started implementing images.
115 *
116 * 21 3/18/98 6:24p Samir
117 * Implemented monitor system.
118 *
119 * 20 3/17/98 2:40p Samir
120 * reorg of cockpit/gauges and hud systems.
121 *
122 * 19 3/16/98 3:30p Samir
123 * incremental checkin.
124 *
125 * 18 2/17/98 3:46p Matt
126 * Revamped weapon system and got sounds for spray and fusion weapons
127 * working. Still need to implements getting continuous & cutoff sounds
128 * from player ship.
129 *
130 * 17 2/11/98 4:54p Jeff
131 * Moved the inventory into the Player struct
132 *
133 * 16 2/09/98 4:58p Jeff
134 * Connected inventory to hud
135 *
136 * 15 2/03/98 12:13p Samir
137 * Font shadowing support in grtext.
138 *
139 * 14 1/28/98 1:11p Jason
140 * took shields field out of Player struct
141 *
142 * 13 1/26/98 2:38p Samir
143 * Assert alpha is opaque for hud font.
144 *
145 * 12 1/23/98 12:07p Jason
146 * made framerate display toggleable
147 *
148 * 11 1/12/98 5:40p Samir
149 * Gauges placed differently.
150 *
151 * 10 1/12/98 5:23p Samir
152 * Use new hud font for gauges.
153 *
154 * 9 12/29/97 5:47p Samir
155 * Uses new text system and took out references to Game_viewport.
156 *
157 * 8 11/16/97 6:55p Samir
158 * Initiated 'init' flag for gauge structure.
159 *
160 * 7 11/14/97 5:29p Samir
161 * Now we pass four world coordinates of the 4 vertex monitor to a gauge
162 * rendering function.
163 *
164 * 6 11/11/97 1:25p Samir
165 * Added modified flag to tGauge and cleaned up gauge renderering a
166 * little.
167 *
168 * 5 11/04/97 6:23p Samir
169 * New Gauge interface.
170 *
171 * 4 10/29/97 12:33p Samir
172 * Framework for RenderHudGauges
173 *
174 * 3 10/28/97 6:36p Samir
175 * Gauge system for text controls functioning.
176 *
177 * 2 10/28/97 12:47p Samir
178 * Gauges are drawn once per frame from GameLoop to a call to gauges.cpp
179 *
180 * 1 10/28/97 12:27p Samir
181 * Initial revision
182 *
183 * $NoKeywords: $
184 */
185
186 #include "gauges.h"cxx . . $ `<file>/Descent3/gauges.h`/
187 #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/
188 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
189 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
190 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
191 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
192 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
193 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
194 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
195 #include "bitmap.h"cxx . . $ `<file>/lib/bitmap.h`/
196 #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/
197 #include "Inventory.h"cxx . . $ `<file>/Descent3/Inventory.h`/
198 #include "cockpit.h"cxx . . $ `<file>/Descent3/cockpit.h`/
199 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
200 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
201 #include "3d.h"cxx . . $ `<file>/lib/3d.h`/
202 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
203 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
204
205 //////////////////////////////////////////////////////////////////////////////
206
207 struct tGaugecxx . . $ tGauge# {
208 poly_modelcxx . . $ poly_model# *cockpitcxx . . $ tGauge#cockpit.; // cockpit model of gauge
209 bsp_infocxx . . $ bsp_info# *monitorcxx . . $ tGauge#monitor.; // monitor in cockpit.
210 int first_vertcxx . . $ tGauge#first_vert.;
211 bool functionalcxx . . $ tGauge#functional.; // is this gauge working?
212 bool just_initcxx . . $ tGauge#just_init.; // gauge just initialized?
213 uint16_tcxx . . $ uint16_t# maskcxx . . $ tGauge#mask.; // mask of stat for gauge
214 int statecxx . . $ tGauge#state.; // gauge dependent state data.
215 unioncxx . . $ tGauge#$anonymous_type_0# { // data for gauge.
216 int icxx . . $ tGauge#$anonymous_type_0#i.;
217 float fcxx . . $ tGauge#$anonymous_type_0#f.;
218 } datacxx . . $ tGauge#data.;
219 g3Pointcxx . . $ g3Point# ptscxx . . $ tGauge#pts.[4]; // points of monitor in view coordinates. (may be cached from last frame)
220 };
221
222 // which monitors correspond to what faces on the cockpit model.
223 #define PRIMARY_MONITORcxx . . $ `Descent3/gauges.cpp:223:9`! SOF_MONITOR1cxx . . $ `lib/polymodel_external.h:84:9`!
224 #define SHIP_MONITORcxx . . $ `Descent3/gauges.cpp:224:9`! SOF_MONITOR2cxx . . $ `lib/polymodel_external.h:85:9`!
225 #define SECONDARY_MONITORcxx . . $ `Descent3/gauges.cpp:225:9`! SOF_MONITOR3cxx . . $ `lib/polymodel_external.h:86:9`!
226 #define ENERGY1_MONITORcxx . . $ `Descent3/gauges.cpp:226:9`! SOF_MONITOR4cxx . . $ `lib/polymodel_external.h:87:9`!
227 #define ENERGY2_MONITORcxx . . $ `Descent3/gauges.cpp:227:9`! SOF_MONITOR5cxx . . $ `lib/polymodel_external.h:88:9`!
228 #define SHIELD_MONITORcxx . . $ `Descent3/gauges.cpp:228:9`! SOF_MONITOR6cxx . . $ `lib/polymodel_external.h:89:9`!
229 #define AFTERBURN_MONITORcxx . . $ `Descent3/gauges.cpp:229:9`! SOF_MONITOR7cxx . . $ `lib/polymodel_external.h:90:9`!
230
231 // Hack vars for turning off the monitors
232 bool Disable_primary_monitorcxx . . $ Disable_primary_monitor. = 0, Disable_secondary_monitorcxx . . $ Disable_secondary_monitor. = 0;
233
234 //////////////////////////////////////////////////////////////////////////////
235
236 // Available gauges to be rendered.
237 static tStatMaskcxx . . $ tStatMask# Gauge_maskcxx . . $ Gauge_mask.;
238
239 // sets for next frame which gauges have been modified.
240 static tStatMaskcxx . . $ tStatMask# Gauge_mask_modifiedcxx . . $ Gauge_mask_modified.;
241
242 // sets for next frame the functional state of each gauge (on/off).
243 static tGaugecxx . . $ tGauge# Gauge_listcxx . . $ Gauge_list.[NUM_GAUGEScxx . . $ `Descent3/gauges.h:94:9`!];
244
245 // position of cockpit
246 static vectorcxx . . $ vector# *Render_gauge_poscxx . . $ Render_gauge_pos.;
247
248 // matrix of cockpit
249 static matrixcxx . . $ matrix# *Render_gauge_matrixcxx . . $ Render_gauge_matrix.;
250
251 // normalized times of cockpit
252 static float *Render_normalized_timescxx . . $ Render_normalized_times.;
253
254 // if gauges are moving in cockpit.
255 static bool Render_gauge_movingcxx . . $ Render_gauge_moving.; // gauge is moving, but temporarily off.
256 static bool Render_gauge_resetcxx . . $ Render_gauge_reset.; // set this if gauges will be moving, but are still active
257
258 // TODO: MTS: function not found
259 // loads all shield bitmaps into memory
260 static void FreeShieldFramescxx . . $ FreeShieldFrames(49f6e7a06ebc5aa8).();
261
262 // TODO: MTS: function not found
263 // loads all ship bitmaps into memory
264 static void FreeShipFramescxx . . $ FreeShipFrames(49f6e7a06ebc5aa8).();
265
266 // projects monitor coordinates to screen coordinates
267 static void RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(tGaugecxx . . $ tGauge# *gauge);
268
269 // TODO: MTS: function not found
270 // renders the current inventory item name at the x,y position
271 static void InventoryRenderGaugecxx . . $ InventoryRenderGauge(3e454b8ccf442868).(int x, int y);
272
273 // renders the primary monitor gauge
274 static void RenderPrimaryMonitorcxx . . $ RenderPrimaryMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified);
275
276 // renders the secondary monitor gauge
277 static void RenderSecondaryMonitorcxx . . $ RenderSecondaryMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified);
278
279 // renders the shield gauge monitor
280 static void RenderShieldMonitorcxx . . $ RenderShieldMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified);
281
282 // renders the ship gauge monitor
283 static void RenderShipMonitorcxx . . $ RenderShipMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified);
284
285 // renders the ship gauge monitor
286 static void RenderEnergyMonitorcxx . . $ RenderEnergyMonitor(d8e4e9e21bf566f2).(tGaugecxx . . $ tGauge# *gauge, int orient, bool modified);
287
288 // renders the ship gauge monitor
289 static void RenderAfterburnMonitorcxx . . $ RenderAfterburnMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified);
290
291 // renders a monitor style quad
292 static void DrawGaugeMonitorcxx . . $ DrawGaugeMonitor(ae4e9c595e3dc46d).(g3Pointcxx . . $ g3Point# *pts, int bm, float brightness, float *alphas);
293
294 // renders a square texture onto the screen.
295 static void DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(g3Pointcxx . . $ g3Point# *pts, int bm, float u0, float v0, float u1, float v1, uint8_tcxx . . $ uint8_t# alpha, bool saturate);
296
297 // renders a square texture onto the screen.
298 static void DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(g3Pointcxx . . $ g3Point# *pts, int bm, uint8_tcxx . . $ uint8_t# alpha = 255, bool saturate = false);
299
300 // renders a flat poly onto the screen with given color
301 static void DrawGaugeQuadFlatcxx . . $ DrawGaugeQuadFlat(b8855151eba32e5e).(g3Pointcxx . . $ g3Point# *pts, float r, float g, float b, uint8_tcxx . . $ uint8_t# alpha);
302
303 // renders a flat poly onto the screen with 4 colors (for each vertex)
304 static void DrawGaugeQuadFlatcxx . . $ DrawGaugeQuadFlat(da638925eb5f32fe).(g3Pointcxx . . $ g3Point# *pts, float *r, float *g, float *b, uint8_tcxx . . $ uint8_t# alpha);
305
306 // correctly orders monitor vertices based off of UVs
307 static int GetFirstVertcxx . . $ GetFirstVert(fb32502debfb1af7).(bsp_infocxx . . $ bsp_info# *sm);
308
309 // tells what gauge index is the gauge stat item.
310 static inline int GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(tStatMaskcxx . . $ tStatMask# mask) {
311 int i;
312
313 for (i = 0; i < NUM_GAUGEScxx . . $ `Descent3/gauges.h:94:9`!; i++)
314 if (Gauge_listcxx . . $ Gauge_list.[i].maskcxx . . $ tGauge#mask. == mask)
315 return i;
316
317 return -1;
318 }
319
320 //////////////////////////////////////////////////////////////////////////////
321 // Initialization routines
322
323 // initializes cockpit gauges
324 void InitGaugescxx . . $ InitGauges(ed53e3bbd3fa2f69).(uint16_tcxx . . $ uint16_t# gauge_mask) {
325 Gauge_maskcxx . . $ Gauge_mask. = gauge_mask;
326 Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. = Gauge_maskcxx . . $ Gauge_mask.;
327 int gauge = 0;
328
329 for (int i = 0; i < NUM_GAUGEScxx . . $ `Descent3/gauges.h:94:9`!; i++) {
330 uint16_tcxx . . $ uint16_t# mask = Gauge_maskcxx . . $ Gauge_mask. & (1 << i);
331
332 if (mask == STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`!) {
333 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(SHIELD_MONITORcxx . . $ `Descent3/gauges.cpp:228:9`!);
334 }
335 if (mask == STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`!)
336 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(PRIMARY_MONITORcxx . . $ `Descent3/gauges.cpp:223:9`!);
337 else if (mask == STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`!)
338 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(SECONDARY_MONITORcxx . . $ `Descent3/gauges.cpp:225:9`!);
339 else if (mask == STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`!) {
340 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(SHIP_MONITORcxx . . $ `Descent3/gauges.cpp:224:9`!);
341 } else if (mask == STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) {
342 // initialize two gauges. one for left, and one for right energy monitor.
343 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(ENERGY1_MONITORcxx . . $ `Descent3/gauges.cpp:226:9`!);
344 Gauge_listcxx . . $ Gauge_list.[gauge].functionalcxx . . $ tGauge#functional. = false;
345 Gauge_listcxx . . $ Gauge_list.[gauge].statecxx . . $ tGauge#state. = 0;
346 Gauge_listcxx . . $ Gauge_list.[gauge].cockpitcxx . . $ tGauge#cockpit. = CockpitGetPolyModelcxx . . $ CockpitGetPolyModel(4cb3338b82435ee4).();
347 Gauge_listcxx . . $ Gauge_list.[gauge].just_initcxx . . $ tGauge#just_init. = true;
348 Gauge_listcxx . . $ Gauge_list.[gauge].maskcxx . . $ tGauge#mask. = mask;
349 Gauge_listcxx . . $ Gauge_list.[gauge].first_vertcxx . . $ tGauge#first_vert. = GetFirstVertcxx . . $ GetFirstVert(fb32502debfb1af7).(Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor.);
350 gauge++;
351 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(ENERGY2_MONITORcxx . . $ `Descent3/gauges.cpp:227:9`!);
352 } else if (mask == STAT_AFTERBURNcxx . . $ `Descent3/hud.h:283:9`!) {
353 Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor. = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(AFTERBURN_MONITORcxx . . $ `Descent3/gauges.cpp:229:9`!);
354 }
355
356 if (mask) {
357 Gauge_listcxx . . $ Gauge_list.[gauge].functionalcxx . . $ tGauge#functional. = false;
358 Gauge_listcxx . . $ Gauge_list.[gauge].statecxx . . $ tGauge#state. = 0;
359 Gauge_listcxx . . $ Gauge_list.[gauge].cockpitcxx . . $ tGauge#cockpit. = CockpitGetPolyModelcxx . . $ CockpitGetPolyModel(4cb3338b82435ee4).();
360 Gauge_listcxx . . $ Gauge_list.[gauge].just_initcxx . . $ tGauge#just_init. = true;
361 Gauge_listcxx . . $ Gauge_list.[gauge].maskcxx . . $ tGauge#mask. = mask;
362 Gauge_listcxx . . $ Gauge_list.[gauge].first_vertcxx . . $ tGauge#first_vert. = GetFirstVertcxx . . $ GetFirstVert(fb32502debfb1af7).(Gauge_listcxx . . $ Gauge_list.[gauge].monitorcxx . . $ tGauge#monitor.);
363
364 gauge++;
365 }
366 }
367 }
368
369 // deinitializes cockpit gauges
370 void CloseGaugescxx . . $ CloseGauges(49f6e7a06ebc5aa8).() {
371 for (int i = 0; i < NUM_GAUGEScxx . . $ `Descent3/gauges.h:94:9`!; i++) {
372 uint16_tcxx . . $ uint16_t# mask = Gauge_maskcxx . . $ Gauge_mask. & (1 << i);
373 Gauge_listcxx . . $ Gauge_list.[i].monitorcxx . . $ tGauge#monitor. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
374 }
375 Gauge_maskcxx . . $ Gauge_mask. = 0;
376 Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. = 0;
377 }
378
379 // renders gauges
380 void RenderGaugescxx . . $ RenderGauges(1ad61c547ad1b9e4).(vectorcxx . . $ vector# *cockpit_pos, matrixcxx . . $ matrix# *cockpit_mat, float *normalized_time, bool moving, bool reset) {
381 tGaugecxx . . $ tGauge# *gauge;
382 float font_aspect_x;
383 float font_aspect_y;
384
385 Render_gauge_poscxx . . $ Render_gauge_pos. = cockpit_pos;
386 Render_gauge_matrixcxx . . $ Render_gauge_matrix. = cockpit_mat;
387 Render_normalized_timescxx . . $ Render_normalized_times. = normalized_time;
388 Render_gauge_movingcxx . . $ Render_gauge_moving. = moving;
389 Render_gauge_resetcxx . . $ Render_gauge_reset. = reset;
390
391 grtext_Resetcxx . . $ grtext_Reset(49f6e7a06ebc5aa8).();
392 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!);
393 // for lores screens, we use different fonts, so DONT SCALE.
394 font_aspect_x = (float)Game_window_wcxx . . $ Game_window_w. / Max_window_wcxx . . $ Max_window_w.;
395 font_aspect_y = (float)Game_window_hcxx . . $ Game_window_h. / Max_window_hcxx . . $ Max_window_h.;
396
397 if (font_aspect_x <= 0.60) {
398 grtext_SetFontScalecxx . . $ grtext_SetFontScale(9364e6e7bff7660).(0.60f);
399 } else if (font_aspect_x <= 0.80) {
400 grtext_SetFontScalecxx . . $ grtext_SetFontScale(9364e6e7bff7660).(0.80f);
401 } else {
402 grtext_SetFontScalecxx . . $ grtext_SetFontScale(9364e6e7bff7660).(1.0f);
403 }
404
405 if (Gauge_maskcxx . . $ Gauge_mask. & STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`!) {
406 ASSERTcxx . . $ `misc/pserror.h:246:9`!(GAUGE_INDEX(STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`!) != -1);
407 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`!)];
408 if (gauge->monitorcxx . . $ tGauge#monitor.) {
409 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
410 RenderPrimaryMonitorcxx . . $ RenderPrimaryMonitor(f45fe91b9a227852).(gauge, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`!) ? true : false);
411 }
412 gauge->just_initcxx . . $ tGauge#just_init. = false;
413 }
414 if (Gauge_maskcxx . . $ Gauge_mask. & STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`!) {
415 ASSERTcxx . . $ `misc/pserror.h:246:9`!(GAUGE_INDEX(STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`!) != -1);
416 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`!)];
417 if (gauge->monitorcxx . . $ tGauge#monitor.) {
418 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
419 RenderSecondaryMonitorcxx . . $ RenderSecondaryMonitor(f45fe91b9a227852).(gauge, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`!) ? true : false);
420 }
421 gauge->just_initcxx . . $ tGauge#just_init. = false;
422 }
423 if (Gauge_maskcxx . . $ Gauge_mask. & STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`!) {
424 ASSERTcxx . . $ `misc/pserror.h:246:9`!(GAUGE_INDEX(STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`!) != -1);
425 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`!)];
426 if (gauge->monitorcxx . . $ tGauge#monitor.) {
427 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
428 RenderShieldMonitorcxx . . $ RenderShieldMonitor(f45fe91b9a227852).(gauge, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`!) ? true : false);
429 }
430 gauge->just_initcxx . . $ tGauge#just_init. = false;
431 }
432 if (Gauge_maskcxx . . $ Gauge_mask. & STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`!) {
433 ASSERTcxx . . $ `misc/pserror.h:246:9`!(GAUGE_INDEX(STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`!) != -1);
434 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`!)];
435 if (gauge->monitorcxx . . $ tGauge#monitor.) {
436 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
437 RenderShipMonitorcxx . . $ RenderShipMonitor(f45fe91b9a227852).(gauge, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`!) ? true : false);
438 }
439 gauge->just_initcxx . . $ tGauge#just_init. = false;
440 }
441 if (Gauge_maskcxx . . $ Gauge_mask. & STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) {
442 ASSERTcxx . . $ `misc/pserror.h:246:9`!(GAUGE_INDEX(STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) != -1);
443 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!)];
444 if (gauge->monitorcxx . . $ tGauge#monitor.) {
445 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
446 RenderEnergyMonitorcxx . . $ RenderEnergyMonitor(d8e4e9e21bf566f2).(gauge, 0, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) ? true : false);
447 }
448 gauge->just_initcxx . . $ tGauge#just_init. = false;
449 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) + 1];
450 if (gauge->monitorcxx . . $ tGauge#monitor.) {
451 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
452 RenderEnergyMonitorcxx . . $ RenderEnergyMonitor(d8e4e9e21bf566f2).(gauge, 1, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) ? true : false);
453 }
454 gauge->just_initcxx . . $ tGauge#just_init. = false;
455 }
456 if (Gauge_maskcxx . . $ Gauge_mask. & STAT_AFTERBURNcxx . . $ `Descent3/hud.h:283:9`!) {
457 ASSERTcxx . . $ `misc/pserror.h:246:9`!(GAUGE_INDEX(STAT_AFTERBURNcxx . . $ `Descent3/hud.h:283:9`!) != -1);
458 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(STAT_AFTERBURNcxx . . $ `Descent3/hud.h:283:9`!)];
459 if (gauge->monitorcxx . . $ tGauge#monitor.) {
460 RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(gauge);
461 RenderAfterburnMonitorcxx . . $ RenderAfterburnMonitor(f45fe91b9a227852).(gauge, (Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. & STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`!) ? true : false);
462 }
463 gauge->just_initcxx . . $ tGauge#just_init. = false;
464 }
465
466 // render all text
467 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
468
469 Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. = 0;
470 }
471
472 // flags certain gauges to be modified next frame.
473 void FlagGaugesModifiedcxx . . $ FlagGaugesModified(ed53e3bbd3fa2f69).(tStatMaskcxx . . $ tStatMask# mask_modified) { Gauge_mask_modifiedcxx . . $ Gauge_mask_modified. |= mask_modified; }
474
475 // sets whether the gauges are functional
476 void FlagGaugesFunctionalcxx . . $ FlagGaugesFunctional(ed53e3bbd3fa2f69).(tStatMaskcxx . . $ tStatMask# mask) {
477 uint16_tcxx . . $ uint16_t# i = 0x8000, j = NUM_GAUGEScxx . . $ `Descent3/gauges.h:94:9`!;
478
479 while (i) {
480 if (mask & i)
481 Gauge_listcxx . . $ Gauge_list.[j - 1].functionalcxx . . $ tGauge#functional. = true;
482 i = i >> 1;
483 j--;
484 }
485 }
486
487 // sets whether the gauges are functional
488 void FlagGaugesNonfunctionalcxx . . $ FlagGaugesNonfunctional(ed53e3bbd3fa2f69).(tStatMaskcxx . . $ tStatMask# mask) {
489 uint16_tcxx . . $ uint16_t# i = 0x8000, j = NUM_GAUGEScxx . . $ `Descent3/gauges.h:94:9`!;
490
491 while (i) {
492 if (mask & i)
493 Gauge_listcxx . . $ Gauge_list.[j - 1].functionalcxx . . $ tGauge#functional. = false;
494 i = i >> 1;
495 j--;
496 }
497 }
498
499 // renders the primary monitor gauge
500 // this will normally render the primary weapon currently selected
501 // can render another view though.
502 // renders the primary monitor gauge
503
504 static inline int get_weapon_hud_imagecxx . . $ get_weapon_hud_image(9b79fb6aee4c0440).(int player, int type) {
505 player_weaponcxx . . $ player_weapon# *pw = &Playerscxx . . $ Players.[player].weaponcxx . . $ player#weapon.[type];
506 weaponcxx . . $ weapon# *wpn = GetWeaponFromIndexcxx . . $ GetWeaponFromIndex(8877214bf23c386e).(player, pw->indexcxx . . $ player_weapon#index.);
507
508 return (wpn ? wpn->hud_image_handlecxx . . $ weapon#hud_image_handle. : BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!);
509 }
510
511 void RenderPrimaryMonitorcxx . . $ RenderPrimaryMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified) {
512 if (Disable_primary_monitorcxx . . $ Disable_primary_monitor.)
513 return;
514
515 if (gauge->functionalcxx . . $ tGauge#functional.) {
516 float alphas[4];
517 alphas[0] = 1.0f;
518 alphas[1] = 1.0f;
519 alphas[2] = 1.0f;
520 alphas[3] = 1.0f;
521
522 int hud_image = get_weapon_hud_imagecxx . . $ get_weapon_hud_image(9b79fb6aee4c0440).(Player_numcxx . . $ Player_num., PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!);
523
524 DrawGaugeMonitorcxx . . $ DrawGaugeMonitor(ae4e9c595e3dc46d).(gauge->ptscxx . . $ tGauge#pts., hud_image, 0.5f, alphas);
525
526 if (!Render_gauge_movingcxx . . $ Render_gauge_moving.) {
527 int x1, y;
528 int index = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weaponcxx . . $ player#weapon.[PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!].indexcxx . . $ player_weapon#index.;
529 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.];
530 otype_wb_infocxx . . $ otype_wb_info# *wb = &ship->static_wbcxx . . $ ship#static_wb.[index];
531
532 gauge->ptscxx . . $ tGauge#pts.[0].p3_flagscxx . . $ g3Point#p3_flags. &= (~PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!);
533 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&gauge->ptscxx . . $ tGauge#pts.[0]);
534 x1 = gauge->ptscxx . . $ tGauge#pts.[0].p3_sxcxx . . $ g3Point#p3_sx.;
535 y = gauge->ptscxx . . $ tGauge#pts.[0].p3_sycxx . . $ g3Point#p3_sy.;
536
537 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
538 grtext_SetFancyColorcxx . . $ grtext_SetFancyColor(eda338842932bf2b).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0));
539 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(30), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(10), "%s", TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[index][0]));
540 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
541 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(30), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(10), "%s", TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[index][0]));
542
543 if (strlen(TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!].index][1]))) {
544 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
545 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(35), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%s", TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[index][1]));
546 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
547 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(35), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%s", TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[index][1]));
548 y = y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(10);
549 }
550
551 if (wb && wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage.) {
552 int ammo = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].weapon_ammocxx . . $ player#weapon_ammo.[index];
553 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
554 if (ship->fire_flagscxx . . $ ship#fire_flags.[index] & SFF_TENTHScxx . . $ `Descent3/ship.h:133:9`!) {
555 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(40), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%d.%d", ammo / 10, ammo % 10);
556 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
557 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(40), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%d.%d", ammo / 10, ammo % 10);
558 } else {
559 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(40), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%d", ammo);
560 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
561 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(40), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%d", ammo);
562 }
563 }
564 }
565 }
566 }
567
568 // renders the secondary monitor gauge
569 void RenderSecondaryMonitorcxx . . $ RenderSecondaryMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified) {
570 if (Disable_secondary_monitorcxx . . $ Disable_secondary_monitor.)
571 return;
572
573 if (gauge->functionalcxx . . $ tGauge#functional.) {
574 float alphas[4];
575
576 alphas[0] = 1.0f;
577 alphas[1] = 1.0f;
578 alphas[2] = 1.0f;
579 alphas[3] = 1.0f;
580
581 int hud_image = get_weapon_hud_imagecxx . . $ get_weapon_hud_image(9b79fb6aee4c0440).(Player_numcxx . . $ Player_num., PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!);
582
583 DrawGaugeMonitorcxx . . $ DrawGaugeMonitor(ae4e9c595e3dc46d).(gauge->ptscxx . . $ tGauge#pts., hud_image, 0.5f, alphas);
584
585 if (!Render_gauge_movingcxx . . $ Render_gauge_moving.) {
586 int x1, y;
587
588 gauge->ptscxx . . $ tGauge#pts.[0].p3_flagscxx . . $ g3Point#p3_flags. &= (~PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!);
589 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&gauge->ptscxx . . $ tGauge#pts.[0]);
590 x1 = gauge->ptscxx . . $ tGauge#pts.[0].p3_sxcxx . . $ g3Point#p3_sx.;
591 y = gauge->ptscxx . . $ tGauge#pts.[0].p3_sycxx . . $ g3Point#p3_sy.;
592
593 grtext_SetFancyColorcxx . . $ grtext_SetFancyColor(eda338842932bf2b).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0));
594 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
595 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(5), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(10), "%s",
596 TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].index][0]));
597 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
598 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(5), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(10), "%s",
599 TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].index][0]));
600 if (strlen(TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].index][1]))) {
601 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
602 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(5), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%s",
603 TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].index][1]));
604 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
605 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(5), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%s",
606 TXTcxx . . $ `Descent3/stringtable.h:24:9`!(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!].index][1]));
607 y = y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(10);
608 }
609 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(0);
610 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(15), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%d",
611 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.]);
612 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SATURATEcxx . . $ `grtext/grtext.h:119:9`!);
613 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x1 + HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(15), y + HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(20), "%d",
614 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.]);
615 }
616 }
617 }
618
619 // renders the shield gauge monitor
620 void RenderShieldMonitorcxx . . $ RenderShieldMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified) {
621 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`!;
622
623 if (alpha_mod > 1.0f)
624 alpha_mod = 1.0f;
625
626 int img = (int)ceilcxx . . $ ceil(fbcf3211dfe1bfd1).((1.0f - alpha_mod - 0.1f) * NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!);
627 if (img < NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!) {
628 if (img < 0)
629 img = 0;
630 img = HUD_resourcescxx . . $ HUD_resources..shield_bmpcxx . . $ sHUDResources#shield_bmp.[img];
631
632 if (gauge->functionalcxx . . $ tGauge#functional.)
633 DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(gauge->ptscxx . . $ tGauge#pts., img, 255);
634 }
635 }
636
637 // renders the ship gauge monitor
638 void RenderEnergyMonitorcxx . . $ RenderEnergyMonitor(d8e4e9e21bf566f2).(tGaugecxx . . $ tGauge# *gauge, int orient, bool modified) {
639 if (gauge->functionalcxx . . $ tGauge#functional.) {
640 float img_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 0);
641 float normalized_energy = (float)Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].energycxx . . $ player#energy. / (float)INITIAL_ENERGYcxx . . $ `Descent3/player_external.h:68:9`!;
642 g3Pointcxx . . $ g3Point# used_pts[4], left_pts[4];
643 float img_energy_h;
644 float hgt_scalar;
645 int i;
646
647 if (normalized_energy > 1.0f)
648 normalized_energy = 1.0f;
649
650 img_energy_h = (normalized_energy * img_h);
651
652 for (i = 0; i < 4; i++) {
653 used_pts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). gauge->ptscxx . . $ tGauge#pts.[i];
654 left_pts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). gauge->ptscxx . . $ tGauge#pts.[i];
655 }
656
657 // draw energy gauge, showing how much energy below 100% you have. draw energy spent faded.
658 hgt_scalar = img_energy_h / img_h;
659 used_pts[3].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). used_pts[3].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). (used_pts[3].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[0].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). hgt_scalar;
660 used_pts[2].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). used_pts[2].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). (used_pts[2].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[1].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). hgt_scalar;
661 used_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
662 used_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). (used_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). hgt_scalar;
663 used_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
664 used_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). (used_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). hgt_scalar;
665
666 if (!orient)
667 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(used_pts, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 0, 0, 1, 1.0f - normalized_energy, 64, 0);
668 else
669 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(used_pts, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 1, 0, 0, 1.0f - normalized_energy, 64, 0);
670
671 left_pts[0].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). left_pts[0].p3_veccxx . . $ g3Point#p3_vec. +cxx . . $ operator+(b77b703cd1e43e33). (left_pts[3].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[0].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - hgt_scalar);
672 left_pts[1].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). left_pts[1].p3_veccxx . . $ g3Point#p3_vec. +cxx . . $ operator+(b77b703cd1e43e33). (left_pts[2].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[1].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - hgt_scalar);
673 left_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
674 left_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. +cxx . . $ operator+(b77b703cd1e43e33). (left_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - hgt_scalar);
675 left_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
676 left_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. +cxx . . $ operator+(b77b703cd1e43e33). (left_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - hgt_scalar);
677
678 if (!orient)
679 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(left_pts, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 0, 1.0f - normalized_energy, 1, 1, 255, 0);
680 else
681 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(left_pts, HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp., 1, 1.0f - normalized_energy, 0, 1, 255, 0);
682 }
683 }
684
685 // renders the ship gauge monitor
686 void RenderAfterburnMonitorcxx . . $ RenderAfterburnMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified) {
687 g3Pointcxx . . $ g3Point# used_pts[4], left_pts[4];
688
689 if (gauge->functionalcxx . . $ tGauge#functional.) {
690 float img_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp., 0);
691 float val = (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].afterburn_time_leftcxx . . $ player#afterburn_time_left. / AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`!);
692 float img_burn_w = (val * img_w);
693 float w_scalar;
694 int i;
695
696 for (i = 0; i < 4; i++) {
697 used_pts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). gauge->ptscxx . . $ tGauge#pts.[i];
698 left_pts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). gauge->ptscxx . . $ tGauge#pts.[i];
699 }
700
701 // draw energy gauge,
702 // showing how much energy below 100% you have. draw energy spent faded.
703 w_scalar = img_burn_w / img_w;
704
705 used_pts[3].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). used_pts[3].p3_veccxx . . $ g3Point#p3_vec. +cxx . . $ operator+(b77b703cd1e43e33). (used_pts[2].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[3].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). w_scalar;
706 used_pts[0].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). used_pts[0].p3_veccxx . . $ g3Point#p3_vec. +cxx . . $ operator+(b77b703cd1e43e33). (used_pts[1].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[0].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). w_scalar;
707 used_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
708 used_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. +cxx . . $ operator+(b77b703cd1e43e33). (used_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). w_scalar;
709 used_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
710 used_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. +cxx . . $ operator+(b77b703cd1e43e33). (used_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). used_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). w_scalar;
711 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(used_pts, HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp., val, 0, 1, 1, 64, 0);
712
713 left_pts[1].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). left_pts[1].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). (left_pts[1].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[0].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - w_scalar);
714 left_pts[2].p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). left_pts[2].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). (left_pts[2].p3_veccxx . . $ g3Point#p3_vec. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[3].p3_veccxx . . $ g3Point#p3_vec.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - w_scalar);
715 left_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
716 left_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). (left_pts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - w_scalar);
717 left_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d).
718 left_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). (left_pts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). left_pts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) *cxx . . $ `operator*`(252247219a31502c). (1.0f - w_scalar);
719 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(left_pts, HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp., 0, 0, val, 1, 255, 0);
720 }
721 }
722
723 // renders the ship gauge monitor
724 #define GAUGE_INVSHIPRING_DELTAcxx . . $ `Descent3/gauges.cpp:724:9`! 0.06f
725 void RenderShipMonitorcxx . . $ RenderShipMonitor(f45fe91b9a227852).(tGaugecxx . . $ tGauge# *gauge, bool modified) {
726 if (!gauge->functionalcxx . . $ tGauge#functional.)
727 return;
728
729 uint8_tcxx . . $ uint8_t# alpha = 255;
730 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`!) {
731 float 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.;
732 if (time_frame < HUD_CLOAKEND_TIMEcxx . . $ `Descent3/hud.h:530:9`!) {
733 alpha = 128 - 127 * FixCoscxx . . $ FixCos(9a38df040a81ca35).(65536.0f * (time_frame - (int)time_frame));
734 } else {
735 alpha = 0;
736 }
737 }
738
739 DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(gauge->ptscxx . . $ tGauge#pts., HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp., alpha);
740 DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(gauge->ptscxx . . $ tGauge#pts., HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp., alpha, true);
741
742 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_INVULNERABLEcxx . . $ `Descent3/player_external.h:79:9`!) {
743 // get to the view matrix so we have direction vectors to move along
744 matrixcxx . . $ matrix# view_matrix;
745 g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(&view_matrix);
746
747 float inv_time_frame = (Gametimecxx . . $ Gametime. - (int)Gametimecxx . . $ Gametime.);
748 float inv_alpha = (uint8_tcxx . . $ uint8_t#)(255 * (1.0f - (inv_time_frame / 2.0f)));
749 g3Pointcxx . . $ g3Point# invpts[4];
750 int i;
751
752 // do invulnerability animation.
753 for (i = 0; i < 4; i++) {
754 invpts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). gauge->ptscxx . . $ tGauge#pts.[i];
755 }
756
757 float amount = (inv_time_frame * GAUGE_INVSHIPRING_DELTAcxx . . $ `Descent3/gauges.cpp:724:9`!);
758 invpts[0].p3_xcxx . . $ `lib/3d.h:245:9`! -= amount;
759 invpts[0].p3_ycxx . . $ `lib/3d.h:246:9`! += amount;
760 invpts[1].p3_xcxx . . $ `lib/3d.h:245:9`! += amount;
761 invpts[1].p3_ycxx . . $ `lib/3d.h:246:9`! += amount;
762 invpts[2].p3_xcxx . . $ `lib/3d.h:245:9`! += amount;
763 invpts[2].p3_ycxx . . $ `lib/3d.h:246:9`! -= amount;
764 invpts[3].p3_xcxx . . $ `lib/3d.h:245:9`! -= amount;
765 invpts[3].p3_ycxx . . $ `lib/3d.h:246:9`! -= amount;
766
767 invpts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d). invpts[0].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). (view_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). amount) +cxx . . $ operator+(b77b703cd1e43e33). (view_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). amount);
768 invpts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d). invpts[1].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. +cxx . . $ operator+(b77b703cd1e43e33). (view_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). amount) +cxx . . $ operator+(b77b703cd1e43e33). (view_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). amount);
769 invpts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d). invpts[2].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. +cxx . . $ operator+(b77b703cd1e43e33). (view_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). amount) -cxx . . $ operator-(b77b703cd1e43e33). (view_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). amount);
770 invpts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. =cxx . . $ vector#`operator=`(c0842353a20857d). invpts[3].p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). (view_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). amount) -cxx . . $ operator-(b77b703cd1e43e33). (view_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). amount);
771
772 DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(invpts, HUD_resourcescxx . . $ HUD_resources..invpulse_bmpcxx . . $ sHUDResources#invpulse_bmp., inv_alpha);
773 DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(invpts, HUD_resourcescxx . . $ HUD_resources..invpulse_bmpcxx . . $ sHUDResources#invpulse_bmp., inv_alpha, true);
774 }
775 }
776
777 // projects monitor coordinates to screen coordinates
778 void RotateMonitorPositioncxx . . $ RotateMonitorPosition(75a368d4cfa89701).(tGaugecxx . . $ tGauge# *gauge) {
779 ASSERTcxx . . $ `misc/pserror.h:246:9`!(gauge->monitor);
780 ASSERTcxx . . $ `misc/pserror.h:246:9`!(gauge->monitor->num_faces == 1);
781 int subnum = gauge->monitorcxx . . $ tGauge#monitor. - gauge->cockpitcxx . . $ tGauge#cockpit.->submodelcxx . . $ poly_model#submodel.;
782
783 if (gauge->monitorcxx . . $ tGauge#monitor.->facescxx . . $ bsp_info#faces.[0].nvertscxx . . $ polyface#nverts. != 4)
784 Int3cxx . . $ `misc/pserror.h:247:9`!();
785
786 for (int j = 0; j < gauge->monitorcxx . . $ tGauge#monitor.->facescxx . . $ bsp_info#faces.[0].nvertscxx . . $ polyface#nverts.; j++) {
787 // saved the view coordinates of the monitor if the gauge is moving and/or was just initialized.
788 // if gauge is not moving, then just use these saved points and make sure to mark them as NOT PROJECTED.
789 vectorcxx . . $ vector# vpt;
790 vectorcxx . . $ vector# vert;
791 vpt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). gauge->monitorcxx . . $ tGauge#monitor.->vertscxx . . $ bsp_info#verts.[gauge->monitorcxx . . $ tGauge#monitor.->facescxx . . $ bsp_info#faces.[0].vertnumscxx . . $ polyface#vertnums.[(gauge->first_vertcxx . . $ tGauge#first_vert. + j) % 4]];
792 // JEFFNOTE: Since we are using hardware transforms, we want to update the points all the time
793 // if (Render_gauge_moving || gauge->just_init || Render_gauge_reset)
794 {
795 GetPolyModelPointInWorldcxx . . $ GetPolyModelPointInWorld(fee16eb52aacf77f).(&vert, gauge->cockpitcxx . . $ tGauge#cockpit., Render_gauge_poscxx . . $ Render_gauge_pos., Render_gauge_matrixcxx . . $ Render_gauge_matrix., subnum,
796 Render_normalized_timescxx . . $ Render_normalized_times., &vpt);
797 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&gauge->ptscxx . . $ tGauge#pts.[j], &vert);
798 }
799 }
800 }
801
802 //////////////////////////////////////////////////////////////////////////////
803 // Graphic primatives for hud
804
805 // renders a monitor style quad
806 void DrawGaugeMonitorcxx . . $ DrawGaugeMonitor(ae4e9c595e3dc46d).(g3Pointcxx . . $ g3Point# *pts, int bm, float brightness, float *alphas) {
807 g3Pointcxx . . $ g3Point# *pntlist[4];
808 g3Pointcxx . . $ g3Point# pnts[4];
809
810 if (bm == -1)
811 bm = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!;
812
813 for (int i = 0; i < 4; i++) {
814 pnts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). pts[i];
815 pnts[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_RGBAcxx . . $ `lib/3d.h:219:9`! | (pts[i].p3_flagscxx . . $ g3Point#p3_flags. & PF_ORIGPOINTcxx . . $ `lib/3d.h:221:9`!);
816 pntlist[i] = &pnts[i];
817 }
818
819 pnts[0].p3_ucxx . . $ `lib/3d.h:250:9`! = 0;
820 pnts[0].p3_vcxx . . $ `lib/3d.h:251:9`! = 0;
821 pnts[0].p3_acxx . . $ `lib/3d.h:256:9`! = alphas[0];
822
823 pnts[1].p3_ucxx . . $ `lib/3d.h:250:9`! = 1;
824 pnts[1].p3_vcxx . . $ `lib/3d.h:251:9`! = 0;
825 pnts[1].p3_acxx . . $ `lib/3d.h:256:9`! = alphas[1];
826
827 pnts[2].p3_ucxx . . $ `lib/3d.h:250:9`! = 1;
828 pnts[2].p3_vcxx . . $ `lib/3d.h:251:9`! = 1;
829 pnts[2].p3_acxx . . $ `lib/3d.h:256:9`! = alphas[2];
830
831 pnts[3].p3_ucxx . . $ `lib/3d.h:250:9`! = 0;
832 pnts[3].p3_vcxx . . $ `lib/3d.h:251:9`! = 1;
833 pnts[3].p3_acxx . . $ `lib/3d.h:256:9`! = alphas[3];
834
835 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
836 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
837 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
838 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(brightness * 255);
839
840 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_VERTEXcxx . . $ `lib/renderer.h:404:9`!);
841
842 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm);
843 }
844
845 // renders a square texture onto the screen.
846 void DrawGaugeQuadcxx . . $ DrawGaugeQuad(b9139e41dc8bd553).(g3Pointcxx . . $ g3Point# *pts, int bm, uint8_tcxx . . $ uint8_t# alpha, bool saturate) {
847 DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(pts, bm, 0, 0, 1, 1, alpha, saturate);
848 }
849
850 // renders a square texture onto the screen.
851 void DrawGaugeQuadcxx . . $ DrawGaugeQuad(7aaea0eccd8e8dc8).(g3Pointcxx . . $ g3Point# *pts, int bm, float u0, float v0, float u1, float v1, uint8_tcxx . . $ uint8_t# alpha, bool saturate) {
852 g3Pointcxx . . $ g3Point# *pntlist[4];
853 g3Pointcxx . . $ g3Point# pnts[4];
854
855 if (bm == -1)
856 bm = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!;
857
858 for (int i = 0; i < 4; i++) {
859 pnts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). pts[i];
860 pnts[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_UVcxx . . $ `lib/3d.h:217:9`! | (pts[i].p3_flagscxx . . $ g3Point#p3_flags. & PF_ORIGPOINTcxx . . $ `lib/3d.h:221:9`!);
861 pntlist[i] = &pnts[i];
862 }
863
864 pnts[0].p3_ucxx . . $ `lib/3d.h:250:9`! = u0;
865 pnts[0].p3_vcxx . . $ `lib/3d.h:251:9`! = v0;
866
867 pnts[1].p3_ucxx . . $ `lib/3d.h:250:9`! = u1;
868 pnts[1].p3_vcxx . . $ `lib/3d.h:251:9`! = v0;
869
870 pnts[2].p3_ucxx . . $ `lib/3d.h:250:9`! = u1;
871 pnts[2].p3_vcxx . . $ `lib/3d.h:251:9`! = v1;
872
873 pnts[3].p3_ucxx . . $ `lib/3d.h:250:9`! = u0;
874 pnts[3].p3_vcxx . . $ `lib/3d.h:251:9`! = v1;
875
876 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
877 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
878 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
879 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha);
880
881 if (!saturate)
882 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
883 else
884 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
885
886 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm);
887 }
888
889 // renders a flat poly onto the screen with given color
890 void DrawGaugeQuadFlatcxx . . $ DrawGaugeQuadFlat(b8855151eba32e5e).(g3Pointcxx . . $ g3Point# *pts, float r, float g, float b, uint8_tcxx . . $ uint8_t# alpha) {
891 float ar[4] = {r, r, r, r}, ag[4] = {g, g, g, g}, ab[4] = {b, b, b, b};
892
893 DrawGaugeQuadFlatcxx . . $ DrawGaugeQuadFlat(da638925eb5f32fe).(pts, ar, ag, ab, alpha);
894 }
895
896 // renders a flat poly onto the screen with 4 colors (for each vertex)
897 void DrawGaugeQuadFlatcxx . . $ DrawGaugeQuadFlat(da638925eb5f32fe).(g3Pointcxx . . $ g3Point# *pts, float *r, float *g, float *b, uint8_tcxx . . $ uint8_t# alpha) {
898 g3Pointcxx . . $ g3Point# *pntlist[4];
899 g3Pointcxx . . $ g3Point# pnts[4];
900
901 for (int i = 0; i < 4; i++) {
902 pnts[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). pts[i];
903 pnts[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_RGBAcxx . . $ `lib/3d.h:219:9`! | (pts[i].p3_flagscxx . . $ g3Point#p3_flags. & PF_ORIGPOINTcxx . . $ `lib/3d.h:221:9`!);
904 pntlist[i] = &pnts[i];
905 }
906
907 pnts[0].p3_rcxx . . $ `lib/3d.h:253:9`! = r[0];
908 pnts[0].p3_gcxx . . $ `lib/3d.h:254:9`! = g[0];
909 pnts[0].p3_bcxx . . $ `lib/3d.h:255:9`! = b[0];
910
911 pnts[1].p3_rcxx . . $ `lib/3d.h:253:9`! = r[1];
912 pnts[1].p3_gcxx . . $ `lib/3d.h:254:9`! = g[1];
913 pnts[1].p3_bcxx . . $ `lib/3d.h:255:9`! = b[1];
914
915 pnts[2].p3_rcxx . . $ `lib/3d.h:253:9`! = r[2];
916 pnts[2].p3_gcxx . . $ `lib/3d.h:254:9`! = g[2];
917 pnts[2].p3_bcxx . . $ `lib/3d.h:255:9`! = b[2];
918
919 pnts[3].p3_rcxx . . $ `lib/3d.h:253:9`! = r[3];
920 pnts[3].p3_gcxx . . $ `lib/3d.h:254:9`! = g[3];
921 pnts[3].p3_bcxx . . $ `lib/3d.h:255:9`! = b[3];
922
923 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
924 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
925 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
926 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
927 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`!);
928 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha);
929
930 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, 0);
931 }
932
933 // Returns the vertex index that corresponds to the upper-left vertex
934 int GetFirstVertcxx . . $ GetFirstVert(fb32502debfb1af7).(bsp_infocxx . . $ bsp_info# *sm) {
935 ASSERTcxx . . $ `misc/pserror.h:246:9`!(sm->num_faces == 1 && sm->faces[0].nverts == 4);
936 int i;
937 polyfacecxx . . $ polyface# *face = &sm->facescxx . . $ bsp_info#faces.[0];
938 int first_vert = -1;
939
940 for (i = 0; i < 4 && first_vert == -1; i++) {
941 if (sm->alphacxx . . $ bsp_info#alpha.[face->vertnumscxx . . $ polyface#vertnums.[i]] < .5)
942 first_vert = i;
943 }
944
945 if (first_vert < 0)
946 first_vert = 0; // If no alpha info, just set to first vertex
947
948 return first_vert;
949 }
950
951 // Returns the coordinates of the specified cockpit monitor
952 // Parameter: window - 0 means primary monitor, 1 means secondary
953 // x0,y0,x1,y1 - these are filled in with the coordinates of the montiro
954 // Returns: true if got coords, false if the monitor was animating
955 bool GetCockpitWindowCoordscxx . . $ GetCockpitWindowCoords(a9756ee215d9d271).(int window, int *left, int *top, int *right, int *bot) {
956 if (Render_gauge_movingcxx . . $ Render_gauge_moving.)
957 return 0;
958
959 tGaugecxx . . $ tGauge# *gauge;
960
961 gauge = &Gauge_listcxx . . $ Gauge_list.[GAUGE_INDEXcxx . . $ GAUGE_INDEX(377f6a3136964dac).(window ? STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`! : STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`!)];
962
963 if (gauge->monitorcxx . . $ tGauge#monitor.) {
964
965 #define HUD_RENDER_ZOOMcxx . . $ `Descent3/gauges.cpp:965:9`! 0.56f
966
967 StartFramecxx . . $ StartFrame(b45ddcbc8423892c).(false);
968 g3_StartFramecxx . . $ g3_StartFrame(e35d136ceab5c8a2).(&Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos., &Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient., HUD_RENDER_ZOOMcxx . . $ `Descent3/gauges.cpp:965:9`!);
969
970 for (int i = 0; i < 2; i++) {
971 gauge->ptscxx . . $ tGauge#pts.[i * 2].p3_flagscxx . . $ g3Point#p3_flags. &= (~PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!);
972 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&gauge->ptscxx . . $ tGauge#pts.[i * 2]);
973 }
974
975 *left = gauge->ptscxx . . $ tGauge#pts.[0].p3_sxcxx . . $ g3Point#p3_sx.;
976 *top = gauge->ptscxx . . $ tGauge#pts.[0].p3_sycxx . . $ g3Point#p3_sy.;
977 *right = gauge->ptscxx . . $ tGauge#pts.[2].p3_sxcxx . . $ g3Point#p3_sx. + 2;
978 *bot = gauge->ptscxx . . $ tGauge#pts.[2].p3_sycxx . . $ g3Point#p3_sy. + 2;
979
980 g3_EndFramecxx . . $ g3_EndFrame(49f6e7a06ebc5aa8).();
981 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
982
983 return 1;
984 }
985
986 return 0;
987 }