76 static int Weapon_flyby_sound_timer;
81 #define MISSILE_OBJ_USED (1<<0) // flag used in missile_obj struct
82 #define MAX_MISSILE_OBJS MAX_WEAPONS // max number of missiles tracked in missile list
119 static int *used_weapons = NULL;
130 #define IMPACT_SOUND_DELTA 50 // in milliseconds
134 #define ESUCK_DEFAULT_WEAPON_REDUCE (10.0f)
135 #define ESUCK_DEFAULT_AFTERBURNER_REDUCE (10.0f)
138 #define SUPERCAP_DAMAGE_SCALE 0.25f
141 #define FLAK_DAMAGE_SCALE 0.05f
144 #define HOMING_DEFAULT_FREE_FLIGHT_TIME 0.5f
147 #define SWARM_MISSILE_DELAY 150
151 #define LOCKED_HOMING_EXTENDED_LIFE_FACTOR 1.2f
160 ExplosionInfo.clear();
163 int weapon_explosions::GetIndex(
char *
filename)
165 if ( filename == NULL ) {
170 for (
size_t i = 0;
i < ExplosionInfo.size();
i++) {
171 if ( !
stricmp(ExplosionInfo[
i].
lod[0].filename, filename)) {
189 int idx = GetIndex(filename);
200 Warning(
LOCATION,
"Weapon explosion '%s' does not have an LOD0 anim!", filename);
208 for (idx = 1; idx < expected_lods; idx++) {
209 sprintf(name_tmp,
"%s_%d", filename, idx);
226 Warning(
LOCATION,
"For '%s', %i of %i LODs are missing!", filename, expected_lods - new_wei.
lod_count, expected_lods);
229 Warning(
LOCATION,
"Filename '%s' is too long to have any LODs.", filename);
232 ExplosionInfo.push_back( new_wei );
234 return (
int)(ExplosionInfo.size() - 1);
241 if ( (idx < 0) || (idx >= (
int)ExplosionInfo.size()) )
255 if ( (weapon_expl_index < 0) || (weapon_expl_index >= (
int)ExplosionInfo.size()) )
266 int x,
y,
w,
h, bm_size;
303 }
else if(w <= bm_size/2){
305 }
else if(w <= 1.3
f*bm_size){
314 }
else if(w <= bm_size/3){
316 }
else if(w <= (1.15
f*bm_size)){
368 for (i = 0; i < LOD_checker.size(); i++) {
370 LOD_checker[
i].num_lods = lod_check.
num_lods;
375 if (i == LOD_checker.size()) {
376 LOD_checker.push_back(lod_check);
384 mprintf((
"TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
398 Missile_objs[
i].
flags = 0;
414 if ( i == MAX_MISSILE_OBJS ) {
415 Error(
LOCATION,
"Fatal Error: Ran out of missile object nodes\n");
419 Missile_objs[
i].
flags = 0;
420 Missile_objs[
i].
objnum = objnum;
434 list_remove(&Missile_obj_list, &Missile_objs[index]);
461 return &Missile_objs[
index];
474 if (!
stricmp(name, Weapon_info[
i].name))
480 #define DEFAULT_WEAPON_SPAWN_COUNT 10
485 const char *spawn_str =
NOX(
"Spawn");
486 const size_t spawn_str_len = strlen(spawn_str);
504 bool set_pierce =
false;
505 bool set_nopierce =
false;
507 for (
int i=0;
i<num_strings;
i++) {
508 if (!
strnicmp(spawn_str, weapon_strings[
i], 5))
514 if((Num_spawn_types % 10) == 0) {
515 Spawn_names = (
char **)
vm_realloc(Spawn_names, (Num_spawn_types + 10) *
sizeof(*Spawn_names));
518 int skip_length, name_length;
521 temp_string = weapon_strings[
i];
525 skip_length = spawn_str_len + strspn(&temp_string[spawn_str_len],
NOX(
" \t"));
526 char *num_start = strchr(&temp_string[skip_length],
',');
527 if (num_start == NULL) {
532 name_length = num_start - temp_string - skip_length;
543 }
else if (!
stricmp(
NOX(
"Remote Detonate"), weapon_strings[i]))
545 else if (!
stricmp(
NOX(
"Puncture"), weapon_strings[i]))
547 else if (!
stricmp(
NOX(
"Big Ship"), weapon_strings[i]))
549 else if (!
stricmp(
NOX(
"Huge"), weapon_strings[i]))
551 else if (!
stricmp(
NOX(
"Bomber+"), weapon_strings[i]))
553 else if (!
stricmp(
NOX(
"child"), weapon_strings[i]))
555 else if (!
stricmp(
NOX(
"Bomb"), weapon_strings[i]))
557 else if (!
stricmp(
NOX(
"No Dumbfire"), weapon_strings[i]))
559 else if (!
stricmp(
NOX(
"In tech database"), weapon_strings[i]))
561 else if (!
stricmp(
NOX(
"Player allowed"), weapon_strings[i]))
563 else if (!
stricmp(
NOX(
"Particle Spew"), weapon_strings[i]))
565 else if (!
stricmp(
NOX(
"EMP"), weapon_strings[i]))
567 else if (!
stricmp(
NOX(
"Esuck"), weapon_strings[i]))
569 else if (!
stricmp(
NOX(
"Flak"), weapon_strings[i]))
571 else if (!
stricmp(
NOX(
"Corkscrew"), weapon_strings[i]))
573 else if (!
stricmp(
NOX(
"Shudder"), weapon_strings[i]))
575 else if (!
stricmp(
NOX(
"Electronics"), weapon_strings[i]))
577 else if (!
stricmp(
NOX(
"lockarm"), weapon_strings[i]))
579 else if (!
stricmp(
NOX(
"beam"), weapon_strings[i]))
586 else if (!
stricmp(
NOX(
"stream"), weapon_strings[i]))
588 else if (!
stricmp(
NOX(
"supercap"), weapon_strings[i]))
590 else if (!
stricmp(
NOX(
"countermeasure"), weapon_strings[i]))
592 else if (!
stricmp(
NOX(
"ballistic"), weapon_strings[i]))
594 else if (!
stricmp(
NOX(
"pierce shields"), weapon_strings[i]))
596 else if (!
stricmp(
NOX(
"no pierce shields"), weapon_strings[i]))
598 else if (!
stricmp(
NOX(
"local ssm"), weapon_strings[i]))
600 else if (!
stricmp(
NOX(
"tagged only"), weapon_strings[i]))
602 else if (!
stricmp(
NOX(
"beam no whack"), weapon_strings[i]))
604 Warning(
LOCATION,
"The \"beam no whack\" flag has been deprecated. Set the beam's mass to 0 instead. This has been done for you.\n");
605 weaponp->
mass = 0.0f;
607 else if (!
stricmp(
NOX(
"cycle"), weapon_strings[i]))
609 else if (!
stricmp(
NOX(
"small only"), weapon_strings[i]))
611 else if (!
stricmp(
NOX(
"same turret cooldown"), weapon_strings[i]))
613 else if (!
stricmp(
NOX(
"apply no light"), weapon_strings[i]))
615 else if (!
stricmp(
NOX(
"training"), weapon_strings[i]))
617 else if (!
stricmp(
NOX(
"smart spawn"), weapon_strings[i]))
619 else if (!
stricmp(
NOX(
"inherit parent target"), weapon_strings[i]))
621 else if (!
stricmp(
NOX(
"no emp kill"), weapon_strings[i]))
623 else if (!
stricmp(
NOX(
"untargeted heat seeker"), weapon_strings[i]))
625 else if (!
stricmp(
NOX(
"no radius doubling"), weapon_strings[i])) {
630 Warning(
LOCATION,
"Weapon %s is not a bomb but has \"no radius doubling\" set. Ignoring this flag", weaponp->
name);
633 else if (!
stricmp(
NOX(
"no subsystem homing"), weapon_strings[i]))
635 else if (!
stricmp(
NOX(
"no lifeleft penalty"), weapon_strings[i]))
637 else if (!
stricmp(
NOX(
"can be targeted"), weapon_strings[i]))
639 else if (!
stricmp(
NOX(
"show on radar"), weapon_strings[i]))
641 else if (!
stricmp(
NOX(
"show friendly on radar"), weapon_strings[i]))
643 else if (!
stricmp(
NOX(
"capital+"), weapon_strings[i]))
645 else if (!
stricmp(
NOX(
"chain external model fps"), weapon_strings[i]))
647 else if (!
stricmp(
NOX(
"external model launcher"), weapon_strings[i]))
649 else if (!
stricmp(
NOX(
"takes blast damage"), weapon_strings[i]))
651 else if (!
stricmp(
NOX(
"takes shockwave damage"), weapon_strings[i]))
653 else if (!
stricmp(
NOX(
"hide from radar"), weapon_strings[i]))
655 else if (!
stricmp(
NOX(
"render flak"), weapon_strings[i]))
657 else if (!
stricmp(
NOX(
"ciws"), weapon_strings[i]))
659 else if (!
stricmp(
NOX(
"anti-subsystem beam"), weapon_strings[i]))
661 else if (!
stricmp(
NOX(
"no primary linking"), weapon_strings[i]))
663 else if (!
stricmp(
NOX(
"same emp time for capships"), weapon_strings[i]))
665 else if (!
stricmp(
NOX(
"no primary linked penalty"), weapon_strings[i]))
667 else if (!
stricmp(
NOX(
"no homing speed ramp"), weapon_strings[i]))
669 else if (!
stricmp(
NOX(
"pulls aspect seekers"), weapon_strings[i]))
673 Warning(
LOCATION,
"\"pulls aspect seekers\" may only be used for countermeasures!");
680 else if (!
stricmp(
NOX(
"interceptable"), weapon_strings[i]))
682 else if (!
stricmp(
NOX(
"turret interceptable"), weapon_strings[i]))
684 else if (!
stricmp(
NOX(
"fighter interceptable"), weapon_strings[i]))
686 else if (!
stricmp(
NOX(
"apply recoil"), weapon_strings[i]))
688 else if (!
stricmp(
NOX(
"don't spawn if shot"), weapon_strings[i]))
690 else if (!
stricmp(
NOX(
"die on lost lock"), weapon_strings[i])) {
692 Warning(
LOCATION,
"\"die on lost lock\" may only be used for Homing Type ASPECT/JAVELIN!");
699 Warning(
LOCATION,
"Bogus string in weapon flags: %s\n", weapon_strings[i]);
717 Warning(
LOCATION,
"Swarm, Corkscrew, and Flak are mutually exclusive! Removing Swarm and Corkscrew attributes.\n");
726 Warning(
LOCATION,
"Swarm and Corkscrew are mutually exclusive! Defaulting to Swarm.\n");
741 Warning(
LOCATION,
"\"small only\" and \"huge\" flags are mutually exclusive.\nThey are used together in %s\nAI will most likely not use this weapon",weaponp->
name);
746 Warning(
LOCATION,
"\"smart spawn\" flag used without \"spawn\" flag in %s\n",weaponp->
name);
751 Warning(
LOCATION,
"Weapon %s has the \"inherit parent target\" flag, but not the \"child\" flag. No changes in behavior will occur.", weaponp->
name);
756 Warning(
LOCATION,
"Weapon '%s' has the \"untargeted heat seeker\" flag, but Homing Type is not set to \"HEAT\".", weaponp->
name);
764 sprintf(buf,
"%sShockwave damage:", pre_char);
769 sprintf(buf,
"%sShockwave damage type:", pre_char);
776 sprintf(buf,
"%sBlast Force:", pre_char);
781 sprintf(buf,
"%sInner Radius:", pre_char);
786 sprintf(buf,
"%sOuter Radius:", pre_char);
792 Warning(
LOCATION,
"Shockwave outer radius must be greater than or equal to the inner radius!");
796 sprintf(buf,
"%sShockwave Speed:", pre_char);
801 sprintf(buf,
"%sShockwave Rotation:", pre_char);
805 for(
int i = 0;
i < 3;
i++)
807 angs[
i] = angs[
i] * (
PI2/180.0f);
822 sprintf(buf,
"%sShockwave Model:", pre_char);
827 sprintf(buf,
"%sShockwave Name:", pre_char);
845 memset(wip->
name, 0,
sizeof(wip->
name));
1064 bsip->flicker = 0.1f;
1065 bsip->z_add =
i2fl(MAX_BEAM_SECTIONS - i - 1);
1066 bsip->tile_type = 0;
1067 bsip->tile_factor = 1.0f;
1068 bsip->translation = 0.0f;
1126 #define WEAPONS_MULTITEXT_LENGTH 2048
1134 int primary_rearm_rate_specified=0;
1135 bool first_time =
false;
1136 bool create_if_not_found =
true;
1147 Warning(
LOCATION,
"+nocreate flag used for weapon in non-modular table");
1149 create_if_not_found =
false;
1155 if ( fname[0] ==
'@' ) {
1163 wip = &Weapon_info[w_id];
1166 Warning(
LOCATION,
"Weapon name %s already exists in weapons.tbl. All weapon names must be unique; the second entry has been skipped", wip->
name);
1176 if(!create_if_not_found && replace)
1205 if(!
stricmp(
"Primary", fname)) {
1207 }
else if(!
stricmp(
"Secondary", fname)) {
1216 Warning(
LOCATION,
"Type of weapon %s entry does not agree with original entry type.", wip->
name);
1229 if (wip->
desc != NULL) {
1273 else if (!
stricmp(effect,
"FS1"))
1275 else if (!
stricmp(effect,
"off"))
1321 mprintf((
"WARNING: Weapon '%s' has both LASER and POF render types! Will only use POF type!\n", wip->
name));
1334 mprintf((
"WARNING: Laser glow specified on non-LASER type weapon (%s)!\n", wip->
name));
1348 bool reset = (!first_time && (
1367 }
else if (first_time) {
1388 if ((!strcmp(wip->
name,
"SAAA") && (wip->
mass == 4.0f))
1389 || (!strcmp(wip->
name,
"MjolnirBeam") && (wip->
mass == 1000.0f))
1390 || (!strcmp(wip->
name,
"MjolnirBeam#home") && (wip->
mass == 1000.0f)))
1432 Warning(
LOCATION,
"+Min Damage: and +Max Damage: in %s are deprecated, please change to +Attenuation Damage:.", wip->
name);
1510 Warning(
LOCATION,
"Lifetime min for weapon '%s' cannot be less than 0. Setting to 0.\n", wip->
name);
1519 Warning(
LOCATION,
"Lifetime max for weapon '%s' cannot be less than 0. Setting to 0.\n", wip->
name);
1531 Warning(
LOCATION,
"Lifetime min, but not lifetime max, specified for weapon %s. Assuming static lifetime of %.2f seconds.\n", wip->
name, wip->
lifetime);
1536 Warning(
LOCATION,
"Lifetime min or max specified, but $Lifetime was also specified; min or max will be used.");
1540 Warning(
LOCATION,
"Lifetime is lower than Damage Time, setting Damage Time to be one half the value of Lifetime.");
1555 bool is_homing=
false;
1592 else if (!
stricmp(temp_type,
NOX(
"JAVELIN")))
1610 float view_cone_angle;
1628 Warning(
LOCATION,
"Seeker Strength for missile \'%s\' must be greater than zero\nReseting value to default.", wip->
name);
1657 float view_cone_angle;
1686 Warning(
LOCATION,
"Seeker Strength for missile \'%s\' must be greater than zero\nReseting value to default.", wip->
name);
1714 Error(
LOCATION,
"Illegal homing type = %s.\nMust be HEAT, ASPECT or JAVELIN.\n", temp_type);
1755 }
else if(first_time && is_homing) {
1762 nprintf((
"Warning",
"Ignoring free flight speed for weapon '%s'\n", wip->
name));
1796 if (!
stricmp(type.c_str(),
"TARGETED"))
1800 else if (!
stricmp(type.c_str(),
"UNTARGETED"))
1804 else if (!
stricmp(type.c_str(),
"ALWAYS"))
1810 Warning(
LOCATION,
"Unknown in-flight sound type \"%s\"!", type.c_str());
1822 primary_rearm_rate_specified = 0;
1828 primary_rearm_rate_specified = 1;
1832 if (rearm_rate > 0.0
f)
1873 if (!primary_rearm_rate_specified && first_time)
1875 Warning(
LOCATION,
"$Rearm Rate for ballistic primary %s not specified. Defaulting to 100...\n", wip->
name);
1883 if (primary_rearm_rate_specified)
1896 Warning(
LOCATION,
"Secondary weapon %s can't be ballistic. Removing this flag...\n", wip->
name);
1906 Warning(
LOCATION,
"Outer blast radius of weapon %s is zero - EMP will not work.\nAdd $Outer Radius to weapon table entry.\n", wip->
name);
1973 }
else if (first_time) {
1982 }
else if (first_time) {
1988 else if (first_time)
2036 Warning(
LOCATION,
"$Recoil Modifier specified for weapon %s but this weapon does not have the \"apply recoil\" weapon flag set. Automatically setting the flag", wip->
name);
2132 int num_spawn_angs_defined = 0;
2142 num_spawn_angs_defined++;
2173 Warning(
LOCATION,
"Weapon \'%s\' has countermeasure information defined, but the \"countermeasure\" flag wasn\'t found in the \'$Flags:\' field.\n", wip->
name);
2256 sprintf(miss_factor_string,
"+%s Miss Factor:",
Iff_info[iff].iff_name);
2294 Warning(
LOCATION,
"Type D beam weapon, '%s', has less than one \"+Shots\" specified! It must be set to at least 1!!", wip->
name);
2349 bool nocreate =
false,
remove =
false;
2350 int bsw_index_override = -1;
2368 if (bsw_index_override >= 0) {
2369 if (bsw_index_override < wip->b_info.beam_num_sections) {
2385 Warning(
LOCATION,
"Invalid index for manually-indexed beam section %d, and +nocreate specified, on weapon %s", bsw_index_override, wip->
name);
2414 if (!
stricmp(fname,
"invisible")) {
2444 mprintf((
"WARNING: Invalid value found for +Flicker on section %d of beam %s. Valid range is 0.0 to 1.0, values will be adjusted.\n", wip->
b_info.
beam_num_sections, wip->
name));
2473 int spew_index = -1;
2476 Warning(
LOCATION,
"$Pspew specified for weapon %s but this weapon does not have the \"Particle Spew\" weapon flag set. Automatically setting the flag", wip->
name);
2489 if (spew_index < 0) {
2490 Warning(
LOCATION,
"+Index not specified or is out of range, can not remove spewer.");
2506 if (spew_index < 0) {
2516 if ( spew_index < 0 ) {
2523 if (!
stricmp(temp_pspew_type,
NOX(
"DEFAULT"))) {
2525 }
else if (!
stricmp(temp_pspew_type,
NOX(
"HELIX"))) {
2527 }
else if (!
stricmp(temp_pspew_type,
NOX(
"SPARKLER"))) {
2529 }
else if (!
stricmp(temp_pspew_type,
NOX(
"RING"))) {
2531 }
else if (!
stricmp(temp_pspew_type,
NOX(
"PLUME"))) {
2615 if (Delayed_SSM_data.find(wip->
name) == Delayed_SSM_data.end())
2616 Delayed_SSM_names.push_back(wip->
name);
2617 Delayed_SSM_data[wip->
name] = temp_data;
2623 if (Delayed_SSM_indices_data.find(wip->
name) == Delayed_SSM_indices_data.end())
2624 Delayed_SSM_indices.push_back(wip->
name);
2625 Delayed_SSM_indices_data[wip->
name] = temp_data;
2644 Warning(
LOCATION,
"WARNING: +Max FOF must be at least as big as $FOF for '%s'! Defaulting to match $FOF, no spread will occur!", wip->
name);
2658 mprintf((
"WARNING: The decal system has been deactivated in FSO builds. Entries for weapon %s will be discarded.\n", wip->
name));
2687 Warning(
LOCATION,
"WARNING: Alpha is set to 0 or a negative value for '%s'! Defaulting to 1.0!", wip->
name);
2699 Warning(
LOCATION,
"WARNING: Alpha is set to cycle for '%s', but max and min values are the same!", wip->
name);
2761 Warning(
LOCATION,
"%s is a tag missile, but the target must be tagged to shoot it", wip->
name);
2780 if ( period <= 0 ) {
2781 Warning(
LOCATION,
"Substitution '%s' for weapon '%s' requires a period greater than 0. Setting period to 1.", subname, wip->
name);
2786 if ( offset <= 0 ) {
2787 Warning(
LOCATION,
"Period offset for substitution '%s' of weapon '%s' has to be greater than 0. Setting offset to 1.", subname, wip->
name);
2794 Warning(
LOCATION,
"Substitution '%s' for weapon '%s' requires an index greater than 0. Setting index to 0.", subname, wip->
name);
2812 size_t desired_size = current_size*period;
2820 for (
size_t i = current_size;
i < desired_size;
i++ ) {
2828 for (
size_t pos = (period + offset - 1) % period;
2873 if ( (Weapon_info[i].spawn_info[j].spawn_type > -1) && (Weapon_info[i].spawn_info[j].spawn_type < Num_spawn_types) )
2877 Assert( spawn_type < Num_spawn_types );
2881 if ( !
stricmp(Spawn_names[spawn_type], Weapon_info[k].
name) )
2886 Warning(
LOCATION,
"Weapon %s spawns itself. Infinite recursion?\n", Weapon_info[i].name);
2896 static char Default_cmeasure_name[
NAME_LENGTH] =
"";
2952 if (!strlen(Default_cmeasure_name)) {
2954 strcpy_s(Default_cmeasure_name, Weapon_info[idx].
name);
2974 mprintf((
"TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
2988 weapon_info *lasers = NULL, *big_lasers = NULL, *beams = NULL, *missiles = NULL, *big_missiles = NULL, *child_primaries = NULL, *child_secondaries = NULL;
2989 int num_lasers = 0, num_big_lasers = 0, num_beams = 0, num_missiles = 0, num_big_missiles = 0, num_child_primaries = 0, num_child_secondaries = 0;
2990 int i, weapon_index;
2994 switch (Weapon_info[i].
subtype)
3000 if (Weapon_info[i].wi_flags &
WIF_CHILD)
3001 num_child_primaries++;
3013 if (Weapon_info[i].wi_flags & WIF_CHILD)
3014 num_child_secondaries++;
3015 else if (Weapon_info[i].wi_flags & WIF_BIG_ONLY)
3030 Verify( lasers != NULL );
3034 if (num_big_lasers) {
3036 Verify( big_lasers != NULL );
3048 Verify( missiles != NULL );
3052 if (num_big_missiles) {
3054 Verify( big_missiles != NULL );
3055 num_big_missiles = 0;
3058 if (num_child_primaries) {
3059 child_primaries =
new weapon_info[num_child_primaries];
3060 Verify( child_primaries != NULL );
3061 num_child_primaries = 0;
3064 if (num_child_secondaries) {
3065 child_secondaries =
new weapon_info[num_child_secondaries];
3066 Verify( child_secondaries != NULL );
3067 num_child_secondaries = 0;
3072 switch (Weapon_info[i].
subtype)
3078 if (Weapon_info[i].wi_flags &
WIF_CHILD)
3079 child_primaries[num_child_primaries++] = Weapon_info[
i];
3081 big_lasers[num_big_lasers++] = Weapon_info[
i];
3083 lasers[num_lasers++] = Weapon_info[
i];
3087 beams[num_beams++] = Weapon_info[
i];
3091 if (Weapon_info[i].wi_flags & WIF_CHILD)
3092 child_secondaries[num_child_secondaries++] = Weapon_info[
i];
3093 else if (Weapon_info[i].wi_flags & WIF_BIG_ONLY)
3094 big_missiles[num_big_missiles++] = Weapon_info[
i];
3096 missiles[num_missiles++]=Weapon_info[
i];
3107 for (i = 0; i < num_lasers; i++, weapon_index++)
3108 Weapon_info[weapon_index] = lasers[i];
3110 for (i = 0; i < num_big_lasers; i++, weapon_index++)
3111 Weapon_info[weapon_index] = big_lasers[i];
3113 for (i = 0; i < num_beams; i++, weapon_index++)
3114 Weapon_info[weapon_index] = beams[i];
3116 for (i = 0; i < num_child_primaries; i++, weapon_index++)
3117 Weapon_info[weapon_index] = child_primaries[i];
3120 First_secondary_index = weapon_index;
3122 for (i = 0; i < num_missiles; i++, weapon_index++)
3123 Weapon_info[weapon_index] = missiles[i];
3125 for (i = 0; i < num_big_missiles; i++, weapon_index++)
3126 Weapon_info[weapon_index] = big_missiles[i];
3128 for (i = 0; i < num_child_secondaries; i++, weapon_index++)
3129 Weapon_info[weapon_index] = child_secondaries[i];
3132 if (lasers)
delete [] lasers;
3133 if (big_lasers)
delete [] big_lasers;
3134 if (beams)
delete [] beams;
3135 if (missiles)
delete [] missiles;
3136 if (big_missiles)
delete [] big_missiles;
3137 if (child_primaries)
delete [] child_primaries;
3138 if (child_secondaries)
delete [] child_secondaries;
3150 wip = &Weapon_info[
i];
3158 int new_idx = s_idx + 1;
3191 wip = &Weapon_info[
i];
3199 if ( used_weapons[i] )
3271 Assert( (weapon_index >= 0) || (weapon_index < Num_weapon_types) );
3272 return (used_weapons[weapon_index] > 0);
3283 if ( (weapon_index < 0) || (weapon_index >= Num_weapon_types) ) {
3288 wip = &Weapon_info[weapon_index];
3299 mprintf((
"Could not find a usable bitmap for '%s'!\n", wip->
name));
3313 mprintf((
"Could not find a usable glow bitmap for '%s'!\n", wip->
name));
3334 mprintf((
"Could not find a usable muzzle glow bitmap for '%s'!\n", wip->
name));
3353 mprintf((
"Could not find a usable beam section (%i) bitmap for '%s'!\n",
i, wip->
name));
3380 mprintf((
"Could not find a usable particle spew bitmap for '%s'!\n", wip->
name));
3405 if ( !used_weapons[weapon_index] )
3406 used_weapons[weapon_index]++;
3418 int weapon_index = -1;
3421 if ( weapon_index == -1 ) {
3422 Warning(
LOCATION,
"Weapon '%s' requests substitution with '%s' which does not seem to exist",
3439 int first_cmeasure_index = -1;
3446 Default_cmeasure_index = -1;
3450 wip = &Weapon_info[
i];
3453 if ( (Default_cmeasure_index < 0) && strlen(Default_cmeasure_name) ) {
3454 if ( !
stricmp(wip->
name, Default_cmeasure_name) ) {
3455 Default_cmeasure_index =
i;
3461 first_cmeasure_index =
i;
3465 if (Default_cmeasure_index < 0)
3466 Default_cmeasure_index = first_cmeasure_index;
3471 if (*ii->cmeasure_name)
3475 Warning(
LOCATION,
"Could not find weapon type '%s' to use as countermeasure on species '%s'", ii->cmeasure_name, ii->species_name);
3476 else if (Weapon_info[index].wi_flags &
WIF_BEAM)
3477 Warning(
LOCATION,
"Attempt made to set a beam weapon as a countermeasure on species '%s'", ii->species_name);
3479 ii->cmeasure_index =
index;
3497 for (i = 0; i < (
int)LOD_checker.size(); i++) {
3498 Weapon_explosions.
Load( LOD_checker[i].filename, LOD_checker[i].num_lods );
3502 LOD_checker.clear();
3518 if ( !Weapons_inited ) {
3525 Num_weapon_types = 0;
3526 Num_spawn_types = 0;
3550 if (Weapon_info[i].desc) {
3552 Weapon_info[
i].
desc = NULL;
3555 if (Weapon_info[i].tech_desc) {
3556 vm_free(Weapon_info[i].tech_desc);
3561 if (used_weapons != NULL) {
3562 delete[] used_weapons;
3563 used_weapons = NULL;
3566 if (Spawn_names != NULL) {
3568 if (Spawn_names[i] != NULL) {
3570 Spawn_names[
i] = NULL;
3608 if (used_weapons == NULL)
3612 memset(used_weapons, 0, Num_weapon_types *
sizeof(
int));
3614 Weapon_flyby_sound_timer =
timestamp(0);
3615 Weapon_impact_timer = 1;
3636 num = obj->instance;
3713 vec3d headp2, tailp;
3773 ft *= (1.0f +
frand()/5.0f - 1.0f/10.0f);
3871 Assert(Num_weapons >= 0);
3911 nprintf((
"Countermeasures",
"Countermeasure (%s-%i) detonated missile (%s-%i) Frame: %i\n",
3929 nprintf((
"Countermeasures",
"Countermeasure (%s-%i) detonated missile (%s-%i) Frame: %i\n",
3947 object *
objp, *old_homing_objp;
3953 int homing_object_team;
3956 vec3d vec_to_object;
3963 best_dist = 99999.9f;
3985 homing_object_team =
obj_team(objp);
4016 if (!target_engines)
4037 if (Weapons[objp->
instance].lssm_stage == 3)
4049 if (dot > wip->
fov) {
4050 if (dist < best_dist) {
4080 float best_dot, dist, dot;
4082 wp = &Weapons[weapon_objp->
instance];
4085 best_dot = wip->
fov;
4098 if (objp==weapon_objp)
4105 vec3d vec_to_object;
4108 if (dist < cm_wip->cm_effective_rad)
4119 nprintf((
"CounterMeasures",
"Weapon (%s-%04i) already seen CounterMeasure (%s-%04i) Frame: %i\n",
4141 if (
frand() >= chance) {
4143 nprintf((
"CounterMeasures",
"Weapon (%s-%04i) ignoring CounterMeasure (%s-%04i) Frame: %i\n",
4155 nprintf((
"CounterMeasures",
"Weapon (%s-%04i) chasing CounterMeasure (%s-%04i) Frame: %i\n",
4172 object *weapon_objp;
4200 object *old_homing_objp;
4202 wp = &Weapons[weapon_objp->
instance];
4242 if (!home_on_cmeasure)
4399 switch (hobjp->
type) {
4489 if (dist < hobj_infop->cm_detonation_rad)
4501 int pick_homing_point = 0;
4503 pick_homing_point = 1;
4508 if (hobjp->
radius < 40.0f) {
4509 target_pos = hobjp->
pos;
4514 if ( !pick_homing_point ) {
4555 target_pos = hobjp->
pos;
4571 float dist_to_target, time_to_target;
4574 time_to_target = dist_to_target/max_speed;
4585 if ((dist_to_target < flFrametime * obj->phys_info.speed * 4.0f + 10.0f) &&
4586 (old_dot < wip->
fov) &&
4596 if ((old_dot > 0.1
f) && (time_to_target > 0.1
f)) {
4617 Warning(
LOCATION,
"Tried to make weapon '%s' home, but found it wasn't aspect-seeking or heat-seeking or a Javelin!", wip->
name);
4623 if (old_dot < 0.90
f) {
4725 float dist, dot, radius;
4739 if ( (dist > radius) && (dist < 55) ) {
4740 vec3d vec_to_weapon;
4752 dot =
vm_vec_dot(&vec_to_weapon, &weapon_objp->orient.vec.fvec);
4754 if ( (dot < -0.80) && (dot > -0.98) ) {
4755 if(Weapon_info[wp->weapon_info_index].
flyby_snd != -1) {
4762 Weapon_flyby_sound_timer =
timestamp(200);
4790 Assert( Weapons[num].objnum == objnum );
4884 if (cur_dist < wp->nearest_dist) {
4903 if (parent_aip != NULL) {
4904 if (cur_dist > 100.0
f)
4909 }
else if (dot > 0.1
f) {
4982 mprintf((
"LSSM: Failed to create warp effect! Please report if this happens frequently.\n"));
5033 mprintf((
"LSSM: Failed to create warp effect! Please report if this happens frequently.\n"));
5063 bool play_sound =
false;
5095 object *parent_objp;
5098 int targeting_same = 0;
5100 if ( weapon_objnum < 0 ) {
5113 if (parent_objnum >= 0) {
5114 parent_objp = &Objects[parent_objnum];
5131 int target_team = -1;
5132 if ( target_objnum >= 0 ) {
5133 int obj_type = Objects[target_objnum].type;
5135 target_team =
obj_team(&Objects[target_objnum]);
5156 wp->
target_sig = Objects[target_objnum].signature;
5166 ship *target_ship = &
Ships[Objects[target_objnum].instance];
5220 ship_weapon_p = &src_turret->
weapons;
5222 Assert( ship_weapon_p != NULL );
5250 object *
objp, *parent_objp=NULL;
5254 Assert(weapon_type >= 0 && weapon_type < Num_weapon_types);
5256 wip = &Weapon_info[weapon_type];
5261 Warning(
LOCATION,
"An attempt to fire a beam ('%s') through weapon_create() was made.\n", wip->
name);
5266 if(parent_objnum >= 0){
5267 parent_objp = &
Objects[parent_objnum];
5276 "Ship index is %d, which is out of range [%d,%d)", parent_objp->
instance, 0,
MAX_SHIPS);
5278 Assert( parent_shipp != NULL );
5304 nprintf((
"WARNING",
"Deleted %d weapons because of lack of slots\n", num_deleted));
5305 if (num_deleted == 0){
5311 if (Weapons[n].weapon_info_index < 0){
5316 if (n == MAX_WEAPONS) {
5336 if ( !used_weapons[weapon_type] )
5344 if(porient != NULL) {
5354 if (fof_cooldown != 0.0
f) {
5358 if(combined_fof > 0.0
f){
5389 if(parent_objp != NULL){
5528 if(parent_objp != NULL){
5610 if ( parent_objp != NULL && parent_objp ==
Player_obj ) {
5688 Assertion(objp->
instance >= 0,
"spawn_child_weapons() called with an object with an instance of %d; get a coder!\n", objp->
instance);
5704 parent_num = objp->
parent;
5706 if (parent_num >= 0) {
5708 mprintf((
"Warning: Parent of spawn weapon does not exist. Not spawning.\n"));
5735 child_wip = &Weapon_info[child_id];
5783 if (weapon_objnum != -1) {
5850 switch(hit_obj->
type) {
5868 if ( hit_obj == NULL ) {
5883 if ( shield_str > 0.1
f ) {
5887 if ( !is_hull_hit ) {
5916 nprintf((
"Warning",
"WARNING ==> Cannot determine sound to play for weapon impact\n"));
5940 vec3d subsys_world_pos;
5944 wip = &Weapon_info[wi_index];
6000 if (disrupt_time > 0)
6044 if ( (dist > outer_rad) || (dist > limit) ) {
6048 if ( dist < inner_rad ) {
6050 *damage = max_damage;
6053 float dist_to_outer_rad_squared = (outer_rad-dist)*(outer_rad-dist);
6054 float total_dist_squared = (inner_rad-outer_rad)*(inner_rad-outer_rad);
6058 if (total_dist_squared < 0.0001
f) {
6063 Assert(dist_to_outer_rad_squared <= total_dist_squared);
6064 *damage = max_damage * dist_to_outer_rad_squared/total_dist_squared;
6065 *blast = (dist - outer_rad) * max_blast /(inner_rad - outer_rad);
6082 #define SHAKE_CONST 3000
6083 vec3d force, vec_blast_to_ship, vec_ship_to_impact;
6087 if ( blast == 0.0
f )
6095 vm_vec_sub(&vec_ship_to_impact, blast_pos, &ship_objp->
pos);
6100 if (make_shockwave) {
6122 float damage, blast;
6158 switch ( objp->
type ) {
6172 target_wip = &Weapon_info[Weapons[objp->
instance].weapon_info_index];
6178 Weapons[objp->
instance].lifeleft = 0.01f;
6255 Assert(weapon_obj != NULL);
6256 if(weapon_obj == NULL){
6266 int expl_ani_handle;
6269 bool hit_target =
false;
6280 wp = &Weapons[weapon_obj->
instance];
6281 wip = &Weapon_info[weapon_type];
6290 bool armed_weapon =
weapon_armed(&Weapons[num], hit_target);
6314 float draw_limit, hull_pct;
6315 int dmg_type_idx, piercing_type;
6332 if (hull_pct > draw_limit)
6349 pe.
pos = weapon_obj->
pos;
6429 if(sci->
speed > 0.0f) {
6483 static int current_id = 0;
6499 if (weapon_type < 0)
6502 if ( used_weapons == NULL )
6507 if (weapon_type < Num_weapon_types) {
6508 used_weapons[weapon_type]++;
6516 Assert( used_weapons != NULL );
6529 if ( !used_weapons[i] )
6535 used_weapons[(
int)Weapon_info[i].spawn_info[j].spawn_type]++;
6546 if ( !used_weapons[i] ) {
6547 nprintf((
"Weapons",
"Not loading weapon id %d (%s)\n", i, Weapon_info[i].
name));
6658 Assert( used_weapons != NULL );
6666 if (used_weapons[i])
6781 vec3d spawn_pos, spawn_vel, output_pos, output_vel, input_pos, input_vel;
6806 vec3d direct, direct_temp, particle_pos;
6821 direct = direct_temp;
6827 direct = direct_temp;
6833 direct = direct_temp;
6869 for (
float is = 0; is < 1; is += inc ) {
6870 particle_rot = rotation_value + (segment_angular_length * is);
6877 input_pos_l.xyz.z = segment_length * is;
6907 temp_vel = input_vel;
6913 output_pos = obj->
pos;
6933 for (
float ir = 0; ir <
PI2; ir += inc) {
6939 output_pos = obj->
pos;
6957 float ang_rand, len_rand, sin_ang, cos_ang;
6964 sin_ang = sinf(ang_rand);
6965 cos_ang = cosf(ang_rand);
6972 input_pos_l.
xyz.x = sin_ang * len_rand;
6973 input_pos_l.
xyz.y = cos_ang * len_rand;
7002 DCF(pspew_count,
"Number of particles spewed at a time")
7010 dc_printf(
"Partical count is %i\n", Weapon_particle_spew_count);
7016 dc_printf(
"Partical count set to %i\n", Weapon_particle_spew_count);
7019 DCF(pspew_time,
"Time between particle spews")
7027 dc_printf(
"Particle spawn period is %i\n", Weapon_particle_spew_time);
7033 dc_printf(
"Particle spawn period set to %i\n", Weapon_particle_spew_time);
7036 DCF(pspew_vel,
"Relative velocity of particles (0.0 - 1.0)")
7044 dc_printf(
"Particle relative velocity is %f\n", Weapon_particle_spew_vel);
7050 dc_printf(
"Particle relative velocity set to %f\n", Weapon_particle_spew_vel);
7053 DCF(pspew_size,
"Size of spewed particles")
7061 dc_printf(
"Particle size is %f\n", Weapon_particle_spew_radius);
7067 dc_printf(
"Particle size set to %f\n", Weapon_particle_spew_radius);
7070 DCF(pspew_life,
"Lifetime of spewed particles")
7078 dc_printf(
"Particle lifetime is %f\n", Weapon_particle_spew_lifetime);
7084 dc_printf(
"Particle lifetime set to %f\n", Weapon_particle_spew_lifetime);
7087 DCF(pspew_scale,
"How far away particles are from the weapon path")
7095 dc_printf(
"Particle scale is %f\n", Weapon_particle_spew_scale);
7100 dc_printf(
"Particle scale set to %f\n", Weapon_particle_spew_scale);
7104 DCF(pspew,
"Particle spew help and status provider")
7107 dc_printf(
"Particle spew settings\n\n");
7109 dc_printf(
" Count (pspew_count) : %d\n", Weapon_particle_spew_count);
7110 dc_printf(
" Time (pspew_time) : %d\n", Weapon_particle_spew_time);
7111 dc_printf(
" Velocity (pspew_vel) : %f\n", Weapon_particle_spew_vel);
7112 dc_printf(
" Size (pspew_size) : %f\n", Weapon_particle_spew_radius);
7113 dc_printf(
" Lifetime (pspew_life) : %f\n", Weapon_particle_spew_lifetime);
7114 dc_printf(
" Scale (psnew_scale) : %f\n", Weapon_particle_spew_scale);
7118 dc_printf(
"Available particlar spew commands:\n");
7119 dc_printf(
"pspew_count : %s\n", dcmd_pspew_count.help);
7120 dc_printf(
"pspew_time : %s\n", dcmd_pspew_time.help);
7121 dc_printf(
"pspew_vel : %s\n", dcmd_pspew_vel.help);
7122 dc_printf(
"pspew_size : %s\n", dcmd_pspew_size.help);
7123 dc_printf(
"pspew_life : %s\n", dcmd_pspew_life.help);
7124 dc_printf(
"pspew_scale : %s\n\n", dcmd_pspew_scale.help);
7126 dc_printf(
"To view status of all pspew settings, type in 'pspew --status'.\n");
7127 dc_printf(
"Passing '--status' as an argument to any of the individual spew commands will show the status of that variable only.\n\n");
7129 dc_printf(
"These commands adjust the various properties of the particle spew system, which is used by weapons when they are fired, are in-flight, and die (either by impact or by end of life time.\n");
7130 dc_printf(
"Generally, a large particle count with small size and scale will result in a nice dense particle spew.\n");
7131 dc_printf(
"Be advised, this effect is applied to _ALL_ weapons, and as such may drastically reduce framerates on lower powered platforms.\n");
7140 int from_player = 0;
7141 float total_scale = 1.0f;
7143 int is_big_damage_ship = 0;
7150 if((wip == NULL) || (wep == NULL) || (target == NULL)){
7168 total_scale *= 0.1f;
7191 if(hull_pct <= 0.75
f){
7213 total_scale *= 0.01f;
7215 total_scale *= 0.05f;
7220 if(hull_pct > 0.1
f){
7221 total_scale *= hull_pct;
7235 if (Weapons[
i].objnum != -1)
7264 int expl_ani_handle = Weapon_explosions.
GetAnim(idx, hitpos, radius);
7355 vec3d headp2, tailp;
7417 ft *= (1.0f +
frand()/5.0f - 1.0f/10.0f);
7467 for (it = Delayed_SSM_names.begin(); it != Delayed_SSM_names.end(); ++it) {
7470 Assertion(wi >= 0,
"Trying to validate non-existant weapon '%s'; get a coder!\n", it->c_str());
7471 wip = &Weapon_info[wi];
7472 nprintf((
"parse",
"Starting validation of '%s' [wip->name is '%s'], currently has an SSM_index of %d.\n", it->c_str(), wip->name, wip->SSM_index));
7474 if (wip->SSM_index < 0) {
7477 nprintf((
"parse",
"Validation complete, SSM_index is %d.\n", wip->SSM_index));
7481 Delayed_SSM_data.clear();
7482 Delayed_SSM_names.clear();
7484 for (it = Delayed_SSM_indices.begin(); it != Delayed_SSM_indices.end(); ++it) {
7487 Assertion(wi >= 0,
"Trying to validate non-existant weapon '%s'; get a coder!\n", it->c_str());
7488 wip = &Weapon_info[wi];
7489 nprintf((
"parse",
"Starting validation of '%s' [wip->name is '%s'], currently has an SSM_index of %d.\n", it->c_str(), wip->name, wip->SSM_index));
7490 if (wip->SSM_index < -1 || wip->SSM_index >= static_cast<int>(
Ssm_info.size())) {
7492 wip->SSM_index = -1;
7494 nprintf((
"parse",
"Validation complete, SSM-index is %d.\n", wip->SSM_index));
void cscrew_delete(int i)
#define SSF_MISSILES_IGNORE_IF_DEAD
#define WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS
#define WIF3_CMEASURE_ASPECT_HOME_ON
#define WIF2_VARIABLE_LEAD_HOMING
void radar_plot_object(object *objp)
int timestamp(int delta_ms)
void ai_update_danger_weapon(int objnum, int weapon_objnum)
#define MULTIPLAYER_CLIENT
#define WIF2_TAKES_BLAST_DAMAGE
char tech_model[MAX_FILENAME_LEN]
void obj_set_flags(object *obj, uint new_flags)
void weapon_pause_sounds()
int mflash_lookup(char *name)
#define WEAPONS_MULTITEXT_LENGTH
int stuff_string_list(SCP_vector< SCP_string > &slp)
model_subsystem * system_info
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
SCP_vector< ArmorType > Armor_types
float cm_aspect_effectiveness
#define MAX_SHIP_PRIMARY_BANKS
float particle_spew_scale
void weapon_do_electronics_effect(object *ship_objp, vec3d *blast_pos, int wi_index)
void validate_SSM_entries()
void weapon_load_bitmaps(int weapon_index)
int parse_string_flag_list(int *dest, flag_def_list defs[], int defs_size)
GLfloat GLfloat GLfloat GLfloat h
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
size_t num_substitution_patterns
float laser_glow_bitmap_frame
int weapon_create_group_id()
void missile_obj_list_rebuild()
float frand_range(float min, float max)
Return a floating point number in the range min..max.
int total_children_spawned
polymodel * model_get(int model_num)
int obj_team(object *objp)
float nearest_locked_distance
float thruster_glow_noise
int weapon_info_lookup(const char *name)
int stuff_int_optional(int *i, bool raw)
SCP_vector< game_snd > Snds
void g3_stop_user_clip_plane()
float vm_vec_mag(const vec3d *v)
generic_anim laser_bitmap
#define WIF_LOCKED_HOMING
char * Weapon_subtype_names[]
int Cmeasures_homing_check
#define WIF_HURTS_BIG_SHIPS
#define ESUCK_DEFAULT_WEAPON_REDUCE
ushort multi_get_next_network_signature(int what_kind)
void set_thruster_info(mst_info &info)
int trail_stamp_elapsed(trail *trailp)
void weapon_set_tracking_info(int weapon_objnum, int parent_objnum, int target_objnum, int target_is_locked, ship_subsys *target_subsys)
#define WF_PLAYED_FLYBY_SOUND
SCP_vector< ssm_info > Ssm_info
char weapon_substitution_pattern_names[MAX_SUBSTITUTION_PATTERNS][NAME_LENGTH]
int pick_big_attack_point_timestamp
#define WIF2_NON_SUBSYS_HOMING
int scoring_eval_kill_on_weapon(object *weapon_obj, object *other_obj)
void stuff_malloc_string(char **dest, int type, char *terminators)
int Cmdline_missile_lighting
void mflash_mark_as_used(int index)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int generic_anim_load(generic_anim *ga)
float piercing_impact_particle_life
#define SWARM_MISSILE_DELAY
int Cmdline_load_all_weapons
#define DEFAULT_WEAPON_SPAWN_COUNT
#define WIF2_DEFAULT_IN_TECH_DATABASE
void static_rand_cone(int num, vec3d *out, vec3d *in, float max_angle, matrix *orient)
Randomly perturb a vector around a given (normalized vector) or optional orientation matrix...
#define WIF2_TAKES_SHOCKWAVE_DAMAGE
float detail_depth[MAX_MODEL_DETAIL_LEVELS]
InFlightSoundType in_flight_play_type
void generic_bitmap_init(generic_bitmap *gb, const char *filename)
SCP_map< SCP_string, delayed_ssm_data > Delayed_SSM_data
struct delayed_ssm_data delayed_ssm_data
float side_slip_time_const
void ship_subsys_set_disrupted(ship_subsys *ss, int time)
#define list_append(head, elem)
int stuff_float_optional(float *f, bool raw)
int shockwave_create(int parent_objnum, vec3d *pos, shockwave_create_info *sci, int flag, int delay)
char anim_filename[MAX_FILENAME_LEN]
char filename[MAX_FILENAME_LEN]
void shockwave_create_info_load(shockwave_create_info *sci)
#define WIF2_MR_NO_LIGHTING
float untargeted_flak_range_penalty
char name[MAX_FILENAME_LEN]
void set_flags(uint flags)
void model_set_alpha(float alpha)
int get_nearest_bbox_point(object *ship_objp, vec3d *start, vec3d *box_pt)
void cscrew_process_post(object *objp)
int hud_gauge_active(int gauge_index)
Determine if the specified HUD gauge should be displayed.
struct vec3d::@225::@227 xyz
#define WIF3_DONT_SPAWN_IF_SHOT
float piercing_impact_particle_variance
void trail_object_died(trail *trailp)
int generic_bitmap_load(generic_bitmap *gb)
ship_subsys * target_subsys
char external_model_name[MAX_FILENAME_LEN]
int GetAnim(int weapon_expl_index, vec3d *pos, float size)
#define BFIF_TARGETING_COORDS
#define WIF2_SAME_TURRET_COOLDOWN
void weapon_do_area_effect(object *wobjp, shockwave_create_info *sci, vec3d *pos, object *other_obj)
void init_weapon_entry(int weap_info_index)
#define WIF2_EXTERNAL_WEAPON_LNCH
float thruster_glow_factor
int snd_is_playing(int sig)
void weapon_expl_info_init()
ai_info Ai_info[MAX_AI_INFO]
void weapon_mark_as_used(int weapon_type)
#define Assertion(expr, msg,...)
#define WEAPON_INFO_INDEX(wip)
#define END_OF_LIST(head)
void translate_spawn_types()
void find_homing_object_by_sig(object *weapon_objp, int sig)
int compute_num_homing_objects(object *target_objp)
void vm_vec_random_cone(vec3d *out, const vec3d *in, float max_angle, const matrix *orient)
float ship_quadrant_shield_strength(object *hit_objp, vec3d *hitpos)
void vm_vec_scale_add2(vec3d *dest, const vec3d *src, float k)
ship_subsys * homing_subsys
#define MAX_WEP_DAMAGE_SLOTS
void gr_set_color_fast(color *dst)
float batch_add_laser(int texture, vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b)
missile_obj Missile_objs[MAX_MISSILE_OBJS]
#define WIF2_NO_LIFE_LOST_IF_MISSED
#define WIF_HOMING_ASPECT
void missle_obj_list_remove(int index)
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
float piercing_impact_particle_back_velocity
#define AIPF_USE_ADDITIVE_WEAPON_VELOCITY
weapon_expl_lod lod[MAX_WEAPON_EXPL_LOD]
void weapon_render_DEPRECATED(object *obj)
float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target)
int num_spawn_weapons_defined
int collide_remove_weapons()
void physics_apply_shock(vec3d *direction_vec, float pressure, physics_info *pi, matrix *orient, vec3d *min, vec3d *max, float radius)
#define WIF3_DIE_ON_LOST_LOCK
int required_string_either(char *str1, char *str2)
Checks for one of two required strings.
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov)
GLenum GLuint GLenum GLsizei const GLchar * buf
char pof_name[MAX_FILENAME_LEN]
void bm_page_in_xparent_texture(int bitmapnum, int nframes)
Marks a textures as being used for level and is transparant.
void ship_apply_whack(vec3d *force, vec3d *hit_pos, object *objp)
#define AIPF2_ASPECT_LOCK_COUNTERMEASURE
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
void particle_emit(particle_emitter *pe, int type, int optional_data, float range)
float particle_spew_z_scale
script_state Script_system("FS2_Open Scripting")
int piercing_impact_weapon_expl_index
void stuff_float(float *f)
flag_def_list Burst_fire_flags[]
float beam_iff_miss_factor[MAX_IFFS][NUM_SKILL_LEVELS]
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
#define LOCKED_HOMING_EXTENDED_LIFE_FACTOR
#define WIF2_CAPITAL_PLUS
#define CLAMP(x, min, max)
void weapon_maybe_play_warning(weapon *wp)
int Load(char *filename=NULL, int specified_lods=MAX_WEAPON_EXPL_LOD)
iff_info Iff_info[MAX_IFFS]
void backspace(char *src)
void g3_start_user_clip_plane(const vec3d *plane_point, const vec3d *plane_normal)
int weapon_substitution_pattern[MAX_SUBSTITUTION_PATTERNS]
#define AIPF_DISABLE_WEAPON_DAMAGE_SCALING
#define AI_ACTIVE_GOAL_DYNAMIC
int damage_ship_id[MAX_WEP_DAMAGE_SLOTS]
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)
const float weapon_glow_scale_r
struct delayed_ssm_index_data delayed_ssm_index_data
float beam_particle_radius
void set_alpha(float alpha)
#define PM_FLAG_HAS_INTRINSIC_ROTATE
#define WIF2_DEFAULT_VALUE
int flash_impact_weapon_expl_index
void model_render_queue(model_render_params *interp, draw_list *scene, int model_num, matrix *orient, vec3d *pos)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define MAX_SHIP_SECONDARY_BANKS
#define MAX_WEAPON_EXPL_LOD
void ship_do_weapon_thruster_frame(weapon *weaponp, object *objp, float frametime)
matrix * vm_vector_2_matrix(matrix *m, const vec3d *fvec, const vec3d *uvec, const vec3d *rvec)
void parse_sound(const char *tag, int *idx_dest, const char *object_name, parse_sound_flags flags)
void vm_vec_add2(vec3d *dest, const vec3d *src)
void model_delete_instance(int model_instance_num)
GLdouble GLdouble GLdouble r
SCP_vector< SCP_string > Delayed_SSM_names
ship_subsys * turret_subsys
struct matrix::@228::@230 vec
SCP_vector< int > * cmeasure_ignore_list
void weapon_clean_entries()
#define NUM_TRAIL_SECTIONS
float ship_max_hull_strength
void vm_vec_scale(vec3d *dest, float s)
float beam_particle_angle
#define AIPF2_PLAYER_WEAPON_SCALE_FIX
char hud_filename[MAX_FILENAME_LEN]
char filename[MAX_FILENAME_LEN]
#define WIF_IN_TECH_DATABASE
particle_spew_info particle_spewers[MAX_PARTICLE_SPEWERS]
int pre_launch_snd_min_interval
int obj_create(ubyte type, int parent_obj, int instance, matrix *orient, vec3d *pos, float radius, uint flags)
int armor_type_get_idx(char *name)
float flash_impact_explosion_radius
#define SADTF_PIERCING_DEFAULT
void g3_set_view_matrix(const vec3d *view_pos, const matrix *view_matrix, float zoom)
ai_profile_t * ai_profile
float get_hull_pct(object *objp)
void model_clear_instance(int model_num)
void weapon_process_pre(object *obj, float frame_time)
#define strnicmp(s1, s2, n)
int clip_plane(int plane_flag, vertex **src, vertex **dest, int *nv, ccodes *cc, uint flags)
Clips a plane to the viewing pyramid.
generic_anim beam_particle_ani
size_t * get_pointer_to_weapon_fire_pattern_index(int weapon_type, ship *shipp, ship_subsys *src_turret)
int ship_get_sound(object *objp, GameSoundsIndex id)
Returns a ship-specific sound index.
ai_goal goals[MAX_AI_GOALS]
int snd_play_3d(game_snd *gs, vec3d *source_pos, vec3d *listen_pos, float radius, vec3d *source_vel, int looping, float vol_scale, int priority, vec3d *sound_fvec, float range_factor, int force, bool is_ambient)
int rand_chance(float frametime, float chance)
Call this in the frame interval to get TRUE chance times per second.
texture_map maps[MAX_MODEL_TEXTURES]
heat-seeker launch warning
generic_anim thruster_glow
void stuff_string(char *outstr, int type, int len, char *terminators)
int ship_get_SIF(ship *shipp)
#define MULTI_SIG_NON_PERMANENT
int dinky_impact_weapon_expl_index
#define MAX_SPAWN_TYPES_PER_WEAPON
#define WIF2_DONT_SHOW_ON_RADAR
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
#define WIF3_TURRET_INTERCEPTABLE
float shield_impact_explosion_radius
#define WIF3_APPLY_RECOIL
void vm_rot_point_around_line(vec3d *out, const vec3d *in, float angle, const vec3d *line_point, const vec3d *line_dir)
#define BFIF_FLOATING_BEAM
int weaponry_pool[MAX_WEAPON_TYPES]
char tech_anim_filename[MAX_FILENAME_LEN]
#define SF_HIDDEN_FROM_SENSORS
float cmeasure_life_scale[NUM_SKILL_LEVELS]
beam_weapon_section_info sections[MAX_BEAM_SECTIONS]
float weapon_submodel_rotate_accell
#define MAX_BEAM_SECTIONS
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
int First_secondary_index
int required_string(const char *pstr)
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
void weapon_area_apply_blast(vec3d *force_apply_pos, object *ship_objp, vec3d *blast_pos, float blast, int make_shockwave)
#define WIF_PARTICLE_SPEW
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
#define WEAPON_MAX_GROUP_IDS
float vm_vec_normalized_dir(vec3d *dest, const vec3d *end, const vec3d *start)
int Default_cmeasure_index
float vm_vec_dist(const vec3d *v0, const vec3d *v1)
#define WIF2_CAN_BE_TARGETED
int optional_string(const char *pstr)
int detail_distance[MAX_MODEL_DETAIL_LEVELS]
missile_obj * missile_obj_return_address(int index)
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
#define MONITOR(function_name)
#define MR_DEPRECATED_ALL_XPARENT
float fireball_lifeleft_percent(object *obj)
#define vm_strndup(ptr, size)
char tech_title[NAME_LENGTH]
#define SADTF_PIERCING_RETAIL
void weapon_detonate(object *objp)
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, int ferror=1, int duplicate=0)
void emp_apply(vec3d *pos, float inner_radius, float outer_radius, float emp_intensity, float emp_time, bool use_emp_time_for_capship_turrets)
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
#define WIF2_SHOWN_ON_RADAR
int skip_to_start_of_string_either(char *pstr1, char *pstr2, char *end)
int max_allowed_player_homers[NUM_SKILL_LEVELS]
#define MAX_SUBSTITUTION_PATTERNS
vec3d particle_spew_offset
int beam_fire(beam_fire_info *fire_info)
bool Parsing_modular_table
float piercing_impact_explosion_radius
float vm_vec_normalize_safe(vec3d *v)
void weapon_unpause_sounds()
generic_anim laser_glow_bitmap
#define WIF_DEFAULT_VALUE
#define SUBSYSTEM_WEAPONS
void weapon_do_post_parse()
#define ESUCK_DEFAULT_AFTERBURNER_REDUCE
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
#define WIF2_EXTERNAL_WEAPON_FP
float piercing_impact_particle_velocity
#define WIF2_UNTARGETED_HEAT_SEEKER
void ship_apply_global_damage(object *ship_objp, object *other_obj, vec3d *force_center, float damage)
int Weapon_particle_spew_time
int iff_x_attacks_y(int team_x, int team_y)
float Weapon_particle_spew_vel
object Objects[MAX_OBJECTS]
GLint GLint GLint GLint GLint x
for(int idx=0;idx< i;idx++)
bool weapon_is_used(int weapon_index)
weapon_info Weapon_info[MAX_WEAPON_TYPES]
void weapon_hit_do_sound(object *hit_obj, weapon_info *wip, vec3d *hitpos, bool is_armed)
bool weapon_armed(weapon *wp, bool hit_target)
int ssm_info_lookup(const char *name)
#define MR_SHOW_THRUSTERS
#define MONITOR_INC(function_name, inc)
void stuff_vec3d(vec3d *vp)
#define AIPF_FIX_HEAT_SEEKER_STEALTH_BUG
#define FLAK_DAMAGE_SCALE
#define WF_CONSIDER_FOR_FLYBY_SOUND
dc_printf("Particle relative velocity set to %f\n", Weapon_particle_spew_vel)
void trail_add_segment(trail *trailp, vec3d *pos)
#define IMPACT_SOUND_DELTA
void weapon_hit(object *weapon_obj, object *other_obj, vec3d *hitpos, int quadrant)
int g3_get_bitmap_dims(int bitmap, vertex *pos, float radius, int *x, int *y, int *w, int *h, int *size)
void stuff_boolean(int *i, bool a_to_eol)
int catchup_pixels_per_sec
char icon_filename[MAX_FILENAME_LEN]
int Weapon_flyby_sound_enabled
float Weapon_particle_spew_scale
float total_damage_received
int piercing_impact_particle_count
void vm_vec_copy_scale(vec3d *dest, const vec3d *src, float s)
#define SADTF_PIERCING_NONE
void weapon_generate_indexes_for_substitution()
void shield_impact_explosion(vec3d *hitpos, object *objp, float radius, int idx)
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int catchup_pixel_penalty
void dc_stuff_float(float *f)
Stuffs a float to the given variable.
void vm_vec_random_in_circle(vec3d *out, const vec3d *in, const matrix *orient, float radius, int on_edge)
void vm_vec_rand_vec_quick(vec3d *rvec)
bool turret_weapon_has_flags(ship_weapon *swp, int flags)
void swarm_update_direction(object *objp, float frametime)
#define WIF3_NO_LINKED_PENALTY
float Weapon_particle_spew_radius
#define WBF_RANDOM_LENGTH
#define WIF2_PIERCE_SHIELDS
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
void reset_parse(char *text)
void dc_stuff_int(int *i)
Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats...
void weapon_play_impact_sound(weapon_info *wip, vec3d *hitpos, bool is_armed)
GLuint const GLchar * name
int parse_weapon(int subtype, bool replace, const char *filename)
trail * trail_create(trail_info *info)
int RunCondition(int condition, char format='\0', void *data=NULL, class object *objp=NULL, int more_data=0)
int weaponry_count[MAX_WEAPON_TYPES]
void cmeasure_maybe_alert_success(object *objp)
If this is a player countermeasure, let the player know they evaded a missile.
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)
void SetHookObjects(int num,...)
void find_homing_object_cmeasures()
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
int cscrew_create(object *obj)
#define vm_realloc(ptr, size)
#define WIF2_SHOW_FRIENDLY
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
GLboolean GLboolean GLboolean b
void weapon_get_laser_color(color *c, object *objp)
int stuff_int_list(int *ilp, int max_ints, int lookup_type)
__inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near=-1.0f, float fog_far=-1.0f)
vec3d particle_spew_velocity
shockwave_create_info dinky_shockwave
float Weapon_particle_spew_lifetime
float particle_spew_rotation_rate
int ship_get_by_signature(int signature)
int hud_in_flight_snd_sig
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
void fs2netd_add_table_validation(const char *tblname)
#define SIF2_DISABLE_WEAPON_DAMAGE_SCALING
void shockwave_create_info_init(shockwave_create_info *sci)
void weapons_page_in_cheats()
#define WIF_PLAYER_ALLOWED
#define MR_DEPRECATED_NORMAL
#define DCF_BOOL(function_name, bool_variable)
void parse_weaponstbl(const char *filename)
SCP_vector< lod_checker > LOD_checker
int vm_vec_same(const vec3d *v1, const vec3d *v2)
void find_homing_object_cmeasures_1(object *weapon_objp)
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
void model_render_DEPRECATED(int model_num, matrix *orient, vec3d *pos, uint flags=MR_DEPRECATED_NORMAL, int objnum=-1, int lighting_skip=-1, int *replacement_textures=NULL, int render=MODEL_RENDER_ALL, const bool is_skybox=false)
float frand()
Return random value in range 0.0..1.0- (1.0- means the closest number less than 1.0)
swarm_info Swarm_missiles[MAX_SWARM_MISSILES]
float particle_spew_radius
#define WF_LOCKED_WHEN_FIRED
int set_target_objnum(ai_info *aip, int objnum)
int optional_string_either(char *str1, char *str2)
#define SUBSYSTEM_SENSORS
void spawn_child_weapons(object *objp)
void bm_page_in_texture(int bitmapnum, int nframes)
Marks a texture as being used for this level.
#define PARTICLE_BITMAP_PERSISTENT
void weapon_release_bitmaps()
DCF(pspew_count,"Number of particles spewed at a time")
#define WIF2_CUSTOM_SEEKER_STR
void trail_set_stamp(trail *trailp)
float flak_detonation_accuracy
int missile_obj_list_add(int objnum)
void generic_anim_init(generic_anim *ga)
#define WIF3_NO_HOMING_SPEED_RAMP
bool aspect_should_lose_target(weapon *wp)
int snd_play_looping(game_snd *gs, float pan, int start_loop, int stop_loop, float vol_scale, int scriptingUpdateVolume)
ship_subsys * ship_get_closest_subsys_in_sight(ship *sp, int subsys_type, vec3d *attacker_pos)
weapon_explosions Weapon_explosions
float cm_heat_effectiveness
void weapon_delete(object *obj)
float model_get_radius(int modelnum)
ship_subsys * locking_subsys
void ai_turn_towards_vector(vec3d *dest, object *objp, float frametime, float turn_time, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec=NULL, int sexp_flags=0)
float thruster_glow_frame
void parse_wi_flags(weapon_info *weaponp, int wi_flags, int wi_flags2, int wi_flags3)
spawn_weapon_info spawn_info[MAX_SPAWN_TYPES_PER_WEAPON]
void RemHookVars(unsigned int num,...)
void cscrew_process_pre(object *objp)
#define MULTIPLAYER_MASTER
#define HOMING_DEFAULT_FREE_FLIGHT_TIME
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
SCP_vector< ship_info > Ship_info
vec3d * vm_vec_avg(vec3d *dest, const vec3d *src0, const vec3d *src1)
void weapon_maybe_play_flyby_sound(object *weapon_objp, weapon *wp)
void model_set_thrust(int model_num=-1, mst_info *mst=NULL)
int nearest_locked_object
#define timestamp_elapsed(stamp)
SCP_vector< float > shield_quadrant
SCP_vector< species_info > Species_info
player ship is hit by laser fire
SCP_vector< SCP_string > Delayed_SSM_indices
#define MAX_MODEL_DETAIL_LEVELS
const float weapon_glow_scale_l
#define OF_SHOULD_BE_DEAD
vec3d * get_subsystem_world_pos(object *parent_obj, ship_subsys *subsys, vec3d *world_pos)
#define WIF3_DEFAULT_VALUE
#define WIF2_HARD_TARGET_BOMB
#define list_remove(head, elem)
void detonate_nearby_missiles(object *killer_objp, object *missile_objp)
#define SUPERCAP_DAMAGE_SCALE
GLsizei GLsizei GLuint * obj
void weapon_process_post(object *obj, float frame_time)
void send_weapon_detonate_packet(object *objp)
#define SWARM_DEFAULT_NUM_MISSILES_FIRED
#define MR_DEPRECATED_IS_MISSILE
int particle_spew_time[MAX_PARTICLE_SPEWERS]
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
void weapon_render(object *obj, draw_list *scene)
void trail_set_segment(trail *trailp, vec3d *pos)
int Player_weapon_precedence[MAX_WEAPON_TYPES]
void asteroid_hit(object *pasteroid_obj, object *other_obj, vec3d *hitpos, float damage)
void mflash_page_in(bool)
void find_homing_object(object *weapon_objp, int num)
void set_clip_plane(vec3d &pos, vec3d &normal)
int Num_player_weapon_precedence
int parse_modular_table(const char *name_check, void(*parse_callback)(const char *filename), int path_type, int sort_type)
void send_homing_weapon_info(int weapon_num)
float impact_explosion_radius
team_data Team_data[MAX_TVT_TEAMS]
void parse_weapon_expl_tbl(const char *filename)
char pofbitmap_name[MAX_FILENAME_LEN]
#define WIF_HOMING_JAVELIN
#define CHA_ONWEAPONDELETE
void weapon_home(object *obj, int num, float frame_time)
void stuff_ubyte(ubyte *i)
#define WIF2_ANTISUBSYSBEAM
void multi_set_network_signature(ushort signature, int what_kind)
float dinky_impact_explosion_radius
#define MR_DEPRECATED_NO_LIGHTING
float particle_spew_lifetime
char filename[MAX_FILENAME_LEN]
ushort multi_assign_network_signature(int what_kind)
#define AIGF_TARGET_OWN_TEAM
particle * particle_create(particle_info *pinfo)
char alt_name[NAME_LENGTH]
int model_create_instance(bool is_ship, int model_num)
#define MAX_PARTICLE_SPEWERS
#define FIREBALL_WARP_EFFECT
#define WF_DESTROYED_BY_WEAPON
#define WIF2_INHERIT_PARENT_TARGET
#define EMP_DEFAULT_INTENSITY
GLclampf GLclampf GLclampf alpha
const float CMEASURE_DETONATE_DISTANCE
int stuff_float_list(float *flp, int max_floats)
void diag_printf(char *format,...)
shockwave_create_info shockwave
#define WIF3_FIGHTER_INTERCEPTABLE
player ship is hit by missile
int multi_find_player_by_object(object *objp)
void parse_shockwave_info(shockwave_create_info *sci, char *pre_char)
float flak_targeting_accuracy
net_player Net_players[MAX_PLAYERS]
float damage_ship[MAX_WEP_DAMAGE_SLOTS]
missile_obj Missile_obj_list
void weapon_maybe_spew_particle(object *obj)
#define WF_LOCK_WARNING_PLAYED
void vm_vec_add(vec3d *dest, const vec3d *src0, const vec3d *src1)
void gr_init_color(color *c, int r, int g, int b)
int impact_weapon_expl_index
matrix vmd_identity_matrix
char title[WEAPON_TITLE_LEN]
void joy_ff_play_vector_effect(vec3d *v, float scaler)
float weapon_submodel_rotate_vel
#define MAX_CMEASURE_TRACK_DIST
float static_randf(int num)
Return a random float in 0.0f .. 1.0f- (ie, it will never return 1.0f).
int damage_type_add(char *name)
char ship_name[NAME_LENGTH]
#define MR_DEPRECATED_SHOW_THRUSTERS
#define SF2_NO_SECONDARY_LOCKON
generic_anim thruster_flame
void beam_unpause_sounds()
void weapon_sort_by_type()
size_t primary_bank_pattern_index[MAX_SHIP_PRIMARY_BANKS]
#define WIF3_AOE_ELECTRONICS
bool Weapons_inherit_parent_collision_group
generic_anim particle_spew_anim
const int weapon_glow_alpha
const float weapon_glow_scale_f
size_t secondary_bank_pattern_index[MAX_SHIP_SECONDARY_BANKS]
void missile_obj_list_init()
int Default_weapon_select_effect
void pause_in_flight_sounds()
#define g3_start_frame(zbuffer_flag)
float vm_vec_normalize(vec3d *v)
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, int reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
#define WF_HOMING_UPDATE_NEEDED
weapon Weapons[MAX_WEAPONS]
int Weapon_particle_spew_count
SCP_map< SCP_string, delayed_ssm_index_data > Delayed_SSM_indices_data