1 /* 2 * Copyright (C) Volition, Inc. 1999. All rights reserved. 3 * 4 * All source code herein is the property of Volition, Inc. You may not sell 5 * or otherwise commercially exploit the source or things you created based on the 6 * source. 7 * 8 */ 9 10 #ifndef _PARSE_H 11 #define _PARSE_H 12 13 #include <setjmp.h> 14 #include "ai/ai.h" 15 #include "ai/ai_profiles.h" 16 #include "model/model.h" 17 #include "object/object.h" 18 #include "graphics/2d.h" 19 #include "sound/sound.h" 20 #include "parse/sexp.h" 21 #include "io/keycontrol.h" 22 23 //WMC - This should be here 24 #define FS_MISSION_FILE_EXT NOX(".fs2") 25 26 struct wing; 27 struct p_dock_instance; 28 29 #define NUM_NEBULAS 3 // how many background nebulas we have altogether 30 #define NUM_NEBULA_COLORS 9 31 32 #define DEFAULT_AMBIENT_LIGHT_LEVEL 0x00787878 33 34 // arrival anchor types 35 // mask should be high enough to avoid conflicting with ship anchors 36 #define SPECIAL_ARRIVAL_ANCHOR_FLAG 0x1000 37 #define SPECIAL_ARRIVAL_ANCHOR_PLAYER_FLAG 0x0100 38 39 // update version when mission file format changes, and add approprate code 40 // to check loaded mission version numbers in the parse code. Also, be sure 41 // to update both MissionParse and MissionSave (FRED) when changing the 42 // mission file format! 43 #define MISSION_VERSION 0.10f 44 #define FRED_MISSION_VERSION 0.10f 45 46 #define WING_PLAYER_BASE 0x80000 // used by Fred to tell ship_index in a wing points to a player 47 48 // mission parse flags used for parse_mission() to tell what kind of information to get from the mission file 49 #define MPF_ONLY_MISSION_INFO (1 << 0) 50 #define MPF_IMPORT_FSM (1 << 1) 51 52 // bitfield definitions for missions game types 53 #define OLD_MAX_GAME_TYPES 4 // needed for compatibility 54 #define OLD_GAME_TYPE_SINGLE_ONLY 0 55 #define OLD_GAME_TYPE_MULTI_ONLY 1 56 #define OLD_GAME_TYPE_SINGLE_MULTI 2 57 #define OLD_GAME_TYPE_TRAINING 3 58 59 #define MAX_MISSION_TYPES 5 60 #define MISSION_TYPE_SINGLE (1<<0) 61 #define MISSION_TYPE_MULTI (1<<1) 62 #define MISSION_TYPE_TRAINING (1<<2) 63 #define MISSION_TYPE_MULTI_COOP (1<<3) 64 #define MISSION_TYPE_MULTI_TEAMS (1<<4) 65 #define MISSION_TYPE_MULTI_DOGFIGHT (1<<5) 66 67 #define MISSION_FLAG_SUBSPACE (1<<0) // mission takes place in subspace 68 #define MISSION_FLAG_NO_PROMOTION (1<<1) // cannot get promoted or badges in this mission 69 #define MISSION_FLAG_FULLNEB (1<<2) // mission is a full nebula mission 70 #define MISSION_FLAG_NO_BUILTIN_MSGS (1<<3) // disables builtin msgs 71 #define MISSION_FLAG_NO_TRAITOR (1<<4) // player cannot become a traitor 72 #define MISSION_FLAG_TOGGLE_SHIP_TRAILS (1<<5) // toggles ship trails (off in nebula, on outside nebula) 73 #define MISSION_FLAG_SUPPORT_REPAIRS_HULL (1<<6) // Toggles support ship repair of ship hulls 74 #define MISSION_FLAG_BEAM_FREE_ALL_BY_DEFAULT (1<<7) // Beam-free-all by default - Goober5000 75 #define MISSION_FLAG_CURRENTLY_UNUSED_1 (1<<8) 76 #define MISSION_FLAG_CURRENTLY_UNUSED_2 (1<<9) 77 #define MISSION_FLAG_NO_BRIEFING (1<<10) // no briefing, jump right into mission - Goober5000 78 #define MISSION_FLAG_TOGGLE_DEBRIEFING (1<<11) // Turn on debriefing for dogfight. Off for everything else - Goober5000 79 #define MISSION_FLAG_CURRENTLY_UNUSED_3 (1<<12) 80 #define MISSION_FLAG_ALLOW_DOCK_TREES (1<<13) // toggle between hub and tree model for ship docking (see objectdock.cpp) - Gooober5000 81 #define MISSION_FLAG_2D_MISSION (1<<14) // Mission is meant to be played top-down style; 2D physics and movement. 82 #define MISSION_FLAG_CURRENTLY_UNUSED_4 (1<<15) 83 #define MISSION_FLAG_RED_ALERT (1<<16) // a red-alert mission - Goober5000 84 #define MISSION_FLAG_SCRAMBLE (1<<17) // a scramble mission - Goober5000 85 #define MISSION_FLAG_NO_BUILTIN_COMMAND (1<<18) // turns off Command without turning off pilots - Karajorma 86 #define MISSION_FLAG_PLAYER_START_AI (1<<19) // Player Starts mission under AI Control (NOT MULTI COMPATABLE) - Kazan 87 #define MISSION_FLAG_ALL_ATTACK (1<<20) // all teams at war - Goober5000 88 #define MISSION_FLAG_USE_AP_CINEMATICS (1<<21) // Kazan - use autopilot cinematics 89 #define MISSION_FLAG_DEACTIVATE_AP (1<<22) // KeldorKatarn - deactivate autopilot (patch approved by Kazan) 90 #define MISSION_FLAG_ALWAYS_SHOW_GOALS (1<<23) // Karajorma - Show the mission goals, even for training missions 91 92 // some mice macros for mission type 93 #define IS_MISSION_MULTI_COOP (The_mission.game_type & MISSION_TYPE_MULTI_COOP) 94 #define IS_MISSION_MULTI_TEAMS (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) 95 #define IS_MISSION_MULTI_DOGFIGHT (The_mission.game_type & MISSION_TYPE_MULTI_DOGFIGHT) 96 97 98 // Goober5000 99 typedef struct support_ship_info { 100 int arrival_location; // arrival location 101 int arrival_anchor; // arrival anchor 102 int departure_location; // departure location 103 int departure_anchor; // departure anchor 104 float max_hull_repair_val; // % of a ship's hull that can be repaired -C 105 float max_subsys_repair_val; // same thing, except for subsystems -C 106 int max_support_ships; // max number of consecutive support ships 107 int max_concurrent_ships; // max number of concurrent support ships in mission per team 108 int ship_class; // ship class of support ship 109 int tally; // number of support ships so far 110 int support_available_for_species; // whether support is available for a given species (this is a bitfield) 111 } support_ship_info; 112 113 // movie type defines 114 #define MOVIE_PRE_FICTION 0 115 #define MOVIE_PRE_CMD_BRIEF 1 116 #define MOVIE_PRE_BRIEF 2 117 #define MOVIE_PRE_GAME 3 118 #define MOVIE_PRE_DEBRIEF 4 119 #define MOVIE_END_CAMPAIGN 5 120 121 // defines a mission cutscene. 122 typedef struct mission_cutscene { 123 int type; 124 char cutscene_name[NAME_LENGTH]; 125 int formula; 126 mission_cutscenemission_cutscene127 mission_cutscene( ) 128 : type( 0 ), formula( -1 ) 129 { 130 cutscene_name[ 0 ] = 0; 131 } 132 } mission_cutscene; 133 134 typedef struct mission { 135 char name[NAME_LENGTH]; 136 char author[NAME_LENGTH]; 137 float version; 138 char created[DATE_TIME_LENGTH]; 139 char modified[DATE_TIME_LENGTH]; 140 char notes[NOTES_LENGTH]; 141 char mission_desc[MISSION_DESC_LENGTH]; 142 int game_type; 143 int flags; 144 int num_players; // valid in multiplayer missions -- number of players supported 145 uint num_respawns; // valid in multiplayer missions -- number of respawns allowed 146 int max_respawn_delay; // valid in multiplayer missions -- number of respawns allowed 147 support_ship_info support_ships; // Goober5000 148 char squad_filename[MAX_FILENAME_LEN]; // if the player has been reassigned to a squadron, this is the filename of the logo, otherwise empty string 149 char squad_name[NAME_LENGTH]; // if the player has been reassigned to a squadron, this is the name of the squadron, otherwise empty string 150 char loading_screen[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN]; 151 char skybox_model[MAX_FILENAME_LEN]; 152 matrix skybox_orientation; 153 char envmap_name[MAX_FILENAME_LEN]; 154 int skybox_flags; 155 int contrail_threshold; 156 int ambient_light_level; 157 float neb_far_multi; 158 float neb_near_multi; 159 sound_env sound_environment; 160 161 // Goober5000 162 int command_persona; 163 char command_sender[NAME_LENGTH]; 164 165 // Goober5000 166 char event_music_name[NAME_LENGTH]; 167 char briefing_music_name[NAME_LENGTH]; 168 char substitute_event_music_name[NAME_LENGTH]; 169 char substitute_briefing_music_name[NAME_LENGTH]; 170 171 // Goober5000 172 ai_profile_t *ai_profile; 173 174 SCP_vector<mission_cutscene> cutscenes; 175 Resetmission176 void Reset( ) 177 { 178 int i = 0; 179 name[ 0 ] = '\0'; 180 author[ 0 ] = '\0'; 181 version = 0.; 182 created[ 0 ] = '\0'; 183 modified[ 0 ] = '\0'; 184 notes[ 0 ] = '\0'; 185 mission_desc[ 0 ] = '\0'; 186 game_type = 0; 187 flags = 0; 188 num_players = 0; 189 num_respawns = 0; 190 max_respawn_delay = 0; 191 memset(&Ignored_keys, 0, sizeof(int)*CCFG_MAX); 192 memset( &support_ships, 0, sizeof( support_ships ) ); 193 squad_filename[ 0 ] = '\0'; 194 squad_name[ 0 ] = '\0'; 195 for ( i = 0; i < GR_NUM_RESOLUTIONS; i++ ) 196 loading_screen[ i ][ 0 ] = '\0'; 197 skybox_model[ 0 ] = '\0'; 198 vm_set_identity(&skybox_orientation); 199 skybox_flags = 0; 200 envmap_name[ 0 ] = '\0'; 201 contrail_threshold = 0; 202 ambient_light_level = DEFAULT_AMBIENT_LIGHT_LEVEL; 203 sound_environment.id = -1; 204 command_persona = 0; 205 command_sender[ 0 ] = '\0'; 206 event_music_name[ 0 ] = '\0'; 207 briefing_music_name[ 0 ] = '\0'; 208 substitute_event_music_name[ 0 ] = '\0'; 209 substitute_briefing_music_name[ 0 ] = '\0'; 210 ai_profile = NULL; 211 cutscenes.clear( ); 212 } 213 missionmission214 mission( ) 215 { 216 Reset( ); 217 } 218 } mission; 219 220 // cargo defines 221 // NOTE: MAX_CARGO MUST REMAIN <= 64 (CARGO_NO_DEPLETE) for NO_DEPLETE to work. 222 // FURTHER NOTE (Goober5000): If a new flag is added here, the code (particularly in sexp.cpp) 223 // must be reworked so that all the flags are maintained from function to function 224 #define CARGO_INDEX_MASK 0xBF 225 #define CARGO_NO_DEPLETE 0x40 // CARGO_NO_DEPLETE + CARGO_INDEX_MASK must == FF 226 #define MAX_CARGO 30 227 228 229 // Goober5000 - contrail threshold (previously defined in ShipContrails.cpp) 230 #define CONTRAIL_THRESHOLD_DEFAULT 45 231 232 extern mission The_mission; 233 extern char Mission_filename[80]; // filename of mission in The_mission (Fred only) 234 235 #define MAX_FORMATION_NAMES 3 236 #define MAX_STATUS_NAMES 3 237 238 // defines for arrival locations. These defines should match their counterparts in the arrival location 239 // array 240 #define MAX_ARRIVAL_NAMES 4 241 #define ARRIVE_AT_LOCATION 0 242 #define ARRIVE_NEAR_SHIP 1 243 #define ARRIVE_IN_FRONT_OF_SHIP 2 244 #define ARRIVE_FROM_DOCK_BAY 3 245 246 // defines for departure locations. These defines should match their counterparts in the departure location 247 // array 248 #define MAX_DEPARTURE_NAMES 2 249 #define DEPART_AT_LOCATION 0 250 #define DEPART_AT_DOCK_BAY 1 251 252 #define MAX_GOAL_TYPE_NAMES 3 253 254 // alternate ship type names 255 #define MAX_ALT_TYPE_NAMES 100 256 extern char Mission_alt_types[MAX_ALT_TYPE_NAMES][NAME_LENGTH]; 257 extern int Mission_alt_type_count; 258 259 // callsign 260 #define MAX_CALLSIGNS 100 261 extern char Mission_callsigns[MAX_CALLSIGNS][NAME_LENGTH]; 262 extern int Mission_callsign_count; 263 264 // path restrictions 265 #define MAX_PATH_RESTRICTIONS 10 266 typedef struct path_restriction_t { 267 int num_paths; 268 int cached_mask; 269 char path_names[MAX_SHIP_BAY_PATHS][MAX_NAME_LEN]; 270 } path_restriction_t; 271 272 extern char *Ship_class_names[MAX_SHIP_CLASSES]; 273 extern char *Ai_behavior_names[MAX_AI_BEHAVIORS]; 274 extern char *Formation_names[MAX_FORMATION_NAMES]; 275 extern char *Status_desc_names[MAX_STATUS_NAMES]; 276 extern char *Status_type_names[MAX_STATUS_NAMES]; 277 extern char *Status_target_names[MAX_STATUS_NAMES]; 278 extern char *Arrival_location_names[MAX_ARRIVAL_NAMES]; 279 extern char *Departure_location_names[MAX_DEPARTURE_NAMES]; 280 extern char *Goal_type_names[MAX_GOAL_TYPE_NAMES]; 281 282 extern char *Reinforcement_type_names[]; 283 extern char *Object_flags[]; 284 extern char *Parse_object_flags[]; 285 extern char *Parse_object_flags_2[]; 286 extern char *Icon_names[]; 287 extern char *Mission_event_log_flags[]; 288 289 extern char *Cargo_names[MAX_CARGO]; 290 extern char Cargo_names_buf[MAX_CARGO][NAME_LENGTH]; 291 292 extern char Mission_parse_storm_name[NAME_LENGTH]; 293 294 extern int Num_iff; 295 extern int Num_ai_behaviors; 296 extern int Num_ai_classes; 297 extern int Num_cargo; 298 extern int Num_status_names; 299 extern int Num_arrival_names; 300 extern int Num_formation_names; 301 extern int Num_goal_type_names; 302 extern int Num_reinforcement_type_names; 303 extern int Player_starts; 304 extern fix Entry_delay_time; 305 extern int Loading_screen_bm_index; 306 307 extern int Num_unknown_ship_classes; 308 extern int Num_unknown_weapon_classes; 309 extern int Num_unknown_loadout_classes; 310 311 extern ushort Current_file_checksum; 312 extern int Current_file_length; 313 314 #define SUBSYS_STATUS_NO_CHANGE -999 315 316 typedef struct subsys_status { 317 char name[NAME_LENGTH]; 318 float percent; // percent damaged 319 int primary_banks[MAX_SHIP_PRIMARY_BANKS]; 320 int primary_ammo[MAX_SHIP_PRIMARY_BANKS]; 321 int secondary_banks[MAX_SHIP_SECONDARY_BANKS]; 322 int secondary_ammo[MAX_SHIP_SECONDARY_BANKS]; 323 int ai_class; 324 int subsys_cargo_name; 325 } subsys_status; 326 327 typedef struct texture_replace { 328 char ship_name[NAME_LENGTH]; 329 char old_texture[MAX_FILENAME_LEN]; 330 char new_texture[MAX_FILENAME_LEN]; 331 int new_texture_id; 332 } texture_replace; 333 334 extern SCP_vector<texture_replace> Fred_texture_replacements; 335 336 typedef struct alt_class { 337 int ship_class; 338 int variable_index; // if set allows the class to be set by a variable 339 bool default_to_this_class; 340 }alt_class; 341 342 #define MAX_OBJECT_STATUS 10 343 344 // a parse object 345 // information from a $OBJECT: definition is read into this struct to 346 // be copied into the real object, ship, etc. structs 347 class p_object 348 { 349 public: 350 char name[NAME_LENGTH]; 351 p_object *next, *prev; 352 353 vec3d pos; 354 matrix orient; 355 int ship_class; 356 int team; 357 int behavior; // ai_class; 358 int ai_goals; // sexp of lists of goals that this ship should try and do 359 char cargo1; 360 SCP_string team_color_setting; 361 362 int status_count; 363 int status_type[MAX_OBJECT_STATUS]; 364 int status[MAX_OBJECT_STATUS]; 365 int target[MAX_OBJECT_STATUS]; 366 367 int subsys_index; // index into subsys_status array 368 int subsys_count; // number of elements used in subsys_status array 369 int initial_velocity; 370 int initial_hull; 371 int initial_shields; 372 373 int arrival_location; 374 int arrival_distance; // used when arrival location is near or in front of some ship 375 int arrival_anchor; // ship used for anchoring an arrival point 376 int arrival_path_mask; // Goober5000 377 int arrival_cue; // Index in Sexp_nodes of this sexp. 378 int arrival_delay; 379 380 int departure_location; 381 int departure_anchor; 382 int departure_path_mask; // Goober5000 383 int departure_cue; // Index in Sexp_nodes of this sexp. 384 int departure_delay; 385 386 char misc[NAME_LENGTH]; 387 388 int wingnum; // set to -1 if not in a wing -- Wing array index otherwise 389 int pos_in_wing; // Goober5000 - needed for FRED with the new way things work 390 391 int flags; // mission savable flags 392 int flags2; // Goober5000 393 int escort_priority; // priority in escort list 394 int ai_class; 395 int hotkey; // hotkey number (between 0 and 9) -1 means no hotkey 396 int score; 397 float assist_score_pct; // percentage of the score which players who gain an assist will get when this ship is killed 398 int orders_accepted; // which orders this ship will accept from the player 399 p_dock_instance *dock_list; // Goober5000 - parse objects this parse object is docked to 400 object *created_object; // Goober5000 401 int group; // group object is within or -1 if none. 402 int persona_index; 403 int kamikaze_damage; // base damage for a kamikaze attack 404 405 bool use_special_explosion; // new special explosion/hitpoints system 406 int special_exp_damage; 407 int special_exp_blast; 408 int special_exp_inner; 409 int special_exp_outer; 410 bool use_shockwave; 411 int special_exp_shockwave_speed; 412 int special_exp_deathroll_time; 413 414 int special_hitpoints; 415 int special_shield; 416 417 ushort net_signature; // network signature this object can have 418 int destroy_before_mission_time; 419 420 char wing_status_wing_index; // wing index (0-4) in wingman status gauge 421 char wing_status_wing_pos; // wing position (0-5) in wingman status gauge 422 423 uint respawn_count; // number of respawns for this object. Applies only to player wing ships in multiplayer 424 int respawn_priority; // priority this ship has for controlling respawn points 425 426 int alt_type_index; // optional alt type index 427 int callsign_index; // optional callsign index 428 429 float ship_max_hull_strength; // Needed to deal with special hitpoints 430 float ship_max_shield_strength; 431 432 // Goober5000 433 int num_texture_replacements; 434 texture_replace replacement_textures[MAX_REPLACEMENT_TEXTURES]; // replacement textures - Goober5000 435 436 SCP_vector<alt_class> alt_classes; 437 438 int alt_iff_color[MAX_IFFS][MAX_IFFS]; 439 440 p_object(); 441 ~p_object(); 442 }; 443 444 // defines for flags used for p_objects when they are created. Used to help create special 445 // circumstances for those ships. This list of bitfield indicators MUST correspond EXACTLY 446 // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! 447 448 #define MAX_PARSE_OBJECT_FLAGS 27 449 450 #define P_SF_CARGO_KNOWN (1<<0) 451 #define P_SF_IGNORE_COUNT (1<<1) 452 #define P_OF_PROTECTED (1<<2) 453 #define P_SF_REINFORCEMENT (1<<3) 454 #define P_OF_NO_SHIELDS (1<<4) 455 #define P_SF_ESCORT (1<<5) 456 #define P_OF_PLAYER_START (1<<6) 457 #define P_SF_NO_ARRIVAL_MUSIC (1<<7) 458 #define P_SF_NO_ARRIVAL_WARP (1<<8) 459 #define P_SF_NO_DEPARTURE_WARP (1<<9) 460 #define P_SF_LOCKED (1<<10) 461 #define P_OF_INVULNERABLE (1<<11) 462 #define P_SF_HIDDEN_FROM_SENSORS (1<<12) 463 #define P_SF_SCANNABLE (1<<13) // ship is a "scannable" ship 464 #define P_AIF_KAMIKAZE (1<<14) 465 #define P_AIF_NO_DYNAMIC (1<<15) 466 #define P_SF_RED_ALERT_STORE_STATUS (1<<16) 467 #define P_OF_BEAM_PROTECTED (1<<17) 468 #define P_OF_FLAK_PROTECTED (1<<18) 469 #define P_OF_LASER_PROTECTED (1<<19) 470 #define P_OF_MISSILE_PROTECTED (1<<20) 471 #define P_SF_GUARDIAN (1<<21) 472 #define P_KNOSSOS_WARP_IN (1<<22) 473 #define P_SF_VAPORIZE (1<<23) 474 #define P_SF2_STEALTH (1<<24) 475 #define P_SF2_FRIENDLY_STEALTH_INVIS (1<<25) 476 #define P_SF2_DONT_COLLIDE_INVIS (1<<26) 477 478 // the following parse object flags are used internally by FreeSpace 479 #define P_SF_USE_UNIQUE_ORDERS (1<<27) // tells a newly created ship to use the default orders for that ship 480 #define P_SF_DOCK_LEADER (1<<28) // Goober5000 - a docked parse object that is the leader of its group 481 #define P_SF_CANNOT_ARRIVE (1<<29) // used to indicate that this ship's arrival cue will never be true 482 #define P_SF_WARP_BROKEN (1<<30) // warp engine should be broken for this ship 483 #define P_SF_WARP_NEVER (1<<31) // warp drive is destroyed 484 485 // more parse flags! -- Goober5000 486 // same caveat: This list of bitfield indicators MUST correspond EXACTLY 487 // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! 488 489 #define MAX_PARSE_OBJECT_FLAGS_2 23 490 491 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) 492 #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) 493 #define P2_SF2_NAV_CARRY_STATUS (1<<2) 494 #define P2_SF2_AFFECTED_BY_GRAVITY (1<<3) 495 #define P2_SF2_TOGGLE_SUBSYSTEM_SCANNING (1<<4) 496 #define P2_OF_TARGETABLE_AS_BOMB (1<<5) 497 #define P2_SF2_NO_BUILTIN_MESSAGES (1<<6) 498 #define P2_SF2_PRIMARIES_LOCKED (1<<7) 499 #define P2_SF2_SECONDARIES_LOCKED (1<<8) 500 #define P2_SF2_NO_DEATH_SCREAM (1<<9) 501 #define P2_SF2_ALWAYS_DEATH_SCREAM (1<<10) 502 #define P2_SF2_NAV_NEEDSLINK (1<<11) 503 #define P2_SF2_HIDE_SHIP_NAME (1<<12) 504 #define P2_SF2_SET_CLASS_DYNAMICALLY (1<<13) 505 #define P2_SF2_LOCK_ALL_TURRETS_INITIALLY (1<<14) 506 #define P2_SF2_AFTERBURNER_LOCKED (1<<15) 507 #define P2_OF_FORCE_SHIELDS_ON (1<<16) 508 #define P2_OF_IMMOBILE (1<<17) 509 #define P2_SF2_NO_ETS (1<<18) 510 #define P2_SF2_CLOAKED (1<<19) 511 #define P2_SF2_SHIP_LOCKED (1<<20) 512 #define P2_SF2_WEAPONS_LOCKED (1<<21) 513 #define P2_SF2_SCRAMBLE_MESSAGES (1<<22) 514 515 // and again: these flags do not appear in the array 516 //#define blah (1<<28) 517 //#define blah (1<<29) 518 #define P2_RED_ALERT_DELETED (1<<30) // Goober5000 - used analogously to SEF_PLAYER_DELETED 519 #define P2_ALREADY_HANDLED (1<<31) // Goober5000 - used for docking currently, but could be used generically 520 521 522 // Goober5000 - this is now dynamic 523 extern SCP_vector<p_object> Parse_objects; 524 #define POBJ_INDEX(pobjp) (pobjp - &Parse_objects[0]) // yes, this arithmetic is valid :D 525 526 extern p_object Support_ship_pobj, *Arriving_support_ship; 527 extern p_object Ship_arrival_list; 528 529 typedef struct { 530 // ships 531 int default_ship; // default ship type for player start point (recommended choice) 532 int num_ship_choices; // number of ship choices inside ship_list 533 int loadout_total; // Total number of ships available of all classes 534 int ship_list[MAX_SHIP_CLASSES]; 535 char ship_list_variables[MAX_SHIP_CLASSES][TOKEN_LENGTH]; 536 int ship_count[MAX_SHIP_CLASSES]; 537 char ship_count_variables[MAX_SHIP_CLASSES][TOKEN_LENGTH]; 538 539 // weapons 540 int num_weapon_choices; 541 int weaponry_pool[MAX_WEAPON_TYPES]; 542 int weaponry_count[MAX_WEAPON_TYPES]; 543 char weaponry_pool_variable[MAX_WEAPON_TYPES][TOKEN_LENGTH]; 544 char weaponry_amount_variable[MAX_WEAPON_TYPES][TOKEN_LENGTH]; 545 bool weapon_required[MAX_WEAPON_TYPES]; 546 } team_data; 547 548 #define MAX_P_WINGS 16 549 #define MAX_SHIP_LIST 16 550 551 extern team_data Team_data[MAX_TVT_TEAMS]; 552 extern subsys_status *Subsys_status; 553 extern int Subsys_index; 554 555 extern vec3d Parse_viewer_pos; 556 extern matrix Parse_viewer_orient; 557 558 extern int Mission_arrival_timestamp; 559 extern int Mission_departure_timestamp; 560 extern fix Mission_end_time; 561 562 extern char Parse_names[MAX_SHIPS + MAX_WINGS][NAME_LENGTH]; 563 extern int Num_parse_names; 564 extern int Num_teams; 565 566 extern char Player_start_shipname[NAME_LENGTH]; 567 extern int Player_start_shipnum; 568 extern p_object *Player_start_pobject; 569 570 extern int Mission_palette; // index of palette file to use for mission 571 extern int Nebula_index; // index into Nebula_filenames[] of nebula to use in mission. 572 extern char *Nebula_filenames[NUM_NEBULAS]; 573 extern char *Nebula_colors[NUM_NEBULA_COLORS]; 574 extern p_object *Arriving_support_ship; 575 576 extern char Neb2_texture_name[MAX_FILENAME_LEN]; 577 578 579 int parse_main(const char *mission_name, int flags = 0); 580 p_object *mission_parse_get_arrival_ship(ushort net_signature); 581 p_object *mission_parse_get_arrival_ship(const char *name); 582 p_object *mission_parse_get_parse_object(ushort net_signature); 583 p_object *mission_parse_get_parse_object(const char *name); 584 int parse_create_object(p_object *objp); 585 void resolve_parse_flags(object *objp, int parse_flags, int parse_flags2); 586 587 void mission_parse_close(); 588 589 // used in squadmate messaging stuff to create wings from reinforcements. 590 int parse_wing_create_ships(wing *wingp, int num_to_create, int force = 0, int specific_instance = -1 ); 591 592 // function for getting basic mission data without loading whole mission 593 int mission_parse_is_multi(const char *filename, char *mission_name ); 594 int mission_parse_get_multi_mission_info(const char *filename); 595 596 // called externally from multiplayer code 597 int mission_do_departure(object *objp, bool goal_is_to_warp = false); 598 599 // called externally from freespace.cpp 600 void mission_parse_fixup_players(void); 601 602 // get a index to a perminently kept around name of a ship or wing 603 int get_parse_name_index(const char *name); 604 605 // called from freespace game level loop 606 void mission_parse_eval_stuff(); 607 608 // function to set the ramaing time left in the mission 609 void mission_parse_set_end_time( int seconds ); 610 611 // code to bring in a repair ship. 612 void mission_bring_in_support_ship( object *requester_objp ); 613 int mission_is_support_ship_arriving( void ); 614 void mission_add_to_arriving_support( object *requester_objp ); 615 int mission_is_repair_scheduled( object *objp ); 616 int mission_remove_scheduled_repair( object *objp ); 617 void mission_parse_support_arrived( int objnum ); 618 619 // alternate name stuff 620 int mission_parse_lookup_alt(const char *name); 621 void mission_parse_lookup_alt_index(int index, char *out); 622 int mission_parse_add_alt(const char *name); 623 void mission_parse_remove_alt(const char *name); 624 void mission_parse_reset_alt(); 625 626 // callsign stuff 627 int mission_parse_lookup_callsign(const char *name); 628 void mission_parse_lookup_callsign_index(int index, char *out); 629 int mission_parse_add_callsign(const char *name); 630 void mission_parse_remove_callsign(const char *name); 631 void mission_parse_reset_callsign(); 632 633 // is training mission 634 int is_training_mission(); 635 636 // code to save/restore mission parse stuff 637 int get_mission_info(const char *filename, mission *missionp = NULL, bool basic = true); 638 639 // Goober5000 640 void parse_dock_one_docked_object(p_object *pobjp, p_object *parent_pobjp); 641 642 // Goober5000 643 extern int Knossos_warp_ani_used; 644 645 // Karajorma 646 void swap_parse_object(p_object *p_obj, int ship_class); 647 void clear_texture_replacements(); 648 649 // Goober5000 650 subsys_status *parse_get_subsys_status(p_object *pobjp, char *subsys_name); 651 652 653 #endif 654 655