Debian Codegraph @

Descent3/TelCom.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/TelCom.cpp $
21 * $Revision: 152 $
22 * $Date: 4/19/00 5:13p $
23 * $Author: Matt $
24 *
25 * Contains the code to initialize, use and control TelCom system
26 *
27 * $Log: /DescentIII/main/TelCom.cpp $
28 *
29 * 152 4/19/00 5:13p Matt
30 * From Duane for 1.4
31 * Added checks, asserts, and fixes for bad return values
32 * Removed Mac OpenGL hack
33 *
34 * 151 3/20/00 12:21p Matt
35 * Merge of Duane's post-1.3 changes.
36 * Minor optimization.
37 *
38 * 150 10/21/99 9:29p Jeff
39 * B.A. Macintosh code merge
40 *
41 * 149 10/12/99 11:08a Jeff
42 * fixed bug regarding ship permissions to start (for level 1) if the ship
43 * is non-code default
44 *
45 * 148 7/13/99 3:33p Samir
46 * music plays in automap and all telcom screens from within game.
47 *
48 * 147 5/23/99 7:43p Jason
49 * fixed briefing problem with lowmem textures
50 *
51 * 146 5/13/99 3:42p Ardussi
52 * changes for compiling on the Mac
53 *
54 * 145 5/12/99 1:58p Jason
55 * made telcom use the global AllowedShips array instead of its own local
56 * array
57 *
58 * 144 5/05/99 3:02a Jeff
59 * added single player ship selection text
60 *
61 * 143 5/03/99 1:16p Jeff
62 * play sounds at full volume
63 *
64 * 142 4/26/99 4:33p Samir
65 * mouse input changed a little so that ddio_MouseGetState is called once
66 * per frame.
67 *
68 * 141 4/21/99 11:05a Kevin
69 * new ps_rand and ps_srand to replace rand & srand
70 *
71 * 140 4/20/99 12:46p Jeff
72 * telcom main menu, mouse over button sets focus. if you go into telcom
73 * main menu, when you leave a system it will return you to main menu.
74 *
75 * 139 4/17/99 3:44p Kevin
76 * Demo2 changes & fixes
77 *
78 * 138 4/15/99 10:06p Matt
79 * Changed briefing file foreign-language filenames to be in the form
80 * "level1_frn.brf".
81 *
82 * 137 4/14/99 3:57a Jeff
83 * fixed case mismatch in #includes
84 *
85 * 136 4/06/99 1:53p Samir
86 * added improved progress bar.
87 *
88 * 135 4/02/99 8:32p Jeff
89 * added system event queue. Arrow keys work in main menu and ship
90 * selection
91 *
92 * 134 3/31/99 5:36p Jeff
93 * cargo shouldn't display in main menu (not done...if it will be done)
94 *
95 * 133 3/31/99 5:28p Jeff
96 * new way of key processesing...can capture printscreen now
97 *
98 * 132 3/28/99 12:44p Jeff
99 * fixed table file parsing to add back in the ships
100 *
101 * 131 3/24/99 2:22p Jeff
102 * fixed power button bug
103 *
104 * 130 3/02/99 6:59p Jeff
105 * no cargo in oem
106 *
107 * 129 2/28/99 3:17p Jeff
108 * single player ship selection not called in OEM
109 *
110 * 128 2/25/99 4:14a Jeff
111 * shift-esc always exits to Main Menu, skips past ship selection
112 *
113 * 127 2/22/99 3:37p Jason
114 * fixed markers in telcom
115 *
116 * 126 2/22/99 3:19p Jeff
117 * random bug fixes
118 *
119 * 125 2/20/99 9:22p Jeff
120 * finished telcom level goals screen. Made it so if you go into the
121 * telcom from the game it goes to main menu instead of briefings.
122 *
123 * 124 2/17/99 6:55p Jeff
124 * added jump button type. Added no early render flag for bitmaps. Fixed
125 * color bug for type text
126 *
127 * 123 2/10/99 4:45p Jeff
128 * table file parser stuff
129 *
130 * 122 2/09/99 6:49p Jeff
131 * removed extra call to startframe...no longer needed with stack based
132 *
133 * 121 2/09/99 3:32p Jeff
134 * table file parser takes quotes strings for force keywords
135 *
136 * 120 2/08/99 1:03a Jeff
137 * click made when changing ships in single player ship selection
138 *
139 * 119 2/05/99 7:04p Jeff
140 * table file parsing macros put in
141 *
142 * 118 2/04/99 7:19p Jeff
143 * added sound id for button click. main menu handling., briefing missing
144 * fix
145 *
146 * 117 2/03/99 1:23p Jeff
147 * more updates to single player ship selection...all thats left is stats
148 *
149 * 116 2/03/99 11:44a Jeff
150 * selected ship hooked into the game
151 *
152 * 115 2/03/99 1:03a Jeff
153 * almost done with single player ship selection...added rotating model
154 *
155 * 113 2/02/99 7:32p Jeff
156 * begining of single player ship selection
157 *
158 * 112 2/01/99 4:52p Jeff
159 * screenshots work in telcom
160 *
161 * 111 1/30/99 2:43p Jeff
162 * fixed infinite loop bug
163 *
164 * 110 1/29/99 7:13p Jeff
165 * localization
166 *
167 * 109 1/25/99 11:02a Samir
168 * revamped mouse and key controls.
169 *
170 * 108 12/15/98 4:39p Jason
171 * added some more telcom functions
172 *
173 * 107 12/15/98 10:53a Jason
174 * yet more changes for 1.1
175 *
176 * 106 12/11/98 11:30p Jeff
177 * oops forgot to remove test #define DEMO
178 *
179 * 105 12/11/98 11:22p Jeff
180 * fixed telcom briefings so they can be called within game in the
181 * demo...fixed some minor bugs that needed to be rounded up (typing sound
182 * and initialization screen text)
183 *
184 * 104 12/11/98 1:48p Kevin
185 * Took out automap ifdefs for demo
186 *
187 * 103 12/11/98 11:37a Jason
188 *
189 * 102 12/09/98 2:36p Jeff
190 * added function to enable/disable telcom system keys and disabled most
191 * system keys while in Automap
192 *
193 * 101 12/09/98 1:09p Jason
194 * second draft of automap
195 *
196 * 100 11/02/98 6:00p Jeff
197 * began adding single player ship selection
198 *
199 * 99 10/27/98 4:22p Jeff
200 * changed the framerate cap to use Sleep(), to possibly help sound
201 * performance
202 *
203 * 98 10/22/98 1:31a Jeff
204 * optimized creating the static bitmaps
205 *
206 * 97 10/22/98 12:03a Matt
207 * Disable creation of static bitmaps to speed the briefing startup.
208 *
209 * 96 10/21/98 11:12p Jeff
210 * page in all data on Telcom init
211 *
212 * 95 10/21/98 4:51p Jeff
213 * removed automap
214 *
215 * 94 10/21/98 11:14a Samir
216 * added generic code to skip rendering while in game controller config or
217 * telcom.
218 *
219 * 93 10/16/98 2:43p Jeff
220 * only call Gameframe if not multi_ui_bail_menu
221 *
222 * 92 10/14/98 11:24p Jeff
223 * turn off bilinear filtering in TC now
224 *
225 * 91 10/12/98 11:39p Jeff
226 * finished up new focus system of telcom
227 *
228 * 90 10/12/98 8:32p Jeff
229 * changed the way focus is handled
230 *
231 * 89 10/12/98 3:03p Jeff
232 * fixed Shift-esc, and right arrow doesn't exit out of telcom if on the
233 * last page
234 *
235 * 88 10/11/98 2:59a Jeff
236 * TelCom is completly multiplayer friendly. Removed cheat codes to
237 * GameCheat.cpp. Fixed up TelCom Mainmenu to handle certain systems not
238 * available
239 *
240 * 87 10/09/98 7:47p Jeff
241 * Fixed killrobot cheat
242 *
243 * 86 10/09/98 6:20p Jeff
244 * fixed weapon cheat
245 *
246 * 85 10/09/98 6:18p Jeff
247 * added camera cheat
248 *
249 * 84 10/09/98 3:05p Jeff
250 * commented out slew cheat...
251 *
252 * 83 10/09/98 1:10p Jeff
253 * removed call to SlewStop in cheat code section (not defined in release)
254 *
255 * 82 10/09/98 12:22p Jeff
256 * cheat code system put in here (temporary?)
257 *
258 * 81 10/08/98 4:23p Kevin
259 * Changed code to comply with memory library usage. Always use mem_malloc
260 * , mem_free and mem_strdup
261 *
262 * 80 9/29/98 2:51p Jeff
263 * put internal serial number check function in here to keep it from the
264 * rest of the serialization stuff
265 *
266 * 79 8/28/98 12:57p Jeff
267 * added sounds and some key functionality
268 *
269 * 78 8/27/98 2:51p Jeff
270 * New TelCom finally checked in
271 *
272 * 77 8/19/98 2:29p Jeff
273 * if not a release build then you can escape to main menu
274 *
275 * 76 8/19/98 1:38p Jeff
276 * removed update2dsound
277 *
278 * 75 8/18/98 11:57a Jeff
279 * fixed sound problem
280 *
281 * 74 8/15/98 2:46p Matt
282 * Took out unneeded include
283 *
284 * 73 7/13/98 4:11p Jeff
285 * sped up entering telcom by about 3-4 times
286 *
287 * 72 7/11/98 9:16p Jeff
288 * moved automatically drawing monitor overlay graphics from update() to a
289 * function of it's own, that way the TelCom API can be avoided if needed
290 *
291 * 71 7/08/98 8:06p Jeff
292 * Initial creation of TelComCargo
293 *
294 * 70 6/16/98 10:54a Jeff
295 *
296 * 69 5/24/98 2:56a Jeff
297 * Adjust x offset for main menu buttons
298 *
299 * 68 5/19/98 10:48a Jeff
300 * if D3_FAST is set, TelCom doesn't run
301 *
302 * 67 5/18/98 4:21p Jeff
303 * setup TelCom so D3_FAST zips it through
304 *
305 * 66 5/18/98 2:23p Jeff
306 * Hooked up Automap
307 *
308 * 65 5/15/98 5:16p Jeff
309 * Added Main Menu
310 *
311 * 64 5/11/98 6:22p Jeff
312 * adjusted sound stopping position and removed calls to show/hide mouse
313 *
314 * 63 5/05/98 6:50p Jeff
315 * Telcom doesn't use rend_DrawLFBitmap anymore...more speed!
316 *
317 * 62 5/04/98 6:22p Jeff
318 * fixed possible sound bugs
319 *
320 * 61 5/04/98 5:29p Jeff
321 * Added sounds to TelCom events
322 *
323 * 60 5/04/98 1:35p Jeff
324 * Changes made for mouse handling
325 *
326 * 59 5/03/98 7:58p Jeff
327 * changes made to handle mouse and input from within TelCom instead of UI
328 *
329 * 58 5/01/98 2:16p Jeff
330 * changed default background colors for monitors
331 *
332 * 57 4/30/98 7:17p Jeff
333 * added a main menu and going back and forth between it and systems.
334 * Added a poweron initializing screen
335 *
336 * 56 4/26/98 7:19p Jeff
337 * Power down effect done only when in hardware (some weird bug puts it in
338 * an infinite loop in software
339 *
340 * 55 4/24/98 6:35p Jeff
341 * Move prototypes to telcom.h
342 *
343 * 54 4/24/98 3:28p Jeff
344 * fixed power down effect
345 *
346 * 53 4/23/98 7:09p Jeff
347 * added power up/down support
348 *
349 * 52 4/23/98 6:38p Jason
350 * made bitmaps use 1555 format
351 *
352 * 51 4/22/98 7:43p Jeff
353 * Added support for monitor hilites
354 *
355 * 50 4/21/98 4:22p Jeff
356 * Added functions for drawing hotspot in on/off positions
357 *
358 * 49 4/20/98 6:44p Jeff
359 * removed extra code after briefings, so when you exit briefings you
360 * don't hang around in limbo
361 *
362 * 48 4/17/98 6:54p Jeff
363 * added scanline and changed order or drawing screen and zbuffer state
364 * set on exit
365 *
366 * 47 4/15/98 6:28p Jeff
367 * removed some built in code for the briefings parser
368 *
369 * 46 4/02/98 12:07p Jeff
370 * Added framework for desktop effects, fixed corner bug
371 *
372 * 45 4/01/98 5:10p Jeff
373 * Added speed for Flash text
374 *
375 * 44 3/30/98 10:50a Jeff
376 * Initial Flash text put in
377 *
378 * 43 3/23/98 2:18p Jeff
379 * Moved structures to hotspotmap.h
380 *
381 * 42 3/23/98 11:08a Jeff
382 * Moved monitor and input stuff to seperate file
383 *
384 * 41 3/23/98 9:55a Jeff
385 * Made changes to remove old telcom
386 *
387 * 40 3/18/98 8:00p Jeff
388 * Added some functionality for text and using the monitor borders
389 * correctly in the new Telcom
390 *
391 * 39 3/12/98 3:32p Jeff
392 * Initial changes started for New TelCom
393 *
394 * 38 2/06/98 2:03p Jeff
395 * added start/stop time calls
396 *
397 * 37 2/04/98 5:26p Jeff
398 * Added movie support back into Telcom, and inventory stuff
399 *
400 * 36 1/31/98 8:50p Jeff
401 * Added a very very crude inventory screen to telcom
402 *
403 * 35 1/26/98 6:35p Jeff
404 * added a 'quick fast forward' key (spacebar)
405 *
406 * 34 1/21/98 1:09p Jeff
407 * Prettied up the code, comments
408 *
409 * 33 1/20/98 9:16p Jeff
410 * Added back in fading bitmaps
411 *
412 * 32 1/20/98 6:12p Jeff
413 *
414 * 31 1/20/98 12:08p Jeff
415 *
416 * 30 1/19/98 5:37p Jeff
417 * Got briefing up to par, and even better than before, added timer so
418 * scroll and type fonts are time based.
419 *
420 * 29 1/16/98 2:40p Jeff
421 * Adjusted so everything is displayed in correct spots, took out
422 * DefaultControl timer, added support for non fading bitmaps
423 *
424 * 28 1/15/98 11:11a Jeff
425 * Got TelCom in a working state again, switch from 2d to 3d
426 *
427 * 27 12/19/97 2:26p Jason
428 * more fixes for 2d/3d intergration
429 *
430 * 26 11/10/97 12:36p Samir
431 * Telcom sets screen mode itself, and use menu font, not d2menu.
432 *
433 * 25 10/15/97 5:20p Jason
434 * did a HUGE overhaul of the bitmap system
435 *
436 * 24 9/15/97 4:21p Samir
437 * Added ddio_KeyFlush when quitting telecom to prevent untreated
438 * keystrokes.
439 *
440 * 23 8/19/97 2:11p Matt
441 * Closed files after they've been opened
442 *
443 * 22 8/15/97 3:17p Jeff
444 * Fixed some functions affected by last change
445 *
446 * 21 8/15/97 12:24p Jeff
447 * Changed things around a bit, added code to handle the round corners
448 *
449 * 20 8/13/97 3:13p Jeff
450 * optimized for memory usage (removed the second background from being
451 * stored in memory)
452 *
453 * 19 8/12/97 6:10p Jeff
454 *
455 * 18 8/12/97 5:34p Jeff
456 * Added some comments, made the code a bit spiffier
457 *
458 * 17 8/12/97 12:35p Jeff
459 * added scroll speed, fixed some more bugs and tweaks
460 *
461 * 16 8/11/97 6:43p Jeff
462 * Added user defined function hook for subwindows, fixed some bugs
463 *
464 * 15 8/08/97 6:36p Jeff
465 * fixed various bugs, did some tweaking
466 *
467 * 14 8/07/97 6:18p Jeff
468 *
469 * 13 8/07/97 12:03p Jeff
470 *
471 * 12 8/06/97 6:35p Jeff
472 * added rough multitasking to subwindows
473 *
474 * 11 8/06/97 3:51p Jeff
475 * fixed some bugs with the new subwindowing
476 *
477 * 10 8/06/97 11:57a Jeff
478 *
479 * 9 8/04/97 7:23p Jeff
480 *
481 * 8 8/04/97 6:23p Jeff
482 *
483 * 7 8/01/97 6:57p Jeff
484 * Added enable/disable for vcr and system buttons. Added screensaver
485 *
486 * 6 8/01/97 2:35p Jeff
487 * Added windows to the hotspotmap
488 *
489 * 5 7/30/97 3:59p Jeff
490 * Fixed VCR controls, updated for new artwork
491 *
492 * $NoKeywords: $
493 */
494
495 #include <stdlib.h>
496 #include <string.h>
497 #include <stdarg.h>
498 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
499 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
500 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
501 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
502 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
503 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
504 #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/
505 #include "application.h"cxx . . $ `<file>/lib/application.h`/
506 #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/
507 #include "TelComEffects.h"cxx . . $ `<file>/Descent3/TelComEffects.h`/
508 #include "Briefing.h"cxx . . $ `<file>/Descent3/Briefing.h`/
509 #include "TelComAutoMap.h"cxx . . $ `<file>/Descent3/TelComAutoMap.h`/
510 #include "TelComCargo.h"cxx . . $ `<file>/Descent3/TelComCargo.h`/
511 #include "TelComGoals.h"cxx . . $ `<file>/Descent3/TelComGoals.h`/
512 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
513 #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/
514 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
515 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
516 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
517 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
518 #include "localization.h"cxx . . $ `<file>/Descent3/localization.h`/
519 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
520 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
521 #include "textaux.h"cxx . . $ `<file>/lib/textaux.h`/
522 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
523 #include "controls.h"cxx . . $ `<file>/Descent3/controls.h`/
524 #include "d3music.h"cxx . . $ `<file>/Descent3/d3music.h`/
525
526 #define FRAME_RATEcxx . . $ `Descent3/TelCom.cpp:526:9`! 30.0f
527 #define TCPE_TIMEcxx . . $ `Descent3/TelCom.cpp:527:9`! 0.5f
528
529 //------------------------------New TelCom Stuff---------------------------------------
530
531 static void TelCom_BltToMemcxx . . $ TelCom_BltToMem(87c0d4c54aba6eb).(int dest_bmp, int dx, int dy, int src_bmp, int sx, int sy, int sw, int sh,
532 bool trans = true);
533 static void TelCom_BltToScreencxx . . $ TelCom_BltToScreen(df47d900db23a9c5).(int dx, int dy, chunked_bitmapcxx . . $ chunked_bitmap# *src_bmp);
534 static void TelCom_BltToScreencxx . . $ TelCom_BltToScreen(19947dc49169eac1).(int dx, int dy, chunked_bitmapcxx . . $ chunked_bitmap# *src_bmp, int sx, int sy, int sw, int sh);
535 static void DrawHotSpotOncxx . . $ DrawHotSpotOn(d4f767463ce0a6b3).(int hotspot);
536
537 //*************************************************************************************
538
539 // Globals---------------------------------------------------------------------------
540
541 static bool TelCom_initcxx . . $ TelCom_init. = false; // Whether the TelComInit() function was called
542 static bool Telcom_first_rendercxx . . $ Telcom_first_render. = true;
543 static bool Telcom_exit_to_mainmenucxx . . $ Telcom_exit_to_mainmenu. = false;
544 bool Telcom_called_from_gamecxx . . $ Telcom_called_from_game. = false;
545 static int Telcom_mouse_last_effectcxx . . $ Telcom_mouse_last_effect. = -1; // the last efxnum the mouse was over
546
547 hotspotmap_tcxx . . $ hotspotmap_t# hotspotmapcxx . . $ hotspotmap.; // Holds hotspot data (position)
548 windowmap_tcxx . . $ windowmap_t# windowmapcxx . . $ windowmap.; // Holds window data (position)
549 tTelComInfocxx . . $ tTelComInfo# Telcom_systemcxx . . $ Telcom_system.;
550
551 chunked_bitmapcxx . . $ chunked_bitmap# Telcom_bitmapcxx . . $ Telcom_bitmap.; // background bitmap for telcom system
552 static chunked_bitmapcxx . . $ chunked_bitmap# *hotspot_bitmapscxx . . $ hotspot_bitmaps.;
553 static int LoadTelcomBitmapcxx . . $ LoadTelcomBitmap(93bf5714f227be9c).(const char *filename, chunked_bitmapcxx . . $ chunked_bitmap# *bmp);
554 static bool TelComMainMenucxx . . $ TelComMainMenu(4a6cbf79c6ed567c).(tTelComInfocxx . . $ tTelComInfo# *tcs);
555
556 static void TelCom_PrepareCustomKeyEventscxx . . $ TelCom_PrepareCustomKeyEvents(49f6e7a06ebc5aa8).(void);
557 static void TelCom_PostProcessCustomKeyEventscxx . . $ TelCom_PostProcessCustomKeyEvents(49f6e7a06ebc5aa8).(void);
558
559 static int Telcom_mouse_xcxx . . $ Telcom_mouse_x., Telcom_mouse_ycxx . . $ Telcom_mouse_y.;
560
561 //===================================================================================================
562 // Functions
563 //===================================================================================================
564
565 // Initializes the TelCom system, only to be called once during game initialization
566 void TelComInitcxx . . $ TelComInit(49f6e7a06ebc5aa8).(void) {
567 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Initializing TelCom System\n");
568
569 // load background screens
570 if (!(cfexistcxx . . $ cfexist(293b0826c8d9cb54).(TELCOM_DISPLAY_OGFcxx . . $ `Descent3/TelCom.h:56:9`!))) {
571 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "%s file not found, exiting TelCom Init\n", TELCOM_DISPLAY_OGF);
572 return;
573 }
574
575 if (!LoadTelcomBitmapcxx . . $ LoadTelcomBitmap(93bf5714f227be9c).(TELCOM_DISPLAY_OGFcxx . . $ `Descent3/TelCom.h:56:9`!, &Telcom_bitmapcxx . . $ Telcom_bitmap.))
576 Errorcxx . . $ Error(326aeb464d16410c).("Unable to open %s in TelCom system.", TELCOM_DISPLAY_OGFcxx . . $ `Descent3/TelCom.h:56:9`!);
577
578 TelCom_initcxx . . $ TelCom_init. = true;
579
580 // init telcom system structs
581 InitSystemscxx . . $ InitSystems(49f6e7a06ebc5aa8).();
582
583 atexitcxx . . $ atexit(cc8c495369588262).(TelComFreecxx . . $ TelComFree(49f6e7a06ebc5aa8).);
584
585 TelcomPageAllIncxx . . $ TelcomPageAllIn(49f6e7a06ebc5aa8).();
586 }
587
588 // Cleanup crew, don't worry about calling this guy, it's an atexit() in the init
589 void TelComFreecxx . . $ TelComFree(49f6e7a06ebc5aa8).() { bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&Telcom_bitmapcxx . . $ Telcom_bitmap.); }
590
591 // This is the main loop for the active TelCom...think of it as a void main(void)
592 void TelComMaincxx . . $ TelComMain(b0b38cda41d4ede4).(bool ingame, bool SelectShip) {
593 // Initialize sound system
594 TelcomInitSoundscxx . . $ TelcomInitSounds(49f6e7a06ebc5aa8).();
595
596 // Initialize screens
597 InitAllScreenscxx . . $ InitAllScreens(49f6e7a06ebc5aa8).();
598
599 // Initialize the Effects
600 EfxInitcxx . . $ EfxInit(49f6e7a06ebc5aa8).();
601
602 // Initialize the Telcom Render Engine
603 TelcomRenderInitcxx . . $ TelcomRenderInit(49f6e7a06ebc5aa8).();
604
605 // Initialize the TelCom System Event Manager
606 TelComInitEventManagercxx . . $ TelComInitEventManager(49f6e7a06ebc5aa8).();
607 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
608
609 // kinda a quick hack...it may stay only if there is no way to enter the briefings directly from the game
610 bool noescape = false;
611 if (!ingame)
612 noescape = true;
613
614 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!;
615
616 TelcomCreateStartupScreencxx . . $ TelcomCreateStartupScreen(49f6e7a06ebc5aa8).();
617
618 TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(TCSND_STARTUPcxx . . $ `Descent3/TelCom.h:318:9`!);
619 TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(TCSND_RUNNINGcxx . . $ `Descent3/TelCom.h:321:9`!);
620 TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_STARTUPcxx . . $ `Descent3/TelCom.h:318:9`!);
621
622 // #ifdef DEMO
623 // Telcom_system.current_status = TS_MISSION;
624 // #endif
625
626 // initialize this to -1 so we get events right away
627 Telcom_mouse_last_effectcxx . . $ Telcom_mouse_last_effect. = -1;
628
629 // if we are coming from the game into the main menu, then any system we select, when
630 // we exit should take us back to main menu
631 bool return_to_main_menu = false;
632 if (ingame && Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. == TS_MAINMENUcxx . . $ `Descent3/TelCom.h:85:9`!) {
633 return_to_main_menu = true;
634 }
635
636 while (Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. != TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!) {
637
638 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!, true);
639
640 switch (Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status.) {
641 case TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`!:
642 // if we are in briefings, then show the briefing
643 if (Current_levelcxx . . $ Current_level.->flagscxx . . $ tLevelNode#flags. & LVLFLAG_BRIEFINGcxx . . $ LVLFLAG_BRIEFING.) {
644 // determine the correct language of briefing to look at
645 char basefilename[_MAX_FNAMEcxx . . $ `linux/linux_fix.h:35:9`!];
646 char briefingname[_MAX_FNAMEcxx . . $ `linux/linux_fix.h:35:9`!];
647 char extension[_MAX_FNAMEcxx . . $ `linux/linux_fix.h:35:9`!];
648 const char *tag[] = {"", "_GER", "_SPN", "_ITN", "_FRN"};
649 bool ok_to_go = false;
650
651 ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(Current_levelcxx . . $ Current_level.->briefnamecxx . . $ tLevelNode#briefname., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, basefilename, extension);
652
653 strcpy(briefingname, basefilename);
654 strcat(briefingname, tag[Localization_GetLanguagecxx . . $ Localization_GetLanguage(b126dc7c1de90089).()]);
655 strcat(briefingname, extension);
656
657 if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(briefingnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
658 // language version doesn't exist
659 strcpy(briefingname, Current_levelcxx . . $ Current_level.->briefnamecxx . . $ tLevelNode#briefname.);
660
661 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(briefingnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
662 ok_to_go = true;
663 }
664
665 } else {
666 ok_to_go = true;
667 }
668
669 if (ok_to_go) {
670 ParseBriefingcxx . . $ ParseBriefing(b323dcd7712446d0).(briefingname, &Telcom_systemcxx . . $ Telcom_system.);
671
672 if (return_to_main_menu && (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu.))) {
673 // return to main menu
674 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_MAINMENUcxx . . $ `Descent3/TelCom.h:85:9`!;
675 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!;
676 }
677
678 } else {
679 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
680 }
681 } else {
682 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
683 }
684 #ifdef DEMO
685 // Telcom_system.state=TCS_POWEROFF;
686 #endif
687 break;
688 case TS_MAPcxx . . $ `Descent3/TelCom.h:88:9`!:
689 TelComAutoMapcxx . . $ TelComAutoMap(4a6cbf79c6ed567c).(&Telcom_systemcxx . . $ Telcom_system.);
690 if (return_to_main_menu && (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu.))) {
691 // return to main menu
692 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_MAINMENUcxx . . $ `Descent3/TelCom.h:85:9`!;
693 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!;
694 }
695
696 #ifdef DEMO
697 // Telcom_system.state=TCS_POWEROFF;
698 #endif
699 break;
700 case TS_CARGOcxx . . $ `Descent3/TelCom.h:87:9`!:
701 #ifdef DEMO
702 // Telcom_system.state=TCS_POWEROFF;
703 #else
704 // show the inventory information
705 TelComCargocxx . . $ TelComCargo(4a6cbf79c6ed567c).(&Telcom_systemcxx . . $ Telcom_system.);
706 if (return_to_main_menu && (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu.))) {
707 // return to main menu
708 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_MAINMENUcxx . . $ `Descent3/TelCom.h:85:9`!;
709 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!;
710 }
711 #endif
712 break;
713 case TS_GOALScxx . . $ `Descent3/TelCom.h:90:9`!:
714 // show goal screen
715 TelComGoalStatuscxx . . $ TelComGoalStatus(4a6cbf79c6ed567c).(&Telcom_systemcxx . . $ Telcom_system.);
716 if (return_to_main_menu && (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu.))) {
717 // return to main menu
718 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_MAINMENUcxx . . $ `Descent3/TelCom.h:85:9`!;
719 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!;
720 }
721 break;
722 default:
723 if (!noescape) {
724 // display main menu
725 TelComMainMenucxx . . $ TelComMainMenu(4a6cbf79c6ed567c).(&Telcom_systemcxx . . $ Telcom_system.);
726 } else {
727 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
728 }
729 break;
730 }
731 }
732
733 TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_TYPINGcxx . . $ `Descent3/TelCom.h:323:9`!);
734
735 // see if we should display the Single Player Ship Selection
736 #if (!defined(DEMO)) && (!defined(OEM))
737 if (SelectShip && !Telcom_exit_to_mainmenucxx . . $ Telcom_exit_to_mainmenu.)
738 TelComSingleShipSelectcxx . . $ TelComSingleShipSelect(9b1dcfbcd79f78bb).(&Telcom_systemcxx . . $ Telcom_system.);
739 #endif
740
741 TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_STARTUPcxx . . $ `Descent3/TelCom.h:318:9`!);
742 TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_RUNNINGcxx . . $ `Descent3/TelCom.h:321:9`!);
743 TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(TCSND_SHUTDOWNcxx . . $ `Descent3/TelCom.h:320:9`!);
744
745 TelcomCreateShutdownScreencxx . . $ TelcomCreateShutdownScreen(49f6e7a06ebc5aa8).();
746 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
747
748 float starttime = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
749
750 while (timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - starttime < TCPE_TIMEcxx . . $ `Descent3/TelCom.cpp:527:9`!) {
751 // Process all waiting events for the TelCom (we may only want to handle this once a frame!)
752 TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(&Telcom_systemcxx . . $ Telcom_system.);
753 TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).(false, false, 2);
754 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
755 }
756
757 TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_SHUTDOWNcxx . . $ `Descent3/TelCom.h:320:9`!);
758
759 TelcomCloseSoundscxx . . $ TelcomCloseSounds(49f6e7a06ebc5aa8).();
760
761 TelcomRenderClosecxx . . $ TelcomRenderClose(49f6e7a06ebc5aa8).();
762
763 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).(true);
764
765 EfxClosecxx . . $ EfxClose(49f6e7a06ebc5aa8).();
766 }
767
768 // This will make the TelCom system active, displaying it on the screen. This version of TelComShow() takes
769 // a system as an argument and it will display that system
770 // Returns true on success
771 bool TelComShowcxx . . $ TelComShow(636f4aecd7c651f4).(int system, bool ingame, bool ShipSelect) {
772 if (system > NUMBER_OF_SYSTEMScxx . . $ `Descent3/TelCom.h:84:9`!)
773 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
774
775 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = system;
776 return TelComShowcxx . . $ TelComShow(f2cb034b043a1ce9).(ingame, ShipSelect);
777 }
778
779 // This will make the TelCom system active, displaying it on the screen. This version of TelComShow() will make
780 // whatever the current system (either whatever the last system to be displayed or whatever TelComSetSystem() set
781 // it to.
782 // Returns true on success
783
784 // externed from GameLoop.cpp
785 extern bool Skip_render_game_framecxx . . $ Skip_render_game_frame.;
786
787 bool TelComShowcxx . . $ TelComShow(f2cb034b043a1ce9).(bool ingame, bool ShipSelect) {
788 Skip_render_game_framecxx . . $ Skip_render_game_frame. = true;
789 Telcom_called_from_gamecxx . . $ Telcom_called_from_game. = ingame;
790
791 bool result = false;
792 int old_sm;
793
794 Telcom_exit_to_mainmenucxx . . $ Telcom_exit_to_mainmenu. = false;
795
796 // must do this to clear out keyboard events
797 ddio_KeyFlushcxx . . $ ddio_KeyFlush(49f6e7a06ebc5aa8).();
798
799 uint8_tcxx . . $ uint8_t# oldmip = Render_preferred_statecxx . . $ Render_preferred_state..mippingcxx . . $ renderer_preferred_state#mipping.;
800 uint8_tcxx . . $ uint8_t# oldbil = Render_preferred_statecxx . . $ Render_preferred_state..filteringcxx . . $ renderer_preferred_state#filtering.;
801
802 if (!TelCom_initcxx . . $ TelCom_init.) {
803 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TELCOM SYSTEM WARNING: TelComInit() error!\n");
804 return false;
805 }
806
807 // Set Screen mode
808 old_sm = GetScreenModecxx . . $ GetScreenMode(b126dc7c1de90089).();
809 SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(SM_MENUcxx . . $ SM_MENU.);
810
811 hotspot_bitmapscxx . . $ hotspot_bitmaps. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
812
813 int TelCom_bitmap = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(TELCOM_DISPLAY_OGFcxx . . $ `Descent3/TelCom.h:56:9`!), 0);
814 if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(HOTSPOT_DISPLAYcxx . . $ `Descent3/TelCom.h:53:9`!)) {
815 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't find HotSpot map, so I'm going to make one\n");
816 if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(TELCOM_DISPLAY_TGAcxx . . $ `Descent3/TelCom.h:55:9`!)) {
817 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to find %s to extract HotSqpots...skipping TelCom System\n", TELCOM_DISPLAY_TGA);
818 FreeViewportscxx . . $ FreeViewports(49f6e7a06ebc5aa8).();
819 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.)
820 mem_freecxx . . $ `mem/mem.h:80:9`!(windowmap.wm);
821 goto telcom_bad_error;
822 }
823 menutga_ConvertTGAtoHSMcxx . . $ menutga_ConvertTGAtoHSM(c5f7da30cbc0f4e9).(TELCOM_DISPLAY_TGAcxx . . $ `Descent3/TelCom.h:55:9`!);
824 }
825
826 // Load up the hotspot map into the structure
827 menutga_LoadHotSpotMapcxx . . $ menutga_LoadHotSpotMap(b6655629de763852).(TelCom_bitmap, IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(HOTSPOT_DISPLAYcxx . . $ `Descent3/TelCom.h:53:9`!), &hotspotmapcxx . . $ hotspotmap., &windowmapcxx . . $ windowmap.);
828 if (TelCom_bitmap >= 0)
829 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(TelCom_bitmap);
830
831 if (hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.) {
832 int TelCom_onbmp = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(TELCOM_DISPLAY_OGF_ONcxx . . $ `Descent3/TelCom.h:57:9`!), 0);
833 if (TelCom_onbmp != -1) {
834 hotspot_bitmapscxx . . $ hotspot_bitmaps. = (chunked_bitmapcxx . . $ chunked_bitmap# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(chunked_bitmap) * hotspotmap.num_of_hotspots);
835 ASSERTcxx . . $ `misc/pserror.h:246:9`!(hotspot_bitmaps);
836 CompressTelComOnImagecxx . . $ CompressTelComOnImage(367ea157a22f9336).(TelCom_onbmp, hotspot_bitmapscxx . . $ hotspot_bitmaps.);
837 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(TelCom_onbmp);
838 }
839 }
840
841 // turn off mipmapping
842 Render_preferred_statecxx . . $ Render_preferred_state..mippingcxx . . $ renderer_preferred_state#mipping. = 0;
843 // turn off bilinear filtering
844 Render_preferred_statecxx . . $ Render_preferred_state..filteringcxx . . $ renderer_preferred_state#filtering. = 1;
845 rend_SetPreferredStatecxx . . $ rend_SetPreferredState(9d6d139eb250c11d).(&Render_preferred_statecxx . . $ Render_preferred_state.);
846 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
847
848 // keep the mouse in view
849 ddio_MouseResetcxx . . $ ddio_MouseReset(49f6e7a06ebc5aa8).();
850 ddio_MouseSetVCoordscxx . . $ ddio_MouseSetVCoords(3e454b8ccf442868).(Game_window_wcxx . . $ Game_window_w., Game_window_hcxx . . $ Game_window_h.);
851
852 // hang out in here until the user presses POWER
853 TelComMaincxx . . $ TelComMain(b0b38cda41d4ede4).(ingame, ShipSelect);
854
855 // do some final deactivation
856 TelComDeactivatecxx . . $ TelComDeactivate(49f6e7a06ebc5aa8).();
857
858 result = true;
859
860 telcom_bad_error:
861
862 if (hotspot_bitmapscxx . . $ hotspot_bitmaps.)
863 mem_freecxx . . $ `mem/mem.h:80:9`!(hotspot_bitmaps);
864
865 // must do this to clear out keyboard events
866 ddio_KeyFlushcxx . . $ ddio_KeyFlush(49f6e7a06ebc5aa8).();
867
868 // reset screen mode
869 SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(old_sm);
870
871 // reset some states
872 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1);
873 Render_preferred_statecxx . . $ Render_preferred_state..mippingcxx . . $ renderer_preferred_state#mipping. = oldmip;
874 Render_preferred_statecxx . . $ Render_preferred_state..filteringcxx . . $ renderer_preferred_state#filtering. = oldbil;
875 rend_SetPreferredStatecxx . . $ rend_SetPreferredState(9d6d139eb250c11d).(&Render_preferred_statecxx . . $ Render_preferred_state.);
876 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
877 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.);
878
879 Skip_render_game_framecxx . . $ Skip_render_game_frame. = false;
880
881 return Telcom_exit_to_mainmenucxx . . $ Telcom_exit_to_mainmenu.;
882 }
883
884 // Initializes the systems so it has correct values
885 void InitSystemscxx . . $ InitSystems(49f6e7a06ebc5aa8).() {
886 Telcom_systemcxx . . $ Telcom_system..current_statuscxx . . $ tTelComInfo#current_status. = TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`!;
887 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!;
888 }
889
890 // Frees allocated memory used by the windows
891 void FreeViewportscxx . . $ FreeViewports(49f6e7a06ebc5aa8).() {
892 int count;
893
894 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.) {
895 for (count = 0; count < windowmapcxx . . $ windowmap..num_of_windowscxx . . $ windowmap_t#num_of_windows.; count++) {
896 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].lt_bmpcxx . . $ window_box#lt_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
897 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].lt_bmpcxx . . $ window_box#lt_bmp.);
898 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].rt_bmpcxx . . $ window_box#rt_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
899 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].rt_bmpcxx . . $ window_box#rt_bmp.);
900 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].lb_bmpcxx . . $ window_box#lb_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
901 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].lb_bmpcxx . . $ window_box#lb_bmp.);
902 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].rb_bmpcxx . . $ window_box#rb_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
903 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[count].rb_bmpcxx . . $ window_box#rb_bmp.);
904 }
905 }
906 }
907
908 // This function 'compresses' the on-state background, to save space
909 void CompressTelComOnImagecxx . . $ CompressTelComOnImage(367ea157a22f9336).(int bitmap, chunked_bitmapcxx . . $ chunked_bitmap# *array) {
910 if (!array)
911 return;
912 int count;
913 int width, height;
914 int handle;
915
916 // the first hotspot bitmap doesn't exist so we can skip it
917 for (count = 1; count < hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.; count++) {
918 width = HotSpotWcxx . . $ HotSpotW(7864480464b09eea).(count);
919 ASSERTcxx . . $ `misc/pserror.h:246:9`!(width != -1); // DAJ -1FIX
920 height = HotSpotHcxx . . $ HotSpotH(7864480464b09eea).(count);
921 ASSERTcxx . . $ `misc/pserror.h:246:9`!(height != -1); // DAJ -1FIX
922 handle = bm_AllocBitmapcxx . . $ bm_AllocBitmap(2326284602b0bb2d).(width, height, 0);
923 TelCom_BltToMemcxx . . $ TelCom_BltToMem(87c0d4c54aba6eb).(handle, 0, 0, bitmap, HotSpotLcxx . . $ HotSpotL(7864480464b09eea).(count), HotSpotTcxx . . $ HotSpotT(7864480464b09eea).(count), width, height);
924 bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(handle, &array[count]);
925 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(handle);
926 }
927 }
928
929 // frees up on-state bitmaps
930 void FreeTelComOnBitmapscxx . . $ FreeTelComOnBitmaps(1635f60f4d3c1317).(chunked_bitmapcxx . . $ chunked_bitmap# *array) {
931 if (!array)
932 return;
933 int count;
934
935 // the first hotspot bitmap doesn't exist, so we can skip it
936 for (count = 1; count < hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.; count++) {
937 bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&array[count]);
938 }
939 }
940
941 // This deactivates the TelCom system
942 void TelComDeactivatecxx . . $ TelComDeactivate(49f6e7a06ebc5aa8).(void) {
943 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TelCom System being deactivated\n");
944 FreeTelComOnBitmapscxx . . $ FreeTelComOnBitmaps(1635f60f4d3c1317).(hotspot_bitmapscxx . . $ hotspot_bitmaps.);
945 FreeHotSpotMapInternalscxx . . $ FreeHotSpotMapInternals(40652d961f76803d).(&hotspotmapcxx . . $ hotspotmap.);
946 FreeViewportscxx . . $ FreeViewports(49f6e7a06ebc5aa8).();
947 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.)
948 mem_freecxx . . $ `mem/mem.h:80:9`!(windowmap.wm);
949 }
950
951 // draws a hotspot with the on bitmap
952 void DrawHotSpotOncxx . . $ DrawHotSpotOn(d4f767463ce0a6b3).(int hotspot) {
953 if (!hotspot_bitmapscxx . . $ hotspot_bitmaps.)
954 return;
955 if ((hotspot < 0) || (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.))
956 return;
957 TelCom_BltToScreencxx . . $ TelCom_BltToScreen(df47d900db23a9c5).(HotSpotLcxx . . $ HotSpotL(7864480464b09eea).(hotspot), HotSpotTcxx . . $ HotSpotT(7864480464b09eea).(hotspot), &hotspot_bitmapscxx . . $ hotspot_bitmaps.[hotspot]);
958 }
959
960 // ---------------------------------------------------------------------------
961 // performs 16-bit blts.
962
963 void TelCom_BltToScreencxx . . $ TelCom_BltToScreen(df47d900db23a9c5).(int dx, int dy, chunked_bitmapcxx . . $ chunked_bitmap# *src_bmp) {
964 TelCom_BltToScreencxx . . $ TelCom_BltToScreen(19947dc49169eac1).(dx, dy, src_bmp, 0, 0, src_bmp->pwcxx . . $ chunked_bitmap#pw., src_bmp->phcxx . . $ chunked_bitmap#ph.);
965 }
966
967 void TelCom_BltToScreencxx . . $ TelCom_BltToScreen(19947dc49169eac1).(int dx, int dy, chunked_bitmapcxx . . $ chunked_bitmap# *src_bmp, int sx, int sy, int sw, int sh) {
968 rend_DrawScaledChunkedBitmapcxx . . $ rend_DrawScaledChunkedBitmap(a8bf607edbcedb63).(src_bmp, dx, dy, sw, sh, 255);
969 }
970
971 void TelCom_BltToMemcxx . . $ TelCom_BltToMem(87c0d4c54aba6eb).(int dest_bmp, int dx, int dy, int src_bmp, int sx, int sy, int sw, int sh, bool trans) {
972 uint16_tcxx . . $ uint16_t# *dbits;
973 uint16_tcxx . . $ uint16_t# *sbits;
974 int srowsize_w, drowsize_w, row, col;
975
976 // set up blt.
977 srowsize_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(src_bmp, 0); // rowsize in shorts
978 drowsize_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(dest_bmp, 0);
979 dbits = (uint16_tcxx . . $ uint16_t# *)bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(dest_bmp, 0) + (dy * drowsize_w) + dx;
980 sbits = (uint16_tcxx . . $ uint16_t# *)bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(src_bmp, 0) + (sy * srowsize_w) + sx;
981
982 if (trans) {
983 for (row = 0; row < sh; row++) {
984 for (col = 0; col < sw; col++)
985 if (sbits[col] & OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!)
986 dbits[col] = sbits[col];
987
988 sbits += srowsize_w;
989 dbits += drowsize_w;
990 }
991 } else {
992 for (row = 0; row < sh; row++) {
993 for (col = 0; col < sw; col++)
994 dbits[col] = sbits[col];
995
996 sbits += srowsize_w;
997 dbits += drowsize_w;
998 }
999 }
1000 }
1001
1002 // returns left edge of hotspot
1003 int HotSpotLcxx . . $ HotSpotL(7864480464b09eea).(int hotspot) {
1004 if (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.)
1005 return -1;
1006 return hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].xcxx . . $ hotspot#x.[0].startcxx . . $ scanline#start.;
1007 }
1008
1009 // returns width of hotspot
1010 int HotSpotWcxx . . $ HotSpotW(7864480464b09eea).(int hotspot) {
1011 if (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.)
1012 return -1;
1013 return hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].xcxx . . $ hotspot#x.[0].endcxx . . $ scanline#end. - hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].xcxx . . $ hotspot#x.[0].startcxx . . $ scanline#start. + 1;
1014 }
1015
1016 // returns the top edge of a hotspot
1017 int HotSpotTcxx . . $ HotSpotT(7864480464b09eea).(int hotspot) {
1018 if (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.)
1019 return -1;
1020 return hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].starting_ycxx . . $ hotspot#starting_y.;
1021 }
1022
1023 // returns the height of a hotspot
1024 int HotSpotHcxx . . $ HotSpotH(7864480464b09eea).(int hotspot) {
1025 if (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.)
1026 return -1;
1027 return hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].scanlinescxx . . $ hotspot#scanlines.;
1028 }
1029
1030 // returns the right edge of a hotspot
1031 int HotSpotRcxx . . $ HotSpotR(7864480464b09eea).(int hotspot) {
1032 if (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.)
1033 return -1;
1034 return hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].xcxx . . $ hotspot#x.[0].endcxx . . $ scanline#end.;
1035 }
1036
1037 // returns the bottom edge of a hotspot
1038 int HotSpotBcxx . . $ HotSpotB(7864480464b09eea).(int hotspot) {
1039 if (hotspot >= hotspotmapcxx . . $ hotspotmap..num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.)
1040 return -1;
1041 return hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].starting_ycxx . . $ hotspot#starting_y. + hotspotmapcxx . . $ hotspotmap..hscxx . . $ hotspotmap_t#hs.[hotspot].scanlinescxx . . $ hotspot#scanlines.;
1042 }
1043
1044 int LoadTelcomBitmapcxx . . $ LoadTelcomBitmap(93bf5714f227be9c).(const char *filename, chunked_bitmapcxx . . $ chunked_bitmap# *chunk) {
1045 int bm_handle = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(filename), 0);
1046 if (bm_handle == -1)
1047 return 0;
1048
1049 // make monitor windows transparent
1050 menutga_LoadHotSpotMapcxx . . $ menutga_LoadHotSpotMap(b6655629de763852).(bm_handle, IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(HOTSPOT_DISPLAYcxx . . $ `Descent3/TelCom.h:53:9`!), &hotspotmapcxx . . $ hotspotmap., &windowmapcxx . . $ windowmap.);
1051
1052 uint16_tcxx . . $ uint16_t# *data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(bm_handle, 0);
1053 int wnd, x, y, bmw;
1054 int bord_left, bord_right, bord_top, bord_bottom;
1055
1056 bmw = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0);
1057
1058 int starty, startx, endy, endx;
1059 for (wnd = 0; wnd < windowmapcxx . . $ windowmap..num_of_windowscxx . . $ windowmap_t#num_of_windows.; wnd++) {
1060 bord_left = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].l_start_xcxx . . $ window_box#l_start_x. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].xcxx . . $ window_box#x.;
1061 bord_right = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].xcxx . . $ window_box#x. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].widthcxx . . $ window_box#width. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].r_end_xcxx . . $ window_box#r_end_x.;
1062 bord_top = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].t_top_ycxx . . $ window_box#t_top_y. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].ycxx . . $ window_box#y.;
1063 bord_bottom = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].ycxx . . $ window_box#y. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].heightcxx . . $ window_box#height. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].b_bottom_ycxx . . $ window_box#b_bottom_y.;
1064
1065 starty = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].ycxx . . $ window_box#y. + bord_top;
1066 endy = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].ycxx . . $ window_box#y. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].heightcxx . . $ window_box#height. - bord_bottom;
1067 startx = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].xcxx . . $ window_box#x. + bord_left;
1068 endx = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].xcxx . . $ window_box#x. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[wnd].widthcxx . . $ window_box#width. - bord_right;
1069 for (y = starty; y < endy; y++)
1070 for (x = startx; x < endx; x++) {
1071 data[y * bmw + x] = NEW_TRANSPARENT_COLORcxx . . $ `lib/grdefs.h:71:9`!;
1072 }
1073 }
1074
1075 FreeHotSpotMapInternalscxx . . $ FreeHotSpotMapInternals(40652d961f76803d).(&hotspotmapcxx . . $ hotspotmap.);
1076 FreeViewportscxx . . $ FreeViewports(49f6e7a06ebc5aa8).();
1077 if (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.)
1078 mem_freecxx . . $ `mem/mem.h:80:9`!(windowmap.wm);
1079
1080 bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(bm_handle, chunk);
1081
1082 if (bm_handle > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
1083 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(bm_handle);
1084
1085 return 1;
1086 }
1087
1088 #define MAINMENU_BUTTONcxx . . $ `Descent3/TelCom.cpp:1088:9`! "TelComMenuButton.ogf"
1089 #define MAINMENU_BUTTONGLOWcxx . . $ `Descent3/TelCom.cpp:1089:9`! "TelComMenuButtonGlow.ogf"
1090 #define MAINMENU_BUTTONFOCUScxx . . $ `Descent3/TelCom.cpp:1090:9`! "Forward.ogf"
1091 #define MAINMENU_BUTTONGLOWFOCUScxx . . $ `Descent3/TelCom.cpp:1091:9`! "ForwardFocus.ogf"
1092 /*
1093 $$TABLE_GAMEFILE "TelComMenuButton.ogf"
1094 $$TABLE_GAMEFILE "TelComMenuButtonGlow.ogf"
1095 $$TABLE_GAMEFILE "Forward.ogf"
1096 $$TABLE_GAMEFILE "ForwardFocus.ogf"
1097 */
1098 #define BOFF_Lcxx . . $ `Descent3/TelCom.cpp:1098:9`! 40
1099 #define BOFF_Tcxx . . $ `Descent3/TelCom.cpp:1099:9`! 15
1100 #define MM_BUTTONXcxx . . $ `Descent3/TelCom.cpp:1100:9`! 99
1101 #define MM_BUTTONYcxx . . $ `Descent3/TelCom.cpp:1101:9`! 60
1102 #define MM_BUTTONOFFSETcxx . . $ `Descent3/TelCom.cpp:1102:9`! 50
1103
1104 // Main Menu button info
1105 #define TCBRIEFINGcxx . . $ `Descent3/TelCom.cpp:1105:9`! 0
1106 #define TCCARGOcxx . . $ `Descent3/TelCom.cpp:1106:9`! 1
1107 #define TCAUTOMAPcxx . . $ `Descent3/TelCom.cpp:1107:9`! 2
1108 #define TCGOALScxx . . $ `Descent3/TelCom.cpp:1108:9`! 3
1109 #define TCMAX_MMBUTTONScxx . . $ `Descent3/TelCom.cpp:1109:9`! 4
1110
1111 int TCMMButtonDesccxx . . $ TCMMButtonDesc.[] = {TXI_TCMM_BRIEFINGScxx . . $ `Descent3/stringtable.h:724:9`!, TXI_TCMM_CARGOcxx . . $ `Descent3/stringtable.h:725:9`!, TXI_TCMM_AUTOMAPcxx . . $ `Descent3/stringtable.h:726:9`!, TXI_TCMM_GOALScxx . . $ `Descent3/stringtable.h:436:9`!};
1112
1113 int mainmenu_systemcxx . . $ mainmenu_system.;
1114
1115 struct tMenuButtoncxx . . $ tMenuButton# {
1116 bool enabledcxx . . $ tMenuButton#enabled.;
1117 int efxidcxx . . $ tMenuButton#efxid.;
1118 int systemcxx . . $ tMenuButton#system.;
1119 char textcxx . . $ tMenuButton#text.[128];
1120 };
1121 tMenuButtoncxx . . $ tMenuButton# MMButtonscxx . . $ MMButtons.[TCMAX_MMBUTTONScxx . . $ `Descent3/TelCom.cpp:1109:9`!];
1122
1123 void TCMainMenuCallbackcxx . . $ TCMainMenuCallback(d4f767463ce0a6b3).(int efxnum) { mainmenu_systemcxx . . $ mainmenu_system. = efxnum; }
1124 void TCMainMenuRenderCallbackcxx . . $ TCMainMenuRenderCallback(49f6e7a06ebc5aa8).(void) {
1125 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BIG_BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:112:9`!);
1126 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255));
1127 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(255);
1128
1129 int mm_y, mm_x;
1130 mm_y = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top. + BOFF_Tcxx . . $ `Descent3/TelCom.cpp:1099:9`! + MM_BUTTONYcxx . . $ `Descent3/TelCom.cpp:1101:9`!;
1131 mm_x = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left. + BOFF_Lcxx . . $ `Descent3/TelCom.cpp:1098:9`! + MM_BUTTONXcxx . . $ `Descent3/TelCom.cpp:1100:9`!;
1132
1133 for (int i = 0; i < TCMAX_MMBUTTONScxx . . $ `Descent3/TelCom.cpp:1109:9`!; i++) {
1134 if (MMButtonscxx . . $ MMButtons.[i].enabledcxx . . $ tMenuButton#enabled.) {
1135 // draw the button text
1136 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(mm_x, mm_y, MMButtonscxx . . $ MMButtons.[i].textcxx . . $ tMenuButton#text.);
1137
1138 // adjust y value
1139 mm_y += MM_BUTTONOFFSETcxx . . $ `Descent3/TelCom.cpp:1102:9`!;
1140 }
1141 }
1142 }
1143
1144 // Main menu
1145 bool TelComMainMenucxx . . $ TelComMainMenu(4a6cbf79c6ed567c).(tTelComInfocxx . . $ tTelComInfo# *tcs) {
1146 bool exitparse = false;
1147 int mm;
1148
1149 mainmenu_systemcxx . . $ mainmenu_system. = -1;
1150
1151 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).();
1152
1153 for (mm = 0; mm < TCMAX_MMBUTTONScxx . . $ `Descent3/TelCom.cpp:1109:9`!; mm++) {
1154 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = false;
1155 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
1156 }
1157
1158 TCBKGDESCcxx . . $ TCBKGDESC# backg;
1159 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
1160 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
1161 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
1162
1163 TCBMPDESCcxx . . $ TCBMPDESC# bmpdesc;
1164 bmpdesc.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
1165 bmpdesc.flagscxx . . $ TCBMPDESC#flags. = 0;
1166 bmpdesc.capscxx . . $ TCBMPDESC#caps. = TCBD_XYcxx . . $ `Descent3/TelComEfxStructs.h:115:9`!;
1167 bmpdesc.xcxx . . $ TCBMPDESC#x. = 0;
1168 bmpdesc.ycxx . . $ TCBMPDESC#y. = 0;
1169 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "TelComMainMenu.ogf");
1170 /*
1171 $$TABLE_GAMEFILE "TelComMainMenu.ogf"
1172 */
1173
1174 TCTEXTDESCcxx . . $ TCTEXTDESC# textdesc;
1175 textdesc.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_STATICcxx . . $ `Descent3/TelComEfxStructs.h:135:9`!;
1176 textdesc.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
1177 textdesc.capscxx . . $ TCTEXTDESC#caps. = TCTD_TEXTBOXcxx . . $ `Descent3/TelComEfxStructs.h:111:9`! | TCTD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:107:9`! | TCTD_FONTcxx . . $ `Descent3/TelComEfxStructs.h:106:9`!;
1178 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 65;
1179 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 380;
1180 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 2;
1181 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 50;
1182 textdesc.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
1183
1184 TCBUTTONDESCcxx . . $ TCBUTTONDESC# buttdesc;
1185 strcpy(buttdesc.filenamecxx . . $ TCBUTTONDESC#filename., MAINMENU_BUTTONcxx . . $ `Descent3/TelCom.cpp:1088:9`!);
1186 strcpy(buttdesc.flash_filenamecxx . . $ TCBUTTONDESC#flash_filename., MAINMENU_BUTTONGLOWcxx . . $ `Descent3/TelCom.cpp:1089:9`!);
1187
1188 #if 0 // def DEMO
1189 // strcpy(buttdesc.filename_focus, MAINMENU_BUTTONFOCUS);
1190 // strcpy(buttdesc.flash_filename_focus, MAINMENU_BUTTONGLOWFOCUS);
1191 #else
1192 strcpy(buttdesc.filename_focuscxx . . $ TCBUTTONDESC#filename_focus., MAINMENU_BUTTONGLOWcxx . . $ `Descent3/TelCom.cpp:1089:9`!);
1193 strcpy(buttdesc.flash_filename_focuscxx . . $ TCBUTTONDESC#flash_filename_focus., MAINMENU_BUTTONGLOWcxx . . $ `Descent3/TelCom.cpp:1089:9`!);
1194 #endif
1195 buttdesc.sibling_idcxx . . $ TCBUTTONDESC#sibling_id. = buttdesc.parent_idcxx . . $ TCBUTTONDESC#parent_id. = -1;
1196 buttdesc.internalcxx . . $ TCBUTTONDESC#internal. = TCMainMenuCallbackcxx . . $ TCMainMenuCallback(d4f767463ce0a6b3).;
1197 buttdesc.flash_timecxx . . $ TCBUTTONDESC#flash_time. = 0;
1198 buttdesc.button_typecxx . . $ TCBUTTONDESC#button_type. = BUTT_INTERNALcxx . . $ `Descent3/TelComEffects.h:183:9`!;
1199 buttdesc.flashercxx . . $ TCBUTTONDESC#flasher. = true;
1200 buttdesc.click_typecxx . . $ TCBUTTONDESC#click_type. = CLICKTYPE_CLICKUPcxx . . $ `Descent3/TelComEffects.h:188:9`!;
1201 buttdesc.osflagscxx . . $ TCBUTTONDESC#osflags. = OBF_GLOWcxx . . $ `Descent3/TelComEfxStructs.h:306:9`! | OBF_MOUSEOVERFOCUScxx . . $ `Descent3/TelComEfxStructs.h:308:9`!;
1202 buttdesc.xcxx . . $ TCBUTTONDESC#x. = 0;
1203 buttdesc.ycxx . . $ TCBUTTONDESC#y. = 0;
1204 buttdesc.tab_stopcxx . . $ TCBUTTONDESC#tab_stop. = true; // all main menu buttons can have focus
1205
1206 // Add effects to screen 0
1207 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(0);
1208 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0);
1209
1210 int mm_y, mm_x;
1211 mm_y = MM_BUTTONYcxx . . $ `Descent3/TelCom.cpp:1101:9`! + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.;
1212 mm_x = MM_BUTTONXcxx . . $ `Descent3/TelCom.cpp:1100:9`! + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
1213
1214 bool ok_to_run = false;
1215
1216 // Now create all the main menu buttons
1217 for (mm = 0; mm < TCMAX_MMBUTTONScxx . . $ `Descent3/TelCom.cpp:1109:9`!; mm++) {
1218 // first determine if this button should be enabled (they are all disabled by default)
1219 // also set all the systems in here
1220 switch (mm) {
1221 case TCBRIEFINGcxx . . $ `Descent3/TelCom.cpp:1105:9`!:
1222 // Briefings should only be enabled if there is a briefing
1223 if (Current_levelcxx . . $ Current_level.->flagscxx . . $ tLevelNode#flags. & LVLFLAG_BRIEFINGcxx . . $ LVLFLAG_BRIEFING.) {
1224 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = true;
1225 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`!;
1226 ok_to_run = true;
1227 } else {
1228 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = false;
1229 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
1230 }
1231 break;
1232 case TCCARGOcxx . . $ `Descent3/TelCom.cpp:1106:9`!:
1233 // #if (defined DEMO)||(defined OEM)
1234 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = false;
1235 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
1236 /*
1237 #else
1238 //Cargo should only be enabled if we are in the game
1239 if(Telcom_called_from_game){
1240 MMButtons[mm].enabled = true;
1241 MMButtons[mm].system = TS_CARGO;
1242 ok_to_run = true;
1243 }else{
1244 MMButtons[mm].enabled = false;
1245 MMButtons[mm].system = TS_OFF;
1246 }
1247 #endif
1248 */
1249 break;
1250 case TCGOALScxx . . $ `Descent3/TelCom.cpp:1108:9`!:
1251 if (Telcom_called_from_gamecxx . . $ Telcom_called_from_game.) {
1252 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = true;
1253 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_GOALScxx . . $ `Descent3/TelCom.h:90:9`!;
1254 ok_to_run = true;
1255 } else {
1256 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = false;
1257 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
1258 }
1259 break;
1260 case TCAUTOMAPcxx . . $ `Descent3/TelCom.cpp:1107:9`!:
1261 // Automap should only be enabled if we are in the game
1262 if (Telcom_called_from_gamecxx . . $ Telcom_called_from_game.) {
1263 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = true;
1264 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_MAPcxx . . $ `Descent3/TelCom.h:88:9`!;
1265 ok_to_run = true;
1266 } else {
1267 MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled. = false;
1268 MMButtonscxx . . $ MMButtons.[mm].systemcxx . . $ tMenuButton#system. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
1269 }
1270 break;
1271 }
1272
1273 strcpy(MMButtonscxx . . $ MMButtons.[mm].textcxx . . $ tMenuButton#text., TXTcxx . . $ `Descent3/stringtable.h:24:9`!(TCMMButtonDesc[mm]));
1274
1275 // now if it's enabled,fill in it's info
1276 // create the button
1277 if (MMButtonscxx . . $ MMButtons.[mm].enabledcxx . . $ tMenuButton#enabled.) {
1278 buttdesc.xcxx . . $ TCBUTTONDESC#x. = mm_x;
1279 buttdesc.ycxx . . $ TCBUTTONDESC#y. = mm_y;
1280 MMButtonscxx . . $ MMButtons.[mm].efxidcxx . . $ tMenuButton#efxid. = CreateButtonEffectcxx . . $ CreateButtonEffect(41aa3ad94772acea).(&buttdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0);
1281 // adjust y
1282 mm_y += MM_BUTTONOFFSETcxx . . $ `Descent3/TelCom.cpp:1102:9`!;
1283 } else {
1284 MMButtonscxx . . $ MMButtons.[mm].efxidcxx . . $ tMenuButton#efxid. = -1;
1285 }
1286 }
1287
1288 if (!ok_to_run) {
1289 // no systems available
1290 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
1291 }
1292
1293 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0);
1294 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, formatcxx . . $ format(a849077ff1b8d812).(TXT_TCMAINMENUcxx . . $ `Descent3/stringtable.h:205:9`!), MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0);
1295 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
1296
1297 TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(TCMainMenuRenderCallbackcxx . . $ TCMainMenuRenderCallback(49f6e7a06ebc5aa8).);
1298
1299 // Set the screen active
1300 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(0);
1301
1302 bool done = false;
1303
1304 TelCom_ClearCustomKeyEventscxx . . $ TelCom_ClearCustomKeyEvents(49f6e7a06ebc5aa8).();
1305 TelCom_AddCustomKeyEventcxx . . $ TelCom_AddCustomKeyEvent(3e454b8ccf442868).(KEY_DOWNcxx . . $ `ddio/ddio_common.h:319:9`!, 0x13); // down arrow
1306 TelCom_AddCustomKeyEventcxx . . $ TelCom_AddCustomKeyEvent(3e454b8ccf442868).(KEY_UPcxx . . $ `ddio/ddio_common.h:318:9`!, 0x14); // up arrow
1307
1308 while (!done) {
1309 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(Telcom_called_from_gamecxx . . $ Telcom_called_from_game.);
1310
1311 if (tcs->statecxx . . $ tTelComInfo#state. == TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`! || mainmenu_systemcxx . . $ mainmenu_system. != -1 || tcs->current_statuscxx . . $ tTelComInfo#current_status. != TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!) {
1312 // we're done with the loop
1313 done = true;
1314
1315 if (mainmenu_systemcxx . . $ mainmenu_system. != -1) {
1316 // go through the buttons and compare efx id's
1317 for (int i = 0; i < TCMAX_MMBUTTONScxx . . $ `Descent3/TelCom.cpp:1109:9`!; i++) {
1318 if (MMButtonscxx . . $ MMButtons.[i].enabledcxx . . $ tMenuButton#enabled. && MMButtonscxx . . $ MMButtons.[i].efxidcxx . . $ tMenuButton#efxid. == mainmenu_systemcxx . . $ mainmenu_system.) {
1319 // we found our system
1320 tcs->current_statuscxx . . $ tTelComInfo#current_status. = MMButtonscxx . . $ MMButtons.[i].systemcxx . . $ tMenuButton#system.;
1321 } // endif
1322 } // endfor
1323 } // endif
1324 }
1325
1326 // Process all waiting events for the TelCom (we may only want to handle this once a frame!)
1327 TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(&Telcom_systemcxx . . $ Telcom_system.);
1328
1329 // Process custom events
1330 tTCEventcxx . . $ tTCEvent# evt;
1331 while (TelCom_PopSystemEventcxx . . $ TelCom_PopSystemEvent(2cd38c003880a92c).(&evt)) {
1332 switch (evt.idcxx . . $ tTCEvent#id.) {
1333 case 0x13: // up arrow
1334 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_FAKEKEYPRESScxx . . $ `Descent3/TelComEffects.h:169:9`!, TCSYS_TABcxx . . $ `Descent3/TelCom.h:103:9`!);
1335 break;
1336 case 0x14: // down arrow
1337 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_FAKEKEYPRESScxx . . $ `Descent3/TelComEffects.h:169:9`!, TCSYS_REVERSETABcxx . . $ `Descent3/TelCom.h:123:9`!);
1338 break;
1339 }
1340 }
1341
1342 TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).();
1343 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
1344 if (KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!))
1345 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
1346
1347 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
1348 }
1349 TelCom_ClearCustomKeyEventscxx . . $ TelCom_ClearCustomKeyEvents(49f6e7a06ebc5aa8).();
1350
1351 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).();
1352 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1353 TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
1354 return true;
1355 }
1356
1357 /*
1358 ************************************************************************
1359 * TelCom Render Functions *
1360 ************************************************************************
1361 *
1362 */
1363 /// internal prototypes *************************************
1364 // Creates the screen overlays for the main monitor
1365 static void TelcomCreateScreenOverlayscxx . . $ TelcomCreateScreenOverlays(49f6e7a06ebc5aa8).(void);
1366 // Destroys the screen overlays that were used for the main monitor
1367 static void TelcomDestroyScreenOverlayscxx . . $ TelcomDestroyScreenOverlays(49f6e7a06ebc5aa8).(void);
1368 // Renders the screen overlays
1369 static void TelcomRenderOverlayscxx . . $ TelcomRenderOverlays(49f6e7a06ebc5aa8).(void);
1370 // Renders the screen hilights
1371 static void TelcomRenderDrawHiLitescxx . . $ TelcomRenderDrawHiLites(49f6e7a06ebc5aa8).(void);
1372 // Loads the Hilites for a monitor
1373 static void TelcomLoadHiLitescxx . . $ TelcomLoadHiLites(5f82b7a869a95a4e).(const char *filelist[], int monitor, int xoff, int yoff);
1374 // Frees all the memory allocated for the hilites
1375 static void TelcomFreeHiLitescxx . . $ TelcomFreeHiLites(49f6e7a06ebc5aa8).(void);
1376 // Renders the scanline to be drawn
1377 static void TelcomRenderScanlinecxx . . $ TelcomRenderScanline(49f6e7a06ebc5aa8).(void);
1378 // Creates the scanline
1379 static void TelcomCreateScanLinecxx . . $ TelcomCreateScanLine(49f6e7a06ebc5aa8).(void);
1380 // Destroys the scanline
1381 static void TelcomDestroyScanLinecxx . . $ TelcomDestroyScanLine(49f6e7a06ebc5aa8).(void);
1382 // Loads the mouse cursor
1383 static void TelcomLoadMouseCursorcxx . . $ TelcomLoadMouseCursor(49f6e7a06ebc5aa8).(void);
1384 // Frees the mouse cursor
1385 static void TelcomFreeMouseCursorcxx . . $ TelcomFreeMouseCursor(49f6e7a06ebc5aa8).(void);
1386 // Renders the mouse cursor
1387 static void TelcomRenderMousecxx . . $ TelcomRenderMouse(49f6e7a06ebc5aa8).(void);
1388 // draws the telcom background, handles flickering lights, power button etc
1389 static void TelcomDrawScreencxx . . $ TelcomDrawScreen(b0b38cda41d4ede4).(bool poweron, bool powerup);
1390 // used to display the rounded corners of the monitor screens
1391 static void TelcomDisplayCornerscxx . . $ TelcomDisplayCorners(49f6e7a06ebc5aa8).(void);
1392 // Frees the bitmaps used for the corners of each monitor
1393 static void TelcomFreeCornerscxx . . $ TelcomFreeCorners(49f6e7a06ebc5aa8).(void);
1394 // Allocates the bitmaps for corners of each monitor
1395 static void TelcomCreateCornerscxx . . $ TelcomCreateCorners(49f6e7a06ebc5aa8).(void);
1396 // Displays static on the screen
1397 static void TelcomDisplayStaticcxx . . $ TelcomDisplayStatic(9364e6e7bff7660).(float amount);
1398 // Frees the static bitmap overlays
1399 static void TelcomFreeStaticOverlayscxx . . $ TelcomFreeStaticOverlays(49f6e7a06ebc5aa8).(void);
1400 // Creates the static bitmap overlays
1401 static void TelcomCreateStaticOverlayscxx . . $ TelcomCreateStaticOverlays(49f6e7a06ebc5aa8).(void);
1402 // Initializes the bitmaps, etc needed for power up/down effect
1403 static void TelcomInitPowerEffectcxx . . $ TelcomInitPowerEffect(49f6e7a06ebc5aa8).(void);
1404 // Frees the bitmaps, etc for power up/down effect
1405 static void TelcomFreePowerEffectcxx . . $ TelcomFreePowerEffect(49f6e7a06ebc5aa8).(void);
1406 // Draws a frame of the power up/down effect
1407 static void TelcomDoPowerEffectcxx . . $ TelcomDoPowerEffect(8927e202fc0ce9fc).(bool power_down, float frametime);
1408
1409 /// global variables ****************************************
1410 // Telcom rendering globals
1411 static void (*TC_callbackcxx . . $ TC_callback.)() = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
1412 static int TC_current_screencxx . . $ TC_current_screen. = DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!;
1413 int TC_cursorcxx . . $ TC_cursor. = -1;
1414
1415 // Monitor hilight variables
1416 static int TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1417 static int *TelcomHiLitescxx . . $ TelcomHiLites.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1418 structcxx . . $ $anonymous_type_47c017155912d27c_0# {
1419 int xcxx . . $ $anonymous_type_47c017155912d27c_0#x., ycxx . . $ $anonymous_type_47c017155912d27c_0#y.;
1420 } TelcomHiLiteOffsetcxx . . $ TelcomHiLiteOffset.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1421 // Main monitor scanline info
1422 static float scanline_nexttimecxx . . $ scanline_nexttime., scanline_speedcxx . . $ scanline_speed.;
1423 static int scanlineycxx . . $ scanliney., scanline_handlecxx . . $ scanline_handle.;
1424 static float last_rendertimecxx . . $ last_rendertime. = 0;
1425 float last_frametimecxx . . $ last_frametime. = 0;
1426 // Monitor corner variables
1427 static chunked_bitmapcxx . . $ chunked_bitmap# lt_cornerscxx . . $ lt_corners.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1428 static chunked_bitmapcxx . . $ chunked_bitmap# rt_cornerscxx . . $ rt_corners.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1429 static chunked_bitmapcxx . . $ chunked_bitmap# lb_cornerscxx . . $ lb_corners.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1430 static chunked_bitmapcxx . . $ chunked_bitmap# rb_cornerscxx . . $ rb_corners.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1431 static bool has_cornerscxx . . $ has_corners.[MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!];
1432 // Screen variables
1433 static int TCWorking_screencxx . . $ TCWorking_screen.;
1434 // Static variables
1435 #define STATIC_BMPScxx . . $ `Descent3/TelCom.cpp:1435:9`! 12
1436 static int StaticBmpscxx . . $ StaticBmps.[STATIC_BMPScxx . . $ `Descent3/TelCom.cpp:1435:9`!];
1437 static bool Telcom_show_staticcxx . . $ Telcom_show_static. = false;
1438 static bool Telcom_static_last_framecxx . . $ Telcom_static_last_frame. = false;
1439 static float Telcom_static_settingcxx . . $ Telcom_static_setting. = 0;
1440 // Glitch variables
1441 static bool Telcom_show_glitchcxx . . $ Telcom_show_glitch. = false;
1442 static bool Telcom_glitch_screencxx . . $ Telcom_glitch_screen. = false;
1443 static float Telcom_glitch_settingcxx . . $ Telcom_glitch_setting. = 0;
1444 static float myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(float max);
1445 // Powereffect variables
1446 static int PowerBmpscxx . . $ PowerBmps.[2];
1447
1448 // Initializes the Telcom rendering engine
1449 void TelcomRenderInitcxx . . $ TelcomRenderInit(49f6e7a06ebc5aa8).(void) {
1450 for (int monitor = 0; monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!; monitor++) {
1451 ASSERTcxx . . $ `misc/pserror.h:246:9`!(monitor < windowmap.num_of_windows);
1452
1453 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].leftcxx . . $ box#left. = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].xcxx . . $ window_box#x.;
1454 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].topcxx . . $ box#top. = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].ycxx . . $ window_box#y.;
1455 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].rightcxx . . $ box#right. = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].xcxx . . $ window_box#x. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].widthcxx . . $ window_box#width.;
1456 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].bottomcxx . . $ box#bottom. = windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].ycxx . . $ window_box#y. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].heightcxx . . $ window_box#height.;
1457
1458 // Do we want to save these seperatly?
1459 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].leftcxx . . $ box#left. += windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].l_start_xcxx . . $ window_box#l_start_x. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].xcxx . . $ window_box#x.;
1460 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].rightcxx . . $ box#right. -=
1461 windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].xcxx . . $ window_box#x. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].widthcxx . . $ window_box#width. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].r_end_xcxx . . $ window_box#r_end_x.;
1462 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].topcxx . . $ box#top. += windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].t_top_ycxx . . $ window_box#t_top_y. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].ycxx . . $ window_box#y.;
1463 Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].bottomcxx . . $ box#bottom. -=
1464 windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].ycxx . . $ window_box#y. + windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].heightcxx . . $ window_box#height. - windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].b_bottom_ycxx . . $ window_box#b_bottom_y.;
1465 }
1466
1467 TC_callbackcxx . . $ TC_callback. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
1468 TC_current_screencxx . . $ TC_current_screen. = DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!;
1469 TelcomCreateScreenOverlayscxx . . $ TelcomCreateScreenOverlays(49f6e7a06ebc5aa8).();
1470 last_rendertimecxx . . $ last_rendertime. = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1471 TelcomCreateDummyScreencxx . . $ TelcomCreateDummyScreen(49f6e7a06ebc5aa8).();
1472 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1473 TelcomDisableGlitchcxx . . $ TelcomDisableGlitch(49f6e7a06ebc5aa8).();
1474 TelcomDisableStaticcxx . . $ TelcomDisableStatic(49f6e7a06ebc5aa8).();
1475 Telcom_first_rendercxx . . $ Telcom_first_render. = true;
1476 }
1477
1478 // Closes down the Telcom rendering engine
1479 void TelcomRenderClosecxx . . $ TelcomRenderClose(49f6e7a06ebc5aa8).(void) {
1480 TelcomDestroyScreenOverlayscxx . . $ TelcomDestroyScreenOverlays(49f6e7a06ebc5aa8).();
1481 TC_current_screencxx . . $ TC_current_screen. = DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!;
1482 }
1483
1484 // Renders the current screen for 1 frame
1485 void TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).(bool poweron, bool powerup, uint8_tcxx . . $ uint8_t# power_effect) {
1486 if (TC_current_screencxx . . $ TC_current_screen. == -1)
1487 return;
1488
1489 float frametime, newtime;
1490 newtime = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1491
1492 float cap_time = last_rendertimecxx . . $ last_rendertime. + (1.0f / FRAME_RATEcxx . . $ `Descent3/TelCom.cpp:526:9`!);
1493 if (cap_time > newtime) {
1494 Descentcxx . . $ Descent.->delaycxx . . $ oeApplication#delay(9364e6e7bff7660).(cap_time - newtime);
1495 newtime = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1496 }
1497
1498 frametime = newtime - last_rendertimecxx . . $ last_rendertime.;
1499 last_rendertimecxx . . $ last_rendertime. = newtime;
1500 last_frametimecxx . . $ last_frametime. = frametime;
1501
1502 if (Telcom_first_rendercxx . . $ Telcom_first_render.) {
1503 Telcom_first_rendercxx . . $ Telcom_first_render. = false;
1504 frametime = 0;
1505 }
1506
1507 StartFramecxx . . $ StartFrame(3285c9bef785d51c).(0, 0, Game_window_wcxx . . $ Game_window_w., Game_window_hcxx . . $ Game_window_h.);
1508
1509 if (Telcom_show_glitchcxx . . $ Telcom_show_glitch.) {
1510 if (((int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(100 * (1.0 - Telcom_glitch_settingcxx . . $ Telcom_glitch_setting.))) == 0) {
1511 Telcom_glitch_screencxx . . $ Telcom_glitch_screen. = true;
1512 glitch_dxcxx . . $ glitch_dx. = (int)(myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(20) - 10.0);
1513 glitch_dycxx . . $ glitch_dy. = (int)(myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(12) - 6.0);
1514 }
1515 }
1516
1517 // first render all the effects
1518 RenderScreencxx . . $ RenderScreen(b1f405cd48763783).(TC_current_screencxx . . $ TC_current_screen., &Telcom_systemcxx . . $ Telcom_system., frametime);
1519
1520 // call the callback if it exists to render anything on the monitor screen
1521 if (TC_callbackcxx . . $ TC_callback.)
1522 TC_callbackcxx . . $ TC_callback.();
1523
1524 // Render the screen overlays
1525 TelcomRenderOverlayscxx . . $ TelcomRenderOverlays(49f6e7a06ebc5aa8).();
1526
1527 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
1528
1529 switch (power_effect) {
1530 case 1:
1531 TelcomDoPowerEffectcxx . . $ TelcomDoPowerEffect(8927e202fc0ce9fc).(false, frametime);
1532 break;
1533 case 2:
1534 TelcomDoPowerEffectcxx . . $ TelcomDoPowerEffect(8927e202fc0ce9fc).(true, frametime);
1535 break;
1536 };
1537
1538 // Draw the TelCom System
1539 TelcomDrawScreencxx . . $ TelcomDrawScreen(b0b38cda41d4ede4).(poweron, powerup);
1540
1541 TelcomRenderMousecxx . . $ TelcomRenderMouse(49f6e7a06ebc5aa8).();
1542
1543 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
1544 rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).();
1545
1546 Telcom_glitch_screencxx . . $ Telcom_glitch_screen. = false;
1547 }
1548
1549 // Sets the callback of the Render. This will get called after Effects are drawn, before the screen overlays
1550 void TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(void (*callback)()) { TC_callbackcxx . . $ TC_callback. = callback; }
1551
1552 // Sets what screen should be drawn by the Telcom
1553 void TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(int screen) {
1554 ASSERTcxx . . $ `misc/pserror.h:246:9`!(screen >= 0 && screen < MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!);
1555
1556 if (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[screen] != SS_READYcxx . . $ `Descent3/TelCom.h:129:9`!) {
1557 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Telcom Warning: Trying to set screen %d active when it isn't ready\n", screen);
1558 return;
1559 }
1560 TC_current_screencxx . . $ TC_current_screen. = screen;
1561 }
1562
1563 // Creates a placeholder screen that can be used if no screens are available
1564 void TelcomCreateDummyScreencxx . . $ TelcomCreateDummyScreen(49f6e7a06ebc5aa8).(void) {
1565 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1566
1567 TCBKGDESCcxx . . $ TCBKGDESC# backg;
1568 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
1569 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
1570 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
1571 TCBMPDESCcxx . . $ TCBMPDESC# bmpdesc;
1572 bmpdesc.capscxx . . $ TCBMPDESC#caps. = 0;
1573 bmpdesc.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
1574 bmpdesc.flagscxx . . $ TCBMPDESC#flags. = 0;
1575 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "TelComInit.ogf");
1576 /*
1577 $$TABLE_GAMEFILE "TelComInit.ogf"
1578 */
1579 TCTEXTDESCcxx . . $ TCTEXTDESC# textdesc;
1580 textdesc.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_FADEcxx . . $ `Descent3/TelComEfxStructs.h:137:9`!;
1581 textdesc.flagscxx . . $ TCTEXTDESC#flags. = TC_TEXTF_INcxx . . $ `Descent3/TelComEfxStructs.h:154:9`!;
1582 textdesc.speedcxx . . $ TCTEXTDESC#speed. = 1.0f;
1583 textdesc.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
1584 textdesc.capscxx . . $ TCTEXTDESC#caps. = TCTD_TEXTBOXcxx . . $ `Descent3/TelComEfxStructs.h:111:9`! | TCTD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:107:9`! | TCTD_SPEEDcxx . . $ `Descent3/TelComEfxStructs.h:108:9`! | TCTD_FONTcxx . . $ `Descent3/TelComEfxStructs.h:106:9`!;
1585 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 25;
1586 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 540;
1587 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 113;
1588 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 260;
1589 textdesc.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
1590
1591 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1592 #ifdef DEMO
1593 // CreateTextEffect(&textdesc,TXT_TCINITIALIZING,MONITOR_MAIN,DUMMY_SCREEN);
1594 #else
1595 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, TXT_TCPLEASEWAITcxx . . $ `Descent3/stringtable.h:204:9`!, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1596 #endif
1597 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1598
1599 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
1600 }
1601
1602 // Creates a placeholder screen that can be used for startup
1603 void TelcomCreateStartupScreencxx . . $ TelcomCreateStartupScreen(49f6e7a06ebc5aa8).(void) {
1604 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1605
1606 TCBKGDESCcxx . . $ TCBKGDESC# backg;
1607 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
1608 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
1609 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
1610 TCBMPDESCcxx . . $ TCBMPDESC# bmpdesc;
1611 bmpdesc.capscxx . . $ TCBMPDESC#caps. = 0;
1612 bmpdesc.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
1613 bmpdesc.flagscxx . . $ TCBMPDESC#flags. = 0;
1614 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "TelComInit.ogf");
1615 /*
1616 $$TABLE_GAMEFILE "TelComInit.ogf"
1617 */
1618 TCTEXTDESCcxx . . $ TCTEXTDESC# textdesc;
1619 textdesc.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_FADEcxx . . $ `Descent3/TelComEfxStructs.h:137:9`!;
1620 textdesc.flagscxx . . $ TCTEXTDESC#flags. = TC_TEXTF_INcxx . . $ `Descent3/TelComEfxStructs.h:154:9`!;
1621 textdesc.speedcxx . . $ TCTEXTDESC#speed. = 1.0f;
1622 textdesc.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
1623 textdesc.capscxx . . $ TCTEXTDESC#caps. = TCTD_TEXTBOXcxx . . $ `Descent3/TelComEfxStructs.h:111:9`! | TCTD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:107:9`! | TCTD_SPEEDcxx . . $ `Descent3/TelComEfxStructs.h:108:9`! | TCTD_FONTcxx . . $ `Descent3/TelComEfxStructs.h:106:9`!;
1624 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 25;
1625 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 280;
1626 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 113;
1627 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 260;
1628 textdesc.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
1629
1630 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1631 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, TXT_TCPLEASEWAITcxx . . $ `Descent3/stringtable.h:204:9`!, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1632 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1633
1634 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
1635 }
1636
1637 // Creates a placeholder screen that can be used for shutdown
1638 void TelcomCreateShutdownScreencxx . . $ TelcomCreateShutdownScreen(49f6e7a06ebc5aa8).(void) {
1639 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1640
1641 TCBKGDESCcxx . . $ TCBKGDESC# backg;
1642 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
1643 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
1644 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
1645 TCBMPDESCcxx . . $ TCBMPDESC# bmpdesc;
1646 bmpdesc.capscxx . . $ TCBMPDESC#caps. = 0;
1647 bmpdesc.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
1648 bmpdesc.flagscxx . . $ TCBMPDESC#flags. = 0;
1649 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "TelComInit.ogf");
1650
1651 /*
1652 $$TABLE_GAMEFILE "TelComInit.ogf"
1653 */
1654 TCTEXTDESCcxx . . $ TCTEXTDESC# textdesc;
1655 textdesc.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_FADEcxx . . $ `Descent3/TelComEfxStructs.h:137:9`!;
1656 textdesc.flagscxx . . $ TCTEXTDESC#flags. = TC_TEXTF_INcxx . . $ `Descent3/TelComEfxStructs.h:154:9`!;
1657 textdesc.speedcxx . . $ TCTEXTDESC#speed. = 1.0f;
1658 textdesc.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
1659 textdesc.capscxx . . $ TCTEXTDESC#caps. = TCTD_TEXTBOXcxx . . $ `Descent3/TelComEfxStructs.h:111:9`! | TCTD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:107:9`! | TCTD_SPEEDcxx . . $ `Descent3/TelComEfxStructs.h:108:9`! | TCTD_FONTcxx . . $ `Descent3/TelComEfxStructs.h:106:9`!;
1660 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 25;
1661 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 280;
1662 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 113;
1663 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 260;
1664 textdesc.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
1665
1666 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1667 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, TXT_TCSHUTDOWNcxx . . $ `Descent3/stringtable.h:728:9`!, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1668 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
1669
1670 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
1671 }
1672
1673 // Enables Static on the Telcom main screen, setting is the probability of static happening
1674 void TelcomEnableStaticcxx . . $ TelcomEnableStatic(9364e6e7bff7660).(float setting) {
1675 Telcom_show_staticcxx . . $ Telcom_show_static. = true;
1676 Telcom_static_settingcxx . . $ Telcom_static_setting. = setting;
1677 }
1678
1679 // Disables static on the Telcom main screen
1680 void TelcomDisableStaticcxx . . $ TelcomDisableStatic(49f6e7a06ebc5aa8).(void) {
1681 Telcom_show_staticcxx . . $ Telcom_show_static. = false;
1682 // TCEndStaticSound();
1683 Telcom_static_last_framecxx . . $ Telcom_static_last_frame. = false;
1684 }
1685
1686 // Enables glitching on the Telcom main screen
1687 void TelcomEnableGlitchcxx . . $ TelcomEnableGlitch(9364e6e7bff7660).(float setting) {
1688 Telcom_show_glitchcxx . . $ Telcom_show_glitch. = true;
1689 Telcom_glitch_settingcxx . . $ Telcom_glitch_setting. = setting;
1690 }
1691
1692 // Disables glitching on the TelCom
1693 void TelcomDisableGlitchcxx . . $ TelcomDisableGlitch(49f6e7a06ebc5aa8).(void) { Telcom_show_glitchcxx . . $ Telcom_show_glitch. = false; }
1694
1695 #define NEON_STATEOFFcxx . . $ `Descent3/TelCom.cpp:1695:9`! 85.0
1696 #define NEON_OFFcxx . . $ `Descent3/TelCom.cpp:1696:9`! 0
1697 #define NEON_OFF2cxx . . $ `Descent3/TelCom.cpp:1697:9`! 1
1698 #define NEON_OFF3cxx . . $ `Descent3/TelCom.cpp:1698:9`! 2
1699 #define NEON_ON1cxx . . $ `Descent3/TelCom.cpp:1699:9`! 10
1700 #define NEON_ON2cxx . . $ `Descent3/TelCom.cpp:1700:9`! 11
1701 #define NEON_ON3cxx . . $ `Descent3/TelCom.cpp:1701:9`! 12
1702 #define NEON_ON1_TIMEcxx . . $ `Descent3/TelCom.cpp:1702:9`! 0.05
1703 #define NEON_OFF2_TIMEcxx . . $ `Descent3/TelCom.cpp:1703:9`! 0.02
1704 #define NEON_ON2_TIMEcxx . . $ `Descent3/TelCom.cpp:1704:9`! 0.03
1705 #define NEON_OFF3_TIMEcxx . . $ `Descent3/TelCom.cpp:1705:9`! 0.02
1706 // draws the telcom background, handles flickering lights, power button etc
1707 void TelcomDrawScreencxx . . $ TelcomDrawScreen(b0b38cda41d4ede4).(bool poweron, bool powerup) {
1708 static int neon_state = NEON_OFFcxx . . $ `Descent3/TelCom.cpp:1696:9`!;
1709 static float start_time = 0;
1710 static float off_time = 0, on_time = 0;
1711
1712 if (powerup) {
1713 neon_state = NEON_OFFcxx . . $ `Descent3/TelCom.cpp:1696:9`!;
1714 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1715 off_time = myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(5);
1716 }
1717
1718 switch (neon_state) {
1719 case NEON_OFFcxx . . $ `Descent3/TelCom.cpp:1696:9`!:
1720 if (((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - start_time) > off_time) && (myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(100.0) >= NEON_STATEOFFcxx . . $ `Descent3/TelCom.cpp:1695:9`!)) {
1721 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1722 neon_state = NEON_ON1cxx . . $ `Descent3/TelCom.cpp:1699:9`!;
1723 }
1724 break;
1725 case NEON_ON1cxx . . $ `Descent3/TelCom.cpp:1699:9`!:
1726 TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(TCSND_LIGHTBULBcxx . . $ `Descent3/TelCom.h:322:9`!);
1727 if ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - start_time) > NEON_ON1_TIMEcxx . . $ `Descent3/TelCom.cpp:1702:9`!) {
1728 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1729 neon_state = NEON_OFF2cxx . . $ `Descent3/TelCom.cpp:1697:9`!;
1730 }
1731 break;
1732 case NEON_OFF2cxx . . $ `Descent3/TelCom.cpp:1697:9`!:
1733 if ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - start_time) > NEON_OFF2_TIMEcxx . . $ `Descent3/TelCom.cpp:1703:9`!) {
1734 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1735 neon_state = NEON_ON2cxx . . $ `Descent3/TelCom.cpp:1700:9`!;
1736 }
1737 break;
1738 case NEON_ON2cxx . . $ `Descent3/TelCom.cpp:1700:9`!:
1739 if ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - start_time) > NEON_ON2_TIMEcxx . . $ `Descent3/TelCom.cpp:1704:9`!) {
1740 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1741 neon_state = NEON_OFF3cxx . . $ `Descent3/TelCom.cpp:1698:9`!;
1742 }
1743 break;
1744 case NEON_OFF3cxx . . $ `Descent3/TelCom.cpp:1698:9`!:
1745 if ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - start_time) > NEON_OFF3_TIMEcxx . . $ `Descent3/TelCom.cpp:1705:9`!) {
1746 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1747 neon_state = NEON_ON3cxx . . $ `Descent3/TelCom.cpp:1701:9`!;
1748 on_time = myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(3);
1749 }
1750 break;
1751 case NEON_ON3cxx . . $ `Descent3/TelCom.cpp:1701:9`!:
1752 if (((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - start_time) > on_time) && (myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(100.0) < NEON_STATEOFFcxx . . $ `Descent3/TelCom.cpp:1695:9`!)) {
1753 start_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
1754 neon_state = NEON_OFFcxx . . $ `Descent3/TelCom.cpp:1696:9`!;
1755 off_time = myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(5);
1756 }
1757 break;
1758 }
1759
1760 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
1761
1762 // draw telcom background
1763 rend_DrawChunkedBitmapcxx . . $ rend_DrawChunkedBitmap(529c7906ea1e7bf7).(&Telcom_bitmapcxx . . $ Telcom_bitmap., 0, 0, 255);
1764
1765 if (neon_state >= NEON_ON1cxx . . $ `Descent3/TelCom.cpp:1699:9`!)
1766 DrawHotSpotOncxx . . $ DrawHotSpotOn(d4f767463ce0a6b3).(NEON_LIGHTcxx . . $ `Descent3/TelCom.h:82:9`!);
1767 if (poweron)
1768 DrawHotSpotOncxx . . $ DrawHotSpotOn(d4f767463ce0a6b3).(POWER_BUTTONcxx . . $ `Descent3/TelCom.h:81:9`!);
1769
1770 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
1771
1772 TelcomDisplayCornerscxx . . $ TelcomDisplayCorners(49f6e7a06ebc5aa8).();
1773 }
1774
1775 // Allocates the bitmaps for corners of each monitor
1776 void TelcomCreateCornerscxx . . $ TelcomCreateCorners(49f6e7a06ebc5aa8).(void) {
1777 for (int monitor = 0; monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!; monitor++) {
1778 if ((windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].t_top_ycxx . . $ window_box#t_top_y. != -1) && (windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].b_top_ycxx . . $ window_box#b_top_y. != -1)) {
1779 bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].lt_bmpcxx . . $ window_box#lt_bmp., &lt_cornerscxx . . $ lt_corners.[monitor]);
1780 bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].rt_bmpcxx . . $ window_box#rt_bmp., &rt_cornerscxx . . $ rt_corners.[monitor]);
1781 bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].lb_bmpcxx . . $ window_box#lb_bmp., &lb_cornerscxx . . $ lb_corners.[monitor]);
1782 bm_CreateChunkedBitmapcxx . . $ bm_CreateChunkedBitmap(b9fa1b176cbdfaf1).(windowmapcxx . . $ windowmap..wmcxx . . $ windowmap_t#wm.[monitor].rb_bmpcxx . . $ window_box#rb_bmp., &rb_cornerscxx . . $ rb_corners.[monitor]);
1783 has_cornerscxx . . $ has_corners.[monitor] = true;
1784 } else {
1785 lt_cornerscxx . . $ lt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = lt_cornerscxx . . $ lt_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1786 rt_cornerscxx . . $ rt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = rt_cornerscxx . . $ rt_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1787 lb_cornerscxx . . $ lb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = lb_cornerscxx . . $ lb_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1788 rb_cornerscxx . . $ rb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = rb_cornerscxx . . $ rb_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1789 has_cornerscxx . . $ has_corners.[monitor] = false;
1790 }
1791 }
1792 }
1793
1794 // Frees the bitmaps used for the corners of each monitor
1795 void TelcomFreeCornerscxx . . $ TelcomFreeCorners(49f6e7a06ebc5aa8).(void) {
1796 for (int monitor = 0; monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!; monitor++) {
1797 if (!has_cornerscxx . . $ has_corners.[monitor])
1798 continue;
1799
1800 // destroy the chunked bitmaps of the corners
1801 if (lt_cornerscxx . . $ lt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. != 0) {
1802 bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&lt_cornerscxx . . $ lt_corners.[monitor]);
1803 lt_cornerscxx . . $ lt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = lt_cornerscxx . . $ lt_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1804 }
1805 if (rt_cornerscxx . . $ rt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. != 0) {
1806 bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&rt_cornerscxx . . $ rt_corners.[monitor]);
1807 rt_cornerscxx . . $ rt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = rt_cornerscxx . . $ rt_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1808 }
1809 if (lb_cornerscxx . . $ lb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. != 0) {
1810 bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&lb_cornerscxx . . $ lb_corners.[monitor]);
1811 lb_cornerscxx . . $ lb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = lb_cornerscxx . . $ lb_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1812 }
1813 if (rb_cornerscxx . . $ rb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. != 0) {
1814 bm_DestroyChunkedBitmapcxx . . $ bm_DestroyChunkedBitmap(1635f60f4d3c1317).(&rb_cornerscxx . . $ rb_corners.[monitor]);
1815 rb_cornerscxx . . $ rb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw. = rb_cornerscxx . . $ rb_corners.[monitor].phcxx . . $ chunked_bitmap#ph. = 0;
1816 }
1817 }
1818 }
1819
1820 void TelcomDisplayCornerscxx . . $ TelcomDisplayCorners(49f6e7a06ebc5aa8).(void) {
1821 for (int monitor = 0; monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!; monitor++) {
1822 if (!has_cornerscxx . . $ has_corners.[monitor])
1823 continue;
1824
1825 int left = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].leftcxx . . $ box#left.;
1826 int right = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].rightcxx . . $ box#right.;
1827 int top = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].topcxx . . $ box#top.;
1828 int bottom = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].bottomcxx . . $ box#bottom.;
1829
1830 BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(left, top, &lt_cornerscxx . . $ lt_corners.[monitor]);
1831 BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(right - rt_cornerscxx . . $ rt_corners.[monitor].pwcxx . . $ chunked_bitmap#pw., top, &rt_cornerscxx . . $ rt_corners.[monitor]);
1832 BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(left, bottom - lb_cornerscxx . . $ lb_corners.[monitor].phcxx . . $ chunked_bitmap#ph., &lb_cornerscxx . . $ lb_corners.[monitor]);
1833 BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(right - rb_cornerscxx . . $ rb_corners.[monitor].pwcxx . . $ chunked_bitmap#pw., bottom - rb_cornerscxx . . $ rb_corners.[monitor].phcxx . . $ chunked_bitmap#ph., &rb_cornerscxx . . $ rb_corners.[monitor]);
1834 }
1835 }
1836
1837 const char *hilitescxx . . $ hilites.[] = {"hilite0", "hilite1", "hilite2", "hilite3", "hilite4", "hilite5", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!};
1838 const char *smhilitescxx . . $ smhilites.[] = {"smhilite01", "smhilite11", "smhilite21", "smhilite31", "smhilite41",
1839 "smhilite51", "smhilite61", "smhilite71", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!};
1840
1841 /*
1842 $$TABLE_TEXTURE "hilite0"
1843 $$TABLE_TEXTURE "hilite1"
1844 $$TABLE_TEXTURE "hilite2"
1845 $$TABLE_TEXTURE "hilite3"
1846 $$TABLE_TEXTURE "hilite4"
1847 $$TABLE_TEXTURE "hilite5"
1848 $$TABLE_TEXTURE "smhilite01"
1849 $$TABLE_TEXTURE "smhilite11"
1850 $$TABLE_TEXTURE "smhilite21"
1851 $$TABLE_TEXTURE "smhilite31"
1852 $$TABLE_TEXTURE "smhilite41"
1853 $$TABLE_TEXTURE "smhilite51"
1854 $$TABLE_TEXTURE "smhilite61"
1855 $$TABLE_TEXTURE "smhilite71"
1856 */
1857
1858 // Creates the screen overlays for the main monitor
1859 void TelcomCreateScreenOverlayscxx . . $ TelcomCreateScreenOverlays(49f6e7a06ebc5aa8).(void) {
1860 TelcomLoadHiLitescxx . . $ TelcomLoadHiLites(5f82b7a869a95a4e).(hilitescxx . . $ hilites., MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 130, -2);
1861 TelcomLoadHiLitescxx . . $ TelcomLoadHiLites(5f82b7a869a95a4e).(smhilitescxx . . $ smhilites., MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0, -8);
1862
1863 TelcomCreateScanLinecxx . . $ TelcomCreateScanLine(49f6e7a06ebc5aa8).();
1864 TelcomLoadMouseCursorcxx . . $ TelcomLoadMouseCursor(49f6e7a06ebc5aa8).();
1865 TelcomCreateCornerscxx . . $ TelcomCreateCorners(49f6e7a06ebc5aa8).();
1866 // TelcomCreateStaticOverlays();
1867 TelcomInitPowerEffectcxx . . $ TelcomInitPowerEffect(49f6e7a06ebc5aa8).();
1868 }
1869
1870 // Destroys the screen overlays that were used for the main monitor
1871 void TelcomDestroyScreenOverlayscxx . . $ TelcomDestroyScreenOverlays(49f6e7a06ebc5aa8).(void) {
1872 TelcomFreeHiLitescxx . . $ TelcomFreeHiLites(49f6e7a06ebc5aa8).();
1873 TelcomDestroyScanLinecxx . . $ TelcomDestroyScanLine(49f6e7a06ebc5aa8).();
1874 TelcomFreeMouseCursorcxx . . $ TelcomFreeMouseCursor(49f6e7a06ebc5aa8).();
1875 TelcomFreeCornerscxx . . $ TelcomFreeCorners(49f6e7a06ebc5aa8).();
1876 // TelcomFreeStaticOverlays();
1877 TelcomFreePowerEffectcxx . . $ TelcomFreePowerEffect(49f6e7a06ebc5aa8).();
1878 }
1879
1880 #define HIGH_STATICcxx . . $ `Descent3/TelCom.cpp:1880:9`! 50.0
1881 #define NEG_CUTcxx . . $ `Descent3/TelCom.cpp:1881:9`! 40.0
1882 #define LOW_LEVELcxx . . $ `Descent3/TelCom.cpp:1882:9`! -20.0
1883 #define HIGH_LEVELcxx . . $ `Descent3/TelCom.cpp:1883:9`! 40.0
1884 // Renders the screen overlays
1885 void TelcomRenderOverlayscxx . . $ TelcomRenderOverlays(49f6e7a06ebc5aa8).(void) {
1886 static float stat = 0;
1887
1888 TelcomRenderScanlinecxx . . $ TelcomRenderScanline(49f6e7a06ebc5aa8).();
1889 TelcomRenderDrawHiLitescxx . . $ TelcomRenderDrawHiLites(49f6e7a06ebc5aa8).();
1890
1891 // Display static
1892 if (Telcom_show_staticcxx . . $ Telcom_show_static.) {
1893 stat += (myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(HIGH_STATICcxx . . $ `Descent3/TelCom.cpp:1880:9`!) - NEG_CUTcxx . . $ `Descent3/TelCom.cpp:1881:9`!);
1894 if (stat > 0) {
1895 Telcom_static_last_framecxx . . $ Telcom_static_last_frame. = true;
1896 float amp = stat * Telcom_static_settingcxx . . $ Telcom_static_setting. / HIGH_STATICcxx . . $ `Descent3/TelCom.cpp:1880:9`!;
1897 // TCStartStaticSound(amp);
1898 TelcomDisplayStaticcxx . . $ TelcomDisplayStatic(9364e6e7bff7660).(amp);
1899 } else {
1900 if (Telcom_glitch_screencxx . . $ Telcom_glitch_screen.) {
1901 float amp = myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(1) - 0.3;
1902 Telcom_static_last_framecxx . . $ Telcom_static_last_frame. = true;
1903 // TCStartStaticSound(amp);
1904 TelcomDisplayStaticcxx . . $ TelcomDisplayStatic(9364e6e7bff7660).(amp);
1905 } else {
1906 /*
1907 if(Telcom_static_last_frame)
1908 TCEndStaticSound();
1909 */
1910 Telcom_static_last_framecxx . . $ Telcom_static_last_frame. = false;
1911 }
1912 }
1913
1914 if (stat > HIGH_STATICcxx . . $ `Descent3/TelCom.cpp:1880:9`!)
1915 stat = HIGH_LEVELcxx . . $ `Descent3/TelCom.cpp:1883:9`!;
1916 if (stat < LOW_LEVELcxx . . $ `Descent3/TelCom.cpp:1882:9`!)
1917 stat = 0;
1918 }
1919 }
1920
1921 // Renders the screen hilights
1922 void TelcomRenderDrawHiLitescxx . . $ TelcomRenderDrawHiLites(49f6e7a06ebc5aa8).(void) {
1923 float alphas[4];
1924
1925 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:413:9`!);
1926 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(120);
1927 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
1928 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
1929 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
1930 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
1931 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
1932
1933 alphas[0] = 0.3f;
1934 alphas[1] = 0.3f;
1935 alphas[2] = 0;
1936 alphas[3] = 0;
1937
1938 for (int monitor = 0; monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!; monitor++) {
1939 if ((!TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor]) || (!TelcomHiLitescxx . . $ TelcomHiLites.[monitor]))
1940 continue;
1941
1942 int curr_x, curr_y, i, w, h;
1943 int *HiLites;
1944
1945 curr_x = TelcomHiLiteOffsetcxx . . $ TelcomHiLiteOffset.[monitor].xcxx . . $ $anonymous_type_47c017155912d27c_0#x. + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].leftcxx . . $ box#left.;
1946 curr_y = TelcomHiLiteOffsetcxx . . $ TelcomHiLiteOffset.[monitor].ycxx . . $ $anonymous_type_47c017155912d27c_0#y. + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[monitor].topcxx . . $ box#top.;
1947 HiLites = TelcomHiLitescxx . . $ TelcomHiLites.[monitor];
1948
1949 for (i = 0; i < TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor]; i++) {
1950 w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(HiLites[i], 0);
1951 h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(HiLites[i], 0);
1952 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(curr_x, curr_y, curr_x + w, curr_y + h, HiLites[i], 0, 0, 1, 1, -1, alphas);
1953 curr_x += w;
1954 }
1955 }
1956
1957 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
1958 }
1959
1960 // Loads the Hilites for a monitor
1961 void TelcomLoadHiLitescxx . . $ TelcomLoadHiLites(5f82b7a869a95a4e).(const char *filelist[], int monitor, int xoff, int yoff) {
1962 if (!filelist)
1963 return;
1964 ASSERTcxx . . $ `misc/pserror.h:246:9`!(monitor >= 0 && monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!);
1965
1966 TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor] = 0;
1967 while (filelist[TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor]])
1968 TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor]++;
1969
1970 if (!TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor])
1971 TelcomHiLitescxx . . $ TelcomHiLites.[monitor] = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
1972
1973 TelcomHiLitescxx . . $ TelcomHiLites.[monitor] = (int *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(int) * TelcomHiLiteCount[monitor]);
1974 if (!TelcomHiLitescxx . . $ TelcomHiLites.[monitor]) {
•1975 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to allocate memory for HiLites monitor=%d\n", monitor);
1976 TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor] = 0;
1977 return;
1978 }
1979
1980 int *HiLites;
1981 HiLites = TelcomHiLitescxx . . $ TelcomHiLites.[monitor];
1982 for (int i = 0; i < TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor]; i++) {
1983 HiLites[i] = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(filelist[i]));
1984 if (HiLites[i] == -1)
1985 HiLites[i] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!;
1986 else
1987 HiLites[i] = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(HiLites[i], 0);
1988 }
1989
1990 TelcomHiLiteOffsetcxx . . $ TelcomHiLiteOffset.[monitor].xcxx . . $ $anonymous_type_47c017155912d27c_0#x. = xoff;
1991 TelcomHiLiteOffsetcxx . . $ TelcomHiLiteOffset.[monitor].ycxx . . $ $anonymous_type_47c017155912d27c_0#y. = yoff;
1992 }
1993
1994 // Frees all the memory allocated for the hilites
1995 void TelcomFreeHiLitescxx . . $ TelcomFreeHiLites(49f6e7a06ebc5aa8).(void) {
1996 int *HiLites;
1997 for (int monitor = 0; monitor < MAX_MONITORcxx . . $ `Descent3/TelCom.h:100:9`!; monitor++) {
1998 HiLites = TelcomHiLitescxx . . $ TelcomHiLites.[monitor];
1999
2000 if (HiLites) {
2001 mem_freecxx . . $ `mem/mem.h:80:9`!(HiLites);
2002 }
2003 TelcomHiLiteCountcxx . . $ TelcomHiLiteCount.[monitor] = 0;
2004 }
2005 }
2006
2007 // Renders the scanline to be drawn
2008 void TelcomRenderScanlinecxx . . $ TelcomRenderScanline(49f6e7a06ebc5aa8).(void) {
2009 if (scanline_handlecxx . . $ scanline_handle. <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
2010 return;
2011
2012 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:413:9`!);
2013 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(120);
2014 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2015 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
2016 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2017 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
2018 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
2019
2020 int x, end_x, start_x;
2021 float alphas[4];
2022 alphas[0] = 0;
2023 alphas[1] = 0;
2024 alphas[2] = 0.05f;
2025 alphas[3] = 0.05f;
2026
2027 start_x = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
2028 end_x = start_x + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].rightcxx . . $ box#right. - Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
2029
2030 float end_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
2031
2032 while (end_time > scanline_nexttimecxx . . $ scanline_nexttime.) {
2033 for (x = start_x; x < end_x; x += 32)
2034 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x, scanlineycxx . . $ scanliney., x + 32, scanlineycxx . . $ scanliney. + 16, scanline_handlecxx . . $ scanline_handle., 0, 0, 1, 1, -1, alphas);
2035 scanlineycxx . . $ scanliney.++;
2036 scanline_nexttimecxx . . $ scanline_nexttime. += scanline_speedcxx . . $ scanline_speed.;
2037 }
2038
2039 if (scanlineycxx . . $ scanliney. > Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom.)
2040 scanlineycxx . . $ scanliney. = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top. - 32;
2041
2042 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
2043 }
2044
2045 // Creates the scanline
2046 void TelcomCreateScanLinecxx . . $ TelcomCreateScanLine(49f6e7a06ebc5aa8).(void) {
2047 scanlineycxx . . $ scanliney. = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top. - 32;
2048 scanline_speedcxx . . $ scanline_speed. = 1.0f / 50.0f;
2049 scanline_nexttimecxx . . $ scanline_nexttime. = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() + scanline_speedcxx . . $ scanline_speed.;
2050 scanline_handlecxx . . $ scanline_handle. = bm_AllocBitmapcxx . . $ bm_AllocBitmap(2326284602b0bb2d).(32, 32, 0);
2051
2052 if (scanline_handlecxx . . $ scanline_handle. <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
2053 return;
2054 }
2055
2056 int start_pixel;
2057 start_pixel = 0;
2058
2059 uint16_tcxx . . $ uint16_t# *data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(scanline_handlecxx . . $ scanline_handle., 0);
2060
2061 int x, y;
2062 for (y = 0; y < 32; y++) {
2063 for (x = 0; x < 32; x++) {
2064 if (y >= start_pixel)
2065 data[y * 32 + x] = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(128, 128, 200);
2066 else
2067 data[y * 32 + x] = NEW_TRANSPARENT_COLORcxx . . $ `lib/grdefs.h:71:9`!;
2068 }
2069 }
2070 }
2071
2072 // Destroys the scanline
2073 void TelcomDestroyScanLinecxx . . $ TelcomDestroyScanLine(49f6e7a06ebc5aa8).(void) {
2074 if (scanline_handlecxx . . $ scanline_handle. <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
2075 return;
2076
2077 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(scanline_handlecxx . . $ scanline_handle.);
2078 scanline_handlecxx . . $ scanline_handle. = -1;
2079 }
2080
2081 // Loads the mouse cursor
2082 void TelcomLoadMouseCursorcxx . . $ TelcomLoadMouseCursor(49f6e7a06ebc5aa8).(void) {
2083 TC_cursorcxx . . $ TC_cursor. = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).("StdCursor.ogf", 0);
2084 if (TC_cursorcxx . . $ TC_cursor. == -1)
2085 TC_cursorcxx . . $ TC_cursor. = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!;
2086 }
2087
2088 // Renders the mouse cursor
2089 void TelcomRenderMousecxx . . $ TelcomRenderMouse(49f6e7a06ebc5aa8).(void) {
2090 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2091 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2092 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
2093 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
2094 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`! + AT_TEXTUREcxx . . $ `lib/renderer.h:401:9`!);
2095 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
2096
2097 if (TC_cursorcxx . . $ TC_cursor. > -1) {
2098 int mx, my;
2099 mx = Telcom_mouse_xcxx . . $ Telcom_mouse_x.;
2100 my = Telcom_mouse_ycxx . . $ Telcom_mouse_y.;
2101
2102 float u0 = 0.0f, v0 = 0.0f, u1 = 1.0f, v1 = 1.0f;
2103 int cur_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(TC_cursorcxx . . $ TC_cursor., 0);
2104 int cur_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(TC_cursorcxx . . $ TC_cursor., 0);
2105
2106 if (mx > (Game_window_wcxx . . $ Game_window_w. - cur_w))
2107 u1 = ((float)(Game_window_wcxx . . $ Game_window_w. - mx)) / ((float)cur_w);
2108 if (my > (Game_window_hcxx . . $ Game_window_h. - cur_h))
2109 v1 = ((float)(Game_window_hcxx . . $ Game_window_h. - my)) / ((float)cur_h);
2110
2111 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(mx, my, mx + (int)((float)cur_w * u1), my + (int)((float)cur_h * v1), TC_cursorcxx . . $ TC_cursor., u0, v0, u1,
2112 v1);
2113 }
2114 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1);
2115 }
2116
2117 // Creates the static bitmap overlays
2118 void TelcomCreateStaticOverlayscxx . . $ TelcomCreateStaticOverlays(49f6e7a06ebc5aa8).(void) {
2119 int i;
2120 for (i = 0; i < STATIC_BMPScxx . . $ `Descent3/TelCom.cpp:1435:9`!; i++)
2121 StaticBmpscxx . . $ StaticBmps.[i] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!;
2122
2123 int j;
2124 int size;
2125 int saturation = 10;
2126 int result;
2127 float amount;
2128 uint16_tcxx . . $ uint16_t# *data[8];
2129
2130 amount = ((float)saturation) * 0.4f;
2131
2132 uint16_tcxx . . $ uint16_t# def_color = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(24, 255, 0);
2133
2134 size = 64 * 64;
2135 for (i = 0; i < 4; i++) {
2136 // last 4 bitmaps
2137 StaticBmpscxx . . $ StaticBmps.[i + 8] = bm_AllocBitmapcxx . . $ bm_AllocBitmap(2326284602b0bb2d).(64, 64, 0);
2138 data[i + 4] = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(StaticBmpscxx . . $ StaticBmps.[i + 8], 0);
2139
2140 // middle 4 bitmaps
2141 StaticBmpscxx . . $ StaticBmps.[i + 4] = bm_AllocBitmapcxx . . $ bm_AllocBitmap(2326284602b0bb2d).(64, 64, 0);
2142 data[i] = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(StaticBmpscxx . . $ StaticBmps.[i + 4], 0);
2143
2144 // first 4 bitmaps
2145 StaticBmpscxx . . $ StaticBmps.[i] = bm_AllocBitmapcxx . . $ bm_AllocBitmap(2326284602b0bb2d).(128, 128, 0);
2146 data[i] = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(StaticBmpscxx . . $ StaticBmps.[i], 0);
2147 }
2148
2149 float t = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
2150
2151 for (j = 0; j < size; j++) {
2152 for (i = 0; i < 4; i++) {
2153
2154 // last 4 bitmaps
2155 result = (int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(amount);
2156 if (!result) {
2157 if ((int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(5) == 3)
2158 data[i + 4][j] = def_color;
2159 else {
2160 uint8_tcxx . . $ uint8_t# grey = (uint8_tcxx . . $ uint8_t#)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(200) + 55;
2161 data[i + 4][j] = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(grey, grey, grey);
2162 }
2163 } else
2164 data[i + 4][j] = NEW_TRANSPARENT_COLORcxx . . $ `lib/grdefs.h:71:9`!;
2165
2166 // middle 4 bitmaps
2167 ps_srandcxx . . $ ps_srand(cb2f890c2fdad230).(t * 674338);
2168 result = (int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(amount);
2169 if (!result) {
2170 if ((int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(5) == 3)
2171 data[i][j] = def_color;
2172 else {
2173 uint8_tcxx . . $ uint8_t# grey = (uint8_tcxx . . $ uint8_t#)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(200) + 55;
2174 data[i][j] = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(grey, grey, grey);
2175 }
2176 } else
2177 data[i][j] = NEW_TRANSPARENT_COLORcxx . . $ `lib/grdefs.h:71:9`!;
2178 }
2179 }
2180
2181 // first 4 bitmaps
2182 size = 128 * 128;
2183 for (j = 0; j < size; j++) {
2184 for (i = 0; i < 4; i++) {
2185 ps_srandcxx . . $ ps_srand(cb2f890c2fdad230).((t * 43243 + ps_randcxx . . $ ps_rand(b126dc7c1de90089).()));
2186 result = (int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(amount);
2187 if (!result) {
2188 if ((int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(5) == 3)
2189 data[i][j] = def_color;
2190 else {
2191 uint8_tcxx . . $ uint8_t# grey = (uint8_tcxx . . $ uint8_t#)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(200) + 55;
2192 data[i][j] = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(grey, grey, grey);
2193 }
2194 } else
2195 data[i][j] = NEW_TRANSPARENT_COLORcxx . . $ `lib/grdefs.h:71:9`!;
2196 }
2197 }
2198 }
2199
2200 // Frees the static bitmap overlays
2201 void TelcomFreeStaticOverlayscxx . . $ TelcomFreeStaticOverlays(49f6e7a06ebc5aa8).(void) {
2202 for (int i = 0; i < STATIC_BMPScxx . . $ `Descent3/TelCom.cpp:1435:9`!; i++)
2203 if ((StaticBmpscxx . . $ StaticBmps.[i] != -1) && (StaticBmpscxx . . $ StaticBmps.[i] != BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!))
2204 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(StaticBmpscxx . . $ StaticBmps.[i]);
2205 }
2206
2207 // Displays static on the screen
2208 void TelcomDisplayStaticcxx . . $ TelcomDisplayStatic(9364e6e7bff7660).(float alpha) {
2209 int x, y;
2210 int height = (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom.) - (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.);
2211 int width = (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].rightcxx . . $ box#right.) - (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.);
2212 int type;
2213
2214 if (alpha < 0)
2215 alpha = 0;
2216 if (alpha > 1)
2217 alpha = 1;
2218
2219 type = (int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(21);
2220 if ((type < 7))
2221 type = 0;
2222 else if ((type < 14))
2223 type = 4;
2224 else
2225 type = 8;
2226
2227 int xoff = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
2228 int yoff = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.;
2229
2230 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
2231 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha * 255.0);
2232 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2233 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
2234 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2235 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
2236 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
2237
2238 int dy = ((int)myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(32)) - 16;
2239
2240 int h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(StaticBmpscxx . . $ StaticBmps.[type], 0);
2241 int w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(StaticBmpscxx . . $ StaticBmps.[type], 0);
2242 int j = 0;
2243 for (y = dy; y < height; y += h)
2244 for (x = 0; x < width; x += w) {
2245 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x + xoff, y + yoff, x + w + xoff, y + h + yoff, StaticBmpscxx . . $ StaticBmps.[type + (j % 4)], 0, 0, 1, 1);
2246 h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(StaticBmpscxx . . $ StaticBmps.[type + (j % 4)], 0);
2247 w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(StaticBmpscxx . . $ StaticBmps.[type + (j % 4)], 0);
2248 j++;
2249 }
2250
2251 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
2252 }
2253
2254 // Frees the mouse cursor
2255 void TelcomFreeMouseCursorcxx . . $ TelcomFreeMouseCursor(49f6e7a06ebc5aa8).(void) {
2256 // remove the mouse cursor
2257 if (TC_cursorcxx . . $ TC_cursor. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
2258 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(TC_cursorcxx . . $ TC_cursor.);
2259 TC_cursorcxx . . $ TC_cursor. = -1;
2260 }
2261 }
2262
2263 float TC_effect_positioncxx . . $ TC_effect_position.;
2264
2265 // Initializes the bitmaps, etc needed for power up/down effect
2266 void TelcomInitPowerEffectcxx . . $ TelcomInitPowerEffect(49f6e7a06ebc5aa8).(void) {
2267 PowerBmpscxx . . $ PowerBmps.[0] = bm_AllocBitmapcxx . . $ bm_AllocBitmap(2326284602b0bb2d).(32, 32, 0);
2268 if (PowerBmpscxx . . $ PowerBmps.[0] == -1)
2269 return;
2270
2271 int i;
2272 uint16_tcxx . . $ uint16_t# *bmpdata = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(PowerBmpscxx . . $ PowerBmps.[0], 0);
2273 for (i = 0; i < 32 * 32; i++)
2274 bmpdata[i] = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 0, 0);
2275
2276 PowerBmpscxx . . $ PowerBmps.[1] = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("TelcomPowerbar");
2277 if (PowerBmpscxx . . $ PowerBmps.[1] == -1)
2278 return;
2279 PowerBmpscxx . . $ PowerBmps.[1] = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(PowerBmpscxx . . $ PowerBmps.[1], 0);
2280 TC_effect_positioncxx . . $ TC_effect_position. = 0;
2281 }
2282
2283 // Frees the bitmaps, etc for power up/down effect
2284 void TelcomFreePowerEffectcxx . . $ TelcomFreePowerEffect(49f6e7a06ebc5aa8).(void) {
2285 if ((PowerBmpscxx . . $ PowerBmps.[0] != -1) && (PowerBmpscxx . . $ PowerBmps.[0] != BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!))
2286 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(PowerBmpscxx . . $ PowerBmps.[0]);
2287 }
2288
2289 #define TCPE_STARTcxx . . $ `Descent3/TelCom.cpp:2289:9`! 0.1f
2290 #define TCPE_STAGE1cxx . . $ `Descent3/TelCom.cpp:2290:9`! 0.3f
2291 #define TCPE_STAGE2cxx . . $ `Descent3/TelCom.cpp:2291:9`! 0.8f
2292 #define TCPE_ENDcxx . . $ `Descent3/TelCom.cpp:2292:9`! 1.0f
2293
2294 // Draws a frame of the power up/down effect
2295 void TelcomDoPowerEffectcxx . . $ TelcomDoPowerEffect(8927e202fc0ce9fc).(bool power_down, float frametime) {
2296 int height = (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom.) - (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.);
2297 int width = (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].rightcxx . . $ box#right.) - (Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.);
2298 int xoff = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
2299 int yoff = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.;
2300
2301 if (!power_down && TC_effect_positioncxx . . $ TC_effect_position. >= TCPE_STAGE2cxx . . $ `Descent3/TelCom.cpp:2291:9`!)
2302 goto tcpe_adjust;
2303
2304 // draw the power effect at it's current state
2305 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
2306 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
2307 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
2308 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
2309 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
2310 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
2311 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
2312 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
2313
2314 if (TC_effect_positioncxx . . $ TC_effect_position. <= TCPE_STAGE1cxx . . $ `Descent3/TelCom.cpp:2290:9`!) {
2315 // stage 1
2316 int i, x, y;
2317 int line_count = (TC_effect_positioncxx . . $ TC_effect_position. - TCPE_STARTcxx . . $ `Descent3/TelCom.cpp:2289:9`!) / (TCPE_STAGE1cxx . . $ `Descent3/TelCom.cpp:2290:9`! - TCPE_STARTcxx . . $ `Descent3/TelCom.cpp:2289:9`!) * ((float)((width / 32) + 3));
2318 if (line_count < 0)
2319 line_count = 0;
2320
2321 for (y = 0; y < height; y += 32)
2322 for (x = 0; x < width; x += 32) {
2323 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x + xoff, y + yoff, x + 32 + xoff, y + 32 + yoff, PowerBmpscxx . . $ PowerBmps.[0], 0, 0, 1, 1);
2324 }
2325
2326 if (TC_effect_positioncxx . . $ TC_effect_position. < TCPE_STARTcxx . . $ `Descent3/TelCom.cpp:2289:9`!)
2327 goto tcpe_adjust;
2328
2329 x = (width / 2) - (16 * line_count) + xoff;
2330 y = (height / 2) - 16 + yoff;
2331
2332 for (i = 0; i < line_count; i++) {
2333 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x, y, x + 32, y + 32, PowerBmpscxx . . $ PowerBmps.[1], 0, 0, 1, 1);
2334 x += 32;
2335 }
2336 } else {
2337 // stage 2
2338 int x, y, i;
2339 int gap;
2340
2341 gap = ((float)height) * (TC_effect_positioncxx . . $ TC_effect_position. - TCPE_STAGE1cxx . . $ `Descent3/TelCom.cpp:2290:9`!) / (TCPE_STAGE2cxx . . $ `Descent3/TelCom.cpp:2291:9`! - TCPE_STAGE1cxx . . $ `Descent3/TelCom.cpp:2290:9`!);
2342 int hcount = ((((float)height) / 2.0f) - (((float)gap) / 2.0f)) / 32.0f;
2343
2344 for (i = 0; i < hcount; i++)
2345 for (x = 0; x < width; x += 32) {
2346 y = (i << 5);
2347 if (i == (hcount - 1)) {
2348 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
2349 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x + xoff, y + 10 + yoff, x + 32 + xoff, y + 42 + yoff, PowerBmpscxx . . $ PowerBmps.[1], 0, 0, 1, 1);
2350 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
2351 }
2352 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x + xoff, y + yoff, x + 32 + xoff, y + 32 + yoff, PowerBmpscxx . . $ PowerBmps.[0], 0, 0, 1, 1);
2353 }
2354
2355 y = height - 32;
2356 for (i = 0; i < hcount; i++) {
2357 for (x = 0; x < width; x += 32) {
2358 if (i == (hcount - 1)) {
2359 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
2360 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x + xoff, y - 10 + yoff, x + 32 + xoff, y + 22 + yoff, PowerBmpscxx . . $ PowerBmps.[1], 0, 0, 1, 1);
2361 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
2362 }
2363 rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(x + xoff, y + yoff, x + 32 + xoff, y + 32 + yoff, PowerBmpscxx . . $ PowerBmps.[0], 0, 0, 1, 1);
2364 }
2365 y -= 32;
2366 }
2367 }
2368
2369 tcpe_adjust:
2370
2371 // Now adjust effect
2372 if (power_down)
2373 frametime = -frametime;
2374
2375 frametime = frametime / TCPE_TIMEcxx . . $ `Descent3/TelCom.cpp:527:9`!; // scale it to a percentage of total time
2376
2377 TC_effect_positioncxx . . $ TC_effect_position. += frametime;
2378 if (TC_effect_positioncxx . . $ TC_effect_position. < 0)
2379 TC_effect_positioncxx . . $ TC_effect_position. = 0;
2380 if (TC_effect_positioncxx . . $ TC_effect_position. > 1)
2381 TC_effect_positioncxx . . $ TC_effect_position. = 1;
2382
2383 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
2384 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1);
2385 }
2386
2387 /***************************************************
2388 * TelCom Event Handling
2389 ***************************************************
2390 */
2391
2392 // returns the true if there is a next screen (from the current)
2393 static bool TelComIsThereANextScreencxx . . $ TelComIsThereANextScreen(c9857a73d68e59ba).(void);
2394
2395 /*
2396 * Initializes the TelCom Event manager system
2397 * Call this as soon as possible
2398 * You can call it whenever the events need to be flushed
2399 */
2400 void TelComInitEventManagercxx . . $ TelComInitEventManager(49f6e7a06ebc5aa8).(void) {
2401 int i;
2402
2403 for (i = 0; i < MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!; i++) {
2404 Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i].idcxx . . $ tTCEvent#id. = -1;
2405 }
2406 for (i = 0; i < TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!; i++) {
2407 Telcom_systemcxx . . $ Telcom_system..Telcom_systemkey_statescxx . . $ tTelComInfo#Telcom_systemkey_states.[i] = false;
2408 }
2409
2410 // Setup the key translation table
2411 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_TABcxx . . $ `Descent3/TelCom.h:103:9`!] = KEY_TABcxx . . $ `ddio/ddio_common.h:270:9`!;
2412 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_UPcxx . . $ `Descent3/TelCom.h:104:9`!] = KEY_UPcxx . . $ `ddio/ddio_common.h:318:9`!;
2413 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_DOWNcxx . . $ `Descent3/TelCom.h:105:9`!] = KEY_DOWNcxx . . $ `ddio/ddio_common.h:319:9`!;
2414 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_LEFTcxx . . $ `Descent3/TelCom.h:106:9`!] = KEY_LEFTcxx . . $ `ddio/ddio_common.h:320:9`!;
2415 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_RIGHTcxx . . $ `Descent3/TelCom.h:107:9`!] = KEY_RIGHTcxx . . $ `ddio/ddio_common.h:321:9`!;
2416 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_ENTERcxx . . $ `Descent3/TelCom.h:108:9`!] = KEY_ENTERcxx . . $ `ddio/ddio_common.h:268:9`!;
2417 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_SPACEcxx . . $ `Descent3/TelCom.h:109:9`!] = KEY_SPACEBARcxx . . $ `ddio/ddio_common.h:271:9`!;
2418 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_Qcxx . . $ `Descent3/TelCom.h:110:9`!] = KEY_Qcxx . . $ `ddio/ddio_common.h:245:9`!;
2419 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_F1cxx . . $ `Descent3/TelCom.h:111:9`!] = KEY_F1cxx . . $ `ddio/ddio_common.h:282:9`!;
2420 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_F2cxx . . $ `Descent3/TelCom.h:112:9`!] = KEY_F2cxx . . $ `ddio/ddio_common.h:283:9`!;
2421 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_F3cxx . . $ `Descent3/TelCom.h:113:9`!] = KEY_F3cxx . . $ `ddio/ddio_common.h:284:9`!;
2422 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_PRINTSCRNcxx . . $ `Descent3/TelCom.h:114:9`!] = KEY_PRINT_SCREENcxx . . $ `ddio/ddio_common.h:322:9`!;
2423 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_1cxx . . $ `Descent3/TelCom.h:115:9`!] = KEY_1cxx . . $ `ddio/ddio_common.h:220:9`!;
2424 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_2cxx . . $ `Descent3/TelCom.h:116:9`!] = KEY_2cxx . . $ `ddio/ddio_common.h:221:9`!;
2425 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_3cxx . . $ `Descent3/TelCom.h:117:9`!] = KEY_3cxx . . $ `ddio/ddio_common.h:222:9`!;
2426 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_4cxx . . $ `Descent3/TelCom.h:118:9`!] = KEY_4cxx . . $ `ddio/ddio_common.h:223:9`!;
2427 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_5cxx . . $ `Descent3/TelCom.h:119:9`!] = KEY_5cxx . . $ `ddio/ddio_common.h:224:9`!;
2428 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_6cxx . . $ `Descent3/TelCom.h:120:9`!] = KEY_6cxx . . $ `ddio/ddio_common.h:225:9`!;
2429 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_7cxx . . $ `Descent3/TelCom.h:121:9`!] = KEY_7cxx . . $ `ddio/ddio_common.h:226:9`!;
2430 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_8cxx . . $ `Descent3/TelCom.h:122:9`!] = KEY_8cxx . . $ `ddio/ddio_common.h:227:9`!;
2431 Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[TCSYS_REVERSETABcxx . . $ `Descent3/TelCom.h:123:9`!] = KEY_TABcxx . . $ `ddio/ddio_common.h:270:9`! + KEY_SHIFTEDcxx . . $ `ddio/ddio_common.h:208:9`!;
2432
2433 Telcom_systemcxx . . $ Telcom_system..Telcom_mouse_downtimecxx . . $ tTelComInfo#Telcom_mouse_downtime. = 0;
2434 }
2435
2436 /*
2437 * Enables/Disables a TelCom system key, pass in TCSYS_MAXKEYS to enable/disable all keys
2438 *
2439 */
2440 void TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(int key, bool enable) {
2441 if (key < 0 || key > TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!)
2442 return;
2443
2444 int bit = 0x01;
2445
2446 if (key == TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!) {
2447 bit = 0xFFFFFFFF;
2448 } else {
2449 bit = (bit << key);
2450 }
2451
2452 if (enable)
2453 Telcom_systemcxx . . $ Telcom_system..TelComSysKeyEnablecxx . . $ tTelComInfo#TelComSysKeyEnable. |= bit;
2454 else
2455 Telcom_systemcxx . . $ Telcom_system..TelComSysKeyEnablecxx . . $ tTelComInfo#TelComSysKeyEnable. &= ~bit;
2456 }
2457
2458 /*
2459 * Calling this sends an event message to the TelCom, adding it to it's event queue
2460 *
2461 */
2462 void TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(int event_num, int parm1, int parm2) {
2463 for (int i = 0; i < MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!; i++) {
2464 if (Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i].idcxx . . $ tTCEvent#id. == -1) {
2465 // add the event here
2466 Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i].idcxx . . $ tTCEvent#id. = event_num;
2467 Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i].parmscxx . . $ tTCEvent#parms.[0] = parm1;
2468 Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i].parmscxx . . $ tTCEvent#parms.[1] = parm2;
2469 return;
2470 }
2471 }
2472
2473 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Warning: TelCom Event Queue Overflow\n");
2474 }
2475
2476 /*
2477 * Call this when handling the TelCom system events, returns true if there is an event waiting, it will then fill
2478 * in the passed struct. You should call this repeatedly until a value of false is returned, signaling no more
2479 * events in the queue
2480 */
2481 bool TelComPopEventcxx . . $ TelComPopEvent(2cd38c003880a92c).(tTCEventcxx . . $ tTCEvent# *evt) {
2482 if (Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[0].idcxx . . $ tTCEvent#id. != -1) {
2483 memcpy(evt, &Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[0], sizeof(tTCEventcxx . . $ tTCEvent#));
2484
2485 // move all items up in the queue
2486 for (int i = 1; i < MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!; i++) {
2487 memcpy(&Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i - 1], &Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[i], sizeof(tTCEventcxx . . $ tTCEvent#));
2488 }
2489 Telcom_systemcxx . . $ Telcom_system..Telcom_event_queuecxx . . $ tTelComInfo#Telcom_event_queue.[MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`! - 1].idcxx . . $ tTCEvent#id. = -1;
2490 return true;
2491 }
2492
2493 return false;
2494 }
2495
2496 /*
2497 * Forces an effect to have focus (if is allowed to have focus)
2498 *
2499 */
2500 void TelComSetFocusOnEffectcxx . . $ TelComSetFocusOnEffect(d4f767463ce0a6b3).(int efxnum) {
2501 int screen;
2502 int effect_with_focus;
2503
2504 if (TCEffectscxx . . $ TCEffects.[efxnum].typecxx . . $ tceffect#type. == EFX_NONEcxx . . $ `Descent3/TelComEffects.h:140:9`!)
2505 return;
2506
2507 screen = TCEffectscxx . . $ TCEffects.[efxnum].screencxx . . $ tceffect#screen.;
2508
2509 if (TCEffectscxx . . $ TCEffects.[efxnum].has_focuscxx . . $ tceffect#has_focus.)
2510 return; // already has focus
2511
2512 if (!TCEffectscxx . . $ TCEffects.[efxnum].tab_stopcxx . . $ tceffect#tab_stop.)
2513 return; // not allowed to have focus
2514
2515 // find the effect on the screen with focus
2516 int i = Screen_rootscxx . . $ Screen_roots.[screen];
2517 effect_with_focus = -1;
2518
2519 while (i != -1) {
2520 if (TCEffectscxx . . $ TCEffects.[i].tab_stopcxx . . $ tceffect#tab_stop. && TCEffectscxx . . $ TCEffects.[i].has_focuscxx . . $ tceffect#has_focus.) {
2521 effect_with_focus = i;
2522 break;
2523 }
2524
2525 i = TCEffectscxx . . $ TCEffects.[i].nextcxx . . $ tceffect#next.;
2526 }
2527
2528 bool send_click = false;
2529
2530 if (TCEffectscxx . . $ TCEffects.[efxnum].flagscxx . . $ tceffect#flags. & OBF_CHANGEFOCUSISCLICKcxx . . $ `Descent3/TelComEfxStructs.h:307:9`!)
2531 send_click = true;
2532
2533 // send out our events and process focus change
2534 if (i != -1)
2535 TCEffectscxx . . $ TCEffects.[i].has_focuscxx . . $ tceffect#has_focus. = false;
2536 TCEffectscxx . . $ TCEffects.[efxnum].has_focuscxx . . $ tceffect#has_focus. = true;
2537
2538 if (i != -1)
2539 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(i, TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!);
2540 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!);
2541
2542 if (send_click)
2543 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_MOUSECLICKcxx . . $ `Descent3/TelComEffects.h:159:9`!);
2544 }
2545
2546 /*
2547 * This should be called once a frame, it will handle all events in the TelCom system and send off any system
2548 * events to the effects/buttons
2549 */
2550 #define TELCOM_FRAMERATE_CAPcxx . . $ `Descent3/TelCom.cpp:2550:9`! 25.0f
2551 void GameFramecxx . . $ GameFrame(49f6e7a06ebc5aa8).(void);
2552 void TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(tTelComInfocxx . . $ tTelComInfo# *tcs) {
2553 static float last_frame_time = 0;
2554 float frame_time;
2555
2556 volatile float curr_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
2557 volatile float next_time = last_frame_time + (1 / TELCOM_FRAMERATE_CAPcxx . . $ `Descent3/TelCom.cpp:2550:9`!);
2558
2559 if (curr_time < next_time) {
2560 Sleepcxx . . $ Sleep(d4f767463ce0a6b3).((next_time - curr_time) * 1000.0f);
2561 }
2562 if (last_frame_time == 0) {
2563 frame_time = 0.1f;
2564 }
2565 frame_time = curr_time - last_frame_time;
2566 last_frame_time = curr_time;
2567
2568 // First handle all events that the TelCom system has waiting
2569 tTCEventcxx . . $ tTCEvent# event;
2570 while (TelComPopEventcxx . . $ TelComPopEvent(2cd38c003880a92c).(&event)) {
2571 // handle the event
2572 switch (event.idcxx . . $ tTCEvent#id.) {
2573 case -1:
2574 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TelCom Error: Trying to process an event of type -1\n");
2575 Int3cxx . . $ `misc/pserror.h:247:9`!(); // Hey!! How'd we pop off a -1!!! Get Jeff
2576 break;
2577 case TEVT_TCQUITcxx . . $ `Descent3/TelComEffects.h:162:9`!: {
2578 // the user wants to quit out of the TelCom
2579 tcs->current_statuscxx . . $ tTelComInfo#current_status. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
2580 } break;
2581 case TEVT_SCREENSHOTcxx . . $ `Descent3/TelComEffects.h:168:9`!: {
2582 // take a screenshot
2583 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Taking Screenshot\n");
2584 DoScreenshotcxx . . $ DoScreenshot(49f6e7a06ebc5aa8).();
2585 } break;
2586 case TEVT_TCNEXTcxx . . $ `Descent3/TelComEffects.h:163:9`!: {
2587 // the user wants to go to the next screen
2588 if (TelcomAdvanceScreencxx . . $ TelcomAdvanceScreen(c9857a73d68e59ba).() && tcs->current_statuscxx . . $ tTelComInfo#current_status. == TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`! && !Telcom_called_from_gamecxx . . $ Telcom_called_from_game.) {
2589 // exit out of TelCom
2590 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
2591 }
2592 } break;
2593 case TEVT_TCPREVcxx . . $ `Descent3/TelComEffects.h:164:9`!: {
2594 // the user wants to go to the prev screen
2595 TelcomBackupScreencxx . . $ TelcomBackupScreen(c9857a73d68e59ba).();
2596 } break;
2597 case TEVT_TCJUMPcxx . . $ `Descent3/TelComEffects.h:165:9`!: {
2598 int screen = event.parmscxx . . $ tTCEvent#parms.[0];
2599 ASSERTcxx . . $ `misc/pserror.h:246:9`!(screen >= 0 && screen < MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!);
2600
2601 // the user wants to jump to a screen
2602 TelComJumpScreencxx . . $ TelComJumpScreen(83c267b20bac841a).(screen);
2603 } break;
2604 case TEVT_FAKEKEYPRESScxx . . $ `Descent3/TelComEffects.h:169:9`!: {
2605 TelComHandleKeyPresscxx . . $ TelComHandleKeyPress(46dd98b1bd92177a).(event.parmscxx . . $ tTCEvent#parms.[0], true, TC_current_screencxx . . $ TC_current_screen.);
2606 } break;
2607 default:
2608 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TelCom System Warning: Unhandled event %d\n", event.id);
2609 break;
2610 }
2611 }
2612
2613 // Now that all the events for the TelCom system have been handled, send off any events that need
2614 // to be sent to the effects or buttons
2615
2616 // First check all TelCom system keys
2617 int screen = TC_current_screencxx . . $ TC_current_screen.;
2618 int key;
2619
2620 if ((KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_LSHIFTcxx . . $ `ddio/ddio_common.h:275:9`!) || KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_RSHIFTcxx . . $ `ddio/ddio_common.h:276:9`!)) && KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!)) {
2621 Telcom_exit_to_mainmenucxx . . $ Telcom_exit_to_mainmenu. = true;
2622 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
2623 }
2624
2625 int i;
2626 bool processed[TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!];
2627 for (i = 0; i < TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!; i++)
2628 processed[i] = false;
2629
2630 TelCom_PrepareCustomKeyEventscxx . . $ TelCom_PrepareCustomKeyEvents(49f6e7a06ebc5aa8).();
2631
2632 while ((key = ddio_KeyInKeycxx . . $ ddio_KeyInKey(b126dc7c1de90089).()) != 0) {
2633 for (i = 0; i < TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!; i++) {
2634 TelCom_ProcessCustomKeyEventcxx . . $ TelCom_ProcessCustomKeyEvent(d4f767463ce0a6b3).(key);
2635
2636 if (Telcom_systemcxx . . $ Telcom_system..TranslateSysKeycxx . . $ tTelComInfo#TranslateSysKey.[i] != key)
2637 continue;
2638
2639 if (!Telcom_systemcxx . . $ Telcom_system..Telcom_systemkey_statescxx . . $ tTelComInfo#Telcom_systemkey_states.[i]) {
2640 // the key has just been pressed, handle button press
2641 TelComHandleKeyPresscxx . . $ TelComHandleKeyPress(46dd98b1bd92177a).(i, true, screen);
2642 }
2643
2644 if (Telcom_systemcxx . . $ Telcom_system..Telcom_systemkey_statescxx . . $ tTelComInfo#Telcom_systemkey_states.[i]) {
2645 // the key is being held down, handle button down
2646 TelComHandleKeyPresscxx . . $ TelComHandleKeyPress(46dd98b1bd92177a).(i, false, screen);
2647 }
2648 Telcom_systemcxx . . $ Telcom_system..Telcom_systemkey_statescxx . . $ tTelComInfo#Telcom_systemkey_states.[i] = true;
2649 processed[i] = true;
2650 }
2651 }
2652
2653 for (i = 0; i < TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!; i++) {
2654 if (!processed[i]) {
2655 Telcom_systemcxx . . $ Telcom_system..Telcom_systemkey_statescxx . . $ tTelComInfo#Telcom_systemkey_states.[i] = false;
2656 }
2657 }
2658
2659 TelCom_PostProcessCustomKeyEventscxx . . $ TelCom_PostProcessCustomKeyEvents(49f6e7a06ebc5aa8).();
2660
2661 // Now check mouse position and button state
2662 int x, y;
2663 int buttons;
2664 int effect_clicktype;
2665 float frametime;
2666
2667 if (Control_poll_flagcxx . . $ Control_poll_flag.) {
2668 buttons = Controllercxx . . $ Controller.->get_mouse_raw_valuescxx . . $ gameController#get_mouse_raw_values(aa23d0250da59a45).(&x, &y);
2669 } else {
2670 buttons = ddio_MouseGetStatecxx . . $ ddio_MouseGetState(150f8a26046a094b).(&x, &y, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
2671 }
2672
2673 Telcom_mouse_xcxx . . $ Telcom_mouse_x. = x;
2674 Telcom_mouse_ycxx . . $ Telcom_mouse_y. = y;
2675
2676 // check to see if the power button was clicked
2677 if (!buttons && Telcom_systemcxx . . $ Telcom_system..Telcom_mouse_downtimecxx . . $ tTelComInfo#Telcom_mouse_downtime. > 0 && (x >= HotSpotLcxx . . $ HotSpotL(7864480464b09eea).(POWER_BUTTONcxx . . $ `Descent3/TelCom.h:81:9`!)) &&
2678 (x <= HotSpotRcxx . . $ HotSpotR(7864480464b09eea).(POWER_BUTTONcxx . . $ `Descent3/TelCom.h:81:9`!)) && (y >= HotSpotTcxx . . $ HotSpotT(7864480464b09eea).(POWER_BUTTONcxx . . $ `Descent3/TelCom.h:81:9`!)) && (y <= HotSpotBcxx . . $ HotSpotB(7864480464b09eea).(POWER_BUTTONcxx . . $ `Descent3/TelCom.h:81:9`!))) {
2679 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
2680 }
2681
2682 frametime = last_frametimecxx . . $ last_frametime.;
2683
2684 // see if the mouse is over any button
2685 int efxnum = FindButtonEffectByXYcxx . . $ FindButtonEffectByXY(2326284602b0bb2d).(x, y, screen);
2686
2687 if (efxnum != -1) {
2688 // check to see if this is the effect num the mouse was last over, if not, then
2689 // register it as mouse enter
2690 if (Telcom_mouse_last_effectcxx . . $ Telcom_mouse_last_effect. != efxnum) {
2691 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_MOUSEENTERcxx . . $ `Descent3/TelComEffects.h:170:9`!);
2692 Telcom_mouse_last_effectcxx . . $ Telcom_mouse_last_effect. = efxnum;
2693 }
2694
2695 // the mouse is over a button
2696 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_MOUSEOVERcxx . . $ `Descent3/TelComEffects.h:158:9`!);
2697
2698 effect_clicktype = TCEffectscxx . . $ TCEffects.[efxnum].buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..click_typecxx . . $ tButtonInfo#click_type.;
2699
2700 if (buttons) {
2701 if (effect_clicktype == CLICKTYPE_DOWNcxx . . $ `Descent3/TelComEffects.h:189:9`!) {
2702 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_MOUSEDOWNcxx . . $ `Descent3/TelComEffects.h:160:9`!);
2703 } else if (Telcom_systemcxx . . $ Telcom_system..Telcom_mouse_downtimecxx . . $ tTelComInfo#Telcom_mouse_downtime. == 0 && effect_clicktype == CLICKTYPE_CLICKDOWNcxx . . $ `Descent3/TelComEffects.h:187:9`!) {
2704 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_MOUSECLICKcxx . . $ `Descent3/TelComEffects.h:159:9`!);
2705 }
2706 } else {
2707 if (Telcom_systemcxx . . $ Telcom_system..Telcom_mouse_downtimecxx . . $ tTelComInfo#Telcom_mouse_downtime. > 0 && effect_clicktype == CLICKTYPE_CLICKUPcxx . . $ `Descent3/TelComEffects.h:188:9`!) {
2708 // send the mouse up event
2709 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_MOUSEUPcxx . . $ `Descent3/TelComEffects.h:161:9`!);
2710 }
2711 }
2712 } else {
2713 // the mouse is not over any effect, reset it's efxnum owner (we can do a mouseleave event here)
2714 Telcom_mouse_last_effectcxx . . $ Telcom_mouse_last_effect. = -1;
2715 }
2716
2717 if (buttons) {
2718 Telcom_systemcxx . . $ Telcom_system..Telcom_mouse_downtimecxx . . $ tTelComInfo#Telcom_mouse_downtime. += frametime;
2719 } else {
2720 Telcom_systemcxx . . $ Telcom_system..Telcom_mouse_downtimecxx . . $ tTelComInfo#Telcom_mouse_downtime. = 0;
2721 }
2722
2723 // If we are calling the telcom from inside the game, than we have some processing to do
2724 if (Telcom_called_from_gamecxx . . $ Telcom_called_from_game. && (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) {
2725 // Process all game frames
2726 if (!Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu.)
2727 GameFramecxx . . $ GameFrame(49f6e7a06ebc5aa8).();
2728
2729 // If we are in a multiplayer game and we have been told to bail, than do so!
2730 if (Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu.) {
2731 tcs->current_statuscxx . . $ tTelComInfo#current_status. = TS_OFFcxx . . $ `Descent3/TelCom.h:79:9`!;
2732 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
2733 }
2734 }
2735
2736 // handle music if in game.
2737 if (Telcom_called_from_gamecxx . . $ Telcom_called_from_game.) {
2738 tMusicSeqInfocxx . . $ tMusicSeqInfo# music_info;
2739 music_info.frametimecxx . . $ tMusicSeqInfo#frametime. = frame_time;
2740 music_info.player_deadcxx . . $ tMusicSeqInfo#player_dead. = false;
2741 music_info.started_levelcxx . . $ tMusicSeqInfo#started_level. = false;
2742 D3MusicDoFramecxx . . $ D3MusicDoFrame(54ecf43cdccad508).(&music_info);
2743 }
2744 }
2745
2746 /*
2747 * Given the key that has been pressed, or being held down, it processes the event depending on what key
2748 * it is.
2749 *
2750 */
2751
2752 extern int AM_terraincxx . . $ AM_terrain., AM_realigncxx . . $ AM_realign., AM_center_on_playercxx . . $ AM_center_on_player., AM_current_markercxx . . $ AM_current_marker.;
2753 void TelComHandleKeyPresscxx . . $ TelComHandleKeyPress(46dd98b1bd92177a).(int key, bool click, int screen_id) {
2754 int bit = 0x01;
2755 bit = (bit << key);
2756 if (!(Telcom_systemcxx . . $ Telcom_system..TelComSysKeyEnablecxx . . $ tTelComInfo#TelComSysKeyEnable. & bit))
2757 return;
2758
2759 switch (key) {
2760 case TCSYS_REVERSETABcxx . . $ `Descent3/TelCom.h:123:9`!: {
2761 if (!click)
2762 break;
2763
2764 int first = -1, curr_focus = -1;
2765 int i = Screen_rootscxx . . $ Screen_roots.[screen_id];
2766
2767 while (i != -1) {
2768 if (TCEffectscxx . . $ TCEffects.[i].tab_stopcxx . . $ tceffect#tab_stop.) {
2769 // this is effect is a tab stop
2770 if (first == -1)
2771 first = i;
2772 if (TCEffectscxx . . $ TCEffects.[i].has_focuscxx . . $ tceffect#has_focus.) {
2773 // this effect is the one with focus
2774 curr_focus = i;
2775 break;
2776 }
2777 }
2778 i = TCEffectscxx . . $ TCEffects.[i].nextcxx . . $ tceffect#next.;
2779 }
2780
2781 if (curr_focus == -1) {
2782 // none currently have focus!, make the effect we found (if any) have focus
2783 if (first != -1) {
2784 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(first, TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!);
2785 TCEffectscxx . . $ TCEffects.[first].has_focuscxx . . $ tceffect#has_focus. = true;
2786 }
2787 break; // our work is done here
2788 }
2789
2790 bool done = false;
2791 int end_node = Screen_rootscxx . . $ Screen_roots.[screen_id];
2792 int t = end_node;
2793 if (t == -1) {
2794 Int3cxx . . $ `misc/pserror.h:247:9`!();
2795 break;
2796 }
2797
2798 while (!done) {
2799 if (TCEffectscxx . . $ TCEffects.[t].nextcxx . . $ tceffect#next. == -1) {
2800 done = true;
2801 end_node = t;
2802 } else {
2803 t = TCEffectscxx . . $ TCEffects.[t].nextcxx . . $ tceffect#next.;
2804 }
2805 }
2806
2807 done = false;
2808 int new_focus = -1;
2809 while (!done) {
2810 if (i == -1) {
2811 // start back at the end of the monitor list
2812 i = end_node;
2813 } else
2814 i = TCEffectscxx . . $ TCEffects.[i].prevcxx . . $ tceffect#prev.;
2815
2816 if (i == curr_focus)
2817 done = true;
2818 else {
2819 if (TCEffectscxx . . $ TCEffects.[i].tab_stopcxx . . $ tceffect#tab_stop.) {
2820 // we found another effect on the screen
2821 new_focus = i;
2822 done = true;
2823 }
2824 }
2825 }
2826
2827 if (new_focus == -1) {
2828 // there is only 1 button on this screen, no change of focus
2829 break;
2830 }
2831 bool send_click = false;
2832
2833 if (TCEffectscxx . . $ TCEffects.[new_focus].flagscxx . . $ tceffect#flags. & OBF_CHANGEFOCUSISCLICKcxx . . $ `Descent3/TelComEfxStructs.h:307:9`!)
2834 send_click = true;
2835
2836 // send out our events and process focus change
2837 TCEffectscxx . . $ TCEffects.[curr_focus].has_focuscxx . . $ tceffect#has_focus. = false;
2838 TCEffectscxx . . $ TCEffects.[new_focus].has_focuscxx . . $ tceffect#has_focus. = true;
2839 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(new_focus, TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!);
2840
2841 if (send_click)
2842 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(new_focus, TEVT_MOUSECLICKcxx . . $ `Descent3/TelComEffects.h:159:9`!);
2843 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(curr_focus, TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!);
2844
2845 } break;
2846 case TCSYS_TABcxx . . $ `Descent3/TelCom.h:103:9`!: {
2847 if (!click)
2848 break;
2849
2850 int first = -1, curr_focus = -1;
2851 int i = Screen_rootscxx . . $ Screen_roots.[screen_id];
2852
2853 while (i != -1) {
2854 if (TCEffectscxx . . $ TCEffects.[i].tab_stopcxx . . $ tceffect#tab_stop.) {
2855 // this is effect is a tab stop
2856 if (first == -1)
2857 first = i;
2858 if (TCEffectscxx . . $ TCEffects.[i].has_focuscxx . . $ tceffect#has_focus.) {
2859 // this effect is the one with focus
2860 curr_focus = i;
2861 break;
2862 }
2863 }
2864 i = TCEffectscxx . . $ TCEffects.[i].nextcxx . . $ tceffect#next.;
2865 }
2866
2867 if (curr_focus == -1) {
2868 // none currently have focus!, make the effect we found (if any) have focus
2869 if (first != -1) {
2870 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(first, TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!);
2871 TCEffectscxx . . $ TCEffects.[first].has_focuscxx . . $ tceffect#has_focus. = true;
2872 }
2873 break; // our work is done here
2874 }
2875
2876 bool done = false;
2877 int new_focus = -1;
2878 while (!done) {
2879 if (i == -1) {
2880 // start back at the beginning of the monitor list
2881 i = Screen_rootscxx . . $ Screen_roots.[screen_id];
2882 } else
2883 i = TCEffectscxx . . $ TCEffects.[i].nextcxx . . $ tceffect#next.;
2884
2885 if (i == curr_focus)
2886 done = true;
2887 else {
2888 if (TCEffectscxx . . $ TCEffects.[i].tab_stopcxx . . $ tceffect#tab_stop.) {
2889 // we found another effect on the screen
2890 new_focus = i;
2891 done = true;
2892 }
2893 }
2894 }
2895
2896 if (new_focus == -1) {
2897 // there is only 1 button on this screen, no change of focus
2898 break;
2899 }
2900 bool send_click = false;
2901
2902 if (TCEffectscxx . . $ TCEffects.[new_focus].flagscxx . . $ tceffect#flags. & OBF_CHANGEFOCUSISCLICKcxx . . $ `Descent3/TelComEfxStructs.h:307:9`!)
2903 send_click = true;
2904
2905 // send out our events and process focus change
2906 TCEffectscxx . . $ TCEffects.[curr_focus].has_focuscxx . . $ tceffect#has_focus. = false;
2907 TCEffectscxx . . $ TCEffects.[new_focus].has_focuscxx . . $ tceffect#has_focus. = true;
2908 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(new_focus, TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!);
2909
2910 if (send_click)
2911 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(new_focus, TEVT_MOUSECLICKcxx . . $ `Descent3/TelComEffects.h:159:9`!);
2912 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(curr_focus, TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!);
2913 } break;
2914 case TCSYS_UPcxx . . $ `Descent3/TelCom.h:104:9`!:
2915 case TCSYS_DOWNcxx . . $ `Descent3/TelCom.h:105:9`!: {
2916 int curr_focus = -1;
2917 int node = Screen_rootscxx . . $ Screen_roots.[screen_id];
2918 while (node != -1) {
2919 if (TCEffectscxx . . $ TCEffects.[node].has_focuscxx . . $ tceffect#has_focus.) {
2920 // this guy has focus
2921 curr_focus = node;
2922 break;
2923 }
2924 node = TCEffectscxx . . $ TCEffects.[node].nextcxx . . $ tceffect#next.;
2925 }
2926
2927 if (curr_focus == -1) {
2928 // nothing has focus
2929 break;
2930 }
2931
2932 bool need_to_find_text = false;
2933
2934 // the up/down arrow keys require either a text box to have focus
2935 // or an up/down arrow to have focus
2936 if (TCEffectscxx . . $ TCEffects.[curr_focus].typecxx . . $ tceffect#type. != EFX_BUTTONcxx . . $ `Descent3/TelComEffects.h:153:9`! && TCEffectscxx . . $ TCEffects.[curr_focus].typecxx . . $ tceffect#type. != EFX_TEXT_STATICcxx . . $ `Descent3/TelComEffects.h:141:9`! &&
2937 TCEffectscxx . . $ TCEffects.[curr_focus].typecxx . . $ tceffect#type. != EFX_TEXT_TYPEcxx . . $ `Descent3/TelComEffects.h:142:9`! && TCEffectscxx . . $ TCEffects.[curr_focus].typecxx . . $ tceffect#type. != EFX_TEXT_FADEcxx . . $ `Descent3/TelComEffects.h:143:9`!) {
2938 // we don't have a text box or a button as focus
2939 need_to_find_text = true;
2940 }
2941
2942 if (TCEffectscxx . . $ TCEffects.[curr_focus].typecxx . . $ tceffect#type. == EFX_BUTTONcxx . . $ `Descent3/TelComEffects.h:153:9`! && TCEffectscxx . . $ TCEffects.[curr_focus].buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..button_typecxx . . $ tButtonInfo#button_type. != BUTT_UPARROWcxx . . $ `Descent3/TelComEffects.h:178:9`! &&
2943 TCEffectscxx . . $ TCEffects.[curr_focus].buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..button_typecxx . . $ tButtonInfo#button_type. != BUTT_DOWNARROWcxx . . $ `Descent3/TelComEffects.h:179:9`!) {
2944 // we have a button, but it's not an up/down arrow
2945 need_to_find_text = true;
2946 }
2947
2948 if (need_to_find_text) {
2949 // we need to hunt through the effect list, find the first text box with a tabstop
2950 // and use that as the text to scroll
2951 int found = -1;
2952 int node = Screen_rootscxx . . $ Screen_roots.[screen_id];
2953 while (node != -1) {
2954 if (TCEffectscxx . . $ TCEffects.[node].has_focuscxx . . $ tceffect#has_focus.) {
2955 // this guy has focus
2956 found = node;
2957 break;
2958 }
2959 node = TCEffectscxx . . $ TCEffects.[node].nextcxx . . $ tceffect#next.;
2960 }
2961
2962 if (found == -1) {
2963 // we found nothing, we're done
2964 break;
2965 }
2966 curr_focus = found;
2967 }
2968
2969 // if the effect to use (curr_focus) is a button, than get it's parent ID, make sure it is a text effect
2970 if (TCEffectscxx . . $ TCEffects.[curr_focus].typecxx . . $ tceffect#type. == EFX_BUTTONcxx . . $ `Descent3/TelComEffects.h:153:9`!) {
2971 int parent_id = TCEffectscxx . . $ TCEffects.[curr_focus].buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..parentcxx . . $ tButtonInfo#parent.;
2972 if (parent_id == -1 ||
2973 (TCEffectscxx . . $ TCEffects.[parent_id].typecxx . . $ tceffect#type. != EFX_TEXT_STATICcxx . . $ `Descent3/TelComEffects.h:141:9`! && TCEffectscxx . . $ TCEffects.[parent_id].typecxx . . $ tceffect#type. != EFX_TEXT_TYPEcxx . . $ `Descent3/TelComEffects.h:142:9`! &&
2974 TCEffectscxx . . $ TCEffects.[parent_id].typecxx . . $ tceffect#type. != EFX_TEXT_FADEcxx . . $ `Descent3/TelComEffects.h:143:9`!)) {
2975 // there is no parent, or it's not a text effect
2976 break;
2977 }
2978
2979 curr_focus = parent_id;
2980 }
2981
2982 // when we get here curr_focus should be pointing to a text effect to scroll
2983 ASSERTcxx . . $ `misc/pserror.h:246:9`!(curr_focus >= 0 && curr_focus < MAX_TCEFFECTScxx . . $ `Descent3/TelComEffects.h:135:9`!);
2984 ASSERTcxx . . $ `misc/pserror.h:246:9`!(TCEffects[curr_focus].type == EFX_TEXT_STATICcxx . . $ `Descent3/TelComEffects.h:141:9`! || TCEffects[curr_focus].type == EFX_TEXT_TYPEcxx . . $ `Descent3/TelComEffects.h:142:9`! ||
2985 TCEffects[curr_focus].type == EFX_TEXT_FADEcxx . . $ `Descent3/TelComEffects.h:143:9`!);
2986 ASSERTcxx . . $ `misc/pserror.h:246:9`!(TCEffects[curr_focus].tab_stop);
2987
2988 if (key == TCSYS_UPcxx . . $ `Descent3/TelCom.h:104:9`!) {
2989 // scroll up
2990 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(curr_focus, TEVT_SCROLLUPcxx . . $ `Descent3/TelComEffects.h:167:9`!);
2991 } else {
2992 // scroll down
2993 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(curr_focus, TEVT_SCROLLDOWNcxx . . $ `Descent3/TelComEffects.h:166:9`!);
2994 }
2995 } break;
2996 case TCSYS_LEFTcxx . . $ `Descent3/TelCom.h:106:9`!: {
2997 if (!click)
2998 break;
2999 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCPREVcxx . . $ `Descent3/TelComEffects.h:164:9`!);
3000 } break;
3001 case TCSYS_SPACEcxx . . $ `Descent3/TelCom.h:109:9`!: {
3002 if (!click)
3003 break;
3004 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCNEXTcxx . . $ `Descent3/TelComEffects.h:163:9`!);
3005 } break;
3006 case TCSYS_RIGHTcxx . . $ `Descent3/TelCom.h:107:9`!: {
3007 if (!click)
3008 break;
3009 // check to see if there is a next page, if there is go to it, else don't
3010 if (TelComIsThereANextScreencxx . . $ TelComIsThereANextScreen(c9857a73d68e59ba).())
3011 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCNEXTcxx . . $ `Descent3/TelComEffects.h:163:9`!);
3012 } break;
3013 case TCSYS_ENTERcxx . . $ `Descent3/TelCom.h:108:9`!: {
3014 int curr_focus = -1;
3015 for (int i = 0; i < MAX_TCEFFECTScxx . . $ `Descent3/TelComEffects.h:135:9`!; i++) {
3016 if (TCEffectscxx . . $ TCEffects.[i].typecxx . . $ tceffect#type. == EFX_BUTTONcxx . . $ `Descent3/TelComEffects.h:153:9`! && TCEffectscxx . . $ TCEffects.[i].screencxx . . $ tceffect#screen. == screen_id) {
3017 // this is a button on the screen
3018 if (TCEffectscxx . . $ TCEffects.[i].has_focuscxx . . $ tceffect#has_focus.) {
3019 // this button is the one with focus currently
3020 curr_focus = i;
3021 break;
3022 }
3023 }
3024 }
3025 if (curr_focus == -1)
3026 break;
3027 if (TCEffectscxx . . $ TCEffects.[curr_focus].buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..click_typecxx . . $ tButtonInfo#click_type. == CLICKTYPE_DOWNcxx . . $ `Descent3/TelComEffects.h:189:9`!) {
3028 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(curr_focus, TEVT_MOUSEDOWNcxx . . $ `Descent3/TelComEffects.h:160:9`!);
3029 } else if (click) {
3030 SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(curr_focus, TEVT_MOUSECLICKcxx . . $ `Descent3/TelComEffects.h:159:9`!);
3031 }
3032 } break;
3033 case TCSYS_Qcxx . . $ `Descent3/TelCom.h:110:9`!: {
3034 if (!click)
3035 break;
3036
3037 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCQUITcxx . . $ `Descent3/TelComEffects.h:162:9`!);
3038 } break;
3039 case TCSYS_F1cxx . . $ `Descent3/TelCom.h:111:9`!: {
3040 if (!click)
3041 break;
3042
3043 AM_terraincxx . . $ AM_terrain. = !AM_terraincxx . . $ AM_terrain.;
3044 } break;
3045 case TCSYS_F2cxx . . $ `Descent3/TelCom.h:112:9`!: {
3046 if (!click)
3047 break;
3048
3049 AM_center_on_playercxx . . $ AM_center_on_player. = 1;
3050 } break;
3051 case TCSYS_F3cxx . . $ `Descent3/TelCom.h:113:9`!: {
3052 if (!click)
3053 break;
3054
3055 AM_realigncxx . . $ AM_realign. = 1;
3056 } break;
3057 case TCSYS_PRINTSCRNcxx . . $ `Descent3/TelCom.h:114:9`!: {
3058 if (!click)
3059 break;
3060
3061 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_SCREENSHOTcxx . . $ `Descent3/TelComEffects.h:168:9`!);
3062
3063 } break;
3064 case TCSYS_1cxx . . $ `Descent3/TelCom.h:115:9`!:
3065 case TCSYS_2cxx . . $ `Descent3/TelCom.h:116:9`!:
3066 case TCSYS_3cxx . . $ `Descent3/TelCom.h:117:9`!:
3067 case TCSYS_4cxx . . $ `Descent3/TelCom.h:118:9`!:
3068 case TCSYS_5cxx . . $ `Descent3/TelCom.h:119:9`!:
3069 case TCSYS_6cxx . . $ `Descent3/TelCom.h:120:9`!:
3070 case TCSYS_7cxx . . $ `Descent3/TelCom.h:121:9`!:
3071 case TCSYS_8cxx . . $ `Descent3/TelCom.h:122:9`!: {
3072 int index = key - TCSYS_1cxx . . $ `Descent3/TelCom.h:115:9`!;
3073
3074 if (index < Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].num_markerscxx . . $ player#num_markers.)
3075 AM_current_markercxx . . $ AM_current_marker. = index;
3076
3077 break;
3078 }
3079 default:
3080 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TelCom Warning: Keypressed not valid\n");
3081 }
3082 }
3083
3084 /*
3085 *****************************************************************************
3086 * TelCom Screen Control Functions *
3087 *****************************************************************************
3088 *
3089 */
3090
3091 // Initializes the TelCom Screens so they're ready for input
3092 void InitAllScreenscxx . . $ InitAllScreens(49f6e7a06ebc5aa8).(void) {
3093 for (int i = 0; i < MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!; i++) {
3094 Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[i] = SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!;
3095 }
3096 TCWorking_screencxx . . $ TCWorking_screen. = -1;
3097 }
3098
3099 // Advances to the next screen
3100 // returns true is there is no screen (it's not being made, nor ready)
3101 bool TelcomAdvanceScreencxx . . $ TelcomAdvanceScreen(c9857a73d68e59ba).(void) {
3102 int next_screen = TC_current_screencxx . . $ TC_current_screen. + 1;
3103 if (next_screen >= MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!)
3104 return true;
3105 switch (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[next_screen]) {
3106 case SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!:
3107 // no screen even being worked on...return true
3108 return true;
3109 break;
3110 case SS_BEING_MADEcxx . . $ `Descent3/TelCom.h:128:9`!:
3111 return false;
3112 break;
3113 case SS_READYcxx . . $ `Descent3/TelCom.h:129:9`!:
3114 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(TC_current_screencxx . . $ TC_current_screen. + 1);
3115 return false;
3116 break;
3117 }
3118 return true;
3119 }
3120
3121 // returns the true if there is a next screen (from the current)
3122 bool TelComIsThereANextScreencxx . . $ TelComIsThereANextScreen(c9857a73d68e59ba).(void) {
3123 int next_screen = TC_current_screencxx . . $ TC_current_screen. + 1;
3124 if (next_screen >= MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!)
3125 return false;
3126 switch (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[next_screen]) {
3127 case SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!:
3128 // no screen even being worked on...return true
3129 return false;
3130 break;
3131 case SS_READYcxx . . $ `Descent3/TelCom.h:129:9`!:
3132 case SS_BEING_MADEcxx . . $ `Descent3/TelCom.h:128:9`!:
3133 return true;
3134 break;
3135 }
3136 return false;
3137 }
3138
3139 // Backs up a screen
3140 // returns true is there is no screen (it's not being made, nor ready)
3141 bool TelcomBackupScreencxx . . $ TelcomBackupScreen(c9857a73d68e59ba).(void) {
3142 int next_screen = TC_current_screencxx . . $ TC_current_screen. - 1;
3143 if (next_screen < 0)
3144 return true;
3145 switch (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[next_screen]) {
3146 case SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!:
3147 // no screen even being worked on...return true
3148 return true;
3149 break;
3150 case SS_BEING_MADEcxx . . $ `Descent3/TelCom.h:128:9`!:
3151 return false;
3152 break;
3153 case SS_READYcxx . . $ `Descent3/TelCom.h:129:9`!:
3154 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(TC_current_screencxx . . $ TC_current_screen. - 1);
3155 return false;
3156 break;
3157 }
3158 return true;
3159 }
3160
3161 bool TelComJumpScreencxx . . $ TelComJumpScreen(83c267b20bac841a).(int screen) {
3162 if (screen < 0 || screen >= MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!)
3163 return true;
3164 switch (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[screen]) {
3165 case SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!:
3166 // no screen even being worked on...return true
3167 return true;
3168 break;
3169 case SS_BEING_MADEcxx . . $ `Descent3/TelCom.h:128:9`!:
3170 return false;
3171 break;
3172 case SS_READYcxx . . $ `Descent3/TelCom.h:129:9`!:
3173 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(screen);
3174 return false;
3175 break;
3176 }
3177
3178 return true;
3179 }
3180
3181 // Destroys and clears all screens of the TelCom
3182 void DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).(bool remove_dummy) {
3183 int end = (remove_dummy) ? MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`! : DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!;
3184
3185 for (int i = 0; i < end; i++) {
3186 if (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[i] != SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!) {
3187 Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[i] = SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!;
3188 EfxDestroyScreencxx . . $ EfxDestroyScreen(d4f767463ce0a6b3).(i);
3189 }
3190 }
3191 TCWorking_screencxx . . $ TCWorking_screen. = -1;
3192 }
3193
3194 // Starts a TelCom screen so it can be created
3195 void TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(int screen) {
3196 ASSERTcxx . . $ `misc/pserror.h:246:9`!(screen >= 0 && screen < MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!);
3197 ASSERTcxx . . $ `misc/pserror.h:246:9`!(TCWorking_screen == -1);
3198
3199 if (Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[screen] != SS_EMPTYcxx . . $ `Descent3/TelCom.h:127:9`!) {
3200 EfxDestroyScreencxx . . $ EfxDestroyScreen(d4f767463ce0a6b3).(screen);
3201 }
3202
3203 Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[screen] = SS_BEING_MADEcxx . . $ `Descent3/TelCom.h:128:9`!;
3204 TCWorking_screencxx . . $ TCWorking_screen. = screen;
3205 }
3206
3207 // Ends a TelCom screen. Calling this enables the screen to be displayed
3208 void TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).(void) {
3209 ASSERTcxx . . $ `misc/pserror.h:246:9`!(TCWorking_screen != -1);
3210
3211 Telcom_systemcxx . . $ Telcom_system..Screen_statecxx . . $ tTelComInfo#Screen_state.[TCWorking_screencxx . . $ TCWorking_screen.] = SS_READYcxx . . $ `Descent3/TelCom.h:129:9`!;
3212 TCWorking_screencxx . . $ TCWorking_screen. = -1;
3213 }
3214
3215 float myrandcxx . . $ myrand(fbcf3211dfe1bfd1).(float max) { return (max * (((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).()) / ((float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!))); }
3216
3217 /////////////////////////////////////////////////////////////////////////////
3218 // These are the functions used for serialization, yes they are out of place,
3219 // But that is to keep them away from other parts of the code that has
3220 // the rest of the serialization. These probably can be moved to some other
3221 // file....if this function returns:
3222 // 1 : than it's a serialized exe, num will be given the serial num
3223 // 0 : than it isn't a serialized exe
3224 // -1 : detected a hacked exe
3225 #define INTERNAL_SERIALNUM_TAGcxx . . $ `Descent3/TelCom.cpp:3225:9`! "XFCABBFFAX"
3226 char GetInternalSerializationNumbercxx . . $ GetInternalSerializationNumber(c936d4c31c50eb30).(int *num) {
3227 static char mydata[] = INTERNAL_SERIALNUM_TAGcxx . . $ `Descent3/TelCom.cpp:3225:9`!;
3228
3229 // first check to see if the value is the same (non-serialized EXE)
3230 if (mydata[0] == 'X' && ((mydata[9] + 2) == 'Z')) {
3231 int value = 0;
3232 char c;
3233 for (int i = 0; i < 8; i++) {
3234 c = mydata[i + 1];
3235 if (c >= 'A' && c <= 'F') {
3236 value = value * 16 + (c - 'A' + 10);
3237 } else
3238 goto get_num;
3239 }
3240
3241 if (value == 0xFCABBFFA)
3242 return 0;
3243 }
3244
3245 get_num:
3246 // we got to get the serial num if we can
3247 int value = 0;
3248 char c;
3249 for (int i = 0; i < 8; i++) {
3250 c = mydata[i + 1];
3251 if (c >= '0' && c <= '9') {
3252 value = value * 16 + c - '0';
3253 } else if (c >= 'A' && c <= 'F') {
3254 value = value * 16 + c - 'A' + 10;
3255 } else
3256 return -1;
3257 }
3258
3259 // now byte swap the value to get it to it's original value
3260 value = (((value & 0xFF000000) >> 24) | ((value & 0xFF0000) >> 8) | ((value & 0xFF) << 24) | ((value & 0xFF00) << 8));
3261
3262 *num = value;
3263 return 1;
3264 }
3265
3266 /*
3267 ****************************************************************
3268 * TelCom Sound Functions *
3269 ****************************************************************
3270 *
3271 */
3272
3273 struct TCSoundcxx . . $ TCSound# {
3274 int hlhandlecxx . . $ TCSound#hlhandle., handlecxx . . $ TCSound#handle.;
3275 };
3276
3277 TCSoundcxx . . $ TCSound# TelcomSoundscxx . . $ TelcomSounds.[TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!];
3278
3279 const char *TCSoundFilescxx . . $ TCSoundFiles.[] = {"Briefstartup1", "BriefStatic", "Briefmonitoroff1", "Briefingrunning",
3280 "Briefbulb1", "Briefingtype", "Menu Slider Click"};
3281
3282 /*
3283 $$TABLE_SOUND "Briefstartup1"
3284 $$TABLE_SOUND "BriefStatic"
3285 $$TABLE_SOUND "Briefmonitoroff1"
3286 $$TABLE_SOUND "Briefingrunning"
3287 $$TABLE_SOUND "Briefbulb1"
3288 $$TABLE_SOUND "Briefingtype"
3289 $$TABLE_SOUND "Menu Slider Click"
3290 */
3291
3292 // Initalizes the Telcom sound sytem
3293 void TelcomInitSoundscxx . . $ TelcomInitSounds(49f6e7a06ebc5aa8).(void) {
3294 for (int i = 0; i < TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!; i++) {
3295 TelcomSoundscxx . . $ TelcomSounds.[i].hlhandlecxx . . $ TCSound#hlhandle. = -1;
3296 TelcomSoundscxx . . $ TelcomSounds.[i].handlecxx . . $ TCSound#handle. = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(TCSoundFiles[i]));
3297 }
3298 }
3299
3300 // Closes down the Telcom sound system
3301 void TelcomCloseSoundscxx . . $ TelcomCloseSounds(49f6e7a06ebc5aa8).(void) {
3302 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(Telcom_called_from_gamecxx . . $ Telcom_called_from_game.);
3303 for (int i = 0; i < TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!; i++) {
3304 if (TelcomSoundscxx . . $ TelcomSounds.[i].hlhandlecxx . . $ TCSound#hlhandle. != -1) {
3305 Sound_systemcxx . . $ Sound_system..StopSoundImmediatecxx . . $ hlsSystem#StopSoundImmediate(d4f767463ce0a6b3).(TelcomSoundscxx . . $ TelcomSounds.[i].hlhandlecxx . . $ TCSound#hlhandle.);
3306 }
3307 }
3308 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
3309 }
3310
3311 // Starts a sound playing (if it isn't already)
3312 void TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(int sid) {
3313 ASSERTcxx . . $ `misc/pserror.h:246:9`!(sid >= 0 && sid < TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!);
3314
3315 // make sure the handle is there
3316 if (TelcomSoundscxx . . $ TelcomSounds.[sid].handlecxx . . $ TCSound#handle. == -1) {
3317 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TelCom Sound Warning: '%s' hasn't been loaded yet, trying to load\n", TCSoundFiles[sid]);
3318 TelcomSoundscxx . . $ TelcomSounds.[sid].handlecxx . . $ TCSound#handle. = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(TCSoundFiles[sid]));
3319
3320 if (TelcomSoundscxx . . $ TelcomSounds.[sid].handlecxx . . $ TCSound#handle. == -1) {
3321 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TelCom Sound Warning: 2nd try failed, bailing\n");
3322 return;
3323 }
3324 }
3325
3326 // see if the sound is already playing
3327 if (TelcomSoundscxx . . $ TelcomSounds.[sid].hlhandlecxx . . $ TCSound#hlhandle. != -1) {
3328 if (Sound_systemcxx . . $ Sound_system..IsSoundPlayingcxx . . $ hlsSystem#IsSoundPlaying(83c267b20bac841a).(TelcomSoundscxx . . $ TelcomSounds.[sid].hlhandlecxx . . $ TCSound#hlhandle.)) {
3329 // the sound is still playing, we don't need to play again
3330 return;
3331 }
3332 }
3333
3334 TelcomSoundscxx . . $ TelcomSounds.[sid].hlhandlecxx . . $ TCSound#hlhandle. = Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(TelcomSoundscxx . . $ TelcomSounds.[sid].handlecxx . . $ TCSound#handle., MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!);
3335 }
3336
3337 // Stops a sound playing
3338 void TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(int sid) {
3339 ASSERTcxx . . $ `misc/pserror.h:246:9`!(sid >= 0 && sid < TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!);
3340
3341 // see if the sound is already playing
3342 if (TelcomSoundscxx . . $ TelcomSounds.[sid].hlhandlecxx . . $ TCSound#hlhandle. != -1) {
3343 Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).(TelcomSoundscxx . . $ TelcomSounds.[sid].hlhandlecxx . . $ TCSound#hlhandle.);
3344 }
3345 TelcomSoundscxx . . $ TelcomSounds.[sid].hlhandlecxx . . $ TCSound#hlhandle. = -1;
3346 }
3347
3348 //------------------------------------------------------------------------------
3349 // Pages a texture into memory, optionally resizing it if in low mem mode
3350 void PageInTexturecxx . . $ PageInTexture(918ebd27a9ddbad3).(int n, bool resize);
3351
3352 // Pages in all the necessary bitmaps, textures & sounds for the TelCom so that they are in memory
3353 void TelcomPageAllIncxx . . $ TelcomPageAllIn(49f6e7a06ebc5aa8).(void) {
3354 extern void UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(float amount); // amount is 0 to 1
3355 const float TELCOM_SOUND_PORTION = 0.3f, TELCOM_BITMAP_PORTION = 0.3f, TELCOM_TEXTUREHI_PORTION = 0.2f,
3356 TELCOM_TEXTURELO_PORTION = 0.2f;
3357
3358 int i;
3359 int count;
3360 float amount_loaded = 0.0f;
3361
3362 // Page in all sounds
3363 for (i = 0; i < TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!; i++) {
3364 int id = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(TCSoundFiles[i]));
3365 if (id != -1) {
3366 Sound_systemcxx . . $ Sound_system..CheckAndForceSoundDataAlloccxx . . $ hlsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(id);
3367 amount_loaded += (1.0f * TELCOM_SOUND_PORTION) / (float)TCSND_SOUNDCOUNTcxx . . $ `Descent3/TelCom.h:325:9`!;
3368 if ((i % 4) == 0) {
3369 UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(amount_loaded);
3370 }
3371 }
3372 }
3373
3374 // Page in all bitmaps
3375 count = Telcom_bitmapcxx . . $ Telcom_bitmap..wcxx . . $ chunked_bitmap#w. * Telcom_bitmapcxx . . $ Telcom_bitmap..hcxx . . $ chunked_bitmap#h.;
3376 for (i = 0; i < count; i++) {
3377 bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(Telcom_bitmapcxx . . $ Telcom_bitmap..bm_arraycxx . . $ chunked_bitmap#bm_array.[i], 0);
3378 UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(amount_loaded);
3379 }
3380 amount_loaded += TELCOM_BITMAP_PORTION;
3381
3382 // Page in all textures
3383 count = 0;
3384 while (hilitescxx . . $ hilites.[count]) {
3385 i = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(hilites[count]));
3386 if (i != -1) {
3387 PageInTexturecxx . . $ PageInTexture(918ebd27a9ddbad3).(i, false);
3388 }
3389 count++;
3390 }
3391 amount_loaded += TELCOM_TEXTURELO_PORTION;
3392 UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(amount_loaded);
3393
3394 count = 0;
3395 while (smhilitescxx . . $ smhilites.[count]) {
3396 i = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(smhilites[count]));
3397 if (i != -1)
3398 PageInTexturecxx . . $ PageInTexture(918ebd27a9ddbad3).(i, false);
3399 count++;
3400 }
3401
3402 i = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("TelcomPowerbar");
3403 if (i != -1)
3404 PageInTexturecxx . . $ PageInTexture(918ebd27a9ddbad3).(i, false);
3405
3406 amount_loaded += TELCOM_TEXTURELO_PORTION;
3407 UpdateInitMessagecxx . . $ UpdateInitMessage(9364e6e7bff7660).(amount_loaded);
3408 }
3409
3410 /*
3411 ****************************************************************************************
3412 Single Player Ship Selection
3413 ****************************************************************************************
3414 */
3415 void TCSSSCallbackcxx . . $ TCSSSCallback(49f6e7a06ebc5aa8).(void);
3416 // collects information about the ships, returns the number of ships available
3417 int TCSSCollectInfocxx . . $ TCSSCollectInfo(b126dc7c1de90089).(void);
3418 void TCSSButtonCallbackcxx . . $ TCSSButtonCallback(d4f767463ce0a6b3).(int efxnum);
3419 void TCSSPutButtonsOnScreencxx . . $ TCSSPutButtonsOnScreen(49f6e7a06ebc5aa8).(void);
3420 int TCSSGetSelectedShipIndexcxx . . $ TCSSGetSelectedShipIndex(b126dc7c1de90089).(void);
3421
3422 structcxx . . $ $anonymous_type_47c017155912d27c_1# {
3423 int ShipCountcxx . . $ $anonymous_type_47c017155912d27c_1#ShipCount.;
3424 int CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID.;
3425 matrixcxx . . $ matrix# orientcxx . . $ $anonymous_type_47c017155912d27c_1#orient.;
3426 int ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model.;
3427 float cam_distcxx . . $ $anonymous_type_47c017155912d27c_1#cam_dist.;
3428 } TCShipSelectcxx . . $ TCShipSelect.;
3429
3430 struct tShipInfocxx . . $ tShipInfo# {
3431 int max_speedcxx . . $ tShipInfo#max_speed.;
3432 int maneuverabilitycxx . . $ tShipInfo#maneuverability.;
3433 int shieldcxx . . $ tShipInfo#shield.;
3434 int ordnancecxx . . $ tShipInfo#ordnance.;
3435 int wingspancxx . . $ tShipInfo#wingspan.;
3436 int lengthcxx . . $ tShipInfo#length.;
3437 int heightcxx . . $ tShipInfo#height.;
3438 int weightcxx . . $ tShipInfo#weight.;
3439 };
3440
3441 #define MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`! 3
3442
3443 tShipInfocxx . . $ tShipInfo# TCSSInfocxx . . $ TCSSInfo.[MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!] = {{TXI_SS_PY_SPEEDcxx . . $ `Descent3/stringtable.h:881:9`!, TXI_SS_PY_MANEUVERABILITYcxx . . $ `Descent3/stringtable.h:882:9`!, TXI_SS_PY_SHIELDScxx . . $ `Descent3/stringtable.h:883:9`!, TXI_SS_PY_ORDANCEcxx . . $ `Descent3/stringtable.h:884:9`!,
3444 TXI_SS_PY_WINGSPANcxx . . $ `Descent3/stringtable.h:885:9`!, TXI_SS_PY_LENGTHcxx . . $ `Descent3/stringtable.h:886:9`!, TXI_SS_PY_HEIGHTcxx . . $ `Descent3/stringtable.h:887:9`!, TXI_SS_PY_WEIGHTcxx . . $ `Descent3/stringtable.h:888:9`!},
3445 {TXI_SS_PH_SPEEDcxx . . $ `Descent3/stringtable.h:889:9`!, TXI_SS_PH_MANEUVERABILITYcxx . . $ `Descent3/stringtable.h:890:9`!, TXI_SS_PH_SHIELDScxx . . $ `Descent3/stringtable.h:891:9`!, TXI_SS_PH_ORDANCEcxx . . $ `Descent3/stringtable.h:892:9`!,
3446 TXI_SS_PH_WINGSPANcxx . . $ `Descent3/stringtable.h:893:9`!, TXI_SS_PH_LENGTHcxx . . $ `Descent3/stringtable.h:894:9`!, TXI_SS_PH_HEIGHTcxx . . $ `Descent3/stringtable.h:895:9`!, TXI_SS_PH_WEIGHTcxx . . $ `Descent3/stringtable.h:896:9`!},
3447 {TXI_SS_M_SPEEDcxx . . $ `Descent3/stringtable.h:897:9`!, TXI_SS_M_MANEUVERABILITYcxx . . $ `Descent3/stringtable.h:898:9`!, TXI_SS_M_SHIELDScxx . . $ `Descent3/stringtable.h:899:9`!, TXI_SS_M_ORDANCEcxx . . $ `Descent3/stringtable.h:900:9`!,
3448 TXI_SS_M_WINGSPANcxx . . $ `Descent3/stringtable.h:901:9`!, TXI_SS_M_LENGTHcxx . . $ `Descent3/stringtable.h:902:9`!, TXI_SS_M_HEIGHTcxx . . $ `Descent3/stringtable.h:903:9`!, TXI_SS_M_WEIGHTcxx . . $ `Descent3/stringtable.h:904:9`!}};
3449
3450 /*
3451 $$TABLE_SHIP "Pyro-GL"
3452 $$TABLE_SHIP "Phoenix"
3453 $$TABLE_SHIP "Magnum-AHT"
3454 */
3455 struct tSSShipInfocxx . . $ tSSShipInfo# {
3456 bool foundcxx . . $ tSSShipInfo#found.;
3457 int ship_indexcxx . . $ tSSShipInfo#ship_index.;
3458 int efxnumcxx . . $ tSSShipInfo#efxnum.;
3459 };
3460 tSSShipInfocxx . . $ tSSShipInfo# SSShipscxx . . $ SSShips.[MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!];
3461
3462 // two buttons
3463 #define SSA_LEFTXcxx . . $ `Descent3/TelCom.cpp:3463:9`! 165
3464 #define SSA_TOPYcxx . . $ `Descent3/TelCom.cpp:3464:9`! 360
3465 #define SSA_GAPcxx . . $ `Descent3/TelCom.cpp:3465:9`! -2
3466
3467 // three buttons
3468 #define SSB_LEFTXcxx . . $ `Descent3/TelCom.cpp:3468:9`! 165
3469 #define SSB_TOPYcxx . . $ `Descent3/TelCom.cpp:3469:9`! 360
3470 #define SSB_GAPcxx . . $ `Descent3/TelCom.cpp:3470:9`! -2
3471
3472 // This is the function called by TelCom to choose a ship
3473 void TelComSingleShipSelectcxx . . $ TelComSingleShipSelect(9b1dcfbcd79f78bb).(tTelComInfocxx . . $ tTelComInfo# *tcs) {
3474 int found_ships = TCSSCollectInfocxx . . $ TCSSCollectInfo(b126dc7c1de90089).();
3475 if (found_ships < 2 || found_ships > 3) {
3476 // not supported
3477 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Skipping Single Player Ship Selecting, %d ships found\n", found_ships);
3478
3479 int ship_index_to_use = 0;
3480 int bit = 0x01;
3481 bool found = true;
3482
3483 for (ship_index_to_use = 0; ship_index_to_use < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!; ship_index_to_use++) {
3484 if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_permissionscxx . . $ player#ship_permissions. & bit) {
3485 found = true;
3486 break;
3487 }
3488 bit = bit << 1;
3489 }
3490
3491 if (!found) {
3492 bit = 0x01;
3493 for (ship_index_to_use = 0; ship_index_to_use < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!; ship_index_to_use++) {
3494 if (Default_ship_permissioncxx . . $ Default_ship_permission. & bit) {
3495 found = true;
3496 break;
3497 }
3498 bit = bit << 1;
3499 }
3500 }
3501
3502 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = ship_index_to_use;
3503 return;
3504 }
3505
3506 bool done = false;
3507
3508 TCShipSelectcxx . . $ TCShipSelect..CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID. = -1;
3509 TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model. = -1;
3510 vm_MakeIdentitycxx . . $ vm_MakeIdentity(dca75c48c9ab5b54).(&TCShipSelectcxx . . $ TCShipSelect..orientcxx . . $ $anonymous_type_47c017155912d27c_1#orient.);
3511
3512 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(0);
3513
3514 // setup general background, plain color
3515 TCBKGDESCcxx . . $ TCBKGDESC# backg;
3516 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
3517 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
3518 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
3519
3520 TCBMPDESCcxx . . $ TCBMPDESC# bmpdesc;
3521 bmpdesc.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
3522 bmpdesc.flagscxx . . $ TCBMPDESC#flags. = 0;
3523 bmpdesc.capscxx . . $ TCBMPDESC#caps. = TCBD_XYcxx . . $ `Descent3/TelComEfxStructs.h:115:9`!;
3524 bmpdesc.xcxx . . $ TCBMPDESC#x. = 0;
3525 bmpdesc.ycxx . . $ TCBMPDESC#y. = 0;
3526 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "SS Background.ogf");
3527 /*
3528 $$TABLE_GAMEFILE "SS Background.ogf"
3529 */
3530
3531 // setup text for the top monitor "Select Ship"
3532 TCTEXTDESCcxx . . $ TCTEXTDESC# textdesc;
3533 textdesc.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_STATICcxx . . $ `Descent3/TelComEfxStructs.h:135:9`!;
3534 textdesc.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
3535 textdesc.capscxx . . $ TCTEXTDESC#caps. = TCTD_TEXTBOXcxx . . $ `Descent3/TelComEfxStructs.h:111:9`! | TCTD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:107:9`! | TCTD_FONTcxx . . $ `Descent3/TelComEfxStructs.h:106:9`!;
3536 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 5;
3537 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 380;
3538 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 33;
3539 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 68;
3540 textdesc.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
3541
3542 // Setup Main Monitor
3543 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0);
3544 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, TXT_SELECTSHIPcxx . . $ `Descent3/stringtable.h:350:9`!, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0);
3545
3546 // Create buttons to select ship (either 2 or 3)
3547 TCSSPutButtonsOnScreencxx . . $ TCSSPutButtonsOnScreen(49f6e7a06ebc5aa8).();
3548
3549 // Setup Location Monitor (small window at top)
3550 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 65;
3551 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 380;
3552 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 5;
3553 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 50;
3554 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0);
3555 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, TXT_SELECTSHIPcxx . . $ `Descent3/stringtable.h:350:9`!, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0);
3556
3557 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
3558 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(0);
3559 TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(TCSSSCallbackcxx . . $ TCSSSCallback(49f6e7a06ebc5aa8).);
3560
3561 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`!; // turn back on telcom
3562 tcs->current_statuscxx . . $ tTelComInfo#current_status. = TS_SHIPSELECTcxx . . $ `Descent3/TelCom.h:89:9`!;
3563
3564 // set focus to the ship we currently have selected
3565 int focus_ship = -1;
3566 for (int j = 0; j < MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!; j++) {
3567 if (SSShipscxx . . $ SSShips.[j].foundcxx . . $ tSSShipInfo#found. && SSShipscxx . . $ SSShips.[j].ship_indexcxx . . $ tSSShipInfo#ship_index. == Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.) {
3568 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Current Ship: %s\n", Ships[SSShips[j].ship_index].name);
3569 focus_ship = SSShipscxx . . $ SSShips.[j].efxnumcxx . . $ tSSShipInfo#efxnum.;
3570 break;
3571 }
3572 }
3573
3574 if (focus_ship != -1) {
3575 if (TCEffectscxx . . $ TCEffects.[focus_ship].has_focuscxx . . $ tceffect#has_focus.)
3576 TCSSButtonCallbackcxx . . $ TCSSButtonCallback(d4f767463ce0a6b3).(focus_ship);
3577 else
3578 TelComSetFocusOnEffectcxx . . $ TelComSetFocusOnEffect(d4f767463ce0a6b3).(focus_ship);
3579 }
3580
3581 TelCom_ClearCustomKeyEventscxx . . $ TelCom_ClearCustomKeyEvents(49f6e7a06ebc5aa8).();
3582 TelCom_AddCustomKeyEventcxx . . $ TelCom_AddCustomKeyEvent(3e454b8ccf442868).(KEY_LEFTcxx . . $ `ddio/ddio_common.h:320:9`!, 0x13); // left arrow
3583 TelCom_AddCustomKeyEventcxx . . $ TelCom_AddCustomKeyEvent(3e454b8ccf442868).(KEY_RIGHTcxx . . $ `ddio/ddio_common.h:321:9`!, 0x14); // right arrow
3584 TelCom_AddCustomKeyEventcxx . . $ TelCom_AddCustomKeyEvent(3e454b8ccf442868).(KEY_ENTERcxx . . $ `ddio/ddio_common.h:268:9`!, 0x15); // enter key
3585
3586 while (!done) {
3587 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(Telcom_called_from_gamecxx . . $ Telcom_called_from_game.);
3588
3589 if (Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. != TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`! || tcs->current_statuscxx . . $ tTelComInfo#current_status. != TS_SHIPSELECTcxx . . $ `Descent3/TelCom.h:89:9`!) {
3590 // we're done with the loop
3591 done = true;
3592 }
3593
3594 // Process all waiting events for the TelCom (we may only want to handle this once a frame!)
3595 TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(tcs);
3596
3597 // Process custom events
3598 tTCEventcxx . . $ tTCEvent# evt;
3599 while (TelCom_PopSystemEventcxx . . $ TelCom_PopSystemEvent(2cd38c003880a92c).(&evt)) {
3600 switch (evt.idcxx . . $ tTCEvent#id.) {
3601 case 0x13: // left arrow
3602 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_FAKEKEYPRESScxx . . $ `Descent3/TelComEffects.h:169:9`!, TCSYS_REVERSETABcxx . . $ `Descent3/TelCom.h:123:9`!);
3603 break;
3604 case 0x14: // right arrow
3605 TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_FAKEKEYPRESScxx . . $ `Descent3/TelComEffects.h:169:9`!, TCSYS_TABcxx . . $ `Descent3/TelCom.h:103:9`!);
3606 break;
3607 case 0x15: // enter key
3608 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
3609 break;
3610 }
3611 }
3612
3613 TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).();
3614 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
3615 if (KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!))
3616 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
3617
3618 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
3619 }
3620
3621 Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!; // turn back off telcom
3622
3623 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).();
3624 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
3625 TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
3626
3627 int ship_index_to_use = TCSSGetSelectedShipIndexcxx . . $ TCSSGetSelectedShipIndex(b126dc7c1de90089).();
3628 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Selected: %s\n", Ships[ship_index_to_use].name);
3629 Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = ship_index_to_use;
3630
3631 TelCom_ClearCustomKeyEventscxx . . $ TelCom_ClearCustomKeyEvents(49f6e7a06ebc5aa8).();
3632 }
3633
3634 // returns the ship index that is selected
3635 int TCSSGetSelectedShipIndexcxx . . $ TCSSGetSelectedShipIndex(b126dc7c1de90089).(void) {
3636 int id = SSShipscxx . . $ SSShips.[SHIP_PYRO_IDcxx . . $ `Descent3/ship.h:136:9`!].ship_indexcxx . . $ tSSShipInfo#ship_index.;
3637 for (int i = 0; i < MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!; i++) {
3638 if (SSShipscxx . . $ SSShips.[i].foundcxx . . $ tSSShipInfo#found.) {
3639 int efxnum = SSShipscxx . . $ SSShips.[i].efxnumcxx . . $ tSSShipInfo#efxnum.;
3640 if (TCEffectscxx . . $ TCEffects.[efxnum].has_focuscxx . . $ tceffect#has_focus.) {
3641 id = SSShipscxx . . $ SSShips.[i].ship_indexcxx . . $ tSSShipInfo#ship_index.;
3642 break;
3643 }
3644 }
3645 }
3646
3647 return id;
3648 }
3649
3650 // collects information about the ships, returns the number of ships available
3651 int TCSSCollectInfocxx . . $ TCSSCollectInfo(b126dc7c1de90089).(void) {
3652 int found = 0;
3653 int i, j;
3654
3655 for (i = 0; i < MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!; i++) {
3656 SSShipscxx . . $ SSShips.[i].foundcxx . . $ tSSShipInfo#found. = false;
3657 }
3658
3659 for (i = 0; i < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!; i++) {
3660 #ifdef _DEBUGcxx . . $ `<built-in>:482:9`!
3661 if (Shipscxx . . $ Ships.[i].usedcxx . . $ ship#used.) {
3662 #else
3663 if (Ships[i].used && PlayerIsShipAllowed(Player_num, i)) {
3664 #endif
3665 for (j = 0; j < MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!; j++) {
3666 if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(Ships[i].name, AllowedShips[j])) {
3667 // found the ship
3668 SSShipscxx . . $ SSShips.[j].foundcxx . . $ tSSShipInfo#found. = true;
3669 SSShipscxx . . $ SSShips.[j].ship_indexcxx . . $ tSSShipInfo#ship_index. = i;
3670 found++;
3671 break;
3672 }
3673 }
3674 }
3675 }
3676
3677 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Collecting Ship Info: %d ships available\n", found);
3678 TCShipSelectcxx . . $ TCShipSelect..ShipCountcxx . . $ $anonymous_type_47c017155912d27c_1#ShipCount. = found;
3679
3680 return found;
3681 }
3682
3683 //====================================
3684 // returns the optimal distance to place the camera
3685 float getdistcxx . . $ getdist(3f5ede336672c4ec).(anglecxx . . $ angle# ang, float height); // in pilot.cpp
3686 extern float Render_zoomcxx . . $ Render_zoom.;
3687
3688 //====================================
3689
3690 void TCSSButtonCallbackcxx . . $ TCSSButtonCallback(d4f767463ce0a6b3).(int efxnum) {
3691 if (!TCEffectscxx . . $ TCEffects.[efxnum].has_focuscxx . . $ tceffect#has_focus.) {
3692 // make sure we have focus...be careful, because by setting focus
3693 // the call is going to come back into this function
3694 TelComSetFocusOnEffectcxx . . $ TelComSetFocusOnEffect(d4f767463ce0a6b3).(efxnum);
3695 return;
3696 }
3697
3698 int selected_id = -1;
3699
3700 // which ship id are we talking about?
3701 for (int i = 0; i < MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!; i++) {
3702 if (SSShipscxx . . $ SSShips.[i].foundcxx . . $ tSSShipInfo#found. && SSShipscxx . . $ SSShips.[i].efxnumcxx . . $ tSSShipInfo#efxnum. == efxnum) {
3703 // this is the id;
3704 selected_id = i;
3705 break;
3706 }
3707 }
3708
3709 if (selected_id == -1) {
3710 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Invalid selected id for efxnum %d\n", efxnum);
3711 return;
3712 }
3713
3714 bool first_click = false;
3715
3716 if (TCShipSelectcxx . . $ TCShipSelect..CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID. == -1)
3717 first_click = true;
3718
3719 if (TCShipSelectcxx . . $ TCShipSelect..CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID. == selected_id) {
3720 // not a change
3721 return;
3722 }
3723
3724 TCShipSelectcxx . . $ TCShipSelect..CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID. = selected_id;
3725
3726 // PUT CODE TO HANDLE NEW SHIP BEING SELECTED HERE
3727 float size;
3728 TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model. = Shipscxx . . $ Ships.[SSShipscxx . . $ SSShips.[selected_id].ship_indexcxx . . $ tSSShipInfo#ship_index.].model_handlecxx . . $ ship#model_handle.;
3729 if (TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model. == -1) {
3730 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "ship_model is -1\n");
3731 Int3cxx . . $ `misc/pserror.h:247:9`!();
3732 }
3733
3734 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model., OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, &size);
3735 poly_modelcxx . . $ poly_model# *pm = GetPolymodelPointercxx . . $ GetPolymodelPointer(ac85e77c73ebf794).(TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model.);
3736 TCShipSelectcxx . . $ TCShipSelect..cam_distcxx . . $ $anonymous_type_47c017155912d27c_1#cam_dist. = pm->anim_sizecxx . . $ poly_model#anim_size. / Render_zoomcxx . . $ Render_zoom. + 6;
3737
3738 TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_CLICKcxx . . $ `Descent3/TelCom.h:324:9`!);
3739 if (!first_click)
3740 TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(TCSND_CLICKcxx . . $ `Descent3/TelCom.h:324:9`!);
3741 }
3742
3743 void TCSSSCallbackcxx . . $ TCSSSCallback(49f6e7a06ebc5aa8).(void) {
3744 if (TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model. == -1) {
3745 // no ship selected yet
3746 return;
3747 }
3748
3749 vectorcxx . . $ vector# viewer_eye = {0, 0, 0};
3750 matrixcxx . . $ matrix# viewer_orient = IDENTITY_MATRIXcxx . . $ `lib/vecmat_external.h:55:9`!;
3751 viewer_eye.zcxx . . $ vector#z. = -TCShipSelectcxx . . $ TCShipSelect..cam_distcxx . . $ $anonymous_type_47c017155912d27c_1#cam_dist.;
3752
3753 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
3754 StartFramecxx . . $ StartFrame(3285c9bef785d51c).(325, 142, 535, 280);
3755
3756 // backup user-specified aspect ratio, than disable it for ship select screen
3757 float aspect = g3_GetAspectRatiocxx . . $ g3_GetAspectRatio(9b8c9e39889c762c).();
3758 g3_SetAspectRatiocxx . . $ g3_SetAspectRatio(9364e6e7bff7660).(0.0f);
3759
3760 g3_StartFramecxx . . $ g3_StartFrame(e35d136ceab5c8a2).(&viewer_eye, &viewer_orient, D3_DEFAULT_ZOOMcxx . . $ `Descent3/descent.h:178:9`!);
3761 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(0);
3762
3763 float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
3764 float light_scalar, size;
3765 PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model., OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, &size);
3766 poly_modelcxx . . $ poly_model# *pm = GetPolymodelPointercxx . . $ GetPolymodelPointer(ac85e77c73ebf794).(TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model.);
3767 vectorcxx . . $ vector# view_pos;
3768 vectorcxx . . $ vector# light_vec;
3769 matrixcxx . . $ matrix# view_orient = IDENTITY_MATRIXcxx . . $ `lib/vecmat_external.h:55:9`!;
3770 matrixcxx . . $ matrix# final_mat = IDENTITY_MATRIXcxx . . $ `lib/vecmat_external.h:55:9`!;
3771 matrixcxx . . $ matrix# rot_mat;
3772
3773 // draw model.
3774 SetNormalizedTimeAnimcxx . . $ SetNormalizedTimeAnim(40d1f0252a152310).(0, normalized_time, pm);
3775
3776 view_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pm->anim_size_offsetcxx . . $ poly_model#anim_size_offset.;
3777
3778 // move 30 degrees a sec
3779 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&rot_mat, 0, (last_frametimecxx . . $ last_frametime.) * (65535 / 360) * 30, 0);
3780
3781 vm_MatrixMulcxx . . $ vm_MatrixMul(3d6e518f7ec8c77c).(&view_orient, &rot_mat, &TCShipSelectcxx . . $ TCShipSelect..orientcxx . . $ $anonymous_type_47c017155912d27c_1#orient.);
3782 vm_Orthogonalizecxx . . $ vm_Orthogonalize(dca75c48c9ab5b54).(&view_orient);
3783 TCShipSelectcxx . . $ TCShipSelect..orientcxx . . $ $anonymous_type_47c017155912d27c_1#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). view_orient;
3784
3785 light_vec.xcxx . . $ vector#x. = 0.0f;
3786 light_vec.ycxx . . $ vector#y. = -1.0f;
3787 light_vec.zcxx . . $ vector#z. = -1.0f;
3788 light_scalar = 0.8f;
3789 vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&light_vec);
3790
3791 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1);
3792 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
3793 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
3794 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
3795 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
3796 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
3797
3798 DrawPolygonModelcxx . . $ DrawPolygonModel(af314eb3da32d535).(&view_pos, &view_orient, TCShipSelectcxx . . $ TCShipSelect..ship_modelcxx . . $ $anonymous_type_47c017155912d27c_1#ship_model., normalized_time, 0, &light_vec, light_scalar,
3799 light_scalar, light_scalar);
3800
3801 // restore user-specified aspect ratio
3802 g3_SetAspectRatiocxx . . $ g3_SetAspectRatio(9364e6e7bff7660).(aspect);
3803
3804 g3_EndFramecxx . . $ g3_EndFrame(49f6e7a06ebc5aa8).();
3805 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
3806
3807 // Render the name of the selected ship
3808 uint8_tcxx . . $ uint8_t# old_alpha = grtext_GetAlphacxx . . $ grtext_GetAlpha(7c4be072098b358f).();
3809 int old_font = grtext_GetFontcxx . . $ grtext_GetFont(b126dc7c1de90089).();
3810 ddgr_colorcxx . . $ ddgr_color# old_color = grtext_GetColorcxx . . $ grtext_GetColor(db52760e79bf9054).();
3811 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(255);
3812 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BIG_BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:112:9`!);
3813 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.);
3814
3815 char *name = Shipscxx . . $ Ships.[SSShipscxx . . $ SSShips.[TCShipSelectcxx . . $ TCShipSelect..CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID.].ship_indexcxx . . $ tSSShipInfo#ship_index.].namecxx . . $ ship#name.;
3816 int line_length = grtext_GetTextLineWidthcxx . . $ grtext_GetTextLineWidth(5c4306d8553b3696).(name);
3817 int line_height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(BIG_BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:112:9`!);
3818 int bar_width = 177;
3819 int bar_height = 34;
3820 int bar_x = 287 + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
3821 int bar_y = 246 + Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.;
3822
3823 int x, y;
3824 x = bar_x + ((bar_width / 2) - (line_length / 2));
3825 y = bar_y + ((bar_height / 2) - (line_height / 2));
3826
3827 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x, y, name);
3828
3829 // write ship descriptions
3830 tShipInfocxx . . $ tShipInfo# *si = &TCSSInfocxx . . $ TCSSInfo.[TCShipSelectcxx . . $ TCShipSelect..CurrentSelectIDcxx . . $ $anonymous_type_47c017155912d27c_1#CurrentSelectID.];
3831 x = 115;
3832 y = 130;
3833 int width = 210;
3834 int max_height = y + 150;
3835 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!);
3836 int height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!);
3837 const char *line_text;
3838 char buffy[512];
3839 char linebuffer[512];
3840
3841 for (int q = 0; q < 8; q++) {
3842 switch (q) {
3843 case 0:
3844 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->max_speed);
3845 break;
3846 case 1:
3847 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->maneuverability);
3848 break;
3849 case 2:
3850 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->shield);
3851 break;
3852 case 3:
3853 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->ordnance);
3854 break;
3855 case 4:
3856 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->wingspan);
3857 break;
3858 case 5:
3859 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->length);
3860 break;
3861 case 6:
3862 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->height);
3863 break;
3864 case 7:
3865 line_text = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(si->weight);
3866 break;
3867 }
3868
3869 textaux_WordWrapcxx . . $ textaux_WordWrap(2480230cce71d9d7).(line_text, buffy, width, BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!);
3870
3871 line_text = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(buffy, linebuffer);
3872 while ((line_text) && ((y + height) < max_height)) {
3873 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x, y, linebuffer);
3874 y += height;
3875 line_text = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(line_text, linebuffer);
3876 }
3877 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x, y, linebuffer);
3878 y += height;
3879 }
3880
3881 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(old_alpha);
3882 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(old_font);
3883 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(old_color);
3884 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
3885 }
3886
3887 void TCSSPutButtonsOnScreencxx . . $ TCSSPutButtonsOnScreen(49f6e7a06ebc5aa8).(void) {
3888 int monitor_y, monitor_x;
3889 monitor_y = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.;
3890 monitor_x = Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
3891
3892 TCBMPDESCcxx . . $ TCBMPDESC# bmpdesc;
3893 bmpdesc.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
3894 bmpdesc.flagscxx . . $ TCBMPDESC#flags. = 0;
3895 bmpdesc.capscxx . . $ TCBMPDESC#caps. = TCBD_XYcxx . . $ `Descent3/TelComEfxStructs.h:115:9`!;
3896
3897 TCBUTTONDESCcxx . . $ TCBUTTONDESC# buttdesc;
3898 buttdesc.sibling_idcxx . . $ TCBUTTONDESC#sibling_id. = buttdesc.parent_idcxx . . $ TCBUTTONDESC#parent_id. = -1;
3899 buttdesc.internalcxx . . $ TCBUTTONDESC#internal. = TCSSButtonCallbackcxx . . $ TCSSButtonCallback(d4f767463ce0a6b3).;
3900 buttdesc.flash_timecxx . . $ TCBUTTONDESC#flash_time. = 0;
3901 buttdesc.button_typecxx . . $ TCBUTTONDESC#button_type. = BUTT_INTERNALcxx . . $ `Descent3/TelComEffects.h:183:9`!;
3902 buttdesc.flashercxx . . $ TCBUTTONDESC#flasher. = false;
3903 buttdesc.click_typecxx . . $ TCBUTTONDESC#click_type. = CLICKTYPE_CLICKUPcxx . . $ `Descent3/TelComEffects.h:188:9`!;
3904 buttdesc.osflagscxx . . $ TCBUTTONDESC#osflags. = OBF_GLOWcxx . . $ `Descent3/TelComEfxStructs.h:306:9`! | OBF_CHANGEFOCUSISCLICKcxx . . $ `Descent3/TelComEfxStructs.h:307:9`!;
3905 buttdesc.tab_stopcxx . . $ TCBUTTONDESC#tab_stop. = true; // all main menu buttons can have focus
3906
3907 int left_x, top_y, gap;
3908 if (TCShipSelectcxx . . $ TCShipSelect..ShipCountcxx . . $ $anonymous_type_47c017155912d27c_1#ShipCount. == 2) {
3909 left_x = SSA_LEFTXcxx . . $ `Descent3/TelCom.cpp:3463:9`!;
3910 top_y = SSA_TOPYcxx . . $ `Descent3/TelCom.cpp:3464:9`!;
3911 gap = SSA_GAPcxx . . $ `Descent3/TelCom.cpp:3465:9`!;
3912
3913 bmpdesc.xcxx . . $ TCBMPDESC#x. = left_x - monitor_x;
3914 bmpdesc.ycxx . . $ TCBMPDESC#y. = top_y - monitor_y;
3915 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "SS 2 button group.ogf");
3916 } else {
3917 left_x = SSB_LEFTXcxx . . $ `Descent3/TelCom.cpp:3468:9`!;
3918 top_y = SSB_TOPYcxx . . $ `Descent3/TelCom.cpp:3469:9`!;
3919 gap = SSB_GAPcxx . . $ `Descent3/TelCom.cpp:3470:9`!;
3920
3921 bmpdesc.xcxx . . $ TCBMPDESC#x. = left_x - monitor_x;
3922 bmpdesc.ycxx . . $ TCBMPDESC#y. = top_y - monitor_y;
3923 strcpy(bmpdesc.filenamecxx . . $ TCBMPDESC#filename., "SS 3 button group.ogf");
3924 }
3925 /*
3926 $$TABLE_GAMEFILE "SS 3 button group.ogf"
3927 $$TABLE_GAMEFILE "SS 2 button group.ogf"
3928 */
3929 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0);
3930
3931 int i;
3932 int width;
3933 int curr_x, curr_y;
3934 curr_x = left_x + 3;
3935 curr_y = top_y + 2;
3936 const char *lit_name, *name;
3937
3938 for (i = 0; i < MAX_NUM_SHIPScxx . . $ `Descent3/TelCom.cpp:3441:9`!; i++) {
3939 if (SSShipscxx . . $ SSShips.[i].foundcxx . . $ tSSShipInfo#found.) {
3940 buttdesc.xcxx . . $ TCBUTTONDESC#x. = curr_x;
3941 buttdesc.ycxx . . $ TCBUTTONDESC#y. = curr_y;
3942
3943 switch (i) {
3944 case SHIP_PYRO_IDcxx . . $ `Descent3/ship.h:136:9`!:
3945 lit_name = "SS Lit Pyro button.ogf";
3946 name = "SS Pyro button.ogf";
3947 break;
3948 case SHIP_MAGNUM_IDcxx . . $ `Descent3/ship.h:138:9`!:
3949 lit_name = "SS Lit Magnum button.ogf";
3950 name = "SS Magnum button.ogf";
3951 break;
3952 case SHIP_PHOENIX_IDcxx . . $ `Descent3/ship.h:137:9`!:
3953 lit_name = "SS Lit Phoenix button.ogf";
3954 name = "SS Phoenix button.ogf";
3955 break;
3956 }
3957
3958 /*
3959 $$TABLE_GAMEFILE "SS Lit Pyro button.ogf"
3960 $$TABLE_GAMEFILE "SS Pyro button.ogf"
3961 $$TABLE_GAMEFILE "SS Lit Magnum button.ogf"
3962 $$TABLE_GAMEFILE "SS Magnum button.ogf"
3963 $$TABLE_GAMEFILE "SS Lit Phoenix button.ogf"
3964 $$TABLE_GAMEFILE "SS Phoenix button.ogf"
3965 */
3966
3967 int bmp_handle = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(name), 0);
3968 if (bmp_handle <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
3969 width = 10;
3970 } else {
3971 width = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bmp_handle, 0);
3972 bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(bmp_handle);
3973 }
3974
3975 strcpy(buttdesc.filenamecxx . . $ TCBUTTONDESC#filename., name);
3976 strcpy(buttdesc.flash_filenamecxx . . $ TCBUTTONDESC#flash_filename., name);
3977 strcpy(buttdesc.filename_focuscxx . . $ TCBUTTONDESC#filename_focus., lit_name);
3978 strcpy(buttdesc.flash_filename_focuscxx . . $ TCBUTTONDESC#flash_filename_focus., lit_name);
3979 SSShipscxx . . $ SSShips.[i].efxnumcxx . . $ tSSShipInfo#efxnum. = CreateButtonEffectcxx . . $ CreateButtonEffect(41aa3ad94772acea).(&buttdesc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0);
3980
3981 curr_x += (width + gap);
3982 }
3983 }
3984 }
3985
3986 /////////////////////////////////////////
3987 tTCEventcxx . . $ tTCEvent# Telcom_system_queuecxx . . $ Telcom_system_queue.[MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!]; // Event queue for TelCom System
3988
3989 void TelCom_ClearSystemQueuecxx . . $ TelCom_ClearSystemQueue(49f6e7a06ebc5aa8).(void) {
3990 for (int i = 0; i < MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!; i++) {
3991 Telcom_system_queuecxx . . $ Telcom_system_queue.[i].idcxx . . $ tTCEvent#id. = -1;
3992 }
3993 }
3994
3995 /*
3996 * Calling this sends an event message to the TelCom System Queue, adding it to it's event queue
3997 *
3998 */
3999 void TelCom_SendSystemEventcxx . . $ TelCom_SendSystemEvent(b1146eedae1e1d0b).(int event_num, int parm1, int parm2) {
4000 for (int i = 0; i < MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!; i++) {
4001 if (Telcom_system_queuecxx . . $ Telcom_system_queue.[i].idcxx . . $ tTCEvent#id. == -1) {
4002 // add the event here
4003 Telcom_system_queuecxx . . $ Telcom_system_queue.[i].idcxx . . $ tTCEvent#id. = event_num;
4004 Telcom_system_queuecxx . . $ Telcom_system_queue.[i].parmscxx . . $ tTCEvent#parms.[0] = parm1;
4005 Telcom_system_queuecxx . . $ Telcom_system_queue.[i].parmscxx . . $ tTCEvent#parms.[1] = parm2;
4006 return;
4007 }
4008 }
4009
4010 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Warning: TelCom System Event Queue Overflow\n");
4011 }
4012
4013 /*
4014 * Call this when handling the TelCom system events, returns true if there is an event waiting, it will then fill
4015 * in the passed struct. You should call this repeatedly until a value of false is returned, signaling no more
4016 * events in the queue
4017 */
4018 bool TelCom_PopSystemEventcxx . . $ TelCom_PopSystemEvent(2cd38c003880a92c).(tTCEventcxx . . $ tTCEvent# *evt) {
4019 if (Telcom_system_queuecxx . . $ Telcom_system_queue.[0].idcxx . . $ tTCEvent#id. != -1) {
4020 memcpy(evt, &Telcom_system_queuecxx . . $ Telcom_system_queue.[0], sizeof(tTCEventcxx . . $ tTCEvent#));
4021
4022 // move all items up in the queue
4023 for (int i = 1; i < MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`!; i++) {
4024 memcpy(&Telcom_system_queuecxx . . $ Telcom_system_queue.[i - 1], &Telcom_system_queuecxx . . $ Telcom_system_queue.[i], sizeof(tTCEventcxx . . $ tTCEvent#));
4025 }
4026 Telcom_system_queuecxx . . $ Telcom_system_queue.[MAX_TELCOM_EVENTScxx . . $ `Descent3/TelCom.h:94:9`! - 1].idcxx . . $ tTCEvent#id. = -1;
4027 return true;
4028 }
4029
4030 return false;
4031 }
4032
4033 struct tCustomKeyEventIDcxx . . $ tCustomKeyEventID# {
4034 int downcountcxx . . $ tCustomKeyEventID#downcount.;
4035 int key_idcxx . . $ tCustomKeyEventID#key_id.;
4036 int event_idcxx . . $ tCustomKeyEventID#event_id.;
4037 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *nextcxx . . $ tCustomKeyEventID#next.;
4038 };
4039 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
4040
4041 /*
4042 Removes any custom key event translation masks
4043 */
4044 void TelCom_ClearCustomKeyEventscxx . . $ TelCom_ClearCustomKeyEvents(49f6e7a06ebc5aa8).(void) {
4045 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *next, *curr = Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root.;
4046
4047 while (curr) {
4048 next = curr->nextcxx . . $ tCustomKeyEventID#next.;
4049
4050 mem_freecxx . . $ `mem/mem.h:80:9`!(curr);
4051 curr = next;
4052 }
4053 Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
4054 }
4055
4056 /*
4057 Adds a custom key event translation mask
4058 */
4059 void TelCom_AddCustomKeyEventcxx . . $ TelCom_AddCustomKeyEvent(3e454b8ccf442868).(int key_id, int event_id) {
4060 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *curr = Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root.;
4061
4062 if (!curr) {
4063 curr = Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root. = (tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(tCustomKeyEventID));
4064 } else {
4065 while (curr->nextcxx . . $ tCustomKeyEventID#next.) {
4066 curr = curr->nextcxx . . $ tCustomKeyEventID#next.;
4067 }
4068 curr->nextcxx . . $ tCustomKeyEventID#next. = (tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(tCustomKeyEventID));
4069 curr = curr->nextcxx . . $ tCustomKeyEventID#next.;
4070 }
4071
4072 curr->nextcxx . . $ tCustomKeyEventID#next. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
4073 curr->event_idcxx . . $ tCustomKeyEventID#event_id. = event_id;
4074 curr->key_idcxx . . $ tCustomKeyEventID#key_id. = key_id;
4075 }
4076
4077 /*
4078 Prepares to handle custom keys
4079 */
4080 void TelCom_PrepareCustomKeyEventscxx . . $ TelCom_PrepareCustomKeyEvents(49f6e7a06ebc5aa8).(void) {
4081 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *curr = Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root.;
4082
4083 while (curr) {
4084 curr->downcountcxx . . $ tCustomKeyEventID#downcount. = 0;
4085 curr = curr->nextcxx . . $ tCustomKeyEventID#next.;
4086 }
4087 }
4088
4089 /*
4090 Post process custom keys
4091 */
4092 void TelCom_PostProcessCustomKeyEventscxx . . $ TelCom_PostProcessCustomKeyEvents(49f6e7a06ebc5aa8).(void) {
4093 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *curr = Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root.;
4094
4095 while (curr) {
4096 if (curr->downcountcxx . . $ tCustomKeyEventID#downcount.) {
4097 TelCom_SendSystemEventcxx . . $ TelCom_SendSystemEvent(b1146eedae1e1d0b).(curr->event_idcxx . . $ tCustomKeyEventID#event_id.);
4098 return;
4099 }
4100
4101 curr = curr->nextcxx . . $ tCustomKeyEventID#next.;
4102 }
4103 }
4104
4105 /*
4106 Handles a possible custom key event
4107 */
4108 void TelCom_ProcessCustomKeyEventcxx . . $ TelCom_ProcessCustomKeyEvent(d4f767463ce0a6b3).(int key_id) {
4109 tCustomKeyEventIDcxx . . $ tCustomKeyEventID# *curr = Telcom_custom_key_event_rootcxx . . $ Telcom_custom_key_event_root.;
4110
4111 while (curr) {
4112 if (key_id == curr->key_idcxx . . $ tCustomKeyEventID#key_id.) {
4113 curr->downcountcxx . . $ tCustomKeyEventID#downcount.++;
4114 return;
4115 }
4116
4117 curr = curr->nextcxx . . $ tCustomKeyEventID#next.;
4118 }
4119 }