| 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/cockpit.cpp $ |
| 21 | * $Revision: 50 $ |
| 22 | * $Date: 8/10/99 5:10p $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * Cockpit code |
| 26 | * |
| 27 | * $Log: /DescentIII/main/cockpit.cpp $ |
| 28 | * |
| 29 | * 50 8/10/99 5:10p Jeff |
| 30 | * added missing call to FreeReticle() |
| 31 | * |
| 32 | * 49 7/28/99 4:21p Kevin |
| 33 | * Mac! |
| 34 | * |
| 35 | * 48 5/10/99 10:17p Ardussi |
| 36 | * changes to compile on Mac |
| 37 | * |
| 38 | * 47 5/05/99 5:48p Samir |
| 39 | * initialize reticle in InitCockpit. |
| 40 | * |
| 41 | * 46 4/21/99 2:15p Samir |
| 42 | * table file filter fixes. |
| 43 | * |
| 44 | * 45 4/17/99 5:43a Jeff |
| 45 | * Changes to get it to compile in Linux |
| 46 | * |
| 47 | * 44 4/06/99 1:50p Jason |
| 48 | * added new mass driver effect |
| 49 | * |
| 50 | * 43 4/01/99 4:50p Matt |
| 51 | * Took out Warning() function, chaning those calls to mprintf() |
| 52 | * |
| 53 | * 42 3/30/99 2:39p Samir |
| 54 | * added custom config file for fullscreen hud and hacked mass driver |
| 55 | * reticle in special reticle code. |
| 56 | * |
| 57 | * 41 3/23/99 10:25a Samir |
| 58 | * shake cockpit a little more. |
| 59 | * |
| 60 | * 40 2/11/99 8:28p Matt |
| 61 | * Fixed stupid bugs |
| 62 | * |
| 63 | * 39 2/11/99 4:02p Matt |
| 64 | * Flaged a bunch of files for TableParse |
| 65 | * |
| 66 | * 38 2/05/99 7:03p Jeff |
| 67 | * table file parsing macros put in |
| 68 | * |
| 69 | * 37 1/31/99 7:25p Matt |
| 70 | * Renamed a bunch of functions to have HUD capitalized |
| 71 | * |
| 72 | * 36 10/20/98 12:42p Matt |
| 73 | * Made the small views work on the cockpit. |
| 74 | * |
| 75 | * 35 10/14/98 1:02p Jason |
| 76 | * fixed FindSoundName issues |
| 77 | * |
| 78 | * 34 9/03/98 4:26p Samir |
| 79 | * gauges are off this time until cockpit is in functional mode. |
| 80 | * |
| 81 | * 33 8/28/98 11:54a Samir |
| 82 | * turn on monitors only if the cockpit is on. |
| 83 | * |
| 84 | * 32 8/19/98 5:47p Samir |
| 85 | * increased cockpit spee.d |
| 86 | * |
| 87 | * 31 8/18/98 1:11a Samir |
| 88 | * fixed some stuff for multi cockpit configs. |
| 89 | * |
| 90 | * 30 7/28/98 5:39p Samir |
| 91 | * basic cockpit sounds. need work on sync. |
| 92 | * |
| 93 | * 29 6/24/98 1:11p Samir |
| 94 | * dont draw monitors |
| 95 | * |
| 96 | * 28 6/19/98 4:14p Jason |
| 97 | * made multicolor lighting work with volume lights |
| 98 | * |
| 99 | * 27 6/15/98 4:00p Jason |
| 100 | * replaced monochromatic polymodel lighting with rgb lighting |
| 101 | * |
| 102 | * 26 6/12/98 5:13p Jason |
| 103 | * made cockpit work with dynamic lighting system |
| 104 | * |
| 105 | * 25 5/26/98 10:47p Samir |
| 106 | * cockpit shake a little better. |
| 107 | * |
| 108 | * 24 5/26/98 5:05p Samir |
| 109 | * cockpit and hud config file now 'unified'. cockpit adds to hudconfig |
| 110 | * load's funtionality, so cockpit info files can contain same syntax as |
| 111 | * hud file. |
| 112 | * |
| 113 | * 23 5/22/98 6:26p Samir |
| 114 | * cockpit lighting primatives. |
| 115 | * |
| 116 | * 22 5/18/98 5:29p Samir |
| 117 | * don't move cockpit while moving. |
| 118 | * |
| 119 | * 21 5/18/98 4:52p Samir |
| 120 | * refined cockpit motion. |
| 121 | * |
| 122 | * 20 5/15/98 12:01p Samir |
| 123 | * cockpit buffet more jarring. fixed red crap bug. |
| 124 | * |
| 125 | * 19 5/14/98 7:40p Samir |
| 126 | * shaking cockpit. |
| 127 | * |
| 128 | * 18 5/14/98 12:07p Sean |
| 129 | * Removed an annoying mprintf |
| 130 | * |
| 131 | * 17 5/13/98 4:01p Samir |
| 132 | * cockpit closing and opening secure. |
| 133 | * |
| 134 | * 16 5/05/98 6:27p Samir |
| 135 | * function that tells the cockpit system that it was resized |
| 136 | * |
| 137 | * 15 5/01/98 4:24p Samir |
| 138 | * added function to quickly open the cockpit. |
| 139 | * |
| 140 | * 14 4/24/98 8:02a Samir |
| 141 | * simpler cockpit animation. |
| 142 | * |
| 143 | * 13 4/23/98 4:13a Samir |
| 144 | * new hud system. |
| 145 | * |
| 146 | * 12 4/06/98 7:35p Samir |
| 147 | * added glare over monitor effect. |
| 148 | * |
| 149 | * 11 4/02/98 3:54p Jason |
| 150 | * first pass in getting polymodel paging to work |
| 151 | * |
| 152 | * 10 3/27/98 11:59a Samir |
| 153 | * moved weapon hud text from hud to weapon monitor gauges. |
| 154 | * |
| 155 | * 9 3/25/98 11:59a Samir |
| 156 | * implemented energy analog fully. |
| 157 | * |
| 158 | * 8 3/24/98 4:28p Samir |
| 159 | * fixed bug when calling OpenCockpit immediately after calling |
| 160 | * CloseCockpit. |
| 161 | * |
| 162 | * 7 3/23/98 11:14a Samir |
| 163 | * maybe better cockpit lighting. |
| 164 | * |
| 165 | * 6 3/22/98 5:03p Samir |
| 166 | * updated cockpit. |
| 167 | * |
| 168 | * 5 3/20/98 8:23p Samir |
| 169 | * new hud and cockpit customization system. |
| 170 | * |
| 171 | * 4 3/18/98 6:24p Samir |
| 172 | * Better view eye positioning for cockpit. |
| 173 | * |
| 174 | * 3 3/17/98 2:40p Samir |
| 175 | * reorg of cockpit/gauges and hud systems. |
| 176 | * |
| 177 | * 2 3/16/98 3:30p Samir |
| 178 | * incremental checkin. |
| 179 | * |
| 180 | * 1 3/13/98 11:22a Samir |
| 181 | * initial revision. |
| 182 | * |
| 183 | * $NoKeywords: $ |
| 184 | */ |
| 185 | // D3 Cockpit system |
| 186 | // needs a model with textures. |
| 187 | // major functions: |
| 188 | // activate cockpit |
| 189 | // render cockpit |
| 190 | // deactivate cockpit. |
| 191 | #include "cockpit.h"cxx . . $ `<file>/Descent3/cockpit.h`/ |
| 192 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 193 | #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/ |
| 194 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 195 | #include "gauges.h"cxx . . $ `<file>/Descent3/gauges.h`/ |
| 196 | #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/ |
| 197 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 198 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 199 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 200 | #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/ |
| 201 | #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/ |
| 202 | |
| 203 | #include <string.h> |
| 204 | |
| 205 | #include <algorithm> |
| 206 | |
| 207 | #define COCKPIT_ANIM_TIMEcxx . . $ `Descent3/cockpit.cpp:207:9`! 2.0f |
| 208 | #define COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`! 0.0 |
| 209 | #define COCKPIT_START_FRAMEcxx . . $ `Descent3/cockpit.cpp:209:9`! 3.0 |
| 210 | #define COCKPIT_MIDWAY_FRAMEcxx . . $ `Descent3/cockpit.cpp:210:9`! 7.0 |
| 211 | #define COCKPIT_COMPLETE_FRAMEcxx . . $ `Descent3/cockpit.cpp:211:9`! ((float)Cockpit_info.model->frame_max) |
| 212 | // cockpit FX modifiers |
| 213 | #define MAX_BUFFET_STRENGTHcxx . . $ `Descent3/cockpit.cpp:213:9`! 0.75f |
| 214 | #define BUFFET_PERIODcxx . . $ `Descent3/cockpit.cpp:214:9`! 0.25f |
| 215 | #define COCKPIT_SHIFT_DELTAcxx . . $ `Descent3/cockpit.cpp:215:9`! 0.02f |
| 216 | struct tCockpitCfgInfocxx . . $ tCockpitCfgInfo# { |
| 217 | char modelnamecxx . . $ tCockpitCfgInfo#modelname.[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 218 | char shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!][PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 219 | char shipimgcxx . . $ tCockpitCfgInfo#shipimg.[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 220 | char burnimgcxx . . $ tCockpitCfgInfo#burnimg.[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 221 | char energyimgcxx . . $ tCockpitCfgInfo#energyimg.[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 222 | char invpulseimgcxx . . $ tCockpitCfgInfo#invpulseimg.[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 223 | }; |
| 224 | |
| 225 | struct tCockpitInfocxx . . $ tCockpitInfo# { |
| 226 | int statecxx . . $ tCockpitInfo#state.; // current state of cockpit on screen. |
| 227 | int ship_indexcxx . . $ tCockpitInfo#ship_index.; // index into ships page. |
| 228 | int model_numcxx . . $ tCockpitInfo#model_num.; // this should be retreived from the ship info. |
| 229 | int snd_opencxx . . $ tCockpitInfo#snd_open., snd_closecxx . . $ tCockpitInfo#snd_close.; // sound open and close. |
| 230 | float frame_timecxx . . $ tCockpitInfo#frame_time.; // current time of animation. |
| 231 | float next_keyframecxx . . $ tCockpitInfo#next_keyframe., this_keyframecxx . . $ tCockpitInfo#this_keyframe.; // current animation of cockpit. |
| 232 | poly_modelcxx . . $ poly_model# *modelcxx . . $ tCockpitInfo#model.; // model of cockpit. |
| 233 | unsigned nonlayered_maskcxx . . $ tCockpitInfo#nonlayered_mask.; // non layered submodel mask |
| 234 | unsigned layered_maskcxx . . $ tCockpitInfo#layered_mask.; // layered submodel mask |
| 235 | bool animatingcxx . . $ tCockpitInfo#animating.; // is cockpit moving? |
| 236 | bool resizedcxx . . $ tCockpitInfo#resized.; // if cockpit is being resized.... |
| 237 | vectorcxx . . $ vector# buffet_veccxx . . $ tCockpitInfo#buffet_vec.; // buffet direction |
| 238 | float buffet_ampcxx . . $ tCockpitInfo#buffet_amp.; // used to calculate real magnitude |
| 239 | float buffet_wavecxx . . $ tCockpitInfo#buffet_wave.; // current sin angle of buffet |
| 240 | float buffet_timecxx . . $ tCockpitInfo#buffet_time.; // current position in buffet wave along time axis. |
| 241 | |
| 242 | matrixcxx . . $ matrix# orientcxx . . $ tCockpitInfo#orient.; // orientation of cockpit |
| 243 | }; |
| 244 | |
| 245 | static tCockpitInfocxx . . $ tCockpitInfo# Cockpit_infocxx . . $ Cockpit_info.; |
| 246 | static float KeyframeAnimateCockpitcxx . . $ KeyframeAnimateCockpit(9b8c9e39889c762c).(); |
| 247 | // loads cockpit. model_name = NULL, then will not load in model name. |
| 248 | static void LoadCockpitInfocxx . . $ LoadCockpitInfo(d7c172acf5a24e66).(const char *ckt_file, tCockpitCfgInfocxx . . $ tCockpitCfgInfo# *info); |
| 249 | ////////////////////////////////////////////////////////////////////////////// |
| 250 | // Initializes the cockpit by loading it in and initializing all it's gauges. |
| 251 | // initialization of cockpit. |
| 252 | void InitCockpitcxx . . $ InitCockpit(d4f767463ce0a6b3).(int ship_index) { |
| 253 | tCockpitCfgInfocxx . . $ tCockpitCfgInfo# cfginfo; |
| 254 | int i; |
| 255 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Initializing cockpit.\n"); |
| 256 | LoadCockpitInfocxx . . $ LoadCockpitInfo(d7c172acf5a24e66).(Shipscxx . . $ Ships.[ship_index].cockpit_namecxx . . $ ship#cockpit_name., &cfginfo); |
| 257 | // initialize special hud/cockpit images unique to this ship |
| 258 | for (i = 0; i < NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!; i++) { |
| 259 | if (cfginfo.shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[i][0]) |
| 260 | HUD_resourcescxx . . $ HUD_resources..shield_bmpcxx . . $ sHUDResources#shield_bmp.[i] = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(cfginfo.shieldrings[i]), 0); |
| 261 | } |
| 262 | HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp. = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(cfginfo.shipimg), 0); |
| 263 | HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp. = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(cfginfo.energyimg), 0); |
| 264 | HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp. = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(cfginfo.burnimg), 0); |
| 265 | HUD_resourcescxx . . $ HUD_resources..invpulse_bmpcxx . . $ sHUDResources#invpulse_bmp. = bm_AllocLoadFileBitmapcxx . . $ bm_AllocLoadFileBitmap(1163be050dbfff7).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(cfginfo.invpulseimg), 0); |
| 266 | if (cfginfo.modelnamecxx . . $ tCockpitCfgInfo#modelname.[0] == 0) { |
| 267 | Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num. = -1; |
| 268 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "No cockpit found for ship.\n"); |
| 269 | return; |
| 270 | } |
| 271 | // initialize cockpit. |
| 272 | Cockpit_infocxx . . $ Cockpit_info..ship_indexcxx . . $ tCockpitInfo#ship_index. = ship_index; |
| 273 | Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num. = LoadPolyModelcxx . . $ LoadPolyModel(220e687f58daa9be).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(cfginfo.modelname), 0); |
| 274 | Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model. = GetPolymodelPointercxx . . $ GetPolymodelPointer(ac85e77c73ebf794).(Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num.); |
| 275 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = 0.0f; |
| 276 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_DORMANTcxx . . $ `Descent3/cockpit.h:109:9`!; |
| 277 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!; |
| 278 | Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. = COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!; |
| 279 | Cockpit_infocxx . . $ Cockpit_info..resizedcxx . . $ tCockpitInfo#resized. = false; |
| 280 | Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. = 0.0f; |
| 281 | Cockpit_infocxx . . $ Cockpit_info..snd_opencxx . . $ tCockpitInfo#snd_open. = SOUND_COCKPITcxx . . $ `Descent3/sounds.h:126:9`!; |
| 282 | vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&Cockpit_infocxx . . $ Cockpit_info..buffet_veccxx . . $ tCockpitInfo#buffet_vec.); |
| 283 | // find layered submodel mask |
| 284 | Cockpit_infocxx . . $ Cockpit_info..layered_maskcxx . . $ tCockpitInfo#layered_mask. = 0x00000000; |
| 285 | Cockpit_infocxx . . $ Cockpit_info..nonlayered_maskcxx . . $ tCockpitInfo#nonlayered_mask. = 0x00000000; |
| 286 | for (i = 0; i < Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model.->n_modelscxx . . $ poly_model#n_models.; i++) { |
| 287 | if ((Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model.->submodelcxx . . $ poly_model#submodel.[i].flagscxx . . $ bsp_info#flags. & SOF_VIEWERcxx . . $ `lib/polymodel_external.h:93:9`!) || |
| 288 | (Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model.->submodelcxx . . $ poly_model#submodel.[i].flagscxx . . $ bsp_info#flags. & SOF_MONITOR_MASKcxx . . $ `model/polymodel.h:311:9`!)) |
| 289 | continue; |
| 290 | if (Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model.->submodelcxx . . $ poly_model#submodel.[i].flagscxx . . $ bsp_info#flags. & SOF_LAYERcxx . . $ `lib/polymodel_external.h:94:9`!) |
| 291 | Cockpit_infocxx . . $ Cockpit_info..layered_maskcxx . . $ tCockpitInfo#layered_mask. |= (1 << i); |
| 292 | else |
| 293 | Cockpit_infocxx . . $ Cockpit_info..nonlayered_maskcxx . . $ tCockpitInfo#nonlayered_mask. |= (1 << i); |
| 294 | } |
| 295 | InitGaugescxx . . $ InitGauges(ed53e3bbd3fa2f69).(STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`! | STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`! | STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`! | STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`! | STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`! | STAT_AFTERBURNcxx . . $ `Descent3/hud.h:283:9`!); |
| 296 | // initialize reticle |
| 297 | FreeReticlecxx . . $ FreeReticle(49f6e7a06ebc5aa8).(); |
| 298 | InitReticlecxx . . $ InitReticle(3e454b8ccf442868).(-1, -1); |
| 299 | } |
| 300 | // Forces freeing of cockpit |
| 301 | void FreeCockpitcxx . . $ FreeCockpit(49f6e7a06ebc5aa8).() { |
| 302 | int i; |
| 303 | CloseGaugescxx . . $ CloseGauges(49f6e7a06ebc5aa8).(); |
| 304 | |
| 305 | if (Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num. > -1) { |
| 306 | FreePolyModelcxx . . $ FreePolyModel(d4f767463ce0a6b3).(Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num.); |
| 307 | Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 308 | Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num. = -1; |
| 309 | } |
| 310 | Cockpit_infocxx . . $ Cockpit_info..ship_indexcxx . . $ tCockpitInfo#ship_index. = -1; |
| 311 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = 0.0f; |
| 312 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_DORMANTcxx . . $ `Descent3/cockpit.h:109:9`!; |
| 313 | // free ship specific stuff for hud-cockpit shared. |
| 314 | bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(HUD_resourcescxx . . $ HUD_resources..invpulse_bmpcxx . . $ sHUDResources#invpulse_bmp.); |
| 315 | bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(HUD_resourcescxx . . $ HUD_resources..afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp.); |
| 316 | bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(HUD_resourcescxx . . $ HUD_resources..energy_bmpcxx . . $ sHUDResources#energy_bmp.); |
| 317 | for (i = 0; i < NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!; i++) |
| 318 | bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(HUD_resourcescxx . . $ HUD_resources..shield_bmpcxx . . $ sHUDResources#shield_bmp.[i]); |
| 319 | bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(HUD_resourcescxx . . $ HUD_resources..ship_bmpcxx . . $ sHUDResources#ship_bmp.); |
| 320 | } |
| 321 | // check if cockpit exists |
| 322 | bool IsValidCockpitcxx . . $ IsValidCockpit(c9857a73d68e59ba).() { return (Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num. > -1) ? true : false; } |
| 323 | bool CockpitFileParsecxx . . $ CockpitFileParse(3b2fb586c5d24833).(const char *command, const char *operand, void *data) { |
| 324 | tCockpitCfgInfocxx . . $ tCockpitCfgInfo# *cfginf = (tCockpitCfgInfocxx . . $ tCockpitCfgInfo# *)data; |
| 325 | if (!strcmp(command, "ckptmodel")) { |
| 326 | // cockpit model name |
| 327 | if (cfginf) |
| 328 | strcpy(cfginf->modelnamecxx . . $ tCockpitCfgInfo#modelname., operand); |
| 329 | } else if (!strncmp(command, "shieldimg", strlen("shieldimg"))) { |
| 330 | // cockpit shield ring names |
| 331 | char buf[16]; |
| 332 | int i; |
| 333 | for (i = 0; i < NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!; i++) { |
| 334 | snprintf(buf, sizeof(buf), "shieldimg%d", i); |
| 335 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, buf)) { |
| 336 | if (cfginf) |
| 337 | strcpy(cfginf->shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[i], operand); |
| 338 | break; |
| 339 | } |
| 340 | } |
| 341 | } else if (!strcmp(command, "shipimg")) { |
| 342 | // ship image name |
| 343 | if (cfginf) |
| 344 | strcpy(cfginf->shipimgcxx . . $ tCockpitCfgInfo#shipimg., operand); |
| 345 | } else if (!strcmp(command, "afterburnimg")) { |
| 346 | // ship image name |
| 347 | if (cfginf) |
| 348 | strcpy(cfginf->burnimgcxx . . $ tCockpitCfgInfo#burnimg., operand); |
| 349 | } else if (!strcmp(command, "energyimg")) { |
| 350 | // ship image name |
| 351 | if (cfginf) |
| 352 | strcpy(cfginf->energyimgcxx . . $ tCockpitCfgInfo#energyimg., operand); |
| 353 | } else if (!strcmp(command, "invpulseimg")) { |
| 354 | // ship image name |
| 355 | if (cfginf) |
| 356 | strcpy(cfginf->invpulseimgcxx . . $ tCockpitCfgInfo#invpulseimg., operand); |
| 357 | } else if (!strcmp(command, "fullhudinf")) { |
| 358 | if (cfginf) |
| 359 | strcpy(HUD_resourcescxx . . $ HUD_resources..hud_inf_namecxx . . $ sHUDResources#hud_inf_name., operand); |
| 360 | } else { |
| 361 | return false; |
| 362 | } |
| 363 | return true; |
| 364 | } |
| 365 | // loads pertinent information about cockpit. |
| 366 | void LoadCockpitInfocxx . . $ LoadCockpitInfo(d7c172acf5a24e66).(const char *ckt_file, tCockpitCfgInfocxx . . $ tCockpitCfgInfo# *cfginfo) { |
| 367 | // clear out return values. |
| 368 | if (cfginfo) { |
| 369 | memset(cfginfo, 0, sizeof(tCockpitCfgInfocxx . . $ tCockpitCfgInfo#)); |
| 370 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`! == 5); |
| 371 | strcpy(cfginfo->shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[0], TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("shieldring01.ogf")); |
| 372 | strcpy(cfginfo->shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[1], TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("shieldring02.ogf")); |
| 373 | strcpy(cfginfo->shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[2], TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("shieldring03.ogf")); |
| 374 | strcpy(cfginfo->shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[3], TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("shieldring04.ogf")); |
| 375 | strcpy(cfginfo->shieldringscxx . . $ tCockpitCfgInfo#shieldrings.[4], TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("shieldring05.ogf")); |
| 376 | strcpy(cfginfo->shipimgcxx . . $ tCockpitCfgInfo#shipimg., TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("hudship.ogf")); |
| 377 | strcpy(cfginfo->burnimgcxx . . $ tCockpitCfgInfo#burnimg., TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("hudburn.ogf")); |
| 378 | strcpy(cfginfo->energyimgcxx . . $ tCockpitCfgInfo#energyimg., TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("hudenergy.ogf")); |
| 379 | strcpy(cfginfo->invpulseimgcxx . . $ tCockpitCfgInfo#invpulseimg., TBL_GAMEFILEcxx . . $ `lib/manage_external.h:60:9`!("shieldinv.ogf")); |
| 380 | } |
| 381 | if (ckt_file[0] == 0) |
| 382 | return; |
| 383 | |
| 384 | LoadHUDConfigcxx . . $ LoadHUDConfig(7fb9cb4cf7d8fbd3).(ckt_file, CockpitFileParsecxx . . $ CockpitFileParse(3b2fb586c5d24833)., cfginfo); |
| 385 | } |
| 386 | // forces opening of cockpit. |
| 387 | void OpenCockpitcxx . . $ OpenCockpit(49f6e7a06ebc5aa8).() { |
| 388 | // this should allow for opening cockpit while in closing mode. |
| 389 | // do this to insure that an immediate call to CloseCockpit will force it to close again. |
| 390 | if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. <= COCKPIT_COMPLETE_FRAMEcxx . . $ `Descent3/cockpit.cpp:211:9`!) { |
| 391 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_QUASIcxx . . $ `Descent3/cockpit.h:110:9`!; |
| 392 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!; |
| 393 | Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. = COCKPIT_COMPLETE_FRAMEcxx . . $ `Descent3/cockpit.cpp:211:9`!; |
| 394 | if (Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. > 0.0f) |
| 395 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = COCKPIT_ANIM_TIMEcxx . . $ `Descent3/cockpit.cpp:207:9`! - Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time.; |
| 396 | } |
| 397 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(Cockpit_infocxx . . $ Cockpit_info..snd_opencxx . . $ tCockpitInfo#snd_open.); |
| 398 | // load hud information for cockpit. |
| 399 | LoadCockpitInfocxx . . $ LoadCockpitInfo(d7c172acf5a24e66).(Shipscxx . . $ Ships.[Cockpit_infocxx . . $ Cockpit_info..ship_indexcxx . . $ tCockpitInfo#ship_index.].cockpit_namecxx . . $ ship#cockpit_name., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 400 | } |
| 401 | // forces complete closing of cockpit |
| 402 | void CloseCockpitcxx . . $ CloseCockpit(49f6e7a06ebc5aa8).() { |
| 403 | // this should allow for closing cockpit while in opening mode. |
| 404 | // do this to insure that an immediate call to OpenCockpit will force it to open again. |
| 405 | if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. >= COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!) { |
| 406 | Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. = COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!; |
| 407 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = COCKPIT_COMPLETE_FRAMEcxx . . $ `Descent3/cockpit.cpp:211:9`!; |
| 408 | if (Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. > 0.0f) |
| 409 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = COCKPIT_ANIM_TIMEcxx . . $ `Descent3/cockpit.cpp:207:9`! - Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time.; |
| 410 | } |
| 411 | FlagGaugesNonfunctionalcxx . . $ FlagGaugesNonfunctional(ed53e3bbd3fa2f69).(STAT_ALLcxx . . $ `Descent3/hud.h:290:9`!); |
| 412 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(Cockpit_infocxx . . $ Cockpit_info..snd_opencxx . . $ tCockpitInfo#snd_open.); |
| 413 | } |
| 414 | // forces quick opening of cockpit |
| 415 | void QuickOpenCockpitcxx . . $ QuickOpenCockpit(49f6e7a06ebc5aa8).() { |
| 416 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = 0.0f; |
| 417 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_FUNCTIONALcxx . . $ `Descent3/cockpit.h:111:9`!; |
| 418 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. = COCKPIT_COMPLETE_FRAMEcxx . . $ `Descent3/cockpit.cpp:211:9`!; |
| 419 | FlagGaugesFunctionalcxx . . $ FlagGaugesFunctional(ed53e3bbd3fa2f69).(STAT_ALLcxx . . $ `Descent3/hud.h:290:9`!); |
| 420 | // load hud information for cockpit. |
| 421 | LoadCockpitInfocxx . . $ LoadCockpitInfo(d7c172acf5a24e66).(Shipscxx . . $ Ships.[Cockpit_infocxx . . $ Cockpit_info..ship_indexcxx . . $ tCockpitInfo#ship_index.].cockpit_namecxx . . $ ship#cockpit_name., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 422 | } |
| 423 | // forces quick closing of cockpit |
| 424 | void QuickCloseCockpitcxx . . $ QuickCloseCockpit(49f6e7a06ebc5aa8).() { |
| 425 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = 0.0f; |
| 426 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_DORMANTcxx . . $ `Descent3/cockpit.h:109:9`!; |
| 427 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. = COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!; |
| 428 | FlagGaugesNonfunctionalcxx . . $ FlagGaugesNonfunctional(ed53e3bbd3fa2f69).(STAT_ALLcxx . . $ `Descent3/hud.h:290:9`!); |
| 429 | } |
| 430 | // resizes cockpit. |
| 431 | void ResizeCockpitcxx . . $ ResizeCockpit(49f6e7a06ebc5aa8).() { Cockpit_infocxx . . $ Cockpit_info..resizedcxx . . $ tCockpitInfo#resized. = true; } |
| 432 | // cockpit orientation. |
| 433 | void StartCockpitShakecxx . . $ StartCockpitShake(d446077cab678e8d).(float mag, vectorcxx . . $ vector# *vec) { |
| 434 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(vec); |
| 435 | if (mag > MAX_BUFFET_STRENGTHcxx . . $ `Descent3/cockpit.cpp:213:9`!) |
| 436 | mag = MAX_BUFFET_STRENGTHcxx . . $ `Descent3/cockpit.cpp:213:9`!; |
| 437 | Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. = mag; |
| 438 | Cockpit_infocxx . . $ Cockpit_info..buffet_veccxx . . $ tCockpitInfo#buffet_vec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). (*vec); |
| 439 | Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. = FixSincxx . . $ FixSin(9a38df040a81ca35).(0); |
| 440 | Cockpit_infocxx . . $ Cockpit_info..buffet_timecxx . . $ tCockpitInfo#buffet_time. = 0.0f; |
| 441 | } |
| 442 | ////////////////////////////////////////////////////////////////////////////// |
| 443 | // renders the cockpit. |
| 444 | extern float GetTerrainDynamicScalarcxx . . $ GetTerrainDynamicScalar(bdb4036c8ebf1af).(vectorcxx . . $ vector# *pos, int seg); |
| 445 | extern void GetRoomDynamicScalarcxx . . $ GetRoomDynamicScalar(93b972edae6e455f).(vectorcxx . . $ vector# *pos, roomcxx . . $ room# *rp, float *r, float *g, float *b); |
| 446 | void RenderCockpitcxx . . $ RenderCockpit(49f6e7a06ebc5aa8).() { |
| 447 | objectcxx . . $ object# *player_obj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].objnumcxx . . $ player#objnum.]; |
| 448 | physics_infocxx . . $ physics_info# *player_phys = &player_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info.; |
| 449 | vectorcxx . . $ vector# view_pos, light_vec; |
| 450 | matrixcxx . . $ matrix# view_tmat; |
| 451 | float view_z, view_y, view_x, keyframe; |
| 452 | float light_scalar_r, light_scalar_g, light_scalar_b; |
| 453 | float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!]; |
| 454 | bool gauge_reset = false; |
| 455 | // draw cockpit depending on current state |
| 456 | if (Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. == COCKPIT_STATE_DORMANTcxx . . $ `Descent3/cockpit.h:109:9`! || Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num. == -1) |
| 457 | return; |
| 458 | // position cockpit correctly. |
| 459 | bsp_infocxx . . $ bsp_info# *viewer_subobj = CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(SOF_VIEWERcxx . . $ `lib/polymodel_external.h:93:9`!); |
| 460 | if (!viewer_subobj) { |
| 461 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Cockpit missing viewer!\n"); |
| 462 | return; |
| 463 | } |
| 464 | view_z = |
| 465 | viewer_subobj->offsetcxx . . $ bsp_info#offset..zcxx . . $ vector#z. - Cockpit_infocxx . . $ Cockpit_info..buffet_veccxx . . $ tCockpitInfo#buffet_vec..zcxx . . $ vector#z. * Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. * Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. * 1.1f; |
| 466 | view_y = viewer_subobj->offsetcxx . . $ bsp_info#offset..ycxx . . $ vector#y. + Cockpit_infocxx . . $ Cockpit_info..buffet_veccxx . . $ tCockpitInfo#buffet_vec..ycxx . . $ vector#y. * Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. * Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave.; |
| 467 | view_x = viewer_subobj->offsetcxx . . $ bsp_info#offset..xcxx . . $ vector#x. + Cockpit_infocxx . . $ Cockpit_info..buffet_veccxx . . $ tCockpitInfo#buffet_vec..xcxx . . $ vector#x. * Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. * Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave.; |
| 468 | //@@ if (player_phys->rotthrust.x !=0.0f || player_phys->rotthrust.y != 0.0f) { |
| 469 | //@@ gauge_reset = true; |
| 470 | //@@ view_x += (player_phys->rotthrust.y*COCKPIT_SHIFT_DELTA/player_phys->full_rotthrust); |
| 471 | //@@ view_y -= (player_phys->rotthrust.x*COCKPIT_SHIFT_DELTA/player_phys->full_rotthrust); |
| 472 | //@@ } |
| 473 | // create new orientation, so the cockpit should be facing the viewer |
| 474 | view_tmat =cxx . . $ matrix#`operator=`(4c6f8b29806742). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient.; |
| 475 | view_pos =cxx . . $ vector#`operator=`(c0842353a20857d). (view_tmat.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). view_z) +cxx . . $ operator+(b77b703cd1e43e33). (view_tmat.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). view_y) +cxx . . $ operator+(b77b703cd1e43e33). (view_tmat.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). view_x) +cxx . . $ operator+(b77b703cd1e43e33). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 476 | view_tmat.fveccxx . . $ matrix#fvec. =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).view_tmat.fveccxx . . $ matrix#fvec.; |
| 477 | view_tmat.rveccxx . . $ matrix#rvec. =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).view_tmat.rveccxx . . $ matrix#rvec.; |
| 478 | // lighting. |
| 479 | light_vec =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 480 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(player_obj)) { |
| 481 | float light_scalar = GetTerrainDynamicScalarcxx . . $ GetTerrainDynamicScalar(bdb4036c8ebf1af).(&player_obj->poscxx . . $ object#pos., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(player_obj->roomnum)); |
| 482 | light_scalar_r = light_scalar; |
| 483 | light_scalar_g = light_scalar; |
| 484 | light_scalar_b = light_scalar; |
| 485 | } else { |
| 486 | GetRoomDynamicScalarcxx . . $ GetRoomDynamicScalar(93b972edae6e455f).(&player_obj->poscxx . . $ object#pos., &Roomscxx . . $ Rooms.[player_obj->roomnumcxx . . $ object#roomnum.], &light_scalar_r, &light_scalar_g, |
| 487 | &light_scalar_b); |
| 488 | } |
| 489 | if (light_scalar_r < 0.1f) |
| 490 | light_scalar_r = 0.1f; |
| 491 | if (light_scalar_g < 0.1f) |
| 492 | light_scalar_g = 0.1f; |
| 493 | if (light_scalar_b < 0.1f) |
| 494 | light_scalar_b = 0.1f; |
| 495 | // Samir, I moved this from the DrawPolygonModel call below -JL |
| 496 | light_scalar_r *= .8f; |
| 497 | light_scalar_g *= .8f; |
| 498 | light_scalar_b *= .8f; |
| 499 | |
| 500 | if (player_obj->effect_infocxx . . $ object#effect_info.) { |
| 501 | light_scalar_r = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(1.0f, light_scalar_r + (player_obj->effect_infocxx . . $ object#effect_info.->dynamic_redcxx . . $ effect_info_s#dynamic_red.)); |
| 502 | light_scalar_g = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(1.0f, light_scalar_g + (player_obj->effect_infocxx . . $ object#effect_info.->dynamic_greencxx . . $ effect_info_s#dynamic_green.)); |
| 503 | light_scalar_b = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(1.0f, light_scalar_b + (player_obj->effect_infocxx . . $ object#effect_info.->dynamic_bluecxx . . $ effect_info_s#dynamic_blue.)); |
| 504 | } |
| 505 | if (Playerscxx . . $ Players.[player_obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!) { |
| 506 | light_scalar_r = 1.0; |
| 507 | light_scalar_g = 1.0; |
| 508 | light_scalar_b = 1.0; |
| 509 | } |
| 510 | |
| 511 | // animate and draw |
| 512 | keyframe = KeyframeAnimateCockpitcxx . . $ KeyframeAnimateCockpit(9b8c9e39889c762c).(); |
| 513 | SetNormalizedTimeAnimcxx . . $ SetNormalizedTimeAnim(40d1f0252a152310).(keyframe, normalized_time, Cockpit_infocxx . . $ Cockpit_info..modelcxx . . $ tCockpitInfo#model.); |
| 514 | // must put after animation. |
| 515 | if (Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. > 0.04f) { |
| 516 | anglecxx . . $ angle# buffet_angle; |
| 517 | Cockpit_infocxx . . $ Cockpit_info..buffet_timecxx . . $ tCockpitInfo#buffet_time. += Frametimecxx . . $ Frametime.; |
| 518 | if (Cockpit_infocxx . . $ Cockpit_info..buffet_timecxx . . $ tCockpitInfo#buffet_time. > BUFFET_PERIODcxx . . $ `Descent3/cockpit.cpp:214:9`!) { |
| 519 | Cockpit_infocxx . . $ Cockpit_info..buffet_timecxx . . $ tCockpitInfo#buffet_time. = 0.0f; |
| 520 | Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. *= 0.5f; |
| 521 | } |
| 522 | buffet_angle = (anglecxx . . $ angle#)(65536.0 * Cockpit_infocxx . . $ Cockpit_info..buffet_timecxx . . $ tCockpitInfo#buffet_time. / |
| 523 | (BUFFET_PERIODcxx . . $ `Descent3/cockpit.cpp:214:9`! - ((BUFFET_PERIODcxx . . $ `Descent3/cockpit.cpp:214:9`! - Cockpit_infocxx . . $ Cockpit_info..buffet_timecxx . . $ tCockpitInfo#buffet_time.) * 0.5f))); |
| 524 | Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. = FixSincxx . . $ FixSin(9a38df040a81ca35).(buffet_angle); |
| 525 | if (Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. > 0.5f) |
| 526 | Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. = 1.0f; |
| 527 | else if (Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. < -0.5f) |
| 528 | Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. = -1.0f; |
| 529 | else |
| 530 | Cockpit_infocxx . . $ Cockpit_info..buffet_wavecxx . . $ tCockpitInfo#buffet_wave. = 0.0f; |
| 531 | Cockpit_infocxx . . $ Cockpit_info..animatingcxx . . $ tCockpitInfo#animating. = true; |
| 532 | } else if (Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. > 0.0f) { |
| 533 | Cockpit_infocxx . . $ Cockpit_info..animatingcxx . . $ tCockpitInfo#animating. = true; |
| 534 | Cockpit_infocxx . . $ Cockpit_info..buffet_ampcxx . . $ tCockpitInfo#buffet_amp. = 0.0f; |
| 535 | } |
| 536 | // draws lower z cockpit, and monitor glares after gauge renderering |
| 537 | rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0); |
| 538 | DrawPolygonModelcxx . . $ DrawPolygonModel(af314eb3da32d535).(&view_pos, &view_tmat, Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num., normalized_time, 0, &light_vec, light_scalar_r, |
| 539 | light_scalar_g, light_scalar_b, Cockpit_infocxx . . $ Cockpit_info..nonlayered_maskcxx . . $ tCockpitInfo#nonlayered_mask., 0, 1); |
| 540 | RenderGaugescxx . . $ RenderGauges(1ad61c547ad1b9e4).(&view_pos, &view_tmat, normalized_time, (Cockpit_infocxx . . $ Cockpit_info..animatingcxx . . $ tCockpitInfo#animating. || Cockpit_infocxx . . $ Cockpit_info..resizedcxx . . $ tCockpitInfo#resized.), gauge_reset); |
| 541 | rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0); |
| 542 | DrawPolygonModelcxx . . $ DrawPolygonModel(af314eb3da32d535).(&view_pos, &view_tmat, Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num., normalized_time, 0, &light_vec, light_scalar_r, |
| 543 | light_scalar_g, light_scalar_b, Cockpit_infocxx . . $ Cockpit_info..layered_maskcxx . . $ tCockpitInfo#layered_mask., 0, 1); |
| 544 | |
| 545 | Cockpit_infocxx . . $ Cockpit_info..resizedcxx . . $ tCockpitInfo#resized. = false; |
| 546 | } |
| 547 | ////////////////////////////////////////////////////////////////////////////// |
| 548 | // |
| 549 | // adjusts current keyframe and dormancy |
| 550 | float KeyframeAnimateCockpitcxx . . $ KeyframeAnimateCockpit(9b8c9e39889c762c).() { |
| 551 | float newkeyframe; |
| 552 | |
| 553 | newkeyframe = Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. + (Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. - Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe.) * |
| 554 | (Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. / COCKPIT_ANIM_TIMEcxx . . $ `Descent3/cockpit.cpp:207:9`!); |
| 555 | // mprintf(0, "this=%.1f next=%.1f ft=%.1f\n", Cockpit_info.this_keyframe, Cockpit_info.next_keyframe, Cockpit_info.frame_time)); // going up in keyframes |
| 556 | if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. < Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.) { |
| 557 | if (newkeyframe >= Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.) { |
| 558 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = 0.0f; |
| 559 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.; |
| 560 | } |
| 561 | } |
| 562 | // going down in keyframes |
| 563 | else if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. > Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.) { |
| 564 | if (newkeyframe <= Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.) { |
| 565 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. = 0.0f; |
| 566 | Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. = Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.; |
| 567 | } |
| 568 | } else { |
| 569 | Cockpit_infocxx . . $ Cockpit_info..animatingcxx . . $ tCockpitInfo#animating. = false; |
| 570 | return newkeyframe; |
| 571 | } |
| 572 | |
| 573 | // decide if we can process cockpit |
| 574 | Cockpit_infocxx . . $ Cockpit_info..animatingcxx . . $ tCockpitInfo#animating. = true; |
| 575 | if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. != Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe.) { |
| 576 | Cockpit_infocxx . . $ Cockpit_info..frame_timecxx . . $ tCockpitInfo#frame_time. += Frametimecxx . . $ Frametime.; |
| 577 | } |
| 578 | if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. == COCKPIT_COMPLETE_FRAMEcxx . . $ `Descent3/cockpit.cpp:211:9`! && |
| 579 | Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. == Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe.) { |
| 580 | FlagGaugesFunctionalcxx . . $ FlagGaugesFunctional(ed53e3bbd3fa2f69).(STAT_ALLcxx . . $ `Descent3/hud.h:290:9`!); |
| 581 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_FUNCTIONALcxx . . $ `Descent3/cockpit.h:111:9`!; |
| 582 | } else if (Cockpit_infocxx . . $ Cockpit_info..this_keyframecxx . . $ tCockpitInfo#this_keyframe. == COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`! && |
| 583 | Cockpit_infocxx . . $ Cockpit_info..next_keyframecxx . . $ tCockpitInfo#next_keyframe. == COCKPIT_DORMANT_FRAMEcxx . . $ `Descent3/cockpit.cpp:208:9`!) { |
| 584 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_DORMANTcxx . . $ `Descent3/cockpit.h:109:9`!; |
| 585 | } else { |
| 586 | Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state. = COCKPIT_STATE_QUASIcxx . . $ `Descent3/cockpit.h:110:9`!; |
| 587 | } |
| 588 | return newkeyframe; |
| 589 | } |
| 590 | ////////////////////////////////////////////////////////////////////////////// |
| 591 | // |
| 592 | // returns the submodel number of the monitor requested |
| 593 | bsp_infocxx . . $ bsp_info# *CockpitGetMonitorSubmodelcxx . . $ CockpitGetMonitorSubmodel(d37280b5e58b1a7c).(uint16_tcxx . . $ uint16_t# monitor_flag) { |
| 594 | int i; |
| 595 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Cockpit_info.model_num > -1); |
| 596 | for (i = 0; i < Poly_modelscxx . . $ Poly_models.[Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num.].n_modelscxx . . $ poly_model#n_models.; i++) { |
| 597 | if (Poly_modelscxx . . $ Poly_models.[Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num.].submodelcxx . . $ poly_model#submodel.[i].flagscxx . . $ bsp_info#flags. & monitor_flag) |
| 598 | return &Poly_modelscxx . . $ Poly_models.[Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num.].submodelcxx . . $ poly_model#submodel.[i]; |
| 599 | } |
| 600 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 601 | } |
| 602 | // returns the polymodel for the hud |
| 603 | poly_modelcxx . . $ poly_model# *CockpitGetPolyModelcxx . . $ CockpitGetPolyModel(4cb3338b82435ee4).() { |
| 604 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Cockpit_info.model_num > -1); |
| 605 | |
| 606 | return &Poly_modelscxx . . $ Poly_models.[Cockpit_infocxx . . $ Cockpit_info..model_numcxx . . $ tCockpitInfo#model_num.]; |
| 607 | } |
| 608 | // Tell whether the cockpit is animating |
| 609 | int CockpitStatecxx . . $ CockpitState(b126dc7c1de90089).() { return Cockpit_infocxx . . $ Cockpit_info..statecxx . . $ tCockpitInfo#state.; } |