FS2_Open
Open source remastering of the Freespace 2 engine
weapon.h File Reference
#include "globalincs/globals.h"
#include "globalincs/systemvars.h"
#include "graphics/2d.h"
#include "graphics/generic.h"
#include "model/model.h"
#include "weapon/shockwave.h"
#include "weapon/trails.h"

Go to the source code of this file.

Classes

struct  weapon
 
struct  beam_weapon_section_info
 
struct  beam_weapon_info
 
struct  particle_spew_info
 
struct  spawn_weapon_info
 
struct  weapon_info
 
struct  missile_obj
 
struct  weapon_expl_lod
 
struct  weapon_expl_info
 
class  weapon_explosions
 

Macros

#define WP_UNUSED   -1
 
#define WP_LASER   0
 
#define WP_MISSILE   1
 
#define WP_BEAM   2
 
#define WRT_NONE   -1
 
#define WRT_LASER   1
 
#define WRT_POF   2
 
#define MAX_WEAPON_FLAGS   18
 
#define WIF_DEFAULT_VALUE   0
 
#define WIF2_DEFAULT_VALUE   0
 
#define WIF3_DEFAULT_VALUE   0
 
#define WIF_HOMING_HEAT   (1 << 0)
 
#define WIF_HOMING_ASPECT   (1 << 1)
 
#define WIF_ELECTRONICS   (1 << 2)
 
#define WIF_SPAWN   (1 << 3)
 
#define WIF_REMOTE   (1 << 4)
 
#define WIF_PUNCTURE   (1 << 5)
 
#define WIF_SUPERCAP   (1 << 6)
 
#define WIF_CMEASURE   (1 << 7)
 
#define WIF_HOMING_JAVELIN   (1 << 8)
 
#define WIF_TURNS   (1 << 9)
 
#define WIF_SWARM   (1 << 10)
 
#define WIF_TRAIL   (1 << 11)
 
#define WIF_BIG_ONLY   (1 << 12)
 
#define WIF_CHILD   (1 << 13)
 
#define WIF_BOMB   (1 << 14)
 
#define WIF_HUGE   (1 << 15)
 
#define WIF_NO_DUMBFIRE   (1 << 16)
 
#define WIF_THRUSTER   (1 << 17)
 
#define WIF_IN_TECH_DATABASE   (1 << 18)
 
#define WIF_PLAYER_ALLOWED   (1 << 19)
 
#define WIF_BOMBER_PLUS   (1 << 20)
 
#define WIF_CORKSCREW   (1 << 21)
 
#define WIF_PARTICLE_SPEW   (1 << 22)
 
#define WIF_EMP   (1 << 23)
 
#define WIF_ENERGY_SUCK   (1 << 24)
 
#define WIF_FLAK   (1 << 25)
 
#define WIF_BEAM   (1 << 26)
 
#define WIF_TAG   (1 << 27)
 
#define WIF_SHUDDER   (1 << 28)
 
#define WIF_LOCKARM   (1 << 29)
 
#define WIF_STREAM   (1 << 30)
 
#define WIF2_BALLISTIC   (1 << 0)
 
#define WIF2_PIERCE_SHIELDS   (1 << 1)
 
#define WIF2_DEFAULT_IN_TECH_DATABASE   (1 << 2)
 
#define WIF2_LOCAL_SSM   (1 << 3)
 
#define WIF2_TAGGED_ONLY   (1 << 4)
 
#define WIF2_CYCLE   (1 << 5)
 
#define WIF2_SMALL_ONLY   (1 << 6)
 
#define WIF2_SAME_TURRET_COOLDOWN   (1 << 7)
 
#define WIF2_MR_NO_LIGHTING   (1 << 8)
 
#define WIF2_TRANSPARENT   (1 << 9)
 
#define WIF2_TRAINING   (1 << 10)
 
#define WIF2_SMART_SPAWN   (1 << 11)
 
#define WIF2_INHERIT_PARENT_TARGET   (1 << 12)
 
#define WIF2_NO_EMP_KILL   (1 << 13)
 
#define WIF2_VARIABLE_LEAD_HOMING   (1 << 14)
 
#define WIF2_UNTARGETED_HEAT_SEEKER   (1 << 15)
 
#define WIF2_HARD_TARGET_BOMB   (1 << 16)
 
#define WIF2_NON_SUBSYS_HOMING   (1 << 17)
 
#define WIF2_NO_LIFE_LOST_IF_MISSED   (1 << 18)
 
#define WIF2_CUSTOM_SEEKER_STR   (1 << 19)
 
#define WIF2_CAN_BE_TARGETED   (1 << 20)
 
#define WIF2_SHOWN_ON_RADAR   (1 << 21)
 
#define WIF2_SHOW_FRIENDLY   (1 << 22)
 
#define WIF2_CAPITAL_PLUS   (1 << 23)
 
#define WIF2_EXTERNAL_WEAPON_FP   (1 << 24)
 
#define WIF2_EXTERNAL_WEAPON_LNCH   (1 << 25)
 
#define WIF2_TAKES_BLAST_DAMAGE   (1 << 26)
 
#define WIF2_TAKES_SHOCKWAVE_DAMAGE   (1 << 27)
 
#define WIF2_DONT_SHOW_ON_RADAR   (1 << 28)
 
#define WIF2_RENDER_FLAK   (1 << 29)
 
#define WIF2_CIWS   (1 << 30)
 
#define WIF2_ANTISUBSYSBEAM   (1 << 31)
 
#define WIF3_NOLINK   (1 << 0)
 
#define WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS   (1 << 1)
 
#define WIF3_NO_LINKED_PENALTY   (1 << 2)
 
#define WIF3_NO_HOMING_SPEED_RAMP   (1 << 3)
 
#define WIF3_CMEASURE_ASPECT_HOME_ON   (1 << 4)
 
#define WIF3_TURRET_INTERCEPTABLE   (1 << 5)
 
#define WIF3_FIGHTER_INTERCEPTABLE   (1 << 6)
 
#define WIF3_AOE_ELECTRONICS   (1 << 7)
 
#define WIF3_APPLY_RECOIL   (1 << 8)
 
#define WIF3_DONT_SPAWN_IF_SHOT   (1 << 9)
 
#define WIF3_DIE_ON_LOST_LOCK   (1 << 10)
 
#define WIF_HOMING   (WIF_HOMING_HEAT | WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
 
#define WIF_LOCKED_HOMING   (WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
 
#define WIF_HURTS_BIG_SHIPS   (WIF_BOMB | WIF_BEAM | WIF_HUGE | WIF_BIG_ONLY)
 
#define WEAPON_EXHAUST_DELTA_TIME   75
 
#define WF_LOCK_WARNING_PLAYED   (1<<0)
 
#define WF_ALREADY_APPLIED_STATS   (1<<1)
 
#define WF_PLAYED_FLYBY_SOUND   (1<<2)
 
#define WF_CONSIDER_FOR_FLYBY_SOUND   (1<<3)
 
#define WF_DEAD_IN_WATER   (1<<4)
 
#define WF_LOCKED_WHEN_FIRED   (1<<5)
 
#define WF_DESTROYED_BY_WEAPON   (1<<6)
 
#define WF_SPAWNED   (1<<7)
 
#define WF_HOMING_UPDATE_NEEDED   (1<<8)
 
#define WF_NO_HOMING   (1<<9)
 
#define WBF_FAST_FIRING   (1<<0)
 
#define WBF_RANDOM_LENGTH   (1<<1)
 
#define PSPEW_NONE   -1
 
#define PSPEW_DEFAULT   0
 
#define PSPEW_HELIX   1
 
#define PSPEW_SPARKLER   2
 
#define PSPEW_RING   3
 
#define PSPEW_PLUME   4
 
#define MAX_PARTICLE_SPEWERS   4
 
#define MAX_WEP_DAMAGE_SLOTS   32
 
#define MAX_SPAWN_TYPES_PER_WEAPON   5
 
#define BEAM_FAR_LENGTH   30000.0f
 
#define WEAPON_TITLE_LEN   48
 
#define MAX_SUBSTITUTION_PATTERNS   10
 
#define MAX_WEAPON_EXPL_LOD   4
 
#define WEAPON_INDEX(wp)   (wp-Weapons)
 
#define WEAPON_INFO_INDEX(wip)   (wip-Weapon_info)
 
#define WEAPON_MAX_GROUP_IDS   256
 

Typedefs

typedef struct weapon weapon
 
typedef struct beam_weapon_section_info beam_weapon_section_info
 
typedef struct beam_weapon_info beam_weapon_info
 
typedef struct particle_spew_info particle_spew_info
 
typedef struct spawn_weapon_info spawn_weapon_info
 
typedef struct weapon_info weapon_info
 
typedef struct missile_obj missile_obj
 
typedef struct weapon_expl_lod weapon_expl_lod
 
typedef struct weapon_expl_info weapon_expl_info
 

Enumerations

enum  InFlightSoundType { TARGETED, UNTARGETED, ALWAYS }
 

Functions

int weapon_info_lookup (const char *name=NULL)
 
void weapon_init ()
 
void weapon_close ()
 
void weapon_level_init ()
 
void weapon_render_DEPRECATED (object *obj)
 
void weapon_render (object *obj, draw_list *scene)
 
void weapon_delete (object *obj)
 
void weapon_process_pre (object *obj, float frame_time)
 
void weapon_process_post (object *obj, float frame_time)
 
void weapon_mark_as_used (int weapon_id)
 
int weapon_create_group_id ()
 
int weapon_create (vec3d *pos, matrix *orient, int weapon_type, int parent_obj, int group_id=-1, int is_locked=0, int is_spawned=0, float fof_cooldown=0.0f, ship_subsys *src_turret=NULL)
 
void weapon_set_tracking_info (int weapon_objnum, int parent_objnum, int target_objnum, int target_is_locked=0, ship_subsys *target_subsys=NULL)
 
void weapon_maybe_spew_particle (object *obj)
 
bool weapon_armed (weapon *wp, bool hit_target)
 
void weapon_hit (object *weapon_obj, object *other_obj, vec3d *hitpos, int quadrant=-1)
 
int cmeasure_name_lookup (char *name)
 
void spawn_child_weapons (object *objp)
 
void weapon_detonate (object *objp)
 
void weapon_area_apply_blast (vec3d *force_apply_pos, object *ship_objp, vec3d *blast_pos, float blast, int make_shockwave)
 
int weapon_area_calc_damage (object *objp, vec3d *pos, float inner_rad, float outer_rad, float max_blast, float max_damage, float *blast, float *damage, float limit)
 
void missile_obj_list_rebuild ()
 
missile_objmissile_obj_return_address (int index)
 
void find_homing_object_cmeasures ()
 
void ship_do_weapon_thruster_frame (weapon *weaponp, object *objp, float frametime)
 
void weapon_get_laser_color (color *c, object *objp)
 
void weapon_hit_do_sound (object *hit_obj, weapon_info *wip, vec3d *hitpos, bool is_armed)
 
void weapon_do_electronics_effect (object *ship_objp, vec3d *blast_pos, int wi_index)
 
float weapon_get_damage_scale (weapon_info *wip, object *wep, object *target)
 
void weapon_pause_sounds ()
 
void weapon_unpause_sounds ()
 
void validate_SSM_entries ()
 
void shield_impact_explosion (vec3d *hitpos, object *objp, float radius, int idx)
 

Variables

char * Weapon_subtype_names []
 
int Num_weapon_subtypes
 
weapon Weapons [MAX_WEAPONS]
 
missile_obj Missile_obj_list
 
weapon_explosions Weapon_explosions
 
weapon_info Weapon_info [MAX_WEAPON_TYPES]
 
int Num_weapon_types
 
int Num_weapons
 
int First_secondary_index
 
int Default_cmeasure_index
 
int Num_player_weapon_precedence
 
int Player_weapon_precedence [MAX_WEAPON_TYPES]
 

Macro Definition Documentation

#define BEAM_FAR_LENGTH   30000.0f

Definition at line 305 of file weapon.h.

#define MAX_PARTICLE_SPEWERS   4

Definition at line 160 of file weapon.h.

#define MAX_SPAWN_TYPES_PER_WEAPON   5

Definition at line 302 of file weapon.h.

#define MAX_SUBSTITUTION_PATTERNS   10

Definition at line 319 of file weapon.h.

#define MAX_WEAPON_EXPL_LOD   4

Definition at line 566 of file weapon.h.

#define MAX_WEAPON_FLAGS   18

Definition at line 38 of file weapon.h.

#define MAX_WEP_DAMAGE_SLOTS   32

Definition at line 161 of file weapon.h.

#define PSPEW_DEFAULT   0

Definition at line 154 of file weapon.h.

#define PSPEW_HELIX   1

Definition at line 155 of file weapon.h.

#define PSPEW_NONE   -1

Definition at line 153 of file weapon.h.

#define PSPEW_PLUME   4

Definition at line 158 of file weapon.h.

#define PSPEW_RING   3

Definition at line 157 of file weapon.h.

#define PSPEW_SPARKLER   2

Definition at line 156 of file weapon.h.

#define WBF_FAST_FIRING   (1<<0)

Definition at line 149 of file weapon.h.

#define WBF_RANDOM_LENGTH   (1<<1)

Definition at line 150 of file weapon.h.

#define WEAPON_EXHAUST_DELTA_TIME   75

Definition at line 133 of file weapon.h.

#define WEAPON_INDEX (   wp)    (wp-Weapons)

Definition at line 612 of file weapon.h.

#define WEAPON_INFO_INDEX (   wip)    (wip-Weapon_info)

Definition at line 613 of file weapon.h.

#define WEAPON_MAX_GROUP_IDS   256

Definition at line 637 of file weapon.h.

#define WEAPON_TITLE_LEN   48

Definition at line 310 of file weapon.h.

#define WF_ALREADY_APPLIED_STATS   (1<<1)

Definition at line 137 of file weapon.h.

#define WF_CONSIDER_FOR_FLYBY_SOUND   (1<<3)

Definition at line 140 of file weapon.h.

#define WF_DEAD_IN_WATER   (1<<4)

Definition at line 141 of file weapon.h.

#define WF_DESTROYED_BY_WEAPON   (1<<6)

Definition at line 143 of file weapon.h.

#define WF_HOMING_UPDATE_NEEDED   (1<<8)

Definition at line 145 of file weapon.h.

#define WF_LOCK_WARNING_PLAYED   (1<<0)

Definition at line 135 of file weapon.h.

#define WF_LOCKED_WHEN_FIRED   (1<<5)

Definition at line 142 of file weapon.h.

#define WF_NO_HOMING   (1<<9)

Definition at line 146 of file weapon.h.

#define WF_PLAYED_FLYBY_SOUND   (1<<2)

Definition at line 139 of file weapon.h.

#define WF_SPAWNED   (1<<7)

Definition at line 144 of file weapon.h.

#define WIF2_ANTISUBSYSBEAM   (1 << 31)

Definition at line 115 of file weapon.h.

#define WIF2_BALLISTIC   (1 << 0)

Definition at line 84 of file weapon.h.

#define WIF2_CAN_BE_TARGETED   (1 << 20)

Definition at line 104 of file weapon.h.

#define WIF2_CAPITAL_PLUS   (1 << 23)

Definition at line 107 of file weapon.h.

#define WIF2_CIWS   (1 << 30)

Definition at line 114 of file weapon.h.

#define WIF2_CUSTOM_SEEKER_STR   (1 << 19)

Definition at line 103 of file weapon.h.

#define WIF2_CYCLE   (1 << 5)

Definition at line 89 of file weapon.h.

#define WIF2_DEFAULT_IN_TECH_DATABASE   (1 << 2)

Definition at line 86 of file weapon.h.

#define WIF2_DEFAULT_VALUE   0

Definition at line 41 of file weapon.h.

#define WIF2_DONT_SHOW_ON_RADAR   (1 << 28)

Definition at line 112 of file weapon.h.

#define WIF2_EXTERNAL_WEAPON_FP   (1 << 24)

Definition at line 108 of file weapon.h.

#define WIF2_EXTERNAL_WEAPON_LNCH   (1 << 25)

Definition at line 109 of file weapon.h.

#define WIF2_HARD_TARGET_BOMB   (1 << 16)

Definition at line 100 of file weapon.h.

#define WIF2_INHERIT_PARENT_TARGET   (1 << 12)

Definition at line 96 of file weapon.h.

#define WIF2_LOCAL_SSM   (1 << 3)

Definition at line 87 of file weapon.h.

#define WIF2_MR_NO_LIGHTING   (1 << 8)

Definition at line 92 of file weapon.h.

#define WIF2_NO_EMP_KILL   (1 << 13)

Definition at line 97 of file weapon.h.

#define WIF2_NO_LIFE_LOST_IF_MISSED   (1 << 18)

Definition at line 102 of file weapon.h.

#define WIF2_NON_SUBSYS_HOMING   (1 << 17)

Definition at line 101 of file weapon.h.

#define WIF2_PIERCE_SHIELDS   (1 << 1)

Definition at line 85 of file weapon.h.

#define WIF2_RENDER_FLAK   (1 << 29)

Definition at line 113 of file weapon.h.

#define WIF2_SAME_TURRET_COOLDOWN   (1 << 7)

Definition at line 91 of file weapon.h.

#define WIF2_SHOW_FRIENDLY   (1 << 22)

Definition at line 106 of file weapon.h.

#define WIF2_SHOWN_ON_RADAR   (1 << 21)

Definition at line 105 of file weapon.h.

#define WIF2_SMALL_ONLY   (1 << 6)

Definition at line 90 of file weapon.h.

#define WIF2_SMART_SPAWN   (1 << 11)

Definition at line 95 of file weapon.h.

#define WIF2_TAGGED_ONLY   (1 << 4)

Definition at line 88 of file weapon.h.

#define WIF2_TAKES_BLAST_DAMAGE   (1 << 26)

Definition at line 110 of file weapon.h.

#define WIF2_TAKES_SHOCKWAVE_DAMAGE   (1 << 27)

Definition at line 111 of file weapon.h.

#define WIF2_TRAINING   (1 << 10)

Definition at line 94 of file weapon.h.

#define WIF2_TRANSPARENT   (1 << 9)

Definition at line 93 of file weapon.h.

#define WIF2_UNTARGETED_HEAT_SEEKER   (1 << 15)

Definition at line 99 of file weapon.h.

#define WIF2_VARIABLE_LEAD_HOMING   (1 << 14)

Definition at line 98 of file weapon.h.

#define WIF3_AOE_ELECTRONICS   (1 << 7)

Definition at line 124 of file weapon.h.

#define WIF3_APPLY_RECOIL   (1 << 8)

Definition at line 125 of file weapon.h.

#define WIF3_CMEASURE_ASPECT_HOME_ON   (1 << 4)

Definition at line 121 of file weapon.h.

#define WIF3_DEFAULT_VALUE   0

Definition at line 42 of file weapon.h.

#define WIF3_DIE_ON_LOST_LOCK   (1 << 10)

Definition at line 127 of file weapon.h.

#define WIF3_DONT_SPAWN_IF_SHOT   (1 << 9)

Definition at line 126 of file weapon.h.

#define WIF3_FIGHTER_INTERCEPTABLE   (1 << 6)

Definition at line 123 of file weapon.h.

#define WIF3_NO_HOMING_SPEED_RAMP   (1 << 3)

Definition at line 120 of file weapon.h.

#define WIF3_NO_LINKED_PENALTY   (1 << 2)

Definition at line 119 of file weapon.h.

#define WIF3_NOLINK   (1 << 0)

Definition at line 117 of file weapon.h.

#define WIF3_TURRET_INTERCEPTABLE   (1 << 5)

Definition at line 122 of file weapon.h.

#define WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS   (1 << 1)

Definition at line 118 of file weapon.h.

#define WIF_BEAM   (1 << 26)

Definition at line 76 of file weapon.h.

#define WIF_BIG_ONLY   (1 << 12)

Definition at line 61 of file weapon.h.

#define WIF_BOMB   (1 << 14)

Definition at line 63 of file weapon.h.

#define WIF_BOMBER_PLUS   (1 << 20)

Definition at line 69 of file weapon.h.

#define WIF_CHILD   (1 << 13)

Definition at line 62 of file weapon.h.

#define WIF_CMEASURE   (1 << 7)

Definition at line 51 of file weapon.h.

#define WIF_CORKSCREW   (1 << 21)

Definition at line 71 of file weapon.h.

#define WIF_DEFAULT_VALUE   0

Definition at line 40 of file weapon.h.

#define WIF_ELECTRONICS   (1 << 2)

Definition at line 46 of file weapon.h.

#define WIF_EMP   (1 << 23)

Definition at line 73 of file weapon.h.

#define WIF_ENERGY_SUCK   (1 << 24)

Definition at line 74 of file weapon.h.

#define WIF_FLAK   (1 << 25)

Definition at line 75 of file weapon.h.

#define WIF_HOMING   (WIF_HOMING_HEAT | WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)

Definition at line 129 of file weapon.h.

#define WIF_HOMING_ASPECT   (1 << 1)

Definition at line 45 of file weapon.h.

#define WIF_HOMING_HEAT   (1 << 0)

Definition at line 44 of file weapon.h.

#define WIF_HOMING_JAVELIN   (1 << 8)

Definition at line 55 of file weapon.h.

#define WIF_HUGE   (1 << 15)

Definition at line 64 of file weapon.h.

#define WIF_HURTS_BIG_SHIPS   (WIF_BOMB | WIF_BEAM | WIF_HUGE | WIF_BIG_ONLY)

Definition at line 131 of file weapon.h.

#define WIF_IN_TECH_DATABASE   (1 << 18)

Definition at line 67 of file weapon.h.

#define WIF_LOCKARM   (1 << 29)

Definition at line 79 of file weapon.h.

#define WIF_LOCKED_HOMING   (WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)

Definition at line 130 of file weapon.h.

#define WIF_NO_DUMBFIRE   (1 << 16)

Definition at line 65 of file weapon.h.

#define WIF_PARTICLE_SPEW   (1 << 22)

Definition at line 72 of file weapon.h.

#define WIF_PLAYER_ALLOWED   (1 << 19)

Definition at line 68 of file weapon.h.

#define WIF_PUNCTURE   (1 << 5)

Definition at line 49 of file weapon.h.

#define WIF_REMOTE   (1 << 4)

Definition at line 48 of file weapon.h.

#define WIF_SHUDDER   (1 << 28)

Definition at line 78 of file weapon.h.

#define WIF_SPAWN   (1 << 3)

Definition at line 47 of file weapon.h.

#define WIF_STREAM   (1 << 30)

Definition at line 80 of file weapon.h.

#define WIF_SUPERCAP   (1 << 6)

Definition at line 50 of file weapon.h.

#define WIF_SWARM   (1 << 10)

Definition at line 59 of file weapon.h.

#define WIF_TAG   (1 << 27)

Definition at line 77 of file weapon.h.

#define WIF_THRUSTER   (1 << 17)

Definition at line 66 of file weapon.h.

#define WIF_TRAIL   (1 << 11)

Definition at line 60 of file weapon.h.

#define WIF_TURNS   (1 << 9)

Definition at line 56 of file weapon.h.

#define WP_BEAM   2

Definition at line 29 of file weapon.h.

#define WP_LASER   0

Definition at line 27 of file weapon.h.

#define WP_MISSILE   1

Definition at line 28 of file weapon.h.

#define WP_UNUSED   -1

Definition at line 26 of file weapon.h.

#define WRT_LASER   1

Definition at line 34 of file weapon.h.

#define WRT_NONE   -1

Definition at line 33 of file weapon.h.

#define WRT_POF   2

Definition at line 35 of file weapon.h.

Typedef Documentation

typedef struct missile_obj missile_obj
typedef struct weapon weapon
typedef struct weapon_info weapon_info

Enumeration Type Documentation

Enumerator
TARGETED 
UNTARGETED 
ALWAYS 

Definition at line 312 of file weapon.h.

Function Documentation

int cmeasure_name_lookup ( char *  name)
void find_homing_object_cmeasures ( )

Someone launched countermeasures. For all heat-seeking homing objects, see if should favor tracking a countermeasure instead.

Definition at line 4170 of file weapons.cpp.

void missile_obj_list_rebuild ( )

Called by the save/restore code to rebuild Missile_obj_list

Definition at line 441 of file weapons.cpp.

missile_obj* missile_obj_return_address ( int  index)

Called externally to generate an address from an index into the Missile_objs[] array

Definition at line 458 of file weapons.cpp.

void shield_impact_explosion ( vec3d hitpos,
object objp,
float  radius,
int  idx 
)

Definition at line 7263 of file weapons.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.

void spawn_child_weapons ( object objp)

Spawn child weapons from object *objp.

Definition at line 5676 of file weapons.cpp.

void validate_SSM_entries ( )

Definition at line 7461 of file weapons.cpp.

void weapon_area_apply_blast ( vec3d force_apply_pos,
object ship_objp,
vec3d blast_pos,
float  blast,
int  make_shockwave 
)

Apply the blast effects of an explosion to a ship

Parameters
force_apply_posWorld pos of where force is applied to object
ship_objpObject pointer of ship receiving the blast
blast_posWorld pos of blast center
blastForce of blast
make_shockwaveBoolean, whether to create a shockwave or not

Definition at line 6080 of file weapons.cpp.

int weapon_area_calc_damage ( object objp,
vec3d pos,
float  inner_rad,
float  outer_rad,
float  max_blast,
float  max_damage,
float blast,
float damage,
float  limit 
)

Calculate the damage for an object based on the location of an area-effect explosion.

Parameters
objpObject pointer ship receiving blast effect
posWorld pos of blast center
inner_radSmallest radius at which full damage is done
outer_radRadius at which no damage is done
max_blastMaximum blast possible from explosion
max_damageMaximum damage possible from explosion
blastOUTPUT PARAMETER: receives blast value from explosion
damageOUTPUT PARAMETER: receives damage value from explosion
limitA limit on the area, needed for shockwave damage
Returns
No damage occurred, -1
Damage occured, 0

Definition at line 6025 of file weapons.cpp.

bool weapon_armed ( weapon wp,
bool  hit_target 
)

Definition at line 6208 of file weapons.cpp.

void weapon_close ( )

Call from game_shutdown() only!!

Definition at line 3545 of file weapons.cpp.

int weapon_create ( vec3d pos,
matrix orient,
int  weapon_type,
int  parent_obj,
int  group_id = -1,
int  is_locked = 0,
int  is_spawned = 0,
float  fof_cooldown = 0.0f,
ship_subsys src_turret = NULL 
)

Definition at line 5246 of file weapons.cpp.

int weapon_create_group_id ( )

Definition at line 6481 of file weapons.cpp.

void weapon_delete ( object obj)

Definition at line 3822 of file weapons.cpp.

void weapon_detonate ( object objp)

Definition at line 6450 of file weapons.cpp.

void weapon_do_electronics_effect ( object ship_objp,
vec3d blast_pos,
int  wi_index 
)

Distrupt any subsystems that fall into damage sphere of this Electronics missile

Parameters
ship_objpPointer to ship that holds subsystem
blast_posWorld pos of weapon blast
wi_indexWeapon info index of weapon causing blast

Definition at line 5934 of file weapons.cpp.

float weapon_get_damage_scale ( weapon_info wip,
object wep,
object target 
)

Return a scale factor for damage which should be applied for 2 collisions

Definition at line 7137 of file weapons.cpp.

void weapon_get_laser_color ( color c,
object objp 
)

Get the "color" of the laser at the given moment (since glowing lasers can cycle colors)

Definition at line 6707 of file weapons.cpp.

void weapon_hit ( object weapon_obj,
object other_obj,
vec3d hitpos,
int  quadrant 
)

Called when a weapon hits something (or, in the case of missiles explodes for any particular reason)

Definition at line 6253 of file weapons.cpp.

void weapon_hit_do_sound ( object hit_obj,
weapon_info wip,
vec3d hitpos,
bool  is_armed 
)

Play a sound effect when a weapon hits a ship

To elimate the "stereo" effect of two lasers hitting at nearly the same time, and to reduce the number of sound channels used, only play one impact sound if IMPACT_SOUND_DELTA has elapsed

Note
Uses Weapon_impact_timer global for timer variable

Definition at line 5834 of file weapons.cpp.

int weapon_info_lookup ( const char *  name)

Return the index of Weapon_info[].name that is *name.

Definition at line 467 of file weapons.cpp.

void weapon_init ( )

This will get called once at game startup

Definition at line 3516 of file weapons.cpp.

void weapon_level_init ( )

This will get called at the start of each level.

Definition at line 3582 of file weapons.cpp.

void weapon_mark_as_used ( int  weapon_type)

Call before weapons_page_in to mark a weapon as used

Definition at line 6497 of file weapons.cpp.

void weapon_maybe_spew_particle ( object obj)

For weapons flagged as particle spewers, spew particles. wheee

Definition at line 6767 of file weapons.cpp.

void weapon_pause_sounds ( )

Definition at line 7248 of file weapons.cpp.

void weapon_process_post ( object obj,
float  frame_time 
)

Definition at line 4775 of file weapons.cpp.

void weapon_process_pre ( object obj,
float  frame_time 
)

Definition at line 4667 of file weapons.cpp.

void weapon_render ( object obj,
draw_list scene 
)

Definition at line 7268 of file weapons.cpp.

void weapon_render_DEPRECATED ( object obj)

Definition at line 3625 of file weapons.cpp.

void weapon_set_tracking_info ( int  weapon_objnum,
int  parent_objnum,
int  target_objnum,
int  target_is_locked,
ship_subsys target_subsys 
)

Update weapon tracking information.

Definition at line 5093 of file weapons.cpp.

void weapon_unpause_sounds ( )

Definition at line 7257 of file weapons.cpp.

Variable Documentation

int Default_cmeasure_index

Definition at line 117 of file weapons.cpp.

int First_secondary_index

Definition at line 116 of file weapons.cpp.

missile_obj Missile_obj_list

Definition at line 84 of file weapons.cpp.

int Num_player_weapon_precedence

Definition at line 124 of file weapons.cpp.

int Num_weapon_subtypes

Definition at line 92 of file weapons.cpp.

int Num_weapon_types

Definition at line 105 of file weapons.cpp.

int Num_weapons

Definition at line 107 of file weapons.cpp.

int Player_weapon_precedence[MAX_WEAPON_TYPES]

Definition at line 125 of file weapons.cpp.

weapon_explosions Weapon_explosions

Definition at line 101 of file weapons.cpp.

Definition at line 79 of file weapons.cpp.

char* Weapon_subtype_names[]

Definition at line 87 of file weapons.cpp.

weapon Weapons[MAX_WEAPONS]

Definition at line 78 of file weapons.cpp.