FS2_Open
Open source remastering of the Freespace 2 engine
|
#include "ai/aibig.h"
#include "asteroid/asteroid.h"
#include "cmdline/cmdline.h"
#include "cmeasure/cmeasure.h"
#include "debugconsole/console.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "graphics/grbatch.h"
#include "hud/hud.h"
#include "hud/hudartillery.h"
#include "iff_defs/iff_defs.h"
#include "io/joy_ff.h"
#include "io/timer.h"
#include "localization/localize.h"
#include "math/staticrand.h"
#include "mod_table/mod_table.h"
#include "model/modelrender.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "object/objcollide.h"
#include "object/object.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/ship.h"
#include "ship/shiphit.h"
#include "stats/scoring.h"
#include "weapon/beam.h"
#include "weapon/corkscrew.h"
#include "weapon/emp.h"
#include "weapon/flak.h"
#include "weapon/muzzleflash.h"
#include "weapon/swarm.h"
#include "weapon/weapon.h"
Go to the source code of this file.
Classes | |
struct | delayed_ssm_data |
struct | delayed_ssm_index_data |
Macros | |
#define | MISSILE_OBJ_USED (1<<0) |
#define | MAX_MISSILE_OBJS MAX_WEAPONS |
#define | IMPACT_SOUND_DELTA 50 |
#define | ESUCK_DEFAULT_WEAPON_REDUCE (10.0f) |
#define | ESUCK_DEFAULT_AFTERBURNER_REDUCE (10.0f) |
#define | SUPERCAP_DAMAGE_SCALE 0.25f |
#define | FLAK_DAMAGE_SCALE 0.05f |
#define | HOMING_DEFAULT_FREE_FLIGHT_TIME 0.5f |
#define | SWARM_MISSILE_DELAY 150 |
#define | LOCKED_HOMING_EXTENDED_LIFE_FACTOR 1.2f |
#define | DEFAULT_WEAPON_SPAWN_COUNT 10 |
#define | WEAPONS_MULTITEXT_LENGTH 2048 |
#define | SHAKE_CONST 3000 |
Typedefs | |
typedef struct delayed_ssm_data | delayed_ssm_data |
typedef struct delayed_ssm_index_data | delayed_ssm_index_data |
#define DEFAULT_WEAPON_SPAWN_COUNT 10 |
Definition at line 480 of file weapons.cpp.
#define ESUCK_DEFAULT_AFTERBURNER_REDUCE (10.0f) |
Definition at line 135 of file weapons.cpp.
#define ESUCK_DEFAULT_WEAPON_REDUCE (10.0f) |
Definition at line 134 of file weapons.cpp.
#define FLAK_DAMAGE_SCALE 0.05f |
Definition at line 141 of file weapons.cpp.
#define HOMING_DEFAULT_FREE_FLIGHT_TIME 0.5f |
Definition at line 144 of file weapons.cpp.
#define IMPACT_SOUND_DELTA 50 |
Definition at line 130 of file weapons.cpp.
#define LOCKED_HOMING_EXTENDED_LIFE_FACTOR 1.2f |
Definition at line 151 of file weapons.cpp.
#define MAX_MISSILE_OBJS MAX_WEAPONS |
Definition at line 82 of file weapons.cpp.
#define MISSILE_OBJ_USED (1<<0) |
Definition at line 81 of file weapons.cpp.
#define SHAKE_CONST 3000 |
#define SUPERCAP_DAMAGE_SCALE 0.25f |
Definition at line 138 of file weapons.cpp.
#define SWARM_MISSILE_DELAY 150 |
Definition at line 147 of file weapons.cpp.
#define WEAPONS_MULTITEXT_LENGTH 2048 |
Definition at line 1126 of file weapons.cpp.
typedef struct delayed_ssm_data delayed_ssm_data |
typedef struct delayed_ssm_index_data delayed_ssm_index_data |
bool aspect_should_lose_target | ( | weapon * | wp | ) |
Definition at line 4227 of file weapons.cpp.
Definition at line 5919 of file aicode.cpp.
dc_printf | ( | "Particle relative velocity set to %f\n" | , |
Weapon_particle_spew_vel | |||
) |
DCF | ( | pspew_count | , |
"Number of particles spewed at a time" | |||
) |
Definition at line 7002 of file weapons.cpp.
DCF | ( | pspew_time | , |
"Time between particle spews" | |||
) |
Definition at line 7019 of file weapons.cpp.
DCF | ( | pspew_size | , |
"Size of spewed particles" | |||
) |
Definition at line 7053 of file weapons.cpp.
DCF | ( | pspew_life | , |
"Lifetime of spewed particles" | |||
) |
Definition at line 7070 of file weapons.cpp.
Definition at line 7087 of file weapons.cpp.
DCF | ( | pspew | , |
"Particle spew help and status provider" | |||
) |
Definition at line 7104 of file weapons.cpp.
void dcf_pspew | ( | ) |
Debug console functionality
Detonate all missiles near this countermeasure.
Definition at line 3899 of file weapons.cpp.
Find an object for weapon num (object *weapon_objp) to home on due to heat.
Definition at line 3945 of file weapons.cpp.
Find object with signature "sig" and make weapon home on it.
Definition at line 4196 of file weapons.cpp.
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.
Scan all countermeasures. Maybe make weapon_objp home on it.
Definition at line 4075 of file weapons.cpp.
void fs2netd_add_table_validation | ( | const char * | tblname | ) |
Definition at line 1554 of file fs2netd_client.cpp.
size_t* get_pointer_to_weapon_fire_pattern_index | ( | int | weapon_type, |
ship * | shipp, | ||
ship_subsys * | src_turret | ||
) |
Definition at line 5214 of file weapons.cpp.
Definition at line 833 of file weapons.cpp.
Add a node from the Missile_obj_list.
Definition at line 406 of file weapons.cpp.
void missile_obj_list_init | ( | ) |
Clear out the Missile_obj_list
Definition at line 392 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.
Remove a node from the Missile_obj_list.
Definition at line 431 of file weapons.cpp.
void parse_shockwave_info | ( | shockwave_create_info * | sci, |
char * | pre_char | ||
) |
Definition at line 760 of file weapons.cpp.
Definition at line 1128 of file weapons.cpp.
void parse_weapon_expl_tbl | ( | const char * | filename | ) |
Definition at line 339 of file weapons.cpp.
void parse_weaponstbl | ( | const char * | filename | ) |
Definition at line 2898 of file weapons.cpp.
void parse_wi_flags | ( | weapon_info * | weaponp, |
int | wi_flags, | ||
int | wi_flags2, | ||
int | wi_flags3 | ||
) |
Definition at line 483 of file weapons.cpp.
void pause_in_flight_sounds | ( | ) |
Definition at line 7231 of file weapons.cpp.
Definition at line 7263 of file weapons.cpp.
Spawn child weapons from object *objp.
Definition at line 5676 of file weapons.cpp.
void translate_spawn_types | ( | ) |
For all weapons that spawn weapons, given an index at weaponp->spawn_type, convert the strings in Spawn_names to indices in the Weapon_types array.
Definition at line 2865 of file weapons.cpp.
bool turret_weapon_has_flags | ( | ship_weapon * | swp, |
int | flags | ||
) |
Returns true if any of the weapons in swp have flags
Definition at line 306 of file aiturret.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
force_apply_pos | World pos of where force is applied to object |
ship_objp | Object pointer of ship receiving the blast |
blast_pos | World pos of blast center |
blast | Force of blast |
make_shockwave | Boolean, 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.
objp | Object pointer ship receiving blast effect |
pos | World pos of blast center |
inner_rad | Smallest radius at which full damage is done |
outer_rad | Radius at which no damage is done |
max_blast | Maximum blast possible from explosion |
max_damage | Maximum damage possible from explosion |
blast | OUTPUT PARAMETER: receives blast value from explosion |
damage | OUTPUT PARAMETER: receives damage value from explosion |
limit | A limit on the area, needed for shockwave damage |
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_clean_entries | ( | ) |
Do any post-parse cleaning on weapon entries
Definition at line 3144 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 * | porient, | ||
int | weapon_type, | ||
int | parent_objnum, | ||
int | group_id, | ||
int | is_locked, | ||
int | is_spawned, | ||
float | fof_cooldown, | ||
ship_subsys * | src_turret | ||
) |
Definition at line 5246 of file weapons.cpp.
int weapon_create_group_id | ( | ) |
Definition at line 6481 of file weapons.cpp.
Definition at line 3822 of file weapons.cpp.
Definition at line 6450 of file weapons.cpp.
void weapon_do_area_effect | ( | object * | wobjp, |
shockwave_create_info * | sci, | ||
vec3d * | pos, | ||
object * | other_obj | ||
) |
Do the area effect for a weapon
wobjp | Object pointer to weapon causing explosion |
sci | Shockwave info |
pos | World pos of explosion center |
other_obj | Object pointer to ship that weapon impacted on (can be NULL) |
Definition at line 6118 of file weapons.cpp.
Distrupt any subsystems that fall into damage sphere of this Electronics missile
ship_objp | Pointer to ship that holds subsystem |
blast_pos | World pos of weapon blast |
wi_index | Weapon info index of weapon causing blast |
Definition at line 5934 of file weapons.cpp.
void weapon_do_post_parse | ( | ) |
Definition at line 3436 of file weapons.cpp.
void weapon_expl_info_init | ( | ) |
Definition at line 3487 of file weapons.cpp.
void weapon_generate_indexes_for_substitution | ( | ) |
Checks all of the weapon infos for substitution patterns and caches the weapon_index of any that it finds.
Definition at line 3412 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.
Get the "color" of the laser at the given moment (since glowing lasers can cycle colors)
Definition at line 6707 of file weapons.cpp.
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
Definition at line 5834 of file weapons.cpp.
Make weapon num home. It's also object *obj.
Definition at line 4256 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.
bool weapon_is_used | ( | int | weapon_index | ) |
Definition at line 3269 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.
Definition at line 3275 of file weapons.cpp.
Call before weapons_page_in to mark a weapon as used
Definition at line 6497 of file weapons.cpp.
Maybe play a "whizz sound" if close enough to view position
Definition at line 4717 of file weapons.cpp.
Check if missile is newly locked onto the Player, maybe play a launch warning
Definition at line 3877 of file weapons.cpp.
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_play_impact_sound | ( | weapon_info * | wip, |
vec3d * | hitpos, | ||
bool | is_armed | ||
) |
Figures out whether to play disarmed or armed hit sound, checks that the chosen one exists, and plays it
Definition at line 5809 of file weapons.cpp.
Definition at line 4775 of file weapons.cpp.
Definition at line 4667 of file weapons.cpp.
void weapon_release_bitmaps | ( | ) |
Definition at line 3177 of file weapons.cpp.
Definition at line 7268 of file weapons.cpp.
Definition at line 3625 of file weapons.cpp.
void weapon_reset_info | ( | ) |
Definition at line 3505 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_sort_by_type | ( | ) |
Definition at line 2986 of file weapons.cpp.
void weapon_unpause_sounds | ( | ) |
Definition at line 7257 of file weapons.cpp.
void weapons_page_in | ( | ) |
Definition at line 6512 of file weapons.cpp.
void weapons_page_in_cheats | ( | ) |
Page_in function for cheaters, grabs all weapons that weren't already in a mission and loads the models for them.
Non-model graphics elements will get loaded when they are rendered for the first time. Maybe not the best way to do this but faster and a lot less error prone.
Definition at line 6650 of file weapons.cpp.
flag_def_list Burst_fire_flags[] |
Definition at line 94 of file weapons.cpp.
int Default_cmeasure_index = -1 |
Definition at line 117 of file weapons.cpp.
SCP_map<SCP_string, delayed_ssm_data> Delayed_SSM_data |
Definition at line 60 of file weapons.cpp.
SCP_vector<SCP_string> Delayed_SSM_indices |
Definition at line 68 of file weapons.cpp.
SCP_map<SCP_string, delayed_ssm_index_data> Delayed_SSM_indices_data |
Definition at line 67 of file weapons.cpp.
SCP_vector<SCP_string> Delayed_SSM_names |
Definition at line 61 of file weapons.cpp.
int First_secondary_index = -1 |
Definition at line 116 of file weapons.cpp.
int Homing_hits = 0 |
Definition at line 4709 of file weapons.cpp.
int Homing_misses = 0 |
Definition at line 4709 of file weapons.cpp.
int laser_model_inner = -1 |
Definition at line 111 of file weapons.cpp.
int laser_model_outer = -1 |
Definition at line 112 of file weapons.cpp.
SCP_vector<lod_checker> LOD_checker |
Definition at line 103 of file weapons.cpp.
int missile_model = -1 |
Definition at line 114 of file weapons.cpp.
missile_obj Missile_obj_list |
Definition at line 84 of file weapons.cpp.
missile_obj Missile_objs[MAX_MISSILE_OBJS] |
Definition at line 83 of file weapons.cpp.
int Num_burst_fire_flags = sizeof(Burst_fire_flags)/sizeof(flag_def_list) |
Definition at line 99 of file weapons.cpp.
int Num_player_weapon_precedence |
Definition at line 124 of file weapons.cpp.
int Num_spawn_types = 0 |
Definition at line 121 of file weapons.cpp.
int Num_weapon_subtypes = sizeof(Weapon_subtype_names)/sizeof(char *) |
Definition at line 92 of file weapons.cpp.
int Num_weapon_types = 0 |
Definition at line 105 of file weapons.cpp.
int Num_weapons = 0 |
Definition at line 107 of file weapons.cpp.
int Player_weapon_precedence[MAX_WEAPON_TYPES] |
Definition at line 125 of file weapons.cpp.
char** Spawn_names = NULL |
Definition at line 122 of file weapons.cpp.
int Weapon_expl_initted = 0 |
Definition at line 109 of file weapons.cpp.
weapon_explosions Weapon_explosions |
Definition at line 101 of file weapons.cpp.
int Weapon_flyby_sound_enabled = 1 |
Definition at line 72 of file weapons.cpp.
const int weapon_glow_alpha = 217 |
Definition at line 3623 of file weapons.cpp.
const float weapon_glow_scale_f = 2.3f |
Definition at line 3620 of file weapons.cpp.
const float weapon_glow_scale_l = 1.5f |
Definition at line 3622 of file weapons.cpp.
const float weapon_glow_scale_r = 2.3f |
Definition at line 3621 of file weapons.cpp.
int Weapon_impact_timer |
Definition at line 131 of file weapons.cpp.
weapon_info Weapon_info[MAX_WEAPON_TYPES] |
Definition at line 79 of file weapons.cpp.
int Weapon_particle_spew_count = 1 |
Definition at line 6757 of file weapons.cpp.
float Weapon_particle_spew_lifetime = 0.15f |
Definition at line 6761 of file weapons.cpp.
float Weapon_particle_spew_radius = 2.0f |
Definition at line 6760 of file weapons.cpp.
float Weapon_particle_spew_scale = 0.8f |
Definition at line 6762 of file weapons.cpp.
int Weapon_particle_spew_time = 25 |
Definition at line 6758 of file weapons.cpp.
float Weapon_particle_spew_vel = 0.4f |
Definition at line 6759 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.
int Weapons_created = 0 |
Create a weapon object
Definition at line 5245 of file weapons.cpp.
int Weapons_inited = 0 |
Definition at line 108 of file weapons.cpp.