Debian Codegraph @

Descent3/TelComAutoMap.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/TelComAutoMap.cpp $
21 * $Revision: 37 $
22 * $Date: 7/20/99 4:59p $
23 * $Author: Samir $
24 *
25 * TelCom Automap
26 *
27 * $Log: /DescentIII/main/TelComAutoMap.cpp $
28 *
29 * 37 7/20/99 4:59p Samir
30 * automap key will close automap.
31 *
32 * 36 5/13/99 3:42p Ardussi
33 * changes for compiling on the Mac
34 *
35 * 35 4/24/99 6:46p Jeff
36 * added functions for theif so he can steal things other than weapons
37 *
38 * 34 4/24/99 5:45p Matt
39 * Made the marker message use a localizable string.
40 *
41 * 33 4/24/99 1:54a Matt
42 * Changed to use briefing font for labels at bottom, and HUD font for
43 * name at top.
44 *
45 * 32 4/14/99 11:44a Jason
46 * fixes for secret rooms
47 *
48 * 31 4/14/99 3:57a Jeff
49 * fixed case mismatch in #includes
50 *
51 * 30 4/11/99 2:24p Kevin
52 * made AM_rotated_points dynamically allocated so it's only used if you
53 * go into the automap. Should help dedicated servers quite a bit.
54 *
55 * 29 4/02/99 5:42p Jason
56 * display level info name instead of current level name. Confused?
57 * Yeah, so am I.
58 *
59 * 28 4/01/99 5:58p Jason
60 * automap now tells you exactly where you haven't gone yet...dunno if
61 * this is a good thing. If enough people bitch then I will change it.
62 *
63 * 27 3/31/99 5:29p Jeff
64 * new way of key processesing...can capture printscreen now
65 *
66 * 26 3/29/99 7:30p Jason
67 * added fading doors
68 *
69 * 25 2/25/99 11:02p Jeff
70 * fixed automap rendering
71 *
72 * 24 2/24/99 6:23p Samir
73 * poll controls if in automap, not suspend and resume per frame.
74 *
75 * 23 2/22/99 3:37p Jason
76 * fixed markers in telcom
77 *
78 * 22 2/15/99 5:32p Jason
79 * made ship blink in automap
80 *
81 * 21 2/01/99 4:35p Jeff
82 * tab exits the automap
83 *
84 * 20 1/29/99 7:13p Jeff
85 * localization
86 *
87 * 19 1/29/99 11:29a Jason
88 * added misc bug fixes/features
89 *
90 * 18 1/21/99 11:15p Jeff
91 * pulled out some structs and defines from header files and moved them
92 * into seperate header files so that multiplayer dlls don't require major
93 * game headers, just those new headers. Side effect is a shorter build
94 * time. Also cleaned up some header file #includes that weren't needed.
95 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
96 * manage.h and multi.h
97 *
98 * 17 12/23/98 3:08p Jason
99 * added new player ship
100 *
101 * 16 12/16/98 4:17p Jason
102 * draw external rooms no matter what
103 *
104 * 15 12/15/98 4:39p Jason
105 * added some more telcom functions
106 *
107 * 14 12/14/98 11:57a Jason
108 * changes for visibile automap
109 *
110 * 13 12/14/98 11:06a Jason
111 * changes for 1.1
112 *
113 * 12 12/11/98 11:37a Jason
114 *
115 * 11 12/09/98 2:52p Jason
116 * fixed automap problem on terrain
117 *
118 * 10 12/09/98 2:36p Jeff
119 * added function to enable/disable telcom system keys and disabled most
120 * system keys while in Automap
121 *
122 * 9 12/09/98 1:09p Jason
123 * second draft of automap
124 *
125 * 8 12/07/98 5:37p Jason
126 * first pass at automap
127 *
128 * 7 8/28/98 12:57p Jeff
129 * added sounds and some key functionality
130 *
131 * 6 8/27/98 2:51p Jeff
132 * New TelCom finally checked in
133 *
134 * 5 7/28/98 12:02p Jeff
135 * got file prepared for Matt to implement Automap
136 *
137 * 4 7/11/98 9:16p Jeff
138 * moved automatically drawing monitor overlay graphics from update() to a
139 * function of it's own, that way the TelCom API can be avoided if needed
140 *
141 * 3 6/16/98 10:54a Jeff
142 *
143 * 2 5/18/98 2:23p Jeff
144 * Automap displays stand-in art right now
145 *
146 * $NoKeywords: $
147 */
148
149 #include "TelComAutoMap.h"cxx . . $ `<file>/Descent3/TelComAutoMap.h`/
150 #include <stdlib.h>
151 #include <string.h>
152 #include <ctype.h>
153
154 #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/
155 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
156 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
157 #include "bitmap.h"cxx . . $ `<file>/lib/bitmap.h`/
158 #include "room.h"cxx . . $ `<file>/Descent3/room.h`/
159
160 #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/
161 #include "TelComEffects.h"cxx . . $ `<file>/Descent3/TelComEffects.h`/
162 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
163 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
164 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
165 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
166 #include "lightmap_info.h"cxx . . $ `<file>/Descent3/lightmap_info.h`/
167 #include "lightmap.h"cxx . . $ `<file>/lib/lightmap.h`/
168 #include "controls.h"cxx . . $ `<file>/Descent3/controls.h`/
169 #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/
170 #include "config.h"cxx . . $ `<file>/Descent3/config.h`/
171 #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/
172 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
173 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
174 #include "gamesequence.h"cxx . . $ `<file>/Descent3/gamesequence.h`/
175 #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/
176 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
177 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
178 #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/
179 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
180
181 // Variables needed for automap
182 static vectorcxx . . $ vector# AM_view_poscxx . . $ AM_view_pos. = {0, 0, 0};
183 static matrixcxx . . $ matrix# AM_view_orientcxx . . $ AM_view_orient.;
184 static tTelComInfocxx . . $ tTelComInfo# *AM_tcscxx . . $ AM_tcs.;
185 static int AM_ship_model_handlecxx . . $ AM_ship_model_handle. = -1;
186
187 uint8_tcxx . . $ uint8_t# AutomapVisMapcxx . . $ AutomapVisMap.[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!];
188
189 static float AM_headingcxx . . $ AM_heading.;
190 static float AM_pitchcxx . . $ AM_pitch.;
191
192 int AM_terraincxx . . $ AM_terrain. = 0, AM_realigncxx . . $ AM_realign. = 0, AM_center_on_playercxx . . $ AM_center_on_player. = 0, AM_current_markercxx . . $ AM_current_marker.;
193
194 static int Num_AM_roomscxx . . $ Num_AM_rooms.;
195 static uint16_tcxx . . $ uint16_t# AM_room_listcxx . . $ AM_room_list.[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!];
196 static uint8_tcxx . . $ uint8_t# AM_rooms_seencxx . . $ AM_rooms_seen.[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!];
197 static g3Pointcxx . . $ g3Point# *AM_rotated_pointscxx . . $ AM_rotated_points. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; //[MAX_VERTS_PER_ROOM];
198
199 static void TCAMCallbackcxx . . $ TCAMCallback(49f6e7a06ebc5aa8).(void);
200
201 static uint8_tcxx . . $ uint8_t# *Small_facescxx . . $ Small_faces.[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!];
202
203 // clears out the list of visible rooms that we've seen
204 void AutomapClearVisMapcxx . . $ AutomapClearVisMap(49f6e7a06ebc5aa8).() { memset(AutomapVisMapcxx . . $ AutomapVisMap., 0, MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!); }
205
206 void ClassifyAMFacescxx . . $ ClassifyAMFaces(49f6e7a06ebc5aa8).() {
207 int i = 0;
208 for (i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) {
209 if (Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used.) {
210 Small_facescxx . . $ Small_faces.[i] = (uint8_tcxx . . $ uint8_t# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(Rooms[i].num_faces);
211 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Small_faces[i]);
212
213 memset(Small_facescxx . . $ Small_faces.[i], 0, Roomscxx . . $ Rooms.[i].num_facescxx . . $ room#num_faces.);
214
215 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[i];
216
217 for (int t = 0; t < rp->num_facescxx . . $ room#num_faces.; t++) {
218 facecxx . . $ face# *fp = &rp->facescxx . . $ room#faces.[t];
219
220 vectorcxx . . $ vector# verts[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!];
221 vectorcxx . . $ vector# center;
222 for (int k = 0; k < fp->num_vertscxx . . $ face#num_verts.; k++)
223 verts[k] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[k]];
224
225 float size = vm_GetCentroidFastcxx . . $ vm_GetCentroidFast(9f2e9a768aacd0cc).(&center, verts, fp->num_vertscxx . . $ face#num_verts.);
226
227 if (size < 120)
228 Small_facescxx . . $ Small_faces.[i][t] = 1;
229 if (size < 60)
230 Small_facescxx . . $ Small_faces.[i][t] = 2;
231 }
232 }
233 }
234 }
235
236 void FreeAMFacescxx . . $ FreeAMFaces(49f6e7a06ebc5aa8).() {
237 for (int i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) {
238 if (Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used.) {
239 mem_freecxx . . $ `mem/mem.h:80:9`!(Small_faces[i]);
240 Small_facescxx . . $ Small_faces.[i] = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
241 }
242 }
243 }
244
245 // Returns the camera position to the player
246 void TCAMCenterOnPlayercxx . . $ TCAMCenterOnPlayer(49f6e7a06ebc5aa8).() {
247
248 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&AM_view_poscxx . . $ AM_view_pos.);
249 vm_MakeIdentitycxx . . $ vm_MakeIdentity(dca75c48c9ab5b54).(&AM_view_orientcxx . . $ AM_view_orient.);
250
251 matrixcxx . . $ matrix# newmat;
252 angveccxx . . $ angvec# heading;
253 AM_view_poscxx . . $ AM_view_pos. =cxx . . $ vector#`operator=`(c0842353a20857d). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 10);
254 vm_ExtractAnglesFromMatrixcxx . . $ vm_ExtractAnglesFromMatrix(5f9a6d6f613ae256).(&heading, &Player_objectcxx . . $ Player_object.->orientcxx . . $ object#orient.);
255
256 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&newmat, 0, heading.hcxx . . $ angvec#h., 0);
257 AM_view_orientcxx . . $ AM_view_orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). newmat;
258
259 AM_headingcxx . . $ AM_heading. = heading.hcxx . . $ angvec#h.;
260 AM_pitchcxx . . $ AM_pitch. = heading.pcxx . . $ angvec#p.;
261 }
262
263 // This is the function called by TelCom
264 // return true if TelCom should exit to TelCom Main Menu
265 // return false if you should exit out of TelCom completly
266 // mmonitor = main monitor class
267 // lmonitor = local monitor class (the monitor at the top of the screen)
268 bool TelComAutoMapcxx . . $ TelComAutoMap(4a6cbf79c6ed567c).(tTelComInfocxx . . $ tTelComInfo# *tcs) {
269 bool done = false;
270
271 if (!AM_rotated_pointscxx . . $ AM_rotated_points.) {
272 AM_rotated_pointscxx . . $ AM_rotated_points. = (g3Pointcxx . . $ g3Point# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(g3Point) * MAX_VERTS_PER_ROOMcxx . . $ `Descent3/room_external.h:107:9`!);
273 }
274 AM_tcscxx . . $ AM_tcs. = tcs;
275 AM_current_markercxx . . $ AM_current_marker. = -1;
276 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!, false); // disable all telcom system keys
277 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_F1cxx . . $ `Descent3/TelCom.h:111:9`!, true); // enable F1 and enter, those are all we may need in automap
278 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_F2cxx . . $ `Descent3/TelCom.h:112:9`!, true); // enable F2 and enter, those are all we may need in automap
279 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_F3cxx . . $ `Descent3/TelCom.h:113:9`!, true); // enable F3 and enter, those are all we may need in automap
280 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_1cxx . . $ `Descent3/TelCom.h:115:9`!, true); // enable marker key
281 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_2cxx . . $ `Descent3/TelCom.h:116:9`!, true); // enable marker key
282 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_3cxx . . $ `Descent3/TelCom.h:117:9`!, true); // enable marker key
283 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_4cxx . . $ `Descent3/TelCom.h:118:9`!, true); // enable marker key
284 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_5cxx . . $ `Descent3/TelCom.h:119:9`!, true); // enable marker key
285 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_6cxx . . $ `Descent3/TelCom.h:120:9`!, true); // enable marker key
286 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_7cxx . . $ `Descent3/TelCom.h:121:9`!, true); // enable marker key
287 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_8cxx . . $ `Descent3/TelCom.h:122:9`!, true); // enable marker key
288 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_ENTERcxx . . $ `Descent3/TelCom.h:108:9`!, true); // processing other keys is a waste of cpu
289 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_PRINTSCRNcxx . . $ `Descent3/TelCom.h:114:9`!, true);
290
291 // Classify faces
292 ClassifyAMFacescxx . . $ ClassifyAMFaces(49f6e7a06ebc5aa8).();
293
294 // Load ship model
295 AM_ship_model_handlecxx . . $ AM_ship_model_handle. = LoadPolyModelcxx . . $ LoadPolyModel(220e687f58daa9be).("automapship.oof"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., 0);
296
297 // Setup intial pos/orient
298 TCAMCenterOnPlayercxx . . $ TCAMCenterOnPlayer(49f6e7a06ebc5aa8).();
299 if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Viewer_object)) {
300 AM_terraincxx . . $ AM_terrain. = 1;
301 }
302
303 TelcomStartScreencxx . . $ TelcomStartScreen(d4f767463ce0a6b3).(0);
304
305 // setup general background, plain color
306 TCBKGDESCcxx . . $ TCBKGDESC# backg;
307 backg.colorcxx . . $ TCBKGDESC#color. = BACKGROUND_COLORcxx . . $ `Descent3/TelCom.h:58:9`!;
308 backg.capscxx . . $ TCBKGDESC#caps. = TCBGD_COLORcxx . . $ `Descent3/TelComEfxStructs.h:127:9`!;
309 backg.typecxx . . $ TCBKGDESC#type. = TC_BACK_STATICcxx . . $ `Descent3/TelComEfxStructs.h:144:9`!;
310
311 /*//load up the "fake automap" <----Start Remove---->
312 TCBMPDESC bmpdesc;
313 bmpdesc.type = TC_BMP_STATIC;
314 bmpdesc.flags = 0;
315 bmpdesc.caps=TCBD_XY;
316 bmpdesc.x = 0; bmpdesc.y = 0;
317 strcpy(bmpdesc.filename,"TCMap.ogf");
318 // <----End Remove ---->*/
319
320 // setup text for the top monitor "Automap"
321 TCTEXTDESCcxx . . $ TCTEXTDESC# textdesc;
322 textdesc.typecxx . . $ TCTEXTDESC#type. = TC_TEXT_STATICcxx . . $ `Descent3/TelComEfxStructs.h:135:9`!;
323 textdesc.fontcxx . . $ TCTEXTDESC#font. = BBRIEF_FONT_INDEXcxx . . $ `Descent3/gamefont.h:114:9`!;
324 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`!;
325 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..leftcxx . . $ tc_text#left. = 65;
326 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..rightcxx . . $ tc_text#right. = 380;
327 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..topcxx . . $ tc_text#top. = 2;
328 textdesc.textboxcxx . . $ TCTEXTDESC#textbox..bottomcxx . . $ tc_text#bottom. = 50;
329 textdesc.colorcxx . . $ TCTEXTDESC#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255);
330
331 // Setup Main Monitor
332 // CreateBitmapEffect(&bmpdesc,MONITOR_MAIN,0);
333 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!, 0); //<---- Replace above line with this line to get a background
334
335 // Setup Location Monitor (small window at top)
336 CreateBackgroundEffectcxx . . $ CreateBackgroundEffect(36995d1e7af252ca).(&backg, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0);
337 CreateTextEffectcxx . . $ CreateTextEffect(b73a9a5c42deb467).(&textdesc, TXT_TCAUTOMAPcxx . . $ `Descent3/stringtable.h:207:9`!, MONITOR_TOPcxx . . $ `Descent3/TelCom.h:99:9`!, 0);
338 TelcomEndScreencxx . . $ TelcomEndScreen(49f6e7a06ebc5aa8).();
339 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(0);
340 TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(TCAMCallbackcxx . . $ TCAMCallback(49f6e7a06ebc5aa8).);
341
342 ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).(); // need to do because we're most likely coming from game.
343
344 while (!done) {
345 ct_packetcxx . . $ ct_packet# automap_key;
346
347 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(Telcom_called_from_gamecxx . . $ Telcom_called_from_game.);
348
349 if (Telcom_systemcxx . . $ Telcom_system..statecxx . . $ tTelComInfo#state. != TCS_POWERONcxx . . $ `Descent3/TelCom.h:133:9`! || tcs->current_statuscxx . . $ tTelComInfo#current_status. != TS_MAPcxx . . $ `Descent3/TelCom.h:88:9`!) {
350 // we're done with the loop
351 done = true;
352 }
353
354 // Process all waiting events for the TelCom (we may only want to handle this once a frame!)
355 TelComHandleAllEventscxx . . $ TelComHandleAllEvents(9b1dcfbcd79f78bb).(tcs);
356
357 TelcomRenderScreencxx . . $ TelcomRenderScreen(22445115de651e24).();
358 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
359 if (KEY_STATEcxx . . $ `ddio/ddio_common.h:204:9`!(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!)) {
360 AM_tcscxx . . $ AM_tcs.->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
361 }
362 // if(KEY_STATE(KEY_TAB)){
363 // AM_tcs->state = TCS_POWEROFF;
364 // }
365
366 // read controls
367 Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUTOMAP_KEYcxx . . $ ctfAUTOMAP_KEY., &automap_key);
368 if (automap_key.valuecxx . . $ ct_packet#value. > 0.0f) {
369 AM_tcscxx . . $ AM_tcs.->statecxx . . $ tTelComInfo#state. = TCS_POWEROFFcxx . . $ `Descent3/TelCom.h:132:9`!;
370 }
371
372 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
373 }
374
375 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
376
377 DestroyAllScreenscxx . . $ DestroyAllScreens(b45ddcbc8423892c).();
378 TelcomRenderSetScreencxx . . $ TelcomRenderSetScreen(d4f767463ce0a6b3).(DUMMY_SCREENcxx . . $ `Descent3/TelCom.h:95:9`!);
379 TelcomRenderSetCallbackcxx . . $ TelcomRenderSetCallback(964b12a25712bdc3).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
380
381 FreeAMFacescxx . . $ FreeAMFaces(49f6e7a06ebc5aa8).();
382
383 if (AM_ship_model_handlecxx . . $ AM_ship_model_handle. != -1) {
384 FreePolyModelcxx . . $ FreePolyModel(d4f767463ce0a6b3).(AM_ship_model_handlecxx . . $ AM_ship_model_handle.);
385 }
386
387 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_MAXKEYScxx . . $ `Descent3/TelCom.h:125:9`!, true); // re-enable all telcom keys
388 TelComEnableSystemKeycxx . . $ TelComEnableSystemKey(918ebd27a9ddbad3).(TCSYS_F1cxx . . $ `Descent3/TelCom.h:111:9`!, false); // disable the T key, not needed outside of automap
389 if (AM_rotated_pointscxx . . $ AM_rotated_points.) {
390 mem_freecxx . . $ `mem/mem.h:80:9`!(AM_rotated_points);
391 AM_rotated_pointscxx . . $ AM_rotated_points. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
392 }
393 return true;
394 }
395
396 // Builds a list of rooms to draw for the automap
397 void TCAMBuildRoomListcxx . . $ TCAMBuildRoomList(d4f767463ce0a6b3).(int startroom) {
398 memset(AM_rooms_seencxx . . $ AM_rooms_seen., 0, MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!);
399 Num_AM_roomscxx . . $ Num_AM_rooms. = 0;
400
401 if (startroom > 0) {
402 AM_room_listcxx . . $ AM_room_list.[Num_AM_roomscxx . . $ Num_AM_rooms.++] = startroom;
403 AM_rooms_seencxx . . $ AM_rooms_seen.[startroom] = 1;
404 }
405
406 int i = 0;
407 for (i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) {
408 if (Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used. && !AM_rooms_seencxx . . $ AM_rooms_seen.[i] && (AutomapVisMapcxx . . $ AutomapVisMap.[i] == 1 || (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!))) {
409 AM_room_listcxx . . $ AM_room_list.[Num_AM_roomscxx . . $ Num_AM_rooms.++] = i;
410 AM_rooms_seencxx . . $ AM_rooms_seen.[i] = 1;
411 }
412 }
413 }
414
415 // Takes a min,max vector and makes a surrounding cube from it
416 void MakePointsFromMinMaxcxx . . $ MakePointsFromMinMax(af83aca25ba5b41c).(vectorcxx . . $ vector# *corners, vectorcxx . . $ vector# *minp, vectorcxx . . $ vector# *maxp);
417 // Returns true if the external room is in the view cone
418 // Else returns false
419 bool IsRoomVisiblecxx . . $ IsRoomVisible(e0edce58e5be2d50).(roomcxx . . $ room# *rp, float *nearz) {
420 g3Pointcxx . . $ g3Point# pnt;
421 uint8_tcxx . . $ uint8_t# ccode;
422
423 vectorcxx . . $ vector# corners[8];
424
425 MakePointsFromMinMaxcxx . . $ MakePointsFromMinMax(af83aca25ba5b41c).(corners, &rp->min_xyzcxx . . $ room#min_xyz., &rp->max_xyzcxx . . $ room#max_xyz.);
426
427 *nearz = 90000000;
428 uint8_tcxx . . $ uint8_t# andbyte = 0xff;
429 for (int t = 0; t < 8; t++) {
430 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt, &corners[t]);
431
432 if (pnt.p3_zcxx . . $ `lib/3d.h:247:9`! < *nearz)
433 *nearz = pnt.p3_zcxx . . $ `lib/3d.h:247:9`!;
434
435 ccode = g3_CodePointcxx . . $ g3_CodePoint(1c2cda054d3314c5).(&pnt);
436 if (!ccode)
437 return true;
438 andbyte &= ccode;
439 }
440
441 if (andbyte)
442 return false;
443
444 return true;
445 }
446
447 void TCAMRenderRoomcxx . . $ TCAMRenderRoom(d4f767463ce0a6b3).(int roomnum) {
448 ASSERTcxx . . $ `misc/pserror.h:246:9`!(Rooms[roomnum].used);
449 roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[roomnum];
450 static int first = 1;
451 static float lm_red[32], lm_green[32], lm_blue[32];
452 float nearz;
453 int i;
454
455 if (first) {
456 first = 0;
457 for (int i = 0; i < 32; i++) {
458 lm_red[i] = ((float)i / 31.0);
459 lm_green[i] = ((float)i / 31.0);
460 lm_blue[i] = ((float)i / 31.0);
461 }
462 }
463
464 if ((rp->flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!) && !AM_terraincxx . . $ AM_terrain.)
465 return;
466
467 if (!IsRoomVisiblecxx . . $ IsRoomVisible(e0edce58e5be2d50).(rp, &nearz))
468 return;
469
470 // rotate all the points for this room
471 for (i = 0; i < rp->num_vertscxx . . $ room#num_verts.; i++) {
472 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&AM_rotated_pointscxx . . $ AM_rotated_points.[i], &rp->vertscxx . . $ room#verts.[i]);
473 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(&AM_rotated_pointscxx . . $ AM_rotated_points.[i]);
474 }
475
476 for (i = 0; i < rp->num_facescxx . . $ room#num_faces.; i++) {
477 g3Pointcxx . . $ g3Point# *pointlist[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!];
478 g3Pointcxx . . $ g3Point# pointbuffer[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!];
479
480 facecxx . . $ face# *fp = &rp->facescxx . . $ room#faces.[i];
481
482 // See if this face is backfaced
483 vectorcxx . . $ vector# subvec = rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[0]] -cxx . . $ operator-(b77b703cd1e43e33). AM_view_poscxx . . $ AM_view_pos.;
484 if (subvec *cxx . . $ `operator*`(4a721543d64e126a). fp->normalcxx . . $ face#normal. > 0)
485 continue; // backfaced
486
487 int black_face = 0, wacky_face = 0;
488
489 if (fp->portal_numcxx . . $ face#portal_num. != -1) {
490 if (!AutomapVisMapcxx . . $ AutomapVisMap.[rp->portalscxx . . $ room#portals.[fp->portal_numcxx . . $ face#portal_num.].croomcxx . . $ portal#croom.]) {
491 // Don't give away secret rooms
492 if (Roomscxx . . $ Rooms.[rp->portalscxx . . $ room#portals.[fp->portal_numcxx . . $ face#portal_num.].croomcxx . . $ portal#croom.].flagscxx . . $ room#flags. & RF_SECRETcxx . . $ `Descent3/room_external.h:201:9`!)
493 black_face = 1;
494 else
495 wacky_face = 1;
496 } else
497 continue;
498 }
499
500 if (nearz > 600) {
501 if (Small_facescxx . . $ Small_faces.[roomnum][i] != 0)
502 continue;
503 } else if (nearz > 300) {
504 if (Small_facescxx . . $ Small_faces.[roomnum][i] == 2)
505 continue;
506 }
507
508 // Color this face from the lightmaps
509 if (!black_face && !wacky_face && (fp->flagscxx . . $ face#flags. & FF_LIGHTMAPcxx . . $ `Descent3/room_external.h:112:9`!)) {
510 int lm_handle = LightmapInfocxx . . $ LightmapInfo.[fp->lmi_handlecxx . . $ face#lmi_handle.].lm_handlecxx . . $ lightmap_info#lm_handle.;
511 uint16_tcxx . . $ uint16_t# *data = (uint16_tcxx . . $ uint16_t# *)lm_datacxx . . $ lm_data(2fbd6a760478ca0f).(lm_handle);
512 int w = lm_wcxx . . $ lm_w(7864480464b09eea).(lm_handle);
513 int h = lm_hcxx . . $ lm_h(7864480464b09eea).(lm_handle);
514
515 for (int t = 0; t < fp->num_vertscxx . . $ face#num_verts.; t++) {
516 pointbuffer[t] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). AM_rotated_pointscxx . . $ AM_rotated_points.[fp->face_vertscxx . . $ face#face_verts.[t]];
517 g3Pointcxx . . $ g3Point# *p = &pointbuffer[t];
518 pointlist[t] = p;
519
520 float u = fp->face_uvlscxx . . $ face#face_uvls.[t].u2cxx . . $ roomUVL#u2. * w;
521 float v = fp->face_uvlscxx . . $ face#face_uvls.[t].v2cxx . . $ roomUVL#v2. * h;
522
523 int int_u = u;
524 int int_v = v;
525
526 uint16_tcxx . . $ uint16_t# texel = data[int_v * w + int_u];
527
528 int r = (texel >> 10) & 0x1f;
529 int g = (texel >> 5) & 0x1f;
530 int b = (texel) & 0x1f;
531
532 p->p3_rcxx . . $ `lib/3d.h:253:9`! = lm_red[r];
533 p->p3_gcxx . . $ `lib/3d.h:254:9`! = lm_green[g];
534 p->p3_bcxx . . $ `lib/3d.h:255:9`! = lm_blue[b];
535 p->p3_acxx . . $ `lib/3d.h:256:9`! = 1.0;
536 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
537 }
538
539 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(fp->num_vertscxx . . $ face#num_verts., pointlist, 0);
540 } else {
541 for (int t = 0; t < fp->num_vertscxx . . $ face#num_verts.; t++) {
542 pointbuffer[t] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). AM_rotated_pointscxx . . $ AM_rotated_points.[fp->face_vertscxx . . $ face#face_verts.[t]];
543 g3Pointcxx . . $ g3Point# *p = &pointbuffer[t];
544 pointlist[t] = p;
545
546 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
547 p->p3_rcxx . . $ `lib/3d.h:253:9`! = 0.0;
548 p->p3_gcxx . . $ `lib/3d.h:254:9`! = 0.0;
549 p->p3_bcxx . . $ `lib/3d.h:255:9`! = 0.0;
550 p->p3_acxx . . $ `lib/3d.h:256:9`! = 1.0;
551
552 if (wacky_face) {
553 float curtime = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
554 int val = curtime;
555 float fval = curtime - val;
556 p->p3_rcxx . . $ `lib/3d.h:253:9`! = fval;
557 p->p3_gcxx . . $ `lib/3d.h:254:9`! = fval;
558 p->p3_bcxx . . $ `lib/3d.h:255:9`! = fval;
559 p->p3_acxx . . $ `lib/3d.h:256:9`! = 1.0;
560 }
561 }
562 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(fp->num_vertscxx . . $ face#num_verts., pointlist, 0);
563 }
564 }
565 }
566
567 #define AM_TRANSLATION_SCALARcxx . . $ `Descent3/TelComAutoMap.cpp:567:9`! 200.0f
568 #define AM_ROTATIONAL_SCALARcxx . . $ `Descent3/TelComAutoMap.cpp:568:9`! 90
569
570 // Reads the controls for the automap, and adjusts viewpoint accordingly
571 void TCAMReadControlscxx . . $ TCAMReadControls(49f6e7a06ebc5aa8).() {
572 Frametimecxx . . $ Frametime. = last_frametimecxx . . $ last_frametime.;
573 int save_mode = Game_interface_modecxx . . $ Game_interface_mode.;
574 game_controlscxx . . $ game_controls# controls;
575
576 controls.toggle_slidecxx . . $ game_controls#toggle_slide. = 0;
577 controls.toggle_bankcxx . . $ game_controls#toggle_bank. = 0;
578 Game_interface_modecxx . . $ Game_interface_mode. = GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!;
579
580 PollControlscxx . . $ PollControls(49f6e7a06ebc5aa8).();
581 DoMovementcxx . . $ DoMovement(728771fc1cd83448).(&controls);
582
583 // Do translational movement
584 AM_view_poscxx . . $ AM_view_pos. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (controls.forward_thrustcxx . . $ game_controls#forward_thrust. * last_frametimecxx . . $ last_frametime. * AM_TRANSLATION_SCALARcxx . . $ `Descent3/TelComAutoMap.cpp:567:9`!) *cxx . . $ `operator*`(9d6577ff3e9faa29). AM_view_orientcxx . . $ AM_view_orient..fveccxx . . $ matrix#fvec.;
585 AM_view_poscxx . . $ AM_view_pos. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (controls.vertical_thrustcxx . . $ game_controls#vertical_thrust. * last_frametimecxx . . $ last_frametime. * AM_TRANSLATION_SCALARcxx . . $ `Descent3/TelComAutoMap.cpp:567:9`!) *cxx . . $ `operator*`(9d6577ff3e9faa29). AM_view_orientcxx . . $ AM_view_orient..uveccxx . . $ matrix#uvec.;
586 AM_view_poscxx . . $ AM_view_pos. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (controls.sideways_thrustcxx . . $ game_controls#sideways_thrust. * last_frametimecxx . . $ last_frametime. * AM_TRANSLATION_SCALARcxx . . $ `Descent3/TelComAutoMap.cpp:567:9`!) *cxx . . $ `operator*`(9d6577ff3e9faa29). AM_view_orientcxx . . $ AM_view_orient..rveccxx . . $ matrix#rvec.;
587
588 // Do rotational movement
589
590 matrixcxx . . $ matrix# newmat;
591 float norm = ((65536 / 360) * AM_ROTATIONAL_SCALARcxx . . $ `Descent3/TelComAutoMap.cpp:568:9`!) * last_frametimecxx . . $ last_frametime.;
592
593 AM_pitchcxx . . $ AM_pitch. += (norm * controls.pitch_thrustcxx . . $ game_controls#pitch_thrust.);
594 AM_headingcxx . . $ AM_heading. += (norm * controls.heading_thrustcxx . . $ game_controls#heading_thrust.);
595
596 if (AM_pitchcxx . . $ AM_pitch. < 0)
597 AM_pitchcxx . . $ AM_pitch. += 65536;
598 if (AM_pitchcxx . . $ AM_pitch. >= 65536)
599 AM_pitchcxx . . $ AM_pitch. -= 65536;
600
601 if (AM_headingcxx . . $ AM_heading. < 0)
602 AM_headingcxx . . $ AM_heading. += 65536;
603 if (AM_headingcxx . . $ AM_heading. >= 65536)
604 AM_headingcxx . . $ AM_heading. -= 65536;
605
606 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&newmat, (uint16_tcxx . . $ uint16_t#)AM_pitchcxx . . $ AM_pitch., (uint16_tcxx . . $ uint16_t#)AM_headingcxx . . $ AM_heading., 0);
607 AM_view_orientcxx . . $ AM_view_orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). newmat;
608
609 vm_Orthogonalizecxx . . $ vm_Orthogonalize(dca75c48c9ab5b54).(&AM_view_orientcxx . . $ AM_view_orient.);
610 Game_interface_modecxx . . $ Game_interface_mode. = save_mode;
611 }
612
613 // Renders the low-res terrain for the automap
614 void TCAMRenderTerraincxx . . $ TCAMRenderTerrain(49f6e7a06ebc5aa8).() {
615 int nt;
616 int render_width, render_height;
617 float w2, h2;
618
619 int save_check = Terrain_occlusion_checksumcxx . . $ Terrain_occlusion_checksum.;
620 int save_pix = Detail_settingscxx . . $ Detail_settings..Pixel_errorcxx . . $ tDetailSettings#Pixel_error.;
621 float save_dist = Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance.;
622
623 Detail_settingscxx . . $ Detail_settings..Pixel_errorcxx . . $ tDetailSettings#Pixel_error. = 31;
624 Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance. = 300 * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!;
625 Terrain_occlusion_checksumcxx . . $ Terrain_occlusion_checksum. = -1;
626
627 // Get the size of the current render window
628 rend_GetProjectionParameterscxx . . $ rend_GetProjectionParameters(ce8f7825f8908cfa).(&render_width, &render_height);
629 w2 = ((float)render_width - 1) / 2.0;
630 h2 = ((float)render_height - 1) / 2.0;
631
632 // Set up vars for (psuedo-)clipping window
633 Check_terrain_portalcxx . . $ Check_terrain_portal. = 0;
634
635 Clip_scale_leftcxx . . $ Clip_scale_left. = 0;
636 Clip_scale_rightcxx . . $ Clip_scale_right. = render_width - 1;
637 Clip_scale_topcxx . . $ Clip_scale_top. = 0;
638 Clip_scale_botcxx . . $ Clip_scale_bot. = render_height - 1;
639
640 Terrain_from_minecxx . . $ Terrain_from_mine. = 0;
641
642 VisibleTerrainZcxx . . $ VisibleTerrainZ. = (Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance.) * Matrix_scalecxx . . $ Matrix_scale..zcxx . . $ vector#z.;
643
644 // Set up our z wall
645 g3_SetFarClipZcxx . . $ g3_SetFarClipZ(9364e6e7bff7660).(VisibleTerrainZcxx . . $ VisibleTerrainZ.);
646
647 vectorcxx . . $ vector# viewer_eye;
648 matrixcxx . . $ matrix# viewer_orient;
649 // Get scaled matrix
650 g3_GetViewPositioncxx . . $ g3_GetViewPosition(ec8cf6451c36d470).(&viewer_eye);
651 g3_GetViewMatrixcxx . . $ g3_GetViewMatrix(dca75c48c9ab5b54).(&viewer_orient);
652
653 // Get all of the cells visible to us
654 nt = GetVisibleTerraincxx . . $ GetVisibleTerrain(ffb987d81e13bf99).(&viewer_eye, &viewer_orient);
655
656 // And display!
657 if (nt > 0)
658 DisplayTerrainListcxx . . $ DisplayTerrainList(918ebd27a9ddbad3).(nt, 1);
659
660 Detail_settingscxx . . $ Detail_settings..Pixel_errorcxx . . $ tDetailSettings#Pixel_error. = save_pix;
661 Detail_settingscxx . . $ Detail_settings..Terrain_render_distancecxx . . $ tDetailSettings#Terrain_render_distance. = save_dist;
662 Terrain_occlusion_checksumcxx . . $ Terrain_occlusion_checksum. = save_check;
663 }
664
665 #define AM_BLINK_TIMEcxx . . $ `Descent3/TelComAutoMap.cpp:665:9`! .25f
666
667 // Draws all the relevant objects for automap
668 void TCAMDrawObjectscxx . . $ TCAMDrawObjects(49f6e7a06ebc5aa8).() {
669 int i;
670 int drawit = (timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() * 4);
671 drawit = (drawit % 2);
672
673 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) {
674 for (i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) {
675 if (i == Player_numcxx . . $ Player_num.) {
676 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.];
677 if (AM_ship_model_handlecxx . . $ AM_ship_model_handle. != -1 && drawit)
678 DrawPolygonModelcxx . . $ DrawPolygonModel(505ac7ffa3f87ac5).(&obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., AM_ship_model_handlecxx . . $ AM_ship_model_handle., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, 0, 1, 1, 1);
679 } else if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) {
680 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.];
681 if ((obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && obj->render_typecxx . . $ object#render_type. == RT_POLYOBJcxx . . $ `Descent3/object_external.h:258:9`!) || obj->typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!)
682 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].poscxx . . $ object#pos., 1, 1, .5f, 1.0, .3f, 3.0);
683 }
684 }
685 } else {
686 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.];
687
688 if (AM_ship_model_handlecxx . . $ AM_ship_model_handle. != -1 && drawit)
689 DrawPolygonModelcxx . . $ DrawPolygonModel(505ac7ffa3f87ac5).(&obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., AM_ship_model_handlecxx . . $ AM_ship_model_handle., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, 0, 1, 1, 1);
690 }
691
692 float norm = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
693 int int_norm = norm;
694 norm -= int_norm;
695 for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) {
696 objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i];
697
698 if (obj->typecxx . . $ object#type. == OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`! && obj->parent_handlecxx . . $ object#parent_handle. == Player_objectcxx . . $ Player_object.->handlecxx . . $ object#handle.) {
699 float size = 2.5 + (norm * 2.5);
700 float r = 1.0;
701 float g = 0;
702 float b = 1.0;
703
704 if (AM_current_markercxx . . $ AM_current_marker. != -1) {
705 int index = 0;
706
707 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)
708 index = obj->idcxx . . $ object#id. - (Player_numcxx . . $ Player_num. * 2);
709 else
710 index = obj->idcxx . . $ object#id.;
711
712 if (AM_current_markercxx . . $ AM_current_marker. == index) {
713 size = 9.0 + (norm * 9.0);
714 r = 0;
715 g = 1.0;
716 b = 1.0;
717 }
718 }
719
720 DrawColoredDiskcxx . . $ DrawColoredDisk(f2919cd76dc6ba9e).(&obj->poscxx . . $ object#pos., r, g, b, 1.0, .3f, size);
721 }
722 }
723 }
724
725 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
726
727 void TCAMDrawMenucxx . . $ TCAMDrawMenu(49f6e7a06ebc5aa8).() {
728 char str[255];
729 g3Pointcxx . . $ g3Point# *pntlist[4], points[4];
730 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!);
731 int fontheight = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!);
732
733 points[0].p3_sxcxx . . $ g3Point#p3_sx. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
734 points[0].p3_sycxx . . $ g3Point#p3_sy. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom. - (fontheight * 3);
735
736 points[1].p3_sxcxx . . $ g3Point#p3_sx. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].rightcxx . . $ box#right.;
737 points[1].p3_sycxx . . $ g3Point#p3_sy. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom. - (fontheight * 3);
738
739 points[2].p3_sxcxx . . $ g3Point#p3_sx. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].rightcxx . . $ box#right.;
740 points[2].p3_sycxx . . $ g3Point#p3_sy. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom.;
741
742 points[3].p3_sxcxx . . $ g3Point#p3_sx. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left.;
743 points[3].p3_sycxx . . $ g3Point#p3_sy. = AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom.;
744
745 for (int i = 0; i < 4; i++) {
746 points[i].p3_zcxx . . $ `lib/3d.h:247:9`! = 0;
747 points[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!;
748 pntlist[i] = &points[i];
749 }
750
751 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0);
752 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
753 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`!);
754 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
755 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_BLACKcxx . . $ GR_BLACK.);
756 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(192);
757 rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4);
758
759 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(250);
760 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255));
761
762 snprintf(str, sizeof(str), TXT_TCAM_TERRAINcxx . . $ `Descent3/stringtable.h:729:9`!, AM_terraincxx . . $ AM_terrain. ? TXT_STRING_OFFcxx . . $ `Descent3/stringtable.h:533:9`! : TXT_STRING_ONcxx . . $ `Descent3/stringtable.h:532:9`!);
763 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom. - (fontheight * 3) + (fontheight / 2), str);
764 snprintf(str, sizeof(str), "%s", TXT_TCAM_INSTRUCTIONScxx . . $ `Descent3/stringtable.h:730:9`!);
765 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].bottomcxx . . $ box#bottom. - (fontheight * 2) + (fontheight / 2), str);
766
767 // Use HUD font for part that overlays the 3D
768 fontheight = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!);
769 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(HUD_FONTcxx . . $ `Descent3/gamefont.h:105:9`!);
770 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(HUD_COLORcxx . . $ `Descent3/hud.h:307:9`!);
771
772 snprintf(str, sizeof(str), "%s", Level_infocxx . . $ Level_info..namecxx . . $ level_info#name.);
773 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top. + (fontheight / 2), str);
774
775 if (AM_current_markercxx . . $ AM_current_marker. != -1) {
776 int markernum = (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) ? (Player_numcxx . . $ Player_num. * 2 + AM_current_markercxx . . $ AM_current_marker.) : AM_current_markercxx . . $ AM_current_marker.;
777 snprintf(str, sizeof(str), TXT_VIEW_MARKERcxx . . $ `Descent3/stringtable.h:801:9`!, AM_current_markercxx . . $ AM_current_marker. + 1);
778 strncat(str, ": ", sizeof(str) - strlen(str) - 1);
779 strncat(str, MarkerMessagescxx . . $ MarkerMessages.[markernum], sizeof(str) - strlen(str) - 1);
780 grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, AM_tcscxx . . $ AM_tcs.->Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top. + (fontheight / 2) + fontheight, str);
781 }
782
783 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
784 }
785
786 // The callback function that the telcom calls every frame
787 void TCAMCallbackcxx . . $ TCAMCallback(49f6e7a06ebc5aa8).(void) {
788 StartFramecxx . . $ StartFrame(3285c9bef785d51c).(Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].leftcxx . . $ box#left., Telcom_systemcxx . . $ Telcom_system..Monitor_coordscxx . . $ tTelComInfo#Monitor_coords.[MONITOR_MAINcxx . . $ `Descent3/TelCom.h:98:9`!].topcxx . . $ box#top.,
789 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`!].bottomcxx . . $ box#bottom.);
790
791 // Start a 3d frame
792 g3_StartFramecxx . . $ g3_StartFrame(e35d136ceab5c8a2).(&AM_view_poscxx . . $ AM_view_pos., &AM_view_orientcxx . . $ AM_view_orient., Render_zoomcxx . . $ Render_zoom.);
793
794 if (AM_center_on_playercxx . . $ AM_center_on_player.) {
795 TCAMCenterOnPlayercxx . . $ TCAMCenterOnPlayer(49f6e7a06ebc5aa8).();
796 AM_center_on_playercxx . . $ AM_center_on_player. = 0;
797 }
798
799 if (AM_realigncxx . . $ AM_realign.) {
800 AM_pitchcxx . . $ AM_pitch. = 0;
801 AM_realigncxx . . $ AM_realign. = 0;
802 }
803
804 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
805 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_VERTEXcxx . . $ `lib/renderer.h:403:9`!);
806 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
807 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
808 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
809 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
810 rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1);
811
812 if (AM_terraincxx . . $ AM_terrain.)
813 rend_SetZValuescxx . . $ rend_SetZValues(5102ef758adc0ae7).(0, VisibleTerrainZcxx . . $ VisibleTerrainZ.);
814
815 TCAMBuildRoomListcxx . . $ TCAMBuildRoomList(d4f767463ce0a6b3).(Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum.);
816 // Render all rooms in view
817 for (int i = 0; i < Num_AM_roomscxx . . $ Num_AM_rooms.; i++) {
818 TCAMRenderRoomcxx . . $ TCAMRenderRoom(d4f767463ce0a6b3).(AM_room_listcxx . . $ AM_room_list.[i]);
819 }
820
821 // Render terrain
822 if (AM_terraincxx . . $ AM_terrain.)
823 TCAMRenderTerraincxx . . $ TCAMRenderTerrain(49f6e7a06ebc5aa8).();
824
825 g3_EndFramecxx . . $ g3_EndFrame(49f6e7a06ebc5aa8).();
826
827 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1);
828
829 TCAMDrawObjectscxx . . $ TCAMDrawObjects(49f6e7a06ebc5aa8).();
830 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
831
832 rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0);
833
834 TCAMDrawMenucxx . . $ TCAMDrawMenu(49f6e7a06ebc5aa8).();
835
836 TCAMReadControlscxx . . $ TCAMReadControls(49f6e7a06ebc5aa8).();
837 }