Debian Codegraph @

Descent3/gamesequence.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/gamesequence.cpp $
21 * $Revision: 313 $
22 * $Date: 8/30/01 12:20p $
23 * $Author: Matt $
24 *
25 * Game Sequencer
26 *
27 * $Log: /DescentIII/main/gamesequence.cpp $
28 *
29 * 313 8/30/01 12:20p Matt
30 * Removed Int3
31 *
32 * 312 7/09/01 4:22p Matt
33 * Fixed code that was supposed to find an allowed ship in a netgame but
34 * did so using the AllowedShips[] array instead of the Ships[] array, so
35 * it would never find the add-on ships.
36 *
37 * 311 4/20/00 12:29p Matt
38 * From Duane for 1.4
39 * Added checks, asserts, and fixes for bad return values
40 * Free the BSP tree when freeing a level
41 * On Mac, free all sounds when flushing the data cache
42 * Mac-only controller changes
43 *
44 * 310 4/06/00 9:25a Matt
45 * Fixed a screen clear problem on at ATI Rage Fury Maxx in dual-chip mode
46 * by forcing the screen to clear four times (instead of three).
47 *
48 * 309 3/20/00 12:09p Matt
49 * Merge of Duane's post-1.3 changes.
50 * Mac controller stuff
51 * Fixed mem leaks with game paths
52 * Message for PageDown pause
53 * Removed dynamic lightmap info system
54 *
55 * 308 1/26/00 9:20p Jeff
56 * added support for IntelliVIBE DLL
57 *
58 * 307 10/29/99 5:01p Jeff
59 * fixed bug where ending a cinematic on FreeThisLevel() hosed
60 * resume/suspend controls
61 *
62 * 306 10/22/99 10:51p Matt
63 * Mac merge
64 *
65 * 305 10/22/99 3:40p Kevin
66 * Mac merge fixes
67 *
68 * 304 7/20/99 1:18p Samir
69 * save state of rearviews between game through the pilot file.
70 *
71 * 303 6/14/99 4:04p Matt
72 * Fixed problem where goal couldn't be found by the Dallas init function
73 * because it was searching for the English name and the goals had been
74 * translated. Now we load the English text, init the scripts, and then
75 * load the correct language.
76 *
77 * A simpler way of doing this would have been to *not* load the localized
78 * version when the level is loaded, and just loaded it after the script
79 * had been initialized.
80 *
81 * 302 6/08/99 1:00p Jason
82 * changes for bumpmapping
83 *
84 * 301 5/21/99 7:07p Jason
85 * fixed some weird multiplayer rejoin anomalies
86 *
87 * 300 5/20/99 3:40p Jason
88 * made mission looping work correctly in multiplayer
89 *
90 * 299 5/20/99 12:17a Jason
91 * automatically delete all ambient objects if in multiplayer
92 *
93 * 298 5/19/99 5:39p Jason
94 * made level failing work in coop
95 *
96 * 297 5/19/99 11:46a Kevin
97 * fixed problem with level not being loaded and client not able to join
98 * further games.
99 *
100 * 296 5/18/99 7:02p Jeff
101 * created new callback for UI so that game states get set properly (only
102 * really affects music, but fixes a problem for multiplayer games with
103 * music.)
104 *
105 * 295 5/17/99 10:15p Matt
106 * Added system for having ambient objects that get deleted at low detail
107 * levels.
108 *
109 * 294 5/17/99 2:39p Kevin
110 * fixed bug with current_mission.filename and not using strdup to
111 * allocate enough room for the mn3
112 *
113 * 293 5/12/99 1:57p Jason
114 * fixed yet more buggy/ugly code
115 *
116 * 292 5/12/99 1:18p Samir
117 * play music during game too when in menus.
118 *
119 * 291 5/11/99 10:59a Kevin
120 * ship allow/disallow in multi works now
121 *
122 * 290 5/10/99 9:25p Jeff
123 * first phase of Rock 'n' Ride support added
124 *
125 * 289 5/10/99 10:29a Samir
126 * moved StopAllSounds in EndLevel so that both single and multiplayer
127 * stop sounds at the end of a level. (interplay bug).
128 *
129 * 288 5/10/99 3:37a Matt
130 * When starting a level, delete all the viewer objects in the level.
131 *
132 * 287 5/09/99 2:34p Jason
133 * fixed hanging of clients when dedicated server quits
134 *
135 * 286 5/08/99 4:30a Jeff
136 * fixed sequencing bug where clients never got a level end event for the
137 * multiplayer games
138 *
139 * 285 5/07/99 5:39p Samir
140 * better error checking for CheckAndForceDataAlloc for PageInSound.
141 *
142 * 284 5/07/99 5:06p Jason
143 * some dedicated server memory optimizations
144 *
145 * 283 5/07/99 2:50p Jason
146 * fixed a bunch of endlevel multiplayer issues
147 *
148 * 282 5/06/99 4:12p Jason
149 * fixed automap getting cleared after loading a savegame
150 *
151 * 281 5/05/99 6:48p Samir
152 * made pause key take down the pause window as well.
153 *
154 * 280 5/05/99 12:23p Jason
155 * fixed some problems with ending levels
156 *
157 * 279 5/05/99 12:02p Kevin
158 * fixed bug with branching missions and scripts
159 *
160 * 278 5/05/99 1:32a Jeff
161 * save/restore player energy also
162 *
163 * 277 5/05/99 1:28a Jeff
164 * save/restore player's shields in single player game if they are over
165 * 100
166 *
167 * 276 5/04/99 10:47p Samir
168 * added secret level screen.
169 *
170 * 275 5/04/99 4:34p Jason
171 * changes for bumpmapping
172 *
173 * 274 5/03/99 3:35p Kevin
174 * bug fixes
175 *
176 * 273 5/01/99 5:52p Samir
177 * removed RenderHudMessages, and redid RenderHUDMessages so it did what
178 * RenderHudMessages did, resets on screen hud messages. The HUD message
179 * console is resetted in ResetGameMessages.
180 *
181 * 272 4/30/99 12:02p Matt
182 * Keep the rear view up between levels, but close the other camera views.
183 *
184 * 271 4/29/99 11:46p Jason
185 * added ability to set the next level in a multiplayer game
186 *
187 * 270 4/29/99 4:59p Jason
188 * fixed some preuploaded texture problems
189 *
190 * 269 4/28/99 3:33a Jeff
191 * reset IGC system on level load, just for sanity
192 *
193 * 268 4/27/99 6:09p Samir
194 * SetCurrentLevel called for secret levels too.
195 *
196 * 267 4/25/99 6:14p Kevin
197 * added "-timetest file.dem" to behave like gamegauge does
198 *
199 * 266 4/25/99 3:35a Jeff
200 * added a please wait popup dialog when entering telcom
201 *
202 * 265 4/23/99 10:34p Kevin
203 * fixed bad things with multiple CD code
204 *
205 * 264 4/23/99 8:26p Samir
206 * fixed stupid clearscreen bug in endlevel
207 *
208 * 263 4/22/99 9:53a Kevin
209 * Fixed some dedicated server crashes
210 *
211 * 262 4/20/99 6:55p Matt
212 * Added code to keep a bitmask of all keys held by all players, and to
213 * allow a robot to open a door if any player has the key(s) for that
214 * door.
215 *
216 * 261 4/20/99 3:32p Kevin
217 * new prepare for descent behaivor
218 *
219 * 260 4/20/99 2:59p Jeff
220 * fixed SimpleStartLevel
221 *
222 * 259 4/20/99 11:45a Samir
223 * added autosave
224 *
225 * 258 4/17/99 3:44p Kevin
226 * Demo2 changes & fixes
227 *
228 * 257 4/16/99 4:30p Kevin
229 * New Training mission exit code
230 *
231 * 256 4/16/99 12:33a Matt
232 * Disable Soar on non-Windows systems.
233 *
234 * 255 4/15/99 3:26p Samir
235 * stop all sounds when quitting game, so that resume game doesn't
236 * playback any sounds.
237 *
238 * 254 4/15/99 2:47p Kevin
239 * doh! I forgot args.h
240 *
241 * 253 4/15/99 2:43p Kevin
242 * Added some things that I put into the demo for HEAT.NET
243 *
244 * 252 4/15/99 2:37p Kevin
245 * Fixed multi-cd problem going from cd 2 - 1
246 *
247 * 251 4/15/99 1:39a Jeff
248 * changes for linux compile
249 *
250 * 250 4/14/99 6:55p Matt
251 * Fixed secret level sequencing bug
252 *
253 * 249 4/14/99 3:07p Kevin
254 * Fixed some multiple CD bugs
255 *
256 * 248 4/14/99 2:50a Jeff
257 * fixed some case mismatched #includes
258 *
259 * 247 4/12/99 7:15p Samir
260 * prioritization pass 1
261 *
262 * 246 4/12/99 5:57p Kevin
263 * Fixed a sequencing bug with branching levels
264 *
265 * 245 4/08/99 4:21p Samir
266 * clear screen before ending level.
267 *
268 * 244 4/08/99 3:12p Matt
269 * Finished cleaning up level sequencing code. Got rid of all the "level
270 * minus one" stuff.
271 *
272 * 243 4/07/99 3:40p Kevin
273 * Fixes for Beta 1
274 *
275 * 242 4/07/99 12:30p Matt
276 * Added code for failed missions.
277 *
278 * 241 4/06/99 10:44p Samir
279 * Always stop music system when loading new level.
280 *
281 * 240 4/05/99 10:54a Matt
282 * Added auto-waypoint system
283 *
284 * 239 4/04/99 8:15p Jeff
285 * added debug graph stuff
286 *
287 * 238 4/03/99 5:05p Samir
288 * added ENDMISSION keyword to end a mission after a certain level.
289 *
290 * 237 3/25/99 4:57p Jason
291 * fixed resetplayerobject bug
292 *
293 * 236 3/25/99 11:57a Jason
294 * changed some sequencing bugs
295 *
296 * 235 3/24/99 11:55a Jason
297 * added S3 texture compression
298 *
299 * 234 3/24/99 10:54a Kevin
300 * Fixed some problems related to splitting up the main d3.mn3 file across
301 * 2 CDs
302 *
303 * 233 3/23/99 11:52a Jason
304 * added preliminary S3 texture compression support
305 *
306 * 232 3/19/99 4:08p Kevin
307 * Multiple CD installation support
308 *
309 * 231 3/11/99 12:06p Jason
310 * fixed triple buffering problem
311 *
312 * 230 3/10/99 7:12p Jason
313 * added smooth specular shading for curved surfaces
314 *
315 * 229 3/08/99 4:31p Kevin
316 * Fixed interlevel sequencing problem with branching multiplayer
317 * missions.
318 *
319 * 228 3/08/99 3:24p Jeff
320 * fixed end level sequencing where if the level ended while the player
321 * was dead.
322 *
323 * 227 3/05/99 7:42p Kevin
324 * Doh! we weren't resetting timers!!
325 *
326 * 226 3/03/99 2:35a Jeff
327 * clear hud messages at the end of level
328 *
329 * 225 3/03/99 12:56a Kevin
330 * removed assert that was causing problems
331 *
332 * 224 2/28/99 3:24a Samir
333 * call OptionsMenu.
334 *
335 * 223 2/25/99 8:54p Jeff
336 * Inventory supports level change persistant items. Inventory supports
337 * time-out objects. Inventory Reset changed (takes a level of reset
338 * now). Quad lasers stay across level change (single player). Guidebot
339 * bug fixed (now back in ship on level start). Quads time out when
340 * spewed. Invulnerability and cloak powerups no longer use game
341 * event/callbacks, so they can be saved in game saves (moved to
342 * MakePlayerInvulnerable and MakeObjectInvisible)
343 *
344 * 222 2/24/99 3:15p Kevin
345 * OEM menu changes, and bug fixes for the save/load system
346 *
347 * 221 2/24/99 9:57a Kevin
348 * Added error messages if you try to save a game while in multi
349 *
350 * 220 2/21/99 12:18p Chris
351 * Improving the level goal system... Not done.
352 *
353 * 219 2/21/99 4:20p Matt
354 * Added SoundSource objects (and reformatted parts of the object header
355 * files).
356 *
357 * 218 2/21/99 12:28p Matt
358 * Added terrain sound system
359 *
360 * 217 2/20/99 9:22p Jeff
361 * finished telcom level goals screen. Made it so if you go into the
362 * telcom from the game it goes to main menu instead of briefings.
363 *
364 * 216 2/20/99 4:11p Jeff
365 * fixed cockpit selection bug again (which cockpit to use depending on
366 * multi or single)
367 *
368 * 215 2/20/99 2:31p Kevin
369 * Made multiplayer DLLs return to the game list after a game.
370 *
371 * 214 2/20/99 2:17p Matt
372 * Added texture sounds
373 *
374 * 213 2/19/99 12:01p Jason
375 * took out sky band
376 *
377 * 211 2/16/99 12:38p Kevin
378 * Improved paging data progress indicator
379 *
380 * 210 2/16/99 11:13a Jason
381 * fixed bug in cockpit initialization code
382 *
383 * 209 2/15/99 7:49p Jeff
384 * new pilot file class and read/write system checked in...should be more
385 * robust than old
386 *
387 * 208 2/14/99 8:06p Jeff
388 * start of new pilot read/write...not working yet, still needs work
389 *
390 * 207 2/12/99 3:54a Jeff
391 * added function to restart a level, and a cheat key to do so (del-alt-e)
392 *
393 * 205 2/10/99 4:56p Kevin
394 * Better progress indicator & prepare for Descent message
395 *
396 * 204 2/10/99 3:47p Jason
397 * table filter changes
398 *
399 * 203 2/10/99 1:47p Matt
400 * Changed object handle symbolic constants
401 *
402 * 202 2/10/99 10:58a Kevin
403 * doh!
404 *
405 * 201 2/10/99 10:56a Kevin
406 * Took out loadlevelcb calls for now
407 *
408 * 200 2/09/99 7:01p Kevin
409 * First work for new and improved progress screen while loading a level.
410 * Note that this is a hack at this point, while I get the details worked
411 * out, then I'll make it cleaner.
412 *
413 * 199 2/05/99 7:23p Kevin
414 * OEM Changes
415 *
416 * 198 2/04/99 12:35p Jeff
417 * free in-game cinematics when level ends
418 *
419 * 197 2/01/99 6:14p Kevin
420 * Moved InitLevelScripts to later in the sequence
421 *
422 * 196 2/01/99 3:57p Samir
423 * fixed bug in secret levels.
424 *
425 * 195 2/01/99 12:44p Jason
426 * added another bumpmapping pass
427 *
428 * 194 2/01/99 10:35a Matt
429 * Fixed the initial player position in the game when playing from the
430 * editor.
431 *
432 * 193 1/31/99 7:25p Matt
433 * Renamed a bunch of functions to have HUD capitalized
434 *
435 * 192 1/31/99 3:44p Matt
436 * Streamlined game sequencing
437 *
438 * 191 1/29/99 6:29p Jason
439 * first pass at adding bumpmaps
440 *
441 * 190 1/29/99 2:08p Jeff
442 * localization
443 *
444 * 189 1/29/99 12:48p Matt
445 * Rewrote the doorway system
446 *
447 * 188 1/28/99 11:32a Jason
448 * added marker cameras
449 *
450 * 187 1/22/99 3:59p Jason
451 * added 256x256 textures to help with terrain skies
452 *
453 * 186 1/21/99 11:15p Jeff
454 * pulled out some structs and defines from header files and moved them
455 * into seperate header files so that multiplayer dlls don't require major
456 * game headers, just those new headers. Side effect is a shorter build
457 * time. Also cleaned up some header file #includes that weren't needed.
458 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
459 * manage.h and multi.h
460 *
461 * 185 1/20/99 4:20p Samir
462 * finished secret level implementation.
463 *
464 * 184 1/20/99 10:50a Jason
465 * added new terrain
466 *
467 * 183 1/19/99 11:25a Jason
468 * added room (fog and wind) changing functions
469 *
470 * 182 1/15/99 7:16p Kevin
471 * Added GameGauge Configuration & code
472 *
473 * 181 1/14/99 3:08p Jason
474 * more cache changes
475 *
476 * 180 1/14/99 3:05p Jason
477 * fixed stupid texture data bug
478 *
479 * 179 1/14/99 2:26p Jason
480 * made data tracking more reliable
481 *
482 * 178 1/13/99 2:28a Chris
483 * Massive AI, OSIRIS update
484 *
485 * 177 1/08/99 2:55p Samir
486 * Ripped out OSIRIS1.
487 *
488 * 176 1/04/99 6:45p Jason
489 * took out paging return
490 *
491 * 175 12/29/98 4:30p Jason
492 * added add-on data functionality
493 *
494 * 174 12/28/98 5:56p Jason
495 * don't page in data if editor
496 *
497 * 173 12/23/98 1:25p Chris
498 * Got the FIRST AI working!!!!!!!! I need to rearrange the sequencing so
499 * that the AIInitAll wouldn't reset objects AFTER there EVT_AI_INIT was
500 * called.
501 *
502 * 172 12/21/98 3:33p Samir
503 * level warp fully implemented.
504 *
505 * 171 12/21/98 9:44a Chris
506 * Ambient life stuff is all tied in to game sequencing
507 *
508 * 170 12/18/98 5:40p Chris
509 * Ambient life is now all sequenced up
510 *
511 * 169 12/15/98 4:28p Jeff
512 * added mission data information to the pilot files to save what the
513 * highest level they achieved on a mission is. Added level select dialog
514 * (not hooked up) and level warp cheat.
515 *
516 * 168 12/14/98 11:57a Jason
517 * changes for visibile automap
518 *
519 * 167 12/03/98 12:50p Samir
520 * music file loaded at beginning of level.
521 *
522 * 166 11/19/98 5:40p Kevin
523 * Demo system
524 *
525 * 165 11/16/98 12:19p Samir
526 * pause and resume sounds until first frame of level.
527 *
528 * 164 11/13/98 2:28p Samir
529 * new music system.
530 *
531 * 163 11/09/98 3:08p Kevin
532 * Added demo code
533 *
534 * 162 11/05/98 7:36p Samir
535 * rearranged some sequencing so that common editor/game code gets called,
536 * and moved redundant game screen init code to StartNewLevel.
537 *
538 * 161 11/05/98 5:54p Kevin
539 * Demo system work
540 *
541 * 160 10/30/98 3:44p Samir
542 * reset multi_ui_bail.
543 *
544 * 159 10/23/98 12:51p Samir
545 * added call to SetHudMode so that level sequencing maintains the hud.
546 *
547 * 158 10/22/98 8:31p Chris
548 * Sounds use GlobalAlloc and GlobalFree
549 *
550 * 157 10/22/98 5:46p Jason
551 * took care of remaining page-in issues
552 *
553 * 156 10/22/98 4:11p Samir
554 * took out ifdef DEMO for inventory.
555 *
556 * 155 10/22/98 3:30p Samir
557 * fixed for editor the hud.
558 *
559 * 154 10/22/98 2:40p Samir
560 * redid HUD sequencing so multiplayer hud stuff works.
561 *
562 * 153 10/22/98 1:30a Jeff
563 * (Samir) ifdefed out guidebot interface for demo
564 *
565 * 152 10/21/98 9:28p Jason
566 * Made no lightmaps work globally
567 *
568 * 151 10/21/98 7:04p Samir
569 * moved init hud and cockpit to init level
570 *
571 * 150 10/21/98 6:53p Jason
572 * changes for shitty direct3d cards
573 *
574 * 149 10/21/98 4:52p Jeff
575 * disallow Automap for Demo
576 *
577 * 148 10/21/98 1:37p Jason
578 * fixed naming bug
579 *
580 * 147 10/21/98 12:05p Jason
581 * changes for data paging
582 *
583 * 146 10/21/98 10:35a Samir
584 * cleaned up GameInterface code.
585 *
586 * 145 10/20/98 8:48p Sean
587 * Don't call ResetPlayerObject() when playing from the editor, since that
588 * caused the player to move to the start position. (MattT on Sean's
589 * machine.)
590 *
591 * 144 10/20/98 6:50p Matt
592 * Fixed small bug paging in object animation sounds.
593 *
594 * 143 10/20/98 2:53a Kevin
595 * gunboy crap
596 *
597 * 142 10/20/98 12:11a Chris
598 *
599 * 141 10/19/98 11:22p Samir
600 * clear screen after UI.
601 *
602 * 140 10/19/98 11:06p Kevin
603 *
604 * 139 10/19/98 8:51p Matt
605 * Added missing period in pause message.
606 *
607 * 138 10/19/98 7:45p Matt
608 *
609 * 137 10/19/98 5:40p Samir
610 * added loading level callback.
611 *
612 * 136 10/19/98 12:12p Samir
613 * call ResetPlayerObject from StartNewLevel.
614 *
615 * 135 10/19/98 11:57a Chris
616 * Update the sound system to use the import volume
617 *
618 * 134 10/18/98 11:11p Matt
619 * Added call to ClearTransientObjects() and cleaned up some sequencing
620 * stuff.
621 *
622 * 133 10/18/98 7:27p Samir
623 * flush controller at start of every level.
624 *
625 * 132 10/16/98 4:03p Matt
626 * Fixed run-on in pause message.
627 *
628 * 131 10/15/98 8:32p Matt
629 * Fixed bug with starting abient sounds that caused rooms & other
630 * non-generic objects to have ambient sounds.
631 *
632 * 130 10/14/98 6:40p Samir
633 * write pilot files out at quitting game.
634 *
635 * 129 10/12/98 3:02p Jeff
636 * moved DEFAULT_SHIP #define into ship.h
637 *
638 * 128 10/12/98 11:15a Samir
639 * changed some sequencing stuff in GAMESTATE_LVLSTART.
640 *
641 * 127 10/09/98 4:13p Matt
642 * Use different default ship for the demo
643 *
644 * 126 10/08/98 8:01p Nate
645 * got rid of warning.
646 *
647 * 125 10/08/98 7:29p Samir
648 * revamped sequencing.
649 *
650 * 124 10/08/98 2:33p Kevin
651 *
652 * 123 10/08/98 2:29p Kevin
653 * fixed bad if statement
654 *
655 * 122 10/08/98 12:00p Kevin
656 * Demo system work
657 *
658 * 121 10/07/98 12:22p Jason
659 *
660 * 120 10/06/98 5:45p Kevin
661 * Added new configuration for demo
662 *
663 * 119 10/06/98 2:38p Jeff
664 * fixed paused message
665 *
666 * 118 10/05/98 12:09p Kevin
667 * Converted projects to VC6 and demo file stuff added
668 *
669 * 117 10/02/98 3:40p Chris
670 * Improved the level goal code
671 *
672 * 116 9/28/98 2:15p Kevin
673 * Changed calls to network idle function
674 *
675 * 115 9/28/98 11:02a Kevin
676 * added Networking defer, and fixed some UI issues
677 *
678 * 114 9/28/98 10:55a Jason
679 * fixed some bugs that VC6 caught
680 *
681 * 113 9/25/98 4:55p Jason
682 * flush all multiplayer buffers at the start of a new level
683 *
684 * 112 9/17/98 3:31p Samir
685 * if level is ending, freethislevel gets called twice (at EndLevel, and
686 * QuitToMenu), so make sure we don't freelevel in latter case.
687 *
688 * 111 9/16/98 5:10p Jason
689 * added first pass at thrid-person camera system
690 *
691 * 110 9/15/98 4:31p Jason
692 * added more functionality for the dedicated server
693 *
694 * 109 9/10/98 3:07p Chris
695 * Improved matcen sequencing code and test effect1
696 *
697 * 108 9/10/98 12:55p Chris
698 * Added pre-level initialization for matcens :)
699 *
700 * 107 9/09/98 1:08p Jeff
701 * commented out call to FlushDataCache in FreeThisLevel
702 *
703 * 106 9/08/98 3:25p Matt
704 * Fixed, hopefully, problems with getting the the player position &
705 * orientation back to the editor when playing from the editor.
706 *
707 * 105 9/08/98 12:05p Jason
708 * moved doorway.h out of room.h
709 *
710 * 104 9/08/98 10:28a Samir
711 * added function to deinitialize a level.
712 *
713 * 103 9/03/98 12:11p Chris
714 * Adding matcen support
715 *
716 * 102 8/29/98 6:53p Jeff
717 * added single-player ship selection
718 *
719 * 101 8/28/98 1:34p Matt
720 * Added code to reset the waypoint when starting a new level, and while I
721 * was at it cleaned up the new level start sequencing.
722 *
723 * 100 8/27/98 2:51p Jeff
724 * made it so SHIFT-ESC exits the TelCom back to Main Menu
725 *
726 * 99 8/26/98 1:48a Chris
727 * Fixed odd non-stopping sounds when ESC out of the game - etc.
728 *
729 * 98 8/24/98 2:45p Jason
730 * tweaks to the data cache stuff
731 *
732 * 97 8/24/98 10:42a Jason
733 * more memory paging issues dealt with
734 *
735 * 96 8/21/98 8:28p Samir
736 * made FlushDataCache bail if in the editor
737 *
738 * 95 8/21/98 5:14p Jason
739 * made better memory use of primitives
740 *
741 * 94 8/21/98 3:02p Jason
742 * better paging in of weapons stuff
743 *
744 * 93 8/20/98 10:52a Samir
745 * added load game(restore game) functionality from main menu.
746 *
747 * 92 8/19/98 6:39p Samir
748 * took out null of Current_level.
749 *
750 * 91 8/19/98 5:36p Samir
751 * pause game when in load game state.
752 *
753 * 90 8/18/98 3:02p Samir
754 * new sequencing for LoadGameState and PLEASE define Current_level some
755 * other way (or at least keep the definition in StartNewLebvel)
756 *
757 * 89 8/18/98 1:50p Matt
758 * Added missing ambient sound init
759 *
760 * 88 8/18/98 1:05a Samir
761 *
762 * 87 8/17/98 6:40p Matt
763 * Added ambient sound system
764 *
765 * 86 8/16/98 5:56p Jeff
766 * added game interface for multiplayer dll ui stuff
767 *
768 * 85 8/10/98 6:19p Jason
769 * Reset all doorways at the beginning of a level
770 *
771 * 84 8/10/98 2:21p Jeff
772 * changes made due to adding flag for inventory reset
773 *
774 * 83 8/04/98 2:32p Chris
775 * Improved attach code added more fixes to the AABB partial computation
776 * patch
777 *
778 * 82 7/31/98 5:19p Samir
779 * mission filenames are dynamically allocated now to allow for pathnames
780 * (since we'd have too many 256 char arrays per level.
781 *
782 * 81 7/28/98 5:41p Samir
783 * music system hooks.
784 *
785 * 80 7/20/98 12:04p Jason
786 * added per level satellite lighting
787 *
788 * 79 6/29/98 6:42p Samir
789 * Properly handle controller pausing and resumption.
790 *
791 * 78 6/25/98 5:22p Kevin
792 * Req/Send gametime to clients
793 *
794 * 77 6/25/98 12:43p Jeff
795 * Added exit game confirmation
796 *
797 * 76 6/24/98 5:18p Matt
798 * Added code for user pausing
799 *
800 * 75 6/23/98 11:10p Matt
801 * Simplified some code
802 *
803 * 74 6/19/98 3:03p Chris
804 * Made CheckAndForceSoundDataAlloc a SoundSystem function - useful for
805 * multiple mixers. Added IsSoundPlaying to the high level sound lib.
806 *
807 * 73 6/16/98 10:38a Jeff
808 * localization, strings pulled out to stringtable.h and d3.str
809 *
810 * 72 6/15/98 10:54a Chris
811 * All sounds stop at the end of a level
812 *
813 * 71 5/27/98 12:36a Samir
814 * print out message saying demo will restart in x minutes for E3.
815 *
816 * 70 5/26/98 11:03p Chris
817 *
818 * 69 5/26/98 10:54p Chris
819 * Ooops again
820 *
821 * 68 5/26/98 10:49p Samir
822 * reset level timer limit for E3.
823 *
824 * 67 5/26/98 10:42p Chris
825 * Fixed door sound paging
826 *
827 * 66 5/26/98 10:21p Chris
828 * Added door sound paging
829 *
830 * 65 5/26/98 10:16p Jason
831 * Precache terrain lod bitmaps
832 *
833 * 64 5/26/98 5:04p Samir
834 * took out calls to SetHudMode (called in SetScreenMode)
835 *
836 * 63 5/26/98 2:49p Jason
837 * fixed FOV bug
838 *
839 * 62 5/25/98 8:29p Samir
840 * moved call to postlevel results to EndLevel function.
841 *
842 * 61 5/25/98 3:46p Jason
843 * added better light glows
844 *
845 * 60 5/24/98 2:55a Jeff
846 * added paramter to MenuOptions()
847 *
848 * 59 5/22/98 12:34p Matt
849 * Added scorch mark/bullet hole system.
850 *
851 * 58 5/21/98 2:32p Samir
852 * added full support for intra-mission level branching.
853 *
854 * 57 5/18/98 4:36p Jeff
855 * TelCom uses Game_interface_mode variable now
856 *
857 * 56 5/17/98 4:08p Chris
858 * Fixed bugs with initial sound loading. :)
859 *
860 * 55 5/15/98 5:18p Chris
861 * Working on sound paging
862 *
863 * 54 5/15/98 5:07p Chris
864 * Fixed some bugs in sound paging
865 *
866 * 53 5/14/98 3:18p Jason
867 * finished multiplayer sequencing issues
868 *
869 * 52 5/14/98 11:49a Chris
870 * Bettered the sound paging system
871 *
872 * 51 5/12/98 4:18p Jason
873 * added better level sequencing for multiplayer
874 *
875 * 50 5/12/98 12:33p Jason
876 * got level sequencing working in multiplayer
877 *
878 * 49 5/11/98 6:19p Samir
879 * hide cursor when entering game.
880 *
881 * 48 5/11/98 4:14p Samir
882 * set ui callback to NULL when just entering game....
883 *
884 * 47 5/11/98 11:31a Jason
885 * added some events for level sequencing
886 *
887 * 46 5/05/98 5:16p Samir
888 * moved loading level message to this file.
889 *
890 * 45 5/01/98 4:24p Samir
891 * open cockpit fully if current hud mode is cockpit at start of level.
892 *
893 * 44 4/24/98 5:31p Samir
894 * reset reticle at game start
895 *
896 * 43 4/24/98 1:53a Samir
897 * took care of a lot of scripting memory leaks.
898 *
899 * 42 4/21/98 4:16a Samir
900 * clear out obj_text array in level node for simple start level.
901 *
902 * 41 4/20/98 10:02a Chris
903 * Working on fixing AI/OSIRIS integration bugs
904 *
905 * 40 4/16/98 2:56p Chris
906 * Updated buddy support and intergrated scripting and AI
907 *
908 * 39 4/16/98 6:52a Samir
909 * took out cockpit init.free code
910 *
911 * 38 4/14/98 9:18p Samir
912 * redid post level results.
913 *
914 * 37 4/10/98 2:58p Chris
915 * Redid where the buddy gets allocated, not all the way done yet.
916 *
917 * 36 4/09/98 7:02p Chris
918 *
919 * 35 4/09/98 6:57p Craig
920 * FIxed a sequencing bug
921 *
922 * 34 4/07/98 4:25p Chris
923 * Added support for buddy bot
924 *
925 * 33 4/06/98 5:13p Chris
926 * Sounds page in at the beginning of a level
927 *
928 * 32 4/06/98 12:14p Jason
929 * changes to multiplayer
930 *
931 * 31 4/03/98 3:36p Chris
932 * Added the start of the buddy menu
933 *
934 * 30 4/02/98 11:11a Samir
935 * Error checking for level load/misison init fail.
936 *
937 * 29 3/31/98 3:49p Jason
938 * added memory lib
939 *
940 * 28 3/27/98 5:06p Samir
941 * took out unnecessary mprintfs.
942 *
943 * 27 3/23/98 7:06p Chris
944 *
945 * 26 3/23/98 6:16p Chris
946 * added some soar_helpers and some debug mprintf's
947 *
948 * 25 3/17/98 2:40p Samir
949 * reorg of hud/gauge system.
950 *
951 * 24 3/13/98 12:37p Jeff
952 * start level at 0 for simplestartlevel.
953 *
954 * 23 3/13/98 12:08p Samir
955 * Added SimpleStartLevel.
956 *
957 * 22 3/05/98 2:51p Jeff
958 * Added Help interface
959 *
960 * 21 3/05/98 2:50p Chris
961 * A bunch of SOAR updates
962 *
963 * 20 3/03/98 12:10p Samir
964 * Added simple pausing.
965 *
966 * 19 3/02/98 5:52p Samir
967 * Added game interface system.
968 *
969 * 18 2/23/98 1:59p Jason
970 * touch terrain textures when initting a level
971 *
972 * 17 2/18/98 3:25p Samir
973 * Added test systems code.
974 *
975 * 16 2/18/98 1:19a Samir
976 * DoLevelIntro now bails at the right place if we're in multiplayer mode.
977 *
978 * 15 2/17/98 8:26p Chris
979 *
980 * 14 2/17/98 7:48p Chris
981 *
982 * 13 2/17/98 7:47p Chris
983 *
984 * 12 2/17/98 4:42p Samir
985 * Current_level is now defined after calling DoLevelIntro.
986 *
987 * 11 2/17/98 2:22p Jason
988 * fixed multiplayer sequencing with briefings
989 *
990 * 10 2/17/98 12:20p Chris
991 * Made sounds not get paged out at end/beginning of level
992 *
993 * 9 2/13/98 6:43p Samir
994 * ifdef out editor code iin GameSequencer.
995 *
996 * 8 2/13/98 12:40p Jason
997 * added functions to touch all data in a level when the level is loaded
998 *
999 * 7 2/13/98 10:57a Samir
1000 * Changed some gamescript initialization.
1001 *
1002 * 6 2/12/98 6:51p Matt
1003 * Renamed GameLoop() to be GameFrame(), cleaned up the StartTime/StopTime
1004 * system, and moved the interval script call to GameFrame().
1005 *
1006 * 5 2/12/98 5:08p Matt
1007 * Reset cockpit mode when starting a level. Unfortunately, this involved
1008 * some semi-major mucking with game sequencing.
1009 *
1010 * 4 2/11/98 4:36p Samir
1011 * Call SetGameMode to modify game mode.
1012 *
1013 * 3 2/09/98 3:58p Matt
1014 * Initialize small views and camera views at level start
1015 *
1016 * 2 2/08/98 5:01p Samir
1017 * New game sequencing changes.
1018 *
1019 * 1 2/08/98 3:54p Samir
1020 * Initial revision.
1021 *
1022 * $NoKeywords: $
1023 */
1024 #ifdef USE_PROFILER
1025 #include <profiler.h>
1026 #endif
1027
1028 #include "gamesequence.h"cxx . . $ `<file>/Descent3/gamesequence.h`/
1029
1030 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
1031 #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/
1032 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
1033 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
1034 #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/
1035 #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/
1036 #include "gameevent.h"cxx . . $ `<file>/Descent3/gameevent.h`/
1037 #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/
1038
1039 #include "soar_helpers.h"cxx . . $ `<file>/Descent3/soar_helpers.h`/
1040
1041 #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/
1042 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
1043 #include "SmallViews.h"cxx . . $ `<file>/Descent3/SmallViews.h`/
1044 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
1045 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
1046 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
1047 #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/
1048 #include "menu.h"cxx . . $ `<file>/Descent3/menu.h`/
1049 #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/
1050 #include "cockpit.h"cxx . . $ `<file>/Descent3/cockpit.h`/
1051 #include "help.h"cxx . . $ `<file>/Descent3/help.h`/
1052 #include "buddymenu.h"cxx . . $ `<file>/Descent3/buddymenu.h`/
1053 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
1054 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
1055 #include "robot.h"cxx . . $ `<file>/Descent3/robot.h`/
1056 #include "screens.h"cxx . . $ `<file>/Descent3/screens.h`/
1057 #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/
1058 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
1059 #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/
1060 #include "scorch.h"cxx . . $ `<file>/Descent3/scorch.h`/
1061 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
1062 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
1063 #include "ddio_common.h"cxx . . $ `<file>/ddio/ddio_common.h`/
1064 #include "gamesave.h"cxx . . $ `<file>/Descent3/gamesave.h`/
1065 #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/
1066 #include "ambient.h"cxx . . $ `<file>/Descent3/ambient.h`/
1067 #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/
1068 #include "pilot.h"cxx . . $ `<file>/Descent3/pilot.h`/
1069 #include "doorway.h"cxx . . $ `<file>/Descent3/doorway.h`/
1070 #include "matcen.h"cxx . . $ `<file>/Descent3/matcen.h`/
1071 #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/
1072 #include "networking.h"cxx . . $ `<file>/lib/networking.h`/
1073 #include "levelgoal.h"cxx . . $ `<file>/Descent3/levelgoal.h`/
1074 #include "demofile.h"cxx . . $ `<file>/lib/demofile.h`/
1075 #include "lightmap_info.h"cxx . . $ `<file>/Descent3/lightmap_info.h`/
1076 #include "lightmap.h"cxx . . $ `<file>/lib/lightmap.h`/
1077 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
1078 #include "d3music.h"cxx . . $ `<file>/Descent3/d3music.h`/
1079 #include "TelComAutoMap.h"cxx . . $ `<file>/Descent3/TelComAutoMap.h`/
1080 #include "aiambient.h"cxx . . $ `<file>/Descent3/aiambient.h`/
1081 #include "ObjScript.h"cxx . . $ `<file>/Descent3/ObjScript.h`/
1082 #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/
1083 #include "gamecinematics.h"cxx . . $ `<file>/Descent3/gamecinematics.h`/
1084 #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/
1085 #include "debuggraph.h"cxx . . $ `<file>/Descent3/debuggraph.h`/
1086 #include "multi_dll_mgr.h"cxx . . $ `<file>/Descent3/multi_dll_mgr.h`/
1087 #include "multi_ui.h"cxx . . $ `<file>/Descent3/multi_ui.h`/
1088 #include "gamepath.h"cxx . . $ `<file>/Descent3/gamepath.h`/
1089 #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/
1090 #include "bsp.h"cxx . . $ `<file>/Descent3/bsp.h`/
1091
1092 #include "args.h"cxx . . $ `<file>/Descent3/args.h`/
1093 void ResetHudMessagescxx . . $ ResetHudMessages(49f6e7a06ebc5aa8).(void);
1094
1095 // Variables
1096 tGameStatecxx . . $ tGameState# Game_statecxx . . $ Game_state. = GAMESTATE_IDLEcxx . . $ GAMESTATE_IDLE.; // current game state.
1097 tGameStatecxx . . $ tGameState# Last_game_statecxx . . $ Last_game_state. = GAMESTATE_IDLEcxx . . $ GAMESTATE_IDLE.; // previous frame game state.
1098 int Game_interface_modecxx . . $ Game_interface_mode. = GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!; // game interface mode (options menu?)
1099
1100 extern bool FirstGamecxx . . $ FirstGame.;
1101
1102 static bool Level_startedcxx . . $ Level_started. = false;
1103 static int Level_warp_nextcxx . . $ Level_warp_next. = 0;
1104
1105 #ifdef E3_DEMO
1106 extern float E3_TIME_LIMIT;
1107 extern bool E3_enforce_level_restart;
1108 #endif
1109
1110 extern float Multi_Game_time_startcxx . . $ Multi_Game_time_start.;
1111
1112 extern bool Demo_loopingcxx . . $ Demo_looping.;
1113 extern bool IsRestoredGamecxx . . $ IsRestoredGame.;
1114
1115 // internal functions
1116 bool StartNewGamecxx . . $ StartNewGame(c9857a73d68e59ba).(); // We start a game by using the current mission in memory.
1117 bool DoLevelIntrocxx . . $ DoLevelIntro(c9857a73d68e59ba).(); // shows movie and briefing
1118 void StartGameFromEditorcxx . . $ StartGameFromEditor(49f6e7a06ebc5aa8).(); // set up new game/new level stuff when playing from editor
1119 void EndLevelcxx . . $ EndLevel(d4f767463ce0a6b3).(int state); // ends the current level.
1120 void RestartLevelcxx . . $ RestartLevel(49f6e7a06ebc5aa8).(); // restarts the current level.
1121 void RunGameMenucxx . . $ RunGameMenu(49f6e7a06ebc5aa8).(); // executes a game menu.
1122 void FreeThisLevelcxx . . $ FreeThisLevel(49f6e7a06ebc5aa8).(); // frees any data/esc that was created for that level.
1123 void FlushDataCachecxx . . $ FlushDataCache(49f6e7a06ebc5aa8).(); // Clears out all the level specific stuff from memory
1124 void SetNextLevelcxx . . $ SetNextLevel(49f6e7a06ebc5aa8).(); // advances to the next level
1125 void CheckHogfilecxx . . $ CheckHogfile(49f6e7a06ebc5aa8).(); // make sure we have the right hogfile
1126
1127 // Data paging functions
1128 void PageInAllDatacxx . . $ PageInAllData(49f6e7a06ebc5aa8).();
1129 void PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(int);
1130 bool PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(int);
1131 void PageInDoorcxx . . $ PageInDoor(d4f767463ce0a6b3).(int);
1132 void PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(int);
1133 void PageInGenericcxx . . $ PageInGeneric(d4f767463ce0a6b3).(int);
1134 void PageInShipcxx . . $ PageInShip(d4f767463ce0a6b3).(int);
1135
1136 // Data allocation arrays, for keeping track of what textures/sounds are level specific
1137 uint8_tcxx . . $ uint8_t# Models_to_freecxx . . $ Models_to_free.[MAX_POLY_MODELScxx . . $ `lib/polymodel_external.h:66:9`!];
1138 uint8_tcxx . . $ uint8_t# Textures_to_freecxx . . $ Textures_to_free.[MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!];
1139 uint8_tcxx . . $ uint8_t# Sounds_to_freecxx . . $ Sounds_to_free.[MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!];
1140
1141 #ifdef EDITOR
1142 extern vector editor_player_pos;
1143 extern matrix editor_player_orient;
1144 extern int editor_player_roomnum;
1145 #endif
1146
1147 extern bool mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(const char *mn3file);
1148 extern void mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).();
1149
1150 extern bool Game_gauge_do_time_testcxx . . $ Game_gauge_do_time_test.;
1151 extern char Game_gauge_usefilecxx . . $ Game_gauge_usefile.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1152
1153 ///////////////////////////////////////////////////////////////////////////////
1154 // Sequences game events
1155 ///////////////////////////////////////////////////////////////////////////////
1156 bool GameSequencercxx . . $ GameSequencer(c9857a73d68e59ba).() {
1157 bool in_editor = (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == EDITOR_GAME_MODEcxx . . $ EDITOR_GAME_MODE.);
1158 tGameStatecxx . . $ tGameState# old_game_state;
1159
1160 // interpret current function mode.
1161 switch (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).()) {
1162 case INIT_MODEcxx . . $ INIT_MODE.:
1163 case GAME_MODEcxx . . $ GAME_MODE.:
1164 case EDITOR_MODEcxx . . $ EDITOR_MODE.:
1165 case EDITOR_GAME_MODEcxx . . $ EDITOR_GAME_MODE.:
1166 case MENU_MODEcxx . . $ MENU_MODE.:
1167 case QUIT_MODEcxx . . $ QUIT_MODE.:
1168 case CREDITS_MODEcxx . . $ CREDITS_MODE.:
1169 case GAMEGAUGE_MODEcxx . . $ GAMEGAUGE_MODE.:
1170 break;
1171 case RESTORE_GAME_MODEcxx . . $ RESTORE_GAME_MODE.:
1172 case LOADDEMO_MODEcxx . . $ LOADDEMO_MODE.:
1173 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(GAME_MODEcxx . . $ GAME_MODE.); // need to do so sequencer thiks we're in game.
1174 break;
1175 }
1176
1177 // The main game sequencer
1178 while ((GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == GAME_MODEcxx . . $ GAME_MODE.) || (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == EDITOR_GAME_MODEcxx . . $ EDITOR_GAME_MODE.)) {
1179 old_game_state = Game_statecxx . . $ Game_state.;
1180
1181 switch (Game_statecxx . . $ Game_state.) {
1182 case GAMESTATE_IDLEcxx . . $ GAMESTATE_IDLE.:
1183 break;
1184 case GAMESTATE_NEWcxx . . $ GAMESTATE_NEW.:
1185 StartNewGamecxx . . $ StartNewGame(c9857a73d68e59ba).();
1186 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLSTARTcxx . . $ GAMESTATE_LVLSTART.);
1187 break;
1188
1189 case GAMESTATE_LVLSTARTcxx . . $ GAMESTATE_LVLSTART.:
1190 CheckHogfilecxx . . $ CheckHogfile(49f6e7a06ebc5aa8).(); // make sure we have the right hogfile
1191
1192 if (in_editor) { // start in editor
1193 #ifdef EDITOR
1194 StartGameFromEditor();
1195 #endif
1196 } else { // start in game
1197 if (!DoLevelIntrocxx . . $ DoLevelIntro(c9857a73d68e59ba).() || !LoadAndStartCurrentLevelcxx . . $ LoadAndStartCurrentLevel(c9857a73d68e59ba).()) {
1198 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
1199 MultiLeaveGamecxx . . $ MultiLeaveGame(49f6e7a06ebc5aa8).();
1200 MultiDLLGameStartingcxx . . $ MultiDLLGameStarting. = 0;
1201 Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu. = false;
1202 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.); // return to main menu
1203 break;
1204 }
1205 }
1206
1207 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLPLAYINGcxx . . $ GAMESTATE_LVLPLAYING.);
1208 break;
1209
1210 case GAMESTATE_LVLPLAYINGcxx . . $ GAMESTATE_LVLPLAYING.:
1211 // must do to display main menu interfaces
1212 if (Last_game_statecxx . . $ Last_game_state. == GAMESTATE_LVLSTARTcxx . . $ GAMESTATE_LVLSTART.) {
1213 // 1st frame resume sounds.
1214 Sound_systemcxx . . $ Sound_system..ResumeSoundscxx . . $ hlsSystem#ResumeSounds(49f6e7a06ebc5aa8).();
1215 }
1216
1217 if (Game_interface_modecxx . . $ Game_interface_mode. != GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!) {
1218 RunGameMenucxx . . $ RunGameMenu(49f6e7a06ebc5aa8).();
1219 } else {
1220 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
1221 GameFramecxx . . $ GameFrame(49f6e7a06ebc5aa8).();
1222 }
1223 break;
1224
1225 case GAMESTATE_LOADDEMOcxx . . $ GAMESTATE_LOADDEMO.:
1226 if (DemoPlaybackFilecxx . . $ DemoPlaybackFile(1ef8e6ec083aabb9).(Demo_fnamecxx . . $ Demo_fname.)) {
1227 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLPLAYINGcxx . . $ GAMESTATE_LVLPLAYING.);
1228 } else {
1229 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1230 }
1231 break;
1232 case GAMESTATE_LOADGAMEcxx . . $ GAMESTATE_LOADGAME.:
1233 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1234 DoMessageBoxcxx . . $ DoMessageBox(dcc99837539e9edc).(TXT_ERRORcxx . . $ `Descent3/stringtable.h:165:9`!, TXT_CANT_LOAD_MULTIcxx . . $ `Descent3/stringtable.h:90:9`!, MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`!);
1235 break;
1236 }
1237 D3MusicStopcxx . . $ D3MusicStop(49f6e7a06ebc5aa8).(); // make sure all music streams are stopped before restoring game.
1238 PauseGamecxx . . $ PauseGame(49f6e7a06ebc5aa8).();
1239 if (!LoadCurrentSaveGamecxx . . $ LoadCurrentSaveGame(c9857a73d68e59ba).()) {
1240 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1241 } else {
1242 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLPLAYINGcxx . . $ GAMESTATE_LVLPLAYING.);
1243 SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(SM_GAMEcxx . . $ SM_GAME.);
1244 SetHUDModecxx . . $ SetHUDMode(1efe68d6753032ab).(GetHUDModecxx . . $ GetHUDMode(d2d05048dda10524).());
1245 }
1246 ResumeGamecxx . . $ ResumeGame(49f6e7a06ebc5aa8).();
1247 break;
1248
1249 case GAMESTATE_LVLENDcxx . . $ GAMESTATE_LVLEND.:
1250 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
1251 EndLevelcxx . . $ EndLevel(d4f767463ce0a6b3).(1);
1252 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLNEXTcxx . . $ GAMESTATE_LVLNEXT.);
1253
1254 // This is for HEAT.NET and their tournement mode stuff
1255 // if(FindArg("-doonelevel"))
1256 // SetGameState(GAMESTATE_LVLSTART);
1257 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-doonelevel")) {
1258 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(QUIT_MODEcxx . . $ QUIT_MODE.);
1259 }
1260
1261 break;
1262
1263 case GAMESTATE_LVLNEXTcxx . . $ GAMESTATE_LVLNEXT.:
1264 SetNextLevelcxx . . $ SetNextLevel(49f6e7a06ebc5aa8).();
1265 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLSTARTcxx . . $ GAMESTATE_LVLSTART.);
1266 break;
1267
1268 case GAMESTATE_LVLWARPcxx . . $ GAMESTATE_LVLWARP.:
1269 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
1270 EndLevelcxx . . $ EndLevel(d4f767463ce0a6b3).(-1);
1271 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(Level_warp_nextcxx . . $ Level_warp_next.);
1272 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLSTARTcxx . . $ GAMESTATE_LVLSTART.);
1273 break;
1274
1275 case GAMESTATE_LVLFAILEDcxx . . $ GAMESTATE_LVLFAILED.:
1276 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
1277 EndLevelcxx . . $ EndLevel(d4f767463ce0a6b3).(0);
1278 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLSTARTcxx . . $ GAMESTATE_LVLSTART.); // restart same level
1279 break;
1280 }
1281 Last_game_statecxx . . $ Last_game_state. = old_game_state;
1282 }
1283
1284 #ifdef EDITOR // Ugly hack to get play position back to the editor
1285 if (Player_object && (Player_object->type == OBJ_PLAYER)) {
1286 editor_player_pos = Player_object->pos;
1287 editor_player_orient = Player_object->orient;
1288 editor_player_roomnum = Player_object->roomnum;
1289 } else
1290 editor_player_roomnum = -1;
1291 #endif
1292
1293 // free up scripts.
1294 PltWriteFilecxx . . $ PltWriteFile(98d330f13870b5ba).(&Current_pilotcxx . . $ Current_pilot.);
1295 FreeThisLevelcxx . . $ FreeThisLevel(49f6e7a06ebc5aa8).();
1296
1297 SetGameModecxx . . $ SetGameMode(d4f767463ce0a6b3).(GM_NONEcxx . . $ `Descent3/game.h:286:9`!);
1298
1299 return true;
1300 }
1301
1302 // Make sure we have the correct hogfile
1303 void CheckHogfilecxx . . $ CheckHogfile(49f6e7a06ebc5aa8).() {
1304 char hogpath[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`! * 2];
1305 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Checking to see if we need to open another hog off of disk or CDROM\n");
1306
1307 if (Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. && (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Current_mission.filename, "d3.mn3") == 0) &&
1308 (Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. > 4)) {
1309 // close the mission hog file and open d3_2.mn3
1310 mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).();
1311 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(hogpath, D3MissionsDircxx . . $ D3MissionsDir., "d3_2.mn3", nullptr);
1312 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(hogpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1313 mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(hogpath);
1314 mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.filename);
1315 Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("d3_2.mn3");
1316 } else {
1317 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1318 }
1319 } else if (Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. && (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Current_mission.filename, "d3_2.mn3") == 0) &&
1320 (Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. <= 4)) {
1321 // Part 2 of the mission is d3_2.mn3
1322 // close the mission hog file and open d3.mn3
1323 mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).();
1324 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(hogpath, D3MissionsDircxx . . $ D3MissionsDir., "d3.mn3", nullptr);
1325 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(hogpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1326 mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(hogpath);
1327 mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.filename);
1328 Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("d3.mn3");
1329 } else {
1330 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1331 }
1332 }
1333 }
1334
1335 ///////////////////////////////////////////////////////////////////////////////
1336 // quickly sets up a mission of 1 level, and doesn't do any
1337 // fancy intro stuff
1338 bool SimpleStartLevelcxx . . $ SimpleStartLevel(c6b7e35ff6de5671).(char *level_name) {
1339 // this initializes a mini one level mission with no frills.
1340
1341 Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. = 1;
1342 Current_missioncxx . . $ Current_mission..num_levelscxx . . $ tMission#num_levels. = 1;
1343 Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels. = (tLevelNodecxx . . $ tLevelNode# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(tLevelNode));
1344 memset(Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels., 0, sizeof(tLevelNodecxx . . $ tLevelNode#));
1345
1346 Current_levelcxx . . $ Current_level. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1347 Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[0].filenamecxx . . $ tLevelNode#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(level_name);
1348 InitMissionScriptcxx . . $ InitMissionScript(c9857a73d68e59ba).();
1349
1350 return true;
1351 }
1352
1353 ///////////////////////////////////////////////////////////////////////////////
1354 // We start a game by using the current mission in memory.
1355 // First we display the mission briefing (the intro movie for Descent 3, if not an add on)
1356 // Then we start level
1357 ///////////////////////////////////////////////////////////////////////////////
1358
1359 bool StartNewGamecxx . . $ StartNewGame(c9857a73d68e59ba).() {
1360 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level.);
1361
1362 ResetGamemodecxx . . $ ResetGamemode(49f6e7a06ebc5aa8).();
1363
1364 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
1365 Player_numcxx . . $ Player_num. = 0; // Reset player num
1366 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = FindShipNamecxx . . $ FindShipName(5c4306d8553b3696).(DEFAULT_SHIPcxx . . $ `Descent3/ship.h:127:9`!);
1367 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Players[Player_num].ship_index != -1);
1368 }
1369
1370 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
1371 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMECREATEDcxx . . $ `lib/d3events.h:72:9`!, &DLLInfocxx . . $ DLLInfo.);
1372
1373 // Load any addon data
1374 mng_LoadAddonPagescxx . . $ mng_LoadAddonPages(49f6e7a06ebc5aa8).();
1375
1376 InitPlayerNewShipcxx . . $ InitPlayerNewShip(3e454b8ccf442868).(Player_numcxx . . $ Player_num., INVRESET_ALLcxx . . $ `Descent3/Inventory.h:201:9`!);
1377 InitPlayerNewGamecxx . . $ InitPlayerNewGame(d4f767463ce0a6b3).(Player_numcxx . . $ Player_num.);
1378
1379 InitCameraViewscxx . . $ InitCameraViews(b45ddcbc8423892c).(1); // Turn off all camera views, including rear views
1380
1381 Quicksave_game_slotcxx . . $ Quicksave_game_slot. = -1; // reset so that quicksave key will always go to savegame menu first
1382
1383 return true;
1384 }
1385
1386 // Shows the intro movie and briefing for a level
1387 bool DoLevelIntrocxx . . $ DoLevelIntro(c9857a73d68e59ba).() {
1388 tLevelNodecxx . . $ tLevelNode# *lvl = Current_levelcxx . . $ Current_level.;
1389
1390 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "In DoLevelIntro()\n");
1391
1392 // multiplayer stuff (we skip the movie and briefings)
1393 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1394 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
1395 // Clear out residual junk
1396 MultiFlushAllIncomingBufferscxx . . $ MultiFlushAllIncomingBuffers(49f6e7a06ebc5aa8).();
1397
1398 if (!MultiPollForLevelInfocxx . . $ MultiPollForLevelInfo(b126dc7c1de90089).()) {
1399 return false;
1400 }
1401 }
1402 return true;
1403 }
1404
1405 #ifdef STEALTH // DAJ just get started
1406 return true;
1407 #endif
1408 // if this level has a movie:
1409 if (lvl->flagscxx . . $ tLevelNode#flags. & LVLFLAG_STARTMOVIEcxx . . $ LVLFLAG_STARTMOVIE.) {
1410 DoMissionMoviecxx . . $ DoMissionMovie(85c52e162fed56f9).(Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1].movienamecxx . . $ tLevelNode#moviename.);
1411 }
1412
1413 // if this level has a briefing:
1414 if (lvl->flagscxx . . $ tLevelNode#flags. & LVLFLAG_BRIEFINGcxx . . $ LVLFLAG_BRIEFING.) {
1415 if (!DoMissionBriefingcxx . . $ DoMissionBriefing(83c267b20bac841a).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1)) {
1416 // quit exit to main menu
1417 return false;
1418 }
1419 }
1420 return true;
1421 }
1422
1423 // Sets the current level for subsequent level loads, movies, or briefings
1424 void SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(int level) {
1425 ASSERTcxx . . $ `misc/pserror.h:246:9`!(level > 0 && level <= Current_mission.num_levels);
1426
1427 // Set this level as the mission's current level
1428 Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. = level;
1429
1430 // Set pointer to this level
1431 Current_levelcxx . . $ Current_level. = &Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[level - 1];
1432 }
1433
1434 void StartLevelSoundscxx . . $ StartLevelSounds(49f6e7a06ebc5aa8).();
1435
1436 // Get rid of any viewer objects in the level
1437 void ClearViewerObjectscxx . . $ ClearViewerObjects(49f6e7a06ebc5aa8).() {
1438 int i;
1439 objectcxx . . $ object# *objp;
1440
1441 for (i = 0, objp = Objectscxx . . $ Objects.; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++, objp++)
1442 if (objp->typecxx . . $ object#type. == OBJ_VIEWERcxx . . $ `Descent3/object_external.h:166:9`!) {
1443 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Deleting viewer object %d\n", i);
1444 ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i);
1445 }
1446 }
1447
1448 // If low or medium detail, delete all or some ambient objects
1449 void DeleteAmbientObjectscxx . . $ DeleteAmbientObjects(49f6e7a06ebc5aa8).() {
1450 int i, count;
1451 objectcxx . . $ object# *objp;
1452
1453 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. == 2) // high
1454 return;
1455
1456 for (i = 0, objp = Objectscxx . . $ Objects., count = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++, objp++) {
1457 if (IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(objp->type) && (Object_infocxx . . $ Object_info.[objp->idcxx . . $ object#id.].flagscxx . . $ object_info#flags. & OIF_AMBIENT_OBJECTcxx . . $ `Descent3/objinfo.h:346:9`!)) {
1458 if ((Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. == 0) || (count & 1) || (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!))
1459 ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i);
1460 count++;
1461 }
1462 }
1463 }
1464
1465 void Localization_SetLanguagecxx . . $ Localization_SetLanguage(d4f767463ce0a6b3).(int type);
1466 int Localization_GetLanguagecxx . . $ Localization_GetLanguage(b126dc7c1de90089).(void);
1467 void LoadLevelTextcxx . . $ LoadLevelText(85c52e162fed56f9).(const char *level_filename);
1468
1469 // Starts the level, which has already been loaded
1470 void StartLevelcxx . . $ StartLevel(49f6e7a06ebc5aa8).() {
1471 extern void RestoreCameraRearviewscxx . . $ RestoreCameraRearviews(49f6e7a06ebc5aa8).(); // gameloop.cpp
1472
1473 // Init time
1474 Gametimecxx . . $ Gametime. = 0.0f;
1475
1476 // Make sure all sounds have stopped
1477 Sound_systemcxx . . $ Sound_system..StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).();
1478
1479 // Get the data for this level
1480 PageInAllDatacxx . . $ PageInAllData(49f6e7a06ebc5aa8).();
1481
1482 // TEMP HACK
1483 if (rend_SupportsBumpmappingcxx . . $ rend_SupportsBumpmapping(b126dc7c1de90089).())
1484 Detail_settingscxx . . $ Detail_settings..Bumpmapping_enabledcxx . . $ tDetailSettings#Bumpmapping_enabled. = 1;
1485 else
1486 Detail_settingscxx . . $ Detail_settings..Bumpmapping_enabledcxx . . $ tDetailSettings#Bumpmapping_enabled. = 0;
1487
1488 // Initialize a bunch of stuff for this level
1489 MakeBOAcxx . . $ MakeBOA(49f6e7a06ebc5aa8).();
1490 ComputeAABBcxx . . $ ComputeAABB(b45ddcbc8423892c).(true);
1491
1492 // Clear/reset objects & events
1493 ClearAllEventscxx . . $ ClearAllEvents(49f6e7a06ebc5aa8).();
1494 ClearRoomChangescxx . . $ ClearRoomChanges(49f6e7a06ebc5aa8).();
1495 ResetMarkerscxx . . $ ResetMarkers(49f6e7a06ebc5aa8).();
1496 ResetScorchescxx . . $ ResetScorches(49f6e7a06ebc5aa8).();
1497 ResetWaypointcxx . . $ ResetWaypoint(49f6e7a06ebc5aa8).();
1498 ResetLightGlowscxx . . $ ResetLightGlows(49f6e7a06ebc5aa8).();
1499 DoorwayDeactivateAllcxx . . $ DoorwayDeactivateAll(49f6e7a06ebc5aa8).();
1500 ClearViewerObjectscxx . . $ ClearViewerObjects(49f6e7a06ebc5aa8).();
1501 DeleteAmbientObjectscxx . . $ DeleteAmbientObjects(49f6e7a06ebc5aa8).();
1502
1503 // AI, scripting, & Soar
1504 AIInitAllcxx . . $ AIInitAll(49f6e7a06ebc5aa8).();
1505
1506 // Set up the player object
1507 ResetPlayerObjectcxx . . $ ResetPlayerObject(918ebd27a9ddbad3).(Player_numcxx . . $ Player_num.);
1508
1509 DSSoarInitcxx . . $ `Descent3/soar_helpers.h:85:9`!();
1510
1511 InitMatcensForLevelcxx . . $ InitMatcensForLevel(49f6e7a06ebc5aa8).();
1512
1513 // What is this?
1514 a_lifecxx . . $ a_life..InitForLevelcxx . . $ ambient_life#InitForLevel(49f6e7a06ebc5aa8).();
1515
1516 // Start sound & music
1517 StartLevelSoundscxx . . $ StartLevelSounds(49f6e7a06ebc5aa8).();
1518 Sound_systemcxx . . $ Sound_system..PauseSoundscxx . . $ hlsSystem#PauseSounds(b45ddcbc8423892c).(); // HACK!! pause sounds started up to now.
1519 D3MusicStartcxx . . $ D3MusicStart(85c52e162fed56f9).(Current_levelcxx . . $ Current_level.->scorecxx . . $ tLevelNode#score.);
1520
1521 // Get the list of waypoints from the waypoint objects
1522 MakeAtuoWaypointListcxx . . $ MakeAtuoWaypointList(49f6e7a06ebc5aa8).();
1523
1524 // Test stuff
1525 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1526 InitTestSystemscxx . . $ InitTestSystems(49f6e7a06ebc5aa8).();
1527 #endif
1528
1529 // Set screen mode
1530 SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(SM_GAMEcxx . . $ SM_GAME.);
1531
1532 // Init HUD and cockpit
1533 int ship_index;
1534
1535 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1536 char ship_model[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!];
1537 Current_pilotcxx . . $ Current_pilot..get_shipcxx . . $ pilot#get_ship(fda57c8427c60377).(ship_model);
1538 ship_index = FindShipNamecxx . . $ FindShipName(5c4306d8553b3696).(ship_model);
1539 ASSERTcxx . . $ `misc/pserror.h:246:9`!(ship_index != -1); // DAJ -1FIX
1540 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
1541 if (PlayerIsShipAllowedcxx . . $ PlayerIsShipAllowed(ceb9eed3194142b2).(Player_numcxx . . $ Player_num., ship_model)) {
1542 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = FindShipNamecxx . . $ FindShipName(5c4306d8553b3696).(ship_model);
1543 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Players[Player_num].ship_index != -1); // DAJ -1FIX
1544 } else {
1545 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Player %d wanted to use a ship (%s) which wasn't allowed.\n", Player_num, ship_model);
1546 int i;
1547 bool found_one = false;
1548
1549 // Loop through ships, looking for one that's allowed
1550 for (i = 0; i < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`! && !found_one; i++) {
1551 if (Shipscxx . . $ Ships.[i].usedcxx . . $ ship#used. && PlayerIsShipAllowedcxx . . $ PlayerIsShipAllowed(cf9ef193275fa6d8).(Player_numcxx . . $ Player_num., i)) {
1552 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = i;
1553 found_one = true;
1554 }
1555 }
1556
1557 // We should have found one
1558 ASSERTcxx . . $ `misc/pserror.h:246:9`!(found_one == true);
1559 }
1560 ship_index = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.;
1561 PlayerChangeShipcxx . . $ PlayerChangeShip(3e454b8ccf442868).(Player_numcxx . . $ Player_num., ship_index);
1562 }
1563 } else {
1564 ship_index = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.;
1565 }
1566
1567 if (ship_index < 0)
1568 ship_index = 0;
1569 InitShipHUDcxx . . $ InitShipHUD(d4f767463ce0a6b3).(ship_index);
1570 InitCockpitcxx . . $ InitCockpit(d4f767463ce0a6b3).(ship_index);
1571 if (GetHUDModecxx . . $ GetHUDMode(d2d05048dda10524).() == HUD_COCKPITcxx . . $ HUD_COCKPIT.) // make sure cockpit is open, if hud mode is cockpit
1572 QuickOpenCockpitcxx . . $ QuickOpenCockpit(49f6e7a06ebc5aa8).();
1573 ResetHUDMessagescxx . . $ ResetHUDMessages(49f6e7a06ebc5aa8).();
1574 ResetGameMessagescxx . . $ ResetGameMessages(49f6e7a06ebc5aa8).();
1575 ResetReticlecxx . . $ ResetReticle(49f6e7a06ebc5aa8).();
1576 ResetSmallViewscxx . . $ ResetSmallViews(49f6e7a06ebc5aa8).(); // ResetSmallViews() must come before InitCameraViews()
1577 InitCameraViewscxx . . $ InitCameraViews(b45ddcbc8423892c).(0); // ResetSmallViews() must come before InitCameraViews()
1578 RestoreCameraRearviewscxx . . $ RestoreCameraRearviews(49f6e7a06ebc5aa8).();
1579 SetHUDModecxx . . $ SetHUDMode(1efe68d6753032ab).(GetHUDModecxx . . $ GetHUDMode(d2d05048dda10524).()); // what does this do?
1580
1581 // Init zoom
1582 Render_zoomcxx . . $ Render_zoom. = D3_DEFAULT_ZOOMcxx . . $ `Descent3/descent.h:178:9`!;
1583
1584 // flush controller system.
1585 ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).();
1586 Controllercxx . . $ Controller.->flushcxx . . $ gameController#flush(49f6e7a06ebc5aa8).();
1587
1588 Level_goalscxx . . $ Level_goals..InitLevelcxx . . $ levelgoals#InitLevel(49f6e7a06ebc5aa8).();
1589
1590 // Do multiplayer & player stuff
1591 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1592 MultiStartNewLevelcxx . . $ MultiStartNewLevel(83c267b20bac841a).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level.);
1593 } else { // Init player for single-player
1594 DeleteMultiplayerObjectscxx . . $ DeleteMultiplayerObjects(49f6e7a06ebc5aa8).();
1595 InitPlayerNewLevelcxx . . $ InitPlayerNewLevel(d4f767463ce0a6b3).(Player_numcxx . . $ Player_num.);
1596 }
1597
1598 // Set flags
1599 Level_startedcxx . . $ Level_started. = true;
1600 Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu. = false;
1601
1602 // Clear robot keys
1603 Global_keyscxx . . $ Global_keys. = 0;
1604
1605 // Clear OSIRIS stuff
1606 Osiris_ResetAllTimerscxx . . $ Osiris_ResetAllTimers(49f6e7a06ebc5aa8).();
1607
1608 // Initialize IGC
1609 Cinematic_LevelInitcxx . . $ Cinematic_LevelInit(49f6e7a06ebc5aa8).();
1610
1611 // Bash the language to english
1612 int save_lang = Localization_GetLanguagecxx . . $ Localization_GetLanguage(b126dc7c1de90089).();
1613 Localization_SetLanguagecxx . . $ Localization_SetLanguage(d4f767463ce0a6b3).(LANGUAGE_ENGLISHcxx . . $ `scripts/osiris_common.h:412:9`!);
1614
1615 // Load the English text so the goal stuff will initialize correctly
1616 LoadLevelTextcxx . . $ LoadLevelText(85c52e162fed56f9).(Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1].filenamecxx . . $ tLevelNode#filename.);
1617
1618 // Restore the correct language
1619 Localization_SetLanguagecxx . . $ Localization_SetLanguage(d4f767463ce0a6b3).(save_lang);
1620
1621 // Init the level scripts
1622 InitLevelScriptcxx . . $ InitLevelScript(49f6e7a06ebc5aa8).();
1623
1624 // Load the localized text
1625 LoadLevelTextcxx . . $ LoadLevelText(85c52e162fed56f9).(Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1].filenamecxx . . $ tLevelNode#filename.);
1626
1627 Gametimecxx . . $ Gametime. = 0.0f;
1628 // Start the clock
1629 InitFrameTimecxx . . $ InitFrameTime(49f6e7a06ebc5aa8).();
1630
1631 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_DONEcxx . . $ `Descent3/Mission.h:178:9`!, 0);
1632
1633 }
1634
1635 // Loads a level and starts everything up
1636 bool LoadAndStartCurrentLevelcxx . . $ LoadAndStartCurrentLevel(c9857a73d68e59ba).() {
1637 char hogpath[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`! * 2];
1638 // This is a bit redundant because we just did it in most cases, but we need to be sure that it always happens,
1639 // and this code is here for weird systems, like save/load and demo, etc.
1640 if (Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. && (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Current_mission.filename, "d3.mn3") == 0) &&
1641 (Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. > 4)) {
1642 // close the mission hog file and open d3_2.mn3
1643 mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).();
1644 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(hogpath, D3MissionsDircxx . . $ D3MissionsDir., "d3_2.mn3", nullptr);
1645 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(hogpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1646 mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(hogpath);
1647 mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.filename);
1648 Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("d3_2.mn3");
1649 } else {
1650 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1651 }
1652 } else if (Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. && (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Current_mission.filename, "d3_2.mn3") == 0) &&
1653 (Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. <= 4)) {
1654 // Part 2 of the mission is d3_2.mn3
1655 // close the mission hog file and open d3.mn3
1656 mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).();
1657 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(hogpath, D3MissionsDircxx . . $ D3MissionsDir., "d3.mn3", nullptr);
1658 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(hogpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1659 mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(hogpath);
1660 mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.filename);
1661 Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("d3.mn3");
1662 } else {
1663 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1664 }
1665 }
1666
1667 // load the level. if fails, then bail out
1668 // ShowProgressScreen (TXT_LOADINGLEVEL);
1669 if (!LoadMissionLevelcxx . . $ LoadMissionLevel(83c267b20bac841a).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level.))
1670 return false;
1671
1672 AutomapClearVisMapcxx . . $ AutomapClearVisMap(49f6e7a06ebc5aa8).();
1673
1674 // Now start the level
1675 StartLevelcxx . . $ StartLevel(49f6e7a06ebc5aa8).();
1676
1677 // Done!
1678 return true;
1679 }
1680
1681 #ifdef EDITOR
1682 // Called to do game initialization stuff when playing from the editor
1683 // Mostly, this will be the same stuff as StartNewLevel()
1684 void StartGameFromEditor() {
1685 // Set up the player ship
1686 InitPlayerNewShip(Player_num, INVRESET_ALL);
1687
1688 // Start the level
1689 StartLevel();
1690
1691 // Move the player to the editor viewer position
1692 ObjSetPos(Player_object, &editor_player_pos, editor_player_roomnum, &editor_player_orient, false);
1693 }
1694 #endif
1695
1696 void ComputeCenterPointOnFacecxx . . $ ComputeCenterPointOnFace(3ca293c02dfae4e1).(vectorcxx . . $ vector# *vp, roomcxx . . $ room# *rp, int facenum);
1697
1698 // Start object ambient sounds
1699 void StartObjectSoundscxx . . $ StartObjectSounds(49f6e7a06ebc5aa8).() {
1700 for (int i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) {
1701 objectcxx . . $ object# *objp = &Objectscxx . . $ Objects.[i];
1702
1703 // If generic object, check for ambient sound
1704 switch (objp->typecxx . . $ object#type.) {
1705
1706 case OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!:
1707 case OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!:
1708 case OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!:
1709 case OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!: {
1710 int ambient_sound = Object_infocxx . . $ Object_info.[objp->idcxx . . $ object#id.].soundscxx . . $ object_info#sounds.[GSI_AMBIENTcxx . . $ `Descent3/object_external.h:350:9`!];
1711 if (ambient_sound != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
1712 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ambient_sound, SND_PRIORITY_LOWESTcxx . . $ `sndlib/ssl_lib.h:286:9`!, objp);
1713 break;
1714 }
1715
1716 case OBJ_SOUNDSOURCEcxx . . $ `Descent3/object_external.h:184:9`!:
1717 ASSERTcxx . . $ `misc/pserror.h:246:9`!(objp->control_type == CT_SOUNDSOURCEcxx . . $ `Descent3/object_external.h:228:9`!);
1718 if (objp->namecxx . . $ object#name.) // if has name, attach sound to object
1719 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(objp->ctypecxx . . $ object#ctype..soundsource_infocxx . . $ object#$anonymous_type_9#soundsource_info..sound_indexcxx . . $ soundsource_info_s#sound_index., SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, objp,
1720 objp->ctypecxx . . $ object#ctype..soundsource_infocxx . . $ object#$anonymous_type_9#soundsource_info..volumecxx . . $ soundsource_info_s#volume.);
1721 else { // no name, so attach to 3D position & delete object
1722 pos_statecxx . . $ pos_state# ps;
1723 ps.positioncxx . . $ pos_state#position. = &objp->poscxx . . $ object#pos.;
1724 ps.roomnumcxx . . $ pos_state#roomnum. = objp->roomnumcxx . . $ object#roomnum.;
1725 ps.orientcxx . . $ pos_state#orient. = (matrixcxx . . $ matrix# *)&Identity_matrixcxx . . $ Identity_matrix.;
1726 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(cbd2c6aa1db9fc8a).(objp->ctypecxx . . $ object#ctype..soundsource_infocxx . . $ object#$anonymous_type_9#soundsource_info..sound_indexcxx . . $ soundsource_info_s#sound_index., SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, &ps,
1727 objp->ctypecxx . . $ object#ctype..soundsource_infocxx . . $ object#$anonymous_type_9#soundsource_info..volumecxx . . $ soundsource_info_s#volume.);
1728 ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i);
1729 }
1730 break;
1731 }
1732 }
1733 }
1734
1735 // Go through the level and start and sounds associated with textures
1736 void StartTextureSoundscxx . . $ StartTextureSounds(49f6e7a06ebc5aa8).() {
1737 int r, f;
1738 roomcxx . . $ room# *rp;
1739 facecxx . . $ face# *fp;
1740
1741 for (r = 0, rp = Roomscxx . . $ Rooms.; r <= Highest_room_indexcxx . . $ Highest_room_index.; r++, rp++) {
1742 if (rp->usedcxx . . $ room#used.) {
1743 for (f = 0, fp = rp->facescxx . . $ room#faces.; f < rp->num_facescxx . . $ room#num_faces.; f++, fp++) {
1744 int sound = GameTexturescxx . . $ GameTextures.[fp->tmapcxx . . $ face#tmap.].soundcxx . . $ texture#sound.;
1745 if ((sound != -1) && (sound != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)) {
1746 vectorcxx . . $ vector# pos;
1747 pos_statecxx . . $ pos_state# ps;
1748 ComputeCenterPointOnFacecxx . . $ ComputeCenterPointOnFace(3ca293c02dfae4e1).(&pos, rp, f);
1749 ps.positioncxx . . $ pos_state#position. = &pos;
1750 ps.roomnumcxx . . $ pos_state#roomnum. = r;
1751 ps.orientcxx . . $ pos_state#orient. = (matrixcxx . . $ matrix# *)&Identity_matrixcxx . . $ Identity_matrix.;
1752 Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(cbd2c6aa1db9fc8a).(sound, SND_PRIORITY_LOWESTcxx . . $ `sndlib/ssl_lib.h:286:9`!, &ps);
1753 }
1754 }
1755 }
1756 }
1757 }
1758
1759 // Starts all the sounds on this level
1760 void StartLevelSoundscxx . . $ StartLevelSounds(49f6e7a06ebc5aa8).() {
1761 StartObjectSoundscxx . . $ StartObjectSounds(49f6e7a06ebc5aa8).();
1762 StartTextureSoundscxx . . $ StartTextureSounds(49f6e7a06ebc5aa8).();
1763 StartTerrainSoundcxx . . $ StartTerrainSound(49f6e7a06ebc5aa8).();
1764 InitAmbientSoundscxx . . $ InitAmbientSounds(49f6e7a06ebc5aa8).();
1765 }
1766
1767 // frees any data/esc that was created for that level
1768 void FreeThisLevelcxx . . $ FreeThisLevel(49f6e7a06ebc5aa8).() {
1769 if (!Level_startedcxx . . $ Level_started.)
1770 return;
1771
1772 bool original_controls = Control_poll_flagcxx . . $ Control_poll_flag.;
1773
1774 Cinematic_Stopcxx . . $ Cinematic_Stop(49f6e7a06ebc5aa8).();
1775
1776 // make sure our controls are correct (this is needed for failed missions)
1777 if (Control_poll_flagcxx . . $ Control_poll_flag. != original_controls) {
1778 if (Control_poll_flagcxx . . $ Control_poll_flag.)
1779 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
1780 else
1781 ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).();
1782 }
1783
1784 Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu. = false;
1785
1786 DemoAbortcxx . . $ DemoAbort(b45ddcbc8423892c).();
1787
1788 // closes hud.
1789 FreeCockpitcxx . . $ FreeCockpit(49f6e7a06ebc5aa8).();
1790 CloseShipHUDcxx . . $ CloseShipHUD(49f6e7a06ebc5aa8).();
1791
1792 // end music sequencer's run.
1793 D3MusicStopcxx . . $ D3MusicStop(49f6e7a06ebc5aa8).();
1794
1795 FreeScriptsForLevelcxx . . $ FreeScriptsForLevel(49f6e7a06ebc5aa8).();
1796 ClearAllEventscxx . . $ ClearAllEvents(49f6e7a06ebc5aa8).();
1797
1798 // Resets the ambient life controller
1799 a_lifecxx . . $ a_life..ALResetcxx . . $ ambient_life#ALReset(49f6e7a06ebc5aa8).();
1800
1801 DestroyAllMatcenscxx . . $ DestroyAllMatcens(49f6e7a06ebc5aa8).();
1802 Level_goalscxx . . $ Level_goals..CleanupAfterLevelcxx . . $ levelgoals#CleanupAfterLevel(49f6e7a06ebc5aa8).();
1803
1804 Sound_systemcxx . . $ Sound_system..StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).();
1805
1806 // Clear out all memory that was used for this past level
1807 FlushDataCachecxx . . $ FlushDataCache(49f6e7a06ebc5aa8).();
1808
1809 InitGamePathscxx . . $ InitGamePaths(49f6e7a06ebc5aa8).(); // DAJ LEAKFIX
1810
1811 DSSoarEndcxx . . $ `Descent3/soar_helpers.h:88:9`!();
1812
1813 // Reset the camera if need be
1814 if (Player_camera_objnumcxx . . $ Player_camera_objnum. != -1) {
1815 SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(&Objectscxx . . $ Objects.[Player_camera_objnumcxx . . $ Player_camera_objnum.]);
1816 Player_camera_objnumcxx . . $ Player_camera_objnum. = -1;
1817 Viewer_objectcxx . . $ Viewer_object. = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.];
1818 }
1819
1820 ResetHUDMessagescxx . . $ ResetHUDMessages(49f6e7a06ebc5aa8).();
1821
1822 DestroyDefaultBSPTreecxx . . $ DestroyDefaultBSPTree(49f6e7a06ebc5aa8).();
1823
1824 Level_startedcxx . . $ Level_started. = false;
1825 IsRestoredGamecxx . . $ IsRestoredGame. = false;
1826 }
1827
1828 extern void FreeTextureBumpmapscxx . . $ FreeTextureBumpmaps(d4f767463ce0a6b3).(int);
1829 // Clears out all the level specific stuff from memory
1830 void FlushDataCachecxx . . $ FlushDataCache(49f6e7a06ebc5aa8).() {
1831 int i;
1832
1833 // This must be done before we free polymodels
1834 FreeAllObjectscxx . . $ FreeAllObjects(49f6e7a06ebc5aa8).();
1835
1836 #ifdef EDITOR
1837 if (Network_up)
1838 return;
1839 #endif
1840
1841 int texfreed = 0;
1842 int modelsfreed = 0;
1843 int soundsfreed = 0;
1844
1845 for (i = 0; i < MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!; i++) {
1846 if (Textures_to_freecxx . . $ Textures_to_free.[i] != 0) {
1847 if (!(GameTexturescxx . . $ GameTextures.[i].flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!)) {
1848 if (GameTexturescxx . . $ GameTextures.[i].bumpmapcxx . . $ texture#bumpmap. != -1)
1849 FreeTextureBumpmapscxx . . $ FreeTextureBumpmaps(d4f767463ce0a6b3).(i);
1850
1851 bm_FreeBitmapDatacxx . . $ bm_FreeBitmapData(d4f767463ce0a6b3).(GameTexturescxx . . $ GameTextures.[i].bm_handlecxx . . $ texture#bm_handle.);
1852 }
1853
1854 texfreed++;
1855 }
1856 }
1857 for (i = 0; i < MAX_POLY_MODELScxx . . $ `lib/polymodel_external.h:66:9`!; i++) {
1858 if (Models_to_freecxx . . $ Models_to_free.[i] != 0) {
1859 FreePolymodelDatacxx . . $ FreePolymodelData(d4f767463ce0a6b3).(i);
1860 modelsfreed++;
1861 }
1862 }
1863
1864 for (i = 0; i < MAX_SOUNDScxx . . $ `sndlib/ssl_lib.h:578:9`!; i++) {
1865 if (Sounds_to_freecxx . . $ Sounds_to_free.[i] != 0)
1866 {
1867 soundsfreed++;
1868 int index = Soundscxx . . $ Sounds.[i].sample_indexcxx . . $ sound_info#sample_index.;
1869 if (SoundFilescxx . . $ SoundFiles.[index].sample_16bitcxx . . $ sound_file_info#sample_16bit.) {
1870 mem_freecxx . . $ `mem/mem.h:80:9`!(SoundFiles[index].sample_16bit);
1871 SoundFilescxx . . $ SoundFiles.[index].sample_16bitcxx . . $ sound_file_info#sample_16bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1872 }
1873 if (SoundFilescxx . . $ SoundFiles.[index].sample_8bitcxx . . $ sound_file_info#sample_8bit.) {
1874 mem_freecxx . . $ `mem/mem.h:80:9`!(SoundFiles[index].sample_8bit);
1875 SoundFilescxx . . $ SoundFiles.[index].sample_8bitcxx . . $ sound_file_info#sample_8bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1876 }
1877 }
1878 }
1879
1880 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Freed %d textures, %d models, and %d sounds.\n", texfreed, modelsfreed, soundsfreed);
1881 // the renderer is never initialized in dedicated server mode, so don't try to reset things either
1882 if (!Dedicated_servercxx . . $ Dedicated_server.) {
1883 rend_ResetCachecxx . . $ rend_ResetCache(49f6e7a06ebc5aa8).();
1884 }
1885 }
1886
1887 ///////////////////////////////////////////////////////////////////////////////
1888 // Runs any possible end movie and stats screen, as well as loads in the next level
1889 ///////////////////////////////////////////////////////////////////////////////
1890
1891 // Parameter: state - 1 = success, 0 = failure, -1 = abort
1892 void EndLevelcxx . . $ EndLevel(d4f767463ce0a6b3).(int state) {
1893 tLevelNodecxx . . $ tLevelNode# *lvl = &Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1];
1894
1895 // Tells all the clients to end the level
1896 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`!) {
1897 MultiSendLevelEndedcxx . . $ MultiSendLevelEnded(3e454b8ccf442868).(state, Multi_next_levelcxx . . $ Multi_next_level.);
1898 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_CLIENT_GAMELEVELENDcxx . . $ `lib/d3events.h:108:9`!, &DLLInfocxx . . $ DLLInfo.);
1899 CallMultiDLLcxx . . $ CallMultiDLL(d4f767463ce0a6b3).(MT_EVT_GAME_OVERcxx . . $ `Descent3/multi_dll_mgr.h:91:9`!);
1900 }
1901
1902 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
1903
1904 // report the information to the pilot's mission data
1905 CurrentPilotUpdateMissionStatuscxx . . $ CurrentPilotUpdateMissionStatus(b45ddcbc8423892c).();
1906 // Sound_system.StopAllSounds(); -- moved to below because bug was reported that sounds were
1907 // playing in performance screen
1908
1909 // save our shields (in case this call is due to starting a new level
1910 // in InitPlayerNewLevel, we'll determine if we should restore them
1911 // this function ALWAYS gets called right before InitPlayerNewLevel from StartLevel
1912 Player_shields_saved_from_last_levelcxx . . $ Player_shields_saved_from_last_level. = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields.;
1913 Player_energy_saved_from_last_levelcxx . . $ Player_energy_saved_from_last_level. = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].energycxx . . $ player#energy.;
1914 } else {
1915 // Stop all player sounds
1916 for (int i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) {
1917 if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) {
1918 PlayerStopSoundscxx . . $ PlayerStopSounds(d4f767463ce0a6b3).(i);
1919 Playerscxx . . $ Players.[i].flagscxx . . $ player#flags. &= ~(PLAYER_FLAGS_THRUSTEDcxx . . $ `Descent3/player_external.h:94:9`! | PLAYER_FLAGS_AFTERBURN_ONcxx . . $ `Descent3/player_external.h:92:9`!);
1920 }
1921 }
1922 }
1923
1924 // clear screen now.
1925 if (!Dedicated_servercxx . . $ Dedicated_server.) {
1926 StartFramecxx . . $ StartFrame(b45ddcbc8423892c).();
1927 rend_ClearScreencxx . . $ rend_ClearScreen(cb2f890c2fdad230).(GR_BLACKcxx . . $ GR_BLACK.);
1928 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
1929 rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).();
1930 Sound_systemcxx . . $ Sound_system..StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).();
1931 }
1932
1933 // Sequencing here.
1934 // if this level has an endmovie
1935 if ((state == 1) && (lvl->flagscxx . . $ tLevelNode#flags. & LVLFLAG_ENDMOVIEcxx . . $ LVLFLAG_ENDMOVIE.) && !(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
1936 DoMissionMoviecxx . . $ DoMissionMovie(85c52e162fed56f9).(lvl->endmoviecxx . . $ tLevelNode#endmovie.);
1937 }
1938
1939 // display postlevel results.
1940 if ((state != -1) && (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() != EDITOR_GAME_MODEcxx . . $ EDITOR_GAME_MODE.))
1941 PostLevelResultscxx . . $ PostLevelResults(efaadfb7dc14930a).(state == 1);
1942
1943 // check for dead players
1944 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
1945 // in multiplayer check all players
1946 for (int i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) {
1947 if ((NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) && (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. >= NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!)) {
1948 // check to see if player is dying
1949 if ((Playerscxx . . $ Players.[i].flagscxx . . $ player#flags. & PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!) || (Playerscxx . . $ Players.[i].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)) {
1950 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Prematurely ending death for player %d\n", i);
1951 EndPlayerDeathcxx . . $ EndPlayerDeath(d4f767463ce0a6b3).(i);
1952 }
1953 }
1954 }
1955
1956 } else {
1957 // in single player, check Player_num
1958 if ((Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!) || (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)) {
1959 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Prematurely ending death for player\n");
1960 EndPlayerDeathcxx . . $ EndPlayerDeath(d4f767463ce0a6b3).(Player_numcxx . . $ Player_num.);
1961 }
1962 }
1963
1964 // Free any game objects/etc that needs to be done when ending a level here.
1965 FreeThisLevelcxx . . $ FreeThisLevel(49f6e7a06ebc5aa8).();
1966
1967 // This option is used for HEAT.NET. They have their dedicated server shut down after the
1968 // kill goal or time limit is reached.
1969 if (Dedicated_servercxx . . $ Dedicated_server.) {
1970 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-quitongoal")) {
1971 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(QUIT_MODEcxx . . $ QUIT_MODE.);
1972 }
1973 }
1974 }
1975
1976 // Advances to the next level. If we were on the last level, end the game
1977 void SetNextLevelcxx . . $ SetNextLevel(49f6e7a06ebc5aa8).() {
1978 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Current_mission.cur_level > 0);
1979
1980 tLevelNodecxx . . $ tLevelNode# *lvl = &Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1];
1981
1982 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`! && Multi_next_levelcxx . . $ Multi_next_level. != -1) {
1983 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(Multi_next_levelcxx . . $ Multi_next_level.);
1984 Multi_next_levelcxx . . $ Multi_next_level. = -1;
1985 } else if (lvl->flagscxx . . $ tLevelNode#flags. & LVLFLAG_BRANCHcxx . . $ LVLFLAG_BRANCH.) {
1986 // jump to brached level
1987 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Branching...\n");
1988 Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. = lvl->lvlbranch0cxx . . $ tLevelNode#lvlbranch0.;
1989 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level.);
1990 } else if ((Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. == Current_missioncxx . . $ Current_mission..num_levelscxx . . $ tMission#num_levels.) || (lvl->flagscxx . . $ tLevelNode#flags. & LVLFLAG_FINALcxx . . $ LVLFLAG_FINAL.)) {
1991 // in this case we are done with the mission!
1992 DoEndMissioncxx . . $ DoEndMission(49f6e7a06ebc5aa8).();
1993
1994 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) // Multiplayer loops its levels and never ends
1995 {
1996 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1997 }
1998 } else if (Current_missioncxx . . $ Current_mission..game_state_flagscxx . . $ tMission#game_state_flags. & MSN_STATE_SECRET_LEVELcxx . . $ `Descent3/Mission.h:234:9`!) {
1999 if (lvl->flagscxx . . $ tLevelNode#flags. & LVLFLAG_SPAWNSECRETcxx . . $ LVLFLAG_SPAWNSECRET.) {
2000 // display secret level screen?
2001 ShowProgressScreencxx . . $ ShowProgressScreen(8d00172ec7558ddf).(TXT_ENTERSECRETLVLcxx . . $ `Descent3/stringtable.h:880:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, true);
2002 Descentcxx . . $ Descent.->delaycxx . . $ oeApplication#delay(9364e6e7bff7660).(1.0f);
2003 Current_missioncxx . . $ Current_mission..game_state_flagscxx . . $ tMission#game_state_flags. &= (~MSN_STATE_SECRET_LEVELcxx . . $ `Descent3/Mission.h:234:9`!);
2004 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(lvl->secretlvlcxx . . $ tLevelNode#secretlvl.);
2005 } else {
2006 Int3cxx . . $ `misc/pserror.h:247:9`!(); // Game says go to secret level, but there's none to go to.
2007 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. + 1);
2008 }
2009 } else {
2010 // nothing special
2011 SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. + 1);
2012 }
2013 }
2014
2015 void GameFrameUIcxx . . $ GameFrameUI(49f6e7a06ebc5aa8).() {
2016 GameFramecxx . . $ GameFrame(49f6e7a06ebc5aa8).();
2017 Last_game_statecxx . . $ Last_game_state. = Game_statecxx . . $ Game_state.;
2018 }
2019
2020 void RunGameMenucxx . . $ RunGameMenu(49f6e7a06ebc5aa8).() {
2021 bool pause_game = false;
2022
2023 if (Game_interface_modecxx . . $ Game_interface_mode. != GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!) {
2024 NewUIWindow_alphacxx . . $ NewUIWindow_alpha. = 226;
2025 SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(GameFrameUIcxx . . $ GameFrameUI(49f6e7a06ebc5aa8).);
2026 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
2027
2028 // reset bail flag.
2029 Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu. = false;
2030
2031 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2032 pause_game = true;
2033 PauseGamecxx . . $ PauseGame(49f6e7a06ebc5aa8).();
2034 D3MusicResumecxx . . $ D3MusicResume(49f6e7a06ebc5aa8).();
2035 }
2036
2037 switch (Game_interface_modecxx . . $ Game_interface_mode.) {
2038 case GAME_OPTIONS_INTERFACEcxx . . $ `Descent3/gamesequence.h:130:9`!: {
2039 extern void OptionsMenucxx . . $ OptionsMenu(49f6e7a06ebc5aa8).();
2040 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2041 OptionsMenucxx . . $ OptionsMenu(49f6e7a06ebc5aa8).();
2042 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2043 } break;
2044 case GAME_HELP_INTERFACEcxx . . $ `Descent3/gamesequence.h:132:9`!: {
2045 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2046 HelpDisplaycxx . . $ HelpDisplay(49f6e7a06ebc5aa8).();
2047 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2048 } break;
2049 case GAME_TOGGLE_DEMOcxx . . $ `Descent3/gamesequence.h:141:9`!: {
2050 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2051 DemoToggleRecordingcxx . . $ DemoToggleRecording(49f6e7a06ebc5aa8).();
2052 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2053 } break;
2054 case GAME_BUDDY_INTERFACEcxx . . $ `Descent3/gamesequence.h:133:9`!: {
2055 // #ifdef DEMO
2056 // DoMessageBox(TXT_ERROR, TXT_WRONGVERSION, MSGBOX_OK);
2057 // #else
2058 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2059 BuddyDisplaycxx . . $ BuddyDisplay(49f6e7a06ebc5aa8).();
2060 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2061 // #endif
2062 } break;
2063 case GAME_TELCOM_CARGOcxx . . $ `Descent3/gamesequence.h:136:9`!: {
2064 // #ifndef DEMO
2065 DoWaitPopupcxx . . $ DoWaitPopup(ee90985596e8b4f9).(true, TXT_TELCOMLOADcxx . . $ `Descent3/stringtable.h:861:9`!);
2066 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2067 TelComShowcxx . . $ TelComShow(636f4aecd7c651f4).(TS_CARGOcxx . . $ `Descent3/TelCom.h:87:9`!);
2068 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2069 DoWaitPopupcxx . . $ DoWaitPopup(ee90985596e8b4f9).(false);
2070 // #else
2071 // DoMessageBox(TXT_ERROR, TXT_WRONGVERSION, MSGBOX_OK);
2072 // #endif
2073 } break;
2074 case GAME_TELCOM_BRIEFINGScxx . . $ `Descent3/gamesequence.h:134:9`!: {
2075 DoWaitPopupcxx . . $ DoWaitPopup(ee90985596e8b4f9).(true, TXT_TELCOMLOADcxx . . $ `Descent3/stringtable.h:861:9`!);
2076 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2077 TelComShowcxx . . $ TelComShow(636f4aecd7c651f4).(TS_MAINMENUcxx . . $ `Descent3/TelCom.h:85:9`!);
2078 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2079 DoWaitPopupcxx . . $ DoWaitPopup(ee90985596e8b4f9).(false);
2080 } break;
2081 case GAME_TELCOM_AUTOMAPcxx . . $ `Descent3/gamesequence.h:135:9`!: {
2082 // #ifndef DEMO
2083 DoWaitPopupcxx . . $ DoWaitPopup(ee90985596e8b4f9).(true, TXT_TELCOMLOADcxx . . $ `Descent3/stringtable.h:861:9`!);
2084 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2085 TelComShowcxx . . $ TelComShow(636f4aecd7c651f4).(TS_MAPcxx . . $ `Descent3/TelCom.h:88:9`!);
2086 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2087 DoWaitPopupcxx . . $ DoWaitPopup(ee90985596e8b4f9).(false);
2088 // #else
2089 // DoMessageBox(TXT_ERROR, TXT_WRONGVERSION, MSGBOX_OK);
2090 // #endif
2091 } break;
2092 case GAME_PAUSE_INTERFACEcxx . . $ `Descent3/gamesequence.h:131:9`!:
2093 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
2094 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_NOPAUSEINMULTIcxx . . $ `Descent3/stringtable.h:573:9`!);
2095 else {
2096 DoMessageBoxAdvancedcxx . . $ DoMessageBoxAdvanced(39eb0f4656941132).(TXTcxx . . $ `Descent3/stringtable.h:24:9`!(TXI_HLPPAUSEcxx . . $ `Descent3/stringtable.h:140:9`!), TXT_PRESSOKTOCONTcxx . . $ `Descent3/stringtable.h:574:9`!, TXT_OKcxx . . $ `Descent3/stringtable.h:34:9`!, KEY_PAUSEcxx . . $ `ddio/ddio_common.h:323:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2097 // DoMessageBox(TXT(TXI_HLPPAUSE),TXT_PRESSOKTOCONT, MSGBOX_OK);
2098 }
2099 break;
2100 case GAME_LEVEL_WARPcxx . . $ `Descent3/gamesequence.h:144:9`!:
2101 Level_warp_nextcxx . . $ Level_warp_next. = DisplayLevelWarpDlgcxx . . $ DisplayLevelWarpDlg(7864480464b09eea).(-1);
2102 if (Level_warp_nextcxx . . $ Level_warp_next. != -1)
2103 SetGameStatecxx . . $ SetGameState(35729c5b0b4aef73).(GAMESTATE_LVLWARPcxx . . $ GAMESTATE_LVLWARP.);
2104 break;
2105 case GAME_EXIT_CONFIRMcxx . . $ `Descent3/gamesequence.h:137:9`!: {
2106 int ret = 0;
2107 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2108 // Weird code for the training mission and the first time you play...
2109 if (Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. && (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Current_mission.filename, "training.mn3") == 0) && (FirstGamecxx . . $ FirstGame.)) {
2110 ret = DoMessageBoxAdvancedcxx . . $ DoMessageBoxAdvanced(39eb0f4656941132).(TXT_TRAININGABORTTITLEcxx . . $ `Descent3/stringtable.h:828:9`!, TXT_TRAININGABORTTEXTcxx . . $ `Descent3/stringtable.h:829:9`!, TXT_SKIPcxx . . $ `Descent3/stringtable.h:830:9`!, KEY_Scxx . . $ `ddio/ddio_common.h:247:9`!, TXT_ABORTcxx . . $ `Descent3/stringtable.h:831:9`!, KEY_Acxx . . $ `ddio/ddio_common.h:229:9`!,
2111 TXT_CANCELcxx . . $ `Descent3/stringtable.h:35:9`!, KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2112 if (ret == 2) {
2113 // Cancel
2114 ret = 0;
2115 } else if (ret == 1) {
2116 // Abort -- back to the main menu
2117 FirstGamecxx . . $ FirstGame. = false;
2118 } else if (ret == 0) {
2119 // Skip
2120 ret = 1;
2121 }
2122
2123 } else {
2124 ret = DoMessageBoxcxx . . $ DoMessageBox(dcc99837539e9edc).(TXT_CONFIRMcxx . . $ `Descent3/stringtable.h:575:9`!, TXT_CONFIRMEXITcxx . . $ `Descent3/stringtable.h:576:9`!, MSGBOX_YESNOcxx . . $ `Descent3/newui_core.h:80:9`!);
2125 }
2126 if (ret) {
2127 Demo_loopingcxx . . $ Demo_looping. = false;
2128 if ((Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!) || (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)) {
2129 EndPlayerDeathcxx . . $ EndPlayerDeath(d4f767463ce0a6b3).(Player_numcxx . . $ Player_num.);
2130 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
2131 MultiSendEndPlayerDeathcxx . . $ MultiSendEndPlayerDeath(49f6e7a06ebc5aa8).();
2132 MultiLeaveGamecxx . . $ MultiLeaveGame(49f6e7a06ebc5aa8).();
2133 }
2134 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
2135 } else {
2136 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
2137 MultiLeaveGamecxx . . $ MultiLeaveGame(49f6e7a06ebc5aa8).();
2138 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
2139 }
2140 Sound_systemcxx . . $ Sound_system..StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).();
2141 }
2142 } break;
2143 case GAME_DLL_INTERFACEcxx . . $ `Descent3/gamesequence.h:138:9`!: {
2144 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
2145 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2146 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_CLIENT_SHOWUIcxx . . $ `lib/d3events.h:114:9`!, &DLLInfocxx . . $ DLLInfo.);
2147 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2148 } break;
2149
2150 case GAME_DEBUGGRAPH_INTERFACEcxx . . $ `Descent3/gamesequence.h:145:9`!: {
2151 DebugGraph_DisplayOptionscxx . . $ DebugGraph_DisplayOptions(49f6e7a06ebc5aa8).();
2152 } break;
2153
2154 case GAME_SAVE_INTERFACEcxx . . $ `Descent3/gamesequence.h:139:9`!:
2155 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2156 #ifdef EDITOR
2157 if (GetFunctionMode() == EDITOR_GAME_MODE)
2158 DoMessageBox("Silly", "You can't save while playing from the editor!", MSGBOX_OK);
2159 else
2160 #endif
2161 SaveGameDialogcxx . . $ SaveGameDialog(49f6e7a06ebc5aa8).(); // link to above endif!
2162 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2163 break;
2164
2165 case GAME_LOAD_INTERFACEcxx . . $ `Descent3/gamesequence.h:140:9`!:
2166 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2167 #ifdef EDITOR
2168 if (GetFunctionMode() == EDITOR_GAME_MODE)
2169 DoMessageBox("Silly", "You can't load while playing from the editor!", MSGBOX_OK);
2170 else
2171 #endif
2172 LoadGameDialogcxx . . $ LoadGameDialog(c9857a73d68e59ba).();
2173 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
2174 break;
2175
2176 case GAME_POST_DEMOcxx . . $ `Descent3/gamesequence.h:142:9`!:
2177 DemoPostPlaybackMenucxx . . $ DemoPostPlaybackMenu(49f6e7a06ebc5aa8).();
2178 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
2179 break;
2180 case GAME_DEMO_LOOPcxx . . $ `Descent3/gamesequence.h:143:9`!:
2181 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
2182 break;
2183 default:
2184 Int3cxx . . $ `misc/pserror.h:247:9`!(); // unhandled game interface mode
2185 }
2186
2187 if (pause_game) {
2188 ResumeGamecxx . . $ ResumeGame(49f6e7a06ebc5aa8).();
2189 pause_game = false;
2190 }
2191
2192 ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).();
2193 SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2194 Game_interface_modecxx . . $ Game_interface_mode. = GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!;
2195 NewUIWindow_alphacxx . . $ NewUIWindow_alpha. = 192;
2196 Clear_screencxx . . $ Clear_screen. = 4;
2197 }
2198 }
2199
2200 void PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(int id) {
2201 if (id == -1 || id == 0)
2202 return;
2203
2204 if (Dedicated_servercxx . . $ Dedicated_server.)
2205 return;
2206
2207 TouchTexturecxx . . $ TouchTexture(d4f767463ce0a6b3).(id);
2208
2209 // Upload all these textures to the card
2210 if (GameTexturescxx . . $ GameTextures.[id].flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!) {
2211 vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[GameTexturescxx . . $ GameTextures.[id].bm_handlecxx . . $ texture#bm_handle.];
2212 for (int i = 0; i < vc->num_framescxx . . $ vclip#num_frames.; i++) {
2213 if (!(GameTexturescxx . . $ GameTextures.[id].flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) && !(GameTexturescxx . . $ GameTextures.[id].flagscxx . . $ texture#flags. & TF_SPECULARcxx . . $ `Descent3/gametexture.h:236:9`!))
2214 GameBitmapscxx . . $ GameBitmaps.[vc->framescxx . . $ vclip#frames.[i]].flagscxx . . $ bms_bitmap#flags. |= BF_COMPRESSABLEcxx . . $ `lib/bitmap.h:52:9`!;
2215 else
2216 GameBitmapscxx . . $ GameBitmaps.[vc->framescxx . . $ vclip#frames.[i]].flagscxx . . $ bms_bitmap#flags. &= ~BF_COMPRESSABLEcxx . . $ `lib/bitmap.h:52:9`!;
2217
2218 if (!Dedicated_servercxx . . $ Dedicated_server. && GameBitmapscxx . . $ GameBitmaps.[vc->framescxx . . $ vclip#frames.[i]].cache_slotcxx . . $ bms_bitmap#cache_slot. == -1)
2219 rend_PreUploadTextureToCardcxx . . $ rend_PreUploadTextureToCard(3e454b8ccf442868).(vc->framescxx . . $ vclip#frames.[i], MAP_TYPE_BITMAPcxx . . $ `lib/renderer.h:362:9`!);
2220 }
2221 } else {
2222 if (!(GameTexturescxx . . $ GameTextures.[id].flagscxx . . $ texture#flags. & TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`!) && !(GameTexturescxx . . $ GameTextures.[id].flagscxx . . $ texture#flags. & TF_SPECULARcxx . . $ `Descent3/gametexture.h:236:9`!))
2223 GameBitmapscxx . . $ GameBitmaps.[GameTexturescxx . . $ GameTextures.[id].bm_handlecxx . . $ texture#bm_handle.].flagscxx . . $ bms_bitmap#flags. |= BF_COMPRESSABLEcxx . . $ `lib/bitmap.h:52:9`!;
2224 else
2225 GameBitmapscxx . . $ GameBitmaps.[GameTexturescxx . . $ GameTextures.[id].bm_handlecxx . . $ texture#bm_handle.].flagscxx . . $ bms_bitmap#flags. &= ~BF_COMPRESSABLEcxx . . $ `lib/bitmap.h:52:9`!;
2226
2227 if (!Dedicated_servercxx . . $ Dedicated_server. && GameBitmapscxx . . $ GameBitmaps.[GameTexturescxx . . $ GameTextures.[id].bm_handlecxx . . $ texture#bm_handle.].cache_slotcxx . . $ bms_bitmap#cache_slot. == -1)
2228 rend_PreUploadTextureToCardcxx . . $ rend_PreUploadTextureToCard(3e454b8ccf442868).(GameTexturescxx . . $ GameTextures.[id].bm_handlecxx . . $ texture#bm_handle., MAP_TYPE_BITMAPcxx . . $ `lib/renderer.h:362:9`!);
2229 }
2230
2231 if (GameTexturescxx . . $ GameTextures.[id].flagscxx . . $ texture#flags. & TF_DESTROYABLEcxx . . $ `Descent3/gametexture.h:208:9`! && GameTexturescxx . . $ GameTextures.[id].destroy_handlecxx . . $ texture#destroy_handle. != -1)
2232 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(GameTexturescxx . . $ GameTextures.[id].destroy_handlecxx . . $ texture#destroy_handle.);
2233
2234 Textures_to_freecxx . . $ Textures_to_free.[id] = 1;
2235 }
2236
2237 bool PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(int id) {
2238 if (id == -1)
2239 return false;
2240
2241 if (Dedicated_servercxx . . $ Dedicated_server.)
2242 return false;
2243
2244 // sometimes, id passed was 0xffff which seems like a int16_t -1. The if statement
2245 // ensures that the array Sounds_to_free is dealt with properly.
2246 if (Sound_systemcxx . . $ Sound_system..CheckAndForceSoundDataAlloccxx . . $ hlsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(id)) {
2247 Sounds_to_freecxx . . $ Sounds_to_free.[id] = 1;
2248 return true;
2249 }
2250
2251 return false;
2252 }
2253
2254 void PageInDoorcxx . . $ PageInDoor(d4f767463ce0a6b3).(int id) {
2255 // Set sounds
2256 doorcxx . . $ door# *doorpointer = &Doorscxx . . $ Doors.[id];
2257
2258 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(doorpointer->model_handlecxx . . $ door#model_handle.);
2259 Models_to_freecxx . . $ Models_to_free.[doorpointer->model_handlecxx . . $ door#model_handle.] = 1;
2260
2261 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[doorpointer->model_handlecxx . . $ door#model_handle.];
2262 for (int t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2263 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2264
2265 if (doorpointer->open_soundcxx . . $ door#open_sound. != -1 && doorpointer->open_soundcxx . . $ door#open_sound. != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
2266 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(doorpointer->open_soundcxx . . $ door#open_sound.);
2267 if (doorpointer->close_soundcxx . . $ door#close_sound. != -1 && doorpointer->close_soundcxx . . $ door#close_sound. != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
2268 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(doorpointer->close_soundcxx . . $ door#close_sound.);
2269 }
2270
2271 void PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(int id) {
2272 weaponcxx . . $ weapon# *weaponpointer = &Weaponscxx . . $ Weapons.[id];
2273
2274 if (id == -1)
2275 return;
2276
2277 int i;
2278
2279 if (!(weaponpointer->flagscxx . . $ weapon#flags. & (WF_IMAGE_BITMAPcxx . . $ `Descent3/weapon.h:219:9`! | WF_IMAGE_VCLIPcxx . . $ `Descent3/weapon.h:223:9`!))) {
2280 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(weaponpointer->fire_image_handlecxx . . $ weapon#fire_image_handle.);
2281 Models_to_freecxx . . $ Models_to_free.[weaponpointer->fire_image_handlecxx . . $ weapon#fire_image_handle.] = 1;
2282
2283 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[weaponpointer->fire_image_handlecxx . . $ weapon#fire_image_handle.];
2284 for (int t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2285 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2286 }
2287
2288 // Load the various textures associated with this weapon
2289 if (weaponpointer->explode_image_handlecxx . . $ weapon#explode_image_handle. != -1) {
2290 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(weaponpointer->explode_image_handlecxx . . $ weapon#explode_image_handle.);
2291 }
2292
2293 if (weaponpointer->particle_handlecxx . . $ weapon#particle_handle. != -1) {
2294 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(weaponpointer->particle_handlecxx . . $ weapon#particle_handle.);
2295 }
2296
2297 if (weaponpointer->smoke_handlecxx . . $ weapon#smoke_handle. != -1) {
2298 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(weaponpointer->smoke_handlecxx . . $ weapon#smoke_handle.);
2299 }
2300
2301 if (weaponpointer->scorch_handlecxx . . $ weapon#scorch_handle. != -1) {
2302 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(weaponpointer->scorch_handlecxx . . $ weapon#scorch_handle.);
2303 }
2304
2305 if (weaponpointer->icon_handlecxx . . $ weapon#icon_handle. != -1) {
2306 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(weaponpointer->icon_handlecxx . . $ weapon#icon_handle.);
2307 }
2308
2309 // Try to load spawn weapons
2310 if (weaponpointer->spawn_handlecxx . . $ weapon#spawn_handle. != -1 && weaponpointer->spawn_countcxx . . $ weapon#spawn_count. > 0 && weaponpointer->spawn_handlecxx . . $ weapon#spawn_handle. != id) {
2311 PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(weaponpointer->spawn_handlecxx . . $ weapon#spawn_handle.);
2312 }
2313
2314 if (weaponpointer->alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle. != -1 && weaponpointer->spawn_countcxx . . $ weapon#spawn_count. > 0 &&
2315 weaponpointer->alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle. != id) {
2316 PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(weaponpointer->alternate_spawn_handlecxx . . $ weapon#alternate_spawn_handle.);
2317 }
2318
2319 if (weaponpointer->robot_spawn_handlecxx . . $ weapon#robot_spawn_handle. != -1) {
2320 PageInGenericcxx . . $ PageInGeneric(d4f767463ce0a6b3).(weaponpointer->robot_spawn_handlecxx . . $ weapon#robot_spawn_handle.);
2321 }
2322
2323 // Try and load the various sounds
2324 for (i = 0; i < MAX_WEAPON_SOUNDScxx . . $ `Descent3/weapon.h:259:9`!; i++) {
2325 if (weaponpointer->soundscxx . . $ weapon#sounds.[i] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2326 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(weaponpointer->soundscxx . . $ weapon#sounds.[i]);
2327 }
2328 }
2329 }
2330 int paged_in_countcxx . . $ paged_in_count. = 0;
2331 extern int need_to_page_incxx . . $ need_to_page_in.;
2332 extern int need_to_page_numcxx . . $ need_to_page_num.;
2333 int paged_in_numcxx . . $ paged_in_num. = 0;
2334
2335 // #define PAGED_IN_CALC paged_in_count ? (float)paged_in_count/(float)need_to_page_in : 0.0f
2336 #define PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`! paged_in_num ? (float)paged_in_num / (float)need_to_page_num : 0.0f
2337 void PageInShipcxx . . $ PageInShip(d4f767463ce0a6b3).(int id) {
2338 int i, t;
2339
2340 shipcxx . . $ ship# *shippointer = &Shipscxx . . $ Ships.[id];
2341
2342 // Page in all textures for this object
2343
2344 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(shippointer->model_handlecxx . . $ ship#model_handle.);
2345 Models_to_freecxx . . $ Models_to_free.[shippointer->model_handlecxx . . $ ship#model_handle.] = 1;
2346
2347 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[shippointer->model_handlecxx . . $ ship#model_handle.];
2348
2349 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++) {
2350 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2351 // Create bumps if neccessary
2352 if (rend_SupportsBumpmappingcxx . . $ rend_SupportsBumpmapping(b126dc7c1de90089).()) {
2353 if (GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[t]].bumpmapcxx . . $ texture#bumpmap. == -1) {
2354 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Trying to make bumpmap!\n");
2355 BuildTextureBumpmapscxx . . $ BuildTextureBumpmaps(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2356 }
2357 }
2358 }
2359
2360 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2361 if (shippointer->med_render_handlecxx . . $ ship#med_render_handle. != -1) {
2362 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(shippointer->med_render_handlecxx . . $ ship#med_render_handle.);
2363 Models_to_freecxx . . $ Models_to_free.[shippointer->med_render_handlecxx . . $ ship#med_render_handle.] = 1;
2364
2365 pm = &Poly_modelscxx . . $ Poly_models.[shippointer->med_render_handlecxx . . $ ship#med_render_handle.];
2366 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2367 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2368 }
2369 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2370 if (shippointer->lo_render_handlecxx . . $ ship#lo_render_handle. != -1) {
2371 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(shippointer->lo_render_handlecxx . . $ ship#lo_render_handle.);
2372 Models_to_freecxx . . $ Models_to_free.[shippointer->lo_render_handlecxx . . $ ship#lo_render_handle.] = 1;
2373
2374 pm = &Poly_modelscxx . . $ Poly_models.[shippointer->lo_render_handlecxx . . $ ship#lo_render_handle.];
2375 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2376 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2377 }
2378 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2379 if (shippointer->dying_model_handlecxx . . $ ship#dying_model_handle. != -1) {
2380 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(shippointer->dying_model_handlecxx . . $ ship#dying_model_handle.);
2381 Models_to_freecxx . . $ Models_to_free.[shippointer->dying_model_handlecxx . . $ ship#dying_model_handle.] = 1;
2382
2383 pm = &Poly_modelscxx . . $ Poly_models.[shippointer->dying_model_handlecxx . . $ ship#dying_model_handle.];
2384 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2385 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2386 }
2387 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2388 // Try and load the various weapons
2389 int j;
2390 if (shippointer->static_wbcxx . . $ ship#static_wb.) {
2391 for (i = 0; i < MAX_PLAYER_WEAPONScxx . . $ `Descent3/player_external_struct.h:91:9`!; i++) {
2392 for (j = 0; j < MAX_WB_GUNPOINTScxx . . $ `lib/robotfirestruct_external.h:22:9`!; j++) {
2393 if (shippointer->static_wbcxx . . $ ship#static_wb.[i].gp_weapon_indexcxx . . $ otype_wb_info#gp_weapon_index.[j] != LASER_INDEXcxx . . $ `Descent3/weapon_external.h:22:9`!) {
2394 PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(shippointer->static_wbcxx . . $ ship#static_wb.[i].gp_weapon_indexcxx . . $ otype_wb_info#gp_weapon_index.[j]);
2395 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2396 }
2397 }
2398 }
2399 }
2400 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2401 // Try and load the various weapons
2402 for (i = 0; i < MAX_PLAYER_WEAPONScxx . . $ `Descent3/player_external_struct.h:91:9`!; i++) {
2403 for (j = 0; j < MAX_WB_FIRING_MASKScxx . . $ `lib/robotfirestruct_external.h:23:9`!; j++) {
2404 if ((j % 5) == 0)
2405 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2406 if (shippointer->static_wbcxx . . $ ship#static_wb.[i].fm_fire_sound_indexcxx . . $ otype_wb_info#fm_fire_sound_index.[j] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)
2407 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(shippointer->static_wbcxx . . $ ship#static_wb.[i].fm_fire_sound_indexcxx . . $ otype_wb_info#fm_fire_sound_index.[j]);
2408 }
2409 }
2410
2411 for (i = 0; i < MAX_PLAYER_WEAPONScxx . . $ `Descent3/player_external_struct.h:91:9`!; i++) {
2412 if ((i % 5) == 0)
2413 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2414 if (shippointer->firing_soundcxx . . $ ship#firing_sound.[i] != -1)
2415 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(shippointer->firing_soundcxx . . $ ship#firing_sound.[i]);
2416
2417 if (shippointer->firing_release_soundcxx . . $ ship#firing_release_sound.[i] != -1)
2418 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(shippointer->firing_release_soundcxx . . $ ship#firing_release_sound.[i]);
2419
2420 if (shippointer->spew_powerupcxx . . $ ship#spew_powerup.[i] != -1)
2421 PageInGenericcxx . . $ PageInGeneric(d4f767463ce0a6b3).(shippointer->spew_powerupcxx . . $ ship#spew_powerup.[i]);
2422 }
2423 }
2424
2425 void PageInGenericcxx . . $ PageInGeneric(d4f767463ce0a6b3).(int id) {
2426 int i, t;
2427
2428 if (id == -1)
2429 return;
2430
2431 object_infocxx . . $ object_info# *objinfopointer = &Object_infocxx . . $ Object_info.[id];
2432
2433 // Page in all textures for this object
2434
2435 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(objinfopointer->render_handlecxx . . $ object_info#render_handle.);
2436 Models_to_freecxx . . $ Models_to_free.[objinfopointer->render_handlecxx . . $ object_info#render_handle.] = 1;
2437
2438 poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[objinfopointer->render_handlecxx . . $ object_info#render_handle.];
2439
2440 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++) {
2441 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2442
2443 // Create bumps if neccessary
2444 if (objinfopointer->typecxx . . $ object_info#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && rend_SupportsBumpmappingcxx . . $ rend_SupportsBumpmapping(b126dc7c1de90089).()) {
2445 if (GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[t]].bumpmapcxx . . $ texture#bumpmap. == -1)
2446 BuildTextureBumpmapscxx . . $ BuildTextureBumpmaps(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2447 }
2448 }
2449
2450 if (objinfopointer->med_render_handlecxx . . $ object_info#med_render_handle. != -1) {
2451 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(objinfopointer->med_render_handlecxx . . $ object_info#med_render_handle.);
2452 Models_to_freecxx . . $ Models_to_free.[objinfopointer->med_render_handlecxx . . $ object_info#med_render_handle.] = 1;
2453
2454 pm = &Poly_modelscxx . . $ Poly_models.[objinfopointer->med_render_handlecxx . . $ object_info#med_render_handle.];
2455 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2456 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2457 }
2458
2459 if (objinfopointer->lo_render_handlecxx . . $ object_info#lo_render_handle. != -1) {
2460 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(objinfopointer->lo_render_handlecxx . . $ object_info#lo_render_handle.);
2461 Models_to_freecxx . . $ Models_to_free.[objinfopointer->lo_render_handlecxx . . $ object_info#lo_render_handle.] = 1;
2462
2463 pm = &Poly_modelscxx . . $ Poly_models.[objinfopointer->lo_render_handlecxx . . $ object_info#lo_render_handle.];
2464 for (t = 0; t < pm->n_texturescxx . . $ poly_model#n_textures.; t++)
2465 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(pm->texturescxx . . $ poly_model#textures.[t]);
2466 }
2467
2468 // Process all sounds for this object
2469 for (i = 0; i < MAX_OBJ_SOUNDScxx . . $ `Descent3/objinfo.h:330:9`!; i++) {
2470 if (objinfopointer->soundscxx . . $ object_info#sounds.[i] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2471 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(objinfopointer->soundscxx . . $ object_info#sounds.[i]);
2472 }
2473 }
2474
2475 if (objinfopointer->ai_infocxx . . $ object_info#ai_info.) {
2476 for (i = 0; i < MAX_AI_SOUNDScxx . . $ `Descent3/aistruct.h:712:9`!; i++) {
2477 if (objinfopointer->ai_infocxx . . $ object_info#ai_info.->soundcxx . . $ t_ai_info#sound.[i] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2478 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(objinfopointer->ai_infocxx . . $ object_info#ai_info.->soundcxx . . $ t_ai_info#sound.[i]);
2479 }
2480 }
2481 }
2482 // Try and load the various wb sounds
2483 int j;
2484 if (objinfopointer->static_wbcxx . . $ object_info#static_wb.) {
2485 for (i = 0; i < MAX_WBS_PER_OBJcxx . . $ `lib/robotfirestruct.h:32:9`!; i++) {
2486 for (j = 0; j < MAX_WB_FIRING_MASKScxx . . $ `lib/robotfirestruct_external.h:23:9`!; j++) {
2487 if (objinfopointer->static_wbcxx . . $ object_info#static_wb.[i].fm_fire_sound_indexcxx . . $ otype_wb_info#fm_fire_sound_index.[j] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2488 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(objinfopointer->static_wbcxx . . $ object_info#static_wb.[i].fm_fire_sound_indexcxx . . $ otype_wb_info#fm_fire_sound_index.[j]);
2489 }
2490 }
2491 }
2492 }
2493 // Try and load the various wb sounds
2494 if (objinfopointer->animcxx . . $ object_info#anim.) {
2495 for (i = 0; i < NUM_MOVEMENT_CLASSEScxx . . $ `Descent3/objinfo.h:368:9`!; i++) {
2496 for (j = 0; j < NUM_ANIMS_PER_CLASScxx . . $ `Descent3/objinfo.h:369:9`!; j++) {
2497 if (objinfopointer->animcxx . . $ object_info#anim.[i].elemcxx . . $ anim_elem#elem.[j].anim_sound_indexcxx . . $ anim_entry#anim_sound_index. != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) {
2498 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(objinfopointer->animcxx . . $ object_info#anim.[i].elemcxx . . $ anim_elem#elem.[j].anim_sound_indexcxx . . $ anim_entry#anim_sound_index.);
2499 }
2500 }
2501 }
2502 }
2503
2504 // Load the spew types
2505 for (i = 0; i < MAX_DSPEW_TYPEScxx . . $ `Descent3/objinfo.h:383:9`!; i++) {
2506 if (objinfopointer->dspew_numbercxx . . $ object_info#dspew_number.[i] > 0 && objinfopointer->dspewcxx . . $ object_info#dspew.[i] != 0 && objinfopointer->dspewcxx . . $ object_info#dspew.[i] != id) {
2507 PageInGenericcxx . . $ PageInGeneric(d4f767463ce0a6b3).(objinfopointer->dspewcxx . . $ object_info#dspew.[i]);
2508 }
2509 }
2510
2511 // Try and load the various weapons
2512
2513 // Automatically include laser
2514 PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(LASER_INDEXcxx . . $ `Descent3/weapon_external.h:22:9`!);
2515
2516 if (objinfopointer->static_wbcxx . . $ object_info#static_wb.) {
2517 for (i = 0; i < MAX_WBS_PER_OBJcxx . . $ `lib/robotfirestruct.h:32:9`!; i++) {
2518 for (j = 0; j < MAX_WB_GUNPOINTScxx . . $ `lib/robotfirestruct_external.h:22:9`!; j++) {
2519 if (objinfopointer->static_wbcxx . . $ object_info#static_wb.[i].gp_weapon_indexcxx . . $ otype_wb_info#gp_weapon_index.[j] != LASER_INDEXcxx . . $ `Descent3/weapon_external.h:22:9`!) {
2520 PageInWeaponcxx . . $ PageInWeapon(d4f767463ce0a6b3).(objinfopointer->static_wbcxx . . $ object_info#static_wb.[i].gp_weapon_indexcxx . . $ otype_wb_info#gp_weapon_index.[j]);
2521 }
2522 }
2523 }
2524 }
2525 }
2526
2527 extern const char *Static_sound_namescxx . . $ Static_sound_names.[];
2528
2529 void PageInAllDatacxx . . $ PageInAllData(49f6e7a06ebc5aa8).() {
2530 int i;
2531 paged_in_countcxx . . $ paged_in_count. = 0;
2532 paged_in_numcxx . . $ paged_in_num. = 0;
2533 memset(Textures_to_freecxx . . $ Textures_to_free., 0, MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!);
2534 memset(Sounds_to_freecxx . . $ Sounds_to_free., 0, MAX_SOUNDScxx . . $ `sndlib/ssl_lib.h:578:9`!);
2535 memset(Models_to_freecxx . . $ Models_to_free., 0, MAX_POLY_MODELScxx . . $ `lib/polymodel_external.h:66:9`!);
2536
2537 PageInShipcxx . . $ PageInShip(d4f767463ce0a6b3).(Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.);
2538 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2539 /*
2540 $$TABLE_TEXTURE "LightFlareStare"
2541 $$TABLE_TEXTURE "LightFlare"
2542 */
2543 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!("LightFlareStar")));
2544 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!("LightFlare")));
2545
2546 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2547
2548 if (PreferredRenderercxx . . $ PreferredRenderer. == RENDERER_DIRECT3Dcxx . . $ RENDERER_DIRECT3D.) {
2549 if (LightmapInfocxx . . $ LightmapInfo. && !Dedicated_servercxx . . $ Dedicated_server.) {
2550 if (!NoLightmapscxx . . $ NoLightmaps.) {
2551 for (i = 0; i < MAX_LIGHTMAP_INFOScxx . . $ `Descent3/lightmap_info.h:74:9`!; i++) {
2552 if (LightmapInfocxx . . $ LightmapInfo.[i].usedcxx . . $ lightmap_info#used. && LightmapInfocxx . . $ LightmapInfo.[i].typecxx . . $ lightmap_info#type. != LMI_DYNAMICcxx . . $ `Descent3/lightmap_info.h:53:9`!) {
2553 if (!Dedicated_servercxx . . $ Dedicated_server. && GameLightmapscxx . . $ GameLightmaps.[LightmapInfocxx . . $ LightmapInfo.[i].lm_handlecxx . . $ lightmap_info#lm_handle.].cache_slotcxx . . $ bms_lightmap#cache_slot. == -1) {
2554 rend_PreUploadTextureToCardcxx . . $ rend_PreUploadTextureToCard(3e454b8ccf442868).(LightmapInfocxx . . $ LightmapInfo.[i].lm_handlecxx . . $ lightmap_info#lm_handle., MAP_TYPE_LIGHTMAPcxx . . $ `lib/renderer.h:363:9`!);
2555 }
2556 }
2557 }
2558 }
2559 }
2560 }
2561
2562 // Get static fireballs
2563 for (i = 0; i < NUM_FIREBALLScxx . . $ `Descent3/fireball.h:178:9`!; i++) {
2564 char name[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!];
2565 strcpy(name, Fireballscxx . . $ Fireballs.[i].namecxx . . $ fireball#name.);
2566
2567 name[strlen(name) - 4] = 0;
2568 int id = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(name);
2569 if (id != -1)
2570 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(id);
2571 }
2572 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2573 // Get static sounds
2574 for (i = 0; i < NUM_STATIC_SOUNDScxx . . $ `Descent3/sounds.h:154:9`!; i++) {
2575 int sid = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).(Static_sound_namescxx . . $ Static_sound_names.[i]);
2576
2577 if (sid != -1)
2578 PageInSoundcxx . . $ PageInSound(83c267b20bac841a).(sid);
2579 }
2580 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2581
2582 // First get textures
2583 for (i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) {
2584 if ((i % 15) == 0)
2585 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2586
2587 if (!Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used.)
2588 continue;
2589
2590 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[i];
2591 for (int t = 0; t < rp->num_facescxx . . $ room#num_faces.; t++) {
2592 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(rp->facescxx . . $ room#faces.[t].tmapcxx . . $ face#tmap.);
2593 }
2594 }
2595 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2596
2597 // Touch all terrain textures
2598 for (i = 0; i < TERRAIN_TEX_WIDTHcxx . . $ `Descent3/terrain.h:34:9`! * TERRAIN_TEX_DEPTHcxx . . $ `Descent3/terrain.h:35:9`!; i++) {
2599 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(Terrain_tex_segcxx . . $ Terrain_tex_seg.[i].tex_indexcxx . . $ terrain_tex_segment#tex_index.);
2600 }
2601 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2602 if (Terrain_skycxx . . $ Terrain_sky..texturedcxx . . $ terrain_sky#textured.) {
2603 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(Terrain_skycxx . . $ Terrain_sky..dome_texturecxx . . $ terrain_sky#dome_texture.);
2604 }
2605 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2606 for (i = 0; i < Terrain_skycxx . . $ Terrain_sky..num_satellitescxx . . $ terrain_sky#num_satellites.; i++)
2607 PageInLevelTexturecxx . . $ PageInLevelTexture(d4f767463ce0a6b3).(Terrain_skycxx . . $ Terrain_sky..satellite_texturecxx . . $ terrain_sky#satellite_texture.[i]);
2608
2609 // Touch all objects
2610 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
2611 if ((i % 20) == 0)
2612 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!, PAGED_IN_CALCcxx . . $ `Descent3/gamesequence.cpp:2336:9`!);
2613 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i];
2614 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`!) {
2615 PageInGenericcxx . . $ PageInGeneric(d4f767463ce0a6b3).(obj->idcxx . . $ object#id.);
2616 continue;
2617 }
2618
2619 if (obj->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) {
2620 PageInDoorcxx . . $ PageInDoor(d4f767463ce0a6b3).(obj->idcxx . . $ object#id.);
2621 continue;
2622 }
2623 }
2624 LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_PREPAREcxx . . $ `Descent3/Mission.h:177:9`!, 0);
2625 }