Debian Codegraph @

physics/collide.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/physics/Collide.cpp $
21 * $Revision: 239 $
22 * $Date: 9/20/01 5:33p $
23 * $Author: Matt $
24 *
25 * Descent III collision code
26 *
27 * $Log: /DescentIII/Main/physics/Collide.cpp $
28 *
29 * 239 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 * 238 11/04/99 5:35p Chris
34 * Levels with forcefields with a custom bouce sound don't cause damage
35 *
36 * 237 10/20/99 5:40p Chris
37 * Added the Red Guidebot
38 *
39 * 236 10/08/99 4:29p Chris
40 * Added the forcefield and glass breaking override options
41 *
42 * 235 5/24/99 1:26a Matt
43 * Correctly deal with hit_info == NULL being passed to collision
44 * routines.
45 *
46 * 234 5/21/99 2:55a Matt
47 * When an object is bounced-out and needs to be killed, call
48 * DestroyObject() if it's already dying. Before the code just set the
49 * dead flag, which caused robots to disappear if they bumped into
50 * something while dying.
51 *
52 * 233 5/20/99 9:03p Matt
53 * Changed trigger system so that collisions with rendered portals don't
54 * set off triggers on the portals.
55 *
56 * 232 5/19/99 1:23p Matt
57 * Fixed (hopefully) yet more collision problems introduced by my recent
58 * changes.
59 *
60 * 231 5/18/99 10:15p Matt
61 * Fixed bug with weapon spawning that I introduced last night.
62 *
63 * 230 5/18/99 10:57a Chris
64 * Various bug fixes
65 *
66 * 229 5/17/99 9:09p Matt
67 * Made objects with lava behave like walls with lava; flares don't stick,
68 * player catches on fire.
69 *
70 * 228 5/17/99 6:07p Chris
71 * GB doesn't damage players - PF_LOCK_MASK objects always do...
72 *
73 * 227 5/11/99 5:50p Chris
74 * Buildings don't collide with each other
75 *
76 * 226 5/08/99 4:27p Chris
77 * Hearing code
78 *
79 * 225 5/08/99 3:31p Matt
80 * Deal with weapons hitting water.
81 *
82 * 224 5/07/99 10:56p Chris
83 * GB avoids forcefields, lava, and volatile surfaces... If he accidently
84 * hits one of these, he ignores the collision (i.e. no effects). It make
85 * him look smarter.
86 *
87 * 223 4/30/99 3:28p Matt
88 * Weapons now make a special sound when colliding with lava & volatile
89 * surfaces, instead of the standard hit-wall sound.
90 *
91 * 222 4/29/99 6:48p Matt
92 * Made volatile surfaces apply damage and lava surfaces catch the player
93 * on fire. Both now generate the steam puff effect.
94 *
95 * 221 4/29/99 2:17a Samir
96 * adjusted some sound priority stuff
97 *
98 * 220 4/23/99 6:44p Matt
99 * Changed weapons to keep going after breaking glass.
100 *
101 * 219 4/21/99 4:27p Chris
102 *
103 * 218 4/21/99 3:45p Chris
104 *
105 * 217 4/21/99 3:43p Chris
106 *
107 * 216 4/21/99 2:56p Chris
108 * Made player-player collisions almost complete in-elastic
109 *
110 * 215 4/21/99 1:30p Matt
111 * Make breakable glass use the new breakable flag, instead of
112 * piggybacking on the destroyable flag.
113 *
114 * 214 4/21/99 11:06a Kevin
115 * new ps_rand and ps_srand to replace rand & srand
116 *
117 * 213 4/21/99 10:12a Chris
118 * Tweaked robot/player damage
119 *
120 * 212 4/21/99 3:33a Chris
121 * Collisions between robots and players cause damage to both robots and
122 * players (robots get more damage)
123 *
124 * 211 4/19/99 12:03p Jason
125 * added checking for fireball collisions
126 *
127 * 210 4/19/99 4:02a Jeff
128 * fixed min/max for Linux
129 *
130 * 209 4/18/99 10:55p Chris
131 * Added ignore own concussive blasts
132 *
133 * 208 4/16/99 8:18p Jason
134 * make impact spawning weapons work with doors
135 *
136 * 207 4/14/99 1:42a Jeff
137 * fixed case mismatched #includes
138 *
139 * 206 4/12/99 6:15p Samir
140 * Sound priorities pass 1
141 *
142 * 205 4/06/99 6:24p Jason
143 * various fixes for multiplayer
144 *
145 * 204 3/23/99 4:10p Jason
146 * more tweaks for line sparks
147 *
148 * 203 3/23/99 12:50p Jason
149 * added line sparks
150 *
151 * 202 3/22/99 6:41p Jason
152 * fixed client side weapons not reacting correctly to bouncing code
153 *
154 * 201 3/22/99 1:47p Matt
155 * Moved breaking glass code from collide.cpp to damage.cpp
156 *
157 * 200 3/16/99 4:16p Matt
158 * Made mass driver spin the victim more. (Jason had reduced it from 0.25
159 * to 0.05; I've moved it back up to 0.12 at Andy's request.)
160 *
161 * 199 3/12/99 7:46p Jeff
162 * record wall hit collisions to demo file
163 *
164 * 198 3/11/99 5:55p Jason
165 * fixed player spin with mass driver
166 *
167 * 197 3/05/99 2:12p Matt
168 * Fixed bug (in a slightly hacky way) where energy weapons would cause
169 * glass to switch to the damaged texture. For a real fix, we need a
170 * separate breakable glass flag for textures.
171 *
172 * 196 3/03/99 10:52a Chris
173 * Energy weapons push again
174 *
175 * 195 3/03/99 5:44a Chris
176 * Max secondary burn time of 10 seconds
177 *
178 * 194 3/01/99 3:18p Jason
179 * made powerups work correctly in multiplayer
180 *
181 * 193 2/28/99 11:29p Chris
182 * Improved robot-wall reactions
183 *
184 * 192 2/22/99 2:03p Jason
185 * added different damages for players and generics
186 *
187 * 191 2/21/99 4:35p Chris
188 * Improving the level goal system... Not done.
189 *
190 * 190 2/20/99 10:31a Kevin
191 * OEM Beta 1 fixs
192 *
193 * 189 2/19/99 12:35p Chris
194 * Player can fly through markers
195 *
196 * 188 2/17/99 4:50p Jason
197 * fixed destroyable face/breakable glass bug
198 *
199 * 187 2/17/99 1:26p Matt
200 * Fixed the die angle system for weapons (changing it around a little in
201 * the process: now all non-weapons (which don't use the system) should
202 * have dot == -1, weapons that die at any angle have dot == 0, and
203 * setting dot == 1 means it never dies).
204 *
205 * 186 2/16/99 8:16a Chris
206 * Fixed a bug - THANKS!
207 *
208 * 185 2/10/99 1:48p Matt
209 * Changed object handle symbolic constants
210 *
211 * 184 2/09/99 2:38p Jason
212 * added destroyable faces
213 *
214 * 183 2/02/99 8:44a Chris
215 * I made buildings with AI work correctly (ie really big robots should be
216 * buildings)
217 * anim to and from states are now shorts instead of bytes
218 *
219 * 182 1/31/99 7:26p Matt
220 * Renamed a bunch of functions to have HUD capitalized
221 *
222 * 181 1/29/99 5:09p Chris
223 * Made changes for ROCKS
224 *
225 * 180 1/28/99 6:17p Jason
226 * added markers
227 *
228 * 179 1/26/99 6:39p Jason
229 * added wall effects code
230 *
231 * 178 1/25/99 5:59p Matt
232 * Patched the masses of objects
233 *
234 * 177 1/24/99 8:18p Chris
235 * Updated AI and OSIRIS. Externalized fireball constants for spew and
236 * sparks. Added CreateRandomSparks to OSIRIS, renamed a bunch of AI
237 * Notify names to use underscores. Fixed a memory access leak in the
238 * matcen effect code.
239 *
240 * 176 1/23/99 5:16p Chris
241 * Bounds fixed acos and asin stuff (-1.0000000000001 could cause really
242 * bad things to happen with rot. vels)
243 *
244 * 175 1/20/99 10:50a Jason
245 * added new terrain
246 *
247 * 174 1/20/99 2:13a Chris
248 * It is now possible for robots to have special immunities, resistances,
249 * and vunerabilities
250 *
251 * 173 1/18/99 12:12a Jeff
252 * removed weapon collide event, combined it in general collide event.
253 * general collide event handles more collides. Added a room collide
254 * event
255 *
256 * 172 1/15/99 3:59a Jeff
257 * added two new multiplayer DLL events for weapon collisions. Added two
258 * new fields to DLLInfo data, point and normal, which are filled out for
259 * collision events.
260 *
261 * 170 1/10/99 7:35p Matt
262 * Added missing break to DO_COLLISION macor
263 *
264 * 169 1/10/99 6:49a Jeff
265 * Some initial work to get linux version to compile
266 *
267 * 168 1/08/99 2:56p Samir
268 * Ripped out OSIRIS1.
269 *
270 * 167 1/01/99 4:10p Chris
271 * Added some const parameters, improved ray cast object collide/rejection
272 * code
273 *
274 * 166 12/21/98 10:50a Chris
275 * You can now push walking objects
276 *
277 * 165 12/17/98 12:08p Jeff
278 * first checkin of new implementation of OSIRIS (old OSIRIS no longer
279 * works)
280 *
281 * 164 11/19/98 3:54p Chris
282 *
283 * 163 11/19/98 3:51p Chris
284 * Shooting dying robots makes them blow up faster (but now not as
285 * quickly)
286 *
287 * 162 11/13/98 4:25p Jason
288 * changes for better weapon effects
289 *
290 * 161 11/13/98 1:00p Chris
291 * Fixed a math problem with the new collision response code. Zero rad
292 * particles where causing i1 or i2 to be zero. c1 = c1/i1 -> it was
293 * going to infinity. So, I made a floor threshold for i1 and i2
294 *
295 * 160 11/11/98 2:46p Kevin
296 * Demo recording system work
297 *
298 * 159 11/10/98 5:17p Jeff
299 * peppered in some more forcefeedback effects
300 *
301 * 158 10/30/98 5:17p Chris
302 * Players only get 1/4 the rotational velocity of an impulse
303 *
304 * 157 10/29/98 1:45p Chris
305 * Checked in the better collision response code
306 *
307 * 156 10/22/98 12:57p Chris
308 * Added sounds to player/player and player/robot collisions
309 *
310 * 155 10/20/98 1:26p Jason
311 * took out spawning on direct hits
312 *
313 * 154 10/20/98 12:10p Chris
314 *
315 * 153 10/19/98 8:38p Matt
316 * Don't make a sound when colliding with lava, since the lava will start
317 * you on fire, which will make sound.
318 *
319 * 152 10/19/98 7:19p Matt
320 * Added system to support different types of damage to the player and
321 * have these different types make different sounds.
322 *
323 * 151 10/18/98 2:09p Matt
324 * Made the backquote/flare thing go away in release versions, and made it
325 * work for terrain cells.
326 *
327 * 150 10/17/98 12:25p Chris
328 * Fixed attached flares
329 *
330 * 149 10/16/98 5:25p Chris
331 * Fixed sticky code
332 *
333 * 148 10/16/98 4:33p Chris
334 *
335 * 147 10/16/98 4:18p Chris
336 * Fixed the 'flare thing'
337 *
338 * 146 10/16/98 3:39p Chris
339 * Improved the object linking system and AI and physics
340 *
341 * 145 10/15/98 4:51p Chris
342 * Speed up dying for player too
343 *
344 * 144 10/15/98 4:49p Chris
345 * Speed up dying if the robot is getting hit
346 *
347 * 143 10/12/98 2:27p Matt
348 * Fixed code to print room:face when backquote/tilde held down and flare
349 * hits the wall.
350 *
351 * 142 10/12/98 10:04a Chris
352 * Wall hits cannot kill the player
353 *
354 * 141 10/09/98 7:57p Chris
355 * Added the flare room/wall cheat
356 *
357 * 140 10/09/98 7:47p Chris
358 * Added ObjSetDeadFlag
359 *
360 * 139 10/08/98 12:00p Kevin
361 * Demo system work
362 *
363 * 138 10/05/98 7:23p Jason
364 * implemented destroyable lights (first draft)
365 *
366 * 137 10/01/98 6:56p Jason
367 * turned off energy weapon hit effects if the object getting hit is the
368 * viewer - this helps cut down on the general clutter in heavy combat
369 *
370 * 136 9/29/98 4:48p Chris
371 * Working on multiplayer collisions
372 *
373 * 135 9/23/98 5:04p Chris
374 * Raised the collide wall damage threshold
375 *
376 * 134 9/23/98 3:47p Chris
377 * Increased the speed to cause damage from wall hits
378 *
379 * 133 9/22/98 12:23p Chris
380 * Further improvements to wall hitting
381 *
382 * 132 9/21/98 8:32p Chris
383 * Another improvement to the forcefield stuff
384 *
385 * 131 9/21/98 8:19p Chris
386 * Improved volatile and forcefield hits
387 *
388 * 130 9/21/98 1:08p Chris
389 * Improved lava handling
390 *
391 * 129 9/21/98 1:04p Chris
392 *
393 * 128 9/21/98 1:03p Chris
394 *
395 * 127 9/21/98 1:01p Chris
396 * Fixed more volatile problems
397 *
398 * 126 9/21/98 11:44a Chris
399 * Fixed the volatile terrain crash bug
400 *
401 * 125 9/18/98 7:45p Chris
402 * Lava works - needs tweaking.
403 *
404 * 124 8/25/98 7:27p Chris
405 * Improved the scorch code
406 *
407 * 123 8/25/98 7:23p Chris
408 * Made weapons explode even if they break glass
409 *
410 * 122 8/25/98 12:35p Chris
411 * Fixed a small reversed normal bug
412 *
413 * 121 8/19/98 2:48p Jason
414 * fixed some weapon firing and weapon exploding bugs
415 *
416 * 120 8/18/98 7:12p Chris
417 * Improved FUSION behavior.
418 *
419 * 119 8/12/98 12:26p Chris
420 *
421 * 118 8/05/98 11:16a Matt
422 * Added trigger checks when weapons and the player collide with walls.
423 *
424 * 117 8/03/98 5:56p Jason
425 * got fusion cannon working correctly
426 *
427 * 116 7/31/98 11:52a Chris
428 * Weapons can be persistent. Added ability for objects to be manually
429 * set for no object collisions.
430 *
431 * 115 7/30/98 11:09a Jason
432 * added weapons that freeze and deform terrain
433 *
434 * 114 7/22/98 4:36p Jason
435 * took out bugs from observer mode
436 *
437 * 113 7/17/98 10:12a Chris
438 *
439 * 112 7/01/98 12:56p Jason
440 * more changes for countermeasures
441 *
442 * 111 7/01/98 12:12p Jason
443 * added countermeasures
444 *
445 * 110 6/24/98 3:56p Jason
446 * added code for new omega cannon
447 *
448 * 109 6/15/98 3:23p Chris
449 * Single point walker update
450 *
451 * 108 6/15/98 7:53a Chris
452 * Fixed a comment'ed out variable
453 *
454 * 107 6/15/98 7:52a Chris
455 * Removed the new "cool" physics
456 *
457 * 106 6/11/98 12:48p Jason
458 * added better spewing weapons
459 *
460 * 105 6/04/98 12:00p Matt
461 * Took out Napalm Rocket hack that I added for the E3 demo.
462 *
463 * 104 6/02/98 10:43p Chris
464 * Multipoint collision detection enabled
465 *
466 * 103 6/01/98 9:23p Chris
467 * Fixed a bunch of collision problems
468 *
469 * 102 5/27/98 6:18p Matt
470 * Super hack to reduce impact damage of napalm rocket (for E3 only)
471 *
472 * 101 5/27/98 6:08p Chris
473 * Added weapon to generic sound
474 *
475 * 100 5/26/98 4:17p Jason
476 * made scripts/dlls not collide every single frame
477 *
478 * 99 5/26/98 3:58p Matt
479 * Only matter weapons now break glass.
480 *
481 * 98 5/25/98 8:36p Matt
482 * Added code to set different sizes for different weapon scorch marks.
483 * Also, don't leave scorch marks on lights.
484 *
485 * 97 5/22/98 12:34p Matt
486 * Added scorch mark/bullet hole system.
487 *
488 * 96 5/22/98 11:59a Chris
489 * Fixed improper uses of FindSoundName and made the proper static sounds
490 *
491 * 95 5/19/98 4:42a Chris
492 * Added shockwave's -- enjoy. :)
493 *
494 * 94 5/07/98 2:52p Chris
495 * Removed a bounce mprintf
496 *
497 * 93 5/07/98 2:40p Chris
498 * Added death_dot and bounce sound for weapons
499 *
500 * 92 5/07/98 2:22p Chris
501 * Hit die dot
502 *
503 * 91 5/06/98 7:07p Samir
504 * when player is completely dead, don't call script too.
505 *
506 * 90 5/05/98 3:42p Chris
507 * Code cleanup and fixed the collide_XXX_with_wall code. The wall_normal
508 * was know by fvi; so, it is passed to the function (instead of
509 * generating it again)
510 *
511 * 89 5/04/98 3:51p Matt
512 * Finished (for now) with breaking glass.
513 *
514 * 88 5/04/98 1:00p Jason
515 * changed the way weapon explosions work
516 *
517 * 87 5/04/98 12:47p Matt
518 * Improvements to the breaking glass system, though I don't consider it
519 * anywhere near done yet.
520 *
521 * 86 5/03/98 10:24p Matt
522 * Partially completed breaking glass code, checked in so Chris can fix a
523 * bug
524 *
525 * 85 4/23/98 7:14p Chris
526 * Changed non-moving objects to player collisions
527 *
528 * 84 4/22/98 9:43p Chris
529 * More AI improvements
530 *
531 * 83 4/22/98 3:25p Jason
532 * changes for multiplayer debugging
533 *
534 * 82 4/20/98 4:47p Chris
535 * Made collision stuff more accurate
536 *
537 * 81 4/17/98 2:00p Jason
538 * added cool object effects
539 *
540 * 80 4/15/98 12:56p Chris
541 * Reformatted some code
542 *
543 * 79 4/09/98 5:18p Jason
544 * got guided working in multiplayer
545 *
546 * 78 4/09/98 12:05p Chris
547 * Added parenting for all object types. :)
548 *
549 * 77 4/08/98 11:16a Chris
550 * Fixed powerup pickup bug
551 *
552 * 76 4/07/98 4:25p Chris
553 * Added support for buddy bot
554 *
555 * 75 4/06/98 11:59a Chris
556 * Fixed powerup/powerup hack
557 *
558 * 74 3/31/98 5:56p Jason
559 * changes for multiplay
560 *
561 * 73 3/30/98 5:12p Jason
562 * more changes for game/dll integration
563 *
564 * 72 3/20/98 9:34p Jason
565 * added SetObjectDeadFlag inlined function
566 *
567 * 71 3/20/98 6:39p Jason
568 * 100.0 to 1.0 for volume
569 *
570 * 70 3/20/98 3:54p Chris
571 * Working on adding sounds to the game. :)
572 *
573 * 69 3/20/98 3:21p Chris
574 * Added player hit by weapon sound.
575 *
576 * 68 3/20/98 2:59p Chris
577 * Added a wall hit sound for the player and added support for a base
578 * volume for 3d sounds
579 *
580 * 67 3/19/98 7:15p Jason
581 * more changes for multiplayer
582 *
583 * 66 3/19/98 3:44p Chris
584 * Multiplayer enchancement for collisions
585 *
586 * 65 3/19/98 3:27p Chris
587 * Did some collision code for multiplayer.
588 *
589 * 64 3/18/98 5:45p Jason
590 * more multiplayer script integration
591 *
592 * 63 3/17/98 6:17p Jason
593 * added gamemode collide stuff
594 *
595 * 62 3/17/98 11:27a Chris
596 * Added object bump notifies for AI
597 *
598 * 61 3/13/98 5:55p Chris
599 * Added the new collision spheres
600 *
601 * 60 2/23/98 5:46p Chris
602 * Removed some old code.
603 *
604 * 59 2/18/98 11:48a Craig
605 *
606 * 58 2/11/98 4:10p Jason
607 * got spawning impact weapons working
608 *
609 * 57 2/05/98 2:54p Jason
610 * changes for explosions
611 *
612 * 56 2/05/98 2:02p Chris
613 * Fixed the hitseg and hitwall in collide_object_with_wall and
614 * scrape_object_with_wall
615 *
616 * 55 2/04/98 6:09p Matt
617 * Changed object room number to indicate a terrain cell via a flag. Got
618 * rid of the object flag which used to indicate terrain.
619 *
620 * 54 1/30/98 2:54p Matt
621 * Took script calls out of bump_two_objects, since they alread existed in
622 * collide_two_objects
623 *
624 * 53 1/29/98 5:48p Matt
625 * Got rid of marker objects
626 *
627 * 52 1/29/98 4:16p Matt
628 * Fixed some problems from my last changes
629 *
630 * 51 1/29/98 3:11p Matt
631 * Clean up a bit: deleted commented-out code, removed leftover D1/D2
632 * stuff, removed references to hostage objects
633 *
634 * 50 1/28/98 12:00p Jason
635 * more changes for multiplayer
636 *
637 * 49 1/26/98 11:01a Jason
638 * incremental checkin for multiplayer
639 *
640 * 48 1/23/98 11:21a Jason
641 * incremental multiplayer checkin
642 *
643 * 47 1/21/98 6:09p Jason
644 * Got player deaths working in multiplayer
645 *
646 * 46 1/21/98 3:05p Samir
647 * Changed a function call to StartPlayerExplosion
648 *
649 * 45 1/21/98 1:11p Jason
650 * incremental checkin for multiplayer
651 *
652 * 44 1/20/98 12:10p Jason
653 * implemented vis effect system
654 *
655 * 43 1/19/98 10:04a Matt
656 * Added new object handle system
657 *
658 * 42 1/14/98 7:57p Chris
659 * Improving the awareness system
660 *
661 * 41 1/14/98 1:23p Jason
662 * made ApplyDamageToGeneric send the weapons parent as the killer
663 *
664 * 40 1/09/98 4:13p Chris
665 * Reformatted some code
666 *
667 * 39 1/09/98 4:11p Chris
668 * Removed a mprintf
669 *
670 * 38 12/22/97 6:19p Chris
671 * Moved weapon battery firing sound off the projectile (weapon) and into
672 * the weapon battery.
673 *
674 * 37 12/15/97 11:03a Jason
675 * make sparks only when successfully hit
676 *
677 * 36 12/12/97 6:13p Jason
678 * added sparks
679 *
680 * 35 12/10/97 2:36p Jason
681 * added random small explosions
682 *
683 * 34 12/04/97 12:15p Jason
684 * gave designers the ability to set their own weapon-to-wall hit vclips
685 *
686 * 33 12/01/97 9:54a Chris
687 * Added support for concussive forces, generalized robot collisions to
688 * generic collisions
689 *
690 * 32 11/20/97 1:38p Chris
691 * No rotation is applied to player objects
692 *
693 * 31 11/13/97 5:06p Chris
694 * Added support for clutter to weapon collisions
695 *
696 * 30 11/05/97 6:42p Jason
697 * took out stupid blast ring
698 *
699 * 29 10/29/97 1:29p Chris
700 * Added PF_STICK for weapons
701 *
702 * 28 10/24/97 2:30p Jason
703 * more changes for explosions
704 *
705 * 27 10/23/97 11:14a Jason
706 * changed some fireball DEFINEs
707 *
708 * 26 10/22/97 7:26p Samir
709 * Player death mostly working. Damn hangup still occurs. Freaky.
710 *
711 * 25 10/22/97 4:30p Chris
712 * We can now slew between the mine and the terrain
713 *
714 * 24 10/22/97 11:44a Jason
715 * changes for explosion system
716 *
717 * 23 10/21/97 4:15p Chris
718 * Incremental integration of the fvi/physics/collide code
719 *
720 * 22 10/20/97 4:46p Jason
721 * changes for explosions
722 *
723 * 21 10/20/97 11:55a Chris
724 * Added some support for the new collide system.
725 *
726 * 20 10/16/97 3:46p Chris
727 * Incremental improvements
728 *
729 * 19 10/03/97 3:47p Chris
730 * Moved script calls to bump two objects (so building can have scripts)
731 *
732 * 18 10/03/97 3:45p Chris
733 * Added some bumping force by weapons
734 *
735 * 17 10/03/97 3:18p Samir
736 * Added script hook to bump_this_object
737 *
738 * 16 10/02/97 11:34a Chris
739 * Added support for external room collisions
740 *
741 * 15 10/01/97 4:51p Samir
742 * Include damage.h
743 *
744 * 14 9/19/97 9:37p Chris
745 * Attempted to fix door collisions -- almost there, but not quite
746 *
747 * 13 9/15/97 5:17a Chris
748 * Removed the Explosion Vclips since they do not play correctly in
749 * Hardware
750 * Added support for building collisons.
751 * working on SPhere to non-moving sphere collisions
752 *
753 * 12 9/12/97 6:36p Chris
754 * Added building collisions
755 *
756 * 11 9/05/97 12:27p Samir
757 * Player takes damage and set death if needed.
758 *
759 * 10 9/04/97 12:03p Matt
760 * Got rid of warnings
761 *
762 * 9 9/03/97 2:13p Chris
763 * Working on improving the debris system and partical explosions
764 *
765 * 8 8/21/97 7:53p Chris
766 *
767 * 7 8/21/97 7:52p Chris
768 *
769 * 6 8/18/97 1:46a Chris
770 * Allowed for robot damage and destoyable objects.
771 * Also, allowed weapons to bounce
772 *
773 * 5 8/14/97 11:44a Samir
774 * Don't kill powerups. Let script do it.
775 *
776 * 4 8/12/97 3:32p Samir
777 * collisions call script code now too.
778 *
779 * 3 8/11/97 1:54p Matt
780 * Ripped out robot & powerup pages, and added generic page
781 *
782 * 2 7/28/97 1:16p Chris
783 * Allow for player and robots to be hit by weapons and correct parenting
784 * of weapons.
785 *
786 * 16 5/19/97 5:39 PM Jeremy
787 * removed "we hit a robot" mprintf
788 *
789 * 15 5/15/97 6:09p Chris
790 *
791 * 14 5/13/97 5:52p Chris
792 * Added ability to exit and enter mine. Also did some
793 * incremental improvements.
794 *
795 * 13 5/05/97 5:41a Chris
796 * Added some better polygon collision code. It is still rough though.
797 *
798 * 12 4/29/97 8:03a Chris
799 * Improved the sound code. High-level sound now
800 * fully uses the flags in the sound page and it
801 * resulted in a simpilier coding interface :)
802 *
803 * 11 4/24/97 5:42p Jason
804 * got fireball vclips working
805 *
806 * 10 4/24/97 12:28p Jason
807 * added sound when weapon hits a wall
808 *
809 * 9 4/24/97 3:25a Chris
810 * // Added some more support for 3d sounds
811 *
812 * 8 4/23/97 6:34p Chris
813 * // Incremental collision stuff.
814 *
815 * 7 4/23/97 6:06p Jason
816 * made player ship and weapons work correctly together (first pass)
817 *
818 * 6 4/17/97 3:10p Chris
819 * Added edge of world object delete. Also did some incremental
820 * improvements.
821 *
822 * 5 4/11/97 3:05a Chris
823 * Allowed robot sphere collision
824 *
825 * 4 3/15/97 1:29p Chris
826 *
827 * $NoKeywords: $
828 */
829
830 #include <algorithm>
831 #include <cmath>
832 #include <cstdio>
833
834 #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/
835 #include "collide.h"cxx . . $ `<file>/physics/collide.h`/
836 #include "D3ForceFeedback.h"cxx . . $ `<file>/Descent3/D3ForceFeedback.h`/
837 #include "ddio_common.h"cxx . . $ `<file>/ddio/ddio_common.h`/
838 #include "damage.h"cxx . . $ `<file>/Descent3/damage.h`/
839 #include "demofile.h"cxx . . $ `<file>/lib/demofile.h`/
840 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
841 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
842 #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/
843 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
844 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
845 #include "levelgoal.h"cxx . . $ `<file>/Descent3/levelgoal.h`/
846 #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/
847 #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/
848 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
849 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
850 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
851 #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/
852 #include "physics.h"cxx . . $ `<file>/physics/physics.h`/
853 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
854 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
855 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
856 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
857 #include "scorch.h"cxx . . $ `<file>/Descent3/scorch.h`/
858 #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/
859 #include "trigger.h"cxx . . $ `<file>/Descent3/trigger.h`/
860 #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/
861 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
862
863 #define PLAYER_ROTATION_BY_FORCE_SCALARcxx . . $ `physics/collide.cpp:863:9`! 0.12f
864 #define NONPLAYER_ROTATION_BY_FORCE_SCALARcxx . . $ `physics/collide.cpp:864:9`! 1.0f
865
866 uint8_tcxx . . $ uint8_t# CollisionResultcxx . . $ CollisionResult.[MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!][MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!];
867 uint8_tcxx . . $ uint8_t# CollisionRayResultcxx . . $ CollisionRayResult.[MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!];
868
869 static bool IsOKToApplyForcecxx . . $ IsOKToApplyForce(39516aeee13ca5ab).(objectcxx . . $ object# *objp);
870 //! Creates some effects where a weapon has collided with a wall.
871 static void DoWallEffectscxx . . $ DoWallEffects(766a1b7183ffa4b4).(objectcxx . . $ object# *weapon, int surface_tmap);
872 //! Check for lava, volatile, or water surface. If contact, make special sound & kill the weapon.
873 static void check_for_special_surfacecxx . . $ check_for_special_surface(a35642c99d329708).(objectcxx . . $ object# *weapon, int surface_tmap, vectorcxx . . $ vector# *surface_normal, float hit_dot);
874 /// Process a collision between a weapon and a wall.
875 /// - Returns: true if the weapon hits the wall, and false if should keep going though the wall (for breakable glass).
876 static bool collide_weapon_and_wallcxx . . $ collide_weapon_and_wall(e4a40ad8112938aa).(objectcxx . . $ object# *weapon, fixcxx . . $ fix# hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpnt,
877 vectorcxx . . $ vector# *wall_normal, float hit_dot);
878 /// Prints out a marker hud message if needed.
879 static void collide_player_and_markercxx . . $ collide_player_and_marker(ba4cc96b4b366922).(objectcxx . . $ object# *playerobj, objectcxx . . $ object# *marker_obj, vectorcxx . . $ vector# *collision_point,
880 vectorcxx . . $ vector# *collision_normal, bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info);
881 static void collide_player_and_wallcxx . . $ collide_player_and_wall(cd5bbf25e955f730).(objectcxx . . $ object# *playerobj, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpt,
882 vectorcxx . . $ vector# *wall_normal, float hit_dot);
883 static void collide_generic_and_wallcxx . . $ collide_generic_and_wall(cd5bbf25e955f730).(objectcxx . . $ object# *genericobj, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpt,
884 vectorcxx . . $ vector# *wall_normal, float hit_dot);
885 static void CollideAnglesToMatrixcxx . . $ CollideAnglesToMatrix(8fba0386e373947b).(matrixcxx . . $ matrix# *m, float p, float h, float b);
886 static vectorcxx . . $ vector# *CollideExtractAnglesFromMatrixcxx . . $ CollideExtractAnglesFromMatrix(7e8589a60955da58).(vectorcxx . . $ vector# *a, matrixcxx . . $ matrix# *m);
887 static void bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(objectcxx . . $ object# *object0, objectcxx . . $ object# *object1, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
888 int damage_flag);
889 static void collide_player_and_playercxx . . $ collide_player_and_player(ba4cc96b4b366922).(objectcxx . . $ object# *p1, objectcxx . . $ object# *p2, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
890 bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info);
891 static void collide_generic_and_playercxx . . $ collide_generic_and_player(ba4cc96b4b366922).(objectcxx . . $ object# *robotobj, objectcxx . . $ object# *playerobj, vectorcxx . . $ vector# *collision_point,
892 vectorcxx . . $ vector# *collision_normal, bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info);
893 static void MakeWeaponStickcxx . . $ MakeWeaponStick(2592bea16b35063f).(objectcxx . . $ object# *weapon, objectcxx . . $ object# *parent, fvi_infocxx . . $ fvi_info# *hit_info);
894 static void check_lg_informcxx . . $ check_lg_inform(6273fa812ac58a8).(objectcxx . . $ object# *A, objectcxx . . $ object# *B);
895
896 bool IsOKToApplyForcecxx . . $ IsOKToApplyForce(39516aeee13ca5ab).(objectcxx . . $ object# *objp) {
897 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
898 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
899 if (objp != Player_objectcxx . . $ Player_object.)
900 return false;
901 } else {
902 if (objp->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && objp->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
903 return false;
904 }
905 }
906
907 if (objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass. == 0.0)
908 return false;
909
910 if (objp->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && objp->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!)
911 return false;
912
913 if (objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_PERSISTENTcxx . . $ `Descent3/object_external.h:318:9`!)
914 return false;
915
916 if (objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!) // Not done!
917 return false;
918
919 return true;
920 }
921
922 struct vec2dcxx . . $ vec2d# {
923 float icxx . . $ vec2d#i., jcxx . . $ vec2d#j.;
924 };
925
926 #define crosscxx . . $ `physics/collide.cpp:926:9`!(v0, v1) (((v0)->i * (v1)->j) - ((v0)->j * (v1)->i))
927
928 // finds the uv coords of the given point on the given seg & side
929 // fills in u & v. if l is non-NULL fills it in also
930 void FindHitpointUVcxx . . $ FindHitpointUV(7a2228cd553a361c).(float *u, float *v, vectorcxx . . $ vector# *point, roomcxx . . $ room# *rp, int facenum) {
931 facecxx . . $ face# *fp = &rp->facescxx . . $ room#faces.[facenum];
932 int ii, jj;
933 vec2dcxx . . $ vec2d# pnt[3], checkp, vec0, vec1;
934 float *t;
935 float k0, k1;
936 int i;
937
938 // 1. find what plane to project this wall onto to make it a 2d case
939
940 GetIJcxx . . $ GetIJ(a7f4633b423b3cc3).(&fp->normalcxx . . $ face#normal., &ii, &jj);
941
942 // 2. compute u,v of intersection point
943
944 // Copy face points into 2d verts array
945 for (i = 0; i < 3; i++) {
946 t = &rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[i]].xcxx . . $ vector#x.;
947 pnt[i].icxx . . $ vec2d#i. = t[ii];
948 pnt[i].jcxx . . $ vec2d#j. = t[jj];
949 }
950 t = &point->xcxx . . $ vector#x.;
951 checkp.icxx . . $ vec2d#i. = t[ii];
952 checkp.jcxx . . $ vec2d#j. = t[jj];
953
954 // vec from 1 -> 0
955 vec0.icxx . . $ vec2d#i. = pnt[0].icxx . . $ vec2d#i. - pnt[1].icxx . . $ vec2d#i.;
956 vec0.jcxx . . $ vec2d#j. = pnt[0].jcxx . . $ vec2d#j. - pnt[1].jcxx . . $ vec2d#j.;
957
958 // vec from 1 -> 2
959 vec1.icxx . . $ vec2d#i. = pnt[2].icxx . . $ vec2d#i. - pnt[1].icxx . . $ vec2d#i.;
960 vec1.jcxx . . $ vec2d#j. = pnt[2].jcxx . . $ vec2d#j. - pnt[1].jcxx . . $ vec2d#j.;
961
962 k1 = -((crosscxx . . $ `physics/collide.cpp:926:9`!(&checkp, &vec0) + crosscxx . . $ `physics/collide.cpp:926:9`!(&vec0, &pnt[1])) / crosscxx . . $ `physics/collide.cpp:926:9`!(&vec0, &vec1));
963 if (fabsf(vec0.icxx . . $ vec2d#i.) > fabsf(vec0.jcxx . . $ vec2d#j.))
964 k0 = ((-k1 * vec1.icxx . . $ vec2d#i.) + checkp.icxx . . $ vec2d#i. - pnt[1].icxx . . $ vec2d#i.) / vec0.icxx . . $ vec2d#i.;
965 else
966 k0 = ((-k1 * vec1.jcxx . . $ vec2d#j.) + checkp.jcxx . . $ vec2d#j. - pnt[1].jcxx . . $ vec2d#j.) / vec0.jcxx . . $ vec2d#j.;
967
968 // mprintf(0," k0,k1 = %x,%x\n",k0,k1);
969
970 *u = fp->face_uvlscxx . . $ face#face_uvls.[1].ucxx . . $ roomUVL#u. + (k0 * (fp->face_uvlscxx . . $ face#face_uvls.[0].ucxx . . $ roomUVL#u. - fp->face_uvlscxx . . $ face#face_uvls.[1].ucxx . . $ roomUVL#u.)) +
971 (k1 * (fp->face_uvlscxx . . $ face#face_uvls.[2].ucxx . . $ roomUVL#u. - fp->face_uvlscxx . . $ face#face_uvls.[1].ucxx . . $ roomUVL#u.));
972 *v = fp->face_uvlscxx . . $ face#face_uvls.[1].vcxx . . $ roomUVL#v. + (k0 * (fp->face_uvlscxx . . $ face#face_uvls.[0].vcxx . . $ roomUVL#v. - fp->face_uvlscxx . . $ face#face_uvls.[1].vcxx . . $ roomUVL#v.)) +
973 (k1 * (fp->face_uvlscxx . . $ face#face_uvls.[2].vcxx . . $ roomUVL#v. - fp->face_uvlscxx . . $ face#face_uvls.[1].vcxx . . $ roomUVL#v.));
974
975 // mprintf(0," u,v = %x,%x\n",*u,*v);
976 }
977
978 // Creates some effects where a weapon has collided with a wall
979 void DoWallEffectscxx . . $ DoWallEffects(766a1b7183ffa4b4).(objectcxx . . $ object# *weapon, int surface_tmap) {
980 texturecxx . . $ texture# *texp = &GameTexturescxx . . $ GameTextures.[surface_tmap];
981
982 if (texp->flagscxx . . $ texture#flags. & (TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`! + TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`! + TF_WATERcxx . . $ `Descent3/gametexture.h:202:9`!)) {
983 // Create some lava steam
984 if ((texp->flagscxx . . $ texture#flags. & TF_WATERcxx . . $ `Descent3/gametexture.h:202:9`!) || ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 4) == 0)) {
985 int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, MED_SMOKE_INDEXcxx . . $ `Descent3/fireball_external.h:29:9`!, weapon->roomnumcxx . . $ object#roomnum., &weapon->poscxx . . $ object#pos.);
986 if (visnum >= 0) {
987 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
988
989 vis->lifetimecxx . . $ vis_effect#lifetime. = .9f;
990 vis->lifeleftcxx . . $ vis_effect#lifeleft. = .9f;
991
992 vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
993 vis->sizecxx . . $ vis_effect#size. = 3.0;
994 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&vis->velocitycxx . . $ vis_effect#velocity.);
995 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = 10;
996 }
997 }
998 } else if (texp->flagscxx . . $ texture#flags. & TF_RUBBLEcxx . . $ `Descent3/gametexture.h:231:9`!) {
999 if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 4) == 0) {
1000 int num_rubble = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 3) + 1;
1001 int bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(texp - GameTexturescxx . . $ GameTextures., 0);
1002 uint16_tcxx . . $ uint16_t# *data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(bm_handle, 0);
1003
1004 uint16_tcxx . . $ uint16_t# color = data[(bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0) * (bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0) / 2)) + (bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0) / 2)];
1005
1006 for (int i = 0; i < num_rubble; i++) {
1007 int visnum;
1008
1009 visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, RUBBLE1_INDEXcxx . . $ `Descent3/fireball_external.h:64:9`! + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 2), weapon->roomnumcxx . . $ object#roomnum., &weapon->poscxx . . $ object#pos.);
1010
1011 if (visnum >= 0) {
1012 vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum];
1013
1014 vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
1015 vis->masscxx . . $ vis_effect#mass. = 100;
1016 vis->dragcxx . . $ vis_effect#drag. = .1f;
1017
1018 vis->phys_flagscxx . . $ vis_effect#phys_flags. |= PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`! | PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!;
1019
1020 if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 3) == 0) {
1021 vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50;
1022 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = -((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 200) - 30);
1023 vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50;
1024 } else {
1025 vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 300) - 50;
1026 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = -((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 200) - 30);
1027 vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 300) - 50;
1028 }
1029
1030 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.);
1031 vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). 4 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 20);
1032 vis->sizecxx . . $ vis_effect#size. = .5 + (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 11) - 5) * .05);
1033 vis->flagscxx . . $ vis_effect#flags. |= VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!;
1034 float lifetime = 1.0 + (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 11) - 5) * .1);
1035 vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime;
1036 vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime;
1037 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = color;
1038 }
1039 }
1040 }
1041 }
1042 }
1043
1044 #define FORCEFIELD_DAMAGEcxx . . $ `physics/collide.cpp:1044:9`! 5.0f
1045
1046 extern void DeformTerraincxx . . $ DeformTerrain(15ae840579c16834).(vectorcxx . . $ vector# *pos, int depth, float size);
1047
1048 // Check for lava, volatile, or water surface. If contact, make special sound & kill the weapon
1049 void check_for_special_surfacecxx . . $ check_for_special_surface(a35642c99d329708).(objectcxx . . $ object# *weapon, int surface_tmap, vectorcxx . . $ vector# *surface_normal, float hit_dot) {
1050 bool f_forcefield, f_volatile, f_lava, f_water;
1051
1052 f_forcefield = (GameTexturescxx . . $ GameTextures.[surface_tmap].flagscxx . . $ texture#flags. & TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`!) != 0;
1053 f_volatile = (GameTexturescxx . . $ GameTextures.[surface_tmap].flagscxx . . $ texture#flags. & TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`!) != 0;
1054 f_lava = (GameTexturescxx . . $ GameTextures.[surface_tmap].flagscxx . . $ texture#flags. & TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!) != 0;
1055 f_water = (GameTexturescxx . . $ GameTextures.[surface_tmap].flagscxx . . $ texture#flags. & TF_WATERcxx . . $ `Descent3/gametexture.h:202:9`!) != 0;
1056
1057 // Kill the weapon if the surface is volatile, lava, or water
1058 if (f_volatile || f_lava || f_water) {
1059 int snd;
1060 ain_hearcxx . . $ ain_hear# hear;
1061 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = false;
1062
1063 if (f_water) {
1064 snd = SOUND_WEAPON_HIT_WATERcxx . . $ `Descent3/sounds.h:153:9`!;
1065 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.2f;
1066 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.3f;
1067 } else if (f_volatile || f_lava) {
1068 snd = SOUND_WEAPON_HIT_LAVAcxx . . $ `Descent3/sounds.h:152:9`!;
1069 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.1f;
1070 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.5f;
1071 } else
1072 Int3cxx . . $ `misc/pserror.h:247:9`!();
1073
1074 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[snd].max_distancecxx . . $ sound_info#max_distance.;
1075 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(snd, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, weapon);
1076 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(weapon, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1077
1078 if (!f_water)
1079 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(weapon, surface_normal);
1080
1081 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(weapon);
1082 }
1083 }
1084
1085 // Process a collision between a weapon and a wall
1086 // Returns true if the weapon hits the wall, and false if should keep going though the wall (for breakable glass)
1087 bool collide_weapon_and_wallcxx . . $ collide_weapon_and_wall(e4a40ad8112938aa).(objectcxx . . $ object# *weapon, fixcxx . . $ fix# hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpnt, vectorcxx . . $ vector# *wall_normal,
1088 float hit_dot) {
1089 bool f_forcefield;
1090 bool f_volatile, f_lava, f_water;
1091 // mprintf(0, "Weapon hit wall, how nice.\n");
1092
1093 // #ifndef RELEASE
1094 if ((stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Weapons[weapon->id].name, "Yellow flare") == 0) && (weapon->parent_handlecxx . . $ object#parent_handle. == Player_objectcxx . . $ Player_object.->handlecxx . . $ object#handle.) &&
1095 (KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_LAPOSTROcxx . . $ `ddio/ddio_common.h:266:9`!))) {
1096 if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hitseg)) {
1097 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).("Terrain cell %d", CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(hitseg));
1098 } else {
1099 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).("Room %d face %d", hitseg, hitwall);
1100 }
1101 }
1102 // #endif
1103
1104 // Check if forcefield
1105 int tmap;
1106 if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hitseg)) // Make sure we've hit a wall, and not terrain
1107 {
1108 tmap = Roomscxx . . $ Rooms.[hitseg].facescxx . . $ room#faces.[hitwall].tmapcxx . . $ face#tmap.;
1109 } else {
1110 tmap = Terrain_tex_segcxx . . $ Terrain_tex_seg.[Terrain_segcxx . . $ Terrain_seg.[CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(hitseg)].texseg_indexcxx . . $ terrain_segment#texseg_index.].tex_indexcxx . . $ terrain_tex_segment#tex_index.;
1111 }
1112 f_forcefield = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`!) != 0;
1113 f_volatile = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`!) != 0;
1114 f_lava = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!) != 0;
1115 f_water = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_WATERcxx . . $ `Descent3/gametexture.h:202:9`!) != 0;
1116
1117 if (f_forcefield && !(Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_MATTER_WEAPONcxx . . $ `Descent3/weapon.h:221:9`!)) {
1118 ain_hearcxx . . $ ain_hear# hear;
1119 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = false;
1120 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.9f;
1121 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.1f;
1122
1123 if (sound_override_force_fieldcxx . . $ sound_override_force_field. == -1)
1124 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_FORCEFIELD_BOUNCEcxx . . $ `Descent3/sounds.h:122:9`!].max_distancecxx . . $ sound_info#max_distance.;
1125 else
1126 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[sound_override_force_fieldcxx . . $ sound_override_force_field.].max_distancecxx . . $ sound_info#max_distance.;
1127
1128 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(weapon, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1129
1130 if (sound_override_force_fieldcxx . . $ sound_override_force_field. == -1)
1131 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_FORCEFIELD_BOUNCEcxx . . $ `Descent3/sounds.h:122:9`!, SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, weapon);
1132 else
1133 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(sound_override_force_fieldcxx . . $ sound_override_force_field., SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, weapon);
1134
1135 return true;
1136 }
1137
1138 // Check for destroyable or breakable face
1139 if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hitseg)) // First, make sure we've hit a wall, and not terrain
1140 {
1141 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[hitseg];
1142 facecxx . . $ face# *fp = &rp->facescxx . . $ room#faces.[hitwall];
1143
1144 // Check for a trigger on this wall
1145 CheckTriggercxx . . $ CheckTrigger(11e0cce86948d892).(hitseg, hitwall, weapon, TT_COLLIDEcxx . . $ `Descent3/trigger.h:144:9`!);
1146
1147 // Check for a destroyable face
1148 if ((GameTexturescxx . . $ GameTextures.[fp->tmapcxx . . $ face#tmap.].flagscxx . . $ texture#flags. & TF_DESTROYABLEcxx . . $ `Descent3/gametexture.h:208:9`!) && !(fp->flagscxx . . $ face#flags. & FF_DESTROYEDcxx . . $ `Descent3/room_external.h:119:9`!)) {
1149 int visnum = CreateFireballcxx . . $ CreateFireball(2a769cac3223e33b).(hitpnt, SHATTER_INDEXcxx . . $ `Descent3/fireball_external.h:67:9`! + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 2), hitseg, VISUAL_FIREBALLcxx . . $ `Descent3/fireball.h:165:9`!);
1150
1151 if (visnum >= 0) {
1152 // Alter the size of this explosion based on the face size
1153 vectorcxx . . $ vector# verts[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!];
1154 vectorcxx . . $ vector# center;
1155 for (int t = 0; t < fp->num_vertscxx . . $ face#num_verts.; t++)
1156 verts[t] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[t]];
1157
1158 float size = sqrtcxx . . $ sqrt(fbcf3211dfe1bfd1).(vm_GetCentroidcxx . . $ vm_GetCentroid(9f2e9a768aacd0cc).(&center, verts, fp->num_vertscxx . . $ face#num_verts.));
1159 VisEffectscxx . . $ VisEffects.[visnum].sizecxx . . $ vis_effect#size. = (size / 2);
1160 }
1161
1162 CreateRandomSparkscxx . . $ CreateRandomSparks(3e6b82e54d72ee3b).(20, hitpnt, hitseg);
1163
1164 if (sound_override_glass_breakingcxx . . $ sound_override_glass_breaking. == -1)
1165 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_BREAKING_GLASScxx . . $ `Descent3/sounds.h:110:9`!, SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, weapon);
1166 else
1167 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(sound_override_glass_breakingcxx . . $ sound_override_glass_breaking., SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, weapon);
1168
1169 fp->flagscxx . . $ face#flags. |= FF_DESTROYEDcxx . . $ `Descent3/room_external.h:119:9`!;
1170 }
1171
1172 // Check for a breakable face: If the texture is breakable and it's on a portal
1173 // and hit with a matter weapon, break it
1174 if ((fp->portal_numcxx . . $ face#portal_num. != -1) && (GameTexturescxx . . $ GameTextures.[fp->tmapcxx . . $ face#tmap.].flagscxx . . $ texture#flags. & TF_BREAKABLEcxx . . $ `Descent3/gametexture.h:221:9`!) &&
1175 (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_MATTER_WEAPONcxx . . $ `Descent3/weapon.h:221:9`!)) {
1176
1177 // Do the breaking glass stuff
1178 if (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))
1179 BreakGlassFacecxx . . $ BreakGlassFace(13a53ec972efd3cd).(rp, hitwall, hitpnt, &weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.);
1180
1181 ain_hearcxx . . $ ain_hear# hear;
1182 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = false;
1183 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.9f;
1184 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 1.0f;
1185 if (sound_override_glass_breakingcxx . . $ sound_override_glass_breaking. == -1)
1186 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_BREAKING_GLASScxx . . $ `Descent3/sounds.h:110:9`!].max_distancecxx . . $ sound_info#max_distance.;
1187 else
1188 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[sound_override_glass_breakingcxx . . $ sound_override_glass_breaking.].max_distancecxx . . $ sound_info#max_distance.;
1189 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(weapon, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1190
1191 return false;
1192 }
1193 }
1194
1195 // Add a scorch
1196 if ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].scorch_handlecxx . . $ weapon#scorch_handle. != -1) && !f_water && !f_volatile && !f_lava)
1197 AddScorchcxx . . $ AddScorch(f3438a7ee3e74b15).(hitseg, hitwall, hitpnt, Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].scorch_handlecxx . . $ weapon#scorch_handle., Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].scorch_sizecxx . . $ weapon#scorch_size.);
1198
1199 if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hitseg)) {
1200 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].terrain_damage_sizecxx . . $ weapon#terrain_damage_size. > 0 && Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].terrain_damage_depthcxx . . $ weapon#terrain_damage_depth. > 0) {
1201 DeformTerraincxx . . $ DeformTerrain(15ae840579c16834).(&weapon->poscxx . . $ object#pos., Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].terrain_damage_depthcxx . . $ weapon#terrain_damage_depth., Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].terrain_damage_sizecxx . . $ weapon#terrain_damage_size.);
1202 }
1203 }
1204
1205 // Do special smoke, etc.
1206 DoWallEffectscxx . . $ DoWallEffects(766a1b7183ffa4b4).(weapon, tmap);
1207
1208 // look for lava, volatile, water
1209 check_for_special_surfacecxx . . $ check_for_special_surface(a35642c99d329708).(weapon, tmap, wall_normal, hit_dot);
1210
1211 // If dead, we're done
1212 if (weapon->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)
1213 return true;
1214
1215 // If done bouncing, kill the weapon
1216 if ((weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..num_bouncescxx . . $ physics_info#num_bounces. <= 0) && !(weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_STICKcxx . . $ `Descent3/object_external.h:317:9`!) &&
1217 (hit_dot > weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..hit_die_dotcxx . . $ physics_info#$anonymous_type_5#hit_die_dot.)) {
1218 int snd;
1219 ain_hearcxx . . $ ain_hear# hear;
1220 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = false;
1221
1222 snd = Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!];
1223 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.9f;
1224 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.1f;
1225
1226 if (snd != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
1227 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[snd].max_distancecxx . . $ sound_info#max_distance.;
1228 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(snd, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, weapon);
1229 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(weapon, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1230 }
1231
1232 // Check to see if we should spawn
1233 if ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SPAWNS_IMPACTcxx . . $ `Descent3/weapon.h:233:9`!) && Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].spawn_countcxx . . $ weapon#spawn_count. > 0 &&
1234 Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].spawn_handlecxx . . $ weapon#spawn_handle. >= 0)
1235 CreateImpactSpawnFromWeaponcxx . . $ CreateImpactSpawnFromWeapon(835e87111e401cce).(weapon, wall_normal);
1236
1237 if ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SPAWNS_ROBOTcxx . . $ `Descent3/weapon.h:242:9`!) && (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_COUNTERMEASUREcxx . . $ `Descent3/weapon.h:241:9`!) &&
1238 Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].robot_spawn_handlecxx . . $ weapon#robot_spawn_handle. >= 0)
1239 CreateRobotSpawnFromWeaponcxx . . $ CreateRobotSpawnFromWeapon(419c470199a90a97).(weapon);
1240
1241 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(weapon, wall_normal);
1242
1243 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(weapon);
1244 } else { // weapon is bouncing
1245
1246 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_BOUNCEcxx . . $ `Descent3/weapon.h:266:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
1247 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_BOUNCEcxx . . $ `Descent3/weapon.h:266:9`!], SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, weapon);
1248
1249 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_BOUNCEcxx . . $ `Descent3/weapon.h:266:9`!] > -1) {
1250 ain_hearcxx . . $ ain_hear# hear;
1251 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = false;
1252 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.20f;
1253 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.6f;
1254 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_BOUNCEcxx . . $ `Descent3/weapon.h:266:9`!]].max_distancecxx . . $ sound_info#max_distance.;
1255 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(weapon, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1256 }
1257 }
1258 }
1259
1260 return true;
1261 }
1262
1263 // Prints out a marker hud message if needed
1264 void collide_player_and_markercxx . . $ collide_player_and_marker(ba4cc96b4b366922).(objectcxx . . $ object# *playerobj, objectcxx . . $ object# *marker_obj, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
1265 bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info) {
1266 if (playerobj->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.) {
1267 char str[100];
1268 snprintf(str, sizeof(str), "Marker: %s", MarkerMessagescxx . . $ MarkerMessages.[marker_obj->idcxx . . $ object#id.]);
1269 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(str);
1270 }
1271 }
1272
1273 #define MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`! 40.0f
1274 #define MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`! 120.0f
1275 #define MIN_PLAYER_WALL_SOUND_TIMEcxx . . $ `physics/collide.cpp:1275:9`! .1f
1276 #define WALL_DAMAGEcxx . . $ `physics/collide.cpp:1276:9`! 0.5f
1277 #define MIN_WALL_HIT_DAMAGE_SHIELDScxx . . $ `physics/collide.cpp:1277:9`! 5
1278 #define MIN_WALL_DAMAGE_SPEEDcxx . . $ `physics/collide.cpp:1278:9`! 65.0
1279
1280 #define VOLATILE_DAMAGEcxx . . $ `physics/collide.cpp:1280:9`! 7.0f // damage per hit
1281
1282 void collide_player_and_wallcxx . . $ collide_player_and_wall(cd5bbf25e955f730).(objectcxx . . $ object# *playerobj, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpt,
1283 vectorcxx . . $ vector# *wall_normal, float hit_dot) {
1284 float volume = MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!;
1285 bool f_volatile, f_lava;
1286 bool f_forcefield;
1287 int tmap;
1288
1289 if (playerobj->flagscxx . . $ object#flags. & OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!)
1290 playerobj->ctypecxx . . $ object#ctype..dying_infocxx . . $ object#$anonymous_type_9#dying_info..delay_timecxx . . $ dying_info_s#delay_time. *= 0.9f;
1291
1292 // Check for a trigger on this wall
1293 if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hitseg)) // Make sure we've hit a wall, and not terrain
1294 {
1295 CheckTriggercxx . . $ CheckTrigger(11e0cce86948d892).(hitseg, hitwall, playerobj, TT_COLLIDEcxx . . $ `Descent3/trigger.h:144:9`!);
1296 tmap = Roomscxx . . $ Rooms.[hitseg].facescxx . . $ room#faces.[hitwall].tmapcxx . . $ face#tmap.;
1297 } else {
1298 tmap = Terrain_tex_segcxx . . $ Terrain_tex_seg.[Terrain_segcxx . . $ Terrain_seg.[CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(hitseg)].texseg_indexcxx . . $ terrain_segment#texseg_index.].tex_indexcxx . . $ terrain_tex_segment#tex_index.;
1299 }
1300 f_lava = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!) != 0;
1301 f_volatile = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`!) != 0;
1302 f_forcefield = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`!) != 0;
1303
1304 if (f_lava) {
1305 if (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) {
1306 int id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("NapalmBlob");
1307 if (id >= 0)
1308 SetNapalmDamageEffectcxx . . $ SetNapalmDamageEffect(6964148eab73f28a).(playerobj, nullptr, id);
1309 else
1310 Int3cxx . . $ `misc/pserror.h:247:9`!();
1311 }
1312 }
1313
1314 // If volatile, make the sound & apply damage
1315 if (f_volatile) {
1316 if (playerobj == Player_objectcxx . . $ Player_object.) {
1317 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`!)
1318 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(playerobj, playerobj, PD_VOLATILE_HISScxx . . $ `Descent3/damage_external.h:29:9`!, VOLATILE_DAMAGEcxx . . $ `physics/collide.cpp:1280:9`!);
1319 else {
1320 Multi_requested_damage_typecxx . . $ Multi_requested_damage_type. = PD_VOLATILE_HISScxx . . $ `Descent3/damage_external.h:29:9`!;
1321 Multi_requested_damage_amountcxx . . $ Multi_requested_damage_amount. += (VOLATILE_DAMAGEcxx . . $ `physics/collide.cpp:1280:9`!);
1322 }
1323 }
1324 }
1325
1326 if (f_forcefield) {
1327 if (playerobj == Player_objectcxx . . $ Player_object. && sound_override_force_fieldcxx . . $ sound_override_force_field. == -1) {
1328 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`!)
1329 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(playerobj, playerobj, PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`!, FORCEFIELD_DAMAGEcxx . . $ `physics/collide.cpp:1044:9`!);
1330 else {
1331 Multi_requested_damage_typecxx . . $ Multi_requested_damage_type. = PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`!;
1332 Multi_requested_damage_amountcxx . . $ Multi_requested_damage_amount. += (FORCEFIELD_DAMAGEcxx . . $ `physics/collide.cpp:1044:9`!);
1333 }
1334 }
1335
1336 if (sound_override_force_fieldcxx . . $ sound_override_force_field. == -1)
1337 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_FORCEFIELD_BOUNCEcxx . . $ `Descent3/sounds.h:122:9`!, SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, playerobj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!);
1338 else
1339 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(sound_override_force_fieldcxx . . $ sound_override_force_field., SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, playerobj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!);
1340 }
1341
1342 if (f_forcefield || f_lava || f_volatile) {
1343 ain_hearcxx . . $ ain_hear# hear;
1344 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = true;
1345 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.90f;
1346 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.6f;
1347 if (sound_override_force_fieldcxx . . $ sound_override_force_field. == -1)
1348 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_FORCEFIELD_BOUNCEcxx . . $ `Descent3/sounds.h:122:9`!].max_distancecxx . . $ sound_info#max_distance.;
1349 else
1350 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[sound_override_force_fieldcxx . . $ sound_override_force_field.].max_distancecxx . . $ sound_info#max_distance.;
1351 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(playerobj, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1352 }
1353
1354 // Do sound stuff when a player hits a wall
1355 if (!f_forcefield && !f_volatile && !f_lava && hitspeed > MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`! &&
1356 Playerscxx . . $ Players.[playerobj->idcxx . . $ object#id.].last_hit_wall_sound_timecxx . . $ player#last_hit_wall_sound_time. + MIN_PLAYER_WALL_SOUND_TIMEcxx . . $ `physics/collide.cpp:1275:9`! < Gametimecxx . . $ Gametime.) {
1357 if (hitspeed < MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`!) {
1358 volume =
1359 MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! * (hitspeed - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) / (MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`! - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!);
1360 }
1361
1362 if (hitspeed > MIN_WALL_DAMAGE_SPEEDcxx . . $ `physics/collide.cpp:1278:9`!) {
1363 if (playerobj == Player_objectcxx . . $ Player_object. && playerobj->shieldscxx . . $ object#shields. >= MIN_WALL_HIT_DAMAGE_SHIELDScxx . . $ `physics/collide.cpp:1277:9`!) {
1364 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`!)
1365 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(playerobj, playerobj, PD_WALL_HITcxx . . $ `Descent3/damage_external.h:28:9`!, WALL_DAMAGEcxx . . $ `physics/collide.cpp:1276:9`!);
1366 else {
1367 Multi_requested_damage_typecxx . . $ Multi_requested_damage_type. = PD_WALL_HITcxx . . $ `Descent3/damage_external.h:28:9`!;
1368 Multi_requested_damage_amountcxx . . $ Multi_requested_damage_amount. += (WALL_DAMAGEcxx . . $ `physics/collide.cpp:1276:9`!);
1369 }
1370 }
1371 }
1372
1373 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, playerobj, volume);
1374 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!)
1375 DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(playerobj), 1, volume);
1376
1377 ain_hearcxx . . $ ain_hear# hear;
1378 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = true;
1379 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.10f;
1380 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.5f;
1381 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!].max_distancecxx . . $ sound_info#max_distance. * volume;
1382 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(playerobj, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
1383
1384 Playerscxx . . $ Players.[playerobj->idcxx . . $ object#id.].last_hit_wall_sound_timecxx . . $ player#last_hit_wall_sound_time. = Gametimecxx . . $ Gametime.;
1385 }
1386
1387 if (Playerscxx . . $ Players.[playerobj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!)
1388 StartPlayerExplosioncxx . . $ StartPlayerExplosion(d4f767463ce0a6b3).(playerobj->idcxx . . $ object#id.);
1389
1390 // Do ForceFeedback
1391 //----------------
1392 if (playerobj->idcxx . . $ object#id. == Player_numcxx . . $ Player_num. && ForceIsEnabledcxx . . $ ForceIsEnabled(c9857a73d68e59ba).()) {
1393 DoForceForWallcxx . . $ DoForceForWall(13f0d3ae53d6a4f9).(playerobj, hitspeed, hitseg, hitwall, wall_normal);
1394 }
1395
1396 return;
1397 }
1398
1399 void collide_generic_and_wallcxx . . $ collide_generic_and_wall(cd5bbf25e955f730).(objectcxx . . $ object# *genericobj, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpt,
1400 vectorcxx . . $ vector# *wall_normal, float hit_dot) {
1401 bool f_volatile, f_lava;
1402 bool f_forcefield;
1403 float volume = MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!;
1404
1405 // Check for a trigger on this wall
1406 int tmap;
1407 if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hitseg)) // Make sure we've hit a wall, and not terrain
1408 {
1409 CheckTriggercxx . . $ CheckTrigger(11e0cce86948d892).(hitseg, hitwall, genericobj, TT_COLLIDEcxx . . $ `Descent3/trigger.h:144:9`!);
1410 tmap = Roomscxx . . $ Rooms.[hitseg].facescxx . . $ room#faces.[hitwall].tmapcxx . . $ face#tmap.;
1411 } else {
1412 tmap = Terrain_tex_segcxx . . $ Terrain_tex_seg.[Terrain_segcxx . . $ Terrain_seg.[CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(hitseg)].texseg_indexcxx . . $ terrain_segment#texseg_index.].tex_indexcxx . . $ terrain_tex_segment#tex_index.;
1413 }
1414 f_forcefield = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`!) != 0;
1415 f_volatile = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`!) != 0;
1416 f_lava = (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!) != 0;
1417
1418 if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(genericobj)) {
1419 f_forcefield = false;
1420 f_volatile = false;
1421 f_lava = false;
1422 }
1423
1424 if (f_lava) {
1425 if (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) {
1426 int id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("NapalmBlob");
1427 if (id >= 0)
1428 SetNapalmDamageEffectcxx . . $ SetNapalmDamageEffect(6964148eab73f28a).(genericobj, nullptr, id);
1429 else
1430 Int3cxx . . $ `misc/pserror.h:247:9`!();
1431 }
1432 }
1433
1434 // If volatile, make the sound & apply damage
1435 if (f_volatile && !((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) {
1436 ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(genericobj, genericobj, GD_VOLATILE_HISScxx . . $ `Descent3/damage_external.h:40:9`!, VOLATILE_DAMAGEcxx . . $ `physics/collide.cpp:1280:9`!);
1437 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_VOLATILE_HISScxx . . $ `Descent3/sounds.h:151:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, genericobj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!);
1438 }
1439
1440 if (f_forcefield && !((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) {
1441 if (sound_override_force_fieldcxx . . $ sound_override_force_field. == -1) {
1442 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_FORCEFIELD_BOUNCEcxx . . $ `Descent3/sounds.h:122:9`!, SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!, genericobj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!);
1443 ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(genericobj, genericobj, GD_ENERGYcxx . . $ `Descent3/damage_external.h:37:9`!, FORCEFIELD_DAMAGEcxx . . $ `physics/collide.cpp:1044:9`!);
1444 } else {
1445 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(sound_override_force_fieldcxx . . $ sound_override_force_field., SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!, genericobj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!);
1446 }
1447 }
1448
1449 if (genericobj->control_typecxx . . $ object#control_type. != CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) {
1450 if (!f_forcefield && !f_volatile && !f_lava && hitspeed > MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) {
1451 if (hitspeed < MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`!) {
1452 volume =
1453 MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! * (hitspeed - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) / (MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`! - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!);
1454 }
1455
1456 if (hitspeed > MIN_WALL_DAMAGE_SPEEDcxx . . $ `physics/collide.cpp:1278:9`!) {
1457 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`!) {
1458 ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(genericobj, genericobj, GD_PHYSICScxx . . $ `Descent3/damage_external.h:38:9`!, WALL_DAMAGEcxx . . $ `physics/collide.cpp:1276:9`!);
1459 }
1460 }
1461
1462 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!, SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!, genericobj, volume);
1463 if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!)
1464 DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(genericobj), 1, volume);
1465 }
1466 }
1467 }
1468
1469 void CollideAnglesToMatrixcxx . . $ CollideAnglesToMatrix(8fba0386e373947b).(matrixcxx . . $ matrix# *m, float p, float h, float b) {
1470 float sinp, cosp, sinb, cosb, sinh, cosh;
1471
1472 sinp = sincxx . . $ sin(fbcf3211dfe1bfd1).(p);
1473 cosp = coscxx . . $ cos(fbcf3211dfe1bfd1).(p);
1474 sinb = sincxx . . $ sin(fbcf3211dfe1bfd1).(b);
1475 cosb = coscxx . . $ cos(fbcf3211dfe1bfd1).(b);
1476 sinh = sincxx . . $ sin(fbcf3211dfe1bfd1).(h);
1477 cosh = coscxx . . $ cos(fbcf3211dfe1bfd1).(h);
1478
1479 m->rveccxx . . $ matrix#rvec..xcxx . . $ vector#x. = cosb * cosh;
1480 m->rveccxx . . $ matrix#rvec..ycxx . . $ vector#y. = cosb * sinp * sinh - cosp * sinb;
1481 m->rveccxx . . $ matrix#rvec..zcxx . . $ vector#z. = cosb * cosp * sinh + sinb * sinp;
1482
1483 m->uveccxx . . $ matrix#uvec..xcxx . . $ vector#x. = cosh * sinb;
1484 m->uveccxx . . $ matrix#uvec..ycxx . . $ vector#y. = sinb * sinp * sinh + cosp * cosb;
1485 m->uveccxx . . $ matrix#uvec..zcxx . . $ vector#z. = sinb * cosp * sinh - cosb * sinp;
1486
1487 m->fveccxx . . $ matrix#fvec..xcxx . . $ vector#x. = -sinh;
1488 m->fveccxx . . $ matrix#fvec..ycxx . . $ vector#y. = sinp * cosh;
1489 m->fveccxx . . $ matrix#fvec..zcxx . . $ vector#z. = cosp * cosh;
1490 }
1491
1492 vectorcxx . . $ vector# *CollideExtractAnglesFromMatrixcxx . . $ CollideExtractAnglesFromMatrix(7e8589a60955da58).(vectorcxx . . $ vector# *a, matrixcxx . . $ matrix# *m) {
1493 float sinh, cosh, sinp, sinb;
1494
1495 sinh = -m->fveccxx . . $ matrix#fvec..xcxx . . $ vector#x.;
1496 if (sinh < -1.0f)
1497 sinh = -1.0f;
1498 else if (sinh > 1.0f)
1499 sinh = 1.0f;
1500 a->ycxx . . $ vector#y. = asincxx . . $ asin(fbcf3211dfe1bfd1).(sinh);
1501
1502 cosh = coscxx . . $ cos(fbcf3211dfe1bfd1).(a->ycxx . . $ vector#y.);
1503 ASSERTcxx . . $ `misc/pserror.h:246:9`!(cosh != 0.0);
1504
1505 sinp = m->fveccxx . . $ matrix#fvec..ycxx . . $ vector#y. / cosh;
1506 if (sinp < -1.0f)
1507 sinp = -1.0f;
1508 else if (sinp > 1.0f)
1509 sinp = 1.0f;
1510
1511 sinb = m->uveccxx . . $ matrix#uvec..xcxx . . $ vector#x. / cosh;
1512 if (sinb < -1.0f)
1513 sinb = -1.0f;
1514 else if (sinb > 1.0f)
1515 sinb = 1.0f;
1516
1517 a->xcxx . . $ vector#x. = asincxx . . $ asin(fbcf3211dfe1bfd1).(sinp);
1518 a->zcxx . . $ vector#z. = asincxx . . $ asin(fbcf3211dfe1bfd1).(sinb);
1519
1520 return a;
1521 }
1522
1523 void ConvertEulerToAxisAmountcxx . . $ ConvertEulerToAxisAmount(1430ddb085312116).(vectorcxx . . $ vector# *e, vectorcxx . . $ vector# *n, float *w) {
1524 float rotspeed = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(e);
1525 matrixcxx . . $ matrix# rotmat;
1526 vectorcxx . . $ vector# e_n;
1527 float scale = rotspeed / .0001f;
1528
1529 // If there isn't a rotation, return something valid
1530 if (rotspeed == 0.0f || scale == 0.0f) {
1531 *n =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1532 n->ycxx . . $ vector#y. = 1.0f;
1533 *w = 0.0f;
1534
1535 return;
1536 }
1537
1538 e_n =cxx . . $ vector#`operator=`(c0842353a20857d). *e /cxx . . $ `operator/`(252247219a31502c). scale;
1539
1540 CollideAnglesToMatrixcxx . . $ CollideAnglesToMatrix(8fba0386e373947b).(&rotmat, e_n.xcxx . . $ vector#x., e_n.ycxx . . $ vector#y., e_n.zcxx . . $ vector#z.);
1541
1542 // This is from Graphics Gems 1 p.467 I am converting from a angle vector
1543 // to the normal of that rotation (you can also get the angle about that normal, but
1544 // we don't need it)
1545 n->xcxx . . $ vector#x. = rotmat.uveccxx . . $ matrix#uvec..zcxx . . $ vector#z. - rotmat.fveccxx . . $ matrix#fvec..ycxx . . $ vector#y.;
1546 n->ycxx . . $ vector#y. = rotmat.fveccxx . . $ matrix#fvec..xcxx . . $ vector#x. - rotmat.rveccxx . . $ matrix#rvec..zcxx . . $ vector#z.;
1547 n->zcxx . . $ vector#z. = rotmat.rveccxx . . $ matrix#rvec..ycxx . . $ vector#y. - rotmat.uveccxx . . $ matrix#uvec..xcxx . . $ vector#x.;
1548
1549 if (*n !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) {
1550 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(n);
1551
1552 float ct = (rotmat.rveccxx . . $ matrix#rvec..xcxx . . $ vector#x. + rotmat.uveccxx . . $ matrix#uvec..ycxx . . $ vector#y. + rotmat.fveccxx . . $ matrix#fvec..zcxx . . $ vector#z. - 1.0f) / 2.0f;
1553 if (ct < -1.0f)
1554 ct = -1.0f;
1555 else if (ct > 1.0f)
1556 ct = 1.0f;
1557
1558 float v = acoscxx . . $ acos(fbcf3211dfe1bfd1).(ct);
1559 float z = sincxx . . $ sin(fbcf3211dfe1bfd1).(v);
1560
1561 *w = rotspeed * ((2.0f * PIcxx . . $ `fix/fix.h:73:9`!) / (65535.0f));
1562
1563 if (z >= 0.0f)
1564 *n *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
1565 } else {
1566 *w = 0.0f;
1567 }
1568 }
1569
1570 void ConvertAxisAmountToEulercxx . . $ ConvertAxisAmountToEuler(541fdd6f774327be).(vectorcxx . . $ vector# *n, float *w, vectorcxx . . $ vector# *e) {
1571 float s;
1572 float c;
1573 float t;
1574
1575 float scale = *w / .0001f;
1576 float w_n = .0001f;
1577 vectorcxx . . $ vector# s_result;
1578
1579 if (*w == 0.0f) {
1580 *e =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1581 return;
1582 }
1583
1584 s = sincxx . . $ sin(fbcf3211dfe1bfd1).(.0001f);
1585 c = coscxx . . $ cos(fbcf3211dfe1bfd1).(.0001f);
1586 t = 1.0f - c;
1587
1588 matrixcxx . . $ matrix# rotmat;
1589 const float sx = s * n->xcxx . . $ vector#x.;
1590 const float sy = s * n->ycxx . . $ vector#y.;
1591 const float sz = s * n->zcxx . . $ vector#z.;
1592 const float txy = t * n->xcxx . . $ vector#x. * n->ycxx . . $ vector#y.;
1593 const float txz = t * n->xcxx . . $ vector#x. * n->zcxx . . $ vector#z.;
1594 const float tyz = t * n->ycxx . . $ vector#y. * n->zcxx . . $ vector#z.;
1595 const float txx = t * n->xcxx . . $ vector#x. * n->xcxx . . $ vector#x.;
1596 const float tyy = t * n->ycxx . . $ vector#y. * n->ycxx . . $ vector#y.;
1597 const float tzz = t * n->zcxx . . $ vector#z. * n->zcxx . . $ vector#z.;
1598
1599 rotmat.rveccxx . . $ matrix#rvec..xcxx . . $ vector#x. = txx + c;
1600 rotmat.rveccxx . . $ matrix#rvec..ycxx . . $ vector#y. = txy - sz;
1601 rotmat.rveccxx . . $ matrix#rvec..zcxx . . $ vector#z. = txz + sy;
1602 rotmat.uveccxx . . $ matrix#uvec..xcxx . . $ vector#x. = txy + sz;
1603 rotmat.uveccxx . . $ matrix#uvec..ycxx . . $ vector#y. = tyy + c;
1604 rotmat.uveccxx . . $ matrix#uvec..zcxx . . $ vector#z. = tyz - sx;
1605 rotmat.fveccxx . . $ matrix#fvec..xcxx . . $ vector#x. = txz - sy;
1606 rotmat.fveccxx . . $ matrix#fvec..ycxx . . $ vector#y. = tyz + sx;
1607 rotmat.fveccxx . . $ matrix#fvec..zcxx . . $ vector#z. = tzz + c;
1608
1609 CollideExtractAnglesFromMatrixcxx . . $ CollideExtractAnglesFromMatrix(7e8589a60955da58).(&s_result, &rotmat);
1610
1611 e->xcxx . . $ vector#x. = (s_result.xcxx . . $ vector#x.) * scale * (65535.0f / (2.0 * PIcxx . . $ `fix/fix.h:73:9`!));
1612 e->ycxx . . $ vector#y. = (s_result.ycxx . . $ vector#y.) * scale * (65535.0f / (2.0 * PIcxx . . $ `fix/fix.h:73:9`!));
1613 e->zcxx . . $ vector#z. = (s_result.zcxx . . $ vector#z.) * scale * (65535.0f / (2.0 * PIcxx . . $ `fix/fix.h:73:9`!));
1614 }
1615
1616 void bump_obj_against_fixedcxx . . $ bump_obj_against_fixed(4f42c5e5dcf5b21f).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal) {
1617 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.rotvel.x));
1618 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.rotvel.y));
1619 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.rotvel.z));
1620 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.velocity.x));
1621 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.velocity.y));
1622 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.velocity.z));
1623
1624 if (!IsOKToApplyForcecxx . . $ IsOKToApplyForce(39516aeee13ca5ab).(obj))
1625 return;
1626
1627 vectorcxx . . $ vector# r1 = *collision_point -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.;
1628 vectorcxx . . $ vector# w1;
1629 vectorcxx . . $ vector# n1;
1630 float temp1;
1631
1632 float j;
1633
1634 matrixcxx . . $ matrix# o_t1 = obj->orientcxx . . $ object#orient.;
1635 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&o_t1);
1636
1637 vectorcxx . . $ vector# cmp1 = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). o_t1;
1638
1639 ConvertEulerToAxisAmountcxx . . $ ConvertEulerToAxisAmount(1430ddb085312116).(&cmp1, &n1, &temp1);
1640
1641 n1 *=cxx . . $ `operator*=`(f132838b2cd11d6). temp1;
1642
1643 if (temp1 != 0.0f) {
1644 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&w1, &n1, &r1);
1645 } else {
1646 w1 =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1647 }
1648
1649 vectorcxx . . $ vector# p1 = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +cxx . . $ operator+(b77b703cd1e43e33). w1;
1650 float v_rel;
1651
1652 float m1 = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.;
1653
1654 ASSERTcxx . . $ `misc/pserror.h:246:9`!(m1 != 0.0f);
1655 if (m1 <= 0.0f)
1656 m1 = 0.00000001f;
1657
1658 v_rel = *collision_normal *cxx . . $ `operator*`(4a721543d64e126a). (p1);
1659
1660 float e = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..coeff_restitutioncxx . . $ physics_info#coeff_restitution.;
1661
1662 vectorcxx . . $ vector# c1;
1663 vectorcxx . . $ vector# cc1;
1664 float cv1;
1665
1666 // matrix i1;
1667 // matrix i2;
1668 float i1 = (2.0f / 5.0f) * m1 * obj->sizecxx . . $ object#size. * obj->sizecxx . . $ object#size.;
1669
1670 if (i1 < .0000001)
1671 i1 = .0000001f;
1672
1673 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&c1, &r1, collision_normal);
1674
1675 c1 =cxx . . $ vector#`operator=`(c0842353a20857d). c1 /cxx . . $ `operator/`(252247219a31502c). i1;
1676
1677 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&cc1, &c1, &r1);
1678
1679 cv1 = (*collision_normal) *cxx . . $ `operator*`(4a721543d64e126a). c1;
1680
1681 j = (-(1.0f + e)) * v_rel;
1682 j /= (1 / m1 + cv1);
1683
1684 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). ((j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal)) /cxx . . $ `operator/`(252247219a31502c). m1);
1685
1686 vectorcxx . . $ vector# jcn = j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal);
1687
1688 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&c1, &r1, &jcn);
1689
1690 n1 =cxx . . $ vector#`operator=`(c0842353a20857d). (c1) /cxx . . $ `operator/`(252247219a31502c). i1;
1691
1692 temp1 = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&n1);
1693
1694 vectorcxx . . $ vector# txx1;
1695
1696 ConvertAxisAmountToEulercxx . . $ ConvertAxisAmountToEuler(541fdd6f774327be).(&n1, &temp1, &txx1);
1697
1698 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (txx1 *cxx . . $ `operator*`(14b8f9ac5c1e7b85). obj->orientcxx . . $ object#orient.);
1699
1700 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.rotvel.x));
1701 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.rotvel.y));
1702 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.rotvel.z));
1703 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.velocity.x));
1704 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.velocity.y));
1705 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(obj->mtype.phys_info.velocity.z));
1706 }
1707
1708 void bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(objectcxx . . $ object# *object0, objectcxx . . $ object# *object1, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
1709 int damage_flag) {
1710 objectcxx . . $ object# *t = nullptr;
1711 objectcxx . . $ object# *other = nullptr;
1712
1713 // Determine if a moving object hits a non-moving object
1714 if ((object0->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && object0->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) ||
1715 (object0->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. ==cxx . . $ `operator==`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector. &&
1716 (object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!) && (object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!))) {
1717 t = object1;
1718 other = object0;
1719 *collision_normal *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
1720 }
1721 if ((object1->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && object1->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) ||
1722 (object1->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. ==cxx . . $ `operator==`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector. &&
1723 (object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!) && (object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!))) {
1724 t = object0;
1725 other = object1;
1726 }
1727
1728 // If we hit a non-moving object...
1729 if (t) {
1730 // chrishack -- walker hack
1731 if (t->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && t->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) {
1732 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1733 return;
1734 }
1735
1736 if (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_PERSISTENTcxx . . $ `Descent3/object_external.h:318:9`!)
1737 return;
1738
1739 vectorcxx . . $ vector# moved_v;
1740 float wall_part;
1741
1742 float luke_test;
1743
1744 if (t->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1745 luke_test = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.);
1746 }
1747
1748 if (!(t->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)) {
1749 // Find hit speed
1750 moved_v =cxx . . $ vector#`operator=`(c0842353a20857d). t->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). t->last_poscxx . . $ object#last_pos.;
1751 wall_part = *collision_normal *cxx . . $ `operator*`(4a721543d64e126a). t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
1752
1753 if (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_BOUNCEcxx . . $ `Descent3/object_external.h:315:9`!) {
1754 wall_part *= 2.0; // Subtract out wall part twice to achieve bounce
1755
1756 // New bounceness code
1757 if ((t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_BOUNCEcxx . . $ `Descent3/object_external.h:315:9`!) && (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..num_bouncescxx . . $ physics_info#num_bounces. != PHYSICS_UNLIMITED_BOUNCEcxx . . $ `physics/physics.h:81:9`!)) {
1758 if (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..num_bouncescxx . . $ physics_info#num_bounces. == 0) {
1759 ASSERTcxx . . $ `misc/pserror.h:246:9`!(t->type != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
1760 if (t->flagscxx . . $ object#flags. & OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!) {
1761 ASSERTcxx . . $ `misc/pserror.h:246:9`!((t->control_type == CT_DYINGcxx . . $ `Descent3/object_external.h:229:9`!) || (t->control_type == CT_DYING_AND_AIcxx . . $ `Descent3/object_external.h:230:9`!));
1762 DestroyObjectcxx . . $ DestroyObject(a11214108e4e4480).(t, 50.0, t->ctypecxx . . $ object#ctype..dying_infocxx . . $ object#$anonymous_type_9#dying_info..death_flagscxx . . $ dying_info_s#death_flags.);
1763 } else
1764 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(t);
1765 }
1766 }
1767 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..num_bouncescxx . . $ physics_info#num_bounces.--;
1768
1769 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). *collision_normal *cxx . . $ `operator*`(252247219a31502c). (wall_part * -1.0f);
1770
1771 if (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..coeff_restitutioncxx . . $ physics_info#coeff_restitution. != 1.0f)
1772 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(252247219a31502c). (1.0f - t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..coeff_restitutioncxx . . $ physics_info#coeff_restitution.));
1773 } else {
1774 float wall_force;
1775
1776 wall_force = t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. *cxx . . $ `operator*`(4a721543d64e126a). *collision_normal;
1777 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9).
1778 *collision_normal *cxx . . $ `operator*`(252247219a31502c). (wall_force * -1.001); // 1.001 so that we are not quite tangential
1779
1780 // Update velocity from wall hit.
1781 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9).
1782 *collision_normal *cxx . . $ `operator*`(252247219a31502c). (wall_part * -1.001); // 1.001 so that we are not quite tangential
1783 if (t->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1784 float real_vel;
1785
1786 real_vel = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.);
1787 t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). ((real_vel + luke_test) / 2.0f);
1788 // obj->mtype.phys_info.velocity *= (luke_test);
1789 }
1790 }
1791
1792 // Weapons should face their new heading. This is so missiles are pointing in the correct direct.
1793 if (t->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && (t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & (PF_BOUNCEcxx . . $ `Descent3/object_external.h:315:9`! | PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`! | PF_WINDcxx . . $ `Descent3/object_external.h:322:9`!)))
1794 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&t->orientcxx . . $ object#orient., &t->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity., &t->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec., nullptr);
1795 }
1796
1797 // Return it to the original direction
1798 if (object0->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && object0->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) {
1799 *collision_normal *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
1800 }
1801
1802 // Do ForceFeedback stuff for non-moving objects
1803 //-----------------------------------------
1804 if (ForceIsEnabledcxx . . $ ForceIsEnabled(c9857a73d68e59ba).()) {
1805
1806 if (object0->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && object0->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.) {
1807 }
1808 }
1809 return;
1810 }
1811
1812 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.rotvel.x));
1813 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.rotvel.y));
1814 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.rotvel.z));
1815 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.rotvel.x));
1816 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.rotvel.y));
1817 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.rotvel.z));
1818 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.velocity.x));
1819 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.velocity.y));
1820 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.velocity.z));
1821 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.velocity.x));
1822 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.velocity.y));
1823 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.velocity.z));
1824
1825 vectorcxx . . $ vector# r1 = *collision_point -cxx . . $ operator-(b77b703cd1e43e33). object0->poscxx . . $ object#pos.;
1826 vectorcxx . . $ vector# r2 = *collision_point -cxx . . $ operator-(b77b703cd1e43e33). object1->poscxx . . $ object#pos.;
1827 vectorcxx . . $ vector# w1;
1828 vectorcxx . . $ vector# w2;
1829 vectorcxx . . $ vector# n1;
1830 vectorcxx . . $ vector# n2;
1831 float temp1;
1832 float temp2;
1833
1834 float j;
1835
1836 matrixcxx . . $ matrix# o_t1 = object0->orientcxx . . $ object#orient.;
1837 matrixcxx . . $ matrix# o_t2 = object1->orientcxx . . $ object#orient.;
1838
1839 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&o_t1);
1840 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&o_t2);
1841
1842 vectorcxx . . $ vector# cmp1 = object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). o_t1;
1843 vectorcxx . . $ vector# cmp2 = object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). o_t2;
1844
1845 ConvertEulerToAxisAmountcxx . . $ ConvertEulerToAxisAmount(1430ddb085312116).(&cmp1, &n1, &temp1);
1846 ConvertEulerToAxisAmountcxx . . $ ConvertEulerToAxisAmount(1430ddb085312116).(&cmp2, &n2, &temp2);
1847
1848 n1 *=cxx . . $ `operator*=`(f132838b2cd11d6). temp1;
1849 n2 *=cxx . . $ `operator*=`(f132838b2cd11d6). temp2;
1850
1851 if (temp1 != 0.0f) {
1852 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&w1, &n1, &r1);
1853 } else {
1854 w1 =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1855 }
1856
1857 if (temp2 != 0.0f) {
1858 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&w2, &n2, &r2);
1859 } else {
1860 w2 =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1861 }
1862
1863 vectorcxx . . $ vector# p1 = object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +cxx . . $ operator+(b77b703cd1e43e33). w1;
1864 vectorcxx . . $ vector# p2 = object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +cxx . . $ operator+(b77b703cd1e43e33). w2;
1865 float v_rel;
1866
1867 float m1 = object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.;
1868 float m2 = object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.;
1869
1870 bool f_force_1 = IsOKToApplyForcecxx . . $ IsOKToApplyForce(39516aeee13ca5ab).(object0);
1871 bool f_force_2 = IsOKToApplyForcecxx . . $ IsOKToApplyForce(39516aeee13ca5ab).(object1);
1872
1873 ASSERTcxx . . $ `misc/pserror.h:246:9`!(m1 != 0.0f && m2 != 0.0f);
1874 if (m1 <= 0.0f)
1875 m1 = 0.00000001f;
1876 if (m2 <= 0.0f)
1877 m2 = 0.00000001f;
1878
1879 v_rel = *collision_normal *cxx . . $ `operator*`(4a721543d64e126a). (p1 -cxx . . $ operator-(b77b703cd1e43e33). p2);
1880
1881 float e;
1882
1883 if (object0->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && object1->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1884 e = 0.015f;
1885 else if ((object0->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! || object1->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) &&
1886 (object0->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && object1->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!))
1887 e = 1.0f;
1888 else if ((object0->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! && object1->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) ||
1889 (object0->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && object1->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!))
1890 e = 0.5f;
1891 else
1892 e = 0.1f;
1893
1894 vectorcxx . . $ vector# c1;
1895 vectorcxx . . $ vector# c2;
1896 vectorcxx . . $ vector# cc1;
1897 vectorcxx . . $ vector# cc2;
1898 float cv1;
1899 float cv2;
1900
1901 // matrix i1;
1902 // matrix i2;
1903 float i1 = (2.0f / 5.0f) * m1 * object0->sizecxx . . $ object#size. * object0->sizecxx . . $ object#size.;
1904 float i2 = (2.0f / 5.0f) * m2 * object1->sizecxx . . $ object#size. * object1->sizecxx . . $ object#size.;
1905
1906 if (i1 < .0000001)
1907 i1 = .0000001f;
1908 if (i2 < .0000001)
1909 i2 = .0000001f;
1910
1911 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&c1, &r1, collision_normal);
1912 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&c2, &r2, collision_normal);
1913
1914 c1 =cxx . . $ vector#`operator=`(c0842353a20857d). c1 /cxx . . $ `operator/`(252247219a31502c). i1;
1915 c2 =cxx . . $ vector#`operator=`(c0842353a20857d). c2 /cxx . . $ `operator/`(252247219a31502c). i2;
1916
1917 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&cc1, &c1, &r1);
1918 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&cc2, &c2, &r2);
1919
1920 cv1 = (*collision_normal) *cxx . . $ `operator*`(4a721543d64e126a). c1;
1921 cv2 = (*collision_normal) *cxx . . $ `operator*`(4a721543d64e126a). c2;
1922
1923 j = (-(1.0f + e)) * v_rel;
1924 j /= (1 / m1 + 1 / m2 + cv1 + cv2);
1925
1926 if (f_force_1)
1927 object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). ((j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal)) /cxx . . $ `operator/`(252247219a31502c). m1);
1928
1929 if (f_force_2)
1930 object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). ((j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal)) /cxx . . $ `operator/`(252247219a31502c). m2);
1931
1932 vectorcxx . . $ vector# jcn = j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal);
1933
1934 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&c1, &r1, &jcn);
1935 vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&c2, &r2, &jcn);
1936
1937 n1 =cxx . . $ vector#`operator=`(c0842353a20857d). (c1) /cxx . . $ `operator/`(252247219a31502c). i1;
1938 n2 =cxx . . $ vector#`operator=`(c0842353a20857d). (c2) /cxx . . $ `operator/`(252247219a31502c). i2;
1939
1940 temp1 = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&n1);
1941 temp2 = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&n2);
1942
1943 vectorcxx . . $ vector# txx1;
1944 vectorcxx . . $ vector# txx2;
1945
1946 ConvertAxisAmountToEulercxx . . $ ConvertAxisAmountToEuler(541fdd6f774327be).(&n1, &temp1, &txx1);
1947 ConvertAxisAmountToEulercxx . . $ ConvertAxisAmountToEuler(541fdd6f774327be).(&n2, &temp2, &txx2);
1948
1949 float rotscale1, rotscale2;
1950
1951 if (object0->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1952 rotscale1 = PLAYER_ROTATION_BY_FORCE_SCALARcxx . . $ `physics/collide.cpp:863:9`!;
1953 else
1954 rotscale1 = NONPLAYER_ROTATION_BY_FORCE_SCALARcxx . . $ `physics/collide.cpp:864:9`!;
1955
1956 if (object1->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
1957 rotscale2 = PLAYER_ROTATION_BY_FORCE_SCALARcxx . . $ `physics/collide.cpp:863:9`!;
1958 else
1959 rotscale2 = NONPLAYER_ROTATION_BY_FORCE_SCALARcxx . . $ `physics/collide.cpp:864:9`!;
1960
1961 if (f_force_1)
1962 object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (txx1 *cxx . . $ `operator*`(14b8f9ac5c1e7b85). object0->orientcxx . . $ object#orient.) *cxx . . $ `operator*`(252247219a31502c). rotscale1;
1963
1964 if (f_force_2)
1965 object1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (txx2 *cxx . . $ `operator*`(14b8f9ac5c1e7b85). object1->orientcxx . . $ object#orient.) *cxx . . $ `operator*`(252247219a31502c). rotscale2;
1966
1967 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.rotvel.x));
1968 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.rotvel.y));
1969 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.rotvel.z));
1970 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.rotvel.x));
1971 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.rotvel.y));
1972 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.rotvel.z));
1973 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.velocity.x));
1974 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.velocity.y));
1975 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object1->mtype.phys_info.velocity.z));
1976 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.velocity.x));
1977 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.velocity.y));
1978 ASSERTcxx . . $ `misc/pserror.h:246:9`!(std::isfinite(object0->mtype.phys_info.velocity.z));
1979
1980 // Do ForceFeedback stuff for moving objects
1981 //-----------------------------------------
1982 if (ForceIsEnabledcxx . . $ ForceIsEnabled(c9857a73d68e59ba).()) {
1983
1984 if (object0->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && object0->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.) {
1985 // v is the force vector
1986 vectorcxx . . $ vector# v;
1987 v =cxx . . $ vector#`operator=`(c0842353a20857d). -1.0f * v_rel *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal);
1988
1989 // Was it weapon->player collide
1990 switch (object1->typecxx . . $ object#type.) {
1991 case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!:
1992 // Do force effect for player/weapon collision
1993 DoForceForWeaponcxx . . $ DoForceForWeapon(a24d58fc7aeaec6).(object0, object1, &v);
1994 break;
1995 default:
1996 break;
1997 }
1998 }
1999 }
2000
2001 // Catch things on fire if possible
2002 if (object0->effect_infocxx . . $ object#effect_info. && object1->effect_infocxx . . $ object#effect_info.) {
2003 // One of these objects must be burning
2004 if ((object0->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!) || (object1->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!)) {
2005 // Both cannot be burning
2006 if (!(object0->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!) || !(object1->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!)) {
2007 objectcxx . . $ object# *src_obj, *dest_obj;
2008 if (object0->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!) {
2009 src_obj = object0;
2010 dest_obj = object1;
2011 } else {
2012 src_obj = object1;
2013 dest_obj = object0;
2014 }
2015
2016 dest_obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!;
2017
2018 dest_obj->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0f, src_obj->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. / 3.0f);
2019 dest_obj->effect_infocxx . . $ object#effect_info.->damage_per_secondcxx . . $ effect_info_s#damage_per_second. = src_obj->effect_infocxx . . $ object#effect_info.->damage_per_secondcxx . . $ effect_info_s#damage_per_second.;
2020
2021 // We need this cap (as the gb burns forever
2022 if (dest_obj->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. > 10.0f) {
2023 dest_obj->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. = 10.0f;
2024 }
2025
2026 dest_obj->effect_infocxx . . $ object#effect_info.->last_damage_timecxx . . $ effect_info_s#last_damage_time. = 0;
2027
2028 dest_obj->effect_infocxx . . $ object#effect_info.->damage_handlecxx . . $ effect_info_s#damage_handle. = src_obj->handlecxx . . $ object#handle.;
2029
2030 if (dest_obj->effect_infocxx . . $ object#effect_info.->sound_handlecxx . . $ effect_info_s#sound_handle. == SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
2031 dest_obj->effect_infocxx . . $ object#effect_info.->sound_handlecxx . . $ effect_info_s#sound_handle. =
2032 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_PLAYER_BURNINGcxx . . $ `Descent3/sounds.h:134:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, dest_obj);
2033 }
2034 }
2035 }
2036 }
2037
2038 void collide_player_and_playercxx . . $ collide_player_and_player(ba4cc96b4b366922).(objectcxx . . $ object# *p1, objectcxx . . $ object# *p2, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
2039 bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info) {
2040 if (f_reverse_normal)
2041 *collision_normal *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
2042
2043 vectorcxx . . $ vector# rvel = p1->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. -cxx . . $ operator-(b77b703cd1e43e33). p2->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
2044 float speed = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&rvel);
2045 float scalar;
2046
2047 if (speed <= MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) {
2048 scalar = 0.0f;
2049 } else if (speed >= MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`!) {
2050 scalar = 1.0f;
2051 } else {
2052 scalar = (speed - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) / (MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`! - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!);
2053 }
2054
2055 if (scalar > .01) {
2056 pos_statecxx . . $ pos_state# cur_pos;
2057 cur_pos.positioncxx . . $ pos_state#position. = collision_point;
2058 cur_pos.orientcxx . . $ pos_state#orient. = &p1->orientcxx . . $ object#orient.;
2059 cur_pos.roomnumcxx . . $ pos_state#roomnum. = p1->roomnumcxx . . $ object#roomnum.;
2060
2061 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(cbd2c6aa1db9fc8a).(SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, &cur_pos, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! * scalar);
2062 }
2063
2064 bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(p1, p2, collision_point, collision_normal, 1);
2065 }
2066
2067 void collide_generic_and_playercxx . . $ collide_generic_and_player(ba4cc96b4b366922).(objectcxx . . $ object# *robotobj, objectcxx . . $ object# *playerobj, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
2068 bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info) {
2069 if (f_reverse_normal)
2070 *collision_normal *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
2071
2072 vectorcxx . . $ vector# rvel;
2073 if (robotobj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || robotobj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) {
2074 rvel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). robotobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
2075 } else {
2076 rvel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
2077 }
2078 rvel -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). playerobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.;
2079 float speed = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&rvel);
2080 float scalar;
2081
2082 if (speed <= MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) {
2083 scalar = 0.0f;
2084 } else if (speed >= MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`!) {
2085 scalar = 1.0f;
2086 } else {
2087 scalar = (speed - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!) / (MAX_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1274:9`! - MIN_WALL_HIT_SOUND_VELcxx . . $ `physics/collide.cpp:1273:9`!);
2088 }
2089
2090 // Check for lava surface on an object
2091 if ((robotobj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) && hit_info) {
2092 poly_modelcxx . . $ poly_model# *pm = GetPolymodelPointercxx . . $ GetPolymodelPointer(ac85e77c73ebf794).(robotobj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.);
2093 int tmap = pm->texturescxx . . $ poly_model#textures.[pm->submodelcxx . . $ poly_model#submodel.[hit_info->hit_subobjectcxx . . $ fvi_info#hit_subobject.[0]].facescxx . . $ bsp_info#faces.[hit_info->hit_facecxx . . $ fvi_info#hit_face.[0]].texnumcxx . . $ polyface#texnum.];
2094
2095 if (GameTexturescxx . . $ GameTextures.[tmap].flagscxx . . $ texture#flags. & TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!) {
2096 if (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) {
2097 int id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("NapalmBlob");
2098 if (id >= 0)
2099 SetNapalmDamageEffectcxx . . $ SetNapalmDamageEffect(6964148eab73f28a).(playerobj, nullptr, id);
2100 else
2101 Int3cxx . . $ `misc/pserror.h:247:9`!();
2102 }
2103 scalar = 0; // don't make collide sound
2104 }
2105 }
2106
2107 if (scalar > .01 || (robotobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!)) {
2108 pos_statecxx . . $ pos_state# cur_pos;
2109 cur_pos.positioncxx . . $ pos_state#position. = collision_point;
2110 cur_pos.orientcxx . . $ pos_state#orient. = &playerobj->orientcxx . . $ object#orient.;
2111 cur_pos.roomnumcxx . . $ pos_state#roomnum. = playerobj->roomnumcxx . . $ object#roomnum.;
2112
2113 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(cbd2c6aa1db9fc8a).(SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, &cur_pos, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! * scalar);
2114
2115 ain_hearcxx . . $ ain_hear# hear;
2116 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = true;
2117 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.10f;
2118 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.5f;
2119 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_PLAYER_HIT_WALLcxx . . $ `Descent3/sounds.h:120:9`!].max_distancecxx . . $ sound_info#max_distance. * scalar;
2120 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(playerobj, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
2121
2122 if ((scalar > .25f && (robotobj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! || robotobj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!)) ||
2123 ((robotobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!) &&
2124 (robotobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!))) {
2125 if (!(IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(robotobj))) {
2126 if (robotobj->shieldscxx . . $ object#shields. <= 1.0f) {
2127 ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(robotobj, playerobj, GD_PHYSICScxx . . $ `Descent3/damage_external.h:38:9`!, 2.0f);
2128 } else {
2129 ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(robotobj, playerobj, GD_PHYSICScxx . . $ `Descent3/damage_external.h:38:9`!, 5.0f * Frametimecxx . . $ Frametime. * scalar);
2130 }
2131 if (scalar < 1.0f && (robotobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!) &&
2132 (robotobj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!))
2133 scalar = 1.0f;
2134
2135 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(playerobj, playerobj, PD_WALL_HITcxx . . $ `Descent3/damage_external.h:28:9`!, 2.0f * Frametimecxx . . $ Frametime. * scalar);
2136 }
2137 }
2138 }
2139
2140 if (robotobj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) {
2141 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(robotobj, AIN_BUMPED_OBJcxx . . $ `Descent3/aistruct_external.h:307:9`!, (void *)playerobj);
2142 }
2143
2144 bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(robotobj, playerobj, collision_point, collision_normal, 1);
2145 }
2146
2147 void MakeWeaponStickcxx . . $ MakeWeaponStick(2592bea16b35063f).(objectcxx . . $ object# *weapon, objectcxx . . $ object# *parent, fvi_infocxx . . $ fvi_info# *hit_info) {
2148 weapon->mtypecxx . . $ object#mtype..obj_link_infocxx . . $ object#$anonymous_type_8#obj_link_info..parent_handlecxx . . $ object_link_info#parent_handle. = parent->handlecxx . . $ object#handle.;
2149 weapon->mtypecxx . . $ object#mtype..obj_link_infocxx . . $ object#$anonymous_type_8#obj_link_info..fveccxx . . $ object_link_info#fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info->hit_subobj_fveccxx . . $ fvi_info#hit_subobj_fvec.;
2150 weapon->mtypecxx . . $ object#mtype..obj_link_infocxx . . $ object#$anonymous_type_8#obj_link_info..uveccxx . . $ object_link_info#uvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info->hit_subobj_uveccxx . . $ fvi_info#hit_subobj_uvec.;
2151 weapon->mtypecxx . . $ object#mtype..obj_link_infocxx . . $ object#$anonymous_type_8#obj_link_info..poscxx . . $ object_link_info#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_info->hit_subobj_poscxx . . $ fvi_info#hit_subobj_pos.;
2152 weapon->mtypecxx . . $ object#mtype..obj_link_infocxx . . $ object#$anonymous_type_8#obj_link_info..sobj_indexcxx . . $ object_link_info#sobj_index. = hit_info->hit_subobjectcxx . . $ fvi_info#hit_subobject.[0];
2153 weapon->movement_typecxx . . $ object#movement_type. = MT_OBJ_LINKEDcxx . . $ `Descent3/object_external.h:242:9`!;
2154 }
2155
2156 void collide_generic_and_weaponcxx . . $ collide_generic_and_weapon(ba4cc96b4b366922).(objectcxx . . $ object# *robotobj, objectcxx . . $ object# *weapon, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
2157 bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info) {
2158 objectcxx . . $ object# *parent_obj;
2159 float damage_to_apply;
2160 uint8_tcxx . . $ uint8_t# electrical = (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_ELECTRICALcxx . . $ `Descent3/weapon.h:222:9`!) ? 1 : 0;
2161 bool f_stick = ((weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_STICKcxx . . $ `Descent3/object_external.h:317:9`!) != 0);
2162 bool f_energy = ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_MATTER_WEAPONcxx . . $ `Descent3/weapon.h:221:9`!) == 0);
2163 int damage_type;
2164
2165 // Check for lava & volatile surfaces on an object
2166 if ((robotobj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) && hit_info) {
2167 poly_modelcxx . . $ poly_model# *pm = GetPolymodelPointercxx . . $ GetPolymodelPointer(ac85e77c73ebf794).(robotobj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.);
2168 int tmap = pm->texturescxx . . $ poly_model#textures.[pm->submodelcxx . . $ poly_model#submodel.[hit_info->hit_subobjectcxx . . $ fvi_info#hit_subobject.[0]].facescxx . . $ bsp_info#faces.[hit_info->hit_facecxx . . $ fvi_info#hit_face.[0]].texnumcxx . . $ polyface#texnum.];
2169 vectorcxx . . $ vector# *normal = &hit_info->hit_wallnormcxx . . $ fvi_info#hit_wallnorm.[0];
2170
2171 DoWallEffectscxx . . $ DoWallEffects(766a1b7183ffa4b4).(weapon, tmap);
2172
2173 check_for_special_surfacecxx . . $ check_for_special_surface(a35642c99d329708).(weapon, tmap, normal, 1.0);
2174
2175 // If object died, stop processing
2176 if (weapon->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)
2177 return;
2178 }
2179
2180 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_NAPALMcxx . . $ `Descent3/weapon.h:238:9`!)
2181 damage_type = GD_FIREcxx . . $ `Descent3/damage_external.h:35:9`!;
2182 else if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_MATTER_WEAPONcxx . . $ `Descent3/weapon.h:221:9`!)
2183 damage_type = GD_MATTERcxx . . $ `Descent3/damage_external.h:36:9`!;
2184 else if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_ELECTRICALcxx . . $ `Descent3/weapon.h:222:9`!)
2185 damage_type = GD_ELECTRICcxx . . $ `Descent3/damage_external.h:33:9`!;
2186 else
2187 damage_type = GD_ENERGYcxx . . $ `Descent3/damage_external.h:37:9`!;
2188
2189 if (f_reverse_normal)
2190 *collision_normal *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
2191
2192 if (robotobj->flagscxx . . $ object#flags. & OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!)
2193 robotobj->ctypecxx . . $ object#ctype..dying_infocxx . . $ object#$anonymous_type_9#dying_info..delay_timecxx . . $ dying_info_s#delay_time. *= 0.975f;
2194
2195 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2196 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!], SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, weapon);
2197
2198 ain_hearcxx . . $ ain_hear# hear;
2199 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = false;
2200 if (robotobj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) {
2201 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 1.0f;
2202 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.1f;
2203 } else if (robotobj->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) {
2204 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.5f;
2205 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 1.0f;
2206 } else {
2207 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = .9f;
2208 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.5f;
2209 }
2210
2211 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_WALLcxx . . $ `Descent3/weapon.h:263:9`!]].max_distancecxx . . $ sound_info#max_distance.;
2212 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(weapon, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
2213 }
2214
2215 // Do weapon explosion stuff
2216 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(weapon, collision_normal, collision_point);
2217
2218 // Check to see if we should spawn
2219 if (robotobj->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`! && !(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2220 if ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SPAWNS_IMPACTcxx . . $ `Descent3/weapon.h:233:9`!) && Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].spawn_countcxx . . $ weapon#spawn_count. > 0 &&
2221 Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].spawn_handlecxx . . $ weapon#spawn_handle. >= 0)
2222 CreateImpactSpawnFromWeaponcxx . . $ CreateImpactSpawnFromWeapon(835e87111e401cce).(weapon, collision_normal);
2223 }
2224
2225 if ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SPAWNS_ROBOTcxx . . $ `Descent3/weapon.h:242:9`!) && (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_COUNTERMEASUREcxx . . $ `Descent3/weapon.h:241:9`!) &&
2226 Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].robot_spawn_handlecxx . . $ weapon#robot_spawn_handle. >= 0)
2227 CreateRobotSpawnFromWeaponcxx . . $ CreateRobotSpawnFromWeapon(419c470199a90a97).(weapon);
2228
2229 parent_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(weapon->parent_handlecxx . . $ object#parent_handle.);
2230
2231 if ((parent_obj) && (parent_obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!)) {
2232 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(parent_obj, AIN_WHIT_OBJECTcxx . . $ `Descent3/aistruct_external.h:291:9`!, (void *)robotobj);
2233 }
2234
2235 if (robotobj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) {
2236 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(robotobj, AIN_HIT_BY_WEAPONcxx . . $ `Descent3/aistruct_external.h:299:9`!, (void *)weapon);
2237 }
2238
2239 if (electrical) {
2240 damage_to_apply = Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].generic_damagecxx . . $ weapon#generic_damage. * Frametimecxx . . $ Frametime.;
2241 } else
2242 damage_to_apply = Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].generic_damagecxx . . $ weapon#generic_damage.;
2243
2244 // Factor in multiplier
2245 damage_to_apply *= weapon->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..multipliercxx . . $ laser_info_s#multiplier.;
2246
2247 if (ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(robotobj, weapon, damage_type, damage_to_apply)) {
2248 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_ROBOTcxx . . $ `Descent3/weapon.h:265:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2249 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_ROBOTcxx . . $ `Descent3/weapon.h:265:9`!], SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, weapon);
2250 }
2251 if (!electrical) {
2252 light_infocxx . . $ light_info# *li = &Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info.;
2253 uint16_tcxx . . $ uint16_t# color = 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);
2254 CreateRandomLineSparkscxx . . $ CreateRandomLineSparks(79b173f5af69382).(3 + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 6, &weapon->poscxx . . $ object#pos., weapon->roomnumcxx . . $ object#roomnum., color);
2255 }
2256 }
2257 #if 0
2258 if(Demo_flags == DF_RECORDING)
2259 {
2260 DemoWriteCollideGenericWeapon( robotobj, weapon, collision_point, collision_normal, f_reverse_normal, hit_info );
2261 }
2262 else if(Demo_flags == DF_PLAYBACK)
2263 {
2264 //During playback we don't need the code below (actually it won't work)
2265 return;
2266 }
2267 #endif
2268
2269 if (!electrical) {
2270
2271 bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(robotobj, weapon, collision_point, collision_normal, 0);
2272
2273 if (!f_stick || (hit_info == nullptr)) {
2274 if ((robotobj->lighting_render_typecxx . . $ object#lighting_render_type. == LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) || !(weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_PERSISTENTcxx . . $ `Descent3/object_external.h:318:9`!))
2275 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(weapon);
2276 } else {
2277 MakeWeaponStickcxx . . $ MakeWeaponStick(2592bea16b35063f).(weapon, robotobj, hit_info);
2278 }
2279 }
2280 }
2281
2282 void collide_player_and_weaponcxx . . $ collide_player_and_weapon(ba4cc96b4b366922).(objectcxx . . $ object# *playerobj, objectcxx . . $ object# *weapon, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal,
2283 bool f_reverse_normal, fvi_infocxx . . $ fvi_info# *hit_info) {
2284 objectcxx . . $ object# *parent_obj;
2285 float damage_to_apply;
2286 uint8_tcxx . . $ uint8_t# electrical = Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_ELECTRICALcxx . . $ `Descent3/weapon.h:222:9`! ? 1 : 0;
2287 bool f_stick = ((weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_STICKcxx . . $ `Descent3/object_external.h:317:9`!) != 0);
2288
2289 if (f_reverse_normal)
2290 *collision_normal *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f;
2291
2292 parent_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(weapon->parent_handlecxx . . $ object#parent_handle.);
2293
2294 if ((parent_obj) && (parent_obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!)) {
2295 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(parent_obj, AIN_WHIT_OBJECTcxx . . $ `Descent3/aistruct_external.h:291:9`!, (void *)playerobj);
2296 }
2297
2298 // Do weapon explosion stuff
2299 DoWeaponExplodedcxx . . $ DoWeaponExploded(7abc5162509c28d6).(weapon, collision_normal, collision_point, playerobj);
2300
2301 // Check to see if we should spawn
2302 /*if ((Weapons[weapon->id].flags & WF_SPAWNS_IMPACT) && Weapons[weapon->id].spawn_count>0 &&
2303 Weapons[weapon->id].spawn_handle>=0) CreateImpactSpawnFromWeapon (weapon,collision_normal);*/
2304
2305 if ((Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_SPAWNS_ROBOTcxx . . $ `Descent3/weapon.h:242:9`!) && (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_COUNTERMEASUREcxx . . $ `Descent3/weapon.h:241:9`!) &&
2306 Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].robot_spawn_handlecxx . . $ weapon#robot_spawn_handle. >= 0)
2307 CreateRobotSpawnFromWeaponcxx . . $ CreateRobotSpawnFromWeapon(419c470199a90a97).(weapon);
2308
2309 if (electrical)
2310 damage_to_apply = Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].player_damagecxx . . $ weapon#player_damage. * Frametimecxx . . $ Frametime.;
2311 else
2312 damage_to_apply = Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].player_damagecxx . . $ weapon#player_damage.;
2313
2314 // Factor in multiplier
2315 damage_to_apply *= weapon->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..multipliercxx . . $ laser_info_s#multiplier.;
2316
2317 int damage_type = electrical ? PD_ENERGY_WEAPONcxx . . $ `Descent3/damage_external.h:24:9`! : PD_MATTER_WEAPONcxx . . $ `Descent3/damage_external.h:25:9`!;
2318
2319 if (ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(playerobj, weapon, damage_type, damage_to_apply)) {
2320 // we were damaged!
2321 if (Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_ROBOTcxx . . $ `Descent3/weapon.h:265:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
2322 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(Weaponscxx . . $ Weapons.[weapon->idcxx . . $ object#id.].soundscxx . . $ weapon#sounds.[WSI_IMPACT_ROBOTcxx . . $ `Descent3/weapon.h:265:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, weapon);
2323 }
2324 #if 0
2325 if(Demo_flags == DF_RECORDING)
2326 {
2327 DemoWriteCollidePlayerWeapon( playerobj, weapon, collision_point, collision_normal, f_reverse_normal, hit_info );
2328 }
2329 else if(Demo_flags == DF_PLAYBACK)
2330 {
2331 //During playback we don't need the code below (actually it won't work)
2332 return;
2333 }
2334 #endif
2335
2336 if (!electrical) {
2337 bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(playerobj, weapon, collision_point, collision_normal, 0);
2338
2339 if (!f_stick || (hit_info == nullptr)) {
2340 if (!(weapon->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_PERSISTENTcxx . . $ `Descent3/object_external.h:318:9`!))
2341 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(weapon);
2342 } else {
2343 MakeWeaponStickcxx . . $ MakeWeaponStick(2592bea16b35063f).(weapon, playerobj, hit_info);
2344 }
2345 }
2346 }
2347
2348 #define COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!(a, b) (((a) << 8) + (b))
2349
2350 #define DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(type1, type2, collision_function) \
2351 case COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!((type1), (type2)): \
2352 (collision_function)((A), (B), collision_point, collision_normal, false, hit_info); \
2353 break; \
2354 case COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!((type2), (type1)): \
2355 (collision_function)((B), (A), collision_point, collision_normal, true, hit_info); \
2356 break;
2357
2358 #define DO_SAME_COLLISIONcxx . . $ `physics/collide.cpp:2358:9`!(type1, type2, collision_function) \
2359 case COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!((type1), (type1)): \
2360 (collision_function)((A), (B), collision_point, collision_normal, false, hit_info); \
2361 break;
2362
2363 #define NO_COLLISIONcxx . . $ `physics/collide.cpp:2363:9`!(type1, type2) \
2364 case COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!((type1), (type2)): \
2365 case COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!((type2), (type1)): \
2366 break;
2367
2368 void check_lg_informcxx . . $ check_lg_inform(6273fa812ac58a8).(objectcxx . . $ object# *A, objectcxx . . $ object# *B) {
2369 if (A->flagscxx . . $ object#flags. & (OF_INFORM_PLAYER_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:300:9`! | OF_INFORM_PLAYER_WEAPON_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:301:9`!)) {
2370 if (B->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2371 bool f_pwc = (A->flagscxx . . $ object#flags. & OF_INFORM_PLAYER_WEAPON_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:301:9`!) != 0;
2372 int type;
2373
2374 if (f_pwc) {
2375 type = OF_INFORM_PLAYER_WEAPON_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:301:9`!;
2376 } else {
2377 type = OF_INFORM_PLAYER_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:300:9`!;
2378 }
2379
2380 Level_goalscxx . . $ Level_goals..Informcxx . . $ levelgoals#Inform(8589f1c7c2d24df6).(LIT_OBJECTcxx . . $ `Descent3/levelgoal_external.h:28:9`!, type, A->handlecxx . . $ object#handle.);
2381 }
2382 }
2383
2384 if (A->flagscxx . . $ object#flags. & OF_INFORM_PLAYER_WEAPON_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:301:9`!) {
2385 if (B->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) {
2386 objectcxx . . $ object# *parent = ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(B);
2387
2388 if (parent && parent->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2389 Level_goalscxx . . $ Level_goals..Informcxx . . $ levelgoals#Inform(8589f1c7c2d24df6).(LIT_OBJECTcxx . . $ `Descent3/levelgoal_external.h:28:9`!, OF_INFORM_PLAYER_WEAPON_COLLIDE_TO_LGcxx . . $ `Descent3/object_external.h:301:9`!, A->handlecxx . . $ object#handle.);
2390 }
2391 }
2392 }
2393 }
2394
2395 void collide_two_objectscxx . . $ collide_two_objects(d2b59d3704ffac80).(objectcxx . . $ object# *A, objectcxx . . $ object# *B, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal, fvi_infocxx . . $ fvi_info# *hit_info) {
2396 int collision_type;
2397 int a_num = A - Objectscxx . . $ Objects.;
2398 int b_num = B - Objectscxx . . $ Objects.;
2399 uint8_tcxx . . $ uint8_t# a_good = 0, b_good = 0;
2400 uint8_tcxx . . $ uint8_t# a_hittime_good = 1, b_hittime_good = 1;
2401
2402 // Only do omega particle collisions if specifically allowed
2403 extern bool Enable_omega_collionscxx . . $ Enable_omega_collions.;
2404 if (((A->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && (A->idcxx . . $ object#id. == OMEGA_INDEXcxx . . $ `Descent3/weapon_external.h:31:9`!)) || ((B->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && (B->idcxx . . $ object#id. == OMEGA_INDEXcxx . . $ `Descent3/weapon_external.h:31:9`!)))
2405 if (!Enable_omega_collionscxx . . $ Enable_omega_collions.)
2406 return;
2407
2408 ASSERTcxx . . $ `misc/pserror.h:246:9`!(CollisionResult[A->type][B->type] != RESULT_NOTHINGcxx . . $ `physics/collide.h:112:9`!);
2409
2410 collision_type = COLLISION_OFcxx . . $ `physics/collide.cpp:2348:9`!(A->type, B->type);
2411
2412 check_lg_informcxx . . $ check_lg_inform(6273fa812ac58a8).(A, B);
2413 check_lg_informcxx . . $ check_lg_inform(6273fa812ac58a8).(B, A);
2414
2415 // mprintf( (0, "Object %d of type %d collided with object %d of type %d\n", A-Objects,A->type, B-Objects, B->type ));
2416
2417 // COLLISION SCRIPT HOOK
2418 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
2419 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(A->flags & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!));
2420 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(B->flags & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!));
2421
2422 // Make sure we have good scripts to call
2423 if (A->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || A->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || A->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || A->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! ||
2424 A->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! || A->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`! || A->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!)
2425 a_good = 1;
2426 if (B->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || B->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || B->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || B->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! ||
2427 B->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! || B->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`! || B->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!)
2428 b_good = 1;
2429
2430 if (A->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[A->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)))
2431 a_good = 0;
2432 if (B->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[B->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)))
2433 b_good = 0;
2434
2435 if (A->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && A->effect_infocxx . . $ object#effect_info.->last_object_hitcxx . . $ effect_info_s#last_object_hit. == b_num &&
2436 (Gametimecxx . . $ Gametime. - A->effect_infocxx . . $ object#effect_info.->last_object_hit_timecxx . . $ effect_info_s#last_object_hit_time.) < 1) {
2437 a_good = 0;
2438 a_hittime_good = 0;
2439 }
2440
2441 if (B->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && B->effect_infocxx . . $ object#effect_info.->last_object_hitcxx . . $ effect_info_s#last_object_hit. == a_num &&
2442 (Gametimecxx . . $ Gametime. - B->effect_infocxx . . $ object#effect_info.->last_object_hit_timecxx . . $ effect_info_s#last_object_hit_time.) < 1) {
2443 b_good = 0;
2444 b_hittime_good = 0;
2445 }
2446
2447 if (a_good && b_good) {
2448 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = A->handlecxx . . $ object#handle.;
2449 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = B->handlecxx . . $ object#handle.;
2450 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..xcxx . . $ vector#x. = collision_point->xcxx . . $ vector#x.;
2451 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..ycxx . . $ vector#y. = collision_point->ycxx . . $ vector#y.;
2452 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..zcxx . . $ vector#z. = collision_point->zcxx . . $ vector#z.;
2453 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..xcxx . . $ vector#x. = collision_normal->xcxx . . $ vector#x.;
2454 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..ycxx . . $ vector#y. = collision_normal->ycxx . . $ vector#y.;
2455 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..zcxx . . $ vector#z. = collision_normal->zcxx . . $ vector#z.;
2456 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMECOLLIDEcxx . . $ `lib/d3events.h:67:9`!, &DLLInfocxx . . $ DLLInfo.);
2457
2458 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = B->handlecxx . . $ object#handle.;
2459 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = A->handlecxx . . $ object#handle.;
2460 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMECOLLIDEcxx . . $ `lib/d3events.h:67:9`!, &DLLInfocxx . . $ DLLInfo.);
2461
2462 // Update static variables
2463 if (A->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) {
2464 A->effect_infocxx . . $ object#effect_info.->last_object_hitcxx . . $ effect_info_s#last_object_hit. = b_num;
2465 A->effect_infocxx . . $ object#effect_info.->last_object_hit_timecxx . . $ effect_info_s#last_object_hit_time. = Gametimecxx . . $ Gametime.;
2466 }
2467 if (B->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) {
2468 B->effect_infocxx . . $ object#effect_info.->last_object_hitcxx . . $ effect_info_s#last_object_hit. = a_num;
2469 B->effect_infocxx . . $ object#effect_info.->last_object_hit_timecxx . . $ effect_info_s#last_object_hit_time. = Gametimecxx . . $ Gametime.;
2470 }
2471 }
2472 }
2473
2474 // Call script only if its ok to
2475 int ok_to_call_script = 1;
2476 if (A->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[A->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)))
2477 ok_to_call_script = 0;
2478 if (B->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[B->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)))
2479 ok_to_call_script = 0;
2480
2481 // Check to see if we should call the script
2482 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2483 if ((A->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || B->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) && (a_hittime_good == 0 || b_hittime_good == 0))
2484 ok_to_call_script = 0;
2485 }
2486
2487 if (ok_to_call_script) {
2488
2489 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2490 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(A->flags & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!));
2491 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(B->flags & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!));
2492 }
2493 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
2494 ei.evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle. = B->handlecxx . . $ object#handle.;
2495 Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(A, EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!, &ei);
2496
2497 ei.evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle. = A->handlecxx . . $ object#handle.;
2498 Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(B, EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!, &ei);
2499 }
2500
2501 switch (collision_type) {
2502 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, collide_player_and_weapon)
2503 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`!, collide_player_and_marker)
2504
2505 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, collide_generic_and_player)
2506 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, collide_generic_and_player)
2507 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, collide_generic_and_player)
2508 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!, OBJ_VIEWERcxx . . $ `Descent3/object_external.h:166:9`!, collide_generic_and_player)
2509 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, collide_generic_and_player)
2510 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, collide_generic_and_player)
2511
2512 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, collide_generic_and_weapon)
2513 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, collide_generic_and_weapon)
2514 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, collide_generic_and_weapon)
2515 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, collide_generic_and_weapon)
2516 DO_COLLISIONcxx . . $ `physics/collide.cpp:2350:9`!(OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, collide_generic_and_weapon)
2517
2518 DO_SAME_COLLISIONcxx . . $ `physics/collide.cpp:2358:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_PLAYER, collide_player_and_player)
2519
2520 // Handled by the script, so no code
2521 NO_COLLISIONcxx . . $ `physics/collide.cpp:2363:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)
2522 NO_COLLISIONcxx . . $ `physics/collide.cpp:2363:9`!(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)
2523
2524 default:
2525 bump_two_objectscxx . . $ bump_two_objects(d38ed2f1e91fd234).(A, B, collision_point, collision_normal, 1);
2526 }
2527
2528 if ((A->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && B->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && (B->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)) ||
2529 (B->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && A->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && (A->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!))) {
2530 ain_hearcxx . . $ ain_hear# hear;
2531 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = true;
2532 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.05f;
2533 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 1.0f;
2534
2535 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_POWERUP_PICKUPcxx . . $ `Descent3/sounds.h:116:9`!].max_distancecxx . . $ sound_info#max_distance.;
2536 if (A->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
2537 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(A, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
2538 else
2539 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(B, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
2540 }
2541 }
2542
2543 #define ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(type1, type2) \
2544 CollisionResult[type1][type2] = RESULT_CHECK_SPHERE_SPHEREcxx . . $ `physics/collide.h:113:9`!; \
2545 CollisionResult[type2][type1] = RESULT_CHECK_SPHERE_SPHEREcxx . . $ `physics/collide.h:113:9`!;
2546
2547 #define ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(type1, type2) \
2548 CollisionResult[type1][type2] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!; \
2549 CollisionResult[type2][type1] = RESULT_CHECK_POLY_SPHEREcxx . . $ `physics/collide.h:115:9`!;
2550
2551 #define ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(type1, type2) \
2552 CollisionResult[type1][type2] = RESULT_CHECK_POLY_SPHEREcxx . . $ `physics/collide.h:115:9`!; \
2553 CollisionResult[type2][type1] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2554
2555 #define ENABLE_COLLISION_BBOX_POLYcxx . . $ `physics/collide.cpp:2555:9`!(type1, type2) \
2556 CollisionResult[type1][type2] = RESULT_CHECK_BBOX_POLY; \
2557 CollisionResult[type2][type1] = RESULT_CHECK_POLY_BBOX;
2558
2559 #define ENABLE_COLLISION_POLY_BBOXcxx . . $ `physics/collide.cpp:2559:9`!(type1, type2) \
2560 CollisionResult[type1][type2] = RESULT_CHECK_POLY_BBOX; \
2561 CollisionResult[type2][type1] = RESULT_CHECK_BBOX_POLY;
2562
2563 #define ENABLE_COLLISION_BBOX_BBOXcxx . . $ `physics/collide.cpp:2563:9`!(type1, type2) \
2564 CollisionResult[type1][type2] = RESULT_CHECK_BBOX_BBOX; \
2565 CollisionResult[type2][type1] = RESULT_CHECK_BBOX_BBOX;
2566
2567 #define ENABLE_COLLISION_BBOX_SPHEREcxx . . $ `physics/collide.cpp:2567:9`!(type1, type2) \
2568 CollisionResult[type1][type2] = RESULT_CHECK_BBOX_SPHERE; \
2569 CollisionResult[type2][type1] = RESULT_CHECK_SPHERE_BBOX;
2570
2571 #define ENABLE_COLLISION_SPHERE_BBOXcxx . . $ `physics/collide.cpp:2571:9`!(type1, type2) \
2572 CollisionResult[type1][type2] = RESULT_CHECK_SPHERE_BBOX; \
2573 CollisionResult[type2][type1] = RESULT_CHECK_BBOX_SPHERE;
2574
2575 #define ENABLE_COLLISION_SPHERE_ROOMcxx . . $ `physics/collide.cpp:2575:9`!(type1, type2) \
2576 CollisionResult[type1][type2] = RESULT_CHECK_SPHERE_ROOMcxx . . $ `physics/collide.h:121:9`!; \
2577 CollisionResult[type2][type1] = RESULT_CHECK_SPHERE_ROOMcxx . . $ `physics/collide.h:121:9`!;
2578
2579 #define ENABLE_COLLISION_BBOX_ROOMcxx . . $ `physics/collide.cpp:2579:9`!(type1, type2) \
2580 CollisionResult[type1][type2] = RESULT_CHECK_BBOX_ROOM; \
2581 CollisionResult[type2][type1] = RESULT_CHECK_BBOX_ROOM;
2582
2583 #define DISABLE_COLLISIONcxx . . $ `physics/collide.cpp:2583:9`!(type1, type2) \
2584 CollisionResult[type1][type2] = RESULT_NOTHINGcxx . . $ `physics/collide.h:112:9`!; \
2585 CollisionResult[type2][type1] = RESULT_NOTHINGcxx . . $ `physics/collide.h:112:9`!;
2586
2587 void CollideInitcxx . . $ CollideInit(49f6e7a06ebc5aa8).() {
2588 int i, j;
2589
2590 for (i = 0; i < MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!; i++)
2591 for (j = 0; j < MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!; j++) {
2592 CollisionResultcxx . . $ CollisionResult.[i][j] = RESULT_NOTHINGcxx . . $ `physics/collide.h:112:9`!;
2593 }
2594
2595 for (i = 0; i < MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!; i++) {
2596 CollisionRayResultcxx . . $ CollisionRayResult.[i] = RESULT_NOTHINGcxx . . $ `physics/collide.h:112:9`!;
2597 }
2598 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2599 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2600 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2601 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2602 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2603 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2604 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2605 CollisionRayResultcxx . . $ CollisionRayResult.[OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!] = RESULT_CHECK_SPHERE_POLYcxx . . $ `physics/collide.h:114:9`!;
2606
2607 for (i = 0; i < MAX_OBJECT_TYPEScxx . . $ `Descent3/object_external.h:186:9`!; i++) {
2608 ENABLE_COLLISION_SPHERE_ROOMcxx . . $ `physics/collide.cpp:2575:9`!(i, OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!)
2609 }
2610
2611 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_WALLcxx . . $ `Descent3/object_external.h:160:9`!, OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!)
2612 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_WALLcxx . . $ `Descent3/object_external.h:160:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)
2613 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_WALLcxx . . $ `Descent3/object_external.h:160:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
2614 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!)
2615 // ENABLE_COLLISION_SPHERE_SPHERE( OBJ_BUILDING, OBJ_BUILDING )
2616 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_FIREBALLcxx . . $ `Descent3/object_external.h:161:9`!)
2617 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
2618 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`!)
2619 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
2620 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)
2621 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
2622 // ENABLE_COLLISION_SPHERE_SPHERE( OBJ_ROBOT, OBJ_PLAYER )
2623 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)
2624
2625 ENABLE_COLLISION_POLY_SPHEREcxx . . $ `physics/collide.cpp:2551:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)
2626 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)
2627 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, OBJ_WALLcxx . . $ `Descent3/object_external.h:160:9`!)
2628 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!)
2629 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!)
2630 ENABLE_COLLISION_SPHERE_SPHEREcxx . . $ `physics/collide.cpp:2543:9`!(OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!, OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!)
2631 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!)
2632 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)
2633 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)
2634 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)
2635 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!, OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)
2636 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!, OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!)
2637 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!, OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!)
2638
2639 ENABLE_COLLISION_SPHERE_ROOMcxx . . $ `physics/collide.cpp:2575:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!)
2640 ENABLE_COLLISION_SPHERE_ROOMcxx . . $ `physics/collide.cpp:2575:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!)
2641 ENABLE_COLLISION_SPHERE_ROOMcxx . . $ `physics/collide.cpp:2575:9`!(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!)
2642 ENABLE_COLLISION_SPHERE_ROOMcxx . . $ `physics/collide.cpp:2575:9`!(OBJ_VIEWERcxx . . $ `Descent3/object_external.h:166:9`!, OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!)
2643
2644 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!)
2645 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!)
2646 ENABLE_COLLISION_SPHERE_POLYcxx . . $ `physics/collide.cpp:2547:9`!(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!)
2647 DISABLE_COLLISIONcxx . . $ `physics/collide.cpp:2583:9`!(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)
2648 }
2649
2650 // Process a collision between an object and a wall
2651 // Returns true if the object hits the wall, and false if should keep going though the wall (for breakable glass)
2652 bool collide_object_with_wallcxx . . $ collide_object_with_wall(df7a53499d66690e).(objectcxx . . $ object# *A, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpt, vectorcxx . . $ vector# *wall_normal,
2653 float hit_dot) {
2654 uint8_tcxx . . $ uint8_t# do_event = 0;
2655 bool ret = true;
2656
2657 switch (A->typecxx . . $ object#type.) {
2658 case OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!:
2659 Errorcxx . . $ Error(326aeb464d16410c).("A object of type NONE hit a wall!\n");
2660 break;
2661 case OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!:
2662 collide_player_and_wallcxx . . $ collide_player_and_wall(cd5bbf25e955f730).(A, hitspeed, hitseg, hitwall, hitpt, wall_normal, hit_dot);
2663 do_event = 1;
2664 break;
2665 case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!:
2666 ret = collide_weapon_and_wallcxx . . $ collide_weapon_and_wall(e4a40ad8112938aa).(A, hitspeed, hitseg, hitwall, hitpt, wall_normal, hit_dot);
2667 do_event = 1;
2668 break;
2669 case OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!:
2670 break; // chrishack -- collide_debris_and_wall(A,hitspeed,hitseg,hitwall,hitpt); break;
2671 case OBJ_FIREBALLcxx . . $ `Descent3/object_external.h:161:9`!:
2672 break; // collide_fireball_and_wall(A,hitspeed,hitseg,hitwall,hitpt);
2673 case OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!:
2674 case OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!:
2675 case OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!:
2676 collide_generic_and_wallcxx . . $ collide_generic_and_wall(cd5bbf25e955f730).(A, hitspeed, hitseg, hitwall, hitpt, wall_normal, hit_dot);
2677 do_event = 1;
2678 break;
2679 case OBJ_VIEWERcxx . . $ `Descent3/object_external.h:166:9`!:
2680 break; // collide_camera_and_wall(A,hitspeed,hitseg,hitwall,hitpt);
2681 case OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!:
2682 break; // collide_powerup_and_wall(A,hitspeed,hitseg,hitwall,hitpt);
2683 case OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!:
2684 break; // do nothing
2685 case OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!:
2686 break; // do nothing
2687 case OBJ_SPLINTERcxx . . $ `Descent3/object_external.h:180:9`!:
2688 break;
2689 case OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`!:
2690 break;
2691 case OBJ_SHARDcxx . . $ `Descent3/object_external.h:163:9`!:
2692 if (sound_override_glass_breakingcxx . . $ sound_override_glass_breaking. == -1)
2693 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_BREAKING_GLASScxx . . $ `Descent3/sounds.h:110:9`!, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, A, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 10);
2694 else
2695 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(sound_override_glass_breakingcxx . . $ sound_override_glass_breaking., SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, A, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 10);
2696 break;
2697
2698 default:
2699 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unhandled collision of object type %d and wall\n", A->type);
2700 // Error( "Unhandled object type hit wall in collide.c\n" );
2701 }
2702
2703 if (do_event && (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2704 // call multiplayer event
2705 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = A->handlecxx . . $ object#handle.;
2706 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
2707 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..xcxx . . $ vector#x. = hitpt->xcxx . . $ vector#x.;
2708 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..ycxx . . $ vector#y. = hitpt->ycxx . . $ vector#y.;
2709 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..zcxx . . $ vector#z. = hitpt->zcxx . . $ vector#z.;
2710 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..xcxx . . $ vector#x. = wall_normal->xcxx . . $ vector#x.;
2711 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..ycxx . . $ vector#y. = wall_normal->ycxx . . $ vector#y.;
2712 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..zcxx . . $ vector#z. = wall_normal->zcxx . . $ vector#z.;
2713 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..hitspeedcxx . . $ game_collide_info#hitspeed. = hitspeed;
2714 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..hit_dotcxx . . $ game_collide_info#hit_dot. = hit_dot;
2715 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..hitsegcxx . . $ game_collide_info#hitseg. = hitseg;
2716 DLLInfocxx . . $ DLLInfo..collide_infocxx . . $ dllinfo#collide_info..hitwallcxx . . $ game_collide_info#hitwall. = hitwall;
2717 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEWALLCOLLIDEcxx . . $ `lib/d3events.h:78:9`!, &DLLInfocxx . . $ DLLInfo.);
2718 }
2719
2720 return ret;
2721 }