Debian Codegraph @

Descent3/object.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/object.cpp $
21 * $Revision: 315 $
22 * $Date: 3/20/00 12:18p $
23 * $Author: Matt $
24 *
25 * Object management functions
26 *
27 * $Log: /DescentIII/main/object.cpp $
28 *
29 * 315 3/20/00 12:18p Matt
30 * Merge of Duane's post-1.3 changes.
31 * Memset ai_frame to zeros after malloc.
32 *
33 * 314 1/26/00 9:20p Jeff
34 * added support for IntelliVIBE DLL
35 *
36 * 313 10/25/99 9:52a Matt
37 * Undid a Mac change (Duane says it's ok)
38 *
39 * 312 10/23/99 12:51a Matt
40 * Fixed compile warning
41 *
42 * 311 10/22/99 10:44p Jeff
43 * mac merge bug fix
44 *
45 * 310 10/22/99 3:43p Matt
46 * Mac merge
47 *
48 * 309 10/20/99 5:40p Chris
49 * Added the Red Guidebot
50 *
51 * 308 10/08/99 4:24p 3dsmax
52 * some ambient sound fix done by MattT
53 *
54 * 307 9/18/99 9:24p Jeff
55 * object position history code (needed for motion blur effect)
56 *
57 * 306 5/22/99 1:54a Matt
58 * Got rid of debug code mistakenly checked in.
59 *
60 * 305 5/21/99 3:43a Matt
61 *
62 * 304 5/20/99 9:03p Matt
63 * Changed trigger system so that collisions with rendered portals don't
64 * set off triggers on the portals.
65 *
66 * 303 5/20/99 3:00p Jason
67 * added support for negative respawn scalars
68 *
69 * 302 5/13/99 7:18p Jeff
70 * fixed unattach bug in delete dead
71 *
72 * 301 5/10/99 8:29p Jason
73 * robots no longer burn on terrain that causes damage
74 *
75 * 300 5/08/99 4:12p Chris
76 * Added AI hearing noises... version 1
77 *
78 * 299 5/06/99 12:52p Jason
79 * fixed set on fire bug
80 *
81 * 298 5/05/99 5:18p Jason
82 * Invul generic objects don't burn on damaging terrain
83 *
84 * 297 5/05/99 5:10a Matt
85 * Fixed a bug with dying & animating objects.
86 *
87 * 296 4/29/99 4:50p Chris
88 * Fixed matcen and Osiris created objects so thier ambient sounds play
89 *
90 * 295 4/29/99 3:09p Jason
91 * fixed a potential bug with object deaths
92 *
93 * 294 4/27/99 10:25p Jason
94 * slowed down afterburner outside just a bit
95 *
96 * 293 4/27/99 9:13a Matt
97 * When clearing a room's secret flag, clear the flag from all the
98 * connected rooms.
99 *
100 * 292 4/26/99 2:30p Jason
101 * fixed bug with secret messages
102 *
103 * 291 4/26/99 2:28p Jason
104 * added persistant hud messages
105 *
106 * 290 4/25/99 5:20p Jason
107 * fixed some more coop bugs
108 *
109 * 289 4/24/99 2:00p Chris
110 * Removed the slow terrain cell verify check from ObjMoveOne when Del+Y
111 * is in effect
112 *
113 * 288 4/23/99 7:18p Jason
114 * fixed some multiplayer issues with observer mode
115 *
116 * 287 4/22/99 7:13p Jeff
117 * fixed bug deleting ghost object in multiplayer
118 *
119 * 286 4/22/99 4:19p Chris
120 * Checked in with the extended DEL+Y terrain node check stuff
121 *
122 * 285 4/21/99 3:01p Matt
123 * Added a new type for dying objects that have AI, instead of keeping a
124 * flag in the dying info.
125 *
126 * 284 4/21/99 11:05a Kevin
127 * new ps_rand and ps_srand to replace rand & srand
128 *
129 * 283 4/20/99 12:24p Matt
130 * Re-revised the ObjInit() system. ObjInit() again does all the
131 * initialization stuff, but now it's passed a lot more information so
132 * those fields can be set before the rest of the initialization takes
133 * place.
134 *
135 * 282 4/18/99 8:13p Chris
136 * Fixed the floating flare problems (where windows where broken out and
137 * the flare remained)
138 *
139 * 281 4/18/99 5:33p Jason
140 * fixed object multiplayer problem
141 *
142 * 280 4/16/99 12:33a Matt
143 * Disable Soar on non-Windows systems.
144 *
145 * 279 4/15/99 1:41a Jeff
146 * changes for linux compile
147 *
148 * 278 4/14/99 3:56a Jeff
149 * fixed case mismatch in #includes
150 *
151 * 277 4/12/99 6:15p Samir
152 * Sound priorities pass 1
153 *
154 * 276 4/12/99 8:18a Chris
155 *
156 * 275 4/12/99 8:12a Chris
157 *
158 * 274 4/12/99 8:06a Chris
159 * Added an ASSERT to check init code that doesn't call
160 * ComputeDefaultSize() for polygon objects
161 *
162 * 273 4/10/99 5:56p Matt
163 * Cleaned up object initialization code, including create object & load
164 * object.
165 *
166 * 272 4/09/99 12:06p Jason
167 * made model setup code faster
168 *
169 * 271 4/05/99 10:54a Matt
170 * Added auto-waypoint system
171 *
172 * 270 4/03/99 4:24p Jason
173 * sped up attached vis effects by a large amount
174 *
175 * 269 3/28/99 5:56p Matt
176 * Added sparking effect for objects
177 *
178 * 268 3/16/99 9:01a Kevin
179 * Fixed generic check to also check for doors.
180 *
181 * 267 3/12/99 7:47p Jeff
182 * only call applydamagetogeneric for generic objects
183 *
184 * 266 3/04/99 6:12p Jason
185 * fixed bug with terrain LOD
186 *
187 * 265 3/01/99 8:34p Matt
188 * Made room damage system set the player on fire instead of applying
189 * damage directly. This system still needs work, but is ok for now.
190 *
191 * 264 3/01/99 6:27p Matt
192 * Cleaned up handling of the outside-mine flag
193 *
194 * 263 3/01/99 3:15p Jason
195 * fixed multiplayer object deletion bug
196 *
197 * 262 2/28/99 6:36p Kevin
198 * More progress on load/save
199 *
200 * 261 2/27/99 5:40p Jason
201 * fixed bug where clients weren't getting remove messages for timed out
202 * powerups
203 *
204 * 260 2/25/99 11:01a Matt
205 * Added new explosion system.
206 *
207 * 259 2/25/99 10:29a Jason
208 * fixed powerup stalling bug in netgames
209 *
210 * 258 2/24/99 1:02p Jason
211 * various fixes for multiplayer
212 *
213 * 257 2/23/99 7:35p Jeff
214 * removed assert/return in unghost if the item is in a player's inventory
215 * (needs to be called when sending over objects in a multiplayer game,
216 * causes an assert)
217 *
218 * 256 2/23/99 5:13p Kevin
219 * Fixed it so objects with lightmaps will retain their lightmaps when a
220 * game is saved & loaded.
221 *
222 * 255 2/23/99 12:39p Jason
223 * added more options for generic objects
224 *
225 * 254 2/22/99 3:26a Matt
226 * Deleted obsolete code
227 *
228 * 253 2/22/99 1:20a Jeff
229 * added support for inventory (simple) in dallas. Moved end-level
230 * sequence to use IGC. Add position clipboard stuff for dallas. Fixed
231 * some inventory bug with storing object handles
232 *
233 * 252 2/21/99 4:31p Chris
234 * Improving the level goal system... Not done.
235 *
236 * 251 2/21/99 4:20p Matt
237 * Added SoundSource objects (and reformatted parts of the object header
238 * files).
239 *
240 * 250 2/19/99 5:16p Chris
241 * Added the child died event
242 *
243 * 249 2/15/99 11:22a Jason
244 * took out client-side prediction
245 *
246 * 248 2/13/99 12:36a Jeff
247 * new object flag. set for when an object is currently in a player's
248 * inventory
249 *
250 * 247 2/12/99 5:59p Jason
251 * more permissable server stuff
252 *
253 * 246 2/12/99 3:38p Jason
254 * added client side interpolation
255 *
256 * 245 2/10/99 2:49p Matt
257 * Renamed OBJECT_HANDLE_INVALID to OBJECT_HANDLE_BAD
258 *
259 * 244 2/10/99 1:47p Matt
260 * Changed object handle symbolic constants
261 *
262 * 243 2/08/99 5:25p Jeff
263 * removed all calls to MultiSendRemoveObject, incorportated into
264 * SetObjectDeadFlag. Fixes sequencing issues in multiplayer
265 *
266 * 242 2/07/99 1:20a Jeff
267 * added new multiplayer game events EVT_GAMEOBJKILLED and
268 * EVT_GAMEOBJDESTROYED
269 *
270 * 241 2/05/99 1:27p Matt
271 * Only do cycled animations for generic objects
272 *
273 * 240 2/03/99 6:32p Jason
274 * more changes for world states
275 *
276 * 239 2/03/99 5:49p Matt
277 * Added room damage system
278 *
279 * 238 2/02/99 8:43a Chris
280 * I made buildings with AI work correctly (ie really big robots should be
281 * buildings)
282 * anim to and from states are now shorts instead of bytes
283 *
284 * 237 2/01/99 4:17p Jason
285 * more changes for multisafe
286 *
287 * 236 1/31/99 7:26p Matt
288 * Renamed a bunch of functions to have HUD capitalized
289 *
290 * 235 1/29/99 5:22p Jeff
291 * localization
292 *
293 * 234 1/27/99 6:48p Jeff
294 * better error handling for ghost/unghost (release build)
295 *
296 * 233 1/24/99 1:24a Jason
297 * fixed chase camera being deleted wrong
298 *
299 * 232 1/23/99 2:49p Kevin
300 * Fixed player movement masking
301 *
302 * 231 1/22/99 8:53p Jeff
303 * added custom-default script overrides
304 *
305 * 230 1/22/99 7:12p Jason
306 * changed terrain speed
307 *
308 * 229 1/22/99 4:23p Jason
309 * sped up afterburner temporarily
310 *
311 * 228 1/21/99 11:15p Jeff
312 * pulled out some structs and defines from header files and moved them
313 * into seperate header files so that multiplayer dlls don't require major
314 * game headers, just those new headers. Side effect is a shorter build
315 * time. Also cleaned up some header file #includes that weren't needed.
316 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
317 * manage.h and multi.h
318 *
319 * 227 1/21/99 6:50p Jason
320 * added test impact mortar
321 *
322 * 226 1/21/99 3:34p Jason
323 * added liquid code
324 *
325 * 225 1/20/99 8:06p Jeff
326 * added members into DLLinfo struct for game change segment events, pass
327 * them over on execute dll packets
328 *
329 * 224 1/20/99 2:13a Chris
330 * It is now possible for robots to have special immunities, resistances,
331 * and vunerabilities
332 *
333 * 223 1/19/99 4:22p Matt
334 * Added the ability for objects to have their own lighting info,
335 * different from the default lighting for that type of object.
336 *
337 * 222 1/19/99 9:20a Kevin
338 * Added afterburner masking
339 *
340 * 221 1/18/99 6:18p Kevin
341 * Added controller masking to DALLAS
342 *
343 * 220 1/18/99 2:46p Matt
344 * Combined flags & flags2 fields in object struct
345 *
346 * 219 1/18/99 12:01a Jeff
347 * fixed EVT_GAMEPLAYERCHANGESEG event (would only get called if the
348 * server changed seg) and added EVT_GAMEOBJCHANGESEG
349 *
350 * 218 1/15/99 7:52p Chris
351 * Updated ObjSetPos() to include a f_update_attach_children flag
352 *
353 * 217 1/15/99 2:53p Jason
354 * fixed multiplayer ping bug
355 *
356 * 216 1/13/99 6:31p Jason
357 * added punch to the afterburner
358 *
359 * 215 1/13/99 2:27p Jeff
360 * added an is_dying flag for evt_destroy to determine whether the event
361 * is due to level end or because it really is dying
362 *
363 * 214 1/12/99 11:44p Jason
364 * Fixed bug with accelerated ping objects
365 *
366 * 213 1/08/99 2:56p Samir
367 * Ripped out OSIRIS1.
368 *
369 * 212 1/06/99 7:02p Jeff
370 * added a multiplayer event for game controls
371 *
372 * 211 1/05/99 5:09p Jason
373 * added permissable server networking (ala Quake/Unreal) to Descent3
374 *
375 * 210 12/31/98 7:35p Jeff
376 * don't allow players to be Ghosted (turned into OBJ_DUMMY). Also, for
377 * ObjDelete[Dead] unghost a ghosted object before killing it
378 *
379 * 209 12/30/98 12:31p Jeff
380 * when freeing object scripts, the type is changed before it's freed in
381 * ObjDelete. Also, when destroyed, OBJ_ROBOT becomes OBJ_DEBRIS and
382 * Osiris was not handling this.
383 *
384 * 208 12/28/98 10:16a Jason
385 * fixed code that was causing some weapons to disappear
386 *
387 * 207 12/21/98 11:30p Matt
388 * Added names for objects
389 *
390 * 206 12/17/98 12:08p Jeff
391 * first checkin of new implementation of OSIRIS (old OSIRIS no longer
392 * works)
393 *
394 * 205 12/10/98 7:09p Jason
395 * added cloak fade
396 *
397 * 204 12/08/98 4:27p Chris
398 * Removed MT_WALKING hack
399 *
400 * 203 12/01/98 3:35p Matt
401 * Got rear view working.
402 *
403 * 202 12/01/98 3:15p Jason
404 * play refueling sound in 3d for multiplayer
405 *
406 * 201 11/17/98 4:16p Kevin
407 * Demo recording system
408 *
409 * 200 11/13/98 4:25p Jason
410 * changes for better weapon effects
411 *
412 * 199 11/13/98 2:27p Samir
413 * took out music code.
414 *
415 * 198 11/11/98 2:46p Kevin
416 * Demo recording system work
417 *
418 * 197 11/10/98 4:48p Jason
419 * sped up afterburner recharge time
420 *
421 * 196 11/10/98 11:16a Jason
422 * fixed some multiplayer bugs with powerups disappearing
423 *
424 *
425 * 195 11/06/98 11:05a Kevin
426 * Added code for demo play back
427 *
428 * 194 11/02/98 6:49p Jason
429 * fixed ifdef release problem
430 *
431 * 193 11/02/98 4:04p Luke
432 * Temp. disabled walkers inside
433 *
434 * 192 10/30/98 4:24p Jason
435 * changes for multiplayer
436 *
437 * 191 10/29/98 5:20p Chris
438 * Player ships collide smaller now
439 *
440 * 190 10/28/98 11:51a Jason
441 * fixed some multiplayer problems, plus redid coop a bit to make it
442 * cleaner
443 *
444 * 189 10/21/98 12:13p Jason
445 * took out guided in multi
446 *
447 * 188 10/20/98 5:47p Kevin
448 * Gunboy and other fixes
449 *
450 * 187 10/20/98 1:19p Jason
451 * fixed afterburner and Of2_SERVER_OBJECT bug
452 *
453 * 186 10/20/98 10:50a Sean
454 *
455 * 185 10/19/98 11:46p Jason
456 * changes for multiplayer debug layer
457 *
458 * 184 10/19/98 10:45p Jason
459 * toned down afterburner outside
460 *
461 * 183 10/19/98 7:51p Kevin
462 * performance testing
463 *
464 * 182 10/19/98 7:18p Matt
465 * Added system to support different types of damage to the player and
466 * have these different types make different sounds.
467 *
468 * 181 10/19/98 1:21p Jason
469 * made afterburner faster
470 *
471 * 180 10/18/98 11:07p Matt
472 * Made ClearTransientObjects() work.
473 *
474 * 179 10/17/98 5:50p Jeff
475 * hooked in rtperformance (run time performance) library
476 *
477 * 178 10/16/98 4:18p Chris
478 * Fixed the 'flare thing'
479 *
480 * 177 10/16/98 3:39p Chris
481 * Improved the object linking system and AI and physics
482 *
483 * 176 10/15/98 8:47a Matt
484 * Changed _DEBUG/RELEASE inconsistancy with slew
485 *
486 * 175 10/14/98 1:02p Jason
487 * fixed FindSoundName issues
488 *
489 * 174 10/14/98 12:43a Matt
490 * Fixed error handling for when an object can't be initialized.
491 *
492 * 173 10/13/98 1:08p Chris
493 * Greatly improved the AI's use of paths. Improved visability checking
494 * algorithm. Probably needs a second pass for further cleanup.
495 *
496 * 172 10/11/98 10:53p Matt
497 * Fixed some zero-length malloc()s
498 *
499 * 171 10/11/98 2:39p Matt
500 * If ObjInit() fails, ObjCreate() now returns an error.
501 *
502 * 170 10/08/98 4:23p Kevin
503 * Changed code to comply with memory library usage. Always use mem_malloc
504 * , mem_free and mem_strdup
505 *
506 * 169 10/06/98 5:46p Kevin
507 * Added new configuration for demo
508 *
509 * 168 10/06/98 2:59p Jason
510 * added timedemo function
511 *
512 * 167 10/06/98 11:27a Jason
513 * added new death type for robots
514 *
515 * 166 10/03/98 8:05p Matt
516 * Added asserts
517 *
518 * 165 9/28/98 6:23p Chris
519 * Changed multi_anim to custom_anim
520 *
521 * 164 9/23/98 2:55p Chris
522 * Improved auto-leveling and added newbie leveling
523 *
524 * 163 9/22/98 6:48p Jason
525 * fixed dedicated server problems
526 *
527 * 162 9/22/98 6:04p Samir
528 * ifdef DoAI to 1 if in release version.
529 *
530 * 161 9/22/98 1:02p Matt
531 * Don't set previous room info for an object if the object was moved in
532 * the editor.
533 *
534 * 160 9/22/98 12:40p Matt
535 * Cleaned up the object per-frame processing code.
536 *
537 * 159 9/17/98 3:03p Jason
538 * added lightning and invul hit effects
539 *
540 * 158 9/10/98 12:18p Jason
541 * more changes to afterburner/thrust effect
542 *
543 * 157 9/09/98 7:09p Jason
544 * changed afterburner effect for ships
545 *
546 * 156 9/09/98 4:30p Jason
547 * fixed a remaining (and insidious) bug with gunpoint instancing
548 *
549 * 155 8/31/98 6:12p Luke
550 * Moved the multi turret deletion code to somewhere where I can debug
551 * things
552 *
553 * 154 8/24/98 4:48p Jason
554 * undid my last rev
555 *
556 * 153 8/24/98 2:52p Jason
557 * fixed instance problem
558 *
559 * 152 8/19/98 11:30a Jason
560 * fixed afterburner problem with low framerates
561 *
562 * 151 8/17/98 12:10p Chris
563 * Fixed MAJOR bug in getting gunpoint positions
564 *
565 * 150 8/14/98 6:21p Chris
566 * Added another safety check for docycledanim
567 *
568 * 149 8/12/98 6:37p Jeff
569 * added functions to ghost an object (make it's type to OBJ_DUMMY) and
570 * unghost
571 *
572 * 148 8/12/98 12:04p Chris
573 * Attach system version .5 (still needs more work to be multiplayer
574 * friendly)
575 *
576 * 147 8/07/98 8:25p Chris
577 * Improved the attach system
578 *
579 * 146 8/07/98 6:54p Jeff
580 * afterburner powerup effect added
581 *
582 * 145 8/03/98 4:29p Chris
583 * Added additional support for the attach system
584 *
585 * 144 7/30/98 11:09a Jason
586 * added weapons that freeze and deform terrain
587 *
588 * 143 7/28/98 5:43p Samir
589 * added room change hook for music system,
590 *
591 * 142 7/22/98 3:16p Jason
592 * added observer mode
593 *
594 * 141 7/20/98 10:42a Jason
595 * added more player scalars, plus afterburner changes
596 *
597 * 140 7/16/98 12:51p Mark
598 * Fixed a potential bug
599 *
600 * 139 7/15/98 2:33p Jason
601 * added scalar variables for various player skills
602 *
603 * 138 7/15/98 12:48p Jeff
604 * put in calls to handle new multiplayer event...when an object's shields
605 * change
606 *
607 * 137 7/14/98 5:52p Kevin
608 * Packet loss measurements and auto pps adjusting
609 *
610 * 136 7/14/98 3:54p Sean
611 * CHRIS -- Fixed a bug in free'ing multi_turret_info on objects that are
612 * not polygon models (i.e. they don't have that info and it is union'ed
613 * to something else so it is not NULL)
614 *
615 * 135 7/09/98 7:50p Jeff
616 * added ObjGetUltimateParent to find out the original parent of an
617 * object, traces the family tree
618 *
619 * 134 7/09/98 3:30p Chris
620 * Fixed communication problem between systems
621 *
622 * 133 7/09/98 11:34a Chris
623 * Turrets are interpolated.
624 *
625 * 132 7/08/98 11:38a Chris
626 * Improved the turret info passing in multiplayer
627 *
628 * 131 7/07/98 3:26p Chris
629 * Added changes for turret updates
630 *
631 * 130 7/02/98 2:47p Chris
632 * Dynamic weapon info is now dynamically allocated
633 *
634 * 129 7/01/98 4:35p Chris
635 * More multiplayer sync issues
636 *
637 * 128 7/01/98 2:02p Chris
638 * Added the sound for animations
639 *
640 * 127 6/30/98 6:36p Chris
641 * Added rev .1 of multiplayer animations - BTW It is totally not done.
642 *
643 * 126 6/30/98 4:28p Chris
644 * Checked in some missing commas
645 *
646 * 125 5/26/98 7:07p Samir
647 * reset script.is_custom to 1 when calling ObjCreate.
648 *
649 * 124 5/22/98 4:45p Chris
650 * Powerups us the correct anim time
651 *
652 * 123 5/19/98 4:42a Chris
653 * Added shockwave's -- enjoy. :)
654 *
655 * 122 5/15/98 5:41p Jason
656 * implemented volume lighting system
657 *
658 * 121 5/11/98 4:40p Chris
659 * AI info is now a malloc'ed pointer
660 *
661 * 120 5/04/98 6:47p Craig
662 * Rooms cannot cycle through anims
663 *
664 * 119 5/04/98 12:30p Matt
665 * ObjCreate() now takes object id as a uint16_t
666 *
667 * 118 5/04/98 12:28p Matt
668 * Added shard objects
669 *
670 * 117 5/01/98 3:41p Chris
671 *
672 * 116 5/31/98 3:08p Chris
673 * Allowed for death animations
674 *
675 * 115 4/27/98 1:14p Jason
676 * cleaned up afterburner stuff
677 *
678 * 114 4/23/98 12:44p Jason
679 * made AI toggleable to test framerate - this is temporary
680 *
681 * 113 4/22/98 4:15p Chris
682 * Improved DebugBlockPrint
683 *
684 * 112 4/22/98 3:50p Chris
685 * Added DebugBlockPrint
686 *
687 * 111 4/22/98 2:10p Matt
688 * Made FreeAllObjects() free the player object (object 0), since objects
689 * now contain malloc'd data and must be freed.
690 *
691 * 110 4/20/98 6:24p Chris
692 * Bulletproofing collision code
693 *
694 * 109 4/19/98 5:00p Jason
695 * added cool napalm effect, plus made object effects dynamically
696 * allocated
697 *
698 * 108 4/17/98 1:59p Jason
699 * added cool object effects
700 *
701 * 107 4/16/98 2:56p Chris
702 * Updated buddy support and intergrated scripting and AI
703 *
704 * 106 4/15/98 8:38p Jason
705 * fixed some multiplayer issues
706 *
707 * 105 4/15/98 12:56p Chris
708 * Updated parent_handle support and added buddy bot support
709 *
710 * 104 4/13/98 2:21p Chris
711 * Fixed some collision problems dealing with AABBs and Polymodel paging
712 * in.
713 *
714 * 103 4/13/98 12:42p Jason
715 * changed afterburner effect
716 *
717 * 102 4/10/98 2:42p Jason
718 * fixed afterburner blobs to be a stream
719 *
720 * 101 4/10/98 2:16p Jason
721 * fixed guided missile problems
722 *
723 * 100 4/09/98 5:18p Jason
724 * got guided working in multiplayer
725 *
726 * 99 4/09/98 3:04p Jason
727 * temp fix for afterburner running out of fuel
728 *
729 * 98 4/09/98 2:23p Jason
730 * added guided/afterburner stuff
731 *
732 * 97 4/07/98 1:12p Jason
733 * make powerup respawn a variable in multiplayer games
734 *
735 * 96 4/03/98 11:04a Jason
736 * added a multplayer dll hook for when a player changes a room
737 *
738 * 95 4/01/98 6:23p Jason
739 * added a slew of stuff for multiplayer
740 *
741 * 94 3/31/98 5:56p Jason
742 * changes for multiplay
743 *
744 * 93 3/31/98 4:23p Chris
745 * Added a new AIpath system
746 *
747 * 92 3/20/98 9:34p Jason
748 * added SetObjectDeadFlag inlined function
749 *
750 * 91 3/13/98 5:55p Chris
751 * Added the new collision spheres
752 *
753 * 90 3/12/98 7:30p Chris
754 * Added ObjSetOrient
755 *
756 * 89 2/25/98 3:01p Jason
757 * added splinter objects to FreeObjects
758 *
759 * 88 2/25/98 2:05p Jason
760 * did FOV and object visibility changes
761 *
762 * 87 2/20/98 1:46p Chris
763 * JASON: Made dynamic lighting only occur if the object is rendered
764 *
765 * 86 2/19/98 11:17a Chris
766 * Tweaked the BIG_OBJECT system
767 *
768 * 85 2/17/98 3:46p Matt
769 * Revamped weapon system and got sounds for spray and fusion weapons
770 * working. Still need to implements getting continuous & cutoff sounds
771 * from player ship.
772 *
773 * 84 2/16/98 2:49p Chris
774 * Made the MAX_SUBOBJECTS determine the number of normalized_time values
775 * to be processed. No longer a 'literal' problem.
776 *
777 * 83 2/13/98 6:59p Chris
778 * FIxed the normalized_time array from being smaller than the number of
779 * subobjects. Also update newstyle_fi.cpp
780 *
781 * 82 2/12/98 8:48p Matt
782 * Changed controls system to keep the reading of the controls seperate
783 * from using the results. Got rid of the Controls global.
784 *
785 * 81 2/11/98 2:04p Jason
786 * got spawning weapons working
787 *
788 * 80 2/09/98 3:20p Matt
789 * Changed assert to allow OBJECT_HANDLE_INVALID to be pased to ObjGet()
790 *
791 * 79 2/05/98 3:00p Matt
792 * Made ObjSetPos() take optional orienation. Got rid of unlink & relink
793 * funcs from header.
794 *
795 * 78 2/04/98 6:09p Matt
796 * Changed object room number to indicate a terrain cell via a flag. Got
797 * rid of the object flag which used to indicate terrain.
798 *
799 * 77 2/03/98 1:06p Jason
800 * tidied up some multiplayer loose ends
801 *
802 * 76 1/30/98 5:26p Chris
803 * Allow all non-AI objects to animate
804 *
805 * 75 1/29/98 5:49p Matt
806 * Changed old camera object type to be viewer object (for editor), and
807 * now camera objects will just be for game cameras.
808 *
809 * 74 1/27/98 12:26p Samir
810 * Added GetObjectPointInWorld.
811 *
812 * 73 1/23/98 11:21a Jason
813 * incremental multiplayer checkin
814 *
815 * 72 1/21/98 1:11p Jason
816 * incremental checkin for multiplayer
817 *
818 * 71 1/20/98 6:01p Jason
819 * first pass at getting multiplayer deaths working
820 *
821 * 70 1/20/98 4:12p Samir
822 * New script housekeeping system.
823 *
824 * 69 1/20/98 12:27p Luke
825 * Added an assert to make sure that we are not linking to an external
826 * room
827 *
828 * 68 1/20/98 12:10p Jason
829 * implemented vis effect system
830 *
831 * 67 1/19/98 2:44p Samir
832 * Use one script per object and started parameter passing support.
833 *
834 * 66 1/19/98 12:38p Jason
835 * took out mprintf in ObjCreate
836 *
837 * 65 1/19/98 10:04a Matt
838 * Added new object handle system
839 *
840 * 64 1/15/98 6:49p Jason
841 * incremental checkin for multiplayer
842 *
843 * 63 12/30/97 5:45p Jason
844 * added toggleable fog
845 *
846 * 62 12/19/97 2:46p Jason
847 * implemented bitmap paging routines
848 *
849 * 61 12/12/97 3:42p Jason
850 * free all objects on shutdown
851 *
852 * 60 12/01/97 9:56a Chris
853 * Removed FLARE and CNTRL_CENTER types
854 *
855 * 59 11/10/97 12:27p Jason
856 * added objects live mprintf
857 *
858 * 58 10/28/97 12:22p Chris
859 * Added a movement type of walking
860 *
861 * 57 10/23/97 5:36p Jason
862 * added splinter objects (probably temporary)
863 *
864 * 56 10/22/97 5:14p Chris
865 * Allow for non-AI objects to animate
866 *
867 * 55 10/20/97 4:46p Jason
868 * changes for explosions
869 *
870 * 54 10/14/97 6:53p Chris
871 * Added the initial SOAR support
872 *
873 * 53 10/08/97 6:35p Samir
874 * Dying player ships get marked as destroyed. When death sequence is
875 * over, they are marked as dead. This is needed to better control
876 * movement of the dying ship.
877 *
878 * 52 10/03/97 5:18p Chris
879 * Added OBJ_LINE as a new type
880 *
881 * 51 10/02/97 1:04p Jason
882 * implemented FreeAllObjects
883 *
884 * 50 10/01/97 7:51p Matt
885 * Added code for external rooms
886 *
887 * 49 9/30/97 6:40p Jason
888 * got lightmap stuff sort of working with objects
889 *
890 * 48 9/22/97 6:20p Matt
891 * Killed include of stub.h, and removed references to stuff that had been
892 * in stub.h
893 *
894 * 47 9/19/97 6:58p Chris
895 * Fixed some bugs with the big object system and removed some annoying
896 * mprintf's
897 *
898 * 46 9/19/97 1:01p Chris
899 * Better big object support
900 *
901 * 45 9/18/97 1:25p Matt
902 * Cleaned up code, added the text name for door objects, and other small
903 * changes.
904 *
905 * 44 9/17/97 11:16a Matt
906 * Ripped out segment code
907 *
908 * 43 9/16/97 5:04p Matt
909 * Changed conditional for debug code
910 *
911 * 42 9/15/97 12:42p Samir
912 * Added include of stdlib.
913 *
914 * 41 9/15/97 5:21a Chris
915 * Added sphere2poly support
916 *
917 * 40 9/12/97 6:36p Chris
918 * Added collision terrain segment support
919 * Added some LARGE OBJECT collision support
920 *
921 * 39 9/12/97 10:12a Matt
922 * Added trigger check
923 *
924 * 38 9/05/97 3:22p Jason
925 * changes for lit objects
926 *
927 * 37 9/05/97 1:29p Jason
928 * revamped generic object lighting
929 *
930 * 36 9/05/97 12:26p Samir
931 * Player initiates death sequence if killed.
932 *
933 * 35 9/04/97 5:26p Jason
934 * got pulsing objects to work
935 *
936 * 34 9/04/97 12:11p Jason
937 * added flickering generic objects
938 *
939 * 33 9/03/97 6:17p Jason
940 * added code to support powerups/robots/etc that cast light
941 *
942 * 32 9/03/97 3:53p Jason
943 * got objects to cast light
944 *
945 * 31 8/25/97 7:32p Chris
946 *
947 * 30 8/25/97 6:18p Chris
948 *
949 * 29 8/25/97 5:14p Craig
950 *
951 * 28 8/25/97 12:41p Chris
952 * Made sure that all object movements and mine changes result in AABB
953 * updates.
954 *
955 * 27 8/22/97 10:51a Samir
956 * call destroy script if object is being killed.
957 *
958 * 26 8/21/97 7:47p Matt
959 * ObjSetPos() wasn't relinking the object when the room changed
960 *
961 * 25 8/21/97 5:57p Samir
962 * Added code that kills scripts when object is being deleted.
963 *
964 * 24 8/20/97 5:04p Samir
965 * Added frame interval scripting.
966 *
967 * 23 8/18/97 1:45a Chris
968 * Fix some bugs.
969 *
970 * 22 8/12/97 3:56p Matt
971 * Added new object type: OBJ_BUILDING
972 *
973 * 21 8/12/97 1:13p Chris
974 * Added AABBs.
975 *
976 * 20 8/11/97 6:48p Matt
977 * Rewrote static object remap system
978 *
979 * 19 8/11/97 1:53p Matt
980 * Ripped out robot & powerup pages, and added generic page
981 *
982 * 18 8/04/97 5:29p Matt
983 * Removed some not-to-be-used room code
984 *
985 * 17 8/04/97 4:08p Matt
986 * Added ObjSetPos() that takes the new room number
987 *
988 * 16 8/04/97 12:37p Chris
989 * We now support fvi in Rooms :)
990 *
991 * 15 7/29/97 10:27a Jason
992 * added RenderOBject abstraction layer
993 *
994 * 14 7/28/97 1:14p Chris
995 * Added support for sub-object visability. Plus, debris.
996 *
997 * 13 7/16/97 4:09p Jason
998 * ripped out temporary object lighting
999 *
1000 *
1001 * 12 7/16/97 3:43p Jason
1002 * took off lighting of objects
1003 *
1004 * 11 7/15/97 5:32p Jason
1005 * got simple static lighting working with objects
1006 *
1007 * 10 7/15/97 4:59p Chris
1008 *
1009 * 9 7/15/97 4:59p Chris
1010 * added support for AI and animations
1011 *
1012 * 50 6/24/97 6:54p Mark
1013 *
1014 * 49 6/24/97 6:07p Matt
1015 * Use DrawPolygonModel() directly, instead of DrawPolygonObject()
1016 *
1017 * 48 6/06/97 4:07p Jason
1018 * verify tmap2 textures if in editor mode
1019 *
1020 * 47 5/16/97 2:17p Samir
1021 * ResetPlayerObject added.
1022 *
1023 * 46 5/15/97 6:09p Chris
1024 *
1025 * 45 5/14/97 3:41p Chris
1026 *
1027 * 44 5/14/97 12:32p Matt
1028 * Took out timer stuff for refuel sound; instead, we set the execlusive
1029 * flag for the sound itself.
1030 *
1031 * 43 5/13/97 10:31p Matt
1032 * Added code for refueling centers.
1033 * Dead objects now get deleted right after the simulation is done.
1034 *
1035 * 42 4/30/97 5:43p Jason
1036 * remap polymodels when pagefile is done loading
1037 *
1038 * 41 4/24/97 5:42p Jason
1039 * got fireball vclips working
1040 *
1041 * 40 4/17/97 2:48p Samir
1042 * ReadFlyingControls renamed from read_flying_controls to match naming
1043 * convention rules.
1044 *
1045 * 39 4/14/97 4:23p Jason
1046 * made objects work with DrawWeaponObject
1047 *
1048 * 38 4/14/97 3:48p Jason
1049 * changed RT_LASER to RT_WEAPON
1050 *
1051 * 37 4/04/97 4:33p Chris
1052 *
1053 * 36 4/04/97 2:45p Matt
1054 * Removed prototypes for deleted functions
1055 *
1056 * 35 4/02/97 3:44p Matt
1057 * Find a valid Ships[] entry, instead of assuming that Ships[0] is valid.
1058 *
1059 * 34 4/02/97 2:26p Jason
1060 * made RemapEverything actually call every remap function
1061 *
1062 * 33 4/01/97 10:49p Matt
1063 * Get player ship model num from Ship page
1064 *
1065 * 32 3/27/97 10:45a Chris
1066 * Set player mass and drag info
1067 *
1068 * 31 3/26/97 3:29p Jason
1069 * made robots work/render
1070 *
1071 * 30 3/26/97 3:02p Chris
1072 * Fixed a bug in ObjMoveAll... It only moved every other object.
1073 *
1074 * 29 3/24/97 4:11p Chris
1075 * Fixed a bug by the TerrainMaster... It seems that !obj->flags &
1076 * OF_OVER_TERRAIN is not the same as !(obj->flags & OF_OVER_TERRAIN) and
1077 * it isn't and shouldn't be. :)
1078 *
1079 * 28 3/21/97 5:01p Jason
1080 * incremental terrain improvments
1081 *
1082 *
1083 * 27 3/20/97 5:45p Jason
1084 * made object work with and render on terrain
1085 *
1086 * 26 3/17/97 12:11p Chris
1087 *
1088 * 25 3/17/97 11:56a Chris
1089 * Forced player object to have valid mass and drag. Will fix this
1090 * correctly at a later date.
1091 *
1092 * 24 3/14/97 12:18p Chris
1093 * Tweak physics and remove braking for now.
1094 *
1095 * 23 3/12/97 6:31p Chris
1096 * Added player flight controls while in game
1097 *
1098 * 22 3/05/97 3:09p Jason
1099 * added RemapDoors to RemapEverything
1100 *
1101 * 21 3/5/97 1:40 PM Jeremy
1102 * only #include editor headers when EDITOR is defined
1103 *
1104 * 20 2/28/97 2:37p Matt
1105 * Draw wireframe box around editor's current object
1106 *
1107 * 19 2/27/97 5:10p Samir
1108 * Added crude trigger checking while flying.
1109 *
1110 * 18 2/18/97 6:31p Matt
1111 * Changed Frame_time to Frametime, & added Gametime
1112 *
1113 * 17 2/13/97 12:16p Jason
1114 * changes for powerup remapping
1115 *
1116 * 16 2/12/97 5:37p Jason
1117 * changed GamePowerups to Powerups to keep from
1118 * getting lynched
1119 *
1120 * 15 2/11/97 6:51p Matt
1121 * Ripped out some old stuff & renamed a function
1122 *
1123 * 14 2/10/97 5:39p Matt
1124 * Fixed to compile with EDITOR defined
1125 *
1126 * 13 2/07/97 5:48p Matt
1127 * Renamed vector.h to vecmat.h to fix DevStudio problem
1128 *
1129 * $NoKeywords: $
1130 */
1131
1132 #include <stdlib.h>
1133 #include <string.h> // for memset
1134 #include <stdio.h>
1135
1136 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
1137
1138 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
1139 #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/
1140 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
1141
1142 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
1143 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
1144 #include "slew.h"cxx . . $ `<file>/Descent3/slew.h`/
1145 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
1146 #include "trigger.h"cxx . . $ `<file>/Descent3/trigger.h`/
1147 #include "physics.h"cxx . . $ `<file>/physics/physics.h`/
1148 #include "collide.h"cxx . . $ `<file>/physics/collide.h`/
1149 #include "door.h"cxx . . $ `<file>/Descent3/door.h`/
1150 #include "controls.h"cxx . . $ `<file>/Descent3/controls.h`/
1151 #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/
1152 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
1153 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
1154 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
1155 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
1156 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
1157 #include "objinit.h"cxx . . $ `<file>/Descent3/objinit.h`/
1158 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
1159 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
1160 #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/
1161 #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/
1162 #include "room.h"cxx . . $ `<file>/Descent3/room.h`/
1163 #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/
1164 #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/
1165 #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/
1166 #include "lightmap_info.h"cxx . . $ `<file>/Descent3/lightmap_info.h`/
1167 #include "object_lighting.h"cxx . . $ `<file>/Descent3/object_lighting.h`/
1168 #include "soar.h"cxx . . $ `<file>/Descent3/soar.h`/
1169 #include "splinter.h"cxx . . $ `<file>/Descent3/splinter.h`/
1170 #include "ObjScript.h"cxx . . $ `<file>/Descent3/ObjScript.h`/
1171 #include "viseffect.h"cxx . . $ `<file>/Descent3/viseffect.h`/
1172 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
1173 #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/
1174 #include "robot.h"cxx . . $ `<file>/Descent3/robot.h`/
1175 #include "damage.h"cxx . . $ `<file>/Descent3/damage.h`/
1176 #include "attach.h"cxx . . $ `<file>/Descent3/attach.h`/
1177 #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/
1178 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
1179 #include "demofile.h"cxx . . $ `<file>/lib/demofile.h`/
1180 #include "rtperformance.h"cxx . . $ `<file>/rtperformance/rtperformance.h`/
1181 #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/
1182 #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/
1183 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
1184 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
1185 #include "levelgoal.h"cxx . . $ `<file>/Descent3/levelgoal.h`/
1186 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
1187
1188 #ifdef EDITOR
1189 #include "editor\d3edit.h"
1190 #endif
1191
1192 #include <algorithm>
1193
1194 /*
1195 * Global variables
1196 */
1197
1198 objectcxx . . $ object# *Player_objectcxx . . $ Player_object. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; // the object that is the player
1199 objectcxx . . $ object# *Viewer_objectcxx . . $ Viewer_object. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; // which object we are seeing from
1200
1201 static int16_t free_obj_listcxx . . $ free_obj_list.[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!];
1202
1203 // Data for objects
1204
1205 // -- Object stuff
1206
1207 // info on the various types of objects
1208
1209 objectcxx . . $ object# Objectscxx . . $ Objects.[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!];
1210
1211 tPosHistorycxx . . $ tPosHistory# Object_position_samplescxx . . $ Object_position_samples.[MAX_OBJECT_POS_HISTORYcxx . . $ `Descent3/object.h:821:9`!];
1212 uint8_tcxx . . $ uint8_t# Object_position_headcxx . . $ Object_position_head.;
1213 int16_t Object_map_position_historycxx . . $ Object_map_position_history.[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!];
1214 int16_t Object_map_position_free_slotscxx . . $ Object_map_position_free_slots.[MAX_OBJECT_POS_HISTORYcxx . . $ `Descent3/object.h:821:9`!];
1215 uint16_tcxx . . $ uint16_t# Num_free_object_position_historycxx . . $ Num_free_object_position_history.;
1216
1217 int Num_objectscxx . . $ Num_objects. = 0;
1218 int Highest_object_indexcxx . . $ Highest_object_index. = 0;
1219 int Highest_ever_object_indexcxx . . $ Highest_ever_object_index. = 0;
1220
1221 int print_object_infocxx . . $ print_object_info. = 0;
1222
1223 #ifdef EDITOR
1224 // This array matches the object types in object.h
1225 char *Object_type_names[MAX_OBJECT_TYPES] = {
1226 "WALL", // OBJ_WALL 0
1227 "FIREBALL", // OBJ_FIREBALL 1
1228 "ROBOT", // OBJ_ROBOT 2
1229 "SHARD", // OBJ_SHARD 3
1230 "PLAYER", // OBJ_PLAYER 4
1231 "WEAPON", // OBJ_WEAPON 5
1232 "VIEWER", // OBJ_VIEWER 6
1233 "POWERUP", // OBJ_POWERUP 7
1234 "DEBRIS", // OBJ_DEBRIS 8
1235 "CAMERA", // OBJ_CAMERA 9
1236 "SHOCKWV", // OBJ_SHOCKWAVE 10
1237 "CLUTTER", // OBJ_CLUTTER 11
1238 "GHOST", // OBJ_GHOST 12
1239 "LIGHT", // OBJ_LIGHT 13
1240 "COOP", // OBJ_COOP 14
1241 "UNUSED", // OBJ_MARKER 15
1242 "BUILDING", // OBJ_BUILDING 16
1243 "DOOR", // OBJ_DOOR 17
1244 "ROOM", // OBJ_ROOM 18
1245 "LINE", // OBJ_PARTICLE 19
1246 "SPLINTER", // OBJ_SPLINTER 20
1247 "DUMMY", // OBJ_DUMMY 21
1248 "OBSERVER", // OBJ_OBSERVER 22
1249 "DEBUG LINE", // OBJ_DEBUG_LINE 23
1250 "SOUNDSOURCE", // OBJ_SOUNDSOURCE 24
1251 "WAYPOINT", // OBJ_WAYPOINT 25
1252 };
1253 #endif
1254
1255 int Num_big_objectscxx . . $ Num_big_objects. = 0;
1256 int16_t BigObjectListcxx . . $ BigObjectList.[MAX_BIG_OBJECTScxx . . $ `Descent3/object.h:695:9`!]; // DAJ_MR utb int
1257
1258 /*
1259 * Local Function Prototypes
1260 */
1261
1262 // Do refueling centers & damage rooms
1263 void DoSpecialPlayerStuffcxx . . $ DoSpecialPlayerStuff(419c470199a90a97).(objectcxx . . $ object# *obj);
1264
1265 /*
1266 * Functions
1267 */
1268
1269 #ifndef RELEASE
1270 // set viewer object to next object in array
1271 void ObjGotoNextViewercxx . . $ ObjGotoNextViewer(49f6e7a06ebc5aa8).() {
1272 int i, start_obj = 0;
1273
1274 start_obj = Viewer_objectcxx . . $ Viewer_object. - Objectscxx . . $ Objects.; // get viewer object number
1275
1276 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
1277
1278 start_obj++;
1279 if (start_obj > Highest_object_indexcxx . . $ Highest_object_index.)
1280 start_obj = 0;
1281
1282 if (Objectscxx . . $ Objects.[start_obj].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
1283 Viewer_objectcxx . . $ Viewer_object. = &Objectscxx . . $ Objects.[start_obj];
1284 return;
1285 }
1286 }
1287
1288 Errorcxx . . $ Error(326aeb464d16410c).("Couldn't find a viewer object!");
1289 }
1290
1291 // set viewer object to next object in array
1292 void obj_goto_prev_viewercxx . . $ obj_goto_prev_viewer(49f6e7a06ebc5aa8).() {
1293 int i, start_obj = 0;
1294
1295 start_obj = Viewer_objectcxx . . $ Viewer_object. - Objectscxx . . $ Objects.; // get viewer object number
1296
1297 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
1298
1299 start_obj--;
1300 if (start_obj < 0)
1301 start_obj = Highest_object_indexcxx . . $ Highest_object_index.;
1302
1303 if (Objectscxx . . $ Objects.[start_obj].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
1304 Viewer_objectcxx . . $ Viewer_object. = &Objectscxx . . $ Objects.[start_obj];
1305 return;
1306 }
1307 }
1308
1309 Errorcxx . . $ Error(326aeb464d16410c).("Couldn't find a viewer object!");
1310 }
1311 #endif
1312
1313 objectcxx . . $ object# *obj_find_first_of_typecxx . . $ obj_find_first_of_type(11672e354c0b263a).(int type) {
1314 int i;
1315
1316 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++)
1317 if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == type)
1318 return (&Objectscxx . . $ Objects.[i]);
1319
1320 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1321 }
1322
1323 int obj_return_num_of_typecxx . . $ obj_return_num_of_type(7864480464b09eea).(int type) {
1324 int i, count = 0;
1325
1326 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++)
1327 if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == type)
1328 count++;
1329
1330 return (count);
1331 }
1332
1333 int obj_return_num_of_typeidcxx . . $ obj_return_num_of_typeid(9b79fb6aee4c0440).(int type, int id) {
1334 int i, count = 0;
1335
1336 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++)
1337 if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == type && Objectscxx . . $ Objects.[i].idcxx . . $ object#id. == id)
1338 count++;
1339
1340 return (count);
1341 }
1342
1343 int ObjAllocatecxx . . $ ObjAllocate(b126dc7c1de90089).(void);
1344
1345 // Creates the player object in the center of the given room
1346 void CreatePlayerObjectcxx . . $ CreatePlayerObject(d4f767463ce0a6b3).(int roomnum) {
1347 int objnum;
1348 vectorcxx . . $ vector# pos;
1349
1350 ComputeRoomCentercxx . . $ ComputeRoomCenter(e48cdaa0374a2a1d).(&pos, &Roomscxx . . $ Rooms.[roomnum]);
1351
1352 objnum = ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, 0, roomnum, &pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1353
1354 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum == 0); // player must be object 0
1355
1356 Player_objectcxx . . $ Player_object. = Viewer_objectcxx . . $ Viewer_object. = &Objectscxx . . $ Objects.[objnum];
1357 }
1358
1359 void InitBigObjectscxx . . $ InitBigObjects(49f6e7a06ebc5aa8).() { Num_big_objectscxx . . $ Num_big_objects. = 0; }
1360
1361 void BigObjAddcxx . . $ BigObjAdd(d4f767463ce0a6b3).(int objnum) {
1362 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Num_big_objects < MAX_BIG_OBJECTScxx . . $ `Descent3/object.h:695:9`!);
1363 if (Num_big_objectscxx . . $ Num_big_objects. >= MAX_BIG_OBJECTScxx . . $ `Descent3/object.h:695:9`!) {
1364 Int3cxx . . $ `misc/pserror.h:247:9`!();
1365 return;
1366 }
1367
1368 Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. |= OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!;
1369 BigObjectListcxx . . $ BigObjectList.[Num_big_objectscxx . . $ Num_big_objects.++] = objnum;
1370 }
1371
1372 void BigObjRemovecxx . . $ BigObjRemove(d4f767463ce0a6b3).(int objnum) {
1373 int i;
1374
1375 Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. &= (~OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!);
1376
1377 for (i = 0; i < Num_big_objectscxx . . $ Num_big_objects.; i++) {
1378 if (BigObjectListcxx . . $ BigObjectList.[i] == objnum) {
1379 Num_big_objectscxx . . $ Num_big_objects.--;
1380 break;
1381 }
1382 }
1383
1384 while (i < Num_big_objectscxx . . $ Num_big_objects.) {
1385 BigObjectListcxx . . $ BigObjectList.[i] = BigObjectListcxx . . $ BigObjectList.[i + 1];
1386 i++;
1387 }
1388
1389 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Num_big_objects < MAX_BIG_OBJECTScxx . . $ `Descent3/object.h:695:9`!);
1390 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Num_big_objects >= 0);
1391 }
1392
1393 // Resets the object list: sets all objects to unused, intializes handles, & sets roomnums to -1
1394 // Called by the editor to init a new level.
1395 void ResetObjectListcxx . . $ ResetObjectList(49f6e7a06ebc5aa8).() {
1396 int i;
1397
1398 // Init data for each object
1399 for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) {
1400 Objectscxx . . $ Objects.[i].handlecxx . . $ object#handle. = i;
1401 Objectscxx . . $ Objects.[i].typecxx . . $ object#type. = OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!;
1402 Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum. = -1;
1403 }
1404
1405 // Build the free object list
1406 ResetFreeObjectscxx . . $ ResetFreeObjects(49f6e7a06ebc5aa8).();
1407
1408 // Say no big objects
1409 InitBigObjectscxx . . $ InitBigObjects(49f6e7a06ebc5aa8).();
1410
1411 ObjResetPositionHistorycxx . . $ ObjResetPositionHistory(49f6e7a06ebc5aa8).();
1412 }
1413
1414 // sets up the free list & init player & whatever else
1415 void InitObjectscxx . . $ InitObjects(49f6e7a06ebc5aa8).() {
1416 int i;
1417
1418 // Initialize the collision system
1419 CollideInitcxx . . $ CollideInit(49f6e7a06ebc5aa8).();
1420
1421 // Mark all the objects as unused
1422 ResetObjectListcxx . . $ ResetObjectList(49f6e7a06ebc5aa8).();
1423
1424 // Make sure no rooms are using any objects
1425 for (i = 0; i < MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!; i++) {
1426 Roomscxx . . $ Rooms.[i].objectscxx . . $ room#objects. = -1;
1427 Roomscxx . . $ Rooms.[i].vis_effectscxx . . $ room#vis_effects. = -1;
1428 }
1429
1430 InitVisEffectscxx . . $ InitVisEffects(49f6e7a06ebc5aa8).();
1431
1432 atexitcxx . . $ atexit(cc8c495369588262).(FreeAllObjectscxx . . $ FreeAllObjects(49f6e7a06ebc5aa8).);
1433 }
1434
1435 // link the object into the list for its room
1436 void ObjLinkcxx . . $ ObjLink(3e454b8ccf442868).(int objnum, int roomnum) {
1437 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
1438
1439 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum != -1);
1440
1441 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->roomnum == -1);
1442 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(obj->flags & OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!));
1443
1444 if ((obj->sizecxx . . $ object#size. >= MIN_BIG_OBJ_RADcxx . . $ `physics/findintersection.h:238:9`!) && (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum))) {
1445 BigObjAddcxx . . $ BigObjAdd(d4f767463ce0a6b3).(objnum);
1446 }
1447
1448 obj->roomnumcxx . . $ object#roomnum. = roomnum;
1449
1450 if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) {
1451 int cellnum = CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum);
1452
1453 obj->nextcxx . . $ object#next. = Terrain_segcxx . . $ Terrain_seg.[cellnum].objectscxx . . $ terrain_segment#objects.;
1454 Terrain_segcxx . . $ Terrain_seg.[cellnum].objectscxx . . $ terrain_segment#objects. = objnum;
1455
1456 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->next != objnum);
1457 } else {
1458 ASSERTcxx . . $ `misc/pserror.h:246:9`!(roomnum >= 0 && roomnum <= Highest_room_index);
1459 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(Rooms[roomnum].flags & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!));
1460
1461 obj->nextcxx . . $ object#next. = Roomscxx . . $ Rooms.[roomnum].objectscxx . . $ room#objects.;
1462 Roomscxx . . $ Rooms.[roomnum].objectscxx . . $ room#objects. = objnum;
1463 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->next != objnum);
1464 }
1465
1466 obj->prevcxx . . $ object#prev. = -1;
1467
1468 if (obj->nextcxx . . $ object#next. != -1)
1469 Objectscxx . . $ Objects.[obj->nextcxx . . $ object#next.].prevcxx . . $ object#prev. = objnum;
1470
1471 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[0].next != 0);
1472 if (Objectscxx . . $ Objects.[0].nextcxx . . $ object#next. == 0)
1473 Objectscxx . . $ Objects.[0].nextcxx . . $ object#next. = -1;
1474
1475 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[0].prev != 0);
1476 if (Objectscxx . . $ Objects.[0].prevcxx . . $ object#prev. == 0)
1477 Objectscxx . . $ Objects.[0].prevcxx . . $ object#prev. = -1;
1478 }
1479
1480 void ObjUnlinkcxx . . $ ObjUnlink(d4f767463ce0a6b3).(int objnum) {
1481 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
1482
1483 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum != -1);
1484
1485 // If object is already unlinked, do nothing
1486 if (obj->roomnumcxx . . $ object#roomnum. == -1) {
1487 return;
1488 }
1489
1490 if (obj->flagscxx . . $ object#flags. & OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!) {
1491 BigObjRemovecxx . . $ BigObjRemove(d4f767463ce0a6b3).(objnum);
1492 }
1493
1494 if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) {
1495 int cellnum = CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum);
1496
1497 terrain_segmentcxx . . $ terrain_segment# *seg = &Terrain_segcxx . . $ Terrain_seg.[cellnum];
1498
1499 if (obj->prevcxx . . $ object#prev. == -1)
1500 seg->objectscxx . . $ terrain_segment#objects. = obj->nextcxx . . $ object#next.;
1501 else
1502 Objectscxx . . $ Objects.[obj->prevcxx . . $ object#prev.].nextcxx . . $ object#next. = obj->nextcxx . . $ object#next.;
1503
1504 if (obj->nextcxx . . $ object#next. != -1)
1505 Objectscxx . . $ Objects.[obj->nextcxx . . $ object#next.].prevcxx . . $ object#prev. = obj->prevcxx . . $ object#prev.;
1506 } else {
1507 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[obj->roomnumcxx . . $ object#roomnum.];
1508
1509 if (obj->prevcxx . . $ object#prev. == -1)
1510 rp->objectscxx . . $ room#objects. = obj->nextcxx . . $ object#next.;
1511 else
1512 Objectscxx . . $ Objects.[obj->prevcxx . . $ object#prev.].nextcxx . . $ object#next. = obj->nextcxx . . $ object#next.;
1513
1514 if (obj->nextcxx . . $ object#next. != -1)
1515 Objectscxx . . $ Objects.[obj->nextcxx . . $ object#next.].prevcxx . . $ object#prev. = obj->prevcxx . . $ object#prev.;
1516 }
1517
1518 // Mark as not linked
1519 obj->roomnumcxx . . $ object#roomnum. = -1;
1520
1521 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[0].next != 0);
1522 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[0].prev != 0);
1523 }
1524
1525 //-----------------------------------------------------------------------------
1526 // Scan the object list, freeing down to num_used objects
1527 // Returns number of slots freed.
1528 int FreeObjectSlotscxx . . $ FreeObjectSlots(7864480464b09eea).(int num_used) {
1529 int i, olind;
1530 int obj_list[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!];
1531 int num_already_free, num_to_free, original_num_to_free;
1532
1533 olind = 0;
1534 num_already_free = MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - Highest_object_indexcxx . . $ Highest_object_index. - 1;
1535
1536 if (MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - num_already_free < num_used) {
1537 return 0;
1538 }
1539
1540 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
1541 if (Objectscxx . . $ Objects.[i].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) {
1542 num_already_free++;
1543 if (MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - num_already_free < num_used)
1544 return num_already_free;
1545 } else {
1546 switch (Objectscxx . . $ Objects.[i].typecxx . . $ object#type.) {
1547 case OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!:
1548 num_already_free++;
1549 if (MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - num_already_free < num_used)
1550 return 0;
1551 break;
1552 case OBJ_WALLcxx . . $ `Descent3/object_external.h:160:9`!:
1553 Int3cxx . . $ `misc/pserror.h:247:9`!(); // This is curious. What is an object that is a wall?
1554 break;
1555 case OBJ_FIREBALLcxx . . $ `Descent3/object_external.h:161:9`!:
1556 case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!:
1557 case OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!:
1558 case OBJ_SPLINTERcxx . . $ `Descent3/object_external.h:180:9`!:
1559 obj_list[olind++] = i;
1560 break;
1561 default:
1562 break;
1563 }
1564 }
1565 }
1566
1567 num_to_free = MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - num_used - num_already_free;
1568 original_num_to_free = num_to_free;
1569
1570 if (num_to_free > olind) {
1571 mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "Warning: Asked to free %i objects, but can only free %i.\n", num_to_free, olind);
1572 num_to_free = olind;
1573 }
1574
1575 for (i = 0; i < num_to_free; i++)
1576 if (Objectscxx . . $ Objects.[obj_list[i]].typecxx . . $ object#type. == OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!) {
1577 num_to_free--;
1578 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Freeing DEBRIS object %3i\n", obj_list[i]);
1579 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(&Objectscxx . . $ Objects.[obj_list[i]]);
1580 }
1581
1582 if (!num_to_free)
1583 return original_num_to_free;
1584
1585 if (!num_to_free)
1586 return original_num_to_free;
1587
1588 //@@for (i=0; i<num_to_free; i++)
1589 //@@ if ((Objects[obj_list[i]].type == OBJ_WEAPON)&& (Objects[obj_list[i]].id == FLARE_ID)) {
1590 //@@ num_to_free--;
1591 //@@ Objects[obj_list[i]].flags |= OF_DEAD;
1592 //@@ }
1593
1594 if (!num_to_free)
1595 return original_num_to_free;
1596
1597 for (i = 0; i < num_to_free; i++)
1598 if (Objectscxx . . $ Objects.[obj_list[i]].typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) {
1599 num_to_free--;
1600 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Freeing WEAPON object %3i\n", obj_list[i]);
1601 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(&Objectscxx . . $ Objects.[obj_list[i]]);
1602 }
1603
1604 return original_num_to_free - num_to_free;
1605 }
1606
1607 // returns the number of a free object, updating Highest_object_index.
1608 // Generally, ObjCreate() should be called to get an object, since it
1609 // fills in important fields and does the linking.
1610 // returns -1 if no free objects
1611 int ObjAllocatecxx . . $ ObjAllocate(b126dc7c1de90089).(void) {
1612 int objnum;
1613
1614 if (Num_objectscxx . . $ Num_objects. >= MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - 2) {
1615 int num_freed;
1616
1617 num_freed = FreeObjectSlotscxx . . $ FreeObjectSlots(7864480464b09eea).(MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - 10);
1618 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, " *** Freed %i objects in frame %i\n", num_freed, FrameCount);
1619 }
1620
1621 if (Num_objectscxx . . $ Num_objects. >= MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!) {
1622 mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "Object creation failed - too many objects!\n");
1623 return -1;
1624 }
1625
1626 objnum = free_obj_listcxx . . $ free_obj_list.[Num_objectscxx . . $ Num_objects.++];
1627
1628 if (objnum > Highest_object_indexcxx . . $ Highest_object_index.) {
1629 Highest_object_indexcxx . . $ Highest_object_index. = objnum;
1630 if (Highest_object_indexcxx . . $ Highest_object_index. > Highest_ever_object_indexcxx . . $ Highest_ever_object_index.) {
1631 Highest_ever_object_indexcxx . . $ Highest_ever_object_index. = Highest_object_indexcxx . . $ Highest_object_index.;
1632 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Highest ever Object %d\n", Highest_ever_object_index);
1633 }
1634 }
1635
1636 return objnum;
1637 }
1638
1639 // frees up an object. Generally, ObjDelete() should be called to get
1640 // rid of an object. This function deallocates the object entry after
1641 // the object has been unlinked
1642 void ObjFreecxx . . $ ObjFree(d4f767463ce0a6b3).(int objnum) {
1643 ObjFreePositionHistorycxx . . $ ObjFreePositionHistory(419c470199a90a97).(&Objectscxx . . $ Objects.[objnum]);
1644
1645 free_obj_listcxx . . $ free_obj_list.[--Num_objectscxx . . $ Num_objects.] = objnum;
1646 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Num_objects >= 0);
1647
1648 if (objnum == Highest_object_indexcxx . . $ Highest_object_index.)
1649 while (Objectscxx . . $ Objects.[--Highest_object_indexcxx . . $ Highest_object_index.].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!)
1650 ;
1651 }
1652
1653 void ObjSetAABBcxx . . $ ObjSetAABB(419c470199a90a97).(objectcxx . . $ object# *obj) {
1654 vectorcxx . . $ vector# object_rad;
1655
1656 if (obj->typecxx . . $ object#type. == OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!) {
1657 obj->min_xyzcxx . . $ object#min_xyz. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Roomscxx . . $ Rooms.[obj->idcxx . . $ object#id.].min_xyzcxx . . $ room#min_xyz.;
1658 obj->max_xyzcxx . . $ object#max_xyz. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Roomscxx . . $ Rooms.[obj->idcxx . . $ object#id.].max_xyzcxx . . $ room#max_xyz.;
1659 } else if (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`! && obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj->typecxx . . $ object#type. != OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`! &&
1660 obj->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && obj->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1661 vectorcxx . . $ vector# offset_pos;
1662
1663 object_rad.xcxx . . $ vector#x. = object_rad.ycxx . . $ vector#y. = object_rad.zcxx . . $ vector#z. = Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].anim_sizecxx . . $ poly_model#anim_size.;
1664 offset_pos =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). obj->anim_sphere_offsetcxx . . $ object#anim_sphere_offset.;
1665
1666 obj->min_xyzcxx . . $ object#min_xyz. =cxx . . $ vector#`operator=`(c0842353a20857d). offset_pos -cxx . . $ operator-(b77b703cd1e43e33). object_rad;
1667 obj->max_xyzcxx . . $ object#max_xyz. =cxx . . $ vector#`operator=`(c0842353a20857d). offset_pos +cxx . . $ operator+(b77b703cd1e43e33). object_rad;
1668 } else {
1669 object_rad.xcxx . . $ vector#x. = obj->sizecxx . . $ object#size.;
1670 object_rad.ycxx . . $ vector#y. = obj->sizecxx . . $ object#size.;
1671 object_rad.zcxx . . $ vector#z. = obj->sizecxx . . $ object#size.;
1672
1673 obj->min_xyzcxx . . $ object#min_xyz. =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). object_rad;
1674
1675 obj->max_xyzcxx . . $ object#max_xyz. =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). object_rad;
1676 }
1677 }
1678
1679 //-----------------------------------------------------------------------------
1680 // initialize a new object. adds to the list for the given room
1681 // returns the object number
1682 int ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(uint8_tcxx . . $ uint8_t# type, uint16_tcxx . . $ uint16_t# id, int roomnum, vectorcxx . . $ vector# *pos, const matrixcxx . . $ matrix# *orient, int parent_handle) {
1683 int objnum;
1684 objectcxx . . $ object# *obj;
1685 int handle;
1686
1687 ASSERTcxx . . $ `misc/pserror.h:246:9`!(type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!);
1688
1689 if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) {
1690 ASSERTcxx . . $ `misc/pserror.h:246:9`!(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) <= TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!);
1691 ASSERTcxx . . $ `misc/pserror.h:246:9`!(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) >= 0);
1692
1693 roomnum = GetTerrainRoomFromPoscxx . . $ GetTerrainRoomFromPos(177d9005acf670a0).(pos);
1694
1695 if (roomnum == -1)
1696 return -1;
1697 }
1698
1699 // Get next free object
1700 objnum = ObjAllocatecxx . . $ ObjAllocate(b126dc7c1de90089).();
1701 if (objnum == -1) // no free objects
1702 return -1;
1703 obj = &Objectscxx . . $ Objects.[objnum];
1704
1705 // Make sure the object is ok
1706 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!); // make sure unused
1707 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->roomnum == -1); // make sure unlinked
1708
1709 // Compute the new handle
1710 handle = obj->handlecxx . . $ object#handle. + HANDLE_COUNT_INCREMENTcxx . . $ `Descent3/object.h:644:9`!;
1711
1712 // Check for handle wrap
1713 if ((handle & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) == HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) // Going to wrap!
1714 Int3cxx . . $ `misc/pserror.h:247:9`!(); // Show this to Matt, or email him if he's not here
1715
1716 // Initialize the object
1717 if (!ObjInitcxx . . $ ObjInit(e978d4035b3bbb3f).(obj, type, id, handle, pos, Gametimecxx . . $ Gametime., parent_handle)) { // Couldn't init!
1718 obj->typecxx . . $ object#type. = OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!; // mark as unused
1719 ObjFreecxx . . $ ObjFree(d4f767463ce0a6b3).(objnum); // de-allocate object
1720 return -1;
1721 }
1722
1723 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1724 if (print_object_infocxx . . $ print_object_info.) {
1725 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Created object %d of type %d\n", objnum, obj->type);
1726 }
1727 #endif
1728
1729 // Set the object's orietation
1730 // THIS MUST BE DONE AFTER ObjInit (as ObjInit could load in a polymodel and set the anim and wall offsets)
1731 ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(obj, orient ? orient : &Identity_matrixcxx . . $ Identity_matrix.);
1732
1733 // Link object into room or terrain cell
1734 ObjLinkcxx . . $ ObjLink(3e454b8ccf442868).(objnum, roomnum);
1735
1736 // Type specific should have set up the size, so now we can compute the bounding box.
1737 ObjSetAABBcxx . . $ ObjSetAABB(419c470199a90a97).(obj);
1738
1739 // Let the demo system know about this object
1740 DemoWriteObjCreatecxx . . $ DemoWriteObjCreate(5b923f0d7a56193f).(type, id, roomnum, pos, orient, parent_handle, obj);
1741
1742 ObjInitPositionHistorycxx . . $ ObjInitPositionHistory(419c470199a90a97).(obj);
1743
1744 // Check bad init code that doesn't call ComputeDefaultSize()
1745 ASSERTcxx . . $ `misc/pserror.h:246:9`!(!(obj->type != OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`! && obj->type != OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`! && (obj->flags & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) &&
1746 !(Poly_models[obj->rtype.pobj_info.model_num].flags & PMF_SIZE_COMPUTEDcxx . . $ `lib/polymodel_external.h:226:9`!)));
1747
1748 // Done!
1749 return objnum;
1750 }
1751
1752 void ObjInitPositionHistorycxx . . $ ObjInitPositionHistory(419c470199a90a97).(objectcxx . . $ object# *obj) {
1753 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Object_map_position_history[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)] == -1);
1754
1755 // If it is one of the types of object's that we have to sample positions for
1756 // Initialize that
1757 switch (obj->typecxx . . $ object#type.) {
1758 case OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!:
1759 case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!:
1760 case OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!:
1761 if (Num_free_object_position_historycxx . . $ Num_free_object_position_history. > 0) {
1762 // we have a free slot
1763 Num_free_object_position_historycxx . . $ Num_free_object_position_history.--;
1764 int free_slot = Object_map_position_free_slotscxx . . $ Object_map_position_free_slots.[Num_free_object_position_historycxx . . $ Num_free_object_position_history.];
1765 Object_map_position_historycxx . . $ Object_map_position_history.[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)] = free_slot;
1766 int i;
1767 for (i = 0; i < MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`!; i++) {
1768 Object_position_samplescxx . . $ Object_position_samples.[free_slot].poscxx . . $ tPosHistory#pos.[i] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
1769 }
1770 } else {
1771 // out of slots!
1772 Object_map_position_historycxx . . $ Object_map_position_history.[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)] = -1;
1773 }
1774 break;
1775 default:
1776 // not saving positions
1777 Object_map_position_historycxx . . $ Object_map_position_history.[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)] = -1;
1778 break;
1779 }
1780 }
1781
1782 void ObjFreePositionHistorycxx . . $ ObjFreePositionHistory(419c470199a90a97).(objectcxx . . $ object# *obj) {
1783 int objnum = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
1784
1785 if (Object_map_position_historycxx . . $ Object_map_position_history.[objnum] != -1) {
1786 int slot_to_free = Object_map_position_historycxx . . $ Object_map_position_history.[objnum];
1787 Object_map_position_historycxx . . $ Object_map_position_history.[objnum] = -1;
1788
1789 Object_map_position_free_slotscxx . . $ Object_map_position_free_slots.[Num_free_object_position_historycxx . . $ Num_free_object_position_history.] = slot_to_free;
1790 Num_free_object_position_historycxx . . $ Num_free_object_position_history.++;
1791 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Num_free_object_position_history <= MAX_OBJECT_POS_HISTORYcxx . . $ `Descent3/object.h:821:9`!);
1792 }
1793 }
1794
1795 void ObjResetPositionHistorycxx . . $ ObjResetPositionHistory(49f6e7a06ebc5aa8).(void) {
1796 Num_free_object_position_historycxx . . $ Num_free_object_position_history. = MAX_OBJECT_POS_HISTORYcxx . . $ `Descent3/object.h:821:9`!;
1797 Object_position_headcxx . . $ Object_position_head. = 0;
1798
1799 int i;
1800
1801 for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) {
1802 Object_map_position_historycxx . . $ Object_map_position_history.[i] = -1;
1803
1804 if (i < MAX_OBJECT_POS_HISTORYcxx . . $ `Descent3/object.h:821:9`!) {
1805 // this array is guaranteed smaller than Objects[]
1806 // so instead of looping through an array again just for
1807 // this, I'll stick it in this loop.
1808 Object_map_position_free_slotscxx . . $ Object_map_position_free_slots.[i] = i;
1809 }
1810 }
1811
1812 for (i = 0; i < MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`!; i++) {
1813 Last_position_history_updatecxx . . $ Last_position_history_update.[i] = 0 - (0.1f * i);
1814 }
1815 }
1816
1817 void ObjReInitPositionHistorycxx . . $ ObjReInitPositionHistory(49f6e7a06ebc5aa8).(void) {
1818 ObjResetPositionHistorycxx . . $ ObjResetPositionHistory(49f6e7a06ebc5aa8).();
1819
1820 int i;
1821 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
1822 if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
1823 ObjInitPositionHistorycxx . . $ ObjInitPositionHistory(419c470199a90a97).(&Objectscxx . . $ Objects.[i]);
1824 }
1825 }
1826 }
1827
1828 extern void newdemo_record_guided_endcxx . . $ newdemo_record_guided_end(49f6e7a06ebc5aa8).();
1829
1830 // remove object from the world
1831 void ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(int objnum) {
1832 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
1833
1834 if (obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) {
1835 // unghost the object before destroying it
1836 ObjUnGhostObjectcxx . . $ ObjUnGhostObject(d4f767463ce0a6b3).(objnum);
1837 }
1838
1839 /* if ((Game_mode & GM_MULTI) && Netgame.local_role==LR_CLIENT && Objects[objnum].type==OBJ_POWERUP)
1840 {
1841 mprintf(0,"Deleting object number %d type=%d id=%d\n",objnum,obj->type,obj->id);
1842 }*/
1843
1844 if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (obj->flagscxx . . $ object#flags. & OF_SERVER_OBJECTcxx . . $ `Descent3/object_external.h:291:9`!)) {
1845 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`! && NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].sequencecxx . . $ netplayer#sequence. > NETSEQ_OBJECTScxx . . $ `Descent3/multi_external.h:158:9`! &&
1846 NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].sequencecxx . . $ netplayer#sequence. != NETSEQ_LEVEL_ENDcxx . . $ `Descent3/multi_external.h:162:9`!) {
1847 if (!(obj->flagscxx . . $ object#flags. & OF_SERVER_SAYS_DELETEcxx . . $ `Descent3/object_external.h:290:9`!)) {
1848 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Illegally deleting server object! Objnum=%d type=%d id=%d\n", objnum, obj->type, obj->id);
1849 Int3cxx . . $ `misc/pserror.h:247:9`!();
1850 return;
1851 }
1852 }
1853 }
1854
1855 if (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) {
1856 polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.;
1857 if (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1858 mem_freecxx . . $ `mem/mem.h:80:9`!(p_info->multi_turret_info.keyframes);
1859 mem_freecxx . . $ `mem/mem.h:80:9`!(p_info->multi_turret_info.last_keyframes);
1860
1861 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1862 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1863 }
1864 }
1865
1866 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum != -1);
1867 // ASSERT(objnum != 0 );
1868 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!);
1869 // ASSERT(obj != Player_object);
1870
1871 //?? if (obj->type==OBJ_WEAPON && obj->id==GUIDEDMISS_ID) {
1872 //?? int pnum=Objects[obj->ctype.laser_info.parent_num].id;
1873 //?? mprintf(0,"Deleting a guided missile! Player %d\n\n",pnum);
1874 //??
1875 //?? if (pnum!=Player_num) {
1876 //?? mprintf(0,"deleting missile that belongs to %d (%s)!\n",pnum,Players[pnum].callsign);
1877 //?? Guided_missile[pnum]=NULL;
1878 //?? }
1879 //?? else if (Newdemo_state==ND_STATE_RECORDING)
1880 //?? newdemo_record_guided_end();
1881 //??
1882 //?? }
1883
1884 if (obj == Viewer_objectcxx . . $ Viewer_object.) // deleting the viewer?
1885 Viewer_objectcxx . . $ Viewer_object. = Player_objectcxx . . $ Player_object.; //..make the player the viewer
1886
1887 // Delete this chase camera if needed
1888 if (Player_camera_objnumcxx . . $ Player_camera_objnum. == objnum)
1889 Player_camera_objnumcxx . . $ Player_camera_objnum. = -1;
1890
1891 //?? if (obj->flags & OF_ATTACHED) //detach this from object
1892 //?? obj_detach_one(obj);
1893 //??
1894 //?? if (obj->attached_obj != -1) //detach all objects from this
1895 //?? obj_detach_all(obj);
1896
1897 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1898 if (print_object_infocxx . . $ print_object_info.) {
1899 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Deleting object %d of type %d\n", objnum, Objects[objnum].type);
1900 }
1901 #endif
1902
1903 if (obj->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..parent_typecxx . . $ laser_info_s#parent_type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1904 int pnum = Objectscxx . . $ Objects.[(obj->parent_handlecxx . . $ object#parent_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!)].idcxx . . $ object#id.;
1905
1906 if (Playerscxx . . $ Players.[pnum].guided_objcxx . . $ player#guided_obj. == obj) {
1907 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Deleting a guided missile!");
1908 Playerscxx . . $ Players.[pnum].guided_objcxx . . $ player#guided_obj. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1909 }
1910 }
1911
1912 if (obj->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..parent_typecxx . . $ laser_info_s#parent_type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1913 int pnum = Objectscxx . . $ Objects.[(obj->parent_handlecxx . . $ object#parent_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!)].idcxx . . $ object#id.;
1914
1915 if (Playerscxx . . $ Players.[pnum].user_timeout_objcxx . . $ player#user_timeout_obj. == obj) {
1916 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Deleting a timeout missile!");
1917 Playerscxx . . $ Players.[pnum].user_timeout_objcxx . . $ player#user_timeout_obj. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1918 }
1919 }
1920
1921 ObjUnlinkcxx . . $ ObjUnlink(d4f767463ce0a6b3).(objnum);
1922
1923 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[0].next != 0);
1924
1925 // Update powerup respawn point
1926 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`!) {
1927 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].respawn_scalarcxx . . $ object_info#respawn_scalar. > 0) {
1928 for (int i = 0; i < Num_powerup_respawncxx . . $ Num_powerup_respawn.; i++) {
1929 if (Powerup_respawncxx . . $ Powerup_respawn.[i].usedcxx . . $ powerup_respawn#used. && Powerup_respawncxx . . $ Powerup_respawn.[i].objnumcxx . . $ powerup_respawn#objnum. == objnum) {
1930 Powerup_respawncxx . . $ Powerup_respawn.[i].usedcxx . . $ powerup_respawn#used. = 0;
1931 Powerup_respawncxx . . $ Powerup_respawn.[i].objnumcxx . . $ powerup_respawn#objnum. = -1;
1932 Powerup_timercxx . . $ Powerup_timer.[Num_powerup_timercxx . . $ Num_powerup_timer.].respawn_timecxx . . $ powerup_timer#respawn_time. =
1933 Gametimecxx . . $ Gametime. + (Netgamecxx . . $ Netgame..respawn_timecxx . . $ netgame_info#respawn_time. * Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].respawn_scalarcxx . . $ object_info#respawn_scalar.);
1934 Powerup_timercxx . . $ Powerup_timer.[Num_powerup_timercxx . . $ Num_powerup_timer.].idcxx . . $ powerup_timer#id. = obj->idcxx . . $ object#id.;
1935 Num_powerup_timercxx . . $ Num_powerup_timer.++;
1936 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Adding powerup id %d to respawn list! count=%d\n", obj->id, Num_powerup_timer);
1937 }
1938 }
1939 }
1940 }
1941
1942 // Kill any script thread associated with this object.
1943 FreeObjectScriptscxx . . $ FreeObjectScripts(674fac047436fc5b).(obj, false);
1944
1945 if (obj->custom_default_script_namecxx . . $ object#custom_default_script_name.) {
1946 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->custom_default_script_name);
1947 obj->custom_default_script_namecxx . . $ object#custom_default_script_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1948 }
1949
1950 if (obj->custom_default_module_namecxx . . $ object#custom_default_module_name.) {
1951 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->custom_default_module_name);
1952 obj->custom_default_module_namecxx . . $ object#custom_default_module_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1953 }
1954
1955 obj->typecxx . . $ object#type. = OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!; // unused!
1956 obj->roomnumcxx . . $ object#roomnum. = -1; // zero it!
1957
1958 // Free lightmap memory
1959 if (obj->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used.)
1960 ClearObjectLightmapscxx . . $ ClearObjectLightmaps(419c470199a90a97).(obj);
1961
1962 // Free up effects memory
1963 if (obj->effect_infocxx . . $ object#effect_info.) {
1964 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->effect_info);
1965 obj->effect_infocxx . . $ object#effect_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1966 }
1967
1968 if (obj->ai_infocxx . . $ object#ai_info. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1969 AIDestroyObjcxx . . $ AIDestroyObj(419c470199a90a97).(obj);
1970 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->ai_info);
1971 obj->ai_infocxx . . $ object#ai_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1972 }
1973
1974 if (obj->dynamic_wbcxx . . $ object#dynamic_wb. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1975 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->dynamic_wb);
1976 obj->dynamic_wbcxx . . $ object#dynamic_wb. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1977 }
1978
1979 if (obj->attach_childrencxx . . $ object#attach_children. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1980 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->attach_children);
1981 obj->attach_childrencxx . . $ object#attach_children. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1982 }
1983
1984 if (obj->namecxx . . $ object#name.) {
1985 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->name);
1986 obj->namecxx . . $ object#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1987 }
1988
1989 if (obj->lighting_infocxx . . $ object#lighting_info.) {
1990 mem_freecxx . . $ `mem/mem.h:80:9`!(obj->lighting_info);
1991 obj->lighting_infocxx . . $ object#lighting_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1992 }
1993
1994 ObjFreecxx . . $ ObjFree(d4f767463ce0a6b3).(objnum);
1995 }
1996
1997 // Frees all the objects that are currently in use
1998 void FreeAllObjectscxx . . $ FreeAllObjects(49f6e7a06ebc5aa8).() {
1999 int objnum;
2000
2001 for (objnum = 0; objnum <= Highest_object_indexcxx . . $ Highest_object_index.; objnum++)
2002 if (Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
2003 Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. |= OF_SERVER_SAYS_DELETEcxx . . $ `Descent3/object_external.h:290:9`!;
2004 Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. &= ~OF_INPLAYERINVENTORYcxx . . $ `Descent3/object_external.h:299:9`!;
2005 ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(objnum);
2006 }
2007
2008 FreeAllVisEffectscxx . . $ FreeAllVisEffects(49f6e7a06ebc5aa8).();
2009 }
2010
2011 // ------------------------------------------------------------------------------------------------------------------
2012 void ObjDeleteDeadcxx . . $ ObjDeleteDead(49f6e7a06ebc5aa8).() {
2013 int i;
2014 objectcxx . . $ object# *objp;
2015 int local_dead_player_object = -1;
2016
2017 // Move all objects
2018 objp = Objectscxx . . $ Objects.;
2019
2020 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
2021 if ((objp->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (objp->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)) {
2022 if (objp->flagscxx . . $ object#flags. & OF_INFORM_DESTROY_TO_LGcxx . . $ `Descent3/object_external.h:302:9`!) {
2023 Level_goalscxx . . $ Level_goals..Informcxx . . $ levelgoals#Inform(8589f1c7c2d24df6).(LIT_OBJECTcxx . . $ `Descent3/levelgoal_external.h:28:9`!, LGF_COMP_DESTROYcxx . . $ `Descent3/levelgoal_external.h:48:9`!, objp->handlecxx . . $ object#handle.);
2024 }
2025
2026 if (objp->flagscxx . . $ object#flags. & OF_INPLAYERINVENTORYcxx . . $ `Descent3/object_external.h:299:9`!) {
2027 // this object is in a player inventory somewhere...remove it first!
2028 InventoryRemoveObjectcxx . . $ InventoryRemoveObject(d4f767463ce0a6b3).(objp->handlecxx . . $ object#handle.);
2029 }
2030
2031 if (objp->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) {
2032 // unghost the object before deleting it
2033 ObjUnGhostObjectcxx . . $ ObjUnGhostObject(d4f767463ce0a6b3).(i);
2034
2035 // tell clients to unghost
2036 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`!)) {
2037 MultiSendGhostObjectcxx . . $ MultiSendGhostObject(674fac047436fc5b).(&Objectscxx . . $ Objects.[i], false);
2038 }
2039 }
2040
2041 if (objp->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) {
2042 if (objp->flagscxx . . $ object#flags. & OF_ATTACHEDcxx . . $ `Descent3/object_external.h:273:9`!) {
2043 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
2044 ei.evt_child_diedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_child_died..it_handlecxx . . $ tOSIRISEVTCHILDDIED#it_handle. = objp->handlecxx . . $ object#handle.;
2045
2046 Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(ObjGetcxx . . $ ObjGet(11672e354c0b263a).(objp->attach_ultimate_handlecxx . . $ object#attach_ultimate_handle.), EVT_CHILD_DIEDcxx . . $ `scripts/osiris_common.h:393:9`!, &ei);
2047 }
2048
2049 UnattachFromParentcxx . . $ UnattachFromParent(39516aeee13ca5ab).(objp);
2050 UnattachChildrencxx . . $ UnattachChildren(39516aeee13ca5ab).(objp);
2051 }
2052
2053 // Execute script for death
2054 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
2055 ei.evt_destroycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_destroy..is_dyingcxx . . $ tOSIRISEVTDESTROY#is_dying. = 1;
2056 Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(objp, EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!, &ei);
2057
2058 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
2059 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = objp->handlecxx . . $ object#handle.;
2060 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEOBJDESTROYEDcxx . . $ `lib/d3events.h:80:9`!, &DLLInfocxx . . $ DLLInfo.);
2061 }
2062
2063 // detach any scripts attached
2064 Osiris_DetachScriptsFromObjectcxx . . $ Osiris_DetachScriptsFromObject(419c470199a90a97).(objp);
2065
2066 // if it's flag to tell the clients to remove is set, tell them now
2067 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`!)) {
2068 bool removed = false;
2069
2070 if (objp->flagscxx . . $ object#flags. & OF_SEND_MULTI_REMOVE_ON_DEATHcxx . . $ `Descent3/object_external.h:294:9`!) {
2071 // Tell all clients to remove this object
2072 MultiSendRemoveObjectcxx . . $ MultiSendRemoveObject(eb56a3b53eea6ace).(objp, 0);
2073 removed = true;
2074 }
2075 if (!removed && objp->flagscxx . . $ object#flags. & OF_SEND_MULTI_REMOVE_ON_DEATHWScxx . . $ `Descent3/object_external.h:296:9`!) {
2076 // Tell all clients to remove this object with sound
2077 MultiSendRemoveObjectcxx . . $ MultiSendRemoveObject(eb56a3b53eea6ace).(objp, 1);
2078 removed = true;
2079 }
2080 }
2081
2082 if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(objp)) {
2083 int i;
2084 int handle = objp->handlecxx . . $ object#handle.;
2085
2086 for (i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) {
2087 if (objp->handlecxx . . $ object#handle. == Buddy_handlecxx . . $ Buddy_handle.[i]) {
2088 Buddy_handlecxx . . $ Buddy_handle.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
2089 break;
2090 }
2091 }
2092 }
2093
2094 // check if player being killed.
2095 if (objp->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2096 ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i);
2097 }
2098 }
2099 objp++;
2100 }
2101
2102 // Delete our visual effects
2103 VisEffectDeleteDeadcxx . . $ VisEffectDeleteDead(49f6e7a06ebc5aa8).();
2104 }
2105
2106 // when an object has moved into a new room, this function unlinks it
2107 // from its old room and links it into the new room
2108 void ObjRelinkcxx . . $ ObjRelink(3e454b8ccf442868).(int objnum, int newroomnum) {
2109 ASSERTcxx . . $ `misc/pserror.h:246:9`!((objnum >= 0) && (objnum <= Highest_object_index));
2110
2111 if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(newroomnum)) {
2112 ASSERTcxx . . $ `misc/pserror.h:246:9`!((newroomnum <= Highest_room_index) && (newroomnum >= 0));
2113 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Rooms[newroomnum].used);
2114 } else
2115 ASSERTcxx . . $ `misc/pserror.h:246:9`!(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(newroomnum) >= 0 && CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(newroomnum) <= (TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!));
2116
2117 ObjUnlinkcxx . . $ ObjUnlink(d4f767463ce0a6b3).(objnum);
2118 ObjLinkcxx . . $ ObjLink(3e454b8ccf442868).(objnum, newroomnum);
2119 }
2120
2121 void DoCycledAnimcxx . . $ DoCycledAnim(419c470199a90a97).(objectcxx . . $ object# *obj) {
2122 float from;
2123 float to;
2124 float delta;
2125 float spc;
2126
2127 float anim_time = Frametimecxx . . $ Frametime.;
2128
2129 if (!(obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!))
2130 return;
2131
2132 from = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!].elemcxx . . $ anim_elem#elem.[AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!].fromcxx . . $ anim_entry#from.;
2133 to = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!].elemcxx . . $ anim_elem#elem.[AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!].tocxx . . $ anim_entry#to.;
2134 spc = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!].elemcxx . . $ anim_elem#elem.[AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!].spccxx . . $ anim_entry#spc.;
2135
2136 if (spc <= 0.0)
2137 return;
2138 ASSERTcxx . . $ `misc/pserror.h:246:9`!(from <= to);
2139
2140 if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. < from || obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. > to) {
2141 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "NonAI-Animation: Correcting for an incorrect frame number\n");
2142 obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. = from;
2143 }
2144
2145 delta = to - from;
2146
2147 ASSERTcxx . . $ `misc/pserror.h:246:9`!(delta >= 0.0f);
2148
2149 if (delta > 0.0f) {
2150 // Frames per second will be on the animation page
2151 float step = (1.0f / (spc / (delta))) * anim_time;
2152
2153 while (step > delta) {
2154 step -= delta;
2155 }
2156
2157 ASSERTcxx . . $ `misc/pserror.h:246:9`!(step >= 0.0f);
2158
2159 obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. += step;
2160
2161 if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. >= to) {
2162
2163 // We are guarenteed that this is between 'to' and 'from' from the above asserts() :)
2164 obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. -= delta;
2165 }
2166 } else {
2167 obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. = from;
2168 }
2169
2170 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->rtype.pobj_info.anim_frame >= from && obj->rtype.pobj_info.anim_frame <= to);
2171 }
2172
2173 void TimeoutObjectcxx . . $ TimeoutObject(419c470199a90a97).(objectcxx . . $ object# *obj) {
2174 switch (obj->typecxx . . $ object#type.) {
2175 case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!:
2176 TimeoutWeaponcxx . . $ TimeoutWeapon(419c470199a90a97).(obj);
2177 break;
2178 case OBJ_SHOCKWAVEcxx . . $ `Descent3/object_external.h:170:9`!:
2179 DoConcussiveForcecxx . . $ DoConcussiveForce(dc43bf10ea54b482).(obj, obj->parent_handlecxx . . $ object#parent_handle.);
2180 break;
2181 default:
2182 break;
2183 }
2184 }
2185
2186 // Does afterburn effects to a player ship
2187 void DoPlayerAfterburnControlcxx . . $ DoPlayerAfterburnControl(6fc1192618b37bc8).(game_controlscxx . . $ game_controls# *controls, objectcxx . . $ object# *objp) {
2188 static int afterburner_id = -1;
2189 int slot = objp->idcxx . . $ object#id.;
2190
2191 if (controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. > 0) {
2192 Playerscxx . . $ Players.[slot].last_afterburner_timecxx . . $ player#last_afterburner_time. = Gametimecxx . . $ Gametime.;
2193
2194 if (Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. > 0) {
2195 float punch_scalar = 1.0;
2196
2197 if (Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. == (AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`!))
2198 AddToShakeMagnitudecxx . . $ AddToShakeMagnitude(9364e6e7bff7660).(objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass. / 2);
2199
2200 if (Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. > (AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`! * .90))
2201 punch_scalar = 1.8f;
2202 else if (Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. > (AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`! * .80) &&
2203 Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. < (AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`! * .90)) {
2204 float norm = Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. - (AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`! * .80);
2205 norm /= (AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`! * .1);
2206 punch_scalar = 1.0 + (norm * .8);
2207 }
2208
2209 if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(objp))
2210 controls->forward_thrustcxx . . $ game_controls#forward_thrust. = controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. * 1.6 * punch_scalar;
2211 else
2212 controls->forward_thrustcxx . . $ game_controls#forward_thrust. = controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. * 1.6 * punch_scalar;
2213
2214 Playerscxx . . $ Players.[slot].flagscxx . . $ player#flags. |= PLAYER_FLAGS_AFTERBURN_ONcxx . . $ `Descent3/player_external.h:92:9`! | PLAYER_FLAGS_THRUSTEDcxx . . $ `Descent3/player_external.h:94:9`!;
2215 Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. -= Frametimecxx . . $ Frametime.;
2216 if (Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. < 0)
2217 Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. = 0;
2218 } else {
2219 Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. = 0;
2220 Playerscxx . . $ Players.[slot].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_AFTERBURN_ONcxx . . $ `Descent3/player_external.h:92:9`!;
2221 }
2222 } else {
2223 Playerscxx . . $ Players.[slot].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_AFTERBURN_ONcxx . . $ `Descent3/player_external.h:92:9`!;
2224
2225 if (Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. < AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`!) {
2226 if (Playerscxx . . $ Players.[slot].energycxx . . $ player#energy. > 5.0) {
2227 float useage;
2228 if (afterburner_id == -1)
2229 afterburner_id = FindObjectIDNamecxx . . $ FindObjectIDName(5c4306d8553b3696).("Afterburner");
2230
2231 if (afterburner_id != -1 && Playerscxx . . $ Players.[slot].inventorycxx . . $ player#inventory..CheckItemcxx . . $ Inventory#CheckItem(cf9ef193275fa6d8).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, afterburner_id))
2232 useage = Frametimecxx . . $ Frametime. * 2;
2233 else
2234 useage = Frametimecxx . . $ Frametime.;
2235
2236 Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. += useage;
2237 Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left. = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<float>(AFTERBURN_TIMEcxx . . $ `Descent3/player.h:394:9`!, Playerscxx . . $ Players.[slot].afterburn_time_leftcxx . . $ player#afterburn_time_left.);
2238
2239 Playerscxx . . $ Players.[slot].energycxx . . $ player#energy. -= (useage);
2240 }
2241 }
2242 }
2243 }
2244
2245 // Deal with the player's rear view
2246 void CheckRearViewcxx . . $ CheckRearView(918ebd27a9ddbad3).(int down_count, bool down_state) {
2247 playercxx . . $ player# *player = &Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.];
2248
2249 #define LEAVE_TIMEcxx . . $ `Descent3/object.cpp:2249:9`! (1.0 / 16) // How long until we decide key is down
2250
2251 static bool leave_mode;
2252 static float entry_time;
2253
2254 if (down_count) { // key/button has gone down
2255
2256 if (player->flagscxx . . $ player#flags. & PLAYER_FLAGS_REARVIEWcxx . . $ `Descent3/player_external.h:97:9`!) { // rear view was active, so turn it off
2257 player->flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_REARVIEWcxx . . $ `Descent3/player_external.h:97:9`!;
2258 } else { // rear view wasn't active, so turn it on
2259 player->flagscxx . . $ player#flags. |= PLAYER_FLAGS_REARVIEWcxx . . $ `Descent3/player_external.h:97:9`!;
2260 leave_mode = 0; // means wait for another key
2261 entry_time = Gametimecxx . . $ Gametime.;
2262 }
2263 } else { // key didn't go down this frame; check if it used to be down
2264
2265 if (down_state) { // key is still down
2266
2267 if (!leave_mode && ((Gametimecxx . . $ Gametime. - entry_time) > LEAVE_TIMEcxx . . $ `Descent3/object.cpp:2249:9`!))
2268 leave_mode = 1;
2269 } else {
2270
2271 if (leave_mode && (player->flagscxx . . $ player#flags. & PLAYER_FLAGS_REARVIEWcxx . . $ `Descent3/player_external.h:97:9`!)) {
2272 player->flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_REARVIEWcxx . . $ `Descent3/player_external.h:97:9`!;
2273 }
2274 }
2275 }
2276 }
2277
2278 extern int Timedemo_framecxx . . $ Timedemo_frame.;
2279 float Timedemo_timecountcxx . . $ Timedemo_timecount.;
2280
2281 // Do the controls for a player-type object
2282 void DoFlyingControlcxx . . $ DoFlyingControl(419c470199a90a97).(objectcxx . . $ object# *objp) {
2283 game_controlscxx . . $ game_controls# controls;
2284
2285 if (Dedicated_servercxx . . $ Dedicated_server.)
2286 return;
2287
2288 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->control_type == CT_FLYINGcxx . . $ `Descent3/object_external.h:219:9`!);
2289
2290 if ((objp->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && objp->typecxx . . $ object#type. != OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) || objp->idcxx . . $ object#id. != Player_numcxx . . $ Player_num.)
2291 return;
2292
2293 if (Timedemo_framecxx . . $ Timedemo_frame. != -1) {
2294 matrixcxx . . $ matrix# temp_mat, rot_mat;
2295
2296 if (Timedemo_framecxx . . $ Timedemo_frame. == 0) {
2297 Timedemo_timecountcxx . . $ Timedemo_timecount. = 0;
2298 } else {
2299 Timedemo_timecountcxx . . $ Timedemo_timecount. += Frametimecxx . . $ Frametime.;
2300 }
2301
2302 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&temp_mat, 0, 65536 / 360, 0);
2303
2304 rot_mat =cxx . . $ matrix#`operator=`(e859ffc26b91394f). objp->orientcxx . . $ object#orient. *cxx . . $ `operator*`(683f8e040c904cb). temp_mat;
2305
2306 ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(objp, &rot_mat);
2307
2308 Timedemo_framecxx . . $ Timedemo_frame.++;
2309 if (Timedemo_framecxx . . $ Timedemo_frame. == 360) {
2310 // Calculate timedemo framerate
2311
2312 float fps = 1.0 / (Timedemo_timecountcxx . . $ Timedemo_timecount. / 360.0);
2313 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_TIMEDEMOcxx . . $ `Descent3/stringtable.h:694:9`!, fps);
2314 Timedemo_framecxx . . $ Timedemo_frame. = -1;
2315 }
2316
2317 return;
2318 }
2319 if (Demo_flagscxx . . $ Demo_flags. == DF_PLAYBACKcxx . . $ `lib/demofile.h:123:9`!) {
2320 // If we are playing back a demo, bail early and don't process controls
2321 return;
2322 }
2323
2324 // Read the controllers
2325 ReadPlayerControlscxx . . $ ReadPlayerControls(728771fc1cd83448).(&controls);
2326
2327 if ((objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && (Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].controller_bitflagscxx . . $ player#controller_bitflags. != 0xffffffff)) {
2328 playercxx . . $ player# *pp = &Playerscxx . . $ Players.[objp->idcxx . . $ object#id.];
2329 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_FORWARDcxx . . $ `Descent3/player_external.h:112:9`!)) {
2330 if (controls.forward_thrustcxx . . $ game_controls#forward_thrust. > 0.0f)
2331 controls.forward_thrustcxx . . $ game_controls#forward_thrust. = 0.0f;
2332 }
2333 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_REVERSEcxx . . $ `Descent3/player_external.h:113:9`!)) {
2334 if (controls.forward_thrustcxx . . $ game_controls#forward_thrust. < 0.0f)
2335 controls.forward_thrustcxx . . $ game_controls#forward_thrust. = 0.0f;
2336 }
2337 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_LEFTcxx . . $ `Descent3/player_external.h:114:9`!)) {
2338 if (controls.sideways_thrustcxx . . $ game_controls#sideways_thrust. < 0.0f)
2339 controls.sideways_thrustcxx . . $ game_controls#sideways_thrust. = 0.0f;
2340 }
2341 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_RIGHTcxx . . $ `Descent3/player_external.h:115:9`!)) {
2342 if (controls.sideways_thrustcxx . . $ game_controls#sideways_thrust. > 0.0f)
2343 controls.sideways_thrustcxx . . $ game_controls#sideways_thrust. = 0.0f;
2344 }
2345 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_UPcxx . . $ `Descent3/player_external.h:116:9`!)) {
2346 if (controls.vertical_thrustcxx . . $ game_controls#vertical_thrust. > 0.0f)
2347 controls.vertical_thrustcxx . . $ game_controls#vertical_thrust. = 0.0f;
2348 }
2349 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_DOWNcxx . . $ `Descent3/player_external.h:117:9`!)) {
2350 if (controls.vertical_thrustcxx . . $ game_controls#vertical_thrust. < 0.0f)
2351 controls.vertical_thrustcxx . . $ game_controls#vertical_thrust. = 0.0f;
2352 }
2353 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_PITCHUPcxx . . $ `Descent3/player_external.h:118:9`!)) {
2354 if (controls.pitch_thrustcxx . . $ game_controls#pitch_thrust. > 0.0f)
2355 controls.pitch_thrustcxx . . $ game_controls#pitch_thrust. = 0.0f;
2356 }
2357 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_PITCHDOWNcxx . . $ `Descent3/player_external.h:119:9`!)) {
2358 if (controls.pitch_thrustcxx . . $ game_controls#pitch_thrust. < 0.0f)
2359 controls.pitch_thrustcxx . . $ game_controls#pitch_thrust. = 0.0f;
2360 }
2361 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_HEADINGLEFTcxx . . $ `Descent3/player_external.h:120:9`!)) {
2362 if (controls.heading_thrustcxx . . $ game_controls#heading_thrust. < 0.0f)
2363 controls.heading_thrustcxx . . $ game_controls#heading_thrust. = 0.0f;
2364 }
2365 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_HEADINGRIGHTcxx . . $ `Descent3/player_external.h:121:9`!)) {
2366 if (controls.heading_thrustcxx . . $ game_controls#heading_thrust. > 0.0f)
2367 controls.heading_thrustcxx . . $ game_controls#heading_thrust. = 0.0f;
2368 }
2369 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_BANKLEFTcxx . . $ `Descent3/player_external.h:122:9`!)) {
2370 if (controls.bank_thrustcxx . . $ game_controls#bank_thrust. < 0.0f)
2371 controls.bank_thrustcxx . . $ game_controls#bank_thrust. = 0.0f;
2372 }
2373 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_BANKRIGHTcxx . . $ `Descent3/player_external.h:123:9`!)) {
2374 if (controls.bank_thrustcxx . . $ game_controls#bank_thrust. > 0.0f)
2375 controls.bank_thrustcxx . . $ game_controls#bank_thrust. = 0.0f;
2376 }
2377 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_PRIMARYcxx . . $ `Descent3/player_external.h:124:9`!)) {
2378 controls.fire_primary_down_countcxx . . $ game_controls#fire_primary_down_count. = 0;
2379 controls.fire_primary_down_timecxx . . $ game_controls#fire_primary_down_time. = 0;
2380 controls.fire_primary_down_statecxx . . $ game_controls#fire_primary_down_state. = false;
2381 }
2382 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_SECONDARYcxx . . $ `Descent3/player_external.h:125:9`!)) {
2383 controls.fire_secondary_down_countcxx . . $ game_controls#fire_secondary_down_count. = 0;
2384 controls.fire_secondary_down_timecxx . . $ game_controls#fire_secondary_down_time. = 0;
2385 controls.fire_secondary_down_statecxx . . $ game_controls#fire_secondary_down_state. = false;
2386 }
2387 if (!(pp->controller_bitflagscxx . . $ player#controller_bitflags. & PCBF_AFTERBURNERcxx . . $ `Descent3/player_external.h:126:9`!)) {
2388 controls.afterburn_thrustcxx . . $ game_controls#afterburn_thrust. = 0.0f;
2389 }
2390 }
2391
2392 // Send an event to the Game DLLs so they can do any processing of game controls
2393 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
2394 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = objp->handlecxx . . $ object#handle.;
2395 DLLInfocxx . . $ DLLInfo..special_datacxx . . $ dllinfo#special_data. = (uint8_tcxx . . $ uint8_t# *)&controls;
2396 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEDOCONTROLScxx . . $ `lib/d3events.h:77:9`!, &DLLInfocxx . . $ DLLInfo.);
2397 }
2398
2399 // Deal with afterburner
2400 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2401 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Player_num == objp->id);
2402
2403 // Reset thrusting
2404 Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_THRUSTEDcxx . . $ `Descent3/player_external.h:94:9`!;
2405
2406 DoPlayerAfterburnControlcxx . . $ DoPlayerAfterburnControl(6fc1192618b37bc8).(&controls, objp);
2407 }
2408
2409 // Update object's physics
2410 if (objp->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) {
2411 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].guided_objcxx . . $ player#guided_obj. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
2412 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->id == Player_num);
2413 objectcxx . . $ object# *g_obj = Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].guided_objcxx . . $ player#guided_obj.;
2414
2415 g_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..xcxx . . $ vector#x. = controls.pitch_thrustcxx . . $ game_controls#pitch_thrust. * g_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
2416 g_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..zcxx . . $ vector#z. = controls.bank_thrustcxx . . $ game_controls#bank_thrust. * g_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
2417 g_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..ycxx . . $ vector#y. = controls.heading_thrustcxx . . $ game_controls#heading_thrust. * g_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust.;
2418 } else {
2419 playercxx . . $ player# *playp = &Playerscxx . . $ Players.[objp->idcxx . . $ object#id.];
2420
2421 objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..xcxx . . $ vector#x. =
2422 controls.pitch_thrustcxx . . $ game_controls#pitch_thrust. * objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust. * playp->turn_scalarcxx . . $ player#turn_scalar.;
2423 objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..zcxx . . $ vector#z. =
2424 controls.bank_thrustcxx . . $ game_controls#bank_thrust. * objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust. * playp->turn_scalarcxx . . $ player#turn_scalar.;
2425 objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust..ycxx . . $ vector#y. =
2426 controls.heading_thrustcxx . . $ game_controls#heading_thrust. * objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_rotthrustcxx . . $ physics_info#$anonymous_type_4#full_rotthrust. * playp->turn_scalarcxx . . $ player#turn_scalar.;
2427 }
2428
2429 float speed_scalar = 1.0;
2430
2431 // If thrusting foward, show glow
2432 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && controls.forward_thrustcxx . . $ game_controls#forward_thrust. > 0)
2433 Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].flagscxx . . $ player#flags. |= PLAYER_FLAGS_THRUSTEDcxx . . $ `Descent3/player_external.h:94:9`!;
2434
2435 if (objp->effect_infocxx . . $ object#effect_info. && objp->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FREEZEcxx . . $ `Descent3/object_external.h:203:9`!)
2436 speed_scalar = objp->effect_infocxx . . $ object#effect_info.->freeze_scalarcxx . . $ effect_info_s#freeze_scalar.;
2437
2438 if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(objp))
2439 speed_scalar *= 1.3f;
2440
2441 objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. =cxx . . $ vector#`operator=`(c0842353a20857d). speed_scalar * Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].movement_scalarcxx . . $ player#movement_scalar. *cxx . . $ `operator*`(9d6577ff3e9faa29).
2442 ((objp->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). controls.forward_thrustcxx . . $ game_controls#forward_thrust. *cxx . . $ `operator*`(252247219a31502c). objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_thrustcxx . . $ physics_info#$anonymous_type_3#full_thrust.) +cxx . . $ operator+(b77b703cd1e43e33).
2443 (objp->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). controls.vertical_thrustcxx . . $ game_controls#vertical_thrust. *cxx . . $ `operator*`(252247219a31502c). objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_thrustcxx . . $ physics_info#$anonymous_type_3#full_thrust.) +cxx . . $ operator+(b77b703cd1e43e33).
2444 (objp->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). controls.sideways_thrustcxx . . $ game_controls#sideways_thrust. *cxx . . $ `operator*`(252247219a31502c). objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..full_thrustcxx . . $ physics_info#$anonymous_type_3#full_thrust.));
2445 }
2446
2447 // Process player-specific stuff
2448 if (objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2449 // Process weapon firing
2450 FireWeaponFromPlayercxx . . $ FireWeaponFromPlayer(c0304a89cf526e9b).(objp, PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!, controls.fire_primary_down_countcxx . . $ game_controls#fire_primary_down_count., controls.fire_primary_down_statecxx . . $ game_controls#fire_primary_down_state.,
2451 controls.fire_primary_down_timecxx . . $ game_controls#fire_primary_down_time.);
2452 FireWeaponFromPlayercxx . . $ FireWeaponFromPlayer(c0304a89cf526e9b).(objp, PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!, controls.fire_secondary_down_countcxx . . $ game_controls#fire_secondary_down_count., controls.fire_secondary_down_statecxx . . $ game_controls#fire_secondary_down_state.,
2453 controls.fire_secondary_down_timecxx . . $ game_controls#fire_secondary_down_time.);
2454
2455 // Deal with the flare
2456 for (int i = 0; i < controls.fire_flare_down_countcxx . . $ game_controls#fire_flare_down_count.; i++)
2457 FireFlareFromPlayercxx . . $ FireFlareFromPlayer(419c470199a90a97).(objp);
2458
2459 // Do rear view
2460 CheckRearViewcxx . . $ CheckRearView(918ebd27a9ddbad3).(controls.rearview_down_countcxx . . $ game_controls#rearview_down_count., controls.rearview_down_statecxx . . $ game_controls#rearview_down_state.);
2461 }
2462 }
2463
2464 // Do any special effects processing for this object
2465 void ObjDoEffectscxx . . $ ObjDoEffects(419c470199a90a97).(objectcxx . . $ object# *obj) {
2466 if (!obj->effect_infocxx . . $ object#effect_info.)
2467 return;
2468
2469 static int napalm_id = -1;
2470
2471 if (napalm_id == -1)
2472 napalm_id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("Napalm");
2473
2474 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VOLUME_CHANGINGcxx . . $ `Descent3/object_external.h:202:9`!) {
2475 obj->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time. -= Frametimecxx . . $ Frametime.;
2476 if (obj->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time. <= 0.0f) {
2477 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_VOLUME_CHANGINGcxx . . $ `Descent3/object_external.h:202:9`!;
2478 }
2479 }
2480
2481 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FADING_INcxx . . $ `Descent3/object_external.h:206:9`!) {
2482 obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. -= Frametimecxx . . $ Frametime.;
2483 if (obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. <= 0.0f) {
2484 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_FADING_INcxx . . $ `Descent3/object_external.h:206:9`!;
2485 }
2486 }
2487
2488 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!) {
2489 obj->effect_infocxx . . $ object#effect_info.->cloak_timecxx . . $ effect_info_s#cloak_time. -= Frametimecxx . . $ Frametime.;
2490 if (obj->effect_infocxx . . $ object#effect_info.->cloak_timecxx . . $ effect_info_s#cloak_time. <= 0.0f) {
2491 // reappear the object
2492 MakeObjectVisiblecxx . . $ MakeObjectVisible(419c470199a90a97).(obj);
2493 }
2494 }
2495
2496 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FADING_OUTcxx . . $ `Descent3/object_external.h:207:9`!) {
2497 obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. -= Frametimecxx . . $ Frametime.;
2498 if (obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. <= 0.0f) {
2499 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_FADING_OUTcxx . . $ `Descent3/object_external.h:207:9`!;
2500 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!;
2501 }
2502 }
2503
2504 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_LIQUIDcxx . . $ `Descent3/object_external.h:208:9`!) {
2505 obj->effect_infocxx . . $ object#effect_info.->liquid_time_leftcxx . . $ effect_info_s#liquid_time_left. -= Frametimecxx . . $ Frametime.;
2506 if (obj->effect_infocxx . . $ object#effect_info.->liquid_time_leftcxx . . $ effect_info_s#liquid_time_left. <= 0.0f) {
2507 // Stop doing liquid effect
2508 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_LIQUIDcxx . . $ `Descent3/object_external.h:208:9`!;
2509 if (obj == Viewer_objectcxx . . $ Viewer_object.)
2510 Render_FOVcxx . . $ Render_FOV. = D3_DEFAULT_FOVcxx . . $ `Descent3/descent.h:176:9`!;
2511 } else {
2512 if (obj == Viewer_objectcxx . . $ Viewer_object.) {
2513 int inttime = Gametimecxx . . $ Gametime.;
2514 float normtime = Gametimecxx . . $ Gametime. - inttime;
2515
2516 float scalar = FixSincxx . . $ FixSin(9a38df040a81ca35).(normtime * 65535 * 4);
2517
2518 scalar *= ((float)obj->effect_infocxx . . $ object#effect_info.->liquid_magcxx . . $ effect_info_s#liquid_mag.);
2519 if (obj->effect_infocxx . . $ object#effect_info.->liquid_time_leftcxx . . $ effect_info_s#liquid_time_left. < 1)
2520 scalar *= (obj->effect_infocxx . . $ object#effect_info.->liquid_time_leftcxx . . $ effect_info_s#liquid_time_left.);
2521
2522 Render_FOVcxx . . $ Render_FOV. = D3_DEFAULT_FOVcxx . . $ `Descent3/descent.h:176:9`! + scalar;
2523 }
2524 }
2525 }
2526
2527 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_DEFORMcxx . . $ `Descent3/object_external.h:198:9`!) {
2528 obj->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time. -= Frametimecxx . . $ Frametime.;
2529 if (obj->effect_infocxx . . $ object#effect_info.->deform_timecxx . . $ effect_info_s#deform_time. <= 0.0f) {
2530 // Stop deforming
2531 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_DEFORMcxx . . $ `Descent3/object_external.h:198:9`!;
2532 }
2533 }
2534
2535 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FREEZEcxx . . $ `Descent3/object_external.h:203:9`!) {
2536 obj->effect_infocxx . . $ object#effect_info.->freeze_scalarcxx . . $ effect_info_s#freeze_scalar. += (Frametimecxx . . $ Frametime. / 3);
2537 if (obj->effect_infocxx . . $ object#effect_info.->freeze_scalarcxx . . $ effect_info_s#freeze_scalar. >= 1.0f) {
2538 // Stop freezing
2539 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_FREEZEcxx . . $ `Descent3/object_external.h:203:9`!;
2540 }
2541 }
2542
2543 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!) {
2544 if ((Gametimecxx . . $ Gametime. - obj->effect_infocxx . . $ object#effect_info.->last_damage_timecxx . . $ effect_info_s#last_damage_time.) > 1.0) {
2545 obj->effect_infocxx . . $ object#effect_info.->last_damage_timecxx . . $ effect_info_s#last_damage_time. = Gametimecxx . . $ Gametime.;
2546
2547 // Apply damage to this napalmed object
2548 objectcxx . . $ object# *killer;
2549
2550 if (obj->effect_infocxx . . $ object#effect_info.->damage_handlecxx . . $ effect_info_s#damage_handle. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
2551 uint32_tcxx . . $ uint32_t# sig = obj->effect_infocxx . . $ object#effect_info.->damage_handlecxx . . $ effect_info_s#damage_handle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!;
2552 int objnum = obj->effect_infocxx . . $ object#effect_info.->damage_handlecxx . . $ effect_info_s#damage_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!;
2553
2554 if ((Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) != sig)
2555 killer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2556 else
2557 killer = &Objectscxx . . $ Objects.[objnum];
2558 } else
2559 killer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2560
2561 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2562 ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(obj, killer, PD_NONEcxx . . $ `Descent3/damage_external.h:23:9`!, obj->effect_infocxx . . $ object#effect_info.->damage_per_secondcxx . . $ effect_info_s#damage_per_second.);
2563 } else if (IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type) || (obj->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!)) {
2564 ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(obj, killer, GD_FIREcxx . . $ `Descent3/damage_external.h:35:9`!, obj->effect_infocxx . . $ object#effect_info.->damage_per_secondcxx . . $ effect_info_s#damage_per_second.);
2565 }
2566 }
2567
2568 obj->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. -= Frametimecxx . . $ Frametime.;
2569 if (obj->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. <= 0) {
2570 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!;
2571 obj->effect_infocxx . . $ object#effect_info.->last_damage_timecxx . . $ effect_info_s#last_damage_time. = 0;
2572 Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).(obj->effect_infocxx . . $ object#effect_info.->sound_handlecxx . . $ effect_info_s#sound_handle.);
2573 obj->effect_infocxx . . $ object#effect_info.->sound_handlecxx . . $ effect_info_s#sound_handle. = SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!;
2574 }
2575
2576 // Drop some smoke/fire and stuff
2577 AttachRandomNapalmEffectsToObjectcxx . . $ AttachRandomNapalmEffectsToObject(419c470199a90a97).(obj);
2578 }
2579
2580 // Do sparking stuff
2581 if (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_SPARKINGcxx . . $ `Descent3/object_external.h:210:9`!) {
2582 int num_bolts = 0;
2583
2584 // Create spark effects
2585 obj->effect_infocxx . . $ object#effect_info.->spark_timercxx . . $ effect_info_s#spark_timer. -= Frametimecxx . . $ Frametime.;
2586 while (obj->effect_infocxx . . $ object#effect_info.->spark_timercxx . . $ effect_info_s#spark_timer. < 0.0) {
2587 obj->effect_infocxx . . $ object#effect_info.->spark_timercxx . . $ effect_info_s#spark_timer. += obj->effect_infocxx . . $ object#effect_info.->spark_delaycxx . . $ effect_info_s#spark_delay.;
2588 num_bolts++;
2589 }
2590 CreateElectricalBoltscxx . . $ CreateElectricalBolts(766a1b7183ffa4b4).(obj, num_bolts);
2591
2592 // Update timer
2593 obj->effect_infocxx . . $ object#effect_info.->spark_time_leftcxx . . $ effect_info_s#spark_time_left. -= Frametimecxx . . $ Frametime.;
2594 if (obj->effect_infocxx . . $ object#effect_info.->spark_time_leftcxx . . $ effect_info_s#spark_time_left. <= 0.0f) {
2595 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_SPARKINGcxx . . $ `Descent3/object_external.h:210:9`!;
2596 }
2597 }
2598 }
2599
2600 // Check passed-through faces for triggers, etc.
2601 void ObjCheckTriggerscxx . . $ ObjCheckTriggers(419c470199a90a97).(objectcxx . . $ object# *objp) {
2602 for (int i = 0; i < Fvi_num_recorded_facescxx . . $ Fvi_num_recorded_faces.; i++) {
2603 int roomnum = Fvi_recorded_facescxx . . $ Fvi_recorded_faces.[i].room_indexcxx . . $ fvi_face_room_list#room_index.;
2604 int facenum = Fvi_recorded_facescxx . . $ Fvi_recorded_faces.[i].face_indexcxx . . $ fvi_face_room_list#face_index.;
2605
2606 CheckTriggercxx . . $ CheckTrigger(11e0cce86948d892).(roomnum, facenum, objp, TT_PASS_THROUGHcxx . . $ `Descent3/trigger.h:143:9`!);
2607 }
2608 }
2609
2610 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
2611 void debug_check_terrain_objectscxx . . $ debug_check_terrain_objects(49f6e7a06ebc5aa8).() {
2612 int i;
2613 int j;
2614
2615 for (i = 0; i < TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!; i++) {
2616 j = Terrain_segcxx . . $ Terrain_seg.[i].objectscxx . . $ terrain_segment#objects.;
2617 while (j != -1) {
2618 ASSERTcxx . . $ `misc/pserror.h:246:9`!(j >= 0 && j <= Highest_object_index);
2619 j = Objectscxx . . $ Objects.[j].nextcxx . . $ object#next.;
2620 }
2621 }
2622 }
2623 #endif
2624
2625 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
2626 extern int DoAIcxx . . $ DoAI.;
2627 #else
2628 #define DoAI 1
2629 #endif
2630 //--------------------------------------------------------------------
2631 // Process an object for the current frame
2632 void ObjDoFramecxx . . $ ObjDoFrame(419c470199a90a97).(objectcxx . . $ object# *obj) {
2633 int previous_room = obj->roomnumcxx . . $ object#roomnum.;
2634 float save_frametime = Frametimecxx . . $ Frametime.;
2635
2636 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!);
2637
2638 // Clear attached vis for this frame
2639 obj->lowest_attached_viscxx . . $ object#lowest_attached_vis. = -1;
2640
2641 // If this is a permissable netgame, accelerate this object if need by
2642 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`! && (obj->flagscxx . . $ object#flags. & OF_PING_ACCELERATEcxx . . $ `Descent3/object_external.h:292:9`!)) {
2643 Frametimecxx . . $ Frametime. += (NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].ping_timecxx . . $ netplayer#ping_time. / 2.0);
2644 obj->flagscxx . . $ object#flags. &= ~OF_PING_ACCELERATEcxx . . $ `Descent3/object_external.h:292:9`!;
2645 }
2646 // Update previous position before moving
2647 obj->last_poscxx . . $ object#last_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.;
2648
2649 // Inevitable countdown towards death
2650 if (obj->flagscxx . . $ object#flags. & OF_USES_LIFELEFTcxx . . $ `Descent3/object_external.h:276:9`!)
2651 obj->lifeleftcxx . . $ object#lifeleft. -= Frametimecxx . . $ Frametime.;
2652
2653 // #ifdef _DEBUG
2654 // if(Physics_player_verbose)
2655 // {
2656 // debug_check_terrain_objects();
2657 // }
2658 // #endif _DEBUG
2659
2660 // Process the control for this object
2661 switch (obj->control_typecxx . . $ object#control_type.) {
2662
2663 case CT_POWERUPcxx . . $ `Descent3/object_external.h:224:9`!:
2664 case CT_NONEcxx . . $ `Descent3/object_external.h:216:9`!:
2665 break;
2666 case CT_FLYINGcxx . . $ `Descent3/object_external.h:219:9`!: {
2667 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(ct_flying_time);
2668 DoFlyingControlcxx . . $ DoFlyingControl(419c470199a90a97).(obj);
2669 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(ct_flying_time);
2670 } break;
2671 case CT_AIcxx . . $ `Descent3/object_external.h:217:9`!:
2672 if (DoAIcxx . . $ DoAI.) {
2673 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(ct_aidoframe_time);
2674 AIDoFramecxx . . $ AIDoFrame(419c470199a90a97).(obj);
2675 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(ct_aidoframe_time);
2676 }
2677 break;
2678 case CT_WEAPONcxx . . $ `Descent3/object_external.h:222:9`!: {
2679 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(ct_weaponframe_time);
2680 WeaponDoFramecxx . . $ WeaponDoFrame(419c470199a90a97).(obj);
2681 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(ct_weaponframe_time);
2682 } break;
2683 case CT_EXPLOSIONcxx . . $ `Descent3/object_external.h:218:9`!: {
2684 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(ct_explosionframe_time);
2685 DoExplosionFramecxx . . $ DoExplosionFrame(419c470199a90a97).(obj);
2686 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(ct_explosionframe_time);
2687 } break;
2688 case CT_DEBRIScxx . . $ `Descent3/object_external.h:223:9`!: {
2689 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(ct_debrisframe_time);
2690 DoDebrisFramecxx . . $ DoDebrisFrame(419c470199a90a97).(obj);
2691 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(ct_debrisframe_time);
2692 } break;
2693 case CT_SPLINTERcxx . . $ `Descent3/object_external.h:227:9`!: {
2694 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(ct_splinterframe_time);
2695 DoSplinterFramecxx . . $ DoSplinterFrame(419c470199a90a97).(obj);
2696 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(ct_splinterframe_time);
2697 } break;
2698 case CT_DYINGcxx . . $ `Descent3/object_external.h:229:9`!:
2699 DoDyingFramecxx . . $ DoDyingFrame(419c470199a90a97).(obj);
2700 break;
2701 case CT_DYING_AND_AIcxx . . $ `Descent3/object_external.h:230:9`!:
2702 if (DoAIcxx . . $ DoAI.)
2703 AIDoFramecxx . . $ AIDoFrame(419c470199a90a97).(obj);
2704 DoDyingFramecxx . . $ DoDyingFrame(419c470199a90a97).(obj);
2705 break;
2706 case CT_SOUNDSOURCEcxx . . $ `Descent3/object_external.h:228:9`!:
2707 break; // do nothing
2708 case CT_SOARcxx . . $ `Descent3/object_external.h:225:9`!:
2709 break;
2710
2711 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
2712 case CT_SLEWcxx . . $ `Descent3/object_external.h:220:9`!:
2713 SlewFramecxx . . $ SlewFrame(174cacb9d899a77a).(obj);
2714 break;
2715 #endif
2716
2717 default:
2718 Errorcxx . . $ Error(326aeb464d16410c).("Unknown control type %d in object %i, handle/type/id = %i/%i/%i", obj->control_typecxx . . $ object#control_type., obj - Objectscxx . . $ Objects.,
2719 obj->handlecxx . . $ object#handle., obj->typecxx . . $ object#type., obj->idcxx . . $ object#id.);
2720 break;
2721 }
2722
2723 // #ifdef _DEBUG
2724 // if(Physics_player_verbose)
2725 // {
2726 // debug_check_terrain_objects();
2727 // }
2728 // #endif _DEBUG
2729
2730 // Update cycled animation
2731 if ((obj->control_typecxx . . $ object#control_type. != CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (obj->control_typecxx . . $ object#control_type. != CT_DYING_AND_AIcxx . . $ `Descent3/object_external.h:230:9`!) && (obj->control_typecxx . . $ object#control_type. != CT_DEBRIScxx . . $ `Descent3/object_external.h:223:9`!) &&
2732 IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type) && (obj->typecxx . . $ object#type. != OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!)) {
2733 if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim. && Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!].elemcxx . . $ anim_elem#elem.[AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!].tocxx . . $ anim_entry#to.) {
2734 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(cycle_anim);
2735 DoCycledAnimcxx . . $ DoCycledAnim(419c470199a90a97).(obj);
2736 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(cycle_anim);
2737 }
2738 }
2739
2740 // #ifdef _DEBUG
2741 // if(Physics_player_verbose)
2742 // {
2743 // debug_check_terrain_objects();
2744 // }
2745 // #endif _DEBUG
2746
2747 // Do freeze stuff on AI controlled robots
2748 if ((obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) && obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! && obj->effect_infocxx . . $ object#effect_info. &&
2749 (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_FREEZEcxx . . $ `Descent3/object_external.h:203:9`!))
2750 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). obj->effect_infocxx . . $ object#effect_info.->freeze_scalarcxx . . $ effect_info_s#freeze_scalar.;
2751
2752 // #ifdef _DEBUG
2753 // if(Physics_player_verbose)
2754 // {
2755 // debug_check_terrain_objects();
2756 // }
2757 // #endif _DEBUG
2758
2759 // Check for object dead of old age
2760 if ((obj->flagscxx . . $ object#flags. & OF_USES_LIFELEFTcxx . . $ `Descent3/object_external.h:276:9`!) && (obj->lifeleftcxx . . $ object#lifeleft. < 0)) {
2761 bool kill_it = true;
2762 bool tell_clients = false;
2763
2764 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
2765
2766 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
2767 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
2768 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! ||
2769 obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) {
2770 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->flags & OF_SERVER_OBJECTcxx . . $ `Descent3/object_external.h:291:9`!);
2771
2772 if (!(obj->flagscxx . . $ object#flags. & OF_SERVER_SAYS_DELETEcxx . . $ `Descent3/object_external.h:290:9`!)) {
2773 kill_it = false;
2774 obj->lifeleftcxx . . $ object#lifeleft. = .001f;
2775 }
2776 }
2777 } else {
2778 if (obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! || obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)
2779 tell_clients = true;
2780 }
2781 }
2782
2783 if (kill_it) {
2784 TimeoutObjectcxx . . $ TimeoutObject(419c470199a90a97).(obj);
2785 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(obj, tell_clients);
2786 }
2787 }
2788
2789 // #ifdef _DEBUG
2790 // if(Physics_player_verbose)
2791 // {
2792 // debug_check_terrain_objects();
2793 // }
2794 // #endif _DEBUG
2795
2796 // If object is dead, don't do any more processing on it
2797 if (obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) {
2798 Frametimecxx . . $ Frametime. = save_frametime;
2799 return;
2800 }
2801
2802 // #ifdef _DEBUG
2803 // if(Physics_player_verbose)
2804 // {
2805 // debug_check_terrain_objects();
2806 // }
2807 // #endif _DEBUG
2808
2809 // Do the movement for this object
2810 switch (obj->movement_typecxx . . $ object#movement_type.) {
2811 case MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!:
2812 if ((obj->flagscxx . . $ object#flags. & OF_STUCK_ON_PORTALcxx . . $ `Descent3/object_external.h:287:9`!) &&
2813 !(Roomscxx . . $ Rooms.[obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..stuck_roomcxx . . $ physics_info#$anonymous_type_5#stuck_room.].portalscxx . . $ room#portals.[obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..stuck_portalcxx . . $ physics_info#$anonymous_type_6#stuck_portal.].flagscxx . . $ portal#flags. & PF_RENDER_FACEScxx . . $ `Descent3/room_external.h:155:9`!)) {
2814 if (IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type) && (obj->flagscxx . . $ object#flags. & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!))
2815 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(obj, true);
2816 else
2817 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(obj, false);
2818 }
2819 break; // this doesn't move
2820
2821 case MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!: {
2822 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(mt_physicsframe_time);
2823
2824 do_physics_simcxx . . $ do_physics_sim(419c470199a90a97).(obj);
2825 ObjCheckTriggerscxx . . $ ObjCheckTriggers(419c470199a90a97).(obj);
2826
2827 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(mt_physicsframe_time);
2828 } break;
2829
2830 case MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!: {
2831 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(mt_walkingframe_time);
2832 do_walking_simcxx . . $ do_walking_sim(419c470199a90a97).(obj);
2833 ObjCheckTriggerscxx . . $ ObjCheckTriggers(419c470199a90a97).(obj);
2834 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(mt_walkingframe_time);
2835 } break;
2836
2837 case MT_SHOCKWAVEcxx . . $ `Descent3/object_external.h:237:9`!: {
2838 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(mt_shockwave_time);
2839 DoConcussiveForcecxx . . $ DoConcussiveForce(dc43bf10ea54b482).(obj, obj->parent_handlecxx . . $ object#parent_handle.);
2840 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(mt_shockwave_time);
2841 } break;
2842
2843 case MT_OBJ_LINKEDcxx . . $ `Descent3/object_external.h:242:9`!:
2844 PhysicsLinkListcxx . . $ PhysicsLinkList.[Physics_NumLinkedcxx . . $ Physics_NumLinked.++] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj);
2845 break;
2846
2847 default:
2848 Int3cxx . . $ `misc/pserror.h:247:9`!(); // unknown movement type
2849 }
2850
2851 // #ifdef _DEBUG
2852 // if(Physics_player_verbose)
2853 // {
2854 // debug_check_terrain_objects();
2855 // }
2856 // #endif _DEBUG
2857
2858 // Do special effects stuff to object
2859 if (obj->effect_infocxx . . $ object#effect_info.) {
2860 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(obj_doeffect_time);
2861 ObjDoEffectscxx . . $ ObjDoEffects(419c470199a90a97).(obj);
2862 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(obj_doeffect_time);
2863 }
2864
2865 // #ifdef _DEBUG
2866 // if(Physics_player_verbose)
2867 // {
2868 // debug_check_terrain_objects();
2869 // }
2870 // #endif _DEBUG
2871
2872 // Deal with special player movement stuff
2873 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
2874 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(obj_move_player_time);
2875 DoSpecialPlayerStuffcxx . . $ DoSpecialPlayerStuff(419c470199a90a97).(obj);
2876 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(obj_move_player_time);
2877 }
2878
2879 // #ifdef _DEBUG
2880 // if(Physics_player_verbose)
2881 // {
2882 // debug_check_terrain_objects();
2883 // }
2884 // #endif _DEBUG
2885
2886 // Handle interval event for script.
2887 do {
2888 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(obj_d3xint_time);
2889 //@$-D3XExecScript(obj, EVT_INTERVAL, obj);
2890 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
2891 ei.evt_intervalcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_interval..frame_timecxx . . $ tOSIRISEVTINTERVAL#frame_time. = Frametimecxx . . $ Frametime.;
2892 ei.evt_intervalcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_interval..game_timecxx . . $ tOSIRISEVTINTERVAL#game_time. = Gametimecxx . . $ Gametime.;
2893 Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(obj, EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!, &ei);
2894 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(obj_d3xint_time);
2895 } while (0); // this do{}while(0) is here because the RTP_STARTINCTIME/RTP_ENDINCTIME must be in the same scope
2896 // and not share scope with another RTP_STARTINCTIME
2897
2898 // #ifdef _DEBUG
2899 // if(Physics_player_verbose)
2900 // {
2901 // debug_check_terrain_objects();
2902 // }
2903 // #endif _DEBUG
2904
2905 // Cast light
2906 do {
2907 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(obj_objlight_time);
2908 DoObjectLightcxx . . $ DoObjectLight(419c470199a90a97).(obj);
2909 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(obj_objlight_time);
2910 } while (0); // this do{}while(0) is here because the RTP_STARTINCTIME/RTP_ENDINCTIME must be in the same scope
2911 // and not share scope with another RTP_STARTINCTIME
2912
2913 // #ifdef _DEBUG
2914 // if(Physics_player_verbose)
2915 // {
2916 // debug_check_terrain_objects();
2917 // }
2918 // #endif _DEBUG
2919
2920 // if this object is walking/rolling on the terrain, make it not LOD at that point
2921 if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! && (obj->flagscxx . . $ object#flags. & OF_RENDEREDcxx . . $ `Descent3/object_external.h:285:9`!) && OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj))
2922 TurnOffLODForCellcxx . . $ TurnOffLODForCell(d4f767463ce0a6b3).(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum));
2923
2924 // #ifdef _DEBUG
2925 // if(Physics_player_verbose)
2926 // {
2927 // debug_check_terrain_objects();
2928 // }
2929 // #endif _DEBUG
2930
2931 // Mark object as not rendered for this frame
2932 obj->flagscxx . . $ object#flags. &= ~OF_RENDEREDcxx . . $ `Descent3/object_external.h:285:9`!;
2933
2934 Frametimecxx . . $ Frametime. = save_frametime;
2935 }
2936
2937 int Max_used_objectscxx . . $ Max_used_objects. = MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`! - 20;
2938 float Last_position_history_updatecxx . . $ Last_position_history_update.[MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`!]; // gametime of the last position history update of the object
2939 float Last_position_history_update_timecxx . . $ Last_position_history_update_time. = 0.0f;
2940
2941 //--------------------------------------------------------------------
2942 // Process all objects for the current frame
2943 #define OBJ_POS_SAMPLE_TIMEcxx . . $ `Descent3/object.cpp:2943:9`! (1.0f / (((float)MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`!) * 20.0f)) // super sample at 20 fps
2944 void ObjDoFrameAllcxx . . $ ObjDoFrameAll(49f6e7a06ebc5aa8).() {
2945 int i;
2946 objectcxx . . $ object# *objp;
2947 int objs_live = 0;
2948 bool update_position_history = false;
2949
2950 if (Last_position_history_update_timecxx . . $ Last_position_history_update_time. > Gametimecxx . . $ Gametime.) {
2951 // the Gametime rolled over (new level)
2952 update_position_history = true;
2953 }
2954
2955 if (Gametimecxx . . $ Gametime. >= Last_position_history_update_timecxx . . $ Last_position_history_update_time. + OBJ_POS_SAMPLE_TIMEcxx . . $ `Descent3/object.cpp:2943:9`!) {
2956 update_position_history = true;
2957 }
2958
2959 if (update_position_history) {
2960 Object_position_headcxx . . $ Object_position_head.--;
2961 if (Object_position_headcxx . . $ Object_position_head. == 255)
2962 Object_position_headcxx . . $ Object_position_head. = MAX_POSITION_HISTORYcxx . . $ `Descent3/object.h:822:9`! - 1;
2963
2964 Last_position_history_updatecxx . . $ Last_position_history_update.[Object_position_headcxx . . $ Object_position_head.] = Gametimecxx . . $ Gametime.;
2965 Last_position_history_update_timecxx . . $ Last_position_history_update_time. = Gametimecxx . . $ Gametime.;
2966 }
2967
2968 // MT: seed code removed 9/20/99 because it breaks the randomness of the
2969 // ambient sound patterns.
2970 // IMPORTANT NOTE: Because this code could have far-reaching consequences,
2971 // please DO NOT check this in until after the regular patches for D3 are
2972 // done. This code should only go in for the Mercenary patch, which will
2973 // get adequate testing to make sure nothing serious has broken.
2974 //@@ // Seed timer for this frame
2975 //@@ int seed=Gametime*1000;
2976 //@@ ps_srand (seed);
2977
2978 // Does control for soar objects
2979 if (Soar_activecxx . . $ `Descent3/soar.h:55:9`!)
2980 SoarTickcxx . . $ `Descent3/soar.h:63:9`!(Frametime);
2981
2982 Physics_NumLinkedcxx . . $ Physics_NumLinked. = 0;
2983
2984 // Process each object
2985 for (i = 0, objp = Objectscxx . . $ Objects.; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++, objp++) {
2986 if ((objp->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (!(objp->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!))) {
2987 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(obj_do_frm);
2988 ObjDoFramecxx . . $ ObjDoFrame(419c470199a90a97).(objp);
2989
2990 if (update_position_history) {
2991 int slot = Object_map_position_historycxx . . $ Object_map_position_history.[OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objp)];
2992 if (slot != -1) {
2993 Object_position_samplescxx . . $ Object_position_samples.[slot].poscxx . . $ tPosHistory#pos.[Object_position_headcxx . . $ Object_position_head.] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). objp->poscxx . . $ object#pos.;
2994 }
2995 }
2996
2997 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(obj_do_frm);
2998 objs_live++;
2999 }
3000 }
3001
3002 // Account for linked objects
3003 for (i = 0; i < Physics_NumLinkedcxx . . $ Physics_NumLinked.; i++) {
3004 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(phys_link);
3005 DoPhysLinkedFramecxx . . $ DoPhysLinkedFrame(419c470199a90a97).(&Objectscxx . . $ Objects.[PhysicsLinkListcxx . . $ PhysicsLinkList.[i]]);
3006 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(phys_link);
3007 }
3008
3009 // Move vis effects
3010 {
3011 RTP_STARTINCTIMEcxx . . $ `rtperformance/rtperformance.h:124:9`!(vis_eff_move);
3012 VisEffectMoveAllcxx . . $ VisEffectMoveAll(49f6e7a06ebc5aa8).();
3013 RTP_ENDINCTIMEcxx . . $ `rtperformance/rtperformance.h:125:9`!(vis_eff_move);
3014 }
3015
3016 // Blend all lights that are needed
3017 BlendAllLightingEdgescxx . . $ BlendAllLightingEdges(49f6e7a06ebc5aa8).();
3018
3019 mprintf_atcxx . . $ `ddebug/mono.h:83:9`!(1, 5, 40, "Objs=%d ", objs_live);
3020
3021 // Delete everything that died
3022 ObjDeleteDeadcxx . . $ ObjDeleteDead(49f6e7a06ebc5aa8).();
3023 }
3024
3025 #define FUELCEN_SOUND_DELAYcxx . . $ `Descent3/object.cpp:3025:9`! 0.25 // play every quarter second
3026 #define FUELCEN_GIVE_RATEcxx . . $ `Descent3/object.cpp:3026:9`! 25 // give 25 units per second
3027
3028 // Give the player fuel. Called when the player is in an energy center
3029 void RefuelPlayercxx . . $ RefuelPlayer(419c470199a90a97).(objectcxx . . $ object# *objp) {
3030 float max, amount;
3031
3032 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
3033 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Rooms[objp->roomnum].flags & RF_FUELCENcxx . . $ `Descent3/room_external.h:175:9`!);
3034
3035 max = INITIAL_ENERGYcxx . . $ `Descent3/player_external.h:68:9`! - Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].energycxx . . $ player#energy.;
3036 amount = FUELCEN_GIVE_RATEcxx . . $ `Descent3/object.cpp:3026:9`! * Frametimecxx . . $ Frametime.;
3037
3038 if (amount > max)
3039 amount = max;
3040
3041 if ((amount > 0)) {
3042 Playerscxx . . $ Players.[objp->idcxx . . $ object#id.].energycxx . . $ player#energy. += amount;
3043
3044 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_REFUELINGcxx . . $ `Descent3/sounds.h:106:9`!, SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`!, objp);
3045
3046 ain_hearcxx . . $ ain_hear# hear;
3047 hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = true;
3048 hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 0.01f;
3049 hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 1.0f;
3050 hear.max_distcxx . . $ ain_hear#max_dist. = Soundscxx . . $ Sounds.[SOUND_REFUELINGcxx . . $ `Descent3/sounds.h:106:9`!].max_distancecxx . . $ sound_info#max_distance.;
3051 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(objp, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear);
3052
3053 // if (Game_mode & GM_MULTI)
3054 // multi_send_play_sound(SOUND_REFUEL_STATION_GIVING_FUEL, F1_0/2);
3055 }
3056 }
3057
3058 // Clears the secret flag in the specified room, and recursively, all connected rooms
3059 void ClearSecretFlagscxx . . $ ClearSecretFlags(cd8c4e8cd0ee4c38).(roomcxx . . $ room# *rp) {
3060 int p;
3061 portalcxx . . $ portal# *pp;
3062
3063 rp->flagscxx . . $ room#flags. &= ~RF_SECRETcxx . . $ `Descent3/room_external.h:201:9`!;
3064
3065 for (p = 0, pp = rp->portalscxx . . $ room#portals.; p < rp->num_portalscxx . . $ room#num_portals.; p++, pp++) {
3066 roomcxx . . $ room# *rp2 = &Roomscxx . . $ Rooms.[pp->croomcxx . . $ portal#croom.];
3067 if (rp2->flagscxx . . $ room#flags. & RF_SECRETcxx . . $ `Descent3/room_external.h:201:9`!)
3068 ClearSecretFlagscxx . . $ ClearSecretFlags(cd8c4e8cd0ee4c38).(rp2);
3069 }
3070 }
3071 // Prints out a message when you've found a secret
3072 #define SECRET_COLORcxx . . $ `Descent3/object.cpp:3072:9`! GR_RGB(0, 128, 255)
3073 void DoSecretForPlayercxx . . $ DoSecretForPlayer(76e0917c6aa1b714).(roomcxx . . $ room# *rp, objectcxx . . $ object# *objp) {
3074 int y = Game_window_hcxx . . $ Game_window_h. / 4;
3075 AddPersistentHUDMessagecxx . . $ AddPersistentHUDMessage(2c96e75cbf2ca747).(SECRET_COLORcxx . . $ `Descent3/object.cpp:3072:9`!, HUD_MSG_PERSISTENT_CENTERcxx . . $ `Descent3/hud.h:312:9`!, y, 5, HPF_FADEOUTcxx . . $ `Descent3/hud.h:401:9`! + HPF_FREESPACE_DRAWcxx . . $ `Descent3/hud.h:402:9`!,
3076 SOUND_GAME_MESSAGEcxx . . $ `Descent3/sounds.h:148:9`!, TXT_FOUND_SECRETcxx . . $ `Descent3/stringtable.h:865:9`!);
3077
3078 ClearSecretFlagscxx . . $ ClearSecretFlags(cd8c4e8cd0ee4c38).(rp);
3079 }
3080
3081 // --------------------------------------------------------------------
3082
3083 // Do refueling centers & damage rooms
3084 void DoSpecialPlayerStuffcxx . . $ DoSpecialPlayerStuff(419c470199a90a97).(objectcxx . . $ object# *objp) {
3085 if (!OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(objp)) {
3086 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[objp->roomnumcxx . . $ object#roomnum.];
3087
3088 // Check for refueling
3089 if (rp->flagscxx . . $ room#flags. & RF_FUELCENcxx . . $ `Descent3/room_external.h:175:9`!)
3090 RefuelPlayercxx . . $ RefuelPlayer(419c470199a90a97).(objp);
3091
3092 if (objp->idcxx . . $ object#id. == Player_numcxx . . $ Player_num. && (rp->flagscxx . . $ room#flags. & RF_SECRETcxx . . $ `Descent3/room_external.h:201:9`!))
3093 DoSecretForPlayercxx . . $ DoSecretForPlayer(76e0917c6aa1b714).(rp, objp);
3094
3095 // Check for damage room
3096 if (rp->damagecxx . . $ room#damage. > 0.0) {
3097 if (!(objp->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!)) {
3098
3099 // Set the player on fire
3100 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->effect_info);
3101 objp->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!;
3102 objp->effect_infocxx . . $ object#effect_info.->damage_timecxx . . $ effect_info_s#damage_time. = 1.0;
3103 objp->effect_infocxx . . $ object#effect_info.->damage_per_secondcxx . . $ effect_info_s#damage_per_second. = rp->damagecxx . . $ room#damage.;
3104 if (Gametimecxx . . $ Gametime. - objp->effect_infocxx . . $ object#effect_info.->last_damage_timecxx . . $ effect_info_s#last_damage_time. > 1.0f)
3105 objp->effect_infocxx . . $ object#effect_info.->last_damage_timecxx . . $ effect_info_s#last_damage_time. = 0;
3106 objp->effect_infocxx . . $ object#effect_info.->damage_handlecxx . . $ effect_info_s#damage_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
3107 if (objp->effect_infocxx . . $ object#effect_info.->sound_handlecxx . . $ effect_info_s#sound_handle. == SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
3108 objp->effect_infocxx . . $ object#effect_info.->sound_handlecxx . . $ effect_info_s#sound_handle. = 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`!, objp);
3109 }
3110 }
3111
3112 // Check for & set waypoint
3113 if (rp->flagscxx . . $ room#flags. & RF_WAYPOINTcxx . . $ `Descent3/room_external.h:200:9`!)
3114 SetAutoWaypointcxx . . $ SetAutoWaypoint(419c470199a90a97).(objp);
3115 } else { // outside
3116
3117 // Check for & set waypoint
3118 // if (Terrain_seg[CELLNUM(objp->roomnum)].flags & TF_WAYPOINT)
3119 // SetAutoWaypoint(objp);
3120 }
3121 }
3122
3123 // Builds the free object list by scanning the list of free objects & adding unused ones to the list
3124 // Also sets Highest_object_index
3125 void ResetFreeObjectscxx . . $ ResetFreeObjects(49f6e7a06ebc5aa8).() {
3126 int i;
3127
3128 Highest_object_indexcxx . . $ Highest_object_index. = -1;
3129
3130 for (i = Num_objectscxx . . $ Num_objects. = MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; --i >= 0;)
3131 if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!)
3132 free_obj_listcxx . . $ free_obj_list.[--Num_objectscxx . . $ Num_objects.] = i;
3133 else if (Highest_object_indexcxx . . $ Highest_object_index. == -1)
3134 Highest_object_indexcxx . . $ Highest_object_index. = i;
3135 }
3136
3137 // sets the orientation of an object. This should be called to orient an object
3138 void ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(objectcxx . . $ object# *obj, const matrixcxx . . $ matrix# *orient) {
3139 // Accounts for if the orientation was set and then this function is being used
3140 // to update the other stuff
3141 if (&obj->orientcxx . . $ object#orient. != orient)
3142 obj->orientcxx . . $ object#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). *orient;
3143
3144 // Recompute the orientation dependant information
3145 if (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) {
3146 if (obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && obj->typecxx . . $ object#type. != OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`! && obj->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && obj->typecxx . . $ object#type. != OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!) {
3147 matrixcxx . . $ matrix# m;
3148
3149 m =cxx . . $ matrix#`operator=`(4c6f8b29806742). obj->orientcxx . . $ object#orient.;
3150 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
3151
3152 obj->wall_sphere_offsetcxx . . $ object#wall_sphere_offset. =cxx . . $ vector#`operator=`(c0842353a20857d). Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].wall_size_offsetcxx . . $ poly_model#wall_size_offset. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
3153 obj->anim_sphere_offsetcxx . . $ object#anim_sphere_offset. =cxx . . $ vector#`operator=`(c0842353a20857d). Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].anim_size_offsetcxx . . $ poly_model#anim_size_offset. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
3154 } else {
3155 obj->wall_sphere_offsetcxx . . $ object#wall_sphere_offset. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
3156 obj->anim_sphere_offsetcxx . . $ object#anim_sphere_offset. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
3157 }
3158 }
3159 }
3160
3161 // sets the position of an object. This should be called to move an object
3162 void ObjSetPoscxx . . $ ObjSetPos(bbb518390bedd509).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *pos, int roomnum, matrixcxx . . $ matrix# *orient, bool f_update_attached_children) {
3163 int oldroomnum = obj->roomnumcxx . . $ object#roomnum.;
3164 vectorcxx . . $ vector# old_pos = obj->poscxx . . $ object#pos.;
3165
3166 // Reset the position & recalculate the AABB
3167 obj->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *pos;
3168 ObjSetAABBcxx . . $ ObjSetAABB(419c470199a90a97).(obj);
3169
3170 // Reset the orientation if changed
3171 if (orient != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
3172 ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(obj, orient);
3173
3174 // Clear the outside-mine flag
3175 obj->flagscxx . . $ object#flags. &= ~OF_OUTSIDE_MINEcxx . . $ `Descent3/object_external.h:278:9`!;
3176
3177 // If changed rooms, do a bunch of stuff
3178 if (obj->roomnumcxx . . $ object#roomnum. != roomnum) {
3179
3180 // Let the script know
3181 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
3182 ei.evt_changesegcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_changeseg..room_numcxx . . $ tOSIRISEVTCHANGESEG#room_num. = roomnum;
3183 Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(obj, EVT_CHANGESEGcxx . . $ `scripts/osiris_common.h:375:9`!, &ei);
3184
3185 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum) && (Roomscxx . . $ Rooms.[roomnum].flagscxx . . $ room#flags. & RF_INFORM_RELINK_TO_LGcxx . . $ `Descent3/room_external.h:198:9`!)) {
3186 Level_goalscxx . . $ Level_goals..Informcxx . . $ levelgoals#Inform(8589f1c7c2d24df6).(LIT_INTERNAL_ROOMcxx . . $ `Descent3/levelgoal_external.h:27:9`!, LGF_COMP_ENTERcxx . . $ `Descent3/levelgoal_external.h:47:9`!, roomnum);
3187 }
3188
3189 // Relink the object
3190 ObjRelinkcxx . . $ ObjRelink(3e454b8ccf442868).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), roomnum);
3191
3192 // Call DLL function if the server player changed rooms
3193 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`!)) {
3194 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = obj->handlecxx . . $ object#handle.;
3195 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = obj->handlecxx . . $ object#handle.;
3196 DLLInfocxx . . $ DLLInfo..oldsegcxx . . $ dllinfo#oldseg. = oldroomnum;
3197 DLLInfocxx . . $ DLLInfo..newsegcxx . . $ dllinfo#newseg. = obj->roomnumcxx . . $ object#roomnum.;
3198
3199 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
3200 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEPLAYERCHANGESEGcxx . . $ `lib/d3events.h:68:9`!, &DLLInfocxx . . $ DLLInfo.);
3201 } else {
3202 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEOBJCHANGESEGcxx . . $ `lib/d3events.h:79:9`!, &DLLInfocxx . . $ DLLInfo.);
3203 }
3204 }
3205
3206 // Slowly change volume lighting if going between rooms, if not in the editor
3207 if (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() != EDITOR_MODEcxx . . $ EDITOR_MODE.) {
3208 if ((obj->effect_infocxx . . $ object#effect_info. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && (obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VOLUME_LITcxx . . $ `Descent3/object_external.h:201:9`!)) {
3209 if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(oldroomnum) && !ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) {
3210 if (!(obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_VOLUME_CHANGINGcxx . . $ `Descent3/object_external.h:202:9`!)) {
3211 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_VOLUME_CHANGINGcxx . . $ `Descent3/object_external.h:202:9`!;
3212 obj->effect_infocxx . . $ object#effect_info.->volume_change_timecxx . . $ effect_info_s#volume_change_time. = 1.0;
3213 obj->effect_infocxx . . $ object#effect_info.->volume_old_roomcxx . . $ effect_info_s#volume_old_room. = oldroomnum;
3214 obj->effect_infocxx . . $ object#effect_info.->volume_old_poscxx . . $ effect_info_s#volume_old_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). old_pos;
3215 }
3216 } else // either old or new room was outside, so don't do volume changing
3217 obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_VOLUME_CHANGINGcxx . . $ `Descent3/object_external.h:202:9`!;
3218 }
3219 }
3220 }
3221 }
3222
3223 // Delete objects, such as weapons & explosions, that shouldn't stay between levels
3224 // if clear_all is set, clear even proximity bombs
3225 void ClearTransientObjectscxx . . $ ClearTransientObjects(d4f767463ce0a6b3).(int clear_all) {
3226 int objnum;
3227 objectcxx . . $ object# *objp;
3228
3229 for (objnum = 0, objp = Objectscxx . . $ Objects.; objnum <= Highest_object_indexcxx . . $ Highest_object_index.; objnum++, objp++) {
3230 if (((objp->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && !(Weaponscxx . . $ Weapons.[objp->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_COUNTERMEASUREcxx . . $ `Descent3/weapon.h:241:9`!)) ||
3231 (objp->typecxx . . $ object#type. == OBJ_FIREBALLcxx . . $ `Descent3/object_external.h:161:9`!) || (objp->typecxx . . $ object#type. == OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`!) || (objp->typecxx . . $ object#type. == OBJ_SHARDcxx . . $ `Descent3/object_external.h:163:9`!) ||
3232 (objp->typecxx . . $ object#type. == OBJ_SHOCKWAVEcxx . . $ `Descent3/object_external.h:170:9`!) || (objp->typecxx . . $ object#type. == OBJ_PARTICLEcxx . . $ `Descent3/object_external.h:179:9`!) || (objp->typecxx . . $ object#type. == OBJ_SPLINTERcxx . . $ `Descent3/object_external.h:180:9`!) ||
3233 ((objp->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (objp->flagscxx . . $ object#flags. & OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!))) {
3234 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Clearing object %d type = %d\n", objnum, objp->type);
3235 ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(objnum);
3236 }
3237 }
3238 }
3239
3240 // Remaps all static powerups,sounds,etc to their appropriate indices
3241 void RemapEverythingcxx . . $ RemapEverything(49f6e7a06ebc5aa8).() {
3242 RemapStaticIDscxx . . $ RemapStaticIDs(49f6e7a06ebc5aa8).();
3243 RemapDoorscxx . . $ RemapDoors(49f6e7a06ebc5aa8).();
3244 RemapShipscxx . . $ RemapShips(49f6e7a06ebc5aa8).();
3245 RemapWeaponscxx . . $ RemapWeapons(49f6e7a06ebc5aa8).();
3246 RemapSoundscxx . . $ RemapSounds(49f6e7a06ebc5aa8).();
3247 RemapPolyModelscxx . . $ RemapPolyModels(49f6e7a06ebc5aa8).();
3248 }
3249
3250 // Retruns a pointer to an object given its handle. Returns NULL if object no longer exists.
3251 objectcxx . . $ object# *ObjGetcxx . . $ ObjGet(11672e354c0b263a).(int handle) {
3252 if (handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
3253 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3254
3255 if (handle == OBJECT_HANDLE_BADcxx . . $ `Descent3/object_external.h:153:9`!) {
3256 Int3cxx . . $ `misc/pserror.h:247:9`!();
3257 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3258 }
3259
3260 int objnum = handle & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!;
3261 objectcxx . . $ object# *objp;
3262
3263 ASSERTcxx . . $ `misc/pserror.h:246:9`!((handle & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) != 0); // count == 0 means never-used object
3264 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!);
3265
3266 objp = &Objectscxx . . $ Objects.[objnum];
3267
3268 if ((objp->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (objp->handlecxx . . $ object#handle. == handle))
3269 return objp;
3270 else
3271 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3272 }
3273
3274 void GetObjectPointInWorldcxx . . $ GetObjectPointInWorld(a1f5449c483432f8).(vectorcxx . . $ vector# *dest, objectcxx . . $ object# *obj, int subnum, int vertnum) {
3275 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
3276 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[subnum];
3277 float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
3278 int i;
3279
3280 if (!pm->new_stylecxx . . $ poly_model#new_style.)
3281 return;
3282
3283 for (i = 0; i < MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!; i++)
3284 normalized_time[i] = 0.0;
3285
3286 SetModelAnglesAndPoscxx . . $ SetModelAnglesAndPos(a00e94110fc4ea4c).(pm, normalized_time);
3287
3288 vectorcxx . . $ vector# pnt = sm->vertscxx . . $ bsp_info#verts.[vertnum];
3289 int mn = subnum;
3290 matrixcxx . . $ matrix# m;
3291
3292 // Instance up the tree for this gun
3293 while (mn != -1) {
3294 vectorcxx . . $ vector# tpnt;
3295
3296 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&m, pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..pcxx . . $ angvec#p., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..hcxx . . $ angvec#h., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..bcxx . . $ angvec#b.);
3297 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
3298
3299 tpnt =cxx . . $ vector#`operator=`(c0842353a20857d). pnt *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
3300
3301 pnt =cxx . . $ vector#`operator=`(c0842353a20857d). tpnt +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].offsetcxx . . $ bsp_info#offset. +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].mod_poscxx . . $ bsp_info#mod_pos.;
3302
3303 mn = pm->submodelcxx . . $ poly_model#submodel.[mn].parentcxx . . $ bsp_info#parent.;
3304 }
3305
3306 // now instance for the entire object
3307 m =cxx . . $ matrix#`operator=`(4c6f8b29806742). obj->orientcxx . . $ object#orient.;
3308 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
3309
3310 *dest =cxx . . $ vector#`operator=`(c0842353a20857d). pnt *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
3311 *dest +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). obj->poscxx . . $ object#pos.;
3312 }
3313
3314 bool ObjGetAnimUpdatecxx . . $ ObjGetAnimUpdate(6db95621231b744d).(uint16_tcxx . . $ uint16_t# objnum, custom_animcxx . . $ custom_anim# *multi_anim_info) {
3315 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
3316
3317 if ((objnum >= 0) && (obj->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!)) {
3318 polyobj_infocxx . . $ polyobj_info# *pm = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.;
3319 ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.;
3320
3321 multi_anim_info->server_timecxx . . $ custom_anim#server_time. = Gametimecxx . . $ Gametime.;
3322 multi_anim_info->server_anim_framecxx . . $ custom_anim#server_anim_frame. = (uint16_tcxx . . $ uint16_t#)(pm->anim_framecxx . . $ polyobj_info#anim_frame. * 256.0f);
3323
3324 multi_anim_info->anim_start_framecxx . . $ custom_anim#anim_start_frame. = pm->anim_start_framecxx . . $ polyobj_info#anim_start_frame.;
3325 multi_anim_info->anim_end_framecxx . . $ custom_anim#anim_end_frame. = pm->anim_end_framecxx . . $ polyobj_info#anim_end_frame.;
3326 multi_anim_info->anim_timecxx . . $ custom_anim#anim_time. = pm->anim_timecxx . . $ polyobj_info#anim_time.;
3327 multi_anim_info->max_speedcxx . . $ custom_anim#max_speed. = pm->max_speedcxx . . $ polyobj_info#max_speed.;
3328
3329 multi_anim_info->flagscxx . . $ custom_anim#flags. = 0;
3330
3331 if (pm->anim_flagscxx . . $ polyobj_info#anim_flags. & AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!)
3332 multi_anim_info->flagscxx . . $ custom_anim#flags. |= FMA_LOOPINGcxx . . $ `Descent3/object.h:663:9`!;
3333
3334 if (obj->ai_infocxx . . $ object#ai_info. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
3335 multi_anim_info->anim_sound_indexcxx . . $ custom_anim#anim_sound_index. = obj->ai_infocxx . . $ object#ai_info.->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index.;
3336 multi_anim_info->flagscxx . . $ custom_anim#flags. |= FMA_HAS_AIcxx . . $ `Descent3/object.h:665:9`!;
3337 } else {
3338 multi_anim_info->anim_sound_indexcxx . . $ custom_anim#anim_sound_index. = -1;
3339 }
3340
3341 return true;
3342 }
3343
3344 return false;
3345 }
3346
3347 void SetObjectControlTypecxx . . $ SetObjectControlType(766a1b7183ffa4b4).(objectcxx . . $ object# *obj, int control_type) {
3348 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj);
3349 ASSERTcxx . . $ `misc/pserror.h:246:9`!(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) >= 0 && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!);
3350
3351 if ((control_type == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (obj->ai_infocxx . . $ object#ai_info. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
3352 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
3353 polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.;
3354 int num_wbs = pm->num_wbscxx . . $ poly_model#num_wbs.;
3355 int count = 0;
3356 int i;
3357
3358 obj->ai_infocxx . . $ object#ai_info. = (ai_framecxx . . $ ai_frame# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(ai_frame));
3359 memset(obj->ai_infocxx . . $ object#ai_info., 0x00, sizeof(ai_framecxx . . $ ai_frame#)); // DAJ clear the baby
3360
3361 for (i = 0; i < num_wbs; i++) {
3362 ASSERTcxx . . $ `misc/pserror.h:246:9`!(pm->poly_wb[i].num_turrets >= 0 && pm->poly_wb[i].num_turrets <= 6400);
3363 count += pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets.;
3364 }
3365
3366 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets. = count;
3367
3368 if ((count > 0) && (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
3369 int cur = 0;
3370
3371 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..timecxx . . $ multi_turret#time. = 0;
3372 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes. = (float *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(float) * count);
3373 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes. = (float *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(float) * count);
3374 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. = 0;
3375 }
3376 }
3377
3378 obj->control_typecxx . . $ object#control_type. = control_type;
3379
3380 if (obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! || obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
3381 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
3382 int num_wbs = pm->num_wbscxx . . $ poly_model#num_wbs.;
3383
3384 if (obj->dynamic_wbcxx . . $ object#dynamic_wb. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
3385 if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
3386 obj->dynamic_wbcxx . . $ object#dynamic_wb. = (dynamic_wb_infocxx . . $ dynamic_wb_info# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(dynamic_wb_info) * MAX_WBS_PER_OBJcxx . . $ `lib/robotfirestruct.h:32:9`!);
3387 } else {
3388 if (num_wbs)
3389 obj->dynamic_wbcxx . . $ object#dynamic_wb. = (dynamic_wb_infocxx . . $ dynamic_wb_info# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(dynamic_wb_info) * num_wbs);
3390 }
3391 }
3392 }
3393 }
3394
3395 void ObjSetAnimUpdatecxx . . $ ObjSetAnimUpdate(fed6272ca188c09c).(uint16_tcxx . . $ uint16_t# objnum, custom_animcxx . . $ custom_anim# *multi_anim_info) {
3396 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
3397 polyobj_infocxx . . $ polyobj_info# *pm;
3398
3399 if ((objnum >= 0) && (obj->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!)) {
3400 pm = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.;
3401 pm->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info. =cxx . . $ custom_anim#`operator=`(88f287df8ac4f702). *multi_anim_info;
3402
3403 // Make sure we mark it as current and
3404 pm->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info..flagscxx . . $ custom_anim#flags. |= FMA_VALIDcxx . . $ `Descent3/object.h:661:9`!;
3405 pm->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info..flagscxx . . $ custom_anim#flags. &= ~FMA_CURRENTcxx . . $ `Descent3/object.h:662:9`!;
3406 }
3407 }
3408
3409 void ObjGetTurretUpdatecxx . . $ ObjGetTurretUpdate(5fa85d5dddf7408c).(uint16_tcxx . . $ uint16_t# objnum, multi_turretcxx . . $ multi_turret# *multi_turret_info) {
3410 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
3411 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
3412 polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.;
3413
3414 if ((objnum >= 0) && (obj->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) &&
3415 (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets.)) {
3416 int i;
3417 int j;
3418 int count = 0;
3419
3420 multi_turret_info->timecxx . . $ multi_turret#time. = Gametimecxx . . $ Gametime.;
3421 multi_turret_info->num_turretscxx . . $ multi_turret#num_turrets. = p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets.;
3422
3423 for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) {
3424 for (j = 0; j < pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets.; j++) {
3425 multi_turret_info->keyframescxx . . $ multi_turret#keyframes.[count++] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j];
3426 }
3427 }
3428 }
3429 }
3430
3431 void ObjSetTurretUpdatecxx . . $ ObjSetTurretUpdate(5fa85d5dddf7408c).(uint16_tcxx . . $ uint16_t# objnum, multi_turretcxx . . $ multi_turret# *multi_turret_info) {
3432 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
3433 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.];
3434 polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.;
3435
3436 if ((objnum >= 0) && (obj->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) && (obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!) &&
3437 (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets.)) {
3438 int i;
3439
3440 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..timecxx . . $ multi_turret#time. = multi_turret_info->timecxx . . $ multi_turret#time.;
3441
3442 for (i = 0; i < p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets.; i++) {
3443 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes.[i] = multi_turret_info->keyframescxx . . $ multi_turret#keyframes.[i];
3444 }
3445
3446 p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. = FMT_NEW_DATAcxx . . $ `Descent3/object.h:667:9`!;
3447 } else {
3448 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Woops, no turret here to update!\n");
3449 }
3450 }
3451
3452 // Returns the original parent for the given object. Returns self if it has no parent
3453 objectcxx . . $ object# *ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(objectcxx . . $ object# *child) {
3454 ASSERTcxx . . $ `misc/pserror.h:246:9`!(child);
3455
3456 objectcxx . . $ object# *ret = child;
3457 int handle;
3458
3459 handle = child->parent_handlecxx . . $ object#parent_handle.;
3460
3461 while (ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle)) {
3462 ret = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle);
3463 handle = ret->parent_handlecxx . . $ object#parent_handle.;
3464 }
3465 return ret;
3466 }
3467
3468 // Sets an object to a type OBJ_DUMMY (saves it's old type) so it won't be renderered, etc, but still alive
3469 void ObjGhostObjectcxx . . $ ObjGhostObject(d4f767463ce0a6b3).(int objnum) {
3470 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum >= 0 && objnum < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!);
3471 if (objnum < 0 || objnum >= MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!)
3472 return;
3473
3474 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
3475
3476 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!);
3477 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!); // Don't ghost a ghosted object!!
3478 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
3479 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type != OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!);
3480
3481 if (obj->typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! || obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`! || obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!)
3482 return;
3483
3484 obj->dummy_typecxx . . $ object#dummy_type. = obj->typecxx . . $ object#type.;
3485 obj->typecxx . . $ object#type. = OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!;
3486 }
3487
3488 // Restores a ghosted object back to it's old type
3489 void ObjUnGhostObjectcxx . . $ ObjUnGhostObject(d4f767463ce0a6b3).(int objnum) {
3490 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objnum >= 0 && objnum < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!);
3491 if (objnum < 0 || objnum >= MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!)
3492 return;
3493
3494 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum];
3495
3496 ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->type == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!);
3497
3498 if (obj->typecxx . . $ object#type. != OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!)
3499 return;
3500
3501 //@@ASSERT (!(obj->flags&OF_INPLAYERINVENTORY));
3502 //@@if(obj->flags&OF_INPLAYERINVENTORY)
3503 //@@ return;
3504 if (obj->flagscxx . . $ object#flags. & OF_INPLAYERINVENTORYcxx . . $ `Descent3/object_external.h:299:9`!) {
3505 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "UnGhosting Object in that is currently in a player's inventory!\n");
3506 }
3507
3508 obj->typecxx . . $ object#type. = obj->dummy_typecxx . . $ object#dummy_type.;
3509 obj->dummy_typecxx . . $ object#dummy_type. = OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!;
3510 }