Debian Codegraph @

Descent3/init.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
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/init.cpp $
21 * $Revision: 323 $
22 * $Date: 10/22/01 12:42p $
23 * $Author: Matt $
24 *
25 * Initialization of D3 systems
26 *
27 * $Log: /DescentIII/Main/init.cpp $
28 *
29 * 323 10/22/01 12:42p Matt
30 * Added MercInstalled() function.
31 *
32 * 322 10/03/01 12:45a Kevin
33 * Smaller version of pxo packets
34 *
35 * 321 9/15/01 1:46p Kevin
36 * Added -nocrashbox to suppress crash dialog box
37 *
38 * 320 9/14/01 4:47p Matt
39 * Cleaned up problems when screen bit depth set to 32.
40 *
41 * 319 9/14/01 12:50p Matt
42 * Took out code that bashed the missile view ot left if it was set to
43 * center. It's now not possible to set the view to center in the config
44 * menu.
45 *
46 * 318 4/19/00 5:36p Matt
47 * Added command-line option to adjust mouse sensitivity
48 *
49 * 317 3/20/00 12:11p Matt
50 * Merge of Duane's post-1.3 changes.
51 * Misc Mac stuff: movie, int'l keyboards, loading screens (Mac only)
52 *
53 * 316 1/26/00 9:20p Jeff
54 * added support for IntelliVIBE DLL
55 *
56 * 315 12/01/99 3:58p Jeff
57 * one last time...linux pregamecdcheck bug fix
58 *
59 * 314 12/01/99 3:30p Jeff
60 * set CD_inserted to 1 for Linux
61 *
62 * 313 11/30/99 5:07p Jeff
63 * no pregame cd check for Linux (for now)
64 *
65 * 312 10/26/99 3:30p Jeff
66 * handle extra.gam addon tablefile
67 *
68 * 311 10/25/99 3:09p Kevin
69 * added -mlooksens
70 *
71 * 310 10/25/99 9:48a Matt
72 * Mac code that should enable the dynamic allocation of lightmap_info
73 * structures. This should be disabled for editor builds.
74 *
75 * 309 10/25/99 12:47a Chris
76 * Fixed a long overdue bug with zero rad wall collison objects and
77 * colliding
78 *
79 * 308 10/22/99 10:52p Matt
80 * Mac merge
81 *
82 * 307 10/22/99 10:43p Jeff
83 * put in a variable to detect whether we are running the editor (needed
84 * in manage system, which can't use EDITOR define)
85 *
86 * 306 10/19/99 4:55p Jeff
87 * removed compiler warning
88 *
89 * 305 10/19/99 12:44p Chris
90 * Fixed a small bug with the registery check
91 *
92 * 304 10/18/99 1:59p Chris
93 * Added the ability to load the merc. hog
94 *
95 * 303 10/17/99 3:55p Jeff
96 * Linux movie stuff
97 *
98 * 302 10/12/99 11:03a Jeff
99 * if there is a -mission command line option, open that mn3 right after
100 * d3.hog for any overridables
101 *
102 * 301 10/06/99 2:04p Kevin
103 * copy protection fix to match the 1.2 full cd
104 *
105 * 300 10/05/99 10:11a Kevin
106 * Don't show tantrum logo on macintosh demo (per GraphSim's Request)
107 *
108 * 299 10/05/99 9:46a Kevin
109 * copy protection can now handle US/AUS & ROW no LL versions in one exe
110 *
111 * 298 9/29/99 8:05a Kevin
112 * Changes to copy protection to allow for us and ROW-NONLL versions to
113 * use the same exe
114 *
115 * 297 9/24/99 12:01p Samir
116 * use directinput when -alternatejoy is selected (like 1.0)
117 *
118 * 296 9/23/99 2:59p Kevin
119 * mac dll hog file
120 *
121 * 295 9/20/99 5:35p Jeff
122 * added -nosparkles command line option to turn off powerup sparkles
123 *
124 * 294 9/18/99 9:21p Jeff
125 * Init motion blur if we are a Katmai
126 *
127 * 293 8/20/99 9:45a Kevin
128 * Rankings changes!
129 *
130 * 292 7/30/99 5:24p Samir
131 * use no joystick emulation by default.
132 *
133 * 291 7/29/99 12:27p Chris
134 * FIxed a mismatched paren
135 *
136 * 290 7/28/99 5:11p Kevin
137 * Mac merges
138 *
139 * 289 7/26/99 5:19p Kevin
140 * fixed copy protection for DVD drives
141 *
142 * 288 7/12/99 6:44p Jeff
143 * create a lock file in the temp directory, if one already exists (for a
144 * program in use), then don't allow the use of the temp directory
145 *
146 * 287 7/08/99 5:44p Jason
147 * added default framecap of 60 to deal with stuttering issues
148 *
149 * 286 7/06/99 5:54p Kevin
150 * more foriegn versions....
151 *
152 * 285 6/24/99 8:10p Jeff
153 * added support for OpenGL renderer
154 *
155 * 284 6/24/99 3:15p Jeff
156 * don't check renderer in Linux if dedicated
157 *
158 * 283 6/22/99 7:03p Jeff
159 * added command line arguments to set renderer for Linux (Glide only
160 * right now)
161 *
162 * 282 6/21/99 2:12p Kevin
163 * South american version changes
164 *
165 * 281 6/17/99 11:34a Kevin
166 *
167 * 280 6/16/99 12:04p Kevin
168 * Warning!!! This is a laserlocked version!
169 *
170 * 279 6/11/99 1:15a Samir
171 * localization issues.
172 *
173 * 278 6/08/99 1:00p Jason
174 * changes for bumpmapping
175 *
176 * 277 6/03/99 8:48a Kevin
177 * fixes for new OEM version....
178 *
179 * 276 5/24/99 6:20a Kevin
180 * fixed dedicated server & copy protection
181 *
182 * 275 5/24/99 2:13a Matt
183 * Fixed -superlowmem switch.
184 *
185 * 274 5/23/99 3:03p Kevin
186 * real dist. checksums
187 *
188 * 273 5/23/99 2:38a Kevin
189 * Lame ass(tm) copy protection
190 *
191 * 272 5/21/99 10:05a Kevin
192 * Added stuff for a future DVD version
193 *
194 * 271 5/19/99 11:47a Kevin
195 * made the parent window of the message box actually be Descent 3.
196 *
197 * 270 5/18/99 10:31a Kevin
198 * made the us version only work with US english and US canadian languages
199 *
200 * 269 5/12/99 2:24p Jeff
201 * Descent3 now has a setable temp directory for all temp files
202 *
203 * 268 5/12/99 1:18p Samir
204 * play music during game too when in menus.
205 *
206 * 267 5/11/99 1:19a Samir
207 * upped music volume, set default to 0.5
208 *
209 * 266 5/10/99 9:25p Jeff
210 * first phase of Rock 'n' Ride support added
211 *
212 * 265 5/10/99 8:49p Jason
213 * added vsync command line switch
214 *
215 * 264 5/10/99 5:35p Kevin
216 * New command line options for heat and scoring API enhancements
217 *
218 * 263 5/07/99 6:54p Jason
219 * fixed some gamegauge issues
220 *
221 * 262 5/07/99 12:04p Samir
222 * added support for foreign keyboards and error text.
223 *
224 * 261 5/06/99 6:11p Kevin
225 * fixes for save/load game syste. Also require CD again and added some
226 * heat.net stuff
227 *
228 * 260 5/05/99 11:16p Kevin
229 * heat.net stuff among other things
230 *
231 * 259 5/05/99 5:46p Samir
232 * took out call to ResumeSounds when restoring from an Alt-tab.
233 *
234 * 258 5/02/99 9:13a Jeff
235 * added system specific hog files (d3-linux.hog for Linux)
236 *
237 * 257 5/01/99 4:24p Jeff
238 * fixed some windows specific code for Linux (*grrrr*)
239 *
240 * 256 4/30/99 10:53p Samir
241 * store pilot settings in a temporary buffer when multitasking.
242 *
243 * 255 4/30/99 5:06p Kevin
244 * misc dedicated server, networking and low memory enhancements
245 *
246 * 254 4/29/99 10:01p Samir
247 * use emulation mode of joystick first.
248 *
249 * 253 4/29/99 5:53p Kevin
250 * Made it so Japanese people can't play D3... well that is only if their
251 * computers have the Japanese language installed. I'm not prejudice or
252 * anything....It's just that Interplay doesn't want the english version
253 * selling in Japan or something like that. :)
254 *
255 * 252 4/29/99 2:28p Kevin
256 * Laserlock implementation
257 *
258 * 251 4/27/99 9:59p Kevin
259 * CD not requred for dedicated server. Also improved demo playback
260 *
261 * 250 4/27/99 2:10p Samir
262 * added code to set the desired sound card given the descriptive name of
263 * a sound card.
264 *
265 * 249 4/26/99 9:11p Matt
266 * Use small font instead of old UI font.
267 *
268 * 248 4/26/99 11:34a Samir
269 * don't resume sounds if game was paused when alt-tabbing back
270 * (ResumeGame will do the trick.)
271 *
272 * 247 4/25/99 6:14p Kevin
273 * added "-timetest file.dem" to behave like gamegauge does
274 *
275 * 246 4/25/99 4:15p Matt
276 * Added code to manually allow the user to specifiy the screen aspect
277 * ratio, to make the game work with wide-screen TVs.
278 *
279 * 245 4/25/99 1:27p Matt
280 * Fixed small bug
281 *
282 * 244 4/22/99 9:53a Kevin
283 * Fixed some dedicated server crashes
284 *
285 * 243 4/20/99 11:44a Jeff
286 * get the language type from the registry
287 *
288 * 242 4/17/99 7:42p Samir
289 * Don't save out renderer and sound mixer in release version since the
290 * launcher should only do this.
291 *
292 * 241 4/17/99 6:15p Samir
293 * replaced gr.h with grdefs.h and fixed resulting compile bugs.
294 *
295 * 240 4/16/99 12:03a Jeff
296 * removed cd check for Linux
297 *
298 * 239 4/15/99 3:48p Samir
299 * set mouse mode when ddio is initialized.
300 *
301 * 238 4/15/99 2:32p Kevin
302 * Added some code for the Demo
303 *
304 * 237 4/15/99 10:57a Kevin
305 * cd check only in release builds
306 *
307 * 236 4/15/99 9:25a Kevin
308 * CD check fixes and updates
309 *
310 * 235 4/14/99 3:07p Kevin
311 * Fixed some multiple CD bugs
312 *
313 * 234 4/14/99 12:35p Samir
314 * localization issues.
315 *
316 * 233 4/14/99 11:48a Matt
317 * Don't set messagebox title for release builds
318 *
319 * 232 4/14/99 2:50a Jeff
320 * fixed some case mismatched #includes
321 *
322 * 231 4/12/99 7:15p Samir
323 * added ability to configure number of sounds played at one time.
324 *
325 * 230 4/09/99 12:02p Samir
326 * joystick changes (Win32 DirectInput support)
327 *
328 * 229 4/06/99 4:15p Nate
329 * Fixed UpdateInitMessage in editor (samir)
330 *
331 * 228 4/06/99 1:53p Samir
332 * added improved progress bar.
333 *
334 * 227 4/05/99 9:53a Kevin
335 * Took out the splash screens Craig made me add while he was smoking
336 * crack.
337 *
338 * 226 4/04/99 8:15p Jeff
339 * added debug graph stuff
340 *
341 * 225 4/03/99 1:24p Jason
342 * changed some wording for loading screen
343 *
344 * 224 4/02/99 7:04p Kevin
345 * Added splash screens do release builds
346 *
347 * 223 4/02/99 5:08p Matt
348 * Added intro movie.
349 *
350 * 222 4/02/99 3:49p Kevin
351 * Added profanity filter code
352 *
353 * 221 4/02/99 1:26p Matt
354 * Changes I made for the OEM version but forgot to check in. Oops.
355 *
356 * 220 3/19/99 4:08p Kevin
357 * Multiple CD installation support
358 *
359 * 219 3/09/99 12:34p Jeff
360 * extract scripts to custom\cache
361 *
362 * 218 3/08/99 3:29p Samir
363 * RestartD3 ddio_Init key emulation = true.
364 *
365 * 217 3/05/99 5:23p Jeff
366 * extract scripts from extra.hog before d3.hog
367 *
368 * 216 3/04/99 1:15p Jeff
369 * erase temporary files that may have been left over from last run
370 *
371 * 215 3/02/99 5:21p Jason
372 * fixed some flip bugs
373 *
374 * 214 3/02/99 2:21p Samir
375 * windows 95 and NT both use same keyboard handler due to flaky
376 * directinput.
377 *
378 * 213 3/02/99 1:49a Mark
379 * put ifdefs around showstaticscreen
380 *
381 * 212 3/02/99 12:16a Jeff
382 *
383 * 211 3/02/99 12:06a Kevin
384 *
385 * 210 3/01/99 11:48p Jeff
386 * fixed prototype placement
387 *
388 * 209 3/01/99 11:47p Kevin
389 *
390 * 208 3/01/99 11:38p Kevin
391 *
392 * 207 3/01/99 9:03p Kevin
393 * OEM Beta 4
394 *
395 * 206 2/19/99 10:31p Samir
396 * added music volume.
397 *
398 * 205 2/17/99 12:38p Kevin
399 * Added -framecap <fps> to limit frame and fixed timer bug and old
400 * framerate limiter code.
401 *
402 * 204 2/16/99 12:00p Samir
403 * added new video resolution swtich test.
404 *
405 * 203 2/16/99 12:36a Kevin
406 * Fixes for release builds of OEM V3 and KAtmai
407 *
408 * 202 2/15/99 3:24p Kevin
409 *
410 * 201 2/15/99 3:23p Kevin
411 * Disabled procedurals for gamegauge
412 *
413 * 200 2/15/99 3:20p Kevin
414 * Fixed bug with dlls in a hog
415 *
416 * 199 2/15/99 1:22p Kevin
417 * Changes for GameGauge
418 *
419 * 198 2/11/99 10:35p Jeff
420 * added support for multiple languages in string table files
421 *
422 * 197 2/10/99 3:29p Jeff
423 * extracted dll manager knows difference between game hogs and miission
424 * hogs
425 *
426 * 196 2/09/99 1:29a Jeff
427 * added code to let D3 process multiplayer games in the background if
428 * game is not in focus.
429 *
430 * 195 2/08/99 2:24p Kevin
431 * Display bundler.mve and bundler.tga if they are included in the OEM
432 * package.
433 *
434 * 194 2/05/99 7:23p Kevin
435 * OEM Changes
436 *
437 * 193 2/04/99 9:46a Kevin
438 * OEM version changes
439 *
440 * 192 1/31/99 8:51p Jeff
441 * new in game cinematics system finished
442 *
443 * 191 1/29/99 5:22p Jeff
444 * localization
445 *
446 * 190 1/27/99 6:08p Jason
447 * first pass at markers
448 *
449 * 189 1/27/99 2:58p Jason
450 * fixed center small view
451 *
452 * 188 1/25/99 6:47p Samir
453 * allow slow keyboard
454 *
455 * 187 1/25/99 11:02a Samir
456 * revamped mouse and key controls.
457 *
458 * 186 1/25/99 12:33a Jeff
459 * save out scorch marks and weapon corona detail settings
460 *
461 * 185 1/21/99 11:15p Jeff
462 * pulled out some structs and defines from header files and moved them
463 * into seperate header files so that multiplayer dlls don't require major
464 * game headers, just those new headers. Side effect is a shorter build
465 * time. Also cleaned up some header file #includes that weren't needed.
466 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
467 * manage.h and multi.h
468 *
469 * 184 1/17/99 10:41p Kevin
470 * Added command line options for setting the renderer in GAMEGAUGE mode.
471 *
472 * 183 1/13/99 3:25p Jason
473 * fixed vsync problem
474 *
475 * 182 1/08/99 2:58p Kevin
476 * Added TCP mprintf support so you can log to a remote machine.
477 *
478 * 181 1/08/99 2:55p Samir
479 * Ripped out OSIRIS1.
480 *
481 * 180 1/07/99 12:28p Samir
482 * Call to InitD3Music added parameter.
483 *
484 * 179 1/05/99 3:59p Kevin
485 *
486 * 178 1/05/99 3:55p Kevin
487 * Added structured exception handling
488 *
489 * 177 1/04/99 5:43p Kevin
490 * new command line args
491 *
492 * 176 12/23/98 6:38p Kevin
493 * All UDP data (except gamespy) now uses one (registered) port number
494 *
495 * 175 12/16/98 12:04p Kevin
496 * GameSpy!
497 *
498 * 174 12/14/98 4:48p Jeff
499 * call to intialize Osiris module manager
500 *
501 * 173 12/10/98 3:41p Jeff
502 * implemented settings for 16 or 32 bit depth (in config)
503 *
504 * 172 12/07/98 11:30a Kevin
505 * Added some features from the 1.1 demo patch
506 *
507 * 171 12/02/98 1:07p Jason
508 * made vsync work correctly, finally
509 *
510 * 170 11/24/98 5:17p Jeff
511 * initialize Pilot Pics
512 *
513 * 169 11/23/98 12:31p Jeff
514 * save out force feedback stuff (bad merge, we lost it earlier)
515 *
516 * 168 11/13/98 2:29p Samir
517 * new music code.
518 *
519 * 166 11/09/98 2:59p Kevin
520 * Added command line option for disabling multiplayer bitmap exchange
521 *
522 * 165 11/03/98 6:43p Jeff
523 * new low-level & high level Force Feedback system implemented, handles
524 * window losing focus, etc.
525 *
526 * 164 10/24/98 2:18p Samir
527 * don't do mouse stuff for dedicated server.
528 *
529 * 163 10/22/98 2:42p Samir
530 * fixed ALT-TAB pause issue.
531 *
532 * 162 10/22/98 1:58p Kevin
533 * Fixed the working directory (-setdir) command
534 *
535 * 161 10/22/98 1:39p Jeff
536 * autolevel is default full
537 *
538 * 160 10/20/98 6:24p Jason
539 * added super low memory mode
540 *
541 * 159 10/20/98 10:56a Sean
542 * fixed #ifdef editor thingy
543 *
544 * 158 10/20/98 12:58a Jeff
545 * added a way to force a lo-resolution timer
546 *
547 * 157 10/20/98 12:10a Samir
548 * this should fix the problem of the mouse not working properly in game.
549 *
550 * 156 10/19/98 6:30p Jeff
551 * changes made for detail variables. Put in preset values. Preset
552 * options. Removed terrain_cast from detail. Put new callbacks in
553 * UIListBox and UISlider
554 *
555 * 153 10/18/98 9:12p Matt
556 * Use new symbolic constant for the program name.
557 *
558 * 152 10/18/98 8:51p Matt
559 * Revamped debug/error system.
560 *
561 * 151 10/18/98 3:36p Jeff
562 * if _DEBUG isn't defined than the rtp_enable/disableflags call gets
563 * compiled out
564 *
565 * 150 10/18/98 2:50p Kevin
566 * Use low memory mode in dedicated server mode.
567 *
568 * 149 10/17/98 5:50p Jeff
569 * hooked in rtperformance (run time performance) library
570 *
571 * 148 10/17/98 12:46p Kevin
572 * Beta 4 fixes
573 *
574 * 147 10/16/98 2:44p Kevin
575 * working on getting demo compiling
576 *
577 * 146 10/16/98 1:54p Kevin
578 * Changes for Demo Beta 4
579 *
580 * 145 10/15/98 1:33p Jeff
581 * removed amount of debris detail level. Added powerup halo detail
582 * level. Added predef detail level settings
583 *
584 * 144 10/15/98 11:58a Kevin
585 * checked for low mem
586 *
587 * 143 10/14/98 4:37p Matt
588 * Made InitD3System() exit with error if there's a problem instead of
589 * returning a status value. Also moved some editor-specific code from
590 * init.cpp to mainfrm.cpp, and cleaned up some other initialization and
591 * error-handling code.
592 *
593 * 142 10/13/98 3:47p Samir
594 * added function to check if a cursor is visible
595 *
596 * 141 10/13/98 3:41p Kevin
597 * bug fixes
598 *
599 * 140 10/13/98 2:49p Matt
600 * Open "extra.hog" (if it exists" at startup so we can put any extra data
601 * in there.
602 *
603 * 139 10/12/98 3:01p Jeff
604 * added vsync and more detail level settings
605 *
606 * 138 10/12/98 2:51p Samir
607 * use main menu background for loading data screen.
608 *
609 * 137 10/09/98 8:47p Samir
610 * don't kill sound library when shutting down game.
611 *
612 * 136 10/08/98 7:27p Samir
613 * don't change defer handlers when shuting down or restarting.
614 *
615 * 135 10/08/98 5:55p Matt
616 * Set main hogfile.
617 *
618 * 134 10/08/98 3:36p Jason
619 * fixes for the demo
620 *
621 * 133 10/08/98 1:23p Samir
622 * shutdown and reinit now do so with ddio systems.
623 *
624 * 132 10/07/98 2:54p Jeff
625 * General UI fixes and additions
626 *
627 * 131 10/07/98 12:55p Jason
628 * fixed some defaults
629 *
630 * 130 10/03/98 11:21p Matt
631 * Added system to seperately control outline mode for mine, terrain, sky,
632 * & objects
633 *
634 * 129 10/01/98 11:57a Matt
635 * Added some mprintf()s
636 *
637 * 128 9/30/98 10:36a Kevin
638 * Added command line launching of URLs and command line directory
639 * specification
640 *
641 * 127 9/25/98 2:53p Jason
642 * added progress bar
643 *
644 * 126 9/25/98 12:31p Samir
645 * in main game, hide cursor when starting.
646 *
647 * 125 9/23/98 3:08p Jeff
648 *
649 * 124 9/22/98 6:58p Samir
650 * Render_floating_triggers is _DEBUG code, so make it so.
651 *
652 * 123 9/22/98 3:55p Samir
653 * ifdef out stuff for non-debug version.
654 *
655 * 122 9/22/98 10:32a Jason
656 * made preferred renderer default to OpenGL
657 *
658 * 121 9/21/98 11:10a Jeff
659 * Calls to init/close forcefeedback
660 *
661 * 120 9/18/98 7:38p Jeff
662 * creation of low-level forcefeedback and beginning of high-level
663 * forcefeedback
664 *
665 * 119 9/18/98 1:27p Jason
666 * cleaned up renderer initting
667 *
668 * 118 9/16/98 6:07p Jason
669 * made dedicated server use standard mouse mode
670 *
671 * 117 9/15/98 4:31p Jason
672 * added more functionality for the dedicated server
673 *
674 * 116 9/14/98 6:28p Jason
675 * first pass at getting dedicated server working
676 *
677 * 115 9/03/98 12:11p Chris
678 * Adding matcen support
679 *
680 * 114 8/31/98 12:39p Samir
681 * added code to resume controllers when restoring game mode.
682 *
683 * 113 8/27/98 6:23p Jeff
684 * changed autoleveling in config so it is a slider...had to convert
685 * global from bool->uint8_t. Added fast headlight and mirrored surfaces to
686 * config menu
687 *
688 * 112 8/19/98 2:19p Jeff
689 * moved detail globals to a struct
690 *
691 * 111 8/17/98 6:40p Matt
692 * Added ambient sound system
693 *
694 * 110 8/15/98 5:16p Matt
695 * Added new Base_directory variable. Got rid of D3_LOCAL check and
696 * 'local directory' registry variable.
697 *
698 * 109 8/10/98 5:52p Samir
699 * took out briefings search path.
700 *
701 * 108 7/31/98 11:51a Jason
702 * added player ship choosing to multiplayer games
703 *
704 * 107 7/24/98 5:32p Samir
705 * added initializer for D3 Music.
706 *
707 * 106 7/13/98 12:42p Samir
708 * don't do initmessage if graphics system not initialized.
709 *
710 * 105 7/08/98 6:27p Samir
711 * stream library integrated with highlevel sound system.
712 *
713 * 104 7/01/98 4:56p Samir
714 * redid init code.
715 *
716 * 103 6/24/98 11:14a Chris
717 * Added more support and bug fixes
718 *
719 * 102 6/23/98 6:00p Chris
720 * DirectSound 16 mixer is active with 8 bit samples
721 *
722 * 101 6/22/98 12:00p Chris
723 * Working on sound system to make it in a nice shape.
724 *
725 * 100 6/19/98 6:42p Jason
726 * made specular mapping a config detail item
727 *
728 * 99 6/19/98 6:04p Jeff
729 * variables to turn on/off voices
730 *
731 * 98 6/18/98 5:22p Jeff
732 * initialize streaming audio system
733 *
734 * 97 6/17/98 3:58p Jeff
735 * put in PilotInit(). String table loaded near begining for Main exe,
736 * after tables are loaded for editor
737 *
738 * 96 6/16/98 3:48p Chris
739 * Updated the sound system and added the start of sound streaming
740 *
741 * 95 6/16/98 11:49a Jeff
742 * string table loaded after manage system
743 *
744 * 94 6/16/98 10:54a Jeff
745 *
746 * 93 6/12/98 5:56p Jeff
747 * Load string tables during init
748 *
749 * 92 6/08/98 3:56p Jeff
750 * added initializing functions for compressed audio and voice systems
751 *
752 * 91 6/02/98 6:03p Jason
753 * added specular lightmaps
754 *
755 * 90 6/02/98 4:37p Samir
756 * multiple joysticks supported.
757 *
758 * 89 6/01/98 11:37a Chris
759 *
760 * 88 5/19/98 3:43p Samir
761 * must move mem_Init after error_Init.
762 *
763 * 87 5/19/98 3:37p Samir
764 * added mem_Init
765 *
766 * 86 5/14/98 11:49a Chris
767 * Bettered the sound paging system
768 *
769 * 85 5/12/98 2:05p Craig
770 * errror
771 *
772 * 84 5/12/98 11:45a Samir
773 * added logfile init.
774 *
775 * 83 5/06/98 6:34p Jeff
776 * Added Terrain casting to config
777 *
778 * 82 5/06/98 4:32p Samir
779 * moved ui init back to it's proper place.
780 *
781 * 81 5/06/98 12:44p Jeff
782 * added saving/restoring video resolution
783 *
784 * 80 5/05/98 5:16p Samir
785 * took out calls to init UI system (that's done now in SetScreenMode)
786 *
787 * 79 5/05/98 3:02p Jason
788 * attempting to add different screen resolutions
789 *
790 * 78 5/04/98 3:42p Matt
791 * Page in all sounds at init time, so you don't have to wait when you're
792 * starting a game
793 *
794 * 77 5/01/98 4:48p Jeff
795 * Added autoleveling into the configuration
796 *
797 * 76 4/28/98 6:42p Matt
798 * If registry says renderer is software, force it to be glide.
799 *
800 * 75 4/28/98 11:56a Jeff
801 * moved things from config (d3.cfg) into the registry
802 *
803 * 74 4/24/98 1:53a Samir
804 * added trigger init and free.
805 *
806 * 73 4/16/98 6:53a Samir
807 * added default script warning system.
808 *
809 * 72 4/16/98 12:23a Samir
810 * fixed bug when checking if script compiled in editor.
811 *
812 * 71 4/14/98 7:31p Matt
813 * Changed code to use ddio_MakePath() instead of sprintf() to create file
814 * spec
815 *
816 * 70 4/10/98 7:48p Samir
817 * make sure to set default values for outlining, etc.
818 *
819 * 69 4/09/98 5:30p Samir
820 * new main menu art.
821 *
822 * 68 4/08/98 7:19p Samir
823 * Added runtime debugging option.
824 *
825 * 67 4/07/98 9:20p Samir
826 * Changes to debug stuff.
827 *
828 * 66 4/06/98 5:13p Chris
829 * Sounds page in at the beginning of a level
830 *
831 * 65 4/02/98 7:58p Samir
832 * make sure to pause game and close/init control system when application
833 * looses focus.
834 *
835 * 64 3/27/98 5:18p Samir
836 * initialize debug break handlers differently for editor.
837 *
838 * 63 3/27/98 3:29p Brent
839 * if joy init fails, don't try initializing joystick. (samir)
840 *
841 * 62 3/27/98 2:44p Samir
842 * Restore joystick initialization.
843 *
844 * 61 3/23/98 8:03p Samir
845 * A bunch of changes to allow for ALT-TAB to work.
846 *
847 * 60 3/20/98 5:51p Jason
848 * more changes for multiplayer
849 *
850 * 59 3/20/98 1:19p Jeff
851 * Changes made to use Default_pilot string for pilot filename to use.
852 *
853 * 58 3/19/98 11:27a Samir
854 * Better error checking.
855 *
856 * 57 3/13/98 1:22p Jason
857 * Moved UseHardware flag to the renderer lib where it belongs
858 *
859 * 56 3/10/98 5:16p Samir
860 * Got debug callbacks working when you hit an Int3.
861 *
862 * 55 3/05/98 6:39p Samir
863 * Initialize ui system with UI_FONT
864 *
865 * 54 3/04/98 12:00p Jason
866 * added default gamma settings
867 *
868 * 53 2/27/98 5:35p Jeff
869 * Added in loading and saving of a game configuration file
870 *
871 * 52 2/18/98 1:33a Jason
872 * don't do mip mapping by default
873 *
874 * 51 2/18/98 1:11a Samir
875 * Some game window mess.
876 *
877 * 50 2/17/98 2:21p Samir
878 * Added d3xdebug.h
879 *
880 * 49 2/14/98 10:48p Jason
881 * got preferred rendering working
882 *
883 * 46 2/11/98 5:55p Samir
884 * Now InitD3XDebug and CloseD3XDebug are called when you enter and leave
885 * the game. This as well as ui_Init and ui_Close
886 *
887 * 45 2/02/98 7:34p Samir
888 * Moved D3X Initialization to PlayGame.
889 *
890 * 44 1/29/98 12:24p Samir
891 * Added logfile support.
892 *
893 * 43 1/27/98 1:20p Samir
894 * Fixed initialization for main game.
895 *
896 * 42 1/13/98 12:31p Samir
897 * only register small font for editor.
898 *
899 * 41 1/02/98 5:32p Chris
900 * More radical changes to the sound system
901 *
902 * 40 12/31/97 1:01a Chris
903 * Removed old dead code
904 *
905 *
906 *
907 * $NoKeywords: $
908 */
909
910 // Initialization routines for Descent3/Editor
911
912 #include <cstring>
913 #include <ctime>
914 #include <filesystem>
915
916 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
917 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
918 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
919 #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/
920 #include "init.h"cxx . . $ `<file>/Descent3/init.h`/
921 #include "config.h"cxx . . $ `<file>/Descent3/config.h`/
922 #include "3d.h"cxx . . $ `<file>/lib/3d.h`/
923 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
924 #include "manage.h"cxx . . $ `<file>/lib/manage.h`/
925 #include "bitmap.h"cxx . . $ `<file>/lib/bitmap.h`/
926 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
927 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
928 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
929 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
930 #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/
931 #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/
932 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
933 #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/
934 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
935 #include "door.h"cxx . . $ `<file>/Descent3/door.h`/
936 #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/
937 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
938 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
939 #include "controls.h"cxx . . $ `<file>/Descent3/controls.h`/
940 #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/
941 #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/
942 #include "appdatabase.h"cxx . . $ `<file>/lib/appdatabase.h`/
943 #include "room.h"cxx . . $ `<file>/Descent3/room.h`/
944 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
945 #include "gamefile.h"cxx . . $ `<file>/Descent3/gamefile.h`/
946 #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/
947 #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/
948 #include "cinematics.h"cxx . . $ `<file>/Descent3/cinematics.h`/
949 #include "lightmap_info.h"cxx . . $ `<file>/Descent3/lightmap_info.h`/
950 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
951 #include "networking.h"cxx . . $ `<file>/lib/networking.h`/
952 #include "args.h"cxx . . $ `<file>/Descent3/args.h`/
953 #include "pilot.h"cxx . . $ `<file>/Descent3/pilot.h`/
954 #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/
955 #include "trigger.h"cxx . . $ `<file>/Descent3/trigger.h`/
956 #include "physics.h"cxx . . $ `<file>/physics/physics.h`/
957 #include "special_face.h"cxx . . $ `<file>/Descent3/special_face.h`/
958 #include "voice.h"cxx . . $ `<file>/Descent3/voice.h`/
959 #include "localization.h"cxx . . $ `<file>/Descent3/localization.h`/
960 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
961 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
962 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
963 #include "ambient.h"cxx . . $ `<file>/Descent3/ambient.h`/
964 #include "matcen.h"cxx . . $ `<file>/Descent3/matcen.h`/
965 #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/
966 #include "D3ForceFeedback.h"cxx . . $ `<file>/Descent3/D3ForceFeedback.h`/
967 #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/
968 #include "SmallViews.h"cxx . . $ `<file>/Descent3/SmallViews.h`/
969 #include "uisys.h"cxx . . $ `<file>/ui/uisys.h`/
970 #include "rtperformance.h"cxx . . $ `<file>/rtperformance/rtperformance.h`/
971 #include "d3music.h"cxx . . $ `<file>/Descent3/d3music.h`/
972 #include "PilotPicsAPI.h"cxx . . $ `<file>/Descent3/PilotPicsAPI.h`/
973 #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/
974 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
975 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
976 #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/
977 #include "gamecinematics.h"cxx . . $ `<file>/Descent3/gamecinematics.h`/
978 #include "debuggraph.h"cxx . . $ `<file>/Descent3/debuggraph.h`/
979
980 // Uncomment this to allow all languages
981 #define ALLOW_ALL_LANGcxx . . $ `Descent3/init.cpp:981:9`! 1
982
983 #ifdef EDITOR
984 #include "editor\HFile.h"
985 #include "editor\d3edit.h"
986 #include "slew.h"
987 #include "gr.h"
988 #define INIT_MESSAGE(c) SplashMessage c
989 #else
990 void IntroScreencxx . . $ IntroScreen(49f6e7a06ebc5aa8).();
991 #define INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(c) InitMessage(c)
992 #endif
993
994 #if defined(EDITOR) || defined(NEWEDITOR)
995 bool Running_editor = true; // didn't we have a variable like this somewhere
996 #else
997 bool Running_editorcxx . . $ Running_editor. = false; // didn't we have a variable like this somewhere
998 #endif
999
1000 static bool Init_in_editorcxx . . $ Init_in_editor. = false;
1001
1002 // used to update load bar.
1003 static void SetInitMessageLengthcxx . . $ SetInitMessageLength(42eacfea086a5352).(const char *c, float amount); // portion of total bar to fill (0 to 1)
1004 extern void UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(float amount); // amount is 0 to 1
1005 static void SetupTempDirectorycxx . . $ SetupTempDirectory(49f6e7a06ebc5aa8).(void);
1006 static void DeleteTempFilescxx . . $ DeleteTempFiles(49f6e7a06ebc5aa8).(void);
1007 static void PreGameCdCheckcxx . . $ PreGameCdCheck(49f6e7a06ebc5aa8).();
1008 static void InitIOSystemscxx . . $ InitIOSystems(b45ddcbc8423892c).(bool editor);
1009 static void InitStringTablecxx . . $ InitStringTable(49f6e7a06ebc5aa8).();
1010 static void InitGraphicscxx . . $ InitGraphics(b45ddcbc8423892c).(bool editor);
1011 static void InitGameSystemscxx . . $ InitGameSystems(b45ddcbc8423892c).(bool editor);
1012 static void InitDedicatedServercxx . . $ InitDedicatedServer(49f6e7a06ebc5aa8).();
1013
1014 #define TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`! 256
1015
1016 // If there's a joystick, this is the stick number. Else, this is -1
1017 char App_ddvid_subsystemcxx . . $ App_ddvid_subsystem.[8];
1018
1019 // other info.
1020 static chunked_bitmapcxx . . $ chunked_bitmap# Title_bitmapcxx . . $ Title_bitmap.;
1021 static bool Init_systems_initcxx . . $ Init_systems_init. = false;
1022 static bool Graphics_initcxx . . $ Graphics_init. = false;
1023 static bool Title_bitmap_initcxx . . $ Title_bitmap_init. = false;
1024 uint8_tcxx . . $ uint8_t# Use_motion_blurcxx . . $ Use_motion_blur. = 0;
1025
1026 // The "root" directory of the D3 file tree
1027 char Base_directorycxx . . $ Base_directory.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1028 char Base_directory_writecxx . . $ Base_directory_write.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1029
1030 extern int Min_allowed_frametimecxx . . $ Min_allowed_frametime.;
1031
1032 extern bool Render_powerup_sparklescxx . . $ Render_powerup_sparkles.;
1033 extern int Use_file_xfercxx . . $ Use_file_xfer.;
1034
1035 static const float kDefaultMouselookSensitivitycxx . . $ kDefaultMouselookSensitivity. = 9.102f;
1036 static const float kAnglesPerDegreecxx . . $ kAnglesPerDegree. = 65536.0f / 360.0f;
1037 float Mouselook_sensitivitycxx . . $ Mouselook_sensitivity. = kAnglesPerDegreecxx . . $ kAnglesPerDegree. * kDefaultMouselookSensitivitycxx . . $ kDefaultMouselookSensitivity.;
1038 float Mouse_sensitivitycxx . . $ Mouse_sensitivity. = 1.0f;
1039
1040 int merc_hidcxx . . $ merc_hid. = -1;
1041
1042 /*
1043 Initializes all the subsystems that need to be initialized BEFORE application creation.
1044 Returns 1 if all is good, 0 if something is wrong
1045 */
1046 void PreInitD3Systemscxx . . $ PreInitD3Systems(49f6e7a06ebc5aa8).() {
1047 // initialize error system
1048 bool debugging = false;
1049
1050 #ifndef RELEASE
1051
1052 debugging = (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-debug") != 0);
1053
1054 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-logfile")) {
1055 char logfile_path[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1056 char* prefPath = SDL_GetPrefPath("Outrage Entertainment", "Descent 3");
1057 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(logfile_path, prefPath, "d3.log", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1058 SDL_free(prefPath);
1059 Debug_Logfilecxx . . $ Debug_Logfile(c5f7da30cbc0f4e9).(logfile_path);
1060 }
1061
1062 #endif
1063
1064 #ifdef DAJ_DEBUG
1065 debugging = true;
1066 #endif
1067
1068 error_Initcxx . . $ error_Init(c4501528ba8b3ce4).(debugging, PRODUCT_NAMEcxx . . $ `Descent3/descent.h:140:9`!);
1069
1070 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-lowmem"))
1071 Mem_low_memory_modecxx . . $ Mem_low_memory_mode. = true;
1072 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-superlowmem"))
1073 Mem_low_memory_modecxx . . $ Mem_low_memory_mode. = Mem_superlow_memory_modecxx . . $ Mem_superlow_memory_mode. = true;
1074 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-dedicated"))
1075 Mem_low_memory_modecxx . . $ Mem_low_memory_mode. = true;
1076 mem_Initcxx . . $ mem_Init(49f6e7a06ebc5aa8).();
1077 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-himem")) {
1078 Mem_low_memory_modecxx . . $ Mem_low_memory_mode. = false;
1079 Mem_superlow_memory_modecxx . . $ Mem_superlow_memory_mode. = false;
1080 }
1081 // For the client and the server, this turns off the bitmap exchange system.
1082 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nomultibmp"))
1083 Use_file_xfercxx . . $ Use_file_xfer. = 0;
1084
1085 int iframelmtarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-limitframe");
1086 if (iframelmtarg) {
1087 Min_allowed_frametimecxx . . $ Min_allowed_frametime. = atoi(GameArgscxx . . $ GameArgs.[iframelmtarg + 1]);
1088 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Using %d as a minimum frametime\n", Min_allowed_frametime);
1089 } else {
1090 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-dedicated"))
1091 Min_allowed_frametimecxx . . $ Min_allowed_frametime. = 30;
1092 else
1093 Min_allowed_frametimecxx . . $ Min_allowed_frametime. = 0;
1094 }
1095 iframelmtarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-framecap");
1096 if (iframelmtarg) {
1097 Min_allowed_frametimecxx . . $ Min_allowed_frametime. = ((float)1.0 / (float)atoi(GameArgscxx . . $ GameArgs.[iframelmtarg + 1])) * 1000;
1098 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Using %d as a minimum frametime\n", Min_allowed_frametime);
1099 } else {
1100 // Default to a framecap of 60
1101 Min_allowed_frametimecxx . . $ Min_allowed_frametime. = (1.0 / 60.0) * 1000;
1102 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Using default framecap of 60\n");
1103 }
1104
1105 // Mouselook sensitivity!
1106 int msensearg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-mlooksens");
1107 if (msensearg) {
1108 Mouselook_sensitivitycxx . . $ Mouselook_sensitivity. = kAnglesPerDegreecxx . . $ kAnglesPerDegree. * atof(GameArgscxx . . $ GameArgs.[msensearg + 1]);
1109 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Using mouselook sensitivity of %f\n", Mouselook_sensitivity);
1110 }
1111
1112 // Mouse sensitivity (non-mouselook)
1113 msensearg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-mousesens");
1114 if (msensearg) {
1115 Mouse_sensitivitycxx . . $ Mouse_sensitivity. = atof(GameArgscxx . . $ GameArgs.[msensearg + 1]);
1116 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Using mouse sensitivity of %f\n", Mouse_sensitivity);
1117 }
1118
1119 grtext_Initcxx . . $ grtext_Init(49f6e7a06ebc5aa8).();
1120
1121 #ifndef RELEASE
1122 SetMessageBoxTitlecxx . . $ SetMessageBoxTitle(85c52e162fed56f9).(PRODUCT_NAMEcxx . . $ `Descent3/descent.h:140:9`! " Message");
1123 #endif
1124 }
1125
1126 void SaveGameSettingscxx . . $ SaveGameSettings(49f6e7a06ebc5aa8).() {
1127 char tempbuffer[TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!];
1128 int tempint;
1129
1130 snprintf(tempbuffer, sizeof(tempbuffer), "%f", Render_preferred_statecxx . . $ Render_preferred_state..gammacxx . . $ renderer_preferred_state#gamma.);
1131 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("RS_gamma", tempbuffer, strlen(tempbuffer) + 1);
1132
1133 snprintf(tempbuffer, sizeof(tempbuffer), "%f", Sound_systemcxx . . $ Sound_system..GetMasterVolumecxx . . $ hlsSystem#GetMasterVolume(9b8c9e39889c762c).());
1134 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("SND_mastervol", tempbuffer, strlen(tempbuffer) + 1);
1135
1136 snprintf(tempbuffer, sizeof(tempbuffer), "%f", D3MusicGetVolumecxx . . $ D3MusicGetVolume(9b8c9e39889c762c).());
1137 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("MUS_mastervol", tempbuffer, strlen(tempbuffer) + 1);
1138
1139 snprintf(tempbuffer, sizeof(tempbuffer), "%f", Detail_settingscxx . . $ Detail_settings..Pixel_errorcxx . . $ tDetailSettings#Pixel_error.);
1140 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("RS_pixelerror", tempbuffer, strlen(tempbuffer) + 1);
1141
1142 snprintf(tempbuffer, sizeof(tempbuffer), "%f", Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance. / ((float)TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!));
1143 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("RS_terraindist", tempbuffer, strlen(tempbuffer) + 1);
1144
1145 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("Dynamic_Lighting", Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting.);
1146
1147 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1148 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("Outline_mode", Outline_modecxx . . $ Outline_mode.);
1149 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("Lighting_on", Lighting_oncxx . . $ Lighting_on.);
1150 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("Render_floating_triggers", Render_floating_triggerscxx . . $ Render_floating_triggers.);
1151 #endif
1152
1153 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("TerrLeveling", Default_player_terrain_levelingcxx . . $ Default_player_terrain_leveling.);
1154 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RoomLeveling", Default_player_room_levelingcxx . . $ Default_player_room_leveling.);
1155 // Database->write("Terrain_casting",Detail_settings.Terrain_casting);
1156 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("Specmapping", Detail_settingscxx . . $ Detail_settings..Specular_lightingcxx . . $ tDetailSettings#Specular_lighting.);
1157 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("FastHeadlight", Detail_settingscxx . . $ Detail_settings..Fast_headlight_oncxx . . $ tDetailSettings#Fast_headlight_on.);
1158 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("MirrorSurfaces", Detail_settingscxx . . $ Detail_settings..Mirrored_surfacescxx . . $ tDetailSettings#Mirrored_surfaces.);
1159 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("MissileView", Missile_camera_windowcxx . . $ Missile_camera_window.);
1160 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_vsync", Render_preferred_statecxx . . $ Render_preferred_state..vsync_oncxx . . $ renderer_preferred_state#vsync_on.);
1161 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailScorchMarks", Detail_settingscxx . . $ Detail_settings..Scorches_enabledcxx . . $ tDetailSettings#Scorches_enabled.);
1162 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailWeaponCoronas", Detail_settingscxx . . $ Detail_settings..Weapon_coronas_enabledcxx . . $ tDetailSettings#Weapon_coronas_enabled.);
1163 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailFog", Detail_settingscxx . . $ Detail_settings..Fog_enabledcxx . . $ tDetailSettings#Fog_enabled.);
1164 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailCoronas", Detail_settingscxx . . $ Detail_settings..Coronas_enabledcxx . . $ tDetailSettings#Coronas_enabled.);
1165 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailProcedurals", Detail_settingscxx . . $ Detail_settings..Procedurals_enabledcxx . . $ tDetailSettings#Procedurals_enabled.);
1166 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailObjectComp", Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity.);
1167 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("DetailPowerupHalos", Detail_settingscxx . . $ Detail_settings..Powerup_haloscxx . . $ tDetailSettings#Powerup_halos.);
1168
1169 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_resolution", Game_video_resolutioncxx . . $ Game_video_resolution.);
1170
1171 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_bitdepth", Render_preferred_bitdepthcxx . . $ Render_preferred_bitdepth.);
1172 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_bilear", Render_preferred_statecxx . . $ Render_preferred_state..filteringcxx . . $ renderer_preferred_state#filtering.);
1173 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_mipping", Render_preferred_statecxx . . $ Render_preferred_state..mippingcxx . . $ renderer_preferred_state#mipping.);
1174 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_color_model", Render_statecxx . . $ Render_state..cur_color_modelcxx . . $ rendering_state#cur_color_model.);
1175 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_light", Render_statecxx . . $ Render_state..cur_light_statecxx . . $ rendering_state#cur_light_state.);
1176 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("RS_texture_quality", Render_statecxx . . $ Render_state..cur_texture_qualitycxx . . $ rendering_state#cur_texture_quality.);
1177
1178 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("VoicePowerup", PlayPowerupVoicecxx . . $ PlayPowerupVoice.);
1179 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("VoiceAll", PlayVoicescxx . . $ PlayVoices.);
1180
1181 // Write out force feedback
1182 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("EnableJoystickFF", D3Use_force_feedbackcxx . . $ D3Use_force_feedback.);
1183 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("ForceFeedbackAutoCenter", D3Force_auto_centercxx . . $ D3Force_auto_center.);
1184 uint8_tcxx . . $ uint8_t# force_gain;
1185 if (D3Force_gaincxx . . $ D3Force_gain. < 0.0f)
1186 D3Force_gaincxx . . $ D3Force_gain. = 0.0f;
1187 if (D3Force_gaincxx . . $ D3Force_gain. > 1.0f)
1188 D3Force_gaincxx . . $ D3Force_gain. = 1.0f;
1189 force_gain = (uint8_tcxx . . $ uint8_t#)((100.0f * D3Force_gaincxx . . $ D3Force_gain.) + 0.5f);
1190 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("ForceFeedbackGain", force_gain);
1191
1192 #ifndef RELEASE // never save this value out in release.
1193 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("SoundMixer", Sound_mixercxx . . $ Sound_mixer.);
1194 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("PreferredRenderer", PreferredRenderercxx . . $ PreferredRenderer.);
1195 #endif
1196
1197 tempint = Sound_qualitycxx . . $ Sound_quality.;
1198 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("SoundQuality", tempint);
1199
1200 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).("SoundQuantity", Sound_systemcxx . . $ Sound_system..GetLLSoundQuantitycxx . . $ hlsSystem#GetLLSoundQuantity(b126dc7c1de90089).());
1201
1202 if (Default_pilotcxx . . $ Default_pilot.[0] != '\0')
1203 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("Default_pilot", Default_pilotcxx . . $ Default_pilot., strlen(Default_pilotcxx . . $ Default_pilot.) + 1);
1204 else
1205 Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).("Default_pilot", " ", 2);
1206 }
1207
1208 /*
1209 Read game variables from the registry
1210 */
1211 void LoadGameSettingscxx . . $ LoadGameSettings(49f6e7a06ebc5aa8).() {
1212 char tempbuffer[TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!], *stoptemp;
1213 int templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1214 int tempint;
1215
1216 // set defaults
1217 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1218 Outline_modecxx . . $ Outline_mode. = OM_ALLcxx . . $ `Descent3/render.h:205:9`!;
1219 Lighting_oncxx . . $ Lighting_on. = true;
1220 #endif
1221
1222 Detail_settingscxx . . $ Detail_settings..Specular_lightingcxx . . $ tDetailSettings#Specular_lighting. = false;
1223 Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting. = true;
1224 Detail_settingscxx . . $ Detail_settings..Fast_headlight_oncxx . . $ tDetailSettings#Fast_headlight_on. = true;
1225 Detail_settingscxx . . $ Detail_settings..Mirrored_surfacescxx . . $ tDetailSettings#Mirrored_surfaces. = true;
1226 Detail_settingscxx . . $ Detail_settings..Scorches_enabledcxx . . $ tDetailSettings#Scorches_enabled. = true;
1227 Detail_settingscxx . . $ Detail_settings..Weapon_coronas_enabledcxx . . $ tDetailSettings#Weapon_coronas_enabled. = true;
1228 Render_preferred_statecxx . . $ Render_preferred_state..mippingcxx . . $ renderer_preferred_state#mipping. = true;
1229 Render_preferred_statecxx . . $ Render_preferred_state..filteringcxx . . $ renderer_preferred_state#filtering. = true;
1230 Render_preferred_statecxx . . $ Render_preferred_state..bit_depthcxx . . $ renderer_preferred_state#bit_depth. = 16;
1231 Render_preferred_bitdepthcxx . . $ Render_preferred_bitdepth. = 16;
1232 Default_player_terrain_levelingcxx . . $ Default_player_terrain_leveling. = 2;
1233 Default_player_room_levelingcxx . . $ Default_player_room_leveling. = 2;
1234 Render_preferred_statecxx . . $ Render_preferred_state..gammacxx . . $ renderer_preferred_state#gamma. = 1.5;
1235 PreferredRenderercxx . . $ PreferredRenderer. = RENDERER_OPENGLcxx . . $ RENDERER_OPENGL.;
1236
1237 Sound_systemcxx . . $ Sound_system..SetLLSoundQuantitycxx . . $ hlsSystem#SetLLSoundQuantity(d4f767463ce0a6b3).(MIN_SOUNDS_MIXEDcxx . . $ `sndlib/hlsoundlib.h:216:9`! + (MAX_SOUNDS_MIXEDcxx . . $ `sndlib/hlsoundlib.h:215:9`! - MIN_SOUNDS_MIXEDcxx . . $ `sndlib/hlsoundlib.h:216:9`!) / 2);
1238 D3MusicSetVolumecxx . . $ D3MusicSetVolume(9364e6e7bff7660).(0.5f);
1239 Detail_settingscxx . . $ Detail_settings..Pixel_errorcxx . . $ tDetailSettings#Pixel_error. = 8.0;
1240 Sound_systemcxx . . $ Sound_system..SetMasterVolumecxx . . $ hlsSystem#SetMasterVolume(9364e6e7bff7660).(1.0);
1241 Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance. = 70.0 * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!;
1242 D3Use_force_feedbackcxx . . $ D3Use_force_feedback. = true;
1243 D3Force_gaincxx . . $ D3Force_gain. = 1.0f;
1244 D3Force_auto_centercxx . . $ D3Force_auto_center. = true;
1245 Game_video_resolutioncxx . . $ Game_video_resolution. = RES_640X480cxx . . $ `Descent3/config.h:137:9`!;
1246 PlayPowerupVoicecxx . . $ PlayPowerupVoice. = true;
1247 PlayVoicescxx . . $ PlayVoices. = true;
1248 Sound_mixercxx . . $ Sound_mixer. = SOUND_MIXER_SOFTWARE_16cxx . . $ `sndlib/ssl_lib.h:342:9`!;
1249 Sound_qualitycxx . . $ Sound_quality. = SQT_NORMALcxx . . $ `sndlib/ssl_lib.h:351:9`!;
1250 Missile_camera_windowcxx . . $ Missile_camera_window. = SVW_LEFTcxx . . $ `Descent3/SmallViews.h:72:9`!;
1251 Render_preferred_statecxx . . $ Render_preferred_state..vsync_oncxx . . $ renderer_preferred_state#vsync_on. = true;
1252 Detail_settingscxx . . $ Detail_settings..Fog_enabledcxx . . $ tDetailSettings#Fog_enabled. = true;
1253 Detail_settingscxx . . $ Detail_settings..Coronas_enabledcxx . . $ tDetailSettings#Coronas_enabled. = true;
1254 Detail_settingscxx . . $ Detail_settings..Procedurals_enabledcxx . . $ tDetailSettings#Procedurals_enabled. = true;
1255 Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. = 1;
1256 Detail_settingscxx . . $ Detail_settings..Powerup_haloscxx . . $ tDetailSettings#Powerup_halos. = true;
1257
1258 ddio_SetKeyboardLanguagecxx . . $ ddio_SetKeyboardLanguage(d4f767463ce0a6b3).(KBLANG_AMERICANcxx . . $ `ddio/ddio_common.h:189:9`!);
1259
1260 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("KeyboardType", tempbuffer, &templen)) {
1261 if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(tempbuffer, "French") == 0) {
1262 ddio_SetKeyboardLanguagecxx . . $ ddio_SetKeyboardLanguage(d4f767463ce0a6b3).(KBLANG_FRENCHcxx . . $ `ddio/ddio_common.h:191:9`!);
1263 } else if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(tempbuffer, "German") == 0) {
1264 ddio_SetKeyboardLanguagecxx . . $ ddio_SetKeyboardLanguage(d4f767463ce0a6b3).(KBLANG_GERMANcxx . . $ `ddio/ddio_common.h:192:9`!);
1265 }
1266 }
1267
1268 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1269 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("RS_gamma", tempbuffer, &templen)) {
1270 Render_preferred_statecxx . . $ Render_preferred_state..gammacxx . . $ renderer_preferred_state#gamma. = strtod(tempbuffer, &stoptemp);
1271 }
1272 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1273 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("SND_mastervol", tempbuffer, &templen)) {
1274 Sound_systemcxx . . $ Sound_system..SetMasterVolumecxx . . $ hlsSystem#SetMasterVolume(9364e6e7bff7660).(strtod(tempbuffer, &stoptemp));
1275 }
1276 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1277 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("MUS_mastervol", tempbuffer, &templen)) {
1278 D3MusicSetVolumecxx . . $ D3MusicSetVolume(9364e6e7bff7660).(strtod(tempbuffer, &stoptemp));
1279 }
1280 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1281 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("RS_pixelerror", tempbuffer, &templen)) {
1282 Detail_settingscxx . . $ Detail_settings..Pixel_errorcxx . . $ tDetailSettings#Pixel_error. = strtod(tempbuffer, &stoptemp);
1283 }
1284 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1285 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("RS_terraindist", tempbuffer, &templen)) {
1286 Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance. = strtod(tempbuffer, &stoptemp) * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!;
1287 }
1288 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1289 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("Dynamic_Lighting", &Detail_settings.Dynamic_lighting);
1290
1291 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
1292 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("Outline_mode", &Outline_mode);
1293 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("Lighting_on", &Lighting_oncxx . . $ Lighting_on.);
1294 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("Render_floating_triggers", &Render_floating_triggerscxx . . $ Render_floating_triggers.);
1295 #endif
1296
1297 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("TerrLeveling", &Default_player_terrain_leveling);
1298 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RoomLeveling", &Default_player_room_leveling);
1299 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("Specmapping", &Detail_settingscxx . . $ Detail_settings..Specular_lightingcxx . . $ tDetailSettings#Specular_lighting.);
1300 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(340cb0a925eda13d).("RS_bitdepth", &Render_preferred_bitdepthcxx . . $ Render_preferred_bitdepth., sizeof(Render_preferred_bitdepthcxx . . $ Render_preferred_bitdepth.));
1301 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_resolution", &Game_video_resolution);
1302 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_bilear", &Render_preferred_state.filtering);
1303 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_mipping", &Render_preferred_state.mipping);
1304 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_color_model", &Render_state.cur_color_model);
1305 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_light", &Render_state.cur_light_state);
1306 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_texture_quality", &Render_state.cur_texture_quality);
1307 // force feedback stuff
1308 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("EnableJoystickFF", &D3Use_force_feedbackcxx . . $ D3Use_force_feedback.);
1309 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("ForceFeedbackAutoCenter", &D3Force_auto_centercxx . . $ D3Force_auto_center.);
1310 uint8_tcxx . . $ uint8_t# force_gain;
1311 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(340cb0a925eda13d).("ForceFeedbackGain", &force_gain, sizeof(force_gain));
1312 if (force_gain > 100)
1313 force_gain = 100;
1314 D3Force_gaincxx . . $ D3Force_gain. = ((float)force_gain) / 100.0f;
1315 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("PreferredRenderer", &PreferredRenderer);
1316 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("MissileView", &Missile_camera_window);
1317 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("FastHeadlight", &Detail_settingscxx . . $ Detail_settings..Fast_headlight_oncxx . . $ tDetailSettings#Fast_headlight_on.);
1318 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("MirrorSurfaces", &Detail_settingscxx . . $ Detail_settings..Mirrored_surfacescxx . . $ tDetailSettings#Mirrored_surfaces.);
1319 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("RS_vsync", &Render_preferred_state.vsync_on);
1320
1321 if (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-vsync"))
1322 Render_preferred_statecxx . . $ Render_preferred_state..vsync_oncxx . . $ renderer_preferred_state#vsync_on. = true;
1323
1324 //@@ // Base missile camera if in wrong window
1325 //@@ if (Missile_camera_window==SVW_CENTER)
1326 //@@ Missile_camera_window=SVW_LEFT;
1327
1328 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("VoicePowerup", &PlayPowerupVoicecxx . . $ PlayPowerupVoice.);
1329 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("VoiceAll", &PlayVoicescxx . . $ PlayVoices.);
1330
1331 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("DetailScorchMarks", &Detail_settingscxx . . $ Detail_settings..Scorches_enabledcxx . . $ tDetailSettings#Scorches_enabled.);
1332 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("DetailWeaponCoronas", &Detail_settingscxx . . $ Detail_settings..Weapon_coronas_enabledcxx . . $ tDetailSettings#Weapon_coronas_enabled.);
1333 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("DetailFog", &Detail_settingscxx . . $ Detail_settings..Fog_enabledcxx . . $ tDetailSettings#Fog_enabled.);
1334 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("DetailCoronas", &Detail_settingscxx . . $ Detail_settings..Coronas_enabledcxx . . $ tDetailSettings#Coronas_enabled.);
1335 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("DetailProcedurals", &Detail_settingscxx . . $ Detail_settings..Procedurals_enabledcxx . . $ tDetailSettings#Procedurals_enabled.);
1336 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("DetailObjectComp", &tempint);
1337 Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. = tempint;
1338 if (Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. < 0 || Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. > 2)
1339 Detail_settingscxx . . $ Detail_settings..Object_complexitycxx . . $ tDetailSettings#Object_complexity. = 1;
1340
1341 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("DetailPowerupHalos", &Detail_settingscxx . . $ Detail_settings..Powerup_haloscxx . . $ tDetailSettings#Powerup_halos.);
1342
1343 if (Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("SoundMixer", &tempint))
1344 Sound_mixercxx . . $ Sound_mixer. = tempint;
1345
1346 if (Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("SoundQuality", &tempint))
1347 Sound_qualitycxx . . $ Sound_quality. = tempint;
1348
1349 if (Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("SoundQuantity", &tempint)) {
1350 Sound_systemcxx . . $ Sound_system..SetLLSoundQuantitycxx . . $ hlsSystem#SetLLSoundQuantity(d4f767463ce0a6b3).(tempint);
1351 }
1352
1353 Sound_card_namecxx . . $ Sound_card_name.[0] = 0;
1354 templen = TEMPBUFFERSIZEcxx . . $ `Descent3/init.cpp:1014:9`!;
1355 if (Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("SoundcardName", tempbuffer, &templen)) {
1356 strcpy(Sound_card_namecxx . . $ Sound_card_name., tempbuffer);
1357 }
1358
1359 int len = _MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!;
1360 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).("Default_pilot", Default_pilotcxx . . $ Default_pilot., &len);
1361
1362 // Now that we have read in all the data, set the detail level if it is a predef setting (custom is ignored in
1363 // function)
1364
1365 int level;
1366 level = DETAIL_LEVEL_MEDcxx . . $ `Descent3/config.h:180:9`!;
1367
1368 Databasecxx . . $ Database.->read_intcxx . . $ `lib/linux/lnxdatabase.h:71:9`!("PredefDetailSetting", &level);
1369 ConfigSetDetailLevelcxx . . $ ConfigSetDetailLevel(d4f767463ce0a6b3).(level);
1370 int widtharg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-Width");
1371 int heightarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-Height");
1372 if (widtharg) {
1373 Video_res_listcxx . . $ Video_res_list.[N_SUPPORTED_VIDREScxx . . $ `Descent3/config.h:134:9`! - 1].widthcxx . . $ tVideoResolution#width. = atoi(GameArgscxx . . $ GameArgs.[widtharg + 1]);
1374 Game_video_resolutioncxx . . $ Game_video_resolution. = N_SUPPORTED_VIDREScxx . . $ `Descent3/config.h:134:9`! - 1;
1375 }
1376 if (heightarg) {
1377 Video_res_listcxx . . $ Video_res_list.[N_SUPPORTED_VIDREScxx . . $ `Descent3/config.h:134:9`! - 1].heightcxx . . $ tVideoResolution#height. = atoi(GameArgscxx . . $ GameArgs.[heightarg + 1]);
1378 Game_video_resolutioncxx . . $ Game_video_resolution. = N_SUPPORTED_VIDREScxx . . $ `Descent3/config.h:134:9`! - 1;
1379 }
1380
1381 // Motion blur
1382 Use_motion_blurcxx . . $ Use_motion_blur. = 0;
1383 if (Katmaicxx . . $ Katmai. || FindArgcxx . . $ FindArg(5c4306d8553b3696).("-motionblur")) {
1384 if (!FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nomotionblur")) {
1385 Use_motion_blurcxx . . $ Use_motion_blur. = 1;
1386 }
1387 }
1388
1389 Render_powerup_sparklescxx . . $ Render_powerup_sparkles. = false;
1390 if (Katmaicxx . . $ Katmai. && !FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nosparkles")) {
1391 Render_powerup_sparklescxx . . $ Render_powerup_sparkles. = true;
1392 }
1393 }
1394
1395 struct tTempFileInfocxx . . $ tTempFileInfo# {
1396 const char *wildcardcxx . . $ tTempFileInfo#wildcard.;
1397 };
1398 static const tTempFileInfocxx . . $ tTempFileInfo# temp_file_wildcardscxx . . $ temp_file_wildcards.[] = {{"d3s*.tmp"}, {"d3m*.tmp"}, {"d3o*.tmp"},
1399 {"d3c*.tmp"}, {"d3t*.tmp"}, {"d3i*.tmp"}};
1400 static const int num_temp_file_wildcardscxx . . $ num_temp_file_wildcards. = sizeof(temp_file_wildcardscxx . . $ temp_file_wildcards.) / sizeof(tTempFileInfocxx . . $ tTempFileInfo#);
1401
1402 /*
1403 I/O systems initialization
1404 */
1405 void InitIOSystemscxx . . $ InitIOSystems(b45ddcbc8423892c).(bool editor) {
1406 ddio_init_infocxx . . $ ddio_init_info# io_info;
1407
1408 // Set the base directory
1409 int dirarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-setdir");
1410 int exedirarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-useexedir");
1411 if (dirarg) {
1412 strncpy(Base_directorycxx . . $ Base_directory., GameArgscxx . . $ GameArgs.[dirarg + 1], sizeof(Base_directorycxx . . $ Base_directory.) - 1);
1413 Base_directorycxx . . $ Base_directory.[sizeof(Base_directorycxx . . $ Base_directory.) - 1] = '\0';
1414 } else if (exedirarg) {
1415 char exec_path[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1416 memset(exec_path, 0, sizeof(exec_path));
1417 // Populate exec_path with the executable path
1418 if (!ddio_GetBinaryPathcxx . . $ ddio_GetBinaryPath(ccee65ad8ce1f171).(exec_path, sizeof(exec_path))) {
1419 Errorcxx . . $ Error(326aeb464d16410c).("Failed to get executable path\n");
1420 } else {
1421 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# executablePathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).(exec_path);
1422 stdcxx . . $ std/::stringcxx . . $ std/string# baseDirectoryString = executablePath.parent_pathcxx . . $ std/filesystem/__cxx11/path#parent_path(159787a050b29eb0).().stringcxx . . $ std/filesystem/__cxx11/path#string(219584694fe2b248).();
1423 strncpy(Base_directorycxx . . $ Base_directory., baseDirectoryString.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), sizeof(Base_directorycxx . . $ Base_directory.) - 1);
1424 Base_directorycxx . . $ Base_directory.[sizeof(Base_directorycxx . . $ Base_directory.) - 1] = '\0';
1425 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Using working directory of %s\n", Base_directory);
1426 }
1427 } else {
1428 ddio_GetWorkingDircxx . . $ ddio_GetWorkingDir(a07d8cccb7673f5a).(Base_directorycxx . . $ Base_directory., sizeof(Base_directorycxx . . $ Base_directory.));
1429 }
1430 char* prefPath = SDL_GetPrefPath("Outrage Entertainment", "Descent 3");
1431 strncpy(Base_directory_writecxx . . $ Base_directory_write., prefPath, sizeof(Base_directory_writecxx . . $ Base_directory_write.));
1432 SDL_free(prefPath);
1433
1434 char working_path[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1435 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(working_path, Base_directory_writecxx . . $ Base_directory_write., "demo", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1436 if (!stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::is_directorycxx . . $ std/filesystem/is_directory(c53a6ef3278968b1).(working_pathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1437 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::create_directorycxx . . $ std/filesystem/create_directory(c53a6ef3278968b1).(working_pathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1438 }
1439 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(working_path, Base_directory_writecxx . . $ Base_directory_write., "savegame", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1440 if (!stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::is_directorycxx . . $ std/filesystem/is_directory(c53a6ef3278968b1).(working_pathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1441 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::create_directorycxx . . $ std/filesystem/create_directory(c53a6ef3278968b1).(working_pathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1442 }
1443
1444 ddio_SetWorkingDircxx . . $ ddio_SetWorkingDir(c5f7da30cbc0f4e9).(Base_directorycxx . . $ Base_directory.);
1445
1446 Descentcxx . . $ Descent.->set_defer_handlercxx . . $ oeApplication#set_defer_handler(ea22beb3ee77eebe).(D3DeferHandlercxx . . $ D3DeferHandler(b45ddcbc8423892c).);
1447
1448 #ifndef RELEASE
1449 if (!editor && !FindArgcxx . . $ FindArg(5c4306d8553b3696).("-windowed")) {
1450 if (Dedicated_servercxx . . $ Dedicated_server.) {
1451 ddio_MouseModecxx . . $ ddio_MouseMode(d4f767463ce0a6b3).(MOUSE_STANDARD_MODEcxx . . $ `ddio/ddio.h:262:9`!);
1452 } else {
1453 ddio_MouseModecxx . . $ ddio_MouseMode(d4f767463ce0a6b3).(MOUSE_EXCLUSIVE_MODEcxx . . $ `ddio/ddio.h:263:9`!);
1454 }
1455 }
1456 #else
1457 ddio_MouseMode(MOUSE_EXCLUSIVE_MODE);
1458 #endif
1459
1460 // do io init stuff
1461 io_info.objcxx . . $ ddio_init_info#obj. = Descentcxx . . $ Descent.;
1462 io_info.joy_emulationcxx . . $ ddio_init_info#joy_emulation. = (bool)((FindArgcxx . . $ FindArg(5c4306d8553b3696).("-alternatejoy") == 0) && (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-directinput") == 0));
1463 io_info.key_emulationcxx . . $ ddio_init_info#key_emulation. = true; //(bool)(FindArg("-slowkey")!=0); WIN95: DirectInput is flaky for some keys.
1464 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Initializing DDIO systems."));
1465 if (!ddio_Initcxx . . $ ddio_Init(4aa02e9b14a147be).(&io_info)) {
1466 Errorcxx . . $ Error(326aeb464d16410c).("I/O initialization failed.");
1467 }
1468
1469 rtp_Initcxx . . $ rtp_Init(49f6e7a06ebc5aa8).();
1470 RTP_ENABLEFLAGScxx . . $ `rtperformance/rtperformance.h:126:9`!(RTI_FRAMETIME | RTI_RENDERFRAMETIME | RTI_MULTIFRAMETIME | RTI_MUSICFRAMETIME |
1471 RTI_AMBSOUNDFRAMETIME);
1472 RTP_ENABLEFLAGScxx . . $ `rtperformance/rtperformance.h:126:9`!(RTI_WEATHERFRAMETIME | RTI_PLAYERFRAMETIME | RTI_DOORFRAMETIME | RTI_LEVELGOALTIME |
1473 RTI_MATCENFRAMETIME);
1474 RTP_ENABLEFLAGScxx . . $ `rtperformance/rtperformance.h:126:9`!(RTI_OBJFRAMETIME | RTI_AIFRAMETIME | RTI_PROCESSKEYTIME);
1475
1476 // Read in stuff from the registry
1477 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Reading settings."));
1478 LoadGameSettingscxx . . $ LoadGameSettings(49f6e7a06ebc5aa8).();
1479
1480 // Setup temp directory
1481 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Setting up temp directory."));
1482 SetupTempDirectorycxx . . $ SetupTempDirectory(49f6e7a06ebc5aa8).();
1483 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Removing any temp files left over from last execution\n");
1484 DeleteTempFilescxx . . $ DeleteTempFiles(49f6e7a06ebc5aa8).();
1485
1486 // create directory system.
1487 if (!mng_InitTableFilescxx . . $ mng_InitTableFiles(b126dc7c1de90089).()) {
1488 #ifdef EDITOR
1489 Error("Couldn't successfully initialize the table files. I'm shutting down!");
1490 #else
1491 Errorcxx . . $ Error(326aeb464d16410c).(TXT_INITTABLEERRcxx . . $ `Descent3/stringtable.h:155:9`!);
1492 #endif
1493 }
1494
1495 // Init hogfiles
1496 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Checking for HOG files."));
1497 int d3_hid = -1, extra_hid = -1, sys_hid = -1, extra13_hid = -1;
1498 char fullname[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1499
1500 #ifdef DEMO
1501 // DAJ d3_hid = cf_OpenLibrary("d3demo.hog");
1502 ddio_MakePath(fullname, LocalD3Dir, "d3demo.hog", NULL);
1503 #else
1504 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., "d3.hog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1505 #endif
1506 d3_hid = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1507
1508 // JC: Steam release uses extra1.hog instead of extra.hog, so try loading it first
1509 // Open this file if it's present for stuff we might add later
1510 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., "extra1.hog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1511 extra_hid = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1512 if (extra_hid == 0) {
1513 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., "extra.hog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1514 extra_hid = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1515 }
1516
1517 // JC: Steam release uses extra.hog instead of merc.hog, so try loading it last (so we don't conflict with the above)
1518 // Open mercenary hog if it exists
1519 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., "merc.hog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1520 merc_hidcxx . . $ merc_hid. = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1521 if (merc_hidcxx . . $ merc_hid. == 0) {
1522 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., "extra.hog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1523 merc_hidcxx . . $ merc_hid. = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1524 }
1525
1526 // Open this for extra 1.3 code (Black Pyro, etc)
1527 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., "extra13.hog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1528 extra13_hid = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1529
1530 // last library opened is the first to be searched for dynamic libs, so put
1531 // this one at the end to find our newly build script libraries first
1532 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullname, LocalD3Dircxx . . $ LocalD3Dir., PRIMARY_HOGcxx . . $ `<built-in>:481:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1533 sys_hid = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(fullnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1534
1535 // Check to see if there is a -mission command line option
1536 // if there is, attempt to open that hog/mn3 so it can override such
1537 // things as the mainmenu movie, or loading screen
1538 int mission_arg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-mission");
1539 if (mission_arg > 0) {
1540 char path_to_mission[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
1541 char filename[256];
1542
1543 // get the true filename
1544 ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(GameArgscxx . . $ GameArgs.[mission_arg + 1], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1545 strcat(filename, ".mn3");
1546
1547 // make the full path (it is forced to be on the harddrive since it contains
1548 // textures and stuff).
1549 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(path_to_mission, LocalD3Dircxx . . $ LocalD3Dir., "missions", filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1550 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(path_to_missioncxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
1551 cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(path_to_missioncxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
1552 } else {
1553 Int3cxx . . $ `misc/pserror.h:247:9`!(); // mission not found
1554 }
1555 }
1556
1557 // Initialize debug graph early incase any system uses it in it's init
1558 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Initializing debug graph."));
1559 DebugGraph_Initializecxx . . $ DebugGraph_Initialize(49f6e7a06ebc5aa8).();
1560
1561 // initialize all the OSIRIS systems
1562 // extract from extra.hog first, so it's dll files are listed ahead of d3.hog's
1563 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Initializing OSIRIS."));
1564 Osiris_InitModuleLoadercxx . . $ Osiris_InitModuleLoader(49f6e7a06ebc5aa8).();
1565 if (extra13_hid != -1)
1566 Osiris_ExtractScriptsFromHogcxx . . $ Osiris_ExtractScriptsFromHog(d455ce14f374a3ab).(extra13_hid, false);
1567 if (extra_hid != -1)
1568 Osiris_ExtractScriptsFromHogcxx . . $ Osiris_ExtractScriptsFromHog(d455ce14f374a3ab).(extra_hid, false);
1569 if (merc_hidcxx . . $ merc_hid. != -1)
1570 Osiris_ExtractScriptsFromHogcxx . . $ Osiris_ExtractScriptsFromHog(d455ce14f374a3ab).(merc_hidcxx . . $ merc_hid., false);
1571 if (sys_hid != -1)
1572 Osiris_ExtractScriptsFromHogcxx . . $ Osiris_ExtractScriptsFromHog(d455ce14f374a3ab).(sys_hid, false);
1573 Osiris_ExtractScriptsFromHogcxx . . $ Osiris_ExtractScriptsFromHog(d455ce14f374a3ab).(d3_hid, false);
1574 }
1575
1576 // Returns true if Mercenary is installed (inits the Black Pyro and Red GB)
1577 bool MercInstalledcxx . . $ MercInstalled(c9857a73d68e59ba).() { return merc_hidcxx . . $ merc_hid. > 0; }
1578
1579 extern int Num_languagescxx . . $ Num_languages.;
1580 void InitStringTablecxx . . $ InitStringTable(49f6e7a06ebc5aa8).() {
1581
1582 int language = LANGUAGE_ENGLISHcxx . . $ `scripts/osiris_common.h:412:9`!;
1583 Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(340cb0a925eda13d).("LanguageType", &language, sizeof(language));
1584
1585 if (language < 0 || language >= Num_languagescxx . . $ Num_languages.) {
1586 Int3cxx . . $ `misc/pserror.h:247:9`!();
1587 language = LANGUAGE_ENGLISHcxx . . $ `scripts/osiris_common.h:412:9`!;
1588 }
1589 Localization_SetLanguagecxx . . $ Localization_SetLanguage(d4f767463ce0a6b3).(language);
1590
1591 int string_count = LoadStringTablescxx . . $ LoadStringTables(b126dc7c1de90089).();
1592
1593 if (string_count == 0)
1594 Errorcxx . . $ Error(326aeb464d16410c).("Couldn't find the string table.");
1595 else
1596 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "%d strings loaded from the string tables\n", string_count);
1597 }
1598
1599 void InitGraphicscxx . . $ InitGraphics(b45ddcbc8423892c).(bool editor) {
1600 // Init our bitmaps, must be called before InitTextures
1601 bm_InitBitmapscxx . . $ bm_InitBitmaps(49f6e7a06ebc5aa8).();
1602
1603 // Init our textures
1604 if (!InitTexturescxx . . $ InitTextures(b126dc7c1de90089).())
1605 Errorcxx . . $ Error(326aeb464d16410c).("Failed to initialize texture system.");
1606
1607 #ifdef EDITOR
1608 char *driver = "GDIX";
1609
1610 if (!ddgr_Init(Descent, driver, editor ? false : true))
1611 Error("DDGR graphic system init failed.");
1612
1613 // Init our renderer
1614 grSurface::init_system();
1615 rend_Init(RENDERER_OPENGL, Descent, NULL);
1616 Desktop_surf = new grSurface(0, 0, 0, SURFTYPE_VIDEOSCREEN, 0);
1617 #else
1618 strcpy(App_ddvid_subsystemcxx . . $ App_ddvid_subsystem., "GDIX");
1619
1620 if (!Dedicated_servercxx . . $ Dedicated_server.) {
1621 if (!ddvid_Initcxx . . $ ddvid_Init(2ed061567e70e37b).(Descentcxx . . $ Descent., App_ddvid_subsystemcxx . . $ App_ddvid_subsystem.))
1622 Errorcxx . . $ Error(326aeb464d16410c).("Graphics initialization failed.\n");
1623 }
1624
1625 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!("Loading fonts.");
1626 LoadAllFontscxx . . $ LoadAllFonts(49f6e7a06ebc5aa8).();
1627 #endif
1628 Graphics_initcxx . . $ Graphics_init. = true;
1629 }
1630
1631 void InitGameSystemscxx . . $ InitGameSystems(b45ddcbc8423892c).(bool editor) {
1632 // initialize possible remote controller.
1633 int adr = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-rjoy");
1634 if (adr)
1635 Controller_ipcxx . . $ Controller_ip. = &GameArgscxx . . $ GameArgs.[adr + 1][1];
1636
1637 // do other joint editor/game initialization.
1638 SetInitMessageLengthcxx . . $ SetInitMessageLength(42eacfea086a5352).(TXT_INITCOLLATINGcxx . . $ `Descent3/stringtable.h:156:9`!, 0.4f);
1639 TelComInitcxx . . $ TelComInit(49f6e7a06ebc5aa8).();
1640 InitFrameTimecxx . . $ InitFrameTime(49f6e7a06ebc5aa8).();
1641
1642 // Check for aspect ratio override
1643 int t = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-aspect");
1644 if (t) {
1645 float aspect = atof(GameArgscxx . . $ GameArgs.[t + 1]);
1646 if (aspect > 0.0)
1647 g3_SetAspectRatiocxx . . $ g3_SetAspectRatio(9364e6e7bff7660).(aspect);
1648 }
1649
1650 // Initialize force feedback effects (if we can)
1651 ForceInitcxx . . $ ForceInit(49f6e7a06ebc5aa8).();
1652
1653 if (!editor) {
1654 tUIInitInfocxx . . $ tUIInitInfo# uiinit;
1655 uiinit.window_fontcxx . . $ tUIInitInfo#window_font. = SMALL_FONTcxx . . $ `Descent3/gamefont.h:103:9`!;
1656 uiinit.wcxx . . $ tUIInitInfo#w. = 640;
1657 uiinit.hcxx . . $ tUIInitInfo#h. = 480;
1658 ui_Initcxx . . $ ui_Init(506d4ea8517b8bcc).(Descentcxx . . $ Descent., &uiinit);
1659 ui_UseCursorcxx . . $ ui_UseCursor(85c52e162fed56f9).("StdCursor.ogf");
1660
1661 NewUIInitcxx . . $ NewUIInit(49f6e7a06ebc5aa8).();
1662 InitControlscxx . . $ InitControls(49f6e7a06ebc5aa8).();
1663
1664 atexit(CloseControlscxx . . $ CloseControls(49f6e7a06ebc5aa8).);
1665 atexit(ui_Closecxx . . $ ui_Close(49f6e7a06ebc5aa8).);
1666 }
1667 }
1668
1669 //////////////////////////////////////////////////////////////////////////////
1670 static float Init_messagebar_portioncxx . . $ Init_messagebar_portion. = 0.0f, Init_messagebar_offsetcxx . . $ Init_messagebar_offset. = 0.0f;
1671 static const char *Init_messagebar_textcxx . . $ Init_messagebar_text. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1672
1673 // portion of total bar to fill (0 to 1)
1674 void SetInitMessageLengthcxx . . $ SetInitMessageLength(42eacfea086a5352).(const char *c, float amount) {
1675 Init_messagebar_textcxx . . $ Init_messagebar_text. = c;
1676 Init_messagebar_offsetcxx . . $ Init_messagebar_offset. += Init_messagebar_portioncxx . . $ Init_messagebar_portion.;
1677 Init_messagebar_portioncxx . . $ Init_messagebar_portion. = amount;
1678 }
1679
1680 // amount is 0 to 1
1681 void UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(float amount) {
1682 if (Init_in_editorcxx . . $ Init_in_editor.)
1683 return;
1684 InitMessagecxx . . $ InitMessage(42eacfea086a5352).(Init_messagebar_textcxx . . $ Init_messagebar_text., (amount * Init_messagebar_portioncxx . . $ Init_messagebar_portion.) + Init_messagebar_offsetcxx . . $ Init_messagebar_offset.);
1685 /*
1686 mprintf(0, "amt=%.2f, portion=%.2f offs=%.2f, prog=%.2f\n",
1687 amount,
1688 Init_messagebar_portion,
1689 Init_messagebar_offset,
1690 (amount*Init_messagebar_portion)+Init_messagebar_offset);
1691 */
1692 }
1693
1694 void InitMessagecxx . . $ InitMessage(42eacfea086a5352).(const char *c, float progress) {
1695 int x = Game_window_wcxx . . $ Game_window_w. / 2 - Title_bitmapcxx . . $ Title_bitmap..pwcxx . . $ chunked_bitmap#pw. / 2;
1696 int y = Game_window_hcxx . . $ Game_window_h. / 2 - Title_bitmapcxx . . $ Title_bitmap..phcxx . . $ chunked_bitmap#ph. / 2;
1697 int i, rx, ry, rw, rh;
1698
1699 if (Dedicated_servercxx . . $ Dedicated_server.) {
1700 PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("%s\n", c);
1701 return;
1702 }
1703
1704 if (!Graphics_initcxx . . $ Graphics_init.)
1705 return;
1706
1707 StartFramecxx . . $ StartFrame(b45ddcbc8423892c).();
1708
1709 if (Title_bitmap_initcxx . . $ Title_bitmap_init.) {
1710 rend_ClearScreencxx . . $ rend_ClearScreen(cb2f890c2fdad230).(GR_BLACKcxx . . $ GR_BLACK.);
1711 rend_DrawChunkedBitmapcxx . . $ rend_DrawChunkedBitmap(529c7906ea1e7bf7).(&Title_bitmapcxx . . $ Title_bitmap., x, y, 255);
1712 }
1713
1714 if (c) {
1715 g3Pointcxx . . $ g3Point# *pntlist[4], points[4];
1716 // Set our four corners to cover the screen
1717 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!);
1718 rw = Game_window_wcxx . . $ Game_window_w.;
1719 rh = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!) + 8;
1720 rx = 0;
1721 ry = Game_window_hcxx . . $ Game_window_h. - rh;
1722 points[0].p3_sxcxx . . $ g3Point#p3_sx. = rx;
1723 points[0].p3_sycxx . . $ g3Point#p3_sy. = ry;
1724 points[1].p3_sxcxx . . $ g3Point#p3_sx. = rx + rw;
1725 points[1].p3_sycxx . . $ g3Point#p3_sy. = ry;
1726 points[2].p3_sxcxx . . $ g3Point#p3_sx. = rx + rw;
1727 points[2].p3_sycxx . . $ g3Point#p3_sy. = ry + rh;
1728 points[3].p3_sxcxx . . $ g3Point#p3_sx. = rx;
1729 points[3].p3_sycxx . . $ g3Point#p3_sy. = ry + rh;
1730
1731 for (i = 0; i < 4; i++) {
1732 points[i].p3_zcxx . . $ `lib/3d.h:247:9`! = 0;
1733 points[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!;
1734 pntlist[i] = &points[i];
1735 }
1736
1737 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
1738 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
1739 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`!);
1740 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
1741 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_BLACKcxx . . $ GR_BLACK.);
1742 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(230);
1743 rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4);
1744
1745 if (progress >= 0) {
1746 points[0].p3_sxcxx . . $ g3Point#p3_sx. = rx;
1747 points[0].p3_sycxx . . $ g3Point#p3_sy. = ry + rh - (rh / 2) + 2;
1748 points[1].p3_sxcxx . . $ g3Point#p3_sx. = rx + ((float)rw * progress);
1749 points[1].p3_sycxx . . $ g3Point#p3_sy. = ry + rh - (rh / 2) + 2;
1750 points[2].p3_sxcxx . . $ g3Point#p3_sx. = rx + ((float)rw * progress);
1751 points[2].p3_sycxx . . $ g3Point#p3_sy. = ry + rh;
1752 points[3].p3_sxcxx . . $ g3Point#p3_sx. = rx;
1753 points[3].p3_sycxx . . $ g3Point#p3_sy. = ry + rh;
1754
1755 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 0, 0));
1756 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(230);
1757 rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4);
1758 }
1759
1760 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(255);
1761 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(NEWUI_MONITORFONT_COLORcxx . . $ `Descent3/newui_core.h:70:9`!);
1762 // grtext_CenteredPrintf(0, ry, c);
1763 grtext_Putscxx . . $ grtext_Puts(3139f19a0dbb8edf).(0, ry, c);
1764 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
1765 }
1766
1767 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
1768 rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).();
1769 }
1770
1771 //////////////////////////////////////////////////////////////////////////////
1772 #if (defined(OEM) || defined(DEMO) || defined(RELEASE))
1773 void ShowStaticScreen(char *bitmap_filename, bool timed = false, float delay_time = 0.0f);
1774 #endif
1775
1776 void IntroScreencxx . . $ IntroScreen(49f6e7a06ebc5aa8).() {
1777 // #if (defined(OEM) || defined(DEMO) )
1778 #ifdef DEMO
1779 ShowStaticScreen("tantrum.ogf", true, 3.0);
1780 ShowStaticScreen("outrage.ogf", true, 3.0);
1781 #else
1782 #endif
1783
1784 #ifdef DEMO
1785 int bm_handle = bm_AllocLoadFileBitmap("demomenu.ogf", 0);
1786 #else
1787 int bm_handle = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).("oemmenu.ogf", 0);
1788 #endif
1789 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Intro screen!.\n");
1790
1791 if (bm_handle > -1) {
1792 if (!bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(bm_handle, &Title_bitmapcxx . . $ Title_bitmap.))
1793 Errorcxx . . $ Error(326aeb464d16410c).("Failed to slice up d3.ogf!");
1794
1795 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(bm_handle);
1796
1797 Title_bitmap_initcxx . . $ Title_bitmap_init. = true;
1798 InitMessagecxx . . $ InitMessage(42eacfea086a5352).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1799 } else {
1800 mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "Unable to find d3.tga.\n");
1801 }
1802 }
1803
1804 void InitDedicatedServercxx . . $ InitDedicatedServer(49f6e7a06ebc5aa8).() {
1805 Game_modecxx . . $ Game_mode. |= GM_MULTIcxx . . $ `Descent3/game.h:288:9`!;
1806 Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. = LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!;
1807
1808 int ok = LoadServerConfigFilecxx . . $ LoadServerConfigFile(b126dc7c1de90089).();
1809
1810 if (!ok) {
1811 PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(TXT_SHUTTINGDOWNcxx . . $ `Descent3/stringtable.h:589:9`!);
1812 Errorcxx . . $ Error(326aeb464d16410c).("Cannot load Dedicated Server config file.");
1813 exit(0);
1814 }
1815 }
1816
1817 /*
1818 The D3 Initialization Mess
1819
1820 This initialization sequence will occur after the application and debug systems
1821 are set up.
1822
1823 From here, we initialize all systems.
1824
1825 Initializes all the subsystems that D3/Editor needs to run.
1826 Returns 1 if all is good, 0 if something is wrong
1827 */
1828 int ServerTimeoutcxx . . $ ServerTimeout. = 0;
1829 float LastPacketReceivedcxx . . $ LastPacketReceived.;
1830
1831 uint16_tcxx . . $ uint16_t# Gameportcxx . . $ Gameport. = D3_DEFAULT_PORTcxx . . $ `Descent3/descent.h:149:9`!;
1832 uint16_tcxx . . $ uint16_t# PXOPortcxx . . $ PXOPort. = 0;
1833 // Initialiaze everything before data load
1834 void InitD3Systems1cxx . . $ InitD3Systems1(b45ddcbc8423892c).(bool editor) {
1835 #if defined(RELEASE)
1836 SetDebugBreakHandlers(NULL, NULL);
1837 #else
1838 SetDebugBreakHandlerscxx . . $ SetDebugBreakHandlers(af7ac88fdfa0d6bb).(D3DebugStopHandlercxx . . $ D3DebugStopHandler(49f6e7a06ebc5aa8)., D3DebugResumeHandlercxx . . $ D3DebugResumeHandler(49f6e7a06ebc5aa8).);
1839 #endif
1840
1841 Init_in_editorcxx . . $ Init_in_editor. = editor;
1842
1843 // Gamespy command to specify the port to listen on
1844 int gameportarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("+host");
1845 if (!gameportarg) {
1846 gameportarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-useport");
1847 }
1848 if (gameportarg) {
1849 Gameportcxx . . $ Gameport. = atoi(GameArgscxx . . $ GameArgs.[gameportarg + 1]);
1850 }
1851
1852 int pxoportarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-pxoport");
1853 if (pxoportarg)
1854 PXOPortcxx . . $ PXOPort. = atoi(GameArgscxx . . $ GameArgs.[pxoportarg + 1]);
1855
1856 // perform user i/o system initialization
1857 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Initializing I/O system."));
1858 InitIOSystemscxx . . $ InitIOSystems(b45ddcbc8423892c).(editor);
1859
1860 // load the string table
1861 InitStringTablecxx . . $ InitStringTable(49f6e7a06ebc5aa8).();
1862
1863 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!(("Initializing GFX"));
1864 InitGraphicscxx . . $ InitGraphics(b45ddcbc8423892c).(editor);
1865
1866 // initialize data structures
1867 InitObjectInfocxx . . $ InitObjectInfo(49f6e7a06ebc5aa8).();
1868 InitVClipscxx . . $ InitVClips(49f6e7a06ebc5aa8).();
1869 InitRoomscxx . . $ InitRooms(49f6e7a06ebc5aa8).();
1870
1871 // initialize lighting systems
1872 InitLightmapInfocxx . . $ InitLightmapInfo(d4f767463ce0a6b3).();
1873 InitSpecialFacescxx . . $ InitSpecialFaces(49f6e7a06ebc5aa8).();
1874 InitDynamicLightingcxx . . $ InitDynamicLighting(49f6e7a06ebc5aa8).();
1875
1876 // Initialize missions
1877 InitMissioncxx . . $ InitMission(49f6e7a06ebc5aa8).();
1878
1879 // Initializes the ship structure
1880 InitShipscxx . . $ InitShips(49f6e7a06ebc5aa8).();
1881
1882 // Initializes the fvi structures for quicker operation
1883 InitFVIcxx . . $ InitFVI(49f6e7a06ebc5aa8).();
1884
1885 // Initializes the matcens
1886 InitMatcenscxx . . $ InitMatcens(49f6e7a06ebc5aa8).();
1887
1888 // This function needs be called before ANY 3d stuff can get done. I mean it.
1889 InitMathTablescxx . . $ InitMathTables(49f6e7a06ebc5aa8).();
1890
1891 // Initialize a random seed.
1892 ps_srandcxx . . $ ps_srand(cb2f890c2fdad230).(time(nullptr));
1893
1894 // This function has to be done before any sound stuff is called
1895 InitSoundscxx . . $ InitSounds(49f6e7a06ebc5aa8).();
1896
1897 // Allocate memory and stuff for our terrain engine, objects, etc.
1898 InitTerraincxx . . $ InitTerrain(49f6e7a06ebc5aa8).();
1899 InitModelscxx . . $ InitModels(b126dc7c1de90089).();
1900 InitDoorscxx . . $ InitDoors(49f6e7a06ebc5aa8).();
1901 InitGamefilescxx . . $ InitGamefiles(49f6e7a06ebc5aa8).();
1902
1903 // network initialization
1904 if (!FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nonetwork")) {
1905 nw_InitNetworkingcxx . . $ nw_InitNetworking(d4f767463ce0a6b3).();
1906 nw_InitSocketscxx . . $ nw_InitSockets(ed53e3bbd3fa2f69).(Gameportcxx . . $ Gameport.);
1907 }
1908
1909 int timeoutarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-timeout");
1910 if (timeoutarg) {
1911 ServerTimeoutcxx . . $ ServerTimeout. = atoi(GameArgscxx . . $ GameArgs.[timeoutarg + 1]);
1912 LastPacketReceivedcxx . . $ LastPacketReceived. = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1913 }
1914
1915 // Sound initialization
1916 int soundres = Sound_systemcxx . . $ Sound_system..InitSoundLibcxx . . $ hlsSystem#InitSoundLib(bc2f84f4176dee7e).(Descentcxx . . $ Descent., Sound_mixercxx . . $ Sound_mixer., Sound_qualitycxx . . $ Sound_quality., false);
1917
1918 // Initialize Cinematics system
1919 InitCinematicscxx . . $ InitCinematics(c9857a73d68e59ba).();
1920 }
1921
1922 // Initialize rest of stuff
1923 void InitD3Systems2cxx . . $ InitD3Systems2(b45ddcbc8423892c).(bool editor) {
1924 // Initialize In-Game Cinematics system
1925 Cinematic_Initcxx . . $ Cinematic_Init(49f6e7a06ebc5aa8).();
1926
1927 // initialize slewing
1928 #ifdef EDITOR
1929 SlewControlInit();
1930 #endif
1931
1932 int tables_loaded = 0;
1933
1934 // load in all data headers.
1935 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!((TXT_INITDATAcxx . . $ `Descent3/stringtable.h:154:9`!));
1936 tables_loaded = mng_LoadTableFilescxx . . $ mng_LoadTableFiles(7864480464b09eea).(!editor);
1937
1938 if (!tables_loaded)
1939 Errorcxx . . $ Error(326aeb464d16410c).("Cannot load table file.");
1940
1941 INIT_MESSAGEcxx . . $ `Descent3/init.cpp:991:9`!((TXT_INITCOLLATINGcxx . . $ `Descent3/stringtable.h:156:9`!));
1942
1943 // Initialize the pilot system
1944 PilotInitcxx . . $ PilotInit(49f6e7a06ebc5aa8).();
1945
1946 // Setup our object system. By object I mean stuff in our world, not those silly C++ things.
1947 // This call must come after InitTableFiles(), so we have a player ship for the user
1948 InitObjectscxx . . $ InitObjects(49f6e7a06ebc5aa8).();
1949
1950 // Fireball initting must come after LoadTableFiles
1951 SetInitMessageLengthcxx . . $ SetInitMessageLength(42eacfea086a5352).(TXT_INITCOLLATINGcxx . . $ `Descent3/stringtable.h:156:9`!, 0.1f);
1952 InitFireballscxx . . $ InitFireballs(49f6e7a06ebc5aa8).();
1953 UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(1.0f);
1954
1955 // initializes triggers
1956 InitTriggerscxx . . $ InitTriggers(49f6e7a06ebc5aa8).();
1957
1958 // the remaining sound system
1959 InitVoicescxx . . $ InitVoices(c9857a73d68e59ba).();
1960 InitD3Musiccxx . . $ InitD3Music(b45ddcbc8423892c).(FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nomusic") ? false : true);
1961 InitAmbientSoundSystemcxx . . $ InitAmbientSoundSystem(49f6e7a06ebc5aa8).();
1962
1963 InitGameSystemscxx . . $ InitGameSystems(b45ddcbc8423892c).(editor);
1964
1965 InitPlayerscxx . . $ InitPlayers(49f6e7a06ebc5aa8).();
1966
1967 SetInitMessageLengthcxx . . $ SetInitMessageLength(42eacfea086a5352).(TXT_INITCOLLATINGcxx . . $ `Descent3/stringtable.h:156:9`!, 0.5f);
1968 InitMarkerscxx . . $ InitMarkers(49f6e7a06ebc5aa8).();
1969 UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(1.0f);
1970
1971 PPic_InitDatabasecxx . . $ PPic_InitDatabase(c9857a73d68e59ba).();
1972
1973 // Set next logical function for game.
1974 if (editor)
1975 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(EDITOR_MODEcxx . . $ EDITOR_MODE.);
1976 else
1977 SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.);
1978
1979 if (Dedicated_servercxx . . $ Dedicated_server.)
1980 InitDedicatedServercxx . . $ InitDedicatedServer(49f6e7a06ebc5aa8).();
1981
1982 Init_systems_initcxx . . $ Init_systems_init. = true;
1983
1984 // free title screen bitmap.
1985 if (Title_bitmap_initcxx . . $ Title_bitmap_init.) {
1986 bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&Title_bitmapcxx . . $ Title_bitmap.);
1987 Title_bitmap_initcxx . . $ Title_bitmap_init. = false;
1988 }
1989
1990 // initialize localized text for controller system.
1991 extern void Localize_ctl_bindingscxx . . $ Localize_ctl_bindings(49f6e7a06ebc5aa8).();
1992 Localize_ctl_bindingscxx . . $ Localize_ctl_bindings(49f6e7a06ebc5aa8).();
1993 }
1994
1995 void SetupTempDirectorycxx . . $ SetupTempDirectory(49f6e7a06ebc5aa8).(void) {
1996 // NOTE: No string tables are available at this point
1997 //--------------------------------------------------
1998
1999 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Setting up temp directory\n");
2000
2001 int t_arg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-tempdir");
2002 if (t_arg) {
2003 strcpy(Descent3_temp_directorycxx . . $ Descent3_temp_directory., GameArgscxx . . $ GameArgs.[t_arg + 1]);
2004 } else {
•2005 char *envr = SDL_getenv("XDG_CACHE_HOME");
2006 if (envr) {
2007 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(Descent3_temp_directorycxx . . $ Descent3_temp_directory., envr, "Descent3", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2008 } else {
2009 envr = SDL_getenv("HOME");
2010 if (envr) {
2011 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(Descent3_temp_directorycxx . . $ Descent3_temp_directory., envr, ".cache", "Descent3", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2012 } else {
2013 stdcxx . . $ std/::error_codecxx . . $ std/error_code# eccxx . . $ std/error_code#error_code(ced63f7c635d850d).;
2014 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# tempPath = stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::temp_directory_pathcxx . . $ std/filesystem/temp_directory_path(75f8056d97e2cec8).(ec);
2015 if (ec) {
2016 Errorcxx . . $ Error(326aeb464d16410c).("Could not find temporary directory: \"%s\"", ec.messagecxx . . $ std/error_code#message(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).() );
2017 exit(1);
2018 }
2019 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(Descent3_temp_directorycxx . . $ Descent3_temp_directory., tempPath.u8stringcxx . . $ std/filesystem/__cxx11/path#u8string(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "Descent3",
2020 "cache", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2021 }
2022 }
2023 }
2024
2025 stdcxx . . $ std/::error_codecxx . . $ std/error_code# eccxx . . $ std/error_code#error_code(ced63f7c635d850d).;
2026 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::create_directoriescxx . . $ std/filesystem/create_directories(d743b8a22d0b5f99).(Descent3_temp_directorycxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., ec);
2027 if (ec) {
2028 Errorcxx . . $ Error(326aeb464d16410c).("Could not create temporary directory: \"%s\"", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2029 exit(1);
2030 }
2031
2032 // verify that temp directory exists
2033 if (!ddio_SetWorkingDircxx . . $ ddio_SetWorkingDir(c5f7da30cbc0f4e9).(Descent3_temp_directorycxx . . $ Descent3_temp_directory.)) {
2034 Errorcxx . . $ Error(326aeb464d16410c).("Unable to set temporary directory to: \"%s\"", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2035 exit(1);
2036 }
2037
2038 char tempfilename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
2039
2040 // verify that we can write to the temp directory
2041 if (!ddio_GetTempFileNamecxx . . $ ddio_GetTempFileName(dfb34736e99ce5d).(Descent3_temp_directorycxx . . $ Descent3_temp_directory., "d3t", tempfilename)) {
2042 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to get temp file name\n");
2043 Errorcxx . . $ Error(326aeb464d16410c).("Unable to set temporary directory to: \"%s\"", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2044 exit(1);
2045 }
2046
2047 // try to create a file in temp directory
2048 CFILEcxx . . $ CFILE# *file = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(tempfilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wb");
2049 if (!file) {
2050 // unable to open file for writing
2051 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to open temp file name for writing\n");
2052 Errorcxx . . $ Error(326aeb464d16410c).("Unable to set temporary directory to: \"%s\"", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2053 exit(1);
2054 }
2055
2056 cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, 0x56);
2057 cfclosecxx . . $ cfclose(3639e799710acb68).(file);
2058
2059 // now open up the file and make sure it is correct
2060 file = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(tempfilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
2061 if (!file) {
2062 // unable to open file for reading
2063 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to open temp file name for reading\n");
2064 ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(tempfilename);
2065 Errorcxx . . $ Error(326aeb464d16410c).("Unable to set temporary directory to: \"%s\"", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2066 exit(1);
2067 }
2068
2069 if (cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file) != 0x56) {
2070 // verify failed
2071 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Temp file verify failed\n");
2072 cfclosecxx . . $ cfclose(3639e799710acb68).(file);
2073 ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(tempfilename);
2074 Errorcxx . . $ Error(326aeb464d16410c).("Unable to set temporary directory to: \"%s\"", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2075 exit(1);
2076 }
2077
2078 cfclosecxx . . $ cfclose(3639e799710acb68).(file);
2079
2080 // temp directory is valid!
2081 ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(tempfilename);
2082
2083 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Temp Directory Set To: \"%s\"\n", Descent3_temp_directory);
2084
2085 // Lock the directory
2086 if (!ddio_CreateLockFilecxx . . $ ddio_CreateLockFile(c53a6ef3278968b1).(stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path#(Descent3_temp_directorycxx . . $ Descent3_temp_directory.))) {
2087 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Lock file NOT created in temp dir %s!\n", Descent3_temp_directory);
2088 Errorcxx . . $ Error(326aeb464d16410c).("Unable to set temporary directory to: \"%s\"\nUnable to create lock file", Descent3_temp_directorycxx . . $ Descent3_temp_directory.);
2089 exit(1);
2090 }
2091 // restore working dir
2092 ddio_SetWorkingDircxx . . $ ddio_SetWorkingDir(c5f7da30cbc0f4e9).(Base_directorycxx . . $ Base_directory.);
2093 }
2094
2095 void DeleteTempFilescxx . . $ DeleteTempFiles(49f6e7a06ebc5aa8).(void) {
2096 char filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
2097
2098 // delete the d3 temp files in the temp directory
2099 if (ddio_SetWorkingDircxx . . $ ddio_SetWorkingDir(c5f7da30cbc0f4e9).(Descent3_temp_directorycxx . . $ Descent3_temp_directory.)) {
2100 int i;
2101 for (i = 0; i < num_temp_file_wildcardscxx . . $ num_temp_file_wildcards.; i++) {
2102 if (ddio_FindFileStartcxx . . $ ddio_FindFileStart(84e74a5521f49206).(temp_file_wildcardscxx . . $ temp_file_wildcards.[i].wildcardcxx . . $ tTempFileInfo#wildcard., filename)) {
2103 do {
2104 ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(filename);
2105 } while (ddio_FindNextFilecxx . . $ ddio_FindNextFile(c6b7e35ff6de5671).(filename));
2106 }
2107 ddio_FindFileClosecxx . . $ ddio_FindFileClose(49f6e7a06ebc5aa8).();
2108 }
2109 }
2110
2111 // restore directory
2112 ddio_SetWorkingDircxx . . $ ddio_SetWorkingDir(c5f7da30cbc0f4e9).(Base_directorycxx . . $ Base_directory.);
2113 }
2114
2115 /*
2116 *
2117 * These functions handle shutting down and restarting all systems in D3
2118 *
2119 */
2120
2121 static int Init_old_screen_modecxx . . $ Init_old_screen_mode.;
2122 static void (*Init_old_ui_callbackcxx . . $ Init_old_ui_callback.)() = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2123 static bool Init_old_control_modecxx . . $ Init_old_control_mode.;
2124 static bool Init_ui_cursor_visiblecxx . . $ Init_ui_cursor_visible.;
2125 static bool Init_was_game_pausedcxx . . $ Init_was_game_paused. = false;
2126 static pilotcxx . . $ pilot# Init_old_pilotcxx . . $ Init_old_pilot.;
2127
2128 // TODO: MTS: Unused in project
2129 void ShutdownD3cxx . . $ ShutdownD3(49f6e7a06ebc5aa8).() {
2130 if (!Init_systems_initcxx . . $ Init_systems_init.)
2131 return;
2132
2133 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Shutting down D3...\n");
2134
2135 // Close forcefeedback effects
2136 ForceShutdowncxx . . $ ForceShutdown(49f6e7a06ebc5aa8).();
2137
2138 // shutdown game systems
2139 Init_old_control_modecxx . . $ Init_old_control_mode. = Control_poll_flagcxx . . $ Control_poll_flag.;
2140
2141 // JEFF: only pause game if not in multi, so we can background process
2142 if (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == GAME_MODEcxx . . $ GAME_MODE.) {
2143 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2144 Init_was_game_pausedcxx . . $ Init_was_game_paused. = Game_pausedcxx . . $ Game_paused.;
2145 if (!Init_was_game_pausedcxx . . $ Init_was_game_paused.) {
2146 PauseGamecxx . . $ PauseGame(49f6e7a06ebc5aa8).();
2147 } else {
2148 D3MusicPausecxx . . $ D3MusicPause(49f6e7a06ebc5aa8).();
2149 }
2150 }
2151 } else {
2152 D3MusicPausecxx . . $ D3MusicPause(49f6e7a06ebc5aa8).();
2153 Sound_systemcxx . . $ Sound_system..PauseSoundscxx . . $ hlsSystem#PauseSounds(b45ddcbc8423892c).();
2154 }
2155
2156 SaveControlConfigcxx . . $ SaveControlConfig(1794bc617d3f3266).(&Init_old_pilotcxx . . $ Init_old_pilot.);
2157 CloseControlscxx . . $ CloseControls(49f6e7a06ebc5aa8).();
2158
2159 // shutdown cinematics.
2160
2161 // shutdown screen.
2162 Init_ui_cursor_visiblecxx . . $ Init_ui_cursor_visible. = ui_IsCursorVisiblecxx . . $ ui_IsCursorVisible(c9857a73d68e59ba).();
2163 Init_old_screen_modecxx . . $ Init_old_screen_mode. = GetScreenModecxx . . $ GetScreenMode(b126dc7c1de90089).();
2164 Init_old_ui_callbackcxx . . $ Init_old_ui_callback. = GetUICallbackcxx . . $ GetUICallback(9f019fced98557ce).();
2165 SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(SM_NULLcxx . . $ SM_NULL.);
2166 ddvid_Closecxx . . $ ddvid_Close(49f6e7a06ebc5aa8).();
2167
2168 // shutdown IO
2169 ddio_Closecxx . . $ ddio_Close(49f6e7a06ebc5aa8).();
2170 }
2171
2172 // TODO: MTS: unused in project
2173 // This function restarts all game systems
2174 void RestartD3cxx . . $ RestartD3(49f6e7a06ebc5aa8).() {
2175 ddio_init_infocxx . . $ ddio_init_info# io_info;
2176
2177 if (!Init_systems_initcxx . . $ Init_systems_init.)
2178 return;
2179
2180 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Restarting D3...\n");
2181
2182 if (!FindArgcxx . . $ FindArg(5c4306d8553b3696).("-windowed")) {
2183 if (Dedicated_servercxx . . $ Dedicated_server.) {
2184 ddio_MouseModecxx . . $ ddio_MouseMode(d4f767463ce0a6b3).(MOUSE_STANDARD_MODEcxx . . $ `ddio/ddio.h:262:9`!);
2185 } else {
2186 ddio_MouseModecxx . . $ ddio_MouseMode(d4f767463ce0a6b3).(MOUSE_EXCLUSIVE_MODEcxx . . $ `ddio/ddio.h:263:9`!);
2187 }
2188 }
2189
2190 // startup io
2191 io_info.objcxx . . $ ddio_init_info#obj. = Descentcxx . . $ Descent.;
2192 io_info.key_emulationcxx . . $ ddio_init_info#key_emulation. = true; //(bool)(FindArg("-slowkey")!=0);
2193 io_info.joy_emulationcxx . . $ ddio_init_info#joy_emulation. = (bool)((FindArgcxx . . $ FindArg(5c4306d8553b3696).("-alternatejoy") == 0) && (FindArgcxx . . $ FindArg(5c4306d8553b3696).("-directinput") == 0));
2194 if (!ddio_Initcxx . . $ ddio_Init(4aa02e9b14a147be).(&io_info)) {
2195 Errorcxx . . $ Error(326aeb464d16410c).("I/O initialization failed.");
2196 }
2197
2198 // startup screen.
2199 ddvid_Initcxx . . $ ddvid_Init(2ed061567e70e37b).(Descentcxx . . $ Descent., App_ddvid_subsystemcxx . . $ App_ddvid_subsystem.);
2200 ddio_KeyFlushcxx . . $ ddio_KeyFlush(49f6e7a06ebc5aa8).();
2201 SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(Init_old_screen_modecxx . . $ Init_old_screen_mode.);
2202 SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(Init_old_ui_callbackcxx . . $ Init_old_ui_callback.);
2203 if (Init_ui_cursor_visiblecxx . . $ Init_ui_cursor_visible.)
2204 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
2205
2206 // startup game systems
2207 InitControlscxx . . $ InitControls(49f6e7a06ebc5aa8).();
2208 LoadControlConfigcxx . . $ LoadControlConfig(1794bc617d3f3266).(&Init_old_pilotcxx . . $ Init_old_pilot.);
2209
2210 // resume game sounds and time as needed
2211 if (GetFunctionModecxx . . $ GetFunctionMode(4270339a2fa9f0f5).() == GAME_MODEcxx . . $ GAME_MODE.) {
2212 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2213 if (!Init_was_game_pausedcxx . . $ Init_was_game_paused.) {
2214 ResumeGamecxx . . $ ResumeGame(49f6e7a06ebc5aa8).();
2215 } else {
2216 D3MusicResumecxx . . $ D3MusicResume(49f6e7a06ebc5aa8).();
2217 }
2218 }
2219 } else {
2220 Sound_systemcxx . . $ Sound_system..ResumeSoundscxx . . $ hlsSystem#ResumeSounds(49f6e7a06ebc5aa8).();
2221 D3MusicResumecxx . . $ D3MusicResume(49f6e7a06ebc5aa8).();
2222 }
2223
2224 // resume controller if it was active before alt-tabbing out.
2225 if (Init_old_control_modecxx . . $ Init_old_control_mode.) {
2226 ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).();
2227 }
2228
2229 // Restart Force Feedback
2230 ForceRestartcxx . . $ ForceRestart(49f6e7a06ebc5aa8).();
2231
2232 // startup cinematics.
2233
2234 // startup sound.
2235 // Sound_system.ResumeSounds();
2236 // Sound_system.InitSoundLib(Descent, Sound_mixer, Sound_quality, false);
2237 }