FS2_Open
Open source remastering of the Freespace 2 engine
ship.cpp File Reference
#include <setjmp.h>
#include "ai/aigoals.h"
#include "asteroid/asteroid.h"
#include "autopilot/autopilot.h"
#include "cmdline/cmdline.h"
#include "cmeasure/cmeasure.h"
#include "debugconsole/console.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/eventmusic.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "globalincs/def_files.h"
#include "globalincs/linklist.h"
#include "graphics/gropenglshader.h"
#include "hud/hud.h"
#include "hud/hudartillery.h"
#include "hud/hudets.h"
#include "hud/hudmessage.h"
#include "hud/hudshield.h"
#include "hud/hudsquadmsg.h"
#include "hud/hudtargetbox.h"
#include "hud/hudwingmanstatus.h"
#include "iff_defs/iff_defs.h"
#include "io/joy_ff.h"
#include "io/timer.h"
#include "jumpnode/jumpnode.h"
#include "lighting/lighting.h"
#include "localization/localize.h"
#include "math/fvi.h"
#include "math/staticrand.h"
#include "math/vecmat.h"
#include "mission/missioncampaign.h"
#include "mission/missionlog.h"
#include "mission/missionmessage.h"
#include "missionui/missionshipchoice.h"
#include "missionui/redalert.h"
#include "mod_table/mod_table.h"
#include "model/model.h"
#include "model/modelrender.h"
#include "nebula/neb.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "object/deadobjectdock.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "object/objectshield.h"
#include "object/objectsnd.h"
#include "object/waypoint.h"
#include "parse/parselo.h"
#include "parse/scripting.h"
#include "particle/particle.h"
#include "playerman/player.h"
#include "radar/radar.h"
#include "radar/radarsetup.h"
#include "render/3d.h"
#include "ship/afterburner.h"
#include "ship/ship.h"
#include "ship/shipcontrails.h"
#include "ship/shipfx.h"
#include "ship/shiphit.h"
#include "ship/subsysdamage.h"
#include "species_defs/species_defs.h"
#include "weapon/beam.h"
#include "weapon/corkscrew.h"
#include "weapon/emp.h"
#include "weapon/flak.h"
#include "weapon/shockwave.h"
#include "weapon/swarm.h"
#include "weapon/weapon.h"

Go to the source code of this file.

Macros

#define NUM_SHIP_SUBSYSTEM_SETS   20
 
#define NUM_SHIP_SUBSYSTEMS_PER_SET   200
 
#define SHIP_REPAIR_SUBSYSTEM_RATE   0.01f
 
#define SHIP_OBJ_USED   (1<<0)
 
#define MAX_SHIP_OBJS   MAX_SHIPS
 
#define SHIP_MULTITEXT_LENGTH   4096
 
#define DEFAULT_DELTA_BANK_CONST   0.5f
 
#define CHECK_THEN_COPY(attribute)
 
#define CHECK_THEN_FREE(attribute)
 
#define SHIP_REPAIR_SUBSYSTEM_RATE   0.01f
 
#define SUBSYS_REPAIR_THRESHOLD   0.1
 
#define PLAYER_MAX_DIST_WARNING   700000
 
#define PLAYER_DISTANCE_MAX_WARNINGS   3
 
#define PLAYER_MAX_DIST_END   750000
 
#define PLAYER_WARN_DELTA_TIME   10000
 
#define PLAYER_DEATH_DELTA_TIME   5000
 
#define MAX_SUBSYS_ATTACKERS   3
 
#define SHIELD_REPAIR_RATE   0.20f
 
#define HULL_REPAIR_RATE   0.15f
 
#define SUBSYS_REPAIR_RATE   0.10f
 
#define REARM_NUM_MISSILES_PER_BATCH   4
 
#define REARM_NUM_BALLISTIC_PRIMARIES_PER_BATCH   100
 
#define PLAYER_CHECK_WARN_INTERVAL   300
 
#define PLAYER_MIN_WARN_DIST   100
 
#define PLAYER_MAX_WARN_DIST   1000
 
#define ASK_HELP_SHIELD_PERCENT   0.1
 
#define ASK_HELP_HULL_PERCENT   0.3
 
#define AWACS_HELP_HULL_HI   0.75
 
#define AWACS_HELP_HULL_LOW   0.25
 
#define PLAYER_LOW_AMMO_MSG_INTERVAL   250000
 
#define PLAYER_REQUEST_REPAIR_MSG_INTERVAL   240000
 
#define PLAYER_MAX_LOW_AMMO_MSGS   5
 
#define PAGE_OUT_TEXTURE(x)
 
#define CLEAR_ARTILLERY_AND_CONTINUE()   { if(aip != NULL){ aip->artillery_objnum = -1; aip->artillery_sig = -1; aip->artillery_lock_time = 0.0f;} continue; }
 
#define AT_TYPE_ADDITIVE   0
 
#define AT_TYPE_MULTIPLICATIVE   1
 
#define AT_TYPE_EXPONENTIAL   2
 
#define AT_TYPE_EXPONENTIAL_BASE   3
 
#define AT_TYPE_CUTOFF   4
 
#define AT_TYPE_REVERSE_CUTOFF   5
 
#define AT_TYPE_INSTANT_CUTOFF   6
 
#define AT_TYPE_INSTANT_REVERSE_CUTOFF   7
 
#define AT_TYPE_CAP   8
 
#define AT_TYPE_INSTANT_CAP   9
 
#define AT_TYPE_SET   10
 
#define AT_TYPE_STORE   11
 
#define AT_TYPE_LOAD   12
 
#define AT_TYPE_RANDOM   13
 
#define AT_NUM_STORAGE_LOCATIONS   8
 

Functions

void fs2netd_add_table_validation (const char *tblname)
 
void render_path_points (object *objp)
 
engine_wash_infoget_engine_wash_pointer (char *engine_wash_name)
 
void ship_reset_disabled_physics (object *objp, int ship_class)
 
int ship_info_lookup_sub (const char *token)
 
int ship_get_subobj_model_num (ship_info *sip, char *subobj_name)
 
void ship_obj_list_reset_slot (int index)
 
int ship_in_my_squadron (ship *shipp)
 
void ship_obj_list_init ()
 
int ship_obj_list_add (int objnum)
 
void ship_obj_list_remove (int index)
 
void ship_obj_list_rebuild ()
 
ship_objget_ship_obj_ptr_from_index (int index)
 
int ship_get_num_ships ()
 
void engine_wash_info_init (engine_wash_info *ewi)
 
void parse_engine_wash (bool replace)
 
int warptype_match (char *p)
 
int lightningtype_match (char *p)
 
int parse_ship (const char *filename, bool replace)
 
int parse_ship_template ()
 
void parse_ship_sound (char *name, GameSoundsIndex id, ship_info *sip)
 
void parse_ship_sounds (ship_info *sip)
 
void parse_ship_particle_effect (ship_info *sip, particle_effect *pe, char *id_string)
 
void parse_allowed_weapons (ship_info *sip, const bool is_primary, const bool is_dogfight, const bool first_time)
 
void parse_weapon_bank (ship_info *sip, bool is_primary, int *num_banks, int *bank_default_weapons, int *bank_capacities)
 
int parse_and_add_briefing_icon_info ()
 
int parse_ship_values (ship_info *sip, const bool is_template, const bool first_time, const bool replace)
 
void parse_ship_type ()
 
void parse_shiptype_tbl (const char *filename)
 
int get_default_player_ship_index ()
 Returns the index of the default player ship. More...
 
void ship_set_default_player_ship ()
 
void parse_shiptbl (const char *filename)
 
void ship_parse_post_cleanup ()
 
void ship_init ()
 
void ship_level_init ()
 
void ship_add_exited_ship (ship *sp, int reason)
 
int ship_find_exited_ship_by_name (char *name)
 
int ship_find_exited_ship_by_signature (int signature)
 
void physics_ship_init (object *objp)
 
int ship_get_type (char *output, ship_info *sip)
 
int ship_get_default_orders_accepted (ship_info *sip)
 
vec3d get_submodel_offset (int model, int submodel)
 
void ship_set_warp_effects (object *objp, ship_info *sip)
 
void ship_set (int ship_index, int objnum, int ship_type)
 
void ship_recalc_subsys_strength (ship *shipp)
 
void ship_copy_subsystem_fixup (ship_info *sip)
 
int subsys_set (int objnum, int ignore_subsys_info)
 
void compute_slew_matrix (matrix *orient, angles *a)
 
void render_dock_bays (object *objp)
 
void ship_find_warping_ship_helper (object *objp, dock_function_info *infop)
 
void batch_render_man_thrusters ()
 
man_thruster_rendererman_thruster_get_slot (int bmap_frame)
 
void ship_render_DEPRECATED (object *obj)
 
void ship_render_cockpit (object *objp)
 
void ship_render_show_ship_cockpit (object *objp)
 
void ship_init_cockpit_displays (ship *shipp)
 
void ship_clear_cockpit_displays ()
 
void ship_add_cockpit_display (cockpit_display_info *display, int cockpit_model_num)
 
void ship_set_hud_cockpit_targets ()
 
int ship_start_render_cockpit_display (int cockpit_display_num)
 
void ship_end_render_cockpit_display (int cockpit_display_num)
 
void ship_subsystems_delete (ship *shipp)
 
void ship_delete (object *obj)
 
void ship_wing_cleanup (int shipnum, wing *wingp)
 
void ship_actually_depart_helper (object *objp, dock_function_info *infop)
 
void ship_actually_depart (int shipnum, int method)
 
void ship_destroy_instantly (object *ship_objp, int shipnum)
 
void ship_cleanup (int shipnum, int cleanup_mode)
 
int ship_explode_area_calc_damage (vec3d *pos1, vec3d *pos2, float inner_rad, float outer_rad, float max_damage, float max_blast, float *damage, float *blast)
 
void ship_blow_up_area_apply_blast (object *exp_objp)
 
void do_dying_undock_physics (object *dying_objp, ship *dying_shipp)
 
void ship_dying_frame (object *objp, int ship_num)
 
void ship_chase_shield_energy_targets (ship *shipp, object *obj, float frametime)
 
int thruster_glow_anim_load (generic_anim *ga)
 
void ship_init_thrusters ()
 
void ship_do_thruster_frame (ship *shipp, object *objp, float frametime)
 
void ship_do_weapon_thruster_frame (weapon *weaponp, object *objp, float frametime)
 
void ship_auto_repair_frame (int shipnum, float frametime)
 
void ship_check_player_distance_sub (player *p, int multi_target=-1)
 
void ship_check_player_distance ()
 
void observer_process_post (object *objp)
 
void ship_subsys_disrupted_check (ship *sp)
 
void ship_subsys_disrupted_maybe_check (ship *shipp)
 
int ship_subsys_disrupted (ship_subsys *ss)
 
void ship_subsys_set_disrupted (ship_subsys *ss, int time)
 
int ship_subsys_disrupted (ship *sp, int type)
 
void lethality_decay (ai_info *aip)
 
void ship_process_pre (object *objp, float frametime)
 
void ship_radar_process (object *obj, ship *shipp, ship_info *sip)
 
void ship_process_post (object *obj, float frametime)
 
void ship_set_default_weapons (ship *shipp, ship_info *sip)
 
int ship_check_collision_fast (object *obj, object *other_obj, vec3d *hitpos)
 
void ship_make_create_time_unique (ship *shipp)
 
void show_ship_subsys_count ()
 
void ship_init_afterburners (ship *shipp)
 
int ship_create (matrix *orient, vec3d *pos, int ship_type, char *ship_name)
 
void ship_model_change (int n, int ship_type)
 
void change_ship_type (int n, int ship_type, int by_sexp)
 
int ship_fire_primary_debug (object *objp)
 
int ship_launch_countermeasure (object *objp, int rand_val)
 
void ship_maybe_play_primary_fail_sound ()
 
int ship_maybe_play_secondary_fail_sound (weapon_info *wip)
 
int ship_weapon_maybe_fail (ship *sp)
 
 DCF (t_rad,"Sets weapon tracer radius")
 
 DCF (t_len,"Sets weapon tracer length")
 
 DCF (t_vel,"Sets weapon tracer velocity")
 
void ship_fire_tracer (int weapon_objnum)
 
int ship_stop_fire_primary_bank (object *obj, int bank_to_stop)
 
int ship_stop_fire_primary (object *obj)
 
float ship_get_subsystem_strength (ship *shipp, int type)
 
int ship_fire_primary (object *obj, int stream_weapons, int force)
 
void ship_start_targeting_laser (ship *shipp)
 
void ship_stop_targeting_laser (ship *shipp)
 
void ship_process_targeting_lasers ()
 
int maybe_detonate_weapon (ship_weapon *swp, object *src)
 
int ship_fire_secondary_detonate (object *obj, ship_weapon *swp)
 
int ship_select_next_valid_secondary_bank (ship_weapon *swp)
 
void ai_maybe_announce_shockwave_weapon (object *firing_objp, int weapon_index)
 
int ship_fire_secondary (object *obj, int allow_swarm)
 
int primary_out_of_ammo (ship_weapon *swp, int bank)
 
int ship_select_next_primary (object *objp, int direction)
 
int ship_select_next_secondary (object *objp)
 
int get_available_primary_weapons (object *objp, int *outlist, int *outbanklist)
 
int get_available_secondary_weapons (object *objp, int *outlist, int *outbanklist)
 
void wing_bash_ship_name (char *ship_name, const char *wing_name, int index)
 
int wing_name_lookup (const char *name, int ignore_count)
 
int wing_lookup (const char *name)
 
int ship_template_lookup (const char *token)
 
int ship_info_lookup (const char *token)
 
int ship_name_lookup (const char *name, int inc_players)
 
int ship_type_name_lookup (const char *name)
 
int ship_query_state (char *name)
 
int get_subsystem_pos (vec3d *pos, object *objp, ship_subsys *subsysp)
 
void ship_model_start (object *objp)
 
void ship_model_stop (object *objp)
 
void ship_model_update_instance (object *objp)
 
int ship_find_num_crewpoints (object *objp)
 
int ship_find_num_turrets (object *objp)
 
void ship_set_eye (object *obj, int eye_index)
 
void ship_get_eye (vec3d *eye_pos, matrix *eye_orient, object *obj, bool do_slew, bool from_origin)
 
ship_subsysship_get_best_subsys_to_attack (ship *sp, int subsys_type, vec3d *attacker_pos)
 
ship_subsysship_get_indexed_subsys (ship *sp, int index, vec3d *attacker_pos)
 
int ship_get_index_from_subsys (ship_subsys *ssp, int objnum, int error_bypass)
 
int ship_get_subsys_index (ship *sp, char *ss_name, int error_bypass)
 
void ship_set_subsystem_strength (ship *shipp, int type, float strength)
 
float ship_calculate_rearm_duration (object *objp)
 
int ship_do_rearm_frame (object *objp, float frametime)
 
int ship_find_repair_ship (object *requester_obj, object **ship_we_found)
 
void ship_close ()
 
void ship_assign_sound (ship *sp)
 
void ship_assign_sound_all ()
 
 DCF (set_shield,"Change player ship shield strength")
 
 DCF (set_hull,"Change player ship hull strength")
 
 DCF (set_subsys,"Set the strength of a particular subsystem on player ship")
 
void ship_clear_ship_type_counts ()
 
void ship_add_ship_type_count (int ship_info_index, int num)
 
void ship_add_ship_type_kill_count (int ship_info_index)
 
int ship_query_general_type (int ship)
 
int ship_query_general_type (ship *shipp)
 
int ship_class_query_general_type (int ship_class)
 
int ship_docking_valid (int docker, int dockee)
 
int ship_get_random_player_wing_ship (int flags, float max_dist, int persona_index, int get_first, int multi_team)
 
int ship_get_random_ship_in_wing (int wingnum, int flags, float max_dist, int get_first)
 
int ship_get_random_team_ship (int team_mask, int flags, float max_dist)
 
int ship_secondary_bank_has_ammo (int shipnum)
 
int ship_primary_bank_has_ammo (int shipnum)
 
int ship_engine_ok_to_warp (ship *sp)
 
int ship_navigation_ok_to_warp (ship *sp)
 
int ship_return_subsys_path_normal (ship *shipp, ship_subsys *ss, vec3d *gsubpos, vec3d *norm)
 
int ship_subsystem_in_sight (object *objp, ship_subsys *subsys, vec3d *eye_pos, vec3d *subsys_pos, int do_facing_check, float *dot_out, vec3d *vec_out)
 
ship_subsysship_return_next_subsys (ship *shipp, int type, vec3d *attacker_pos)
 
ship_subsysship_get_closest_subsys_in_sight (ship *sp, int subsys_type, vec3d *attacker_pos)
 
char * ship_subsys_get_name (ship_subsys *ss)
 
bool ship_subsys_has_instance_name (ship_subsys *ss)
 
void ship_subsys_set_name (ship_subsys *ss, char *n_name)
 
float ship_quadrant_shield_strength (object *hit_objp, vec3d *hitpos)
 
int ship_dumbfire_threat (ship *sp)
 
int ship_has_homing_missile_locked (ship *shipp)
 
int ship_is_getting_locked (ship *shipp)
 
int ship_lock_threat (ship *sp)
 
int bitmask_2_bitnum (int num)
 
char * ship_return_orders (char *outbuf, ship *sp)
 
char * ship_return_time_to_goal (char *outbuf, ship *sp)
 
void ship_maybe_warn_player (ship *enemy_sp, float dist)
 
void ship_maybe_praise_player (ship *deader_sp)
 
void ship_maybe_praise_self (ship *deader_sp, ship *killer_sp)
 
void awacs_maybe_ask_for_help (ship *sp, int multi_team_filter)
 
void ship_maybe_ask_for_help (ship *sp)
 
void ship_maybe_lament ()
 
void ship_scream (ship *sp)
 
void ship_maybe_scream (ship *sp)
 
void ship_maybe_tell_about_low_ammo (ship *sp)
 
void ship_maybe_tell_about_rearm (ship *sp)
 
void ship_primary_changed (ship *sp)
 
void ship_secondary_changed (ship *sp)
 
int ship_get_SIF (ship *shipp)
 
int ship_get_SIF (int sh)
 
int ship_get_by_signature (int signature)
 
ship_type_infoship_get_type_info (object *objp)
 
void ship_do_cargo_revealed (ship *shipp, int from_network)
 
void ship_do_cap_subsys_cargo_revealed (ship *shipp, ship_subsys *subsys, int from_network)
 
void ship_do_cargo_hidden (ship *shipp, int from_network)
 
void ship_do_cap_subsys_cargo_hidden (ship *shipp, ship_subsys *subsys, int from_network)
 
float ship_get_secondary_weapon_range (ship *shipp)
 
int get_max_ammo_count_for_primary_bank (int ship_class, int bank, int ammo_type)
 
int get_max_ammo_count_for_bank (int ship_class, int bank, int ammo_type)
 
int get_max_ammo_count_for_turret_bank (ship_weapon *swp, int bank, int ammo_type)
 
void ship_page_in ()
 
void ship_page_in_textures (int ship_index)
 
void ship_page_out_textures (int ship_index, bool release)
 
int is_support_allowed (object *objp, bool do_simple_check)
 
int ship_get_random_targetable_ship ()
 
void object_jettison_cargo (object *objp, object *cargo_objp)
 
float ship_get_exp_damage (object *objp)
 
int ship_get_exp_propagates (ship *sp)
 
float ship_get_exp_outer_rad (object *ship_objp)
 
int valid_cap_subsys_cargo_list (char *subsys)
 
int ship_get_turret_type (ship_subsys *subsys)
 
ship_subsysship_get_subsys (ship *shipp, char *subsys_name)
 
int ship_get_num_subsys (ship *shipp)
 
int wing_has_conflicting_teams (int wing_index)
 
int ship_get_reinforcement_team (int r_index)
 
int ship_get_texture (int bitmap)
 
 DCF (art,"Sets artillery disance")
 
void ship_update_artillery_lock ()
 
int check_world_pt_in_expanded_ship_bbox (vec3d *world_pt, object *objp, float delta_box)
 
int ship_is_tagged (object *objp)
 
float ship_get_max_speed (ship *shipp)
 
float ship_get_warpout_speed (object *objp)
 
int ship_is_beginning_warpout_speedup (object *objp)
 
float ship_class_get_length (ship_info *sip)
 
void ship_set_new_ai_class (int ship_num, int new_ai_class)
 
void ship_subsystem_set_new_ai_class (int ship_num, char *subsystem, int new_ai_class)
 
void wing_load_squad_bitmap (wing *w)
 
bool ship_has_dock_bay (int shipnum)
 
bool ship_useful_for_departure (int shipnum, int path_mask)
 
int ship_get_ship_for_departure (int team)
 
bool ship_fighterbays_all_destroyed (ship *shipp)
 
bool ship_subsys_is_fighterbay (ship_subsys *ss)
 
bool ship_subsys_takes_damage (ship_subsys *ss)
 
void ship_do_submodel_rotation (ship *shipp, model_subsystem *psub, ship_subsys *pss)
 
int ship_has_energy_weapons (ship *shipp)
 
int ship_has_engine_power (ship *shipp)
 
int ship_starting_wing_lookup (const char *wing_name)
 
int ship_squadron_wing_lookup (const char *wing_name)
 
int ship_tvt_wing_lookup (const char *wing_name)
 
int ship_class_get_priority (int ship_class)
 
int ship_class_compare (int ship_class_1, int ship_class_2)
 
int damage_type_get_idx (char *name)
 
int damage_type_add (char *name)
 
int piercing_type_get (char *str)
 
int difficulty_scale_type_get (char *str)
 
int armor_type_constants_get (char *str)
 
int calculation_type_get (char *str)
 
int armor_type_get_idx (char *name)
 
void parse_armor_type ()
 
void armor_parse_table (const char *filename)
 
void armor_init ()
 
void parse_ai_target_priorities ()
 
ai_target_priority init_ai_target_priorities ()
 
void parse_weapon_targeting_priorities ()
 
void init_path_metadata (path_metadata &metadata)
 
int ship_get_sound (object *objp, GameSoundsIndex id)
 Returns a ship-specific sound index. More...
 
bool ship_has_sound (object *objp, GameSoundsIndex id)
 Specifies if a ship has a custom sound for the specified id. More...
 
int get_nearest_bbox_point (object *ship_objp, vec3d *start, vec3d *box_pt)
 
void ship_set_thruster_info (mst_info *mst, object *obj, ship *shipp, ship_info *sip)
 
void ship_render_batch_thrusters (object *obj)
 
void ship_render_weapon_models (model_render_params *ship_render_info, draw_list *scene, object *obj, int render_flags)
 
int ship_render_get_insignia (object *obj, ship *shipp)
 
void ship_render_set_animated_effect (model_render_params *render_info, ship *shipp, uint *render_flags)
 
void ship_render (object *obj, draw_list *scene)
 

Variables

ship_subsys ship_subsys_free_list
 
bool splodeing
 
float splode_level
 
int splodeingtexture
 
int Cmdline_nohtl
 
int Ai_render_debug_flag =0
 
int Ship_sphere_check = 0
 
int Ship_auto_repair = 1
 
int Num_wings = 0
 
int Num_reinforcements = 0
 
ship Ships [MAX_SHIPS]
 
shipPlayer_ship
 
intPlayer_cockpit_textures
 
SCP_vector< cockpit_displayPlayer_displays
 
wing Wings [MAX_WINGS]
 
int ships_inited = 0
 
int armor_inited = 0
 
int Starting_wings [MAX_STARTING_WINGS]
 
int Squadron_wings [MAX_SQUADRON_WINGS]
 
int TVT_wings [MAX_TVT_WINGS]
 
char Starting_wing_names [MAX_STARTING_WINGS][NAME_LENGTH]
 
char Squadron_wing_names [MAX_SQUADRON_WINGS][NAME_LENGTH]
 
char TVT_wing_names [MAX_TVT_WINGS][NAME_LENGTH]
 
SCP_vector< engine_wash_infoEngine_wash_info
 
SCP_vector< exited_shipShips_exited
 
int Num_engine_wash_types
 
int Num_ship_subobj_types
 
int Num_ship_subobjects
 
int Player_ship_class
 
ship_obj Ship_objs [MAX_SHIP_OBJS]
 
ship_obj Ship_obj_list
 
SCP_vector< ship_infoShip_info
 
reinforcements Reinforcements [MAX_REINFORCEMENTS]
 
SCP_vector< ship_infoShip_templates
 
SCP_vector< ship_type_infoShip_types
 
SCP_vector< ArmorTypeArmor_types
 
SCP_vector< DamageTypeStructDamage_types
 
flag_def_list Armor_flags []
 
const int Num_armor_flags = sizeof(Armor_flags)/sizeof(flag_def_list)
 
flag_def_list Man_types []
 
const int Num_man_types = sizeof(Man_types)/sizeof(flag_def_list)
 
flag_def_list Player_orders []
 
const int Num_player_orders = sizeof(Player_orders)/sizeof(flag_def_list)
 
flag_def_list Subsystem_flags []
 
const int Num_subsystem_flags = sizeof(Subsystem_flags)/sizeof(flag_def_list)
 
flag_def_list Ship_flags []
 
const int Num_ship_flags = sizeof(Ship_flags) / sizeof(flag_def_list)
 
flag_def_list ai_tgt_objects []
 
const int num_ai_tgt_objects = sizeof(ai_tgt_objects) / sizeof(flag_def_list)
 
flag_def_list ai_tgt_obj_flags []
 
const int num_ai_tgt_obj_flags = sizeof(ai_tgt_obj_flags) / sizeof(flag_def_list)
 
flag_def_list ai_tgt_ship_flags []
 
const int num_ai_tgt_ship_flags = sizeof(ai_tgt_ship_flags) / sizeof(flag_def_list)
 
flag_def_list ai_tgt_weapon_flags []
 
ship_flag_name Ship_flag_names []
 
const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list)
 
SCP_vector< ai_target_priorityAi_tp_list
 
SCP_vector< ship_countsShip_type_counts
 
SCP_vector< ship_effectShip_effects
 
int ship_render_mode = MODEL_RENDER_ALL
 
char * Warp_types []
 
int Num_warp_types = sizeof(Warp_types)/sizeof(char*)
 
char * Lightning_types []
 
int Num_lightning_types = sizeof(Lightning_types)/sizeof(char*)
 
int ship_show_velocity_dot = 0
 
int Man_thruster_reset_timestamp = 0
 
int Ship_shadows = 0
 
int Show_shield_hits = 0
 
int Show_tnorms = 0
 
int Show_paths = 0
 
int Show_fpaths = 0
 
SCP_vector< man_thruster_rendererMan_thrusters
 
geometry_batcher fx_batcher
 
bool Rendering_to_shadow_map
 
float Decay_rate = 1.0f / 120.0f
 
float min_lethality = 0.0f
 
int Ship_subsys_hwm = 0
 
float t_rad = 0.5f
 
float t_len = 10.0f
 
float t_vel = 0.2f
 
float t_min = 150.0f
 
float t_max = 300.0f
 
int tracers [MAX_SHIPS][4][4]
 
int CLOAKMAP =-1
 
float artillery_dist = 10.0f
 
flag_def_list PiercingTypes []
 
const int Num_piercing_effect_types = sizeof(PiercingTypes)/sizeof(flag_def_list)
 
flag_def_list DifficultyScaleTypes []
 
const int Num_difficulty_scale_types = sizeof(DifficultyScaleTypes)/sizeof(flag_def_list)
 
flag_def_list ArmorTypeConstants []
 
const int Num_armor_type_constants = sizeof(ArmorTypeConstants)/sizeof(flag_def_list)
 
char * TypeNames []
 
float TypeDefaultValues []
 
const int Num_armor_calculation_types = sizeof(TypeNames)/sizeof(char*)
 

Macro Definition Documentation

#define ASK_HELP_HULL_PERCENT   0.3

Definition at line 15630 of file ship.cpp.

#define ASK_HELP_SHIELD_PERCENT   0.1

Definition at line 15629 of file ship.cpp.

#define AT_NUM_STORAGE_LOCATIONS   8

Definition at line 17869 of file ship.cpp.

#define AT_TYPE_ADDITIVE   0

Definition at line 17852 of file ship.cpp.

#define AT_TYPE_CAP   8

Definition at line 17861 of file ship.cpp.

#define AT_TYPE_CUTOFF   4

Definition at line 17856 of file ship.cpp.

#define AT_TYPE_EXPONENTIAL   2

Definition at line 17854 of file ship.cpp.

#define AT_TYPE_EXPONENTIAL_BASE   3

Definition at line 17855 of file ship.cpp.

#define AT_TYPE_INSTANT_CAP   9

Definition at line 17862 of file ship.cpp.

#define AT_TYPE_INSTANT_CUTOFF   6

Definition at line 17858 of file ship.cpp.

#define AT_TYPE_INSTANT_REVERSE_CUTOFF   7

Definition at line 17859 of file ship.cpp.

#define AT_TYPE_LOAD   12

Definition at line 17865 of file ship.cpp.

#define AT_TYPE_MULTIPLICATIVE   1

Definition at line 17853 of file ship.cpp.

#define AT_TYPE_RANDOM   13

Definition at line 17866 of file ship.cpp.

#define AT_TYPE_REVERSE_CUTOFF   5

Definition at line 17857 of file ship.cpp.

#define AT_TYPE_SET   10

Definition at line 17863 of file ship.cpp.

#define AT_TYPE_STORE   11

Definition at line 17864 of file ship.cpp.

#define AWACS_HELP_HULL_HI   0.75

Definition at line 15631 of file ship.cpp.

#define AWACS_HELP_HULL_LOW   0.25

Definition at line 15632 of file ship.cpp.

#define CHECK_THEN_COPY (   attribute)
Value:
do {\
if (other.attribute != NULL)\
attribute = vm_strdup( other.attribute );\
} while(false)
#define vm_strdup(ptr)
Definition: pstypes.h:549
if(aifft_max_checks<=0)
Definition: aiturret.cpp:1581

Definition at line 664 of file ship.cpp.

#define CHECK_THEN_FREE (   attribute)
Value:
do {\
if (attribute != NULL) {\
vm_free(attribute);\
attribute = NULL;\
}\
} while(false)
#define vm_free(ptr)
Definition: pstypes.h:548
if(aifft_max_checks<=0)
Definition: aiturret.cpp:1581

Definition at line 1256 of file ship.cpp.

#define CLEAR_ARTILLERY_AND_CONTINUE ( )    { if(aip != NULL){ aip->artillery_objnum = -1; aip->artillery_sig = -1; aip->artillery_lock_time = 0.0f;} continue; }

Definition at line 17139 of file ship.cpp.

#define DEFAULT_DELTA_BANK_CONST   0.5f

Definition at line 662 of file ship.cpp.

#define HULL_REPAIR_RATE   0.15f

Definition at line 13528 of file ship.cpp.

#define MAX_SHIP_OBJS   MAX_SHIPS

Definition at line 160 of file ship.cpp.

#define MAX_SUBSYS_ATTACKERS   3

Definition at line 13277 of file ship.cpp.

#define NUM_SHIP_SUBSYSTEM_SETS   20

Definition at line 87 of file ship.cpp.

#define NUM_SHIP_SUBSYSTEMS_PER_SET   200

Definition at line 90 of file ship.cpp.

#define PAGE_OUT_TEXTURE (   x)
Value:
{ \
if ( (x) >= 0 ) { \
if (release) { \
bm_release( (x) ); \
(x) = -1; \
} else { \
bm_unload( (x) ); \
} \
} \
}
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
if(aifft_max_checks<=0)
Definition: aiturret.cpp:1581
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info.
Definition: bmpman.cpp:2890

Definition at line 16697 of file ship.cpp.

#define PLAYER_CHECK_WARN_INTERVAL   300

Definition at line 15453 of file ship.cpp.

#define PLAYER_DEATH_DELTA_TIME   5000

Definition at line 8860 of file ship.cpp.

#define PLAYER_DISTANCE_MAX_WARNINGS   3

Definition at line 8857 of file ship.cpp.

#define PLAYER_LOW_AMMO_MSG_INTERVAL   250000

Definition at line 15829 of file ship.cpp.

#define PLAYER_MAX_DIST_END   750000

Definition at line 8858 of file ship.cpp.

#define PLAYER_MAX_DIST_WARNING   700000

Definition at line 8856 of file ship.cpp.

#define PLAYER_MAX_LOW_AMMO_MSGS   5

Definition at line 15831 of file ship.cpp.

#define PLAYER_MAX_WARN_DIST   1000

Definition at line 15455 of file ship.cpp.

#define PLAYER_MIN_WARN_DIST   100

Definition at line 15454 of file ship.cpp.

#define PLAYER_REQUEST_REPAIR_MSG_INTERVAL   240000

Definition at line 15830 of file ship.cpp.

#define PLAYER_WARN_DELTA_TIME   10000

Definition at line 8859 of file ship.cpp.

#define REARM_NUM_BALLISTIC_PRIMARIES_PER_BATCH   100

Definition at line 13532 of file ship.cpp.

#define REARM_NUM_MISSILES_PER_BATCH   4

Definition at line 13531 of file ship.cpp.

#define SHIELD_REPAIR_RATE   0.20f

Definition at line 13527 of file ship.cpp.

#define SHIP_MULTITEXT_LENGTH   4096

Definition at line 661 of file ship.cpp.

#define SHIP_OBJ_USED   (1<<0)

Definition at line 159 of file ship.cpp.

#define SHIP_REPAIR_SUBSYSTEM_RATE   0.01f

Definition at line 8761 of file ship.cpp.

#define SHIP_REPAIR_SUBSYSTEM_RATE   0.01f

Definition at line 8761 of file ship.cpp.

#define SUBSYS_REPAIR_RATE   0.10f

Definition at line 13529 of file ship.cpp.

#define SUBSYS_REPAIR_THRESHOLD   0.1

Definition at line 8762 of file ship.cpp.

Function Documentation

void ai_maybe_announce_shockwave_weapon ( object firing_objp,
int  weapon_index 
)

Definition at line 5939 of file aicode.cpp.

void armor_init ( )

Definition at line 18394 of file ship.cpp.

void armor_parse_table ( const char *  filename)

Definition at line 18367 of file ship.cpp.

int armor_type_constants_get ( char *  str)

Definition at line 17833 of file ship.cpp.

int armor_type_get_idx ( char *  name)

Definition at line 18332 of file ship.cpp.

void awacs_maybe_ask_for_help ( ship sp,
int  multi_team_filter 
)

Definition at line 15635 of file ship.cpp.

void batch_render_man_thrusters ( )

Batch renders all maneuvering thrusters in the array.

It also clears the array every 10 seconds to keep mem usage down.

Definition at line 6668 of file ship.cpp.

int bitmask_2_bitnum ( int  num)

Definition at line 15178 of file ship.cpp.

int calculation_type_get ( char *  str)

Definition at line 17911 of file ship.cpp.

void change_ship_type ( int  n,
int  ship_type,
int  by_sexp 
)

Change the ship class on a ship, and changing all required information for consistency (ie textures, subsystems, weapons, physics)

Parameters
nindex of ship in Ships[] array
ship_typeship class (index into Ship_info vector)
by_sexpSEXP reference

Definition at line 9983 of file ship.cpp.

int check_world_pt_in_expanded_ship_bbox ( vec3d world_pt,
object objp,
float  delta_box 
)

Checks if a world point is inside the extended bounding box of a ship

May not work if delta box is large and negative (ie, adjusted box crosses over on itself - min > max)

Definition at line 17241 of file ship.cpp.

void compute_slew_matrix ( matrix orient,
angles a 
)

Modify the matrix orient by the slew angles a.

Definition at line 6546 of file ship.cpp.

int damage_type_add ( char *  name)

Either loads a new damage type, or returns the index of one with the same name as given

Definition at line 17749 of file ship.cpp.

int damage_type_get_idx ( char *  name)

Gives the index into the Damage_types[] vector of a specified damage type name

Returns
-1 if not found

Definition at line 17734 of file ship.cpp.

DCF ( t_rad  ,
"Sets weapon tracer radius"   
)

Definition at line 10609 of file ship.cpp.

DCF ( t_len  ,
"Sets weapon tracer length  
)

Definition at line 10618 of file ship.cpp.

DCF ( t_vel  ,
"Sets weapon tracer velocity"   
)

Definition at line 10627 of file ship.cpp.

DCF ( set_shield  ,
"Change player ship shield strength"   
)

Debug console function to set the shield for the player ship

Definition at line 14297 of file ship.cpp.

DCF ( set_hull  ,
"Change player ship hull strength"   
)

Debug console function to set the hull for the player ship

Definition at line 14323 of file ship.cpp.

DCF ( set_subsys  ,
"Set the strength of a particular subsystem on player ship  
)

Debug console function to set the strength of a particular subsystem

Definition at line 14349 of file ship.cpp.

DCF ( art  ,
"Sets artillery disance"   
)

Definition at line 17141 of file ship.cpp.

int difficulty_scale_type_get ( char *  str)

Definition at line 17811 of file ship.cpp.

void do_dying_undock_physics ( object dying_objp,
ship dying_shipp 
)

Only ever called once for any ship that dies

This function relies on the "dead dock" list, which replaces the dock_objnum_when_dead used in retail.

Definition at line 8037 of file ship.cpp.

void engine_wash_info_init ( engine_wash_info ewi)

Definition at line 534 of file ship.cpp.

void fs2netd_add_table_validation ( const char *  tblname)

Definition at line 1554 of file fs2netd_client.cpp.

int get_available_primary_weapons ( object objp,
int outlist,
int outbanklist 
)

Definition at line 12641 of file ship.cpp.

int get_available_secondary_weapons ( object objp,
int outlist,
int outbanklist 
)

Stuff list of weapon indices for object *objp in list *outlist.

Returns
number of weapons in list.

Definition at line 12667 of file ship.cpp.

int get_default_player_ship_index ( )

Returns the index of the default player ship.

Returns
An index into Ship_info[], location of the default player ship.

Definition at line 4862 of file ship.cpp.

engine_wash_info * get_engine_wash_pointer ( char *  engine_wash_name)

Definition at line 4577 of file ship.cpp.

int get_max_ammo_count_for_bank ( int  ship_class,
int  bank,
int  ammo_type 
)

Determine the number of secondary ammo units (missile/bomb) allowed max for a ship

Definition at line 16279 of file ship.cpp.

int get_max_ammo_count_for_primary_bank ( int  ship_class,
int  bank,
int  ammo_type 
)

Determine the number of primary ammo units allowed max for a ship

Definition at line 16262 of file ship.cpp.

int get_max_ammo_count_for_turret_bank ( ship_weapon swp,
int  bank,
int  ammo_type 
)

The same as above, but for a specific turret's bank.

Definition at line 16299 of file ship.cpp.

int get_nearest_bbox_point ( object ship_objp,
vec3d start,
vec3d box_pt 
)

Given a ship with bounding box and a point, find the closest point on the bbox

Parameters
ship_objpObject that has the bounding box (should be a ship)
startWorld position of the point being compared
box_ptOUTPUT PARAMETER: closest point on the bbox to start
Returns
point is inside bbox, TRUE/1
point is outside bbox, FALSE/0

Definition at line 18664 of file ship.cpp.

ship_obj* get_ship_obj_ptr_from_index ( int  index)

Definition at line 513 of file ship.cpp.

vec3d get_submodel_offset ( int  model,
int  submodel 
)

Definition at line 5489 of file ship.cpp.

int get_subsystem_pos ( vec3d pos,
object objp,
ship_subsys subsysp 
)

Definition at line 12975 of file ship.cpp.

ai_target_priority init_ai_target_priorities ( )

Definition at line 18528 of file ship.cpp.

void init_path_metadata ( path_metadata metadata)

Definition at line 18607 of file ship.cpp.

int is_support_allowed ( object objp,
bool  do_simple_check 
)

Definition at line 16749 of file ship.cpp.

void lethality_decay ( ai_info aip)

Definition at line 9106 of file ship.cpp.

int lightningtype_match ( char *  p)

Definition at line 648 of file ship.cpp.

man_thruster_renderer* man_thruster_get_slot ( int  bmap_frame)

Looks for a free slot in the man_thruster batch rendering array. Or, it returns a slot with the same bitmap ID as the maneuvering thruster.

You could actually batch render anything that uses a simple bitmap on a single poly with this system...just plug the bitmap into bmap_frame and use as a normal batcher.

Once calling this function, use man_batcher.allocate_add() to allocate or it will crash later. Then call man_batcher.draw*()

Definition at line 6705 of file ship.cpp.

int maybe_detonate_weapon ( ship_weapon swp,
object src 
)

Attempt to detonate weapon last fired by *src. Only used for weapons that support remote detonation.

Parameters
swpShip weapon
srcSource of weapon
Returns
true if detonated, else return false.
 Calls ::weapon_hit(), indirectly via ::weapon_detonate(), to detonate weapon.
 If it's a weapon that spawns particles, those will be released.

Definition at line 11680 of file ship.cpp.

void object_jettison_cargo ( object objp,
object cargo_objp 
)

Forcible jettison cargo from a ship

Definition at line 16911 of file ship.cpp.

void observer_process_post ( object objp)

Definition at line 8947 of file ship.cpp.

void parse_ai_target_priorities ( )

Definition at line 18408 of file ship.cpp.

void parse_allowed_weapons ( ship_info sip,
const bool  is_primary,
const bool  is_dogfight,
const bool  first_time 
)

Definition at line 1987 of file ship.cpp.

int parse_and_add_briefing_icon_info ( )

Common method for parsing briefing icon info.

Definition at line 2103 of file ship.cpp.

void parse_armor_type ( )

Definition at line 18346 of file ship.cpp.

void parse_engine_wash ( bool  replace)

Parse an engine wash info record

Definition at line 546 of file ship.cpp.

int parse_ship ( const char *  filename,
bool  replace 
)

Parse the information for a specific ship type.

Definition at line 1688 of file ship.cpp.

void parse_ship_particle_effect ( ship_info sip,
particle_effect pe,
char *  id_string 
)

Definition at line 1884 of file ship.cpp.

void parse_ship_sound ( char *  name,
GameSoundsIndex  id,
ship_info sip 
)

Definition at line 1843 of file ship.cpp.

void parse_ship_sounds ( ship_info sip)

Definition at line 1855 of file ship.cpp.

int parse_ship_template ( )

Parse the information for a specific ship type template.

Definition at line 1788 of file ship.cpp.

void parse_ship_type ( )

Definition at line 4591 of file ship.cpp.

int parse_ship_values ( ship_info sip,
const bool  is_template,
const bool  first_time,
const bool  replace 
)

Puts values into a ship_info.

Definition at line 2148 of file ship.cpp.

void parse_shiptbl ( const char *  filename)

Definition at line 4910 of file ship.cpp.

void parse_shiptype_tbl ( const char *  filename)

Definition at line 4816 of file ship.cpp.

void parse_weapon_bank ( ship_info sip,
bool  is_primary,
int num_banks,
int bank_default_weapons,
int bank_capacities 
)

Common method for parsing ship/subsystem primary/secondary weapons so that the parser doesn't flip out in the event of a problem.

Definition at line 2056 of file ship.cpp.

void parse_weapon_targeting_priorities ( )

Definition at line 18548 of file ship.cpp.

void physics_ship_init ( object objp)

Definition at line 5366 of file ship.cpp.

int piercing_type_get ( char *  str)

Definition at line 17789 of file ship.cpp.

int primary_out_of_ammo ( ship_weapon swp,
int  bank 
)

Definition at line 12291 of file ship.cpp.

void render_dock_bays ( object objp)

Render docking information, NOT while in object's reference frame.

Definition at line 6571 of file ship.cpp.

void render_path_points ( object objp)

Definition at line 6230 of file aicode.cpp.

void ship_actually_depart ( int  shipnum,
int  method 
)

Used to actually remove a ship, plus all the ships it's docked to, from the mission

Definition at line 7748 of file ship.cpp.

void ship_actually_depart_helper ( object objp,
dock_function_info infop 
)

Definition at line 7733 of file ship.cpp.

void ship_add_cockpit_display ( cockpit_display_info display,
int  cockpit_model_num 
)

Definition at line 7409 of file ship.cpp.

void ship_add_exited_ship ( ship sp,
int  reason 
)

Add a ship onto the exited ships list.

The reason parameter tells us why the ship left the mission (i.e. departed or destroyed)

Definition at line 5298 of file ship.cpp.

void ship_add_ship_type_count ( int  ship_info_index,
int  num 
)

Definition at line 14449 of file ship.cpp.

void ship_add_ship_type_kill_count ( int  ship_info_index)

Definition at line 14462 of file ship.cpp.

void ship_assign_sound ( ship sp)

Assign object-linked sound to a particular ship

Definition at line 14191 of file ship.cpp.

void ship_assign_sound_all ( )

Assign object-linked sounds to all ships currently in the obj_used_list

Definition at line 14263 of file ship.cpp.

void ship_auto_repair_frame ( int  shipnum,
float  frametime 
)

Definition at line 8763 of file ship.cpp.

void ship_blow_up_area_apply_blast ( object exp_objp)

Applies damage to ship close to others when a ship dies and blows up

Parameters
exp_objpship object pointers

Definition at line 7926 of file ship.cpp.

float ship_calculate_rearm_duration ( object objp)

Calculates approximate time in seconds it would take to rearm and repair object.

Definition at line 13537 of file ship.cpp.

void ship_chase_shield_energy_targets ( ship shipp,
object obj,
float  frametime 
)

Definition at line 8461 of file ship.cpp.

int ship_check_collision_fast ( object obj,
object other_obj,
vec3d hitpos 
)

Faster version of ship_check_collision that does not do checking at the polygon level. Just checks to see if a vector will intersect a sphere.

Definition at line 9521 of file ship.cpp.

void ship_check_player_distance ( )

Definition at line 8923 of file ship.cpp.

void ship_check_player_distance_sub ( player p,
int  multi_target = -1 
)

Definition at line 8862 of file ship.cpp.

int ship_class_compare ( int  ship_class_1,
int  ship_class_2 
)

Definition at line 17715 of file ship.cpp.

float ship_class_get_length ( ship_info sip)

Return the length of a ship

Definition at line 17354 of file ship.cpp.

int ship_class_get_priority ( int  ship_class)

Definition at line 17672 of file ship.cpp.

int ship_class_query_general_type ( int  ship_class)

Definition at line 14485 of file ship.cpp.

void ship_cleanup ( int  shipnum,
int  cleanup_mode 
)

Merge ship_destroyed and ship_departed and ship_vanished

Definition at line 7786 of file ship.cpp.

void ship_clear_cockpit_displays ( )

Definition at line 7385 of file ship.cpp.

void ship_clear_ship_type_counts ( )

Definition at line 14436 of file ship.cpp.

void ship_close ( )

Definition at line 14146 of file ship.cpp.

void ship_copy_subsystem_fixup ( ship_info sip)

Fixup the model subsystem information for this ship pointer. Needed when ships share the same model.

Definition at line 6121 of file ship.cpp.

int ship_create ( matrix orient,
vec3d pos,
int  ship_type,
char *  ship_name 
)

Returns object index of ship.

Returns
-1 means failed.

Definition at line 9690 of file ship.cpp.

void ship_delete ( object obj)

Definition at line 7585 of file ship.cpp.

void ship_destroy_instantly ( object ship_objp,
int  shipnum 
)

Definition at line 7761 of file ship.cpp.

void ship_do_cap_subsys_cargo_hidden ( ship shipp,
ship_subsys subsys,
int  from_network 
)

Definition at line 16210 of file ship.cpp.

void ship_do_cap_subsys_cargo_revealed ( ship shipp,
ship_subsys subsys,
int  from_network 
)

Definition at line 16161 of file ship.cpp.

void ship_do_cargo_hidden ( ship shipp,
int  from_network 
)

alled when the cargo of a ship is hidden by the sexp.

Need to send stuff to clients in multiplayer game.

Definition at line 16190 of file ship.cpp.

void ship_do_cargo_revealed ( ship shipp,
int  from_network 
)

Called when the cargo of a ship is revealed.

Happens at two different locations (at least when this function was written), one for the player, and one for AI ships. Need to send stuff to clients in multiplayer game.

Definition at line 16138 of file ship.cpp.

int ship_do_rearm_frame ( object objp,
float  frametime 
)

Definition at line 13664 of file ship.cpp.

void ship_do_submodel_rotation ( ship shipp,
model_subsystem psub,
ship_subsys pss 
)

Definition at line 17553 of file ship.cpp.

void ship_do_thruster_frame ( ship shipp,
object objp,
float  frametime 
)

Figure out which thruster bitmap will get rendered next time around.

ship_render() needs to have shipp->thruster_bitmap set to a valid bitmap number, or -1 if we shouldn't render thrusters.

Definition at line 8567 of file ship.cpp.

void ship_do_weapon_thruster_frame ( weapon weaponp,
object objp,
float  frametime 
)

Figure out which thruster bitmap will get rendered next time around.

ship_render needs to have shipp->thruster_bitmap set to a valid bitmap number, or -1 if we shouldn't render thrusters.

This does basically the same thing as ship_do_thruster_frame, except it operates on a weapon. This is in the ship code because it needs the same thruster animation info as the ship stuff, and I would rather extern this one function than all the thruster animation stuff.

Definition at line 8680 of file ship.cpp.

int ship_docking_valid ( int  docker,
int  dockee 
)

Returns true

Definition at line 14494 of file ship.cpp.

int ship_dumbfire_threat ( ship sp)

Definition at line 15078 of file ship.cpp.

void ship_dying_frame ( object objp,
int  ship_num 
)

Do the stuff we do in a frame for a ship that's in its death throes.

Definition at line 8101 of file ship.cpp.

void ship_end_render_cockpit_display ( int  cockpit_display_num)

Definition at line 7539 of file ship.cpp.

int ship_engine_ok_to_warp ( ship sp)

Definition at line 14783 of file ship.cpp.

int ship_explode_area_calc_damage ( vec3d pos1,
vec3d pos2,
float  inner_rad,
float  outer_rad,
float  max_damage,
float  max_blast,
float damage,
float blast 
)

Calculates the blast and damage applied to a ship from another ship blowing up.

Parameters
pos1ship explosion position
pos2other ship position
inner_raddistance from ship center for which full damage is applied
outer_raddistance from ship center for which no damage is applied
max_damagemaximum damage applied
max_blastmaximum impulse applied from blast
damagedamage applied
blastimpulse applied from blast

Definition at line 7895 of file ship.cpp.

bool ship_fighterbays_all_destroyed ( ship shipp)

Definition at line 17494 of file ship.cpp.

int ship_find_exited_ship_by_name ( char *  name)

Attempt to find information about an exited ship based on shipname

Definition at line 5338 of file ship.cpp.

int ship_find_exited_ship_by_signature ( int  signature)

Attempt to find information about an exited ship based on signature

Definition at line 5353 of file ship.cpp.

int ship_find_num_crewpoints ( object objp)

Finds the number of crew points in a ship

Definition at line 13128 of file ship.cpp.

int ship_find_num_turrets ( object objp)

Finds the number of turrets in a ship

Definition at line 13164 of file ship.cpp.

int ship_find_repair_ship ( object requester_obj,
object **  ship_we_found 
)

Definition at line 14008 of file ship.cpp.

void ship_find_warping_ship_helper ( object objp,
dock_function_info infop 
)

Definition at line 6632 of file ship.cpp.

int ship_fire_primary ( object obj,
int  stream_weapons,
int  force 
)

Definition at line 10760 of file ship.cpp.

int ship_fire_primary_debug ( object objp)

Fire the debug laser

Definition at line 10386 of file ship.cpp.

int ship_fire_secondary ( object obj,
int  allow_swarm 
)

Definition at line 11799 of file ship.cpp.

int ship_fire_secondary_detonate ( object obj,
ship_weapon swp 
)

Maybe detonate secondary weapon that's already out.

Returns
Return true if we detonate it, false if not.

Definition at line 11729 of file ship.cpp.

void ship_fire_tracer ( int  weapon_objnum)

Definition at line 10647 of file ship.cpp.

ship_subsys* ship_get_best_subsys_to_attack ( ship sp,
int  subsys_type,
vec3d attacker_pos 
)

Definition at line 13278 of file ship.cpp.

int ship_get_by_signature ( int  signature)

Definition at line 16106 of file ship.cpp.

ship_subsys* ship_get_closest_subsys_in_sight ( ship sp,
int  subsys_type,
vec3d attacker_pos 
)

Definition at line 14963 of file ship.cpp.

int ship_get_default_orders_accepted ( ship_info sip)

Set the orders allowed for a ship – based on ship type.

This value might get overridden by a value in the mission file.

Definition at line 5480 of file ship.cpp.

float ship_get_exp_damage ( object objp)

Definition at line 16949 of file ship.cpp.

float ship_get_exp_outer_rad ( object ship_objp)

Definition at line 16970 of file ship.cpp.

int ship_get_exp_propagates ( ship sp)

Definition at line 16965 of file ship.cpp.

void ship_get_eye ( vec3d eye_pos,
matrix eye_orient,
object obj,
bool  do_slew,
bool  from_origin 
)

Definition at line 13227 of file ship.cpp.

int ship_get_index_from_subsys ( ship_subsys ssp,
int  objnum,
int  error_bypass 
)

Given a pointer to a subsystem and an associated object, return the index.

Definition at line 13390 of file ship.cpp.

ship_subsys* ship_get_indexed_subsys ( ship sp,
int  index,
vec3d attacker_pos 
)

Definition at line 13340 of file ship.cpp.

float ship_get_max_speed ( ship shipp)

Get maximum ship speed (when not warping in or out)

Definition at line 17279 of file ship.cpp.

int ship_get_num_ships ( )

Return number of ships in the game.

Definition at line 522 of file ship.cpp.

int ship_get_num_subsys ( ship shipp)

Definition at line 17046 of file ship.cpp.

int ship_get_random_player_wing_ship ( int  flags,
float  max_dist,
int  persona_index,
int  get_first,
int  multi_team 
)

Definition at line 14508 of file ship.cpp.

int ship_get_random_ship_in_wing ( int  wingnum,
int  flags,
float  max_dist,
int  get_first 
)

Definition at line 14623 of file ship.cpp.

int ship_get_random_targetable_ship ( )

Definition at line 16876 of file ship.cpp.

int ship_get_random_team_ship ( int  team_mask,
int  flags,
float  max_dist 
)

Definition at line 14682 of file ship.cpp.

int ship_get_reinforcement_team ( int  r_index)

Get the team of a reinforcement item

Definition at line 17090 of file ship.cpp.

float ship_get_secondary_weapon_range ( ship shipp)

Return the range of the currently selected secondary weapon

NOTE: If there is no missiles left in the current bank, range returned is 0

Parameters
shippPointer to ship from which currently selected secondary weapon will be ranged

Definition at line 16238 of file ship.cpp.

int ship_get_ship_for_departure ( int  team)

Definition at line 17477 of file ship.cpp.

int ship_get_SIF ( ship shipp)

Definition at line 16096 of file ship.cpp.

int ship_get_SIF ( int  sh)

Definition at line 16101 of file ship.cpp.

int ship_get_sound ( object objp,
GameSoundsIndex  id 
)

Returns a ship-specific sound index.

Parameters
objpAn object pointer. Has to be of type OBJ_SHIP
idA sound id as defined in gamsesnd.h. If the given id is unknown then the game_snd with the id as index is returned.
Returns
An index into the Snds vector, if the specified index could not be found then the id itself will be returned

Definition at line 18614 of file ship.cpp.

int ship_get_subobj_model_num ( ship_info sip,
char *  subobj_name 
)

Definition at line 18597 of file ship.cpp.

ship_subsys* ship_get_subsys ( ship shipp,
char *  subsys_name 
)

Definition at line 17024 of file ship.cpp.

int ship_get_subsys_index ( ship sp,
char *  ss_name,
int  error_bypass 
)

Returns the index number of the ship_subsys parameter

Definition at line 13421 of file ship.cpp.

float ship_get_subsystem_strength ( ship shipp,
int  type 
)

Definition at line 13446 of file ship.cpp.

int ship_get_texture ( int  bitmap)

Determine if the given texture is used by a ship type. return ship info index, or -1 if not used by a ship

Definition at line 17125 of file ship.cpp.

int ship_get_turret_type ( ship_subsys subsys)

Determine turret status of a given subsystem

Returns
0 for no turret, 1 for "fixed turret", 2 for "rotating" turret

Definition at line 17008 of file ship.cpp.

int ship_get_type ( char *  output,
ship_info sip 
)

Get the type of the given ship as a string

Definition at line 5464 of file ship.cpp.

ship_type_info* ship_get_type_info ( object objp)

Definition at line 16121 of file ship.cpp.

float ship_get_warpout_speed ( object objp)

Determine warpout speed of ship

Definition at line 17306 of file ship.cpp.

bool ship_has_dock_bay ( int  shipnum)

Definition at line 17435 of file ship.cpp.

int ship_has_energy_weapons ( ship shipp)

Definition at line 17611 of file ship.cpp.

int ship_has_engine_power ( ship shipp)

Definition at line 17618 of file ship.cpp.

int ship_has_homing_missile_locked ( ship shipp)

Definition at line 15092 of file ship.cpp.

bool ship_has_sound ( object objp,
GameSoundsIndex  id 
)

Specifies if a ship has a custom sound for the specified id.

Parameters
objpAn object pointer. Has to be of type OBJ_SHIP
idA sound id as defined in gamsesnd.h
Returns
True if this object has the specified sound, false otherwise

Definition at line 18636 of file ship.cpp.

int ship_in_my_squadron ( ship shipp)

If the given ship is in my squadron wings

Definition at line 428 of file ship.cpp.

int ship_info_lookup ( const char *  token)

Definition at line 12772 of file ship.cpp.

int ship_info_lookup_sub ( const char *  token)

Return the index of Ship_info[].name that is *token.

Definition at line 12749 of file ship.cpp.

void ship_init ( )

Called once at the beginning of the game to parse ships.tbl and stuff the Ship_info vector

Definition at line 5086 of file ship.cpp.

void ship_init_afterburners ( ship shipp)

Definition at line 9624 of file ship.cpp.

void ship_init_cockpit_displays ( ship shipp)

Definition at line 7349 of file ship.cpp.

void ship_init_thrusters ( )

Loads the animations for ship's afterburners

Definition at line 8530 of file ship.cpp.

int ship_is_beginning_warpout_speedup ( object objp)

Returns true if ship is beginning to speed up in warpout

Definition at line 17334 of file ship.cpp.

int ship_is_getting_locked ( ship shipp)

Definition at line 15129 of file ship.cpp.

int ship_is_tagged ( object objp)

Returns true when objp is ship and is tagged

Definition at line 17263 of file ship.cpp.

int ship_launch_countermeasure ( object objp,
int  rand_val 
)

Launch countermeasures from object *objp.

Parameters
objpobject from which to launch countermeasure
rand_valis used in multiplayer to ensure that all clients in the game fire countermeasure the same way

Definition at line 10421 of file ship.cpp.

void ship_level_init ( )

This will get called at the start of each level.

Definition at line 5226 of file ship.cpp.

int ship_lock_threat ( ship sp)

Definition at line 15163 of file ship.cpp.

void ship_make_create_time_unique ( ship shipp)

Ensure create time for ship is unique

Definition at line 9550 of file ship.cpp.

void ship_maybe_ask_for_help ( ship sp)

Definition at line 15668 of file ship.cpp.

void ship_maybe_lament ( )

The player has just entered death roll, maybe have wingman mourn the loss of the player

Definition at line 15738 of file ship.cpp.

void ship_maybe_play_primary_fail_sound ( )

See if enough time has elapsed to play fail sound again

Definition at line 10524 of file ship.cpp.

int ship_maybe_play_secondary_fail_sound ( weapon_info wip)

See if enough time has elapsed to play secondary fail sound again

Definition at line 10550 of file ship.cpp.

void ship_maybe_praise_player ( ship deader_sp)

Definition at line 15532 of file ship.cpp.

void ship_maybe_praise_self ( ship deader_sp,
ship killer_sp 
)

Definition at line 15572 of file ship.cpp.

void ship_maybe_scream ( ship sp)

Ship has just died, maybe play a scream.

Definition at line 15789 of file ship.cpp.

void ship_maybe_tell_about_low_ammo ( ship sp)

This function is only for notifying the player that the ship's ammo is low, without necessarily requesting support (e.g. if support is disallowed for this mission). It is not called if support was successfully requested in maybe_request_support.

Definition at line 15837 of file ship.cpp.

void ship_maybe_tell_about_rearm ( ship sp)

Tell player that we've requested a support ship

Definition at line 15913 of file ship.cpp.

void ship_maybe_warn_player ( ship enemy_sp,
float  dist 
)

Definition at line 15457 of file ship.cpp.

void ship_model_change ( int  n,
int  ship_type 
)

Change the ship model for a ship to that for ship class 'ship_type'

Parameters
nindex of ship in Ships[] array
ship_typeship class (index into Ship_info vector)

Definition at line 9888 of file ship.cpp.

void ship_model_start ( object objp)

Definition at line 13012 of file ship.cpp.

void ship_model_stop ( object objp)

Clears all the instance specific stuff out of the model info

Definition at line 13059 of file ship.cpp.

void ship_model_update_instance ( object objp)

Like ship_model_start but fills submodel instances instead of the submodels themselves

Definition at line 13072 of file ship.cpp.

int ship_name_lookup ( const char *  name,
int  inc_players 
)

Return the ship index of the ship with name *name.

Definition at line 12900 of file ship.cpp.

int ship_navigation_ok_to_warp ( ship sp)

Definition at line 14809 of file ship.cpp.

int ship_obj_list_add ( int  objnum)

Function to add a node to the Ship_obj_list. Only called from ship_create()

Definition at line 465 of file ship.cpp.

void ship_obj_list_init ( )

Initialise Ship_obj_list

Definition at line 451 of file ship.cpp.

void ship_obj_list_rebuild ( )

Called from the save/restore code to re-create the Ship_obj_list

Definition at line 500 of file ship.cpp.

void ship_obj_list_remove ( int  index)

Function to remove a node from the Ship_obj_list. Only called from ship_delete()

Definition at line 490 of file ship.cpp.

void ship_obj_list_reset_slot ( int  index)

Set the ship_obj struct fields to default values

Definition at line 418 of file ship.cpp.

void ship_page_in ( )

Page in bitmaps for all the ships in this level

Definition at line 16318 of file ship.cpp.

void ship_page_in_textures ( int  ship_index)

Definition at line 16635 of file ship.cpp.

void ship_page_out_textures ( int  ship_index,
bool  release 
)

Unload all textures for a given ship

Definition at line 16711 of file ship.cpp.

void ship_parse_post_cleanup ( )

Clean up ship entries, making sure various flags and settings are correct

Definition at line 4983 of file ship.cpp.

int ship_primary_bank_has_ammo ( int  shipnum)

Definition at line 14764 of file ship.cpp.

void ship_primary_changed ( ship sp)

Definition at line 15996 of file ship.cpp.

void ship_process_post ( object obj,
float  frametime 
)

Player ship uses this code, but does a quick out after doing a few things.

When adding code to this function, decide whether or not a client in a multiplayer game needs to execute the code you are adding. Code which moves things, creates things, etc probably doesn't need to be called. If you don't know – find Allender!!!

Definition at line 9180 of file ship.cpp.

void ship_process_pre ( object objp,
float  frametime 
)

Definition at line 9128 of file ship.cpp.

void ship_process_targeting_lasers ( )

Definition at line 11611 of file ship.cpp.

float ship_quadrant_shield_strength ( object hit_objp,
vec3d hitpos 
)

Definition at line 15030 of file ship.cpp.

int ship_query_general_type ( int  ship)

Definition at line 14475 of file ship.cpp.

int ship_query_general_type ( ship shipp)

Definition at line 14480 of file ship.cpp.

int ship_query_state ( char *  name)

Definition at line 12945 of file ship.cpp.

void ship_radar_process ( object obj,
ship shipp,
ship_info sip 
)

Definition at line 9136 of file ship.cpp.

void ship_recalc_subsys_strength ( ship shipp)

Recalculates the overall strength of subsystems.

Needed because several places in FreeSpace change subsystem strength and all this data needs to be kept up to date.

Definition at line 6020 of file ship.cpp.

void ship_render ( object obj,
draw_list scene 
)

Definition at line 19003 of file ship.cpp.

void ship_render_batch_thrusters ( object obj)

Definition at line 18721 of file ship.cpp.

void ship_render_cockpit ( object objp)

Definition at line 7272 of file ship.cpp.

void ship_render_DEPRECATED ( object obj)

Definition at line 6733 of file ship.cpp.

int ship_render_get_insignia ( object obj,
ship shipp 
)

Definition at line 18937 of file ship.cpp.

void ship_render_set_animated_effect ( model_render_params render_info,
ship shipp,
uint render_flags 
)

Definition at line 18973 of file ship.cpp.

void ship_render_show_ship_cockpit ( object objp)

Definition at line 7322 of file ship.cpp.

void ship_render_weapon_models ( model_render_params ship_render_info,
draw_list scene,
object obj,
int  render_flags 
)

Definition at line 18852 of file ship.cpp.

void ship_reset_disabled_physics ( object objp,
int  ship_class 
)

Reset some physics info when ship's engines goes from disabled->enabled

Definition at line 8974 of file ship.cpp.

ship_subsys* ship_return_next_subsys ( ship shipp,
int  type,
vec3d attacker_pos 
)

Find a subsystem matching 'type' inside the ship, and that is not destroyed.

Returns
If cannot find one, return NULL.

Definition at line 14945 of file ship.cpp.

char* ship_return_orders ( char *  outbuf,
ship sp 
)

Definition at line 15201 of file ship.cpp.

int ship_return_subsys_path_normal ( ship shipp,
ship_subsys ss,
vec3d gsubpos,
vec3d norm 
)

Definition at line 14837 of file ship.cpp.

char* ship_return_time_to_goal ( char *  outbuf,
ship sp 
)

Definition at line 15294 of file ship.cpp.

void ship_scream ( ship sp)

Play a death scream for a ship

Definition at line 15757 of file ship.cpp.

int ship_secondary_bank_has_ammo ( int  shipnum)

Definition at line 14741 of file ship.cpp.

void ship_secondary_changed ( ship sp)

Definition at line 16053 of file ship.cpp.

int ship_select_next_primary ( object objp,
int  direction 
)

Return true if a new index gets selected.

Parameters
objppointer to object for ship cycling primary
directionforward == CYCLE_PRIMARY_NEXT, backward == CYCLE_PRIMARY_PREV

NOTE: This code can be called for any arbitrary ship. HUD messages and sounds are only used for the player ship.

Definition at line 12317 of file ship.cpp.

int ship_select_next_secondary ( object objp)

Definition at line 12550 of file ship.cpp.

int ship_select_next_valid_secondary_bank ( ship_weapon swp)

Try to switch to a secondary bank that has ammo

Note
: not currently used - mark for removal?

Definition at line 11762 of file ship.cpp.

void ship_set ( int  ship_index,
int  objnum,
int  ship_type 
)

Definition at line 5869 of file ship.cpp.

void ship_set_default_player_ship ( )

Definition at line 4877 of file ship.cpp.

void ship_set_default_weapons ( ship shipp,
ship_info sip 
)

Set the ship level weapons based on the information contained in the ship info.

Weapon assignments are checked against the model to ensure the models and the ship info weapon data are in synch.

Definition at line 9392 of file ship.cpp.

void ship_set_eye ( object obj,
int  eye_index 
)

Definition at line 13197 of file ship.cpp.

void ship_set_hud_cockpit_targets ( )

Definition at line 7479 of file ship.cpp.

void ship_set_new_ai_class ( int  ship_num,
int  new_ai_class 
)

Definition at line 17362 of file ship.cpp.

void ship_set_subsystem_strength ( ship shipp,
int  type,
float  strength 
)

Set the strength of a subsystem on a given ship.

The strength passed as a parameter is between 0.0 and 1.0

NOTE: this function was made to be called by the debug function dcf_set_subsys(). If you want to use this, be sure that you test it for all cases.

Definition at line 13500 of file ship.cpp.

void ship_set_thruster_info ( mst_info mst,
object obj,
ship shipp,
ship_info sip 
)

Definition at line 18684 of file ship.cpp.

void ship_set_warp_effects ( object objp,
ship_info sip 
)

Definition at line 5500 of file ship.cpp.

int ship_squadron_wing_lookup ( const char *  wing_name)

Definition at line 17636 of file ship.cpp.

int ship_start_render_cockpit_display ( int  cockpit_display_num)

Definition at line 7494 of file ship.cpp.

void ship_start_targeting_laser ( ship shipp)

Definition at line 11568 of file ship.cpp.

int ship_starting_wing_lookup ( const char *  wing_name)

Definition at line 17624 of file ship.cpp.

int ship_stop_fire_primary ( object obj)

Stuff to do when the ship has stoped fireing all primary weapons

Definition at line 10711 of file ship.cpp.

int ship_stop_fire_primary_bank ( object obj,
int  bank_to_stop 
)

Stops a single primary bank

Definition at line 10674 of file ship.cpp.

void ship_stop_targeting_laser ( ship shipp)

Definition at line 11605 of file ship.cpp.

int ship_subsys_disrupted ( ship_subsys ss)

Determine if a given subsystem is disrupted (ie inoperable)

Parameters
sspointer to ship subsystem
Returns
1 if subsystem is disrupted, 0 if subsystem is not disrupted

Definition at line 9033 of file ship.cpp.

int ship_subsys_disrupted ( ship sp,
int  type 
)

Determine if a given type of subsystem is disrupted (i.e. inoperable)

Parameters
sppointer to ship containing subsystem
typetype of subsystem (SUBSYSTEM_*)
Returns
1 if subsystem is disrupted, 0 if subsystem is not disrupted

Definition at line 9077 of file ship.cpp.

void ship_subsys_disrupted_check ( ship sp)

Clear/set the subsystem disrupted flags

Definition at line 8988 of file ship.cpp.

void ship_subsys_disrupted_maybe_check ( ship shipp)

Maybe check ship subsystems for disruption, and set/clear flags

Definition at line 9019 of file ship.cpp.

char* ship_subsys_get_name ( ship_subsys ss)

Definition at line 15001 of file ship.cpp.

bool ship_subsys_has_instance_name ( ship_subsys ss)

Definition at line 15009 of file ship.cpp.

bool ship_subsys_is_fighterbay ( ship_subsys ss)

Definition at line 17533 of file ship.cpp.

void ship_subsys_set_disrupted ( ship_subsys ss,
int  time 
)

Disrupt a subsystem (ie make it inoperable for a time)

Parameters
sspointer to ship subsystem to be disrupted
timetime in ms that subsystem should be disrupted

Definition at line 9053 of file ship.cpp.

void ship_subsys_set_name ( ship_subsys ss,
char *  n_name 
)

Definition at line 15017 of file ship.cpp.

bool ship_subsys_takes_damage ( ship_subsys ss)

Definition at line 17545 of file ship.cpp.

int ship_subsystem_in_sight ( object objp,
ship_subsys subsys,
vec3d eye_pos,
vec3d subsys_pos,
int  do_facing_check,
float dot_out,
vec3d vec_out 
)

Definition at line 14881 of file ship.cpp.

void ship_subsystem_set_new_ai_class ( int  ship_num,
char *  subsystem,
int  new_ai_class 
)

Definition at line 17380 of file ship.cpp.

void ship_subsystems_delete ( ship shipp)

Definition at line 7568 of file ship.cpp.

int ship_template_lookup ( const char *  token)

Return the index of Ship_templates[].name that is *token.

Definition at line 12761 of file ship.cpp.

int ship_tvt_wing_lookup ( const char *  wing_name)

Definition at line 17660 of file ship.cpp.

int ship_type_name_lookup ( const char *  name)

Definition at line 12923 of file ship.cpp.

void ship_update_artillery_lock ( )

Definition at line 17146 of file ship.cpp.

bool ship_useful_for_departure ( int  shipnum,
int  path_mask 
)

Definition at line 17448 of file ship.cpp.

int ship_weapon_maybe_fail ( ship sp)

See if weapon for ship can fire based on weapons subystem strength.

Returns
1 if weapon failed to fire, 0 if weapon can fire

Definition at line 10572 of file ship.cpp.

void ship_wing_cleanup ( int  shipnum,
wing wingp 
)

Used by ship_cleanup which is called if the ship is in a wing.

This function updates the ship_index list (i.e. removes its entry in the list) and packs the array accordingly.

Definition at line 7640 of file ship.cpp.

void show_ship_subsys_count ( )

Definition at line 9606 of file ship.cpp.

int subsys_set ( int  objnum,
int  ignore_subsys_info 
)

Set subsystem

Parameters
objnumObject number (used as index into Objects[])
ignore_subsys_infoDefault parameter with value of 0. This is only set to 1 by the save/restore code

Definition at line 6253 of file ship.cpp.

int thruster_glow_anim_load ( generic_anim ga)

Definition at line 8506 of file ship.cpp.

int valid_cap_subsys_cargo_list ( char *  subsys)

Definition at line 16984 of file ship.cpp.

int warptype_match ( char *  p)

Definition at line 629 of file ship.cpp.

void wing_bash_ship_name ( char *  ship_name,
const char *  wing_name,
int  index 
)

Definition at line 12686 of file ship.cpp.

int wing_has_conflicting_teams ( int  wing_index)

Definition at line 17054 of file ship.cpp.

void wing_load_squad_bitmap ( wing w)

Definition at line 17406 of file ship.cpp.

int wing_lookup ( const char *  name)

Needed in addition to wing_name_lookup because it does a straight lookup without caring about how many ships are in the wing, etc.

Definition at line 12736 of file ship.cpp.

int wing_name_lookup ( const char *  name,
int  ignore_count 
)

Return the object index of the ship with name *name.

Definition at line 12706 of file ship.cpp.

Variable Documentation

int Ai_render_debug_flag =0

Definition at line 113 of file ship.cpp.

flag_def_list ai_tgt_obj_flags[]
Initial value:
= {
{ "no shields", OF_NO_SHIELDS, 0 },
{ "targetable as bomb", OF_TARGETABLE_AS_BOMB, 0 }
}
#define OF_NO_SHIELDS
Definition: object.h:110
#define OF_TARGETABLE_AS_BOMB
Definition: object.h:118

Definition at line 339 of file ship.cpp.

flag_def_list ai_tgt_objects[]
Initial value:
= {
{ "ship", OBJ_SHIP, 0 },
{ "asteroid", OBJ_ASTEROID, 0 },
{ "weapon", OBJ_WEAPON, 0 }
}
#define OBJ_ASTEROID
Definition: object.h:44
#define OBJ_WEAPON
Definition: object.h:33
#define OBJ_SHIP
Definition: object.h:32

Definition at line 331 of file ship.cpp.

flag_def_list ai_tgt_ship_flags[]
Initial value:
= {
{ "afterburners", SIF_AFTERBURNER, 0 },
{ "big damage", SIF_BIG_DAMAGE, 0 },
{ "has awacs", SIF_HAS_AWACS, 0 }
}
#define SIF_HAS_AWACS
Definition: ship.h:906
#define SIF_BIG_DAMAGE
Definition: ship.h:905
#define SIF_AFTERBURNER
Definition: ship.h:879

Definition at line 346 of file ship.cpp.

flag_def_list ai_tgt_weapon_flags[]
Initial value:
= {
{ "bomb", WIF_BOMB, 0 },
{ "huge damage", WIF_HUGE, 0 },
{ "supercap damage", WIF_SUPERCAP, 0 },
{ "bomber+", WIF_BOMBER_PLUS, 0 },
{ "electronics", WIF_ELECTRONICS, 0 },
{ "puncture", WIF_PUNCTURE, 0 },
{ "emp", WIF_EMP, 0 },
{ "heat seeking", WIF_HOMING_HEAT, 0 },
{ "aspect seeking", WIF_HOMING_ASPECT, 0 },
{ "engine seeking", WIF_HOMING_JAVELIN, 0 },
{ "pierce shields", WIF2_PIERCE_SHIELDS, 1 },
{ "local ssm", WIF2_LOCAL_SSM, 1 },
{ "capital+", WIF2_CAPITAL_PLUS, 1 }
}
#define WIF_EMP
Definition: weapon.h:73
#define WIF_BOMBER_PLUS
Definition: weapon.h:69
#define WIF_HUGE
Definition: weapon.h:64
#define WIF_HOMING_ASPECT
Definition: weapon.h:45
#define WIF2_CAPITAL_PLUS
Definition: weapon.h:107
#define WIF_HOMING_HEAT
Definition: weapon.h:44
#define WIF_BOMB
Definition: weapon.h:63
#define WIF2_PIERCE_SHIELDS
Definition: weapon.h:85
#define WIF_ELECTRONICS
Definition: weapon.h:46
#define WIF_SUPERCAP
Definition: weapon.h:50
#define WIF_PUNCTURE
Definition: weapon.h:49
#define WIF_HOMING_JAVELIN
Definition: weapon.h:55
#define WIF2_LOCAL_SSM
Definition: weapon.h:87

Definition at line 354 of file ship.cpp.

Definition at line 396 of file ship.cpp.

flag_def_list Armor_flags[]
Initial value:
= {
{ "ignore subsystem armor", SAF_IGNORE_SS_ARMOR, 0 }
}
#define SAF_IGNORE_SS_ARMOR
Definition: ship.h:243

Definition at line 173 of file ship.cpp.

int armor_inited = 0

Definition at line 130 of file ship.cpp.

SCP_vector<ArmorType> Armor_types

Definition at line 170 of file ship.cpp.

flag_def_list ArmorTypeConstants[]
Initial value:
= {
{ "base damage", AT_CONSTANT_BASE_DMG, 0},
{ "current damage", AT_CONSTANT_CURRENT_DMG, 0},
{ "difficulty factor", AT_CONSTANT_DIFF_FACTOR, 0},
{ "random", AT_CONSTANT_RANDOM, 0},
{ "pi", AT_CONSTANT_PI, 0},
}
#define AT_CONSTANT_BASE_DMG
Definition: ship.h:181
#define AT_CONSTANT_RANDOM
Definition: ship.h:184
#define AT_CONSTANT_CURRENT_DMG
Definition: ship.h:182
#define AT_CONSTANT_DIFF_FACTOR
Definition: ship.h:183
#define AT_CONSTANT_PI
Definition: ship.h:185

Definition at line 17823 of file ship.cpp.

float artillery_dist = 10.0f

Definition at line 17140 of file ship.cpp.

int CLOAKMAP =-1

Called in game_shutdown() to free malloced memory

NOTE: do not call this function. It is only called from game_shutdown()

Definition at line 14145 of file ship.cpp.

int Cmdline_nohtl

Definition at line 438 of file cmdline.cpp.

Definition at line 171 of file ship.cpp.

float Decay_rate = 1.0f / 120.0f

Definition at line 9093 of file ship.cpp.

flag_def_list DifficultyScaleTypes[]
Initial value:
= {
{ "first", ADT_DIFF_SCALE_FIRST, 0},
{ "last", ADT_DIFF_SCALE_LAST, 0},
{ "manual", ADT_DIFF_SCALE_MANUAL, 0},
}
#define ADT_DIFF_SCALE_FIRST
Definition: ship.h:173
#define ADT_DIFF_SCALE_LAST
Definition: ship.h:174
#define ADT_DIFF_SCALE_MANUAL
Definition: ship.h:175

Definition at line 17803 of file ship.cpp.

SCP_vector<engine_wash_info> Engine_wash_info

Definition at line 143 of file ship.cpp.

geometry_batcher fx_batcher

Definition at line 6731 of file ship.cpp.

char* Lightning_types[]
Initial value:
= {
"None",
"Default",
}

Definition at line 641 of file ship.cpp.

int Man_thruster_reset_timestamp = 0

Definition at line 5152 of file ship.cpp.

Definition at line 6661 of file ship.cpp.

flag_def_list Man_types[]
Initial value:
= {
{ "Bank right", MT_BANK_RIGHT, 0 },
{ "Bank left", MT_BANK_LEFT, 0 },
{ "Pitch up", MT_PITCH_UP, 0 },
{ "Pitch down", MT_PITCH_DOWN, 0 },
{ "Roll right", MT_ROLL_RIGHT, 0 },
{ "Roll left", MT_ROLL_LEFT, 0 },
{ "Slide right", MT_SLIDE_RIGHT, 0 },
{ "Slide left", MT_SLIDE_LEFT, 0 },
{ "Slide up", MT_SLIDE_UP, 0 },
{ "Slide down", MT_SLIDE_DOWN, 0 },
{ "Forward", MT_FORWARD, 0 },
{ "Reverse", MT_REVERSE, 0 }
}
#define MT_SLIDE_DOWN
Definition: ship.h:1085
#define MT_ROLL_LEFT
Definition: ship.h:1081
#define MT_REVERSE
Definition: ship.h:1087
#define MT_BANK_LEFT
Definition: ship.h:1077
#define MT_PITCH_UP
Definition: ship.h:1078
#define MT_ROLL_RIGHT
Definition: ship.h:1080
#define MT_SLIDE_LEFT
Definition: ship.h:1083
#define MT_PITCH_DOWN
Definition: ship.h:1079
#define MT_BANK_RIGHT
Definition: ship.h:1076
#define MT_SLIDE_RIGHT
Definition: ship.h:1082
#define MT_SLIDE_UP
Definition: ship.h:1084
#define MT_FORWARD
Definition: ship.h:1086

Definition at line 179 of file ship.cpp.

float min_lethality = 0.0f

Definition at line 9104 of file ship.cpp.

const int num_ai_tgt_obj_flags = sizeof(ai_tgt_obj_flags) / sizeof(flag_def_list)

Definition at line 344 of file ship.cpp.

const int num_ai_tgt_objects = sizeof(ai_tgt_objects) / sizeof(flag_def_list)

Definition at line 337 of file ship.cpp.

const int num_ai_tgt_ship_flags = sizeof(ai_tgt_ship_flags) / sizeof(flag_def_list)

Definition at line 352 of file ship.cpp.

const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list)

Definition at line 394 of file ship.cpp.

const int Num_armor_calculation_types = sizeof(TypeNames)/sizeof(char*)

Definition at line 17909 of file ship.cpp.

const int Num_armor_flags = sizeof(Armor_flags)/sizeof(flag_def_list)

Definition at line 177 of file ship.cpp.

const int Num_armor_type_constants = sizeof(ArmorTypeConstants)/sizeof(flag_def_list)

Definition at line 17831 of file ship.cpp.

const int Num_difficulty_scale_types = sizeof(DifficultyScaleTypes)/sizeof(flag_def_list)

Definition at line 17809 of file ship.cpp.

int Num_engine_wash_types

Definition at line 154 of file ship.cpp.

int Num_lightning_types = sizeof(Lightning_types)/sizeof(char*)

Definition at line 646 of file ship.cpp.

const int Num_man_types = sizeof(Man_types)/sizeof(flag_def_list)

Definition at line 194 of file ship.cpp.

const int Num_piercing_effect_types = sizeof(PiercingTypes)/sizeof(flag_def_list)

Definition at line 17787 of file ship.cpp.

const int Num_player_orders = sizeof(Player_orders)/sizeof(flag_def_list)

Definition at line 228 of file ship.cpp.

int Num_reinforcements = 0

Definition at line 121 of file ship.cpp.

const int Num_ship_flags = sizeof(Ship_flags) / sizeof(flag_def_list)

Definition at line 322 of file ship.cpp.

int Num_ship_subobj_types

Definition at line 155 of file ship.cpp.

int Num_ship_subobjects

Definition at line 156 of file ship.cpp.

const int Num_subsystem_flags = sizeof(Subsystem_flags)/sizeof(flag_def_list)

Definition at line 265 of file ship.cpp.

int Num_warp_types = sizeof(Warp_types)/sizeof(char*)

Definition at line 627 of file ship.cpp.

int Num_wings = 0

Definition at line 120 of file ship.cpp.

flag_def_list PiercingTypes[]
Initial value:
= {
{ "none", SADTF_PIERCING_NONE, 0},
{ "default", SADTF_PIERCING_DEFAULT, 0},
{ "retail", SADTF_PIERCING_RETAIL, 0},
}
#define SADTF_PIERCING_DEFAULT
Definition: ship.h:246
#define SADTF_PIERCING_RETAIL
Definition: ship.h:247
#define SADTF_PIERCING_NONE
Definition: ship.h:245

Definition at line 17781 of file ship.cpp.

int* Player_cockpit_textures

Definition at line 125 of file ship.cpp.

SCP_vector<cockpit_display> Player_displays

Definition at line 126 of file ship.cpp.

flag_def_list Player_orders[]
Initial value:
= {
{ "attack ship", ATTACK_TARGET_ITEM, 0 },
{ "disable ship", DISABLE_TARGET_ITEM, 0 },
{ "disarm ship", DISARM_TARGET_ITEM, 0 },
{ "disable subsys", DISABLE_SUBSYSTEM_ITEM, 0 },
{ "guard ship", PROTECT_TARGET_ITEM, 0 },
{ "ignore ship", IGNORE_TARGET_ITEM, 0 },
{ "form on wing", FORMATION_ITEM, 0 },
{ "cover me", COVER_ME_ITEM, 0 },
{ "attack any", ENGAGE_ENEMY_ITEM, 0 },
{ "dock", CAPTURE_TARGET_ITEM, 0 },
{ "rearm me", REARM_REPAIR_ME_ITEM, 0 },
{ "abort rearm", ABORT_REARM_REPAIR_ITEM, 0 },
{ "depart", DEPART_ITEM, 0 },
{ "stay near me", STAY_NEAR_ME_ITEM, 0 },
{ "stay near ship", STAY_NEAR_TARGET_ITEM, 0 },
{ "keep safe dist", KEEP_SAFE_DIST_ITEM, 0 }
}
#define REARM_REPAIR_ME_ITEM
Definition: hudsquadmsg.h:49
#define PROTECT_TARGET_ITEM
Definition: hudsquadmsg.h:41
#define STAY_NEAR_TARGET_ITEM
Definition: hudsquadmsg.h:52
#define STAY_NEAR_ME_ITEM
Definition: hudsquadmsg.h:51
#define CAPTURE_TARGET_ITEM
Definition: hudsquadmsg.h:46
#define COVER_ME_ITEM
Definition: hudsquadmsg.h:44
#define DISARM_TARGET_ITEM
Definition: hudsquadmsg.h:40
#define IGNORE_TARGET_ITEM
Definition: hudsquadmsg.h:42
#define ATTACK_TARGET_ITEM
Definition: hudsquadmsg.h:38
#define ENGAGE_ENEMY_ITEM
Definition: hudsquadmsg.h:45
#define DISABLE_TARGET_ITEM
Definition: hudsquadmsg.h:39
#define KEEP_SAFE_DIST_ITEM
Definition: hudsquadmsg.h:53
#define DEPART_ITEM
Definition: hudsquadmsg.h:56
#define DISABLE_SUBSYSTEM_ITEM
Definition: hudsquadmsg.h:59
#define ABORT_REARM_REPAIR_ITEM
Definition: hudsquadmsg.h:50
#define FORMATION_ITEM
Definition: hudsquadmsg.h:43

Definition at line 200 of file ship.cpp.

ship* Player_ship

Definition at line 124 of file ship.cpp.

int Player_ship_class

Definition at line 157 of file ship.cpp.

Definition at line 165 of file ship.cpp.

bool Rendering_to_shadow_map

Definition at line 88 of file gropengltnl.cpp.

int Ship_auto_repair = 1

Definition at line 116 of file ship.cpp.

SCP_vector<ship_effect> Ship_effects

Definition at line 412 of file ship.cpp.

ship_flag_name Ship_flag_names[]
Initial value:
= {
{SF_VAPORIZE, "vaporize", 1, },
{SF_WARP_BROKEN, "break-warp", 1, },
{SF_WARP_NEVER, "never-warp", 1, },
{SF_SCANNABLE, "scannable", 1, },
{SF_CARGO_REVEALED, "cargo-known", 1, },
{SF_HIDDEN_FROM_SENSORS, "hidden-from-sensors", 1, },
{SF2_STEALTH, "stealth", 2, },
{SF2_FRIENDLY_STEALTH_INVIS, "friendly-stealth-invisible", 2, },
{SF2_HIDE_SHIP_NAME, "hide-ship-name", 2, },
{SF2_PRIMITIVE_SENSORS, "primitive-sensors", 2, },
{SF2_AFTERBURNER_LOCKED, "afterburners-locked", 2, },
{SF2_PRIMARIES_LOCKED, "primaries-locked", 2, },
{SF2_SECONDARIES_LOCKED, "secondaries-locked", 2, },
{SF2_NO_SUBSPACE_DRIVE, "no-subspace-drive", 2, },
{SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, },
{SF2_NO_ETS, "no-ets", 2, },
{SF2_TOGGLE_SUBSYSTEM_SCANNING, "toggle-subsystem-scanning", 2, },
{SF2_NO_SECONDARY_LOCKON, "no-secondary-lock-on", 2, },
{SF2_NO_DISABLED_SELF_DESTRUCT, "no-disabled-self-destruct", 2, },
}
#define SF2_TOGGLE_SUBSYSTEM_SCANNING
Definition: ship.h:490
#define SF2_NO_DISABLED_SELF_DESTRUCT
Definition: ship.h:511
#define SF2_NO_SUBSPACE_DRIVE
Definition: ship.h:487
#define SF2_DONT_COLLIDE_INVIS
Definition: ship.h:486
#define SF2_FRIENDLY_STEALTH_INVIS
Definition: ship.h:484
#define SF2_HIDE_SHIP_NAME
Definition: ship.h:498
#define SF_HIDDEN_FROM_SENSORS
Definition: ship.h:464
#define SF_SCANNABLE
Definition: ship.h:465
#define SF2_PRIMARIES_LOCKED
Definition: ship.h:492
#define SF_VAPORIZE
Definition: ship.h:470
#define SF_WARP_BROKEN
Definition: ship.h:460
#define SF2_NO_ETS
Definition: ship.h:503
#define SF2_AFTERBURNER_LOCKED
Definition: ship.h:499
#define SF_CARGO_REVEALED
Definition: ship.h:456
#define SF2_PRIMITIVE_SENSORS
Definition: ship.h:483
#define SF2_STEALTH
Definition: ship.h:485
#define SF2_SECONDARIES_LOCKED
Definition: ship.h:493
#define SF_WARP_NEVER
Definition: ship.h:461
#define SF2_NO_SECONDARY_LOCKON
Definition: ship.h:510

Definition at line 372 of file ship.cpp.

flag_def_list Ship_flags[]

Definition at line 272 of file ship.cpp.

SCP_vector<ship_info> Ship_info

Definition at line 164 of file ship.cpp.

ship_obj Ship_obj_list

Definition at line 162 of file ship.cpp.

ship_obj Ship_objs[MAX_SHIP_OBJS]

Definition at line 161 of file ship.cpp.

int ship_render_mode = MODEL_RENDER_ALL

Definition at line 414 of file ship.cpp.

int Ship_shadows = 0

Definition at line 6614 of file ship.cpp.

int ship_show_velocity_dot = 0

Definition at line 4975 of file ship.cpp.

int Ship_sphere_check = 0

Definition at line 115 of file ship.cpp.

ship_subsys ship_subsys_free_list

Definition at line 101 of file ship.cpp.

int Ship_subsys_hwm = 0

Definition at line 9604 of file ship.cpp.

SCP_vector<ship_info> Ship_templates

Definition at line 166 of file ship.cpp.

SCP_vector<ship_counts> Ship_type_counts

Definition at line 401 of file ship.cpp.

Definition at line 168 of file ship.cpp.

ship Ships[MAX_SHIPS]

Definition at line 122 of file ship.cpp.

SCP_vector<exited_ship> Ships_exited

Definition at line 152 of file ship.cpp.

int ships_inited = 0

Definition at line 129 of file ship.cpp.

int Show_fpaths = 0

Definition at line 6629 of file ship.cpp.

int Show_paths = 0

Definition at line 6626 of file ship.cpp.

int Show_shield_hits = 0

Definition at line 6620 of file ship.cpp.

int Show_tnorms = 0

Definition at line 6623 of file ship.cpp.

float splode_level

Definition at line 473 of file modelinterp.cpp.

bool splodeing

Definition at line 471 of file modelinterp.cpp.

int splodeingtexture

Definition at line 472 of file modelinterp.cpp.

char Squadron_wing_names[MAX_SQUADRON_WINGS][NAME_LENGTH]

Definition at line 140 of file ship.cpp.

int Squadron_wings[MAX_SQUADRON_WINGS]

Definition at line 135 of file ship.cpp.

char Starting_wing_names[MAX_STARTING_WINGS][NAME_LENGTH]

Definition at line 139 of file ship.cpp.

int Starting_wings[MAX_STARTING_WINGS]

Definition at line 132 of file ship.cpp.

flag_def_list Subsystem_flags[]

Definition at line 231 of file ship.cpp.

float t_len = 10.0f

Definition at line 10605 of file ship.cpp.

float t_max = 300.0f

Definition at line 10608 of file ship.cpp.

float t_min = 150.0f

Definition at line 10607 of file ship.cpp.

float t_rad = 0.5f

Definition at line 10604 of file ship.cpp.

float t_vel = 0.2f

Definition at line 10606 of file ship.cpp.

int tracers[MAX_SHIPS][4][4]

Definition at line 10750 of file ship.cpp.

char TVT_wing_names[MAX_TVT_WINGS][NAME_LENGTH]

Definition at line 141 of file ship.cpp.

int TVT_wings[MAX_TVT_WINGS]

Definition at line 136 of file ship.cpp.

float TypeDefaultValues[]
Initial value:
= {
0.0f,
1.0f,
1.0f,
1.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f
}

Definition at line 17891 of file ship.cpp.

char* TypeNames[]
Initial value:
= {
"additive",
"multiplicative",
"exponential",
"exponential base",
"cutoff",
"reverse cutoff",
"instant cutoff",
"instant reverse cutoff",
"cap",
"instant cap",
"set",
"load",
"store",
"random"
}

Definition at line 17872 of file ship.cpp.

char* Warp_types[]
Initial value:
= {
"Default",
"Knossos",
"Babylon5",
"Galactica",
"Homeworld",
"Hyperspace",
}

Definition at line 618 of file ship.cpp.

wing Wings[MAX_WINGS]

Definition at line 128 of file ship.cpp.