Debian Codegraph @

Descent3/WeaponFire.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/WeaponFire.cpp $
21 * $Revision: 279 $
22 * $Date: 9/20/01 5:33p $
23 * $Author: Matt $
24 *
25 * Weapon firing functions
26 *
27 * $Log: /DescentIII/Main/WeaponFire.cpp $
28 *
29 * 279 9/20/01 5:33p Matt
30 * Fixed weird omega cannon bugs (I hope) by only letting the omega
31 * particles collide from inside AquireElectricalTarget().
32 *
33 * 278 9/10/01 5:18p Matt
34 * For continuous-fire energy weapons (the omega cannon) use energy at a
35 * continuous (i.e., not frame-rate dependent) way.
36 *
37 * 277 9/05/01 4:14p Matt
38 * Only call StopWeapon() when dealing with a primary weapon. This change
39 * fixes odd primary weapon behavior when holding down the secondary fire
40 * button when out of secondaries.
41 *
42 * 276 8/29/01 4:26p Matt
43 * Add command-line switch to turn off suturation for omega cannon.
44 *
45 * 275 2/01/00 3:48a Jason
46 * Made lock image not display if the homing weapon is no longer locked on
47 *
48 * 274 1/26/00 9:20p Jeff
49 * added support for IntelliVIBE DLL
50 *
51 * 273 11/02/99 4:22p Chris
52 * Fixed problem with being able to fire dual fire secondaries when you
53 * only have one missle left
54 *
55 * 272 10/22/99 2:39p Jay
56 * Update for the FinalBoss Laser Effect
57 *
58 * 271 10/21/99 9:30p Jeff
59 * B.A. Macintosh code merge
60 *
61 * 270 10/20/99 5:40p Chris
62 * Added the Red Guidebot
63 *
64 * 269 9/01/99 6:57p Jason
65 * fixed guided missiles and timeout missiles so they work in multiplayer
66 *
67 * 268 7/27/99 12:17p Chris
68 * Only play the homing sound if there is a direct line of sight between
69 * the player and the homing object
70 *
71 * 267 7/20/99 6:51p Chris
72 * The Omega Cannon no longer locks on the GB
73 *
74 * 266 5/22/99 10:38p Jason
75 * fixed dumb bug with last rev
76 *
77 * 265 5/22/99 10:27p Jason
78 * changes for multiplayer and buildings, ai
79 *
80 * 264 5/21/99 10:35p Jason
81 * fixed 3rd person firing spray effects through walls
82 *
83 * 263 5/21/99 5:08a Chris
84 * Fixed the weapon speed scaling for TEAM_REBEL robots
85 *
86 * 262 5/20/99 3:48p Chris
87 * Rebel stuff isn't usually scaled by diff anymore
88 *
89 * 261 5/20/99 3:10p Jason
90 * fixed omega homing on invisible objects
91 *
92 * 260 5/19/99 3:25p Jason
93 * fixed wrong ordering of InitObjectScripts and MultiSendObject
94 *
95 * 259 5/17/99 6:07p Chris
96 * Tweaked min fire spread for diff levels
97 *
98 * 258 5/10/99 11:57p Chris
99 * Now related objects are not targetted by an omega cannon (I.e. things
100 * like a flag or something attached)
101 *
102 * 257 5/09/99 11:57p Jason
103 * fixed electrical weapon bug
104 *
105 * 256 5/09/99 1:24p Jason
106 * made chaff multiplayer friendly
107 *
108 * 255 5/09/99 1:13p Matt
109 * Three things: (1) Made players & chaff related, so they don't collide;
110 * (2) Made homing missiles prefer chaff; (3) Fixed a fire spread bug.
111 *
112 * 254 5/08/99 10:38p Chris
113 * Further scaled the game. :)
114 *
115 * 253 5/08/99 3:30p Jason
116 * fixed MassDriver zoom bug
117 *
118 * 252 5/07/99 4:56p Chris
119 * Doing boa vis around a bunch of code. :)
120 *
121 * 251 5/05/99 6:30p Jason
122 * toned down mass driver effect
123 *
124 * 250 5/05/99 1:20a Chris
125 * Fixed homers.
126 *
127 * 249 5/02/99 2:00a Jason
128 * added assert to help track down DoSprayEffect crash
129 *
130 * 248 5/01/99 2:34p Jason
131 * fixed omega problems
132 *
133 * 247 4/28/99 11:28a Jason
134 * made real viseffects not cast light
135 *
136 * 246 4/24/99 4:33p Jason
137 * made fusion damage sound not be irritating
138 *
139 * 245 4/23/99 3:33p Jason
140 * fixed napalm going through walls
141 *
142 * 244 4/23/99 1:00p Chris
143 * Improved conditions for LARGE objects - i.e. buildings
144 *
145 * 243 4/23/99 11:56a Jason
146 * fixed mass driver mess up on robots
147 *
148 * 242 4/21/99 11:05a Kevin
149 * new ps_rand and ps_srand to replace rand & srand
150 *
151 * 241 4/20/99 8:15p Chris
152 * Fixed bug with firing directly at objects(if vec is NULL, don't use the
153 * flag)
154 *
155 * 240 4/18/99 5:49p Chris
156 * Fixed smart missles
157 *
158 * 239 4/16/99 3:48p Jason
159 * made vauss streamers a little cooler
160 *
161 * 238 4/14/99 3:57a Jeff
162 * fixed case mismatch in #includes
163 *
164 * 237 4/13/99 12:16p Jason
165 * mass driver...again!
166 *
167 * 236 4/12/99 7:05p Jason
168 * fixed omega lighting
169 *
170 * 235 4/12/99 3:03p Jason
171 * added recoil to player objects when firing weapons
172 *
173 * 234 4/12/99 8:30a Chris
174 * Moving building don't collide with powerups
175 *
176 * 233 4/10/99 5:09p Samir
177 * prioritize sounds, pass 1
178 *
179 * 232 4/09/99 7:27p Jason
180 * added better mass driver effect
181 *
182 * 231 4/09/99 12:06p Jason
183 * made model setup code faster
184 *
185 * 230 4/08/99 6:00p Jason
186 * more tweaks for mass driver
187 *
188 * 229 4/06/99 2:45p Jason
189 * don't play cuttoff sound if in permissable netgame
190 *
191 * 228 4/06/99 1:51p Jason
192 * added new mass driver effect
193 *
194 * 227 4/05/99 4:40p Jason
195 * added groovy new smoke trails
196 *
197 * 226 4/01/99 1:11p Jason
198 * made vis effects better for the lighting system
199 *
200 * 225 3/08/99 5:24p Jason
201 * fixed mass driver visual
202 *
203 * 224 3/08/99 11:37a Chris
204 * Fixed mod_pos problems
205 *
206 * 223 3/08/99 11:13a Jason
207 * made omegas homing cone a little more restricted
208 *
209 * 222 3/03/99 11:04a Chris
210 *
211 * 221 3/03/99 10:51a Chris
212 * Robots dont collide with openned doors
213 *
214 * 220 3/03/99 3:56a Chris
215 * Improve diff level stuff
216 *
217 * 219 3/03/99 3:36a Matt
218 * Fixed ammo usage problem
219 *
220 * 218 3/02/99 7:22p Chris
221 * Add the 'fire at target' check box for weapon batteries
222 *
223 * 217 3/02/99 3:39p Jason
224 * made quaded weapons use double energy/ammo
225 *
226 * 216 3/02/99 2:20p Jason
227 * doh! Fixed bug with my last rev
228 *
229 * 215 3/02/99 2:19p Jason
230 * fixed energy/ammo usage bug
231 *
232 * 214 2/10/99 4:02p Chris
233 * Updated the attach system so that if a robot is idling, the AI will not
234 * update the attached subobjects (if the object is still moving, physics
235 * will do it).
236 *
237 * 213 2/10/99 1:47p Matt
238 * Changed object handle symbolic constants
239 *
240 * 212 2/08/99 5:29p Jason
241 * added weapon options
242 *
243 * 211 2/08/99 11:05a Jason
244 * took off impact mortar blobbly explosion
245 *
246 * 210 2/02/99 8:43a Chris
247 * I made buildings with AI work correctly (ie really big robots should be
248 * buildings)
249 * anim to and from states are now shorts instead of bytes
250 *
251 * 209 1/31/99 7:26p Matt
252 * Renamed a bunch of functions to have HUD capitalized
253 *
254 * 208 1/29/99 4:59p Chris
255 * Fixed a bug where the omega cannon would mess up weapons
256 *
257 * 207 1/25/99 7:43a Chris
258 * Added the GUID (Goal Unique Id) and added the ability for weapon
259 * batteries to always fire exactly forward.
260 *
261 * 206 1/24/99 8:18p Chris
262 * Updated AI and OSIRIS. Externalized fireball constants for spew and
263 * sparks. Added CreateRandomSparks to OSIRIS, renamed a bunch of AI
264 * Notify names to use underscores. Fixed a memory access leak in the
265 * matcen effect code.
266 *
267 * 205 1/24/99 3:11a Jason
268 * fixed weapon fire no glow bug
269 *
270 * 204 1/21/99 11:29p Jason
271 * made no_glow flag work correctly with weapons
272 *
273 * 203 1/21/99 11:15p Jeff
274 * pulled out some structs and defines from header files and moved them
275 * into seperate header files so that multiplayer dlls don't require major
276 * game headers, just those new headers. Side effect is a shorter build
277 * time. Also cleaned up some header file #includes that weren't needed.
278 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
279 * manage.h and multi.h
280 *
281 * 202 1/21/99 7:02p Jason
282 * weapon effect changes
283 *
284 * 201 1/21/99 6:50p Jason
285 * added test impact mortar
286 *
287 * 200 1/14/99 12:21p Jason
288 * fixed up on/off weapons in multiplayer
289 *
290 * 199 1/13/99 12:43p Jason
291 * added some more detail settings
292 *
293 * 198 1/08/99 2:56p Samir
294 * Ripped out OSIRIS1.
295 *
296 * 197 1/07/99 11:43a Jason
297 * made zoom weapons shake your ship more
298 *
299 * 196 1/05/99 5:09p Jason
300 * added permissable server networking (ala Quake/Unreal) to Descent3
301 *
302 * 195 1/05/99 12:24p Chris
303 * More OSIRIS improvements
304 *
305 * 194 12/11/98 5:08p Jason
306 * changed mass driver effect
307 *
308 * 193 12/09/98 2:06p Jason
309 * changed mass driver tracers
310 *
311 * 192 12/08/98 4:28p Chris
312 * Improved ObjRelated code. Attach objects are correctly functional with
313 * weapons and other attached objects
314 *
315 * 191 12/02/98 5:52p Chris
316 * Fire spread is now partially scaled by difficulty level
317 *
318 * 190 12/02/98 10:30a Jason
319 * added additional damage types for client-side multiplayer
320 *
321 * 189 11/30/98 5:48p Jason
322 * toned down fusion screen color
323 *
324 * 188 11/23/98 3:11p Kevin
325 * Demo system
326 *
327 * 187 11/18/98 5:50p Jeff
328 * added some cheap recoil effects for ForceFeedback...not fully
329 * implemented
330 *
331 * 186 11/17/98 4:17p Kevin
332 * Demo recording system
333 *
334 * 185 11/16/98 10:30a Jason
335 * fixed user timeout missile
336 *
337 * 184 11/13/98 4:46p Jason
338 * fixed smart missile
339 *
340 * 183 11/13/98 4:25p Jason
341 * changes for better weapon effects
342 *
343 * 182 11/13/98 12:30p Jason
344 * changes for weapons
345 *
346 * 181 11/03/98 6:16p Chris
347 * Starting to make on/off and spray weapons accessable to robots
348 *
349 * 180 10/28/98 7:05p Jason
350 * made napalm work better
351 *
352 * 179 10/22/98 5:35p Chris
353 *
354 * 178 10/22/98 2:58p Chris
355 * Difficulty levels are in beta
356 *
357 * 177 10/21/98 10:33a Matt
358 * Fixed a problem where the napalm kept firing & making sound even when
359 * out of fuel.
360 *
361 * 176 10/21/98 7:33a Chris
362 * Dead objects are not-targetable
363 *
364 * 175 10/20/98 12:34p Chris
365 * Robots can now fire when players are right on them
366 *
367 * 174 10/19/98 11:46p Jason
368 * changes for multiplayer debug layer
369 *
370 * 173 10/19/98 7:18p Matt
371 * Added system to support different types of damage to the player and
372 * have these different types make different sounds.
373 *
374 * 172 10/17/98 6:14p Chris
375 * Facing explosings happen from the object position - Planar explosions
376 * happen at the wall
377 *
378 * 171 10/17/98 2:35p Jason
379 * changed some potential RT_POLYOBJ problems to OF_POLYGON_OBJECT
380 *
381 * 170 10/16/98 4:18p Chris
382 * Fixed the 'flare thing'
383 *
384 * 169 10/16/98 3:42p Chris
385 *
386 * 168 10/16/98 3:39p Chris
387 * Improved the object linking system and AI and physics
388 *
389 * 167 10/13/98 12:58p Matt
390 * Allow a weapon to fire if it has non-zero ammo, even if it doesn't have
391 * as much as the weapon requires. This assures that the ammo will go all
392 * the way to zero.
393 *
394 * 166 10/12/98 10:20a Chris
395 * Weapon hits happen at the collision point
396 *
397 * 165 10/09/98 8:13p Craig
398 * Fixed a bad merge
399 *
400 * 164 10/09/98 7:47p Chris
401 * Added ObjSetDeadFlag
402 *
403 * 163 10/07/98 12:40p Jason
404 * fixed remaining weapon firing problems
405 *
406 * 162 10/06/98 5:46p Kevin
407 * Added new configuration for demo
408 *
409 * 161 10/05/98 4:31p Chris
410 * Homers should only track a firer's enemy
411 *
412 * 160 10/01/98 6:56p Jason
413 * turned off energy weapon hit effects if the object getting hit is the
414 * viewer - this helps cut down on the general clutter in heavy combat
415 *
416 * 159 9/30/98 4:05p Jason
417 * more parenting fun
418 *
419 * 158 9/28/98 10:54a Jason
420 * tidied up some napalm stuff
421 *
422 * 157 9/28/98 10:40a Chris
423 * Fixed a homing bug with cloaked
424 *
425 * 156 9/24/98 2:36p Jason
426 * took out gaps from first person napalm
427 *
428 * 155 9/22/98 1:02p Chris
429 * Improved which weapons can use the precomputed wall collisions
430 *
431 * 154 9/17/98 3:32p Jason
432 * tweaked omega effect
433 *
434 * 153 9/11/98 12:26p Jason
435 * got energy to shield and fusion damage working in multiplayer
436 *
437 * 152 9/10/98 5:56p Chris
438 * Added more shit to the matcen code :)
439 *
440 * 151 9/09/98 4:28p Jason
441 * added better weapon effects
442 *
443 * 150 9/08/98 5:35p Jason
444 * added WF_NO_ROTATE flag to weapons
445 *
446 * 149 8/26/98 1:39p Jason
447 * added weapon fired event
448 *
449 * 148 8/25/98 6:45p Chris
450 *
451 * 147 8/25/98 4:21p Chris
452 * Fixed an attached related problem
453 *
454 * 146 8/21/98 2:06p Jason
455 * fixed a slew of weapons bugs
456 *
457 * 145 8/19/98 2:48p Jason
458 * fixed some weapon firing and weapon exploding bugs
459 *
460 * 144 8/17/98 2:59p Chris
461 * Improved parented of fired weapons from attached objects - they now use
462 * the ultimate parent
463 *
464 * 143 8/17/98 12:10p Chris
465 * Fixed MAJOR bug in getting gunpoint positions
466 *
467 * 142 8/15/98 6:11p Chris
468 * Added 13 new fields. AI fire spread works.
469 *
470 * 141 8/12/98 3:33p Jason
471 * fixed omega cannon
472 *
473 * 140 8/06/98 1:00p Chris
474 * Added new homing flags
475 *
476 * 139 8/06/98 10:59a Jason
477 * added zoom weapons
478 *
479 * 138 8/03/98 5:56p Jason
480 * got fusion cannon working correctly
481 *
482 * 137 8/03/98 3:59p Chris
483 * Added support for FQ_IGNORE_WEAPONS, added .000001 attach code, fix a
484 * bug in polymodel collision detection
485 *
486 * 136 8/03/98 1:09p Jason
487 * added some more weapons flags
488 *
489 * 135 7/31/98 11:52a Chris
490 * Weapons can be persistent. Added ability for objects to be manually
491 * set for no object collisions.
492 *
493 * 134 7/30/98 11:09a Jason
494 * added weapons that freeze and deform terrain
495 *
496 * 133 7/28/98 12:44p Jason
497 * fixed robot spawning weapon bug
498 *
499 * 132 7/23/98 12:29p Chris
500 *
501 * 131 7/22/98 6:42p Chris
502 * A relink fix for points on a wall
503 *
504 * 130 7/22/98 6:31p Chris
505 * Fixed a relink bug
506 *
507 * 129 7/20/98 4:05p Chris
508 * Fixed a bug with not being able to fire while in powerups
509 *
510 * 128 7/20/98 2:48p Chris
511 * Removed hit_time (not neccessary)
512 *
513 * 127 7/20/98 2:26p Chris
514 *
515 * 126 7/20/98 2:06p Chris
516 * Added the precomputation of some weapons (fixed speed weapons). This
517 * algorithm can be expanded to include some missiles with some minor
518 * work.
519 *
520 * 125 7/20/98 12:48p Jason
521 * fixed bug with my last rev
522 *
523 * 124 7/20/98 10:43a Jason
524 * added more player scalars, plus afterburner changes
525 *
526 * 123 7/19/98 10:38p Chris
527 *
528 * 122 7/19/98 9:44p Chris
529 * Greatly improved homing performance
530 *
531 * 121 7/17/98 5:57p Jason
532 * misc multiplayer changes
533 *
534 * 120 7/15/98 12:48p Jeff
535 * put in calls to handle new multiplayer event...when an object's shields
536 * change
537 *
538 * 119 7/07/98 6:51p Jason
539 * fixed countermeasures for Jeffs multiplay
540 *
541 * 118 7/06/98 6:57p Chris
542 * Added some parenting limits
543 *
544 * 117 7/06/98 11:51a Jason
545 * added accessor function for countermeasures
546 *
547 * 116 7/01/98 12:55p Jason
548 * more changes for countermeasures
549 *
550 * 115 7/01/98 12:12p Jason
551 * added countermeasures
552 *
553 * 114 6/30/98 11:39a Jason
554 * added AdditionalDamage packet type for multiplayer
555 *
556 * 113 6/29/98 3:08p Jason
557 * added on/off weapons
558 *
559 * 112 6/29/98 12:34p Chris
560 * Fighting robots get some notification of hostile fire
561 *
562 * 111 6/26/98 6:53p Kevin
563 * Coop mode
564 *
565 * 110 6/26/98 2:04p Jason
566 * fixed some graphical problems with the omega
567 *
568 * 109 6/24/98 4:16p Jason
569 * adjusted omega effect
570 *
571 * 108 6/24/98 3:56p Jason
572 * added code for new omega cannon
573 *
574 * 107 6/22/98 6:26p Jason
575 * added gravity field effect for weapons
576 *
577 * 106 6/19/98 12:04p Jason
578 *
579 * 105 6/16/98 10:54a Jeff
580 *
581 * 104 6/15/98 6:29p Chris
582 * Added FQ_NO_RELINK to the homing code
583 *
584 * 103 6/15/98 6:08p Chris
585 * Hit_type to hit_type[0]
586 *
587 * 102 6/15/98 4:00p Jason
588 * replaced monochromatic polymodel lighting with rgb lighting
589 *
590 * 101 5/26/98 11:36a Matt
591 * Changed small view system to allow the popup window in any of the three
592 * positions, to allow any window to be the "bigger" size, and to restore
593 * the old view when a popup view goes away.
594 *
595 * 100 5/22/98 11:59a Chris
596 * Fixed improper uses of FindSoundName and made the proper static sounds
597 *
598 * 99 5/21/98 12:34p Jason
599 * made particles drop differently
600 *
601 * 98 5/19/98 4:42a Chris
602 * Added shockwave's -- enjoy. :)
603 *
604 * 97 5/18/98 8:05p Chris
605 * Matter weapons without spawn explode on no lifeleft -- we probably
606 * could use a flag for this
607 *
608 * 96 5/18/98 3:52p Chris
609 * More error checking for invalid gun numbers. :)
610 *
611 * 95 5/04/98 11:32a Chris
612 * Made it ok for non-polyobjs to fire things
613 *
614 * 94 5/04/98 1:12a Chris
615 * Added parenting bug checking
616 *
617 * 93 4/30/98 12:22p Jason
618 * did some lo-res model optimizations
619 *
620 * 92 4/24/98 3:20p Jason
621 * took redundant out smoke trails
622 *
623 * 91 4/19/98 5:00p Jason
624 * added cool napalm effect, plus made object effects dynamically
625 * allocated
626 *
627 * 90 4/17/98 4:58p Jason
628 * fixed weapon impact spawning to spread out from the normal of the wall
629 * it hits
630 *
631 * 89 4/17/98 1:59p Jason
632 * added cool object effects
633 *
634 * 88 4/15/98 2:33p Jason
635 * changed some smoke trail stuff
636 *
637 * 87 4/15/98 12:22p Jason
638 * lots of miscellaneous stuff pertaining to lighting and vis effects
639 *
640 * 86 4/10/98 6:56p Chris
641 * Fixed problem with missiles after they are done thrusting
642 *
643 * 85 4/10/98 2:16p Jason
644 * fixed guided missile problems
645 *
646 * 84 4/10/98 12:39p Jason
647 * added expanding explosion bitmaps
648 *
649 * 83 4/09/98 4:53p Jason
650 * fixed particle bug
651 *
652 * 82 4/09/98 3:16p Chris
653 * Updated the ObjectsRelated code.
654 *
655 * 81 4/09/98 2:23p Jason
656 * added guided/afterburner stuff
657 *
658 * 80 4/09/98 12:05p Chris
659 * Added parenting for all object types. :)
660 *
661 * 79 4/07/98 3:31p Jason
662 * got particle effects working with weapons
663 *
664 * 78 4/06/98 1:07p Chris
665 * Fixed bug with cloaked players
666 *
667 * 77 3/20/98 4:47p Chris
668 * Made homing sound play faster
669 *
670 * 76 3/20/98 3:54p Chris
671 * Working on adding sounds to the game. :)
672 *
673 * 75 3/19/98 12:53p Chris
674 * Fixed problem with not being able to home on the Highest_object_index
675 *
676 * 74 3/10/98 1:00p Chris
677 *
678 * 73 3/10/98 12:51p Chris
679 * Added a truely D2 style homing missile
680 *
681 * 72 3/09/98 1:18p Chris
682 * Made the lock hueristic totally dot based. It makes the most sense.
683 *
684 * 71 3/09/98 10:49a Chris
685 * Worked on the homing code
686 *
687 * 70 3/09/98 8:12a Chris
688 * Added the start of the homing code
689 *
690 * 69 3/06/98 3:11p Chris
691 * Fixed a bug I added with the last checkin
692 *
693 * 68 3/06/98 2:15p Chris
694 * Changed target_object to target_handle
695 *
696 * 67 3/05/98 2:50p Chris
697 * A bunch of SOAR updates
698 *
699 * 66 3/02/98 4:29p Jason
700 * fixed bitmap weapon spinning
701 *
702 * 65 2/18/98 1:34a Jason
703 * fixed foolhardy assertions
704 *
705 * 64 2/17/98 11:32p Matt
706 * Fixed player wepon fire problem when down_count != 0 && down_time == 0
707 * Add function to clear out player firing activity for when die or switch
708 * weapons
709 *
710 * 63 2/17/98 8:19p Matt
711 * Added looping & release sounds for player weapons
712 *
713 * 62 2/17/98 4:06p Jason
714 * Only explode timedout weapons if they have spawn
715 *
716 * 61 2/17/98 3:47p Matt
717 * Revamped weapon system and got sounds for spray and fusion weapons
718 * working. Still need to implements getting continuous & cutoff sounds
719 * from player ship.
720 *
721 * 60 2/16/98 3:02p Matt
722 * Changed normalized_time literal to a symbolic constant, as per ChrisP's
723 * instructions.
724 *
725 * 59 2/12/98 8:48p Matt
726 * Changed controls system to keep the reading of the controls seperate
727 * from using the results. Got rid of the Controls global.
728 *
729 * 58 2/11/98 4:10p Jason
730 * got spawning impact weapons working
731 *
732 * 57 2/11/98 2:04p Jason
733 * got spawning weapons working
734 *
735 * 56 2/09/98 3:20p Matt
736 * Added missile camera system
737 *
738 * 55 2/05/98 6:29p Jason
739 * added user settable explode time/size
740 *
741 * 54 2/05/98 12:37p Jason
742 * added more weapon effects
743 *
744 * 53 2/04/98 9:28p Jason
745 * added some new weapons effects
746 *
747 * 52 2/04/98 6:09p Matt
748 * Changed object room number to indicate a terrain cell via a flag. Got
749 * rid of the object flag which used to indicate terrain.
750 *
751 * 51 2/04/98 11:16a Jason
752 * added muzzle flash
753 *
754 * 50 2/03/98 12:03p Chris
755 * Updated how PF_USES_PARENT_VELOCITY works
756 *
757 * 49 2/02/98 4:07p Jason
758 * added a couple of weapons
759 *
760 * 48 1/29/98 6:06p Jason
761 * added new weapons
762 *
763 * 47 1/28/98 5:37p Jason
764 * added streamer weapons
765 *
766 * 46 1/28/98 12:00p Jason
767 * more changes for multiplayer
768 *
769 * 45 1/26/98 11:02a Jason
770 * fixed auto-fire bug
771 *
772 * 44 1/26/98 11:01a Jason
773 * incremental checkin for multiplayer
774 *
775 * 43 1/23/98 6:25p Jason
776 * Got spray weapons working
777 *
778 * 42 1/23/98 11:21a Jason
779 * incremental multiplayer checkin
780 *
781 * 41 1/20/98 12:10p Jason
782 * implemented vis effect system
783 *
784 * 40 1/19/98 10:04a Matt
785 * Added new object handle system
786 *
787 * 39 1/13/98 3:09p Jason
788 * added glow effect for engines
789 *
790 * 38 1/13/98 1:57p Chris
791 * Reduced parent relative velocity to 10% of the parent's velocity
792 *
793 * 37 1/10/98 2:24p Jason
794 * better multiplayer code checked in
795 *
796 * 36 12/22/97 6:19p Chris
797 * Moved weapon battery firing sound off the projectile (weapon) and into
798 * the weapon battery.
799 *
800 * 35 12/08/97 3:28p Jason
801 * tweaked explosions
802 *
803 * 34 12/03/97 11:54a Jason
804 * added designer-settable smoketrails
805 *
806 * 33 11/28/97 3:37p Jason
807 * fixed bug with alpha rendering
808 *
809 * 32 11/20/97 4:59p Jason
810 * tweaked some explosion stuff
811 *
812 * 31 11/18/97 4:37p Jason
813 * implemented some more changes to event system
814 *
815 * 30 11/13/97 5:20p Jason
816 * made bitmap weapons spin faster
817 *
818 * 29 11/12/97 5:35p Jason
819 * made energy/ammo usage work with weapon batteries
820 *
821 * 28 11/12/97 1:13p Jason
822 * added weapons that can ramp up
823 *
824 * 27 11/12/97 10:42a Chris
825 * Added an AI notify
826 *
827 * 26 11/07/97 5:33p Jason
828 * improved omega cannon effect
829 *
830 * 25 11/06/97 12:48p Chris
831 * Fixed a bug with the multi-configuration for a single wb. Actually, it
832 * will allow us to do some interesting things (like a weapon battery
833 * page).
834 *
835 * 24 11/06/97 6:17p Jason
836 * added support for electrical weapons
837 *
838 * 23 11/04/97 6:18p Chris
839 * Added support so that the player ship uses the robot's firing dialog.
840 *
841 * 22 11/03/97 4:31p Jason
842 * fixed bug when drawing bitmap weapons
843 *
844 * 21 10/30/97 4:02p Matt
845 * Added the flare
846 *
847 * 20 10/23/97 11:14a Jason
848 * changed some fireball DEFINEs
849 *
850 * 19 10/22/97 4:19p Jason
851 * added smoke trail effects
852 *
853 * 18 10/03/97 11:59a Samir
854 * Take care of setting player weapon usage stats.
855 *
856 * 17 9/17/97 11:02a Chris
857 * Fixed FindGunPoint's object transversal code (handles multiple base
858 * subobjects). Removed dependance on segment.h.
859 *
860 * 16 9/16/97 4:51p Matt
861 * Changed conditional for debug code
862 *
863 * 15 9/12/97 6:37p Chris
864 *
865 * 14 9/12/97 6:34p Chris
866 * My lasers collided with robot's lasers -- no more.
867 *
868 * 13 9/11/97 3:13p Samir
869 * Fixed missile autoeselection
870 *
871 * 12 9/05/97 12:25p Samir
872 * Added autoselection of weapons.
873 *
874 * 11 9/03/97 6:17p Jason
875 * added code to support powerups/robots/etc that cast light
876 *
877 * 10 9/03/97 3:54p Jason
878 * got objects to cast light
879 *
880 * 9 9/03/97 2:12p Chris
881 * Added new weapon battery system and made the animation system usable.
882 *
883 * 8 8/22/97 3:03a Chris
884 *
885 * 7 8/18/97 1:43a Chris
886 * Used new fvi_FindIntersection hit_seg format. FVIF_OUTSIDE bit.
887 *
888 * 6 8/07/97 5:19p Chris
889 * Expanded the weapon system
890 *
891 * 5 8/06/97 4:33p Chris
892 * Expanded the weapons page
893 *
894 * 4 8/04/97 5:35p Chris
895 *
896 * 3 7/28/97 1:12p Chris
897 * Fixed multiple bugs in the weapon system. Added fvi checking for
898 * weapon firing. Added a correct method of parenting weapons
899 * and for sibling collisions.
900 *
901 * $NoKeywords: $
902 */
903
904 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
905 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
906 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
907 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
908 #include "room.h"cxx . . $ `<file>/Descent3/room.h`/
909 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
910 #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/
911 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
912 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
913 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
914 #include "gameevent.h"cxx . . $ `<file>/Descent3/gameevent.h`/
915 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
916 #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/
917 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
918 #include <string.h>
919 #include <stdlib.h>
920 #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/
921 #include "robotfire.h"cxx . . $ `<file>/Descent3/robotfire.h`/
922 #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/
923 #include "controls.h"cxx . . $ `<file>/Descent3/controls.h`/
924 #include "damage.h"cxx . . $ `<file>/Descent3/damage.h`/
925 #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/
926 #include "viseffect.h"cxx . . $ `<file>/Descent3/viseffect.h`/
927 #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/
928 #include "SmallViews.h"cxx . . $ `<file>/Descent3/SmallViews.h`/
929 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
930 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
931 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
932 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
933 #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/
934 #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/
935 #include "collide.h"cxx . . $ `<file>/physics/collide.h`/
936 #include "demofile.h"cxx . . $ `<file>/lib/demofile.h`/
937 #include "difficulty.h"cxx . . $ `<file>/Descent3/difficulty.h`/
938 #include "D3ForceFeedback.h"cxx . . $ `<file>/Descent3/D3ForceFeedback.h`/
939 #include "config.h"cxx . . $ `<file>/Descent3/config.h`/
940 #include "ObjScript.h"cxx . . $ `<file>/Descent3/ObjScript.h`/
941 #include "doorway.h"cxx . . $ `<file>/Descent3/doorway.h`/
942 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
943 #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/
944
945 #include <algorithm>
946
947 static bool AreObjectsAttachedcxx . . $ AreObjectsAttached(1902ce9bc4d65af3).(const objectcxx . . $ object# *obj1, const objectcxx . . $ object# *obj2) {
948 const bool f_o1_a = (obj1->flagscxx . . $ object#flags. & OF_ATTACHEDcxx . . $ `Descent3/object_external.h:273:9`!) != 0;
949 const bool f_o2_a = (obj2->flagscxx . . $ object#flags. & OF_ATTACHEDcxx . . $ `Descent3/object_external.h:273:9`!) != 0;
950
951 if (f_o1_a || f_o2_a) {
952 const int o1_uh = obj1->attach_ultimate_handlecxx . . $ object#attach_ultimate_handle.;
953 const int o2_uh = obj2->attach_ultimate_handlecxx . . $ object#attach_ultimate_handle.;
954
955 if ((f_o1_a) && ((o1_uh == obj2->handlecxx . . $ object#handle.) || (f_o2_a && (o1_uh == o2_uh))))
956 return true;
957
958 if ((f_o2_a) && (o2_uh == obj1->handlecxx . . $ object#handle.))
959 return true;
960 }
961
962 return false;
963 }
964
965 bool ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(int o1, int o2) {
966 if ((o1 < 0) || (o2 < 0))
967 return false;
968
969 const objectcxx . . $ object# *obj1 = &Objectscxx . . $ Objects.[o1];
970 const objectcxx . . $ object# *obj2 = &Objectscxx . . $ Objects.[o2];
971
972 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj1->handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
973 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj2->handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
974
975 if (obj1->movement_typecxx . . $ object#movement_type. == MT_OBJ_LINKEDcxx . . $ `Descent3/object_external.h:242:9`! || obj2->movement_typecxx . . $ object#movement_type. == MT_OBJ_LINKEDcxx . . $ `Descent3/object_external.h:242:9`!)
976 return true;
977
978 if (obj1->typecxx . . $ object#type. != OBJ_SHOCKWAVEcxx . . $ `Descent3/object_external.h:170:9`! && (obj1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!)) {
979 return true;
980 }
981
982 if (obj2->typecxx . . $ object#type. != OBJ_SHOCKWAVEcxx . . $ `Descent3/object_external.h:170:9`! && (obj2->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!)) {
983 return true;
984 }
985
986 if (((obj1->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && ((obj2->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) && (obj2->idcxx . . $ object#id. == GENOBJ_CHAFFCHUNKcxx . . $ `Descent3/objinfo.h:360:9`!))) ||
987 ((obj2->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && ((obj1->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) && (obj1->idcxx . . $ object#id. == GENOBJ_CHAFFCHUNKcxx . . $ `Descent3/objinfo.h:360:9`!))))
988 return true;
989
990 if (((obj1->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) && (obj1->movement_typecxx . . $ object#movement_type. != MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!) && (obj2->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)) ||
991 ((obj2->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) && (obj2->movement_typecxx . . $ object#movement_type. != MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!) && (obj1->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!))) {
992 return true;
993 }
994
995 if (obj1->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`! && DoorwayGetPositioncxx . . $ `Descent3/doorway.h:215:9`!(&Roomscxx . . $ Rooms.[obj1->roomnumcxx . . $ object#roomnum.]) == 1.0f && obj2->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!)
996 return true;
997
998 if (obj2->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`! && DoorwayGetPositioncxx . . $ `Descent3/doorway.h:215:9`!(&Roomscxx . . $ Rooms.[obj2->roomnumcxx . . $ object#roomnum.]) == 1.0f && obj1->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!)
999 return true;
1000
1001 if (AreObjectsAttachedcxx . . $ AreObjectsAttached(1902ce9bc4d65af3).(obj1, obj2))
1002 return true;
1003
1004 if (obj1->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj2->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) {
1005 if (((Gametimecxx . . $ Gametime. < obj1->creation_timecxx . . $ object#creation_time. + 3.0f) && obj1->parent_handlecxx . . $ object#parent_handle. == obj2->handlecxx . . $ object#handle.) ||
1006 ((Gametimecxx . . $ Gametime. < obj2->creation_timecxx . . $ object#creation_time. + 3.0f) && obj2->parent_handlecxx . . $ object#parent_handle. == obj1->handlecxx . . $ object#handle.))
1007 return true;
1008 else
1009 return false;
1010 }
1011
1012 if (obj1->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj1->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && (obj1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_PERSISTENTcxx . . $ `Descent3/object_external.h:318:9`!) &&
1013 obj1->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_hit_handlecxx . . $ laser_info_s#last_hit_handle. == obj2->handlecxx . . $ object#handle.)
1014 return true;
1015
1016 if (obj2->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj2->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && (obj2->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_PERSISTENTcxx . . $ `Descent3/object_external.h:318:9`!) &&
1017 obj2->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_hit_handlecxx . . $ laser_info_s#last_hit_handle. == obj1->handlecxx . . $ object#handle.)
1018 return true;
1019
1020 // See if o2 is the parent of o1
1021 if (obj1->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && (obj1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_NO_COLLIDE_PARENTcxx . . $ `Descent3/object_external.h:326:9`!)) {
1022 if (obj1->parent_handlecxx . . $ object#parent_handle. == obj2->handlecxx . . $ object#handle.)
1023 return true;
1024
1025 objectcxx . . $ object# *t1 = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj1->parent_handlecxx . . $ object#parent_handle.);
1026
1027 if (t1) {
1028 if (AreObjectsAttachedcxx . . $ AreObjectsAttached(1902ce9bc4d65af3).(obj2, t1))
1029 return true;
1030 }
1031 }
1032
1033 // See if o1 is the parent of o2
1034 if (obj2->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && (obj2->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_NO_COLLIDE_PARENTcxx . . $ `Descent3/object_external.h:326:9`!)) {
1035 if (obj2->parent_handlecxx . . $ object#parent_handle. == obj1->handlecxx . . $ object#handle.)
1036 return true;
1037
1038 objectcxx . . $ object# *t2 = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj2->parent_handlecxx . . $ object#parent_handle.);
1039
1040 if (t2) {
1041 if (AreObjectsAttachedcxx . . $ AreObjectsAttached(1902ce9bc4d65af3).(obj1, t2))
1042 return true;
1043 }
1044 }
1045
1046 // They must both be weapons
1047 if (obj1->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! || obj2->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) {
1048 return false;
1049 }
1050
1051 // Here is the 09/07/94 change -- Siblings must be identical, others can hurt each other
1052 // See if they're siblings...
1053 if (obj1->parent_handlecxx . . $ object#parent_handle. == obj2->parent_handlecxx . . $ object#parent_handle.) {
1054 if ((obj1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_HITS_SIBLINGScxx . . $ `Descent3/object_external.h:327:9`!) || (obj2->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_HITS_SIBLINGScxx . . $ `Descent3/object_external.h:327:9`!)) {
1055 return false; // if either is proximity, then can blow up, so say not related
1056 } else {
1057 return true;
1058 }
1059 }
1060
1061 // Otherwise, it is two weapons and by default, they should not collide
1062 return true;
1063 }
1064
1065 bool Enable_omega_collionscxx . . $ Enable_omega_collions. = false;
1066
1067 // Picks out a target for an elecrical weapon to fire on
1068 void AquireElectricalTargetcxx . . $ AquireElectricalTarget(419c470199a90a97).(objectcxx . . $ object# *obj) {
1069 int i;
1070 float closest_dist = 99999, dist;
1071 objectcxx . . $ object# *closest_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, *hit_obj_ptr;
1072
1073 if (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_HOMINGcxx . . $ `Descent3/object_external.h:334:9`!) {
1074 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
1075 hit_obj_ptr = &Objectscxx . . $ Objects.[i];
1076
1077 if ((hit_obj_ptr->render_typecxx . . $ object#render_type. == RT_NONEcxx . . $ `Descent3/object_external.h:257:9`!) ||
1078 !(hit_obj_ptr->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || hit_obj_ptr->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! ||
1079 (hit_obj_ptr->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && hit_obj_ptr->ai_infocxx . . $ object#ai_info.)))
1080 continue;
1081
1082 if (ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), i))
1083 continue;
1084
1085 if (obj == hit_obj_ptr)
1086 continue;
1087
1088 if (hit_obj_ptr->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)
1089 continue;
1090
1091 // The GB has an "electric shield" that works kind of like a Faraday's Cage (it also
1092 // make him less annoying as a player's own Omega will not track his GB)
1093 if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(hit_obj_ptr))
1094 continue;
1095
1096 // Make sure this target is within our view cone
1097 vectorcxx . . $ vector# subvec = hit_obj_ptr->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.;
1098 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&subvec);
1099 if (vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&subvec, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.) < .8)
1100 continue;
1101
1102 // The distance is actually the objects' centers minus some of the hit object's radius (I set it to 80%)
1103 if ((hit_obj_ptr->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) && hit_obj_ptr->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! &&
1104 hit_obj_ptr->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && hit_obj_ptr->typecxx . . $ object#type. != OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!) {
1105 vectorcxx . . $ vector# pos;
1106 pos =cxx . . $ vector#`operator=`(c0842353a20857d). hit_obj_ptr->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). hit_obj_ptr->wall_sphere_offsetcxx . . $ object#wall_sphere_offset.;
1107
1108 dist = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&pos, &obj->poscxx . . $ object#pos.) - Poly_modelscxx . . $ Poly_models.[hit_obj_ptr->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].wall_sizecxx . . $ poly_model#wall_size.;
1109 } else {
1110 dist = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&hit_obj_ptr->poscxx . . $ object#pos., &obj->poscxx . . $ object#pos.) - hit_obj_ptr->sizecxx . . $ object#size.;
1111 }
1112
1113 if (dist < 0.0f)
1114 dist = 0.0f;
1115 if (dist > 50)
1116 continue;
1117
1118 if (dist <= closest_dist) {
1119 closest_dist = dist;
1120 closest_obj = hit_obj_ptr;
1121 }
1122 }
1123 }
1124
1125 if (closest_obj != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1126 float old_shield, new_shield;
1127 if (closest_obj->effect_infocxx . . $ object#effect_info. && closest_obj != Viewer_objectcxx . . $ Viewer_object.) {
1128 closest_obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_DEFORMcxx . . $ `Descent3/object_external.h:198:9`!;
1129 closest_obj->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time. = 1.0;
1130 closest_obj->effect_infocxx . . $ object#effect_info.->deform_rangecxx . . $ effect_info_s#deform_range. = .03f;
1131 }
1132
1133 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle. = closest_obj->handlecxx . . $ object#handle.;
1134
1135 vectorcxx . . $ vector# subvec = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). closest_obj->poscxx . . $ object#pos.;
1136 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&subvec);
1137
1138 old_shield = closest_obj->shieldscxx . . $ object#shields.;
1139
1140 vectorcxx . . $ vector# save_pos = obj->poscxx . . $ object#pos.;
1141 vectorcxx . . $ vector# col_norm = {0, 1, 0};
1142 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). closest_obj->poscxx . . $ object#pos.;
1143
1144 Enable_omega_collionscxx . . $ Enable_omega_collions. = true;
1145 collide_two_objectscxx . . $ collide_two_objects(d2b59d3704ffac80).(obj, closest_obj, &closest_obj->poscxx . . $ object#pos., &col_norm);
1146 Enable_omega_collionscxx . . $ Enable_omega_collions. = false;
1147
1148 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). save_pos;
1149 new_shield = closest_obj->shieldscxx . . $ object#shields.;
1150
1151 objectcxx . . $ object# *parent_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.);
1152
1153 if (parent_obj->shieldscxx . . $ object#shields. < 100) {
1154 float shields_to_add = (old_shield - new_shield) * .1;
1155 if (parent_obj->shieldscxx . . $ object#shields. + shields_to_add > 100)
1156 shields_to_add = 100 - parent_obj->shieldscxx . . $ object#shields.;
1157
1158 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1159 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
1160 parent_obj->shieldscxx . . $ object#shields. += shields_to_add;
1161 Multi_additional_damagecxx . . $ Multi_additional_damage.[parent_obj->idcxx . . $ object#id.] -= shields_to_add;
1162 Multi_additional_damage_typecxx . . $ Multi_additional_damage_type.[parent_obj->idcxx . . $ object#id.] = PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`!;
1163
1164 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = -1;
1165 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = parent_obj->handlecxx . . $ object#handle.;
1166 DLLInfocxx . . $ DLLInfo..fParamcxx . . $ dllinfo#fParam. = shields_to_add;
1167 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEOBJECTSHIELDSCHANGEDcxx . . $ `lib/d3events.h:75:9`!, &DLLInfocxx . . $ DLLInfo.);
1168 }
1169 } else
1170 parent_obj->shieldscxx . . $ object#shields. += shields_to_add;
1171 }
1172 } else {
1173 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1174
1175 // Cast a ray to see what we've hit
1176 int fate; // Collision type for response code
1177 fvi_infocxx . . $ fvi_info# hit_info; // Hit information
1178 fvi_querycxx . . $ fvi_query# fq; // Movement query
1179 vectorcxx . . $ vector# dest = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 50.0);
1180
1181 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
1182 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
1183 fq.p1cxx . . $ fvi_query#p1. = &dest;
1184 fq.radcxx . . $ fvi_query#rad. = .0001f;
1185 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = Objectscxx . . $ Objects. - obj;
1186 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1187 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`!;
1188
1189 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
1190
1191 vectorcxx . . $ vector# save_pos = obj->poscxx . . $ object#pos.;
1192
1193 if (fate == HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`! || fate == HIT_TERRAINcxx . . $ `lib/findintersection_external.h:48:9`!) {
1194 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info.hit_pntcxx . . $ fvi_info#hit_pnt.;
1195 collide_object_with_wallcxx . . $ collide_object_with_wall(df7a53499d66690e).(obj, 0, hit_info.hit_face_roomcxx . . $ fvi_info#hit_face_room.[0], hit_info.hit_facecxx . . $ fvi_info#hit_face.[0], &hit_info.hit_face_pntcxx . . $ fvi_info#hit_face_pnt.[0],
1196 &hit_info.hit_wallnormcxx . . $ fvi_info#hit_wallnorm.[0], 0);
1197 } else if (fate == HIT_OBJECTcxx . . $ `lib/findintersection_external.h:47:9`! || fate == HIT_SPHERE_2_POLY_OBJECTcxx . . $ `lib/findintersection_external.h:52:9`!) {
1198 if (CollisionResultcxx . . $ CollisionResult.[obj->typecxx . . $ object#type.][Objectscxx . . $ Objects.[hit_info.hit_objectcxx . . $ fvi_info#hit_object.[0]].typecxx . . $ object#type.] != RESULT_NOTHINGcxx . . $ `physics/collide.h:112:9`!) {
1199 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info.hit_pntcxx . . $ fvi_info#hit_pnt.;
1200 Enable_omega_collionscxx . . $ Enable_omega_collions. = true;
1201 collide_two_objectscxx . . $ collide_two_objects(d2b59d3704ffac80).(obj, &Objectscxx . . $ Objects.[hit_info.hit_objectcxx . . $ fvi_info#hit_object.[0]], &hit_info.hit_face_pntcxx . . $ fvi_info#hit_face_pnt.[0],
1202 &hit_info.hit_wallnormcxx . . $ fvi_info#hit_wallnorm.[0]);
1203 Enable_omega_collionscxx . . $ Enable_omega_collions. = false;
1204 }
1205 }
1206
1207 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). save_pos;
1208 obj->flagscxx . . $ object#flags. &= ~OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!; // Bring it back from the dead in case the collide code killed it!
1209 }
1210 }
1211
1212 // Creates an weapon and sends it speeding on its way
1213 int CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(vectorcxx . . $ vector# *pos, vectorcxx . . $ vector# *dir, objectcxx . . $ object# *parent, int weapon_num) {
1214 int objnum;
1215 objectcxx . . $ object# *obj;
1216 int parentnum = parent - Objectscxx . . $ Objects.;
1217 uint8_tcxx . . $ uint8_t# terrain = 0;
1218
1219 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weapons[weapon_num].used);
1220
1221 // This can happen in multiplayer -- not single player
1222 if (parent->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)
1223 return -1;
1224
1225 // Find out if it is o.k. to create a weapon here.
1226 fvi_querycxx . . $ fvi_query# fq;
1227 fvi_infocxx . . $ fvi_info# hit_data;
1228 int fate;
1229
1230 fq.p0cxx . . $ fvi_query#p0. = &parent->poscxx . . $ object#pos.;
1231 fq.startroomcxx . . $ fvi_query#startroom. = parent->roomnumcxx . . $ object#roomnum.;
1232 fq.p1cxx . . $ fvi_query#p1. = pos;
1233 fq.radcxx . . $ fvi_query#rad. = 0;
1234 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(parent);
1235 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1236 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! |
1237 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!; // what about trans walls???
1238
1239 if (parent->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) {
1240 fq.flagscxx . . $ fvi_query#flags. &= ~FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`!;
1241 }
1242
1243 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
1244 if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
1245 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Warning: Laser from parent=%d weapon point is in a wall or object, didn't fire!\n", OBJNUM(parent));
1246 return -1;
1247 }
1248
1249 objnum = ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, weapon_num, hit_data.hit_roomcxx . . $ fvi_info#hit_room., pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, parent->handlecxx . . $ object#handle.);
1250
1251 if (objnum < 0) {
1252 mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "Can't create laser - Out of objects!\n");
1253 return -1;
1254 }
1255
1256 obj = &Objectscxx . . $ Objects.[objnum];
1257
1258 // Fill in laser-specific data
1259 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..multipliercxx . . $ laser_info_s#multiplier. = 1.0;
1260 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..parent_typecxx . . $ laser_info_s#parent_type. = parent->typecxx . . $ object#type.;
1261
1262 if (parent->flagscxx . . $ object#flags. & OF_ATTACHEDcxx . . $ `Descent3/object_external.h:273:9`!)
1263 obj->parent_handlecxx . . $ object#parent_handle. = parent->attach_ultimate_handlecxx . . $ object#attach_ultimate_handle.;
1264 else
1265 obj->parent_handlecxx . . $ object#parent_handle. = parent->handlecxx . . $ object#handle.;
1266
1267 // Assign parent type to highest level creator. This propagates parent type down from
1268 // the original creator through weapons which create children of their own (ie, smart missile)
1269 objectcxx . . $ object# *p = parent;
1270 while (p && (p->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)) {
1271 p = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(p->parent_handlecxx . . $ object#parent_handle.);
1272 if (p) {
1273 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..parent_typecxx . . $ laser_info_s#parent_type. = p->typecxx . . $ object#type.;
1274 obj->parent_handlecxx . . $ object#parent_handle. = p->handlecxx . . $ object#handle.;
1275 }
1276 }
1277
1278 // Set direction
1279 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&obj->orientcxx . . $ object#orient., dir, &parent->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1280
1281 float scalar = 1.0f;
1282 if (!ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.) || ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.)->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1283 scalar = (ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.)->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! &&
1284 ((ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.)->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) == AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!))
1285 ? 1.0f
1286 : Diff_ai_weapon_speedcxx . . $ Diff_ai_weapon_speed.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!];
1287
1288 // Set thrust
1289 if (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_USES_THRUSTcxx . . $ `Descent3/object_external.h:319:9`!) {
1290 vm_ScaleVectorcxx . . $ vm_ScaleVector(cfd0f9d897ccca3c).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust., dir, obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_thrustcxx . . $ physics_info#$anonymous_type_3#full_thrust. * scalar);
1291 // If this is a player, scale the thrust based on the players weapon_speed scalar
1292 if (parent->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1293 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. *=cxx . . $ `operator*=`(f132838b2cd11d6). Playerscxx . . $ Players.[parent->idcxx . . $ object#id.].weapon_speed_scalarcxx . . $ player#weapon_speed_scalar.;
1294 } else {
1295 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust.);
1296 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust.);
1297 }
1298 // vm_MakeZero(&obj->mtype.phys_info.rotvel);
1299
1300 // Set the initial velocity
1301 vm_ScaleVectorcxx . . $ vm_ScaleVector(cfd0f9d897ccca3c).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity., dir, Weaponscxx . . $ Weapons.[weapon_num].phys_infocxx . . $ weapon#phys_info..velocitycxx . . $ physics_info#velocity..zcxx . . $ vector#z. * scalar);
1302
1303 // If this is a player, scale the velocity based on the players weapon_speed scalar
1304 if (parent->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1305 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). Playerscxx . . $ Players.[parent->idcxx . . $ object#id.].weapon_speed_scalarcxx . . $ player#weapon_speed_scalar.;
1306
1307 // Set initial velocity to that of the firing object
1308 // Don't do it though if its a spawned weapon
1309 if ((obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_USES_PARENT_VELOCITYcxx . . $ `Descent3/object_external.h:323:9`!) && parent->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) {
1310
1311 float fdot = (parent->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). parent->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.);
1312 vectorcxx . . $ vector# fvel;
1313
1314 if (fdot > 0.0)
1315 fvel =cxx . . $ vector#`operator=`(c0842353a20857d). parent->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). fdot;
1316 else
1317 fvel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1318
1319 vectorcxx . . $ vector# rvel = 0.1f *cxx . . $ `operator*`(9d6577ff3e9faa29). parent->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (parent->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). parent->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.);
1320 vectorcxx . . $ vector# uvel = 0.1f *cxx . . $ `operator*`(9d6577ff3e9faa29). parent->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (parent->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). parent->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.);
1321
1322 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). fvel +cxx . . $ operator+(b77b703cd1e43e33). rvel +cxx . . $ operator+(b77b703cd1e43e33). uvel;
1323 }
1324
1325 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_ELECTRICALcxx . . $ `Descent3/weapon.h:222:9`!) {
1326 AquireElectricalTargetcxx . . $ AquireElectricalTarget(419c470199a90a97).(obj);
1327 } else if (obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) {
1328 if (!((obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_USES_PARENT_VELOCITYcxx . . $ `Descent3/object_external.h:323:9`!) && (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_USES_THRUSTcxx . . $ `Descent3/object_external.h:319:9`!))) {
1329 // For now, it only works on fixed velocity weapons
1330 if ((obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_FIXED_VELOCITYcxx . . $ `Descent3/object_external.h:324:9`!) &&
1331 !(obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & (PF_GRAVITY_MASKcxx . . $ `Descent3/object_external.h:330:9`! | PF_HOMINGcxx . . $ `Descent3/object_external.h:334:9`! | PF_WIGGLEcxx . . $ `Descent3/object_external.h:316:9`! | PF_GUIDEDcxx . . $ `Descent3/object_external.h:335:9`!))) {
1332 fvi_querycxx . . $ fvi_query# fq;
1333 fvi_infocxx . . $ fvi_info# hit_info;
1334 vectorcxx . . $ vector# end_pos = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(252247219a31502c). obj->lifeleftcxx . . $ object#lifeleft.;
1335
1336 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
1337 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
1338 fq.p1cxx . . $ fvi_query#p1. = &end_pos;
1339 fq.radcxx . . $ fvi_query#rad. = obj->sizecxx . . $ object#size.;
1340 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
1341 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1342 fq.flagscxx . . $ fvi_query#flags. = 0;
1343
1344 fq.flagscxx . . $ fvi_query#flags. |= FQ_TRANSPOINTcxx . . $ `lib/findintersection_external.h:61:9`!;
1345
1346 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
1347
1348 if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`! && fate != HIT_OUT_OF_TERRAIN_BOUNDScxx . . $ `lib/findintersection_external.h:50:9`!) {
1349 float try_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &end_pos);
1350 float got_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &hit_info.hit_pntcxx . . $ fvi_info#hit_pnt.);
1351
1352 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_pntcxx . . $ laser_info_s#hit_pnt. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info.hit_pntcxx . . $ fvi_info#hit_pnt.;
1353 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_wall_pntcxx . . $ laser_info_s#hit_wall_pnt. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info.hit_face_pntcxx . . $ fvi_info#hit_face_pnt.[0];
1354 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_roomcxx . . $ laser_info_s#hit_room. = hit_info.hit_roomcxx . . $ fvi_info#hit_room.;
1355 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_pnt_roomcxx . . $ laser_info_s#hit_pnt_room. = hit_info.hit_face_roomcxx . . $ fvi_info#hit_face_room.[0];
1356 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_wall_normalcxx . . $ laser_info_s#hit_wall_normal. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info.hit_wallnormcxx . . $ fvi_info#hit_wallnorm.[0];
1357 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_facecxx . . $ laser_info_s#hit_face. = hit_info.hit_facecxx . . $ fvi_info#hit_face.[0];
1358
1359 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_statuscxx . . $ laser_info_s#hit_status. = WPC_HIT_WALLcxx . . $ `Descent3/object.h:659:9`!;
1360 // mprintf(0, "WPC: Hit r%d rw%d w%d (%f,%f,%f)\n", hit_info.hit_room,
1361 // hit_info.hit_face_room[0], hit_info.hit_face[0], XYZ(&hit_info.hit_wallnorm[0]));
1362 } else {
1363 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..hit_statuscxx . . $ laser_info_s#hit_status. = WPC_NO_COLLISIONScxx . . $ `Descent3/object.h:658:9`!;
1364 // mprintf(0, "WPC: No collisions\n");
1365 }
1366 }
1367 }
1368 }
1369
1370 if (parent && (parent->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || parent->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!) && (parent->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.)) {
1371 // Do ForceFeeback for recoil
1372 DoForceForRecoilcxx . . $ DoForceForRecoil(6273fa812ac58a8).(parent, obj);
1373 }
1374
1375 // For smoke effects
1376 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_smoke_poscxx . . $ laser_info_s#last_smoke_pos. =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). (obj->sizecxx . . $ object#size. / 2));
1377 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..casts_lightcxx . . $ laser_info_s#casts_light. = true;
1378 return objnum;
1379 }
1380
1381 // Steers a homing missile
1382 void HomingTurnTowardObjcxx . . $ HomingTurnTowardObj(6273fa812ac58a8).(objectcxx . . $ object# *weapon, objectcxx . . $ object# *target) {
1383 vectorcxx . . $ vector# dir_to_target;
1384 vectorcxx . . $ vector# movement = Zero_vectorcxx . . $ Zero_vector.;
1385
1386 if (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1387 return;
1388
1389 if (target->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || target->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) {
1390 movement =cxx . . $ vector#`operator=`(c0842353a20857d). 0.1f *cxx . . $ `operator*`(9d6577ff3e9faa29). (target->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.);
1391 }
1392
1393 dir_to_target =cxx . . $ vector#`operator=`(c0842353a20857d). target->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). movement -cxx . . $ operator-(b77b703cd1e43e33). weapon->poscxx . . $ object#pos.;
1394
1395 if (weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotdragcxx . . $ physics_info#rotdrag. > 0.0f) {
1396 if (dir_to_target *cxx . . $ `operator*`(4a721543d64e126a). weapon->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. > 0.0) {
1397 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..ycxx . . $ vector#y. = weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
1398 } else {
1399 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..ycxx . . $ vector#y. = -weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
1400 }
1401
1402 if (dir_to_target *cxx . . $ `operator*`(4a721543d64e126a). weapon->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. > 0.0) {
1403 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..xcxx . . $ vector#x. = -weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
1404 } else {
1405 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..xcxx . . $ vector#x. = weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
1406 }
1407
1408 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..zcxx . . $ vector#z. = 0.0;
1409
1410 if (!ObjGetcxx . . $ ObjGet(11672e354c0b263a).(weapon->parent_handlecxx . . $ object#parent_handle.) || ObjGetcxx . . $ ObjGet(11672e354c0b263a).(weapon->parent_handlecxx . . $ object#parent_handle.)->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1411 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust. *=cxx . . $ `operator*=`(f132838b2cd11d6). Diff_homing_strengthcxx . . $ Diff_homing_strength.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!];
1412 } else {
1413 float scalar;
1414 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir_to_target);
1415
1416 if (!ObjGetcxx . . $ ObjGet(11672e354c0b263a).(weapon->parent_handlecxx . . $ object#parent_handle.) || ObjGetcxx . . $ ObjGet(11672e354c0b263a).(weapon->parent_handlecxx . . $ object#parent_handle.)->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1417 scalar = Diff_homing_strengthcxx . . $ Diff_homing_strength.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!];
1418 else
1419 scalar = 1.0f;
1420
1421 AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(weapon, &dir_to_target, weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust. * scalar);
1422 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(c0842353a20857d).
1423 weapon->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_thrustcxx . . $ physics_info#$anonymous_type_3#full_thrust. /cxx . . $ `operator/`(252247219a31502c). weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag.;
1424 weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. =cxx . . $ vector#`operator=`(c0842353a20857d). weapon->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_thrustcxx . . $ physics_info#$anonymous_type_3#full_thrust.;
1425 }
1426 }
1427
1428 #define MAX_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1428:9`! 500.0f
1429 #define CLOSE_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1429:9`! 15.0
1430
1431 #define MAX_HOMING_SOUND_TIME_DISTcxx . . $ `Descent3/WeaponFire.cpp:1431:9`! 250.00f
1432 #define MAX_HOMING_SOUND_TIMEcxx . . $ `Descent3/WeaponFire.cpp:1432:9`! 1.00f
1433 #define MIN_HOMING_SOUND_TIMEcxx . . $ `Descent3/WeaponFire.cpp:1433:9`! 0.05f
1434 #define HOMING_CHECK_VIS_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:1434:9`! 0.25f
1435 #define HOMING_FIND_LOC_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:1435:9`! 0.20f
1436
1437 objectcxx . . $ object# *HomingAquireTargetcxx . . $ HomingAquireTarget(64a00b84ed3f82ee).(objectcxx . . $ object# *obj) {
1438 objectcxx . . $ object# *track_goal = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle.);
1439 objectcxx . . $ object# *weapon_parent = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.);
1440
1441 // Forces its parent to itself if there is no parent
1442 if (weapon_parent == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1443 weapon_parent = obj;
1444 }
1445
1446 // Determine if the current track_goal is valid
1447 if (track_goal) {
1448 bool f_locked = false;
1449
1450 vectorcxx . . $ vector# to_target = track_goal->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.;
1451 float dist_to_target = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to_target) - track_goal->sizecxx . . $ object#size. - obj->sizecxx . . $ object#size.;
1452
1453 if (obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`! || obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`! ||
1454 (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) {
1455 f_locked = false;
1456 } else 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`!)) {
1457 f_locked = false;
1458 } else if (to_target *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. > Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].homing_fovcxx . . $ weapon#homing_fov.) {
1459 if (track_goal == Player_objectcxx . . $ Player_object. && Player_objectcxx . . $ Player_object.->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1460 float sound_delta;
1461 float volume;
1462
1463 if (dist_to_target > MAX_HOMING_SOUND_TIME_DISTcxx . . $ `Descent3/WeaponFire.cpp:1431:9`!) {
1464 sound_delta = MAX_HOMING_SOUND_TIMEcxx . . $ `Descent3/WeaponFire.cpp:1432:9`!;
1465 volume = MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2.0f;
1466 } else {
1467 float percent_near = dist_to_target / (float)MAX_HOMING_SOUND_TIME_DISTcxx . . $ `Descent3/WeaponFire.cpp:1431:9`!;
1468
1469 sound_delta = MAX_HOMING_SOUND_TIMEcxx . . $ `Descent3/WeaponFire.cpp:1432:9`! * percent_near;
1470 volume = MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2.0f + MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2.0 * (1.0f - percent_near);
1471
1472 if (sound_delta < MIN_HOMING_SOUND_TIMEcxx . . $ `Descent3/WeaponFire.cpp:1433:9`!) {
1473 sound_delta = MIN_HOMING_SOUND_TIMEcxx . . $ `Descent3/WeaponFire.cpp:1433:9`!;
1474 volume = MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!;
1475 }
1476 }
1477
1478 if (!(obj->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SILENT_HOMINGcxx . . $ `Descent3/weapon.h:246:9`!) &&
1479 !(obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_GUIDEDcxx . . $ `Descent3/object_external.h:335:9`!) &&
1480 Playerscxx . . $ Players.[Player_objectcxx . . $ Player_object.->idcxx . . $ object#id.].last_homing_warning_sound_timecxx . . $ player#last_homing_warning_sound_time. + sound_delta < Gametimecxx . . $ Gametime.) {
1481 fvi_querycxx . . $ fvi_query# fq;
1482 fvi_infocxx . . $ fvi_info# hit_info;
1483
1484 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
1485 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
1486 fq.p1cxx . . $ fvi_query#p1. = &track_goal->poscxx . . $ object#pos.;
1487 fq.radcxx . . $ fvi_query#rad. = 0.0f;
1488 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
1489 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1490 fq.flagscxx . . $ fvi_query#flags. = /*FQ_TRANSPOINT | */ FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_ONLY_DOOR_OBJcxx . . $ `lib/findintersection_external.h:72:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`!;
1491
1492 fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
1493
1494 // Only plays sound if there is a LOS between the player and the homing weapon
1495 if (hit_info.hit_typecxx . . $ fvi_info#hit_type.[0] == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
1496 Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(7bec394c8d81705d).(SOUND_MISSLE_LOCKcxx . . $ `Descent3/sounds.h:115:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, volume);
1497 Playerscxx . . $ Players.[Player_objectcxx . . $ Player_object.->idcxx . . $ object#id.].last_homing_warning_sound_timecxx . . $ player#last_homing_warning_sound_time. = Gametimecxx . . $ Gametime.;
1498 }
1499 }
1500 }
1501
1502 if (dist_to_target < CLOSE_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1429:9`!) {
1503 f_locked = true;
1504 } else if (dist_to_target < MAX_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1428:9`!) {
1505 if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(obj->roomnumcxx . . $ object#roomnum., track_goal->roomnumcxx . . $ object#roomnum.)) {
1506 if (Gametimecxx . . $ Gametime. > obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_track_timecxx . . $ laser_info_s#last_track_time. + HOMING_CHECK_VIS_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:1434:9`!) {
1507 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_track_timecxx . . $ laser_info_s#last_track_time. = Gametimecxx . . $ Gametime.;
1508 fvi_querycxx . . $ fvi_query# fq;
1509 fvi_infocxx . . $ fvi_info# hit_info;
1510
1511 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
1512 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
1513 fq.p1cxx . . $ fvi_query#p1. = &track_goal->poscxx . . $ object#pos.;
1514 fq.radcxx . . $ fvi_query#rad. = 0.0f;
1515 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
1516 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1517 fq.flagscxx . . $ fvi_query#flags. = /*FQ_TRANSPOINT | */ FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_ONLY_DOOR_OBJcxx . . $ `lib/findintersection_external.h:72:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`!;
1518
1519 fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
1520 if (hit_info.hit_typecxx . . $ fvi_info#hit_type.[0] == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
1521 f_locked = true;
1522 }
1523 } else {
1524 f_locked = true;
1525 }
1526 }
1527 }
1528 }
1529
1530 if (!f_locked) {
1531 track_goal = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1532 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1533 }
1534 }
1535
1536 // Determine a track_goal if there is not one
1537 if (!track_goal) {
1538 int i;
1539 int best_index = -1;
1540 int best_dist = MAX_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1428:9`! + 1;
1541 float best_dot = -1.0f;
1542
1543 if (Gametimecxx . . $ Gametime. > obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_track_timecxx . . $ laser_info_s#last_track_time. + HOMING_FIND_LOC_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:1435:9`!) {
1544 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_track_timecxx . . $ laser_info_s#last_track_time. = Gametimecxx . . $ Gametime.;
1545
1546 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
1547 if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(obj->roomnumcxx . . $ object#roomnum., Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum.)) {
1548 if ((i != OBJNUMcxx . . $ `Descent3/object.h:700:9`!(weapon_parent)) && ((Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.) ||
1549 (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) || (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!))) {
1550 vectorcxx . . $ vector# to_target = Objectscxx . . $ Objects.[i].poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.;
1551
1552 if (Objectscxx . . $ Objects.[i].effect_infocxx . . $ object#effect_info. && Objectscxx . . $ Objects.[i].effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)
1553 continue;
1554
1555 if (weapon_parent && !AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(weapon_parent), ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(&Objectscxx . . $ Objects.[i])))
1556 continue;
1557
1558 float dist_to_target = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to_target) - obj->sizecxx . . $ object#size. - Objectscxx . . $ Objects.[i].sizecxx . . $ object#size.;
1559 float cur_dot = to_target *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1560
1561 if (cur_dot > Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].homing_fovcxx . . $ weapon#homing_fov.) {
1562 // Pick chaff over other objects
1563 if ((Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) && (Objectscxx . . $ Objects.[i].idcxx . . $ object#id. == GENOBJ_CHAFFCHUNKcxx . . $ `Descent3/objinfo.h:360:9`!)) {
1564 // Make multiplayer safe!
1565 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1566 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
1567 if (!(Local_object_listcxx . . $ Local_object_list.[i] & 0x3)) {
1568 best_index = i;
1569 break;
1570 }
1571 } else {
1572 if (!(i & 0x3)) {
1573 best_index = i;
1574 break;
1575 }
1576 }
1577 } else {
1578 if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() < D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! / 4) { // 1/4 chance of picking chaff
1579 best_index = i;
1580 break;
1581 }
1582 }
1583 } else if (dist_to_target < CLOSE_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1429:9`!) {
1584 best_index = i;
1585 break;
1586 } else if (dist_to_target < MAX_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1428:9`!) {
1587 if (cur_dot > best_dot) {
1588
1589 fvi_querycxx . . $ fvi_query# fq;
1590 fvi_infocxx . . $ fvi_info# hit_info;
1591
1592 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
1593 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
1594 fq.p1cxx . . $ fvi_query#p1. = &Objectscxx . . $ Objects.[i].poscxx . . $ object#pos.;
1595 fq.radcxx . . $ fvi_query#rad. = 0.0f;
1596 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
1597 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1598 fq.flagscxx . . $ fvi_query#flags. = FQ_TRANSPOINTcxx . . $ `lib/findintersection_external.h:61:9`! | FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_ONLY_DOOR_OBJcxx . . $ `lib/findintersection_external.h:72:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`!;
1599
1600 fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
1601 if (hit_info.hit_typecxx . . $ fvi_info#hit_type.[0] == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
1602 best_index = i;
1603 best_dist = dist_to_target;
1604 best_dot = cur_dot;
1605 }
1606 }
1607 }
1608 }
1609 }
1610 }
1611 }
1612 if (best_index >= 0) {
1613 track_goal = &Objectscxx . . $ Objects.[best_index];
1614 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle. = Objectscxx . . $ Objects.[best_index].handlecxx . . $ object#handle.;
1615 }
1616 }
1617 }
1618
1619 return track_goal;
1620 }
1621
1622 // Does homing code
1623 void HomingDoFramecxx . . $ HomingDoFrame(419c470199a90a97).(objectcxx . . $ object# *obj) {
1624 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1625
1626 HomingTurnTowardObjcxx . . $ HomingTurnTowardObj(6273fa812ac58a8).(obj, HomingAquireTargetcxx . . $ HomingAquireTarget(64a00b84ed3f82ee).(obj));
1627 }
1628
1629 void WeaponDoFramecxx . . $ WeaponDoFrame(419c470199a90a97).(objectcxx . . $ object# *obj) {
1630 bool draw_effects = 1;
1631
1632 if (!Detail_settingscxx . . $ Detail_settings..Weapon_coronas_enabledcxx . . $ tDetailSettings#Weapon_coronas_enabled.)
1633 draw_effects = 0;
1634
1635 if (MAX_WEAPON_NOT_HIT_PARENT_TIMEcxx . . $ `Descent3/weapon.h:205:9`! + obj->creation_timecxx . . $ object#creation_time. < Gametimecxx . . $ Gametime.)
1636 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_NO_COLLIDE_PARENTcxx . . $ `Descent3/object_external.h:326:9`!);
1637
1638 if ((obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_USES_THRUSTcxx . . $ `Descent3/object_external.h:319:9`!) && (obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..thrust_leftcxx . . $ laser_info_s#thrust_left. >= 0.0)) {
1639 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..thrust_leftcxx . . $ laser_info_s#thrust_left. -= Frametimecxx . . $ Frametime.;
1640
1641 if ((obj->creation_timecxx . . $ object#creation_time. + 0.1f < Gametimecxx . . $ Gametime.) && (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_HOMINGcxx . . $ `Descent3/object_external.h:334:9`!) &&
1642 !(obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_GUIDEDcxx . . $ `Descent3/object_external.h:335:9`!)) {
1643 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_track_timecxx . . $ laser_info_s#last_track_time. = Gametimecxx . . $ Gametime. - HOMING_CHECK_VIS_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:1434:9`!;
1644 HomingDoFramecxx . . $ HomingDoFrame(419c470199a90a97).(obj);
1645 }
1646
1647 if (obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..thrust_leftcxx . . $ laser_info_s#thrust_left. <= 0.0) {
1648 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_USES_THRUSTcxx . . $ `Descent3/object_external.h:319:9`!);
1649 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust.);
1650 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust.);
1651
1652 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag. = 0.005f;
1653 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotdragcxx . . $ physics_info#rotdrag. = 0.005f;
1654
1655 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. |= PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`!;
1656 }
1657 }
1658
1659 if ((Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SMOKEcxx . . $ `Descent3/weapon.h:220:9`!) && draw_effects) {
1660 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_PLANAR_SMOKEcxx . . $ `Descent3/weapon.h:245:9`!) {
1661 vectorcxx . . $ vector# newpos = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). (obj->sizecxx . . $ object#size. / 2));
1662 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, BILLBOARD_SMOKETRAIL_INDEXcxx . . $ `Descent3/fireball_external.h:69:9`!, obj->roomnumcxx . . $ object#roomnum., &newpos);
1663 if (visnum >= 0) {
1664 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
1665 vis->custom_handlecxx . . $ vis_effect#custom_handle. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].smoke_handlecxx . . $ weapon#smoke_handle.;
1666 vis->lifeleftcxx . . $ vis_effect#lifeleft. = 1.0;
1667 vis->lifetimecxx . . $ vis_effect#lifetime. = 1.0;
1668
1669 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_smoke_poscxx . . $ laser_info_s#last_smoke_pos.;
1670 vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width. = 4;
1671 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..red_light1cxx . . $ light_info#red_light1. * 255.0,
1672 Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..green_light1cxx . . $ light_info#green_light1. * 255.0,
1673 Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..blue_light1cxx . . $ light_info#blue_light1. * 255.0);
1674 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_smoke_poscxx . . $ laser_info_s#last_smoke_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->poscxx . . $ vis_effect#pos.;
1675 }
1676 } else {
1677 // Create blobby smoke
1678 // Create extras
1679 vectorcxx . . $ vector# blobpos = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). obj->sizecxx . . $ object#size.);
1680
1681 float delta_time = Frametimecxx . . $ Frametime.;
1682 vectorcxx . . $ vector# delta_vec = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(252247219a31502c). delta_time;
1683
1684 float mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&delta_vec);
1685 float extras = (mag * 4) + .5;
1686 int int_extras = extras + 1;
1687
1688 int_extras = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(int_extras, 2);
1689
1690 delta_vec /=cxx . . $ `operator/=`(f132838b2cd11d6). int_extras;
1691 delta_time /= int_extras;
1692
1693 vectorcxx . . $ vector# new_blobpos = blobpos;
1694
1695 for (int i = 0; i < int_extras; i++) {
1696 int visnum = CreateFireballcxx . . $ CreateFireball(2a769cac3223e33b).(&new_blobpos, SMOKE_TRAIL_INDEXcxx . . $ `Descent3/fireball_external.h:32:9`!, obj->roomnumcxx . . $ object#roomnum., VISUAL_FIREBALLcxx . . $ `Descent3/fireball.h:165:9`!);
1697
1698 if (visnum >= 0) {
1699 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
1700
1701 vis->custom_handlecxx . . $ vis_effect#custom_handle. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].smoke_handlecxx . . $ weapon#smoke_handle.;
1702 vis->lifeleftcxx . . $ vis_effect#lifeleft. -= (i * delta_time);
1703 vis->creation_timecxx . . $ vis_effect#creation_time. -= (i * delta_time);
1704
1705 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_REVERSE_SMOKEcxx . . $ `Descent3/weapon.h:239:9`!)
1706 vis->flagscxx . . $ vis_effect#flags. |= VF_REVERSEcxx . . $ `Descent3/viseffect_external.h:68:9`!;
1707 }
1708
1709 new_blobpos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). delta_vec;
1710 }
1711 }
1712 }
1713
1714 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].particle_countcxx . . $ weapon#particle_count. > 0 && Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].particle_handlecxx . . $ weapon#particle_handle. != -1 && draw_effects) {
1715 vectorcxx . . $ vector# pos = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). obj->sizecxx . . $ object#size.);
1716 weaponcxx . . $ weapon# *weap = &Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.];
1717 float particle_interval = (1.0 / (float)weap->particle_countcxx . . $ weapon#particle_count.);
1718
1719 if (Gametimecxx . . $ Gametime. - obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_drop_timecxx . . $ laser_info_s#last_drop_time. > particle_interval) {
1720 CreateRandomParticlescxx . . $ CreateRandomParticles(7b2877c745efbbf9).(1, &pos, obj->roomnumcxx . . $ object#roomnum., weap->particle_handlecxx . . $ weapon#particle_handle., weap->particle_sizecxx . . $ weapon#particle_size., weap->particle_lifecxx . . $ weapon#particle_life.);
1721 obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..last_drop_timecxx . . $ laser_info_s#last_drop_time. = Gametimecxx . . $ Gametime.;
1722 }
1723 }
1724
1725 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_RINGcxx . . $ `Descent3/weapon.h:227:9`!) {
1726 float norm = ((Gametimecxx . . $ Gametime. - obj->creation_timecxx . . $ object#creation_time.) / obj->lifetimecxx . . $ object#lifetime.);
1727 obj->sizecxx . . $ object#size. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].sizecxx . . $ weapon#size. + (norm * Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].sizecxx . . $ weapon#size. * 8);
1728 }
1729 }
1730
1731 bool WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(vectorcxx . . $ vector# *gun_point, vectorcxx . . $ vector# *gun_normal, objectcxx . . $ object# *obj, int gun_num) {
1732 poly_modelcxx . . $ poly_model# *pm;
1733 vectorcxx . . $ vector# pnt;
1734 vectorcxx . . $ vector# normal;
1735 matrixcxx . . $ matrix# m;
1736 int mn; // submodel number
1737 float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
1738 bool f_good_gp = true;
1739
1740 if (!(obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!)) {
1741 // mprintf(0,"Object type %d is not a polyobj!\n",obj->type);
1742
1743 if (gun_point)
1744 *gun_point =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1745 if (gun_normal)
1746 *gun_normal =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1747
1748 return false;
1749 }
1750
1751 pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
1752
1753 if (pm->n_gunscxx . . $ poly_model#n_guns. == 0) {
1754 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "WARNING: Object with no weapons is firing.\n", gun_num);
1755
1756 if (gun_point)
1757 *gun_point =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1758 if (gun_normal)
1759 *gun_normal =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1760
1761 return false;
1762 }
1763
1764 SetNormalizedTimeObjcxx . . $ SetNormalizedTimeObj(8af4de573afdac78).(obj, normalized_time);
1765 SetModelAnglesAndPoscxx . . $ SetModelAnglesAndPos(a00e94110fc4ea4c).(pm, normalized_time);
1766
1767 if (gun_num < 0 || gun_num >= pm->n_gunscxx . . $ poly_model#n_guns.) {
1768 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "WARNING: Bashing gun num %d to 0.\n", gun_num);
1769 if (gun_point)
1770 *gun_point =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1771 if (gun_normal)
1772 *gun_normal =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1773 return false;
1774 }
1775
1776 pnt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pm->gun_slotscxx . . $ poly_model#gun_slots.[gun_num].pntcxx . . $ w_bank#pnt.;
1777 normal =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pm->gun_slotscxx . . $ poly_model#gun_slots.[gun_num].normcxx . . $ w_bank#norm.;
1778 mn = pm->gun_slotscxx . . $ poly_model#gun_slots.[gun_num].parentcxx . . $ w_bank#parent.;
1779
1780 // Instance up the tree for this gun
1781 while (mn != -1) {
1782 vectorcxx . . $ vector# tpnt;
1783
1784 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&m, pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..pcxx . . $ angvec#p., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..hcxx . . $ angvec#h., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..bcxx . . $ angvec#b.);
1785 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
1786
1787 if (gun_point)
1788 tpnt =cxx . . $ vector#`operator=`(c0842353a20857d). pnt *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
1789
1790 if (gun_normal)
1791 normal =cxx . . $ vector#`operator=`(c0842353a20857d). normal *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
1792
1793 if (gun_point)
1794 pnt =cxx . . $ vector#`operator=`(c0842353a20857d). tpnt +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].offsetcxx . . $ bsp_info#offset. +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].mod_poscxx . . $ bsp_info#mod_pos.;
1795
1796 mn = pm->submodelcxx . . $ poly_model#submodel.[mn].parentcxx . . $ bsp_info#parent.;
1797 }
1798
1799 m =cxx . . $ matrix#`operator=`(4c6f8b29806742). obj->orientcxx . . $ object#orient.;
1800 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
1801
1802 if (gun_point)
1803 *gun_point =cxx . . $ vector#`operator=`(c0842353a20857d). pnt *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
1804 if (gun_normal)
1805 *gun_normal =cxx . . $ vector#`operator=`(c0842353a20857d). normal *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
1806
1807 if (gun_point)
1808 *gun_point +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->poscxx . . $ object#pos.;
1809
1810 return f_good_gp;
1811 }
1812
1813 #define MIN_FIRE_SPREADcxx . . $ `Descent3/WeaponFire.cpp:1813:9`! 5000
1814 #define MAX_FIRE_SPREADcxx . . $ `Descent3/WeaponFire.cpp:1814:9`! 16768 // We vary by difficulty level!!!!!!!! Its the total fire cone (half each way)
1815
1816 // Given an object and a weapon, fires a shot from that object
1817 int FireWeaponFromObjectcxx . . $ FireWeaponFromObject(3c611958fe04e279).(objectcxx . . $ object# *obj, int weapon_num, int gun_num, bool f_force_forward, bool f_force_target) {
1818 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weapons[weapon_num].used);
1819
1820 // Mass driver is hack
1821 static int mass_driver_id = -2;
1822 static int mass_driver_ring = -2;
1823
1824 if (mass_driver_id == -2) {
1825 mass_driver_id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("Mass Driver");
1826 mass_driver_ring = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("CloakRing.tga1");
1827 }
1828
1829 vectorcxx . . $ vector# laser_pos, laser_dir;
1830 int objnum;
1831
1832 if (gun_num == -1) {
1833 laser_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1834 laser_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1835 } else {
1836 // Find the initial position of the laser
1837 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.];
1838 // vector *pnt = &pm->gun_slots[gun_num].pnt;
1839 // vector gun_point;
1840 // matrix m;
1841
1842 if (gun_num >= pm->n_gunscxx . . $ poly_model#n_guns.) {
1843 // We don't have a gun point for this gun!
1844 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Trying to fire from gun %d...we don't have that gun!\n", gun_num);
1845 laser_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1846 laser_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1847 } else {
1848 if (f_force_forward) {
1849 WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&laser_pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, obj, gun_num);
1850 laser_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
1851 } else if (f_force_target && obj->ai_infocxx . . $ object#ai_info. && obj->ai_infocxx . . $ object#ai_info.->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived. !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) {
1852 WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&laser_pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, obj, gun_num);
1853 laser_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->ai_infocxx . . $ object#ai_info.->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived.;
1854 } else {
1855 WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&laser_pos, &laser_dir, obj, gun_num);
1856 }
1857 }
1858 }
1859
1860 if ((obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (obj->ai_infocxx . . $ object#ai_info.->fire_spreadcxx . . $ ai_frame#fire_spread. || (Diff_ai_min_fire_spreadcxx . . $ Diff_ai_min_fire_spread.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]))) {
1861 matrixcxx . . $ matrix# rot_mat;
1862 anglecxx . . $ angle# p, h, b;
1863
1864 float diff_scale = DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`! / (MAX_DIFFICULTY_LEVELScxx . . $ `Descent3/difficulty_external.h:22:9`! - 1);
1865 float fs = (MAX_FIRE_SPREADcxx . . $ `Descent3/WeaponFire.cpp:1814:9`! * (1.0f - diff_scale)) + (MIN_FIRE_SPREADcxx . . $ `Descent3/WeaponFire.cpp:1813:9`! * diff_scale);
1866
1867 int16_t fire_spread = obj->ai_infocxx . . $ object#ai_info.->fire_spreadcxx . . $ ai_frame#fire_spread. * fs;
1868
1869 if ((obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! && ((obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) != AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!)) &&
1870 fire_spread < Diff_ai_min_fire_spreadcxx . . $ Diff_ai_min_fire_spread.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!] * fs) {
1871 fire_spread = Diff_ai_min_fire_spreadcxx . . $ Diff_ai_min_fire_spread.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!] * fs;
1872 }
1873
1874 int16_t half_fire_spread = fire_spread >> 1;
1875
1876 if (fire_spread > 0) {
1877 p = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % fire_spread) - half_fire_spread;
1878 h = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % fire_spread) - half_fire_spread;
1879 b = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % fire_spread) - half_fire_spread;
1880
1881 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&rot_mat, p, h, b);
1882
1883 laser_dir =cxx . . $ vector#`operator=`(c0842353a20857d). laser_dir *cxx . . $ `operator*`(14b8f9ac5c1e7b85). rot_mat;
1884 }
1885 }
1886
1887 objnum = CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(&laser_pos, &laser_dir, obj, weapon_num);
1888 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1889 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
1890 if (obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) {
1891 MultiSendRobotFireWeaponcxx . . $ MultiSendRobotFireWeapon(31923516c07f001d).(obj->handlecxx . . $ object#handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!, &laser_pos, &laser_dir, (uint16_tcxx . . $ uint16_t#)weapon_num);
1892 }
1893 }
1894 }
1895 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) {
1896 DemoWriteWeaponFirecxx . . $ DemoWriteWeaponFire(dd192dd00f042f22).(obj->handlecxx . . $ object#handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!, &laser_pos, &laser_dir, (uint16_tcxx . . $ uint16_t#)weapon_num, objnum,
1897 gun_num);
1898 }
1899
1900 // bail out of their was an error creating this weapon object
1901 if (objnum == -1)
1902 return -1;
1903
1904 // Record gun number
1905 Objectscxx . . $ Objects.[objnum].ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..src_gun_numcxx . . $ laser_info_s#src_gun_num. = gun_num;
1906
1907 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(&Objectscxx . . $ Objects.[objnum], AIN_OBJ_FIREDcxx . . $ `Descent3/aistruct_external.h:293:9`!, obj);
1908
1909 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && obj == Player_objectcxx . . $ Player_object.) {
1910 // Check if missile camera enabled, and if this weapon allows it
1911 if ((Missile_camera_windowcxx . . $ Missile_camera_window. != -1) && (Weaponscxx . . $ Weapons.[weapon_num].flagscxx . . $ weapon#flags. & WF_ENABLE_CAMERAcxx . . $ `Descent3/weapon.h:232:9`!)) {
1912
1913 // Check if there's already a missile camera
1914 objectcxx . . $ object# *viewer_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(GetSmallViewercxx . . $ GetSmallViewer(7864480464b09eea).(Missile_camera_windowcxx . . $ Missile_camera_window.));
1915 if ((viewer_obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) || (viewer_obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!))
1916 CreateSmallViewcxx . . $ CreateSmallView(114097c446ee1c3e).(Missile_camera_windowcxx . . $ Missile_camera_window., Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle., SVF_POPUPcxx . . $ `Descent3/SmallViews.h:77:9`! + SVF_BIGGERcxx . . $ `Descent3/SmallViews.h:78:9`!);
1917 }
1918 }
1919
1920 // if (Weapons[weapon_num].sounds[WSI_FIRE]!=SOUND_NONE_INDEX)
1921 // Sound_system.Play3dSound(Weapons[weapon_num].sounds[WSI_FIRE], &Objects[objnum]);
1922
1923 if (Weaponscxx . . $ Weapons.[weapon_num].soundscxx . . $ weapon#sounds.[WSI_FLYINGcxx . . $ `Descent3/weapon.h:264:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
1924 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[weapon_num].soundscxx . . $ weapon#sounds.[WSI_FLYINGcxx . . $ `Descent3/weapon.h:264:9`!], SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, &Objectscxx . . $ Objects.[objnum]);
1925
1926 // Do a muzzle flash from this gun
1927 if (Weaponscxx . . $ Weapons.[weapon_num].flagscxx . . $ weapon#flags. & WF_MUZZLEcxx . . $ `Descent3/weapon.h:236:9`!) {
1928 int visnum;
1929 vectorcxx . . $ vector# newpos;
1930
1931 if (obj == &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.]) {
1932 newpos =cxx . . $ vector#`operator=`(c0842353a20857d). laser_pos +cxx . . $ operator+(b77b703cd1e43e33). (laser_dir);
1933 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, MUZZLE_FLASH_INDEXcxx . . $ `Descent3/fireball_external.h:42:9`!, obj->roomnumcxx . . $ object#roomnum., &newpos);
1934 } else {
1935 newpos =cxx . . $ vector#`operator=`(c0842353a20857d). laser_pos +cxx . . $ operator+(b77b703cd1e43e33). (laser_dir /cxx . . $ `operator/`(252247219a31502c). 2);
1936 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, MUZZLE_FLASH_INDEXcxx . . $ `Descent3/fireball_external.h:42:9`!, obj->roomnumcxx . . $ object#roomnum., &newpos);
1937 }
1938
1939 // Make this guy live for a very short time
1940 if (visnum >= 0) {
1941 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
1942
1943 vis->lifetimecxx . . $ vis_effect#lifetime. = .08f;
1944 vis->lifeleftcxx . . $ vis_effect#lifeleft. = .08f;
1945 vis->sizecxx . . $ vis_effect#size. = 1.0f;
1946
1947 vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
1948 vis->velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
1949
1950 // Make some smoke!
1951 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, MED_SMOKE_INDEXcxx . . $ `Descent3/fireball_external.h:29:9`!, obj->roomnumcxx . . $ object#roomnum., &newpos);
1952 if (visnum >= 0) {
1953 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
1954
1955 vis->lifetimecxx . . $ vis_effect#lifetime. = .3f;
1956 vis->lifeleftcxx . . $ vis_effect#lifeleft. = .3f;
1957
1958 vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
1959 vis->velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
1960 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. += 10;
1961 }
1962 }
1963 }
1964
1965 // Check for mass driver
1966 if (weapon_num == mass_driver_id) {
1967 // Create a fire trail for this weapon
1968 // find out where this weapon hits
1969 fvi_querycxx . . $ fvi_query# fq;
1970 fvi_infocxx . . $ fvi_info# hit_data;
1971
1972 vectorcxx . . $ vector# dest_vec = laser_pos +cxx . . $ operator+(b77b703cd1e43e33). (laser_dir *cxx . . $ `operator*`(252247219a31502c). 5000);
1973
1974 fq.p0cxx . . $ fvi_query#p0. = &laser_pos;
1975 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
1976 fq.p1cxx . . $ fvi_query#p1. = &dest_vec;
1977 fq.radcxx . . $ fvi_query#rad. = 0;
1978 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
1979 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1980 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`!;
1981
1982 fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
1983
1984 float mag = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&hit_data.hit_pntcxx . . $ fvi_info#hit_pnt., &obj->poscxx . . $ object#pos.);
1985
1986 int visnum;
1987
1988 if (obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || obj->typecxx . . $ object#type. != OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! || stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Object_info[obj->id].name, "FinalbossLITTLETIT") != 0)
1989 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, MASSDRIVER_EFFECT_INDEXcxx . . $ `Descent3/fireball_external.h:70:9`!, obj->roomnumcxx . . $ object#roomnum., &laser_pos);
1990 else
1991 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, MERCBOSS_MASSDRIVER_EFFECT_INDEXcxx . . $ `Descent3/fireball_external.h:74:9`!, obj->roomnumcxx . . $ object#roomnum., &laser_pos);
1992
1993 if (visnum >= 0) {
1994 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
1995 vis->custom_handlecxx . . $ vis_effect#custom_handle. = mass_driver_ring;
1996 vis->lifeleftcxx . . $ vis_effect#lifeleft. = 1.5;
1997 vis->lifetimecxx . . $ vis_effect#lifetime. = 1.5;
1998
1999 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_data.hit_pntcxx . . $ fvi_info#hit_pnt.;
2000 vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width. = 1;
2001 if (obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || obj->typecxx . . $ object#type. != OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! || stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Object_info[obj->id].name, "FinalbossLITTLETIT") != 0)
2002 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(100, 100, 170);
2003 else
2004 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(240, 10, 10);
2005 vis->flagscxx . . $ vis_effect#flags. |= VF_LINK_TO_VIEWERcxx . . $ `Descent3/viseffect_external.h:72:9`! | VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!;
2006 vis->sizecxx . . $ vis_effect#size. = mag;
2007 }
2008 }
2009
2010 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
2011 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.;
2012 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = obj->handlecxx . . $ object#handle.;
2013 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_WEAPONFIREDcxx . . $ `lib/d3events.h:115:9`!, &DLLInfocxx . . $ DLLInfo.);
2014 }
2015
2016 return objnum;
2017 }
2018
2019 // This define determines how wide this arc is
2020 #define ELECTRICAL_WIDTHcxx . . $ `Descent3/WeaponFire.cpp:2020:9`! .3f
2021 #define ELECTRICAL_ALPHAcxx . . $ `Descent3/WeaponFire.cpp:2021:9`! .2
2022
2023 #include "args.h"cxx . . $ `<file>/Descent3/args.h`/
2024
2025 // Draws a lighting like chain of electricity
2026 void DrawElectricalWeaponcxx . . $ DrawElectricalWeapon(419c470199a90a97).(objectcxx . . $ object# *obj) {
2027 int i, t;
2028 vectorcxx . . $ vector# center_vecs[20];
2029 vectorcxx . . $ vector# arc_vec;
2030 g3Pointcxx . . $ g3Point# arc_points[100];
2031 vectorcxx . . $ vector# dest_vector, src_vector, line_norm;
2032 float line_mag;
2033 g3Pointcxx . . $ g3Point# *pntlist[20];
2034 vectorcxx . . $ vector# dir;
2035 objectcxx . . $ object# *parent_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.);
2036 float view_dp = 0;
2037
2038 if (!parent_obj)
2039 return;
2040
2041 if (parent_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2042 if (Playerscxx . . $ Players.[parent_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`!))
2043 return;
2044 } else {
2045 if (parent_obj->flagscxx . . $ object#flags. & OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!)
2046 return;
2047 }
2048
2049 int bm_handle = GetWeaponFireImagecxx . . $ GetWeaponFireImage(9b79fb6aee4c0440).(obj->idcxx . . $ object#id., 0);
2050 ASSERTcxx . . $ `misc/pserror.h:246:9`!(bm_handle >= 0);
2051
2052 WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&src_vector, &dir, parent_obj, obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..src_gun_numcxx . . $ laser_info_s#src_gun_num.);
2053
2054 if (obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! || ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle.) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
2055 dest_vector =cxx . . $ vector#`operator=`(c0842353a20857d). src_vector +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 50);
2056 } else {
2057 objectcxx . . $ object# *obj_to_track = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..track_handlecxx . . $ laser_info_s#track_handle.);
2058 dest_vector =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj_to_track->poscxx . . $ object#pos.;
2059 if (obj_to_track == Player_objectcxx . . $ Player_object.) {
2060 vectorcxx . . $ vector# subvec = src_vector -cxx . . $ operator-(b77b703cd1e43e33). dest_vector;
2061 float mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&subvec);
2062
2063 if (mag < .5) {
2064 obj->lifeleftcxx . . $ object#lifeleft. = 0;
2065 return;
2066 }
2067
2068 subvec /=cxx . . $ `operator/=`(f132838b2cd11d6). mag;
2069
2070 dest_vector +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). subvec; // This prevents rendering errors
2071 }
2072 }
2073
2074 // Find out if it is o.k. to create a weapon here.
2075 fvi_querycxx . . $ fvi_query# fq;
2076 fvi_infocxx . . $ fvi_info# hit_data;
2077 int fate;
2078
2079 fq.p0cxx . . $ fvi_query#p0. = &src_vector;
2080 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
2081 fq.p1cxx . . $ fvi_query#p1. = &dest_vector;
2082 fq.radcxx . . $ fvi_query#rad. = 0;
2083 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
2084 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2085 fq.flagscxx . . $ fvi_query#flags. = 0; // what about trans walls???
2086
2087 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
2088
2089 if (fate == HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`! || fate == HIT_TERRAINcxx . . $ `lib/findintersection_external.h:48:9`!) {
2090 dest_vector =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_data.hit_pntcxx . . $ fvi_info#hit_pnt.;
2091 CreateRandomSparkscxx . . $ CreateRandomSparks(3e6b82e54d72ee3b).((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 4), &dest_vector, obj->roomnumcxx . . $ object#roomnum., COOL_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:38:9`!);
2092 }
2093
2094 line_norm =cxx . . $ vector#`operator=`(c0842353a20857d). dest_vector -cxx . . $ operator-(b77b703cd1e43e33). src_vector;
2095 line_mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&line_norm);
2096
2097 if (line_mag < .5) {
2098 obj->lifeleftcxx . . $ object#lifeleft. = 0;
2099 return;
2100 }
2101
2102 line_norm /=cxx . . $ `operator/=`(f132838b2cd11d6). line_mag;
2103
2104 // Get view dot product for drawing blobs
2105
2106 if (parent_obj != Viewer_objectcxx . . $ Viewer_object.) {
2107 vectorcxx . . $ vector# temp_line_norm = -cxx . . $ operator-(9e07539e219c6f20).line_norm;
2108 view_dp = Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). temp_line_norm;
2109 }
2110
2111 matrixcxx . . $ matrix# mat;
2112
2113 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&mat, &line_norm, 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`!);
2114
2115 // Create the center points of our chain
2116 int num_segments = 20;
2117 int circle_pieces = 5;
2118
2119 if (!Detail_settingscxx . . $ Detail_settings..Weapon_coronas_enabledcxx . . $ tDetailSettings#Weapon_coronas_enabled.)
2120 num_segments = 10;
2121
2122 float line_scalar = (line_mag / (float)num_segments);
2123 line_norm *=cxx . . $ `operator*=`(f132838b2cd11d6). line_scalar;
2124
2125 // Get the src and dest vectors in view space so we know how to compute z
2126
2127 center_vecs[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). src_vector; // Set first one equal to our origin
2128 center_vecs[num_segments - 1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). dest_vector;
2129 vectorcxx . . $ vector# from = src_vector;
2130 int cur_sin = FrameCountcxx . . $ FrameCount. * 5000;
2131
2132 for (i = 1; i < num_segments - 1; i++, from +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). line_norm, cur_sin += 8000) {
2133 center_vecs[i] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). from;
2134 center_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (mat.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). FixSincxx . . $ FixSin(9a38df040a81ca35).(cur_sin % 65536) *cxx . . $ `operator*`(252247219a31502c). .4f);
2135 center_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (mat.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). FixCoscxx . . $ FixCos(9a38df040a81ca35).(cur_sin % 65536) *cxx . . $ `operator*`(252247219a31502c). .4f);
2136 }
2137
2138 // Now that we have our center points, create a tube
2139 for (i = 0; i < num_segments; i++) {
2140 float size = ELECTRICAL_WIDTHcxx . . $ `Descent3/WeaponFire.cpp:2020:9`!;
2141
2142 for (t = 0; t < circle_pieces; t++) {
2143 float norm = (float)t / (float)circle_pieces;
2144 arc_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). center_vecs[i];
2145
2146 if (i != num_segments - 1) {
2147 arc_vec +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). size *cxx . . $ `operator*`(252247219a31502c). FixSincxx . . $ FixSin(9a38df040a81ca35).(norm * 65536));
2148 arc_vec -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). size *cxx . . $ `operator*`(252247219a31502c). FixCoscxx . . $ FixCos(9a38df040a81ca35).(norm * 65536));
2149 }
2150
2151 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&arc_points[i * circle_pieces + t], &arc_vec);
2152 arc_points[i * circle_pieces + t].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!;
2153 }
2154 }
2155
2156 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
2157 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(ELECTRICAL_ALPHAcxx . . $ `Descent3/WeaponFire.cpp:2021:9`! * 255);
2158 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2159 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2160 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
2161
2162 float float_time = (Gametimecxx . . $ Gametime. * 300);
2163 int int_time = float_time;
2164 int_time %= 100;
2165 float vchange = int_time / 100.0;
2166
2167 // Check for no sat flag
2168 bool sat = true;
2169 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nosatomega"))
2170 sat = false;
2171
2172 // Form our vectors into points and draw!
2173 for (t = (num_segments - 1) * circle_pieces, i = num_segments - 1; i >= 1; i--, t -= circle_pieces) {
2174 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
2175 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(sat ? AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`! : AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`!);
2176 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
2177 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2178 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(ELECTRICAL_ALPHAcxx . . $ `Descent3/WeaponFire.cpp:2021:9`! * 255);
2179
2180 for (int k = 0; k < circle_pieces; k++) {
2181 int next = (k + 1) % circle_pieces;
2182
2183 arc_points[t + k].p3_ucxx . . $ `lib/3d.h:250:9`! = 0;
2184 arc_points[t + k].p3_vcxx . . $ `lib/3d.h:251:9`! = 1;
2185
2186 arc_points[t + k - circle_pieces].p3_ucxx . . $ `lib/3d.h:250:9`! = 0;
2187 arc_points[t + k - circle_pieces].p3_vcxx . . $ `lib/3d.h:251:9`! = 0;
2188
2189 arc_points[t + next - circle_pieces].p3_ucxx . . $ `lib/3d.h:250:9`! = 1;
2190 arc_points[t + next - circle_pieces].p3_vcxx . . $ `lib/3d.h:251:9`! = 1;
2191
2192 arc_points[t + next].p3_ucxx . . $ `lib/3d.h:250:9`! = 1;
2193 arc_points[t + next].p3_vcxx . . $ `lib/3d.h:251:9`! = 0;
2194
2195 pntlist[0] = &arc_points[t + k];
2196 pntlist[1] = &arc_points[t + k - circle_pieces];
2197 pntlist[2] = &arc_points[t + next - circle_pieces];
2198 pntlist[3] = &arc_points[t + next];
2199
2200 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle);
2201 }
2202
2203 if (i != num_segments - 1) {
2204 vectorcxx . . $ vector# subvec = center_vecs[i + 1] -cxx . . $ operator-(b77b703cd1e43e33). center_vecs[i];
2205 subvec =cxx . . $ vector#`operator=`(c0842353a20857d). center_vecs[i] +cxx . . $ operator+(b77b703cd1e43e33). (subvec *cxx . . $ `operator*`(252247219a31502c). vchange);
2206
2207 if (parent_obj == Viewer_objectcxx . . $ Viewer_object.) {
2208 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&subvec, .2f, .5f, 1, .6f, 0, ELECTRICAL_WIDTHcxx . . $ `Descent3/WeaponFire.cpp:2020:9`! * 4, sat, 2);
2209 } else {
2210 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&subvec, .2f, .5f, 1, .6f * fabscxx . . $ fabs(fbcf3211dfe1bfd1).(view_dp), 0, ELECTRICAL_WIDTHcxx . . $ `Descent3/WeaponFire.cpp:2020:9`! * 4, sat, 2);
2211 }
2212 }
2213 }
2214
2215 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
2216
2217 // Kill it!
2218 obj->lifeleftcxx . . $ object#lifeleft. = 0;
2219 }
2220
2221 #define FUSION_RAMP_TIMEcxx . . $ `Descent3/WeaponFire.cpp:2221:9`! 3.0
2222 #define FUSION_DAMAGE_SOUND_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:2222:9`! .5
2223
2224 float Last_fusion_damage_timecxx . . $ Last_fusion_damage_time. = 0;
2225
2226 // Does that crazy fusion effect, including damaging/shaking your ship
2227 void DoFusionEffectcxx . . $ DoFusionEffect(766a1b7183ffa4b4).(objectcxx . . $ object# *objp, int weapon_type) {
2228 float norm;
2229 int move = 0;
2230
2231 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
2232 ASSERTcxx . . $ `misc/pserror.h:246:9`!((weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!) || (weapon_type == PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!));
2233
2234 norm = (Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].weaponcxx . . $ player#weapon.[weapon_type].firing_timecxx . . $ player_weapon#firing_time. / FUSION_RAMP_TIMEcxx . . $ `Descent3/WeaponFire.cpp:2221:9`!);
2235
2236 if (norm > .1) {
2237 float over = norm;
2238
2239 if (over > 1.0)
2240 over = 1.0;
2241
2242 over = (over - .1) / .9;
2243
2244 move = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 5) - 2;
2245
2246 objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (objp->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.) *cxx . . $ `operator*`(252247219a31502c). ((float)move * over * Frametimecxx . . $ Frametime. * 175.0);
2247
2248 move = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 5) - 2;
2249
2250 objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (objp->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.) *cxx . . $ `operator*`(252247219a31502c). ((float)move * over * Frametimecxx . . $ Frametime. * 175.0);
2251 }
2252
2253 if (norm > 1.0) {
2254 norm = 1.0;
2255
2256 if ((!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) || Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
2257 if ((Gametimecxx . . $ Gametime. - Last_fusion_damage_timecxx . . $ Last_fusion_damage_time.) < FUSION_DAMAGE_SOUND_INTERVALcxx . . $ `Descent3/WeaponFire.cpp:2222:9`!) {
2258 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(objp, objp, PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`!, (.125 * abscxx . . $ abs(a1851578aea3f541).(move)), 0, 255, 0);
2259 } else {
2260 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(objp, objp, PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`!, (.125 * abscxx . . $ abs(a1851578aea3f541).(move)));
2261 Last_fusion_damage_timecxx . . $ Last_fusion_damage_time. = Gametimecxx . . $ Gametime.;
2262 }
2263 } else {
2264 Multi_requested_damage_typecxx . . $ Multi_requested_damage_type. = PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`!;
2265 Multi_requested_damage_amountcxx . . $ Multi_requested_damage_amount. += (.125 * abscxx . . $ abs(a1851578aea3f541).(move));
2266 }
2267 }
2268
2269 float vals[4];
2270 vals[0] = 1.0;
2271 vals[1] = 0.0;
2272 vals[2] = 1.0;
2273 vals[3] = .25 * norm;
2274
2275 CreateNewEventcxx . . $ CreateNewEvent(85af21da76cb0316).(RENDER_EVENTcxx . . $ `Descent3/gameevent.h:29:9`!, FUSION_EFFECTcxx . . $ `Descent3/gameevent.h:33:9`!, 0, &vals, sizeof(float) * 4, DrawAlphaEventcxx . . $ DrawAlphaEvent(6ca3d68f5c5f0975).);
2276 }
2277
2278 // Do the spray effect
2279 void DoSprayEffectcxx . . $ DoSprayEffect(8a3ad1df6cc7128b).(objectcxx . . $ object# *obj, otype_wb_infocxx . . $ otype_wb_info# *static_wb, uint8_tcxx . . $ uint8_t# wb_index) {
2280 vectorcxx . . $ vector# laser_pos, laser_dir;
2281 int cur_m_bit;
2282
2283 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(obj->flags & OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!));
2284
2285 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.];
2286
2287 // Go through each gun point
2288 for (cur_m_bit = 0; cur_m_bit < pm->poly_wbcxx . . $ poly_model#poly_wb.[0].num_gpscxx . . $ poly_wb_info#num_gps.; cur_m_bit++) {
2289 // Figure out out if this weapon fires from this gunpoint
2290 if (static_wb->gp_fire_maskscxx . . $ otype_wb_info#gp_fire_masks.[obj->dynamic_wbcxx . . $ object#dynamic_wb.[wb_index].cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask.] & (0x01 << cur_m_bit)) {
2291 int weapon_num = static_wb->gp_weapon_indexcxx . . $ otype_wb_info#gp_weapon_index.[cur_m_bit];
2292
2293 WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&laser_pos, &laser_dir, obj, pm->poly_wbcxx . . $ poly_model#poly_wb.[0].gp_indexcxx . . $ poly_wb_info#gp_index.[cur_m_bit]);
2294 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, SPRAY_INDEXcxx . . $ `Descent3/fireball_external.h:40:9`!, obj->roomnumcxx . . $ object#roomnum., &laser_pos);
2295
2296 if (visnum < 0)
2297 return;
2298
2299 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
2300
2301 // Set the initial velocity
2302 vm_ScaleVectorcxx . . $ vm_ScaleVector(cfd0f9d897ccca3c).(&vis->velocitycxx . . $ vis_effect#velocity., &laser_dir, Weaponscxx . . $ Weapons.[weapon_num].phys_infocxx . . $ weapon#phys_info..velocitycxx . . $ physics_info#velocity..zcxx . . $ vector#z.);
2303
2304 // Set initial velocity to that of the firing object
2305 if (Weaponscxx . . $ Weapons.[weapon_num].phys_infocxx . . $ weapon#phys_info..flagscxx . . $ physics_info#flags. & PF_USES_PARENT_VELOCITYcxx . . $ `Descent3/object_external.h:323:9`!) {
2306 float fdot = (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.);
2307 vectorcxx . . $ vector# fvel;
2308
2309 if (fdot > 0.0)
2310 fvel =cxx . . $ vector#`operator=`(c0842353a20857d). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). fdot;
2311 else
2312 fvel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
2313
2314 vectorcxx . . $ vector# rvel = 0.1f *cxx . . $ `operator*`(9d6577ff3e9faa29). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.);
2315 vectorcxx . . $ vector# uvel = 0.1f *cxx . . $ `operator*`(9d6577ff3e9faa29). obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.);
2316
2317 vis->velocitycxx . . $ vis_effect#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). fvel +cxx . . $ operator+(b77b703cd1e43e33). rvel +cxx . . $ operator+(b77b703cd1e43e33). uvel;
2318 }
2319
2320 vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2321 vis->custom_handlecxx . . $ vis_effect#custom_handle. = Weaponscxx . . $ Weapons.[weapon_num].fire_image_handlecxx . . $ weapon#fire_image_handle.;
2322 vis->dragcxx . . $ vis_effect#drag. = Weaponscxx . . $ Weapons.[weapon_num].phys_infocxx . . $ weapon#phys_info..dragcxx . . $ physics_info#drag.;
2323 vis->phys_flagscxx . . $ vis_effect#phys_flags. = Weaponscxx . . $ Weapons.[weapon_num].phys_infocxx . . $ weapon#phys_info..flagscxx . . $ physics_info#flags.;
2324 vis->masscxx . . $ vis_effect#mass. = Weaponscxx . . $ Weapons.[weapon_num].phys_infocxx . . $ weapon#phys_info..masscxx . . $ physics_info#mass.;
2325 vis->sizecxx . . $ vis_effect#size. = Weaponscxx . . $ Weapons.[weapon_num].sizecxx . . $ weapon#size.;
2326 vis->lifetimecxx . . $ vis_effect#lifetime. = Weaponscxx . . $ Weapons.[weapon_num].life_timecxx . . $ weapon#life_time.;
2327 vis->lifeleftcxx . . $ vis_effect#lifeleft. = vis->lifetimecxx . . $ vis_effect#lifetime.;
2328
2329 // Now create extras so that there are no gaps
2330
2331 if (obj != Viewer_objectcxx . . $ Viewer_object.) {
2332 // Find hit point so we know when to stop
2333 float life_scalar = 1.0;
2334 fvi_querycxx . . $ fvi_query# fq;
2335 fvi_infocxx . . $ fvi_info# hit_data;
2336 int fate;
2337 vectorcxx . . $ vector# dest_vector = laser_pos +cxx . . $ operator+(b77b703cd1e43e33). (vis->velocitycxx . . $ vis_effect#velocity. *cxx . . $ `operator*`(252247219a31502c). vis->lifetimecxx . . $ vis_effect#lifetime.);
2338
2339 fq.p0cxx . . $ fvi_query#p0. = &laser_pos;
2340 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
2341 fq.p1cxx . . $ fvi_query#p1. = &dest_vector;
2342 fq.radcxx . . $ fvi_query#rad. = vis->sizecxx . . $ vis_effect#size.;
2343 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
2344 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2345 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
2346
2347 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
2348
2349 if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
2350 vectorcxx . . $ vector# subvec = hit_data.hit_pntcxx . . $ fvi_info#hit_pnt. -cxx . . $ operator-(b77b703cd1e43e33). laser_pos;
2351 vis->lifetimecxx . . $ vis_effect#lifetime. = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&subvec) / vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.);
2352 life_scalar = vis->lifetimecxx . . $ vis_effect#lifetime. / vis->lifeleftcxx . . $ vis_effect#lifeleft.;
2353 vis->lifeleftcxx . . $ vis_effect#lifeleft. = vis->lifetimecxx . . $ vis_effect#lifetime.;
2354 }
2355
2356 float velmag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.);
2357 vectorcxx . . $ vector# velnorm = vis->velocitycxx . . $ vis_effect#velocity. /cxx . . $ `operator/`(252247219a31502c). velmag;
2358 float len = Frametimecxx . . $ Frametime. * velmag;
2359 float fextras = len * 2;
2360 float fps = 1.0 / Frametimecxx . . $ Frametime.;
2361
2362 int extras = fextras;
2363
2364 extras = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(extras, 8);
2365
2366 for (int t = 0; t < extras; t++) {
2367
2368 vectorcxx . . $ vector# newpos = vis->poscxx . . $ vis_effect#pos. +cxx . . $ operator+(b77b703cd1e43e33). (((velnorm *cxx . . $ `operator*`(252247219a31502c). len) /cxx . . $ `operator/`(252247219a31502c). extras) *cxx . . $ `operator*`(252247219a31502c). (t + 1));
2369
2370 int extranum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, SPRAY_INDEXcxx . . $ `Descent3/fireball_external.h:40:9`!, obj->roomnumcxx . . $ object#roomnum., &newpos);
2371 if (extranum >= 0) {
2372 vis_effectcxx . . $ vis_effect# *extravis = &VisEffectscxx . . $ VisEffects.[extranum];
2373 extravis->masscxx . . $ vis_effect#mass. = vis->masscxx . . $ vis_effect#mass.;
2374 extravis->dragcxx . . $ vis_effect#drag. = vis->dragcxx . . $ vis_effect#drag.;
2375 extravis->velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->velocitycxx . . $ vis_effect#velocity.;
2376 extravis->sizecxx . . $ vis_effect#size. = vis->sizecxx . . $ vis_effect#size.;
2377 extravis->phys_flagscxx . . $ vis_effect#phys_flags. = vis->phys_flagscxx . . $ vis_effect#phys_flags.;
2378 extravis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2379 extravis->custom_handlecxx . . $ vis_effect#custom_handle. = vis->custom_handlecxx . . $ vis_effect#custom_handle.;
2380 extravis->lifetimecxx . . $ vis_effect#lifetime. = vis->lifetimecxx . . $ vis_effect#lifetime.;
2381
2382 float life_adjust = ((Frametimecxx . . $ Frametime. / (float)extras) * (t + 1));
2383
2384 extravis->lifeleftcxx . . $ vis_effect#lifeleft. = Frametimecxx . . $ Frametime. * (fps / 2);
2385 extravis->lifeleftcxx . . $ vis_effect#lifeleft. *= life_scalar;
2386 life_adjust *= life_scalar;
2387
2388 if (extravis->lifeleftcxx . . $ vis_effect#lifeleft. > 0)
2389 extravis->creation_timecxx . . $ vis_effect#creation_time. = vis->creation_timecxx . . $ vis_effect#creation_time. - life_adjust;
2390 else {
2391 VisEffectDeletecxx . . $ VisEffectDelete(d4f767463ce0a6b3).(extranum);
2392 }
2393 }
2394 }
2395 } else {
2396 // Find hit point so we know when to stop
2397 fvi_querycxx . . $ fvi_query# fq;
2398 fvi_infocxx . . $ fvi_info# hit_data;
2399 int fate;
2400 vectorcxx . . $ vector# dest_vector = laser_pos +cxx . . $ operator+(b77b703cd1e43e33). (vis->velocitycxx . . $ vis_effect#velocity. *cxx . . $ `operator*`(252247219a31502c). vis->lifetimecxx . . $ vis_effect#lifetime.);
2401
2402 fq.p0cxx . . $ fvi_query#p0. = &laser_pos;
2403 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
2404 fq.p1cxx . . $ fvi_query#p1. = &dest_vector;
2405 fq.radcxx . . $ fvi_query#rad. = vis->sizecxx . . $ vis_effect#size.;
2406 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1;
2407 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2408 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
2409
2410 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data);
2411
2412 if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
2413 vectorcxx . . $ vector# subvec = hit_data.hit_pntcxx . . $ fvi_info#hit_pnt. -cxx . . $ operator-(b77b703cd1e43e33). laser_pos;
2414 vis->lifetimecxx . . $ vis_effect#lifetime. = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&subvec) / vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.);
2415 vis->lifeleftcxx . . $ vis_effect#lifeleft. = vis->lifetimecxx . . $ vis_effect#lifetime.;
2416 }
2417 }
2418 }
2419 }
2420 }
2421
2422 // Draws a streamer behind a weapon
2423 void DrawWeaponStreamercxx . . $ DrawWeaponStreamer(419c470199a90a97).(objectcxx . . $ object# *obj) {
2424 float time_live = Gametimecxx . . $ Gametime. - obj->creation_timecxx . . $ object#creation_time.;
2425 float len;
2426 float norm_time = time_live / obj->lifetimecxx . . $ object#lifetime.;
2427
2428 if (norm_time >= 1)
2429 norm_time = .99999f; // don't go over!
2430
2431 // Get length
2432 objectcxx . . $ object# *parent_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.);
2433
2434 if (!parent_obj)
2435 return;
2436
2437 len = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&parent_obj->poscxx . . $ object#pos., &obj->poscxx . . $ object#pos.);
2438
2439 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_VERTEXcxx . . $ `lib/renderer.h:403:9`!);
2440 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
2441 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
2442 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
2443
2444 vectorcxx . . $ vector# vecs[2];
2445 g3Pointcxx . . $ g3Point# pnts[2];
2446 int i;
2447
2448 vecs[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
2449 vecs[1] =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). len);
2450
2451 for (i = 0; i < 2; i++) {
2452 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnts[i], &vecs[i]);
2453 pnts[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
2454 pnts[i].p3_rcxx . . $ `lib/3d.h:253:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..red_light1cxx . . $ light_info#red_light1.;
2455 pnts[i].p3_gcxx . . $ `lib/3d.h:254:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..green_light1cxx . . $ light_info#green_light1.;
2456 pnts[i].p3_bcxx . . $ `lib/3d.h:255:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..blue_light1cxx . . $ light_info#blue_light1.;
2457 }
2458
2459 pnts[0].p3_acxx . . $ `lib/3d.h:256:9`! = (1.0 - norm_time) * .3f;
2460 pnts[1].p3_acxx . . $ `lib/3d.h:256:9`! = 0;
2461
2462 g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(&pnts[0], &pnts[1]);
2463 }
2464
2465 void DrawBlobbyWeaponRingcxx . . $ DrawBlobbyWeaponRing(419c470199a90a97).(objectcxx . . $ object# *obj) {
2466 vectorcxx . . $ vector# vecs[30];
2467 float lifenorm = (obj->lifetimecxx . . $ object#lifetime. - obj->lifeleftcxx . . $ object#lifeleft.) / obj->lifetimecxx . . $ object#lifetime.;
2468 int i;
2469
2470 int bm_handle;
2471 int num_segments = 20;
2472
2473 int ring_increment = 65536 / num_segments;
2474 int ring_angle = 0;
2475
2476 if (lifenorm >= 1.0)
2477 lifenorm = .999f;
2478
2479 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_IMAGE_BITMAPcxx . . $ `Descent3/weapon.h:219:9`!)
2480 bm_handle = GetWeaponFireImagecxx . . $ GetWeaponFireImage(9b79fb6aee4c0440).(obj->idcxx . . $ object#id., 0);
2481 else {
2482 vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].fire_image_handlecxx . . $ weapon#fire_image_handle.];
2483 int int_frame = vc->num_framescxx . . $ vclip#num_frames. * lifenorm;
2484 bm_handle = vc->framescxx . . $ vclip#frames.[int_frame];
2485 }
2486
2487 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2488 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
2489 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
2490 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).((1.0 - lifenorm) * 255.0);
2491
2492 // Now draw a ring of blobs
2493 ring_angle = 0;
2494 float blob_size = (obj->sizecxx . . $ object#size. / 4);
2495
2496 for (i = 0; i < num_segments; i++, ring_angle += ring_increment) {
2497 float ring_sin = FixSincxx . . $ FixSin(9a38df040a81ca35).(ring_angle);
2498 float ring_cos = FixCoscxx . . $ FixCos(9a38df040a81ca35).(ring_angle);
2499
2500 vecs[i] =cxx . . $ vector#`operator=`(c0842353a20857d). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (ring_cos * obj->sizecxx . . $ object#size.);
2501 vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (ring_sin * obj->sizecxx . . $ object#size.);
2502 vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->poscxx . . $ object#pos.;
2503
2504 g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(&vecs[i], ring_angle, blob_size, (blob_size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0),
2505 bm_handle);
2506 }
2507 }
2508
2509 void DrawPolygonalWeaponRingcxx . . $ DrawPolygonalWeaponRing(419c470199a90a97).(objectcxx . . $ object# *obj) {
2510 vectorcxx . . $ vector# inner_vecs[30], outer_vecs[30];
2511 g3Pointcxx . . $ g3Point# inner_points[30], outer_points[30];
2512 float lifenorm = (obj->lifetimecxx . . $ object#lifetime. - obj->lifeleftcxx . . $ object#lifeleft.) / obj->lifetimecxx . . $ object#lifetime.;
2513 int i;
2514 g3Pointcxx . . $ g3Point# *pntlist[4];
2515 float inner_size = (obj->sizecxx . . $ object#size. * .8);
2516 int objnum = obj - Objectscxx . . $ Objects.;
2517 int odd = objnum % 2;
2518
2519 int num_segments = 20;
2520
2521 int ring_increment = 65536 / num_segments;
2522 int ring_angle = 0;
2523
2524 if (lifenorm > 1.0)
2525 lifenorm = 1.0;
2526
2527 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
2528 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
2529 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
2530 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_VERTEXcxx . . $ `lib/renderer.h:411:9`!);
2531
2532 for (i = 0; i < num_segments; i++, ring_angle += ring_increment) {
2533 float ring_sin = FixSincxx . . $ FixSin(9a38df040a81ca35).(ring_angle);
2534 float ring_cos = FixCoscxx . . $ FixCos(9a38df040a81ca35).(ring_angle);
2535
2536 inner_vecs[i] =cxx . . $ vector#`operator=`(c0842353a20857d). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (ring_cos * inner_size);
2537 inner_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (ring_sin * inner_size);
2538 inner_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->poscxx . . $ object#pos.;
2539
2540 outer_vecs[i] =cxx . . $ vector#`operator=`(c0842353a20857d). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (ring_cos * obj->sizecxx . . $ object#size.);
2541 outer_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (ring_sin * obj->sizecxx . . $ object#size.);
2542 outer_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->poscxx . . $ object#pos.;
2543
2544 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&inner_points[i], &inner_vecs[i]);
2545 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&outer_points[i], &outer_vecs[i]);
2546
2547 outer_points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`! | PF_UVcxx . . $ `lib/3d.h:217:9`!;
2548 inner_points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`! | PF_UVcxx . . $ `lib/3d.h:217:9`!;
2549
2550 outer_points[i].p3_acxx . . $ `lib/3d.h:256:9`! = (1.0 - lifenorm) * .3;
2551 inner_points[i].p3_acxx . . $ `lib/3d.h:256:9`! = (1.0 - lifenorm) * .1;
2552
2553 outer_points[i].p3_rcxx . . $ `lib/3d.h:253:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..red_light1cxx . . $ light_info#red_light1.;
2554 outer_points[i].p3_gcxx . . $ `lib/3d.h:254:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..green_light1cxx . . $ light_info#green_light1.;
2555 outer_points[i].p3_bcxx . . $ `lib/3d.h:255:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..blue_light1cxx . . $ light_info#blue_light1.;
2556
2557 inner_points[i].p3_rcxx . . $ `lib/3d.h:253:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..red_light1cxx . . $ light_info#red_light1.;
2558 inner_points[i].p3_gcxx . . $ `lib/3d.h:254:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..green_light1cxx . . $ light_info#green_light1.;
2559 inner_points[i].p3_bcxx . . $ `lib/3d.h:255:9`! = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info..blue_light1cxx . . $ light_info#blue_light1.;
2560 }
2561
2562 for (i = 0; i < num_segments; i++) {
2563 if (i % 2 && !odd)
2564 continue;
2565 if ((i % 2 == 0) && odd)
2566 continue;
2567
2568 int next = (i + 1) % num_segments;
2569
2570 pntlist[0] = &outer_points[i];
2571 pntlist[1] = &outer_points[next];
2572 pntlist[2] = &inner_points[next];
2573 pntlist[3] = &inner_points[i];
2574
2575 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, 0);
2576 }
2577 }
2578
2579 // Draws a ring for the weapon
2580 void DrawWeaponRingcxx . . $ DrawWeaponRing(419c470199a90a97).(objectcxx . . $ object# *obj) {
2581 if ((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`!)) {
2582 DrawBlobbyWeaponRingcxx . . $ DrawBlobbyWeaponRing(419c470199a90a97).(obj);
2583 return;
2584 } else
2585 DrawPolygonalWeaponRingcxx . . $ DrawPolygonalWeaponRing(419c470199a90a97).(obj);
2586 }
2587
2588 // Draws a weapon
2589 void DrawWeaponObjectcxx . . $ DrawWeaponObject(419c470199a90a97).(objectcxx . . $ object# *obj) {
2590 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! || obj->type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!);
2591 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weapons[obj->id].used > 0);
2592
2593 // Don't draw if spray
2594 if (!(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_INVISIBLEcxx . . $ `Descent3/weapon.h:226:9`!)) {
2595 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_ELECTRICALcxx . . $ `Descent3/weapon.h:222:9`!) {
2596 DrawElectricalWeaponcxx . . $ DrawElectricalWeapon(419c470199a90a97).(obj);
2597 } else if ((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`!)) {
2598 int bm_handle;
2599 int objnum = obj - Objectscxx . . $ Objects.;
2600 float rot_temp = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].phys_infocxx . . $ weapon#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel..zcxx . . $ vector#z. / 65536.0;
2601 int int_game = Gametimecxx . . $ Gametime. / rot_temp;
2602 float diff = Gametimecxx . . $ Gametime. - (int_game * rot_temp);
2603 int rot_angle = diff * 65536;
2604
2605 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_NO_ROTATEcxx . . $ `Descent3/weapon.h:248:9`!)
2606 rot_angle = (objnum * 1000) % 65536;
2607
2608 bm_handle = GetWeaponFireImagecxx . . $ GetWeaponFireImage(9b79fb6aee4c0440).(obj->idcxx . . $ object#id., 0);
2609 ASSERTcxx . . $ `misc/pserror.h:246:9`!(bm_handle >= 0);
2610
2611 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SATURATEcxx . . $ `Descent3/weapon.h:228:9`!)
2612 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
2613 else
2614 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`! + AT_TEXTUREcxx . . $ `lib/renderer.h:401:9`!);
2615
2616 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].alphacxx . . $ weapon#alpha. * 255);
2617 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2618 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2619
2620 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_PLANARcxx . . $ `Descent3/weapon.h:231:9`!) {
2621 vectorcxx . . $ vector# norm = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
2622 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&norm);
2623 g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(&obj->poscxx . . $ object#pos., &norm, rot_angle, obj->sizecxx . . $ object#size.,
2624 (obj->sizecxx . . $ object#size. * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle);
2625 } else
2626 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),
2627 bm_handle);
2628 } else {
2629
2630 polymodel_effectcxx . . $ polymodel_effect# pe = {0};
2631 int use_effect = 0;
2632
2633 if (obj->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && !Detail_settingscxx . . $ Detail_settings..Weapon_coronas_enabledcxx . . $ tDetailSettings#Weapon_coronas_enabled.) {
2634 pe.typecxx . . $ polymodel_effect#type. |= PEF_NO_GLOWScxx . . $ `lib/polymodel_external.h:301:9`!;
2635 use_effect = 1;
2636 }
2637
2638 if (use_effect)
2639 SetPolymodelEffectcxx . . $ SetPolymodelEffect(c6aad29469640daf).(&pe);
2640
2641 DrawPolygonModelcxx . . $ DrawPolygonModel(505ac7ffa3f87ac5).(&obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, 1.0, 1.0, 1.0, 0xFFFFFFFF,
2642 use_effect);
2643 }
2644 }
2645
2646 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_STREAMERcxx . . $ `Descent3/weapon.h:225:9`!) {
2647 DrawWeaponStreamercxx . . $ DrawWeaponStreamer(419c470199a90a97).(obj);
2648 }
2649
2650 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_RINGcxx . . $ `Descent3/weapon.h:227:9`!) {
2651 DrawWeaponRingcxx . . $ DrawWeaponRing(419c470199a90a97).(obj);
2652 }
2653 }
2654
2655 // Stops any on/off weapons that are firing
2656 void StopOnOffWeaponcxx . . $ StopOnOffWeapon(419c470199a90a97).(objectcxx . . $ object# *obj) {
2657 // mprintf(0,"Stopping on/off weapon!\n");
2658 obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. &= ~WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!;
2659
2660 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) {
2661 DemoWriteObjWeapFireFlagChangedcxx . . $ DemoWriteObjWeapFireFlagChanged(68e3ae50fe6578a9).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj));
2662 }
2663 }
2664
2665 // Starts an on/off weapon firing
2666 void StartOnOffWeaponcxx . . $ StartOnOffWeapon(eb56a3b53eea6ace).(objectcxx . . $ object# *obj, uint8_tcxx . . $ uint8_t# wb_index) {
2667 // mprintf(0,"Starting on/off weapon!\n");
2668 obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. |= WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!;
2669
2670 dynamic_wb_infocxx . . $ dynamic_wb_info# *p_dwb = &obj->dynamic_wbcxx . . $ object#dynamic_wb.[wb_index];
2671 p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask. = 0;
2672
2673 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) {
2674 DemoWriteObjWeapFireFlagChangedcxx . . $ DemoWriteObjWeapFireFlagChanged(68e3ae50fe6578a9).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj));
2675 }
2676 }
2677
2678 float Zoom_fov_timecxx . . $ Zoom_fov_time. = 0;
2679
2680 #define ZOOM_STAY_TIMEcxx . . $ `Descent3/WeaponFire.cpp:2680:9`! .25
2681 #define ZOOM_FOV_TARGETcxx . . $ `Descent3/WeaponFire.cpp:2681:9`! 18
2682
2683 void DoZoomStaycxx . . $ DoZoomStay(49f6e7a06ebc5aa8).() {
2684 if (Zoom_fov_timecxx . . $ Zoom_fov_time. > 0) {
2685 Render_FOVcxx . . $ Render_FOV. = ZOOM_FOV_TARGETcxx . . $ `Descent3/WeaponFire.cpp:2681:9`!;
2686 Zoom_fov_timecxx . . $ Zoom_fov_time. -= Frametimecxx . . $ Frametime.;
2687 if (Zoom_fov_timecxx . . $ Zoom_fov_time. < 0) {
2688 Zoom_fov_timecxx . . $ Zoom_fov_time. = 0;
2689 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_ZOOMEDcxx . . $ `Descent3/player_external.h:96:9`!;
2690 Render_FOVcxx . . $ Render_FOV. = D3_DEFAULT_FOVcxx . . $ `Descent3/descent.h:176:9`!;
2691 }
2692 }
2693 }
2694
2695 // Zooms in for this weapon
2696 void DoZoomEffectcxx . . $ DoZoomEffect(21bdd1769aed9e41).(player_weaponcxx . . $ player_weapon# *pw, uint8_tcxx . . $ uint8_t# clear) {
2697 if (pw->firing_timecxx . . $ player_weapon#firing_time. < .5) {
2698 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].turn_scalarcxx . . $ player#turn_scalar. = 1.0;
2699 Render_FOVcxx . . $ Render_FOV. = D3_DEFAULT_FOVcxx . . $ `Descent3/descent.h:176:9`!;
2700
2701 if (!clear)
2702 DoZoomStaycxx . . $ DoZoomStay(49f6e7a06ebc5aa8).();
2703 return;
2704 }
2705
2706 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].turn_scalarcxx . . $ player#turn_scalar. = .3f;
2707
2708 if (pw->firing_timecxx . . $ player_weapon#firing_time. > 1.0) {
2709 // We are fully zoomed in
2710
2711 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. |= PLAYER_FLAGS_ZOOMEDcxx . . $ `Descent3/player_external.h:96:9`!;
2712 Render_FOVcxx . . $ Render_FOV. = ZOOM_FOV_TARGETcxx . . $ `Descent3/WeaponFire.cpp:2681:9`!;
2713 Zoom_fov_timecxx . . $ Zoom_fov_time. = ZOOM_STAY_TIMEcxx . . $ `Descent3/WeaponFire.cpp:2680:9`!;
2714
2715 // See if we hit anything
2716 // Cast a ray to see what we've hit
2717 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_BULLSEYEcxx . . $ `Descent3/player_external.h:95:9`!;
2718 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.];
2719 int fate; // Collision type for response code
2720 fvi_infocxx . . $ fvi_info# hit_info; // Hit information
2721 fvi_querycxx . . $ fvi_query# fq; // Movement query
2722 vectorcxx . . $ vector# dest = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 5000.0);
2723
2724 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
2725 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
2726 fq.p1cxx . . $ fvi_query#p1. = &dest;
2727 fq.radcxx . . $ fvi_query#rad. = .0001f;
2728 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = Objectscxx . . $ Objects. - obj;
2729 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2730 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`!;
2731
2732 fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
2733
2734 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].zoom_distancecxx . . $ player#zoom_distance. = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &hit_info.hit_pntcxx . . $ fvi_info#hit_pnt.);
2735
2736 if (fate == HIT_SPHERE_2_POLY_OBJECTcxx . . $ `lib/findintersection_external.h:52:9`! || fate == HIT_OBJECTcxx . . $ `lib/findintersection_external.h:47:9`!) {
2737 objectcxx . . $ object# *hit_obj = &Objectscxx . . $ Objects.[hit_info.hit_objectcxx . . $ fvi_info#hit_object.[0]];
2738 if (hit_obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || hit_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! ||
2739 (hit_obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && hit_obj->ai_infocxx . . $ object#ai_info.))
2740 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. |= PLAYER_FLAGS_BULLSEYEcxx . . $ `Descent3/player_external.h:95:9`!;
2741 }
2742 return;
2743 }
2744
2745 // calculate zoom effect
2746 float norm = (pw->firing_timecxx . . $ player_weapon#firing_time. - .5) * 2;
2747
2748 Render_FOVcxx . . $ Render_FOV. = (ZOOM_FOV_TARGETcxx . . $ `Descent3/WeaponFire.cpp:2681:9`! * norm) + ((1.0 - norm) * D3_DEFAULT_FOVcxx . . $ `Descent3/descent.h:176:9`!);
2749
2750 return;
2751 }
2752
2753 // Called when a player dies or switches weapons to clear out any active weapon stuff
2754 void ClearPlayerFiringcxx . . $ ClearPlayerFiring(766a1b7183ffa4b4).(objectcxx . . $ object# *objp, int weapon_type) {
2755 // Check parms
2756 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
2757 // ASSERT(objp->id == Player_num);
2758
2759 // Set up various vars
2760 playercxx . . $ player# *player = &Playerscxx . . $ Players.[objp->idcxx . . $ object#id.];
2761 player_weaponcxx . . $ player_weapon# *pw = &player->weaponcxx . . $ player#weapon.[weapon_type];
2762
2763 // Clear firing flags
2764 if (objp->weapon_fire_flagscxx . . $ object#weapon_fire_flags. & WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!)
2765 StopOnOffWeaponcxx . . $ StopOnOffWeapon(419c470199a90a97).(objp);
2766
2767 // Clear firing time
2768 pw->firing_timecxx . . $ player_weapon#firing_time. = 0.0;
2769 objp->weapon_fire_flagscxx . . $ object#weapon_fire_flags. = 0;
2770 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) {
2771 DemoWriteObjWeapFireFlagChangedcxx . . $ DemoWriteObjWeapFireFlagChanged(68e3ae50fe6578a9).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objp));
2772 }
2773
2774 // Clear zoom if there is one
2775 if (objp->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.) {
2776 player_weaponcxx . . $ player_weapon# *pw = &player->weaponcxx . . $ player#weapon.[weapon_type];
2777 int weapon_battery_index = pw->indexcxx . . $ player_weapon#index.;
2778 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[player->ship_indexcxx . . $ player#ship_index.];
2779
2780 if (ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & SFF_ZOOMcxx . . $ `Descent3/ship.h:132:9`!) {
2781 DoZoomEffectcxx . . $ DoZoomEffect(21bdd1769aed9e41).(pw, 1);
2782 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_ZOOMEDcxx . . $ `Descent3/player_external.h:96:9`!;
2783 Zoom_fov_timecxx . . $ Zoom_fov_time. = 0;
2784 }
2785 }
2786
2787 // Stop firing sound if one playing
2788 if (pw->sound_handlecxx . . $ player_weapon#sound_handle. != -1) {
2789 Sound_systemcxx . . $ Sound_system..StopSoundImmediatecxx . . $ hlsSystem#StopSoundImmediate(d4f767463ce0a6b3).(pw->sound_handlecxx . . $ player_weapon#sound_handle.);
2790 pw->sound_handlecxx . . $ player_weapon#sound_handle. = -1;
2791 }
2792 }
2793
2794 // Stops weapon sound & visual effects
2795 void StopWeaponcxx . . $ StopWeapon(4f4c8baa6db11619).(objectcxx . . $ object# *obj, player_weaponcxx . . $ player_weapon# *pw, otype_wb_infocxx . . $ otype_wb_info# *wb) {
2796 // Stop any on/off weapons
2797 if (obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. & WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!)
2798 StopOnOffWeaponcxx . . $ StopOnOffWeapon(419c470199a90a97).(obj);
2799
2800 // Stop spray weapons
2801 if (wb->flagscxx . . $ otype_wb_info#flags. & WBF_SPRAYcxx . . $ `lib/robotfirestruct_external.h:27:9`!)
2802 obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. &= ~WFF_SPRAYcxx . . $ `Descent3/player_external.h:103:9`!;
2803
2804 // Stop firing sound if one playing
2805 if (pw && pw->sound_handlecxx . . $ player_weapon#sound_handle. != -1) {
2806 Sound_systemcxx . . $ Sound_system..StopSoundImmediatecxx . . $ hlsSystem#StopSoundImmediate(d4f767463ce0a6b3).(pw->sound_handlecxx . . $ player_weapon#sound_handle.);
2807 pw->sound_handlecxx . . $ player_weapon#sound_handle. = -1;
2808 }
2809
2810 // Clear firing time
2811 if (pw) {
2812 pw->firing_timecxx . . $ player_weapon#firing_time. = 0.0;
2813 }
2814 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) {
2815 DemoWriteObjWeapFireFlagChangedcxx . . $ DemoWriteObjWeapFireFlagChanged(68e3ae50fe6578a9).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj));
2816 }
2817 }
2818
2819 // Does weapon battery stuff for the permissable network architecture
2820 void DoPermissableWeaponMaskcxx . . $ DoPermissableWeaponMask(d4f767463ce0a6b3).(int weapon_battery_index) {
2821 playercxx . . $ player# *player = &Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.];
2822 objectcxx . . $ object# *objp = &Objectscxx . . $ Objects.[player->objnumcxx . . $ player#objnum.];
2823 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[player->ship_indexcxx . . $ player#ship_index.];
2824 otype_wb_infocxx . . $ otype_wb_info# *wb = &ship->static_wbcxx . . $ ship#static_wb.[weapon_battery_index];
2825 dynamic_wb_infocxx . . $ dynamic_wb_info# *p_dwb = &objp->dynamic_wbcxx . . $ object#dynamic_wb.[weapon_battery_index];
2826
2827 player->last_fire_weapon_timecxx . . $ player#last_fire_weapon_time. = Gametimecxx . . $ Gametime.;
2828
2829 p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask.++;
2830 p_dwb->last_fire_timecxx . . $ dynamic_wb_info#last_fire_time. = Gametimecxx . . $ Gametime.;
2831
2832 if (p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask. >= wb->num_maskscxx . . $ otype_wb_info#num_masks.)
2833 p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask. = 0;
2834 }
2835
2836 // Fires a weapon from our player. Won't fire if ammo/energy requirements aren't met.
2837 // Parameters: weapon_type - either PW_PRIMARY or PW_SECONDARY
2838 void FireWeaponFromPlayercxx . . $ FireWeaponFromPlayer(c0304a89cf526e9b).(objectcxx . . $ object# *objp, int weapon_type, int down_count, bool down_state, float down_time) {
2839 // Check parms
2840 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
2841 // ASSERT(objp->id == Player_num);
2842 ASSERTcxx . . $ `misc/pserror.h:246:9`!((weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!) || (weapon_type == PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!));
2843
2844 // Set up various vars
2845 playercxx . . $ player# *player = &Playerscxx . . $ Players.[objp->idcxx . . $ object#id.];
2846 player_weaponcxx . . $ player_weapon# *pw = &player->weaponcxx . . $ player#weapon.[weapon_type];
2847 int weapon_battery_index = pw->indexcxx . . $ player_weapon#index.;
2848 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[player->ship_indexcxx . . $ player#ship_index.];
2849 otype_wb_infocxx . . $ otype_wb_info# *wb = &ship->static_wbcxx . . $ ship#static_wb.[weapon_battery_index];
2850 int fire_on_release = (ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & (SFF_FUSIONcxx . . $ `Descent3/ship.h:131:9`! | SFF_ZOOMcxx . . $ `Descent3/ship.h:132:9`!));
2851 bool can_fire_now = WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(objp, wb, weapon_battery_index);
2852 dynamic_wb_infocxx . . $ dynamic_wb_info# *p_dwb = &objp->dynamic_wbcxx . . $ object#dynamic_wb.[weapon_battery_index];
2853 float ammo_scalar = 1.0;
2854
2855 if (p_dwb->flagscxx . . $ dynamic_wb_info#flags. & DWBF_QUADcxx . . $ `lib/robotfirestruct_external.h:47:9`!)
2856 ammo_scalar = 2.0;
2857
2858 // Don't allow down_time to be zero if we have a down count
2859 if (down_count && (down_time == 0.0))
2860 down_time = 1.0f / 100.0f;
2861
2862 // Check to see if we can release a guided
2863 if (down_count && down_time != 0.0 && Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].guided_objcxx . . $ player#guided_obj. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && weapon_type == PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`! &&
2864 can_fire_now) {
2865 ReleaseGuidedMissilecxx . . $ ReleaseGuidedMissile(d4f767463ce0a6b3).(objp->idcxx . . $ object#id.);
2866 p_dwb->last_fire_timecxx . . $ dynamic_wb_info#last_fire_time. = Gametimecxx . . $ Gametime.;
2867 return;
2868 }
2869
2870 // Check to see if we can release a user timeout weapon
2871 if (down_count && down_time != 0.0 && Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].user_timeout_objcxx . . $ player#user_timeout_obj. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && weapon_type == PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`! &&
2872 can_fire_now) {
2873 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
2874 MultiSendReleaseTimeoutMissilecxx . . $ MultiSendReleaseTimeoutMissile(49f6e7a06ebc5aa8).();
2875
2876 ReleaseUserTimeoutMissilecxx . . $ ReleaseUserTimeoutMissile(d4f767463ce0a6b3).(objp->idcxx . . $ object#id.);
2877 p_dwb->last_fire_timecxx . . $ dynamic_wb_info#last_fire_time. = Gametimecxx . . $ Gametime.;
2878 return;
2879 }
2880
2881 // Check for weapon stopped firing
2882 if ((down_count == 0) && (down_time == 0)) {
2883 if (ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & SFF_ZOOMcxx . . $ `Descent3/ship.h:132:9`!)
2884 DoZoomEffectcxx . . $ DoZoomEffect(21bdd1769aed9e41).(pw, 0);
2885
2886 // Abort if we weren't firing last frame either
2887 if (pw->firing_timecxx . . $ player_weapon#firing_time. == 0.0)
2888 return;
2889
2890 // Check for fire-on-release weapon
2891 if (fire_on_release) {
2892 if (can_fire_now) {
2893 float scalar = 1.0;
2894
2895 // Ready?
2896 if (ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & SFF_FUSIONcxx . . $ `Descent3/ship.h:131:9`!) {
2897 scalar = 1.0 + ((pw->firing_timecxx . . $ player_weapon#firing_time. / FUSION_RAMP_TIMEcxx . . $ `Descent3/WeaponFire.cpp:2221:9`!) * 3.0);
2898 }
2899
2900 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_PERMISSABLEcxx . . $ `Descent3/multi_external.h:239:9`!)) {
2901 MultiSendRequestToFirecxx . . $ MultiSendRequestToFire(c2f439e40e2f19ed).(weapon_battery_index, p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask., scalar);
2902 DoPermissableWeaponMaskcxx . . $ DoPermissableWeaponMask(d4f767463ce0a6b3).(weapon_battery_index);
2903 } else
2904 WBFireBatterycxx . . $ WBFireBattery(721350389efbb479).(objp, wb, 0, weapon_battery_index, scalar);
2905
2906 player->energycxx . . $ player#energy. -= wb->energy_usagecxx . . $ otype_wb_info#energy_usage. * ammo_scalar;
2907 if (player->energycxx . . $ player#energy. < 0)
2908 player->energycxx . . $ player#energy. = 0;
2909
2910 if (player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] < (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage. * ammo_scalar))
2911 player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] = 0;
2912 else
2913 player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] -= (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage. * ammo_scalar);
2914
2915 player->num_discharges_levelcxx . . $ player#num_discharges_level.++;
2916
2917 if (ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & SFF_ZOOMcxx . . $ `Descent3/ship.h:132:9`!) {
2918 AddToShakeMagnitudecxx . . $ AddToShakeMagnitude(9364e6e7bff7660).(ship->phys_infocxx . . $ ship#phys_info..masscxx . . $ physics_info#mass. * 2);
2919 }
2920 }
2921 }
2922
2923 // Play cut-off sound if one (but not if in permissable game)
2924 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) || !(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_PERMISSABLEcxx . . $ `Descent3/multi_external.h:239:9`!)) {
2925 int cutoff_sound = ship->firing_release_soundcxx . . $ ship#firing_release_sound.[weapon_battery_index];
2926 if (cutoff_sound != -1)
2927 Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(7bec394c8d81705d).(cutoff_sound, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!);
2928 }
2929
2930 // Stop the weapon sound & visual effects
2931 if (weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!)
2932 StopWeaponcxx . . $ StopWeapon(4f4c8baa6db11619).(objp, pw, wb);
2933
2934 // We're done
2935 return;
2936 }
2937
2938 // Check for adequate energy
2939 if ((wb->energy_usagecxx . . $ otype_wb_info#energy_usage. * ammo_scalar) && (player->energycxx . . $ player#energy. <= 0)) {
2940 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNNONRGcxx . . $ `Descent3/stringtable.h:274:9`!);
2941 if (weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!)
2942 StopWeaponcxx . . $ StopWeapon(4f4c8baa6db11619).(objp, pw, wb);
2943 AutoSelectWeaponcxx . . $ AutoSelectWeapon(cf9ef193275fa6d8).(weapon_type);
2944 return;
2945 }
2946
2947 // Check for adequate ammo
2948 if ((wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage. * ammo_scalar) && (player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] <= 0)) {
2949 if (weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!)
2950 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNNOAMMOcxx . . $ `Descent3/stringtable.h:275:9`!);
2951 else
2952 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNNOPROJcxx . . $ `Descent3/stringtable.h:276:9`!);
2953
2954 if (weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!)
2955 StopWeaponcxx . . $ StopWeapon(4f4c8baa6db11619).(objp, pw, wb);
2956 AutoSelectWeaponcxx . . $ AutoSelectWeapon(cf9ef193275fa6d8).(weapon_type);
2957 return;
2958 }
2959
2960 // Check for adequate ammo for secondaries...
2961 if (weapon_battery_index >= 10 && (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage. * ammo_scalar > player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index])) {
2962 if (weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!)
2963 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNNOAMMOcxx . . $ `Descent3/stringtable.h:275:9`!);
2964 else
2965 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNNOPROJcxx . . $ `Descent3/stringtable.h:276:9`!);
2966
2967 if (weapon_type == PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!)
2968 StopWeaponcxx . . $ StopWeapon(4f4c8baa6db11619).(objp, pw, wb);
2969 AutoSelectWeaponcxx . . $ AutoSelectWeapon(cf9ef193275fa6d8).(weapon_type);
2970 return;
2971 }
2972
2973 if (!can_fire_now)
2974 return;
2975
2976 // If continous sound weapon, start the sound if wasn't firing last frame
2977 int firing_sound = ship->firing_soundcxx . . $ ship#firing_sound.[weapon_battery_index];
2978
2979 if (can_fire_now && (firing_sound != -1) && (pw->firing_timecxx . . $ player_weapon#firing_time. == 0.0))
2980 pw->sound_handlecxx . . $ player_weapon#sound_handle. = Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(7bec394c8d81705d).(firing_sound, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!);
2981
2982 // Set spray flag if spray weapon
2983 if (wb->flagscxx . . $ otype_wb_info#flags. & WBF_SPRAYcxx . . $ `lib/robotfirestruct_external.h:27:9`!)
2984 objp->weapon_fire_flagscxx . . $ object#weapon_fire_flags. |= WFF_SPRAYcxx . . $ `Descent3/player_external.h:103:9`!;
2985
2986 if (ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & SFF_ZOOMcxx . . $ `Descent3/ship.h:132:9`!)
2987 DoZoomEffectcxx . . $ DoZoomEffect(21bdd1769aed9e41).(pw, 0);
2988
2989 // Do fusion effect if fusion weapon
2990 if (can_fire_now && ship->fire_flagscxx . . $ ship#fire_flags.[weapon_battery_index] & SFF_FUSIONcxx . . $ `Descent3/ship.h:131:9`!)
2991 DoFusionEffectcxx . . $ DoFusionEffect(766a1b7183ffa4b4).(objp, weapon_type);
2992
2993 // Start any on/off weapons
2994 if ((wb->flagscxx . . $ otype_wb_info#flags. & WBF_ON_OFFcxx . . $ `lib/robotfirestruct_external.h:34:9`!) && !(objp->weapon_fire_flagscxx . . $ object#weapon_fire_flags. & WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!))
2995 StartOnOffWeaponcxx . . $ StartOnOffWeapon(eb56a3b53eea6ace).(objp, weapon_battery_index);
2996
2997 // If not a fire-on-release weapon, then fire if ready
2998 if (!fire_on_release && can_fire_now) {
2999
3000 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_PERMISSABLEcxx . . $ `Descent3/multi_external.h:239:9`!)) {
3001 MultiSendRequestToFirecxx . . $ MultiSendRequestToFire(c2f439e40e2f19ed).(weapon_battery_index, p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask.);
3002 DoPermissableWeaponMaskcxx . . $ DoPermissableWeaponMask(d4f767463ce0a6b3).(weapon_battery_index);
3003 } else
3004 WBFireBatterycxx . . $ WBFireBattery(721350389efbb479).(objp, wb, 0, weapon_battery_index);
3005
3006 // If on/off weapon, scale energy by framerate based on "reference" rate of 20 fps.
3007 if (wb->flagscxx . . $ otype_wb_info#flags. & WBF_ON_OFFcxx . . $ `lib/robotfirestruct_external.h:34:9`!)
3008 player->energycxx . . $ player#energy. -= (wb->energy_usagecxx . . $ otype_wb_info#energy_usage. * ammo_scalar * Frametimecxx . . $ Frametime. / (1.0 / 20.0));
3009 else
3010 player->energycxx . . $ player#energy. -= (wb->energy_usagecxx . . $ otype_wb_info#energy_usage. * ammo_scalar);
3011 if (player->energycxx . . $ player#energy. < 0)
3012 player->energycxx . . $ player#energy. = 0;
3013
3014 if (player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] < (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage. * ammo_scalar))
3015 player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] = 0;
3016 else
3017 player->weapon_ammocxx . . $ player#weapon_ammo.[weapon_battery_index] -= (wb->ammo_usagecxx . . $ otype_wb_info#ammo_usage. * ammo_scalar);
3018
3019 player->num_discharges_levelcxx . . $ player#num_discharges_level.++;
3020 }
3021
3022 // Update the firing time
3023 pw->firing_timecxx . . $ player_weapon#firing_time. += down_time;
3024 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) {
3025 DemoWriteObjWeapFireFlagChangedcxx . . $ DemoWriteObjWeapFireFlagChanged(68e3ae50fe6578a9).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objp));
3026 }
3027 }
3028
3029 // Fires a flare from our player.
3030 // It might make sense to combine this with FireWeaponFromPlayer(), or maybe not
3031 void FireFlareFromPlayercxx . . $ FireFlareFromPlayer(419c470199a90a97).(objectcxx . . $ object# *objp) {
3032 // Check parms
3033 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
3034 // ASSERT(objp->id == Player_num || objp->control_type == CT_SOAR);
3035
3036 // Set up various vars
3037 int weapon_battery_index = FLARE_INDEXcxx . . $ `Descent3/weapon_external.h:43:9`!;
3038 shipcxx . . $ ship# *ship = &Shipscxx . . $ Ships.[Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].ship_indexcxx . . $ player#ship_index.];
3039 otype_wb_infocxx . . $ otype_wb_info# *wb = &ship->static_wbcxx . . $ ship#static_wb.[weapon_battery_index];
3040 playercxx . . $ player# *player = &Playerscxx . . $ Players.[objp->idcxx . . $ object#id.];
3041 dynamic_wb_infocxx . . $ dynamic_wb_info# *p_dwb = &objp->dynamic_wbcxx . . $ object#dynamic_wb.[weapon_battery_index];
3042
3043 if (player->energycxx . . $ player#energy. < wb->energy_usagecxx . . $ otype_wb_info#energy_usage.) {
3044 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNFLARENONRGcxx . . $ `Descent3/stringtable.h:277:9`!);
3045 return;
3046 }
3047
3048 if (WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(Player_objectcxx . . $ Player_object., wb, weapon_battery_index)) {
3049 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_PERMISSABLEcxx . . $ `Descent3/multi_external.h:239:9`!)) {
3050 MultiSendRequestToFirecxx . . $ MultiSendRequestToFire(c2f439e40e2f19ed).(weapon_battery_index, p_dwb->cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask.);
3051 DoPermissableWeaponMaskcxx . . $ DoPermissableWeaponMask(d4f767463ce0a6b3).(weapon_battery_index);
3052 } else
3053 WBFireBatterycxx . . $ WBFireBattery(721350389efbb479).(Player_objectcxx . . $ Player_object., wb, 0, weapon_battery_index);
3054
3055 player->energycxx . . $ player#energy. -= wb->energy_usagecxx . . $ otype_wb_info#energy_usage.;
3056 if (player->energycxx . . $ player#energy. < 0)
3057 player->energycxx . . $ player#energy. = 0;
3058
3059 // Samir & I think that firing a flare should not count as discharge, even though
3060 // it would allow people push up their kill effiency by killing things with flares. -MT, 10/29/97
3061 // Players[Player_num].num_discharges_level++;
3062 }
3063 }
3064
3065 // Plays the animation that accompanies a weapon death
3066 void DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *norm, vectorcxx . . $ vector# *collision_point, objectcxx . . $ object# *hit_object) {
3067 weaponcxx . . $ weapon# *w = &Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.];
3068 light_infocxx . . $ light_info# *li = &w->lighting_infocxx . . $ weapon#lighting_info.;
3069 vectorcxx . . $ vector# col_point, normal;
3070
3071 if (w->flagscxx . . $ weapon#flags. & WF_ELECTRICALcxx . . $ `Descent3/weapon.h:222:9`!)
3072 return;
3073
3074 MakeShockwavecxx . . $ MakeShockwave(766a1b7183ffa4b4).(obj, obj->parent_handlecxx . . $ object#parent_handle.);
3075
3076 if (collision_point == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || !(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_PLANAR_BLASTcxx . . $ `Descent3/weapon.h:230:9`!))
3077 col_point =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
3078 else
3079 col_point =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *collision_point;
3080
3081 if (norm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
3082 normal =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.;
3083 else
3084 normal =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *norm;
3085
3086 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_GRAVITY_FIELDcxx . . $ `Descent3/weapon.h:240:9`!)
3087 CreateGravityFieldcxx . . $ CreateGravityField(28e0c577fe83b9b1).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].gravity_sizecxx . . $ weapon#gravity_size., Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].gravity_timecxx . . $ weapon#gravity_time.,
3088 obj->parent_handlecxx . . $ object#parent_handle.);
3089
3090 if (hit_object == Viewer_objectcxx . . $ Viewer_object. && !(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_MATTER_WEAPONcxx . . $ `Descent3/weapon.h:221:9`!))
3091 return; // Don't draw if its viewer who is getting hit
3092
3093 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_PLANAR_BLASTcxx . . $ `Descent3/weapon.h:230:9`!) {
3094 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_BLAST_RINGcxx . . $ `Descent3/weapon.h:229:9`!) {
3095 // Create a planar ring
3096 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, BLAST_RING_INDEXcxx . . $ `Descent3/fireball_external.h:31:9`!, obj->roomnumcxx . . $ object#roomnum., &col_point);
3097 if (visnum >= 0) {
3098 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
3099 vis->sizecxx . . $ vis_effect#size. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_sizecxx . . $ weapon#explode_size.;
3100 vis->lifetimecxx . . $ vis_effect#lifetime. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3101 vis->lifeleftcxx . . $ vis_effect#lifeleft. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3102 vis->custom_handlecxx . . $ vis_effect#custom_handle. = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_image_handlecxx . . $ weapon#explode_image_handle., 0);
3103 vis->flagscxx . . $ vis_effect#flags. |= VF_PLANARcxx . . $ `Descent3/viseffect_external.h:67:9`!;
3104 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). normal;
3105 vis->lighting_colorcxx . . $ vis_effect#lighting_color. =
3106 OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(li->red_light2cxx . . $ light_info#red_light2. * 255, li->green_light2cxx . . $ light_info#green_light2. * 255, li->blue_light2cxx . . $ light_info#blue_light2. * 255);
3107 }
3108 } else {
3109 // Create a planar explosion
3110 int visnum;
3111
3112 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_image_handlecxx . . $ weapon#explode_image_handle. > 0) {
3113 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, CUSTOM_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:33:9`!, obj->roomnumcxx . . $ object#roomnum., &col_point);
3114 if (visnum >= 0) {
3115 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
3116 vis->sizecxx . . $ vis_effect#size. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_sizecxx . . $ weapon#explode_size.;
3117 vis->lifetimecxx . . $ vis_effect#lifetime. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3118 vis->lifeleftcxx . . $ vis_effect#lifeleft. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3119 vis->custom_handlecxx . . $ vis_effect#custom_handle. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_image_handlecxx . . $ weapon#explode_image_handle.;
3120 vis->lighting_colorcxx . . $ vis_effect#lighting_color. =
3121 OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(li->red_light2cxx . . $ light_info#red_light2. * 255, li->green_light2cxx . . $ light_info#green_light2. * 255, li->blue_light2cxx . . $ light_info#blue_light2. * 255);
3122 }
3123 } else
3124 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, GetRandomSmallExplosioncxx . . $ GetRandomSmallExplosion(b126dc7c1de90089).(), obj->roomnumcxx . . $ object#roomnum., &col_point);
3125
3126 if (visnum >= 0) {
3127 VisEffectscxx . . $ VisEffects.[visnum].flagscxx . . $ vis_effect#flags. |= VF_PLANARcxx . . $ `Descent3/viseffect_external.h:67:9`!;
3128 VisEffectscxx . . $ VisEffects.[visnum].end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). normal;
3129
3130 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_EXPANDcxx . . $ `Descent3/weapon.h:235:9`!)
3131 VisEffectscxx . . $ VisEffects.[visnum].flagscxx . . $ vis_effect#flags. |= VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!;
3132 }
3133 }
3134 } else {
3135 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_BLAST_RINGcxx . . $ `Descent3/weapon.h:229:9`!) {
3136 // Create a non-planar ring
3137 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, BLAST_RING_INDEXcxx . . $ `Descent3/fireball_external.h:31:9`!, obj->roomnumcxx . . $ object#roomnum., &col_point);
3138 if (visnum >= 0) {
3139 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
3140 vis->sizecxx . . $ vis_effect#size. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_sizecxx . . $ weapon#explode_size.;
3141 vis->lifetimecxx . . $ vis_effect#lifetime. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3142 vis->lifeleftcxx . . $ vis_effect#lifeleft. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3143 vis->custom_handlecxx . . $ vis_effect#custom_handle. = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_image_handlecxx . . $ weapon#explode_image_handle., 0);
3144 vis->lighting_colorcxx . . $ vis_effect#lighting_color. =
3145 OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(li->red_light2cxx . . $ light_info#red_light2. * 255, li->green_light2cxx . . $ light_info#green_light2. * 255, li->blue_light2cxx . . $ light_info#blue_light2. * 255);
3146 }
3147 } else {
3148 // Create a normal "always facing you" explosion
3149 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_image_handlecxx . . $ weapon#explode_image_handle. > 0) {
3150 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, CUSTOM_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:33:9`!, obj->roomnumcxx . . $ object#roomnum., &col_point);
3151 if (visnum >= 0) {
3152 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
3153 vis->sizecxx . . $ vis_effect#size. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_sizecxx . . $ weapon#explode_size.;
3154 vis->lifetimecxx . . $ vis_effect#lifetime. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3155 vis->lifeleftcxx . . $ vis_effect#lifeleft. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_timecxx . . $ weapon#explode_time.;
3156 vis->custom_handlecxx . . $ vis_effect#custom_handle. = Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].explode_image_handlecxx . . $ weapon#explode_image_handle.;
3157 vis->lighting_colorcxx . . $ vis_effect#lighting_color. =
3158 OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(li->red_light2cxx . . $ light_info#red_light2. * 255, li->green_light2cxx . . $ light_info#green_light2. * 255, li->blue_light2cxx . . $ light_info#blue_light2. * 255);
3159
3160 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_EXPANDcxx . . $ `Descent3/weapon.h:235:9`!)
3161 VisEffectscxx . . $ VisEffects.[visnum].flagscxx . . $ vis_effect#flags. |= VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!;
3162 }
3163 } else
3164 VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, GetRandomSmallExplosioncxx . . $ GetRandomSmallExplosion(b126dc7c1de90089).(), obj->roomnumcxx . . $ object#roomnum., &col_point);
3165 }
3166 }
3167 }
3168
3169 // Creates chidren from a dying weapon
3170 void CreateTimeoutSpawnFromWeaponcxx . . $ CreateTimeoutSpawnFromWeapon(419c470199a90a97).(objectcxx . . $ object# *obj) {
3171 int n = obj->idcxx . . $ object#id.;
3172
3173 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weapons[n].spawn_count > 0 && Weapons[n].spawn_handle >= 0);
3174
3175 int num = Weaponscxx . . $ Weapons.[n].spawn_countcxx . . $ weapon#spawn_count.;
3176 int spawn_index = Weaponscxx . . $ Weapons.[n].spawn_handlecxx . . $ weapon#spawn_handle.;
3177 vectorcxx . . $ vector# pos;
3178 matrixcxx . . $ matrix# orient;
3179
3180 // See if we should spawn the alternate
3181 if (Weaponscxx . . $ Weapons.[n].alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle. >= 0 && Weaponscxx . . $ Weapons.[n].alternate_chancecxx . . $ weapon#alternate_chance. > 0) {
3182 if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) < Weaponscxx . . $ Weapons.[n].alternate_chancecxx . . $ weapon#alternate_chance.)
3183 spawn_index = Weaponscxx . . $ Weapons.[n].alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle.;
3184 }
3185
3186 for (int i = 0; i < num; i++) {
3187 if (i == 0) // Make first one fire from the center of the ring
3188 {
3189 pos =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). obj->sizecxx . . $ object#size. /cxx . . $ `operator/`(252247219a31502c). 2);
3190
3191 CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(&pos, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., obj, spawn_index);
3192 } else {
3193 matrixcxx . . $ matrix# temp_mat;
3194 pos =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). obj->sizecxx . . $ object#size. /cxx . . $ `operator/`(252247219a31502c). 2);
3195
3196 float norm = ((float)(i - 1)) / ((float)num - 1);
3197
3198 float mysin = FixSincxx . . $ FixSin(9a38df040a81ca35).(norm * 65536);
3199 float mycos = FixCoscxx . . $ FixCos(9a38df040a81ca35).(norm * 65536);
3200
3201 int x_twist = mycos * 4096;
3202 int y_twist = mysin * 4096;
3203
3204 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, x_twist, y_twist, 0);
3205 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&temp_mat);
3206
3207 orient =cxx . . $ matrix#`operator=`(e859ffc26b91394f). obj->orientcxx . . $ object#orient. *cxx . . $ `operator*`(683f8e040c904cb). temp_mat;
3208
3209 CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(&pos, &orient.fveccxx . . $ matrix#fvec., obj, spawn_index);
3210 }
3211 }
3212 }
3213
3214 // Creates a robot as a countermeasure
3215 void CreateRobotSpawnFromWeaponcxx . . $ CreateRobotSpawnFromWeapon(419c470199a90a97).(objectcxx . . $ object# *obj) {
3216 int index = obj->idcxx . . $ object#id.;
3217 weaponcxx . . $ weapon# *wp = &Weaponscxx . . $ Weapons.[index];
3218
3219 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
3220 return; // clients do not create robots without the servers permission
3221
3222 if (wp->robot_spawn_handlecxx . . $ weapon#robot_spawn_handle. == -1) {
3223 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Trying to create an invalid robot spawn!\n");
3224 return;
3225 }
3226 objectcxx . . $ object# *parent_obj = ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(obj);
3227
3228 int objnum = ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, wp->robot_spawn_handlecxx . . $ weapon#robot_spawn_handle., obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., parent_obj->handlecxx . . $ object#handle.);
3229
3230 if (objnum < 0)
3231 return;
3232
3233 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
3234 MultiSendObjectcxx . . $ MultiSendObject(d7354c60e612ede5).(&Objectscxx . . $ Objects.[objnum], 0);
3235 }
3236
3237 // Create the scripts for it
3238 InitObjectScriptscxx . . $ InitObjectScripts(674fac047436fc5b).(&Objectscxx . . $ Objects.[objnum]);
3239 }
3240
3241 // Returns a object to home on for spawned weapons
3242 objectcxx . . $ object# *FindSpawnHomingTargetcxx . . $ FindSpawnHomingTarget(64a00b84ed3f82ee).(objectcxx . . $ object# *obj) {
3243 int i;
3244 float best_dist = MAX_HOMING_DISTcxx . . $ `Descent3/WeaponFire.cpp:1428:9`! / 2;
3245 int best_index = -1;
3246 objectcxx . . $ object# *weapon_parent = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.);
3247
3248 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
3249 if ((i != OBJNUMcxx . . $ `Descent3/object.h:700:9`!(weapon_parent)) && ((Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) || (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) ||
3250 (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.))) {
3251 if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(obj->roomnumcxx . . $ object#roomnum., Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum.)) {
3252 vectorcxx . . $ vector# to_target = Objectscxx . . $ Objects.[i].poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.;
3253
3254 if (Objectscxx . . $ Objects.[i].effect_infocxx . . $ object#effect_info. && Objectscxx . . $ Objects.[i].effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)
3255 continue;
3256
3257 if (ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.) &&
3258 !AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.)), ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(&Objectscxx . . $ Objects.[i])))
3259 continue;
3260
3261 float dist_to_target = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to_target) - obj->sizecxx . . $ object#size. - Objectscxx . . $ Objects.[i].sizecxx . . $ object#size.;
3262
3263 if (dist_to_target < best_dist) {
3264 fvi_querycxx . . $ fvi_query# fq;
3265 fvi_infocxx . . $ fvi_info# hit_info;
3266
3267 fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.;
3268 fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.;
3269 fq.p1cxx . . $ fvi_query#p1. = &Objectscxx . . $ Objects.[i].poscxx . . $ object#pos.;
3270 fq.radcxx . . $ fvi_query#rad. = 0.0f;
3271 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
3272 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3273 fq.flagscxx . . $ fvi_query#flags. = FQ_TRANSPOINTcxx . . $ `lib/findintersection_external.h:61:9`! | FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_ONLY_DOOR_OBJcxx . . $ `lib/findintersection_external.h:72:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`!;
3274
3275 fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info);
3276 if (hit_info.hit_typecxx . . $ fvi_info#hit_type.[0] == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
3277 best_index = i;
3278 best_dist = dist_to_target;
3279 }
3280 }
3281 }
3282 }
3283 }
3284 if (best_index >= 0)
3285 return &Objectscxx . . $ Objects.[best_index];
3286
3287 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3288 }
3289
3290 // Creates chidren from a dying weapon
3291 void CreateImpactSpawnFromWeaponcxx . . $ CreateImpactSpawnFromWeapon(835e87111e401cce).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *normal) {
3292 int n = obj->idcxx . . $ object#id.;
3293 objectcxx . . $ object# *home_target = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3294
3295 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weapons[n].spawn_count > 0 && Weapons[n].spawn_handle >= 0);
3296
3297 int num = Weaponscxx . . $ Weapons.[n].spawn_countcxx . . $ weapon#spawn_count.;
3298 int spawn_index = Weaponscxx . . $ Weapons.[n].spawn_handlecxx . . $ weapon#spawn_handle.;
3299
3300 // See if we should spawn the alternate
3301 if (Weaponscxx . . $ Weapons.[n].alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle. >= 0 && Weaponscxx . . $ Weapons.[n].alternate_chancecxx . . $ weapon#alternate_chance. > 0) {
3302 if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) < Weaponscxx . . $ Weapons.[n].alternate_chancecxx . . $ weapon#alternate_chance.)
3303 spawn_index = Weaponscxx . . $ Weapons.[n].alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle.;
3304 }
3305
3306 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
3307 ps_srandcxx . . $ ps_srand(cb2f890c2fdad230).(num);
3308
3309 if (Weaponscxx . . $ Weapons.[n].flagscxx . . $ weapon#flags. & WF_HOMING_SPLITcxx . . $ `Descent3/weapon.h:247:9`!) {
3310 home_target = FindSpawnHomingTargetcxx . . $ FindSpawnHomingTarget(64a00b84ed3f82ee).(obj);
3311 }
3312
3313 for (int i = 0; i < num; i++) {
3314 if (home_target != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
3315 vectorcxx . . $ vector# subvec = home_target->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.;
3316 float mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&subvec);
3317 subvec /=cxx . . $ `operator/=`(f132838b2cd11d6). mag;
3318
3319 int objnum = CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(&obj->poscxx . . $ object#pos., &subvec, obj, spawn_index);
3320
3321 // Stagger the weapons a bit
3322 if (objnum > -1) {
3323 objectcxx . . $ object# *created_obj = &Objectscxx . . $ Objects.[objnum];
3324
3325 float scalar = .2 + ((float)(ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) / 1000.0);
3326
3327 created_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). scalar;
3328 }
3329 } else {
3330 matrixcxx . . $ matrix# temp_mat;
3331 matrixcxx . . $ matrix# rot_mat;
3332 vectorcxx . . $ vector# new_norm;
3333
3334 float norm = ((float)(ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000)) / 1000.0;
3335 int x_twist = 16384 - (norm * 32768);
3336 if (x_twist < 0)
3337 x_twist = 65536 + x_twist;
3338
3339 norm = ((float)(ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000)) / 1000.0;
3340 int y_twist = 16384 - (norm * 32768);
3341 if (y_twist < 0)
3342 y_twist = 65536 + y_twist;
3343
3344 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&rot_mat, normal, 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`!);
3345 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&rot_mat);
3346 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, x_twist, y_twist, 0);
3347
3348 new_norm =cxx . . $ vector#`operator=`(c0842353a20857d). temp_mat.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). rot_mat;
3349
3350 CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(&obj->poscxx . . $ object#pos., &new_norm, obj, spawn_index);
3351 }
3352 }
3353 }
3354
3355 // Does whatever to be done when a weapon times out
3356 void TimeoutWeaponcxx . . $ TimeoutWeapon(419c470199a90a97).(objectcxx . . $ object# *obj) {
3357 int n = obj->idcxx . . $ object#id.;
3358
3359 if ((Weaponscxx . . $ Weapons.[n].flagscxx . . $ weapon#flags. & WF_SPAWNS_TIMEOUTcxx . . $ `Descent3/weapon.h:234:9`!) && Weaponscxx . . $ Weapons.[n].spawn_countcxx . . $ weapon#spawn_count. > 0 && Weaponscxx . . $ Weapons.[n].spawn_handlecxx . . $ weapon#spawn_handle. >= 0) {
3360 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(obj, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.);
3361 CreateTimeoutSpawnFromWeaponcxx . . $ CreateTimeoutSpawnFromWeapon(419c470199a90a97).(obj);
3362 }
3363
3364 if ((Weaponscxx . . $ Weapons.[n].flagscxx . . $ weapon#flags. & WF_MATTER_WEAPONcxx . . $ `Descent3/weapon.h:221:9`!) && !(Weaponscxx . . $ Weapons.[n].flagscxx . . $ weapon#flags. & WF_SPAWNS_TIMEOUTcxx . . $ `Descent3/weapon.h:234:9`!) &&
3365 (Weaponscxx . . $ Weapons.[n].spawn_countcxx . . $ weapon#spawn_count. <= 0)) {
3366 vectorcxx . . $ vector# temp = Zero_vectorcxx . . $ Zero_vector.;
3367
3368 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
3369 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!], SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, obj);
3370
3371 temp.ycxx . . $ vector#y. = 1.0;
3372
3373 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(obj, &temp);
3374 }
3375
3376 if (Weaponscxx . . $ Weapons.[n].flagscxx . . $ weapon#flags. & WF_TIMEOUT_WALLcxx . . $ `Descent3/weapon.h:244:9`!) {
3377 if (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
3378 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!], SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, obj);
3379
3380 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(obj);
3381 }
3382
3383 if ((Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SPAWNS_ROBOTcxx . . $ `Descent3/weapon.h:242:9`!) && (Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_COUNTERMEASUREcxx . . $ `Descent3/weapon.h:241:9`!) &&
3384 Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.].robot_spawn_handlecxx . . $ weapon#robot_spawn_handle. >= 0)
3385 CreateRobotSpawnFromWeaponcxx . . $ CreateRobotSpawnFromWeapon(419c470199a90a97).(obj);
3386 }
3387
3388 // Given a parent object and a weapon id, creates that countermeasure
3389 void CreateCountermeasureFromObjectcxx . . $ CreateCountermeasureFromObject(766a1b7183ffa4b4).(objectcxx . . $ object# *parent, int weapon_id) {
3390 ASSERTcxx . . $ `misc/pserror.h:246:9`!(parent != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
3391 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weapons[weapon_id].used);
3392
3393 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
3394 MultiSendRequestCountermeasurecxx . . $ MultiSendRequestCountermeasure(59a23d33d43e6eac).(parent - Objectscxx . . $ Objects., weapon_id);
3395 else
3396 FireWeaponFromObjectcxx . . $ FireWeaponFromObject(3c611958fe04e279).(parent, weapon_id, 5);
3397 }
3398
3399 // Releases the guided missile of a passed in player
3400 void ReleaseGuidedMissilecxx . . $ ReleaseGuidedMissile(d4f767463ce0a6b3).(int slot) {
3401 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Players[slot].guided_obj);
3402 if (!Playerscxx . . $ Players.[slot].guided_objcxx . . $ player#guided_obj.)
3403 return;
3404
3405 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (slot == Player_numcxx . . $ Player_num.)) {
3406 MultiSendMissileReleasecxx . . $ MultiSendMissileRelease(918ebd27a9ddbad3).(slot, true);
3407 }
3408
3409 Playerscxx . . $ Players.[slot].guided_objcxx . . $ player#guided_obj.->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= ~PF_GUIDEDcxx . . $ `Descent3/object_external.h:335:9`!;
3410 Playerscxx . . $ Players.[slot].guided_objcxx . . $ player#guided_obj. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3411 }
3412
3413 // Releases the timeout missile of a passed in player
3414 void ReleaseUserTimeoutMissilecxx . . $ ReleaseUserTimeoutMissile(d4f767463ce0a6b3).(int slot) {
3415 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Players[slot].user_timeout_obj);
3416 if (!Playerscxx . . $ Players.[slot].user_timeout_objcxx . . $ player#user_timeout_obj.)
3417 return;
3418
3419 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (slot == Player_numcxx . . $ Player_num.)) {
3420 MultiSendMissileReleasecxx . . $ MultiSendMissileRelease(918ebd27a9ddbad3).(slot, false);
3421 }
3422
3423 TimeoutWeaponcxx . . $ TimeoutWeapon(419c470199a90a97).(Playerscxx . . $ Players.[slot].user_timeout_objcxx . . $ player#user_timeout_obj.);
3424 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(Playerscxx . . $ Players.[slot].user_timeout_objcxx . . $ player#user_timeout_obj.);
3425
3426 Playerscxx . . $ Players.[slot].user_timeout_objcxx . . $ player#user_timeout_obj. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3427 }