mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
Weapon info flags conversion (#851)
This commit is contained in:
1 parent
e9cc4601eb
commit
127976cd74
46 files changed
+868
-1108
No files matched your search
+3
-3
@@ -754,7 +754,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
|
||||
if (current_bank > -1) {
|
||||
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
|
||||
|
||||
if(!(En_objp->flags[Object::Object_Flags::Protected]) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
|
||||
if(!(En_objp->flags[Object::Object_Flags::Protected]) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags[Weapon::Info_Flags::Puncture] )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
|
||||
// If ship is protected and very low on hits, don't fire missiles.
|
||||
if (!(En_objp->flags[Object::Object_Flags::Protected]) || (En_objp->hull_strength > 10*swip->damage)) {
|
||||
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
|
||||
@@ -765,7 +765,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
|
||||
|
||||
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
|
||||
float firing_range;
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
if (swip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
firing_range=swip->lssm_lock_range;
|
||||
else
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
@@ -1810,7 +1810,7 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp)
|
||||
// Approx 1/4 chance we'll go after the other ship's beam.
|
||||
|
||||
bool attack_turret_on_different_ship = (aip->ai_profile_flags & AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS)
|
||||
&& (Weapon_info[Weapons[weapon_objp->instance].weapon_info_index].wi_flags & WIF_BEAM) && (frand()*100 < 25.0f);
|
||||
&& (Weapon_info[Weapons[weapon_objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Beam]) && (frand()*100 < 25.0f);
|
||||
|
||||
// unless we're making an exception, we should only attack a turret if it sits on the current target
|
||||
if ( !attack_turret_on_different_ship )
|
||||
|
||||
+94
-103
@@ -1283,7 +1283,7 @@ int set_target_objnum(ai_info *aip, int objnum)
|
||||
return aip->target_objnum;
|
||||
}
|
||||
|
||||
int ai_select_primary_weapon(object *objp, object *other_objp, int flags);
|
||||
int ai_select_primary_weapon(object *objp, object *other_objp, Weapon::Info_Flags flags);
|
||||
|
||||
/**
|
||||
* Make new_subsys the targeted subsystem of ship *aip.
|
||||
@@ -1301,7 +1301,7 @@ ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int pare
|
||||
if (new_subsys->system_info->type == SUBSYSTEM_ENGINE) {
|
||||
if ( aip != Player_ai ) {
|
||||
Assert( aip->shipnum >= 0 );
|
||||
ai_select_primary_weapon(&Objects[Ships[aip->shipnum].objnum], &Objects[parent_objnum], WIF_PUNCTURE);
|
||||
ai_select_primary_weapon(&Objects[Ships[aip->shipnum].objnum], &Objects[parent_objnum], Weapon::Info_Flags::Puncture);
|
||||
ship_primary_changed(&Ships[aip->shipnum]); // AL: maybe send multiplayer information when AI ship changes primaries
|
||||
}
|
||||
}
|
||||
@@ -5221,25 +5221,25 @@ vec3d G_predicted_pos, G_fire_pos;
|
||||
//old version of this fuction, this will be useful for playing old missions and not having the new primary
|
||||
//selection code throw off the balance of the mission.
|
||||
// If:
|
||||
// flags & WIF_PUNCTURE
|
||||
// flags & Weapon::Info_Flags::Puncture
|
||||
// Then Select a Puncture weapon.
|
||||
// Else
|
||||
// Select Any ol' weapon.
|
||||
// Returns primary_bank index.
|
||||
int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
int ai_select_primary_weapon_OLD(object *objp, object *other_objp, Weapon::Info_Flags flags)
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
|
||||
|
||||
if (flags & WIF_PUNCTURE) {
|
||||
if (flags == Weapon::Info_Flags::Puncture) {
|
||||
if (swp->current_primary_bank >= 0) {
|
||||
int bank_index;
|
||||
|
||||
bank_index = swp->current_primary_bank;
|
||||
|
||||
if (Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags & WIF_PUNCTURE) {
|
||||
if (Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags[Weapon::Info_Flags::Puncture]) {
|
||||
return swp->current_primary_bank;
|
||||
}
|
||||
}
|
||||
@@ -5249,7 +5249,7 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
weapon_info_index = swp->primary_bank_weapons[i];
|
||||
|
||||
if (weapon_info_index > -1){
|
||||
if (Weapon_info[weapon_info_index].wi_flags & WIF_PUNCTURE) {
|
||||
if (Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Puncture]) {
|
||||
swp->current_primary_bank = i;
|
||||
return i;
|
||||
}
|
||||
@@ -5265,13 +5265,13 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
|
||||
} else { // Don't need to be using a puncture weapon.
|
||||
if (swp->current_primary_bank >= 0) {
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags & WIF_PUNCTURE)){
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags[Weapon::Info_Flags::Puncture])){
|
||||
return swp->current_primary_bank;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<swp->num_primary_banks; i++) {
|
||||
if (swp->primary_bank_weapons[i] > -1) {
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[i]].wi_flags & WIF_PUNCTURE)) {
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Puncture])) {
|
||||
swp->current_primary_bank = i;
|
||||
nprintf(("AI", "%i: Ship %s selecting weapon %s\n", Framecount, Ships[objp->instance].ship_name, Weapon_info[swp->primary_bank_weapons[i]].name));
|
||||
return i;
|
||||
@@ -5287,7 +5287,7 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
}
|
||||
|
||||
// If:
|
||||
// flags & WIF_PUNCTURE
|
||||
// flags == Weapon::Info_Flags::Puncture
|
||||
// Then Select a Puncture weapon.
|
||||
// Else
|
||||
// Select Any ol' weapon.
|
||||
@@ -5299,7 +5299,7 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
* The AI will now intelligently choose the best weapon to use based on the overall shield
|
||||
* status of the target.
|
||||
*/
|
||||
int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
int ai_select_primary_weapon(object *objp, object *other_objp, Weapon::Info_Flags flags)
|
||||
{
|
||||
// Pointer Set Up
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
@@ -5323,7 +5323,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
|
||||
|
||||
//made it so it only selects puncture weapons if the active goal is to disable something -Bobboau
|
||||
if ((flags & WIF_PUNCTURE) && (Ai_info[shipp->ai_index].goals[0].ai_mode & (AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP)))
|
||||
if ((flags == Weapon::Info_Flags::Puncture) && (Ai_info[shipp->ai_index].goals[0].ai_mode & (AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP)))
|
||||
{
|
||||
if (swp->current_primary_bank >= 0)
|
||||
{
|
||||
@@ -5331,7 +5331,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
|
||||
bank_index = swp->current_primary_bank;
|
||||
|
||||
if (Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags & WIF_PUNCTURE)
|
||||
if (Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags[Weapon::Info_Flags::Puncture])
|
||||
{
|
||||
return swp->current_primary_bank;
|
||||
}
|
||||
@@ -5344,7 +5344,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
|
||||
if (weapon_info_index > -1)
|
||||
{
|
||||
if (Weapon_info[weapon_info_index].wi_flags & WIF_PUNCTURE)
|
||||
if (Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Puncture])
|
||||
{
|
||||
swp->current_primary_bank = i;
|
||||
return i;
|
||||
@@ -5360,7 +5360,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
{
|
||||
if (swp->primary_bank_weapons[i] > -1) // Make sure there is a weapon in the bank
|
||||
{
|
||||
if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CAPITAL_PLUS)
|
||||
if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Capital_plus])
|
||||
{
|
||||
swp->current_primary_bank = i;
|
||||
nprintf(("AI", "%i: Ship %s selecting weapon %s\n", Framecount, Ships[objp->instance].ship_name, Weapon_info[swp->primary_bank_weapons[i]].name));
|
||||
@@ -5387,7 +5387,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
{
|
||||
if ((((Weapon_info[swp->primary_bank_weapons[i]].armor_factor) * (Weapon_info[swp->primary_bank_weapons[i]].damage)) / Weapon_info[swp->primary_bank_weapons[i]].fire_wait) > i_hullfactor_prev)
|
||||
{
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CAPITAL_PLUS) )
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Capital_plus]) )
|
||||
{
|
||||
// This weapon is the new candidate
|
||||
i_hullfactor_prev = ( ((Weapon_info[swp->primary_bank_weapons[i]].armor_factor) * (Weapon_info[swp->primary_bank_weapons[i]].damage)) / Weapon_info[swp->primary_bank_weapons[i]].fire_wait );
|
||||
@@ -5413,7 +5413,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
|
||||
bank_index = swp->current_primary_bank;
|
||||
|
||||
if ((Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags2 & WIF2_PIERCE_SHIELDS) && !(Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags2 & WIF2_CAPITAL_PLUS))
|
||||
if ((Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags[Weapon::Info_Flags::Pierce_shields]) && !(Weapon_info[swp->primary_bank_weapons[bank_index]].wi_flags[Weapon::Info_Flags::Capital_plus]))
|
||||
{
|
||||
return swp->current_primary_bank;
|
||||
}
|
||||
@@ -5426,7 +5426,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
|
||||
if (weapon_info_index > -1)
|
||||
{
|
||||
if ((Weapon_info[weapon_info_index].wi_flags2 & WIF2_PIERCE_SHIELDS) && !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CAPITAL_PLUS))
|
||||
if ((Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Pierce_shields]) && !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Capital_plus]))
|
||||
{
|
||||
swp->current_primary_bank = i;
|
||||
return i;
|
||||
@@ -5449,7 +5449,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
{
|
||||
if ((((Weapon_info[swp->primary_bank_weapons[i]].armor_factor + Weapon_info[swp->primary_bank_weapons[i]].shield_factor) * Weapon_info[swp->primary_bank_weapons[i]].damage) / Weapon_info[swp->primary_bank_weapons[i]].fire_wait) > i_hullfactor_prev)
|
||||
{
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CAPITAL_PLUS) )
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Capital_plus]) )
|
||||
{
|
||||
// This weapon is the new candidate
|
||||
i_hullfactor_prev = ((((Weapon_info[swp->primary_bank_weapons[i]].armor_factor + Weapon_info[swp->primary_bank_weapons[i]].shield_factor) * Weapon_info[swp->primary_bank_weapons[i]].damage) / Weapon_info[swp->primary_bank_weapons[i]].fire_wait));
|
||||
@@ -5478,7 +5478,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
{
|
||||
if ((((Weapon_info[swp->primary_bank_weapons[i]].shield_factor) * Weapon_info[swp->primary_bank_weapons[i]].damage) / Weapon_info[swp->primary_bank_weapons[i]].fire_wait) > i_hullfactor_prev)
|
||||
{
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CAPITAL_PLUS) )
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Capital_plus]) )
|
||||
{
|
||||
// This weapon is the new candidate
|
||||
i_hullfactor_prev = ( ((Weapon_info[swp->primary_bank_weapons[i]].shield_factor) * (Weapon_info[swp->primary_bank_weapons[i]].damage)) / Weapon_info[swp->primary_bank_weapons[i]].fire_wait );
|
||||
@@ -5546,9 +5546,9 @@ void set_primary_weapon_linkage(object *objp)
|
||||
{
|
||||
// only continue if both primaries are puncture weapons
|
||||
if ( swp->num_primary_banks == 2 ) {
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[0]].wi_flags & WIF_PUNCTURE) )
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[0]].wi_flags[Weapon::Info_Flags::Puncture]) )
|
||||
return;
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[1]].wi_flags & WIF_PUNCTURE) )
|
||||
if ( !(Weapon_info[swp->primary_bank_weapons[1]].wi_flags[Weapon::Info_Flags::Puncture]) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -5595,7 +5595,7 @@ void set_primary_weapon_linkage(object *objp)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
total_ammo += swp->primary_bank_start_ammo[i];
|
||||
current_ammo += swp->primary_bank_ammo[i];
|
||||
@@ -5662,9 +5662,9 @@ int ai_fire_primary_weapon(object *objp)
|
||||
}
|
||||
|
||||
if ( (swp->current_primary_bank < 0) || (swp->current_primary_bank >= swp->num_primary_banks) || timestamp_elapsed(aip->primary_select_timestamp)) {
|
||||
int flags = 0;
|
||||
Weapon::Info_Flags flags = Weapon::Info_Flags::NUM_VALUES;
|
||||
if ( aip->targeted_subsys != NULL ) {
|
||||
flags = WIF_PUNCTURE;
|
||||
flags = Weapon::Info_Flags::Puncture;
|
||||
}
|
||||
ai_select_primary_weapon(objp, enemy_objp, flags);
|
||||
ship_primary_changed(shipp); // AL: maybe send multiplayer information when AI ship changes primaries
|
||||
@@ -5691,7 +5691,7 @@ int ai_fire_primary_weapon(object *objp)
|
||||
(enemy_objp->phys_info.speed >= 1.0f) && //Only burst for moving ships
|
||||
(enemy_sip->is_small_ship() || enemy_sip->flags[Ship::Info_Flags::Transport]) && //Only burst for small ships (transports count)
|
||||
swp->primary_bank_start_ammo[swp->current_primary_bank] > 0 && //Prevent div by 0
|
||||
Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags2 & WIF2_BALLISTIC) //Current weapon must be ballistic
|
||||
Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags[Weapon::Info_Flags::Ballistic]) //Current weapon must be ballistic
|
||||
{
|
||||
float percentAmmoLeft = ((float)swp->primary_bank_ammo[swp->current_primary_bank] / (float)swp->primary_bank_start_ammo[swp->current_primary_bank]);
|
||||
float distToTarget = vm_vec_dist(&enemy_objp->pos, &objp->pos);
|
||||
@@ -5739,7 +5739,7 @@ int ai_fire_primary_weapon(object *objp)
|
||||
if ((enemy_objp->hull_strength < 750.0f) &&
|
||||
((aip->targeted_subsys == NULL) || (enemy_objp->hull_strength < aip->targeted_subsys->current_hits + 50.0f)) &&
|
||||
(swp->current_primary_bank >= 0) ) {
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags & WIF_PUNCTURE)) {
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags[Weapon::Info_Flags::Puncture])) {
|
||||
swp->next_primary_fire_stamp[swp->current_primary_bank] = timestamp(1000);
|
||||
return 0;
|
||||
}
|
||||
@@ -5804,35 +5804,39 @@ int num_nearby_fighters(int enemy_team_mask, vec3d *pos, float threshold)
|
||||
// Favor aspect seekers when attacking small ships faraway.
|
||||
// Favor rapid fire dumbfire when attacking a large ship.
|
||||
// Ignore heat seekers because we're not sure how they'll work.
|
||||
void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 = -1, int priority2 = -1, int wif2_priority1 = -1, int wif2_priority2 = -1)
|
||||
void ai_select_secondary_weapon(object *objp, ship_weapon *swp, flagset<Weapon::Info_Flags>* priority1 = NULL, flagset<Weapon::Info_Flags>* priority2 = NULL)
|
||||
{
|
||||
int num_weapon_types;
|
||||
int weapon_id_list[MAX_WEAPON_TYPES], weapon_bank_list[MAX_WEAPON_TYPES];
|
||||
int i;
|
||||
int ignore_mask, ignore_mask_without_huge;
|
||||
flagset<Weapon::Info_Flags> ignore_mask, prio1, prio2;
|
||||
int initial_bank;
|
||||
ai_info *aip = &Ai_info[Ships[objp->instance].ai_index];
|
||||
|
||||
initial_bank = swp->current_secondary_bank;
|
||||
|
||||
if (priority1 != NULL)
|
||||
prio1 = *priority1;
|
||||
if (priority2 != NULL)
|
||||
prio2 = *priority2;
|
||||
|
||||
|
||||
// set up ignore masks
|
||||
ignore_mask = 0;
|
||||
ignore_mask_without_huge = 0;
|
||||
ignore_mask.reset();
|
||||
|
||||
// Ignore bombs unless one of the priorities asks for them to be selected.
|
||||
if (!(WIF_HUGE & (priority1 | priority2))) {
|
||||
ignore_mask |= WIF_HUGE;
|
||||
if (!(prio1[Weapon::Info_Flags::Huge] || prio2[Weapon::Info_Flags::Huge])) {
|
||||
ignore_mask.set(Weapon::Info_Flags::Huge);
|
||||
}
|
||||
|
||||
// Ignore capital+ unless one of the priorities asks for it.
|
||||
if (!(WIF2_CAPITAL_PLUS & (wif2_priority1 | wif2_priority2))) {
|
||||
ignore_mask |= WIF2_CAPITAL_PLUS;
|
||||
if (!(prio1[Weapon::Info_Flags::Capital_plus] || prio2[Weapon::Info_Flags::Capital_plus])) {
|
||||
ignore_mask.set(Weapon::Info_Flags::Capital_plus);
|
||||
}
|
||||
|
||||
// Ignore bomber+ unless one of the priorities asks for them to be selected
|
||||
if (!(WIF_BOMBER_PLUS & (priority1 | priority2))) {
|
||||
ignore_mask |= WIF_BOMBER_PLUS;
|
||||
ignore_mask_without_huge |= WIF_BOMBER_PLUS;
|
||||
if (!(prio1[Weapon::Info_Flags::Bomber_plus] || prio2[Weapon::Info_Flags::Bomber_plus])) {
|
||||
ignore_mask.set(Weapon::Info_Flags::Bomber_plus);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -5846,38 +5850,28 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
|
||||
num_weapon_types = get_available_secondary_weapons(objp, weapon_id_list, weapon_bank_list);
|
||||
|
||||
// Ignore homing weapons if we didn't specify a flag - for priority 1
|
||||
if ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority1 == 0)) {
|
||||
ignore_mask |= WIF_HOMING;
|
||||
ignore_mask_without_huge |= WIF_HOMING;
|
||||
if ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (prio1.none_set())) {
|
||||
ignore_mask.set(Weapon::Info_Flags::Homing_aspect).set(Weapon::Info_Flags::Homing_heat).set(Weapon::Info_Flags::Homing_javelin);
|
||||
}
|
||||
|
||||
int priority2_index = -1;
|
||||
|
||||
for (i=0; i<num_weapon_types; i++) {
|
||||
int wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
int wi_flags2 = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags2;
|
||||
int ignore_mask_to_use = ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (wi_flags & WIF_BOMBER_PLUS)) ? ignore_mask_without_huge : ignore_mask;
|
||||
auto wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
auto ignore_mask_to_use = ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (wi_flags[Weapon::Info_Flags::Bomber_plus])) ? (ignore_mask - Weapon::Info_Flags::Huge) : ignore_mask;
|
||||
|
||||
if (!(wi_flags & ignore_mask_to_use)) { // Maybe bombs are illegal.
|
||||
if (wi_flags & priority1) {
|
||||
if (!(wi_flags & ignore_mask_to_use).any_set()) { // Maybe bombs are illegal.
|
||||
if ((wi_flags & prio1).any_set()) {
|
||||
swp->current_secondary_bank = weapon_bank_list[i]; // Found first priority, return it.
|
||||
break;
|
||||
} else if (wi_flags & priority2)
|
||||
priority2_index = weapon_bank_list[i]; // Found second priority, but might still find first priority.
|
||||
}
|
||||
if (!(wi_flags2 & ignore_mask_to_use)) { // Maybe bombs are illegal.
|
||||
if (wi_flags2 & wif2_priority1) {
|
||||
swp->current_secondary_bank = weapon_bank_list[i]; // Found first priority, return it.
|
||||
break;
|
||||
} else if (wi_flags2 & wif2_priority2)
|
||||
} else if ((wi_flags & prio2).any_set())
|
||||
priority2_index = weapon_bank_list[i]; // Found second priority, but might still find first priority.
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore homing weapons if we didn't specify a flag - for priority 2
|
||||
if ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority2 == 0)) {
|
||||
ignore_mask |= WIF_HOMING;
|
||||
ignore_mask_without_huge |= WIF_HOMING;
|
||||
if ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (prio2.none_set())) {
|
||||
ignore_mask.set(Weapon::Info_Flags::Homing_aspect).set(Weapon::Info_Flags::Homing_heat).set(Weapon::Info_Flags::Homing_javelin);
|
||||
}
|
||||
|
||||
// If didn't find anything above, then pick any secondary weapon.
|
||||
@@ -5885,10 +5879,10 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
|
||||
swp->current_secondary_bank = priority2_index; // Assume we won't find anything.
|
||||
if (priority2_index == -1) {
|
||||
for (i=0; i<num_weapon_types; i++) {
|
||||
int wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
int ignore_mask_to_use = ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (wi_flags & WIF_BOMBER_PLUS)) ? ignore_mask_without_huge : ignore_mask;
|
||||
auto wi_flags = Weapon_info[swp->secondary_bank_weapons[weapon_bank_list[i]]].wi_flags;
|
||||
auto ignore_mask_to_use = ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (wi_flags[Weapon::Info_Flags::Bomber_plus])) ? (ignore_mask - Weapon::Info_Flags::Huge) : ignore_mask;
|
||||
|
||||
if (!(wi_flags & ignore_mask_to_use)) { // Maybe bombs are illegal.
|
||||
if (!(wi_flags & ignore_mask_to_use).any_set()) { // Maybe bombs are illegal.
|
||||
if (swp->secondary_bank_ammo[weapon_bank_list[i]] > 0) {
|
||||
swp->current_secondary_bank = weapon_bank_list[i];
|
||||
break;
|
||||
@@ -5910,7 +5904,7 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
|
||||
weapon_info *wip=&Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
|
||||
|
||||
// phreak -- rapid dumbfire? let it rip!
|
||||
if ((aip->ai_profile_flags & AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE) && !(wip->wi_flags & WIF_HOMING) && (wip->fire_wait < .5f))
|
||||
if ((aip->ai_profile_flags & AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE) && !(wip->is_homing()) && (wip->fire_wait < .5f))
|
||||
{
|
||||
aip->ai_flags |= AIF_UNLOAD_SECONDARIES;
|
||||
}
|
||||
@@ -5929,7 +5923,7 @@ int compute_num_homing_objects(object *target_objp)
|
||||
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_WEAPON) {
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_HOMING) {
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].is_homing()) {
|
||||
if (Weapons[objp->instance].homing_object == target_objp) {
|
||||
count++;
|
||||
}
|
||||
@@ -6012,7 +6006,7 @@ int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip)
|
||||
|
||||
// If player, maybe fire based on Skill_level and number of incoming weapons.
|
||||
// If non-player, maybe fire based on payload of incoming weapons.
|
||||
if (wip->wi_flags & WIF_HOMING) {
|
||||
if (wip->is_homing()) {
|
||||
if ((target_objnum > -1) && (tobjp->flags[Object::Object_Flags::Player_ship])) {
|
||||
if (Ai_info[Ships[tobjp->instance].ai_index].target_objnum != objnum) {
|
||||
// Don't allow AI ships to fire at player for fixed periods of time based on skill level.
|
||||
@@ -6024,7 +6018,7 @@ int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip)
|
||||
}
|
||||
}
|
||||
int swarmers = 0;
|
||||
if (wip->wi_flags & WIF_SWARM)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Swarm])
|
||||
swarmers = 2; // Note, always want to be able to fire swarmers if no currently incident homers.
|
||||
if (The_mission.ai_profile->max_allowed_player_homers[Game_skill_level] < num_homers + swarmers) {
|
||||
return 0;
|
||||
@@ -6083,9 +6077,9 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2)
|
||||
|
||||
weapon_info *wip = &Weapon_info[shipp->weapons.secondary_bank_weapons[current_bank]];
|
||||
|
||||
if ((wip->wi_flags & WIF_LOCKED_HOMING) && (!Ai_info[shipp->ai_index].current_target_is_locked)) {
|
||||
if ((wip->is_locked_homing()) && (!Ai_info[shipp->ai_index].current_target_is_locked)) {
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp(250);
|
||||
} else if ((wip->wi_flags & WIF_BOMB) || (vm_vec_dist_quick(&objp->pos, &En_objp->pos) > 50.0f)) {
|
||||
} else if ((wip->wi_flags[Weapon::Info_Flags::Bomb]) || (vm_vec_dist_quick(&objp->pos, &En_objp->pos) > 50.0f)) {
|
||||
// This might look dumb, firing a bomb even if closer than 50 meters, but the reason is, if you're carrying
|
||||
// bombs, delivering them is probably more important than surviving.
|
||||
ai_info *aip;
|
||||
@@ -7609,7 +7603,7 @@ void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dis
|
||||
|
||||
wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
|
||||
|
||||
if (num_weapon_types && (wip->wi_flags & WIF_LOCKED_HOMING) && !(shipp->flags[Ship::Ship_Flags::No_secondary_lockon])) {
|
||||
if (num_weapon_types && (wip->is_locked_homing()) && !(shipp->flags[Ship::Ship_Flags::No_secondary_lockon])) {
|
||||
if (dist_to_enemy > 300.0f - MIN(enemy_radius, 100.0f))
|
||||
aip->ai_flags |= AIF_SEEK_LOCK;
|
||||
else
|
||||
@@ -7621,8 +7615,8 @@ void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dis
|
||||
|
||||
float needed_dot = 0.9f - 0.5f * enemy_radius/(dist_to_enemy + enemy_radius); // Replaced MIN_TRACKABLE_DOT with 0.9f
|
||||
if (dot_to_enemy > needed_dot &&
|
||||
(wip->wi_flags & WIF_HOMING_ASPECT ||
|
||||
(wip->wi_flags & WIF_HOMING_JAVELIN &&
|
||||
(wip->wi_flags[Weapon::Info_Flags::Homing_aspect] ||
|
||||
(wip->wi_flags[Weapon::Info_Flags::Homing_javelin] &&
|
||||
(tshpp == NULL ||
|
||||
ship_get_closest_subsys_in_sight(tshpp, SUBSYSTEM_ENGINE, &aiobjp->pos))))) {
|
||||
aip->aspect_locked_time += flFrametime;
|
||||
@@ -7706,7 +7700,8 @@ int has_preferred_secondary(object *objp, object *en_objp, ship_weapon *swp)
|
||||
void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp)
|
||||
{
|
||||
float subsystem_strength = 0.0f;
|
||||
int is_big_ship, wif_priority1, wif_priority2, wif2_priority1, wif2_priority2;
|
||||
int is_big_ship;
|
||||
flagset<Weapon::Info_Flags> wif_priority1, wif_priority2;
|
||||
ship_weapon *swp;
|
||||
ship_info *esip;
|
||||
|
||||
@@ -7747,41 +7742,36 @@ void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp)
|
||||
|
||||
if (is_big_ship)
|
||||
{
|
||||
wif_priority1 = WIF_HUGE;
|
||||
wif_priority2 = (aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) ? WIF_BOMBER_PLUS : WIF_HOMING;
|
||||
wif2_priority1 = WIF2_CAPITAL_PLUS;
|
||||
wif2_priority2 = 0;
|
||||
wif_priority1.set(Weapon::Info_Flags::Huge);
|
||||
if (aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) {
|
||||
wif_priority2.set(Weapon::Info_Flags::Bomber_plus);
|
||||
}
|
||||
else {
|
||||
wif_priority2.set(Weapon::Info_Flags::Homing_aspect).set(Weapon::Info_Flags::Homing_heat).set(Weapon::Info_Flags::Homing_javelin);
|
||||
}
|
||||
}
|
||||
else if ( (esip != NULL) && (esip->flags[Ship::Info_Flags::Bomber]) )
|
||||
{
|
||||
wif_priority1 = WIF_BOMBER_PLUS;
|
||||
wif_priority2 = WIF_HOMING;
|
||||
wif2_priority1 = 0;
|
||||
wif2_priority2 = 0;
|
||||
wif_priority1.set(Weapon::Info_Flags::Bomber_plus);
|
||||
wif_priority2.set(Weapon::Info_Flags::Homing_aspect).set(Weapon::Info_Flags::Homing_heat).set(Weapon::Info_Flags::Homing_javelin);
|
||||
}
|
||||
else if (subsystem_strength > 100.0f)
|
||||
{
|
||||
wif_priority1 = WIF_PUNCTURE;
|
||||
wif_priority2 = WIF_HOMING;
|
||||
wif2_priority1 = 0;
|
||||
wif2_priority2 = 0;
|
||||
wif_priority1.set(Weapon::Info_Flags::Puncture);
|
||||
wif_priority2.set(Weapon::Info_Flags::Homing_aspect).set(Weapon::Info_Flags::Homing_heat).set(Weapon::Info_Flags::Homing_javelin);
|
||||
}
|
||||
else if ((aip->ai_profile_flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (en_objp->type == OBJ_ASTEROID)) //prefer dumbfires if its an asteroid
|
||||
{
|
||||
wif_priority1 = 0;
|
||||
wif_priority2 = 0;
|
||||
wif2_priority1 = 0;
|
||||
wif2_priority2 = 0;
|
||||
wif_priority1.reset();
|
||||
wif_priority2.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
wif_priority1 = WIF_HOMING;
|
||||
wif_priority2 = 0;
|
||||
wif2_priority1 = 0;
|
||||
wif2_priority2 = 0;
|
||||
wif_priority1.set(Weapon::Info_Flags::Homing_aspect).set(Weapon::Info_Flags::Homing_heat).set(Weapon::Info_Flags::Homing_javelin);
|
||||
wif_priority2.reset();
|
||||
}
|
||||
|
||||
ai_select_secondary_weapon(objp, swp, wif_priority1, wif_priority2, wif2_priority1, wif2_priority2);
|
||||
ai_select_secondary_weapon(objp, swp, &wif_priority1, &wif_priority2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8805,9 +8795,9 @@ void ai_chase()
|
||||
if (current_bank >= 0) {
|
||||
float firing_range;
|
||||
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
if (swip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
firing_range=swip->lssm_lock_range; //that should be enough
|
||||
else if (swip->wi_flags & WIF_BOMB)
|
||||
else if (swip->wi_flags[Weapon::Info_Flags::Bomb])
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime * 0.75f), swip->weapon_range);
|
||||
else
|
||||
{
|
||||
@@ -8828,7 +8818,7 @@ void ai_chase()
|
||||
// If firing a spawn weapon, distance doesn't matter.
|
||||
int spawn_fire = 0;
|
||||
|
||||
if (swip->wi_flags & WIF_SPAWN) {
|
||||
if (swip->wi_flags[Weapon::Info_Flags::Spawn]) {
|
||||
int count;
|
||||
|
||||
count = num_nearby_fighters(iff_get_attackee_mask(obj_team(Pl_objp)), &Pl_objp->pos, 1000.0f);
|
||||
@@ -9635,7 +9625,7 @@ int ai_guard_find_nearby_bomb(object *guarding_objp, object *guarded_objp)
|
||||
wp = &Weapons[bomb_objp->instance];
|
||||
wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
if ( !((wip->wi_flags & WIF_BOMB) || (wip->wi_flags3 & WIF3_FIGHTER_INTERCEPTABLE)) ) {
|
||||
if ( !((wip->wi_flags[Weapon::Info_Flags::Bomb]) || (wip->wi_flags[Weapon::Info_Flags::Fighter_Interceptable])) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -12385,7 +12375,7 @@ void ai_maybe_evade_locked_missile(object *objp, ai_info *aip)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((missile_objp->type == OBJ_WEAPON) && (Weapon_info[Weapons[missile_objp->instance].weapon_info_index].wi_flags & WIF_HOMING)) {
|
||||
if ((missile_objp->type == OBJ_WEAPON) && (Weapon_info[Weapons[missile_objp->instance].weapon_info_index].is_homing())) {
|
||||
float dist = vm_vec_dist_quick(&missile_objp->pos, &objp->pos);
|
||||
float dist2 = 4.0f * vm_vec_mag_quick(&missile_objp->phys_info.vel);
|
||||
if (dist < dist2) {
|
||||
@@ -13261,7 +13251,7 @@ int maybe_request_support(object *objp)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
r = (float) swp->primary_bank_ammo[i] / swp->primary_bank_start_ammo[i];
|
||||
|
||||
@@ -13618,7 +13608,7 @@ int aas_1(object *objp, ai_info *aip, vec3d *safe_pos)
|
||||
// If an aspect locked missile, assume it will detonate at the homing position.
|
||||
// If not, which is not possible in a default FreeSpace weapon, then predict it will detonate at some
|
||||
// time in the future, this time based on max lifetime and life left.
|
||||
if (wip->wi_flags & WIF_LOCKED_HOMING) {
|
||||
if (wip->is_locked_homing()) {
|
||||
expected_pos = weaponp->homing_pos;
|
||||
if (weaponp->homing_object && weaponp->homing_object->type == OBJ_SHIP) {
|
||||
target_ship_obj = weaponp->homing_object;
|
||||
@@ -14834,8 +14824,8 @@ int firing_aspect_seeking_bomb(object *objp)
|
||||
if (bank_index != -1) {
|
||||
if (swp->secondary_bank_weapons[bank_index] > 0) {
|
||||
if (swp->secondary_bank_ammo[bank_index] > 0) {
|
||||
if (Weapon_info[swp->secondary_bank_weapons[bank_index]].wi_flags & WIF_BOMB) {
|
||||
if (Weapon_info[swp->secondary_bank_weapons[bank_index]].wi_flags & WIF_HOMING_ASPECT) {
|
||||
if (Weapon_info[swp->secondary_bank_weapons[bank_index]].wi_flags[Weapon::Info_Flags::Bomb]) {
|
||||
if (Weapon_info[swp->secondary_bank_weapons[bank_index]].wi_flags[Weapon::Info_Flags::Homing_aspect]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -14915,7 +14905,7 @@ void ai_update_lethality(object *pship_obj, object *other_obj, float damage)
|
||||
|
||||
// if parent is BIG|HUGE, don't count beam
|
||||
if ( Ship_info[Ships[Objects[parent].instance].ship_info_index].is_big_or_huge() ) {
|
||||
if (wif->wi_flags & WIF_BEAM) {
|
||||
if (wif->wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
dont_count = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -15565,8 +15555,9 @@ void cheat_fire_synaptic(object *objp, ship *shipp, ai_info *aip)
|
||||
ship_weapon *swp;
|
||||
swp = &shipp->weapons;
|
||||
int current_bank = swp->current_secondary_bank;
|
||||
|
||||
ai_select_secondary_weapon(objp, swp, WIF_SPAWN, 0);
|
||||
flagset<Weapon::Info_Flags> flags;
|
||||
flags += Weapon::Info_Flags::Spawn;
|
||||
ai_select_secondary_weapon(objp, swp, &flags, NULL);
|
||||
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
|
||||
if (ship_fire_secondary(objp)) {
|
||||
nprintf(("AI", "ship %s cheat fired synaptic!\n", shipp->ship_name));
|
||||
|
||||
+76
-132
@@ -256,54 +256,46 @@ int turret_select_best_weapon(ship_subsys *turret, object *target)
|
||||
|
||||
/**
|
||||
* Returns true if all weapons in swp have the specified flag
|
||||
*
|
||||
* @note doesn't work for WIF2
|
||||
*/
|
||||
bool all_turret_weapons_have_flags(ship_weapon *swp, int flags)
|
||||
bool all_turret_weapons_have_flags(ship_weapon *swp, flagset<Weapon::Info_Flags> flags)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if(!(Weapon_info[swp->primary_bank_weapons[i]].wi_flags & flags))
|
||||
if(!(Weapon_info[swp->primary_bank_weapons[i]].wi_flags & flags).any_set())
|
||||
return false;
|
||||
}
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if(!(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags & flags))
|
||||
if(!(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags & flags).any_set())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all weapons in swp have the specified flag
|
||||
*
|
||||
* @note does work for WIF2, but not WIF
|
||||
*/
|
||||
bool all_turret_weapons_have_flags2(ship_weapon *swp, int flags)
|
||||
bool all_turret_weapons_have_flags(ship_weapon *swp, Weapon::Info_Flags flags)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if(!(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & flags))
|
||||
return false;
|
||||
}
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if(!(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2 & flags))
|
||||
return false;
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if (!(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[flags]))
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if (!(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags[flags]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have flags
|
||||
*
|
||||
* @note doesn't work for WIF2
|
||||
*/
|
||||
bool turret_weapon_has_flags(ship_weapon *swp, int flags)
|
||||
bool turret_weapon_has_flags(ship_weapon *swp, Weapon::Info_Flags flags)
|
||||
{
|
||||
Assert(swp != NULL);
|
||||
|
||||
@@ -311,42 +303,14 @@ bool turret_weapon_has_flags(ship_weapon *swp, int flags)
|
||||
for(i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if(swp->primary_bank_weapons[i] >=0) {
|
||||
if(Weapon_info[swp->primary_bank_weapons[i]].wi_flags & flags)
|
||||
if(Weapon_info[swp->primary_bank_weapons[i]].wi_flags[flags])
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if(swp->secondary_bank_weapons[i] >=0) {
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags & flags)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have flags
|
||||
*
|
||||
* @note does work for WIF2, but not WIF
|
||||
*/
|
||||
bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
|
||||
{
|
||||
Assert(swp != NULL);
|
||||
|
||||
int i = 0;
|
||||
for(i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if(swp->primary_bank_weapons[i] >=0) {
|
||||
if(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & flags)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if(swp->secondary_bank_weapons[i] >=0) {
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2 & flags)
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags[flags])
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -357,11 +321,12 @@ bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
|
||||
/**
|
||||
* Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.
|
||||
*/
|
||||
int turret_weapon_aggregate_flags(ship_weapon *swp)
|
||||
flagset<Weapon::Info_Flags> turret_weapon_aggregate_flags(ship_weapon *swp)
|
||||
{
|
||||
Assert(swp != NULL);
|
||||
|
||||
int i = 0, flags = 0;
|
||||
int i = 0;
|
||||
flagset<Weapon::Info_Flags> flags;
|
||||
for (i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if (swp->primary_bank_weapons[i] >= 0) {
|
||||
@@ -378,30 +343,6 @@ int turret_weapon_aggregate_flags(ship_weapon *swp)
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.
|
||||
*/
|
||||
int turret_weapon_aggregate_flags2(ship_weapon *swp)
|
||||
{
|
||||
Assert(swp != NULL);
|
||||
|
||||
int i = 0, flags2 = 0;
|
||||
for (i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
if (swp->primary_bank_weapons[i] >= 0) {
|
||||
flags2 |= Weapon_info[swp->primary_bank_weapons[i]].wi_flags2;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if (swp->secondary_bank_weapons[i] >= 0) {
|
||||
flags2 |= Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2;
|
||||
}
|
||||
}
|
||||
|
||||
return flags2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have the subtype specified
|
||||
*
|
||||
@@ -473,7 +414,7 @@ float longest_turret_weapon_range(ship_weapon *swp)
|
||||
for(i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
if (wip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
weapon_range = wip->lssm_lock_range;
|
||||
else
|
||||
weapon_range = MIN(wip->lifetime * wip->max_speed, wip->weapon_range);
|
||||
@@ -484,7 +425,7 @@ float longest_turret_weapon_range(ship_weapon *swp)
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
wip = &Weapon_info[swp->secondary_bank_weapons[i]];
|
||||
if (wip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
weapon_range = wip->lssm_lock_range;
|
||||
else
|
||||
weapon_range = MIN(wip->lifetime * wip->max_speed, wip->weapon_range);
|
||||
@@ -549,15 +490,15 @@ int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
weapon *wp = &Weapons[objp->instance];
|
||||
weapon_info *wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
if (wip->subtype == WP_LASER && !(wip->wi_flags3 & WIF3_TURRET_INTERCEPTABLE)) { // If the thing can't be shot down, don't try. -MageKing17
|
||||
if (wip->subtype == WP_LASER && !(wip->wi_flags[Weapon::Info_Flags::Turret_Interceptable])) { // If the thing can't be shot down, don't try. -MageKing17
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (!((wip->wi_flags & WIF_BOMB) || (wip->wi_flags3 & WIF3_TURRET_INTERCEPTABLE)) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
|
||||
if ( (!((wip->wi_flags[Weapon::Info_Flags::Bomb]) || (wip->wi_flags[Weapon::Info_Flags::Turret_Interceptable])) && !(Ai_info[Ships[turret_parent->instance].ai_index].ai_profile_flags & AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY) ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (wip->wi_flags2 & WIF2_LOCAL_SSM) && (wp->lssm_stage == 3) ) {
|
||||
if ( (wip->wi_flags[Weapon::Info_Flags::Local_ssm]) && (wp->lssm_stage == 3) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -658,7 +599,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
if (eeo->eeo_flags & EEOF_TAGGED_ONLY) {
|
||||
if (!ship_is_tagged(objp) &&
|
||||
( (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING) ||
|
||||
( !(objp->type == OBJ_WEAPON) && !(turret_weapon_has_flags(&eeo->turret_subsys->weapons, WIF_SPAWN))) )) {
|
||||
( !(objp->type == OBJ_WEAPON) && !(turret_weapon_has_flags(&eeo->turret_subsys->weapons, Weapon::Info_Flags::Spawn))) )) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -842,12 +783,12 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
int is_target_beam_valid(ship_weapon *swp, object *objp)
|
||||
{
|
||||
// check if turret has beam weapon
|
||||
if (all_turret_weapons_have_flags(swp, WIF_BEAM)) {
|
||||
if (all_turret_weapons_have_flags(swp, Weapon::Info_Flags::Beam)) {
|
||||
if (objp->flags[Object::Object_Flags::Beam_protected]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (all_turret_weapons_have_flags(swp, WIF_HUGE)) {
|
||||
if (all_turret_weapons_have_flags(swp, Weapon::Info_Flags::Huge)) {
|
||||
if (objp->type == OBJ_SHIP && !(Ship_info[Ships[objp->instance].ship_info_index].is_big_or_huge()) ) {
|
||||
return 0;
|
||||
}
|
||||
@@ -889,7 +830,7 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
//wip=&Weapon_info[tp->turret_weapon_type];
|
||||
//weapon_travel_dist = MIN(wip->lifetime * wip->max_speed, wip->weapon_range);
|
||||
|
||||
//if (wip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
//if (wip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
// weapon_travel_dist=wip->lssm_lock_range;
|
||||
|
||||
// Set flag based on strength of weapons subsystem. If weapons subsystem is destroyed, don't let turrets fire at bombs
|
||||
@@ -960,8 +901,8 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
n_tgt_priorities = Weapon_info[priority_weapon_idx].num_targeting_priorities;
|
||||
}
|
||||
|
||||
if (n_tgt_priorities > 0) {
|
||||
|
||||
if (n_tgt_priorities > 0)
|
||||
{
|
||||
for(int i = 0; i < n_tgt_priorities; i++) {
|
||||
// courtesy of WMC...
|
||||
ai_target_priority *tt;
|
||||
@@ -1008,10 +949,8 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
}
|
||||
}
|
||||
|
||||
if( ( (tt->wif_flags != 0) || (tt->wif2_flags != 0) || (tt->wif3_flags != 0) ) && (ptr->type == OBJ_WEAPON) ) {
|
||||
if( ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags & tt->wif_flags ) == tt->wif_flags)
|
||||
&& ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags2 & tt->wif2_flags ) == tt->wif2_flags)
|
||||
&& ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags3 & tt->wif3_flags ) == tt->wif3_flags) ) {
|
||||
if( (tt->wif_flags.any_set()) && (ptr->type == OBJ_WEAPON) ) {
|
||||
if( ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags & tt->wif_flags ) == tt->wif_flags) ) {
|
||||
found_something = true;
|
||||
}
|
||||
}
|
||||
@@ -1087,7 +1026,11 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
return return_objnum;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
flagset<Weapon::Info_Flags> tmp_flagset;
|
||||
const Weapon::Info_Flags weapon_flags[] = { Weapon::Info_Flags::Huge, Weapon::Info_Flags::Flak, Weapon::Info_Flags::Homing_aspect, Weapon::Info_Flags::Homing_heat, Weapon::Info_Flags::Homing_javelin, Weapon::Info_Flags::Spawn };
|
||||
tmp_flagset.set_multiple(std::begin(weapon_flags), std::end(weapon_flags));
|
||||
|
||||
for(int i = 0; i < NUM_TURRET_ORDER_TYPES; i++)
|
||||
{
|
||||
@@ -1108,7 +1051,7 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
objp = &Objects[mo->objnum];
|
||||
|
||||
Assert(objp->type == OBJ_WEAPON);
|
||||
if ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags3 & WIF3_TURRET_INTERCEPTABLE))
|
||||
if ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Turret_Interceptable]))
|
||||
{
|
||||
evaluate_obj_as_target(objp, &eeo);
|
||||
}
|
||||
@@ -1151,7 +1094,8 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
// - lasers
|
||||
// - dumbfire type missiles
|
||||
// - AAA beams
|
||||
if ( !all_turret_weapons_have_flags(swp, WIF_HUGE | WIF_FLAK | WIF_HOMING | WIF_SPAWN) ) {
|
||||
|
||||
if ( !all_turret_weapons_have_flags(swp, tmp_flagset) ) {
|
||||
// Asteroid_obj_list
|
||||
for ( ao = GET_FIRST(&Asteroid_obj_list); ao != END_OF_LIST(&Asteroid_obj_list); ao = GET_NEXT(ao) ) {
|
||||
objp = &Objects[ao->objnum];
|
||||
@@ -1192,12 +1136,12 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
|
||||
|
||||
enemy_team_mask = iff_get_attackee_mask(obj_team(&Objects[objnum]));
|
||||
|
||||
bool big_only_flag = all_turret_weapons_have_flags(&turret_subsys->weapons, WIF_HUGE);
|
||||
bool small_only_flag = all_turret_weapons_have_flags2(&turret_subsys->weapons, WIF2_SMALL_ONLY);
|
||||
bool tagged_only_flag = all_turret_weapons_have_flags2(&turret_subsys->weapons, WIF2_TAGGED_ONLY) || (turret_subsys->weapons.flags[Ship::Weapon_Flags::Tagged_Only]);
|
||||
bool big_only_flag = all_turret_weapons_have_flags(&turret_subsys->weapons, Weapon::Info_Flags::Huge);
|
||||
bool small_only_flag = all_turret_weapons_have_flags(&turret_subsys->weapons, Weapon::Info_Flags::Small_only);
|
||||
bool tagged_only_flag = all_turret_weapons_have_flags(&turret_subsys->weapons, Weapon::Info_Flags::Tagged_only) || (turret_subsys->weapons.flags[Ship::Weapon_Flags::Tagged_Only]);
|
||||
|
||||
bool beam_flag = turret_weapon_has_flags(&turret_subsys->weapons, WIF_BEAM);
|
||||
bool flak_flag = turret_weapon_has_flags(&turret_subsys->weapons, WIF_FLAK);
|
||||
bool beam_flag = turret_weapon_has_flags(&turret_subsys->weapons, Weapon::Info_Flags::Beam);
|
||||
bool flak_flag = turret_weapon_has_flags(&turret_subsys->weapons, Weapon::Info_Flags::Flak);
|
||||
bool laser_flag = turret_weapon_has_subtype(&turret_subsys->weapons, WP_LASER);
|
||||
bool missile_flag = turret_weapon_has_subtype(&turret_subsys->weapons, WP_MISSILE);
|
||||
|
||||
@@ -1747,13 +1691,13 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
|
||||
fs_dest = &turret->weapons.next_secondary_fire_stamp[weapon_num - MAX_SHIP_PRIMARY_BANKS];
|
||||
|
||||
//Check for the new cooldown flag
|
||||
if(!((wip->wi_flags2 & WIF2_SAME_TURRET_COOLDOWN) || ((wip->burst_shots > 0) && (wip->burst_flags & WBF_FAST_FIRING))))
|
||||
if(!((wip->wi_flags[Weapon::Info_Flags::Same_turret_cooldown]) || ((wip->burst_shots > 0) && (wip->burst_flags & WBF_FAST_FIRING))))
|
||||
{
|
||||
|
||||
// make side even for team vs. team
|
||||
if (MULTI_TEAM) {
|
||||
// flak guns need to fire more rapidly
|
||||
if (wip->wi_flags & WIF_FLAK) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Flak]) {
|
||||
wait *= aip->ai_ship_fire_delay_scale_friendly * 0.5f;
|
||||
if (aip->ai_class_autoscale)
|
||||
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
|
||||
@@ -1764,7 +1708,7 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
|
||||
}
|
||||
} else {
|
||||
// flak guns need to fire more rapidly
|
||||
if (wip->wi_flags & WIF_FLAK) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Flak]) {
|
||||
if (Ships[aip->shipnum].team == Player_ship->team) {
|
||||
wait *= aip->ai_ship_fire_delay_scale_friendly * 0.5f;
|
||||
} else {
|
||||
@@ -1773,7 +1717,7 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
|
||||
if (aip->ai_class_autoscale)
|
||||
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
|
||||
|
||||
} else if (wip->wi_flags & WIF_HUGE) {
|
||||
} else if (wip->wi_flags[Weapon::Info_Flags::Huge]) {
|
||||
// make huge weapons fire independently of team
|
||||
wait *= aip->ai_ship_fire_delay_scale_friendly;
|
||||
if (aip->ai_class_autoscale)
|
||||
@@ -1869,12 +1813,12 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
object *tobjp = &Objects[turret->turret_enemy_objnum];
|
||||
|
||||
// should not get this far. check if ship is protected from beam and weapon is type beam
|
||||
if ( (wip->wi_flags & WIF_BEAM) && (tobjp->flags[Object::Object_Flags::Beam_protected]) ) {
|
||||
if ( (wip->wi_flags[Weapon::Info_Flags::Beam]) && (tobjp->flags[Object::Object_Flags::Beam_protected]) ) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
// should not get this far. check if ship is protected from flak and weapon is type flak
|
||||
else if ( (wip->wi_flags & WIF_FLAK) && (tobjp->flags[Object::Object_Flags::Flak_protected]) ) {
|
||||
else if ( (wip->wi_flags[Weapon::Info_Flags::Flak]) && (tobjp->flags[Object::Object_Flags::Flak_protected]) ) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
@@ -1900,7 +1844,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
turret_set_next_fire_timestamp(weapon_num, wip, turret, parent_aip);
|
||||
|
||||
// if this weapon is a beam weapon, handle it specially
|
||||
if (wip->wi_flags & WIF_BEAM) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
// if this beam isn't free to fire
|
||||
if (!(turret->weapons.flags[Ship::Weapon_Flags::Beam_Free])) {
|
||||
return false;
|
||||
@@ -1914,7 +1858,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
fire_info.beam_info_override = NULL;
|
||||
fire_info.shooter = &Objects[parent_objnum];
|
||||
fire_info.target = &Objects[turret->turret_enemy_objnum];
|
||||
if (wip->wi_flags2 & WIF2_ANTISUBSYSBEAM)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Antisubsysbeam])
|
||||
fire_info.target_subsys = turret->targeted_subsys;
|
||||
else
|
||||
fire_info.target_subsys = NULL;
|
||||
@@ -1938,7 +1882,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
return true;
|
||||
}
|
||||
// don't fire swam, but set up swarm info instead
|
||||
else if ((wip->wi_flags & WIF_SWARM) || (wip->wi_flags & WIF_CORKSCREW)) {
|
||||
else if ((wip->wi_flags[Weapon::Info_Flags::Swarm]) || (wip->wi_flags[Weapon::Info_Flags::Corkscrew])) {
|
||||
ship_weapon *swp = &turret->weapons;
|
||||
if (swp->current_secondary_bank < 0) {
|
||||
swp->current_secondary_bank = 0;
|
||||
@@ -2069,7 +2013,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
|
||||
|
||||
// if the gun is a flak gun
|
||||
if (wip->wi_flags & WIF_FLAK) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Flak]) {
|
||||
// show a muzzle flash
|
||||
flak_muzzle_flash(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, turret_weapon_class);
|
||||
|
||||
@@ -2097,7 +2041,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
|
||||
subsys_index = ship_get_index_from_subsys(turret, parent_objnum );
|
||||
Assert( subsys_index != -1 );
|
||||
if(wip->wi_flags & WIF_FLAK){
|
||||
if(wip->wi_flags[Weapon::Info_Flags::Flak]){
|
||||
send_flak_fired_packet( parent_objnum, subsys_index, weapon_objnum, flak_range );
|
||||
} else {
|
||||
send_turret_fired_packet( parent_objnum, subsys_index, weapon_objnum );
|
||||
@@ -2155,13 +2099,13 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
tsi->turret->turret_next_fire_pos++;
|
||||
|
||||
//check if this really is a swarm. If not, how the hell did it get here?
|
||||
Assert((Weapon_info[tsi->weapon_class].wi_flags & WIF_SWARM) || (Weapon_info[tsi->weapon_class].wi_flags & WIF_CORKSCREW));
|
||||
Assert((Weapon_info[tsi->weapon_class].wi_flags[Weapon::Info_Flags::Swarm]) || (Weapon_info[tsi->weapon_class].wi_flags[Weapon::Info_Flags::Corkscrew]));
|
||||
|
||||
|
||||
// *If it's a non-homer, then use the last fire direction instead of turret orientation to fix inaccuracy
|
||||
// problems with non-homing swarm weapons -Et1
|
||||
if ( (Weapon_info[tsi->weapon_class].subtype == WP_LASER) || ((The_mission.ai_profile->flags & AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY)
|
||||
&& !(Weapon_info[tsi->weapon_class].wi_flags & WIF_HOMING)) )
|
||||
&& !(Weapon_info[tsi->weapon_class].is_homing())) )
|
||||
{
|
||||
turret_fvec = tsi->turret->turret_last_fire_direction;
|
||||
}
|
||||
@@ -2273,7 +2217,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
|
||||
// If beam weapon, check beam free
|
||||
if ( all_turret_weapons_have_flags(swp, WIF_BEAM) && !(swp->flags[Ship::Weapon_Flags::Beam_Free]) ) {
|
||||
if ( all_turret_weapons_have_flags(swp, Weapon::Info_Flags::Beam) && !(swp->flags[Ship::Weapon_Flags::Beam_Free]) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2396,7 +2340,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
|
||||
//If this is a spawning type weapon, shoot it!
|
||||
//If 'smart spawn' just use it like normal weapons
|
||||
if ( (wip->wi_flags & WIF_SPAWN) && !(wip->wi_flags2 & WIF2_SMART_SPAWN) )
|
||||
if ( (wip->wi_flags[Weapon::Info_Flags::Spawn]) && !(wip->wi_flags[Weapon::Info_Flags::Smart_spawn]) )
|
||||
{
|
||||
if (( num_ships_nearby >= 3 ) || ((num_ships_nearby >= 2) && (frand() < 0.1f))) {
|
||||
turret_fire_weapon(i, ss, parent_objnum, &gpos, &ss->turret_last_fire_direction);
|
||||
@@ -2409,7 +2353,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
|
||||
|
||||
if(wip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
if(wip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
{
|
||||
weapon_firing_range=wip->lssm_lock_range;
|
||||
WeaponMinRange = 0.0f;
|
||||
@@ -2421,7 +2365,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
|
||||
|
||||
if (wip->wi_flags & WIF_BEAM) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
if ( !((shipp->tag_left > 0) || (shipp->level2_tag_left > 0)) ) {
|
||||
if (Nebula_sec_range)
|
||||
{
|
||||
@@ -2439,7 +2383,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
{
|
||||
if( (dist_to_enemy <= weapon_firing_range) && (dist_to_enemy >= WeaponMinRange) )
|
||||
{
|
||||
if ( wip->wi_flags & WIF_HUGE ) {
|
||||
if ( wip->wi_flags[Weapon::Info_Flags::Huge] ) {
|
||||
if ( lep->type != OBJ_SHIP ) {
|
||||
continue;
|
||||
}
|
||||
@@ -2448,13 +2392,13 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
}
|
||||
|
||||
if ( wip->wi_flags2 & WIF2_SMALL_ONLY ) {
|
||||
if ( wip->wi_flags[Weapon::Info_Flags::Small_only] ) {
|
||||
if ( (lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge()) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bool tagged_only = ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags[Ship::Weapon_Flags::Tagged_Only]));
|
||||
bool tagged_only = ((wip->wi_flags[Weapon::Info_Flags::Tagged_only]) || (ss->weapons.flags[Ship::Weapon_Flags::Tagged_Only]));
|
||||
|
||||
if (lep->type == OBJ_SHIP) {
|
||||
// Check if we're targeting a protected ship
|
||||
@@ -2465,13 +2409,13 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
|
||||
// Check if we're targeting a beam protected ship with a beam weapon
|
||||
if ( (lep->flags[Object::Object_Flags::Beam_protected]) && (wip->wi_flags & WIF_BEAM) ) {
|
||||
if ( (lep->flags[Object::Object_Flags::Beam_protected]) && (wip->wi_flags[Weapon::Info_Flags::Beam]) ) {
|
||||
ss->turret_enemy_objnum = -1;
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
}
|
||||
// Check if we're targeting a flak protected ship with a flak weapon
|
||||
else if ( (lep->flags[Object::Object_Flags::Flak_protected]) && (wip->wi_flags & WIF_FLAK) ) {
|
||||
else if ( (lep->flags[Object::Object_Flags::Flak_protected]) && (wip->wi_flags[Weapon::Info_Flags::Flak]) ) {
|
||||
ss->turret_enemy_objnum = -1;
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
@@ -2653,7 +2597,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
|
||||
// if the weapon is a flak gun, add some jitter to its aim so it fires in a "cone"
|
||||
// to make a cool visual effect and make them less lethal
|
||||
if(wip->wi_flags & WIF_FLAK){
|
||||
if(wip->wi_flags[Weapon::Info_Flags::Flak]){
|
||||
flak_jitter_aim(&tv2e, dist_to_enemy, ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS), wip);
|
||||
}
|
||||
|
||||
@@ -2668,7 +2612,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
// we have already passed the FOV test of the turret so...
|
||||
in_sight = true;
|
||||
} else {
|
||||
if (wip->wi_flags & WIF_HOMING_HEAT) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Homing_heat]) {
|
||||
if (dot > AICODE_TURRET_HEATSEEK_ANGLE) {
|
||||
in_sight = true;
|
||||
}
|
||||
@@ -2679,7 +2623,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
}
|
||||
|
||||
if ( !(wip->wi_flags & WIF_HOMING) )
|
||||
if ( !(wip->is_homing()) )
|
||||
{
|
||||
if ((dist_to_enemy < 75.0f) || in_sight)
|
||||
{
|
||||
@@ -2687,7 +2631,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
ok_to_fire = true;
|
||||
}
|
||||
}
|
||||
else if ( wip->wi_flags & WIF_HOMING_HEAT )
|
||||
else if ( wip->wi_flags[Weapon::Info_Flags::Homing_heat] )
|
||||
{ // if heat seekers
|
||||
if ((dist_to_enemy < 50.0f) || in_sight)
|
||||
{
|
||||
@@ -2695,7 +2639,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
ok_to_fire = true;
|
||||
}
|
||||
}
|
||||
else if ( wip->wi_flags & WIF_HOMING_ASPECT )
|
||||
else if ( wip->wi_flags[Weapon::Info_Flags::Homing_aspect] )
|
||||
{ // if aspect seeker
|
||||
if ((dist_to_enemy < 50.0f) || in_sight)
|
||||
{
|
||||
@@ -2706,7 +2650,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
ok_to_fire = true;
|
||||
}
|
||||
}
|
||||
else if ( wip->wi_flags & WIF_HOMING_JAVELIN )
|
||||
else if ( wip->wi_flags[Weapon::Info_Flags::Homing_javelin] )
|
||||
{ // if javelin heat seeker
|
||||
if ((dist_to_enemy < 50.0f) || in_sight)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ void cmeasure_select_next(ship *shipp)
|
||||
{
|
||||
new_index = (shipp->current_cmeasure + i) % Num_weapon_types;
|
||||
|
||||
if(Weapon_info[new_index].wi_flags & WIF_CMEASURE)
|
||||
if(Weapon_info[new_index].wi_flags[Weapon::Info_Flags::Cmeasure])
|
||||
{
|
||||
shipp->current_cmeasure = new_index;
|
||||
return;
|
||||
@@ -88,7 +88,7 @@ void cmeasure_maybe_alert_success(object *objp)
|
||||
return;
|
||||
}
|
||||
|
||||
Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_CMEASURE);
|
||||
Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Cmeasure]);
|
||||
|
||||
if ( objp->parent == OBJ_INDEX(Player_obj) ) {
|
||||
hud_start_text_flash(XSTR("Evaded", 1430), 800);
|
||||
|
||||
@@ -120,8 +120,8 @@ class flagset {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool any_set() const { return values.any(); }
|
||||
bool none_set() const { return values.none(); }
|
||||
bool any_set() { return values.any(); }
|
||||
bool none_set() { return values.none(); }
|
||||
|
||||
void from_long(std::uint64_t num) { values = num; }
|
||||
std::uint64_t to_long() const { return values.to_ulong(); }
|
||||
|
||||
@@ -38,5 +38,4 @@ class SCP_deque : public std::deque< T, std::allocator< T > > { };
|
||||
template< typename Key, typename T, typename Hash = std::hash<Key>, typename KeyEqual = std::equal_to<Key> >
|
||||
class SCP_unordered_map : public std::unordered_map< Key, T, Hash, KeyEqual, std::allocator< std::pair<const Key, T> > > { };
|
||||
|
||||
|
||||
#endif // _VMALLOCATOR_H_INCLUDED_
|
||||
@@ -308,7 +308,7 @@ void ssm_create(object *target, vec3d *start, size_t ssm_index, ssm_firing_info
|
||||
|
||||
ssm_info *si = &Ssm_info[ssm_index];
|
||||
weapon_info *wip = &Weapon_info[si->weapon_info_index];
|
||||
if (wip->wi_flags & WIF_BEAM) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
ssm.sinfo.duration = ((si->warp_time - ((wip->b_info.beam_warmup / 1000.0f) + wip->b_info.beam_life + (wip->b_info.beam_warmdown / 1000.0f))) / 2.0f) / si->warp_time;
|
||||
} else {
|
||||
ssm.sinfo.duration = 0.5f;
|
||||
@@ -371,7 +371,7 @@ void ssm_process()
|
||||
if ((1.0f - fireball_lifeleft_percent(&Objects[moveup->fireballs[idx]])) >= moveup->sinfo.duration) {
|
||||
weapon_info *wip = &Weapon_info[si->weapon_info_index];
|
||||
// are we a beam? -MageKing17
|
||||
if (wip->wi_flags & WIF_BEAM) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
beam_fire_info fire_info;
|
||||
memset(&fire_info, 0, sizeof(beam_fire_info));
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ int hud_lock_world_pos_in_range(vec3d *target_world_pos, vec3d *vec_to_target)
|
||||
dist_to_target = vm_vec_mag(vec_to_target);
|
||||
|
||||
//local ssms are always in range :)
|
||||
if (wip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Local_ssm])
|
||||
weapon_range=wip->lssm_lock_range;
|
||||
else
|
||||
// calculate the range of the weapon, and only display the lead target indicator when
|
||||
@@ -532,7 +532,7 @@ void hud_do_lock_indicator(float frametime)
|
||||
vec3d dir_to_target;
|
||||
vm_vec_normalized_dir(&dir_to_target, &tobjp->pos, &Player_obj->pos);
|
||||
|
||||
if ( !(wip->wi_flags & WIF_LOCKED_HOMING) ) {
|
||||
if ( !(wip->is_locked_homing()) ) {
|
||||
hud_lock_reset();
|
||||
return;
|
||||
}
|
||||
@@ -544,7 +544,7 @@ void hud_do_lock_indicator(float frametime)
|
||||
}
|
||||
|
||||
// Javelins must lock on engines if locking on a ship and those must be in sight
|
||||
if (wip->wi_flags & WIF_HOMING_JAVELIN &&
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Homing_javelin] &&
|
||||
tobjp->type == OBJ_SHIP &&
|
||||
Player->locking_subsys != NULL) {
|
||||
vec3d subobj_pos;
|
||||
@@ -558,7 +558,7 @@ void hud_do_lock_indicator(float frametime)
|
||||
}
|
||||
}
|
||||
|
||||
if (wip->wi_flags & WIF_HOMING_JAVELIN &&
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Homing_javelin] &&
|
||||
tobjp->type == OBJ_SHIP &&
|
||||
Player->locking_subsys == NULL) {
|
||||
Player->locking_subsys =
|
||||
@@ -989,7 +989,7 @@ void hud_lock_update_lock_pos(object *target_objp)
|
||||
ship_weapon *swp = &Player_ship->weapons;
|
||||
weapon_info *wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
|
||||
|
||||
if ( Player_ai->targeted_subsys && !(wip->wi_flags & WIF_HOMING_JAVELIN) ) {
|
||||
if ( Player_ai->targeted_subsys && !(wip->wi_flags[Weapon::Info_Flags::Homing_javelin]) ) {
|
||||
get_subsystem_world_pos(target_objp, Player_ai->targeted_subsys, &lock_world_pos);
|
||||
return;
|
||||
}
|
||||
@@ -1022,7 +1022,7 @@ void hud_lock_get_new_lock_pos(object *target_objp)
|
||||
|
||||
// if a large ship, lock to pos closest to center and within range
|
||||
if ( (target_shipp) && (Ship_info[target_shipp->ship_info_index].is_big_or_huge()) &&
|
||||
!(wip->wi_flags & WIF_HOMING_JAVELIN) ) {
|
||||
!(wip->wi_flags[Weapon::Info_Flags::Homing_javelin]) ) {
|
||||
// check all the subsystems and the center of the ship
|
||||
|
||||
// assume best lock pos is the center of the ship
|
||||
@@ -1060,7 +1060,7 @@ void hud_lock_get_new_lock_pos(object *target_objp)
|
||||
}
|
||||
ss = GET_NEXT( ss );
|
||||
}
|
||||
} else if ( (target_shipp) && (wip->wi_flags & WIF_HOMING_JAVELIN)) {
|
||||
} else if ( (target_shipp) && (wip->wi_flags[Weapon::Info_Flags::Homing_javelin])) {
|
||||
Player->locking_subsys = ship_get_closest_subsys_in_sight(target_shipp, SUBSYSTEM_ENGINE, &Player_obj->pos);
|
||||
if (Player->locking_subsys != NULL) {
|
||||
get_subsystem_world_pos(target_objp, Player->locking_subsys, &lock_world_pos);
|
||||
@@ -1099,12 +1099,12 @@ void hud_lock_determine_lock_point(vec3d *lock_world_pos_out)
|
||||
wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
|
||||
|
||||
// If subsystem is targeted, we must try to lock on that
|
||||
if ( Player_ai->targeted_subsys && !(wip->wi_flags & WIF_HOMING_JAVELIN) ) {
|
||||
if ( Player_ai->targeted_subsys && !(wip->wi_flags[Weapon::Info_Flags::Homing_javelin]) ) {
|
||||
hud_lock_update_lock_pos(target_objp);
|
||||
Player->locking_on_center=0;
|
||||
Player->locking_subsys=Player_ai->targeted_subsys;
|
||||
Player->locking_subsys_parent=Player_ai->target_objnum;
|
||||
} else if ( (wip->wi_flags & WIF_HOMING_JAVELIN) && (target_objp->type == OBJ_SHIP)) {
|
||||
} else if ( (wip->wi_flags[Weapon::Info_Flags::Homing_javelin]) && (target_objp->type == OBJ_SHIP)) {
|
||||
if (!Player->locking_subsys ||
|
||||
Player->locking_subsys->system_info->type != SUBSYSTEM_ENGINE) {
|
||||
Player->locking_subsys = ship_get_closest_subsys_in_sight(&Ships[target_objp->instance], SUBSYSTEM_ENGINE, &Player_obj->pos);
|
||||
|
||||
@@ -318,7 +318,7 @@ void HudGaugeReticle::getFirepointStatus() {
|
||||
if ( !( (j >= (shipp->last_fired_point[i]+1) % num_slots) && (j <= (shipp->last_fired_point[i]+swp->primary_bank_slot_count[i]) % num_slots) ) ) {
|
||||
fpactive--;
|
||||
}
|
||||
} else if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CYCLE) {
|
||||
} else if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Cycle]) {
|
||||
// If this firepoint is not the next one to be fired, dim it one step
|
||||
if (j != (shipp->last_fired_point[i]+1) % num_slots) {
|
||||
fpactive--;
|
||||
|
||||
@@ -850,7 +850,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
|
||||
}
|
||||
|
||||
if ( (Comm_orders[order].item == ATTACK_TARGET_ITEM )
|
||||
&& ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags3 & WIF3_FIGHTER_INTERCEPTABLE))
|
||||
&& ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Fighter_Interceptable]))
|
||||
&& (Weapons[objp->instance].team != ordering_shipp->team) )
|
||||
|
||||
return 1;
|
||||
|
||||
+36
-36
@@ -1021,7 +1021,7 @@ void hud_init_ballistic_index()
|
||||
ballistic_hud_index = 0;
|
||||
for (i = 0; i < Player_ship->weapons.num_primary_banks; i++)
|
||||
{
|
||||
if (Weapon_info[Player_ship->weapons.primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[Player_ship->weapons.primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ballistic_hud_index = 1;
|
||||
break;
|
||||
@@ -1179,8 +1179,8 @@ void hud_target_common(int team_mask, int next_flag)
|
||||
continue;
|
||||
|
||||
if (A->type == OBJ_WEAPON) {
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags2 & WIF2_CAN_BE_TARGETED) )
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags & WIF_BOMB) )
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Can_be_targeted]) )
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) )
|
||||
continue;
|
||||
|
||||
if (Weapons[A->instance].lssm_stage == 3)
|
||||
@@ -1470,8 +1470,8 @@ void hud_target_missile(object *source_obj, int next_flag)
|
||||
wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
// only allow targeting of bombs
|
||||
if ( !(wip->wi_flags2 & WIF2_CAN_BE_TARGETED) ) {
|
||||
if ( !(wip->wi_flags & WIF_BOMB) ) {
|
||||
if ( !(wip->wi_flags[Weapon::Info_Flags::Can_be_targeted]) ) {
|
||||
if ( !(wip->wi_flags[Weapon::Info_Flags::Bomb]) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1726,7 +1726,7 @@ int turret_compare_func(const void *e1, const void *e2)
|
||||
}
|
||||
}
|
||||
|
||||
extern bool turret_weapon_has_flags(ship_weapon *swp, int flags);
|
||||
extern bool turret_weapon_has_flags(ship_weapon *swp, Weapon::Info_Flags flags);
|
||||
extern bool turret_weapon_has_subtype(ship_weapon *swp, int subtype);
|
||||
// target the next/prev live turret on the current target
|
||||
// auto_advance from hud_update_closest_turret
|
||||
@@ -1809,9 +1809,9 @@ void hud_target_live_turret(int next_flag, int auto_advance, int only_player_tar
|
||||
}
|
||||
|
||||
// set weapon_type to allow sort of ent on type
|
||||
if (turret_weapon_has_flags(&A->weapons, WIF_BEAM)) {
|
||||
if (turret_weapon_has_flags(&A->weapons, Weapon::Info_Flags::Beam)) {
|
||||
ent[num_live_turrets].type = TYPE_FACING_BEAM;
|
||||
} else if (turret_weapon_has_flags(&A->weapons, WIF_FLAK)) {
|
||||
} else if (turret_weapon_has_flags(&A->weapons, Weapon::Info_Flags::Flak)) {
|
||||
ent[num_live_turrets].type = TYPE_FACING_FLAK;
|
||||
} else {
|
||||
if (turret_weapon_has_subtype(&A->weapons, WP_MISSILE)) {
|
||||
@@ -1941,7 +1941,7 @@ void hud_target_closest_locked_missile(object *locked_obj)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !(wip->wi_flags & WIF_HOMING ) ){
|
||||
if ( !(wip->is_homing() ) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2146,9 +2146,9 @@ bool evaluate_ship_as_closest_target(esct *esct_p)
|
||||
/*
|
||||
// GET TURRET TYPE, FAVOR BEAM, FLAK, OTHER
|
||||
int turret_type = ss->system_info->turret_weapon_type;
|
||||
if (Weapon_info[turret_type].wi_flags & WIF_BEAM) {
|
||||
if (Weapon_info[turret_type].wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
new_distance *= 0.3f;
|
||||
} else if (Weapon_info[turret_type].wi_flags & WIF_FLAK) {
|
||||
} else if (Weapon_info[turret_type].wi_flags[Weapon::Info_Flags::Flak]) {
|
||||
new_distance *= 0.6f;
|
||||
} */
|
||||
|
||||
@@ -2357,9 +2357,9 @@ void hud_update_closest_turret()
|
||||
|
||||
// GET TURRET TYPE, FAVOR BEAM, FLAK, OTHER
|
||||
int turret_type = ss->system_info->turret_weapon_type;
|
||||
if (Weapon_info[turret_type].wi_flags & WIF_BEAM) {
|
||||
if (Weapon_info[turret_type].wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
new_distance *= 0.3f;
|
||||
} else if (Weapon_info[turret_type].wi_flags & WIF_FLAK) {
|
||||
} else if (Weapon_info[turret_type].wi_flags[Weapon::Info_Flags::Flak]) {
|
||||
new_distance *= 0.6f;
|
||||
}
|
||||
|
||||
@@ -2512,8 +2512,8 @@ void hud_target_in_reticle_new()
|
||||
}
|
||||
|
||||
if ( A->type == OBJ_WEAPON ) {
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags2 & WIF2_CAN_BE_TARGETED) ) {
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags & WIF_BOMB) ){
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Can_be_targeted]) ) {
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2620,8 +2620,8 @@ void hud_target_in_reticle_old()
|
||||
}
|
||||
|
||||
if ( A->type == OBJ_WEAPON ) {
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags2 & WIF2_CAN_BE_TARGETED) ){
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags & WIF_BOMB) ){
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Can_be_targeted]) ){
|
||||
if ( !(Weapon_info[Weapons[A->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -3125,7 +3125,7 @@ void hud_process_homing_missiles()
|
||||
|
||||
if (dist < nearest_dist) {
|
||||
nearest_dist = dist;
|
||||
if ( Weapon_info[wp->weapon_info_index].wi_flags & WIF_LOCKED_HOMING ) {
|
||||
if ( Weapon_info[wp->weapon_info_index].is_locked_homing() ) {
|
||||
closest_is_aspect=1;
|
||||
} else {
|
||||
closest_is_aspect=0;
|
||||
@@ -3185,7 +3185,7 @@ void HudGaugeMissileTriangles::render(float frametime)
|
||||
wp = &Weapons[A->instance];
|
||||
|
||||
if (wp->homing_object == Player_obj) {
|
||||
renderTriangle(&A->pos, Weapon_info[wp->weapon_info_index].wi_flags & WIF_LOCKED_HOMING, 1, 1);
|
||||
renderTriangle(&A->pos, Weapon_info[wp->weapon_info_index].is_locked_homing(), 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3244,7 +3244,7 @@ void hud_process_remote_detonate_missile()
|
||||
mobjp = &Objects[mo->objnum];
|
||||
|
||||
if ((Player_obj != NULL) && (mobjp->parent_sig == Player_obj->parent_sig)) {
|
||||
if (Weapon_info[Weapons[mobjp->instance].weapon_info_index].wi_flags & WIF_REMOTE) {
|
||||
if (Weapon_info[Weapons[mobjp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Remote]) {
|
||||
// get box center point
|
||||
g3_rotate_vertex(&target_point,&mobjp->pos);
|
||||
|
||||
@@ -3759,7 +3759,7 @@ int hud_get_best_primary_bank(float *range)
|
||||
weapon_range = MIN((wip->max_speed * wip->lifetime), wip->weapon_range);
|
||||
|
||||
// don't consider this primary if it's a ballistic that's out of ammo - Goober5000
|
||||
if ( wip->wi_flags2 & WIF2_BALLISTIC )
|
||||
if ( wip->wi_flags[Weapon::Info_Flags::Ballistic] )
|
||||
{
|
||||
if ( swp->primary_bank_ammo[bank_to_fire] <= 0)
|
||||
{
|
||||
@@ -3959,8 +3959,8 @@ void HudGaugeLeadIndicator::renderLeadCurrentTarget()
|
||||
|
||||
// only allow bombs to have lead indicator displayed
|
||||
if ( targetp->type == OBJ_WEAPON ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags2 & WIF2_CAN_BE_TARGETED) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags & WIF_BOMB) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Can_be_targeted]) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4027,7 +4027,7 @@ void HudGaugeLeadIndicator::renderLeadCurrentTarget()
|
||||
{
|
||||
int bank = swp->current_secondary_bank;
|
||||
tmp = &Weapon_info[swp->secondary_bank_weapons[bank]];
|
||||
if ( !(tmp->wi_flags & WIF_HOMING) && !(tmp->wi_flags & WIF_LOCKED_HOMING && Player->target_in_lock_cone) ) {
|
||||
if ( !(tmp->is_homing()) && !(tmp->is_locked_homing() && Player->target_in_lock_cone) ) {
|
||||
//The secondary lead indicator is handled farther below if it is a non-locking type
|
||||
srange = -1.0f;
|
||||
}
|
||||
@@ -4048,7 +4048,7 @@ void HudGaugeLeadIndicator::renderLeadCurrentTarget()
|
||||
wip=&Weapon_info[swp->secondary_bank_weapons[bank]];
|
||||
|
||||
//get out of here if the secondary weapon is a homer or if its out of range
|
||||
if ( wip->wi_flags & WIF_HOMING )
|
||||
if ( wip->is_homing() )
|
||||
return;
|
||||
|
||||
double max_dist = MIN((wip->lifetime * wip->max_speed), wip->weapon_range);
|
||||
@@ -4085,8 +4085,8 @@ void HudGaugeLeadIndicator::renderLeadQuick(vec3d *target_world_pos, object *tar
|
||||
|
||||
// only allow bombs to have lead indicator displayed
|
||||
if ( targetp->type == OBJ_WEAPON ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags2 & WIF2_CAN_BE_TARGETED) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags & WIF_BOMB) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Can_be_targeted]) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4246,7 +4246,7 @@ void HudGaugeLeadSight::render(float frametime)
|
||||
|
||||
// only allow bombs to have lead indicator displayed
|
||||
if ( targetp->type == OBJ_WEAPON ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags & WIF_BOMB) ) {
|
||||
if ( !(Weapon_info[Weapons[targetp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4321,7 +4321,7 @@ void HudGaugeLeadSight::render(float frametime)
|
||||
wip=&Weapon_info[swp->secondary_bank_weapons[bank]];
|
||||
|
||||
//get out of here if the secondary weapon is a homer or if its out of range
|
||||
if ( wip->wi_flags & WIF_HOMING ) {
|
||||
if ( wip->is_homing() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5545,7 +5545,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
{
|
||||
for(x = 0; x < Player_ship->weapons.num_primary_banks; x++)
|
||||
{
|
||||
if(Weapon_info[Player_ship->weapons.primary_bank_weapons[x]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if(Weapon_info[Player_ship->weapons.primary_bank_weapons[x]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
use_new_gauge = true;
|
||||
break;
|
||||
@@ -5595,7 +5595,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
for(x = 0; x < Player_ship->weapons.num_primary_banks; x++)
|
||||
{
|
||||
//Skip all pure-energy weapons
|
||||
if(!(Weapon_info[Player_ship->weapons.primary_bank_weapons[x]].wi_flags2 & WIF2_BALLISTIC))
|
||||
if(!(Weapon_info[Player_ship->weapons.primary_bank_weapons[x]].wi_flags[Weapon::Info_Flags::Ballistic]))
|
||||
continue;
|
||||
|
||||
//Draw the weapon bright or normal depending if it's active or not.
|
||||
@@ -5658,7 +5658,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
for ( i = 0; i < sw->num_primary_banks; i++ ) {
|
||||
|
||||
// skip all pure-energy weapons
|
||||
if( ! ( Weapon_info[sw->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC ) ) {
|
||||
if( ! ( Weapon_info[sw->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -6041,7 +6041,7 @@ void HudGaugeWeapons::render(float frametime)
|
||||
}
|
||||
|
||||
// indicate if this is linked or currently armed
|
||||
if ( ((sw->current_primary_bank == i) && !(Player_ship->flags[Ship::Ship_Flags::Primary_linked])) || ((Player_ship->flags[Ship::Ship_Flags::Primary_linked]) && !(Weapon_info[sw->primary_bank_weapons[i]].wi_flags3 & WIF3_NOLINK))) {
|
||||
if ( ((sw->current_primary_bank == i) && !(Player_ship->flags[Ship::Ship_Flags::Primary_linked])) || ((Player_ship->flags[Ship::Ship_Flags::Primary_linked]) && !(Weapon_info[sw->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Nolink]))) {
|
||||
renderPrintf(position[0] + Weapon_plink_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
|
||||
}
|
||||
|
||||
@@ -6053,7 +6053,7 @@ void HudGaugeWeapons::render(float frametime)
|
||||
}
|
||||
|
||||
// if this is a ballistic primary with ammo, render the ammo count
|
||||
if (Weapon_info[sw->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC) {
|
||||
if (Weapon_info[sw->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic]) {
|
||||
// print out the ammo right justified
|
||||
sprintf(ammo_str, "%d", sw->primary_bank_ammo[i]);
|
||||
|
||||
@@ -6921,7 +6921,7 @@ void HudGaugePrimaryWeapons::render(float frametime)
|
||||
}
|
||||
|
||||
// if this is a ballistic primary with ammo, render the ammo count
|
||||
if (Weapon_info[sw->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC) {
|
||||
if (Weapon_info[sw->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic]) {
|
||||
// print out the ammo right justified
|
||||
sprintf(ammo_str, "%d", sw->primary_bank_ammo[i]);
|
||||
|
||||
@@ -7201,7 +7201,7 @@ void HudGaugeHardpoints::render(float frametime)
|
||||
|
||||
bank = &(model_get(sip->model_num))->missile_banks[i];
|
||||
|
||||
if (Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
|
||||
if (Weapon_info[swp->secondary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::External_weapon_lnch]) {
|
||||
for(k = 0; k < bank->num_slots; k++) {
|
||||
model_render_params weapon_render_info;
|
||||
|
||||
|
||||
@@ -814,7 +814,7 @@ void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
|
||||
return;
|
||||
|
||||
is_homing = FALSE;
|
||||
if ( target_wip->wi_flags & WIF_HOMING && wp->homing_object != &obj_used_list )
|
||||
if ( target_wip->is_homing() && wp->homing_object != &obj_used_list )
|
||||
is_homing = TRUE;
|
||||
|
||||
is_player_missile = FALSE;
|
||||
@@ -1541,8 +1541,7 @@ void HudGaugeExtraTargetData::endFlashDock()
|
||||
}
|
||||
|
||||
//from aicode.cpp. Less include...problems...this way.
|
||||
extern int turret_weapon_aggregate_flags(ship_weapon *swp);
|
||||
extern int turret_weapon_aggregate_flags2(ship_weapon *swp);
|
||||
extern flagset<Weapon::Info_Flags> turret_weapon_aggregate_flags(ship_weapon *swp);
|
||||
extern bool turret_weapon_has_subtype(ship_weapon *swp, int subtype);
|
||||
void get_turret_subsys_name(ship_weapon *swp, char *outstr)
|
||||
{
|
||||
@@ -1550,25 +1549,24 @@ void get_turret_subsys_name(ship_weapon *swp, char *outstr)
|
||||
|
||||
//WMC - find the first weapon, if there is one
|
||||
if (swp->num_primary_banks || swp->num_secondary_banks) {
|
||||
int flags = turret_weapon_aggregate_flags(swp);
|
||||
int flags2 = turret_weapon_aggregate_flags2(swp);
|
||||
auto flags = turret_weapon_aggregate_flags(swp);
|
||||
|
||||
// check if beam or flak using weapon flags
|
||||
if (flags & WIF_BEAM) {
|
||||
if (flags[Weapon::Info_Flags::Beam]) {
|
||||
sprintf(outstr, "%s", XSTR("Beam turret", 1567));
|
||||
} else if (flags & WIF_FLAK) {
|
||||
} else if (flags[Weapon::Info_Flags::Flak]) {
|
||||
sprintf(outstr, "%s", XSTR("Flak turret", 1566));
|
||||
} else {
|
||||
if (turret_weapon_has_subtype(swp, WP_MISSILE)) {
|
||||
sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
|
||||
} else if (turret_weapon_has_subtype(swp, WP_LASER)) {
|
||||
// ballistic too! - Goober5000
|
||||
if (flags2 & WIF2_BALLISTIC)
|
||||
if (flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
sprintf(outstr, "%s", XSTR("Turret", 1487));
|
||||
}
|
||||
// the TVWP has some primaries flagged as bombs
|
||||
else if (flags & WIF_BOMB)
|
||||
else if (flags[Weapon::Info_Flags::Bomb])
|
||||
{
|
||||
sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
|
||||
}
|
||||
@@ -1578,7 +1576,7 @@ void get_turret_subsys_name(ship_weapon *swp, char *outstr)
|
||||
}
|
||||
} else {
|
||||
// Mantis #2226: find out if there are any weapons here at all
|
||||
if (flags == 0 && flags2 == 0) {
|
||||
if (flags.none_set()) {
|
||||
sprintf(outstr, "%s", NOX("Unused"));
|
||||
} else {
|
||||
// Illegal subtype
|
||||
|
||||
@@ -593,7 +593,7 @@ void debug_max_primary_weapons(object *objp) // Goober5000
|
||||
for ( index = 0; index < MAX_SHIP_PRIMARY_BANKS; index++ )
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[index]];
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
float capacity, size;
|
||||
capacity = (float) sip->primary_bank_ammo_capacity[index];
|
||||
|
||||
+4
-4
@@ -943,7 +943,7 @@ void labviewer_render_model(float frametime)
|
||||
continue;
|
||||
if (Lab_weaponmodel_num[l] >= 0) {
|
||||
bank = &(model_get(Lab_model_num))->missile_banks[j];
|
||||
if (Weapon_info[sip->secondary_bank_weapons[j]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
|
||||
if (Weapon_info[sip->secondary_bank_weapons[j]].wi_flags[Weapon::Info_Flags::External_weapon_lnch]) {
|
||||
for(k = 0; k < bank->num_slots; k++) {
|
||||
render_info.set_flags(render_flags);
|
||||
model_render_immediate(&render_info, Lab_weaponmodel_num[l], &vmd_identity_matrix, &bank->pnt[k]);
|
||||
@@ -1013,7 +1013,7 @@ void labviewer_render_model(float frametime)
|
||||
continue;
|
||||
if (Lab_weaponmodel_num[l] >= 0) {
|
||||
bank = &(model_get(Lab_model_num))->missile_banks[j];
|
||||
if (Weapon_info[sip->secondary_bank_weapons[j]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
|
||||
if (Weapon_info[sip->secondary_bank_weapons[j]].wi_flags[Weapon::Info_Flags::External_weapon_lnch]) {
|
||||
for(k = 0; k < bank->num_slots; k++) {
|
||||
render_info.set_flags(render_flags);
|
||||
model_render_immediate(&render_info, Lab_weaponmodel_num[l], &vmd_identity_matrix, &bank->pnt[k]);
|
||||
@@ -2270,7 +2270,7 @@ void labviewer_change_weapon(Tree *caller)
|
||||
int weap_index = (int)(caller->GetSelectedItem()->GetData());
|
||||
Assert( weap_index >= 0 );
|
||||
|
||||
if ( !(Weapon_info[weap_index].wi_flags & WIF_BEAM) ) {
|
||||
if ( !(Weapon_info[weap_index].wi_flags[Weapon::Info_Flags::Beam]) ) {
|
||||
switch (Weapon_info[weap_index].render_type) {
|
||||
case WRT_POF:
|
||||
labviewer_change_bitmap();
|
||||
@@ -2352,7 +2352,7 @@ void labviewer_make_weap_window(Button* caller)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Weapon_info[i].wi_flags & WIF_BEAM) {
|
||||
if (Weapon_info[i].wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
stip = type_nodes[WP_BEAM];
|
||||
} else {
|
||||
stip = type_nodes[Weapon_info[i].subtype];
|
||||
|
||||
+10
-12
@@ -736,8 +736,9 @@ void techroom_anim_render(float frametime)
|
||||
|
||||
void techroom_change_tab(int num)
|
||||
{
|
||||
int multi = 0, wi_mask, wi_mask2, font_height, max_num_entries_viewable;
|
||||
Ship::Info_Flags si_mask, si_mask2;
|
||||
int multi = 0, font_height, max_num_entries_viewable;
|
||||
flagset<Weapon::Info_Flags> wi_mask;
|
||||
flagset<Ship::Info_Flags> si_mask;
|
||||
|
||||
//unload the current animation, we load another one for the new current entry
|
||||
if(Tab != SHIPS_DATA_TAB)
|
||||
@@ -760,8 +761,8 @@ void techroom_change_tab(int num)
|
||||
|
||||
switch (Tab) {
|
||||
case SHIPS_DATA_TAB:
|
||||
si_mask = multi ? Ship::Info_Flags::In_tech_database_m : Ship::Info_Flags::In_tech_database;
|
||||
si_mask2 = multi ? Ship::Info_Flags::Default_in_tech_database_m : Ship::Info_Flags::Default_in_tech_database;
|
||||
si_mask.set(multi ? Ship::Info_Flags::In_tech_database_m : Ship::Info_Flags::In_tech_database);
|
||||
si_mask.set(multi ? Ship::Info_Flags::Default_in_tech_database_m : Ship::Info_Flags::Default_in_tech_database);
|
||||
|
||||
// load ship info if necessary
|
||||
if ( Ships_loaded == 0 ) {
|
||||
@@ -776,7 +777,7 @@ void techroom_change_tab(int num)
|
||||
|
||||
for (auto it = Ship_info.begin(); it != Ship_info.end(); ++it)
|
||||
{
|
||||
if (Techroom_show_all || (it->flags[si_mask]) || (it->flags[si_mask2]))
|
||||
if (Techroom_show_all || (it->flags & si_mask).any_set())
|
||||
{
|
||||
// this ship should be displayed, fill out the entry struct
|
||||
Ship_list[Ship_list_size].bitmap = -1;
|
||||
@@ -829,12 +830,12 @@ void techroom_change_tab(int num)
|
||||
}
|
||||
|
||||
Weapon_list_size = 0;
|
||||
wi_mask = multi ? WIF_PLAYER_ALLOWED : WIF_IN_TECH_DATABASE;
|
||||
wi_mask2 = WIF2_DEFAULT_IN_TECH_DATABASE;
|
||||
wi_mask.set(multi ? Weapon::Info_Flags::Player_allowed : Weapon::Info_Flags::In_tech_database);
|
||||
wi_mask.set(Weapon::Info_Flags::Default_in_tech_database);
|
||||
|
||||
for (int i=0; i<Num_weapon_types; i++)
|
||||
{
|
||||
if (Techroom_show_all || (Weapon_info[i].wi_flags & wi_mask) || (Weapon_info[i].wi_flags2 & wi_mask2))
|
||||
if (Techroom_show_all || (Weapon_info[i].wi_flags & wi_mask).any_set())
|
||||
{
|
||||
// we have a weapon that should be in the tech db, so fill out the entry struct
|
||||
Weapon_list[Weapon_list_size].index = i;
|
||||
@@ -1447,10 +1448,7 @@ void tech_reset_to_default()
|
||||
// weapons
|
||||
for (int i=0; i<Num_weapon_types; i++)
|
||||
{
|
||||
if (Weapon_info[i].wi_flags2 & WIF2_DEFAULT_IN_TECH_DATABASE)
|
||||
Weapon_info[i].wi_flags |= WIF_IN_TECH_DATABASE;
|
||||
else
|
||||
Weapon_info[i].wi_flags &= ~WIF_IN_TECH_DATABASE;
|
||||
Weapon_info[i].wi_flags.set(Weapon::Info_Flags::In_tech_database, Weapon_info[i].wi_flags[Weapon::Info_Flags::Default_in_tech_database]);
|
||||
}
|
||||
|
||||
// intelligence
|
||||
|
||||
@@ -921,7 +921,7 @@ void parse_player_info2(mission *pm)
|
||||
if ( (list2[i] >= 0) && (list2[i] < MAX_WEAPON_TYPES) ) {
|
||||
// always allow the pool to be added in FRED, it is a verbal warning
|
||||
// to let the mission dev know about the problem
|
||||
if ( (Weapon_info[list2[i]].wi_flags & WIF_PLAYER_ALLOWED) || Fred_running ) {
|
||||
if ( (Weapon_info[list2[i]].wi_flags[Weapon::Info_Flags::Player_allowed]) || Fred_running ) {
|
||||
ptr->weaponry_pool[num_choices] = list2[i];
|
||||
ptr->weaponry_count[num_choices] = list2[i+2];
|
||||
|
||||
@@ -2159,7 +2159,7 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
{
|
||||
wp->primary_bank_ammo[j] = sssp->primary_ammo[j];
|
||||
}
|
||||
else if (wp->primary_bank_weapons[j] >= 0 && Weapon_info[wp->primary_bank_weapons[j]].wi_flags2 & WIF2_BALLISTIC)
|
||||
else if (wp->primary_bank_weapons[j] >= 0 && Weapon_info[wp->primary_bank_weapons[j]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
Assertion(Weapon_info[wp->primary_bank_weapons[j]].cargo_size > 0.0f,
|
||||
"Primary weapon cargo size <= 0. Ship (%s) Subsystem (%s) Bank (%i) Weapon (%s)",
|
||||
@@ -2253,7 +2253,7 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
{
|
||||
if (Fred_running) {
|
||||
ptr->weapons.primary_bank_ammo[j] = sssp->primary_ammo[j];
|
||||
} else if (ptr->weapons.primary_bank_weapons[j] >= 0 && Weapon_info[ptr->weapons.primary_bank_weapons[j]].wi_flags2 & WIF2_BALLISTIC) {
|
||||
} else if (ptr->weapons.primary_bank_weapons[j] >= 0 && Weapon_info[ptr->weapons.primary_bank_weapons[j]].wi_flags[Weapon::Info_Flags::Ballistic]) {
|
||||
Assertion(Weapon_info[ptr->weapons.primary_bank_weapons[j]].cargo_size > 0.0f,
|
||||
"Primary weapon cargo size <= 0. Ship (%s) Subsystem (%s) Bank (%i) Weapon (%s)",
|
||||
shipp->ship_name, sssp->name, j, Weapon_info[ptr->weapons.primary_bank_weapons[j]].name);
|
||||
|
||||
@@ -1121,7 +1121,7 @@ void wl_set_disabled_weapons(int ship_class)
|
||||
Wl_icons[i].can_use = eval_weapon_flag_for_game_type(sip->allowed_weapons[i]);
|
||||
|
||||
// Goober5000: ballistic primaries
|
||||
if (Weapon_info[i].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[i].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
// not allowed if this ship is not ballistic
|
||||
if (!(sip->flags[Ship::Info_Flags::Ballistic_primaries]))
|
||||
@@ -1502,7 +1502,7 @@ int wl_calc_ballistic_fit(int wi_index, int capacity)
|
||||
|
||||
Assert(Weapon_info[wi_index].subtype == WP_LASER);
|
||||
|
||||
Assert(Weapon_info[wi_index].wi_flags2 & WIF2_BALLISTIC);
|
||||
Assert(Weapon_info[wi_index].wi_flags[Weapon::Info_Flags::Ballistic]);
|
||||
|
||||
return fl2i( capacity / Weapon_info[wi_index].cargo_size + 0.5f );
|
||||
}
|
||||
@@ -3280,7 +3280,7 @@ void wl_update_parse_object_weapons(p_object *pobjp, wss_unit *slot)
|
||||
ss->primary_banks[j] = slot->wep[i];
|
||||
|
||||
// ballistic primaries - Goober5000
|
||||
if (Weapon_info[slot->wep[i]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[slot->wep[i]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
// Important: the primary_ammo[] value is a percentage of max capacity!
|
||||
// which means that it's always 100%, since ballistic primaries are completely
|
||||
@@ -3403,7 +3403,7 @@ void wl_bash_ship_weapons(ship_weapon *swp, wss_unit *slot)
|
||||
swp->primary_bank_weapons[j] = slot->wep[i];
|
||||
|
||||
// ballistic primaries - Goober5000
|
||||
if (Weapon_info[swp->primary_bank_weapons[j]].wi_flags2 & WIF2_BALLISTIC) {
|
||||
if (Weapon_info[swp->primary_bank_weapons[j]].wi_flags[Weapon::Info_Flags::Ballistic]) {
|
||||
// this is a bit tricky: we must recalculate ammo for full capacity
|
||||
// since wep_count for primaries does not store the ammo; ballistic
|
||||
// primaries always come with a full magazine
|
||||
@@ -4044,7 +4044,7 @@ void wl_apply_current_loadout_to_all_ships_in_current_wing()
|
||||
|
||||
// make sure this ship can accept this weapon
|
||||
if (!eval_weapon_flag_for_game_type(sip->allowed_weapons[weapon_type_to_add])
|
||||
|| ((wip->wi_flags2 & WIF2_BALLISTIC) && !(sip->flags[Ship::Info_Flags::Ballistic_primaries])))
|
||||
|| ((wip->wi_flags[Weapon::Info_Flags::Ballistic]) && !(sip->flags[Ship::Info_Flags::Ballistic_primaries])))
|
||||
{
|
||||
SCP_string temp;
|
||||
sprintf(temp, XSTR("%s is unable to carry %s weaponry", 1629), ship_name, wep_display_name);
|
||||
|
||||
@@ -470,7 +470,7 @@ void red_alert_store_weapons(red_alert_ship_status *ras, ship_weapon *swp)
|
||||
|
||||
wip = &Weapon_info[weapons.index];
|
||||
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic]) {
|
||||
// to avoid triggering the below condition: this way, minimum ammo will be 2...
|
||||
// since the red-alert representation of a conventional primary is 0 -> not used,
|
||||
// 1 -> used, I added the representation 2 and above -> ballistic primary
|
||||
@@ -514,7 +514,7 @@ void red_alert_bash_weapons(red_alert_ship_status *ras, ship_weapon *swp)
|
||||
swp->primary_bank_weapons[i] = ras->primary_weapons[i].index;
|
||||
swp->primary_bank_ammo[i] = ras->primary_weapons[i].count;
|
||||
|
||||
if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC) {
|
||||
if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic]) {
|
||||
// adjust to correct ammo count, per red_alert_store_weapons()
|
||||
swp->primary_bank_ammo[i] -= 2;
|
||||
}
|
||||
@@ -568,7 +568,7 @@ void red_alert_bash_weapons(red_alert_ship_status *ras, p_object *pobjp)
|
||||
Assert( ras->primary_weapons[i].index >= 0 );
|
||||
sssp->primary_banks[i] = ras->primary_weapons[i].index;
|
||||
|
||||
if (Weapon_info[sssp->primary_banks[i]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[sssp->primary_banks[i]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
float max_count = sip->primary_bank_ammo_capacity[i] / Weapon_info[sssp->primary_banks[i]].cargo_size;
|
||||
sssp->primary_ammo[i] = fl2i(100.0f * (ras->primary_weapons[i].count - 2) / max_count + 0.5f);
|
||||
|
||||
@@ -2997,7 +2997,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting
|
||||
}
|
||||
|
||||
if ( Objects[aip->target_objnum].type == OBJ_WEAPON ) {
|
||||
Assert(Weapon_info[Weapons[Objects[aip->target_objnum].instance].weapon_info_index].wi_flags & WIF_BOMB);
|
||||
Assert(Weapon_info[Weapons[Objects[aip->target_objnum].instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7303,7 +7303,7 @@ void send_homing_weapon_info( int weapon_num )
|
||||
wp = &Weapons[weapon_num];
|
||||
|
||||
// be sure that this weapon object is a homing object.
|
||||
if ( !(Weapon_info[wp->weapon_info_index].wi_flags & WIF_HOMING) )
|
||||
if ( !(Weapon_info[wp->weapon_info_index].is_homing()) )
|
||||
return;
|
||||
|
||||
// default the subsystem
|
||||
@@ -7369,11 +7369,11 @@ void process_homing_weapon_info( ubyte *data, header *hinfo )
|
||||
}
|
||||
|
||||
if ( homing_object->type == OBJ_WEAPON ) {
|
||||
int flags = Weapon_info[Weapons[homing_object->instance].weapon_info_index].wi_flags;
|
||||
auto flags = Weapon_info[Weapons[homing_object->instance].weapon_info_index].wi_flags;
|
||||
|
||||
// Assert( (flags & WIF_BOMB) || (flags & WIF_CMEASURE) );
|
||||
|
||||
if ( !((flags & WIF_BOMB) || (flags & WIF_CMEASURE)) ) {
|
||||
if ( !((flags[Weapon::Info_Flags::Bomb, Weapon::Info_Flags::Cmeasure])) ) {
|
||||
nprintf(("Network", "Homing object is invalid for homing update\n"));
|
||||
return;
|
||||
}
|
||||
@@ -8123,7 +8123,7 @@ void process_flak_fired_packet(ubyte *data, header *hinfo)
|
||||
wid = ssp->weapons.secondary_bank_weapons[0];
|
||||
}
|
||||
|
||||
if((wid < 0) || !(Weapon_info[wid].wi_flags & WIF_FLAK)){
|
||||
if((wid < 0) || !(Weapon_info[wid].wi_flags[Weapon::Info_Flags::Flak])){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
|
||||
// if this weapon pierces the shield, then do the hit effect, but act like a shield collision never occurred;
|
||||
// otherwise, we have a valid hit on this shield
|
||||
if (wip->wi_flags2 & WIF2_PIERCE_SHIELDS)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Pierce_shields])
|
||||
quadrant_num = -1;
|
||||
else
|
||||
valid_hit_occurred = 1;
|
||||
@@ -441,7 +441,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
|
||||
Script_system.RemHookVars(4, "Ship", "Weapon", "Self","Object");
|
||||
}
|
||||
else if ((Missiontime - wp->creation_time > F1_0/2) && (wip->wi_flags & WIF_HOMING) && (wp->homing_object == ship_objp)) {
|
||||
else if ((Missiontime - wp->creation_time > F1_0/2) && (wip->is_homing()) && (wp->homing_object == ship_objp)) {
|
||||
if (dist < wip->shockwave.inner_rad) {
|
||||
vec3d vec_to_ship;
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@ int collide_weapon_weapon( obj_pair * pair )
|
||||
B_radius = B->radius;
|
||||
|
||||
if (wipA->weapon_hitpoints > 0) {
|
||||
if (!(wipA->wi_flags2 & WIF2_HARD_TARGET_BOMB)) {
|
||||
if (!(wipA->wi_flags[Weapon::Info_Flags::Hard_target_bomb])) {
|
||||
A_radius *= 2; // Makes bombs easier to hit
|
||||
}
|
||||
|
||||
if ((The_mission.ai_profile->flags2 & AIPF2_ASPECT_INVULNERABILITY_FIX) && (wipA->wi_flags & WIF_LOCKED_HOMING) && (wpA->homing_object != &obj_used_list)) {
|
||||
if ((The_mission.ai_profile->flags2 & AIPF2_ASPECT_INVULNERABILITY_FIX) && (wipA->is_locked_homing()) && (wpA->homing_object != &obj_used_list)) {
|
||||
if ( (wipA->max_lifetime - wpA->lifeleft) < The_mission.ai_profile->delay_bomb_arm_timer[Game_skill_level] )
|
||||
return 0;
|
||||
}
|
||||
@@ -68,10 +68,10 @@ int collide_weapon_weapon( obj_pair * pair )
|
||||
}
|
||||
|
||||
if (wipB->weapon_hitpoints > 0) {
|
||||
if (!(wipB->wi_flags2 & WIF2_HARD_TARGET_BOMB)) {
|
||||
if (!(wipB->wi_flags[Weapon::Info_Flags::Hard_target_bomb])) {
|
||||
B_radius *= 2; // Makes bombs easier to hit
|
||||
}
|
||||
if ((The_mission.ai_profile->flags2 & AIPF2_ASPECT_INVULNERABILITY_FIX) && (wipB->wi_flags & WIF_LOCKED_HOMING) && (wpB->homing_object != &obj_used_list)) {
|
||||
if ((The_mission.ai_profile->flags2 & AIPF2_ASPECT_INVULNERABILITY_FIX) && (wipB->is_locked_homing()) && (wpB->homing_object != &obj_used_list)) {
|
||||
if ( (wipB->max_lifetime - wpB->lifeleft) < The_mission.ai_profile->delay_bomb_arm_timer[Game_skill_level] )
|
||||
return 0;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ int collide_weapon_weapon( obj_pair * pair )
|
||||
|
||||
if (wipA->weapon_hitpoints > 0) {
|
||||
if (wipB->weapon_hitpoints > 0) { // Two bombs collide, detonate both.
|
||||
if ((wipA->wi_flags & WIF_BOMB) && (wipB->wi_flags & WIF_BOMB)) {
|
||||
if ((wipA->wi_flags[Weapon::Info_Flags::Bomb]) && (wipB->wi_flags[Weapon::Info_Flags::Bomb])) {
|
||||
wpA->lifeleft = 0.01f;
|
||||
wpB->lifeleft = 0.01f;
|
||||
wpA->weapon_flags |= WF_DESTROYED_BY_WEAPON;
|
||||
@@ -151,14 +151,14 @@ int collide_weapon_weapon( obj_pair * pair )
|
||||
if (!MULTIPLAYER_CLIENT) {
|
||||
|
||||
// If bomb was destroyed, do scoring
|
||||
if (wipA->wi_flags & WIF_BOMB) {
|
||||
if (wipA->wi_flags[Weapon::Info_Flags::Bomb]) {
|
||||
//Update stats. -Halleck
|
||||
scoring_eval_hit(A, B, 0);
|
||||
if (wpA->weapon_flags & WF_DESTROYED_BY_WEAPON) {
|
||||
scoring_eval_kill_on_weapon(A, B);
|
||||
}
|
||||
}
|
||||
if (wipB->wi_flags & WIF_BOMB) {
|
||||
if (wipB->wi_flags[Weapon::Info_Flags::Bomb]) {
|
||||
//Update stats. -Halleck
|
||||
scoring_eval_hit(B, A, 0);
|
||||
if (wpB->weapon_flags & WF_DESTROYED_BY_WEAPON) {
|
||||
|
||||
@@ -296,11 +296,11 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end )
|
||||
|
||||
if (awip->subtype != WP_LASER || bwip->subtype != WP_LASER) {
|
||||
if (awip->subtype == WP_LASER) {
|
||||
if ( bwip->wi_flags & WIF_BOMB ) {
|
||||
if ( bwip->wi_flags[Weapon::Info_Flags::Bomb] ) {
|
||||
check_collision = collide_weapon_weapon;
|
||||
}
|
||||
} else if (bwip->subtype == WP_LASER) {
|
||||
if ( awip->wi_flags & WIF_BOMB ) {
|
||||
if ( awip->wi_flags[Weapon::Info_Flags::Bomb] ) {
|
||||
check_collision = collide_weapon_weapon;
|
||||
swapped=1;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end )
|
||||
// only check debris:weapon collisions for player
|
||||
if (check_collision == collide_debris_weapon) {
|
||||
// weapon is B
|
||||
if ( !(Weapon_info[Weapons[B->instance].weapon_info_index].wi_flags & WIF_TURNS) ) {
|
||||
if ( !(Weapon_info[Weapons[B->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Turns]) ) {
|
||||
// check for dumbfire weapon
|
||||
// check if debris is behind laser
|
||||
float vdot;
|
||||
@@ -738,7 +738,7 @@ int weapon_will_never_hit( object *obj_weapon, object *other, obj_pair * current
|
||||
|
||||
|
||||
// Do some checks for weapons that don't turn
|
||||
if ( !(wip->wi_flags & WIF_TURNS) ) {
|
||||
if ( !(wip->wi_flags[Weapon::Info_Flags::Turns]) ) {
|
||||
|
||||
// This first check is to see if a weapon is behind an object, and they
|
||||
// are heading in opposite directions. If so, we don't need to ever check
|
||||
@@ -810,7 +810,7 @@ int weapon_will_never_hit( object *obj_weapon, object *other, obj_pair * current
|
||||
// compare (weeapon) ray with expanding sphere (ship) to find earliest possible collision time
|
||||
// look for two time solutions to Xw = Xs, where Xw = Xw0 + Vwt*t Xs = Xs + Vs*(t+dt), where Vs*dt = radius of ship
|
||||
// Since direction of Vs is unknown, solve for (Vs*t) and find norm of both sides
|
||||
if ( !(wip->wi_flags & WIF_TURNS) ) {
|
||||
if ( !(wip->wi_flags[Weapon::Info_Flags::Turns]) ) {
|
||||
vec3d delta_x, laser_vel;
|
||||
float a,b,c, delta_x_dot_vl, delta_t;
|
||||
float root1, root2, root, earliest_time;
|
||||
@@ -1587,7 +1587,7 @@ void obj_collide_pair(object *A, object *B)
|
||||
// only check debris:weapon collisions for player
|
||||
if (check_collision == collide_debris_weapon) {
|
||||
// weapon is B
|
||||
if ( !(Weapon_info[Weapons[B->instance].weapon_info_index].wi_flags & WIF_TURNS) ) {
|
||||
if ( !(Weapon_info[Weapons[B->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Turns]) ) {
|
||||
// check for dumbfire weapon
|
||||
// check if debris is behind laser
|
||||
float vdot;
|
||||
|
||||
+3
-10
@@ -4659,18 +4659,11 @@ ADE_VIRTVAR(Bomb, l_Weaponclass, "boolean", "Is weapon class flagged as bomb", "
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(newVal)
|
||||
{
|
||||
info->wi_flags |= WIF_BOMB;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->wi_flags &= ~WIF_BOMB;
|
||||
}
|
||||
info->wi_flags.set(Weapon::Info_Flags::Bomb, newVal);
|
||||
}
|
||||
|
||||
|
||||
if (info->wi_flags & WIF_BOMB)
|
||||
if (info->wi_flags[Weapon::Info_Flags::Bomb])
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
@@ -4796,7 +4789,7 @@ ADE_FUNC(isBeam, l_Weaponclass, NULL, "Return true if the weapon is a beam", "bo
|
||||
if(idx < 0 || idx >= Num_weapon_types)
|
||||
return ADE_RETURN_FALSE;
|
||||
|
||||
if (Weapon_info[idx].wi_flags & WIF_BEAM || Weapon_info[idx].subtype == WP_BEAM)
|
||||
if (Weapon_info[idx].wi_flags[Weapon::Info_Flags::Beam] || Weapon_info[idx].subtype == WP_BEAM)
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
|
||||
@@ -2926,7 +2926,7 @@ int stuff_loadout_list (int *ilp, int max_ints, int lookup_type)
|
||||
Warning(LOCATION, "Ship type \"%s\" found in loadout of mission file. This class is not marked as a player ship...skipping", str);
|
||||
continue;
|
||||
}
|
||||
else if ((lookup_type == MISSION_LOADOUT_WEAPON_LIST) && (!(Weapon_info[index].wi_flags & WIF_PLAYER_ALLOWED)) ) {
|
||||
else if ((lookup_type == MISSION_LOADOUT_WEAPON_LIST) && (!(Weapon_info[index].wi_flags[Weapon::Info_Flags::Player_allowed])) ) {
|
||||
clean_loadout_list_entry();
|
||||
nprintf(("Warning", "Warning: Weapon type %s found in loadout of mission file. This class is not marked as a player allowed weapon...skipping\n", str));
|
||||
if ( !Is_standalone )
|
||||
|
||||
@@ -343,7 +343,7 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data)
|
||||
if (!(primary || secondary))
|
||||
return false;
|
||||
|
||||
if ((shipp->flags[Ship::Ship_Flags::Primary_linked]) && primary && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags3 & WIF3_NOLINK))
|
||||
if ((shipp->flags[Ship::Ship_Flags::Primary_linked]) && primary && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags[Weapon::Info_Flags::Nolink]))
|
||||
return false;
|
||||
|
||||
break;
|
||||
@@ -353,7 +353,7 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data)
|
||||
secondary = stricmp(Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.current_secondary_bank]].name, scp->data.name) == 0;
|
||||
prev_secondary = stricmp(Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.previous_secondary_bank]].name, scp->data.name) == 0;
|
||||
|
||||
if ((shipp->flags[Ship::Ship_Flags::Primary_linked]) && prev_primary && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.previous_primary_bank]].wi_flags3 & WIF3_NOLINK))
|
||||
if ((shipp->flags[Ship::Ship_Flags::Primary_linked]) && prev_primary && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.previous_primary_bank]].wi_flags[Weapon::Info_Flags::Nolink]))
|
||||
return true;
|
||||
|
||||
if ( !prev_secondary && ! secondary && !prev_primary && !primary )
|
||||
@@ -408,7 +408,7 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data)
|
||||
secondary = stricmp(Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.current_secondary_bank]].name, scp->data.name) == 0;
|
||||
}
|
||||
|
||||
if ((shipp->flags[Ship::Ship_Flags::Primary_linked]) && primary && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags3 & WIF3_NOLINK))
|
||||
if ((shipp->flags[Ship::Ship_Flags::Primary_linked]) && primary && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags[Weapon::Info_Flags::Nolink]))
|
||||
return false;
|
||||
|
||||
return more_data == 1 ? primary : secondary;
|
||||
|
||||
+14
-14
@@ -2918,7 +2918,7 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
|
||||
|
||||
// we need to be sure that for huge weapons, the WIF_HUGE flag is set
|
||||
if ( type == OPF_HUGE_WEAPON ) {
|
||||
if ( !(Weapon_info[i].wi_flags & WIF_HUGE) )
|
||||
if ( !(Weapon_info[i].wi_flags[Weapon::Info_Flags::Huge]) )
|
||||
return SEXP_CHECK_INVALID_WEAPON_NAME;
|
||||
}
|
||||
|
||||
@@ -12601,8 +12601,8 @@ void sexp_tech_add_weapon(int node)
|
||||
while (node >= 0) {
|
||||
name = CTEXT(node);
|
||||
i = weapon_info_lookup(name);
|
||||
if (i >= 0)
|
||||
Weapon_info[i].wi_flags |= WIF_IN_TECH_DATABASE;
|
||||
if (i >= 0)
|
||||
Weapon_info[i].wi_flags.set(Weapon::Info_Flags::In_tech_database);
|
||||
else
|
||||
Warning(LOCATION, "In tech-add-weapon, weapon class \"%s\" invalid", name);
|
||||
|
||||
@@ -15154,7 +15154,7 @@ int sexp_primaries_depleted(int node)
|
||||
for (int idx=0; idx<num_banks; idx++)
|
||||
{
|
||||
// is this a ballistic bank?
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[idx]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[idx]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
// is this bank out of ammo?
|
||||
if (shipp->weapons.primary_bank_ammo[idx] == 0)
|
||||
@@ -15673,7 +15673,7 @@ int sexp_primary_ammo_pct(int node)
|
||||
for(idx=0; idx<shipp->weapons.num_primary_banks; idx++)
|
||||
{
|
||||
// ballistic
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[idx]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[idx]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ret_sum[idx] = (int)(((float)shipp->weapons.primary_bank_ammo[idx] / (float)shipp->weapons.primary_bank_start_ammo[idx]) * 100.0f);
|
||||
}
|
||||
@@ -15695,7 +15695,7 @@ int sexp_primary_ammo_pct(int node)
|
||||
else
|
||||
{
|
||||
// ballistic
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[check]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[check]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ret = (int)(((float)shipp->weapons.primary_bank_ammo[check] / (float)shipp->weapons.primary_bank_start_ammo[check]) * 100.0f);
|
||||
}
|
||||
@@ -15792,7 +15792,7 @@ int sexp_get_primary_ammo(int node)
|
||||
for(int bank=0; bank<shipp->weapons.num_primary_banks; bank++)
|
||||
{
|
||||
// Only ballistic weapons need to be counted
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[bank]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[bank]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ammo_left += shipp->weapons.primary_bank_ammo[bank] ;
|
||||
}
|
||||
@@ -15801,7 +15801,7 @@ int sexp_get_primary_ammo(int node)
|
||||
else
|
||||
{
|
||||
// Again only ballistic weapons need to be counted
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[check]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[shipp->weapons.primary_bank_weapons[check]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ammo_left = shipp->weapons.primary_bank_ammo[check] ;
|
||||
}
|
||||
@@ -15897,7 +15897,7 @@ void set_primary_ammo (int ship_index, int requested_bank, int requested_ammo, i
|
||||
}
|
||||
|
||||
// Check that this isn't a non-ballistic bank as it's pointless to set the amount of ammo for those
|
||||
if (!(Weapon_info[shipp->weapons.primary_bank_weapons[requested_bank]].wi_flags2 & WIF2_BALLISTIC))
|
||||
if (!(Weapon_info[shipp->weapons.primary_bank_weapons[requested_bank]].wi_flags[Weapon::Info_Flags::Ballistic]))
|
||||
{
|
||||
return ;
|
||||
}
|
||||
@@ -16898,7 +16898,7 @@ void sexp_beam_fire(int node, bool at_coords)
|
||||
Assertion(fire_info.turret->weapons.primary_bank_weapons[idx] >= 0 && fire_info.turret->weapons.primary_bank_weapons[idx] < MAX_WEAPON_TYPES,
|
||||
"sexp_beam_fire: found invalid weapon index (%i), get a coder\n!", fire_info.turret->weapons.primary_bank_weapons[idx]);
|
||||
// store the weapon info index
|
||||
if (Weapon_info[fire_info.turret->weapons.primary_bank_weapons[idx]].wi_flags & WIF_BEAM) {
|
||||
if (Weapon_info[fire_info.turret->weapons.primary_bank_weapons[idx]].wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
fire_info.beam_info_index = fire_info.turret->weapons.primary_bank_weapons[idx];
|
||||
}
|
||||
}
|
||||
@@ -16928,7 +16928,7 @@ void sexp_beam_floating_fire(int n)
|
||||
Warning(LOCATION, "Invalid weapon class passed to beam-create; weapon type '%s' does not exist!\n", CTEXT(n));
|
||||
return;
|
||||
}
|
||||
if (!(Weapon_info[fire_info.beam_info_index].wi_flags & WIF_BEAM)) {
|
||||
if (!(Weapon_info[fire_info.beam_info_index].wi_flags[Weapon::Info_Flags::Beam])) {
|
||||
Warning(LOCATION, "Invalid weapon class passed to beam-create; weapon type '%s' is not a beam!\n", CTEXT(n));
|
||||
return;
|
||||
}
|
||||
@@ -17985,14 +17985,14 @@ int sexp_get_turret_primary_ammo(int node)
|
||||
for (bank = 0; bank < swp->num_primary_banks; bank++)
|
||||
{
|
||||
// Only ballistic weapons need to be counted
|
||||
if (Weapon_info[swp->primary_bank_weapons[bank]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[swp->primary_bank_weapons[bank]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ammo_left += swp->primary_bank_ammo[bank];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Again only ballistic weapons need to be counted
|
||||
if (Weapon_info[swp->primary_bank_weapons[check]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[swp->primary_bank_weapons[check]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
ammo_left = swp->primary_bank_ammo[check];
|
||||
}
|
||||
@@ -18078,7 +18078,7 @@ void set_turret_primary_ammo(ship_subsys *turret, int requested_bank, int reques
|
||||
}
|
||||
|
||||
// Check that this isn't a non-ballistic bank as it's pointless to set the amount of ammo for those
|
||||
if (!(Weapon_info[turret->weapons.primary_bank_weapons[requested_bank]].wi_flags2 & WIF2_BALLISTIC))
|
||||
if (!(Weapon_info[turret->weapons.primary_bank_weapons[requested_bank]].wi_flags[Weapon::Info_Flags::Ballistic]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ void pilotfile::csg_read_techroom()
|
||||
|
||||
if (visible) {
|
||||
if (weapon_list[idx].index >= 0) {
|
||||
Weapon_info[weapon_list[idx].index].wi_flags |= WIF_IN_TECH_DATABASE;
|
||||
Weapon_info[weapon_list[idx].index].wi_flags.set(Weapon::Info_Flags::In_tech_database);
|
||||
} else {
|
||||
m_data_invalid = true;
|
||||
}
|
||||
@@ -494,7 +494,7 @@ void pilotfile::csg_write_techroom()
|
||||
// visible weapons
|
||||
for (idx = 0; idx < Num_weapon_types; idx++) {
|
||||
// only visible if not in techroom by default
|
||||
if ( (Weapon_info[idx].wi_flags & WIF_IN_TECH_DATABASE) && !(Weapon_info[idx].wi_flags2 & WIF2_DEFAULT_IN_TECH_DATABASE) ) {
|
||||
if ( (Weapon_info[idx].wi_flags[Weapon::Info_Flags::In_tech_database]) && !(Weapon_info[idx].wi_flags[Weapon::Info_Flags::Default_in_tech_database]) ) {
|
||||
visible = 1;
|
||||
} else {
|
||||
visible = 0;
|
||||
|
||||
@@ -207,16 +207,16 @@ void radar_plot_object( object *objp )
|
||||
case OBJ_WEAPON:
|
||||
{
|
||||
// if not a bomb, return
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags2 & WIF2_SHOWN_ON_RADAR) )
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) )
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Shown_on_radar]) )
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) )
|
||||
return;
|
||||
|
||||
// if explicitly hidden, return
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags2 & WIF2_DONT_SHOW_ON_RADAR)
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Dont_show_on_radar])
|
||||
return;
|
||||
|
||||
// if we don't attack the bomb, return
|
||||
if ( (!(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags2 & WIF2_SHOW_FRIENDLY)) && (!iff_x_attacks_y(Player_ship->team, obj_team(objp))))
|
||||
if ( (!(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Show_friendly])) && (!iff_x_attacks_y(Player_ship->team, obj_team(objp))))
|
||||
return;
|
||||
|
||||
// if a local ssm is in subspace, return
|
||||
@@ -224,7 +224,7 @@ void radar_plot_object( object *objp )
|
||||
return;
|
||||
|
||||
// if corkscrew missile use last frame pos for pos
|
||||
if ( (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_CORKSCREW) )
|
||||
if ( (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Corkscrew]) )
|
||||
world_pos = objp->last_pos;
|
||||
|
||||
break;
|
||||
@@ -561,16 +561,16 @@ RadarVisibility radar_is_visible( object *objp )
|
||||
case OBJ_WEAPON:
|
||||
{
|
||||
// if not a bomb, return
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags2 & WIF2_SHOWN_ON_RADAR) )
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_BOMB) )
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Shown_on_radar]) )
|
||||
if ( !(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) )
|
||||
return NOT_VISIBLE;
|
||||
|
||||
// if explicitly hidden, return
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags2 & WIF2_DONT_SHOW_ON_RADAR)
|
||||
if (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Dont_show_on_radar])
|
||||
return NOT_VISIBLE;
|
||||
|
||||
// if we don't attack the bomb, return
|
||||
if ( (!(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags2 & WIF2_SHOW_FRIENDLY)) && (!iff_x_attacks_y(Player_ship->team, obj_team(objp))))
|
||||
if ( (!(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Show_friendly])) && (!iff_x_attacks_y(Player_ship->team, obj_team(objp))))
|
||||
return NOT_VISIBLE;
|
||||
|
||||
// if a local ssm is in subspace, return
|
||||
|
||||
+130
-138
@@ -405,87 +405,87 @@ flag_def_list_new<Ship::Info_Flags> ai_tgt_ship_flags[] = {
|
||||
|
||||
const int num_ai_tgt_ship_flags = sizeof(ai_tgt_ship_flags) / sizeof(flag_def_list_new<Ship::Info_Flags>);
|
||||
|
||||
flag_def_list ai_tgt_weapon_flags[] = {
|
||||
{ "bomb", WIF_BOMB, 0 },
|
||||
{ "huge damage", WIF_HUGE, 0 },
|
||||
{ "supercap damage", WIF_SUPERCAP, 0 },
|
||||
{ "bomber+", WIF_BOMBER_PLUS, 0 },
|
||||
{ "electronics", WIF_ELECTRONICS, 0 },
|
||||
{ "puncture", WIF_PUNCTURE, 0 },
|
||||
{ "emp", WIF_EMP, 0 },
|
||||
{ "heat seeking", WIF_HOMING_HEAT, 0 },
|
||||
{ "aspect seeking", WIF_HOMING_ASPECT, 0 },
|
||||
{ "engine seeking", WIF_HOMING_JAVELIN, 0 },
|
||||
{ "pierce shields", WIF2_PIERCE_SHIELDS, 1 },
|
||||
{ "local ssm", WIF2_LOCAL_SSM, 1 },
|
||||
{ "capital+", WIF2_CAPITAL_PLUS, 1 },
|
||||
{ "heat-seeking", WIF_HOMING_HEAT, 0 },
|
||||
{ "aspect-seeking", WIF_HOMING_ASPECT, 0 },
|
||||
{ "javelin", WIF_HOMING_JAVELIN, 0 },
|
||||
{ "spawn", WIF_SPAWN, 0 },
|
||||
{ "remote detonate", WIF_REMOTE, 0 },
|
||||
{ "countermeasure", WIF_CMEASURE, 0 },
|
||||
{ "turns", WIF_TURNS, 0 },
|
||||
{ "swarm", WIF_SWARM, 0 },
|
||||
{ "trail", WIF_TRAIL, 0 },
|
||||
{ "big ship", WIF_BIG_ONLY, 0 },
|
||||
{ "child", WIF_CHILD, 0 },
|
||||
{ "no dumbfire", WIF_NO_DUMBFIRE, 0 },
|
||||
{ "thruster", WIF_THRUSTER, 0 },
|
||||
{ "in tech database", WIF_IN_TECH_DATABASE, 0 },
|
||||
{ "player allowed", WIF_PLAYER_ALLOWED, 0 },
|
||||
{ "corkscrew", WIF_CORKSCREW, 0 },
|
||||
{ "particle spew", WIF_PARTICLE_SPEW, 0 },
|
||||
{ "esuck", WIF_ENERGY_SUCK, 0 },
|
||||
{ "flak", WIF_FLAK, 0 },
|
||||
//{ "beam", WIF_BEAM, 0 }, // Okay, this one probably doesn't make sense.
|
||||
{ "tag", WIF_TAG, 0 },
|
||||
{ "shudder", WIF_SHUDDER, 0 },
|
||||
{ "lockarm", WIF_LOCKARM, 0 },
|
||||
{ "stream", WIF_STREAM, 0 },
|
||||
{ "ballistic", WIF2_BALLISTIC, 0 },
|
||||
{ "default in tech database", WIF2_DEFAULT_IN_TECH_DATABASE, 1 },
|
||||
{ "tagged only", WIF2_TAGGED_ONLY, 1 },
|
||||
{ "cycle", WIF2_CYCLE, 1 },
|
||||
{ "small only", WIF2_SMALL_ONLY, 1 },
|
||||
{ "same turret cooldown", WIF2_SAME_TURRET_COOLDOWN, 1 },
|
||||
{ "apply no light", WIF2_MR_NO_LIGHTING, 1 },
|
||||
{ "transparent", WIF2_TRANSPARENT, 1 },
|
||||
{ "training", WIF2_TRAINING, 1 },
|
||||
{ "smart spawn", WIF2_SMART_SPAWN, 1 },
|
||||
{ "inherit parent target", WIF2_INHERIT_PARENT_TARGET, 1 },
|
||||
{ "no emp kill", WIF2_NO_EMP_KILL, 1 },
|
||||
{ "variable lead homing", WIF2_VARIABLE_LEAD_HOMING, 1 },
|
||||
{ "untargeted heat seeker", WIF2_UNTARGETED_HEAT_SEEKER, 1 },
|
||||
{ "no radius doubling", WIF2_HARD_TARGET_BOMB, 1 },
|
||||
{ "no subsystem homing", WIF2_NON_SUBSYS_HOMING, 1 },
|
||||
{ "no lifeleft penalty", WIF2_NO_LIFE_LOST_IF_MISSED, 1 },
|
||||
{ "custom seeker str", WIF2_CUSTOM_SEEKER_STR, 1 },
|
||||
{ "can be targeted", WIF2_CAN_BE_TARGETED, 1 },
|
||||
{ "show on radar", WIF2_SHOWN_ON_RADAR, 1 },
|
||||
{ "show friendly on radar", WIF2_SHOW_FRIENDLY, 1 },
|
||||
{ "chain external model fps", WIF2_EXTERNAL_WEAPON_FP, 1 },
|
||||
{ "external model launcher", WIF2_EXTERNAL_WEAPON_LNCH, 1 },
|
||||
{ "takes blast damage", WIF2_TAKES_BLAST_DAMAGE, 1 },
|
||||
{ "takes shockwave damage", WIF2_TAKES_SHOCKWAVE_DAMAGE, 1 },
|
||||
{ "hide from radar", WIF2_DONT_SHOW_ON_RADAR, 1 },
|
||||
{ "render flak", WIF2_RENDER_FLAK, 1 },
|
||||
{ "ciws", WIF2_CIWS, 1 },
|
||||
{ "anti-subsystem beam", WIF2_ANTISUBSYSBEAM, 1 },
|
||||
{ "no primary linking", WIF3_NOLINK, 2 },
|
||||
{ "same emp time for capships", WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS, 2 },
|
||||
{ "no primary linked penalty", WIF3_NO_LINKED_PENALTY, 2 },
|
||||
{ "no homing speed ramp", WIF3_NO_HOMING_SPEED_RAMP, 2 },
|
||||
{ "pulls aspect seekers", WIF3_CMEASURE_ASPECT_HOME_ON, 2 },
|
||||
{ "turret interceptable", WIF3_TURRET_INTERCEPTABLE, 2 },
|
||||
{ "fighter interceptable", WIF3_FIGHTER_INTERCEPTABLE, 2 },
|
||||
{ "aoe electronics", WIF3_AOE_ELECTRONICS, 2 },
|
||||
{ "apply recoil", WIF3_APPLY_RECOIL, 2 },
|
||||
{ "don't spawn if shot", WIF3_DONT_SPAWN_IF_SHOT, 2 },
|
||||
{ "die on lost lock", WIF3_DIE_ON_LOST_LOCK, 2 },
|
||||
flag_def_list_new<Weapon::Info_Flags> ai_tgt_weapon_flags[] = {
|
||||
{ "bomb", Weapon::Info_Flags::Bomb, true, false },
|
||||
{ "huge damage", Weapon::Info_Flags::Huge, true, false },
|
||||
{ "supercap damage", Weapon::Info_Flags::Supercap, true, false },
|
||||
{ "bomber+", Weapon::Info_Flags::Bomber_plus, true, false },
|
||||
{ "electronics", Weapon::Info_Flags::Electronics, true, false },
|
||||
{ "puncture", Weapon::Info_Flags::Puncture, true, false },
|
||||
{ "emp", Weapon::Info_Flags::Emp, true, false },
|
||||
{ "heat seeking", Weapon::Info_Flags::Homing_heat, true, false },
|
||||
{ "aspect seeking", Weapon::Info_Flags::Homing_aspect, true, false },
|
||||
{ "engine seeking", Weapon::Info_Flags::Homing_javelin, true, false },
|
||||
{ "pierce shields", Weapon::Info_Flags::Pierce_shields, true, false },
|
||||
{ "local ssm", Weapon::Info_Flags::Local_ssm, true, false },
|
||||
{ "capital+", Weapon::Info_Flags::Capital_plus, true, false },
|
||||
{ "heat-seeking", Weapon::Info_Flags::Homing_heat, true, false },
|
||||
{ "aspect-seeking", Weapon::Info_Flags::Homing_aspect, true, false },
|
||||
{ "javelin", Weapon::Info_Flags::Homing_javelin, true, false },
|
||||
{ "spawn", Weapon::Info_Flags::Spawn, true, false },
|
||||
{ "remote detonate", Weapon::Info_Flags::Remote, true, false },
|
||||
{ "countermeasure", Weapon::Info_Flags::Cmeasure, true, false },
|
||||
{ "turns", Weapon::Info_Flags::Turns, true, false },
|
||||
{ "swarm", Weapon::Info_Flags::Swarm, true, false },
|
||||
{ "trail", Weapon::Info_Flags::Trail, true, false },
|
||||
{ "big ship", Weapon::Info_Flags::Big_only, true, false },
|
||||
{ "child", Weapon::Info_Flags::Child, true, false },
|
||||
{ "no dumbfire", Weapon::Info_Flags::No_dumbfire, true, false },
|
||||
{ "thruster", Weapon::Info_Flags::Thruster, true, false },
|
||||
{ "in tech database", Weapon::Info_Flags::In_tech_database, true, false },
|
||||
{ "player allowed", Weapon::Info_Flags::Player_allowed, true, false },
|
||||
{ "corkscrew", Weapon::Info_Flags::Corkscrew, true, false },
|
||||
{ "particle spew", Weapon::Info_Flags::Particle_spew, true, false },
|
||||
{ "esuck", Weapon::Info_Flags::Energy_suck, true, false },
|
||||
{ "flak", Weapon::Info_Flags::Flak, true, false },
|
||||
//{ "beam", Weapon::Info_Flags::Beam, true, false }, // Okay, this one probably doesn't make sense.
|
||||
{ "tag", Weapon::Info_Flags::Tag, true, false },
|
||||
{ "shudder", Weapon::Info_Flags::Shudder, true, false },
|
||||
{ "lockarm", Weapon::Info_Flags::Lockarm, true, false },
|
||||
{ "stream", Weapon::Info_Flags::Stream, true, false },
|
||||
{ "ballistic", Weapon::Info_Flags::Ballistic, true, false },
|
||||
{ "default in tech database", Weapon::Info_Flags::Default_in_tech_database, true, false },
|
||||
{ "tagged only", Weapon::Info_Flags::Tagged_only, true, false },
|
||||
{ "cycle", Weapon::Info_Flags::Cycle, true, false },
|
||||
{ "small only", Weapon::Info_Flags::Small_only, true, false },
|
||||
{ "same turret cooldown", Weapon::Info_Flags::Same_turret_cooldown, true, false },
|
||||
{ "apply no light", Weapon::Info_Flags::Mr_no_lighting, true, false },
|
||||
{ "transparent", Weapon::Info_Flags::Transparent, true, false },
|
||||
{ "training", Weapon::Info_Flags::Training, true, false },
|
||||
{ "smart spawn", Weapon::Info_Flags::Smart_spawn, true, false },
|
||||
{ "inherit parent target", Weapon::Info_Flags::Inherit_parent_target, true, false },
|
||||
{ "no emp kill", Weapon::Info_Flags::No_emp_kill, true, false },
|
||||
{ "variable lead homing", Weapon::Info_Flags::Variable_lead_homing, true, false },
|
||||
{ "untargeted heat seeker", Weapon::Info_Flags::Untargeted_heat_seeker, true, false },
|
||||
{ "no radius doubling", Weapon::Info_Flags::Hard_target_bomb, true, false },
|
||||
{ "no subsystem homing", Weapon::Info_Flags::Non_subsys_homing, true, false },
|
||||
{ "no lifeleft penalty", Weapon::Info_Flags::No_life_lost_if_missed, true, false },
|
||||
{ "custom seeker str", Weapon::Info_Flags::Custom_seeker_str, true, false },
|
||||
{ "can be targeted", Weapon::Info_Flags::Can_be_targeted, true, false },
|
||||
{ "show on radar", Weapon::Info_Flags::Shown_on_radar, true, false },
|
||||
{ "show friendly on radar", Weapon::Info_Flags::Show_friendly, true, false },
|
||||
{ "chain external model fps", Weapon::Info_Flags::External_weapon_fp, true, false },
|
||||
{ "external model launcher", Weapon::Info_Flags::External_weapon_lnch, true, false },
|
||||
{ "takes blast damage", Weapon::Info_Flags::Takes_blast_damage, true, false },
|
||||
{ "takes shockwave damage", Weapon::Info_Flags::Takes_shockwave_damage, true, false },
|
||||
{ "hide from radar", Weapon::Info_Flags::Dont_show_on_radar, true, false },
|
||||
{ "render flak", Weapon::Info_Flags::Render_flak, true, false },
|
||||
{ "ciws", Weapon::Info_Flags::Ciws, true, false },
|
||||
{ "anti-subsystem beam", Weapon::Info_Flags::Antisubsysbeam, true, false },
|
||||
{ "no primary linking", Weapon::Info_Flags::Nolink, true, false },
|
||||
{ "same emp time for capships", Weapon::Info_Flags::Use_emp_time_for_capship_turrets, true, false },
|
||||
{ "no primary linked penalty", Weapon::Info_Flags::No_linked_penalty, true, false },
|
||||
{ "no homing speed ramp", Weapon::Info_Flags::No_homing_speed_ramp, true, false },
|
||||
{ "pulls aspect seekers", Weapon::Info_Flags::Cmeasure_aspect_home_on, true, false },
|
||||
{ "turret interceptable", Weapon::Info_Flags::Turret_Interceptable, true, false },
|
||||
{ "fighter interceptable", Weapon::Info_Flags::Fighter_Interceptable, true, false },
|
||||
{ "aoe electronics", Weapon::Info_Flags::Aoe_Electronics, true, false },
|
||||
{ "apply recoil", Weapon::Info_Flags::Apply_recoil, true, false },
|
||||
{ "don't spawn if shot", Weapon::Info_Flags::Dont_spawn_if_shot, true, false },
|
||||
{ "die on lost lock", Weapon::Info_Flags::Die_on_lost_lock, true, false },
|
||||
};
|
||||
|
||||
const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list);
|
||||
const int num_ai_tgt_weapon_info_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list_new<Weapon::Info_Flags>);
|
||||
|
||||
SCP_vector <ai_target_priority> Ai_tp_list;
|
||||
|
||||
@@ -3448,7 +3448,7 @@ int parse_ship_values(ship_info* sip, const bool is_template, const bool first_t
|
||||
{
|
||||
for (j = 0; j < Num_weapon_types; j++)
|
||||
{
|
||||
if(sip->allowed_bank_restricted_weapons[i][j] && (Weapon_info[j].wi_flags2 & WIF2_BALLISTIC))
|
||||
if(sip->allowed_bank_restricted_weapons[i][j] && (Weapon_info[j].wi_flags[Weapon::Info_Flags::Ballistic]))
|
||||
{
|
||||
sip->flags.set(Ship::Info_Flags::Ballistic_primaries);
|
||||
break;
|
||||
@@ -3541,7 +3541,7 @@ int parse_ship_values(ship_info* sip, const bool is_template, const bool first_t
|
||||
int res = weapon_info_lookup(buf);
|
||||
if (res < 0) {
|
||||
Warning(LOCATION, "Could not find weapon type '%s' to use as countermeasure on %s '%s'", buf, info_type_name, sip->name);
|
||||
} else if (Weapon_info[res].wi_flags & WIF_BEAM) {
|
||||
} else if (Weapon_info[res].wi_flags[Weapon::Info_Flags::Beam]) {
|
||||
Warning(LOCATION, "Attempt made to set a beam weapon as a countermeasure on %s '%s'", info_type_name, sip->name);
|
||||
} else {
|
||||
sip->cmeasure_type = res;
|
||||
@@ -5200,7 +5200,7 @@ void ship_parse_post_cleanup()
|
||||
|
||||
if (n_tgt_groups > 0) {
|
||||
for(i = 0; i < n_tgt_groups; i++) {
|
||||
if (!(Ai_tp_list[i].obj_flags.any_set() || Ai_tp_list[i].sif_flags.any_set() || Ai_tp_list[i].wif_flags || Ai_tp_list[i].wif2_flags || Ai_tp_list[i].wif3_flags)) {
|
||||
if (!(Ai_tp_list[i].obj_flags.any_set() || Ai_tp_list[i].sif_flags.any_set() || Ai_tp_list[i].wif_flags.any_set())) {
|
||||
//had none of these, check next
|
||||
if (Ai_tp_list[i].obj_type == -1) {
|
||||
//didn't have this one
|
||||
@@ -9058,7 +9058,7 @@ void ship_set_default_weapons(ship *shipp, ship_info *sip)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
|
||||
if ( wip->wi_flags2 & WIF2_BALLISTIC )
|
||||
if ( wip->wi_flags[Weapon::Info_Flags::Ballistic] )
|
||||
{
|
||||
if (Fred_running){
|
||||
swp->primary_bank_ammo[i] = 100;
|
||||
@@ -10374,7 +10374,7 @@ void ship_maybe_play_primary_fail_sound()
|
||||
if ( timestamp_elapsed(Laser_energy_out_snd_timer) )
|
||||
{
|
||||
// check timestamp according to ballistics
|
||||
if (Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]].wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
stampval = 500;
|
||||
}
|
||||
@@ -10396,7 +10396,7 @@ int ship_maybe_play_secondary_fail_sound(weapon_info *wip)
|
||||
|
||||
if ( timestamp_elapsed(Missile_out_snd_timer) ) {
|
||||
|
||||
if ( wip->wi_flags & WIF_SWARM ) {
|
||||
if ( wip->wi_flags[Weapon::Info_Flags::Swarm] ) {
|
||||
Missile_out_snd_timer = timestamp(500);
|
||||
} else {
|
||||
Missile_out_snd_timer = timestamp(50);
|
||||
@@ -10737,17 +10737,17 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
continue;
|
||||
}
|
||||
// if this is a targeting laser, start it up ///- only targeting laser if it is tag-c, otherwise it's a fighter beam -Bobboau
|
||||
if((winfo_p->wi_flags & WIF_BEAM) && (winfo_p->tag_level == 3) && (shipp->flags[Ship_Flags::Trigger_down]) && (winfo_p->b_info.beam_type == BEAM_TYPE_C) ){
|
||||
if((winfo_p->wi_flags[Weapon::Info_Flags::Beam]) && (winfo_p->tag_level == 3) && (shipp->flags[Ship_Flags::Trigger_down]) && (winfo_p->b_info.beam_type == BEAM_TYPE_C) ){
|
||||
ship_start_targeting_laser(shipp);
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we're firing stream weapons and this is a non stream weapon, skip it
|
||||
if(stream_weapons && !(winfo_p->wi_flags & WIF_STREAM)){
|
||||
if(stream_weapons && !(winfo_p->wi_flags[Weapon::Info_Flags::Stream])){
|
||||
continue;
|
||||
}
|
||||
// if we're firing non stream weapons and this is a stream weapon, skip it
|
||||
if(!stream_weapons && (winfo_p->wi_flags & WIF_STREAM)){
|
||||
if(!stream_weapons && (winfo_p->wi_flags[Weapon::Info_Flags::Stream])){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -10757,7 +10757,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
}
|
||||
|
||||
// if weapons are linked and this is a nolink weapon, skip it
|
||||
if (shipp->flags[Ship_Flags::Primary_linked] && winfo_p->wi_flags3 & WIF3_NOLINK) {
|
||||
if (shipp->flags[Ship_Flags::Primary_linked] && winfo_p->wi_flags[Weapon::Info_Flags::Nolink]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -10786,12 +10786,12 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
polymodel *pm = model_get( sip->model_num );
|
||||
|
||||
// Goober5000 (thanks to _argv[-1] for the original idea)
|
||||
if ( (num_primary_banks > 1) && !(winfo_p->wi_flags3 & WIF3_NO_LINKED_PENALTY) && !(The_mission.ai_profile->flags & AIPF_DISABLE_LINKED_FIRE_PENALTY) )
|
||||
if ( (num_primary_banks > 1) && !(winfo_p->wi_flags[Weapon::Info_Flags::No_linked_penalty]) && !(The_mission.ai_profile->flags & AIPF_DISABLE_LINKED_FIRE_PENALTY) )
|
||||
{
|
||||
int effective_primary_banks = 0;
|
||||
for (int it = 0; it < num_primary_banks; it++)
|
||||
{
|
||||
if ((it == bank_to_fire) || !(Weapon_info[swp->primary_bank_weapons[it]].wi_flags3 & (WIF3_NOLINK | WIF3_NO_LINKED_PENALTY)))
|
||||
if ((it == bank_to_fire) || !(Weapon_info[swp->primary_bank_weapons[it]].wi_flags[Weapon::Info_Flags::Nolink, Weapon::Info_Flags::No_linked_penalty]))
|
||||
effective_primary_banks++;
|
||||
}
|
||||
Assert(effective_primary_banks >= 1);
|
||||
@@ -10837,7 +10837,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
Assert(pm->gun_banks[bank_to_fire].num_slots != 0);
|
||||
swp->next_primary_fire_stamp[bank_to_fire] = timestamp((int)(next_fire_delay * ( swp->primary_bank_slot_count[ bank_to_fire ] ) / pm->gun_banks[bank_to_fire].num_slots ) );
|
||||
swp->last_primary_fire_stamp[bank_to_fire] = timestamp();
|
||||
} else if (winfo_p->wi_flags2 & WIF2_CYCLE) {
|
||||
} else if (winfo_p->wi_flags[Weapon::Info_Flags::Cycle]) {
|
||||
Assert(pm->gun_banks[bank_to_fire].num_slots != 0);
|
||||
swp->next_primary_fire_stamp[bank_to_fire] = timestamp((int)(next_fire_delay / pm->gun_banks[bank_to_fire].num_slots));
|
||||
swp->last_primary_fire_stamp[bank_to_fire] = timestamp();
|
||||
@@ -10898,7 +10898,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
}
|
||||
}
|
||||
|
||||
if(winfo_p->wi_flags & WIF_BEAM){ // the big change I made for fighter beams, if there beams fill out the Fire_Info for a targeting laser then fire it, for each point in the weapon bank -Bobboau
|
||||
if(winfo_p->wi_flags[Weapon::Info_Flags::Beam]){ // the big change I made for fighter beams, if there beams fill out the Fire_Info for a targeting laser then fire it, for each point in the weapon bank -Bobboau
|
||||
float t;
|
||||
if (winfo_p->burst_shots > swp->burst_counter[bank_to_fire]) {
|
||||
t = winfo_p->burst_delay;
|
||||
@@ -10988,7 +10988,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
if ( sip->flags[Ship::Info_Flags::Dyn_primary_linking] ) {
|
||||
numtimes = 1;
|
||||
points = MIN( num_slots, swp->primary_bank_slot_count[ bank_to_fire ] );
|
||||
} else if ( winfo_p->wi_flags2 & WIF2_CYCLE ) {
|
||||
} else if ( winfo_p->wi_flags[Weapon::Info_Flags::Cycle] ) {
|
||||
numtimes = 1;
|
||||
points = MIN(num_slots, winfo_p->shots);
|
||||
} else {
|
||||
@@ -11016,7 +11016,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
// moved the above to here to use points instead of num_slots for energy consumption check
|
||||
|
||||
// ballistics support for primaries - Goober5000
|
||||
if ( winfo_p->wi_flags2 & WIF2_BALLISTIC )
|
||||
if ( winfo_p->wi_flags[Weapon::Info_Flags::Ballistic] )
|
||||
{
|
||||
// Make sure this ship is set up for ballistics.
|
||||
// If you get this error, add the ballistic primaries tags to ships.tbl.
|
||||
@@ -11080,7 +11080,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
vec3d *firepoint_list;
|
||||
size_t current_firepoint = 0;
|
||||
|
||||
if (winfo_p->wi_flags3 & WIF3_APPLY_RECOIL){
|
||||
if (winfo_p->wi_flags[Weapon::Info_Flags::Apply_recoil]){
|
||||
firepoint_list = new vec3d[numtimes * points];
|
||||
vm_vec_zero(&total_impulse);
|
||||
} else {
|
||||
@@ -11098,7 +11098,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
|
||||
for ( j = 0; j < points; j++ ) {
|
||||
int pt; //point
|
||||
if ( (winfo_p->wi_flags2 & WIF2_CYCLE) || (sip->flags[Ship::Info_Flags::Dyn_primary_linking]) ){
|
||||
if ( (winfo_p->wi_flags[Weapon::Info_Flags::Cycle]) || (sip->flags[Ship::Info_Flags::Dyn_primary_linking]) ){
|
||||
pt = (shipp->last_fired_point[bank_to_fire]+1)%num_slots;
|
||||
}else{
|
||||
pt = j;
|
||||
@@ -11107,14 +11107,14 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
int sub_shots = 1;
|
||||
// Use 0 instead of bank_to_fire as index when checking the number of external weapon model firingpoints
|
||||
if (weapon_model && weapon_model->n_guns)
|
||||
if (!(winfo_p->wi_flags2 & WIF2_EXTERNAL_WEAPON_FP))
|
||||
if (!(winfo_p->wi_flags[Weapon::Info_Flags::External_weapon_fp]))
|
||||
sub_shots = weapon_model->gun_banks[0].num_slots;
|
||||
|
||||
for(int s = 0; s<sub_shots; s++){
|
||||
pnt = pm->gun_banks[bank_to_fire].pnt[pt];
|
||||
// Use 0 instead of bank_to_fire as index to external weapon model firingpoints
|
||||
if (weapon_model && weapon_model->n_guns) {
|
||||
if (winfo_p->wi_flags2 & WIF2_EXTERNAL_WEAPON_FP) {
|
||||
if (winfo_p->wi_flags[Weapon::Info_Flags::External_weapon_fp]) {
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[swp->external_model_fp_counter[bank_to_fire]]);
|
||||
} else {
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[s]);
|
||||
@@ -11180,7 +11180,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
firing_orient = obj->orient;
|
||||
}
|
||||
|
||||
if (winfo_p->wi_flags3 & WIF3_APPLY_RECOIL){ // Function to add recoil functionality - DahBlount
|
||||
if (winfo_p->wi_flags[Weapon::Info_Flags::Apply_recoil]){ // Function to add recoil functionality - DahBlount
|
||||
vec3d local_impulse = firing_orient.vec.fvec;
|
||||
|
||||
float recoil_force = (winfo_p->mass * winfo_p->max_speed * winfo_p->recoil_modifier * sip->ship_recoil_modifier);
|
||||
@@ -11200,7 +11200,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
|
||||
weapon_set_tracking_info(weapon_objnum, OBJ_INDEX(obj), aip->target_objnum, aip->current_target_is_locked, aip->targeted_subsys);
|
||||
|
||||
if (winfo_p->wi_flags & WIF_FLAK)
|
||||
if (winfo_p->wi_flags[Weapon::Info_Flags::Flak])
|
||||
{
|
||||
object *target;
|
||||
vec3d predicted_pos;
|
||||
@@ -11242,7 +11242,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
}
|
||||
|
||||
// maybe shudder the ship - if its me
|
||||
if((winfo_p->wi_flags & WIF_SHUDDER) && (obj == Player_obj) && !(Game_mode & GM_STANDALONE_SERVER)){
|
||||
if((winfo_p->wi_flags[Weapon::Info_Flags::Shudder]) && (obj == Player_obj) && !(Game_mode & GM_STANDALONE_SERVER)){
|
||||
// calculate some arbitrary value between 100
|
||||
// (mass * velocity) / 10
|
||||
game_shudder_apply(500, (winfo_p->mass * winfo_p->max_speed) * 0.1f);
|
||||
@@ -11254,7 +11254,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
}
|
||||
swp->external_model_fp_counter[bank_to_fire]++;
|
||||
}
|
||||
if (winfo_p->wi_flags3 & WIF3_APPLY_RECOIL){
|
||||
if (winfo_p->wi_flags[Weapon::Info_Flags::Apply_recoil]){
|
||||
vec3d avg_firepoint;
|
||||
|
||||
vm_vec_avg_n(&avg_firepoint, current_firepoint, firepoint_list);
|
||||
@@ -11274,7 +11274,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
// avoid playing the same sound multiple times when banks are linked with the
|
||||
// same weapon.
|
||||
|
||||
if (!(winfo_p->wi_flags & WIF_BEAM)){ // not a beam weapon?
|
||||
if (!(winfo_p->wi_flags[Weapon::Info_Flags::Beam])){ // not a beam weapon?
|
||||
if ( sound_played != winfo_p->launch_snd ) {
|
||||
sound_played = winfo_p->launch_snd;
|
||||
if ( obj == Player_obj ) {
|
||||
@@ -11309,7 +11309,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
int force_level = (int) ((wip->armor_factor + wip->shield_factor * 0.2f) * (wip->damage * wip->damage - 7.5f) * 0.45f + 0.6f) * 10 + 2000;
|
||||
|
||||
// modify force feedback for ballistics: make it stronger
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
joy_ff_play_primary_shoot(force_level * 2);
|
||||
// no ballistics
|
||||
else
|
||||
@@ -11380,10 +11380,10 @@ void ship_start_targeting_laser(ship *shipp)
|
||||
int bank1_laser = 0;
|
||||
|
||||
// determine if either of our banks have a targeting laser
|
||||
if((shipp->weapons.primary_bank_weapons[0] >= 0) && (Weapon_info[shipp->weapons.primary_bank_weapons[0]].wi_flags & WIF_BEAM) && (Weapon_info[shipp->weapons.primary_bank_weapons[0]].b_info.beam_type == BEAM_TYPE_C)){
|
||||
if((shipp->weapons.primary_bank_weapons[0] >= 0) && (Weapon_info[shipp->weapons.primary_bank_weapons[0]].wi_flags[Weapon::Info_Flags::Beam]) && (Weapon_info[shipp->weapons.primary_bank_weapons[0]].b_info.beam_type == BEAM_TYPE_C)){
|
||||
bank0_laser = 1;
|
||||
}
|
||||
if((shipp->weapons.primary_bank_weapons[1] >= 0) && (Weapon_info[shipp->weapons.primary_bank_weapons[1]].wi_flags & WIF_BEAM) && (Weapon_info[shipp->weapons.primary_bank_weapons[1]].b_info.beam_type == BEAM_TYPE_C)){
|
||||
if((shipp->weapons.primary_bank_weapons[1] >= 0) && (Weapon_info[shipp->weapons.primary_bank_weapons[1]].wi_flags[Weapon::Info_Flags::Beam]) && (Weapon_info[shipp->weapons.primary_bank_weapons[1]].b_info.beam_type == BEAM_TYPE_C)){
|
||||
bank1_laser = 1;
|
||||
}
|
||||
|
||||
@@ -11514,7 +11514,7 @@ int maybe_detonate_weapon(ship_weapon *swp, object *src)
|
||||
Assert(Weapons[objp->instance].weapon_info_index != -1);
|
||||
wip = &Weapon_info[Weapons[objp->instance].weapon_info_index];
|
||||
|
||||
if (wip->wi_flags & WIF_REMOTE) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Remote]) {
|
||||
|
||||
int weapon_sig;
|
||||
|
||||
@@ -11550,7 +11550,7 @@ int ship_fire_secondary_detonate(object *obj, ship_weapon *swp)
|
||||
Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS);
|
||||
mobjp = &Objects[mo->objnum];
|
||||
if ((mobjp != first_objp) && (mobjp->parent_sig == obj->parent_sig)) {
|
||||
if (Weapon_info[Weapons[mobjp->instance].weapon_info_index].wi_flags & WIF_REMOTE) {
|
||||
if (Weapon_info[Weapons[mobjp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Remote]) {
|
||||
weapon_detonate(mobjp);
|
||||
}
|
||||
}
|
||||
@@ -11731,14 +11731,14 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
}
|
||||
|
||||
// Ensure if this is a "require-lock" missile, that a lock actually exists
|
||||
if ( wip->wi_flags & WIF_NO_DUMBFIRE ) {
|
||||
if ( wip->wi_flags[Weapon::Info_Flags::No_dumbfire] ) {
|
||||
if ( aip->current_target_is_locked <= 0 ) {
|
||||
if ( obj == Player_obj ) {
|
||||
if ( !Weapon_energy_cheat ) {
|
||||
float max_dist;
|
||||
|
||||
max_dist = wip->lifetime * wip->max_speed;
|
||||
if (wip->wi_flags2 & WIF2_LOCAL_SSM){
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Local_ssm]){
|
||||
max_dist= wip->lssm_lock_range;
|
||||
}
|
||||
|
||||
@@ -11765,7 +11765,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
}
|
||||
}
|
||||
|
||||
if (wip->wi_flags2 & WIF2_TAGGED_ONLY)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Tagged_only])
|
||||
{
|
||||
if (!ship_is_tagged(&Objects[aip->target_objnum]))
|
||||
{
|
||||
@@ -11792,7 +11792,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
|
||||
|
||||
// if trying to fire a swarm missile, make sure being called from right place
|
||||
if ( (wip->wi_flags & WIF_SWARM) && !allow_swarm ) {
|
||||
if ( (wip->wi_flags[Weapon::Info_Flags::Swarm]) && !allow_swarm ) {
|
||||
Assert(wip->swarm_count > 0);
|
||||
if(wip->swarm_count <= 0){
|
||||
shipp->num_swarm_missiles_to_fire = SWARM_DEFAULT_NUM_MISSILES_FIRED;
|
||||
@@ -11804,7 +11804,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
}
|
||||
|
||||
// if trying to fire a corkscrew missile, make sure being called from right place
|
||||
if ( (wip->wi_flags & WIF_CORKSCREW) && !allow_swarm ) {
|
||||
if ( (wip->wi_flags[Weapon::Info_Flags::Corkscrew]) && !allow_swarm ) {
|
||||
//phreak 11-9-02
|
||||
//changed this from 4 to custom number defined in tables
|
||||
shipp->num_corkscrew_to_fire = (ubyte)(shipp->num_corkscrew_to_fire + (ubyte)wip->cs_num_fired);
|
||||
@@ -11913,7 +11913,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
|
||||
if (weapon_model && weapon_model->n_guns) {
|
||||
int external_bank = bank + MAX_SHIP_PRIMARY_BANKS;
|
||||
if (wip->wi_flags2 & WIF2_EXTERNAL_WEAPON_FP) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::External_weapon_fp]) {
|
||||
if ((weapon_model->n_guns <= swp->external_model_fp_counter[external_bank]) || (swp->external_model_fp_counter[external_bank] < 0))
|
||||
swp->external_model_fp_counter[external_bank] = 0;
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[swp->external_model_fp_counter[external_bank]]);
|
||||
@@ -11957,7 +11957,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
shipfx_flash_create(obj, sip->model_num, &pnt, &obj->orient.vec.fvec, 0, weapon_idx);
|
||||
}
|
||||
|
||||
if((wip->wi_flags & WIF_SHUDDER) && (obj == Player_obj) && !(Game_mode & GM_STANDALONE_SERVER)){
|
||||
if((wip->wi_flags[Weapon::Info_Flags::Shudder]) && (obj == Player_obj) && !(Game_mode & GM_STANDALONE_SERVER)){
|
||||
// calculate some arbitrary value between 100
|
||||
// (mass * velocity) / 10
|
||||
game_shudder_apply(500, (wip->mass * wip->max_speed) * 0.1f);
|
||||
@@ -12102,7 +12102,7 @@ int primary_out_of_ammo(ship_weapon *swp, int bank)
|
||||
// true if both ballistic and ammo <= 0,
|
||||
// false if not ballistic or if ballistic and ammo > 0
|
||||
|
||||
if ( Weapon_info[swp->primary_bank_weapons[bank]].wi_flags2 & WIF2_BALLISTIC )
|
||||
if ( Weapon_info[swp->primary_bank_weapons[bank]].wi_flags[Weapon::Info_Flags::Ballistic] )
|
||||
{
|
||||
if (swp->primary_bank_ammo[bank] <= 0)
|
||||
{
|
||||
@@ -13400,7 +13400,7 @@ float ship_calculate_rearm_duration( object *objp )
|
||||
for (i = 0; i < swp->num_primary_banks; i++)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
//check how many full reloads we need
|
||||
num_reloads = (swp->primary_bank_start_ammo[i] - swp->primary_bank_ammo[i])/REARM_NUM_BALLISTIC_PRIMARIES_PER_BATCH;
|
||||
@@ -13667,14 +13667,14 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
{
|
||||
for (i = 1; i < swp->num_primary_banks; i++ )
|
||||
{
|
||||
if ( Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC )
|
||||
if ( Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic] )
|
||||
last_ballistic_idx = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < swp->num_primary_banks; i++ )
|
||||
{
|
||||
if ( Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC )
|
||||
if ( Weapon_info[swp->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Ballistic] )
|
||||
{
|
||||
// Actual loading of bullets is preceded by a sound effect which is the bullet
|
||||
// loading equipment moving into place
|
||||
@@ -14922,7 +14922,7 @@ int ship_has_homing_missile_locked(ship *shipp)
|
||||
if ( wip->subtype != WP_MISSILE )
|
||||
continue;
|
||||
|
||||
if ( !(wip->wi_flags & WIF_HOMING ) )
|
||||
if ( !(wip->is_homing() ) )
|
||||
continue;
|
||||
|
||||
if (wp->homing_object == locked_objp) {
|
||||
@@ -15686,7 +15686,7 @@ void ship_maybe_tell_about_low_ammo(ship *sp)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
if (swp->primary_bank_start_ammo[i] > 0)
|
||||
{
|
||||
@@ -15767,7 +15767,7 @@ void ship_maybe_tell_about_rearm(ship *sp)
|
||||
{
|
||||
wip = &Weapon_info[swp->primary_bank_weapons[i]];
|
||||
|
||||
if (wip->wi_flags2 & WIF2_BALLISTIC)
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Ballistic])
|
||||
{
|
||||
if (swp->primary_bank_start_ammo[i] > 0)
|
||||
{
|
||||
@@ -16993,8 +16993,8 @@ void ship_update_artillery_lock()
|
||||
if(shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank] < 0){
|
||||
continue;
|
||||
}
|
||||
Assert((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags & WIF_BEAM) && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type == BEAM_TYPE_C));
|
||||
if(!(Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags & WIF_BEAM) || (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type != BEAM_TYPE_C)){
|
||||
Assert((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags[Weapon::Info_Flags::Beam]) && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type == BEAM_TYPE_C));
|
||||
if(!(Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags[Weapon::Info_Flags::Beam]) || (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type != BEAM_TYPE_C)){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -18304,19 +18304,13 @@ void parse_ai_target_priorities()
|
||||
num_strings = stuff_string_list(temp_strings);
|
||||
|
||||
for (i = 0; i < num_strings; i++) {
|
||||
for (j = 0; j < num_ai_tgt_weapon_flags; j++) {
|
||||
for (j = 0; j < num_ai_tgt_weapon_info_flags; j++) {
|
||||
if ( !stricmp(ai_tgt_weapon_flags[j].name, temp_strings[i].c_str()) ) {
|
||||
if (ai_tgt_weapon_flags[j].var == 0) {
|
||||
temp_priority.wif_flags |= ai_tgt_weapon_flags[j].def;
|
||||
} else if (ai_tgt_weapon_flags[j].var == 1) {
|
||||
temp_priority.wif2_flags |= ai_tgt_weapon_flags[j].def;
|
||||
} else {
|
||||
temp_priority.wif3_flags |= ai_tgt_weapon_flags[j].def;
|
||||
}
|
||||
temp_priority.wif_flags |= ai_tgt_weapon_flags[j].def;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == num_ai_tgt_weapon_flags) {
|
||||
if (j == num_ai_tgt_weapon_info_flags) {
|
||||
Warning(LOCATION, "Unidentified weapon class flag '%s' set for target priority group '%s'\n", temp_strings[i].c_str(), temp_priority.name);
|
||||
}
|
||||
}
|
||||
@@ -18342,9 +18336,7 @@ ai_target_priority init_ai_target_priorities()
|
||||
temp_priority.ship_type.clear();
|
||||
temp_priority.sif_flags.reset();
|
||||
temp_priority.weapon_class.clear();
|
||||
temp_priority.wif_flags = 0;
|
||||
temp_priority.wif2_flags = 0;
|
||||
temp_priority.wif3_flags = 0;
|
||||
temp_priority.wif_flags.reset();
|
||||
temp_priority.name[0] = '\0';
|
||||
|
||||
//return the initialized
|
||||
@@ -18706,7 +18698,7 @@ void ship_render_weapon_models(model_render_params *ship_render_info, draw_list
|
||||
|
||||
bank = &(model_get(sip->model_num))->missile_banks[i];
|
||||
|
||||
if (Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
|
||||
if (Weapon_info[swp->secondary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::External_weapon_lnch]) {
|
||||
for(k = 0; k < bank->num_slots; k++) {
|
||||
render_info.set_flags(render_flags);
|
||||
|
||||
|
||||
+2
-3
@@ -31,6 +31,7 @@
|
||||
#include "weapon/shockwave.h"
|
||||
#include "weapon/trails.h"
|
||||
#include "ship/ship_flags.h"
|
||||
#include "weapon/weapon_flags.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -718,9 +719,7 @@ struct ai_target_priority {
|
||||
|
||||
flagset<Object::Object_Flags> obj_flags;
|
||||
flagset<Ship::Info_Flags> sif_flags;
|
||||
int wif_flags;
|
||||
int wif2_flags;
|
||||
int wif3_flags;
|
||||
flagset<Weapon::Info_Flags> wif_flags;
|
||||
};
|
||||
|
||||
extern SCP_vector <ai_target_priority> Ai_tp_list;
|
||||
|
||||
@@ -1243,7 +1243,7 @@ void shipfx_flash_create(object *objp, int model_num, vec3d *gun_pos, vec3d *gun
|
||||
// ALWAYS do this - since this is called once per firing
|
||||
// if this is a cannon type weapon, create a muzzle flash
|
||||
// HACK - let the flak guns do this on their own since they fire so quickly
|
||||
if ((Weapon_info[weapon_info_index].muzzle_flash >= 0) && !(Weapon_info[weapon_info_index].wi_flags & WIF_FLAK)) {
|
||||
if ((Weapon_info[weapon_info_index].muzzle_flash >= 0) && !(Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Flak])) {
|
||||
vec3d real_dir;
|
||||
vm_vec_rotate(&real_dir, gun_dir,&objp->orient);
|
||||
mflash_create(gun_pos, &real_dir, &objp->phys_info, Weapon_info[weapon_info_index].muzzle_flash, objp);
|
||||
|
||||
@@ -495,7 +495,7 @@ float do_subobj_hit_stuff(object *ship_objp, object *other_obj, vec3d *hitpos, i
|
||||
weapon_info_index = shiphit_get_damage_weapon(other_obj); // Goober5000 - a NULL other_obj returns -1
|
||||
if ((weapon_info_index >= 0) && ((other_obj->type == OBJ_WEAPON) ||
|
||||
(Beams_use_damage_factors && (other_obj->type == OBJ_BEAM)))) {
|
||||
if ( Weapon_info[weapon_info_index].wi_flags2 & WIF2_TRAINING ) {
|
||||
if ( Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Training] ) {
|
||||
return damage_left;
|
||||
}
|
||||
damage_left *= Weapon_info[weapon_info_index].subsystem_factor;
|
||||
@@ -2160,7 +2160,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
if (damage > 0.0f) {
|
||||
weapon_info_index = shiphit_get_damage_weapon(other_obj); // Goober5000 - a NULL other_obj returns -1
|
||||
if ( weapon_info_index >= 0 ) {
|
||||
if (Weapon_info[weapon_info_index].wi_flags & WIF_PUNCTURE) {
|
||||
if (Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Puncture]) {
|
||||
damage /= 4;
|
||||
}
|
||||
|
||||
@@ -2185,7 +2185,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
// Check if this is simulated damage.
|
||||
weapon_info_index = shiphit_get_damage_weapon(other_obj);
|
||||
if ( weapon_info_index >= 0 ) {
|
||||
if (Weapon_info[weapon_info_index].wi_flags2 & WIF2_TRAINING) {
|
||||
if (Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Training]) {
|
||||
// diag_printf2("Simulated Hull for Ship %s hit, dropping from %.32f to %d.\n", shipp->ship_name, (int) ( ship_objp->sim_hull_strength * 100 ), (int) ( ( ship_objp->sim_hull_strength - damage ) * 100 ) );
|
||||
ship_objp->sim_hull_strength -= damage;
|
||||
ship_objp->sim_hull_strength = MAX( 0, ship_objp->sim_hull_strength );
|
||||
@@ -2265,7 +2265,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
if (other_obj->type == OBJ_BEAM)
|
||||
{
|
||||
int beam_weapon_info_index = beam_get_weapon_info_index(other_obj);
|
||||
if ( (beam_weapon_info_index > -1) && (Weapon_info[beam_weapon_info_index].wi_flags & (WIF_HUGE)) ) {
|
||||
if ( (beam_weapon_info_index > -1) && (Weapon_info[beam_weapon_info_index].wi_flags[Weapon::Info_Flags::Huge]) ) {
|
||||
// Flag as vaporized
|
||||
shipp->flags.set(Ship::Ship_Flags::Vaporize);
|
||||
}
|
||||
@@ -2307,7 +2307,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
wip = &Weapon_info[Weapons[other_obj->instance].weapon_info_index];
|
||||
|
||||
// if its a leech weapon - NOTE - unknownplayer: Perhaps we should do something interesting like direct the leeched energy into the attacker ?
|
||||
if (wip->wi_flags & WIF_ENERGY_SUCK) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Energy_suck]) {
|
||||
// reduce afterburner fuel
|
||||
shipp->afterburner_fuel -= wip->afterburner_reduce;
|
||||
shipp->afterburner_fuel = (shipp->afterburner_fuel < 0.0f) ? 0.0f : shipp->afterburner_fuel;
|
||||
@@ -2401,7 +2401,7 @@ void ship_apply_local_damage(object *ship_objp, object *other_obj, vec3d *hitpos
|
||||
|
||||
Assert(wip != NULL);
|
||||
|
||||
if (wip->wi_flags & WIF_TAG) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Tag]) {
|
||||
// ssm stuff
|
||||
vec3d *start = hitpos;
|
||||
int ssm_index = wip->SSM_index;
|
||||
@@ -2413,7 +2413,7 @@ void ship_apply_local_damage(object *ship_objp, object *other_obj, vec3d *hitpos
|
||||
#ifndef NDEBUG
|
||||
if (other_obj->type == OBJ_WEAPON) {
|
||||
weapon_info *wip = &Weapon_info[Weapons[other_obj->instance].weapon_info_index];
|
||||
if (wip->wi_flags & WIF_HOMING) {
|
||||
if (wip->is_homing()) {
|
||||
Homing_hits++;
|
||||
// nprintf(("AI", " Hit! Hits = %i/%i\n", Homing_hits, (Homing_hits + Homing_misses)));
|
||||
}
|
||||
@@ -2451,7 +2451,7 @@ void ship_apply_local_damage(object *ship_objp, object *other_obj, vec3d *hitpos
|
||||
|
||||
Assert(wip != NULL);
|
||||
|
||||
if (wip->wi_flags2 & WIF2_TRAINING) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Training]) {
|
||||
create_sparks = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ int scoring_eval_kill_on_weapon(object *weapon_obj, object *other_obj) {
|
||||
weapon_info *dead_wip = &Weapon_info[dead_wp->weapon_info_index]; // info on the weapon that was killed
|
||||
|
||||
// we don't evaluate kills on anything except bombs, currently. -Halleck
|
||||
if(!(dead_wip->wi_flags & WIF_BOMB)) {
|
||||
if(!(dead_wip->wi_flags[Weapon::Info_Flags::Bomb])) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ void scoring_eval_hit(object *hit_obj, object *other_obj,int from_blast)
|
||||
return;
|
||||
}
|
||||
|
||||
hit_obj_is_bomb = (Weapon_info[Weapons[hit_obj->instance].weapon_info_index].wi_flags & WIF_BOMB) ? true : false;
|
||||
hit_obj_is_bomb = (Weapon_info[Weapons[hit_obj->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) ? true : false;
|
||||
|
||||
//If it's not a bomb but just a regular weapon, we don't care about it (for now, at least.) -Halleck
|
||||
if (!hit_obj_is_bomb) {
|
||||
@@ -1170,7 +1170,7 @@ void scoring_eval_hit(object *hit_obj, object *other_obj,int from_blast)
|
||||
// hostile hit
|
||||
else {
|
||||
// if its a bomb, count every bit of damage it does
|
||||
if(Weapon_info[Weapons[other_obj->instance].weapon_info_index].wi_flags & WIF_BOMB){
|
||||
if(Weapon_info[Weapons[other_obj->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]){
|
||||
// once we get impact damage, stop keeping track of it
|
||||
Net_players[player_num].m_player->stats.ms_shots_hit++;
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ void scoring_eval_hit(object *hit_obj, object *other_obj,int from_blast)
|
||||
// hostile hit
|
||||
else {
|
||||
// if its a bomb, count every bit of damage it does
|
||||
if(Weapon_info[Weapons[other_obj->instance].weapon_info_index].wi_flags & WIF_BOMB){
|
||||
if(Weapon_info[Weapons[other_obj->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]){
|
||||
// once we get impact damage, stop keeping track of it
|
||||
Player->stats.ms_shots_hit++;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ int beam_fire(beam_fire_info *fire_info)
|
||||
}
|
||||
|
||||
// make sure the beam_info_index is valid
|
||||
if ((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= Num_weapon_types) || !(Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)) {
|
||||
if ((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= Num_weapon_types) || !(Weapon_info[fire_info->beam_info_index].wi_flags[Weapon::Info_Flags::Beam])) {
|
||||
Assertion(false, "beam_info_index (%d) invalid (either <0, >= %d, or not actually a beam)!\n", fire_info->beam_info_index, Num_weapon_types);
|
||||
return -1;
|
||||
}
|
||||
@@ -493,8 +493,8 @@ int beam_fire_targeting(fighter_beam_fire_info *fire_info)
|
||||
}
|
||||
|
||||
// make sure the beam_info_index is valid
|
||||
Assert((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < MAX_WEAPON_TYPES) && (Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM));
|
||||
if((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= MAX_WEAPON_TYPES) || !(Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)){
|
||||
Assert((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < MAX_WEAPON_TYPES) && (Weapon_info[fire_info->beam_info_index].wi_flags[Weapon::Info_Flags::Beam]));
|
||||
if((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= MAX_WEAPON_TYPES) || !(Weapon_info[fire_info->beam_info_index].wi_flags[Weapon::Info_Flags::Beam])){
|
||||
return -1;
|
||||
}
|
||||
wip = &Weapon_info[fire_info->beam_info_index];
|
||||
@@ -2511,7 +2511,7 @@ int beam_collide_ship(obj_pair *pair)
|
||||
|
||||
// if this weapon pierces the shield, then do the hit effect, but act like a shield collision never occurred;
|
||||
// otherwise, we have a valid hit on this shield
|
||||
if (bwi->wi_flags2 & WIF2_PIERCE_SHIELDS)
|
||||
if (bwi->wi_flags[Weapon::Info_Flags::Pierce_shields])
|
||||
quadrant_num = -1;
|
||||
else
|
||||
valid_hit_occurred = 1;
|
||||
@@ -3033,7 +3033,7 @@ void beam_handle_collisions(beam *b)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wi->wi_flags & WIF_HUGE) {
|
||||
if (wi->wi_flags[Weapon::Info_Flags::Huge]) {
|
||||
if (Objects[target].type == OBJ_SHIP) {
|
||||
ship_type_info *sti;
|
||||
sti = ship_get_type_info(&Objects[target]);
|
||||
@@ -3587,7 +3587,7 @@ int beam_will_tool_target(beam *b, object *objp)
|
||||
}
|
||||
|
||||
// calculate total strength, factoring in shield
|
||||
if (!(wip->wi_flags2 & WIF2_PIERCE_SHIELDS))
|
||||
if (!(wip->wi_flags[Weapon::Info_Flags::Pierce_shields]))
|
||||
total_strength += shield_get_strength(objp);
|
||||
|
||||
// if the beam is going to apply more damage in about 1 and a half than the ship can take
|
||||
@@ -3606,7 +3606,7 @@ DCF(beam_list, "Lists all beams")
|
||||
int b_count = 0;
|
||||
|
||||
for(idx=0; idx<Num_weapon_types; idx++){
|
||||
if(Weapon_info[idx].wi_flags & WIF_BEAM){
|
||||
if(Weapon_info[idx].wi_flags[Weapon::Info_Flags::Beam]){
|
||||
b_count++;
|
||||
dc_printf("Beam %d : %s\n", b_count, Weapon_info[idx].name);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void cscrew_maybe_fire_missile(int shipnum)
|
||||
Assert( weapon_info_index >= 0 && weapon_info_index < MAX_WEAPON_TYPES );
|
||||
|
||||
// if current secondary bank is not a corkscrew missile, return
|
||||
if ( !(Weapon_info[weapon_info_index].wi_flags & WIF_CORKSCREW) ) {
|
||||
if ( !(Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Corkscrew]) ) {
|
||||
sp->num_corkscrew_to_fire = 0;
|
||||
sp->corkscrew_missile_bank = -1;
|
||||
return;
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ void emp_apply(vec3d *pos, float inner_radius, float outer_radius, float emp_int
|
||||
|
||||
// if we have a bomb weapon
|
||||
wip_target = &Weapon_info[Weapons[target->instance].weapon_info_index];
|
||||
if((wip_target->weapon_hitpoints > 0) && !(wip_target->wi_flags2 & WIF2_NO_EMP_KILL)) {
|
||||
if((wip_target->weapon_hitpoints > 0) && !(wip_target->wi_flags[Weapon::Info_Flags::No_emp_kill])) {
|
||||
// get the distance between the detonation and the target object
|
||||
vm_vec_sub(&dist, &target->pos, pos);
|
||||
dist_mag = vm_vec_mag(&dist);
|
||||
|
||||
@@ -44,7 +44,7 @@ void flak_pick_range(object *objp, vec3d *firing_pos, vec3d *predicted_target_po
|
||||
Assert(objp->type == OBJ_WEAPON);
|
||||
Assert(objp->instance >= 0);
|
||||
Assert(Weapons[objp->instance].weapon_info_index >= 0);
|
||||
Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_FLAK);
|
||||
Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Flak]);
|
||||
|
||||
weapon_info* wip = &Weapon_info[Weapons[objp->instance].weapon_info_index];
|
||||
|
||||
@@ -124,8 +124,8 @@ void flak_muzzle_flash(vec3d *pos, vec3d *dir, physics_info *pip, int turret_wea
|
||||
if((turret_weapon_class < 0) || (turret_weapon_class >= Num_weapon_types)){
|
||||
return;
|
||||
}
|
||||
Assert(Weapon_info[turret_weapon_class].wi_flags & WIF_FLAK);
|
||||
if(!(Weapon_info[turret_weapon_class].wi_flags & WIF_FLAK)){
|
||||
Assert(Weapon_info[turret_weapon_class].wi_flags[Weapon::Info_Flags::Flak]);
|
||||
if(!(Weapon_info[turret_weapon_class].wi_flags[Weapon::Info_Flags::Flak])){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ void shockwave_move(object *shockwave_objp, float frametime)
|
||||
if (wip->weapon_hitpoints <= 0)
|
||||
continue;
|
||||
|
||||
if (!(wip->wi_flags2 & WIF2_TAKES_SHOCKWAVE_DAMAGE || (sw->weapon_info_index >= 0 && Weapon_info[sw->weapon_info_index].wi_flags2 & WIF2_CIWS)))
|
||||
if (!(wip->wi_flags[Weapon::Info_Flags::Takes_shockwave_damage] || (sw->weapon_info_index >= 0 && Weapon_info[sw->weapon_info_index].wi_flags[Weapon::Info_Flags::Ciws])))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void shockwave_move(object *shockwave_objp, float frametime)
|
||||
case OBJ_SHIP:
|
||||
sw->obj_sig_hitlist[sw->num_objs_hit++] = objp->signature;
|
||||
// If we're doing an AoE Electronics shockwave, do the electronics stuff. -MageKing17
|
||||
if ( (sw->weapon_info_index >= 0) && (Weapon_info[sw->weapon_info_index].wi_flags3 & WIF3_AOE_ELECTRONICS) && !(objp->flags[Object::Object_Flags::Invulnerable]) ) {
|
||||
if ( (sw->weapon_info_index >= 0) && (Weapon_info[sw->weapon_info_index].wi_flags[Weapon::Info_Flags::Aoe_Electronics]) && !(objp->flags[Object::Object_Flags::Invulnerable]) ) {
|
||||
weapon_do_electronics_effect(objp, &sw->pos, sw->weapon_info_index);
|
||||
}
|
||||
ship_apply_global_damage(objp, shockwave_objp, &sw->pos, damage );
|
||||
|
||||
@@ -111,7 +111,7 @@ void swarm_maybe_fire_missile(int shipnum)
|
||||
Assert( weapon_info_index >= 0 && weapon_info_index < MAX_WEAPON_TYPES );
|
||||
|
||||
// if swarm secondary bank is not a swarm missile, return
|
||||
if ( !(Weapon_info[weapon_info_index].wi_flags & WIF_SWARM) ) {
|
||||
if ( !(Weapon_info[weapon_info_index].wi_flags[Weapon::Info_Flags::Swarm]) ) {
|
||||
sp->num_swarm_missiles_to_fire = 0;
|
||||
sp->swarm_missile_bank = -1;
|
||||
return;
|
||||
@@ -451,9 +451,9 @@ void turret_swarm_set_up_info(int parent_objnum, ship_subsys *turret, weapon_inf
|
||||
target_obj = &Objects[turret->turret_enemy_objnum];
|
||||
|
||||
// valid swarm weapon
|
||||
Assert(((wip->wi_flags & WIF_SWARM) && (wip->swarm_count > 0)) || ((wip->wi_flags & WIF_CORKSCREW) && (wip->cs_num_fired > 0)));
|
||||
Assert(((wip->wi_flags[Weapon::Info_Flags::Swarm]) && (wip->swarm_count > 0)) || ((wip->wi_flags[Weapon::Info_Flags::Corkscrew]) && (wip->cs_num_fired > 0)));
|
||||
|
||||
if(!((wip->wi_flags & WIF_SWARM) || (wip->wi_flags & WIF_CORKSCREW)) || ((wip->wi_flags & WIF_SWARM) && (wip->swarm_count <= 0)) || ((wip->wi_flags & WIF_CORKSCREW) && (wip->cs_num_fired <= 0)))
|
||||
if(!((wip->wi_flags[Weapon::Info_Flags::Swarm]) || (wip->wi_flags[Weapon::Info_Flags::Corkscrew])) || ((wip->wi_flags[Weapon::Info_Flags::Swarm]) && (wip->swarm_count <= 0)) || ((wip->wi_flags[Weapon::Info_Flags::Corkscrew]) && (wip->cs_num_fired <= 0)))
|
||||
return;
|
||||
|
||||
// get turret_swarm_info
|
||||
@@ -499,7 +499,7 @@ void turret_swarm_set_up_info(int parent_objnum, ship_subsys *turret, weapon_inf
|
||||
|
||||
// initialize tsi
|
||||
tsi->weapon_class = WEAPON_INFO_INDEX(wip);
|
||||
if (wip->wi_flags & WIF_SWARM) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Swarm]) {
|
||||
tsi->num_to_launch = wip->swarm_count;
|
||||
} else {
|
||||
tsi->num_to_launch = wip->cs_num_fired;
|
||||
@@ -582,7 +582,7 @@ void turret_swarm_maybe_fire_missile(int shipnum)
|
||||
}
|
||||
|
||||
// *Get timestamp from weapon info's -Et1
|
||||
if (wip->wi_flags & WIF_SWARM) {
|
||||
if (wip->wi_flags[Weapon::Info_Flags::Swarm]) {
|
||||
tsi->time_to_fire = timestamp( wip->SwarmWait );
|
||||
} else {
|
||||
tsi->time_to_fire = timestamp( wip->cs_delay );
|
||||
|
||||
+7
-96
@@ -20,6 +20,7 @@
|
||||
#include "weapon/shockwave.h"
|
||||
#include "weapon/trails.h"
|
||||
#include "particle/ParticleManager.h"
|
||||
#include "weapon/weapon_flags.h"
|
||||
|
||||
class object;
|
||||
class ship_subsys;
|
||||
@@ -38,99 +39,6 @@ extern int Num_weapon_subtypes;
|
||||
// Bitflags controlling weapon behavior
|
||||
#define MAX_WEAPON_FLAGS 18 // Maximum number of different bit flags legal to specify in a single weapons.tbl Flags line
|
||||
|
||||
#define WIF_DEFAULT_VALUE 0
|
||||
#define WIF2_DEFAULT_VALUE 0
|
||||
#define WIF3_DEFAULT_VALUE 0
|
||||
|
||||
#define WIF_HOMING_HEAT (1 << 0) // if set, this weapon homes via seeking heat
|
||||
#define WIF_HOMING_ASPECT (1 << 1) // if set, this weapon homes via chasing aspect
|
||||
#define WIF_ELECTRONICS (1 << 2) // Takes out electronics systems.
|
||||
#define WIF_SPAWN (1 << 3) // Spawns projectiles on detonation.
|
||||
#define WIF_REMOTE (1 << 4) // Can be remotely detonated by parent.
|
||||
#define WIF_PUNCTURE (1 << 5) // Punctures armor, damaging subsystems.
|
||||
#define WIF_SUPERCAP (1 << 6) // This is a weapon which does supercap class damage (meaning, it applies real damage to supercap ships)
|
||||
#define WIF_CMEASURE (1 << 7) // Weapon acts as a countermeasure
|
||||
//#define WIF_AREA_EFFECT (1 << 7) // Explosion has an area effect
|
||||
//#define WIF_SHOCKWAVE (1 << 8) // Explosion has a shockwave
|
||||
//WMC - These are no longer needed so these spots are free
|
||||
#define WIF_HOMING_JAVELIN (1 << 8) // WC Saga Javelin HS style heatseeker, locks only on target's engines
|
||||
#define WIF_TURNS (1 << 9) // Set this if the weapon ever changes heading. If you
|
||||
// don't set this and the weapon turns, collision detection
|
||||
// won't work, I promise!
|
||||
#define WIF_SWARM (1 << 10) // Missile "swarms".. ie changes heading and twists on way to target
|
||||
#define WIF_TRAIL (1 << 11) // Has a trail
|
||||
#define WIF_BIG_ONLY (1 << 12) // Only big ships (cruiser, capital, etc.) can arm this weapon
|
||||
#define WIF_CHILD (1 << 13) // No ship can have this weapon. It gets created by weapon detonations.
|
||||
#define WIF_BOMB (1 << 14) // Bomb-type missile, can be targeted
|
||||
#define WIF_HUGE (1 << 15) // Huge damage (generally 500+), probably only fired at huge ships.
|
||||
#define WIF_NO_DUMBFIRE (1 << 16) // Missile cannot be fired dumbfire (ie requires aspect lock)
|
||||
#define WIF_THRUSTER (1 << 17) // Has thruster cone and/or glow
|
||||
#define WIF_IN_TECH_DATABASE (1 << 18)
|
||||
#define WIF_PLAYER_ALLOWED (1 << 19) // allowed to be on starting wing ships/in weaponry pool
|
||||
#define WIF_BOMBER_PLUS (1 << 20) // Fire this missile only at a bomber or big ship. But not a fighter.
|
||||
|
||||
#define WIF_CORKSCREW (1 << 21) // corkscrew style missile
|
||||
#define WIF_PARTICLE_SPEW (1 << 22) // spews particles as it travels
|
||||
#define WIF_EMP (1 << 23) // weapon explodes with a serious EMP effect
|
||||
#define WIF_ENERGY_SUCK (1 << 24) // energy suck primary (impact effect)
|
||||
#define WIF_FLAK (1 << 25) // use for big-ship turrets - flak gun
|
||||
#define WIF_BEAM (1 << 26) // if this is a beam weapon : NOTE - VERY SPECIAL CASE
|
||||
#define WIF_TAG (1 << 27) // this weapon has a tag effect when it hits
|
||||
#define WIF_SHUDDER (1 << 28) // causes the weapon to shudder. shudder is proportional to the mass and damage of the weapon
|
||||
#define WIF_LOCKARM (1 << 29) // if the missile was fired without a lock, it does significanlty less damage on impact
|
||||
#define WIF_STREAM (1 << 30) // handled by "trigger down/trigger up" instead of "fire - wait - fire - wait"
|
||||
// NOTE: the remaining WIF is reserved for a flag that truly needs to be in the WIF_ flag field,
|
||||
// as opposed to any typical new flag that can be added to WIF3
|
||||
|
||||
#define WIF2_BALLISTIC (1 << 0) // ballistic primaries - Goober5000
|
||||
#define WIF2_PIERCE_SHIELDS (1 << 1) // shield pierceing -Bobboau
|
||||
#define WIF2_DEFAULT_IN_TECH_DATABASE (1 << 2) // default in tech database - Goober5000
|
||||
#define WIF2_LOCAL_SSM (1 << 3) // localized ssm. ship that fires ssm is in mission. ssms also warp back in during mission
|
||||
#define WIF2_TAGGED_ONLY (1 << 4) // can only fire if target is tagged
|
||||
#define WIF2_CYCLE (1 << 5) // will only fire from (shots (defalts to 1)) points at a time
|
||||
#define WIF2_SMALL_ONLY (1 << 6) // can only be used against small ships like fighters or bombers
|
||||
#define WIF2_SAME_TURRET_COOLDOWN (1 << 7) // the weapon has the same cooldown time on turrets
|
||||
#define WIF2_MR_NO_LIGHTING (1 << 8) // don't render with lighting, regardless of user options
|
||||
#define WIF2_TRANSPARENT (1 << 9) // render as transparent
|
||||
#define WIF2_TRAINING (1 << 10) // Weapon does shield/hull damage, but doesn't hurt subsystems, whack you, or put marks on your ship.
|
||||
#define WIF2_SMART_SPAWN (1 << 11) // Spawn weapon that is fired via turrets like normal weapons
|
||||
#define WIF2_INHERIT_PARENT_TARGET (1 << 12) // child weapons home in on the target their parent is homing on.
|
||||
#define WIF2_NO_EMP_KILL (1 << 13) // though weapon has hitpoints it can not be disabled by EMP
|
||||
#define WIF2_VARIABLE_LEAD_HOMING (1 << 14) // allows user defined scaler to be added to lead (to enable, lead, pure or lag pursuit for missiles)
|
||||
#define WIF2_UNTARGETED_HEAT_SEEKER (1 << 15) // forces heat seeker to lose target immeadiately (and acquire a random new one)
|
||||
#define WIF2_HARD_TARGET_BOMB (1 << 16) // removes the radius doubling effect bombs have for collisions
|
||||
#define WIF2_NON_SUBSYS_HOMING (1 << 17) // spreads fired missiles around the target ships hull
|
||||
#define WIF2_NO_LIFE_LOST_IF_MISSED (1 << 18) // prevents game from shortening the lifeleft of the missed but still homing missiles
|
||||
#define WIF2_CUSTOM_SEEKER_STR (1 << 19) // sets the game to use custom seeker strengths instead of default values
|
||||
#define WIF2_CAN_BE_TARGETED (1 << 20) // allows non-bomb weapons to be targeted
|
||||
#define WIF2_SHOWN_ON_RADAR (1 << 21) // allows non-bombs be visible on radar
|
||||
#define WIF2_SHOW_FRIENDLY (1 << 22) // allows friendly weapon radar dots be drawn
|
||||
#define WIF2_CAPITAL_PLUS (1 << 23) // AI will not use this weapon on fighters or bombers
|
||||
#define WIF2_EXTERNAL_WEAPON_FP (1 << 24) // will try to use external models FPs if possible
|
||||
#define WIF2_EXTERNAL_WEAPON_LNCH (1 << 25) // render external secondary as a launcher
|
||||
#define WIF2_TAKES_BLAST_DAMAGE (1 << 26) // This weapon can take blast damage
|
||||
#define WIF2_TAKES_SHOCKWAVE_DAMAGE (1 << 27) // This weapon can take shockwave damage
|
||||
#define WIF2_DONT_SHOW_ON_RADAR (1 << 28) // Force a weapon to not show on radar
|
||||
#define WIF2_RENDER_FLAK (1 << 29) // Even though this is a flak weapon, render the shell
|
||||
#define WIF2_CIWS (1 << 30) // This weapons' burst and shockwave damage can damage bombs (Basically, a reverse for TAKES_BLAST/SHOCKWAVE_DAMAGE
|
||||
#define WIF2_ANTISUBSYSBEAM (1 << 31) // This beam can target subsystems as per normal
|
||||
|
||||
#define WIF3_NOLINK (1 << 0) // This weapon can not be linked with others
|
||||
#define WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS (1 << 1) // override MAX_TURRET_DISRUPT_TIME in emp.cpp - Goober5000
|
||||
#define WIF3_NO_LINKED_PENALTY (1 << 2) // This weapon does not count into linked firing penalty
|
||||
#define WIF3_NO_HOMING_SPEED_RAMP (1 << 3) // Disables the 1s long speed ramping when firing locked-on secondaries
|
||||
#define WIF3_CMEASURE_ASPECT_HOME_ON (1 << 4) // This countermeasure flag makes aspect seekers home on the countermeasure instead of going into dumbfire mode
|
||||
#define WIF3_TURRET_INTERCEPTABLE (1 << 5) // These two flags mark a weapon as being interceptable by the AI
|
||||
#define WIF3_FIGHTER_INTERCEPTABLE (1 << 6) // (like WIF_BOMB), without forcing it to be tagetable -MageKing17
|
||||
#define WIF3_AOE_ELECTRONICS (1 << 7) // Apply electronics effect across the weapon's entire area of effect instead of just on the impacted ship -MageKing17
|
||||
#define WIF3_APPLY_RECOIL (1 << 8) // Apply recoil using weapon and ship info
|
||||
#define WIF3_DONT_SPAWN_IF_SHOT (1 << 9) // Prevent shot down parent weapons from spawning children (DahBlount)
|
||||
#define WIF3_DIE_ON_LOST_LOCK (1 << 10) // WIF_LOCKED_HOMING missiles will die if they lose their lock
|
||||
|
||||
#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 // Delay in milliseconds between exhaust blobs
|
||||
|
||||
#define WF_LOCK_WARNING_PLAYED (1<<0) // set when a lock warning sound is played for the player
|
||||
@@ -398,9 +306,7 @@ typedef struct weapon_info {
|
||||
float max_lifetime ; // How long this weapon will actually live for
|
||||
float lifetime; // How long the AI thinks this thing lives (used for distance calculations etc)
|
||||
float energy_consumed; // Energy used up when weapon is fired
|
||||
int wi_flags; // bit flags defining behavior, see WIF_xxxx
|
||||
int wi_flags2; // stupid int wi_flags, only 32 bits... argh - Goober5000
|
||||
int wi_flags3; // stupid int wi_flags2, only 32 bits... argh - The E
|
||||
flagset<Weapon::Info_Flags> wi_flags; // bit flags defining behavior, see WIF_xxxx
|
||||
float turn_time;
|
||||
float cargo_size; // cargo space taken up by individual weapon (missiles only)
|
||||
float rearm_rate; // rate per second at which secondary weapons are loaded during rearming
|
||||
@@ -570,6 +476,11 @@ typedef struct weapon_info {
|
||||
public:
|
||||
weapon_info();
|
||||
|
||||
inline bool is_homing() { return wi_flags[Weapon::Info_Flags::Homing_heat, Weapon::Info_Flags::Homing_aspect, Weapon::Info_Flags::Homing_javelin]; }
|
||||
inline bool is_locked_homing() { return wi_flags[Weapon::Info_Flags::Homing_aspect, Weapon::Info_Flags::Homing_javelin]; }
|
||||
inline bool hurts_big_ships() { return wi_flags[Weapon::Info_Flags::Bomb, Weapon::Info_Flags::Beam, Weapon::Info_Flags::Huge, Weapon::Info_Flags::Big_only]; }
|
||||
inline bool is_interceptable() { return wi_flags[Weapon::Info_Flags::Fighter_Interceptable, Weapon::Info_Flags::Turret_Interceptable]; }
|
||||
|
||||
void reset();
|
||||
} weapon_info;
|
||||
|
||||
|
||||
@@ -81,8 +81,9 @@ namespace Weapon {
|
||||
Apply_Recoil, // Apply Recoil
|
||||
Dont_spawn_if_shot, // Prevent shot down parent weapons from spawning children (DahBlount)
|
||||
Die_on_lost_lock, // WIF_LOCKED_HOMING missiles will die if they lose their lock
|
||||
|
||||
NUM_VALUES
|
||||
Apply_recoil, // Apply recoil using weapon and ship info
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Weapon_Flags) {
|
||||
|
||||
+377
-443
File diff suppressed because it is too large.
Load diff
@@ -882,7 +882,7 @@ void clear_mission()
|
||||
|
||||
count = 0;
|
||||
for (j=0; j<MAX_WEAPON_TYPES; j++){
|
||||
if (Weapon_info[j].wi_flags & WIF_PLAYER_ALLOWED){
|
||||
if (Weapon_info[j].wi_flags[Weapon::Info_Flags::Player_allowed]){
|
||||
if(Weapon_info[j].subtype == WP_LASER){
|
||||
Team_data[i].weaponry_count[count] = 16;
|
||||
} else {
|
||||
|
||||
@@ -305,7 +305,7 @@ void player_start_editor::reset_controls()
|
||||
m_weapon_list.ResetContent();
|
||||
ct = 0;
|
||||
for (i=0; i<Num_weapon_types; i++) {
|
||||
if (Weapon_info[i].wi_flags & WIF_PLAYER_ALLOWED) {
|
||||
if (Weapon_info[i].wi_flags[Weapon::Info_Flags::Player_allowed]) {
|
||||
m_weapon_list.AddString(Weapon_info[i].name);
|
||||
|
||||
// if the ship currently has pool entries or was set by a variable, check it
|
||||
|
||||
+1
-1
@@ -5721,7 +5721,7 @@ sexp_list_item *sexp_tree::get_listing_opf_huge_weapon()
|
||||
sexp_list_item head;
|
||||
|
||||
for (i=0; i<Num_weapon_types; i++) {
|
||||
if (Weapon_info[i].wi_flags & WIF_HUGE)
|
||||
if (Weapon_info[i].wi_flags[Weapon::Info_Flags::Huge])
|
||||
head.add_data(Weapon_info[i].name);
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ BOOL WeaponEditorDlg::OnInitDialog()
|
||||
}
|
||||
|
||||
for (i=0; i<end1; i++){
|
||||
if ((Weapon_info[i].wi_flags & WIF_CHILD) || (!big && (Weapon_info[i].wi_flags & WIF_BIG_ONLY))){
|
||||
if ((Weapon_info[i].wi_flags[Weapon::Info_Flags::Child]) || (!big && (Weapon_info[i].wi_flags[Weapon::Info_Flags::Big_only]))){
|
||||
end1 = i;
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ BOOL WeaponEditorDlg::OnInitDialog()
|
||||
}
|
||||
|
||||
for (i=First_secondary_index; i<end2; i++){
|
||||
if ((Weapon_info[i].wi_flags & WIF_CHILD) || (!big && (Weapon_info[i].wi_flags & WIF_BIG_ONLY))){
|
||||
if ((Weapon_info[i].wi_flags[Weapon::Info_Flags::Child]) || (!big && (Weapon_info[i].wi_flags[Weapon::Info_Flags::Big_only]))){
|
||||
end2 = i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user