Debian Codegraph @

Descent3/renderobject.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/renderobject.cpp $
21 * $Revision: 182 $
22 * $Date: 10/03/01 11:35p $
23 * $Author: Kevin $
24 *
25 * Code to render objects
26 *
27 * $Log: /DescentIII/Main/renderobject.cpp $
28 *
29 * 182 10/03/01 11:35p Kevin
30 * multiplayer stripes appear in demo playback
31 *
32 * 181 10/12/99 11:07a Jeff
33 * created virus infected effect
34 *
35 * 180 9/21/99 2:55p Jeff
36 * use powerup color for spark colors
37 *
38 * 179 9/20/99 5:35p Jeff
39 * added -nosparkles command line option to turn off powerup sparkles
40 *
41 * 178 9/20/99 5:30p Jeff
42 * added pretty powerup particles for Katmai systems
43 *
44 * 177 9/18/99 9:28p Jeff
45 * motion blur robots and debris
46 *
47 * 176 8/09/99 3:27p Jeff
48 * fixed render bug with typing indicator
49 *
50 * 175 7/28/99 3:44p Kevin
51 * Mac!
52 *
53 * 174 7/20/99 1:00p Jason
54 * added auto katmai support
55 *
56 * 173 7/08/99 5:47p Jason
57 * changes for new bumpmapping system in 1.1 update patch
58 *
59 * 172 5/26/99 3:03a Jason
60 * fixed bug where flags attached to players would render incorrectly in
61 * multplayer (specifially ctf flags)
62 *
63 * 171 5/13/99 3:41p Ardussi
64 * changes for compiling on the Mac
65 *
66 * 170 5/12/99 3:25p Jason
67 * don't render powerup glows if their render type is RT_NONE
68 *
69 * 169 5/08/99 1:50p Jason
70 * fixed some player colors
71 *
72 * 168 5/03/99 9:27p Jason
73 * fixed one of Chris's bugs with the attach system
74 *
75 * 167 4/29/99 4:58p Jason
76 * fixed typing indicator problem
77 *
78 * 166 4/21/99 11:05a Kevin
79 * new ps_rand and ps_srand to replace rand & srand
80 *
81 * 165 4/19/99 3:25p Jason
82 *
83 * 164 4/19/99 3:46a Jeff
84 * fixed min/max for Linux
85 *
86 * 163 4/17/99 4:51p Jason
87 * fixed stupid headlight issue for good
88 *
89 * 162 4/16/99 11:53a Jason
90 * fixed some lighting issues
91 *
92 * 161 4/14/99 7:21p Jason
93 * made ships more visible in multiplayer
94 *
95 * 160 4/14/99 3:57a Jeff
96 * fixed case mismatch in #includes
97 *
98 * 159 4/09/99 7:04p Jason
99 * changed some texture defines
100 *
101 * 158 4/06/99 1:51p Jason
102 * added new mass driver effect
103 *
104 * 157 4/06/99 10:23a Chris
105 * More "render even though the parent is invisible" cases
106 *
107 * 156 4/03/99 4:56p Jason
108 * fixed deform effect just a little
109 *
110 * 155 4/03/99 2:20p Jason
111 * added better heat damage effect
112 *
113 * 154 3/29/99 4:02p Chris
114 * Patched/Hacked a solution to the invis. after landing problem.
115 *
116 * 153 3/22/99 11:16a Jason
117 * Katmai enhancements
118 *
119 * 152 3/04/99 11:44a Jeff
120 * made it so typing indicator is at max 64x64 when rendering
121 *
122 * 151 3/03/99 4:51p Jason
123 * fixed divide by zero problem
124 *
125 * 150 2/24/99 11:51p Jason
126 * fixed object bug for matt
127 *
128 * 149 2/23/99 12:40p Jason
129 * added more options for generic objects
130 *
131 * 148 2/22/99 3:37p Jason
132 * fixed LOD problems
133 *
134 * 147 2/21/99 4:20p Matt
135 * Added SoundSource objects (and reformatted parts of the object header
136 * files).
137 *
138 * 146 2/18/99 11:05a Jason
139 * fixed some cloak effects
140 *
141 * 145 2/17/99 1:05p Jason
142 * revamped object/face/terrain selection code
143 *
144 * 144 2/15/99 4:11p Jason
145 * made non-vis objects kill all their attach sounds/objects
146 *
147 * 143 2/10/99 12:47p Jeff
148 * fixed up typing indicator
149 *
150 * 142 2/09/99 6:53p Jeff
151 * implemented 'typing inidcator' in multiplayer...players that are typing
152 * messages have an icon on them
153 *
154 * 141 2/09/99 9:59a Chris
155 * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy
156 * now.
157 *
158 * 140 2/05/99 3:00p Jason
159 * fixed bug with my last rev
160 *
161 * 139 2/05/99 12:19p Jason
162 * fixed object selection
163 *
164 * 138 2/02/99 8:43a Chris
165 * I made buildings with AI work correctly (ie really big robots should be
166 * buildings)
167 * anim to and from states are now shorts instead of bytes
168 *
169 * 137 1/27/99 6:08p Jason
170 * first pass at markers
171 *
172 * 136 1/21/99 11:29p Jason
173 * took out misplaced no_glow flag
174 *
175 * 135 1/20/99 5:36p Jason
176 * added custom glows for teams
177 *
178 * 134 1/19/99 4:22p Matt
179 * Added the ability for objects to have their own lighting info,
180 * different from the default lighting for that type of object.
181 *
182 * 133 1/13/99 12:43p Jason
183 * added some more detail settings
184 *
185 * 132 1/13/99 6:38a Jeff
186 * fixed object.h. There were numerous struct declarations that were the
187 * same name as the instance of the struct (gcc doesn't like this).
188 * Changed the struct name. Also added some #ifdef's for linux build,
189 * along with fixing case-sensitive includes
190 *
191 * 131 1/08/99 2:56p Samir
192 * Ripped out OSIRIS1.
193 *
194 * 130 12/14/98 10:53a Jason
195 * added bright player ships option
196 *
197 * 129 12/10/98 7:09p Jason
198 * added cloak fade
199 *
200 * 128 12/10/98 12:27p Jason
201 * added cooler specular mapping for objects
202 *
203 * 127 12/07/98 3:02p Jason
204 * added multi_logo_state
205 *
206 * 126 11/11/98 7:18p Jeff
207 * changes made so that a dedicated server's team is always -1 (team game
208 * or not)
209 *
210 * 125 11/11/98 12:33p Jason
211 * changed black player color
212 *
213 * 124 10/21/98 9:28p Jason
214 * Made no lightmaps work globally
215 *
216 * 123 10/21/98 7:55p Jason
217 * d3d changes
218 *
219 * 122 10/21/98 7:30p Jason
220 * more direct3d changes
221 *
222 * 121 10/19/98 3:16p Jason
223 * additional error checking for lightning
224 *
225 * 120 10/18/98 4:25p Jason
226 * fixes for fogged objects
227 *
228 * 119 10/16/98 3:39p Chris
229 * Improved the object linking system and AI and physics
230 *
231 * 118 10/16/98 2:38p Jason
232 * made powerup halo detail setting work
233 *
234 * 117 10/16/98 2:24p Jason
235 * changes for the demo
236 *
237 * 116 10/14/98 6:24p Jason
238 * made object complexity work
239 *
240 * 115 10/08/98 5:59p Jason
241 * fixed object and room popping with small views
242 *
243 * 114 10/07/98 5:04p Jason
244 * made spheres work in WindowGL mode
245 *
246 * 113 10/02/98 1:47p Jason
247 * added lod player ships
248 *
249 * 112 10/02/98 12:23p Jason
250 * took off sight vector
251 *
252 * 111 10/02/98 11:46a Jason
253 * checked in for samir
254 *
255 * 110 10/01/98 6:10p Jason
256 * added EVT_CLIENT_GETCOLOREDNAME
257 *
258 * 109 10/01/98 4:41p Jason
259 * fixed colors in team games
260 *
261 * 108 10/01/98 4:09p Jason
262 * added multicolor ship stuff
263 *
264 * 107 9/29/98 12:49p Jason
265 * worked on matcen effects and lightning
266 *
267 * 106 9/24/98 12:57p Jason
268 * more state limited optimizations
269 *
270 * 105 9/21/98 5:08p Jason
271 * made damage shield not rotate when you get hit
272 *
273 * 104 9/21/98 1:03p Jason
274 * make sparky damage lightning ramp up depending on amount of damage
275 *
276 * 103 9/18/98 8:23p Jason
277 * fixed insidious vis effect errors
278 *
279 * 102 9/17/98 6:08p Jason
280 * more tweaks for effects
281 *
282 * 101 9/17/98 3:03p Jason
283 * added lightning and invul hit effects
284 *
285 * 100 9/10/98 12:18p Jason
286 * more changes to afterburner/thrust effect
287 *
288 * 99 9/09/98 7:09p Jason
289 * changed afterburner effect for ships
290 *
291 * 98 8/27/98 5:19p Jason
292 * added first rev of reflected surfaces
293 *
294 * 97 8/24/98 1:01p Jason
295 * made object specular faces selectable by texture
296 *
297 * 96 8/19/98 2:19p Jeff
298 * moved detail globals to a struct
299 *
300 * 95 8/18/98 11:38a Jason
301 * fixed polymodel fog lighting
302 *
303 * 94 8/14/98 4:00p Jason
304 * added specular objects outside
305 *
306 * 93 8/13/98 6:57p Jason
307 * made fogged objects render correctly
308 *
309 * 92 8/12/98 6:38p Jeff
310 * don't render ghosted objects (type==OBJ_DUMMY)
311 *
312 * 91 8/03/98 3:59p Chris
313 * Added support for FQ_IGNORE_WEAPONS, added .000001 attach code, fix a
314 * bug in polymodel collision detection
315 *
316 * 90 8/03/98 2:59p Jeff
317 * player names only check doors for visibility
318 *
319 * 89 8/03/98 11:06a Jason
320 * made custom textures work correctly
321 *
322 * 88 7/30/98 11:12a Jason
323 * fixed player names showing up when cloaked
324 *
325 * 87 7/28/98 3:29p Jason
326 * fixed z buffer bug with damage disk
327 *
328 * 86 7/27/98 5:59p Jason
329 * added piggyback mode plus multiplayer colors
330 *
331 * 85 7/02/98 6:30p Jason
332 * added some multiplayer stuff for Jeff
333 *
334 * 84 6/30/98 6:36p Chris
335 * Added rev .1 of multiplayer animations - BTW It is totally not done.
336 *
337 * 83 6/25/98 5:17p Jason
338 * added multiple colored balls for players
339 *
340 * 82 6/22/98 12:27p Jason
341 * fixed stupid bug with my last rev
342 *
343 * 81 6/22/98 12:15p Jason
344 * took out cheap LOD effect with robots
345 *
346 * 80 6/15/98 4:00p Jason
347 * replaced monochromatic polymodel lighting with rgb lighting
348 *
349 * 79 6/11/98 12:48p Jason
350 * added better spewing weapons
351 *
352 * 78 5/11/98 10:41a Jason
353 * made clutter object lodable
354 *
355 * 77 5/05/98 6:26p Chris
356 * Added BBoxs and spheres to external rooms (in mode 2)
357 *
358 * 76 5/04/98 7:26p Chris
359 * Allowed turning off of submodels on robots
360 *
361 * 75 5/04/98 3:51p Matt
362 * Finished (for now) with breaking glass.
363 *
364 * 74 5/04/98 12:28p Matt
365 * Added shard objects
366 *
367 * 73 5/03/98 8:42p Chris
368 *
369 * 72 5/03/98 8:36p Chris
370 * Additional debug info
371 *
372 * 71 4/30/98 12:22p Jason
373 * did some lo-res model optimizations
374 *
375 * 70 4/23/98 6:38p Jason
376 * made bitmaps use 1555 format
377 *
378 * 69 4/19/98 5:00p Jason
379 * added cool napalm effect, plus made object effects dynamically
380 * allocated
381 *
382 * 68 4/17/98 3:57p Jason
383 * added microwave effect
384 *
385 * 67 4/17/98 1:59p Jason
386 * added cool object effects
387 *
388 * 66 4/15/98 3:28p Jason
389 * changed glow stuff to work with new system
390 *
391 * 65 4/13/98 3:51p Chris
392 * Added sphere bubbles to weapons (when wanted) and fixed a small FVI
393 * bug
394 *
395 * 64 4/10/98 12:41p Jason
396 * sped up lighting a little
397 *
398 * 63 4/08/98 12:58p Jason
399 * fixed cloak effect in software
400 *
401 * 62 4/07/98 5:01p Jason
402 * more tweaks to cloak effect
403 *
404 * 61 4/07/98 4:49p Jason
405 * fixed cloak problem
406 *
407 * 60 4/06/98 2:54p Jason
408 * yet more multiplayer changes
409 *
410 * 59 4/02/98 12:24p Jason
411 * trimmed some fat from our structures
412 *
413 * 58 4/01/98 6:23p Jason
414 * added a slew of stuff for multiplayer
415 *
416 * 57 4/01/98 12:02p Jason
417 * incremental checkin for rendering changes
418 *
419 * 56 3/20/98 5:51p Jason
420 * more changes for multiplayer
421 *
422 * 55 3/20/98 2:18p Jason
423 * changes for multiplayer
424 *
425 * 54 3/19/98 7:15p Jason
426 * more changes for multiplayer
427 *
428 * 53 3/13/98 7:00p Chris
429 * EDITOR to _DEBUG
430 *
431 * 52 3/13/98 12:10p Jason
432 * draw a bit of a ring around polygon glows
433 *
434 * 51 3/11/98 4:59p Chris
435 * Added a few new sphere types (wall and anim)
436 *
437 * 50 3/10/98 5:15p Chris
438 * DEL+B shows the bounding-sphere of an object
439 *
440 * 49 3/09/98 5:58p Jason
441 * draw powerups with saturated alpha rings
442 *
443 * 48 3/09/98 4:54p Jason
444 * don't render objects that can't been seen through a portal
445 *
446 * 47 2/25/98 4:31p Jason
447 * changes for explosions
448 *
449 * 46 2/25/98 2:05p Jason
450 * did FOV and object visibility changes
451 *
452 * 45 2/20/98 1:46p Chris
453 * JASON: Made dynamic lighting only occur if the object is rendered
454 *
455 * 44 2/11/98 6:58p Matt
456 * Changed the way cameras are rendered, so they show up on the terrain as
457 * well.
458 *
459 * 43 2/11/98 6:38p Jason
460 * tweaking the glow effects for engines
461 *
462 * 42 2/04/98 6:09p Matt
463 * Changed object room number to indicate a terrain cell via a flag. Got
464 * rid of the object flag which used to indicate terrain.
465 *
466 * 41 2/04/98 2:52p Jason
467 * made length of glow dependant on whether or not the player is thrusting
468 *
469 * 40 1/30/98 6:07p Matt
470 * Added code and menu items to deal with camera objects
471 *
472 * 39 1/30/98 2:56p Matt
473 * Added support for small views. Made R toggle rear view, and Delete-F8
474 * show a view from object 2. Also changed main window render flow so
475 * could share code with small views.
476 *
477 * 38 1/28/98 5:37p Jason
478 * added streamer weapons
479 *
480 * 37 1/23/98 11:21a Jason
481 * incremental multiplayer checkin
482 *
483 * 36 1/21/98 6:09p Jason
484 * Got player deaths working in multiplayer
485 *
486 * 35 1/21/98 1:11p Jason
487 * incremental checkin for multiplayer
488 *
489 * 34 1/20/98 2:17p Jason
490 * fixed weird sorting problem with objects and viseffects
491 *
492 * 33 1/20/98 12:10p Jason
493 * implemented vis effect system
494 *
495 * 32 1/13/98 4:04p Jason
496 * changes for engine glow
497 *
498 * 31 1/13/98 3:09p Jason
499 * added glow effect for engines
500 *
501 * 30 1/05/98 5:59p Jason
502 * tweaked z bias code
503 *
504 * 29 12/08/97 6:18p Jason
505 * more tweaks for destroyable buildings
506 *
507 * 28 12/08/97 5:22p Jason
508 * added code for destroyable buildings that leave their base object
509 * around
510 *
511 * 27 11/25/97 1:36p Jason
512 * adjusted LOD switch levels
513 *
514 * 26 11/25/97 1:17p Jason
515 * added lod system for certain objects
516 *
517 * 25 11/18/97 12:26a Sean
518 * I don't know (Chris)
519 *
520 * 24 11/11/97 8:40p Chris
521 * Added an assert.
522 *
523 * 23 11/05/97 6:03p Jason
524 * added disky colored lighting effects
525 *
526 * 22 11/05/97 12:20p Jason
527 * made powerups render with halos
528 *
529 * 21 10/28/97 11:34a Chris
530 * Fixed a bug in the animation code (if keyframe = 0 and the object
531 * animates, we need to set the angles)
532 *
533 * 20 10/23/97 11:34p Chris
534 * Fixed problems with idle animations
535 *
536 * 19 10/23/97 5:36p Jason
537 * added splinter objects (probably temporary)
538 *
539 * 18 10/20/97 4:46p Jason
540 * changes for explosions
541 *
542 * 17 10/03/97 5:57p Chris
543 * Added support for debug fvi_line
544 *
545 * 16 10/03/97 4:43p Chris
546 * added debug fvi call and object type line
547 *
548 * 15 10/01/97 7:00p Jason
549 * did more work on object lightmaps
550 *
551 * 14 10/01/97 11:35a Jason
552 * added IsObjectVisible function
553 *
554 * 13 9/30/97 5:08p Chris
555 * No changes
556 *
557 * 12 9/22/97 6:20p Matt
558 * Removed obsolete code
559 *
560 * 11 9/16/97 5:04p Matt
561 * Changed conditional for debug code
562 *
563 * 10 9/12/97 5:38p Jason
564 * got doors working
565 *
566 * 9 9/10/97 5:17p Jason
567 * more lighting improvements
568 *
569 * 8 9/09/97 6:15p Jason
570 * made dynamic lighting on objects more memory efficient
571 *
572 * 7 9/03/97 2:12p Chris
573 * Added new weapon battery system and made the animation system usable.
574 *
575 * 6 8/20/97 5:19p Matt
576 * Draw selected bracket instead of box for current object
577 *
578 * $NoKeywords: $
579 */
580 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
581 #include "object_lighting.h"cxx . . $ `<file>/Descent3/object_lighting.h`/
582 #include "3d.h"cxx . . $ `<file>/lib/3d.h`/
583 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
584 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
585 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
586 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
587 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
588 #include "renderobject.h"cxx . . $ `<file>/Descent3/renderobject.h`/
589 #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/
590 #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/
591 #include "splinter.h"cxx . . $ `<file>/Descent3/splinter.h`/
592 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
593 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
594 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
595 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
596 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
597 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
598 #include "damage.h"cxx . . $ `<file>/Descent3/damage.h`/
599 #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/
600 #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/
601 #include "grtext.h"cxx . . $ `<file>/grtext/grtext.h`/
602 #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/
603 #include "config.h"cxx . . $ `<file>/Descent3/config.h`/
604 #include "viseffect.h"cxx . . $ `<file>/Descent3/viseffect.h`/
605 #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/
606 #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/
607 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
608 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
609
610 #include <string.h>
611 #ifdef EDITOR
612 #include "editor\d3edit.h"
613 #endif
614
615 #include <algorithm>
616
617 // what darkening level to use when cloaked
618 #define CLOAKED_FADE_LEVELcxx . . $ `Descent3/renderobject.cpp:618:9`! 28
619 #define CLOAK_FADEIN_DURATION_PLAYERcxx . . $ `Descent3/renderobject.cpp:619:9`! F2_0
620 #define CLOAK_FADEOUT_DURATION_PLAYERcxx . . $ `Descent3/renderobject.cpp:620:9`! F2_0
621 #define CLOAK_FADEIN_DURATION_ROBOTcxx . . $ `Descent3/renderobject.cpp:621:9`! F1_0
622 #define CLOAK_FADEOUT_DURATION_ROBOTcxx . . $ `Descent3/renderobject.cpp:622:9`! F1_0
623 #define RO_STATICcxx . . $ `Descent3/renderobject.cpp:623:9`! 0
624 #define RO_GOURAUDcxx . . $ `Descent3/renderobject.cpp:624:9`! 1
625 #define RO_LIGHTMAPScxx . . $ `Descent3/renderobject.cpp:625:9`! 2
626 extern uint8_tcxx . . $ uint8_t# Use_motion_blurcxx . . $ Use_motion_blur.;
627 uint8_tcxx . . $ uint8_t# RenderObjectTypecxx . . $ RenderObjectType. = RO_STATICcxx . . $ `Descent3/renderobject.cpp:623:9`!;
628 float RenderObjectStaticRedValuecxx . . $ RenderObjectStaticRedValue. = 1.0f;
629 float RenderObjectStaticGreenValuecxx . . $ RenderObjectStaticGreenValue. = 1.0f;
630 float RenderObjectStaticBlueValuecxx . . $ RenderObjectStaticBlueValue. = 1.0f;
631 float RenderObjectStaticScalarcxx . . $ RenderObjectStaticScalar. = 1.0f;
632 uint8_tcxx . . $ uint8_t# *RenderObjectGouraudValuecxx . . $ RenderObjectGouraudValue. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
633 lightmap_objectcxx . . $ lightmap_object# *RenderObjectLightmapObjectcxx . . $ RenderObjectLightmapObject. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
634 vectorcxx . . $ vector# RenderObject_LightDirectioncxx . . $ RenderObject_LightDirection.;
635
636 float Last_powerup_sparkle_timecxx . . $ Last_powerup_sparkle_time. = 0.0f;
637 bool Render_powerup_sparklescxx . . $ Render_powerup_sparkles. = false;
638 // Do powerup sparkles and stuff
639 void DrawPowerupSparklescxx . . $ DrawPowerupSparkles(419c470199a90a97).(objectcxx . . $ object# *obj);
640
641 // Draws the glowing disk around a powerup
642 void DrawPowerupGlowDiskcxx . . $ DrawPowerupGlowDisk(419c470199a90a97).(objectcxx . . $ object# *obj);
643 // Draws a damage disk around a powerup
644 void DrawPlayerDamageDiskcxx . . $ DrawPlayerDamageDisk(419c470199a90a97).(objectcxx . . $ object# *obj);
645 void DrawPlayerInvulSpherecxx . . $ DrawPlayerInvulSphere(419c470199a90a97).(objectcxx . . $ object# *obj);
646 void DrawPlayerSightVectorcxx . . $ DrawPlayerSightVector(419c470199a90a97).(objectcxx . . $ object# *obj);
647 // Draws this players name on the hud
648 void DrawPlayerNameOnHudcxx . . $ DrawPlayerNameOnHud(419c470199a90a97).(objectcxx . . $ object# *obj);
649 // Draws a rotating ball around the player
650 void DrawPlayerRotatingBallcxx . . $ DrawPlayerRotatingBall(419c470199a90a97).(objectcxx . . $ object# *obj);
651 // Creates lightning sparks on a damaged object
652 void DrawSparkyDamageLightningcxx . . $ DrawSparkyDamageLightning(419c470199a90a97).(objectcxx . . $ object# *obj);
653 // Creates Virus infected lightning on an object
654 void DrawVirusLightningcxx . . $ DrawVirusLightning(419c470199a90a97).(objectcxx . . $ object# *obj);
655
656 #ifdef EDITOR
657 // Draws the little corner brackets around the selected object
658 // Actually, only draws those either in front or in back of the object, based on front_flag
659 void DrawObjectSelectionBrackets(object *obj, bool front_flag) {
660 vector viewvec;
661 poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num];
662 float line_len;
663 // Get vector from object to viewer
664 g3_GetViewPosition(&viewvec);
665 viewvec -= obj->pos;
666 // Get length of line segments we're drawing
667 line_len = (pm->maxs.x - pm->mins.x) * 0.2f;
668 // Do each corner
669 for (int c = 0; c < 8; c++) {
670 vector corner;
671 // Get the corner relative to the object
672 corner = (obj->orient.rvec * ((c & 1) ? pm->mins.x : pm->maxs.x)) +
673 (obj->orient.uvec * ((c & 2) ? pm->mins.y : pm->maxs.y)) +
674 (obj->orient.fvec * ((c & 4) ? pm->mins.z : pm->maxs.z));
675 // See if this corner is in front or in back of the object, as specified
676 if (((corner * viewvec) > 0.0) != front_flag)
677 continue;
678 // Get absolute position in 3-space
679 corner += obj->pos;
680 // Draw line for each axis at this corner
681 for (int a = 0; a < 3; a++) {
682 g3Point pp0, pp1;
683 vector t;
684 // Grab the x,y, or z axis, and scale by the line segment length
685 t = corner + ((((vector *)&obj->orient)[a]) * ((c & (1 << a)) ? line_len : -line_len));
686 // Rotate both ends of the line
687 g3_RotatePoint(&pp0, &corner);
688 g3_RotatePoint(&pp1, &t);
689 // Draw!
690 g3_DrawLine(GR_RGB(255, 255, 255), &pp0, &pp1);
691 }
692 }
693 }
694 #endif
695 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
696 static float ArrayXcxx . . $ ArrayX.[10][20] = {{-1, 1, 1, -1, -1},
697 {-.25, 0.0, 0.0, 0.0, -1.0, 1.0},
698 {-1.0, 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, -1.0, 1.0},
699 {-1.0, 1.0, 1.0, -1.0, 1.0, 1.0, -.5},
700 {-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},
701 {-1.0, 1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, 1.0},
702 {-1.0, 1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, 1.0},
703 {-1.0, 1.0, 1.0, 1.0},
704 {-1.0, 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, -1.0, 1.0},
705 {1.0, -1.0, -1.0, 1.0, 1.0, 1.0}};
706 static float ArrayYcxx . . $ ArrayY.[10][20] = {{1, 1, -1, -1, 1},
707 {.75, 1.0, 1.0, -1.0, -1.0, -1.0},
708 {1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0},
709 {1.0, 1.0, -1.0, -1.0, -1.0, 0, 0.0},
710 {1.0, 0.0, 0.0, 0.0, 1.0, -1.0},
711 {1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0},
712 {1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 0.0, 0.0, 0.0},
713 {1.0, 1.0, 1.0, -1.0},
714 {1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 0.0, 0.0},
715 {1.0, 1.0, 0.0, 0.0, 1.0, -1.0}};
716 static int NumOfPointscxx . . $ NumOfPoints.[] = {5, 6, 10, 7, 6, 10, 10, 4, 10, 6};
717 static void DrawNumbercxx . . $ DrawNumber(4a460ce01c7ad9de).(int num, vectorcxx . . $ vector# pos, float size, ddgr_colorcxx . . $ ddgr_color# c1) {
718 g3Pointcxx . . $ g3Point# basepnt, rot_pnt[20];
719 int num_array[10];
720 int i, j;
721 int total = num;
722 size /= 2;
723 if (num < 0) {
724 num *= -1;
725 num += 10000;
726 }
727 int num_numbers = (int)(log10f((float)num) + 1);
728 if (num_numbers > 10) {
729 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Cannot represent a number with over 10 digits\n");
730 Int3cxx . . $ `misc/pserror.h:247:9`!();
731 return;
732 }
733
734 for (j = num_numbers - 1; j >= 0; j--) {
735 num_array[j] = total / ((int)powf(10.0f, (float)j));
736 total -= num_array[j] * (int)powf(10.0f, (float)j);
737 }
738 for (j = 0; j < num_numbers; j++) {
739 vectorcxx . . $ vector# cur_pos;
740
741 if (num_numbers & 0x00000001)
742 cur_pos =cxx . . $ vector#`operator=`(c0842353a20857d). pos +cxx . . $ operator+(b77b703cd1e43e33). (2.1 * size * ((num_numbers >> 1) - j)) *cxx . . $ `operator*`(9d6577ff3e9faa29). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.;
743 else
744 cur_pos =cxx . . $ vector#`operator=`(c0842353a20857d). pos +cxx . . $ operator+(b77b703cd1e43e33). (2.1 * size * ((num_numbers >> 1) - j) - size) *cxx . . $ `operator*`(9d6577ff3e9faa29). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.;
745 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&basepnt, &cur_pos);
746 for (i = 0; i < NumOfPointscxx . . $ NumOfPoints.[num_array[j]]; i++) {
747 rot_pnt[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). basepnt;
748 rot_pnt[i].p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. += (ArrayXcxx . . $ ArrayX.[num_array[j]][i] * size);
749 rot_pnt[i].p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. += (ArrayYcxx . . $ ArrayY.[num_array[j]][i] * size);
750 rot_pnt[i].p3_flagscxx . . $ g3Point#p3_flags. = 0;
751 g3_CodePointcxx . . $ g3_CodePoint(1c2cda054d3314c5).(&rot_pnt[i]);
752 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&rot_pnt[i]);
753 }
754 for (i = 0; i < NumOfPointscxx . . $ NumOfPoints.[num_array[j]] - 1; i++) {
755 g3Pointcxx . . $ g3Point# p1, p2;
756 p1 =cxx . . $ g3Point#`operator=`(c45224b80d125eec). rot_pnt[i];
757 p2 =cxx . . $ g3Point#`operator=`(c45224b80d125eec). rot_pnt[i + 1];
758
759 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &p1, &p2);
760 }
761 }
762 }
763 static inline bool object_object_AABBcxx . . $ object_object_AABB(9fa7d4d2c8b4c2db).(objectcxx . . $ object# *obj1, objectcxx . . $ object# *obj2) {
764 bool overlap = true;
765 if (obj1->max_xyzcxx . . $ object#max_xyz..xcxx . . $ vector#x. < obj2->min_xyzcxx . . $ object#min_xyz..xcxx . . $ vector#x. || obj2->max_xyzcxx . . $ object#max_xyz..xcxx . . $ vector#x. < obj1->min_xyzcxx . . $ object#min_xyz..xcxx . . $ vector#x. || obj1->max_xyzcxx . . $ object#max_xyz..zcxx . . $ vector#z. < obj2->min_xyzcxx . . $ object#min_xyz..zcxx . . $ vector#z. ||
766 obj2->max_xyzcxx . . $ object#max_xyz..zcxx . . $ vector#z. < obj1->min_xyzcxx . . $ object#min_xyz..zcxx . . $ vector#z. || obj1->max_xyzcxx . . $ object#max_xyz..ycxx . . $ vector#y. < obj2->min_xyzcxx . . $ object#min_xyz..ycxx . . $ vector#y. || obj2->max_xyzcxx . . $ object#max_xyz..ycxx . . $ vector#y. < obj1->min_xyzcxx . . $ object#min_xyz..ycxx . . $ vector#y.)
767 overlap = false;
768
769 return overlap;
770 }
771 // Given a face, computes the upper left corner of the face
772 void ComputeDebugVisFaceUpperLeftcxx . . $ ComputeDebugVisFaceUpperLeft(f808f597789360c9).(roomcxx . . $ room# *rp, facecxx . . $ face# *fp, vectorcxx . . $ vector# *upper_left, float *xdiff, float *ydiff, vectorcxx . . $ vector# *center) {
773 matrixcxx . . $ matrix# face_matrix, trans_matrix;
774 vectorcxx . . $ vector# fvec;
775 vectorcxx . . $ vector# avg_vert;
776 vectorcxx . . $ vector# verts[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!];
777 vectorcxx . . $ vector# rot_vert;
778 int i;
779
780 // find the center point of this face
781 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&avg_vert);
782 for (i = 0; i < fp->num_vertscxx . . $ face#num_verts.; i++)
783 avg_vert +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[i]];
784 avg_vert /=cxx . . $ `operator/=`(f132838b2cd11d6). fp->num_vertscxx . . $ face#num_verts.;
785 // Make the orientation matrix
786 // Reverse the normal because we're looking "at" the face, not from it
787 fvec =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).fp->normalcxx . . $ face#normal.;
788
789 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&face_matrix, &fvec, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
790 // Make the transformation matrix
791
792 angveccxx . . $ angvec# avec;
793 vm_ExtractAnglesFromMatrixcxx . . $ vm_ExtractAnglesFromMatrix(5f9a6d6f613ae256).(&avec, &face_matrix);
794 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&trans_matrix, avec.pcxx . . $ angvec#p., avec.hcxx . . $ angvec#h., avec.bcxx . . $ angvec#b.);
795
796 // Rotate all the points
797 for (i = 0; i < fp->num_vertscxx . . $ face#num_verts.; i++) {
798 vectorcxx . . $ vector# vert = rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[i]];
799
800 vert -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). avg_vert;
801 vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&rot_vert, &vert, &trans_matrix);
802 verts[i] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rot_vert;
803 }
804 // Find left most point
805 int leftmost_point = -1;
806 float leftmost_x = 900000.00f; // a big number
807 for (i = 0; i < fp->num_vertscxx . . $ face#num_verts.; i++) {
808 if (verts[i].xcxx . . $ vector#x. < leftmost_x) {
809 leftmost_point = i;
810 leftmost_x = verts[i].xcxx . . $ vector#x.;
811 }
812 }
813 ASSERTcxx . . $ `misc/pserror.h:246:9`!(leftmost_point != -1);
814 // Find top most point
815 int topmost_point = -1;
816 float topmost_y = -900000.0f; // a big number
817 for (i = 0; i < fp->num_vertscxx . . $ face#num_verts.; i++) {
818 if (verts[i].ycxx . . $ vector#y. > topmost_y) {
819 topmost_point = i;
820 topmost_y = verts[i].ycxx . . $ vector#y.;
821 }
822 }
823 ASSERTcxx . . $ `misc/pserror.h:246:9`!(topmost_point != -1);
824 // Find right most point
825 int rightmost_point = -1;
826 float rightmost_x = -900000.00f; // a big number
827 for (i = 0; i < fp->num_vertscxx . . $ face#num_verts.; i++) {
828 if (verts[i].xcxx . . $ vector#x. > rightmost_x) {
829 rightmost_point = i;
830 rightmost_x = verts[i].xcxx . . $ vector#x.;
831 }
832 }
833 ASSERTcxx . . $ `misc/pserror.h:246:9`!(rightmost_point != -1);
834 // Find bottom most point
835 int bottommost_point = -1;
836 float bottommost_y = 900000.0f; // a big number
837 for (i = 0; i < fp->num_vertscxx . . $ face#num_verts.; i++) {
838 if (verts[i].ycxx . . $ vector#y. < bottommost_y) {
839 bottommost_point = i;
840 bottommost_y = verts[i].ycxx . . $ vector#y.;
841 }
842 }
843 ASSERTcxx . . $ `misc/pserror.h:246:9`!(bottommost_point != -1);
844 // now set the base vertex, which is where we base uv 0,0 on
845 vectorcxx . . $ vector# base_vector;
846 base_vector.xcxx . . $ vector#x. = verts[leftmost_point].xcxx . . $ vector#x.;
847 base_vector.ycxx . . $ vector#y. = verts[topmost_point].ycxx . . $ vector#y.;
848 base_vector.zcxx . . $ vector#z. = 0;
849 // Figure out grid resolution
850 *xdiff = verts[rightmost_point].xcxx . . $ vector#x. - verts[leftmost_point].xcxx . . $ vector#x.;
851 *ydiff = verts[topmost_point].ycxx . . $ vector#y. - verts[bottommost_point].ycxx . . $ vector#y.;
852
853 // Find upper left corner
854 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&trans_matrix);
855 vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&rot_vert, &base_vector, &trans_matrix);
856 *upper_left =cxx . . $ vector#`operator=`(c0842353a20857d). rot_vert +cxx . . $ operator+(b77b703cd1e43e33). avg_vert;
857 *center =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). avg_vert;
858 }
859
860 #define VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`! 6
861 void DrawRoomVisPntscxx . . $ DrawRoomVisPnts(419c470199a90a97).(objectcxx . . $ object# *obj) {
862 int roomnum = obj->roomnumcxx . . $ object#roomnum.;
863 if ((!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) && (roomnum != -1) && (Roomscxx . . $ Rooms.[roomnum].usedcxx . . $ room#used.)) {
864 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[roomnum];
865 int t;
866 int j;
867 for (t = 0; t < rp->num_portalscxx . . $ room#num_portals.; t++) {
868 facecxx . . $ face# *src_fp = &rp->facescxx . . $ room#faces.[rp->portalscxx . . $ room#portals.[t].portal_facecxx . . $ portal#portal_face.];
869 float src_width, src_height;
870 vectorcxx . . $ vector# src_upper_left, src_center;
871 matrixcxx . . $ matrix# src_matrix;
872 vectorcxx . . $ vector# src_verts[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!], *src_vertp[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!];
873 for (j = 0; j < src_fp->num_vertscxx . . $ face#num_verts.; j++) {
874 src_verts[j] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rp->vertscxx . . $ room#verts.[src_fp->face_vertscxx . . $ face#face_verts.[j]];
875 src_vertp[j] = &src_verts[j];
876 }
877 vectorcxx . . $ vector# fvec = -cxx . . $ operator-(9e07539e219c6f20).src_fp->normalcxx . . $ face#normal.;
878 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&src_matrix, &fvec, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
879 ComputeDebugVisFaceUpperLeftcxx . . $ ComputeDebugVisFaceUpperLeft(f808f597789360c9).(rp, src_fp, &src_upper_left, &src_width, &src_height, &src_center);
880
881 if (src_width > VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`!) {
882 float num = src_width / VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`!;
883 src_width = VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`!;
884 src_upper_left +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (src_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (num / 2));
885 src_matrix.rveccxx . . $ matrix#rvec. *=cxx . . $ `operator*=`(f132838b2cd11d6). num;
886 }
887 if (src_height > VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`!) {
888 float num = src_height / VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`!;
889 src_height = VIS_TABLE_RESOLUTIONcxx . . $ `Descent3/renderobject.cpp:860:9`!;
890 src_upper_left -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (src_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (num / 2));
891 src_matrix.uveccxx . . $ matrix#uvec. *=cxx . . $ `operator*=`(f132838b2cd11d6). num;
892 }
893 vectorcxx . . $ vector# src_vector, src_ybase;
894 src_ybase =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). src_upper_left;
895 for (int sy = 0; sy < src_height; sy++, src_ybase -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). src_matrix.uveccxx . . $ matrix#uvec.) {
896 src_vector =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). src_ybase;
897 for (int sx = 0; sx < src_width; sx++, src_vector +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). src_matrix.rveccxx . . $ matrix#rvec.) {
898 vectorcxx . . $ vector# src2 = src_vector;
899 // vector subvec=src_center-src_vector;
900 // float mag=vm_GetMagnitudeFast (&subvec);
901 // subvec/=(mag*4);
902 // src2+=subvec;
903 if ((check_point_to_facecxx . . $ check_point_to_face(ccece0347280792).(&src2, &src_fp->normalcxx . . $ face#normal., src_fp->num_vertscxx . . $ face#num_verts., src_vertp))) {
904 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&src2, 1.0f, 0.0f, 0.0f, .1f, .7f, 0.25f, 1);
905 continue;
906 }
907
908 src2 +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). 0.1f *cxx . . $ `operator*`(9d6577ff3e9faa29). rp->facescxx . . $ room#faces.[rp->portalscxx . . $ room#portals.[t].portal_facecxx . . $ portal#portal_face.].normalcxx . . $ face#normal.;
909 if (!fvi_QuickRoomCheckcxx . . $ fvi_QuickRoomCheck(46bb3ef3c66d3688).(&src2, rp, false) && !fvi_QuickRoomCheckcxx . . $ fvi_QuickRoomCheck(46bb3ef3c66d3688).(&src2, rp, true)) {
910 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&src2, 0.0f, 1.0f, 0.0f, .1f, .7f, 0.25f, 1);
911 continue;
912 }
913 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&src2, 0.0f, 0.0f, 1.0f, .1f, .7f, 0.25f, 1);
914 }
915 }
916 }
917 }
918 }
919 void DrawDebugInfocxx . . $ DrawDebugInfo(419c470199a90a97).(objectcxx . . $ object# *obj) {
920 matrixcxx . . $ matrix# m;
921 m =cxx . . $ matrix#`operator=`(4c6f8b29806742). obj->orientcxx . . $ object#orient.;
922 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
923 if (obj->typecxx . . $ object#type. == OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!) {
924 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&obj->poscxx . . $ object#pos., 0.0f, 0.0f, 1.0f, .1f, .7f, obj->sizecxx . . $ object#size., 1);
925 } else {
926 if (Game_show_spherecxx . . $ Game_show_sphere. == 1) {
927 vectorcxx . . $ vector# center = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].wall_size_offsetcxx . . $ poly_model#wall_size_offset. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
928 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&center, 0.0f, 0.0f, 1.0f, .1f, .7f, Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].wall_sizecxx . . $ poly_model#wall_size., 1);
929 } else if (Game_show_spherecxx . . $ Game_show_sphere. == 2) {
930 vectorcxx . . $ vector# center = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].anim_size_offsetcxx . . $ poly_model#anim_size_offset. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
931 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&center, 0.0f, 0.1f, .9f, .1f, .7f, Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].anim_sizecxx . . $ poly_model#anim_size., 1);
932 } else if (Game_show_spherecxx . . $ Game_show_sphere. == 3) {
933 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&obj->poscxx . . $ object#pos., 0.1f, 0.2f, .9f, .1f, .7f, obj->sizecxx . . $ object#size., 1);
934 }
935 }
936 g3Pointcxx . . $ g3Point# g3p[8];
937 memset(g3p, 0, 8 * sizeof(g3Pointcxx . . $ g3Point#));
938 vectorcxx . . $ vector# pos[9];
939 // g3p[0].p3_vec = obj->pos;
940 // g3p[1].p3_vec = obj->rtype.line_info.end_pos;
941
942 ddgr_colorcxx . . $ ddgr_color# c1;
943 if (!object_object_AABBcxx . . $ object_object_AABB(9fa7d4d2c8b4c2db).(obj, Player_objectcxx . . $ Player_object.))
944 c1 = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 0, 0);
945 else
946 c1 = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
947 pos[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->max_xyzcxx . . $ object#max_xyz.;
948 pos[1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->max_xyzcxx . . $ object#max_xyz.;
949 pos[1].zcxx . . $ vector#z. = obj->min_xyzcxx . . $ object#min_xyz..zcxx . . $ vector#z.;
950 pos[2] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->min_xyzcxx . . $ object#min_xyz.;
951 pos[2].ycxx . . $ vector#y. = obj->max_xyzcxx . . $ object#max_xyz..ycxx . . $ vector#y.;
952 pos[3] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->max_xyzcxx . . $ object#max_xyz.;
953 pos[3].xcxx . . $ vector#x. = obj->min_xyzcxx . . $ object#min_xyz..xcxx . . $ vector#x.;
954 pos[4] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->max_xyzcxx . . $ object#max_xyz.;
955 pos[4].ycxx . . $ vector#y. = obj->min_xyzcxx . . $ object#min_xyz..ycxx . . $ vector#y.;
956 pos[5] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->min_xyzcxx . . $ object#min_xyz.;
957 pos[5].xcxx . . $ vector#x. = obj->max_xyzcxx . . $ object#max_xyz..xcxx . . $ vector#x.;
958 pos[6] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->min_xyzcxx . . $ object#min_xyz.;
959 pos[7] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->min_xyzcxx . . $ object#min_xyz.;
960 pos[7].zcxx . . $ vector#z. = obj->max_xyzcxx . . $ object#max_xyz..zcxx . . $ vector#z.;
961
962 pos[8] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
963 pos[8].ycxx . . $ vector#y. += .8f * obj->sizecxx . . $ object#size.;
964 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[0], &pos[0]);
965 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[1], &pos[1]);
966 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[2], &pos[2]);
967 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[3], &pos[3]);
968 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[4], &pos[4]);
969 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[5], &pos[5]);
970 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[6], &pos[6]);
971 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[7], &pos[7]);
972 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[0], &g3p[1]);
973 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[1], &g3p[2]);
974 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[2], &g3p[3]);
975 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[3], &g3p[0]);
976 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[0], &g3p[4]);
977 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[1], &g3p[5]);
978 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[2], &g3p[6]);
979 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[3], &g3p[7]);
980 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[4], &g3p[5]);
981 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[5], &g3p[6]);
982 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[6], &g3p[7]);
983 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(c1, &g3p[7], &g3p[4]);
984 DrawNumbercxx . . $ DrawNumber(4a460ce01c7ad9de).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), obj->poscxx . . $ object#pos., 1.0, GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255));
985
986 if (!OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) {
987 if (obj->roomnumcxx . . $ object#roomnum. != Player_objectcxx . . $ Player_object.->roomnumcxx . . $ object#roomnum.)
988 c1 = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 0, 0);
989 else
990 c1 = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
991 DrawNumbercxx . . $ DrawNumber(4a460ce01c7ad9de).(obj->roomnumcxx . . $ object#roomnum., obj->max_xyzcxx . . $ object#max_xyz., 0.50, c1);
992 }
993 }
994 #endif
995 // Draw a shard
996 void DrawShardObjectcxx . . $ DrawShardObject(419c470199a90a97).(objectcxx . . $ object# *obj) {
997 shard_info_scxx . . $ shard_info_s# *si = &obj->rtypecxx . . $ object#rtype..shard_infocxx . . $ object#$anonymous_type_10#shard_info.;
998 bool flip = 0;
999 g3Pointcxx . . $ g3Point# rotated_points[3];
1000 g3Pointcxx . . $ g3Point# *pointlist[3];
1001 uint8_tcxx . . $ uint8_t# codes_and = 0xff;
1002 g3_StartInstanceMatrixcxx . . $ g3_StartInstanceMatrix(bc315f98e1febb02).(&obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient.);
1003 // Build list of points and UVLs for this face
1004 for (int i = 0; i < 3; i++) {
1005 uint8_tcxx . . $ uint8_t# c;
1006 g3Pointcxx . . $ g3Point# *p = &rotated_points[i];
1007 c = g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(p, &si->pointscxx . . $ shard_info_s#points.[i]);
1008 codes_and &= c;
1009 p->p3_uvlcxx . . $ g3Point#p3_uvl..ucxx . . $ g3UVL#u. = si->ucxx . . $ shard_info_s#u.[i];
1010 p->p3_uvlcxx . . $ g3Point#p3_uvl..vcxx . . $ g3UVL#v. = si->vcxx . . $ shard_info_s#v.[i];
1011 p->p3_uvlcxx . . $ g3Point#p3_uvl..acxx . . $ g3UVL#a. = 1.0; // GameTextures[si->tmap].alpha;
1012 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!; // + PF_L; // + PF_UV2 + PF_RGBA; //has uv and l set
1013 p->p3_uvlcxx . . $ g3Point#p3_uvl..lcxx . . $ g3UVL#$anonymous_type_0#l. = 1.0;
1014 pointlist[i] = &rotated_points[i];
1015 }
1016 // Check for backside
1017 if (!g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(&obj->poscxx . . $ object#pos., &si->normalcxx . . $ shard_info_s#normal.)) {
1018 g3Pointcxx . . $ g3Point# *t = pointlist[1];
1019 pointlist[1] = pointlist[2];
1020 pointlist[2] = t;
1021 }
1022 // Done with 3D
1023 g3_DoneInstancecxx . . $ g3_DoneInstance(49f6e7a06ebc5aa8).();
1024 // Check if face off screen
1025 if (codes_and)
1026 return;
1027 // Get bitmap handle
1028 int bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(si->tmapcxx . . $ shard_info_s#tmap., 0);
1029 ASSERTcxx . . $ `misc/pserror.h:246:9`!(bm_handle != -1);
1030 float alpha = GameTexturescxx . . $ GameTextures.[si->tmapcxx . . $ shard_info_s#tmap.].alphacxx . . $ texture#alpha.;
1031 alpha = 0.2 + alpha * 0.8; // Make less transparent
1032 // Set alpha, transparency, & lighting for this face
1033 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`!);
1034 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha * 255);
1035 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
1036 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
1037 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
1038 // Select texture type
1039 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
1040 // Draw the polygon
1041 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(3, pointlist, bm_handle);
1042 }
1043 // Sets up the light states for an outdoor object to be rendered
1044 bool SetupTerrainObjectcxx . . $ SetupTerrainObject(39516aeee13ca5ab).(objectcxx . . $ object# *obj) {
1045 vectorcxx . . $ vector# camlight = Terrain_skycxx . . $ Terrain_sky..lightsourcecxx . . $ terrain_sky#lightsource.;
1046 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&camlight);
1047 #ifdef EDITOR
1048 if (!Terrain_render_ext_room_objs)
1049 return false;
1050 #endif
1051
1052 obj->flagscxx . . $ object#flags. |= OF_SAFE_TO_RENDERcxx . . $ `Descent3/object_external.h:277:9`!;
1053 RenderObject_SetLightDirectioncxx . . $ RenderObject_SetLightDirection(ec8cf6451c36d470).(&camlight);
1054 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
1055 if (obj->render_typecxx . . $ object#render_type. == RT_POLYOBJcxx . . $ `Descent3/object_external.h:258:9`! ||
1056 (obj->render_typecxx . . $ object#render_type. == RT_WEAPONcxx . . $ `Descent3/object_external.h:260:9`! &&
1057 !((Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_IMAGE_BITMAPcxx . . $ `Descent3/weapon.h:219:9`!) || (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_IMAGE_VCLIPcxx . . $ `Descent3/weapon.h:223:9`!)))) {
1058 float scalar_r, scalar_g, scalar_b, scalar;
1059 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) {
1060 scalar = 1.0;
1061 scalar_r = 1.0;
1062 scalar_g = 1.0;
1063 scalar_b = 1.0;
1064 } else {
1065 scalar = GetTerrainDynamicScalarcxx . . $ GetTerrainDynamicScalar(bdb4036c8ebf1af).(&obj->poscxx . . $ object#pos., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum));
1066 if (obj->effect_infocxx . . $ object#effect_info. && (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VOLUME_LITcxx . . $ `Descent3/object_external.h:201:9`!)) {
1067 scalar_r = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar + (obj->effect_infocxx . . $ object#effect_info.->dynamic_redcxx . . $ effect_info_s#dynamic_red.));
1068 scalar_g = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar + (obj->effect_infocxx . . $ object#effect_info.->dynamic_greencxx . . $ effect_info_s#dynamic_green.));
1069 scalar_b = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar + (obj->effect_infocxx . . $ object#effect_info.->dynamic_bluecxx . . $ effect_info_s#dynamic_blue.));
1070 // If this is a robot, make it at least 10% for each RGB component
1071 if (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) {
1072 scalar_r = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<float>(.1, scalar_r);
1073 scalar_g = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<float>(.1, scalar_g);
1074 scalar_b = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<float>(.1, scalar_b);
1075 }
1076 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && ((Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!) ||
1077 ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_BRIGHT_PLAYERScxx . . $ `Descent3/multi_external.h:238:9`!)))) {
1078 scalar_r = 1;
1079 scalar_g = 1;
1080 scalar_b = 1;
1081 }
1082 } else {
1083 scalar_r = scalar;
1084 scalar_g = scalar;
1085 scalar_b = scalar;
1086 }
1087 }
1088
1089 if (obj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_STATICcxx . . $ `Descent3/object.h:649:9`! || Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].new_stylecxx . . $ poly_model#new_style. == 0)
1090 RenderObject_SetStaticcxx . . $ RenderObject_SetStatic(bd1040fe176e0786).(scalar_r, scalar_g, scalar_b);
1091 else if (obj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_GOURAUDcxx . . $ `Descent3/object.h:650:9`! || NoLightmapscxx . . $ NoLightmaps.) {
1092 vectorcxx . . $ vector# lightdir = {0, -1.0, 0}; // straight down for now
1093 RenderObject_SetGouraudcxx . . $ RenderObject_SetGouraud(3eea5de0da32321b).(&lightdir, scalar_r, scalar_g, scalar_b, scalar);
1094 } else if (obj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) {
1095 if (obj->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used. == 0)
1096 RenderObject_SetStaticcxx . . $ RenderObject_SetStatic(bd1040fe176e0786).(scalar_r, scalar_g, scalar_b);
1097 else
1098 RenderObject_SetLightmapscxx . . $ RenderObject_SetLightmaps(589ec6a7871cb4e1).(&obj->lm_objectcxx . . $ object#lm_object.);
1099 }
1100 } else {
1101 RenderObject_SetStaticcxx . . $ RenderObject_SetStatic(bd1040fe176e0786).(1, 1, 1);
1102 }
1103 return true;
1104 }
1105 // Sets up the light states for an indoor object to be rendered
1106 bool SetupMineObjectcxx . . $ SetupMineObject(39516aeee13ca5ab).(objectcxx . . $ object# *objp) {
1107 if (objp->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_STATICcxx . . $ `Descent3/object.h:649:9`! || Poly_modelscxx . . $ Poly_models.[objp->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].new_stylecxx . . $ poly_model#new_style. == 0) {
1108 RenderObject_SetStaticcxx . . $ RenderObject_SetStatic(bd1040fe176e0786).(1.0f, 1.0f, 1.0f);
1109 } else if (objp->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_GOURAUDcxx . . $ `Descent3/object.h:650:9`! || NoLightmapscxx . . $ NoLightmaps.) {
1110 float scalar_r = 1.0, scalar_g = 1.0, scalar_b = 1.0;
1111
1112 vectorcxx . . $ vector# lightdir = {0, -1.0, 0}; // straight down for now
1113
1114 // Get the volume light for this object
1115 if (objp->effect_infocxx . . $ object#effect_info. && (objp->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VOLUME_LITcxx . . $ `Descent3/object_external.h:201:9`!) &&
1116 !(Roomscxx . . $ Rooms.[objp->roomnumcxx . . $ object#roomnum.].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!)) {
1117 vectorcxx . . $ vector# vpos = objp->poscxx . . $ object#pos.;
1118 if (Render_mirror_for_roomcxx . . $ Render_mirror_for_room.)
1119 vpos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). objp->last_poscxx . . $ object#last_pos.;
1120 if (objp->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VOLUME_CHANGINGcxx . . $ `Descent3/object_external.h:202:9`!) {
1121 float old_r, old_g, old_b;
1122 float new_r, new_g, new_b;
1123 GetRoomDynamicScalarcxx . . $ GetRoomDynamicScalar(93b972edae6e455f).(&objp->effect_infocxx . . $ object#effect_info.->volume_old_poscxx . . $ effect_info_s#volume_old_pos., &Roomscxx . . $ Rooms.[objp->effect_infocxx . . $ object#effect_info.->volume_old_roomcxx . . $ effect_info_s#volume_old_room.], &old_r,
1124 &old_g, &old_b);
1125 GetRoomDynamicScalarcxx . . $ GetRoomDynamicScalar(93b972edae6e455f).(&vpos, &Roomscxx . . $ Rooms.[objp->roomnumcxx . . $ object#roomnum.], &new_r, &new_g, &new_b);
1126 scalar_r =
1127 (old_r * objp->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time.) + ((1 - objp->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time.) * new_r);
1128 scalar_g =
1129 (old_g * objp->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time.) + ((1 - objp->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time.) * new_g);
1130 scalar_b =
1131 (old_b * objp->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time.) + ((1 - objp->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time.) * new_b);
1132 } else
1133 GetRoomDynamicScalarcxx . . $ GetRoomDynamicScalar(93b972edae6e455f).(&vpos, &Roomscxx . . $ Rooms.[objp->roomnumcxx . . $ object#roomnum.], &scalar_r, &scalar_g, &scalar_b);
1134
1135 scalar_r = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar_r + (objp->effect_infocxx . . $ object#effect_info.->dynamic_redcxx . . $ effect_info_s#dynamic_red.));
1136 scalar_g = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar_g + (objp->effect_infocxx . . $ object#effect_info.->dynamic_greencxx . . $ effect_info_s#dynamic_green.));
1137 scalar_b = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar_b + (objp->effect_infocxx . . $ object#effect_info.->dynamic_bluecxx . . $ effect_info_s#dynamic_blue.));
1138 // If this is a robot, make it at least 10% for each RGB component
1139 if (objp->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) {
1140 scalar_r = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<float>(.1, scalar_r);
1141 scalar_g = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<float>(.1, scalar_g);
1142 scalar_b = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<float>(.1, scalar_b);
1143 }
1144
1145 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
1146 if (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_BRIGHT_PLAYERScxx . . $ `Descent3/multi_external.h:238:9`!) {
1147 scalar_r = 1;
1148 scalar_g = 1;
1149 scalar_b = 1;
1150 } else {
1151 // Make this ship brighter based on its speed
1152 float speed_norm;
1153 speed_norm = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.) / 20.0, 1);
1154 speed_norm *= 1;
1155 speed_norm += 1;
1156 scalar_r = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar_r * speed_norm);
1157 scalar_g = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar_g * speed_norm);
1158 scalar_b = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(1, scalar_b * speed_norm);
1159 }
1160 }
1161 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!)) {
1162 scalar_r = 1;
1163 scalar_g = 1;
1164 scalar_b = 1;
1165 }
1166 }
1167 RenderObject_SetGouraudcxx . . $ RenderObject_SetGouraud(3eea5de0da32321b).(&lightdir, scalar_r, scalar_g, scalar_b);
1168 } else if (objp->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) {
1169 if (objp->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used. == 0)
1170 RenderObject_SetStaticcxx . . $ RenderObject_SetStatic(bd1040fe176e0786).(1.0f, 1.0f, 1.0f);
1171 else
1172 RenderObject_SetLightmapscxx . . $ RenderObject_SetLightmaps(589ec6a7871cb4e1).(&objp->lm_objectcxx . . $ object#lm_object.);
1173 }
1174 return true;
1175 }
1176
1177 bool GetLinearPositioncxx . . $ GetLinearPosition(8d380eed63fea9a2).(vectorcxx . . $ vector# *points, float *times, int num_points, float t, vectorcxx . . $ vector# *pos) {
1178 // find between which points is the time
1179 int min_point;
1180 for (min_point = 0; min_point < num_points - 1; min_point++) {
1181 if (times[min_point] <= t && t <= times[min_point + 1]) {
1182 break;
1183 }
1184 }
1185 if (min_point == (num_points - 1))
1186 return false;
1187 ASSERTcxx . . $ `misc/pserror.h:246:9`!(times[min_point] <= t && t <= times[min_point + 1]);
1188
1189 t -= times[min_point];
1190 float d = times[min_point + 1] - times[min_point];
1191 float newt = t / d;
1192
1193 vectorcxx . . $ vector# vd;
1194 float mag;
1195 vd =cxx . . $ vector#`operator=`(c0842353a20857d). points[min_point + 1] -cxx . . $ operator-(b77b703cd1e43e33). points[min_point];
1196 mag = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&vd);
1197 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&vd);
1198 vd *=cxx . . $ `operator*=`(f132838b2cd11d6). (mag * newt);
1199
1200 *pos =cxx . . $ vector#`operator=`(c0842353a20857d). points[min_point] +cxx . . $ operator+(b77b703cd1e43e33). vd;
1201 return true;
1202 }
1203
1204 // -----------------------------------------------------------------------------
1205 // Render an object. Calls one of several routines based on type
1206 void RenderObjectcxx . . $ RenderObject(419c470199a90a97).(objectcxx . . $ object# *obj) {
1207 float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
1208 bool render_it = false;
1209 if (obj->typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
1210 mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "ERROR!!!! Bogus obj %d in room %d is rendering!\n", OBJNUM(obj), obj->roomnum);
1211 Int3cxx . . $ `misc/pserror.h:247:9`!();
1212 return;
1213 }
1214 if (obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!)
1215 return;
1216 if (obj->flagscxx . . $ object#flags. & OF_ATTACHEDcxx . . $ `Descent3/object_external.h:273:9`!) {
1217 // See if we should be rendered, because our attach parent might be invisible
1218 objectcxx . . $ object# *parent_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_ultimate_handlecxx . . $ object#attach_ultimate_handle.);
1219 if (!parent_obj)
1220 return;
1221 if (parent_obj->render_typecxx . . $ object#render_type. == RT_NONEcxx . . $ `Descent3/object_external.h:257:9`! && parent_obj->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! &&
1222 (parent_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || parent_obj->movement_typecxx . . $ object#movement_type. != MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!))
1223 return;
1224 }
1225 if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj))
1226 render_it = SetupTerrainObjectcxx . . $ SetupTerrainObject(39516aeee13ca5ab).(obj);
1227 else
1228 render_it = SetupMineObjectcxx . . $ SetupMineObject(39516aeee13ca5ab).(obj);
1229 if (!render_it)
1230 return;
1231 if (!(obj->flagscxx . . $ object#flags. & OF_SAFE_TO_RENDERcxx . . $ `Descent3/object_external.h:277:9`!))
1232 return;
1233 // Mark this a rendered this frame
1234 obj->flagscxx . . $ object#flags. |= OF_RENDEREDcxx . . $ `Descent3/object_external.h:285:9`!;
1235 // If we're not rendering from a mirror, mark this object as rendered
1236 if (Render_mirror_for_roomcxx . . $ Render_mirror_for_room. == false)
1237 obj->flagscxx . . $ object#flags. &= ~OF_SAFE_TO_RENDERcxx . . $ `Descent3/object_external.h:277:9`!;
1238 obj->renderframecxx . . $ object#renderframe. = FrameCountcxx . . $ FrameCount. % 65536;
1239 if (obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! && (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == GAME_MODEcxx . . $ GAME_MODE. || GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == EDITOR_GAME_MODEcxx . . $ EDITOR_GAME_MODE.)) {
1240 AI_RenderedListcxx . . $ AI_RenderedList.[AI_NumRenderedcxx . . $ AI_NumRendered.] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
1241 AI_NumRenderedcxx . . $ AI_NumRendered. += 1;
1242 }
1243 #ifdef EDITOR
1244 ddgr_color oldcolor;
1245 if (TSearch_on && obj->type != OBJ_ROOM) {
1246 rend_SetPixel(GR_RGB(16, 255, 64), TSearch_x, TSearch_y);
1247 oldcolor = rend_GetPixel(TSearch_x, TSearch_y); // will be different in 15/16-bit color
1248 }
1249 #endif
1250 switch (obj->render_typecxx . . $ object#render_type.) {
1251 case RT_NONEcxx . . $ `Descent3/object_external.h:257:9`!:
1252 break;
1253 case RT_EDITOR_SPHEREcxx . . $ `Descent3/object_external.h:265:9`!: // to render objects in editor mode
1254 #ifdef EDITOR
1255 if ((GetFunctionMode() == EDITOR_MODE)) { // only render if in editor mode
1256 if (!UseHardware) {
1257 g3Point sphere_point;
1258 g3_RotatePoint(&sphere_point, &obj->pos);
1259 g3_DrawSphere(obj->rtype.sphere_color, &sphere_point, obj->size);
1260 } else {
1261 // Let me take this opportunity to say how much it pisses me off that
1262 // the DrawColoredDisk() function takes r,g,b as floats, when the standard
1263 // in our graphics system is to pass color as a ddgr_color
1264 float r = (float)GR_COLOR_RED(obj->rtype.sphere_color) / 255.0,
1265 g = (float)GR_COLOR_GREEN(obj->rtype.sphere_color) / 255.0,
1266 b = (float)GR_COLOR_BLUE(obj->rtype.sphere_color) / 255.0;
1267 DrawColoredDisk(&obj->pos, r, g, b, 1, 1, obj->size, 0);
1268 }
1269 }
1270 #endif
1271 break;
1272 case RT_POLYOBJcxx . . $ `Descent3/object_external.h:258:9`!:
1273 #ifdef EDITOR
1274 if ((GetFunctionMode() == EDITOR_MODE) && (obj - Objects == Cur_object_index))
1275 DrawObjectSelectionBrackets(obj, 0); // draw back brackets
1276 #endif
1277 if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. || (Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].frame_maxcxx . . $ poly_model#frame_max. !=
1278 Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].frame_mincxx . . $ poly_model#frame_min.)) {
1279 SetNormalizedTimeObjcxx . . $ SetNormalizedTimeObj(8af4de573afdac78).(obj, normalized_time);
1280 RenderObject_DrawPolymodelcxx . . $ RenderObject_DrawPolymodel(8af4de573afdac78).(obj, normalized_time);
1281 } else {
1282 RenderObject_DrawPolymodelcxx . . $ RenderObject_DrawPolymodel(8af4de573afdac78).(obj, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1283 }
1284
1285 ////////////////////////////////////////////
1286 /////////////MOTION BLUR////////////////////
1287 if (Use_motion_blurcxx . . $ Use_motion_blur. && (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!) &&
1288 Object_map_position_historycxx . . $ Object_map_position_history.[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)] != -1) {
1289 float vel_mag; // velocity magnitude
1290 float sphere_size_perc = 0.20f; // percentage of object size
1291 float AFT = 1.0f / 20.0f; // Assumed frame time
1292 int num_iterations; // number of iterations
1293
1294 vel_mag = fabscxx . . $ fabs(fbcf3211dfe1bfd1).(vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.));
1295 num_iterations = (vel_mag * AFT) / (sphere_size_perc * obj->sizecxx . . $ object#size.);
1296
1297 if (num_iterations > 12)
1298 num_iterations = 12;
1299
1300 if (num_iterations >= 1) {
1301 vectorcxx . . $ vector# saved_pos;
1302 float saved_alpha_fac;
1303 vectorcxx . . $ vector# positions[MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`! + 1];
1304 float times[MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`! + 1];
1305
1306 // save the position of the object, because we'll have to restore it
1307 saved_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1308 saved_alpha_fac = rend_GetAlphaFactorcxx . . $ rend_GetAlphaFactor(9b8c9e39889c762c).();
1309
1310 int pos_slot = Object_map_position_historycxx . . $ Object_map_position_history.[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)];
1311 int i, c_pos = Object_position_headcxx . . $ Object_position_head.;
1312
1313 // fill in the positions, starting with our current one
1314 for (i = 0; i < MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`! + 1; i++) {
1315 if (i == 0) {
1316 positions[i] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1317 times[i] = 0;
1318 } else {
1319 positions[i] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Object_position_samplescxx . . $ Object_position_samples.[pos_slot].poscxx . . $ tPosHistory#pos.[c_pos];
1320 times[i] = Gametimecxx . . $ Gametime. - Last_position_history_updatecxx . . $ Last_position_history_update.[c_pos];
1321 c_pos++;
1322 c_pos = c_pos % MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`!;
1323 }
1324 }
1325
1326 float t_interval; // time interval
1327 float alpha_step; // opacity stepping
1328 float total_time; // total time of samples
1329
1330 t_interval = AFT / ((float)num_iterations + 1);
1331 alpha_step = 1.0f / (num_iterations + 1);
1332 total_time = times[MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`!] - times[0];
1333 ASSERTcxx . . $ `misc/pserror.h:246:9`!(total_time > 0);
1334
1335 float curr_alpha = 1.0f - alpha_step;
1336 float curr_t = t_interval;
1337 float full_time = AFT / total_time; // how much of the interval we want to go across
1338
1339 for (i = 0; i < num_iterations; i++) {
1340 if (!GetLinearPositioncxx . . $ GetLinearPosition(8d380eed63fea9a2).(positions, times, MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`! + 1, curr_t, &obj->poscxx . . $ object#pos.))
1341 break;
1342
1343 rend_SetAlphaFactorcxx . . $ rend_SetAlphaFactor(9364e6e7bff7660).(curr_alpha);
1344
1345 // render the iteration
1346 if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. || (Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].frame_maxcxx . . $ poly_model#frame_max. !=
1347 Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].frame_mincxx . . $ poly_model#frame_min.)) {
1348 RenderObject_DrawPolymodelcxx . . $ RenderObject_DrawPolymodel(8af4de573afdac78).(obj, normalized_time);
1349 } else {
1350 RenderObject_DrawPolymodelcxx . . $ RenderObject_DrawPolymodel(8af4de573afdac78).(obj, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1351 }
1352
1353 // update
1354 curr_alpha -= alpha_step;
1355 curr_t += t_interval;
1356 }
1357
1358 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). saved_pos;
1359 rend_SetAlphaFactorcxx . . $ rend_SetAlphaFactor(9364e6e7bff7660).(saved_alpha_fac);
1360 }
1361 }
1362 ////////////////////////////////////////////
1363
1364 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1365 if (Game_show_spherecxx . . $ Game_show_sphere.) {
1366 DrawDebugInfocxx . . $ DrawDebugInfo(419c470199a90a97).(obj);
1367 }
1368 #endif
1369
1370 // Render that powerup glow
1371 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) {
1372 DrawPowerupGlowDiskcxx . . $ DrawPowerupGlowDisk(419c470199a90a97).(obj);
1373 DrawPowerupSparklescxx . . $ DrawPowerupSparkles(419c470199a90a97).(obj);
1374 }
1375
1376 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1377 DrawPlayerDamageDiskcxx . . $ DrawPlayerDamageDisk(419c470199a90a97).(obj);
1378 DrawPlayerRotatingBallcxx . . $ DrawPlayerRotatingBall(419c470199a90a97).(obj);
1379 DrawPlayerNameOnHudcxx . . $ DrawPlayerNameOnHud(419c470199a90a97).(obj);
1380 DrawPlayerTypingIndicatorcxx . . $ DrawPlayerTypingIndicator(419c470199a90a97).(obj);
1381 DrawPlayerInvulSpherecxx . . $ DrawPlayerInvulSphere(419c470199a90a97).(obj);
1382 }
1383 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || (obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && obj->ai_infocxx . . $ object#ai_info.)) {
1384 DrawSparkyDamageLightningcxx . . $ DrawSparkyDamageLightning(419c470199a90a97).(obj);
1385 DrawVirusLightningcxx . . $ DrawVirusLightning(419c470199a90a97).(obj);
1386 }
1387
1388 break;
1389 case RT_FIREBALLcxx . . $ `Descent3/object_external.h:259:9`!:
1390 DrawFireballObjectcxx . . $ DrawFireballObject(419c470199a90a97).(obj);
1391 break;
1392 case RT_WEAPONcxx . . $ `Descent3/object_external.h:260:9`!:
1393 DrawWeaponObjectcxx . . $ DrawWeaponObject(419c470199a90a97).(obj);
1394
1395 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1396 if (Game_show_spherecxx . . $ Game_show_sphere.) {
1397 DrawDebugInfocxx . . $ DrawDebugInfo(419c470199a90a97).(obj);
1398 }
1399 #endif
1400 break;
1401 case RT_SPLINTERcxx . . $ `Descent3/object_external.h:263:9`!:
1402 DrawSplinterObjectcxx . . $ DrawSplinterObject(419c470199a90a97).(obj);
1403 break;
1404 case RT_SHARDcxx . . $ `Descent3/object_external.h:266:9`!:
1405 DrawShardObjectcxx . . $ DrawShardObject(419c470199a90a97).(obj);
1406 break;
1407 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1408 case RT_LINEcxx . . $ `Descent3/object_external.h:261:9`!: {
1409 g3Pointcxx . . $ g3Point# g3p[2];
1410 memset(g3p, 0, 2 * sizeof(g3Pointcxx . . $ g3Point#));
1411 // g3p[0].p3_vec = obj->pos;
1412 // g3p[1].p3_vec = obj->rtype.line_info.end_pos;
1413
1414 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[0], &obj->poscxx . . $ object#pos.);
1415 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&g3p[1], &obj->rtypecxx . . $ object#rtype..line_infocxx . . $ object#$anonymous_type_10#line_info..end_poscxx . . $ line_info_s#end_pos.);
1416 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255), &g3p[0], &g3p[1]);
1417 break;
1418 }
1419 #endif
1420 default:
1421 Errorcxx . . $ Error(326aeb464d16410c).("Unknown render_type <%d>", obj->render_typecxx . . $ object#render_type.);
1422 }
1423 #ifdef NEWDEMO
1424 if (obj->render_type != RT_NONE)
1425 if (Newdemo_state == ND_STATE_RECORDING) {
1426 if (!WasRecorded[obj - Objects]) {
1427 newdemo_record_RenderObject(obj);
1428 WasRecorded[obj - Objects] = 1;
1429 }
1430 }
1431 #endif
1432 //?? Max_linear_depth = mld_save;
1433 // Mark selected objects
1434 #ifdef EDITOR
1435 if ((GetFunctionMode() == EDITOR_MODE) && (obj - Objects == Cur_object_index)) {
1436 if (obj->render_type != RT_POLYOBJ) {
1437 g3Point pnt;
1438 g3_RotatePoint(&pnt, &obj->pos);
1439 g3_DrawBox(GR_RGB(255, 255, 255), &pnt, obj->size);
1440 } else { // polygon model
1441 DrawObjectSelectionBrackets(obj, 1); // draw front brackets
1442 }
1443 }
1444 #endif // ifdef EDITOR
1445 #ifdef EDITOR
1446 if (TSearch_on) {
1447 if (rend_GetPixel(TSearch_x, TSearch_y) != oldcolor) {
1448 TSearch_found_type = TSEARCH_FOUND_OBJECT;
1449 TSearch_seg = obj - Objects;
1450 mprintf(0, "TR:objnum=%d\n", obj - Objects);
1451 }
1452 }
1453 #endif
1454 }
1455 // Sets the polygon render object type to static (one lightval for whole object)
1456 void RenderObject_SetStaticcxx . . $ RenderObject_SetStatic(bd1040fe176e0786).(float r, float g, float b) {
1457 RenderObjectTypecxx . . $ RenderObjectType. = RO_STATICcxx . . $ `Descent3/renderobject.cpp:623:9`!;
1458 RenderObjectStaticRedValuecxx . . $ RenderObjectStaticRedValue. = r;
1459 RenderObjectStaticGreenValuecxx . . $ RenderObjectStaticGreenValue. = g;
1460 RenderObjectStaticBlueValuecxx . . $ RenderObjectStaticBlueValue. = b;
1461 RenderObjectStaticScalarcxx . . $ RenderObjectStaticScalar. = 1.0;
1462 }
1463 // Sets the polygon render object type to gouraud (one lightval for each vertex)
1464 void RenderObject_SetGouraudcxx . . $ RenderObject_SetGouraud(3eea5de0da32321b).(vectorcxx . . $ vector# *dir, float r, float g, float b, float scalar) {
1465 RenderObject_LightDirectioncxx . . $ RenderObject_LightDirection. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *dir;
1466 RenderObjectStaticRedValuecxx . . $ RenderObjectStaticRedValue. = r;
1467 RenderObjectStaticGreenValuecxx . . $ RenderObjectStaticGreenValue. = g;
1468 RenderObjectStaticBlueValuecxx . . $ RenderObjectStaticBlueValue. = b;
1469 RenderObjectStaticScalarcxx . . $ RenderObjectStaticScalar. = scalar;
1470 RenderObjectTypecxx . . $ RenderObjectType. = RO_GOURAUDcxx . . $ `Descent3/renderobject.cpp:624:9`!;
1471 }
1472 // Sets the object render to draw a polymodel with lightmaps applied
1473 void RenderObject_SetLightmapscxx . . $ RenderObject_SetLightmaps(589ec6a7871cb4e1).(lightmap_objectcxx . . $ lightmap_object# *lmobject) {
1474 ASSERTcxx . . $ `misc/pserror.h:246:9`!(lmobject->used);
1475 RenderObjectTypecxx . . $ RenderObjectType. = RO_LIGHTMAPScxx . . $ `Descent3/renderobject.cpp:625:9`!;
1476 RenderObjectLightmapObjectcxx . . $ RenderObjectLightmapObject. = lmobject;
1477 }
1478
1479 ddgr_colorcxx . . $ ddgr_color# Player_colorscxx . . $ Player_colors.[] = {
1480 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 0, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 32, 255), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(32, 64, 96),
1481 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 0, 255), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 128, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 128, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 32, 128),
1482 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 128, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 0, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 0, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 255), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 128, 255),
1483 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 128, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 64, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 0, 255), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 64, 0),
1484 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 255, 0), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 0, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(64, 64, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 64, 64), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 192, 128),
1485 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 128), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 64), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(64, 128, 64), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 0, 64), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 192, 0),
1486 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255), GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 128)};
1487
1488 bool is_multi_democxx . . $ is_multi_demo. = false;
1489
1490 // Actually draws a polygon model based on the light parameters set by the above
1491 // functions
1492 void RenderObject_DrawPolymodelcxx . . $ RenderObject_DrawPolymodel(8af4de573afdac78).(objectcxx . . $ object# *obj, float *normalized_times) {
1493 int model_num;
1494 int use_effect = 0;
1495 vectorcxx . . $ vector# obj_pos = obj->poscxx . . $ object#pos.;
1496 polymodel_effectcxx . . $ polymodel_effect# pe = {0};
1497
1498 // Do cloak effect on player
1499 if (UseHardwarecxx . . $ UseHardware.) {
1500 if (obj->effect_infocxx . . $ object#effect_info. && (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FADING_OUTcxx . . $ `Descent3/object_external.h:207:9`!)) {
1501 pe.typecxx . . $ polymodel_effect#type. = PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`!;
1502 pe.alphacxx . . $ polymodel_effect#alpha. = .08 + (.92 * (obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. / obj->effect_infocxx . . $ object#effect_info.->fade_max_timecxx . . $ effect_info_s#fade_max_time.));
1503 use_effect = 1;
1504 }
1505 if (obj->effect_infocxx . . $ object#effect_info. && (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FADING_INcxx . . $ `Descent3/object_external.h:206:9`!)) {
1506 pe.typecxx . . $ polymodel_effect#type. = PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`!;
1507 pe.alphacxx . . $ polymodel_effect#alpha. = .08 + (.92 * (1.0 - (obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. / obj->effect_infocxx . . $ object#effect_info.->fade_max_timecxx . . $ effect_info_s#fade_max_time.)));
1508 use_effect = 1;
1509 }
1510 if (obj->effect_infocxx . . $ object#effect_info. && (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)) {
1511 pe.typecxx . . $ polymodel_effect#type. = PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`! | PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!;
1512 pe.alphacxx . . $ polymodel_effect#alpha. = .13f;
1513 pe.deform_rangecxx . . $ polymodel_effect#deform_range. = .1f;
1514
1515 use_effect = 1;
1516 }
1517 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1518 // Draw thrust/afterburner cooler
1519 pe.typecxx . . $ polymodel_effect#type. |= PEF_GLOW_SCALARcxx . . $ `lib/polymodel_external.h:298:9`!;
1520 pe.glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar. = (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].thrust_magcxx . . $ player#thrust_mag.);
1521 pe.glow_size_scalarcxx . . $ polymodel_effect#glow_size_scalar. = (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].thrust_magcxx . . $ player#thrust_mag.);
1522
1523 pe.glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar. += (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].afterburner_magcxx . . $ player#afterburner_mag. * 3);
1524 pe.glow_size_scalarcxx . . $ polymodel_effect#glow_size_scalar. += (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].afterburner_magcxx . . $ player#afterburner_mag. * .5);
1525 float adjustment = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100 - 50);
1526 adjustment /= 50.0;
1527 pe.glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar. += (.2 * adjustment);
1528
1529 use_effect = 1;
1530 // Make Katmai glows longer
1531 if (Katmaicxx . . $ Katmai.) {
1532 pe.glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar. *= 1.5;
1533 }
1534 // hack to make multiplayer demos work!
1535 if (is_multi_democxx . . $ is_multi_demo. || (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
1536 if (Num_teamscxx . . $ Num_teams. > 1) {
1537 int teamnum = PlayerGetTeamcxx . . $ PlayerGetTeam(7864480464b09eea).(obj->idcxx . . $ object#id.);
1538
1539 pe.typecxx . . $ polymodel_effect#type. |= PEF_CUSTOM_COLORcxx . . $ `lib/polymodel_external.h:293:9`! | PEF_CUSTOM_GLOWcxx . . $ `lib/polymodel_external.h:302:9`!;
1540 pe.custom_colorcxx . . $ polymodel_effect#custom_color. = Player_colorscxx . . $ Player_colors.[teamnum];
1541 pe.glow_rcxx . . $ polymodel_effect#glow_r. = GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(pe.custom_colorcxx . . $ polymodel_effect#custom_color.) / 255.0;
1542 pe.glow_gcxx . . $ polymodel_effect#glow_g. = GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(pe.custom_colorcxx . . $ polymodel_effect#custom_color.) / 255.0;
1543 pe.glow_bcxx . . $ polymodel_effect#glow_b. = GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(pe.custom_colorcxx . . $ polymodel_effect#custom_color.) / 255.0;
1544
1545 use_effect = 1;
1546 } else {
1547 pe.typecxx . . $ polymodel_effect#type. |= PEF_CUSTOM_COLORcxx . . $ `lib/polymodel_external.h:293:9`!;
1548 pe.custom_colorcxx . . $ polymodel_effect#custom_color. = Player_colorscxx . . $ Player_colors.[obj->idcxx . . $ object#id.];
1549
1550 use_effect = 1;
1551 }
1552 if (Multi_logo_statecxx . . $ Multi_logo_state. && GameTexturescxx . . $ GameTextures.[Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].custom_texture_handlecxx . . $ player#custom_texture_handle.].bm_handlecxx . . $ texture#bm_handle. != 0) {
1553 pe.typecxx . . $ polymodel_effect#type. |= PEF_CUSTOM_TEXTUREcxx . . $ `lib/polymodel_external.h:294:9`!;
1554
1555 pe.custom_texturecxx . . $ polymodel_effect#custom_texture. = Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].custom_texture_handlecxx . . $ player#custom_texture_handle.;
1556
1557 use_effect = 1;
1558 }
1559 }
1560 }
1561 // Deform this object if needed
1562 if (obj->effect_infocxx . . $ object#effect_info. && (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_DEFORMcxx . . $ `Descent3/object_external.h:198:9`!)) {
1563 pe.typecxx . . $ polymodel_effect#type. |= PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!;
1564 pe.deform_rangecxx . . $ polymodel_effect#deform_range. = obj->effect_infocxx . . $ object#effect_info.->deform_rangecxx . . $ effect_info_s#deform_range. * obj->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time.;
1565 float val = obj->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time.;
1566 if (val > 1)
1567 val = 1;
1568
1569 pe.typecxx . . $ polymodel_effect#type. |= PEF_COLORcxx . . $ `lib/polymodel_external.h:289:9`!;
1570 pe.rcxx . . $ polymodel_effect#r. = 1.0;
1571 pe.gcxx . . $ polymodel_effect#g. = 1 - (val / 2);
1572 pe.bcxx . . $ polymodel_effect#b. = 1 - (val / 2);
1573
1574 use_effect = 1;
1575 }
1576 // If the viewer is deformed, warp his view somewhat
1577 if (Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info. && (Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_DEFORMcxx . . $ `Descent3/object_external.h:198:9`!)) {
1578 pe.typecxx . . $ polymodel_effect#type. |= PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!;
1579 pe.deform_rangecxx . . $ polymodel_effect#deform_range. = Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info.->deform_rangecxx . . $ effect_info_s#deform_range. * Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time.;
1580 float val = Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time.;
1581 if (val > 1)
1582 val = 1;
1583
1584 use_effect = 1;
1585 // switch object position a little
1586 float moveval = 10.0 * val * Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info.->deform_rangecxx . . $ effect_info_s#deform_range.;
1587 obj_pos.xcxx . . $ vector#x. += (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * moveval;
1588 obj_pos.ycxx . . $ vector#y. += (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * moveval;
1589 obj_pos.zcxx . . $ vector#z. += (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * moveval;
1590 }
1591 // If this is a powerup, fade it out near the end of its life
1592 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && (obj->flagscxx . . $ object#flags. & OF_USES_LIFELEFTcxx . . $ `Descent3/object_external.h:276:9`!) && obj->lifeleftcxx . . $ object#lifeleft. < 5) {
1593 pe.typecxx . . $ polymodel_effect#type. |= PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`! | PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!;
1594 pe.alphacxx . . $ polymodel_effect#alpha. = obj->lifeleftcxx . . $ object#lifeleft. / 5.0;
1595 pe.deform_rangecxx . . $ polymodel_effect#deform_range. = .2f * (1.0 - (obj->lifeleftcxx . . $ object#lifeleft. / 5.0));
1596
1597 use_effect = 1;
1598 }
1599 // Fog this object if needed
1600 if (!OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj) && (Roomscxx . . $ Rooms.[obj->roomnumcxx . . $ object#roomnum.].flagscxx . . $ room#flags. & RF_FOGcxx . . $ `Descent3/room_external.h:184:9`!) && Room_fog_plane_checkcxx . . $ Room_fog_plane_check. != -1) {
1601 pe.typecxx . . $ polymodel_effect#type. |= PEF_FOGGED_MODELcxx . . $ `lib/polymodel_external.h:295:9`!;
1602 pe.fog_distancecxx . . $ polymodel_effect#fog_distance. = Room_fog_distancecxx . . $ Room_fog_distance.;
1603 pe.fog_eye_distancecxx . . $ polymodel_effect#fog_eye_distance. = Room_fog_eye_distancecxx . . $ Room_fog_eye_distance.;
1604 pe.fog_plane_checkcxx . . $ polymodel_effect#fog_plane_check. = Room_fog_plane_checkcxx . . $ Room_fog_plane_check.;
1605 pe.fog_portal_vertcxx . . $ polymodel_effect#fog_portal_vert. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Room_fog_portal_vertcxx . . $ Room_fog_portal_vert.;
1606 pe.fog_planecxx . . $ polymodel_effect#fog_plane. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Room_fog_planecxx . . $ Room_fog_plane.;
1607 pe.fog_depthcxx . . $ polymodel_effect#fog_depth. = Roomscxx . . $ Rooms.[obj->roomnumcxx . . $ object#roomnum.].fog_depthcxx . . $ room#fog_depth.;
1608 pe.fog_rcxx . . $ polymodel_effect#fog_r. = Roomscxx . . $ Rooms.[obj->roomnumcxx . . $ object#roomnum.].fog_rcxx . . $ room#fog_r.;
1609 pe.fog_gcxx . . $ polymodel_effect#fog_g. = Roomscxx . . $ Rooms.[obj->roomnumcxx . . $ object#roomnum.].fog_gcxx . . $ room#fog_g.;
1610 pe.fog_bcxx . . $ polymodel_effect#fog_b. = Roomscxx . . $ Rooms.[obj->roomnumcxx . . $ object#roomnum.].fog_bcxx . . $ room#fog_b.;
1611
1612 use_effect = 1;
1613 }
1614 // Apply specularity from dynamic lights
1615 if (obj->effect_infocxx . . $ object#effect_info.) {
1616 if ((obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_SPECULARcxx . . $ `Descent3/object_external.h:205:9`!)) {
1617 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)
1618 pe.typecxx . . $ polymodel_effect#type. |= PEF_SPECULAR_MODELcxx . . $ `lib/polymodel_external.h:296:9`!;
1619 else
1620 pe.typecxx . . $ polymodel_effect#type. |= PEF_SPECULAR_FACEScxx . . $ `lib/polymodel_external.h:297:9`!;
1621
1622 pe.spec_light_poscxx . . $ polymodel_effect#spec_light_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->effect_infocxx . . $ object#effect_info.->spec_poscxx . . $ effect_info_s#spec_pos.;
1623 pe.spec_rcxx . . $ polymodel_effect#spec_r. = obj->effect_infocxx . . $ object#effect_info.->spec_rcxx . . $ effect_info_s#spec_r.;
1624 pe.spec_gcxx . . $ polymodel_effect#spec_g. = obj->effect_infocxx . . $ object#effect_info.->spec_gcxx . . $ effect_info_s#spec_g.;
1625 pe.spec_bcxx . . $ polymodel_effect#spec_b. = obj->effect_infocxx . . $ object#effect_info.->spec_bcxx . . $ effect_info_s#spec_b.;
1626 pe.spec_scalarcxx . . $ polymodel_effect#spec_scalar. = 1.0;
1627 use_effect = 1;
1628 }
1629 }
1630 // Apply specularity from outdoor satellites
1631 if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj) && obj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_GOURAUDcxx . . $ `Descent3/object.h:650:9`! && Detail_settingscxx . . $ Detail_settings..Specular_lightingcxx . . $ tDetailSettings#Specular_lighting. &&
1632 !(Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ object_info#lighting_info..flagscxx . . $ light_info#flags. & OLF_NO_SPECULARITYcxx . . $ `Descent3/object.h:677:9`!)) {
1633 if (obj->effect_infocxx . . $ object#effect_info. && !(obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_SPECULARcxx . . $ `Descent3/object_external.h:205:9`!)) {
1634 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)
1635 pe.typecxx . . $ polymodel_effect#type. |= PEF_SPECULAR_MODELcxx . . $ `lib/polymodel_external.h:296:9`!;
1636 else
1637 pe.typecxx . . $ polymodel_effect#type. |= PEF_SPECULAR_FACEScxx . . $ `lib/polymodel_external.h:297:9`!;
1638
1639 pe.spec_light_poscxx . . $ polymodel_effect#spec_light_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Terrain_skycxx . . $ Terrain_sky..satellite_vectorscxx . . $ terrain_sky#satellite_vectors.[0];
1640 pe.spec_rcxx . . $ polymodel_effect#spec_r. = 1.0;
1641 pe.spec_gcxx . . $ polymodel_effect#spec_g. = 1.0;
1642 pe.spec_bcxx . . $ polymodel_effect#spec_b. = 1.0;
1643 pe.spec_scalarcxx . . $ polymodel_effect#spec_scalar. = RenderObjectStaticScalarcxx . . $ RenderObjectStaticScalar.;
1644 use_effect = 1;
1645 }
1646 }
1647 if (Detail_settingscxx . . $ Detail_settings..Bumpmapping_enabledcxx . . $ tDetailSettings#Bumpmapping_enabled. && (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)) {
1648 pe.bump_light_poscxx . . $ polymodel_effect#bump_light_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1649 pe.bump_light_poscxx . . $ polymodel_effect#bump_light_pos..ycxx . . $ vector#y. += 100;
1650 pe.bump_scalarcxx . . $ polymodel_effect#bump_scalar. = 1;
1651 pe.typecxx . . $ polymodel_effect#type. |= PEF_BUMPMAPPEDcxx . . $ `lib/polymodel_external.h:303:9`!;
1652 use_effect = 1;
1653 }
1654 }
1655 // Pick a lod model to use if eligible
1656 if (obj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_STATICcxx . . $ `Descent3/object.h:649:9`! || obj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_GOURAUDcxx . . $ `Descent3/object.h:650:9`!) {
1657 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!) {
1658 g3Pointcxx . . $ g3Point# pnt;
1659 float detail_scalar = 1.0;
1660 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt, &obj->poscxx . . $ object#pos.);
1661 if (Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. == 0)
1662 detail_scalar = .6f;
1663 else if (Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. == 2)
1664 detail_scalar = 1.2f;
1665 if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! < (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].med_lod_distancecxx . . $ object_info#med_lod_distance. * detail_scalar))
1666 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1667 else if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! < (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].lo_lod_distancecxx . . $ object_info#lo_lod_distance. * detail_scalar)) {
1668 if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].med_render_handlecxx . . $ object_info#med_render_handle. != -1)
1669 model_num = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].med_render_handlecxx . . $ object_info#med_render_handle.;
1670 else {
1671 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1672 }
1673 } else {
1674 if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].lo_render_handlecxx . . $ object_info#lo_render_handle. != -1)
1675 model_num = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].lo_render_handlecxx . . $ object_info#lo_render_handle.;
1676 else {
1677 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1678 if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].med_render_handlecxx . . $ object_info#med_render_handle. != -1)
1679 model_num = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].med_render_handlecxx . . $ object_info#med_render_handle.;
1680 else
1681 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1682 }
1683 }
1684 } else if (obj->typecxx . . $ object#type. == OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`!) {
1685 model_num = Marker_polynumcxx . . $ Marker_polynum.;
1686 } else if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !(Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) {
1687 g3Pointcxx . . $ g3Point# pnt;
1688 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt, &obj->poscxx . . $ object#pos.);
1689 int ship_num = Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].ship_indexcxx . . $ player#ship_index.;
1690 float detail_scalar = 1.0;
1691 if (Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. == 0)
1692 detail_scalar = .6f;
1693 else if (Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. == 2)
1694 detail_scalar = 1.2f;
1695 if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! < (Shipscxx . . $ Ships.[ship_num].med_lod_distancecxx . . $ ship#med_lod_distance. * detail_scalar))
1696 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1697 else if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! < (Shipscxx . . $ Ships.[ship_num].lo_lod_distancecxx . . $ ship#lo_lod_distance. * detail_scalar)) {
1698 if (Shipscxx . . $ Ships.[ship_num].med_render_handlecxx . . $ ship#med_render_handle. != -1)
1699 model_num = Shipscxx . . $ Ships.[ship_num].med_render_handlecxx . . $ ship#med_render_handle.;
1700 else {
1701 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1702 }
1703 } else {
1704 if (Shipscxx . . $ Ships.[ship_num].lo_render_handlecxx . . $ ship#lo_render_handle. != -1)
1705 model_num = Shipscxx . . $ Ships.[ship_num].lo_render_handlecxx . . $ ship#lo_render_handle.;
1706 else {
1707 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1708 if (Shipscxx . . $ Ships.[ship_num].med_render_handlecxx . . $ ship#med_render_handle. != -1)
1709 model_num = Shipscxx . . $ Ships.[ship_num].med_render_handlecxx . . $ ship#med_render_handle.;
1710 else
1711 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1712 }
1713 }
1714 } else
1715 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1716 } else
1717 model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
1718 if (obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && obj->flagscxx . . $ object#flags. & OF_USE_DESTROYED_POLYMODELcxx . . $ `Descent3/object_external.h:283:9`!) {
1719 if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].lo_render_handlecxx . . $ object_info#lo_render_handle. != -1)
1720 model_num = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].lo_render_handlecxx . . $ object_info#lo_render_handle.;
1721 }
1722 // Set effects
1723 if (use_effect)
1724 SetPolymodelEffectcxx . . $ SetPolymodelEffect(c6aad29469640daf).(&pe);
1725 if (RenderObjectTypecxx . . $ RenderObjectType. == RO_STATICcxx . . $ `Descent3/renderobject.cpp:623:9`!) {
1726 // Draw this object with static light
1727 int overlay = 0;
1728 if ((obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..subobj_flagscxx . . $ polyobj_info#subobj_flags. != 0xFFFFFFFF)
1729 overlay = 1;
1730
1731 DrawPolygonModelcxx . . $ DrawPolygonModel(505ac7ffa3f87ac5).(&obj_pos, &obj->orientcxx . . $ object#orient., model_num, normalized_times, 0, RenderObjectStaticRedValuecxx . . $ RenderObjectStaticRedValue.,
1732 RenderObjectStaticGreenValuecxx . . $ RenderObjectStaticGreenValue., RenderObjectStaticBlueValuecxx . . $ RenderObjectStaticBlueValue., obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..subobj_flagscxx . . $ polyobj_info#subobj_flags.,
1733 use_effect, overlay);
1734 } else if (RenderObjectTypecxx . . $ RenderObjectType. == RO_GOURAUDcxx . . $ `Descent3/renderobject.cpp:624:9`! || NoLightmapscxx . . $ NoLightmaps.) {
1735 // Draw this object with gouraud static light
1736 int overlay = 0;
1737 if ((obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..subobj_flagscxx . . $ polyobj_info#subobj_flags. != 0xFFFFFFFF)
1738 overlay = 1;
1739 DrawPolygonModelcxx . . $ DrawPolygonModel(af314eb3da32d535).(&obj_pos, &obj->orientcxx . . $ object#orient., model_num, normalized_times, 0, &RenderObject_LightDirectioncxx . . $ RenderObject_LightDirection.,
1740 RenderObjectStaticRedValuecxx . . $ RenderObjectStaticRedValue., RenderObjectStaticGreenValuecxx . . $ RenderObjectStaticGreenValue., RenderObjectStaticBlueValuecxx . . $ RenderObjectStaticBlueValue.,
1741 obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..subobj_flagscxx . . $ polyobj_info#subobj_flags., use_effect, overlay);
1742 } else if (RenderObjectTypecxx . . $ RenderObjectType. == RO_LIGHTMAPScxx . . $ `Descent3/renderobject.cpp:625:9`!) {
1743 int overlay = 0;
1744 if ((obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..subobj_flagscxx . . $ polyobj_info#subobj_flags. != 0xFFFFFFFF)
1745 overlay = 1;
1746 // If this object is a destroyed building then do something different with it
1747 DrawPolygonModelcxx . . $ DrawPolygonModel(dfc7b9e8076b2536).(&obj_pos, &obj->orientcxx . . $ object#orient., model_num, normalized_times, 0, RenderObjectLightmapObjectcxx . . $ RenderObjectLightmapObject.,
1748 obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..subobj_flagscxx . . $ polyobj_info#subobj_flags., use_effect, overlay);
1749 } else
1750 Int3cxx . . $ `misc/pserror.h:247:9`!(); // Get Jason
1751 }
1752 // Sets the direction of the lightsource to be used when calculating vertex lighting
1753 // The light source vector should be in the models coordinate space
1754 void RenderObject_SetLightDirectioncxx . . $ RenderObject_SetLightDirection(ec8cf6451c36d470).(vectorcxx . . $ vector# *dir) { RenderObject_LightDirectioncxx . . $ RenderObject_LightDirection. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *dir; }
1755 // draw an object that has one bitmap & doesn't rotate
1756 void obj_draw_blobcxx . . $ obj_draw_blob(766a1b7183ffa4b4).(objectcxx . . $ object# *obj, int bmnum) {
1757 // int orientation=0;
1758 // grs_bitmap * bm = &GameBitmaps[bmnum];
1759 //
1760 //
1761 // if (obj->type == OBJ_FIREBALL)
1762 // orientation = (obj-Objects) & 7;
1763 //
1764 // orientation = global_orientation;
1765 //
1766 // PIGGY_PAGE_IN( bmi );
1767 //
1768 // if (bm->bm_w > bm->bm_h)
1769 //
1770 // g3_draw_bitmap(&obj->pos,obj->size,fixmuldiv(obj->size,bm->bm_h,bm->bm_w),bm, orientation);
1771 //
1772 // else
1773 //
1774 // g3_draw_bitmap(&obj->pos,fixmuldiv(obj->size,bm->bm_w,bm->bm_h),obj->size,bm, orientation);
1775 }
1776 extern float Far_clip_zcxx . . $ Far_clip_z.;
1777 int Point_visible_last_framecxx . . $ Point_visible_last_frame. = -1;
1778 // Given a position in 3space and a size, returns whether or not that sized point is
1779 // visible from the current view matrix
1780 int IsPointVisiblecxx . . $ IsPointVisible(a3c3a6b9788a7132).(vectorcxx . . $ vector# *pos, float size, float *pointz) {
1781 g3Pointcxx . . $ g3Point# pnt;
1782 uint8_tcxx . . $ uint8_t# ccode;
1783 static float last_render_fov = -1;
1784 static vectorcxx . . $ vector# left_normal, right_normal, top_normal, bottom_normal, view_position;
1785 static matrixcxx . . $ matrix# unscaled_matrix;
1786
1787 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt, pos);
1788 ccode = g3_CodePointcxx . . $ g3_CodePoint(1c2cda054d3314c5).(&pnt);
1789 if (pointz != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1790 *pointz = pnt.p3_zcxx . . $ `lib/3d.h:247:9`!;
1791 if (ccode) // the center point is off, find out if the whole object is off
1792 {
1793 float dotp;
1794
1795 if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! < -size)
1796 return 0; // behind plane!
1797 if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! > Far_clip_zcxx . . $ Far_clip_z. + size)
1798 return 0; // too far away!
1799 if (Render_FOVcxx . . $ Render_FOV. != last_render_fov) {
1800 last_render_fov = Render_FOVcxx . . $ Render_FOV.;
1801 int angle_adjust = (Render_FOVcxx . . $ Render_FOV. / 2) * (65536 / 360);
1802 vectorcxx . . $ vector# rvec = {1, 0, 0};
1803 vectorcxx . . $ vector# lvec = {-1, 0, 0};
1804 vectorcxx . . $ vector# tvec = {0, 1, 0};
1805 vectorcxx . . $ vector# bvec = {0, -1, 0};
1806 matrixcxx . . $ matrix# temp_mat;
1807 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, 0, 65536 - angle_adjust, 0);
1808 right_normal =cxx . . $ vector#`operator=`(c0842353a20857d). rvec *cxx . . $ `operator*`(14b8f9ac5c1e7b85). temp_mat;
1809 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, 0, angle_adjust, 0);
1810 left_normal =cxx . . $ vector#`operator=`(c0842353a20857d). lvec *cxx . . $ `operator*`(14b8f9ac5c1e7b85). temp_mat;
1811 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, 65536 - angle_adjust, 0, 0);
1812 bottom_normal =cxx . . $ vector#`operator=`(c0842353a20857d). bvec *cxx . . $ `operator*`(14b8f9ac5c1e7b85). temp_mat;
1813 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, angle_adjust, 0, 0);
1814 top_normal =cxx . . $ vector#`operator=`(c0842353a20857d). tvec *cxx . . $ `operator*`(14b8f9ac5c1e7b85). temp_mat;
1815 }
1816 // Get unscaled matrix stuff
1817 if (Point_visible_last_framecxx . . $ Point_visible_last_frame. != FrameCountcxx . . $ FrameCount.) {
1818 Point_visible_last_framecxx . . $ Point_visible_last_frame. = FrameCountcxx . . $ FrameCount.;
1819 g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(&unscaled_matrix);
1820 g3_GetViewPositioncxx . . $ g3_GetViewPosition(ec8cf6451c36d470).(&view_position);
1821 }
1822 vectorcxx . . $ vector# temp_vec = *pos -cxx . . $ operator-(b77b703cd1e43e33). view_position;
1823 pnt.p3_veccxx . . $ g3Point#p3_vec. =cxx . . $ vector#`operator=`(c0842353a20857d). temp_vec *cxx . . $ `operator*`(14b8f9ac5c1e7b85). unscaled_matrix;
1824 if (ccode & CC_OFF_RIGHTcxx . . $ `lib/3d.h:225:9`!) {
1825 dotp = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&right_normal, &pnt.p3_veccxx . . $ g3Point#p3_vec.);
1826 if (dotp > size)
1827 return 0;
1828 }
1829 if (ccode & CC_OFF_LEFTcxx . . $ `lib/3d.h:224:9`!) {
1830 dotp = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&left_normal, &pnt.p3_veccxx . . $ g3Point#p3_vec.);
1831 if (dotp > size)
1832 return 0;
1833 }
1834
1835 if (ccode & CC_OFF_TOPcxx . . $ `lib/3d.h:227:9`!) {
1836 dotp = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&top_normal, &pnt.p3_veccxx . . $ g3Point#p3_vec.);
1837 if (dotp > size)
1838 return 0;
1839 }
1840 if (ccode & CC_OFF_BOTcxx . . $ `lib/3d.h:226:9`!) {
1841 dotp = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&bottom_normal, &pnt.p3_veccxx . . $ g3Point#p3_vec.);
1842 if (dotp > size)
1843 return 0;
1844 }
1845 return 1;
1846 }
1847 // Center point is on, must be visible
1848 return 1;
1849 }
1850
1851 // Do powerup sparkles and stuff
1852 void DrawPowerupSparklescxx . . $ DrawPowerupSparkles(419c470199a90a97).(objectcxx . . $ object# *obj) {
1853 extern bool Render_mirror_for_roomcxx . . $ Render_mirror_for_room.;
1854 if (!Render_powerup_sparklescxx . . $ Render_powerup_sparkles.)
1855 return;
1856
1857 if (Game_pausedcxx . . $ Game_paused.)
1858 return;
1859
1860 // we want to render if
1861 // a) we are not rendering in a mirror
1862 // b) we are rendering a mirror but the object is not visible from our position
1863 if (Render_mirror_for_roomcxx . . $ Render_mirror_for_room. && !IsPointVisiblecxx . . $ IsPointVisible(a3c3a6b9788a7132).(&obj->poscxx . . $ object#pos., obj->sizecxx . . $ object#size., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!))
1864 return;
1865
1866 if (obj->render_typecxx . . $ object#render_type. != RT_POLYOBJcxx . . $ `Descent3/object_external.h:258:9`!)
1867 return;
1868
1869 // check to see if it's time to update
1870 if (Last_powerup_sparkle_timecxx . . $ Last_powerup_sparkle_time. < POWERUP_SPARKLE_INTERVALcxx . . $ `Descent3/renderobject.h:57:9`!)
1871 return;
1872
1873 int num_sparks = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() & 7;
1874 float obj_size_delta = obj->sizecxx . . $ object#size. * 0.3f;
1875
1876 // Create some sparks
1877 for (int i = 0; i < num_sparks; ++i) {
1878 const int randnum = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10;
1879
1880 int index;
1881 switch (randnum) {
1882 case 0:
1883 index = HOT_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:37:9`!;
1884 break;
1885 case 1:
1886 index = COOL_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:38:9`!;
1887 break;
1888 default:
1889 index = GRAY_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:72:9`!;
1890 break;
1891 }
1892
1893 vectorcxx . . $ vector# pos_delta;
1894 pos_delta.xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50;
1895 pos_delta.ycxx . . $ vector#y. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 80;
1896 pos_delta.zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50;
1897 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&pos_delta);
1898 pos_delta =cxx . . $ vector#`operator=`(c0842353a20857d). obj->last_poscxx . . $ object#last_pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj_size_delta *cxx . . $ `operator*`(9d6577ff3e9faa29). pos_delta);
1899
1900 int sparknum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, index, obj->roomnumcxx . . $ object#roomnum., &pos_delta);
1901 if (sparknum >= 0) {
1902 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[sparknum];
1903
1904 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->poscxx . . $ vis_effect#pos.;
1905 vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
1906 vis->masscxx . . $ vis_effect#mass. = 1000.0f;
1907 vis->dragcxx . . $ vis_effect#drag. = 0.2f;
1908 vis->phys_flagscxx . . $ vis_effect#phys_flags. |= PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`! | PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!;
1909
1910 vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 50) - 25;
1911 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = -10 - (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 20);
1912 vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 50) - 25;
1913 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.);
1914 vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). 3.0f + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 4);
1915
1916 vis->sizecxx . . $ vis_effect#size. = 0.05f + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) * 0.008f);
1917 vis->flagscxx . . $ vis_effect#flags. |= VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!;
1918
1919 const float lifetime = 0.25f + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) * 0.05f);
1920 vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime;
1921 vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime;
1922
1923 light_infocxx . . $ light_info# *li = ObjGetLightInfocxx . . $ ObjGetLightInfo(fae61030adf16a8b).(obj);
1924 if (li) {
1925 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(li->red_light1cxx . . $ light_info#red_light1. * 255.0f, li->green_light1cxx . . $ light_info#green_light1. * 255.0f, li->blue_light1cxx . . $ light_info#blue_light1. * 255.0f);
1926 } else {
1927 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(255, 255, 255);
1928 }
1929 }
1930 }
1931 }
1932
1933 #define POWERUP_HALO_ALPHAcxx . . $ `Descent3/renderobject.cpp:1933:9`! .3f
1934 // Draws the glowing disk around a powerup
1935 void DrawPowerupGlowDiskcxx . . $ DrawPowerupGlowDisk(419c470199a90a97).(objectcxx . . $ object# *obj) {
1936 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!);
1937 if (!Detail_settingscxx . . $ Detail_settings..Powerup_haloscxx . . $ tDetailSettings#Powerup_halos.)
1938 return;
1939 if (obj->render_typecxx . . $ object#render_type. == RT_NONEcxx . . $ `Descent3/object_external.h:257:9`!)
1940 return;
1941 if (Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info. && Viewer_objectcxx . . $ Viewer_object.->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_DEFORMcxx . . $ `Descent3/object_external.h:198:9`!)
1942 return;
1943 light_infocxx . . $ light_info# *li = ObjGetLightInfocxx . . $ ObjGetLightInfo(fae61030adf16a8b).(obj);
1944 int objnum = obj - Objectscxx . . $ Objects.;
1945 float size_adjust = FixSincxx . . $ FixSin(9a38df040a81ca35).((objnum * 5000) + (FrameCountcxx . . $ FrameCount. * 600));
1946 size_adjust += 1.0;
1947 size_adjust /= 2; // now in range 0 to 1.0
1948 size_adjust += .5;
1949 vectorcxx . . $ vector# subvec = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.;
1950 float mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&subvec);
1951 if (mag < 40)
1952 return;
1953
1954 float alpha_scalar = 1;
1955 if (obj->flagscxx . . $ object#flags. & OF_USES_LIFELEFTcxx . . $ `Descent3/object_external.h:276:9`!) {
1956 if (obj->lifeleftcxx . . $ object#lifeleft. < 5)
1957 alpha_scalar = (obj->lifeleftcxx . . $ object#lifeleft. / 5.0);
1958 }
1959 if (mag < 70) {
1960 alpha_scalar *= ((mag - 40) / 30.0);
1961 }
1962
1963 // Draw lo-res disk
1964 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&obj->poscxx . . $ object#pos., li->red_light1cxx . . $ light_info#red_light1., li->green_light1cxx . . $ light_info#green_light1., li->blue_light1cxx . . $ light_info#blue_light1., POWERUP_HALO_ALPHAcxx . . $ `Descent3/renderobject.cpp:1933:9`! * alpha_scalar, 0.0f,
1965 (obj->sizecxx . . $ object#size. / 2) + size_adjust, 0, 2);
1966 }
1967 // Draws the glowing disk around a player indicating damage
1968 void DrawPlayerDamageDiskcxx . . $ DrawPlayerDamageDisk(419c470199a90a97).(objectcxx . . $ object# *obj) {
1969 // if (!(Game_mode & GM_MULTI))
1970 // return; // only in multiplayer
1971
1972 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
1973 if (obj == Viewer_objectcxx . . $ Viewer_object.)
1974 return; // don't do me
1975 float damage_norm = Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].damage_magnitudecxx . . $ player#damage_magnitude. / MAX_DAMAGE_MAGcxx . . $ `Descent3/damage.h:106:9`!;
1976 if (damage_norm > 1.0)
1977 damage_norm = 1.0;
1978 if (damage_norm < .001)
1979 return;
1980 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(-obj->sizecxx . . $ object#size.);
1981 int bm_handle;
1982 int objnum = obj - Objectscxx . . $ Objects.;
1983 float rot_temp = .25; // Higher is faster
1984 int int_game = Gametimecxx . . $ Gametime. / rot_temp;
1985 float diff = Gametimecxx . . $ Gametime. - (int_game * rot_temp);
1986 int rot_angle = diff * 65536;
1987 rot_angle = 0;
1988 bm_handle = Fireballscxx . . $ Fireballs.[SHIP_HIT_INDEXcxx . . $ `Descent3/fireball_external.h:43:9`!].bm_handlecxx . . $ fireball#bm_handle.;
1989
1990 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
1991 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
1992
1993 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(.4 * damage_norm * 255);
1994 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
1995 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
1996 g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(&obj->poscxx . . $ object#pos., rot_angle, obj->sizecxx . . $ object#size., (obj->sizecxx . . $ object#size. * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0),
1997 bm_handle);
1998 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
1999 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(0);
2000 }
2001 // Draws the red sphere around a player indicating invulnerability
2002 void DrawPlayerInvulSpherecxx . . $ DrawPlayerInvulSphere(419c470199a90a97).(objectcxx . . $ object# *obj) {
2003 // if (!(Game_mode & GM_MULTI))
2004 // return; // only in multiplayer
2005
2006 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
2007 if (Viewer_objectcxx . . $ Viewer_object. == obj)
2008 return; // don't do me
2009 if (!(Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_INVULNERABLEcxx . . $ `Descent3/player_external.h:79:9`!))
2010 return;
2011 if (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].invul_magnitudecxx . . $ player#invul_magnitude. < .05)
2012 return;
2013
2014 int bm_handle = Fireballscxx . . $ Fireballs.[INVUL_HIT_INDEXcxx . . $ `Descent3/fireball_external.h:54:9`!].bm_handlecxx . . $ fireball#bm_handle.;
2015 // Figure out the position and orientation to draw this
2016 vectorcxx . . $ vector# hit_pos = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].invul_vectorcxx . . $ player#invul_vector. *cxx . . $ `operator*`(252247219a31502c). obj->sizecxx . . $ object#size.);
2017 vectorcxx . . $ vector# norm_vec = Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].invul_vectorcxx . . $ player#invul_vector.;
2018 // Check to see that we're ok with the length of the vector
2019 float mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&norm_vec);
2020 if (mag < 1)
2021 return;
2022 norm_vec /=cxx . . $ `operator/=`(f132838b2cd11d6). mag;
2023
2024 // Now draw!
2025 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
2026 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
2027 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(.6 * Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].invul_magnitudecxx . . $ player#invul_magnitude. * 255);
2028 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2029 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2030 g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(&hit_pos, &norm_vec, 0, 3, 3, bm_handle);
2031 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
2032 }
2033 // Draws a rotating ball around the player
2034 void DrawPlayerRotatingBallcxx . . $ DrawPlayerRotatingBall(419c470199a90a97).(objectcxx . . $ object# *obj) {
2035 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
2036 if (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].num_ballscxx . . $ player#num_balls. < 1)
2037 return;
2038 static int first = 1;
2039 static int bm_handle;
2040 vectorcxx . . $ vector# worldpos;
2041 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
2042 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
2043 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
2044 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
2045 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(.3 * 255);
2046 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
2047 if (first) {
2048 int texhandle = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("WhiteGlowingBall");
2049 if (texhandle == -1)
2050 bm_handle = 0;
2051 else
2052 bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(texhandle, 0);
2053 first = 0;
2054 }
2055 for (int i = 0; i < Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].num_ballscxx . . $ player#num_balls.; i++) {
2056 PlayerGetBallPositioncxx . . $ PlayerGetBallPosition(826a07231ea9ab7c).(&worldpos, obj->idcxx . . $ object#id., i);
2057 // Get color of balls
2058 ddgr_colorcxx . . $ ddgr_color# color =
2059 GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].ball_rcxx . . $ player#ball_r.[i] * 255, Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].ball_gcxx . . $ player#ball_g.[i] * 255, Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].ball_bcxx . . $ player#ball_b.[i] * 255);
2060 g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(&worldpos, obj->sizecxx . . $ object#size. / 4, ((obj->sizecxx . . $ object#size. / 4) * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle,
2061 color);
2062 }
2063 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
2064 }
2065 // Draws the 'typing message' icon indicator above an object
2066 void DrawPlayerTypingIndicatorcxx . . $ DrawPlayerTypingIndicator(419c470199a90a97).(objectcxx . . $ object# *obj) {
2067 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!))
2068 return;
2069 int slot = obj->idcxx . . $ object#id.;
2070 if (slot == Player_numcxx . . $ Player_num.)
2071 return;
2072 if (NetPlayerscxx . . $ NetPlayers.[slot].sequencecxx . . $ netplayer#sequence. != NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!)
2073 return;
2074 uint32_tcxx . . $ uint32_t# bit = (0x01 << slot);
2075 if (!(Players_typingcxx . . $ Players_typing. & bit))
2076 return;
2077 if (obj->effect_infocxx . . $ object#effect_info. && obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)
2078 return;
2079 static int type_indicator_model = -2;
2080 if (type_indicator_model == -2)
2081 type_indicator_model = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("TypingIndicator");
2082 if (type_indicator_model < 0)
2083 return;
2084 int bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(type_indicator_model, 0);
2085 float IndicatorTan;
2086 float rad = (float)(3.14 * (float)(10) / 180.0);
2087 IndicatorTan = tancxx . . $ tan(fbcf3211dfe1bfd1).(rad);
2088 // See if its in our viewcone
2089 vectorcxx . . $ vector# subvec = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). Player_objectcxx . . $ Player_object.->poscxx . . $ object#pos.;
2090 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&subvec);
2091 if ((vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&subvec, &Player_objectcxx . . $ Player_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.)) < IndicatorTan)
2092 return;
2093 if ((vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos., &obj->poscxx . . $ object#pos.) > 800.0f))
2094 return;
2095 // Find out if it is o.k. to draw here.
2096 fvi_querycxx . . $ fvi_query# fq;
2097 fvi_infocxx . . $ fvi_info# hit_data;
2098 int fate;
2099 fq.p0cxx . . $ fvi_query#p0. = &Player_objectcxx . . $ Player_object.->poscxx . . $ object#pos.;
2100 fq.startroomcxx . . $ fvi_query#startroom. = Player_objectcxx . . $ Player_object.->roomnumcxx . . $ object#roomnum.;
2101 fq.p1cxx . . $ fvi_query#p1. = &obj->poscxx . . $ object#pos.;
2102 fq.radcxx . . $ fvi_query#rad. = 0;
2103 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
2104 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2105 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`!;
2106 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
2107 if (fate == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`! || (fate == HIT_SPHERE_2_POLY_OBJECTcxx . . $ `lib/findintersection_external.h:52:9`! && hit_data.hit_objectcxx . . $ fvi_info#hit_object.[0] == (obj - Objectscxx . . $ Objects.))) {
2108 // Draw this indicator on the hud
2109 g3Pointcxx . . $ g3Point# pnt;
2110 int bmh, bmw;
2111 g3Pointcxx . . $ g3Point# *pntlist[32], points[4];
2112 g3Codescxx . . $ g3Codes# cc;
2113 uint8_tcxx . . $ uint8_t# code;
2114
2115 cc.cc_andcxx . . $ g3Codes#cc_and. = 0xFF;
2116 cc.cc_orcxx . . $ g3Codes#cc_or. = 0;
2117
2118 int b_w = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), 32);
2119 int b_h = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0), 32);
2120 bmw = b_w / 2;
2121 bmh = b_h / 2;
2122
2123 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt, fq.p1cxx . . $ fvi_query#p1.);
2124 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&pnt);
2125
2126 points[0].p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. = pnt.p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. - bmw;
2127 points[0].p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. = pnt.p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. + bmh + 5;
2128 points[0].p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z. = pnt.p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z.;
2129 points[0].p3_ucxx . . $ `lib/3d.h:250:9`! = 0;
2130 points[0].p3_vcxx . . $ `lib/3d.h:251:9`! = 0;
2131
2132 points[1].p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. = pnt.p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. + bmw;
2133 points[1].p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. = pnt.p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. + bmh + 5;
2134 points[1].p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z. = pnt.p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z.;
2135 points[1].p3_ucxx . . $ `lib/3d.h:250:9`! = 1;
2136 points[1].p3_vcxx . . $ `lib/3d.h:251:9`! = 0;
2137
2138 points[2].p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. = pnt.p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. + bmw;
2139 points[2].p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. = pnt.p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. - bmh + 5;
2140 points[2].p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z. = pnt.p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z.;
2141 points[2].p3_ucxx . . $ `lib/3d.h:250:9`! = 1;
2142 points[2].p3_vcxx . . $ `lib/3d.h:251:9`! = 1;
2143
2144 points[3].p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. = pnt.p3_veccxx . . $ g3Point#p3_vec..xcxx . . $ vector#x. - bmw;
2145 points[3].p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. = pnt.p3_veccxx . . $ g3Point#p3_vec..ycxx . . $ vector#y. - bmh + 5;
2146 points[3].p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z. = pnt.p3_veccxx . . $ g3Point#p3_vec..zcxx . . $ vector#z.;
2147 points[3].p3_ucxx . . $ `lib/3d.h:250:9`! = 0;
2148 points[3].p3_vcxx . . $ `lib/3d.h:251:9`! = 1;
2149
2150 for (int i = 0; i < 4; i++) {
2151 points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!;
2152 pntlist[i] = &points[i];
2153 code = g3_CodePointcxx . . $ g3_CodePoint(1c2cda054d3314c5).(pntlist[i]);
2154 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(pntlist[i]);
2155
2156 cc.cc_andcxx . . $ g3Codes#cc_and. &= code;
2157 cc.cc_orcxx . . $ g3Codes#cc_or. |= code;
2158 }
2159 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
2160 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(200);
2161 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
2162 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2163 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2164 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
2165 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
2166 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle, 0, &cc);
2167 }
2168 }
2169 // Draws the player name on the hud
2170 void DrawPlayerNameOnHudcxx . . $ DrawPlayerNameOnHud(419c470199a90a97).(objectcxx . . $ object# *obj) {
2171 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!))
2172 return;
2173 int slot = obj->idcxx . . $ object#id.;
2174 int color;
2175 if (slot == Player_numcxx . . $ Player_num.)
2176 return;
2177 if (NetPlayerscxx . . $ NetPlayers.[slot].sequencecxx . . $ netplayer#sequence. != NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!)
2178 return;
2179 if (HudNameTancxx . . $ HudNameTan. <= 0)
2180 return;
2181 if (obj->effect_infocxx . . $ object#effect_info. && obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)
2182 return;
2183
2184 // Get color to draw this name in
2185 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = obj->handlecxx . . $ object#handle.;
2186 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_CLIENT_GETCOLOREDNAMEcxx . . $ `lib/d3events.h:118:9`!, &DLLInfocxx . . $ DLLInfo.);
2187 color = DLLInfocxx . . $ DLLInfo..iRetcxx . . $ dllinfo#$anonymous_type_0#iRet.;
2188 if (color < 0)
2189 return;
2190
2191 // See if its in our viewcone
2192 vectorcxx . . $ vector# subvec = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). Player_objectcxx . . $ Player_object.->poscxx . . $ object#pos.;
2193 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&subvec);
2194 if ((vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&subvec, &Player_objectcxx . . $ Player_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.)) < HudNameTancxx . . $ HudNameTan.)
2195 return;
2196 // Find out if it is o.k. to draw here.
2197 fvi_querycxx . . $ fvi_query# fq;
2198 fvi_infocxx . . $ fvi_info# hit_data;
2199 int fate;
2200 fq.p0cxx . . $ fvi_query#p0. = &Player_objectcxx . . $ Player_object.->poscxx . . $ object#pos.;
2201 fq.startroomcxx . . $ fvi_query#startroom. = Player_objectcxx . . $ Player_object.->roomnumcxx . . $ object#roomnum.;
2202 fq.p1cxx . . $ fvi_query#p1. = &obj->poscxx . . $ object#pos.;
2203 fq.radcxx . . $ fvi_query#rad. = 0;
2204 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
2205 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2206 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`!;
2207 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
2208 if (fate == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`! || (fate == HIT_SPHERE_2_POLY_OBJECTcxx . . $ `lib/findintersection_external.h:52:9`! && hit_data.hit_objectcxx . . $ fvi_info#hit_object.[0] == (obj - Objectscxx . . $ Objects.))) {
2209 int half = Game_window_wcxx . . $ Game_window_w. / 2;
2210 // Draw this name on the hud
2211 g3Pointcxx . . $ g3Point# pnt;
2212 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt, fq.p1cxx . . $ fvi_query#p1.);
2213 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&pnt);
2214 // put a centered name string in the text buffer.
2215
2216 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!);
2217 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(color);
2218 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(pnt.p3_sxcxx . . $ g3Point#p3_sx. - half, pnt.p3_sycxx . . $ g3Point#p3_sy., Playerscxx . . $ Players.[slot].callsigncxx . . $ player#callsign.);
2219 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
2220 }
2221 }
2222 // Creates lightning sparks on a damaged object
2223 void DrawSparkyDamageLightningcxx . . $ DrawSparkyDamageLightning(419c470199a90a97).(objectcxx . . $ object# *obj) {
2224 float max_shields = 100;
2225 if (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! || obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)
2226 max_shields = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].hit_pointscxx . . $ object_info#hit_points.;
2227 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
2228 max_shields = INITIAL_SHIELDScxx . . $ `Descent3/player_external.h:69:9`!;
2229 // If less than 30% shields, make some lightning every now and then
2230 if (max_shields > 0 && (obj->shieldscxx . . $ object#shields. / max_shields) < .3 && obj->shieldscxx . . $ object#shields. >= 0) {
2231 float shield_norm = (obj->shieldscxx . . $ object#shields. / max_shields) / .3;
2232 shield_norm = 1 - shield_norm;
2233 ASSERTcxx . . $ `misc/pserror.h:246:9`!(shield_norm >= 0 && shield_norm <= 1);
2234 int shield_modulo = 20 - (12 * shield_norm);
2235 if (shield_modulo < 1)
2236 shield_modulo = 1;
2237 if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % shield_modulo) == 0) {
2238 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
2239 if (pm->n_modelscxx . . $ poly_model#n_models. == 0)
2240 return;
2241 int subnum = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % pm->n_modelscxx . . $ poly_model#n_models.;
2242 if (IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, subnum))
2243 return;
2244
2245 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[subnum];
2246 if (sm->nvertscxx . . $ bsp_info#nverts. == 0)
2247 return;
2248 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, LIGHTNING_BOLT_INDEXcxx . . $ `Descent3/fireball_external.h:53:9`!, obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos.);
2249 if (visnum >= 0) {
2250 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
2251 vis->lifeleftcxx . . $ vis_effect#lifeleft. = 1.0;
2252 vis->lifetimecxx . . $ vis_effect#lifetime. = 1.0;
2253 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
2254 vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = .15f;
2255 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = 3;
2256 vis->attach_infocxx . . $ vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle. = obj->handlecxx . . $ object#handle.;
2257 vis->attach_infocxx . . $ vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum. = subnum;
2258 vis->attach_infocxx . . $ vis_effect#attach_info..vertnumcxx . . $ vis_attach_info#vertnum. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % sm->nvertscxx . . $ bsp_info#nverts.;
2259 vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % sm->nvertscxx . . $ bsp_info#nverts.;
2260 vis->attach_infocxx . . $ vis_effect#attach_info..modelnumcxx . . $ vis_attach_info#modelnum. = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
2261 vis->flagscxx . . $ vis_effect#flags. = VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`! | VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`! | VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!;
2262 }
2263 }
2264 }
2265 }
2266
2267 // Creates Virus infected lightning on an object
2268 void DrawVirusLightningcxx . . $ DrawVirusLightning(419c470199a90a97).(objectcxx . . $ object# *obj) {
2269 if (!obj->effect_infocxx . . $ object#effect_info.)
2270 return;
2271 if (!(obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VIRUS_INFECTEDcxx . . $ `Descent3/object_external.h:213:9`!))
2272 return;
2273
2274 float shield_norm = (float)(ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!;
2275 shield_norm = 1 - shield_norm;
2276
2277 ASSERTcxx . . $ `misc/pserror.h:246:9`!(shield_norm >= 0 && shield_norm <= 1);
2278 int shield_modulo = 20 - (16 * shield_norm);
2279 if (shield_modulo < 1)
2280 shield_modulo = 1;
2281 if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % shield_modulo) == 0) {
2282 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
2283 if (pm->n_modelscxx . . $ poly_model#n_models. == 0)
2284 return;
2285 int subnum = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % pm->n_modelscxx . . $ poly_model#n_models.;
2286 if (IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, subnum))
2287 return;
2288
2289 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[subnum];
2290 if (sm->nvertscxx . . $ bsp_info#nverts. == 0)
2291 return;
2292 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, GRAY_LIGHTNING_BOLT_INDEXcxx . . $ `Descent3/fireball_external.h:73:9`!, obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos.);
2293 if (visnum >= 0) {
2294 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
2295 vis->lifeleftcxx . . $ vis_effect#lifeleft. = 1.0;
2296 vis->lifetimecxx . . $ vis_effect#lifetime. = 1.0;
2297 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
2298 vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = .15f;
2299 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = 3;
2300 vis->attach_infocxx . . $ vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle. = obj->handlecxx . . $ object#handle.;
2301 vis->attach_infocxx . . $ vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum. = subnum;
2302 vis->attach_infocxx . . $ vis_effect#attach_info..vertnumcxx . . $ vis_attach_info#vertnum. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % sm->nvertscxx . . $ bsp_info#nverts.;
2303 vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % sm->nvertscxx . . $ bsp_info#nverts.;
2304 vis->attach_infocxx . . $ vis_effect#attach_info..modelnumcxx . . $ vis_attach_info#modelnum. = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.;
2305 vis->flagscxx . . $ vis_effect#flags. = VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`! | VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`! | VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!;
2306 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(40, 250, 40);
2307 }
2308 }
2309 }
2310
2311 void DrawPlayerSightVectorcxx . . $ DrawPlayerSightVector(419c470199a90a97).(objectcxx . . $ object# *obj) {
2312 if (obj->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || obj->idcxx . . $ object#id. != Player_numcxx . . $ Player_num.)
2313 return;
2314 if (Player_has_cameracxx . . $ Player_has_camera. == 0 || Player_camera_objnumcxx . . $ Player_camera_objnum. == -1)
2315 return;
2316 // Cast a ray to see where it ends up
2317 fvi_querycxx . . $ fvi_query# fq;
2318 fvi_infocxx . . $ fvi_info# hit_data;
2319 int fate;
2320 vectorcxx . . $ vector# end_pos = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 500);
2321
2322 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
2323 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
2324 fq.p1cxx . . $ fvi_query#p1. = &end_pos;
2325 fq.radcxx . . $ fvi_query#rad. = 0;
2326 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
2327 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2328 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`!;
2329 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
2330 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_VERTEXcxx . . $ `lib/renderer.h:403:9`!);
2331 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
2332 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
2333 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
2334 vectorcxx . . $ vector# vecs[2];
2335 g3Pointcxx . . $ g3Point# pnts[2];
2336
2337 vecs[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
2338 vecs[1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_data.hit_pntcxx . . $ fvi_info#hit_pnt.;
2339 for (int i = 0; i < 2; i++) {
2340 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnts[i], &vecs[i]);
2341 pnts[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
2342 pnts[i].p3_rcxx . . $ `lib/3d.h:253:9`! = 1;
2343 pnts[i].p3_gcxx . . $ `lib/3d.h:254:9`! = 0;
2344 pnts[i].p3_bcxx . . $ `lib/3d.h:255:9`! = 0;
2345 }
2346 pnts[0].p3_acxx . . $ `lib/3d.h:256:9`! = .1f;
2347 pnts[1].p3_acxx . . $ `lib/3d.h:256:9`! = .05f;
2348 g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(&pnts[0], &pnts[1]);
2349 }