Debian Codegraph @

Descent3/Briefing.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/Briefing.cpp $
21 * $Revision: 57 $
22 * $Date: 4/14/99 2:50a $
23 * $Author: Jeff $
24 *
25 * Briefing system
26 *
27 * $Log: /DescentIII/main/Briefing.cpp $
28 *
29 * 57 4/14/99 2:50a Jeff
30 * fixed some case mismatched #includes
31 *
32 * 56 2/25/99 11:56a Jeff
33 * added embedded hottag support
34 *
35 * 55 1/04/99 6:12p Jeff
36 * put in handling of mission state flags
37 *
38 * 54 1/04/99 12:32p Jeff
39 * added support for mission flag parsing
40 *
41 * 53 12/15/98 4:28p Jeff
42 * don't die if the briefing file doesn't exist
43 *
44 * 52 10/12/98 8:32p Jeff
45 * changed the way focus is handled
46 *
47 * 51 9/11/98 10:34a Jeff
48 * Briefing Editor completed
49 *
50 * 50 9/09/98 7:02p Jeff
51 *
52 * 49 8/28/98 12:57p Jeff
53 * added sounds and some key functionality
54 *
55 * 48 8/27/98 2:51p Jeff
56 * New TelCom finally checked in
57 *
58 * 47 8/19/98 1:38p Jeff
59 * removed update2dsound
60 *
61 * 46 8/18/98 11:57a Jeff
62 * fixed sound problem
63 *
64 * 45 7/11/98 9:16p Jeff
65 * moved automatically drawing monitor overlay graphics from update() to a
66 * function of it's own, that way the TelCom API can be avoided if needed
67 *
68 * 44 7/09/98 8:33p Samir
69 * changes for new streaming interface.
70 *
71 * 43 6/26/98 2:49p Jeff
72 * fixed the bug where is you aborted parsing in the middle of a screen
73 * you'd crash
74 *
75 * 42 6/25/98 12:44p Jeff
76 * Added ESC to escape out of TelCom while it's initializing. Added
77 * DestroyScratch to Monitor
78 *
79 * 41 6/19/98 6:05p Jeff
80 * changes made due to voice system
81 *
82 * 40 6/18/98 5:18p Jeff
83 * use new streamaudio system
84 *
85 * 39 6/17/98 8:08p Jeff
86 * removed call to DoVoiceFrame
87 *
88 * 38 6/08/98 3:56p Jeff
89 * added voice support
90 *
91 * 37 5/19/98 3:40p Jeff
92 * poly models functional
93 *
94 * 36 5/18/98 4:20p Jeff
95 * setup TelCom so D3_FAST zips it through
96 *
97 * 35 5/18/98 3:37p Jeff
98 * added glow parameter to $button
99 *
100 * 34 5/15/98 5:16p Jeff
101 * various changes
102 *
103 * 33 5/11/98 6:20p Jeff
104 * added glitch and static keywords
105 *
106 * 32 5/08/98 12:39p Jeff
107 * various cleanups
108 *
109 * 31 5/06/98 6:34p Jeff
110 * capped framerate for mouse
111 *
112 * 30 5/04/98 5:29p Jeff
113 * Added sound frames and mouse cursor drawing
114 *
115 * 29 5/04/98 1:35p Jeff
116 * Changes made for mouse handling
117 *
118 * 28 5/04/98 11:01a Jeff
119 * added scroll param to text
120 *
121 * 27 5/03/98 7:59p Jeff
122 * little changes
123 *
124 * 26 5/01/98 2:16p Jeff
125 * added $title and $sound
126 *
127 * 25 4/30/98 7:16p Jeff
128 * added $font, exiting to mainmenu
129 *
130 * 24 4/29/98 4:36p Jeff
131 * increased text buffer size
132 *
133 * 23 4/28/98 6:58p Jeff
134 * Added new poly model effect driver
135 *
136 * 22 4/26/98 7:22p Jeff
137 * fixed fade ping pong bug, implemented new invert and stretch bitmaps
138 *
139 * 21 4/26/98 2:53a Jeff
140 * Made changes needed for new Effect driver system
141 *
142 * 20 4/24/98 6:35p Jeff
143 * Added space bar page forward
144 *
145 * 19 4/24/98 3:29p Jeff
146 * fixed powerup effect
147 *
148 * 18 4/23/98 7:09p Jeff
149 * added power up/down support
150 *
151 * 17 4/22/98 7:44p Jeff
152 * added flashing buttons
153 *
154 * 16 4/21/98 4:22p Jeff
155 * Call a general purpose function to draw entire telcom screen
156 *
157 * 15 4/20/98 6:45p Jeff
158 * added multiple screen handling and on screen buttons
159 *
160 * 14 4/17/98 6:55p Jeff
161 * Added button support
162 *
163 * 13 4/15/98 6:28p Jeff
164 * Got parsing working for most of the keywords
165 *
166 * 12 3/23/98 9:55a Jeff
167 * Made changes to remove old telcom
168 *
169 * 11 3/12/98 3:32p Jeff
170 * Initial changes started for New TelCom
171 *
172 * 10 2/03/98 12:21p Jeff
173 * changed default font to briefing font
174 *
175 * 9 1/26/98 4:19p Jeff
176 * Added "blur in" bitmap effect
177 *
178 * 8 1/20/98 9:16p Jeff
179 * Added back in fading bitmaps
180 *
181 * 7 1/20/98 6:04p Jeff
182 * Added support for fading fonts
183 *
184 * 6 1/20/98 10:43a Jeff
185 *
186 * 5 1/19/98 5:37p Jeff
187 * Got briefing up to par, and even better than before, added timer so
188 * scroll and type fonts are time based.
189 *
190 * 4 1/16/98 2:40p Jeff
191 * Adjusted so everything is displayed in correct spots, took out
192 * DefaultControl timer, added support for non fading bitmaps
193 *
194 * 3 1/15/98 11:14a Jeff
195 * Changed some code in TelComCallMission() to get Telcom working again
196 *
197 * 2 11/17/97 3:56p Matt
198 * Added the briefing system code
199 *
200 * 1 11/12/97 10:44a Matt
201 *
202 * $NoKeywords: $
203 */
204
205 #include "Briefing.h"cxx . . $ `<file>/Descent3/Briefing.h`/
206 #include "BriefingParse.h"cxx . . $ `<file>/Descent3/BriefingParse.h`/
207 #include <stdlib.h>
208 #include <string.h>
209 #include <ctype.h>
210 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
211 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
212 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
213 #include "voice.h"cxx . . $ `<file>/Descent3/voice.h`/
214 #include "streamaudio.h"cxx . . $ `<file>/stream_audio/streamaudio.h`/
215 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
216 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
217 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
218 #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/
219 #include "TelComEffects.h"cxx . . $ `<file>/Descent3/TelComEffects.h`/
220 #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/
221
222 struct tBriefingTagcxx . . $ tBriefingTag# {
223 const char *namecxx . . $ tBriefingTag#name.;
224 int idcxx . . $ tBriefingTag#id.;
225 int lengthcxx . . $ tBriefingTag#length.;
226 };
227
228 #define TAG_LEVELNUMcxx . . $ `Descent3/Briefing.cpp:228:9`! 0
229 #define TAG_PLEVELNUMcxx . . $ `Descent3/Briefing.cpp:229:9`! 1
230 #define TAG_NLEVELNUMcxx . . $ `Descent3/Briefing.cpp:230:9`! 2
231
232 static tBriefingTagcxx . . $ tBriefingTag# HotTagscxx . . $ HotTags.[] = {
233 {"#LEVELNUM#", TAG_LEVELNUMcxx . . $ `Descent3/Briefing.cpp:228:9`!, -1},
234 {"#PLEVELNUM#", TAG_PLEVELNUMcxx . . $ `Descent3/Briefing.cpp:229:9`!, -1},
235 {"#NLEVELNUM#", TAG_NLEVELNUMcxx . . $ `Descent3/Briefing.cpp:230:9`!, -1},
236 };
237 static const int NumHotTagscxx . . $ NumHotTags. = sizeof(HotTagscxx . . $ HotTags.) / sizeof(tBriefingTagcxx . . $ tBriefingTag#);
238
239 static int osb_xoffcxx . . $ osb_xoff. = 0, osb_yoffcxx . . $ osb_yoff. = 0;
240 static int current_screencxx . . $ current_screen. = -1;
241 static tTelComInfocxx . . $ tTelComInfo# *pb_tcscxx . . $ pb_tcs. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
242 static bool gottitlecxx . . $ gottitle. = false;
243 static bool pbfirst_callcxx . . $ pbfirst_call.;
244 static char pbtitlecxx . . $ pbtitle.[100];
245 static bool ok_to_parse_screencxx . . $ ok_to_parse_screen. = false;
246 static int skipped_screenscxx . . $ skipped_screens.;
247
248 static bool IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(uint32_tcxx . . $ uint32_t# set, uint32_tcxx . . $ uint32_t# unset);
249 static void ReplaceHotTagcxx . . $ ReplaceHotTag(a07d8cccb7673f5a).(char *string, int tag);
250 static bool ParseForHotTagscxx . . $ ParseForHotTags(7d497ed1f110ed85).(const char *src, char **dest);
251 static bool PlayBriefingcxx . . $ PlayBriefing(4a6cbf79c6ed567c).(tTelComInfocxx . . $ tTelComInfo# *tcs);
252 static void PBAddTextEffectcxx . . $ PBAddTextEffect(8c7da23385c075e6).(TCTEXTDESCcxx . . $ TCTEXTDESC#* desc, char *text, char *description, int id);
253 static void PBAddBmpEffectcxx . . $ PBAddBmpEffect(eb50d64d4177044).(TCBMPDESCcxx . . $ TCBMPDESC#* desc, char *description);
254 static void PBAddMovieEffectcxx . . $ PBAddMovieEffect(f897cf82c3cc391).(TCMOVIEDESCcxx . . $ TCMOVIEDESC#* desc, char *description);
255 static void PBAddBkgEffectcxx . . $ PBAddBkgEffect(34f3b3dbfea998a8).(TCBKGDESCcxx . . $ TCBKGDESC#* desc, char *description);
256 static void PBAddPolyEffectcxx . . $ PBAddPolyEffect(e3dc38107ff92692).(TCPOLYDESCcxx . . $ TCPOLYDESC#* desc, char *description);
257 static void PBAddButtonEffectcxx . . $ PBAddButtonEffect(3df5e0aea629f06).(TCBUTTONDESCcxx . . $ TCBUTTONDESC#* desc, char *description, int id);
258 static void PBStartScreencxx . . $ PBStartScreen(8b85e123d4ac146a).(int screen_num, char *description, char *layout, uint32_tcxx . . $ uint32_t# mask_set, uint32_tcxx . . $ uint32_t# mask_unset);
259 static void PBEndScreencxx . . $ PBEndScreen(49f6e7a06ebc5aa8).();
260 static bool PBLoopCallbackcxx . . $ PBLoopCallback(c9857a73d68e59ba).();
261 static void PBSetTitlecxx . . $ PBSetTitle(fda57c8427c60377).(char *title);
262 static void PBSetStaticcxx . . $ PBSetStatic(9364e6e7bff7660).(float amount);
263 static void PBSetGlitchcxx . . $ PBSetGlitch(9364e6e7bff7660).(float amount);
264 static void PBAddVoicecxx . . $ PBAddVoice(4a1b59b32c1450c6).(char *filename, int flags, char *description);
265
266 bool IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(uint32_tcxx . . $ uint32_t# set, uint32_tcxx . . $ uint32_t# unset) {
267 uint32_tcxx . . $ uint32_t# Gamemissionmask = Current_missioncxx . . $ Current_mission..game_state_flagscxx . . $ tMission#game_state_flags.;
268
269 uint32_tcxx . . $ uint32_t# fGamemissionmask;
270 fGamemissionmask = Gamemissionmask ^ 0xFFFFFFFF;
271
272 if (!(((set & Gamemissionmask) == set) && ((unset & fGamemissionmask) == unset))) {
273 return false;
274 }
275
276 return true;
277 }
278
279 void ReplaceHotTagcxx . . $ ReplaceHotTag(a07d8cccb7673f5a).(char *string, int tag) {
280 if (tag < 0 || tag >= NumHotTagscxx . . $ NumHotTags.) {
281 *string = '\0';
282 return;
283 }
284
285 switch (tag) {
286 case TAG_LEVELNUMcxx . . $ `Descent3/Briefing.cpp:228:9`!:
287 sprintf(string, "%d", Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level.);
288 break;
289 case TAG_PLEVELNUMcxx . . $ `Descent3/Briefing.cpp:229:9`!:
290 sprintf(string, "%d", Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1);
291 break;
292 case TAG_NLEVELNUMcxx . . $ `Descent3/Briefing.cpp:230:9`!:
293 sprintf(string, "%d", Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. + 1);
294 break;
295 }
296 }
297
298 // returns true if there were hot tags and it had to allocate memory for dest (so it needs to be freed)
299 #define MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`! 50
300 bool ParseForHotTagscxx . . $ ParseForHotTags(7d497ed1f110ed85).(const char *src, char **dest) {
301 bool ret = false;
302 const char *curr_ptr = src;
303 char *dest_ptr;
304 *dest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
305
306 bool done = false;
307 int length = strlen(src) + 1;
308 int curr_size = length;
309 int curr_index = 0;
310
311 dest_ptr = *dest = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(length);
312 if (!dest_ptr)
313 return false;
314 char replacement[256];
315
316 while (!done) {
317 if (*curr_ptr != '#') {
318 if (*curr_ptr == '\0') {
319 done = true;
320 } else {
321 *dest_ptr = *curr_ptr;
322 dest_ptr++;
323 curr_ptr++;
324 curr_index++;
325 length--;
326
327 if (length < 1) {
328 // we need to allocate some more memory
329 char *new_mem = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(curr_size + MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!);
330 if (!new_mem) {
331 // out of memory
332 mem_freecxx . . $ `mem/mem.h:80:9`!((*dest));
333 *dest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
334 return false;
335 }
336
337 memcpy(new_mem, (*dest), curr_index);
338 mem_freecxx . . $ `mem/mem.h:80:9`!(*dest);
339 *dest = new_mem;
340 dest_ptr = &new_mem[curr_index];
341 curr_size += MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!;
342 length += MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!;
343 }
344 }
345 } else {
346 int is_hot_tag = -1;
347
348 // see if it's a hot tag
349 for (int i = 0; i < NumHotTagscxx . . $ NumHotTags.; i++) {
350 if (HotTagscxx . . $ HotTags.[i].lengthcxx . . $ tBriefingTag#length. == -1)
351 HotTagscxx . . $ HotTags.[i].lengthcxx . . $ tBriefingTag#length. = strlen(HotTagscxx . . $ HotTags.[i].namecxx . . $ tBriefingTag#name.);
352
353 if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(curr_ptr, HotTags[i].name, HotTags[i].length)) {
354 // this is a hot tag!!!!!
355 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Found Embedded HotTag: %s\n", HotTags[i].name);
356 is_hot_tag = i;
357 ret = true;
358 break;
359 }
360 }
361
362 if (is_hot_tag == -1) {
363 // it wasn't a hot tag continue on
364 *dest_ptr = *curr_ptr;
365 dest_ptr++;
366 curr_ptr++;
367 curr_index++;
368 length--;
369
370 if (length < 1) {
371 // we need to allocate some more memory
372 char *new_mem = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(curr_size + MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!);
373 if (!new_mem) {
374 // out of memory
375 mem_freecxx . . $ `mem/mem.h:80:9`!((*dest));
376 *dest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
377 return false;
378 }
379
380 memcpy(new_mem, (*dest), curr_index);
381 mem_freecxx . . $ `mem/mem.h:80:9`!(*dest);
382 *dest = new_mem;
383 dest_ptr = &new_mem[curr_index];
384 curr_size += MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!;
385 length += MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!;
386 }
387 } else {
388 // we need to replace the hot tag
389 ReplaceHotTagcxx . . $ ReplaceHotTag(a07d8cccb7673f5a).(replacement, is_hot_tag);
390 curr_ptr += HotTagscxx . . $ HotTags.[is_hot_tag].lengthcxx . . $ tBriefingTag#length.; // skip past hot tag
391
392 int dest_left = strlen(replacement);
393 char *r_ptr = replacement;
394
395 while (dest_left > 0) {
396 *dest_ptr = *r_ptr;
397 dest_ptr++;
398 curr_index++;
399 length--;
400
401 if (length < 1) {
402 // we need to allocate some more memory
403 char *new_mem = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(curr_size + MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!);
404 if (!new_mem) {
405 // out of memory
406 mem_freecxx . . $ `mem/mem.h:80:9`!((*dest));
407 *dest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
408 return false;
409 }
410
411 memcpy(new_mem, (*dest), curr_index);
412 mem_freecxx . . $ `mem/mem.h:80:9`!(*dest);
413 *dest = new_mem;
414 dest_ptr = &new_mem[curr_index];
415 curr_size += MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!;
416 length += MEMORY_BLOCKcxx . . $ `Descent3/Briefing.cpp:299:9`!;
417 }
418
419 dest_left--;
420 r_ptr++;
421 }
422 }
423 }
424 }
425 *dest_ptr = '\0';
426
427 if (!ret) {
428 mem_freecxx . . $ `mem/mem.h:80:9`!((*dest));
429 *dest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
430 }
431
432 return ret;
433 }
434
435 bool PlayBriefingcxx . . $ PlayBriefing(4a6cbf79c6ed567c).(tTelComInfocxx . . $ tTelComInfo# *tcs) {
436 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(0);
437 bool done = false;
438
439 while (!done) {
440 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(Telcom_called_from_gamecxx . . $ Telcom_called_from_game.);
441
442 if (tcs->statecxx . . $ tTelComInfo#state. == TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`! || tcs->current_statuscxx . . $ tTelComInfo#current_status. != TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`!) {
443 // we're done with the loop
444 done = true;
445 }
446 // Process all waiting events for the TelCom (we may only want to handle this once a frame!)
447 TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(tcs);
448
449 TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).();
450 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
451 if (KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!))
452 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
453
454 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
455 }
456 return true;
457 }
458
459 void PBAddTextEffectcxx . . $ PBAddTextEffect(8c7da23385c075e6).(TCTEXTDESCcxx . . $ TCTEXTDESC#* desc, char *text, char *description, int id) {
460 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCTEXTDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCTEXTDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.) {
461 char *new_text = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
462 const bool new_stuff = ParseForHotTagscxx . . $ ParseForHotTags(7d497ed1f110ed85).(text, &new_text);
463
464 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(desc, new_stuff ? new_text : text, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen., id);
465
466 if (new_text) {
467 mem_freecxx . . $ `mem/mem.h:80:9`!(new_text);
468 }
469 }
470 }
471
472 void PBAddBmpEffectcxx . . $ PBAddBmpEffect(eb50d64d4177044).(TCBMPDESCcxx . . $ TCBMPDESC#* desc, char *description) {
473 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCBMPDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCBMPDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.)
474 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(desc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen.);
475 }
476
477 void PBAddMovieEffectcxx . . $ PBAddMovieEffect(f897cf82c3cc391).(TCMOVIEDESCcxx . . $ TCMOVIEDESC#* desc, char *description) {
478 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCMOVIEDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCMOVIEDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.)
479 CreateMovieEffectcxx . . $ CreateMovieEffect(8c6beb65af861305).(desc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen.);
480 }
481
482 void PBAddBkgEffectcxx . . $ PBAddBkgEffect(34f3b3dbfea998a8).(TCBKGDESCcxx . . $ TCBKGDESC#* desc, char *description) {
483 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCBKGDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCBKGDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.) {
484 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PB: Add Bkg\n");
485 }
486 }
487
488 void PBAddPolyEffectcxx . . $ PBAddPolyEffect(e3dc38107ff92692).(TCPOLYDESCcxx . . $ TCPOLYDESC#* desc, char *description) {
489 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCPOLYDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCPOLYDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.)
490 CreatePolyModelEffectcxx . . $ CreatePolyModelEffect(be6c0a3ab1323a8d).(desc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen.);
491 }
492
493 void PBAddSoundEffectcxx . . $ PBAddSoundEffect(d472e8a5dd13b86a).(TCSNDDESCcxx . . $ TCSNDDESC#* desc, char *description) {
494 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCSNDDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCSNDDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.)
495 CreateSoundEffectcxx . . $ CreateSoundEffect(ab0b0cfe910b3644).(desc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen.);
496 }
497
498 void PBAddButtonEffectcxx . . $ PBAddButtonEffect(3df5e0aea629f06).(TCBUTTONDESCcxx . . $ TCBUTTONDESC#* desc, char *description, int id) {
499 if (IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(desc->mission_mask_setcxx . . $ TCBUTTONDESC#mission_mask_set., desc->mission_mask_unsetcxx . . $ TCBUTTONDESC#mission_mask_unset.) && ok_to_parse_screencxx . . $ ok_to_parse_screen.) {
500 desc->xcxx . . $ TCBUTTONDESC#x. += osb_xoffcxx . . $ osb_xoff.;
501 desc->ycxx . . $ TCBUTTONDESC#y. += osb_yoffcxx . . $ osb_yoff.;
502 desc->tab_stopcxx . . $ TCBUTTONDESC#tab_stop. = false; // no briefing buttons can have focus
503 CreateButtonEffectcxx . . $ CreateButtonEffect(41aa3ad94772acea).(desc, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen., id);
504 }
505 }
506
507 void PBStartScreencxx . . $ PBStartScreen(8b85e123d4ac146a).(int screen_num, char *description, char *layout, uint32_tcxx . . $ uint32_t# mask_set, uint32_tcxx . . $ uint32_t# mask_unset) {
508 if (!IsMissionMaskOKcxx . . $ IsMissionMaskOK(8e1b545ea3aecce3).(mask_set, mask_unset)) {
509 ok_to_parse_screencxx . . $ ok_to_parse_screen. = false;
510 skipped_screenscxx . . $ skipped_screens.++;
511 return;
512 }
513 int real_screen_num = screen_num - skipped_screenscxx . . $ skipped_screens.;
514 ok_to_parse_screencxx . . $ ok_to_parse_screen. = true;
515
516 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(real_screen_num);
517 current_screencxx . . $ current_screen. = real_screen_num;
518
519 TCBKGDESCcxx . . $ TCBKGDESC# backg;
520 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
521 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
522 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
523 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, current_screencxx . . $ current_screen.);
524 if (gottitlecxx . . $ gottitle.) {
525 TCTEXTDESCcxx . . $ TCTEXTDESC# textd;
526 textd.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(200, 200, 200);
527 textd.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_STATICcxx . . $ `Descent3/TelComEfxStructs.h:135:9`!;
528 textd.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
529 textd.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 4;
530 textd.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 300;
531 textd.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 2;
532 textd.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 80;
533 textd.capscxx . . $ TCTEXTDESC#caps. = TCTD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:107:9`! | TCTD_FONTcxx . . $ `Descent3/TelComEfxStructs.h:106:9`! | TCTD_TEXTBOXcxx . . $ `Descent3/TelComEfxStructs.h:111:9`!;
534 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textd, pbtitlecxx . . $ pbtitle., MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, current_screencxx . . $ current_screen.);
535 }
536
537 if (layout) {
538 TCBMPDESCcxx . . $ TCBMPDESC# bmpd;
539 bmpd.capscxx . . $ TCBMPDESC#caps. = TCBD_XYcxx . . $ `Descent3/TelComEfxStructs.h:115:9`!;
540 bmpd.typecxx . . $ TCBMPDESC#type. = TC_BMP_STATICcxx . . $ `Descent3/TelComEfxStructs.h:139:9`!;
541 bmpd.flagscxx . . $ TCBMPDESC#flags. = 0;
542 bmpd.xcxx . . $ TCBMPDESC#x. = bmpd.ycxx . . $ TCBMPDESC#y. = 0;
543 strcpy(bmpd.filenamecxx . . $ TCBMPDESC#filename., layout);
544 CreateBitmapEffectcxx . . $ CreateBitmapEffect(a6e53fec506ced4b).(&bmpd, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, current_screencxx . . $ current_screen.);
545 }
546 }
547
548 void PBEndScreencxx . . $ PBEndScreen(49f6e7a06ebc5aa8).() {
549 if (ok_to_parse_screencxx . . $ ok_to_parse_screen.) {
550 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
551 current_screencxx . . $ current_screen. = -1;
552 }
553 }
554
555 bool PBLoopCallbackcxx . . $ PBLoopCallback(c9857a73d68e59ba).() {
556 if (!pbfirst_callcxx . . $ pbfirst_call.) {
557 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
558 } else
559 pbfirst_callcxx . . $ pbfirst_call. = false;
560
561 bool ret = false;
562 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(Telcom_called_from_gamecxx . . $ Telcom_called_from_game.);
563
564 if (pb_tcscxx . . $ pb_tcs.->statecxx . . $ tTelComInfo#state. == TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`! || pb_tcscxx . . $ pb_tcs.->current_statuscxx . . $ tTelComInfo#current_status. != TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`!) {
565 // we're done with the loop
566 ret = true;
567 }
568
569 // Process all waiting events for the TelCom (we may only want to handle this once a frame!)
570 TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(pb_tcscxx . . $ pb_tcs.);
571 TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).();
572
573 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
574 if (KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!)) {
575 pb_tcscxx . . $ pb_tcs.->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
576 ret = true;
577 }
578
579 return ret;
580 }
581
582 void PBSetTitlecxx . . $ PBSetTitle(fda57c8427c60377).(char *title) {
583 gottitlecxx . . $ gottitle. = true;
584 strcpy(pbtitlecxx . . $ pbtitle., title);
585 }
586
587 void PBSetStaticcxx . . $ PBSetStatic(9364e6e7bff7660).(float amount) {
588 if (amount > 0)
589 TelcomEnableStaticcxx . . $ TelcomEnableStatic(9364e6e7bff7660).(amount);
590 }
591
592 void PBSetGlitchcxx . . $ PBSetGlitch(9364e6e7bff7660).(float amount) {
593 if (amount > 0)
594 TelcomEnableGlitchcxx . . $ TelcomEnableGlitch(9364e6e7bff7660).(amount);
595 }
596
597 void PBAddVoicecxx . . $ PBAddVoice(4a1b59b32c1450c6).(char *filename, int flags,char *description) {}
598
599 bool ParseBriefingcxx . . $ ParseBriefing(b323dcd7712446d0).(const char *filename, tTelComInfocxx . . $ tTelComInfo# *tcs) {
600 if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
601 tcs->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
602 return false;
603 }
604
605 osb_xoffcxx . . $ osb_xoff. = tcs->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
606 osb_yoffcxx . . $ osb_yoff. = tcs->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.;
607 current_screencxx . . $ current_screen. = -1;
608 pb_tcscxx . . $ pb_tcs. = tcs;
609 gottitlecxx . . $ gottitle. = false;
610 pbtitlecxx . . $ pbtitle.[0] = '\0';
611 pbfirst_callcxx . . $ pbfirst_call. = true;
612
613 CBriefParsecxx . . $ CBriefParse# enginecxx . . $ CBriefParse#CBriefParse(49f6e7a06ebc5aa8).;
614 tBriefParseCallbackscxx . . $ tBriefParseCallbacks# pb_callbacks;
615
616 pb_callbacks.AddTextEffectcxx . . $ tBriefParseCallbacks#AddTextEffect. = PBAddTextEffectcxx . . $ PBAddTextEffect(8c7da23385c075e6).;
617 pb_callbacks.AddBmpEffectcxx . . $ tBriefParseCallbacks#AddBmpEffect. = PBAddBmpEffectcxx . . $ PBAddBmpEffect(eb50d64d4177044).;
618 pb_callbacks.AddMovieEffectcxx . . $ tBriefParseCallbacks#AddMovieEffect. = PBAddMovieEffectcxx . . $ PBAddMovieEffect(f897cf82c3cc391).;
619 pb_callbacks.AddBkgEffectcxx . . $ tBriefParseCallbacks#AddBkgEffect. = PBAddBkgEffectcxx . . $ PBAddBkgEffect(34f3b3dbfea998a8).;
620 pb_callbacks.AddPolyEffectcxx . . $ tBriefParseCallbacks#AddPolyEffect. = PBAddPolyEffectcxx . . $ PBAddPolyEffect(e3dc38107ff92692).;
621 pb_callbacks.AddSoundEffectcxx . . $ tBriefParseCallbacks#AddSoundEffect. = PBAddSoundEffectcxx . . $ PBAddSoundEffect(d472e8a5dd13b86a).;
622 pb_callbacks.AddButtonEffectcxx . . $ tBriefParseCallbacks#AddButtonEffect. = PBAddButtonEffectcxx . . $ PBAddButtonEffect(3df5e0aea629f06).;
623 pb_callbacks.StartScreencxx . . $ tBriefParseCallbacks#StartScreen. = PBStartScreencxx . . $ PBStartScreen(8b85e123d4ac146a).;
624 pb_callbacks.EndScreencxx . . $ tBriefParseCallbacks#EndScreen. = PBEndScreencxx . . $ PBEndScreen(49f6e7a06ebc5aa8).;
625 pb_callbacks.LoopCallbackcxx . . $ tBriefParseCallbacks#LoopCallback. = PBLoopCallbackcxx . . $ PBLoopCallback(c9857a73d68e59ba).;
626 pb_callbacks.SetTitlecxx . . $ tBriefParseCallbacks#SetTitle. = PBSetTitlecxx . . $ PBSetTitle(fda57c8427c60377).;
627 pb_callbacks.SetStaticcxx . . $ tBriefParseCallbacks#SetStatic. = PBSetStaticcxx . . $ PBSetStatic(9364e6e7bff7660).;
628 pb_callbacks.SetGlitchcxx . . $ tBriefParseCallbacks#SetGlitch. = PBSetGlitchcxx . . $ PBSetGlitch(9364e6e7bff7660).;
629 pb_callbacks.AddVoicecxx . . $ tBriefParseCallbacks#AddVoice. = PBAddVoicecxx . . $ PBAddVoice(4a1b59b32c1450c6).;
630
631 engine.SetCallbackscxx . . $ CBriefParse#SetCallbacks(9ee811468c67755d).(&pb_callbacks);
632
633 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).();
634 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
635
636 skipped_screenscxx . . $ skipped_screens. = 0;
637 int ret = engine.ParseBriefingcxx . . $ CBriefParse#ParseBriefing(5c4306d8553b3696).(filename);
638 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
639
640 if (ret == PBERR_NOERRcxx . . $ `Descent3/BriefingParse.h:62:9`!) {
641 PlayBriefingcxx . . $ PlayBriefing(4a6cbf79c6ed567c).(tcs);
642 }
643
644 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).(true);
645 TelcomCreateDummyScreencxx . . $ TelcomCreateDummyScreen(49f6e7a06ebc5aa8).();
646 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
647
648 TelcomDisableStaticcxx . . $ TelcomDisableStatic(49f6e7a06ebc5aa8).();
649 TelcomDisableGlitchcxx . . $ TelcomDisableGlitch(49f6e7a06ebc5aa8).();
650
651 return false;
652 }