| 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/pilot_class.cpp $ |
| 21 | * $Revision: 30 $ |
| 22 | * $Date: 3/20/00 12:19p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Pilot class and access functions |
| 26 | * |
| 27 | * $Log: /DescentIII/main/pilot_class.cpp $ |
| 28 | * |
| 29 | * 30 3/20/00 12:19p Matt |
| 30 | * Merge of Duane's post-1.3 changes. |
| 31 | * Default to full-screen mode on Mac. |
| 32 | * Mouse sensitivity change (Mac only) |
| 33 | * |
| 34 | * 29 10/21/99 9:28p Jeff |
| 35 | * B.A. Macintosh code merge |
| 36 | * |
| 37 | * 28 8/10/99 5:12p Jeff |
| 38 | * fixed compiler warnings |
| 39 | * |
| 40 | * 27 8/06/99 4:25p Samir |
| 41 | * set key ramping speed globally when loading pilot file. |
| 42 | * |
| 43 | * 26 7/20/99 1:18p Samir |
| 44 | * save state of rearviews between game through the pilot file. |
| 45 | * |
| 46 | * 25 5/21/99 10:42p Jeff |
| 47 | * init pilot ship to Pyro-GL for dedicated server needs |
| 48 | * |
| 49 | * 24 5/09/99 1:48a Jeff |
| 50 | * default rookie |
| 51 | * |
| 52 | * 23 5/02/99 12:56a Jeff |
| 53 | * save ship permissions at highest level achieved and use that on restore |
| 54 | * to a level previously played |
| 55 | * |
| 56 | * 22 5/01/99 1:36a Samir |
| 57 | * oops forgot to update pilot version number! |
| 58 | * |
| 59 | * 21 4/30/99 1:29p Samir |
| 60 | * added save for key ramping |
| 61 | * |
| 62 | * 20 4/27/99 4:18p Jeff |
| 63 | * fixed crash |
| 64 | * |
| 65 | * 19 4/27/99 3:58p Jeff |
| 66 | * added kiddie settings |
| 67 | * |
| 68 | * 18 4/27/99 1:56p Jeff |
| 69 | * audio taunts stuff in pilot menu, added stringtables |
| 70 | * |
| 71 | * 17 4/25/99 2:32a Jeff |
| 72 | * fixed bug trying to read pilot files that are too new |
| 73 | * |
| 74 | * 16 4/24/99 8:40p Samir |
| 75 | * added toggle to pilot for ship sounds. |
| 76 | * |
| 77 | * 15 4/20/99 7:28p Jeff |
| 78 | * added guidebot name |
| 79 | * |
| 80 | * 14 4/17/99 8:25p Samir |
| 81 | * took out graphical option for inventory display. no time. |
| 82 | * |
| 83 | * 13 4/15/99 2:55p Samir |
| 84 | * added UI for mouselook. |
| 85 | * |
| 86 | * 12 4/05/99 5:13p Samir |
| 87 | * added game toggles. |
| 88 | * |
| 89 | * 11 4/03/99 2:18a Jeff |
| 90 | * added profanity filter stuff |
| 91 | * |
| 92 | * 10 3/22/99 6:22p Jeff |
| 93 | * added 2 more audio taunts. a mulitplayer event when someone plays an |
| 94 | * audio taunt. option to disable audio taunts. |
| 95 | * |
| 96 | * 9 3/15/99 9:24p Gwar |
| 97 | * |
| 98 | * 8 3/05/99 2:44p Samir |
| 99 | * needs to be cleaned up later, but mouse and joystick sensitivities are |
| 100 | * read in always, and set by the controller system. A cancel method |
| 101 | * needs to be implemented for these functions. |
| 102 | * |
| 103 | * 7 3/03/99 5:09p Samir |
| 104 | * default to graphical hud! |
| 105 | * |
| 106 | * 6 2/25/99 8:55p Jeff |
| 107 | * Inventory supports level change persistant items. Inventory supports |
| 108 | * time-out objects. Inventory Reset changed (takes a level of reset |
| 109 | * now). Quad lasers stay across level change (single player). Guidebot |
| 110 | * bug fixed (now back in ship on level start). Quads time out when |
| 111 | * spewed. Invulnerability and cloak powerups no longer use game |
| 112 | * event/callbacks, so they can be saved in game saves (moved to |
| 113 | * MakePlayerInvulnerable and MakeObjectInvisible) |
| 114 | * |
| 115 | * 5 2/24/99 12:55p Samir |
| 116 | * refresh weapon select info in pilot_class when writing out pilot file. |
| 117 | * |
| 118 | * 4 2/18/99 5:55p Jeff |
| 119 | * added weapon select data |
| 120 | * |
| 121 | * 3 2/16/99 12:00p Samir |
| 122 | * added new video resolution swtich test. |
| 123 | * |
| 124 | * 2 2/15/99 7:50p Jeff |
| 125 | * new pilot file class and read/write system checked in...should be more |
| 126 | * robust than old |
| 127 | * |
| 128 | * 1 2/15/99 3:18a Jeff |
| 129 | * initial creation |
| 130 | * |
| 131 | * $NoKeywords: $ |
| 132 | */ |
| 133 | |
| 134 | #include "pilot_class.h"cxx . . $ `<file>/Descent3/pilot_class.h`/ |
| 135 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 136 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 137 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 138 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 139 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 140 | #include "config.h"cxx . . $ `<file>/Descent3/config.h`/ |
| 141 | #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/ |
| 142 | #include <string.h> |
| 143 | #include <stdlib.h> |
| 144 | |
| 145 | #include "application.h"cxx . . $ `<file>/lib/application.h`/ |
| 146 | #include "appdatabase.h"cxx . . $ `<file>/lib/appdatabase.h`/ |
| 147 | |
| 148 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 149 | |
| 150 | #define __PILOT_H_cxx . . $ `Descent3/pilot_class.cpp:150:9`! // don't want to include pilot.h right now |
| 151 | #include "difficulty.h"cxx . . $ `<file>/Descent3/difficulty.h`/ |
| 152 | #include "audiotaunts.h"cxx . . $ `<file>/Descent3/audiotaunts.h`/ |
| 153 | |
| 154 | #include <algorithm> |
| 155 | |
| 156 | extern void grtext_SetProfanityFiltercxx . . $ grtext_SetProfanityFilter(b45ddcbc8423892c).(bool enabled); |
| 157 | |
| 158 | extern float Key_ramp_speedcxx . . $ Key_ramp_speed.; |
| 159 | |
| 160 | #define PLT_FILE_VERSIONcxx . . $ `Descent3/pilot_class.cpp:160:9`! 0x2B // pilot file version |
| 161 | |
| 162 | // pilot file version history |
| 163 | #define PFV_REARVIEWINFOcxx . . $ `Descent3/pilot_class.cpp:163:9`! 0x2B // (SAMIR) save current state of rear small view. |
| 164 | #define PFV_SHIPPERMISSIONScxx . . $ `Descent3/pilot_class.cpp:164:9`! 0x2A // (JEFF) save highest level ship permission in mission data |
| 165 | #define PFV_KEYRAMPINGcxx . . $ `Descent3/pilot_class.cpp:165:9`! 0x29 // (SAMIR) added save of keyboard ramping value. |
| 166 | #define PFV_AUDIOTAUNTScxx . . $ `Descent3/pilot_class.cpp:166:9`! 0x28 // (JEFF) added audiotaunts |
| 167 | #define PFV_GUIDEBOTNAMEcxx . . $ `Descent3/pilot_class.cpp:167:9`! 0x26 // (JEFF) added guidebot name |
| 168 | #define PFV_MOUSELOOKcxx . . $ `Descent3/pilot_class.cpp:168:9`! 0x25 // (SAMIR) added mouselook option to pilot. |
| 169 | #define PFV_GAMETOGGLEScxx . . $ `Descent3/pilot_class.cpp:169:9`! 0x24 // (SAMIR) gameplay toggles |
| 170 | #define PFV_PROFANITYcxx . . $ `Descent3/pilot_class.cpp:170:9`! 0x23 // (JEFF) added profanity filter |
| 171 | #define PFV_AUDIOTAUNT3N4cxx . . $ `Descent3/pilot_class.cpp:171:9`! 0x22 // (JEFF) added saving of audio taunts 3 & 4 (and save/restore count for mission data) |
| 172 | #define PFV_WEAPONSELECTcxx . . $ `Descent3/pilot_class.cpp:172:9`! 0x21 // (JEFF) added saving weapon select |
| 173 | |
| 174 | pilotcxx . . $ pilot#::~cxx . . $ pilot#`~pilot`(ced63f7c635d850d).pilotcxx . . $ pilot#() { cleancxx . . $ pilot#clean(b45ddcbc8423892c).(false); } |
| 175 | |
| 176 | pilotcxx . . $ pilot#::pilotcxx . . $ pilot#pilot(49f6e7a06ebc5aa8).() { |
| 177 | write_pendingcxx . . $ pilot#write_pending. = false; |
| 178 | initializecxx . . $ pilot#initialize(49f6e7a06ebc5aa8).(); |
| 179 | } |
| 180 | |
| 181 | pilotcxx . . $ pilot#::pilotcxx . . $ pilot#pilot(1794bc617d3f3266).(pilotcxx . . $ pilot# *copy) { |
| 182 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 183 | initializecxx . . $ pilot#initialize(49f6e7a06ebc5aa8).(); |
| 184 | } |
| 185 | |
| 186 | pilotcxx . . $ pilot#::pilotcxx . . $ pilot#pilot(fda57c8427c60377).(char *fname) { |
| 187 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 188 | initializecxx . . $ pilot#initialize(49f6e7a06ebc5aa8).(); |
| 189 | } |
| 190 | |
| 191 | // initializes all the data (for constructors) |
| 192 | void pilotcxx . . $ pilot#::initializecxx . . $ pilot#initialize(49f6e7a06ebc5aa8).(void) { |
| 193 | int i; |
| 194 | |
| 195 | filenamecxx . . $ pilot#filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 196 | namecxx . . $ pilot#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 197 | ship_modelcxx . . $ pilot#ship_model. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("Pyro-GL"); |
| 198 | ship_logocxx . . $ pilot#ship_logo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 199 | audio1_filecxx . . $ pilot#audio1_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 200 | audio2_filecxx . . $ pilot#audio2_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 201 | audio3_filecxx . . $ pilot#audio3_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 202 | audio4_filecxx . . $ pilot#audio4_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 203 | guidebot_namecxx . . $ pilot#guidebot_name. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("GB"); |
| 204 | picture_idcxx . . $ pilot#picture_id. = PPIC_INVALID_IDcxx . . $ `Descent3/pilot_class.h:126:9`!; |
| 205 | difficultycxx . . $ pilot#difficulty. = DIFFICULTY_ROOKIEcxx . . $ `Descent3/difficulty_external.h:26:9`!; |
| 206 | hud_modecxx . . $ pilot#hud_mode. = (uint8_tcxx . . $ uint8_t#)HUD_COCKPITcxx . . $ HUD_COCKPIT.; |
| 207 | hud_statcxx . . $ pilot#hud_stat. = 0; |
| 208 | hud_graphical_statcxx . . $ pilot#hud_graphical_stat. = STAT_STANDARDcxx . . $ `Descent3/hud.h:289:9`!; |
| 209 | game_window_wcxx . . $ pilot#game_window_w. = Video_res_listcxx . . $ Video_res_list.[Game_video_resolutioncxx . . $ Game_video_resolution.].widthcxx . . $ tVideoResolution#width.; |
| 210 | game_window_hcxx . . $ pilot#game_window_h. = Video_res_listcxx . . $ Video_res_list.[Game_video_resolutioncxx . . $ Game_video_resolution.].heightcxx . . $ tVideoResolution#height.; |
| 211 | num_missions_flowncxx . . $ pilot#num_missions_flown. = 0; |
| 212 | mission_datacxx . . $ pilot#mission_data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 213 | mouselook_controlcxx . . $ pilot#mouselook_control. = false; |
| 214 | key_rampingcxx . . $ pilot#key_ramping. = 0.35f; |
| 215 | lrearview_enabledcxx . . $ pilot#lrearview_enabled. = false; |
| 216 | rrearview_enabledcxx . . $ pilot#rrearview_enabled. = false; |
| 217 | |
| 218 | bool kiddie_settings = true; |
| 219 | |
| 220 | if (Databasecxx . . $ Database.) { |
| 221 | Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).("ProfanityPrevention", &kiddie_settings); |
| 222 | } |
| 223 | |
| 224 | if (kiddie_settings) { |
| 225 | profanity_filter_oncxx . . $ pilot#profanity_filter_on. = true; |
| 226 | audiotauntscxx . . $ pilot#audiotaunts. = false; |
| 227 | } else { |
| 228 | profanity_filter_oncxx . . $ pilot#profanity_filter_on. = false; |
| 229 | audiotauntscxx . . $ pilot#audiotaunts. = true; |
| 230 | } |
| 231 | |
| 232 | gameplay_togglescxx . . $ pilot#gameplay_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview. = false; |
| 233 | gameplay_togglescxx . . $ pilot#gameplay_toggles..show_reticlecxx . . $ tGameToggles#show_reticle. = true; |
| 234 | gameplay_togglescxx . . $ pilot#gameplay_toggles..ship_noisescxx . . $ tGameToggles#ship_noises. = true; |
| 235 | |
| 236 | // Copy taunts |
| 237 | for (i = 0; i < MAX_PILOT_TAUNTScxx . . $ `Descent3/pilot_class.h:132:9`!; i++) { |
| 238 | strcpy(tauntscxx . . $ pilot#taunts.[i], TXTcxx . . $ `Descent3/stringtable.h:24:9`!(TXT_TAUNT_TEXTcxx . . $ `Descent3/stringtable.h:479:9`! + i)); |
| 239 | } |
| 240 | |
| 241 | read_controllercxx . . $ pilot#read_controller. = READF_MOUSEcxx . . $ `Descent3/controls.h:177:9`! + READF_JOYcxx . . $ `Descent3/controls.h:178:9`!; |
| 242 | |
| 243 | if (Controllercxx . . $ Controller.) { |
| 244 | for (i = 0; i < NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.; i++) { |
| 245 | Controllercxx . . $ Controller.->get_controller_functioncxx . . $ gameController#get_controller_function(c004c324aa6068e0).(Controller_needscxx . . $ Controller_needs.[i].idcxx . . $ ct_function#id., controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type., &controlscxx . . $ pilot#controls.[i].valuecxx . . $ cntrldata#value., |
| 246 | controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.); |
| 247 | controlscxx . . $ pilot#controls.[i].idcxx . . $ cntrldata#id. = Controller_needscxx . . $ Controller_needs.[i].idcxx . . $ ct_function#id.; |
| 248 | } |
| 249 | } else { |
| 250 | for (i = 0; i < NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.; i++) { |
| 251 | memset(&controlscxx . . $ pilot#controls.[i], 0, sizeof(cntrldatacxx . . $ cntrldata#)); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | for (i = 0; i < N_MOUSE_AXIScxx . . $ `Descent3/pilot_class.h:128:9`!; i++) { |
| 256 | mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[i] = 1.0f; |
| 257 | } |
| 258 | |
| 259 | for (i = 0; i < N_JOY_AXIScxx . . $ `Descent3/pilot_class.h:129:9`!; i++) { |
| 260 | joy_sensitivitycxx . . $ pilot#joy_sensitivity.[i] = 1.0f; |
| 261 | } |
| 262 | |
| 263 | for (i = 0; i < MAX_PRIMARY_WEAPONScxx . . $ `Descent3/weapon.h:202:9`!; i++) |
| 264 | PrimarySelectListcxx . . $ pilot#PrimarySelectList.[i] = DefaultPrimarySelectListcxx . . $ DefaultPrimarySelectList.[i]; |
| 265 | |
| 266 | for (i = 0; i < MAX_SECONDARY_WEAPONScxx . . $ `Descent3/weapon.h:203:9`!; i++) |
| 267 | SecondarySelectListcxx . . $ pilot#SecondarySelectList.[i] = DefaultSecondarySelectListcxx . . $ DefaultSecondarySelectList.[i]; |
| 268 | } |
| 269 | |
| 270 | // This function guts the data so it's virgin (fresh for reading) |
| 271 | // frees any memory that needs to be freed, etc. |
| 272 | void pilotcxx . . $ pilot#::cleancxx . . $ pilot#clean(b45ddcbc8423892c).(bool reset) { |
| 273 | if (filenamecxx . . $ pilot#filename.) { |
| 274 | mem_freecxx . . $ `mem/mem.h:80:9`!(filename); |
| 275 | filenamecxx . . $ pilot#filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 276 | } |
| 277 | |
| 278 | if (namecxx . . $ pilot#name.) { |
| 279 | mem_freecxx . . $ `mem/mem.h:80:9`!(name); |
| 280 | namecxx . . $ pilot#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 281 | } |
| 282 | |
| 283 | if (ship_modelcxx . . $ pilot#ship_model.) { |
| 284 | mem_freecxx . . $ `mem/mem.h:80:9`!(ship_model); |
| 285 | ship_modelcxx . . $ pilot#ship_model. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 286 | } |
| 287 | |
| 288 | if (ship_logocxx . . $ pilot#ship_logo.) { |
| 289 | mem_freecxx . . $ `mem/mem.h:80:9`!(ship_logo); |
| 290 | ship_logocxx . . $ pilot#ship_logo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 291 | } |
| 292 | |
| 293 | if (audio1_filecxx . . $ pilot#audio1_file.) { |
| 294 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio1_file); |
| 295 | audio1_filecxx . . $ pilot#audio1_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 296 | } |
| 297 | |
| 298 | if (audio2_filecxx . . $ pilot#audio2_file.) { |
| 299 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio2_file); |
| 300 | audio2_filecxx . . $ pilot#audio2_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 301 | } |
| 302 | |
| 303 | if (audio3_filecxx . . $ pilot#audio3_file.) { |
| 304 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio3_file); |
| 305 | audio3_filecxx . . $ pilot#audio3_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 306 | } |
| 307 | |
| 308 | if (audio4_filecxx . . $ pilot#audio4_file.) { |
| 309 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio4_file); |
| 310 | audio4_filecxx . . $ pilot#audio4_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 311 | } |
| 312 | |
| 313 | if (mission_datacxx . . $ pilot#mission_data.) { |
| 314 | mem_freecxx . . $ `mem/mem.h:80:9`!(mission_data); |
| 315 | mission_datacxx . . $ pilot#mission_data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 316 | } |
| 317 | |
| 318 | if (guidebot_namecxx . . $ pilot#guidebot_name.) { |
| 319 | mem_freecxx . . $ `mem/mem.h:80:9`!(guidebot_name); |
| 320 | guidebot_namecxx . . $ pilot#guidebot_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 321 | } |
| 322 | |
| 323 | if (reset) |
| 324 | initializecxx . . $ pilot#initialize(49f6e7a06ebc5aa8).(); |
| 325 | } |
| 326 | |
| 327 | // This function verifies all the pilot data, making sure nothing is out of whack |
| 328 | // It will correct any messed data. |
| 329 | void pilotcxx . . $ pilot#::verifycxx . . $ pilot#verify(49f6e7a06ebc5aa8).(void) { |
| 330 | int i; |
| 331 | for (i = 0; i < MAX_PRIMARY_WEAPONScxx . . $ `Descent3/weapon.h:202:9`!; i++) { |
| 332 | PrimarySelectListcxx . . $ pilot#PrimarySelectList.[i] = GetAutoSelectPrimaryWpnIdxcxx . . $ GetAutoSelectPrimaryWpnIdx(1ab5934a54f935a6).(i); |
| 333 | } |
| 334 | for (i = 0; i < MAX_SECONDARY_WEAPONScxx . . $ `Descent3/weapon.h:203:9`!; i++) { |
| 335 | SecondarySelectListcxx . . $ pilot#SecondarySelectList.[i] = GetAutoSelectSecondaryWpnIdxcxx . . $ GetAutoSelectSecondaryWpnIdx(1ab5934a54f935a6).(i); |
| 336 | } |
| 337 | |
| 338 | gameplay_togglescxx . . $ pilot#gameplay_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview. = Game_togglescxx . . $ Game_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview.; |
| 339 | gameplay_togglescxx . . $ pilot#gameplay_toggles..show_reticlecxx . . $ tGameToggles#show_reticle. = Game_togglescxx . . $ Game_toggles..show_reticlecxx . . $ tGameToggles#show_reticle.; |
| 340 | gameplay_togglescxx . . $ pilot#gameplay_toggles..ship_noisescxx . . $ tGameToggles#ship_noises. = Game_togglescxx . . $ Game_toggles..ship_noisescxx . . $ tGameToggles#ship_noises.; |
| 341 | |
| 342 | // kill graphical stat for inventory and reset to text version |
| 343 | if (hud_graphical_statcxx . . $ pilot#hud_graphical_stat. & STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`!) { |
| 344 | hud_graphical_statcxx . . $ pilot#hud_graphical_stat. = hud_graphical_statcxx . . $ pilot#hud_graphical_stat. & (~STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`!); |
| 345 | hud_statcxx . . $ pilot#hud_stat. = hud_statcxx . . $ pilot#hud_stat. | STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`!; |
| 346 | } |
| 347 | |
| 348 | key_rampingcxx . . $ pilot#key_ramping. = Key_ramp_speedcxx . . $ Key_ramp_speed.; |
| 349 | |
| 350 | /* |
| 351 | bool had_to_change = false; |
| 352 | |
| 353 | //first check the ship mode |
| 354 | bool found_model = false; |
| 355 | for(int i=0;i<MAX_SHIPS;i++){ |
| 356 | if(Ships[i].used && !stricmp(Ships[i].name,Pilot->ship_model) ){ |
| 357 | found_model = true; |
| 358 | break; |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | if(!found_model){ |
| 363 | //we couldn't find the ship model |
| 364 | had_to_change = true; |
| 365 | strcpy(Pilot->ship_model,DEFAULT_SHIP); |
| 366 | } |
| 367 | |
| 368 | //check the custom texture |
| 369 | if(Pilot->ship_logo[0]!='\0'){ |
| 370 | if(cfexist(Pilot->ship_logo)==CF_NOT_FOUND){ |
| 371 | //couldn't find the custom texture |
| 372 | Pilot->ship_logo[0] = '\0'; |
| 373 | had_to_change = true; |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | //check audio files |
| 378 | if(Pilot->audio1_file[0]!='\0'){ |
| 379 | if(cfexist(Pilot->audio1_file)==CF_NOT_FOUND){ |
| 380 | //couldn't find the custom texture |
| 381 | Pilot->audio1_file[0] = '\0'; |
| 382 | had_to_change = true; |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | if(Pilot->audio2_file[0]!='\0'){ |
| 387 | if(cfexist(Pilot->audio2_file)==CF_NOT_FOUND){ |
| 388 | //couldn't find the custom texture |
| 389 | Pilot->audio2_file[0] = '\0'; |
| 390 | had_to_change = true; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | char temp_buffer[PILOT_STRING_SIZE]; |
| 395 | if(Pilot->picture_id!=PPIC_INVALID_ID && !PPic_GetPilot(Pilot->picture_id,temp_buffer,PILOT_STRING_SIZE)){ |
| 396 | //the pilot picture id is invalid |
| 397 | Pilot->picture_id = PPIC_INVALID_ID; |
| 398 | had_to_change = true; |
| 399 | } |
| 400 | |
| 401 | return had_to_change; |
| 402 | */ |
| 403 | } |
| 404 | |
| 405 | // This function makes the pilot file so it's write pending, meaning that |
| 406 | // on the next call to flush, it will actually write out the data. There is |
| 407 | // no need to constantly do file access unless it's really needed |
| 408 | void pilotcxx . . $ pilot#::writecxx . . $ pilot#write(49f6e7a06ebc5aa8).(void) { write_pendingcxx . . $ pilot#write_pending. = true; } |
| 409 | |
| 410 | // This function makes certain that the pilot data is up to date with the |
| 411 | // actual pilot file, writing if needed. |
| 412 | int pilotcxx . . $ pilot#::flushcxx . . $ pilot#flush(73da94e76e6bd037).(bool new_file) { |
| 413 | if (!write_pendingcxx . . $ pilot#write_pending.) |
| 414 | return PLTW_NO_ERRORcxx . . $ `Descent3/pilot_class.h:137:9`!; // no need to write, data hasn't changed |
| 415 | |
| 416 | if (!filenamecxx . . $ pilot#filename.) { |
| 417 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 418 | return PLTW_NO_FILENAMEcxx . . $ `Descent3/pilot_class.h:138:9`!; // no filename was given |
| 419 | } |
| 420 | |
| 421 | CFILEcxx . . $ CFILE# *file; |
| 422 | char real_filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 423 | |
| 424 | // open and process file |
| 425 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(real_filename, Base_directory_writecxx . . $ Base_directory_write., filenamecxx . . $ pilot#filename., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 426 | |
| 427 | if (new_file && cfexistcxx . . $ cfexist(293b0826c8d9cb54).(real_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) { |
| 428 | // the file already exists, we can't write out |
| 429 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTW: File (%s) exists, can't create\n", real_filename); |
| 430 | return PLTW_FILE_EXISTScxx . . $ `Descent3/pilot_class.h:139:9`!; |
| 431 | } |
| 432 | |
| 433 | try { |
| 434 | verifycxx . . $ pilot#verify(49f6e7a06ebc5aa8).(); |
| 435 | |
| 436 | file = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(real_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wb"); |
| 437 | if (!file) { |
| 438 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTW: File (%s) can't be opened\n", real_filename); |
| 439 | return PLTW_FILE_CANTOPENcxx . . $ `Descent3/pilot_class.h:140:9`!; |
| 440 | } |
| 441 | |
| 442 | // Write out our fileversion |
| 443 | file_versioncxx . . $ pilot#file_version. = PLT_FILE_VERSIONcxx . . $ `Descent3/pilot_class.cpp:160:9`!; |
| 444 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, file_versioncxx . . $ pilot#file_version.); |
| 445 | |
| 446 | write_namecxx . . $ pilot#write_name(3639e799710acb68).(file); |
| 447 | write_ship_infocxx . . $ pilot#write_ship_info(3639e799710acb68).(file); |
| 448 | write_custom_multiplayer_datacxx . . $ pilot#write_custom_multiplayer_data(3639e799710acb68).(file); |
| 449 | write_difficultycxx . . $ pilot#write_difficulty(3639e799710acb68).(file); |
| 450 | write_profanity_filtercxx . . $ pilot#write_profanity_filter(3639e799710acb68).(file); |
| 451 | write_audiotauntscxx . . $ pilot#write_audiotaunts(3639e799710acb68).(file); |
| 452 | write_hud_datacxx . . $ pilot#write_hud_data(3639e799710acb68).(file); |
| 453 | write_mission_datacxx . . $ pilot#write_mission_data(3639e799710acb68).(file); |
| 454 | write_tauntscxx . . $ pilot#write_taunts(3639e799710acb68).(file); |
| 455 | write_weapon_selectcxx . . $ pilot#write_weapon_select(3639e799710acb68).(file); |
| 456 | write_gameplay_togglescxx . . $ pilot#write_gameplay_toggles(3639e799710acb68).(file); // version 0x24 PFV_GAMETOGGLES |
| 457 | write_guidebot_namecxx . . $ pilot#write_guidebot_name(3639e799710acb68).(file); |
| 458 | write_controlscxx . . $ pilot#write_controls(3639e799710acb68).(file); |
| 459 | |
| 460 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 461 | |
| 462 | } catch (cfile_errorcxx . . $ cfile_error#) { |
| 463 | // catch and handle CFILE errors |
| 464 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTW: CFILE Exception writing data\n"); |
| 465 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 466 | try { |
| 467 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 468 | } catch (...) { |
| 469 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTW: Unable to close file due to exception\n"); |
| 470 | } |
| 471 | return PLTW_CFILE_FATALcxx . . $ `Descent3/pilot_class.h:141:9`!; |
| 472 | } catch (...) { |
| 473 | // catch all errors |
| 474 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTW: Unknown exception writing data\n"); |
| 475 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 476 | try { |
| 477 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 478 | } catch (...) { |
| 479 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTW: Unable to close file due to exception\n"); |
| 480 | } |
| 481 | return PLTW_UNKNOWN_FATALcxx . . $ `Descent3/pilot_class.h:142:9`!; |
| 482 | } |
| 483 | |
| 484 | write_pendingcxx . . $ pilot#write_pending. = false; |
| 485 | |
| 486 | return PLTW_NO_ERRORcxx . . $ `Descent3/pilot_class.h:137:9`!; |
| 487 | } |
| 488 | |
| 489 | // This function sets the filename that is associated with this pilot |
| 490 | void pilotcxx . . $ pilot#::set_filenamecxx . . $ pilot#set_filename(fda57c8427c60377).(char *fname) { |
| 491 | if (filenamecxx . . $ pilot#filename.) { |
| 492 | mem_freecxx . . $ `mem/mem.h:80:9`!(filename); |
| 493 | filenamecxx . . $ pilot#filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 494 | } |
| 495 | |
| 496 | filenamecxx . . $ pilot#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(fname); |
| 497 | } |
| 498 | |
| 499 | void pilotcxx . . $ pilot#::get_filenamecxx . . $ pilot#get_filename(fda57c8427c60377).(char *fname) { |
| 500 | if (filenamecxx . . $ pilot#filename.) { |
| 501 | strcpy(fname, filenamecxx . . $ pilot#filename.); |
| 502 | } else { |
| 503 | *fname = '\0'; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | // This function reads in the data from file (from the filename associated) |
| 508 | // into the pilot data. |
| 509 | int pilotcxx . . $ pilot#::readcxx . . $ pilot#read(9f1afb2e1f195c72).(bool skip_config, bool skip_mission_data) { |
| 510 | if (!filenamecxx . . $ pilot#filename.) { |
| 511 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 512 | return PLTR_NO_FILENAMEcxx . . $ `Descent3/pilot_class.h:145:9`!; // no filename was given |
| 513 | } |
| 514 | |
| 515 | CFILEcxx . . $ CFILE# *file; |
| 516 | char real_filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 517 | |
| 518 | // open and process file |
| 519 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(real_filename, Base_directory_writecxx . . $ Base_directory_write., filenamecxx . . $ pilot#filename., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 520 | |
| 521 | if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(real_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) { |
| 522 | // the file already exists, we can't write out |
| 523 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTR: File (%s) does not exist\n", real_filename); |
| 524 | return PLTR_FILE_NOEXISTcxx . . $ `Descent3/pilot_class.h:146:9`!; |
| 525 | } |
| 526 | |
| 527 | try { |
| 528 | file = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(real_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb"); |
| 529 | if (!file) { |
| 530 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTR: File (%s) can't be opened\n", real_filename); |
| 531 | return PLTR_FILE_CANTOPENcxx . . $ `Descent3/pilot_class.h:147:9`!; |
| 532 | } |
| 533 | |
| 534 | // Write out our fileversion |
| 535 | file_versioncxx . . $ pilot#file_version. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 536 | |
| 537 | if (file_versioncxx . . $ pilot#file_version. > PLT_FILE_VERSIONcxx . . $ `Descent3/pilot_class.cpp:160:9`!) { |
| 538 | // too new!! |
| 539 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 540 | return PLTR_TOO_NEWcxx . . $ `Descent3/pilot_class.h:150:9`!; |
| 541 | } |
| 542 | |
| 543 | ////////////////////////////////////////////// |
| 544 | read_namecxx . . $ pilot#read_name(5a5441f2f69caf20).(file, false); |
| 545 | read_ship_infocxx . . $ pilot#read_ship_info(5a5441f2f69caf20).(file, false); |
| 546 | read_custom_multiplayer_datacxx . . $ pilot#read_custom_multiplayer_data(5a5441f2f69caf20).(file, false); |
| 547 | read_difficultycxx . . $ pilot#read_difficulty(5a5441f2f69caf20).(file, false); |
| 548 | if (file_versioncxx . . $ pilot#file_version. >= PFV_PROFANITYcxx . . $ `Descent3/pilot_class.cpp:170:9`!) { |
| 549 | read_profanity_filtercxx . . $ pilot#read_profanity_filter(5a5441f2f69caf20).(file, false); |
| 550 | } |
| 551 | if (file_versioncxx . . $ pilot#file_version. >= PFV_AUDIOTAUNTScxx . . $ `Descent3/pilot_class.cpp:166:9`!) { |
| 552 | read_audiotauntscxx . . $ pilot#read_audiotaunts(5a5441f2f69caf20).(file, false); |
| 553 | } |
| 554 | |
| 555 | read_hud_datacxx . . $ pilot#read_hud_data(5a5441f2f69caf20).(file, false); |
| 556 | read_mission_datacxx . . $ pilot#read_mission_data(5a5441f2f69caf20).(file, skip_mission_data); |
| 557 | read_tauntscxx . . $ pilot#read_taunts(5a5441f2f69caf20).(file, false); |
| 558 | |
| 559 | if (file_versioncxx . . $ pilot#file_version. >= PFV_WEAPONSELECTcxx . . $ `Descent3/pilot_class.cpp:172:9`!) { |
| 560 | read_weapon_selectcxx . . $ pilot#read_weapon_select(3639e799710acb68).(file); |
| 561 | } |
| 562 | |
| 563 | if (file_versioncxx . . $ pilot#file_version. >= PFV_GAMETOGGLEScxx . . $ `Descent3/pilot_class.cpp:169:9`!) { |
| 564 | read_gameplay_togglescxx . . $ pilot#read_gameplay_toggles(5a5441f2f69caf20).(file, false); |
| 565 | } |
| 566 | |
| 567 | if (file_versioncxx . . $ pilot#file_version. >= PFV_GUIDEBOTNAMEcxx . . $ `Descent3/pilot_class.cpp:167:9`!) { |
| 568 | read_guidebot_namecxx . . $ pilot#read_guidebot_name(5a5441f2f69caf20).(file, false); |
| 569 | } |
| 570 | |
| 571 | read_controlscxx . . $ pilot#read_controls(5a5441f2f69caf20).(file, skip_config); |
| 572 | |
| 573 | ////////////////////////////////////////////// |
| 574 | int wpn; |
| 575 | for (wpn = 0; wpn < MAX_PRIMARY_WEAPONScxx . . $ `Descent3/weapon.h:202:9`!; wpn++) { |
| 576 | SetAutoSelectPrimaryWpnIdxcxx . . $ SetAutoSelectPrimaryWpnIdx(a7050f1a4cb56049).(wpn, PrimarySelectListcxx . . $ pilot#PrimarySelectList.[wpn]); |
| 577 | } |
| 578 | for (wpn = 0; wpn < MAX_SECONDARY_WEAPONScxx . . $ `Descent3/weapon.h:203:9`!; wpn++) { |
| 579 | SetAutoSelectSecondaryWpnIdxcxx . . $ SetAutoSelectSecondaryWpnIdx(a7050f1a4cb56049).(wpn, SecondarySelectListcxx . . $ pilot#SecondarySelectList.[wpn]); |
| 580 | } |
| 581 | |
| 582 | Game_togglescxx . . $ Game_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview. = gameplay_togglescxx . . $ pilot#gameplay_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview.; |
| 583 | Game_togglescxx . . $ Game_toggles..show_reticlecxx . . $ tGameToggles#show_reticle. = gameplay_togglescxx . . $ pilot#gameplay_toggles..show_reticlecxx . . $ tGameToggles#show_reticle.; |
| 584 | Game_togglescxx . . $ Game_toggles..ship_noisescxx . . $ tGameToggles#ship_noises. = gameplay_togglescxx . . $ pilot#gameplay_toggles..ship_noisescxx . . $ tGameToggles#ship_noises.; |
| 585 | |
| 586 | Key_ramp_speedcxx . . $ Key_ramp_speed. = key_rampingcxx . . $ pilot#key_ramping.; |
| 587 | |
| 588 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 589 | } catch (cfile_errorcxx . . $ cfile_error#) { |
| 590 | // catch and handle CFILE errors |
| 591 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTR: CFILE Exception reading data\n"); |
| 592 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 593 | try { |
| 594 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 595 | } catch (...) { |
| 596 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTR: Unable to close file due to exception\n"); |
| 597 | } |
| 598 | verifycxx . . $ pilot#verify(49f6e7a06ebc5aa8).(); |
| 599 | return PLTR_CFILE_FATALcxx . . $ `Descent3/pilot_class.h:148:9`!; |
| 600 | } catch (...) { |
| 601 | // catch all errors |
| 602 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTR: Unknown exception reading data\n"); |
| 603 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 604 | try { |
| 605 | cfclosecxx . . $ cfclose(3639e799710acb68).(file); |
| 606 | } catch (...) { |
| 607 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PLTR: Unable to close file due to exception\n"); |
| 608 | } |
| 609 | verifycxx . . $ pilot#verify(49f6e7a06ebc5aa8).(); |
| 610 | return PLTR_UNKNOWN_FATALcxx . . $ `Descent3/pilot_class.h:149:9`!; |
| 611 | } |
| 612 | |
| 613 | verifycxx . . $ pilot#verify(49f6e7a06ebc5aa8).(); |
| 614 | return PLTR_NO_ERRORcxx . . $ `Descent3/pilot_class.h:144:9`!; |
| 615 | } |
| 616 | |
| 617 | void pilotcxx . . $ pilot#::set_namecxx . . $ pilot#set_name(85c52e162fed56f9).(const char *n) { |
| 618 | if (namecxx . . $ pilot#name.) { |
| 619 | mem_freecxx . . $ `mem/mem.h:80:9`!(name); |
| 620 | namecxx . . $ pilot#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 621 | } |
| 622 | if (n) { |
| 623 | int length = strlen(n); |
| 624 | int size = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(PILOT_STRING_SIZEcxx . . $ `Descent3/pilot_class.h:124:9`! - 1, length); |
| 625 | namecxx . . $ pilot#name. = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(size + 1); |
| 626 | if (namecxx . . $ pilot#name.) { |
| 627 | strncpy(namecxx . . $ pilot#name., n, size); |
| 628 | namecxx . . $ pilot#name.[size] = '\0'; |
| 629 | } |
| 630 | } |
| 631 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 632 | } |
| 633 | void pilotcxx . . $ pilot#::get_namecxx . . $ pilot#get_name(fda57c8427c60377).(char *n) { |
| 634 | if (n) { |
| 635 | if (namecxx . . $ pilot#name.) { |
| 636 | strcpy(n, namecxx . . $ pilot#name.); |
| 637 | } else { |
| 638 | *n = '\0'; |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | void pilotcxx . . $ pilot#::set_shipcxx . . $ pilot#set_ship(85c52e162fed56f9).(const char *ship) { |
| 644 | if (ship_modelcxx . . $ pilot#ship_model.) { |
| 645 | mem_freecxx . . $ `mem/mem.h:80:9`!(ship_model); |
| 646 | ship_modelcxx . . $ pilot#ship_model. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 647 | } |
| 648 | if (ship) { |
| 649 | int length = strlen(ship); |
| 650 | int size = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`! - 1, length); |
| 651 | ship_modelcxx . . $ pilot#ship_model. = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(size + 1); |
| 652 | if (ship_modelcxx . . $ pilot#ship_model.) { |
| 653 | strncpy(ship_modelcxx . . $ pilot#ship_model., ship, size); |
| 654 | ship_modelcxx . . $ pilot#ship_model.[size] = '\0'; |
| 655 | } |
| 656 | } |
| 657 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 658 | } |
| 659 | void pilotcxx . . $ pilot#::get_shipcxx . . $ pilot#get_ship(fda57c8427c60377).(char *ship) { |
| 660 | if (ship) { |
| 661 | if (ship_modelcxx . . $ pilot#ship_model.) { |
| 662 | strcpy(ship, ship_modelcxx . . $ pilot#ship_model.); |
| 663 | } else { |
| 664 | *ship = '\0'; |
| 665 | } |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | void pilotcxx . . $ pilot#::set_multiplayer_datacxx . . $ pilot#set_multiplayer_data(a7d02ca8b58088a9).(const char *logo, const char *audio1, const char *audio2, const uint16_tcxx . . $ uint16_t# *ppic, const char *audio3, const char *audio4) { |
| 670 | if (logo) { |
| 671 | if (ship_logocxx . . $ pilot#ship_logo.) { |
| 672 | mem_freecxx . . $ `mem/mem.h:80:9`!(ship_logo); |
| 673 | ship_logocxx . . $ pilot#ship_logo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 674 | } |
| 675 | ship_logocxx . . $ pilot#ship_logo. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(logo); |
| 676 | if (ship_logocxx . . $ pilot#ship_logo.) { |
| 677 | int len = strlen(ship_logocxx . . $ pilot#ship_logo.); |
| 678 | if (len >= PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!) { |
| 679 | ship_logocxx . . $ pilot#ship_logo.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`! - 1] = '\0'; |
| 680 | } |
| 681 | } |
| 682 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 683 | } |
| 684 | //////////// |
| 685 | if (audio1) { |
| 686 | if (audio1_filecxx . . $ pilot#audio1_file.) { |
| 687 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio1_file); |
| 688 | audio1_filecxx . . $ pilot#audio1_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 689 | } |
| 690 | audio1_filecxx . . $ pilot#audio1_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(audio1); |
| 691 | if (audio1_filecxx . . $ pilot#audio1_file.) { |
| 692 | int len = strlen(audio1_filecxx . . $ pilot#audio1_file.); |
| 693 | if (len >= PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!) { |
| 694 | audio1_filecxx . . $ pilot#audio1_file.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`! - 1] = '\0'; |
| 695 | } |
| 696 | } |
| 697 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 698 | } |
| 699 | //////////// |
| 700 | if (audio2) { |
| 701 | if (audio2_filecxx . . $ pilot#audio2_file.) { |
| 702 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio2_file); |
| 703 | audio2_filecxx . . $ pilot#audio2_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 704 | } |
| 705 | audio2_filecxx . . $ pilot#audio2_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(audio2); |
| 706 | if (audio2_filecxx . . $ pilot#audio2_file.) { |
| 707 | int len = strlen(audio2_filecxx . . $ pilot#audio2_file.); |
| 708 | if (len >= PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!) { |
| 709 | audio2_filecxx . . $ pilot#audio2_file.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`! - 1] = '\0'; |
| 710 | } |
| 711 | } |
| 712 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 713 | } |
| 714 | //////////// |
| 715 | if (ppic) { |
| 716 | picture_idcxx . . $ pilot#picture_id. = *ppic; |
| 717 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 718 | } |
| 719 | //////////// |
| 720 | if (audio3) { |
| 721 | if (audio3_filecxx . . $ pilot#audio3_file.) { |
| 722 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio3_file); |
| 723 | audio3_filecxx . . $ pilot#audio3_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 724 | } |
| 725 | audio3_filecxx . . $ pilot#audio3_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(audio3); |
| 726 | if (audio3_filecxx . . $ pilot#audio3_file.) { |
| 727 | int len = strlen(audio3_filecxx . . $ pilot#audio3_file.); |
| 728 | if (len >= PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!) { |
| 729 | audio3_filecxx . . $ pilot#audio3_file.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`! - 1] = '\0'; |
| 730 | } |
| 731 | } |
| 732 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 733 | } |
| 734 | //////////// |
| 735 | if (audio4) { |
| 736 | if (audio4_filecxx . . $ pilot#audio4_file.) { |
| 737 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio4_file); |
| 738 | audio4_filecxx . . $ pilot#audio4_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 739 | } |
| 740 | audio4_filecxx . . $ pilot#audio4_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(audio4); |
| 741 | if (audio4_filecxx . . $ pilot#audio4_file.) { |
| 742 | int len = strlen(audio4_filecxx . . $ pilot#audio4_file.); |
| 743 | if (len >= PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!) { |
| 744 | audio4_filecxx . . $ pilot#audio4_file.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`! - 1] = '\0'; |
| 745 | } |
| 746 | } |
| 747 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 748 | } |
| 749 | } |
| 750 | void pilotcxx . . $ pilot#::get_multiplayer_datacxx . . $ pilot#get_multiplayer_data(ea6e7aa10f4b80f5).(char *logo, char *audio1, char *audio2, uint16_tcxx . . $ uint16_t# *ppic, char *audio3, char *audio4) { |
| 751 | if (logo) { |
| 752 | if (ship_logocxx . . $ pilot#ship_logo.) { |
| 753 | strcpy(logo, ship_logocxx . . $ pilot#ship_logo.); |
| 754 | } else { |
| 755 | *logo = '\0'; |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | if (audio1) { |
| 760 | if (audio1_filecxx . . $ pilot#audio1_file.) { |
| 761 | strcpy(audio1, audio1_filecxx . . $ pilot#audio1_file.); |
| 762 | } else { |
| 763 | *audio1 = '\0'; |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | if (audio2) { |
| 768 | if (audio2_filecxx . . $ pilot#audio2_file.) { |
| 769 | strcpy(audio2, audio2_filecxx . . $ pilot#audio2_file.); |
| 770 | } else { |
| 771 | *audio2 = '\0'; |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | if (audio3) { |
| 776 | if (audio3_filecxx . . $ pilot#audio3_file.) { |
| 777 | strcpy(audio3, audio3_filecxx . . $ pilot#audio3_file.); |
| 778 | } else { |
| 779 | *audio3 = '\0'; |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | if (audio4) { |
| 784 | if (audio4_filecxx . . $ pilot#audio4_file.) { |
| 785 | strcpy(audio4, audio4_filecxx . . $ pilot#audio4_file.); |
| 786 | } else { |
| 787 | *audio4 = '\0'; |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | if (ppic) { |
| 792 | *ppic = picture_idcxx . . $ pilot#picture_id.; |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | void pilotcxx . . $ pilot#::set_difficultycxx . . $ pilot#set_difficulty(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# diff) { |
| 797 | difficultycxx . . $ pilot#difficulty. = diff; |
| 798 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 799 | } |
| 800 | void pilotcxx . . $ pilot#::get_difficultycxx . . $ pilot#get_difficulty(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *diff) { |
| 801 | if (diff) { |
| 802 | *diff = difficultycxx . . $ pilot#difficulty.; |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | void pilotcxx . . $ pilot#::set_profanity_filtercxx . . $ pilot#set_profanity_filter(b45ddcbc8423892c).(bool enable) { |
| 807 | profanity_filter_oncxx . . $ pilot#profanity_filter_on. = enable; |
| 808 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 809 | grtext_SetProfanityFiltercxx . . $ grtext_SetProfanityFilter(b45ddcbc8423892c).(enable); |
| 810 | } |
| 811 | |
| 812 | void pilotcxx . . $ pilot#::get_profanity_filtercxx . . $ pilot#get_profanity_filter(c13a04b6074e49a2).(bool *enabled) { |
| 813 | if (enabled) { |
| 814 | *enabled = profanity_filter_oncxx . . $ pilot#profanity_filter_on.; |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | void pilotcxx . . $ pilot#::set_audiotauntscxx . . $ pilot#set_audiotaunts(b45ddcbc8423892c).(bool enable) { |
| 819 | audiotauntscxx . . $ pilot#audiotaunts. = enable; |
| 820 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 821 | taunt_Enablecxx . . $ taunt_Enable(b45ddcbc8423892c).(enable); |
| 822 | } |
| 823 | |
| 824 | void pilotcxx . . $ pilot#::get_audiotauntscxx . . $ pilot#get_audiotaunts(c13a04b6074e49a2).(bool *enabled) { |
| 825 | if (enabled) { |
| 826 | *enabled = audiotauntscxx . . $ pilot#audiotaunts.; |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | void pilotcxx . . $ pilot#::set_guidebot_namecxx . . $ pilot#set_guidebot_name(fda57c8427c60377).(char *name) { |
| 831 | if (guidebot_namecxx . . $ pilot#guidebot_name.) { |
| 832 | mem_freecxx . . $ `mem/mem.h:80:9`!(guidebot_name); |
| 833 | guidebot_namecxx . . $ pilot#guidebot_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 834 | } |
| 835 | |
| 836 | if (name) { |
| 837 | guidebot_namecxx . . $ pilot#guidebot_name. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(name); |
| 838 | } else { |
| 839 | guidebot_namecxx . . $ pilot#guidebot_name. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("GB"); |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | void pilotcxx . . $ pilot#::get_guidebot_namecxx . . $ pilot#get_guidebot_name(fda57c8427c60377).(char *name) { |
| 844 | if (guidebot_namecxx . . $ pilot#guidebot_name.) { |
| 845 | strcpy(name, guidebot_namecxx . . $ pilot#guidebot_name.); |
| 846 | } else { |
| 847 | strcpy(name, "GB"); |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | void pilotcxx . . $ pilot#::set_hud_datacxx . . $ pilot#set_hud_data(c4a38c24677fe9fd).(uint8_tcxx . . $ uint8_t# *hmode, uint16_tcxx . . $ uint16_t# *hstat, uint16_tcxx . . $ uint16_t# *hgraphicalstat, int *gw_w, int *gw_h) { |
| 852 | if (hmode) { |
| 853 | // should do checking here |
| 854 | switch (*hmode) { |
| 855 | case HUD_COCKPITcxx . . $ HUD_COCKPIT.: |
| 856 | case HUD_FULLSCREENcxx . . $ HUD_FULLSCREEN.: |
| 857 | hud_modecxx . . $ pilot#hud_mode. = *hmode; |
| 858 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 859 | break; |
| 860 | default: |
| 861 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "PILOT: Trying to set hode mode to invalid mode (%d)\n", *hmode); |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | if (hstat) { |
| 866 | hud_statcxx . . $ pilot#hud_stat. = *hstat; |
| 867 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 868 | } |
| 869 | |
| 870 | if (hgraphicalstat) { |
| 871 | hud_graphical_statcxx . . $ pilot#hud_graphical_stat. = *hgraphicalstat; |
| 872 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 873 | } |
| 874 | |
| 875 | if (gw_w) { |
| 876 | game_window_wcxx . . $ pilot#game_window_w. = *gw_w; |
| 877 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 878 | } |
| 879 | |
| 880 | if (gw_h) { |
| 881 | game_window_hcxx . . $ pilot#game_window_h. = *gw_h; |
| 882 | write_pendingcxx . . $ pilot#write_pending. = true; |
| 883 | } |
| 884 | } |
| 885 | void pilotcxx . . $ pilot#::get_hud_datacxx . . $ pilot#get_hud_data(c4a38c24677fe9fd).(uint8_tcxx . . $ uint8_t# *hmode, uint16_tcxx . . $ uint16_t# *hstat, uint16_tcxx . . $ uint16_t# *hgraphicalstat, int *gw_w, int *gw_h) { |
| 886 | if (hmode) { |
| 887 | *hmode = hud_modecxx . . $ pilot#hud_mode.; |
| 888 | } |
| 889 | |
| 890 | if (hstat) { |
| 891 | *hstat = hud_statcxx . . $ pilot#hud_stat.; |
| 892 | } |
| 893 | |
| 894 | if (hgraphicalstat) { |
| 895 | *hgraphicalstat = hud_graphical_statcxx . . $ pilot#hud_graphical_stat.; |
| 896 | } |
| 897 | |
| 898 | if (gw_w) { |
| 899 | *gw_w = game_window_wcxx . . $ pilot#game_window_w.; |
| 900 | } |
| 901 | |
| 902 | if (gw_h) { |
| 903 | *gw_h = game_window_hcxx . . $ pilot#game_window_h.; |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | void pilotcxx . . $ pilot#::add_mission_datacxx . . $ pilot#add_mission_data(df89f5652ec534f0).(tMissionDatacxx . . $ tMissionData# *mdata) { |
| 908 | if (!mdata) { |
| 909 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 910 | return; |
| 911 | } |
| 912 | |
| 913 | if (find_mission_datacxx . . $ pilot#find_mission_data(5c4306d8553b3696).(mdata->mission_namecxx . . $ tMissionData#mission_name.) != -1) { |
| 914 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 915 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Mission already exists\n"); |
| 916 | return; |
| 917 | } |
| 918 | |
| 919 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Adding new mission data for (%s)\n", mdata->mission_name); |
| 920 | |
| 921 | tMissionDatacxx . . $ tMissionData# *new_data = (tMissionDatacxx . . $ tMissionData# *)mem_malloccxx . . $ `mem/mem.h:79:9`!((num_missions_flown + 1) * sizeof(tMissionData)); |
| 922 | if (!new_data) { |
| 923 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Out of memory\n"); |
| 924 | return; |
| 925 | } |
| 926 | |
| 927 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(num_missions_flown >= 0); |
| 928 | |
| 929 | if (mission_datacxx . . $ pilot#mission_data. && num_missions_flowncxx . . $ pilot#num_missions_flown. > 0) { |
| 930 | memcpy(new_data, mission_datacxx . . $ pilot#mission_data., sizeof(tMissionDatacxx . . $ tMissionData#) * num_missions_flowncxx . . $ pilot#num_missions_flown.); |
| 931 | mem_freecxx . . $ `mem/mem.h:80:9`!(mission_data); |
| 932 | } |
| 933 | |
| 934 | mission_datacxx . . $ pilot#mission_data. = new_data; |
| 935 | |
| 936 | memcpy(&mission_datacxx . . $ pilot#mission_data.[num_missions_flowncxx . . $ pilot#num_missions_flown.], mdata, sizeof(tMissionDatacxx . . $ tMissionData#)); |
| 937 | |
| 938 | num_missions_flowncxx . . $ pilot#num_missions_flown.++; |
| 939 | } |
| 940 | void pilotcxx . . $ pilot#::edit_mission_datacxx . . $ pilot#edit_mission_data(db29c71e02b5942a).(int index, tMissionDatacxx . . $ tMissionData# *mdata) { |
| 941 | if (index < 0 || index >= num_missions_flowncxx . . $ pilot#num_missions_flown.) { |
| 942 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Invalid mission index\n"); |
| 943 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 944 | return; |
| 945 | } |
| 946 | |
| 947 | if (!mission_datacxx . . $ pilot#mission_data.) { |
| 948 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 949 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "No mission data\n"); |
| 950 | return; |
| 951 | } |
| 952 | |
| 953 | if (!mdata) { |
| 954 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 955 | return; |
| 956 | } |
| 957 | |
| 958 | memcpy(&mission_datacxx . . $ pilot#mission_data.[index], mdata, sizeof(tMissionDatacxx . . $ tMissionData#)); |
| 959 | } |
| 960 | |
| 961 | void pilotcxx . . $ pilot#::get_mission_datacxx . . $ pilot#get_mission_data(db29c71e02b5942a).(int index, tMissionDatacxx . . $ tMissionData# *mdata) { |
| 962 | if (index < 0 || index >= num_missions_flowncxx . . $ pilot#num_missions_flown.) { |
| 963 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Invalid mission index\n"); |
| 964 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 965 | return; |
| 966 | } |
| 967 | |
| 968 | if (!mission_datacxx . . $ pilot#mission_data.) { |
| 969 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 970 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "No mission data\n"); |
| 971 | return; |
| 972 | } |
| 973 | |
| 974 | if (!mdata) { |
| 975 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 976 | return; |
| 977 | } |
| 978 | |
| 979 | memcpy(mdata, &mission_datacxx . . $ pilot#mission_data.[index], sizeof(tMissionDatacxx . . $ tMissionData#)); |
| 980 | } |
| 981 | |
| 982 | int pilotcxx . . $ pilot#::find_mission_datacxx . . $ pilot#find_mission_data(5c4306d8553b3696).(const char *mission_name) { |
| 983 | if (num_missions_flowncxx . . $ pilot#num_missions_flown. <= 0) { |
| 984 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(num_missions_flown == 0); |
| 985 | return -1; |
| 986 | } |
| 987 | |
| 988 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(mission_data); |
| 989 | if (!mission_datacxx . . $ pilot#mission_data.) |
| 990 | return -1; |
| 991 | |
| 992 | for (int i = 0; i < num_missions_flowncxx . . $ pilot#num_missions_flown.; i++) { |
| 993 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(mission_data[i].mission_name, mission_name)) { |
| 994 | return i; |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | return -1; |
| 999 | } |
| 1000 | |
| 1001 | // internal file access functions |
| 1002 | // for the read functions, skip is true if the data should actually |
| 1003 | // just be skipped and not processed |
| 1004 | |
| 1005 | void pilotcxx . . $ pilot#::write_namecxx . . $ pilot#write_name(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1006 | if (!namecxx . . $ pilot#name.) { |
| 1007 | // write out a dummy name |
| 1008 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, "No Name"); |
| 1009 | return; |
| 1010 | } |
| 1011 | |
| 1012 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, namecxx . . $ pilot#name.); |
| 1013 | } |
| 1014 | |
| 1015 | void pilotcxx . . $ pilot#::read_namecxx . . $ pilot#read_name(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1016 | char buffer[PILOT_STRING_SIZEcxx . . $ `Descent3/pilot_class.h:124:9`!]; |
| 1017 | |
| 1018 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PILOT_STRING_SIZEcxx . . $ `Descent3/pilot_class.h:124:9`!, file); |
| 1019 | |
| 1020 | if (!skip) { |
| 1021 | if (namecxx . . $ pilot#name.) { |
| 1022 | mem_freecxx . . $ `mem/mem.h:80:9`!(name); |
| 1023 | namecxx . . $ pilot#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1024 | } |
| 1025 | namecxx . . $ pilot#name. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | void pilotcxx . . $ pilot#::write_ship_infocxx . . $ pilot#write_ship_info(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1030 | if (ship_modelcxx . . $ pilot#ship_model.) { |
| 1031 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ship_modelcxx . . $ pilot#ship_model.); |
| 1032 | } else { |
| 1033 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, DEFAULT_SHIPcxx . . $ `Descent3/ship.h:127:9`!); |
| 1034 | } |
| 1035 | } |
| 1036 | |
| 1037 | void pilotcxx . . $ pilot#::read_ship_infocxx . . $ pilot#read_ship_info(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1038 | char buffer[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; |
| 1039 | |
| 1040 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, file); |
| 1041 | |
| 1042 | if (!skip) { |
| 1043 | if (ship_modelcxx . . $ pilot#ship_model.) { |
| 1044 | mem_freecxx . . $ `mem/mem.h:80:9`!(ship_model); |
| 1045 | ship_modelcxx . . $ pilot#ship_model. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1046 | } |
| 1047 | ship_modelcxx . . $ pilot#ship_model. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1048 | } |
| 1049 | } |
| 1050 | |
| 1051 | void pilotcxx . . $ pilot#::write_custom_multiplayer_datacxx . . $ pilot#write_custom_multiplayer_data(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1052 | if (ship_logocxx . . $ pilot#ship_logo.) { |
| 1053 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ship_logocxx . . $ pilot#ship_logo.); |
| 1054 | } else { |
| 1055 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ""); |
| 1056 | } |
| 1057 | |
| 1058 | if (audio1_filecxx . . $ pilot#audio1_file.) { |
| 1059 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, audio1_filecxx . . $ pilot#audio1_file.); |
| 1060 | } else { |
| 1061 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ""); |
| 1062 | } |
| 1063 | |
| 1064 | if (audio2_filecxx . . $ pilot#audio2_file.) { |
| 1065 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, audio2_filecxx . . $ pilot#audio2_file.); |
| 1066 | } else { |
| 1067 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ""); |
| 1068 | } |
| 1069 | |
| 1070 | if (audio3_filecxx . . $ pilot#audio3_file.) { |
| 1071 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, audio3_filecxx . . $ pilot#audio3_file.); |
| 1072 | } else { |
| 1073 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ""); |
| 1074 | } |
| 1075 | |
| 1076 | if (audio4_filecxx . . $ pilot#audio4_file.) { |
| 1077 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, audio4_filecxx . . $ pilot#audio4_file.); |
| 1078 | } else { |
| 1079 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, ""); |
| 1080 | } |
| 1081 | |
| 1082 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, picture_idcxx . . $ pilot#picture_id.); |
| 1083 | } |
| 1084 | |
| 1085 | void pilotcxx . . $ pilot#::read_custom_multiplayer_datacxx . . $ pilot#read_custom_multiplayer_data(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1086 | char buffer[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; |
| 1087 | uint16_tcxx . . $ uint16_t# temp; |
| 1088 | |
| 1089 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, file); |
| 1090 | if (!skip) { |
| 1091 | if (ship_logocxx . . $ pilot#ship_logo.) { |
| 1092 | mem_freecxx . . $ `mem/mem.h:80:9`!(ship_logo); |
| 1093 | ship_logocxx . . $ pilot#ship_logo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1094 | } |
| 1095 | ship_logocxx . . $ pilot#ship_logo. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1096 | } |
| 1097 | |
| 1098 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, file); |
| 1099 | if (!skip) { |
| 1100 | if (audio1_filecxx . . $ pilot#audio1_file.) { |
| 1101 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio1_file); |
| 1102 | audio1_filecxx . . $ pilot#audio1_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1103 | } |
| 1104 | audio1_filecxx . . $ pilot#audio1_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1105 | } |
| 1106 | |
| 1107 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, file); |
| 1108 | if (!skip) { |
| 1109 | if (audio2_filecxx . . $ pilot#audio2_file.) { |
| 1110 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio2_file); |
| 1111 | audio2_filecxx . . $ pilot#audio2_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1112 | } |
| 1113 | audio2_filecxx . . $ pilot#audio2_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1114 | } |
| 1115 | |
| 1116 | if (file_versioncxx . . $ pilot#file_version. >= PFV_AUDIOTAUNT3N4cxx . . $ `Descent3/pilot_class.cpp:171:9`!) { |
| 1117 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, file); |
| 1118 | if (!skip) { |
| 1119 | if (audio3_filecxx . . $ pilot#audio3_file.) { |
| 1120 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio3_file); |
| 1121 | audio3_filecxx . . $ pilot#audio3_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1122 | } |
| 1123 | audio3_filecxx . . $ pilot#audio3_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1124 | } |
| 1125 | |
| 1126 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!, file); |
| 1127 | if (!skip) { |
| 1128 | if (audio4_filecxx . . $ pilot#audio4_file.) { |
| 1129 | mem_freecxx . . $ `mem/mem.h:80:9`!(audio4_file); |
| 1130 | audio4_filecxx . . $ pilot#audio4_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1131 | } |
| 1132 | audio4_filecxx . . $ pilot#audio4_file. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | temp = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1137 | if (!skip) { |
| 1138 | picture_idcxx . . $ pilot#picture_id. = temp; |
| 1139 | } |
| 1140 | } |
| 1141 | |
| 1142 | void pilotcxx . . $ pilot#::write_difficultycxx . . $ pilot#write_difficulty(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, difficultycxx . . $ pilot#difficulty.); } |
| 1143 | |
| 1144 | void pilotcxx . . $ pilot#::read_difficultycxx . . $ pilot#read_difficulty(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1145 | uint8_tcxx . . $ uint8_t# temp; |
| 1146 | |
| 1147 | temp = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1148 | if (!skip) { |
| 1149 | difficultycxx . . $ pilot#difficulty. = temp; |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | void pilotcxx . . $ pilot#::write_profanity_filtercxx . . $ pilot#write_profanity_filter(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (profanity_filter_oncxx . . $ pilot#profanity_filter_on.) ? 1 : 0); } |
| 1154 | |
| 1155 | void pilotcxx . . $ pilot#::read_profanity_filtercxx . . $ pilot#read_profanity_filter(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1156 | bool temp; |
| 1157 | |
| 1158 | temp = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file) ? true : false; |
| 1159 | if (!skip) { |
| 1160 | profanity_filter_oncxx . . $ pilot#profanity_filter_on. = temp; |
| 1161 | grtext_SetProfanityFiltercxx . . $ grtext_SetProfanityFilter(b45ddcbc8423892c).(profanity_filter_oncxx . . $ pilot#profanity_filter_on.); |
| 1162 | } |
| 1163 | } |
| 1164 | |
| 1165 | void pilotcxx . . $ pilot#::write_audiotauntscxx . . $ pilot#write_audiotaunts(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (audiotauntscxx . . $ pilot#audiotaunts.) ? 1 : 0); } |
| 1166 | |
| 1167 | void pilotcxx . . $ pilot#::read_audiotauntscxx . . $ pilot#read_audiotaunts(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1168 | bool temp; |
| 1169 | |
| 1170 | temp = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file) ? true : false; |
| 1171 | if (!skip) { |
| 1172 | audiotauntscxx . . $ pilot#audiotaunts. = temp; |
| 1173 | taunt_Enablecxx . . $ taunt_Enable(b45ddcbc8423892c).(audiotauntscxx . . $ pilot#audiotaunts.); |
| 1174 | } |
| 1175 | } |
| 1176 | |
| 1177 | void pilotcxx . . $ pilot#::write_guidebot_namecxx . . $ pilot#write_guidebot_name(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1178 | if (guidebot_namecxx . . $ pilot#guidebot_name.) { |
| 1179 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, 1); |
| 1180 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, guidebot_namecxx . . $ pilot#guidebot_name.); |
| 1181 | } else { |
| 1182 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, 0); |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | void pilotcxx . . $ pilot#::read_guidebot_namecxx . . $ pilot#read_guidebot_name(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1187 | if (guidebot_namecxx . . $ pilot#guidebot_name.) { |
| 1188 | mem_freecxx . . $ `mem/mem.h:80:9`!(guidebot_name); |
| 1189 | guidebot_namecxx . . $ pilot#guidebot_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1190 | } |
| 1191 | |
| 1192 | int len = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1193 | char buffer[256]; |
| 1194 | |
| 1195 | if (len) { |
| 1196 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, 256, file); |
| 1197 | guidebot_namecxx . . $ pilot#guidebot_name. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(buffer); |
| 1198 | } else { |
| 1199 | guidebot_namecxx . . $ pilot#guidebot_name. = mem_strdupcxx . . $ `mem/mem.h:81:9`!("GB"); |
| 1200 | } |
| 1201 | } |
| 1202 | |
| 1203 | void pilotcxx . . $ pilot#::write_hud_datacxx . . $ pilot#write_hud_data(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1204 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, hud_modecxx . . $ pilot#hud_mode.); |
| 1205 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, hud_statcxx . . $ pilot#hud_stat.); |
| 1206 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, hud_graphical_statcxx . . $ pilot#hud_graphical_stat.); |
| 1207 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, game_window_wcxx . . $ pilot#game_window_w.); |
| 1208 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, game_window_hcxx . . $ pilot#game_window_h.); |
| 1209 | |
| 1210 | // PFV_REARVIEWINFO |
| 1211 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)lrearview_enabledcxx . . $ pilot#lrearview_enabled.); |
| 1212 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)rrearview_enabledcxx . . $ pilot#rrearview_enabled.); |
| 1213 | } |
| 1214 | |
| 1215 | void pilotcxx . . $ pilot#::read_hud_datacxx . . $ pilot#read_hud_data(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1216 | uint8_tcxx . . $ uint8_t# temp_b; |
| 1217 | uint16_tcxx . . $ uint16_t# temp_s; |
| 1218 | int temp_i; |
| 1219 | |
| 1220 | temp_b = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1221 | if (!skip) { |
| 1222 | hud_modecxx . . $ pilot#hud_mode. = temp_b; |
| 1223 | } |
| 1224 | |
| 1225 | temp_s = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1226 | if (!skip) { |
| 1227 | hud_statcxx . . $ pilot#hud_stat. = temp_s; |
| 1228 | } |
| 1229 | |
| 1230 | temp_s = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1231 | if (!skip) { |
| 1232 | hud_graphical_statcxx . . $ pilot#hud_graphical_stat. = temp_s; |
| 1233 | } |
| 1234 | |
| 1235 | temp_i = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1236 | if (!skip) { |
| 1237 | game_window_wcxx . . $ pilot#game_window_w. = temp_i; |
| 1238 | } |
| 1239 | |
| 1240 | temp_i = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1241 | if (!skip) { |
| 1242 | game_window_hcxx . . $ pilot#game_window_h. = temp_i; |
| 1243 | } |
| 1244 | |
| 1245 | // kill graphical stat for inventory and reset to text version |
| 1246 | if (!skip) { |
| 1247 | if (hud_graphical_statcxx . . $ pilot#hud_graphical_stat. & STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`!) { |
| 1248 | hud_graphical_statcxx . . $ pilot#hud_graphical_stat. = hud_graphical_statcxx . . $ pilot#hud_graphical_stat. & (~STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`!); |
| 1249 | hud_statcxx . . $ pilot#hud_stat. = hud_statcxx . . $ pilot#hud_stat. | STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`!; |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | // read smallview state |
| 1254 | if (file_versioncxx . . $ pilot#file_version. >= PFV_REARVIEWINFOcxx . . $ `Descent3/pilot_class.cpp:163:9`!) { |
| 1255 | lrearview_enabledcxx . . $ pilot#lrearview_enabled. = (bool)(cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file) != 0); |
| 1256 | rrearview_enabledcxx . . $ pilot#rrearview_enabled. = (bool)(cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file) != 0); |
| 1257 | } else { |
| 1258 | lrearview_enabledcxx . . $ pilot#lrearview_enabled. = false; |
| 1259 | rrearview_enabledcxx . . $ pilot#rrearview_enabled. = false; |
| 1260 | } |
| 1261 | } |
| 1262 | |
| 1263 | void pilotcxx . . $ pilot#::write_mission_datacxx . . $ pilot#write_mission_data(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1264 | int i; |
| 1265 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, num_missions_flowncxx . . $ pilot#num_missions_flown.); |
| 1266 | |
| 1267 | for (i = 0; i < num_missions_flowncxx . . $ pilot#num_missions_flown.; i++) { |
| 1268 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, mission_datacxx . . $ pilot#mission_data.[i].highest_levelcxx . . $ tMissionData#highest_level.); |
| 1269 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, mission_datacxx . . $ pilot#mission_data.[i].finishedcxx . . $ tMissionData#finished.); |
| 1270 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, mission_datacxx . . $ pilot#mission_data.[i].mission_namecxx . . $ tMissionData#mission_name.); |
| 1271 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, mission_datacxx . . $ pilot#mission_data.[i].num_restorescxx . . $ tMissionData#num_restores.); |
| 1272 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, mission_datacxx . . $ pilot#mission_data.[i].num_savescxx . . $ tMissionData#num_saves.); |
| 1273 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, mission_datacxx . . $ pilot#mission_data.[i].ship_permissionscxx . . $ tMissionData#ship_permissions.); |
| 1274 | } |
| 1275 | } |
| 1276 | |
| 1277 | void pilotcxx . . $ pilot#::read_mission_datacxx . . $ pilot#read_mission_data(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1278 | int temp_i, i, temp_perm; |
| 1279 | uint8_tcxx . . $ uint8_t# temp_b1, temp_b2; |
| 1280 | int temp_restores = 0, temp_saves = 0; |
| 1281 | char temp_s[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; |
| 1282 | |
| 1283 | skip = false; // hard code it so we always read this |
| 1284 | |
| 1285 | temp_i = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1286 | if (!skip) { |
| 1287 | num_missions_flowncxx . . $ pilot#num_missions_flown. = temp_i; |
| 1288 | } |
| 1289 | |
| 1290 | if (temp_i <= 0) { |
| 1291 | // no more data to read |
| 1292 | return; |
| 1293 | } |
| 1294 | |
| 1295 | if (!skip) { |
| 1296 | // allocate needed memory |
| 1297 | if (mission_datacxx . . $ pilot#mission_data.) { |
| 1298 | mem_freecxx . . $ `mem/mem.h:80:9`!(mission_data); |
| 1299 | mission_datacxx . . $ pilot#mission_data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1300 | } |
| 1301 | mission_datacxx . . $ pilot#mission_data. = (tMissionDatacxx . . $ tMissionData# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(tMissionData) * num_missions_flown); |
| 1302 | if (!mission_datacxx . . $ pilot#mission_data.) { |
| 1303 | // out of memory |
| 1304 | num_missions_flowncxx . . $ pilot#num_missions_flown. = 0; |
| 1305 | skip = true; |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | for (i = 0; i < temp_i; i++) { |
| 1310 | temp_b1 = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1311 | temp_b2 = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1312 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(temp_s, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!, file); |
| 1313 | |
| 1314 | if (file_versioncxx . . $ pilot#file_version. >= PFV_AUDIOTAUNT3N4cxx . . $ `Descent3/pilot_class.cpp:171:9`!) { |
| 1315 | temp_restores = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1316 | temp_saves = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1317 | } else { |
| 1318 | temp_restores = temp_saves = 0; |
| 1319 | } |
| 1320 | |
| 1321 | if (file_versioncxx . . $ pilot#file_version. >= PFV_SHIPPERMISSIONScxx . . $ `Descent3/pilot_class.cpp:164:9`!) { |
| 1322 | temp_perm = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1323 | } else { |
| 1324 | temp_perm = Default_ship_permissioncxx . . $ Default_ship_permission.; |
| 1325 | } |
| 1326 | |
| 1327 | if (!skip) { |
| 1328 | mission_datacxx . . $ pilot#mission_data.[i].highest_levelcxx . . $ tMissionData#highest_level. = temp_b1; |
| 1329 | mission_datacxx . . $ pilot#mission_data.[i].ship_permissionscxx . . $ tMissionData#ship_permissions. = temp_perm; |
| 1330 | mission_datacxx . . $ pilot#mission_data.[i].finishedcxx . . $ tMissionData#finished. = (temp_b2) ? true : false; |
| 1331 | mission_datacxx . . $ pilot#mission_data.[i].num_restorescxx . . $ tMissionData#num_restores. = temp_restores; |
| 1332 | mission_datacxx . . $ pilot#mission_data.[i].num_savescxx . . $ tMissionData#num_saves. = temp_saves; |
| 1333 | strcpy(mission_datacxx . . $ pilot#mission_data.[i].mission_namecxx . . $ tMissionData#mission_name., temp_s); |
| 1334 | } |
| 1335 | } |
| 1336 | } |
| 1337 | |
| 1338 | void pilotcxx . . $ pilot#::write_tauntscxx . . $ pilot#write_taunts(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1339 | int i; |
| 1340 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, MAX_PILOT_TAUNTScxx . . $ `Descent3/pilot_class.h:132:9`!); |
| 1341 | |
| 1342 | for (i = 0; i < MAX_PILOT_TAUNTScxx . . $ `Descent3/pilot_class.h:132:9`!; i++) { |
| 1343 | cf_WriteStringcxx . . $ cf_WriteString(643e1411966bd56c).(file, tauntscxx . . $ pilot#taunts.[i]); |
| 1344 | } |
| 1345 | } |
| 1346 | |
| 1347 | void pilotcxx . . $ pilot#::read_tauntscxx . . $ pilot#read_taunts(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1348 | int i; |
| 1349 | int num_taunts_in_file = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1350 | |
| 1351 | if (!skip) { |
| 1352 | for (i = 0; i < num_taunts_in_file; i++) { |
| 1353 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(tauntscxx . . $ pilot#taunts.[i], PILOT_TAUNT_SIZEcxx . . $ `Descent3/pilot_class.h:134:9`!, file); |
| 1354 | } |
| 1355 | |
| 1356 | // blank any remaining taunts |
| 1357 | for (; i < MAX_PILOT_TAUNTScxx . . $ `Descent3/pilot_class.h:132:9`!; i++) { |
| 1358 | tauntscxx . . $ pilot#taunts.[i][0] = '\0'; |
| 1359 | } |
| 1360 | |
| 1361 | } else { |
| 1362 | char buffer[PILOT_TAUNT_SIZEcxx . . $ `Descent3/pilot_class.h:134:9`!]; |
| 1363 | for (i = 0; i < num_taunts_in_file; i++) { |
| 1364 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(buffer, PILOT_TAUNT_SIZEcxx . . $ `Descent3/pilot_class.h:134:9`!, file); |
| 1365 | } |
| 1366 | } |
| 1367 | } |
| 1368 | |
| 1369 | void pilotcxx . . $ pilot#::write_controlscxx . . $ pilot#write_controls(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1370 | int i; |
| 1371 | |
| 1372 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, read_controllercxx . . $ pilot#read_controller.); |
| 1373 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.); |
| 1374 | |
| 1375 | for (i = 0; i < NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.; i++) { |
| 1376 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, (int)controlscxx . . $ pilot#controls.[i].idcxx . . $ cntrldata#id.); |
| 1377 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, (int)controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type.[0]); |
| 1378 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, (int)controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type.[1]); |
| 1379 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(file, (int)controlscxx . . $ pilot#controls.[i].valuecxx . . $ cntrldata#value.); |
| 1380 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.[0]); |
| 1381 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.[1]); |
| 1382 | } |
| 1383 | |
| 1384 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, N_MOUSE_AXIScxx . . $ `Descent3/pilot_class.h:128:9`!); |
| 1385 | for (i = 0; i < N_MOUSE_AXIScxx . . $ `Descent3/pilot_class.h:128:9`!; i++) { |
| 1386 | cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(file, mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[i]); |
| 1387 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "pilot mousesens[%d]=%f\n", i, mouse_sensitivity[i]); |
| 1388 | } |
| 1389 | |
| 1390 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, N_JOY_AXIScxx . . $ `Descent3/pilot_class.h:129:9`!); |
| 1391 | for (i = 0; i < N_JOY_AXIScxx . . $ `Descent3/pilot_class.h:129:9`!; i++) { |
| 1392 | cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(file, joy_sensitivitycxx . . $ pilot#joy_sensitivity.[i]); |
| 1393 | } |
| 1394 | cf_WriteFloatcxx . . $ cf_WriteFloat(c51c6cf5f6d5270c).(file, key_rampingcxx . . $ pilot#key_ramping.); // 0x29- keyramping |
| 1395 | |
| 1396 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (mouselook_controlcxx . . $ pilot#mouselook_control. ? 1 : 0)); // version 0x25 - mouselook |
| 1397 | } |
| 1398 | |
| 1399 | void pilotcxx . . $ pilot#::read_controlscxx . . $ pilot#read_controls(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1400 | float temp_f; |
| 1401 | uint8_tcxx . . $ uint8_t# temp_b; |
| 1402 | int i; |
| 1403 | |
| 1404 | // Controller data |
| 1405 | temp_b = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1406 | |
| 1407 | // alway read this? |
| 1408 | read_controllercxx . . $ pilot#read_controller. = temp_b; |
| 1409 | |
| 1410 | temp_b = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1411 | |
| 1412 | for (i = 0; i < temp_b; i++) { |
| 1413 | int id, y; |
| 1414 | ct_typecxx . . $ ct_type# type[2]; |
| 1415 | ct_config_datacxx . . $ ct_config_data# value; |
| 1416 | |
| 1417 | id = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1418 | type[0] = (ct_typecxx . . $ ct_type#)cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1419 | type[1] = (ct_typecxx . . $ ct_type#)cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1420 | value = (ct_config_datacxx . . $ ct_config_data#)cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(file); |
| 1421 | |
| 1422 | for (y = 0; y < temp_b; y++) { |
| 1423 | if (Controller_needscxx . . $ Controller_needs.[y].idcxx . . $ ct_function#id. == id) { |
| 1424 | if (type[0] == ctNonecxx . . $ ctNone.) // do this if there are new functions that don't have ctNone. |
| 1425 | type[0] = Controller_needscxx . . $ Controller_needs.[y].ctypecxx . . $ ct_function#ctype.[0]; |
| 1426 | if (type[1] == ctNonecxx . . $ ctNone.) // do this if there are new functions that don't have ctNone. |
| 1427 | type[1] = Controller_needscxx . . $ Controller_needs.[y].ctypecxx . . $ ct_function#ctype.[1]; |
| 1428 | break; |
| 1429 | } |
| 1430 | } |
| 1431 | |
| 1432 | controlscxx . . $ pilot#controls.[y].idcxx . . $ cntrldata#id. = id; |
| 1433 | controlscxx . . $ pilot#controls.[y].typecxx . . $ cntrldata#type.[0] = type[0]; |
| 1434 | controlscxx . . $ pilot#controls.[y].typecxx . . $ cntrldata#type.[1] = type[1]; |
| 1435 | controlscxx . . $ pilot#controls.[y].valuecxx . . $ cntrldata#value. = value; |
| 1436 | controlscxx . . $ pilot#controls.[y].flagscxx . . $ cntrldata#flags.[0] = (uint8_tcxx . . $ uint8_t#)cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1437 | controlscxx . . $ pilot#controls.[y].flagscxx . . $ cntrldata#flags.[1] = (uint8_tcxx . . $ uint8_t#)cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1438 | |
| 1439 | if (!skip) |
| 1440 | Controllercxx . . $ Controller.->set_controller_functioncxx . . $ gameController#set_controller_function(a87bf4975f40b925).(controlscxx . . $ pilot#controls.[y].idcxx . . $ cntrldata#id., controlscxx . . $ pilot#controls.[y].typecxx . . $ cntrldata#type., controlscxx . . $ pilot#controls.[y].valuecxx . . $ cntrldata#value., controlscxx . . $ pilot#controls.[y].flagscxx . . $ cntrldata#flags.); |
| 1441 | } |
| 1442 | |
| 1443 | // fill in remainder of pilot controls array. |
| 1444 | for (; i < NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.; i++) { |
| 1445 | Controllercxx . . $ Controller.->get_controller_functioncxx . . $ gameController#get_controller_function(c004c324aa6068e0).(Controller_needscxx . . $ Controller_needs.[i].idcxx . . $ ct_function#id., controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type., &controlscxx . . $ pilot#controls.[i].valuecxx . . $ cntrldata#value., |
| 1446 | controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.); |
| 1447 | } |
| 1448 | |
| 1449 | // Set controller enabled masks |
| 1450 | if (!skip && Controllercxx . . $ Controller.) { |
| 1451 | Controllercxx . . $ Controller.->mask_controllerscxx . . $ gameController#mask_controllers(b0b38cda41d4ede4).((read_controllercxx . . $ pilot#read_controller. & READF_JOYcxx . . $ `Descent3/controls.h:178:9`!) ? true : false, |
| 1452 | (read_controllercxx . . $ pilot#read_controller. & READF_MOUSEcxx . . $ `Descent3/controls.h:177:9`!) ? true : false); |
| 1453 | } |
| 1454 | |
| 1455 | // mouse sensitivity |
| 1456 | temp_b = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1457 | for (i = 0; i < temp_b; i++) { |
| 1458 | temp_f = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(file); |
| 1459 | mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[i] = temp_f; |
| 1460 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "pilot mousesens[%d]=%f\n", i, mouse_sensitivity[i]); |
| 1461 | } |
| 1462 | for (; i < N_MOUSE_AXIScxx . . $ `Descent3/pilot_class.h:128:9`!; i++) { |
| 1463 | mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[i] = 1.0f; |
| 1464 | } |
| 1465 | |
| 1466 | // joystick sensitivity |
| 1467 | temp_b = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1468 | for (i = 0; i < temp_b; i++) { |
| 1469 | temp_f = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(file); |
| 1470 | joy_sensitivitycxx . . $ pilot#joy_sensitivity.[i] = temp_f; |
| 1471 | } |
| 1472 | for (; i < N_JOY_AXIScxx . . $ `Descent3/pilot_class.h:129:9`!; i++) { |
| 1473 | joy_sensitivitycxx . . $ pilot#joy_sensitivity.[i] = 1.0f; |
| 1474 | } |
| 1475 | |
| 1476 | if (file_versioncxx . . $ pilot#file_version. >= PFV_KEYRAMPINGcxx . . $ `Descent3/pilot_class.cpp:165:9`!) { |
| 1477 | temp_f = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(file); |
| 1478 | key_rampingcxx . . $ pilot#key_ramping. = temp_f; |
| 1479 | } |
| 1480 | if (file_versioncxx . . $ pilot#file_version. >= PFV_MOUSELOOKcxx . . $ `Descent3/pilot_class.cpp:168:9`!) { |
| 1481 | temp_b = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1482 | mouselook_controlcxx . . $ pilot#mouselook_control. = temp_b ? true : false; |
| 1483 | } |
| 1484 | } |
| 1485 | |
| 1486 | void pilotcxx . . $ pilot#::write_weapon_selectcxx . . $ pilot#write_weapon_select(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1487 | int i; |
| 1488 | |
| 1489 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, MAX_PRIMARY_WEAPONScxx . . $ `Descent3/weapon.h:202:9`!); |
| 1490 | for (i = 0; i < MAX_PRIMARY_WEAPONScxx . . $ `Descent3/weapon.h:202:9`!; i++) { |
| 1491 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, PrimarySelectListcxx . . $ pilot#PrimarySelectList.[i]); |
| 1492 | } |
| 1493 | |
| 1494 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, MAX_SECONDARY_WEAPONScxx . . $ `Descent3/weapon.h:203:9`!); |
| 1495 | for (i = 0; i < MAX_SECONDARY_WEAPONScxx . . $ `Descent3/weapon.h:203:9`!; i++) { |
| 1496 | cf_WriteShortcxx . . $ cf_WriteShort(d7cf1a05aca96fe5).(file, SecondarySelectListcxx . . $ pilot#SecondarySelectList.[i]); |
| 1497 | } |
| 1498 | } |
| 1499 | |
| 1500 | void pilotcxx . . $ pilot#::read_weapon_selectcxx . . $ pilot#read_weapon_select(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1501 | int i; |
| 1502 | int count; |
| 1503 | |
| 1504 | count = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1505 | for (i = 0; i < count; i++) { |
| 1506 | PrimarySelectListcxx . . $ pilot#PrimarySelectList.[i] = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1507 | } |
| 1508 | for (; i < MAX_PRIMARY_WEAPONScxx . . $ `Descent3/weapon.h:202:9`!; i++) { |
| 1509 | // PrimarySelectList[i] = 0; |
| 1510 | } |
| 1511 | |
| 1512 | count = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1513 | for (i = 0; i < count; i++) { |
| 1514 | SecondarySelectListcxx . . $ pilot#SecondarySelectList.[i] = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(file); |
| 1515 | } |
| 1516 | for (; i < MAX_SECONDARY_WEAPONScxx . . $ `Descent3/weapon.h:203:9`!; i++) { |
| 1517 | // SecondarySelectList[i] = 0; |
| 1518 | } |
| 1519 | } |
| 1520 | |
| 1521 | void pilotcxx . . $ pilot#::read_gameplay_togglescxx . . $ pilot#read_gameplay_toggles(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *file, bool skip) { |
| 1522 | uint8_tcxx . . $ uint8_t# count, i; |
| 1523 | bool toggles[16]; |
| 1524 | |
| 1525 | for (i = 0; i < 16; i++) |
| 1526 | toggles[i] = false; |
| 1527 | |
| 1528 | count = (uint8_tcxx . . $ uint8_t#)cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file); |
| 1529 | if (count > 16) { |
| 1530 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1531 | count = 16; |
| 1532 | } // bad, very bad. |
| 1533 | |
| 1534 | for (i = 0; i < count; i++) { |
| 1535 | toggles[i] = (bool)(cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(file) ? true : false); |
| 1536 | } |
| 1537 | |
| 1538 | // define toggles. |
| 1539 | if (!skip) { |
| 1540 | gameplay_togglescxx . . $ pilot#gameplay_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview. = toggles[0]; |
| 1541 | gameplay_togglescxx . . $ pilot#gameplay_toggles..show_reticlecxx . . $ tGameToggles#show_reticle. = toggles[1]; |
| 1542 | |
| 1543 | // verify that we are setting values correctly, if new toggles are added to pilot. |
| 1544 | gameplay_togglescxx . . $ pilot#gameplay_toggles..ship_noisescxx . . $ tGameToggles#ship_noises. = (count < 3) ? true : toggles[2]; |
| 1545 | } |
| 1546 | } |
| 1547 | |
| 1548 | void pilotcxx . . $ pilot#::write_gameplay_togglescxx . . $ pilot#write_gameplay_toggles(3639e799710acb68).(CFILEcxx . . $ CFILE# *file) { |
| 1549 | // number of toggles to write out! |
| 1550 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, 3); |
| 1551 | |
| 1552 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)gameplay_togglescxx . . $ pilot#gameplay_toggles..guided_mainviewcxx . . $ tGameToggles#guided_mainview.); |
| 1553 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)gameplay_togglescxx . . $ pilot#gameplay_toggles..show_reticlecxx . . $ tGameToggles#show_reticle.); |
| 1554 | cf_WriteBytecxx . . $ cf_WriteByte(17377ebd5835367f).(file, (int8_t)gameplay_togglescxx . . $ pilot#gameplay_toggles..ship_noisescxx . . $ tGameToggles#ship_noises.); |
| 1555 | } |