mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
Bitset flags -- take 2 (#775)
This introduces a new mechanism for handling bit flags. Instead of using an int (or two, or three) to write bits into, this uses the std::bitset in a wrapper class that accepts an enum class as input. This means that certain classes of errors we've had a few of in the engine, where a coder used the wrong set of flags or checked them against the wrong variable (SF_STEALTH vs SIF_STEALTH, for example) can now be detected at a compiler level rather than not at all.
This commit is contained in:
1 parent
1ea71d2ba6
commit
770fce8de5
132 files changed
+5500
-5448
No files matched your search
+14
-14
@@ -510,7 +510,7 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
|
||||
{
|
||||
// if moving slowly (or stopped), and SIF_SMALL_SHIP, then enter STRAFE mode if enemy fighter/bombers
|
||||
// are near
|
||||
if ( sip->flags & SIF_SMALL_SHIP ) {
|
||||
if ( sip->is_small_ship() ) {
|
||||
if ( timestamp_elapsed(aip->scan_for_enemy_timestamp) ) {
|
||||
ship_obj *so;
|
||||
object *test_objp;
|
||||
@@ -525,7 +525,7 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
|
||||
test_sp = &Ships[test_objp->instance];
|
||||
|
||||
if ( iff_x_attacks_y(Ships[Pl_objp->instance].team, test_sp->team) ) {
|
||||
if ( Ship_info[test_sp->ship_info_index].flags & SIF_SMALL_SHIP ) {
|
||||
if ( Ship_info[test_sp->ship_info_index].is_small_ship() ) {
|
||||
dist_squared = vm_vec_dist_squared(&Pl_objp->pos, &test_objp->pos);
|
||||
if ( dist_squared < ENTER_STRAFE_THREAT_DIST_SQUARED ) {
|
||||
return 1;
|
||||
@@ -641,7 +641,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
|
||||
accelerate_ship(aip, 1.0f);
|
||||
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags2 & SF2_AFTERBURNER_LOCKED) && (dot_to_enemy > 0.75f)) {
|
||||
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked]) && (dot_to_enemy > 0.75f)) {
|
||||
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
|
||||
afterburners_start(Pl_objp);
|
||||
aip->afterburner_stop_time = Missiontime + 3*F1_0;
|
||||
@@ -683,7 +683,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
|
||||
accelerate_ship(aip, accel);
|
||||
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags2 & SF2_AFTERBURNER_LOCKED) && (accel > 0.95f)) {
|
||||
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked]) && (accel > 0.95f)) {
|
||||
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
|
||||
afterburners_start(Pl_objp);
|
||||
aip->afterburner_stop_time = Missiontime + 3*F1_0;
|
||||
@@ -748,15 +748,15 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
|
||||
}
|
||||
|
||||
if (tswp->num_secondary_banks > 0) {
|
||||
if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
|
||||
if (!(En_objp->flags[Object::Object_Flags::Protected]) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
|
||||
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
|
||||
int current_bank = tswp->current_secondary_bank;
|
||||
if (current_bank > -1) {
|
||||
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
|
||||
|
||||
if(!(En_objp->flags & OF_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 & WIF_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 & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage)) {
|
||||
if (!(En_objp->flags[Object::Object_Flags::Protected]) || (En_objp->hull_strength > 10*swip->damage)) {
|
||||
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
|
||||
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
|
||||
@@ -771,7 +771,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
// reduce firing range of secondaries in nebula
|
||||
extern int Nebula_sec_range;
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
if ((The_mission.flags[Mission::Mission_Flags::Fullneb]) && Nebula_sec_range) {
|
||||
firing_range *= 0.8f;
|
||||
}
|
||||
|
||||
@@ -914,7 +914,7 @@ void ai_big_chase()
|
||||
dist_to_enemy = vm_vec_normalized_dir(&vec_to_enemy, &enemy_pos, &player_pos); // - En_objp->radius;
|
||||
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
|
||||
update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy, En_objp->radius);
|
||||
} else if (En_objp->flags & OF_PROTECTED) { // If protected and we're not attacking a subsystem, stop attacking!
|
||||
} else if (En_objp->flags[Object::Object_Flags::Protected]) { // If protected and we're not attacking a subsystem, stop attacking!
|
||||
update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy - En_objp->radius, En_objp->radius);
|
||||
aip->target_objnum = -1;
|
||||
if (find_enemy(OBJ_INDEX(Pl_objp), MAX_ENEMY_DISTANCE, The_mission.ai_profile->max_attackers[Game_skill_level]) == -1) {
|
||||
@@ -1174,7 +1174,7 @@ void ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float *dot_t
|
||||
Assert(aip->mode == AIM_STRAFE);
|
||||
|
||||
// ensure that Pl_objp is still targeting a big ship
|
||||
if ( !(esip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( !(esip->is_big_or_huge()) ) {
|
||||
ai_big_switch_to_chase_mode(aip);
|
||||
return;
|
||||
}
|
||||
@@ -1654,7 +1654,7 @@ void ai_big_strafe()
|
||||
}
|
||||
*/
|
||||
// check if target is still a big ship... if not enter chase mode
|
||||
if ( !(Ship_info[Ships[En_objp->instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
|
||||
if ( !(Ship_info[Ships[En_objp->instance].ship_info_index].is_big_or_huge()) ) {
|
||||
ai_big_switch_to_chase_mode(aip);
|
||||
return;
|
||||
}
|
||||
@@ -1727,12 +1727,12 @@ int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consi
|
||||
|
||||
// if Pl_objp's target is not a big/capital ship, then cannot enter strafe mode
|
||||
// AL 12-31-97: Even though transports are considered big ships, don't enter strafe mode on them
|
||||
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) || (sip->flags & SIF_TRANSPORT) ) {
|
||||
if ( !(sip->is_big_or_huge()) || (sip->flags[Ship::Info_Flags::Transport]) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If Pl_objp not a fighter or bomber, don't enter strafe mode. -- MK, 11/11/97.
|
||||
if ( !(Ship_info[Ships[pl_objp->instance].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) ) {
|
||||
if ( !(Ship_info[Ships[pl_objp->instance].ship_info_index].is_fighter_bomber()) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1754,7 +1754,7 @@ int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consi
|
||||
//JAS IMPOSSIBLE } else {
|
||||
// switch targets
|
||||
sip = &Ship_info[Ships[parent_objp->instance].ship_info_index];
|
||||
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) || (sip->flags & SIF_TRANSPORT) ) {
|
||||
if ( !(sip->is_big_or_huge()) || (sip->flags[Ship::Info_Flags::Transport]) ) {
|
||||
return 0;
|
||||
}
|
||||
set_target_objnum(aip, OBJ_INDEX(parent_objp));
|
||||
|
||||
+208
-201
File diff suppressed because it is too large.
Load diff
+8
-8
@@ -584,10 +584,10 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
|
||||
// look for docking points of the appriopriate type. Use cargo docks for cargo ships.
|
||||
/*
|
||||
if (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO) {
|
||||
if (Ship_info[Ships[shipnum].ship_info_index].flags[Ship::Info_Flags::Cargo]) {
|
||||
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_CARGO);
|
||||
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_CARGO);
|
||||
} else if (Ship_info[Ships[aip->shipnum].ship_info_index].flags & SIF_SUPPORT) {
|
||||
} else if (Ship_info[Ships[aip->shipnum].ship_info_index].flags[Ship::Info_Flags::Support]) {
|
||||
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_REARM);
|
||||
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_REARM);
|
||||
}
|
||||
@@ -1387,7 +1387,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
|
||||
// always valid if has subspace drive
|
||||
if (!(shipp->flags2 & SF2_NO_SUBSPACE_DRIVE))
|
||||
if (!(shipp->flags[Ship::Ship_Flags::No_subspace_drive]))
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
|
||||
// if no subspace drive, only valid if our mothership is present
|
||||
@@ -1661,7 +1661,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
}
|
||||
|
||||
// if ship is disabled, don't know if it can dock or not
|
||||
if ( Ships[objp->instance].flags & SF_DISABLED )
|
||||
if ( Ships[objp->instance].flags[Ship::Ship_Flags::Disabled] )
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
|
||||
// we must also determine if we're prevented from docking for any reason
|
||||
@@ -1807,7 +1807,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
|
||||
// if the destination ship is dying or departing (but not completed yet), the mark goal as
|
||||
// not achievable.
|
||||
if ( Ships[sindex].flags & (SF_DYING | SF_DEPARTING) )
|
||||
if ( Ships[sindex].is_dying_or_departing())
|
||||
return AI_GOAL_NOT_ACHIEVABLE;
|
||||
|
||||
// if the destination object is no longer awaiting repair, then remove the item
|
||||
@@ -2042,7 +2042,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
|
||||
// Goober5000 - we may want to use AI for the player
|
||||
// AL 3-7-98: If this is a player ship, and the goal is not a formation goal, then do a quick out
|
||||
if ( !(Player_use_ai) && (objp->flags & OF_PLAYER_SHIP) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) )
|
||||
if ( !(Player_use_ai) && (objp->flags[Object::Object_Flags::Player_ship]) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2199,11 +2199,11 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
if (aip->target_objnum != -1) {
|
||||
// Only protect if _not_ a capital ship. We don't want the Lucifer accidentally getting protected.
|
||||
if (Ship_types[Ship_info[Ships[shipnum].ship_info_index].class_type].ai_bools & STI_AI_PROTECTED_ON_CRIPPLE)
|
||||
Objects[aip->target_objnum].flags |= OF_PROTECTED;
|
||||
Objects[aip->target_objnum].flags.set(Object::Object_Flags::Protected);
|
||||
}
|
||||
} else // Just in case this ship had been protected, unprotect it.
|
||||
if (aip->target_objnum != -1)
|
||||
Objects[aip->target_objnum].flags &= ~OF_PROTECTED;
|
||||
Objects[aip->target_objnum].flags.remove(Object::Object_Flags::Protected);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
+49
-49
@@ -522,17 +522,17 @@ int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// don't fire at ships with protected bit set!!!
|
||||
if ( objp->flags & OF_PROTECTED ) {
|
||||
if ( objp->flags[Object::Object_Flags::Protected] ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// don't shoot at ships without collision check
|
||||
if (!(objp->flags & OF_COLLIDES)) {
|
||||
if (!(objp->flags[Object::Object_Flags::Collides])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// don't shoot at arriving ships
|
||||
if (shipp->flags & SF_ARRIVING) {
|
||||
if (shipp->is_arriving()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -604,48 +604,48 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
}
|
||||
|
||||
// check if protected
|
||||
if (objp->flags & OF_PROTECTED) {
|
||||
if (objp->flags[Object::Object_Flags::Protected]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check if beam protected
|
||||
if (eeo->eeo_flags & EEOF_BEAM) {
|
||||
if (objp->flags & OF_BEAM_PROTECTED) {
|
||||
if (objp->flags[Object::Object_Flags::Beam_protected]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check if flak protected
|
||||
if (eeo->eeo_flags & EEOF_FLAK) {
|
||||
if (objp->flags & OF_FLAK_PROTECTED) {
|
||||
if (objp->flags[Object::Object_Flags::Flak_protected]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check if laser protected
|
||||
if (eeo->eeo_flags & EEOF_LASER) {
|
||||
if (objp->flags & OF_LASER_PROTECTED) {
|
||||
if (objp->flags[Object::Object_Flags::Laser_protected]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check if missile protected
|
||||
if (eeo->eeo_flags & EEOF_MISSILE) {
|
||||
if (objp->flags & OF_MISSILE_PROTECTED) {
|
||||
if (objp->flags[Object::Object_Flags::Missile_protected]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// don't shoot at small ships if we shouldn't
|
||||
if (eeo->eeo_flags & EEOF_BIG_ONLY) {
|
||||
if (!(Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
if (!(Ship_info[shipp->ship_info_index].is_big_or_huge())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// don't shoot at big ships if we shouldn't
|
||||
if (eeo->eeo_flags & EEOF_SMALL_ONLY) {
|
||||
if ((Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
if ((Ship_info[shipp->ship_info_index].is_big_or_huge())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -753,7 +753,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
} // end weapon section
|
||||
|
||||
// maybe recalculate dist for big or huge ship
|
||||
// if (shipp && (Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
// if (shipp && (Ship_info[shipp->ship_info_index].is_big_or_huge())) {
|
||||
// fvi_ray_boundingbox(min, max, start, direction, hit);
|
||||
// dist = vm_vec_dist_quick(hit, tvec);
|
||||
// }
|
||||
@@ -770,11 +770,11 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
// return if we're over the cap
|
||||
// int max_turrets = 3 + Game_skill_level * Game_skill_level;
|
||||
int max_turrets = The_mission.ai_profile->max_turret_ownage_target[Game_skill_level];
|
||||
if (objp->flags & OF_PLAYER_SHIP) {
|
||||
if (objp->flags[Object::Object_Flags::Player_ship]) {
|
||||
max_turrets = The_mission.ai_profile->max_turret_ownage_player[Game_skill_level];
|
||||
}
|
||||
// Apply the per-turret limit for small targets, if there is one and this is a small target
|
||||
if (ss->turret_max_target_ownage != -1 && (Ship_info[shipp->ship_info_index].flags & (SIF_SMALL_SHIP))) {
|
||||
if (ss->turret_max_target_ownage != -1 && (Ship_info[shipp->ship_info_index].is_small_ship())) {
|
||||
max_turrets = MIN(max_turrets, ss->system_info->turret_max_target_ownage);
|
||||
}
|
||||
if (num_att_turrets > max_turrets) {
|
||||
@@ -783,7 +783,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
|
||||
// modify distance based on lethality of objp to my ship
|
||||
float active_lethality = aip->lethality;
|
||||
if (objp->flags & OF_PLAYER_SHIP) {
|
||||
if (objp->flags[Object::Object_Flags::Player_ship]) {
|
||||
active_lethality += Player_lethality_bump[Game_skill_level];
|
||||
}
|
||||
|
||||
@@ -843,12 +843,12 @@ 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 (objp->flags & OF_BEAM_PROTECTED) {
|
||||
if (objp->flags[Object::Object_Flags::Beam_protected]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (all_turret_weapons_have_flags(swp, WIF_HUGE)) {
|
||||
if (objp->type == OBJ_SHIP && !(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
|
||||
if (objp->type == OBJ_SHIP && !(Ship_info[Ships[objp->instance].ship_info_index].is_big_or_huge()) ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1015,14 +1015,14 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
}
|
||||
}
|
||||
|
||||
if( ( ( tt->sif_flags != 0 ) || ( tt->sif2_flags != 0 ) ) && (ptr->type == OBJ_SHIP) ) {
|
||||
if( ( (Ship_info[Ships[ptr->instance].ship_info_index].flags & tt->sif_flags) == tt->sif_flags)
|
||||
&& ( (Ship_info[Ships[ptr->instance].ship_info_index].flags2 & tt->sif2_flags) == tt->sif2_flags) ) {
|
||||
found_something = true;
|
||||
if( ( tt->sif_flags.any_set() && (ptr->type == OBJ_SHIP) ) ) {
|
||||
if( (Ship_info[Ships[ptr->instance].ship_info_index].flags & tt->sif_flags) == tt->sif_flags)
|
||||
{
|
||||
found_something = true;
|
||||
}
|
||||
}
|
||||
|
||||
if((tt->obj_flags != 0) && !((ptr->flags & tt->obj_flags) == tt->obj_flags)) {
|
||||
if ((tt->obj_flags.any_set()) && !((ptr->flags & tt->obj_flags) == tt->obj_flags)) {
|
||||
found_something = true;
|
||||
}
|
||||
|
||||
@@ -1209,7 +1209,7 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
|
||||
|
||||
if (Objects[target_objnum].signature == aip->target_signature) {
|
||||
if (iff_matches_mask(Ships[Objects[target_objnum].instance].team, enemy_team_mask)) {
|
||||
if ( !(Objects[target_objnum].flags & OF_PROTECTED) ) { // check this flag as well
|
||||
if ( !(Objects[target_objnum].flags[Object::Object_Flags::Protected]) ) { // check this flag as well
|
||||
// nprintf(("AI", "Frame %i: Object %i resuming goal of object %i\n", AI_FrameCount, objnum, target_objnum));
|
||||
return target_objnum;
|
||||
}
|
||||
@@ -1224,8 +1224,8 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
|
||||
if ((frand() < 0.8f) && (aip->target_objnum != -1) && Use_parent_target) {
|
||||
|
||||
//check if aip->target_objnum is valid target
|
||||
int target_flags = Objects[aip->target_objnum].flags;
|
||||
if ( target_flags & OF_PROTECTED ) {
|
||||
auto target_flags = Objects[aip->target_objnum].flags;
|
||||
if ( target_flags[Object::Object_Flags::Protected] ) {
|
||||
// AL 2-27-98: why is a protected ship being targeted?
|
||||
set_target_objnum(aip, -1);
|
||||
return -1;
|
||||
@@ -1234,15 +1234,15 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
|
||||
// maybe use ship target_objnum if valid for turret
|
||||
// check for beam weapon and beam protected, etc.
|
||||
bool skip = false;
|
||||
if ( (target_flags & OF_BEAM_PROTECTED) && beam_flag ) skip = true;
|
||||
else if ( (target_flags & OF_FLAK_PROTECTED) && flak_flag ) skip = true;
|
||||
else if ( (target_flags & OF_LASER_PROTECTED) && laser_flag ) skip = true;
|
||||
else if ( (target_flags & OF_MISSILE_PROTECTED) && missile_flag ) skip = true;
|
||||
if ( target_flags[Object::Object_Flags::Beam_protected] && beam_flag ) skip = true;
|
||||
else if ( target_flags[Object::Object_Flags::Flak_protected] && flak_flag ) skip = true;
|
||||
else if ( target_flags[Object::Object_Flags::Laser_protected] && laser_flag ) skip = true;
|
||||
else if ( target_flags[Object::Object_Flags::Missile_protected] && missile_flag) skip = true;
|
||||
|
||||
if (!skip) {
|
||||
if ( Objects[aip->target_objnum].type == OBJ_SHIP ) {
|
||||
// check for huge weapon and huge ship
|
||||
if ( !big_only_flag || (Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
|
||||
if ( !big_only_flag || (Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].is_big_or_huge()) ) {
|
||||
// check for tagged only and tagged ship
|
||||
if ( tagged_only_flag && ship_is_tagged(&Objects[aip->target_objnum]) ) {
|
||||
// select new target if aip->target_objnum is out of field of view
|
||||
@@ -1272,12 +1272,12 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
|
||||
|
||||
enemy_objnum = get_nearest_turret_objnum(objnum, turret_subsys, enemy_team_mask, tpos, tvec, current_enemy, big_only_flag, small_only_flag, tagged_only_flag, beam_flag, flak_flag, laser_flag, missile_flag);
|
||||
if ( enemy_objnum >= 0 ) {
|
||||
Assert( !((Objects[enemy_objnum].flags & OF_BEAM_PROTECTED) && beam_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags & OF_FLAK_PROTECTED) && flak_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags & OF_LASER_PROTECTED) && laser_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags & OF_MISSILE_PROTECTED) && missile_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Beam_protected]) && beam_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Flak_protected]) && flak_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Laser_protected]) && laser_flag) );
|
||||
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Missile_protected]) && missile_flag) );
|
||||
|
||||
if ( Objects[enemy_objnum].flags & OF_PROTECTED ) {
|
||||
if ( Objects[enemy_objnum].flags[Object::Object_Flags::Protected] ) {
|
||||
Int3();
|
||||
enemy_objnum = aip->target_objnum;
|
||||
}
|
||||
@@ -1364,7 +1364,7 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
|
||||
vm_vec_unrotate(&enemy_point, &ssp->targeted_subsys->system_info->pnt, &Objects[ssp->turret_enemy_objnum].orient);
|
||||
vm_vec_add2(&enemy_point, &ssp->last_aim_enemy_pos);
|
||||
} else {
|
||||
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge())) {
|
||||
vm_vec_unrotate(&turret_norm, &tp->turret_norm, &objp->orient);
|
||||
ai_big_pick_attack_point_turret(lep, ssp, &tmp_pos, &turret_norm, &enemy_point, MIN(wip->max_speed * wip->lifetime, wip->weapon_range), tp->turret_fov);
|
||||
}
|
||||
@@ -1462,7 +1462,7 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
|
||||
vm_vec_add2(&enemy_point, &ss->last_aim_enemy_pos);
|
||||
}
|
||||
} else {
|
||||
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge())) {
|
||||
ai_big_pick_attack_point_turret(lep, ss, &gun_pos, &gun_vec, &enemy_point, tp->turret_fov, MIN(wip->max_speed * wip->lifetime, wip->weapon_range));
|
||||
} else {
|
||||
enemy_point = ss->last_aim_enemy_pos;
|
||||
@@ -1616,7 +1616,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
|
||||
vm_vec_add2(&abs_gun_pos, &objp->pos);
|
||||
|
||||
// Only pick a turret to attack on large ships.
|
||||
if (!(esip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)))
|
||||
if (!esip->is_big_or_huge())
|
||||
return best_subsysp;
|
||||
|
||||
// Make sure big or huge ship *actually* has subsystems (ie, knossos)
|
||||
@@ -1868,22 +1868,22 @@ 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 & OF_BEAM_PROTECTED) ) {
|
||||
if ( (wip->wi_flags & WIF_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 & OF_FLAK_PROTECTED) ) {
|
||||
else if ( (wip->wi_flags & WIF_FLAK) && (tobjp->flags[Object::Object_Flags::Flak_protected]) ) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
// should not get this far. check if ship is protected from laser and weapon is type laser
|
||||
else if ( (wip->subtype == WP_LASER) && (tobjp->flags & OF_LASER_PROTECTED) ) {
|
||||
else if ( (wip->subtype == WP_LASER) && (tobjp->flags[Object::Object_Flags::Laser_protected]) ) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
// should not get this far. check if ship is protected from missile and weapon is type missile
|
||||
else if ( (wip->subtype == WP_MISSILE) && (tobjp->flags & OF_MISSILE_PROTECTED) ) {
|
||||
else if ( (wip->subtype == WP_MISSILE) && (tobjp->flags[Object::Object_Flags::Missile_protected]) ) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
@@ -2442,13 +2442,13 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
if ( lep->type != OBJ_SHIP ) {
|
||||
continue;
|
||||
}
|
||||
if ( !(Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( !(Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge()) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( wip->wi_flags2 & WIF2_SMALL_ONLY ) {
|
||||
if ( (lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( (lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge()) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2457,32 +2457,32 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
|
||||
if (lep->type == OBJ_SHIP) {
|
||||
// Check if we're targeting a protected ship
|
||||
if (lep->flags & OF_PROTECTED) {
|
||||
if (lep->flags[Object::Object_Flags::Protected]) {
|
||||
ss->turret_enemy_objnum = -1;
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if we're targeting a beam protected ship with a beam weapon
|
||||
if ( (lep->flags & OF_BEAM_PROTECTED) && (wip->wi_flags & WIF_BEAM) ) {
|
||||
if ( (lep->flags[Object::Object_Flags::Beam_protected]) && (wip->wi_flags & WIF_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 & OF_FLAK_PROTECTED) && (wip->wi_flags & WIF_FLAK) ) {
|
||||
else if ( (lep->flags[Object::Object_Flags::Flak_protected]) && (wip->wi_flags & WIF_FLAK) ) {
|
||||
ss->turret_enemy_objnum = -1;
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
}
|
||||
// Check if we're targeting a laser protected ship with a laser weapon
|
||||
else if ( (lep->flags & OF_LASER_PROTECTED) && (wip->subtype == WP_LASER) ) {
|
||||
else if ( (lep->flags[Object::Object_Flags::Laser_protected]) && (wip->subtype == WP_LASER) ) {
|
||||
ss->turret_enemy_objnum = -1;
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
}
|
||||
// Check if we're targeting a missile protected ship with a missile weapon
|
||||
else if ( (lep->flags & OF_MISSILE_PROTECTED) && (wip->subtype == WP_MISSILE) ) {
|
||||
else if ( (lep->flags[Object::Object_Flags::Missile_protected]) && (wip->subtype == WP_MISSILE) ) {
|
||||
ss->turret_enemy_objnum = -1;
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
continue;
|
||||
@@ -2563,7 +2563,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Objects[ss->turret_enemy_objnum].flags & OF_PROTECTED) {
|
||||
if (Objects[ss->turret_enemy_objnum].flags[Object::Object_Flags::Protected]) {
|
||||
// This can happen if the enemy was selected before it became protected.
|
||||
ss->turret_enemy_objnum = -1;
|
||||
return;
|
||||
|
||||
+15
-11
@@ -320,8 +320,12 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
|
||||
}
|
||||
|
||||
vm_angles_2_matrix(&orient, &angs);
|
||||
|
||||
objnum = obj_create( OBJ_ASTEROID, -1, n, &orient, &pos, radius, OF_RENDERS | OF_PHYSICS | OF_COLLIDES);
|
||||
flagset<Object::Object_Flags> asteroid_default_flagset;
|
||||
asteroid_default_flagset += Object::Object_Flags::Renders;
|
||||
asteroid_default_flagset += Object::Object_Flags::Physics;
|
||||
asteroid_default_flagset += Object::Object_Flags::Collides;
|
||||
|
||||
objnum = obj_create(OBJ_ASTEROID, -1, n, &orient, &pos, radius, asteroid_default_flagset);
|
||||
|
||||
if ( (objnum == -1) || (objnum >= MAX_OBJECTS) ) {
|
||||
mprintf(("Couldn't create asteroid -- out of object slots\n"));
|
||||
@@ -804,7 +808,7 @@ void maybe_throw_asteroid(int count)
|
||||
|
||||
// if asteroid is inside inner bound, kill it
|
||||
if (asteroid_in_inner_bound(&Asteroid_field, &objp->pos, 0.0f)) {
|
||||
objp->flags |= OF_SHOULD_BE_DEAD;
|
||||
objp->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
} else {
|
||||
Asteroids[objp->instance].target_objnum = so->objnum;
|
||||
|
||||
@@ -870,7 +874,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
|
||||
|
||||
if ( (dot < 0.7f) || (dist > asfieldp->bound_rad) ) {
|
||||
if (Num_asteroids > MAX_ASTEROIDS-10) {
|
||||
objp->flags |= OF_SHOULD_BE_DEAD;
|
||||
objp->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
} else {
|
||||
// check to ensure player won't see asteroid appear either
|
||||
asteroid_wrap_pos(objp, asfieldp);
|
||||
@@ -1336,7 +1340,7 @@ void asteroid_do_area_effect(object *asteroid_objp)
|
||||
ship_objp = &Objects[so->objnum];
|
||||
|
||||
// don't blast navbuoys
|
||||
if ( ship_get_SIF(ship_objp->instance) & SIF_NAVBUOY ) {
|
||||
if ( ship_get_SIF(ship_objp->instance)[Ship::Info_Flags::Navbuoy] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1363,7 +1367,7 @@ void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, f
|
||||
|
||||
asp = &Asteroids[pasteroid_obj->instance];
|
||||
|
||||
if (pasteroid_obj->flags & OF_SHOULD_BE_DEAD){
|
||||
if (pasteroid_obj->flags[Object::Object_Flags::Should_be_dead]){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1419,7 +1423,7 @@ void asteroid_level_close()
|
||||
if (Asteroids[i].flags & AF_USED) {
|
||||
Asteroids[i].flags &= ~AF_USED;
|
||||
Assert(Asteroids[i].objnum >=0 && Asteroids[i].objnum < MAX_OBJECTS);
|
||||
Objects[Asteroids[i].objnum].flags |= OF_SHOULD_BE_DEAD;
|
||||
Objects[Asteroids[i].objnum].flags.set(Object::Object_Flags::Should_be_dead);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,7 +1488,7 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
|
||||
Script_system.SetHookObject("Self", pasteroid_obj);
|
||||
if(!Script_system.IsConditionOverride(CHA_DEATH, pasteroid_obj))
|
||||
{
|
||||
pasteroid_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
pasteroid_obj->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
|
||||
// multiplayer clients won't go through the following code. asteroid_sub_create will send
|
||||
// a create packet to the client in the above named function
|
||||
@@ -1669,11 +1673,11 @@ int asteroid_will_collide(object *pasteroid_obj, object *escort_objp)
|
||||
*/
|
||||
int asteroid_valid_ship_to_warn_collide(ship *shipp)
|
||||
{
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( !(Ship_info[shipp->ship_info_index].is_big_or_huge()) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( shipp->flags & (SF_DYING|SF_DEPART_WARP) ) {
|
||||
if ( shipp->flags[Ship::Ship_Flags::Dying] || shipp->flags[Ship::Ship_Flags::Depart_warp] ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2095,7 +2099,7 @@ int set_asteroid_throw_objnum()
|
||||
ship_objp = &Objects[so->objnum];
|
||||
float radius = ship_objp->radius*2.0f;
|
||||
|
||||
if (Ship_info[Ships[ship_objp->instance].ship_info_index].flags & (SIF_HUGE_SHIP | SIF_BIG_SHIP)) {
|
||||
if (Ship_info[Ships[ship_objp->instance].ship_info_index].is_big_or_huge()) {
|
||||
if (ship_objp->pos.xyz.x + radius > Asteroid_field.min_bound.xyz.x)
|
||||
if (ship_objp->pos.xyz.y + radius > Asteroid_field.min_bound.xyz.y)
|
||||
if (ship_objp->pos.xyz.z + radius > Asteroid_field.min_bound.xyz.z)
|
||||
|
||||
@@ -178,7 +178,7 @@ bool CanAutopilot(vec3d targetPos, bool send_msg)
|
||||
object *other_objp = &Objects[so->objnum];
|
||||
// attacks player?
|
||||
if (iff_x_attacks_y(obj_team(other_objp), obj_team(Player_obj))
|
||||
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags & SIF_CARGO)) // ignore cargo
|
||||
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags[Ship::Info_Flags::Cargo])) // ignore cargo
|
||||
{
|
||||
// Cannot autopilot if enemy within AutopilotMinEnemyDistance meters
|
||||
if (vm_vec_dist_quick(&targetPos, &other_objp->pos) < AutopilotMinEnemyDistance) {
|
||||
@@ -233,7 +233,7 @@ bool StartAutopilot()
|
||||
// If the support ship is doing something then tell the user such.
|
||||
for ( object *objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) )
|
||||
{
|
||||
if ((objp->type == OBJ_SHIP) && !(objp->flags & OF_SHOULD_BE_DEAD))
|
||||
if ((objp->type == OBJ_SHIP) && !(objp->flags[Object::Object_Flags::Should_be_dead]))
|
||||
{
|
||||
Assertion((objp->instance >= 0) && (objp->instance < MAX_SHIPS),
|
||||
"objp does not have a valid pointer to a ship. Pointer is %d, which is smaller than 0 or bigger than %d",
|
||||
@@ -248,11 +248,11 @@ bool StartAutopilot()
|
||||
shipp->ship_name, shipp->ship_info_index, static_cast<int>(Ship_info.size()));
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if ( !(sip->flags & SIF_SUPPORT) )
|
||||
if ( !(sip->flags[Ship::Info_Flags::Support]) )
|
||||
continue;
|
||||
|
||||
// don't deal with dying or departing support ships
|
||||
if ( shipp->flags & (SF_DYING | SF_DEPARTING) )
|
||||
if ( shipp->is_dying_or_departing() )
|
||||
continue;
|
||||
|
||||
Assert(shipp->ai_index != -1);
|
||||
@@ -286,7 +286,7 @@ bool StartAutopilot()
|
||||
Autopilot_flight_leader = Player_obj;
|
||||
}
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
LockAPConv = timestamp(); // lock convergence instantly
|
||||
else
|
||||
LockAPConv = timestamp(3000); // 3 seconds before we lock convergence
|
||||
@@ -325,7 +325,7 @@ bool StartAutopilot()
|
||||
|
||||
|
||||
// instantly turn player toward tpos
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
{
|
||||
vm_vec_sub(&norm1, Navs[CurrentNav].GetPosition(), &Player_obj->pos);
|
||||
vm_vector_2_matrix(&Player_obj->orient, &norm1, NULL, NULL);
|
||||
@@ -334,7 +334,7 @@ bool StartAutopilot()
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1 &&
|
||||
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
(Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
|
||||
)
|
||||
)
|
||||
@@ -345,7 +345,7 @@ bool StartAutopilot()
|
||||
}
|
||||
|
||||
// damp speed_cap to 90% of actual -- to make sure ships stay in formation
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
speed_cap = 0.90f * speed_cap;
|
||||
|
||||
if ( speed_cap < 1.0f ) {
|
||||
@@ -367,28 +367,27 @@ bool StartAutopilot()
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1 &&
|
||||
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
(Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
|
||||
)
|
||||
)
|
||||
{
|
||||
// do we have capital ships in the area?
|
||||
if (Ship_info[Ships[i].ship_info_index].flags
|
||||
& ( SIF_CRUISER | SIF_CAPITAL | SIF_SUPERCAP | SIF_CORVETTE | SIF_AWACS | SIF_GAS_MINER | SIF_FREIGHTER | SIF_TRANSPORT))
|
||||
if (Ship_info[Ships[i].ship_info_index].is_big_ship() || Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Capital] || Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Supercap])
|
||||
{
|
||||
capshipPresent = true;
|
||||
|
||||
capIndexes.push_back(i);
|
||||
// ok.. what size class
|
||||
|
||||
if (Ship_info[Ships[i].ship_info_index].flags & (SIF_CAPITAL | SIF_SUPERCAP))
|
||||
{
|
||||
capship_counts[0]++;
|
||||
if (capship_spreads[0] < Objects[Ships[i].objnum].radius)
|
||||
capship_spreads[0] = Objects[Ships[i].objnum].radius;
|
||||
}
|
||||
else if (Ship_info[Ships[i].ship_info_index].flags & (SIF_CORVETTE))
|
||||
{
|
||||
if (Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Capital] || Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Supercap])
|
||||
{
|
||||
capship_counts[0]++;
|
||||
if (capship_spreads[0] < Objects[Ships[i].objnum].radius)
|
||||
capship_spreads[0] = Objects[Ships[i].objnum].radius;
|
||||
}
|
||||
else if (Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Corvette])
|
||||
{
|
||||
capship_counts[1]++;
|
||||
if (capship_spreads[1] < Objects[Ships[i].objnum].radius)
|
||||
capship_spreads[1] = Objects[Ships[i].objnum].radius;
|
||||
@@ -416,14 +415,14 @@ bool StartAutopilot()
|
||||
radius = Objects[Ships[i].objnum].radius;
|
||||
}
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
{// instantly turn the ship to match the direction player is looking
|
||||
//vm_vec_sub(&norm1, Navs[CurrentNav].GetPosition(), &Player_obj->pos);
|
||||
vm_vector_2_matrix(&Objects[Ships[i].objnum].orient, &norm1, NULL, NULL);
|
||||
}
|
||||
|
||||
// snap wings into formation
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS && // only if using cinematics
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics] && // only if using cinematics
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY) // only if in a wing
|
||||
&& Autopilot_flight_leader != &Objects[Ships[i].objnum]) //only if not flight leader's object
|
||||
{
|
||||
@@ -470,8 +469,10 @@ bool StartAutopilot()
|
||||
}
|
||||
}
|
||||
// lock primary and secondary weapons
|
||||
if ( LockWeaponsDuringAutopilot )
|
||||
Ships[i].flags2 |= (SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
|
||||
if (LockWeaponsDuringAutopilot) {
|
||||
Ships[i].flags.set(Ship::Ship_Flags::Primaries_locked);
|
||||
Ships[i].flags.set(Ship::Ship_Flags::Secondaries_locked);
|
||||
}
|
||||
|
||||
// clear the ship goals and cap the waypoint speed
|
||||
ai_clear_ship_goals(&Ai_info[Ships[i].ai_index]);
|
||||
@@ -479,7 +480,7 @@ bool StartAutopilot()
|
||||
|
||||
|
||||
// if they're not part of a wing set their goal
|
||||
if (Ships[i].wingnum == -1 || The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (Ships[i].wingnum == -1 || The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
{
|
||||
if (Navs[CurrentNav].flags & NP_WAYPOINT)
|
||||
{
|
||||
@@ -496,7 +497,7 @@ bool StartAutopilot()
|
||||
}
|
||||
|
||||
// assign wing goals
|
||||
if (!(The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS))
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics]))
|
||||
{
|
||||
for (i = 0; i < MAX_WINGS; i++)
|
||||
{
|
||||
@@ -538,7 +539,7 @@ bool StartAutopilot()
|
||||
{
|
||||
if (Ships[i].objnum != -1)
|
||||
{
|
||||
if (Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
if (Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY))
|
||||
for (j = 0; j < MAX_AI_GOALS; j++)
|
||||
{
|
||||
@@ -557,7 +558,7 @@ bool StartAutopilot()
|
||||
start_dist = DistanceTo(CurrentNav);
|
||||
|
||||
// ----------------------------- setup cinematic -----------------------------
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
{
|
||||
if (capshipPresent)
|
||||
{
|
||||
@@ -570,7 +571,7 @@ bool StartAutopilot()
|
||||
vm_vec_add(&front, &Autopilot_flight_leader->orient.vec.fvec, &zero);
|
||||
vm_vec_add(&up, &Autopilot_flight_leader->orient.vec.uvec, &zero);
|
||||
vm_vec_add(&offset, &zero, &zero);
|
||||
if (Ship_info[Ships[*idx].ship_info_index].flags & (SIF_CAPITAL | SIF_SUPERCAP))
|
||||
if (Ship_info[Ships[*idx].ship_info_index].flags[Ship::Info_Flags::Capital] || Ship_info[Ships[*idx].ship_info_index].flags[Ship::Info_Flags::Supercap])
|
||||
{
|
||||
//0 - below - three lines of position
|
||||
|
||||
@@ -604,7 +605,7 @@ bool StartAutopilot()
|
||||
|
||||
capship_placed[0]++;
|
||||
}
|
||||
else if (Ship_info[Ships[*idx].ship_info_index].flags & SIF_CORVETTE)
|
||||
else if (Ship_info[Ships[*idx].ship_info_index].flags[Ship::Info_Flags::Corvette])
|
||||
{
|
||||
//1 above - 3 lines of position
|
||||
// front/back to zero
|
||||
@@ -913,14 +914,16 @@ void EndAutoPilot()
|
||||
{
|
||||
if (Ships[i].objnum != -1 &&
|
||||
(
|
||||
Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY )
|
||||
)
|
||||
)
|
||||
{
|
||||
//unlock their weaponry
|
||||
if ( LockWeaponsDuringAutopilot )
|
||||
Ships[i].flags2 &= ~(SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
|
||||
if (LockWeaponsDuringAutopilot) {
|
||||
Ships[i].flags.remove(Ship::Ship_Flags::Primaries_locked);
|
||||
Ships[i].flags.remove(Ship::Ship_Flags::Secondaries_locked);
|
||||
}
|
||||
Ai_info[Ships[i].ai_index].waypoint_speed_cap = -1; // uncap their speed
|
||||
Ai_info[Ships[i].ai_index].mode = AIM_NONE; // make AI re-evaluate current ship mode
|
||||
|
||||
@@ -955,7 +958,7 @@ void EndAutoPilot()
|
||||
}
|
||||
|
||||
// un-assign wing goals
|
||||
if ( !(The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS) )
|
||||
if ( !(The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics]) )
|
||||
{
|
||||
for (i = 0; i < MAX_WINGS; i++)
|
||||
{
|
||||
@@ -1041,7 +1044,7 @@ void nav_warp(bool prewarp=false)
|
||||
for (int i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1
|
||||
&& (Ships[i].flags2 & SF2_NAVPOINT_CARRY
|
||||
&& (Ships[i].flags[Ship::Ship_Flags::Navpoint_carry]
|
||||
|| (Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)))
|
||||
{
|
||||
vm_vec_add(&Objects[Ships[i].objnum].pos, &Objects[Ships[i].objnum].pos, &targetPos);
|
||||
@@ -1069,7 +1072,7 @@ void NavSystem_Do()
|
||||
{
|
||||
if (AutoPilotEngaged)
|
||||
{
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
|
||||
{
|
||||
camera *cam = nav_get_set_camera();
|
||||
if (CinematicStarted)
|
||||
@@ -1148,7 +1151,7 @@ void NavSystem_Do()
|
||||
}
|
||||
|
||||
// ramp time compression - only if not using cinematics
|
||||
if (AutoPilotEngaged && !(The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS))
|
||||
if (AutoPilotEngaged && !(The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics]))
|
||||
{
|
||||
int dstfrm_start = start_dist - DistanceTo(CurrentNav);
|
||||
|
||||
@@ -1193,14 +1196,14 @@ void NavSystem_Do()
|
||||
*/
|
||||
for (int i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1 && Ships[i].flags2 & SF2_NAVPOINT_NEEDSLINK)
|
||||
if (Ships[i].objnum != -1 && Ships[i].flags[Ship::Ship_Flags::Navpoint_needslink])
|
||||
{
|
||||
object *other_objp = &Objects[Ships[i].objnum];
|
||||
|
||||
if (vm_vec_dist_quick(&Player_obj->pos, &other_objp->pos) < (NavLinkDistance + other_objp->radius))
|
||||
{
|
||||
Ships[i].flags2 &= ~SF2_NAVPOINT_NEEDSLINK;
|
||||
Ships[i].flags2 |= SF2_NAVPOINT_CARRY;
|
||||
Ships[i].flags.remove(Ship::Ship_Flags::Navpoint_needslink);
|
||||
Ships[i].flags.set(Ship::Ship_Flags::Navpoint_carry);
|
||||
|
||||
send_autopilot_msgID(NP_MSG_MISC_LINKED);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void cmeasure_maybe_alert_success(object *objp)
|
||||
if ( objp->parent == OBJ_INDEX(Player_obj) ) {
|
||||
hud_start_text_flash(XSTR("Evaded", 1430), 800);
|
||||
snd_play(&Snds[ship_get_sound(Player_obj, SND_MISSILE_EVADED_POPUP)]);
|
||||
} else if ( Objects[objp->parent].flags & OF_PLAYER_SHIP ) {
|
||||
} else if ( Objects[objp->parent].flags[Object::Object_Flags::Player_ship] ) {
|
||||
send_countermeasure_success_packet( objp->parent );
|
||||
}
|
||||
}
|
||||
+10
-8
@@ -78,7 +78,7 @@ static void debris_start_death_roll(object *debris_obj, debris *debris_p)
|
||||
}
|
||||
}
|
||||
|
||||
debris_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
debris_obj->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,7 +201,7 @@ void maybe_delete_debris(debris *db)
|
||||
db->next_distance_check = timestamp(DEBRIS_DISTANCE_CHECK_TIME);
|
||||
} else {
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->flags & OF_PLAYER_SHIP) {
|
||||
if (objp->flags[Object::Object_Flags::Player_ship]) {
|
||||
if (vm_vec_dist_quick(&objp->pos, &Objects[db->objnum].pos) < MAX_DEBRIS_DIST) {
|
||||
db->next_distance_check = timestamp(DEBRIS_DISTANCE_CHECK_TIME);
|
||||
return;
|
||||
@@ -378,7 +378,7 @@ int debris_find_oldest()
|
||||
oldest_time = 0x7fffffff;
|
||||
|
||||
for ( db = GET_FIRST(&Hull_debris_list); db != END_OF_LIST(&Hull_debris_list); db = GET_NEXT(db) ) {
|
||||
if ( (db->time_started < oldest_time) && !(Objects[db->objnum].flags & OF_SHOULD_BE_DEAD) ) {
|
||||
if ( (db->time_started < oldest_time) && !(Objects[db->objnum].flags[Object::Object_Flags::Should_be_dead]) ) {
|
||||
oldest_index = DEBRIS_INDEX(db);
|
||||
oldest_time = db->time_started;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS );
|
||||
shipp = &Ships[source_obj->instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
vaporize = (shipp->flags &SF_VAPORIZE);
|
||||
vaporize = (shipp->flags[Ship::Ship_Flags::Vaporize]);
|
||||
|
||||
if ( !hull_flag ) {
|
||||
// Make vaporize debris seen from farther away
|
||||
@@ -548,10 +548,12 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
if ( pos == NULL )
|
||||
pos = &source_obj->pos;
|
||||
|
||||
uint flags = OF_RENDERS | OF_PHYSICS;
|
||||
if ( hull_flag )
|
||||
flags |= OF_COLLIDES;
|
||||
objnum = obj_create( OBJ_DEBRIS, parent_objnum, n, &source_obj->orient, pos, radius, flags );
|
||||
flagset<Object::Object_Flags> default_flags;
|
||||
default_flags.set(Object::Object_Flags::Renders);
|
||||
default_flags.set(Object::Object_Flags::Physics);
|
||||
default_flags.set(Object::Object_Flags::Collides, hull_flag != 0);
|
||||
|
||||
objnum = obj_create( OBJ_DEBRIS, parent_objnum, n, &source_obj->orient, pos, radius, default_flags);
|
||||
if ( objnum == -1 ) {
|
||||
mprintf(("Couldn't create debris object -- out of object slots\n"));
|
||||
return NULL;
|
||||
|
||||
@@ -76,10 +76,10 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
|
||||
if(fb->warp_open_sound_index > -1) {
|
||||
sound_index = fb->warp_open_sound_index;
|
||||
} else if ((ship_class >= 0) && (ship_class < static_cast<int>(Ship_info.size()))) {
|
||||
if ( Ship_info[ship_class].flags & SIF_HUGE_SHIP ) {
|
||||
if ( Ship_info[ship_class].is_huge_ship() ) {
|
||||
sound_index = SND_CAPITAL_WARP_IN;
|
||||
fb->flags |= FBF_WARP_CAPITAL_SIZE;
|
||||
} else if ( Ship_info[ship_class].flags & SIF_BIG_SHIP ) {
|
||||
} else if ( Ship_info[ship_class].is_big_ship() ) {
|
||||
range_multiplier = 6.0f;
|
||||
fb->flags |= FBF_WARP_CRUISER_SIZE;
|
||||
}
|
||||
@@ -462,7 +462,7 @@ int fireball_is_perishable(object * obj)
|
||||
return 1;
|
||||
|
||||
if ( !(fb->fireball_render_type == FIREBALL_WARP_EFFECT) ) {
|
||||
if ( !(obj->flags & OF_WAS_RENDERED)) {
|
||||
if ( !(obj->flags[Object::Object_Flags::Was_rendered])) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void fireball_process_post(object * obj, float frame_time)
|
||||
|
||||
fb->time_elapsed += frame_time;
|
||||
if ( fb->time_elapsed > fb->total_time ) {
|
||||
obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
obj->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
}
|
||||
|
||||
fireball_maybe_play_warp_close_sound(fb);
|
||||
@@ -767,7 +767,9 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
}
|
||||
}
|
||||
|
||||
objnum = obj_create(OBJ_FIREBALL, parent_obj, n, &orient, pos, size, OF_RENDERS);
|
||||
flagset<Object::Object_Flags> default_flags;
|
||||
default_flags.set(Object::Object_Flags::Renders);
|
||||
objnum = obj_create(OBJ_FIREBALL, parent_obj, n, &orient, pos, size, default_flags);
|
||||
|
||||
if (objnum < 0) {
|
||||
Int3(); // Get John, we ran out of objects for fireballs
|
||||
@@ -825,7 +827,7 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
|
||||
if ( velocity ) {
|
||||
// Make the explosion move at a constant velocity.
|
||||
obj->flags |= OF_PHYSICS;
|
||||
obj->flags.set(Object::Object_Flags::Physics);
|
||||
obj->phys_info.mass = 1.0f;
|
||||
obj->phys_info.side_slip_time_const = 0.0f;
|
||||
obj->phys_info.rotdamp = 0.0f;
|
||||
|
||||
@@ -114,7 +114,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
|
||||
float alpha = (The_mission.flags & MISSION_FLAG_FULLNEB) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
|
||||
float alpha = (The_mission.flags[Mission::Mission_Flags::Fullneb]) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
|
||||
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, alpha );
|
||||
|
||||
g3_draw_bitmap( &verts[4], 0, r, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
|
||||
@@ -252,7 +252,7 @@ void warpin_queue_render(draw_list *scene, object *obj, matrix *orient, vec3d *p
|
||||
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
|
||||
float alpha = (The_mission.flags & MISSION_FLAG_FULLNEB) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
|
||||
float alpha = (The_mission.flags[Mission::Mission_Flags::Fullneb]) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
|
||||
|
||||
batch_add_bitmap(Warp_glow_bitmap, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_EMISSIVE , &verts[4], 0, r, alpha);
|
||||
}
|
||||
|
||||
@@ -1619,11 +1619,11 @@ int hostile_ships_present()
|
||||
continue;
|
||||
|
||||
// check if ship is threatening
|
||||
if ( (shipp->flags & (SF_DISABLED|SF_DYING|SF_DEPARTING)) || (ship_subsys_disrupted(shipp, SUBSYSTEM_ENGINE)) )
|
||||
if ( shipp->is_dying_or_departing() || shipp->flags[Ship::Ship_Flags::Disabled] || (ship_subsys_disrupted(shipp, SUBSYSTEM_ENGINE)) )
|
||||
continue;
|
||||
|
||||
// check if ship is flyable
|
||||
if ( Ship_info[shipp->ship_info_index].flags & SIF_NOT_FLYABLE ) {
|
||||
if (!Ship_info[shipp->ship_info_index].is_flyable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1652,7 +1652,7 @@ int hostile_ships_to_arrive()
|
||||
for (p_objp = GET_FIRST(&Ship_arrival_list); p_objp != END_OF_LIST(&Ship_arrival_list); p_objp = GET_NEXT(p_objp))
|
||||
{
|
||||
// check if ship can arrive
|
||||
if (p_objp->flags & P_SF_CANNOT_ARRIVE)
|
||||
if (p_objp->flags[Mission::Parse_Object_Flags::SF_Cannot_arrive])
|
||||
continue;
|
||||
|
||||
// check if ship is enemy ship (we attack it)
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
#ifndef _FLAGSET_
|
||||
#define _FLAGSET_
|
||||
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
|
||||
template <class T, size_t SIZE = static_cast < size_t >(T::NUM_VALUES)>
|
||||
class flagset {
|
||||
protected:
|
||||
std::bitset<SIZE> values;
|
||||
public:
|
||||
|
||||
bool operator [] (const T idx) const { return values[(static_cast < size_t >(idx))]; };
|
||||
|
||||
flagset<T> operator & (const flagset<T>& other) const {
|
||||
flagset<T> result;
|
||||
result.values = this->values & other.values;
|
||||
return result;
|
||||
}
|
||||
|
||||
flagset<T> operator + (const T flag) const {
|
||||
flagset<T> result = *this;
|
||||
result.set(flag);
|
||||
return result;
|
||||
}
|
||||
|
||||
flagset<T>& operator += (const T flag) {
|
||||
this->set(flag);
|
||||
return *this;
|
||||
}
|
||||
|
||||
flagset<T> operator - (const T flag) const {
|
||||
flagset<T> result = *this;
|
||||
result.remove(flag);
|
||||
return result;
|
||||
}
|
||||
|
||||
flagset<T>& operator -= (const T flag) {
|
||||
this->remove(flag);
|
||||
return *this;
|
||||
}
|
||||
|
||||
flagset<T> operator | (const flagset<T>& other) const {
|
||||
flagset<T> result;
|
||||
result.values = this->values | other.values;
|
||||
return result;
|
||||
}
|
||||
|
||||
flagset<T>& operator |= (const flagset<T>& other) {
|
||||
this->values |= other.values;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void operator |= (const T flag) {
|
||||
set(flag);
|
||||
}
|
||||
|
||||
bool operator == (const flagset<T>& other) const { return this->values == other.values; }
|
||||
bool operator != (const flagset<T>& other) const { return this->values != other.values; }
|
||||
|
||||
void reset() { values.reset(); }
|
||||
|
||||
flagset<T>& set(T idx, bool value = true) {
|
||||
Assert(idx >= T::NUM_VALUES);
|
||||
|
||||
values.set(static_cast < size_t >(idx), value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename TIter>
|
||||
flagset<T>& set_multiple(TIter begin, TIter end) {
|
||||
auto current = begin;
|
||||
while (current != end)
|
||||
{
|
||||
set(*current, true);
|
||||
|
||||
current = std::next(current);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
flagset<T>& remove(T idx) {
|
||||
return set(idx, false);
|
||||
}
|
||||
|
||||
template<typename TIter>
|
||||
flagset<T>& remove_multiple(TIter begin, TIter end) {
|
||||
auto current = begin;
|
||||
while (current != end)
|
||||
{
|
||||
set(*current, false);
|
||||
|
||||
current = std::next(current);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
flagset<T>& toggle(T idx) {
|
||||
values[static_cast < size_t >(idx)] = !values[static_cast < size_t >(idx)];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool any_set() const { return values.any(); }
|
||||
bool none_set() const { return values.none(); }
|
||||
|
||||
void from_long(std::uint64_t num) { values = num; }
|
||||
std::uint64_t to_long() const { return values.to_ulong(); }
|
||||
};
|
||||
|
||||
#define FLAG_LIST(Type) enum class Type : size_t
|
||||
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include "globalincs/toolchain.h"
|
||||
|
||||
#if defined( __x86_64__ ) || defined( _WIN64 )
|
||||
@@ -222,6 +223,14 @@ typedef struct flag_def_list {
|
||||
ubyte var;
|
||||
} def_list;
|
||||
|
||||
template<class T>
|
||||
struct flag_def_list_new {
|
||||
const char* name; // The parseable representation of this flag
|
||||
T def; // The flag definition for this flag
|
||||
bool in_use; // Whether or not this flag is currently in use or obsolete
|
||||
bool is_special; // Whether this flag requires special processing. See parse_string_flag_list<T, T> for details
|
||||
};
|
||||
|
||||
// weapon count list (mainly for pilot files)
|
||||
typedef struct wep_t {
|
||||
int index;
|
||||
@@ -342,11 +351,13 @@ const size_t INVALID_SIZE = static_cast<size_t>(-1);
|
||||
#undef USE_INLINE_ASM
|
||||
|
||||
#define INTEL_INT(x) SDL_Swap32(x)
|
||||
#define INTEL_LONG(x) SDL_Swap64(x)
|
||||
#define INTEL_SHORT(x) SDL_Swap16(x)
|
||||
#define INTEL_FLOAT(x) SDL_SwapFloat((*x))
|
||||
|
||||
#else // Little Endian -
|
||||
#define INTEL_INT(x) x
|
||||
#define INTEL_LONG(x) x
|
||||
#define INTEL_SHORT(x) x
|
||||
#define INTEL_FLOAT(x) (*x)
|
||||
#endif // BYTE_ORDER
|
||||
|
||||
+12
-10
@@ -1088,7 +1088,7 @@ bool HudGauge::canRender()
|
||||
}
|
||||
|
||||
if (gauge_config == HUD_ETS_GAUGE) {
|
||||
if (Ships[Player_obj->instance].flags2 & SF2_NO_ETS) {
|
||||
if (Ships[Player_obj->instance].flags[Ship::Ship_Flags::No_ets]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ void HUD_init()
|
||||
HUD_draw = 1;
|
||||
HUD_disable_except_messages = 0;
|
||||
|
||||
if(The_mission.flags & MISSION_FLAG_FULLNEB){
|
||||
if(The_mission.flags[Mission::Mission_Flags::Fullneb]){
|
||||
HUD_contrast = 1;
|
||||
}
|
||||
|
||||
@@ -1384,7 +1384,7 @@ void hud_update_frame(float frametime)
|
||||
if (Player_ai->target_objnum == -1){
|
||||
retarget = 1;
|
||||
} else if (Objects[Player_ai->target_objnum].type == OBJ_SHIP) {
|
||||
if (Ships[Objects[Player_ai->target_objnum].instance].flags & SF_DYING){
|
||||
if (Ships[Objects[Player_ai->target_objnum].instance].flags[Ship::Ship_Flags::Dying]){
|
||||
if (timestamp_elapsed(Ships[Objects[Player_ai->target_objnum].instance].final_death_time)) {
|
||||
retarget = 1;
|
||||
}
|
||||
@@ -1395,8 +1395,8 @@ void hud_update_frame(float frametime)
|
||||
// only do this is not retargeting
|
||||
if ((!retarget) && (Player_ai->target_objnum != -1)) {
|
||||
if (Objects[Player_ai->target_objnum].type == OBJ_SHIP) {
|
||||
if ( !(Ships[Objects[Player_ai->target_objnum].instance].flags & SF_DYING) ) {
|
||||
if ( Ship_info[Ships[Objects[Player_ai->target_objnum].instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP) ) {
|
||||
if ( !(Ships[Objects[Player_ai->target_objnum].instance].flags[Ship::Ship_Flags::Dying]) ) {
|
||||
if ( Ship_info[Ships[Objects[Player_ai->target_objnum].instance].ship_info_index].is_big_or_huge() ) {
|
||||
ship_subsys *ss = Player_ai->targeted_subsys;
|
||||
if (ss != NULL) {
|
||||
if ((ss->system_info->type == SUBSYSTEM_TURRET) && (ss->current_hits == 0)) {
|
||||
@@ -1476,7 +1476,7 @@ void hud_update_frame(float frametime)
|
||||
int stop_targetting_this_thing = 0;
|
||||
|
||||
// check to see if the target is still alive
|
||||
if ( targetp->flags&OF_SHOULD_BE_DEAD ) {
|
||||
if ( targetp->flags[Object::Object_Flags::Should_be_dead] ) {
|
||||
stop_targetting_this_thing = 1;
|
||||
}
|
||||
|
||||
@@ -1486,10 +1486,10 @@ void hud_update_frame(float frametime)
|
||||
if ( targetp->type == OBJ_SHIP ) {
|
||||
Assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS );
|
||||
target_shipp = &Ships[targetp->instance];
|
||||
Player->target_is_dying = target_shipp->flags & SF_DYING;
|
||||
Player->target_is_dying = target_shipp->flags[Ship::Ship_Flags::Dying];
|
||||
|
||||
// If it is warping out (or exploded), turn off targeting
|
||||
if ( target_shipp->flags & (SF_DEPART_WARP|SF_EXPLODED) ) {
|
||||
if ( target_shipp->flags[Ship::Ship_Flags::Depart_warp] || target_shipp->flags[Ship::Ship_Flags::Exploded] ) {
|
||||
stop_targetting_this_thing = 1;
|
||||
}
|
||||
}
|
||||
@@ -2662,11 +2662,13 @@ int hud_support_find_closest( int objnum )
|
||||
|
||||
sop = GET_FIRST(&Ship_obj_list);
|
||||
while(sop != END_OF_LIST(&Ship_obj_list)){
|
||||
if ( Ship_info[Ships[Objects[sop->objnum].instance].ship_info_index].flags & SIF_SUPPORT ) {
|
||||
if ( Ship_info[Ships[Objects[sop->objnum].instance].ship_info_index].flags[Ship::Info_Flags::Support] ) {
|
||||
int pship_index, sindex;
|
||||
|
||||
// make sure support ship is not dying
|
||||
if ( !(Ships[Objects[sop->objnum].instance].flags & (SF_DYING|SF_EXPLODED)) ) {
|
||||
auto shipp = &Ships[Objects[sop->objnum].instance];
|
||||
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::Dying] || shipp->flags[Ship::Ship_Flags::Exploded]) ) {
|
||||
|
||||
Assert( objp->type == OBJ_SHIP );
|
||||
aip = &Ai_info[Ships[Objects[sop->objnum].instance].ai_index];
|
||||
|
||||
+12
-12
@@ -367,7 +367,7 @@ void HudGaugeEscort::renderIcon(int x, int y, int index)
|
||||
*/
|
||||
|
||||
// draw a 'D' if a ship is disabled
|
||||
if ( (sp->flags & SF_DISABLED) || (ship_subsys_disrupted(sp, SUBSYSTEM_ENGINE)) ) {
|
||||
if ( (sp->flags[Ship::Ship_Flags::Disabled]) || (ship_subsys_disrupted(sp, SUBSYSTEM_ENGINE)) ) {
|
||||
renderString( x + ship_status_offsets[0], y + ship_status_offsets[1], EG_NULL, XSTR( "D", 284));
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ void hud_escort_clear_all(bool clear_flags)
|
||||
Num_escort_ships = 0;
|
||||
for ( i = 0; i < Max_escort_ships; i++ ) {
|
||||
if(clear_flags && (Escort_ships[i].objnum >= 0) && (Objects[Escort_ships[i].objnum].type == OBJ_SHIP) && (Objects[Escort_ships[i].objnum].instance >= 0)){
|
||||
Ships[Objects[Escort_ships[i].objnum].instance].flags &= ~SF_ESCORT;
|
||||
Ships[Objects[Escort_ships[i].objnum].instance].flags.remove(Ship::Ship_Flags::Escort);
|
||||
}
|
||||
Escort_ships[i].obj_signature = -99;
|
||||
Escort_ships[i].np_id = -1;
|
||||
@@ -599,22 +599,22 @@ void hud_create_complete_escort_list(escort_info *escorts, int *num_escorts)
|
||||
}
|
||||
|
||||
// only process ships that might be on the list
|
||||
if ( !(Ships[objp->instance].flags & SF_ESCORT) ){
|
||||
if ( !(Ships[objp->instance].flags[Ship::Ship_Flags::Escort]) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
// only process ships that can be seen by sensors
|
||||
if ( (Ships[objp->instance].flags & SF_HIDDEN_FROM_SENSORS) ){
|
||||
if ( (Ships[objp->instance].flags[Ship::Ship_Flags::Hidden_from_sensors]) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't process most stealth ships
|
||||
if ( (Ships[objp->instance].flags2 & SF2_STEALTH) )
|
||||
if ( (Ships[objp->instance].flags[Ship::Ship_Flags::Stealth]) )
|
||||
{
|
||||
if ( Ships[objp->instance].team == Player_ship->team )
|
||||
{
|
||||
// friendly stealths are only not seen when explicitly specified
|
||||
if ( Ships[objp->instance].flags2 & SF2_FRIENDLY_STEALTH_INVIS )
|
||||
if ( Ships[objp->instance].flags[Ship::Ship_Flags::Friendly_stealth_invis] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -627,7 +627,7 @@ void hud_create_complete_escort_list(escort_info *escorts, int *num_escorts)
|
||||
}
|
||||
|
||||
// don't process objects that should be dead
|
||||
if ( objp->flags & OF_SHOULD_BE_DEAD ) {
|
||||
if ( objp->flags[Object::Object_Flags::Should_be_dead] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -761,7 +761,7 @@ void hud_remove_ship_from_escort_index(int dead_index, int objnum)
|
||||
|
||||
// remove him from escort list
|
||||
if((objnum >= 0) && (Objects[objnum].type == OBJ_SHIP) && (Objects[objnum].instance >= 0)){
|
||||
Ships[Objects[objnum].instance].flags &= ~SF_ESCORT;
|
||||
Ships[Objects[objnum].instance].flags.remove(Ship::Ship_Flags::Escort);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@@ -816,15 +816,15 @@ void hud_escort_cull_list()
|
||||
int objnum = Escort_ships[i].objnum;
|
||||
Assert( objnum >=0 && objnum < MAX_OBJECTS );
|
||||
|
||||
if ( Objects[objnum].flags & OF_SHOULD_BE_DEAD ) {
|
||||
if ( Objects[objnum].flags[Object::Object_Flags::Should_be_dead] ) {
|
||||
hud_setup_escort_list(0);
|
||||
break;
|
||||
} else if ( Objects[objnum].type == OBJ_SHIP ) {
|
||||
int shipnum = Objects[objnum].instance;
|
||||
Assert( shipnum >= 0 && shipnum < MAX_SHIPS );
|
||||
|
||||
if ( (Ships[shipnum].flags & SF_HIDDEN_FROM_SENSORS)
|
||||
|| ((Ships[shipnum].flags2 & SF2_STEALTH) && ((Ships[shipnum].team != Player_ship->team) || (Ships[shipnum].flags2 & SF2_FRIENDLY_STEALTH_INVIS)))
|
||||
if ( (Ships[shipnum].flags[Ship::Ship_Flags::Hidden_from_sensors])
|
||||
|| ((Ships[shipnum].flags[Ship::Ship_Flags::Stealth]) && ((Ships[shipnum].team != Player_ship->team) || (Ships[shipnum].flags[Ship::Ship_Flags::Friendly_stealth_invis])))
|
||||
) {
|
||||
hud_setup_escort_list(0);
|
||||
break;
|
||||
@@ -881,7 +881,7 @@ void hud_add_ship_to_escort(int objnum, int supress_feedback)
|
||||
complete_escorts[num_complete_escorts].escort_show_bright = false;
|
||||
|
||||
// add him to escort list
|
||||
Ships[Objects[objnum].instance].flags |= SF_ESCORT;
|
||||
Ships[Objects[objnum].instance].flags.set(Ship::Ship_Flags::Escort);
|
||||
|
||||
num_complete_escorts++;
|
||||
}
|
||||
|
||||
+31
-31
@@ -44,7 +44,7 @@ void ets_init_ship(object* obj)
|
||||
sp = &Ships[obj->instance];
|
||||
|
||||
sp->weapon_energy = Ship_info[sp->ship_info_index].max_weapon_reserve;
|
||||
if ((sp->flags2 & SF2_NO_ETS) == 0) {
|
||||
if ((sp->flags[Ship::Ship_Flags::No_ets]) == 0) {
|
||||
sp->next_manage_ets = timestamp(AI_MODIFY_ETS_INTERVAL);
|
||||
} else {
|
||||
sp->next_manage_ets = -1;
|
||||
@@ -73,7 +73,7 @@ void update_ets(object* objp, float fl_frametime)
|
||||
float max_g=sinfo_p->max_weapon_reserve,
|
||||
max_s=ship_p->ship_max_shield_strength;
|
||||
|
||||
if ( ship_p->flags & SF_DYING ){
|
||||
if ( ship_p->flags[Ship::Ship_Flags::Dying] ){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void update_ets(object* objp, float fl_frametime)
|
||||
|
||||
// update weapon energy
|
||||
max_new_weapon_energy = fl_frametime * sinfo_p->max_weapon_regen_per_second * max_g;
|
||||
if ( objp->flags & OF_PLAYER_SHIP ) {
|
||||
if ( objp->flags[Object::Object_Flags::Player_ship] ) {
|
||||
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy * The_mission.ai_profile->weapon_energy_scale[Game_skill_level];
|
||||
} else {
|
||||
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy;
|
||||
@@ -97,7 +97,7 @@ void update_ets(object* objp, float fl_frametime)
|
||||
|
||||
float shield_delta;
|
||||
max_new_shield_energy = fl_frametime * sinfo_p->max_shield_regen_per_second * max_s;
|
||||
if ( objp->flags & OF_PLAYER_SHIP ) {
|
||||
if ( objp->flags[Object::Object_Flags::Player_ship] ) {
|
||||
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy * The_mission.ai_profile->shield_energy_scale[Game_skill_level];
|
||||
} else {
|
||||
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy;
|
||||
@@ -132,7 +132,7 @@ void update_ets(object* objp, float fl_frametime)
|
||||
}
|
||||
|
||||
if ( timestamp_elapsed(ship_p->next_manage_ets) ) {
|
||||
if ( !(objp->flags & OF_PLAYER_SHIP) ) {
|
||||
if ( !(objp->flags[Object::Object_Flags::Player_ship]) ) {
|
||||
ai_manage_ets(objp);
|
||||
ship_p->next_manage_ets = timestamp(AI_MODIFY_ETS_INTERVAL);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ void ai_manage_ets(object* obj)
|
||||
if ( ship_info_p->power_output == 0 )
|
||||
return;
|
||||
|
||||
if (ship_p->flags & SF_DYING)
|
||||
if (ship_p->flags[Ship::Ship_Flags::Dying])
|
||||
return;
|
||||
|
||||
// check if any of the three systems are not being used. If so, don't allow energy management.
|
||||
@@ -221,13 +221,13 @@ void ai_manage_ets(object* obj)
|
||||
decrease_recharge_rate(obj, WEAPONS);
|
||||
}
|
||||
|
||||
if (!(obj->flags & OF_NO_SHIELDS) && (shield_left_percent == 1.0f)) {
|
||||
if (!(obj->flags[Object::Object_Flags::No_shields]) && (shield_left_percent == 1.0f)) {
|
||||
decrease_recharge_rate(obj, SHIELDS);
|
||||
}
|
||||
|
||||
// minimum check
|
||||
|
||||
if (!(obj->flags & OF_NO_SHIELDS) && (shield_left_percent < SHIELDS_MIN_LEVEL_PERCENT)) {
|
||||
if (!(obj->flags[Object::Object_Flags::No_shields]) && (shield_left_percent < SHIELDS_MIN_LEVEL_PERCENT)) {
|
||||
if ( weapon_left_percent > WEAPONS_MIN_LEVEL_PERCENT )
|
||||
increase_recharge_rate(obj, SHIELDS);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ void ai_manage_ets(object* obj)
|
||||
}
|
||||
|
||||
// emergency check
|
||||
if (!(obj->flags & OF_NO_SHIELDS)) {
|
||||
if (!(obj->flags[Object::Object_Flags::No_shields])) {
|
||||
if ( shield_left_percent < SHIELDS_EMERG_LEVEL_PERCENT ) {
|
||||
if (ship_p->target_shields_delta == 0.0f)
|
||||
transfer_energy_to_shields(obj);
|
||||
@@ -286,7 +286,7 @@ void set_default_recharge_rates(object* obj)
|
||||
if (ship_has_energy_weapons(ship_p))
|
||||
ship_properties |= HAS_WEAPONS;
|
||||
|
||||
if (!(obj->flags & OF_NO_SHIELDS))
|
||||
if (!(obj->flags[Object::Object_Flags::No_shields]))
|
||||
ship_properties |= HAS_SHIELDS;
|
||||
|
||||
if (ship_has_engine_power(ship_p))
|
||||
@@ -352,7 +352,7 @@ void increase_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
int count=0;
|
||||
ship *ship_p = &Ships[obj->instance];
|
||||
|
||||
if (ship_p->flags2 & SF2_NO_ETS)
|
||||
if (ship_p->flags[Ship::Ship_Flags::No_ets])
|
||||
return;
|
||||
|
||||
switch ( ship_system ) {
|
||||
@@ -362,7 +362,7 @@ void increase_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
|
||||
gain_index = &ship_p->weapon_recharge_index;
|
||||
|
||||
if ( obj->flags & OF_NO_SHIELDS )
|
||||
if ( obj->flags[Object::Object_Flags::No_shields] )
|
||||
lose_index1 = NULL;
|
||||
else
|
||||
lose_index1 = &ship_p->shield_recharge_index;
|
||||
@@ -375,7 +375,7 @@ void increase_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
break;
|
||||
|
||||
case SHIELDS:
|
||||
if ( obj->flags & OF_NO_SHIELDS )
|
||||
if ( obj->flags[Object::Object_Flags::No_shields] )
|
||||
return;
|
||||
|
||||
gain_index = &ship_p->shield_recharge_index;
|
||||
@@ -403,7 +403,7 @@ void increase_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
else
|
||||
lose_index1 = &ship_p->weapon_recharge_index;
|
||||
|
||||
if ( obj->flags & OF_NO_SHIELDS )
|
||||
if ( obj->flags[Object::Object_Flags::No_shields] )
|
||||
lose_index2 = NULL;
|
||||
else
|
||||
lose_index2 = &ship_p->shield_recharge_index;
|
||||
@@ -476,7 +476,7 @@ void decrease_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
int count;
|
||||
ship *ship_p = &Ships[obj->instance];
|
||||
|
||||
if (ship_p->flags2 & SF2_NO_ETS)
|
||||
if (ship_p->flags[Ship::Ship_Flags::No_ets])
|
||||
return;
|
||||
|
||||
switch ( ship_system ) {
|
||||
@@ -486,7 +486,7 @@ void decrease_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
|
||||
lose_index = &ship_p->weapon_recharge_index;
|
||||
|
||||
if ( obj->flags & OF_NO_SHIELDS )
|
||||
if ( obj->flags[Object::Object_Flags::No_shields] )
|
||||
gain_index1 = NULL;
|
||||
else
|
||||
gain_index1 = &ship_p->shield_recharge_index;
|
||||
@@ -499,7 +499,7 @@ void decrease_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
break;
|
||||
|
||||
case SHIELDS:
|
||||
if ( obj->flags & OF_NO_SHIELDS )
|
||||
if ( obj->flags[Object::Object_Flags::No_shields] )
|
||||
return;
|
||||
|
||||
lose_index = &ship_p->shield_recharge_index;
|
||||
@@ -527,7 +527,7 @@ void decrease_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
|
||||
else
|
||||
gain_index1 = &ship_p->weapon_recharge_index;
|
||||
|
||||
if ( obj->flags & OF_NO_SHIELDS )
|
||||
if ( obj->flags[Object::Object_Flags::No_shields] )
|
||||
gain_index2 = NULL;
|
||||
else
|
||||
gain_index2 = &ship_p->shield_recharge_index;
|
||||
@@ -615,10 +615,10 @@ void transfer_energy_to_shields(object* obj)
|
||||
{
|
||||
ship* ship_p = &Ships[obj->instance];
|
||||
|
||||
if (ship_p->flags & SF_DYING)
|
||||
if (ship_p->flags[Ship::Ship_Flags::Dying])
|
||||
return;
|
||||
|
||||
if ( !ship_has_energy_weapons(ship_p) || obj->flags & OF_NO_SHIELDS )
|
||||
if ( !ship_has_energy_weapons(ship_p) || obj->flags[Object::Object_Flags::No_shields] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -634,10 +634,10 @@ void transfer_energy_to_weapons(object* obj)
|
||||
ship* ship_p = &Ships[obj->instance];
|
||||
ship_info* sinfo_p = &Ship_info[ship_p->ship_info_index];
|
||||
|
||||
if (ship_p->flags & SF_DYING)
|
||||
if (ship_p->flags[Ship::Ship_Flags::Dying])
|
||||
return;
|
||||
|
||||
if ( !ship_has_energy_weapons(ship_p) || obj->flags & OF_NO_SHIELDS )
|
||||
if ( !ship_has_energy_weapons(ship_p) || obj->flags[Object::Object_Flags::No_shields] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -729,7 +729,7 @@ bool validate_ship_ets_indxes(const int &ship_idx, int (&ets_indexes)[num_retail
|
||||
}
|
||||
ship *ship_p = &Ships[ship_idx];
|
||||
|
||||
if (ship_p->flags2 & SF2_NO_ETS)
|
||||
if (ship_p->flags[Ship::Ship_Flags::No_ets])
|
||||
return false;
|
||||
|
||||
// handle ships that are missing parts of the ETS
|
||||
@@ -738,7 +738,7 @@ bool validate_ship_ets_indxes(const int &ship_idx, int (&ets_indexes)[num_retail
|
||||
ship_properties |= HAS_WEAPONS;
|
||||
}
|
||||
|
||||
if (!(Objects[ship_p->objnum].flags & OF_NO_SHIELDS)) {
|
||||
if (!(Objects[ship_p->objnum].flags[Object::Object_Flags::No_shields])) {
|
||||
ship_properties |= HAS_SHIELDS;
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ void HudGaugeEtsRetail::render(float frametime)
|
||||
// if at least two gauges are not shown, don't show any
|
||||
i = 0;
|
||||
if (!ship_has_energy_weapons(ship_p)) i++;
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) i++;
|
||||
if (Player_obj->flags[Object::Object_Flags::No_shields]) i++;
|
||||
if (!ship_has_engine_power(ship_p)) i++;
|
||||
if (i >= 2) return;
|
||||
|
||||
@@ -933,7 +933,7 @@ void HudGaugeEtsRetail::render(float frametime)
|
||||
position[0] = Gauge_positions[initial_position++];
|
||||
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
|
||||
}
|
||||
if (!(Player_obj->flags & OF_NO_SHIELDS)) {
|
||||
if (!(Player_obj->flags[Object::Object_Flags::No_shields])) {
|
||||
Letter = Letters[1];
|
||||
position[0] = Gauge_positions[initial_position++];
|
||||
renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter);
|
||||
@@ -951,7 +951,7 @@ void HudGaugeEtsRetail::render(float frametime)
|
||||
position[0] = Gauge_positions[initial_position++];
|
||||
blitGauge(ship_p->weapon_recharge_index);
|
||||
}
|
||||
if (!(Player_obj->flags & OF_NO_SHIELDS)) {
|
||||
if (!(Player_obj->flags[Object::Object_Flags::No_shields])) {
|
||||
Letter = Letters[1];
|
||||
position[0] = Gauge_positions[initial_position++];
|
||||
blitGauge(ship_p->shield_recharge_index);
|
||||
@@ -1002,7 +1002,7 @@ void HudGaugeEtsWeapons::render(float frametime)
|
||||
// if at least two gauges are not shown, don't show any
|
||||
i = 0;
|
||||
if (!ship_has_energy_weapons(ship_p)) i++;
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) i++;
|
||||
if (Player_obj->flags[Object::Object_Flags::No_shields]) i++;
|
||||
if (!ship_has_engine_power(ship_p)) i++;
|
||||
if (i >= 2) return;
|
||||
|
||||
@@ -1039,12 +1039,12 @@ void HudGaugeEtsShields::render(float frametime)
|
||||
// if at least two gauges are not shown, don't show any
|
||||
i = 0;
|
||||
if (!ship_has_energy_weapons(ship_p)) i++;
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) i++;
|
||||
if (Player_obj->flags[Object::Object_Flags::No_shields]) i++;
|
||||
if (!ship_has_engine_power(ship_p)) i++;
|
||||
if (i >= 2) return;
|
||||
|
||||
// no shields, no shields gauge
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) {
|
||||
if (Player_obj->flags[Object::Object_Flags::No_shields]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ void HudGaugeEtsEngines::render(float frametime)
|
||||
// if at least two gauges are not shown, don't show any
|
||||
i = 0;
|
||||
if (!ship_has_energy_weapons(ship_p)) i++;
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) i++;
|
||||
if (Player_obj->flags[Object::Object_Flags::No_shields]) i++;
|
||||
if (!ship_has_engine_power(ship_p)) i++;
|
||||
if (i >= 2) return;
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ int hud_lock_world_pos_in_range(vec3d *target_world_pos, vec3d *vec_to_target)
|
||||
|
||||
|
||||
// reduce firing range in nebula
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
if ((The_mission.flags[Mission::Mission_Flags::Fullneb]) && Nebula_sec_range) {
|
||||
weapon_range *= 0.8f;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ int hud_abort_lock()
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( Player_ship->flags2 & SF2_NO_SECONDARY_LOCKON ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::No_secondary_lockon] ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ void hud_lock_get_new_lock_pos(object *target_objp)
|
||||
wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
|
||||
|
||||
// if a large ship, lock to pos closest to center and within range
|
||||
if ( (target_shipp) && (Ship_info[target_shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) &&
|
||||
if ( (target_shipp) && (Ship_info[target_shipp->ship_info_index].is_big_or_huge()) &&
|
||||
!(wip->wi_flags & WIF_HOMING_JAVELIN) ) {
|
||||
// check all the subsystems and the center of the ship
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ void hud_observer_init(ship *shipp, ai_info *aip)
|
||||
Hud_obs_ship.team = shipp->team;
|
||||
Hud_obs_ship.ai_index = shipp->ai_index;
|
||||
Hud_obs_ship.flags = shipp->flags;
|
||||
Hud_obs_ship.flags2 = shipp->flags2;
|
||||
Hud_obs_ship.ship_info_index = shipp->ship_info_index;
|
||||
Hud_obs_ship.objnum = shipp->objnum;
|
||||
Hud_obs_ship.wingnum = shipp->wingnum;
|
||||
|
||||
@@ -306,14 +306,14 @@ void HudGaugeReticle::getFirepointStatus() {
|
||||
bankactive = 1;
|
||||
else if (timestamp_elapsed(shipp->weapons.primary_animation_done_time[i]))
|
||||
bankactive = 1;
|
||||
else if (i == shipp->weapons.current_primary_bank || shipp->flags & SF_PRIMARY_LINKED)
|
||||
else if (i == shipp->weapons.current_primary_bank || shipp->flags[Ship::Ship_Flags::Primary_linked])
|
||||
bankactive = 2;
|
||||
|
||||
int num_slots = pm->gun_banks[i].num_slots;
|
||||
for (int j = 0; j < num_slots; j++) {
|
||||
int fpactive = bankactive;
|
||||
|
||||
if (sip->flags2 & SIF2_DYN_PRIMARY_LINKING) {
|
||||
if (sip->flags[Ship::Info_Flags::Dyn_primary_linking]) {
|
||||
// If this firepoint is not among the next shot(s) to be fired, dim it one step
|
||||
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--;
|
||||
@@ -919,7 +919,7 @@ void HudGaugeWeaponLinking::render(float frametime)
|
||||
if ( swp->current_primary_bank == -1 ) {
|
||||
frame_offset = 0;
|
||||
} else {
|
||||
if ( Player_ship->flags & SF_PRIMARY_LINKED ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Primary_linked] ) {
|
||||
frame_offset = 3;
|
||||
} else {
|
||||
if ( swp->current_primary_bank == 0 ) {
|
||||
|
||||
+10
-10
@@ -224,7 +224,7 @@ void hud_shield_equalize(object *objp, player *pl)
|
||||
return;
|
||||
|
||||
// Goober5000 - quick out if we have no shields
|
||||
if (objp->flags & OF_NO_SHIELDS)
|
||||
if (objp->flags[Object::Object_Flags::No_shields])
|
||||
return;
|
||||
|
||||
// are all quadrants equal?
|
||||
@@ -284,7 +284,7 @@ void hud_augment_shield_quadrant(object *objp, int direction)
|
||||
float max_quadrant_val;
|
||||
int i;
|
||||
|
||||
if (sip->flags2 & SIF2_MODEL_POINT_SHIELDS) {
|
||||
if (sip->flags[Ship::Info_Flags::Model_point_shields]) {
|
||||
direction = sip->shield_point_augment_ctrls[direction];
|
||||
|
||||
// The re-mapped direction can be -1 if this direction cannot be augmented
|
||||
@@ -426,7 +426,7 @@ void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_off
|
||||
|
||||
for ( i = 0; i < objp->n_quadrants; i++ ) {
|
||||
|
||||
if ( objp->flags & OF_NO_SHIELDS || i >= DEFAULT_SHIELD_SECTIONS) {
|
||||
if ( objp->flags[Object::Object_Flags::No_shields] || i >= DEFAULT_SHIELD_SECTIONS) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ void hud_shield_quadrant_hit(object *objp, int quadrant)
|
||||
Assertion(shi->hull_hit_index < (int) shi->shield_hit_timers.size(), "Shield hit info object for object '%s' has a hull_hit_index of %d (should be between 0 and " SIZE_T_ARG "); get a coder!\n", Ships[objp->instance].ship_name, shi->hull_hit_index, shi->shield_hit_timers.size() - 1);
|
||||
|
||||
if ( quadrant >= 0 ) {
|
||||
if ( !(Ship_info[Ships[objp->instance].ship_info_index].flags2 & SIF2_MODEL_POINT_SHIELDS) )
|
||||
if ( !(Ship_info[Ships[objp->instance].ship_info_index].flags[Ship::Info_Flags::Model_point_shields]) )
|
||||
num = Quadrant_xlate[quadrant];
|
||||
else
|
||||
num = quadrant;
|
||||
@@ -606,14 +606,14 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
return;
|
||||
|
||||
// Goober5000 - don't show if primitive sensors
|
||||
if ( Ships[Player_obj->instance].flags2 & SF2_PRIMITIVE_SENSORS )
|
||||
if ( Ships[Player_obj->instance].flags[Ship::Ship_Flags::Primitive_sensors] )
|
||||
return;
|
||||
|
||||
sp = &Ships[objp->instance];
|
||||
sip = &Ship_info[sp->ship_info_index];
|
||||
|
||||
// bool digitus_improbus = (fod_model != -2 && strstr(sp->ship_name, "Sathanas") != NULL);
|
||||
if ( sip->shield_icon_index == 255 && !(sip->flags2 & SIF2_GENERATE_HUD_ICON) /*&& !digitus_improbus*/) {
|
||||
if ( sip->shield_icon_index == 255 && !(sip->flags[Ship::Info_Flags::Generate_hud_icon]) /*&& !digitus_improbus*/) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -724,11 +724,11 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
|
||||
for ( i = 0; i < objp->n_quadrants; i++ ) {
|
||||
|
||||
if ( objp->flags & OF_NO_SHIELDS ) {
|
||||
if ( objp->flags[Object::Object_Flags::No_shields] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !(sip->flags2 & SIF2_MODEL_POINT_SHIELDS) ) {
|
||||
if ( !(sip->flags[Ship::Info_Flags::Model_point_shields]) ) {
|
||||
if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f )
|
||||
continue;
|
||||
} else {
|
||||
@@ -738,7 +738,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
|
||||
|
||||
range = MAX(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + objp->n_quadrants);
|
||||
|
||||
if ( !(sip->flags2 & SIF2_MODEL_POINT_SHIELDS) )
|
||||
if ( !(sip->flags[Ship::Info_Flags::Model_point_shields]) )
|
||||
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range);
|
||||
else
|
||||
hud_color_index = fl2i( (objp->shield_quadrant[i] / max_shield) * range);
|
||||
@@ -1010,7 +1010,7 @@ void HudGaugeShieldMini::showMiniShields(object *objp)
|
||||
|
||||
for ( i = 0; i < objp->n_quadrants; i++ ) {
|
||||
|
||||
if ( objp->flags & OF_NO_SHIELDS ) {
|
||||
if ( objp->flags[Object::Object_Flags::No_shields] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+30
-27
@@ -320,7 +320,7 @@ bool hud_squadmsg_exist_fighters( )
|
||||
continue;
|
||||
|
||||
// ship must be a fighter/bomber
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) )
|
||||
if ( !(Ship_info[shipp->ship_info_index].is_fighter_bomber()) )
|
||||
continue;
|
||||
|
||||
// this ship satisfies everything
|
||||
@@ -351,7 +351,7 @@ bool hud_squadmsg_ship_valid(ship *shipp, object *objp)
|
||||
#endif
|
||||
|
||||
// departing or dying ships cannot be on list
|
||||
if ( shipp->flags & (SF_DEPARTING|SF_DYING) )
|
||||
if ( shipp->is_dying_or_departing() )
|
||||
return false;
|
||||
|
||||
// cannot be my ship or an instructor
|
||||
@@ -363,7 +363,7 @@ bool hud_squadmsg_ship_valid(ship *shipp, object *objp)
|
||||
return false;
|
||||
|
||||
// if it is a player ship, we must be in multiplayer
|
||||
if ( (objp->flags & OF_PLAYER_SHIP) && !(Game_mode & GM_MULTIPLAYER) )
|
||||
if ( (objp->flags[Object::Object_Flags::Player_ship]) && !(Game_mode & GM_MULTIPLAYER) )
|
||||
return false;
|
||||
|
||||
// if a messaging shortcut, be sure this ship can process the order
|
||||
@@ -777,11 +777,11 @@ int hud_squadmsg_ship_order_valid( int shipnum, int order )
|
||||
{
|
||||
case DEPART_ITEM:
|
||||
// disabled ships can't depart.
|
||||
if (shipp->flags & SF_DISABLED)
|
||||
if (shipp->flags[Ship::Ship_Flags::Disabled])
|
||||
return 0;
|
||||
|
||||
// Goober5000: also can't depart if no subspace drives and no valid mothership
|
||||
if (shipp->flags2 & SF2_NO_SUBSPACE_DRIVE)
|
||||
if (shipp->flags[Ship::Ship_Flags::No_subspace_drive])
|
||||
{
|
||||
// check that we have a mothership and that we can depart to it
|
||||
if (shipp->departure_location == DEPART_AT_DOCK_BAY)
|
||||
@@ -863,7 +863,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
// if target is a navbouy, return 0
|
||||
if ( Ship_info[shipp->ship_info_index].flags & SIF_NAVBUOY ){
|
||||
if ( Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Navbuoy] ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -873,7 +873,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip )
|
||||
}
|
||||
|
||||
// if the order is a disable order or depart, and the ship is disabled, order isn't active
|
||||
if ( (Comm_orders[order].item == DISABLE_TARGET_ITEM) && (shipp->flags & SF_DISABLED) ){
|
||||
if ( (Comm_orders[order].item == DISABLE_TARGET_ITEM) && (shipp->flags[Ship::Ship_Flags::Disabled]) ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -962,7 +962,7 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num )
|
||||
continue;
|
||||
|
||||
// can't message if ship not fighter/bomber if the command isn't to everyone.
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) )
|
||||
if ( !(Ship_info[shipp->ship_info_index].is_fighter_bomber()) )
|
||||
continue;
|
||||
|
||||
// don't send the command if the "wing" won't accept the command. We do this by looking at
|
||||
@@ -995,11 +995,11 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num )
|
||||
continue;
|
||||
|
||||
// don't send message to non fighter wings
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) )
|
||||
if ( !(Ship_info[shipp->ship_info_index].is_fighter_bomber()) )
|
||||
continue;
|
||||
|
||||
// skip departing/dying ships
|
||||
if ( shipp->flags & (SF_DEPARTING|SF_DYING) )
|
||||
if ( shipp->is_dying_or_departing() )
|
||||
continue;
|
||||
|
||||
// don't send command if ship won't accept if
|
||||
@@ -1043,7 +1043,9 @@ int hud_squadmsg_enemies_present()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OVERRIDE_PROTECT_SHIP_TYPE (SIF_FIGHTER|SIF_BOMBER|SIF_FREIGHTER|SIF_TRANSPORT)
|
||||
inline bool override_protect_ship_type(ship_info* sip) {
|
||||
return sip->is_fighter_bomber() || sip->flags[Ship::Info_Flags::Freighter] || sip->flags[Ship::Info_Flags::Transport];
|
||||
}
|
||||
// function which sends a message to a specific ship. This routine can be called from one of two
|
||||
// places. Either after selecting a ship when using a hotkey, or after selecting a command when
|
||||
// using the entire messaging menu system
|
||||
@@ -1117,9 +1119,10 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
Assert( ship_team != target_team );
|
||||
|
||||
// Orders to override protect
|
||||
if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) {
|
||||
Objects[ainfo->target_objnum].flags &= ~OF_PROTECTED;
|
||||
}
|
||||
if (override_protect_ship_type(&Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index])) {
|
||||
Objects[ainfo->target_objnum].flags.remove(Object::Object_Flags::Protected);
|
||||
}
|
||||
|
||||
|
||||
ai_mode = AI_GOAL_CHASE;
|
||||
ai_submode = SM_ATTACK;
|
||||
@@ -1136,8 +1139,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
Assert( ship_team != target_team );
|
||||
|
||||
// Orders to override protect
|
||||
if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) {
|
||||
Objects[ainfo->target_objnum].flags &= ~OF_PROTECTED;
|
||||
if (override_protect_ship_type(&Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index])) {
|
||||
Objects[ainfo->target_objnum].flags.remove(Object::Object_Flags::Protected);
|
||||
}
|
||||
|
||||
ai_mode = AI_GOAL_DISABLE_SHIP;
|
||||
@@ -1150,8 +1153,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
Assert( ship_team != target_team );
|
||||
|
||||
// Orders to override protect
|
||||
if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) {
|
||||
Objects[ainfo->target_objnum].flags &= ~OF_PROTECTED;
|
||||
if (override_protect_ship_type(&Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index])) {
|
||||
Objects[ainfo->target_objnum].flags.remove(Object::Object_Flags::Protected);
|
||||
}
|
||||
|
||||
ai_mode = AI_GOAL_DISARM_SHIP;
|
||||
@@ -1166,8 +1169,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
Assert( ainfo->targeted_subsys->current_hits > 0.0f);
|
||||
|
||||
// Orders to override protect
|
||||
if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) {
|
||||
Objects[ainfo->target_objnum].flags &= ~OF_PROTECTED;
|
||||
if (override_protect_ship_type(&Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index])) {
|
||||
Objects[ainfo->target_objnum].flags.remove(Object::Object_Flags::Protected);
|
||||
}
|
||||
|
||||
ai_mode = AI_GOAL_DESTROY_SUBSYSTEM;
|
||||
@@ -1182,9 +1185,9 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
|
||||
Assert(ainfo->target_objnum > -1);
|
||||
|
||||
Objects[ainfo->target_objnum].flags |= OF_PROTECTED;
|
||||
|
||||
ai_mode = AI_GOAL_DOCK;
|
||||
Objects[ainfo->target_objnum].flags.set(Object::Object_Flags::Protected);
|
||||
|
||||
ai_mode = AI_GOAL_DOCK;
|
||||
ai_submode = AIS_DOCK_0;
|
||||
message = MESSAGE_DOCK_YES;
|
||||
break;
|
||||
@@ -1243,7 +1246,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
ai_mode = AI_GOAL_WARP;
|
||||
ai_submode = -1;
|
||||
message = MESSAGE_WARP_OUT;
|
||||
Ships[shipnum].flags |= SF_DEPARTURE_ORDERED;
|
||||
Ships[shipnum].flags.set(Ship::Ship_Flags::Departure_ordered);
|
||||
break;
|
||||
|
||||
// the following are support ship options!!!
|
||||
@@ -1319,7 +1322,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
}
|
||||
|
||||
// this is the _response_
|
||||
if ( send_message && (!(Ships[shipnum].flags2 & SF2_NO_BUILTIN_MESSAGES)))
|
||||
if ( send_message && (!(Ships[shipnum].flags[Ship::Ship_Flags::No_builtin_messages])))
|
||||
{
|
||||
message_send_builtin_to_player( message, &Ships[shipnum], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_ANYTIME, 0, 0, player_num, message_team_filter );
|
||||
}
|
||||
@@ -1833,7 +1836,7 @@ void hud_squadmsg_call_reinforcement(int reinforcement_num, int player_num)
|
||||
if ( p_objp ) {
|
||||
// by resetting the reinforcement flag, we will allow code which normally handles arrivals
|
||||
// to make this reinforcement arrive. Doing so keeps the data structures clean.
|
||||
p_objp->flags &= ~P_SF_REINFORCEMENT;
|
||||
p_objp->flags.remove(Mission::Parse_Object_Flags::SF_Reinforcement);
|
||||
|
||||
// set up the arrival delay
|
||||
delay = rp->arrival_delay;
|
||||
@@ -2014,7 +2017,7 @@ void hud_squadmsg_ship_command()
|
||||
continue;
|
||||
|
||||
// don't send message to non fighter wings
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) )
|
||||
if ( !(Ship_info[shipp->ship_info_index].is_fighter_bomber()) )
|
||||
continue;
|
||||
|
||||
all_accept &= shipp->orders_accepted; // 'and'ing will either keep this bit set or zero it properly
|
||||
|
||||
+181
-172
@@ -45,9 +45,6 @@
|
||||
#include "weapon/emp.h"
|
||||
#include "weapon/weapon.h"
|
||||
|
||||
// If any of these bits in the ship->flags are set, ignore this ship when targeting
|
||||
int TARGET_SHIP_IGNORE_FLAGS = (SF_EXPLODED|SF_DEPART_WARP|SF_DYING|SF_ARRIVING_STAGE_1|SF_HIDDEN_FROM_SENSORS);
|
||||
|
||||
// Global values for the target bracket width and height, used for debugging
|
||||
int Hud_target_w, Hud_target_h;
|
||||
|
||||
@@ -498,7 +495,7 @@ void hud_maybe_set_sorted_turret_subsys(ship *shipp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[shipp->ship_info_index].is_big_or_huge()) {
|
||||
if (shipp->last_targeted_subobject[Player_num] == NULL) {
|
||||
hud_target_live_turret(1, 1);
|
||||
}
|
||||
@@ -544,7 +541,7 @@ void hud_check_reticle_list()
|
||||
rl = GET_FIRST(&Reticle_cur_list);
|
||||
while( rl !=END_OF_LIST(&Reticle_cur_list) ) {
|
||||
temp = GET_NEXT(rl);
|
||||
if ( rl->objp->flags & OF_SHOULD_BE_DEAD ) {
|
||||
if ( rl->objp->flags[Object::Object_Flags::Should_be_dead] ) {
|
||||
list_remove( &Reticle_cur_list, rl );
|
||||
rl->flags = 0;
|
||||
}
|
||||
@@ -792,7 +789,7 @@ void hud_target_hotkey_add_remove( int k, object *ctarget, int how_to_add )
|
||||
return;
|
||||
|
||||
// don't put dying or departing
|
||||
if ( Ships[ctarget->instance].flags & (SF_DYING|SF_DEPARTING) )
|
||||
if ( Ships[ctarget->instance].is_dying_or_departing() )
|
||||
return;
|
||||
|
||||
// don't add mission file added hotkey assignments if there are player added assignments
|
||||
@@ -1065,7 +1062,7 @@ void hud_init_targeting()
|
||||
Target_newest_ship_timestamp = timestamp(0);
|
||||
Target_next_turret_timestamp = timestamp(0);
|
||||
|
||||
if(The_mission.flags & MISSION_FLAG_FULLNEB) {
|
||||
if(The_mission.flags[Mission::Mission_Flags::Fullneb]) {
|
||||
Toggle_text_alpha = TOGGLE_TEXT_NEBULA_ALPHA;
|
||||
} else {
|
||||
Toggle_text_alpha = TOGGLE_TEXT_NORMAL_ALPHA;
|
||||
@@ -1191,7 +1188,7 @@ void hud_target_common(int team_mask, int next_flag)
|
||||
}
|
||||
|
||||
if (A->type == OBJ_SHIP) {
|
||||
if (Ships[A->instance].flags & TARGET_SHIP_IGNORE_FLAGS)
|
||||
if (should_be_ignored(&Ships[A->instance]))
|
||||
continue;
|
||||
|
||||
is_ship = 1;
|
||||
@@ -1217,7 +1214,7 @@ void hud_target_common(int team_mask, int next_flag)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( A == Player_obj || (shipp->flags & TARGET_SHIP_IGNORE_FLAGS) ){
|
||||
if ( A == Player_obj || (should_be_ignored(shipp)) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1293,123 +1290,135 @@ ship_obj *advance_ship(ship_obj *so, int next_flag)
|
||||
///
|
||||
/// \returns The next object to target if targeting was successful.
|
||||
/// Returns NULL if targeting was unsuccessful.
|
||||
static object* select_next_target_by_distance( const bool targeting_from_closest_to_farthest, const int valid_team_mask, const int attacked_object_number = -1, const int target_filters = (SIF_CARGO | SIF_NAVBUOY)) {
|
||||
object *minimum_object_ptr, *maximum_object_ptr, *nearest_object_ptr;
|
||||
minimum_object_ptr = maximum_object_ptr = nearest_object_ptr = NULL;
|
||||
float current_distance = hud_find_target_distance(&Objects[Player_ai->target_objnum], Player_obj);
|
||||
float minimum_distance = 1e20f;
|
||||
float maximum_distance = 0.0f;
|
||||
int player_object_index = OBJ_INDEX(Player_obj);
|
||||
|
||||
float nearest_distance;
|
||||
if ( targeting_from_closest_to_farthest ) {
|
||||
nearest_distance = 1e20f;
|
||||
} else {
|
||||
nearest_distance = 0.0f;
|
||||
}
|
||||
|
||||
ship_obj *ship_object_ptr;
|
||||
object *prospective_victim_ptr;
|
||||
ship *prospective_victim_ship_ptr;
|
||||
for ( ship_object_ptr = GET_FIRST(&Ship_obj_list); ship_object_ptr != END_OF_LIST(&Ship_obj_list); ship_object_ptr = GET_NEXT( ship_object_ptr) ) {
|
||||
prospective_victim_ptr = &Objects[ ship_object_ptr->objnum];
|
||||
// get a pointer to the ship information
|
||||
prospective_victim_ship_ptr = &Ships[prospective_victim_ptr->instance];
|
||||
|
||||
float new_distance;
|
||||
if ( (prospective_victim_ptr == Player_obj) || (prospective_victim_ship_ptr->flags & TARGET_SHIP_IGNORE_FLAGS) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// choose from the correct team
|
||||
if ( !iff_matches_mask(prospective_victim_ship_ptr->team, valid_team_mask) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't use object if it is already a target
|
||||
if ( OBJ_INDEX(prospective_victim_ptr) == Player_ai->target_objnum ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if( attacked_object_number == -1 ) {
|
||||
// always ignore navbuoys and cargo
|
||||
if ( Ship_info[prospective_victim_ship_ptr->ship_info_index].flags & target_filters ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(hud_target_invalid_awacs(prospective_victim_ptr)){
|
||||
continue;
|
||||
}
|
||||
|
||||
new_distance = hud_find_target_distance(prospective_victim_ptr,Player_obj);
|
||||
} else {
|
||||
// Filter out any target that is not targeting the player --Mastadon
|
||||
if ( (attacked_object_number == player_object_index) && (Ai_info[prospective_victim_ship_ptr->ai_index].target_objnum != player_object_index) ) {
|
||||
continue;
|
||||
}
|
||||
esct eval_ship_as_closest_target_args;
|
||||
eval_ship_as_closest_target_args.attacked_objnum = attacked_object_number;
|
||||
eval_ship_as_closest_target_args.check_all_turrets = (attacked_object_number == player_object_index);
|
||||
eval_ship_as_closest_target_args.check_nearest_turret = FALSE;
|
||||
// We don't ever filter our target selection to just bombers or fighters
|
||||
// because the select next attacker logic doesn't. --Mastadon
|
||||
eval_ship_as_closest_target_args.filter = 0;
|
||||
eval_ship_as_closest_target_args.team_mask = valid_team_mask;
|
||||
// We always get the turret attacking, since that's how the select next
|
||||
// attacker logic does it. --Mastadon
|
||||
eval_ship_as_closest_target_args.turret_attacking_target = 1;
|
||||
eval_ship_as_closest_target_args.shipp = prospective_victim_ship_ptr;
|
||||
evaluate_ship_as_closest_target( &eval_ship_as_closest_target_args );
|
||||
|
||||
new_distance = eval_ship_as_closest_target_args.min_distance;
|
||||
}
|
||||
|
||||
|
||||
if (new_distance <= minimum_distance) {
|
||||
minimum_distance = new_distance;
|
||||
minimum_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
|
||||
if (new_distance >= maximum_distance) {
|
||||
maximum_distance = new_distance;
|
||||
maximum_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
|
||||
float diff = 0.0f;
|
||||
if ( targeting_from_closest_to_farthest ) {
|
||||
diff = new_distance - current_distance;
|
||||
if ( diff > 0.0f ) {
|
||||
if ( diff < ( nearest_distance - current_distance ) ) {
|
||||
nearest_distance = new_distance;
|
||||
nearest_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
diff = current_distance - new_distance;
|
||||
if ( diff > 0.0f ) {
|
||||
if ( diff < ( current_distance - nearest_distance ) ) {
|
||||
nearest_distance = new_distance;
|
||||
nearest_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static object* select_next_target_by_distance(const bool targeting_from_closest_to_farthest, const int valid_team_mask, const int attacked_object_number = -1, flagset<Ship::Info_Flags>* target_filters = NULL) {
|
||||
object *minimum_object_ptr, *maximum_object_ptr, *nearest_object_ptr;
|
||||
minimum_object_ptr = maximum_object_ptr = nearest_object_ptr = NULL;
|
||||
float current_distance = hud_find_target_distance(&Objects[Player_ai->target_objnum], Player_obj);
|
||||
float minimum_distance = 1e20f;
|
||||
float maximum_distance = 0.0f;
|
||||
int player_object_index = OBJ_INDEX(Player_obj);
|
||||
flagset<Ship::Info_Flags> filter;
|
||||
|
||||
if ( nearest_object_ptr == NULL ) {
|
||||
if (target_filters != NULL) {
|
||||
filter = *target_filters;
|
||||
} else {
|
||||
filter.set(Ship::Info_Flags::Cargo);
|
||||
filter.set(Ship::Info_Flags::Navbuoy);
|
||||
}
|
||||
|
||||
if ( targeting_from_closest_to_farthest ) {
|
||||
if ( minimum_object_ptr != NULL ) {
|
||||
nearest_object_ptr = minimum_object_ptr;
|
||||
}
|
||||
} else {
|
||||
if ( maximum_object_ptr != NULL ) {
|
||||
nearest_object_ptr = maximum_object_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
float nearest_distance;
|
||||
if (targeting_from_closest_to_farthest) {
|
||||
nearest_distance = 1e20f;
|
||||
}
|
||||
else {
|
||||
nearest_distance = 0.0f;
|
||||
}
|
||||
|
||||
return nearest_object_ptr;
|
||||
ship_obj *ship_object_ptr;
|
||||
object *prospective_victim_ptr;
|
||||
ship *prospective_victim_ship_ptr;
|
||||
for (ship_object_ptr = GET_FIRST(&Ship_obj_list); ship_object_ptr != END_OF_LIST(&Ship_obj_list); ship_object_ptr = GET_NEXT(ship_object_ptr)) {
|
||||
prospective_victim_ptr = &Objects[ship_object_ptr->objnum];
|
||||
// get a pointer to the ship information
|
||||
prospective_victim_ship_ptr = &Ships[prospective_victim_ptr->instance];
|
||||
|
||||
float new_distance;
|
||||
if ((prospective_victim_ptr == Player_obj) || (should_be_ignored(prospective_victim_ship_ptr))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// choose from the correct team
|
||||
if (!iff_matches_mask(prospective_victim_ship_ptr->team, valid_team_mask)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't use object if it is already a target
|
||||
if (OBJ_INDEX(prospective_victim_ptr) == Player_ai->target_objnum) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (attacked_object_number == -1) {
|
||||
// always ignore navbuoys and cargo
|
||||
if ((Ship_info[prospective_victim_ship_ptr->ship_info_index].flags & filter).any_set()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hud_target_invalid_awacs(prospective_victim_ptr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
new_distance = hud_find_target_distance(prospective_victim_ptr, Player_obj);
|
||||
}
|
||||
else {
|
||||
// Filter out any target that is not targeting the player --Mastadon
|
||||
if ((attacked_object_number == player_object_index) && (Ai_info[prospective_victim_ship_ptr->ai_index].target_objnum != player_object_index)) {
|
||||
continue;
|
||||
}
|
||||
esct eval_ship_as_closest_target_args;
|
||||
eval_ship_as_closest_target_args.attacked_objnum = attacked_object_number;
|
||||
eval_ship_as_closest_target_args.check_all_turrets = (attacked_object_number == player_object_index);
|
||||
eval_ship_as_closest_target_args.check_nearest_turret = FALSE;
|
||||
// We don't ever filter our target selection to just bombers or fighters
|
||||
// because the select next attacker logic doesn't. --Mastadon
|
||||
eval_ship_as_closest_target_args.filter = 0;
|
||||
eval_ship_as_closest_target_args.team_mask = valid_team_mask;
|
||||
// We always get the turret attacking, since that's how the select next
|
||||
// attacker logic does it. --Mastadon
|
||||
eval_ship_as_closest_target_args.turret_attacking_target = 1;
|
||||
eval_ship_as_closest_target_args.shipp = prospective_victim_ship_ptr;
|
||||
evaluate_ship_as_closest_target(&eval_ship_as_closest_target_args);
|
||||
|
||||
new_distance = eval_ship_as_closest_target_args.min_distance;
|
||||
}
|
||||
|
||||
|
||||
if (new_distance <= minimum_distance) {
|
||||
minimum_distance = new_distance;
|
||||
minimum_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
|
||||
if (new_distance >= maximum_distance) {
|
||||
maximum_distance = new_distance;
|
||||
maximum_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
|
||||
float diff = 0.0f;
|
||||
if (targeting_from_closest_to_farthest) {
|
||||
diff = new_distance - current_distance;
|
||||
if (diff > 0.0f) {
|
||||
if (diff < (nearest_distance - current_distance)) {
|
||||
nearest_distance = new_distance;
|
||||
nearest_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
diff = current_distance - new_distance;
|
||||
if (diff > 0.0f) {
|
||||
if (diff < (current_distance - nearest_distance)) {
|
||||
nearest_distance = new_distance;
|
||||
nearest_object_ptr = prospective_victim_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nearest_object_ptr == NULL) {
|
||||
|
||||
if (targeting_from_closest_to_farthest) {
|
||||
if (minimum_object_ptr != NULL) {
|
||||
nearest_object_ptr = minimum_object_ptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (maximum_object_ptr != NULL) {
|
||||
nearest_object_ptr = maximum_object_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nearest_object_ptr;
|
||||
}
|
||||
|
||||
ship_obj *get_ship_obj_ptr_from_index(int index);
|
||||
@@ -1493,8 +1502,8 @@ void hud_target_missile(object *source_obj, int next_flag)
|
||||
|
||||
if ( (aip->target_objnum != -1)
|
||||
&& (Objects[aip->target_objnum].type == OBJ_SHIP)
|
||||
&& ((Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].flags & SIF_BOMBER)
|
||||
|| (Objects[aip->target_objnum].flags & OF_TARGETABLE_AS_BOMB))) {
|
||||
&& ((Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].flags[Ship::Info_Flags::Bomber])
|
||||
|| (Objects[aip->target_objnum].flags[Object::Object_Flags::Targetable_as_bomb]))) {
|
||||
int index = Ships[Objects[aip->target_objnum].instance].ship_list_index;
|
||||
startShip = get_ship_obj_ptr_from_index(index);
|
||||
} else {
|
||||
@@ -1519,12 +1528,12 @@ void hud_target_missile(object *source_obj, int next_flag)
|
||||
}
|
||||
|
||||
// check if ship type is bomber
|
||||
if ( !(Ship_info[Ships[A->instance].ship_info_index].flags & SIF_BOMBER) && !(A->flags & OF_TARGETABLE_AS_BOMB) ) {
|
||||
if ( !(Ship_info[Ships[A->instance].ship_info_index].flags[Ship::Info_Flags::Bomber]) && !(A->flags[Object::Object_Flags::Targetable_as_bomb]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check if ignore
|
||||
if ( Ships[A->instance].flags & TARGET_SHIP_IGNORE_FLAGS ){
|
||||
if ( should_be_ignored(&Ships[A->instance]) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1549,11 +1558,11 @@ int hud_target_ship_can_be_scanned(ship *shipp)
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// ignore cargo that has already been scanned
|
||||
if (shipp->flags & SF_CARGO_REVEALED)
|
||||
if (shipp->flags[Ship::Ship_Flags::Cargo_revealed])
|
||||
return 0;
|
||||
|
||||
// allow ships with scannable flag set
|
||||
if (shipp->flags & SF_SCANNABLE)
|
||||
if (shipp->flags[Ship::Ship_Flags::Scannable])
|
||||
return 1;
|
||||
|
||||
// ignore ships that don't carry cargo
|
||||
@@ -1589,7 +1598,7 @@ void hud_target_uninspected_cargo(int next_flag)
|
||||
|
||||
shipp = &Ships[A->instance]; // get a pointer to the ship information
|
||||
|
||||
if ( shipp->flags & TARGET_SHIP_IGNORE_FLAGS ) {
|
||||
if ( should_be_ignored(shipp) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1644,11 +1653,11 @@ void hud_target_newest_ship()
|
||||
A = &Objects[so->objnum];
|
||||
shipp = &Ships[A->instance]; // get a pointer to the ship information
|
||||
|
||||
if ( (A == Player_obj) || (shipp->flags & TARGET_SHIP_IGNORE_FLAGS) )
|
||||
if ( (A == Player_obj) || (should_be_ignored(shipp)) )
|
||||
continue;
|
||||
|
||||
// ignore navbuoys
|
||||
if ( Ship_info[shipp->ship_info_index].flags & SIF_NAVBUOY ) {
|
||||
if ( Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Navbuoy] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2093,7 +2102,7 @@ bool evaluate_ship_as_closest_target(esct *esct_p)
|
||||
}
|
||||
|
||||
// check if player or ignore ship
|
||||
if ( (esct_p->shipp->objnum == OBJ_INDEX(Player_obj)) || (esct_p->shipp->flags & TARGET_SHIP_IGNORE_FLAGS) ) {
|
||||
if ( (esct_p->shipp->objnum == OBJ_INDEX(Player_obj)) || (should_be_ignored(esct_p->shipp)) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2109,13 +2118,13 @@ bool evaluate_ship_as_closest_target(esct *esct_p)
|
||||
|
||||
// If filter is set, only target fighters and bombers
|
||||
if ( esct_p->filter ) {
|
||||
if ( !(Ship_info[esct_p->shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) ) {
|
||||
if ( !(Ship_info[esct_p->shipp->ship_info_index].is_fighter_bomber()) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// find closest turret to player if BIG or HUGE ship
|
||||
if (Ship_info[esct_p->shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[esct_p->shipp->ship_info_index].is_big_or_huge()) {
|
||||
for (ss=GET_FIRST(&esct_p->shipp->subsys_list); ss!=END_OF_LIST(&esct_p->shipp->subsys_list); ss=GET_NEXT(ss)) {
|
||||
|
||||
if (ss->flags & SSF_UNTARGETABLE)
|
||||
@@ -2239,7 +2248,7 @@ int hud_target_closest(int team_mask, int attacked_objnum, int play_fail_snd, in
|
||||
}
|
||||
|
||||
// bail if ship is to be ignored
|
||||
if (Ships[Objects[attacked_objnum].instance].flags & TARGET_SHIP_IGNORE_FLAGS) {
|
||||
if (should_be_ignored(&Ships[Objects[attacked_objnum].instance])) {
|
||||
goto Target_closest_done;
|
||||
}
|
||||
}
|
||||
@@ -2419,7 +2428,7 @@ void hud_target_targets_target()
|
||||
goto ttt_fail;
|
||||
}
|
||||
|
||||
if ( Ships[tt_objp->instance].flags & TARGET_SHIP_IGNORE_FLAGS ) {
|
||||
if ( should_be_ignored(&Ships[tt_objp->instance]) ) {
|
||||
goto ttt_fail;
|
||||
}
|
||||
|
||||
@@ -2515,7 +2524,7 @@ void hud_target_in_reticle_new()
|
||||
|
||||
|
||||
if ( A->type == OBJ_SHIP ) {
|
||||
if ( Ships[A->instance].flags & TARGET_SHIP_IGNORE_FLAGS ){
|
||||
if ( should_be_ignored(&Ships[A->instance]) ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2623,7 +2632,7 @@ void hud_target_in_reticle_old()
|
||||
}
|
||||
|
||||
if ( A->type == OBJ_SHIP ) {
|
||||
if ( Ships[A->instance].flags & TARGET_SHIP_IGNORE_FLAGS ){
|
||||
if ( should_be_ignored(&Ships[A->instance]) ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2699,7 +2708,7 @@ void hud_target_subsystem_in_reticle()
|
||||
int shipnum = targetp->instance;
|
||||
|
||||
if ( targetp->type == OBJ_SHIP ) {
|
||||
if ( Ships[shipnum].flags & TARGET_SHIP_IGNORE_FLAGS ) {
|
||||
if ( should_be_ignored(&Ships[shipnum]) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3282,7 +3291,7 @@ void hud_show_message_sender()
|
||||
}
|
||||
|
||||
// Goober5000 - don't draw if primitive sensors
|
||||
if ( Ships[Player_obj->instance].flags2 & SF2_PRIMITIVE_SENSORS ) {
|
||||
if ( Ships[Player_obj->instance].flags[Ship::Ship_Flags::Primitive_sensors] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3290,8 +3299,8 @@ void hud_show_message_sender()
|
||||
// their position cause they're feeling chatty
|
||||
// MageKing17 - Make the check see if they're actually stealthed at the time, and may as well include a check for
|
||||
// being hidden from sensors, too; logic copied from a similar check in hudescort.cpp
|
||||
if ( (Ships[Message_shipnum].flags & SF_HIDDEN_FROM_SENSORS)
|
||||
|| ((Ships[Message_shipnum].flags2 & SF2_STEALTH) && ((Ships[Message_shipnum].team != Player_ship->team) || (Ships[Message_shipnum].flags2 & SF2_FRIENDLY_STEALTH_INVIS)))
|
||||
if ( (Ships[Message_shipnum].flags[Ship::Ship_Flags::Hidden_from_sensors])
|
||||
|| ((Ships[Message_shipnum].flags[Ship::Ship_Flags::Stealth]) && ((Ships[Message_shipnum].team != Player_ship->team) || (Ships[Message_shipnum].flags[Ship::Ship_Flags::Friendly_stealth_invis])))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -3299,7 +3308,7 @@ void hud_show_message_sender()
|
||||
Assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS );
|
||||
|
||||
// check the object flags to see if this ship is gone. If so, then don't do this stuff anymore
|
||||
if ( targetp->flags & OF_SHOULD_BE_DEAD ) {
|
||||
if ( targetp->flags[Object::Object_Flags::Should_be_dead] ) {
|
||||
Message_shipnum = -1;
|
||||
return;
|
||||
}
|
||||
@@ -3358,7 +3367,7 @@ void hud_prune_hotkeys()
|
||||
|
||||
// check to see if the object is dying -- if so, remove it from the list
|
||||
// check to see if the ship is departing -- if so, remove it from the list
|
||||
if ( remove_item || (objp->flags & OF_SHOULD_BE_DEAD) || (sp->flags & (SF_DEPARTING|SF_DYING)) ) {
|
||||
if ( remove_item || (objp->flags[Object::Object_Flags::Should_be_dead]) || (sp->is_dying_or_departing()) ) {
|
||||
if ( sp != NULL ) {
|
||||
nprintf(("Network", "Hotkey: Pruning %s\n", sp->ship_name));
|
||||
}
|
||||
@@ -3582,7 +3591,7 @@ void hud_show_hostile_triangle()
|
||||
aip = &Ai_info[Ships[A->instance].ai_index];
|
||||
|
||||
// don't look at ignore ships
|
||||
if ( sp->flags & TARGET_SHIP_IGNORE_FLAGS ) {
|
||||
if ( should_be_ignored(sp) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3599,7 +3608,7 @@ void hud_show_hostile_triangle()
|
||||
turret_is_attacking = 0;
|
||||
|
||||
// check if any turrets on ship are firing at the player (only on non fighter-bombers)
|
||||
if ( !(Ship_info[sp->ship_info_index].flags & (SIF_FIGHTER|SIF_BOMBER)) ) {
|
||||
if ( !(Ship_info[sp->ship_info_index].is_fighter_bomber()) ) {
|
||||
for (ss = GET_FIRST(&sp->subsys_list); ss != END_OF_LIST(&sp->subsys_list); ss = GET_NEXT(ss) ) {
|
||||
if (ss->flags & SSF_UNTARGETABLE)
|
||||
continue;
|
||||
@@ -3728,7 +3737,7 @@ int hud_get_best_primary_bank(float *range)
|
||||
farthest_weapon_range = 0.0f;
|
||||
best_bank = -1;
|
||||
|
||||
if ( Player_ship->flags & SF_PRIMARY_LINKED ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Primary_linked] ) {
|
||||
num_to_test = swp->num_primary_banks;
|
||||
} else {
|
||||
num_to_test = MIN(1, swp->num_primary_banks);
|
||||
@@ -4615,11 +4624,11 @@ int hud_communications_state(ship *sp)
|
||||
}
|
||||
|
||||
// Goober5000 - if the ship is the player, and he's dying, return OK (so laments can be played)
|
||||
if ((sp == Player_ship) && (sp->flags & SF_DYING))
|
||||
if ((sp == Player_ship) && (sp->flags[Ship::Ship_Flags::Dying]))
|
||||
return COMM_OK;
|
||||
|
||||
// Goober5000 - check for scrambled communications
|
||||
if ( emp_active_local() || sp->flags2 & SF2_SCRAMBLE_MESSAGES )
|
||||
if ( emp_active_local() || sp->flags[Ship::Ship_Flags::Scramble_messages] )
|
||||
return COMM_SCRAMBLED;
|
||||
|
||||
str = ship_get_subsystem_strength( sp, SUBSYSTEM_COMMUNICATION );
|
||||
@@ -4731,7 +4740,7 @@ void HudGaugeAutoTarget::initOffColor(int r, int g, int b, int a)
|
||||
|
||||
void HudGaugeAutoTarget::render(float frametime)
|
||||
{
|
||||
if (Player_ship->flags2 & SF2_PRIMITIVE_SENSORS)
|
||||
if (Player_ship->flags[Ship::Ship_Flags::Primitive_sensors])
|
||||
return;
|
||||
|
||||
int frame_offset;
|
||||
@@ -4817,7 +4826,7 @@ void HudGaugeAutoSpeed::initOffColor(int r, int g, int b, int a)
|
||||
|
||||
void HudGaugeAutoSpeed::render(float frametime)
|
||||
{
|
||||
if (Player_ship->flags2 & SF2_PRIMITIVE_SENSORS)
|
||||
if (Player_ship->flags[Ship::Ship_Flags::Primitive_sensors])
|
||||
return;
|
||||
|
||||
int frame_offset;
|
||||
@@ -4870,11 +4879,11 @@ int hud_target_closest_repair_ship(int goal_objnum)
|
||||
shipp = &Ships[A->instance]; // get a pointer to the ship information
|
||||
|
||||
// ignore all ships that aren't repair ships
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags & SIF_SUPPORT) ) {
|
||||
if ( !(Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Support]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( (A == Player_obj) || (shipp->flags & TARGET_SHIP_IGNORE_FLAGS) )
|
||||
if ( (A == Player_obj) || (should_be_ignored(shipp)) )
|
||||
continue;
|
||||
|
||||
// only consider friendly ships
|
||||
@@ -4919,11 +4928,11 @@ int hud_target_closest_repair_ship(int goal_objnum)
|
||||
|
||||
void hud_target_toggle_hidden_from_sensors()
|
||||
{
|
||||
if ( TARGET_SHIP_IGNORE_FLAGS & SF_HIDDEN_FROM_SENSORS ) {
|
||||
TARGET_SHIP_IGNORE_FLAGS &= ~SF_HIDDEN_FROM_SENSORS;
|
||||
if ( Ignore_List[Ship::Ship_Flags::Hidden_from_sensors] ) {
|
||||
Ignore_List.remove(Ship::Ship_Flags::Hidden_from_sensors);
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, NOX("Target hiding from sensors disabled"));
|
||||
} else {
|
||||
TARGET_SHIP_IGNORE_FLAGS |= SF_HIDDEN_FROM_SENSORS;
|
||||
Ignore_List.set(Ship::Ship_Flags::Hidden_from_sensors);
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, NOX("Target hiding from sensors enabled"));
|
||||
}
|
||||
}
|
||||
@@ -4942,7 +4951,7 @@ void hud_target_closest_uninspected_object()
|
||||
A = &Objects[so->objnum];
|
||||
shipp = &Ships[A->instance]; // get a pointer to the ship information
|
||||
|
||||
if ( (A == Player_obj) || (shipp->flags & TARGET_SHIP_IGNORE_FLAGS) ){
|
||||
if ( (A == Player_obj) || (should_be_ignored(shipp)) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5005,7 +5014,7 @@ void hud_target_uninspected_object(int next_flag)
|
||||
A = &Objects[so->objnum];
|
||||
shipp = &Ships[A->instance]; // get a pointer to the ship information
|
||||
|
||||
if ( (A == Player_obj) || (shipp->flags & TARGET_SHIP_IGNORE_FLAGS) )
|
||||
if ( (A == Player_obj) || (should_be_ignored(shipp)) )
|
||||
continue;
|
||||
|
||||
// ignore all non-cargo carrying craft
|
||||
@@ -5150,7 +5159,7 @@ void hud_target_last_transmit()
|
||||
play_fail_sound = 0;
|
||||
} else {
|
||||
if ( Transmit_target_list[transmit_index].objsig == Objects[Transmit_target_list[transmit_index].objnum].signature ) {
|
||||
if ( !(Ships[Objects[transmit_objnum].instance].flags & TARGET_SHIP_IGNORE_FLAGS) ) {
|
||||
if ( !(should_be_ignored(&Ships[Objects[transmit_objnum].instance])) ) {
|
||||
Transmit_target_current_slot = transmit_index-1;
|
||||
if ( Transmit_target_current_slot < 0 ) {
|
||||
Transmit_target_current_slot = MAX_TRANSMIT_TARGETS - 1;
|
||||
@@ -5269,7 +5278,7 @@ void hudtarget_page_in()
|
||||
void hud_stuff_ship_name(char *ship_name_text, ship *shipp)
|
||||
{
|
||||
// print ship name
|
||||
if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) ) {
|
||||
if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags[Ship::Ship_Flags::Hide_ship_name]) ) {
|
||||
*ship_name_text = 0;
|
||||
} else {
|
||||
strcpy(ship_name_text, shipp->ship_name);
|
||||
@@ -5437,7 +5446,7 @@ void HudGaugeAfterburner::render(float frametime)
|
||||
}
|
||||
|
||||
Assert(Player_ship);
|
||||
if ( !(Ship_info[Player_ship->ship_info_index].flags & SIF_AFTERBURNER) ) {
|
||||
if ( !(Ship_info[Player_ship->ship_info_index].flags[Ship::Info_Flags::Afterburner]) ) {
|
||||
// Goober5000 - instead of drawing an empty burner gauge, don't draw the gauge at all
|
||||
return;
|
||||
} else {
|
||||
@@ -5532,7 +5541,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
bool use_new_gauge = false;
|
||||
|
||||
// Goober5000 - only check for the new gauge in case of command line + a ballistic-capable ship
|
||||
if (Cmdline_ballistic_gauge && Ship_info[Player_ship->ship_info_index].flags & SIF_BALLISTIC_PRIMARIES)
|
||||
if (Cmdline_ballistic_gauge && Ship_info[Player_ship->ship_info_index].flags[Ship::Info_Flags::Ballistic_primaries])
|
||||
{
|
||||
for(x = 0; x < Player_ship->weapons.num_primary_banks; x++)
|
||||
{
|
||||
@@ -5590,7 +5599,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
continue;
|
||||
|
||||
//Draw the weapon bright or normal depending if it's active or not.
|
||||
if(x == Player_ship->weapons.current_primary_bank || (Player_ship->flags & SF_PRIMARY_LINKED)) {
|
||||
if(x == Player_ship->weapons.current_primary_bank || (Player_ship->flags[Ship::Ship_Flags::Primary_linked])) {
|
||||
setGaugeColor(HUD_C_BRIGHT);
|
||||
} else {
|
||||
setGaugeColor(HUD_C_NORMAL);
|
||||
@@ -5642,8 +5651,8 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
sw = &Player_ship->weapons;
|
||||
|
||||
// show ballistic ammunition in energy gauge if need be
|
||||
if ( Show_ballistic && Ship_info[Player_ship->ship_info_index].flags & SIF_BALLISTIC_PRIMARIES ) {
|
||||
if ( Player_ship->flags & SF_PRIMARY_LINKED ) {
|
||||
if ( Show_ballistic && Ship_info[Player_ship->ship_info_index].flags[Ship::Info_Flags::Ballistic_primaries] ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Primary_linked] ) {
|
||||
|
||||
// go through all ballistic primaries and add up their ammunition totals and max capacities
|
||||
for ( i = 0; i < sw->num_primary_banks; i++ ) {
|
||||
@@ -5709,7 +5718,7 @@ void HudGaugeWeaponEnergy::render(float frametime)
|
||||
|
||||
// list currently armed primary banks if we have to
|
||||
if ( Show_armed ) {
|
||||
if ( Player_ship->flags & SF_PRIMARY_LINKED ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Primary_linked] ) {
|
||||
// show all primary banks
|
||||
for ( i = 0; i < Player_ship->weapons.num_primary_banks; i++ ) {
|
||||
wip = &Weapon_info[sw->primary_bank_weapons[i]];
|
||||
@@ -6032,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 & SF_PRIMARY_LINKED)) || ((Player_ship->flags & SF_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_flags3 & WIF3_NOLINK))) {
|
||||
renderPrintf(position[0] + Weapon_plink_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
|
||||
}
|
||||
|
||||
@@ -6100,7 +6109,7 @@ void HudGaugeWeapons::render(float frametime)
|
||||
renderPrintf(position[0] + Weapon_sunlinked_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
|
||||
|
||||
// indicate if this is linked
|
||||
if ( Player_ship->flags & SF_SECONDARY_DUAL_FIRE ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Secondary_dual_fire] ) {
|
||||
renderPrintf(position[0] + Weapon_slinked_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon);
|
||||
}
|
||||
|
||||
@@ -6900,7 +6909,7 @@ void HudGaugePrimaryWeapons::render(float frametime)
|
||||
}
|
||||
|
||||
// indicate if this is linked or currently armed
|
||||
if ( (sw->current_primary_bank == i) || (Player_ship->flags & SF_PRIMARY_LINKED) ) {
|
||||
if ( (sw->current_primary_bank == i) || (Player_ship->flags[Ship::Ship_Flags::Primary_linked]) ) {
|
||||
renderPrintf(position[0] + _plink_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon);
|
||||
}
|
||||
|
||||
@@ -7014,7 +7023,7 @@ void HudGaugeSecondaryWeapons::render(float frametime)
|
||||
renderPrintf(position[0] + _sunlinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon);
|
||||
|
||||
// indicate if this is linked
|
||||
if ( Player_ship->flags & SF_SECONDARY_DUAL_FIRE ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Secondary_dual_fire] ) {
|
||||
renderPrintf(position[0] + _slinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon);
|
||||
}
|
||||
|
||||
@@ -7216,7 +7225,7 @@ void HudGaugeHardpoints::render(float frametime)
|
||||
|
||||
model_render_params weapon_render_info;
|
||||
|
||||
if ( swp->current_secondary_bank == i && ( swp->secondary_next_slot[i] == k || ( swp->secondary_next_slot[i]+1 == k && sp->flags & SF_SECONDARY_DUAL_FIRE ) ) ) {
|
||||
if ( swp->current_secondary_bank == i && ( swp->secondary_next_slot[i] == k || ( swp->secondary_next_slot[i]+1 == k && sp->flags[Ship::Ship_Flags::Secondary_dual_fire] ) ) ) {
|
||||
weapon_render_info.set_color(Color_bright_blue);
|
||||
} else {
|
||||
weapon_render_info.set_color(Color_bright_white);
|
||||
|
||||
@@ -621,7 +621,7 @@ void HudGaugeTargetBox::renderTargetShip(object *target_objp)
|
||||
|
||||
// set glowmap flag here since model_render (etc) require an objnum to handle glowmaps
|
||||
// if we did pass the objnum, we'd also have thrusters drawn in the targetbox
|
||||
if (target_shipp->flags2 & SF2_GLOWMAPS_DISABLED) {
|
||||
if (target_shipp->flags[Ship::Ship_Flags::Glowmaps_disabled]) {
|
||||
flags |= MR_NO_GLOWMAPS;
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
|
||||
|
||||
// set glowmap flag here since model_render (etc) require an objnum to handle glowmaps
|
||||
// if we did pass the objnum, we'd also have thrusters drawn in the targetbox
|
||||
if (homing_shipp->flags2 & SF2_GLOWMAPS_DISABLED) {
|
||||
if (homing_shipp->flags[Ship::Ship_Flags::Glowmaps_disabled]) {
|
||||
flags |= MR_NO_GLOWMAPS;
|
||||
}
|
||||
}
|
||||
@@ -1435,7 +1435,7 @@ void HudGaugeExtraTargetData::render(float frametime)
|
||||
// Print out current orders if the targeted ship is friendly
|
||||
// AL 12-26-97: only show orders and time to target for friendly ships
|
||||
// Backslash: actually let's consult the IFF table. Maybe we want to show orders for certain teams, or hide orders for friendlies
|
||||
if ( ((Player_ship->team == target_shipp->team) || ((Iff_info[target_shipp->team].flags & IFFF_ORDERS_SHOWN) && !(Iff_info[target_shipp->team].flags & IFFF_ORDERS_HIDDEN)) ) && !(ship_get_SIF(target_shipp) & SIF_NOT_FLYABLE) ) {
|
||||
if ( ((Player_ship->team == target_shipp->team) || ((Iff_info[target_shipp->team].flags & IFFF_ORDERS_SHOWN) && !(Iff_info[target_shipp->team].flags & IFFF_ORDERS_HIDDEN)) ) && !(Ship_info[target_shipp->ship_info_index].is_flyable() ) ) {
|
||||
extra_data_shown=1;
|
||||
if ( ship_return_orders(outstr, target_shipp) ) {
|
||||
font::force_fit_string(outstr, 255, order_max_w);
|
||||
@@ -1762,8 +1762,8 @@ void HudGaugeTargetBox::renderTargetShipInfo(object *target_objp)
|
||||
}
|
||||
|
||||
// print out 'disabled' on the monitor if the target is disabled
|
||||
if ( (target_shipp->flags & SF_DISABLED) || (ship_subsys_disrupted(target_shipp, SUBSYSTEM_ENGINE)) ) {
|
||||
if ( target_shipp->flags & SF_DISABLED ) {
|
||||
if ( (target_shipp->flags[Ship::Ship_Flags::Disabled]) || (ship_subsys_disrupted(target_shipp, SUBSYSTEM_ENGINE)) ) {
|
||||
if ( target_shipp->flags[Ship::Ship_Flags::Disabled] ) {
|
||||
strcpy_s(outstr, XSTR( "DISABLED", 342));
|
||||
} else {
|
||||
strcpy_s(outstr, XSTR( "DISRUPTED", 343));
|
||||
@@ -2248,7 +2248,7 @@ void hud_update_ship_status(object *targetp)
|
||||
|
||||
if ( (targetp->instance >= 0) && (targetp->instance < MAX_SHIPS) ) {
|
||||
// print out status of ship for the targetbox
|
||||
if ( (Ships[targetp->instance].flags & SF_DISABLED) || (ship_subsys_disrupted(&Ships[targetp->instance], SUBSYSTEM_ENGINE)) ) {
|
||||
if ( (Ships[targetp->instance].flags[Ship::Ship_Flags::Disabled]) || (ship_subsys_disrupted(&Ships[targetp->instance], SUBSYSTEM_ENGINE)) ) {
|
||||
Current_ts = TS_DIS;
|
||||
} else {
|
||||
if ( Pl_target_integrity > 0.9 ) {
|
||||
|
||||
@@ -187,10 +187,10 @@ void hud_wingman_status_update()
|
||||
wing_index = shipp->wing_status_wing_index;
|
||||
wing_pos = shipp->wing_status_wing_pos;
|
||||
|
||||
if ( (wing_index >= 0) && (wing_pos >= 0) && !(ship_objp->flags & OF_SHOULD_BE_DEAD) ) {
|
||||
if ( (wing_index >= 0) && (wing_pos >= 0) && !(ship_objp->flags[Object::Object_Flags::Should_be_dead]) ) {
|
||||
|
||||
HUD_wingman_status[wing_index].used = 1;
|
||||
if (!(shipp->flags & SF_DEPARTING) ) {
|
||||
if (!(shipp->is_departing()) ) {
|
||||
HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_ALIVE;
|
||||
}
|
||||
HUD_wingman_status[wing_index].hull[wing_pos] = get_hull_pct(ship_objp);
|
||||
|
||||
+11
-46
@@ -387,53 +387,18 @@ void iff_init()
|
||||
}
|
||||
}
|
||||
|
||||
// get default ship flags
|
||||
iff->default_parse_flags = 0;
|
||||
if (optional_string("$Default Ship Flags:"))
|
||||
{
|
||||
i = 0;
|
||||
j = 0;
|
||||
char flag_strings[MAX_PARSE_OBJECT_FLAGS][NAME_LENGTH];
|
||||
int num_strings = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS);
|
||||
for (i = 0; i < num_strings; i++)
|
||||
{
|
||||
for (j = 0; j < MAX_PARSE_OBJECT_FLAGS; j++)
|
||||
{
|
||||
if (!stricmp(flag_strings[i], Parse_object_flags[j]))
|
||||
{
|
||||
iff->default_parse_flags |= (1 << j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// get default ship flags
|
||||
iff->default_parse_flags.reset();
|
||||
if (optional_string("$Default Ship Flags:"))
|
||||
{
|
||||
parse_string_flag_list<Mission::Parse_Object_Flags, flagset<Mission::Parse_Object_Flags>>(&iff->default_parse_flags, Parse_object_flags, num_parse_object_flags, NULL);
|
||||
}
|
||||
|
||||
if (j == MAX_PARSE_OBJECT_FLAGS)
|
||||
Warning(LOCATION, "Bogus string in iff default ship flags: %s\n", flag_strings[i]);
|
||||
}
|
||||
|
||||
// again
|
||||
iff->default_parse_flags2 = 0;
|
||||
if (optional_string("$Default Ship Flags2:"))
|
||||
{
|
||||
i = 0;
|
||||
j = 0;
|
||||
char flag_strings[MAX_PARSE_OBJECT_FLAGS_2][NAME_LENGTH];
|
||||
int num_strings = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS_2);
|
||||
for (i = 0; i < num_strings; i++)
|
||||
{
|
||||
for (j = 0; j < MAX_PARSE_OBJECT_FLAGS_2; j++)
|
||||
{
|
||||
if (!stricmp(flag_strings[i], Parse_object_flags_2[j]))
|
||||
{
|
||||
iff->default_parse_flags2 |= (1 << j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (j == MAX_PARSE_OBJECT_FLAGS_2)
|
||||
Warning(LOCATION, "Bogus string in iff default ship flags2: %s\n", flag_strings[i]);
|
||||
}
|
||||
// again, for compatibility reasons
|
||||
if (optional_string("$Default Ship Flags2:"))
|
||||
{
|
||||
parse_string_flag_list<Mission::Parse_Object_Flags, flagset<Mission::Parse_Object_Flags>>(&iff->default_parse_flags, Parse_object_flags, num_parse_object_flags, NULL);
|
||||
}
|
||||
|
||||
// this is cleared between each level but let's just set it here for thoroughness
|
||||
iff->ai_rearm_timestamp = timestamp(-1);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "mission/mission_flags.h"
|
||||
|
||||
class object;
|
||||
|
||||
@@ -43,8 +44,7 @@ typedef struct iff_info {
|
||||
|
||||
// flags
|
||||
int flags;
|
||||
int default_parse_flags;
|
||||
int default_parse_flags2;
|
||||
flagset<Mission::Parse_Object_Flags> default_parse_flags;
|
||||
|
||||
// used internally, not parsed
|
||||
int ai_rearm_timestamp;
|
||||
|
||||
+24
-23
@@ -497,7 +497,7 @@ void debug_cycle_player_ship(int delta)
|
||||
si_index = static_cast<int>(Ship_info.size() - 1);
|
||||
}
|
||||
sip = &Ship_info[si_index];
|
||||
if ( sip->flags & SIF_PLAYER_SHIP ){
|
||||
if ( sip->flags[Ship::Info_Flags::Player_ship] ){
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ void debug_cycle_targeted_ship(int delta)
|
||||
if ( strstr(name,NOX("test")) != NULL )
|
||||
continue;
|
||||
|
||||
if ( sip->species == species && (sip->flags & (SIF_FIGHTER | SIF_BOMBER | SIF_TRANSPORT) ) )
|
||||
if (sip->species == species && (sip->is_fighter_bomber() || sip->flags[Ship::Info_Flags::Transport]))
|
||||
break;
|
||||
|
||||
// just in case
|
||||
@@ -588,7 +588,7 @@ void debug_max_primary_weapons(object *objp) // Goober5000
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
weapon_info *wip;
|
||||
|
||||
if (sip->flags & SIF_BALLISTIC_PRIMARIES)
|
||||
if (sip->flags[Ship::Info_Flags::Ballistic_primaries])
|
||||
{
|
||||
for ( index = 0; index < MAX_SHIP_PRIMARY_BANKS; index++ )
|
||||
{
|
||||
@@ -709,11 +709,12 @@ void process_debug_keys(int k)
|
||||
|
||||
case KEY_DEBUGGED + KEY_C:
|
||||
case KEY_DEBUGGED1 + KEY_C:
|
||||
if(Player_obj->flags & OF_COLLIDES){
|
||||
obj_set_flags(Player_obj, Player_obj->flags & ~(OF_COLLIDES));
|
||||
|
||||
if(Player_obj->flags[Object::Object_Flags::Collides]){
|
||||
obj_set_flags(Player_obj, Player_obj->flags - Object::Object_Flags::Collides);
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, "Player no longer collides");
|
||||
} else {
|
||||
obj_set_flags(Player_obj, Player_obj->flags | OF_COLLIDES);
|
||||
} else {
|
||||
obj_set_flags(Player_obj, Player_obj->flags + Object::Object_Flags::Collides);
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, "Player collides");
|
||||
}
|
||||
break;
|
||||
@@ -862,7 +863,7 @@ void process_debug_keys(int k)
|
||||
|
||||
if ( sp->subsys_info[SUBSYSTEM_ENGINE].aggregate_current_hits <= 0.0f ) {
|
||||
mission_log_add_entry(LOG_SHIP_DISABLED, sp->ship_name, NULL );
|
||||
sp->flags |= SF_DISABLED; // add the disabled flag
|
||||
sp->flags.set(Ship::Ship_Flags::Disabled); // add the disabled flag
|
||||
}
|
||||
|
||||
if ( sp->subsys_info[SUBSYSTEM_TURRET].aggregate_current_hits <= 0.0f ) {
|
||||
@@ -890,8 +891,8 @@ void process_debug_keys(int k)
|
||||
// Select next object to be viewed by AI.
|
||||
case KEY_DEBUGGED + KEY_I:
|
||||
case KEY_DEBUGGED1 + KEY_I:
|
||||
Player_obj->flags ^= OF_INVULNERABLE;
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "You are %s", 10), Player_obj->flags & OF_INVULNERABLE ? XSTR( "now INVULNERABLE!", 11) : XSTR( "no longer invulnerable...", 12));
|
||||
Player_obj->flags.toggle(Object::Object_Flags::Invulnerable);
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "You are %s", 10), Player_obj->flags[Object::Object_Flags::Invulnerable] ? XSTR( "now INVULNERABLE!", 11) : XSTR( "no longer invulnerable...", 12));
|
||||
break;
|
||||
|
||||
case KEY_DEBUGGED + KEY_SHIFTED + KEY_I:
|
||||
@@ -899,8 +900,8 @@ void process_debug_keys(int k)
|
||||
if (Player_ai->target_objnum != -1) {
|
||||
object *objp = &Objects[Player_ai->target_objnum];
|
||||
|
||||
objp->flags ^= OF_INVULNERABLE;
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Player's target [%s] is %s", 13), Ships[objp->instance].ship_name, objp->flags & OF_INVULNERABLE ? XSTR( "now INVULNERABLE!", 11) : XSTR( "no longer invulnerable...", 12));
|
||||
objp->flags.toggle(Object::Object_Flags::Invulnerable);
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Player's target [%s] is %s", 13), Ships[objp->instance].ship_name, objp->flags[Object::Object_Flags::Invulnerable] ? XSTR( "now INVULNERABLE!", 11) : XSTR( "no longer invulnerable...", 12));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1587,7 +1588,7 @@ void game_process_cheats(int k)
|
||||
ship_idx++;
|
||||
} while(1);
|
||||
|
||||
shipp->flags |= SF_ESCORT;
|
||||
shipp->flags.set(Ship::Ship_Flags::Escort);
|
||||
shipp->escort_priority = 1000 - ship_idx;
|
||||
|
||||
// now make sure we're not colliding with anyone
|
||||
@@ -1646,7 +1647,7 @@ void game_process_keys()
|
||||
}
|
||||
|
||||
//If topdown view in non-2D mission, go back to cockpit view.
|
||||
if ( (Viewer_mode & VM_TOPDOWN) && !(The_mission.flags & MISSION_FLAG_2D_MISSION) && !(Perspective_locked) ) {
|
||||
if ( (Viewer_mode & VM_TOPDOWN) && !(The_mission.flags[Mission::Mission_Flags::Mission_2d]) && !(Perspective_locked) ) {
|
||||
Viewer_mode &= ~VM_TOPDOWN;
|
||||
break;
|
||||
}
|
||||
@@ -1756,7 +1757,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
npl = p;
|
||||
at_self = 0;
|
||||
|
||||
if ( NETPLAYER_IS_DEAD(npl) || (Ships[Objects[pl->objnum].instance].flags & SF_DYING) )
|
||||
if ( NETPLAYER_IS_DEAD(npl) || (Ships[Objects[pl->objnum].instance].flags[Ship::Ship_Flags::Dying]) )
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1768,7 +1769,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
ship * shipp = &Ships[objp->instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
if (sip->flags2 & SIF2_DYN_PRIMARY_LINKING) {
|
||||
if (sip->flags[Ship::Info_Flags::Dyn_primary_linking]) {
|
||||
polymodel *pm = model_get( sip->model_num );
|
||||
count = (int)ftables.getNext( pm->gun_banks[ swp->current_primary_bank ].num_slots, swp->primary_bank_slot_count[ swp->current_primary_bank ] );
|
||||
swp->primary_bank_slot_count[ swp->current_primary_bank ] = count;
|
||||
@@ -1858,15 +1859,15 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
|
||||
int firepoints = pm->missile_banks[Ships[objp->instance].weapons.current_secondary_bank].num_slots;
|
||||
|
||||
if ( Ships[objp->instance].flags & SF_SECONDARY_DUAL_FIRE || firepoints < 2) {
|
||||
Ships[objp->instance].flags &= ~SF_SECONDARY_DUAL_FIRE;
|
||||
if (Ships[objp->instance].flags[Ship::Ship_Flags::Secondary_dual_fire] || firepoints < 2) {
|
||||
Ships[objp->instance].flags.remove(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
if(at_self) {
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Secondary weapon set to normal fire mode", 34));
|
||||
snd_play( &Snds[ship_get_sound(Player_obj, SND_SECONDARY_CYCLE)] );
|
||||
hud_gauge_popup_start(HUD_WEAPONS_GAUGE);
|
||||
}
|
||||
} else {
|
||||
Ships[objp->instance].flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
Ships[objp->instance].flags.set(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
if(at_self) {
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Secondary weapon set to dual fire mode", 35));
|
||||
snd_play( &Snds[ship_get_sound(Player_obj, SND_SECONDARY_CYCLE)] );
|
||||
@@ -2231,7 +2232,7 @@ int button_function(int n)
|
||||
}
|
||||
|
||||
// Goober5000 - if the ship doesn't have subspace drive, jump key doesn't work: so test and exit early
|
||||
if (Player_ship->flags2 & SF2_NO_SUBSPACE_DRIVE)
|
||||
if (Player_ship->flags[Ship::Ship_Flags::No_subspace_drive])
|
||||
{
|
||||
switch(n)
|
||||
{
|
||||
@@ -2242,7 +2243,7 @@ int button_function(int n)
|
||||
}
|
||||
|
||||
// Goober5000 - if we have primitive sensors, some keys don't work: so test and exit early
|
||||
if (Player_ship->flags2 & SF2_PRIMITIVE_SENSORS)
|
||||
if (Player_ship->flags[Ship::Ship_Flags::Primitive_sensors])
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
@@ -2323,7 +2324,7 @@ int button_function(int n)
|
||||
case INCREASE_ENGINE: // increase energy to engines
|
||||
case DECREASE_ENGINE: // decrease energy to engines
|
||||
case ETS_EQUALIZE:
|
||||
if ((Player_ship->flags2 & SF2_NO_ETS) == 0) {
|
||||
if ((Player_ship->flags[Ship::Ship_Flags::No_ets]) == 0) {
|
||||
hud_gauge_popup_start(HUD_ETS_GAUGE);
|
||||
return button_function_critical(n);
|
||||
}
|
||||
@@ -2501,7 +2502,7 @@ int button_function(int n)
|
||||
|
||||
// Autopilot key control
|
||||
case AUTO_PILOT_TOGGLE:
|
||||
if (!(The_mission.flags & MISSION_FLAG_DEACTIVATE_AP)) {
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::Deactivate_ap])) {
|
||||
if (AutoPilotEngaged) {
|
||||
if (Cmdline_autopilot_interruptable == 1) //allow WCS to disable autopilot interrupt via commandline
|
||||
EndAutoPilot();
|
||||
|
||||
@@ -53,7 +53,9 @@ CJumpNode::CJumpNode(vec3d *position) : m_radius(0.0f), m_modelnum(-1), m_objnum
|
||||
m_pos.xyz.z = position->xyz.z;
|
||||
|
||||
// Create the object
|
||||
m_objnum = obj_create(OBJ_JUMP_NODE, -1, -1, NULL, &m_pos, m_radius, OF_RENDERS);
|
||||
flagset<Object::Object_Flags> default_flags;
|
||||
default_flags.set(Object::Object_Flags::Renders);
|
||||
m_objnum = obj_create(OBJ_JUMP_NODE, -1, -1, NULL, &m_pos, m_radius, default_flags);
|
||||
}
|
||||
|
||||
CJumpNode::CJumpNode(CJumpNode&& other)
|
||||
|
||||
+18
-87
@@ -641,7 +641,7 @@ void labviewer_add_model_thrusters(model_render_params *render_info, ship_info *
|
||||
|
||||
// Add noise to thruster geometry.
|
||||
if ( Lab_mode == LAB_MODE_SHIP ) {
|
||||
if (!(sip->flags2 & SIF2_NO_THRUSTER_GEO_NOISE)) {
|
||||
if (!(sip->flags[Ship::Info_Flags::No_thruster_geo_noise])) {
|
||||
mst.length.xyz.z *= (1.0f + frand()/5.0f - 0.1f);
|
||||
mst.length.xyz.y *= (1.0f + frand()/5.0f - 0.1f);
|
||||
mst.length.xyz.x *= (1.0f + frand()/5.0f - 0.1f);
|
||||
@@ -706,9 +706,9 @@ void labviewer_render_model(float frametime)
|
||||
rev_rate = REVOLUTION_RATE;
|
||||
|
||||
if (sip != NULL) {
|
||||
if (sip->flags & SIF_BIG_SHIP) {
|
||||
if (sip->is_big_ship()) {
|
||||
rev_rate *= 1.7f;
|
||||
} else if (sip->flags & SIF_HUGE_SHIP) {
|
||||
} else if (sip->is_huge_ship()) {
|
||||
rev_rate *= 3.0f;
|
||||
}
|
||||
|
||||
@@ -1391,8 +1391,6 @@ void labviewer_flags_add(int *X, int *Y, char *flag_name, int flag, bool flags2
|
||||
|
||||
void labviewer_populate_flags_window()
|
||||
{
|
||||
int y;
|
||||
|
||||
if (Lab_mode == LAB_MODE_NONE) {
|
||||
return;
|
||||
}
|
||||
@@ -1403,71 +1401,19 @@ void labviewer_populate_flags_window()
|
||||
|
||||
// clear out anything that already exists
|
||||
labviewer_flags_clear();
|
||||
|
||||
y = 0;
|
||||
|
||||
// ship flags ...
|
||||
if (Lab_mode == LAB_MODE_SHIP) {
|
||||
labviewer_flags_add(NULL, &y, "SUPPORT", SIF_SUPPORT);
|
||||
labviewer_flags_add(NULL, &y, "CARGO", SIF_CARGO);
|
||||
labviewer_flags_add(NULL, &y, "FIGHTER", SIF_FIGHTER);
|
||||
labviewer_flags_add(NULL, &y, "BOMBER", SIF_BOMBER);
|
||||
labviewer_flags_add(NULL, &y, "CRUISER", SIF_CRUISER);
|
||||
labviewer_flags_add(NULL, &y, "CORVETTE", SIF_CORVETTE);
|
||||
labviewer_flags_add(NULL, &y, "FREIGHTER", SIF_FREIGHTER);
|
||||
labviewer_flags_add(NULL, &y, "CAPITAL", SIF_CAPITAL);
|
||||
labviewer_flags_add(NULL, &y, "TRANSPORT", SIF_TRANSPORT);
|
||||
labviewer_flags_add(NULL, &y, "NAVBUOY", SIF_NAVBUOY);
|
||||
labviewer_flags_add(NULL, &y, "SENTRYGUN", SIF_SENTRYGUN);
|
||||
labviewer_flags_add(NULL, &y, "ESCAPEPOD", SIF_ESCAPEPOD);
|
||||
labviewer_flags_add(NULL, &y, "GAS MINER", SIF_GAS_MINER);
|
||||
labviewer_flags_add(NULL, &y, "AWACS", SIF_AWACS);
|
||||
labviewer_flags_add(NULL, &y, "STEALTH", SIF_STEALTH);
|
||||
labviewer_flags_add(NULL, &y, "SUPERCAP", SIF_SUPERCAP);
|
||||
labviewer_flags_add(NULL, &y, "KNOSSOS DEVICE", SIF_KNOSSOS_DEVICE);
|
||||
labviewer_flags_add(NULL, &y, "DRYDOCK", SIF_DRYDOCK);
|
||||
labviewer_flags_add(NULL, &y, "SHIP COPY", SIF_SHIP_COPY);
|
||||
labviewer_flags_add(NULL, &y, "BIG DAMAGE", SIF_BIG_DAMAGE);
|
||||
labviewer_flags_add(NULL, &y, "HAS AWACS", SIF_HAS_AWACS);
|
||||
labviewer_flags_add(NULL, &y, "NO COLLIDE INVISIBLE", SIF_SHIP_CLASS_DONT_COLLIDE_INVIS);
|
||||
labviewer_flags_add(NULL, &y, "DO COLLISION CHECK", SIF_NO_COLLIDE);
|
||||
labviewer_flags_add(NULL, &y, "PLAYER SHIP", SIF_PLAYER_SHIP);
|
||||
labviewer_flags_add(NULL, &y, "DEFAULT PLAYER SHIP", SIF_DEFAULT_PLAYER_SHIP);
|
||||
labviewer_flags_add(NULL, &y, "BALLISTIC PRIMARIES", SIF_BALLISTIC_PRIMARIES);
|
||||
labviewer_flags_add(NULL, &y, "FLASH", SIF2_FLASH, true);
|
||||
labviewer_flags_add(NULL, &y, "SURFACE SHIELDS", SIF2_SURFACE_SHIELDS, true);
|
||||
labviewer_flags_add(NULL, &y, "SHOW SHIP MODEL", SIF2_SHOW_SHIP_MODEL, true);
|
||||
labviewer_flags_add(NULL, &y, "IN TECH DATABASE", SIF_IN_TECH_DATABASE);
|
||||
labviewer_flags_add(NULL, &y, "IN TECH DATABASE MULTI", SIF_IN_TECH_DATABASE_M);
|
||||
}
|
||||
// weapon flags ...
|
||||
else if (Lab_mode == LAB_MODE_WEAPON) {
|
||||
labviewer_flags_add(NULL, &y, "HEAT SEEKING", WIF_HOMING_HEAT);
|
||||
labviewer_flags_add(NULL, &y, "ASPECT SEEKING", WIF_HOMING_ASPECT);
|
||||
labviewer_flags_add(NULL, &y, "ELECTRONICS", WIF_ELECTRONICS);
|
||||
labviewer_flags_add(NULL, &y, "PUNCTURE", WIF_PUNCTURE);
|
||||
labviewer_flags_add(NULL, &y, "SUPERCAP", WIF_SUPERCAP);
|
||||
labviewer_flags_add(NULL, &y, "COUNTERMEASURE", WIF_CMEASURE);
|
||||
labviewer_flags_add(NULL, &y, "BIG ONLY", WIF_BIG_ONLY);
|
||||
labviewer_flags_add(NULL, &y, "HUGE", WIF_HUGE);
|
||||
labviewer_flags_add(NULL, &y, "PLAYER ALLOWED", WIF_PLAYER_ALLOWED);
|
||||
labviewer_flags_add(NULL, &y, "PARTICLE SPEW", WIF_PARTICLE_SPEW);
|
||||
labviewer_flags_add(NULL, &y, "EMP", WIF_EMP);
|
||||
labviewer_flags_add(NULL, &y, "ENERGY SUCK", WIF_ENERGY_SUCK);
|
||||
labviewer_flags_add(NULL, &y, "SHUDDER", WIF_SHUDDER);
|
||||
labviewer_flags_add(NULL, &y, "BALLISTIC", WIF2_BALLISTIC, true);
|
||||
labviewer_flags_add(NULL, &y, "PIERCE SHIELDS", WIF2_PIERCE_SHIELDS, true);
|
||||
labviewer_flags_add(NULL, &y, "CYCLE", WIF2_CYCLE, true);
|
||||
labviewer_flags_add(NULL, &y, "NO LIGHTING", WIF2_MR_NO_LIGHTING, true);
|
||||
labviewer_flags_add(NULL, &y, "TRANSPARENT", WIF2_TRANSPARENT, true);
|
||||
labviewer_flags_add(NULL, &y, "IN TECH DATABASE", WIF_IN_TECH_DATABASE);
|
||||
}
|
||||
|
||||
// ship flags ...
|
||||
if (Lab_mode == LAB_MODE_SHIP) {
|
||||
//Needs reimplementation
|
||||
}
|
||||
// weapon flags ...
|
||||
else if (Lab_mode == LAB_MODE_WEAPON) {
|
||||
//Needs reimplementation
|
||||
}
|
||||
}
|
||||
|
||||
void labviewer_update_flags_window()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( (Lab_selected_index < 0) || (Lab_mode == LAB_MODE_NONE) ) {
|
||||
return;
|
||||
}
|
||||
@@ -1478,27 +1424,12 @@ void labviewer_update_flags_window()
|
||||
}
|
||||
|
||||
|
||||
if (Lab_mode == LAB_MODE_SHIP) {
|
||||
ship_info *sip = &Ship_info[Lab_selected_index];
|
||||
|
||||
for (i = 0; i < Lab_flags.size(); i++) {
|
||||
if (Lab_flags[i].second) {
|
||||
Lab_flags[i].cb->SetFlag(&sip->flags2, Lab_flags[i].flag);
|
||||
} else {
|
||||
Lab_flags[i].cb->SetFlag(&sip->flags, Lab_flags[i].flag);
|
||||
}
|
||||
}
|
||||
} else if (Lab_mode == LAB_MODE_WEAPON) {
|
||||
weapon_info *wip = &Weapon_info[Lab_selected_index];
|
||||
|
||||
for (i = 0; i < Lab_flags.size(); i++) {
|
||||
if (Lab_flags[i].second) {
|
||||
Lab_flags[i].cb->SetFlag(&wip->wi_flags2, Lab_flags[i].flag);
|
||||
} else {
|
||||
Lab_flags[i].cb->SetFlag(&wip->wi_flags, Lab_flags[i].flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Lab_mode == LAB_MODE_SHIP) {
|
||||
//Needs reimplementation
|
||||
}
|
||||
else if (Lab_mode == LAB_MODE_WEAPON) {
|
||||
//Needs reimplementation
|
||||
}
|
||||
}
|
||||
|
||||
void labviewer_close_flags_window(GUIObject *caller)
|
||||
|
||||
+32
-33
@@ -464,7 +464,7 @@ void techroom_ships_render(float frametime)
|
||||
// now render the trackball ship, which is unique to the ships tab
|
||||
float rev_rate = REVOLUTION_RATE;
|
||||
angles rot_angles, view_angles;
|
||||
int z, i, j;
|
||||
int i, j;
|
||||
ship_info *sip = &Ship_info[Cur_entry_index];
|
||||
model_render_params render_info;
|
||||
|
||||
@@ -473,11 +473,10 @@ void techroom_ships_render(float frametime)
|
||||
}
|
||||
|
||||
// get correct revolution rate
|
||||
z = sip->flags;
|
||||
if (z & SIF_BIG_SHIP) {
|
||||
if (sip->is_big_ship()) {
|
||||
rev_rate *= 1.7f;
|
||||
}
|
||||
if (z & SIF_HUGE_SHIP) {
|
||||
if (sip->is_huge_ship()) {
|
||||
rev_rate *= 3.0f;
|
||||
}
|
||||
|
||||
@@ -578,7 +577,7 @@ void techroom_ships_render(float frametime)
|
||||
|
||||
uint render_flags = MR_AUTOCENTER;
|
||||
|
||||
if(sip->flags2 & SIF2_NO_LIGHTING)
|
||||
if(sip->flags[Ship::Info_Flags::No_lighting])
|
||||
render_flags |= MR_NO_LIGHTING;
|
||||
|
||||
render_info.set_flags(render_flags);
|
||||
@@ -737,7 +736,8 @@ void techroom_anim_render(float frametime)
|
||||
|
||||
void techroom_change_tab(int num)
|
||||
{
|
||||
int i, multi = 0, mask, mask2, font_height, max_num_entries_viewable;
|
||||
int multi = 0, wi_mask, wi_mask2, font_height, max_num_entries_viewable;
|
||||
Ship::Info_Flags si_mask, si_mask2;
|
||||
|
||||
//unload the current animation, we load another one for the new current entry
|
||||
if(Tab != SHIPS_DATA_TAB)
|
||||
@@ -748,7 +748,7 @@ void techroom_change_tab(int num)
|
||||
Cur_entry = 0;
|
||||
multi = Player->flags & PLAYER_FLAGS_IS_MULTI;
|
||||
|
||||
for (i=0; i<LIST_BUTTONS_MAX; i++){
|
||||
for (int i=0; i<LIST_BUTTONS_MAX; i++){
|
||||
List_buttons[i].disable();
|
||||
}
|
||||
|
||||
@@ -760,8 +760,8 @@ void techroom_change_tab(int num)
|
||||
|
||||
switch (Tab) {
|
||||
case SHIPS_DATA_TAB:
|
||||
mask = multi ? SIF_IN_TECH_DATABASE_M : SIF_IN_TECH_DATABASE;
|
||||
mask2 = multi ? SIF2_DEFAULT_IN_TECH_DATABASE_M : SIF2_DEFAULT_IN_TECH_DATABASE;
|
||||
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;
|
||||
|
||||
// load ship info if necessary
|
||||
if ( Ships_loaded == 0 ) {
|
||||
@@ -776,7 +776,7 @@ void techroom_change_tab(int num)
|
||||
|
||||
for (auto it = Ship_info.begin(); it != Ship_info.end(); ++it)
|
||||
{
|
||||
if (Techroom_show_all || (it->flags & mask) || (it->flags2 & mask2))
|
||||
if (Techroom_show_all || (it->flags[si_mask]) || (it->flags[si_mask2]))
|
||||
{
|
||||
// this ship should be displayed, fill out the entry struct
|
||||
Ship_list[Ship_list_size].bitmap = -1;
|
||||
@@ -788,9 +788,9 @@ void techroom_change_tab(int num)
|
||||
Ship_list[Ship_list_size].model_num = -1;
|
||||
Ship_list[Ship_list_size].textures_loaded = 0;
|
||||
|
||||
Ship_list_size++;
|
||||
}
|
||||
}
|
||||
Ship_list_size++;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that at least the default entry is cleared out if we didn't grab anything
|
||||
if (!Ship_info.empty() && !Ship_list_size) {
|
||||
@@ -829,12 +829,12 @@ void techroom_change_tab(int num)
|
||||
}
|
||||
|
||||
Weapon_list_size = 0;
|
||||
mask = multi ? WIF_PLAYER_ALLOWED : WIF_IN_TECH_DATABASE;
|
||||
mask2 = WIF2_DEFAULT_IN_TECH_DATABASE;
|
||||
wi_mask = multi ? WIF_PLAYER_ALLOWED : WIF_IN_TECH_DATABASE;
|
||||
wi_mask2 = WIF2_DEFAULT_IN_TECH_DATABASE;
|
||||
|
||||
for (i=0; i<Num_weapon_types; i++)
|
||||
for (int i=0; i<Num_weapon_types; i++)
|
||||
{
|
||||
if (Techroom_show_all || (Weapon_info[i].wi_flags & mask) || (Weapon_info[i].wi_flags2 & mask2))
|
||||
if (Techroom_show_all || (Weapon_info[i].wi_flags & wi_mask) || (Weapon_info[i].wi_flags2 & wi_mask2))
|
||||
{
|
||||
// we have a weapon that should be in the tech db, so fill out the entry struct
|
||||
Weapon_list[Weapon_list_size].index = i;
|
||||
@@ -883,7 +883,7 @@ void techroom_change_tab(int num)
|
||||
// now populate the entry structs
|
||||
Intel_list_size = 0;
|
||||
|
||||
for (i=0; i<Intel_info_size; i++) {
|
||||
for (int i=0; i<Intel_info_size; i++) {
|
||||
if (Techroom_show_all || (Intel_info[i].flags & IIF_IN_TECH_DATABASE) || (Intel_info[i].flags & IIF_DEFAULT_IN_TECH_DATABASE)) {
|
||||
// leave option for no animation if string == "none"
|
||||
if (!strcmp(Intel_info[i].anim_filename, "none")) {
|
||||
@@ -1429,24 +1429,23 @@ int intel_info_lookup(char *name)
|
||||
// Goober5000
|
||||
void tech_reset_to_default()
|
||||
{
|
||||
int i;
|
||||
|
||||
// ships
|
||||
for (auto it = Ship_info.begin(); it != Ship_info.end(); ++it)
|
||||
{
|
||||
if (it->flags2 & SIF2_DEFAULT_IN_TECH_DATABASE)
|
||||
it->flags |= SIF_IN_TECH_DATABASE;
|
||||
else
|
||||
it->flags &= ~SIF_IN_TECH_DATABASE;
|
||||
for (auto it = Ship_info.begin(); it != Ship_info.end(); ++it)
|
||||
{
|
||||
if (it->flags[Ship::Info_Flags::Default_in_tech_database])
|
||||
it->flags.set(Ship::Info_Flags::In_tech_database);
|
||||
else
|
||||
it->flags.remove(Ship::Info_Flags::Default_in_tech_database);
|
||||
|
||||
if (it->flags[Ship::Info_Flags::Default_in_tech_database_m])
|
||||
it->flags.set(Ship::Info_Flags::In_tech_database_m);
|
||||
else
|
||||
it->flags.remove(Ship::Info_Flags::Default_in_tech_database_m);
|
||||
}
|
||||
|
||||
if (it->flags2 & SIF2_DEFAULT_IN_TECH_DATABASE_M)
|
||||
it->flags |= SIF_IN_TECH_DATABASE_M;
|
||||
else
|
||||
it->flags &= ~SIF_IN_TECH_DATABASE_M;
|
||||
}
|
||||
|
||||
// weapons
|
||||
for (i=0; i<Num_weapon_types; i++)
|
||||
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;
|
||||
@@ -1455,7 +1454,7 @@ void tech_reset_to_default()
|
||||
}
|
||||
|
||||
// intelligence
|
||||
for (i=0; i<Intel_info_size; i++)
|
||||
for (int i=0; i<Intel_info_size; i++)
|
||||
{
|
||||
if (Intel_info[i].flags & IIF_DEFAULT_IN_TECH_DATABASE)
|
||||
Intel_info[i].flags |= IIF_IN_TECH_DATABASE;
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
#ifndef MISSION_FLAGS_H
|
||||
#define MISSION_FLAGS_H
|
||||
|
||||
#include "globalincs/flagset.h"
|
||||
|
||||
namespace Mission {
|
||||
|
||||
FLAG_LIST(Mission_Flags) {
|
||||
Subspace, // mission takes place in subspace
|
||||
No_promotion, // cannot get promoted or badges in this mission
|
||||
Fullneb, // mission is a full nebula mission
|
||||
No_builtin_msgs, // disables builtin msgs
|
||||
No_traitor, // player cannot become a traitor
|
||||
Toggle_ship_trails, // toggles ship trails (off in nebula, on outside nebula)
|
||||
Support_repairs_hull, // Toggles support ship repair of ship hulls
|
||||
Beam_free_all_by_default, // Beam-free-all by default - Goober5000
|
||||
Unused_1, // Necessary to not break parsing
|
||||
Unused_2, // Necessary to not break parsing
|
||||
No_briefing, // no briefing, jump right into mission - Goober5000
|
||||
Toggle_debriefing, // Turn on debriefing for dogfight. Off for everything else - Goober5000
|
||||
Unused_3, // Necessary to not break parsing
|
||||
Allow_dock_trees, // toggle between hub and tree model for ship docking (see objectdock.cpp) - Gooober5000
|
||||
Mission_2d, // Mission is meant to be played top-down style; 2D physics and movement.
|
||||
Unused_4, // Necessary to not break parsing
|
||||
Red_alert, // a red-alert mission - Goober5000
|
||||
Scramble, // a scramble mission - Goober5000
|
||||
No_builtin_command, // turns off Command without turning off pilots - Karajorma
|
||||
Player_start_ai, // Player Starts mission under AI Control (NOT MULTI COMPATABLE) - Kazan
|
||||
All_attack, // all teams at war - Goober5000
|
||||
Use_ap_cinematics, // Kazan - use autopilot cinematics
|
||||
Deactivate_ap, // KeldorKatarn - deactivate autopilot (patch approved by Kazan)
|
||||
Always_show_goals, // Karajorma - Show the mission goals, even for training missions
|
||||
End_to_mainhall, // niffiwan - Return to the mainhall after debrief
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Parse_Object_Flags) {
|
||||
SF_Cargo_known,
|
||||
SF_Ignore_count,
|
||||
SF_Reinforcement,
|
||||
SF_Escort,
|
||||
SF_No_arrival_music,
|
||||
SF_No_arrival_warp,
|
||||
OF_No_shields,
|
||||
OF_Protected,
|
||||
OF_Player_start,
|
||||
SF_No_departure_warp,
|
||||
SF_Locked,
|
||||
OF_Invulnerable,
|
||||
SF_Hidden_from_sensors,
|
||||
SF_Scannable, // ship is a "scannable" ship
|
||||
AIF_Kamikaze,
|
||||
AIF_No_dynamic,
|
||||
SF_Red_alert_store_status,
|
||||
OF_Beam_protected,
|
||||
OF_Flak_protected,
|
||||
OF_Laser_protected,
|
||||
OF_Missile_protected,
|
||||
SF_Guardian,
|
||||
Knossos_warp_in,
|
||||
SF_Vaporize,
|
||||
SF_Stealth,
|
||||
SF_Friendly_stealth_invis,
|
||||
SF_Dont_collide_invis,
|
||||
SF_Use_unique_orders, // tells a newly created ship to use the default orders for that ship
|
||||
SF_Dock_leader, // Goober5000 - a docked parse object that is the leader of its group
|
||||
SF_Cannot_arrive, // used to indicate that this ship's arrival cue will never be true
|
||||
SF_Warp_broken, // warp engine should be broken for this ship
|
||||
SF_Warp_never, // warp drive is destroyed
|
||||
SF_Primitive_sensors,
|
||||
SF_No_subspace_drive,
|
||||
SF_Nav_carry_status,
|
||||
SF_Affected_by_gravity,
|
||||
SF_Toggle_subsystem_scanning,
|
||||
OF_Targetable_as_bomb,
|
||||
SF_No_builtin_messages,
|
||||
SF_Primaries_locked,
|
||||
SF_Secondaries_locked,
|
||||
SF_No_death_scream,
|
||||
SF_Always_death_scream,
|
||||
SF_Nav_needslink,
|
||||
SF_Hide_ship_name,
|
||||
SF_Set_class_dynamically,
|
||||
SF_Lock_all_turrets_initially,
|
||||
SF_Afterburner_locked,
|
||||
OF_Force_shields_on,
|
||||
OF_Immobile,
|
||||
SF_No_ets,
|
||||
SF_Cloaked,
|
||||
SF_Ship_locked,
|
||||
SF_Weapons_locked,
|
||||
SF_Scramble_messages,
|
||||
Red_alert_deleted, // Goober5000 - used analogously to SEF_PLAYER_DELETED
|
||||
Already_handled, // Goober5000 - used for docking currently, but could be used generically
|
||||
OF_No_collide,
|
||||
SF_No_disabled_self_destruct,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -369,41 +369,41 @@ void mission_campaign_build_list(bool desc, bool sort, bool multiplayer)
|
||||
*/
|
||||
void mission_campaign_get_sw_info()
|
||||
{
|
||||
int i, count, ship_list[MAX_SHIP_CLASSES], weapon_list[MAX_WEAPON_TYPES];
|
||||
int i, count, ship_list[MAX_SHIP_CLASSES], weapon_list[MAX_WEAPON_TYPES];
|
||||
|
||||
// set allowable ships to the SIF_PLAYER_SHIPs
|
||||
memset( Campaign.ships_allowed, 0, sizeof(Campaign.ships_allowed) );
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it ) {
|
||||
if ( it->flags & SIF_PLAYER_SHIP )
|
||||
Campaign.ships_allowed[std::distance(Ship_info.cbegin(), it)] = 1;
|
||||
}
|
||||
// set allowable ships to the SIF_PLAYER_SHIPs
|
||||
memset(Campaign.ships_allowed, 0, sizeof(Campaign.ships_allowed));
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
|
||||
if (it->flags[Ship::Info_Flags::Player_ship])
|
||||
Campaign.ships_allowed[std::distance(Ship_info.cbegin(), it)] = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_WEAPON_TYPES; i++ )
|
||||
Campaign.weapons_allowed[i] = 1;
|
||||
for (i = 0; i < MAX_WEAPON_TYPES; i++)
|
||||
Campaign.weapons_allowed[i] = 1;
|
||||
|
||||
if ( optional_string("+Starting Ships:") ) {
|
||||
for (i = 0; i < static_cast<int>(Ship_info.size()); i++ )
|
||||
Campaign.ships_allowed[i] = 0;
|
||||
if (optional_string("+Starting Ships:")) {
|
||||
for (i = 0; i < static_cast<int>(Ship_info.size()); i++)
|
||||
Campaign.ships_allowed[i] = 0;
|
||||
|
||||
count = stuff_int_list(ship_list, MAX_SHIP_CLASSES, SHIP_INFO_TYPE);
|
||||
count = stuff_int_list(ship_list, MAX_SHIP_CLASSES, SHIP_INFO_TYPE);
|
||||
|
||||
// now set the array elements stating which ships we are allowed
|
||||
for (i = 0; i < count; i++ ) {
|
||||
if ( Ship_info[ship_list[i]].flags & SIF_PLAYER_SHIP )
|
||||
Campaign.ships_allowed[ship_list[i]] = 1;
|
||||
}
|
||||
}
|
||||
// now set the array elements stating which ships we are allowed
|
||||
for (i = 0; i < count; i++) {
|
||||
if (Ship_info[ship_list[i]].flags[Ship::Info_Flags::Player_ship])
|
||||
Campaign.ships_allowed[ship_list[i]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( optional_string("+Starting Weapons:") ) {
|
||||
for (i = 0; i < MAX_WEAPON_TYPES; i++ )
|
||||
Campaign.weapons_allowed[i] = 0;
|
||||
if (optional_string("+Starting Weapons:")) {
|
||||
for (i = 0; i < MAX_WEAPON_TYPES; i++)
|
||||
Campaign.weapons_allowed[i] = 0;
|
||||
|
||||
count = stuff_int_list(weapon_list, MAX_WEAPON_TYPES, WEAPON_POOL_TYPE);
|
||||
count = stuff_int_list(weapon_list, MAX_WEAPON_TYPES, WEAPON_POOL_TYPE);
|
||||
|
||||
// now set the array elements stating which ships we are allowed
|
||||
for (i = 0; i < count; i++ )
|
||||
Campaign.weapons_allowed[weapon_list[i]] = 1;
|
||||
}
|
||||
// now set the array elements stating which ships we are allowed
|
||||
for (i = 0; i < count; i++)
|
||||
Campaign.weapons_allowed[weapon_list[i]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1833,7 +1833,7 @@ void mission_campaign_skip_to_next(int start_game)
|
||||
// closes out mission stuff, sets up next one
|
||||
mission_campaign_mission_over();
|
||||
|
||||
if ( Campaign.next_mission == -1 || (The_mission.flags & MISSION_FLAG_END_TO_MAINHALL) ) {
|
||||
if ( Campaign.next_mission == -1 || (The_mission.flags[Mission::Mission_Flags::End_to_mainhall]) ) {
|
||||
// go to main hall, either the campaign is over or the FREDer requested it.
|
||||
gameseq_post_event(GS_EVENT_MAIN_MENU);
|
||||
} else {
|
||||
|
||||
@@ -607,7 +607,7 @@ int hotkey_build_team_listing(int enemy_team_mask, int y, bool list_enemies)
|
||||
continue;
|
||||
|
||||
// don't process ships invisible to sensors, dying or departing
|
||||
if ( Ships[shipnum].flags & (SF_HIDDEN_FROM_SENSORS|SF_DYING|SF_DEPARTING) )
|
||||
if ( Ships[shipnum].flags[Ship::Ship_Flags::Hidden_from_sensors] || Ships[shipnum].is_dying_or_departing() )
|
||||
continue;
|
||||
|
||||
// if a ship's hotkey is the last hotkey on the list, then maybe make the hotkey -1 if
|
||||
@@ -641,7 +641,7 @@ int hotkey_build_team_listing(int enemy_team_mask, int y, bool list_enemies)
|
||||
|
||||
// don't add any wing data whose ships are hidden from sensors
|
||||
for ( j = 0; j < Wings[i].current_count; j++ ) {
|
||||
if ( Ships[Wings[i].ship_index[j]].flags & SF_HIDDEN_FROM_SENSORS )
|
||||
if ( Ships[Wings[i].ship_index[j]].flags[Ship::Ship_Flags::Hidden_from_sensors] )
|
||||
break;
|
||||
}
|
||||
// if we didn't reach the end of the list, don't display the wing
|
||||
|
||||
@@ -294,7 +294,7 @@ void mission_log_add_entry(int type, char *pname, char *sname, int info_index)
|
||||
} else {
|
||||
nprintf(("missionlog", "No secondary name for ship destroyed log entry!\n"));
|
||||
}
|
||||
} else if ( (type == LOG_SHIP_SUBSYS_DESTROYED) && (Ship_info[Ships[index].ship_info_index].flags & SIF_SMALL_SHIP) ) {
|
||||
} else if ( (type == LOG_SHIP_SUBSYS_DESTROYED) && (Ship_info[Ships[index].ship_info_index].is_small_ship()) ) {
|
||||
// make subsystem destroyed entries for small ships hidden
|
||||
entry->flags |= MLF_HIDDEN;
|
||||
} else if ( (type == LOG_SHIP_ARRIVED) && (Ships[index].wingnum != -1 ) ) {
|
||||
|
||||
@@ -1336,7 +1336,7 @@ void message_queue_process()
|
||||
|
||||
// see if the ship sending this message is dying. If do, kill wave and anim
|
||||
if ( Playing_messages[i].shipnum != -1 ) {
|
||||
if ( (Ships[Playing_messages[i].shipnum].flags & SF_DYING) && (Playing_messages[i].builtin_type != MESSAGE_WINGMAN_SCREAM) ) {
|
||||
if ( (Ships[Playing_messages[i].shipnum].flags[Ship::Ship_Flags::Dying]) && (Playing_messages[i].builtin_type != MESSAGE_WINGMAN_SCREAM) ) {
|
||||
int shipnum;
|
||||
|
||||
shipnum = Playing_messages[i].shipnum;
|
||||
@@ -1347,7 +1347,7 @@ void message_queue_process()
|
||||
// MWA 3/24/98 -- save shipnum before killing message
|
||||
//
|
||||
Assert( shipnum >= 0 );
|
||||
if ( !(Ships[shipnum].flags & SF_SHIP_HAS_SCREAMED) && !(Ships[shipnum].flags2 & SF2_NO_DEATH_SCREAM) ) {
|
||||
if ( !(Ships[shipnum].flags[Ship::Ship_Flags::Ship_has_screamed]) && !(Ships[shipnum].flags[Ship::Ship_Flags::No_death_scream]) ) {
|
||||
ship_scream( &Ships[shipnum] );
|
||||
}
|
||||
continue; // this should keep us in the while() loop with same value of i.
|
||||
@@ -1547,7 +1547,7 @@ void message_queue_process()
|
||||
if (Message_shipnum < 0) {
|
||||
goto all_done;
|
||||
}
|
||||
if (!((Ship_info[Ships[Message_shipnum].ship_info_index].flags & SIF_SMALL_SHIP) || (Ships[Message_shipnum].flags2 & SF2_ALWAYS_DEATH_SCREAM)) ) {
|
||||
if (!(Ship_info[Ships[Message_shipnum].ship_info_index].is_small_ship() || (Ships[Message_shipnum].flags[Ship::Ship_Flags::Always_death_scream])) ) {
|
||||
goto all_done;
|
||||
}
|
||||
}
|
||||
@@ -1578,7 +1578,7 @@ void message_queue_process()
|
||||
ship *shipp = &Ships[Message_shipnum];
|
||||
if ( shipp->callsign_index >= 0 ) {
|
||||
hud_stuff_ship_callsign( who_from, shipp );
|
||||
} else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) ) {
|
||||
} else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags[Ship::Ship_Flags::Hide_ship_name]) ) {
|
||||
hud_stuff_ship_class( who_from, shipp );
|
||||
} else {
|
||||
end_string_at_first_hash_symbol(who_from);
|
||||
@@ -1714,7 +1714,8 @@ void message_queue_message( int message_num, int priority, int timing, char *who
|
||||
// type personas. ship is the ship we should assign a persona to
|
||||
int message_get_persona( ship *shipp )
|
||||
{
|
||||
int i = 0, ship_type, count;
|
||||
int i = 0, count;
|
||||
ship_info* sip;
|
||||
int *slist = new int[Num_personas];
|
||||
memset( slist, 0, sizeof(int) * Num_personas );
|
||||
|
||||
@@ -1727,15 +1728,15 @@ int message_get_persona( ship *shipp )
|
||||
}
|
||||
|
||||
// get the type of ship (i.e. support, fighter/bomber, etc)
|
||||
ship_type = Ship_info[shipp->ship_info_index].flags;
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
int persona_needed;
|
||||
count = 0;
|
||||
|
||||
if ( ship_type & (SIF_FIGHTER|SIF_BOMBER) )
|
||||
if ( sip->is_fighter_bomber() )
|
||||
{
|
||||
persona_needed = PERSONA_FLAG_WINGMAN;
|
||||
} else if ( ship_type & SIF_SUPPORT )
|
||||
} else if ( sip->flags[Ship::Info_Flags::Support] )
|
||||
{
|
||||
persona_needed = PERSONA_FLAG_SUPPORT;
|
||||
}
|
||||
@@ -1935,11 +1936,11 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti
|
||||
|
||||
|
||||
// if we aren't showing builtin msgs, bail
|
||||
if (The_mission.flags & MISSION_FLAG_NO_BUILTIN_MSGS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::No_builtin_msgs])
|
||||
return;
|
||||
|
||||
// Karajorma - If we aren't showing builtin msgs from command and this is not a ship, bail
|
||||
if ( (shipp == NULL) && (The_mission.flags & MISSION_FLAG_NO_BUILTIN_COMMAND) )
|
||||
if ( (shipp == NULL) && (The_mission.flags[Mission::Mission_Flags::No_builtin_command]) )
|
||||
return;
|
||||
|
||||
// builtin type isn't supported by this version of the table
|
||||
@@ -1964,7 +1965,7 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti
|
||||
// see if there is a persona assigned to this ship. If not, then try to assign one!!!
|
||||
if ( shipp ) {
|
||||
// Karajorma - the game should assert if a silenced ship gets this far
|
||||
Assert( !(shipp->flags2 & SF2_NO_BUILTIN_MESSAGES) );
|
||||
Assert( !(shipp->flags[Ship::Ship_Flags::No_builtin_messages]) );
|
||||
|
||||
if ( shipp->persona_index == -1 )
|
||||
shipp->persona_index = message_get_persona( shipp );
|
||||
@@ -1975,7 +1976,7 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti
|
||||
nprintf(("messaging", "Couldn't find persona for %s\n", shipp->ship_name ));
|
||||
|
||||
// be sure that this ship can actually send a message!!! (i.e. not-not-flyable -- get it!)
|
||||
Assert( !(Ship_info[shipp->ship_info_index].flags & SIF_NOT_FLYABLE) ); // get allender or alan
|
||||
Assert( !Ship_info[shipp->ship_info_index].is_flyable() ); // get allender or alan
|
||||
} else {
|
||||
persona_index = The_mission.command_persona; // use the terran command persona
|
||||
}
|
||||
|
||||
+318
-343
File diff suppressed because it is too large.
Load diff
+7
-113
@@ -20,6 +20,7 @@
|
||||
#include "object/object.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "sound/sound.h"
|
||||
#include "mission/mission_flags.h"
|
||||
|
||||
//WMC - This should be here
|
||||
#define FS_MISSION_FILE_EXT NOX(".fs2")
|
||||
@@ -65,32 +66,6 @@ struct p_dock_instance;
|
||||
#define MISSION_TYPE_MULTI_TEAMS (1<<4)
|
||||
#define MISSION_TYPE_MULTI_DOGFIGHT (1<<5)
|
||||
|
||||
#define MISSION_FLAG_SUBSPACE (1<<0) // mission takes place in subspace
|
||||
#define MISSION_FLAG_NO_PROMOTION (1<<1) // cannot get promoted or badges in this mission
|
||||
#define MISSION_FLAG_FULLNEB (1<<2) // mission is a full nebula mission
|
||||
#define MISSION_FLAG_NO_BUILTIN_MSGS (1<<3) // disables builtin msgs
|
||||
#define MISSION_FLAG_NO_TRAITOR (1<<4) // player cannot become a traitor
|
||||
#define MISSION_FLAG_TOGGLE_SHIP_TRAILS (1<<5) // toggles ship trails (off in nebula, on outside nebula)
|
||||
#define MISSION_FLAG_SUPPORT_REPAIRS_HULL (1<<6) // Toggles support ship repair of ship hulls
|
||||
#define MISSION_FLAG_BEAM_FREE_ALL_BY_DEFAULT (1<<7) // Beam-free-all by default - Goober5000
|
||||
#define MISSION_FLAG_CURRENTLY_UNUSED_1 (1<<8)
|
||||
#define MISSION_FLAG_CURRENTLY_UNUSED_2 (1<<9)
|
||||
#define MISSION_FLAG_NO_BRIEFING (1<<10) // no briefing, jump right into mission - Goober5000
|
||||
#define MISSION_FLAG_TOGGLE_DEBRIEFING (1<<11) // Turn on debriefing for dogfight. Off for everything else - Goober5000
|
||||
#define MISSION_FLAG_CURRENTLY_UNUSED_3 (1<<12)
|
||||
#define MISSION_FLAG_ALLOW_DOCK_TREES (1<<13) // toggle between hub and tree model for ship docking (see objectdock.cpp) - Gooober5000
|
||||
#define MISSION_FLAG_2D_MISSION (1<<14) // Mission is meant to be played top-down style; 2D physics and movement.
|
||||
#define MISSION_FLAG_CURRENTLY_UNUSED_4 (1<<15)
|
||||
#define MISSION_FLAG_RED_ALERT (1<<16) // a red-alert mission - Goober5000
|
||||
#define MISSION_FLAG_SCRAMBLE (1<<17) // a scramble mission - Goober5000
|
||||
#define MISSION_FLAG_NO_BUILTIN_COMMAND (1<<18) // turns off Command without turning off pilots - Karajorma
|
||||
#define MISSION_FLAG_PLAYER_START_AI (1<<19) // Player Starts mission under AI Control (NOT MULTI COMPATABLE) - Kazan
|
||||
#define MISSION_FLAG_ALL_ATTACK (1<<20) // all teams at war - Goober5000
|
||||
#define MISSION_FLAG_USE_AP_CINEMATICS (1<<21) // Kazan - use autopilot cinematics
|
||||
#define MISSION_FLAG_DEACTIVATE_AP (1<<22) // KeldorKatarn - deactivate autopilot (patch approved by Kazan)
|
||||
#define MISSION_FLAG_ALWAYS_SHOW_GOALS (1<<23) // Karajorma - Show the mission goals, even for training missions
|
||||
#define MISSION_FLAG_END_TO_MAINHALL (1<<24) // niffiwan - Return to the mainhall after debrief
|
||||
|
||||
// some mice macros for mission type
|
||||
#define IS_MISSION_MULTI_COOP (The_mission.game_type & MISSION_TYPE_MULTI_COOP)
|
||||
#define IS_MISSION_MULTI_TEAMS (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS)
|
||||
@@ -136,7 +111,7 @@ typedef struct mission {
|
||||
char notes[NOTES_LENGTH];
|
||||
char mission_desc[MISSION_DESC_LENGTH];
|
||||
int game_type;
|
||||
int flags;
|
||||
flagset<Mission::Mission_Flags> flags;
|
||||
int num_players; // valid in multiplayer missions -- number of players supported
|
||||
uint num_respawns; // valid in multiplayer missions -- number of respawns allowed
|
||||
int max_respawn_delay; // valid in multiplayer missions -- number of respawns allowed
|
||||
@@ -180,7 +155,7 @@ typedef struct mission {
|
||||
notes[ 0 ] = '\0';
|
||||
mission_desc[ 0 ] = '\0';
|
||||
game_type = 0;
|
||||
flags = 0;
|
||||
flags.reset();
|
||||
num_players = 0;
|
||||
num_respawns = 0;
|
||||
max_respawn_delay = 0;
|
||||
@@ -277,8 +252,8 @@ extern char *Goal_type_names[MAX_GOAL_TYPE_NAMES];
|
||||
|
||||
extern char *Reinforcement_type_names[];
|
||||
extern char *Object_flags[];
|
||||
extern char *Parse_object_flags[];
|
||||
extern char *Parse_object_flags_2[];
|
||||
extern flag_def_list_new<Mission::Parse_Object_Flags> Parse_object_flags[];
|
||||
extern const size_t num_parse_object_flags;
|
||||
extern char *Icon_names[];
|
||||
extern char *Mission_event_log_flags[];
|
||||
|
||||
@@ -384,8 +359,7 @@ public:
|
||||
int wingnum; // set to -1 if not in a wing -- Wing array index otherwise
|
||||
int pos_in_wing; // Goober5000 - needed for FRED with the new way things work
|
||||
|
||||
int flags; // mission savable flags
|
||||
int flags2; // Goober5000
|
||||
flagset<Mission::Parse_Object_Flags> flags; // mission savable flags
|
||||
int escort_priority; // priority in escort list
|
||||
int ai_class;
|
||||
int hotkey; // hotkey number (between 0 and 9) -1 means no hotkey
|
||||
@@ -438,86 +412,6 @@ public:
|
||||
~p_object();
|
||||
};
|
||||
|
||||
// defines for flags used for p_objects when they are created. Used to help create special
|
||||
// circumstances for those ships. This list of bitfield indicators MUST correspond EXACTLY
|
||||
// (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!!
|
||||
|
||||
#define MAX_PARSE_OBJECT_FLAGS 27
|
||||
|
||||
#define P_SF_CARGO_KNOWN (1<<0)
|
||||
#define P_SF_IGNORE_COUNT (1<<1)
|
||||
#define P_OF_PROTECTED (1<<2)
|
||||
#define P_SF_REINFORCEMENT (1<<3)
|
||||
#define P_OF_NO_SHIELDS (1<<4)
|
||||
#define P_SF_ESCORT (1<<5)
|
||||
#define P_OF_PLAYER_START (1<<6)
|
||||
#define P_SF_NO_ARRIVAL_MUSIC (1<<7)
|
||||
#define P_SF_NO_ARRIVAL_WARP (1<<8)
|
||||
#define P_SF_NO_DEPARTURE_WARP (1<<9)
|
||||
#define P_SF_LOCKED (1<<10)
|
||||
#define P_OF_INVULNERABLE (1<<11)
|
||||
#define P_SF_HIDDEN_FROM_SENSORS (1<<12)
|
||||
#define P_SF_SCANNABLE (1<<13) // ship is a "scannable" ship
|
||||
#define P_AIF_KAMIKAZE (1<<14)
|
||||
#define P_AIF_NO_DYNAMIC (1<<15)
|
||||
#define P_SF_RED_ALERT_STORE_STATUS (1<<16)
|
||||
#define P_OF_BEAM_PROTECTED (1<<17)
|
||||
#define P_OF_FLAK_PROTECTED (1<<18)
|
||||
#define P_OF_LASER_PROTECTED (1<<19)
|
||||
#define P_OF_MISSILE_PROTECTED (1<<20)
|
||||
#define P_SF_GUARDIAN (1<<21)
|
||||
#define P_KNOSSOS_WARP_IN (1<<22)
|
||||
#define P_SF_VAPORIZE (1<<23)
|
||||
#define P_SF2_STEALTH (1<<24)
|
||||
#define P_SF2_FRIENDLY_STEALTH_INVIS (1<<25)
|
||||
#define P_SF2_DONT_COLLIDE_INVIS (1<<26)
|
||||
|
||||
// the following parse object flags are used internally by FreeSpace
|
||||
#define P_SF_USE_UNIQUE_ORDERS (1<<27) // tells a newly created ship to use the default orders for that ship
|
||||
#define P_SF_DOCK_LEADER (1<<28) // Goober5000 - a docked parse object that is the leader of its group
|
||||
#define P_SF_CANNOT_ARRIVE (1<<29) // used to indicate that this ship's arrival cue will never be true
|
||||
#define P_SF_WARP_BROKEN (1<<30) // warp engine should be broken for this ship
|
||||
#define P_SF_WARP_NEVER (1<<31) // warp drive is destroyed
|
||||
|
||||
// more parse flags! -- Goober5000
|
||||
// same caveat: This list of bitfield indicators MUST correspond EXACTLY
|
||||
// (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!!
|
||||
|
||||
#define MAX_PARSE_OBJECT_FLAGS_2 25
|
||||
|
||||
#define P2_SF2_PRIMITIVE_SENSORS (1<<0)
|
||||
#define P2_SF2_NO_SUBSPACE_DRIVE (1<<1)
|
||||
#define P2_SF2_NAV_CARRY_STATUS (1<<2)
|
||||
#define P2_SF2_AFFECTED_BY_GRAVITY (1<<3)
|
||||
#define P2_SF2_TOGGLE_SUBSYSTEM_SCANNING (1<<4)
|
||||
#define P2_OF_TARGETABLE_AS_BOMB (1<<5)
|
||||
#define P2_SF2_NO_BUILTIN_MESSAGES (1<<6)
|
||||
#define P2_SF2_PRIMARIES_LOCKED (1<<7)
|
||||
#define P2_SF2_SECONDARIES_LOCKED (1<<8)
|
||||
#define P2_SF2_NO_DEATH_SCREAM (1<<9)
|
||||
#define P2_SF2_ALWAYS_DEATH_SCREAM (1<<10)
|
||||
#define P2_SF2_NAV_NEEDSLINK (1<<11)
|
||||
#define P2_SF2_HIDE_SHIP_NAME (1<<12)
|
||||
#define P2_SF2_SET_CLASS_DYNAMICALLY (1<<13)
|
||||
#define P2_SF2_LOCK_ALL_TURRETS_INITIALLY (1<<14)
|
||||
#define P2_SF2_AFTERBURNER_LOCKED (1<<15)
|
||||
#define P2_OF_FORCE_SHIELDS_ON (1<<16)
|
||||
#define P2_OF_IMMOBILE (1<<17)
|
||||
#define P2_SF2_NO_ETS (1<<18)
|
||||
#define P2_SF2_CLOAKED (1<<19)
|
||||
#define P2_SF2_SHIP_LOCKED (1<<20)
|
||||
#define P2_SF2_WEAPONS_LOCKED (1<<21)
|
||||
#define P2_SF2_SCRAMBLE_MESSAGES (1<<22)
|
||||
#define P2_OF_NO_COLLIDE (1<<23) // This actually changes the OF_COLLIDES object flag
|
||||
#define P2_SF2_NO_DISABLED_SELF_DESTRUCT (1<<24)
|
||||
|
||||
// and again: these flags do not appear in the array
|
||||
//#define blah (1<<28)
|
||||
//#define blah (1<<29)
|
||||
#define P2_RED_ALERT_DELETED (1<<30) // Goober5000 - used analogously to SEF_PLAYER_DELETED
|
||||
#define P2_ALREADY_HANDLED (1<<31) // Goober5000 - used for docking currently, but could be used generically
|
||||
|
||||
|
||||
// Goober5000 - this is now dynamic
|
||||
extern SCP_vector<p_object> Parse_objects;
|
||||
#define POBJ_INDEX(pobjp) (int)(pobjp - &Parse_objects[0]) // yes, this arithmetic is valid :D
|
||||
@@ -581,7 +475,7 @@ p_object *mission_parse_get_arrival_ship(const char *name);
|
||||
p_object *mission_parse_get_parse_object(ushort net_signature);
|
||||
p_object *mission_parse_get_parse_object(const char *name);
|
||||
int parse_create_object(p_object *objp);
|
||||
void resolve_parse_flags(object *objp, int parse_flags, int parse_flags2);
|
||||
void resolve_parse_flags(object *objp, flagset<Mission::Parse_Object_Flags> &parse_flags);
|
||||
|
||||
void mission_parse_close();
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ bool HudGaugeDirectives::canRender()
|
||||
}
|
||||
|
||||
if (gauge_config == HUD_ETS_GAUGE) {
|
||||
if (Ships[Player_obj->instance].flags2 & SF2_NO_ETS) {
|
||||
if (Ships[Player_obj->instance].flags[Ship::Ship_Flags::No_ets]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -932,7 +932,7 @@ void message_training_queue_check()
|
||||
|
||||
// if the instructor is dying or departing, do nothing
|
||||
if ( iship_num != -1 ) // added by Goober5000
|
||||
if (Ships[iship_num].flags & (SF_DYING | SF_DEPARTING))
|
||||
if (Ships[iship_num].is_dying_or_departing())
|
||||
return;
|
||||
|
||||
if (Training_failure)
|
||||
|
||||
@@ -348,7 +348,7 @@ void brief_skip_training_pressed()
|
||||
mission_campaign_eval_next_mission();
|
||||
mission_campaign_mission_over();
|
||||
|
||||
if ( The_mission.flags & MISSION_FLAG_END_TO_MAINHALL ) {
|
||||
if ( The_mission.flags[Mission::Mission_Flags::End_to_mainhall] ) {
|
||||
gameseq_post_event( GS_EVENT_MAIN_MENU );
|
||||
} else {
|
||||
gameseq_post_event( GS_EVENT_START_GAME );
|
||||
@@ -880,7 +880,7 @@ void brief_init()
|
||||
return;
|
||||
}
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_ALWAYS_SHOW_GOALS || !(The_mission.game_type & MISSION_TYPE_TRAINING))
|
||||
if (The_mission.flags[Mission::Mission_Flags::Always_show_goals] || !(The_mission.game_type & MISSION_TYPE_TRAINING))
|
||||
Num_brief_stages = Briefing->num_stages + 1;
|
||||
else
|
||||
Num_brief_stages = Briefing->num_stages;
|
||||
@@ -1058,12 +1058,10 @@ void brief_render_closeup(int ship_class, float frametime)
|
||||
|
||||
model_clear_instance( Closeup_icon->modelnum );
|
||||
|
||||
int is_neb = The_mission.flags & MISSION_FLAG_FULLNEB;
|
||||
|
||||
// maybe switch off nebula rendering
|
||||
if(is_neb){
|
||||
The_mission.flags &= ~MISSION_FLAG_FULLNEB;
|
||||
}
|
||||
auto neb_restore = The_mission.flags[Mission::Mission_Flags::Fullneb];
|
||||
The_mission.flags.remove(Mission::Mission_Flags::Fullneb);
|
||||
|
||||
model_render_params render_info;
|
||||
render_info.set_detail_level_lock(0);
|
||||
@@ -1077,9 +1075,7 @@ void brief_render_closeup(int ship_class, float frametime)
|
||||
|
||||
model_render_immediate( &render_info, Closeup_icon->modelnum, &Closeup_orient, &Closeup_pos );
|
||||
|
||||
if (is_neb) {
|
||||
The_mission.flags |= MISSION_FLAG_FULLNEB;
|
||||
}
|
||||
The_mission.flags.set(Mission::Mission_Flags::Fullneb, neb_restore);
|
||||
|
||||
gr_end_view_matrix();
|
||||
gr_end_proj_matrix();
|
||||
@@ -1472,7 +1468,7 @@ void brief_do_frame(float frametime)
|
||||
// commit if skipping briefing, but not in multi - Goober5000
|
||||
if (!(Game_mode & GM_MULTIPLAYER))
|
||||
{
|
||||
if (The_mission.flags & MISSION_FLAG_NO_BRIEFING)
|
||||
if (The_mission.flags[Mission::Mission_Flags::No_briefing])
|
||||
{
|
||||
commit_pressed();
|
||||
return;
|
||||
@@ -1987,7 +1983,7 @@ int brief_only_allow_briefing()
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( The_mission.flags & (MISSION_FLAG_SCRAMBLE | MISSION_FLAG_RED_ALERT) ) {
|
||||
if ( The_mission.flags[Mission::Mission_Flags::Scramble] || The_mission.flags[Mission::Mission_Flags::Red_alert] ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -774,7 +774,7 @@ int debrief_set_stages_and_multi_stuff()
|
||||
if ( !(Game_mode & GM_MULTIPLAYER) ) {
|
||||
// although the no traitor flag check seems redundant it allows the mission designer to turn the traitor
|
||||
// debriefing off before the mission ends and supply one themselves
|
||||
if ((Player_ship->team == Iff_traitor) && !(The_mission.flags & MISSION_FLAG_NO_TRAITOR))
|
||||
if ((Player_ship->team == Iff_traitor) && !(The_mission.flags[Mission::Mission_Flags::No_traitor]))
|
||||
debriefp = &Traitor_debriefing;
|
||||
}
|
||||
|
||||
@@ -1389,7 +1389,7 @@ void debrief_accept(int ok_to_post_start_game_event)
|
||||
}
|
||||
|
||||
// check if campaign is over, or if FREDer wants the mainhall
|
||||
if ( Campaign.next_mission == -1 || (The_mission.flags & MISSION_FLAG_END_TO_MAINHALL) ) {
|
||||
if ( Campaign.next_mission == -1 || (The_mission.flags[Mission::Mission_Flags::End_to_mainhall]) ) {
|
||||
gameseq_post_event(GS_EVENT_MAIN_MENU);
|
||||
} else {
|
||||
if ( ok_to_post_start_game_event ) {
|
||||
@@ -1404,7 +1404,7 @@ void debrief_accept(int ok_to_post_start_game_event)
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
if ( play_commit_sound && !(The_mission.flags & MISSION_FLAG_TOGGLE_DEBRIEFING)) {
|
||||
if ( play_commit_sound && !(The_mission.flags[Mission::Mission_Flags::Toggle_debriefing])) {
|
||||
gamesnd_play_iface(SND_COMMIT_PRESSED);
|
||||
}
|
||||
|
||||
@@ -2287,7 +2287,7 @@ void debrief_do_frame(float frametime)
|
||||
Assert(Debrief_inited);
|
||||
|
||||
// Goober5000 - accept immediately if skipping debriefing
|
||||
if (The_mission.flags & MISSION_FLAG_TOGGLE_DEBRIEFING)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Toggle_debriefing])
|
||||
{
|
||||
// make sure that we can actually advance - we don't want an endless loop!!!
|
||||
if ( !((/*Cheats_enabled ||*/ Turned_traitor || Must_replay_mission) && (Game_mode & GM_CAMPAIGN_MODE)) )
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
#include <limits.h> // this is need even when not building debug!!
|
||||
#include <type_traits>
|
||||
|
||||
#include "anim/animplay.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
@@ -1527,7 +1528,7 @@ int restore_wss_data(ubyte *block)
|
||||
return offset;
|
||||
}
|
||||
|
||||
void draw_model_icon(int model_id, int flags, float closeup_zoom, int x, int y, int w, int h, const ship_info *sip, int resize_mode, const vec3d *closeup_pos)
|
||||
void draw_model_icon(int model_id, int flags, float closeup_zoom, int x, int y, int w, int h, ship_info *sip, int resize_mode, const vec3d *closeup_pos)
|
||||
{
|
||||
matrix object_orient = IDENTITY_MATRIX;
|
||||
angles rot_angles = {0.0f,0.0f,0.0f};
|
||||
@@ -1543,11 +1544,11 @@ void draw_model_icon(int model_id, int flags, float closeup_zoom, int x, int y,
|
||||
// If non-zero model_icon_angles exists, always use that
|
||||
rot_angles = sip->model_icon_angles;
|
||||
}
|
||||
else if(sip->flags & SIF_SMALL_SHIP)
|
||||
else if(sip->is_small_ship())
|
||||
{
|
||||
rot_angles.p = -(PI_2);
|
||||
}
|
||||
else if((sip->max_speed <= 0.0f) && !(sip->flags & SIF_CARGO))
|
||||
else if((sip->max_speed <= 0.0f) && !(sip->flags[Ship::Info_Flags::Cargo]))
|
||||
{
|
||||
//Probably an installation or Knossos
|
||||
rot_angles.h = PI;
|
||||
|
||||
@@ -205,7 +205,7 @@ int store_wss_data(ubyte *block, int max_size, int sound,int player_index);
|
||||
int restore_wss_data(ubyte *block);
|
||||
|
||||
class ship_info;
|
||||
void draw_model_icon(int model_id, int flags, float closeup_zoom, int x1, int x2, int y1, int y2, const ship_info* sip = NULL, int resize_mode = GR_RESIZE_FULL, const vec3d *closeup_pos = &vmd_zero_vector);
|
||||
void draw_model_icon(int model_id, int flags, float closeup_zoom, int x1, int x2, int y1, int y2, ship_info* sip = NULL, int resize_mode = GR_RESIZE_FULL, const vec3d *closeup_pos = &vmd_zero_vector);
|
||||
void draw_model_rotating(model_render_params *render_info, int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos=NULL, float closeup_zoom = .65f, float rev_rate = REVOLUTION_RATE, int flags = MR_AUTOCENTER | MR_NO_FOGGING, int resize_mode=GR_RESIZE_FULL, int effect = 2);
|
||||
|
||||
void common_set_team_pointers(int team);
|
||||
|
||||
@@ -1451,10 +1451,10 @@ void ship_select_do(float frametime)
|
||||
{
|
||||
ship_info *sip = &Ship_info[Selected_ss_class];
|
||||
float rev_rate = REVOLUTION_RATE;
|
||||
if (sip->flags & SIF_BIG_SHIP) {
|
||||
if (sip->is_big_ship()) {
|
||||
rev_rate *= 1.7f;
|
||||
}
|
||||
if (sip->flags & SIF_HUGE_SHIP) {
|
||||
if (sip->is_huge_ship()) {
|
||||
rev_rate *= 3.0f;
|
||||
}
|
||||
|
||||
@@ -1906,7 +1906,7 @@ void commit_pressed()
|
||||
mission_hotkey_validate();
|
||||
|
||||
// Goober5000 - no sound when skipping briefing
|
||||
if (!(The_mission.flags & MISSION_FLAG_NO_BRIEFING))
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::No_briefing]))
|
||||
gamesnd_play_iface(SND_COMMIT_PRESSED);
|
||||
|
||||
// save the player loadout
|
||||
@@ -3029,10 +3029,10 @@ void ss_init_units()
|
||||
// going to be able to modify that ship.
|
||||
if ( ss_slot->sa_index == -1 ) {
|
||||
int objnum;
|
||||
if ( Ships[wp->ship_index[j]].flags2 & SF2_SHIP_LOCKED ) {
|
||||
if ( Ships[wp->ship_index[j]].flags[Ship::Ship_Flags::Ship_locked] ) {
|
||||
ss_slot->status |= WING_SLOT_SHIPS_DISABLED;
|
||||
}
|
||||
if ( Ships[wp->ship_index[j]].flags2 & SF2_WEAPONS_LOCKED ) {
|
||||
if ( Ships[wp->ship_index[j]].flags[Ship::Ship_Flags::Weapons_locked] ) {
|
||||
ss_slot->status |= WING_SLOT_WEAPONS_DISABLED;
|
||||
}
|
||||
|
||||
@@ -3042,7 +3042,7 @@ void ss_init_units()
|
||||
}
|
||||
|
||||
objnum = Ships[wp->ship_index[j]].objnum;
|
||||
if ( Objects[objnum].flags & OF_PLAYER_SHIP ) {
|
||||
if ( Objects[objnum].flags[Object::Object_Flags::Player_ship] ) {
|
||||
if ( ss_slot->status & WING_SLOT_LOCKED ) {
|
||||
// Int3(); // Get Alan
|
||||
|
||||
@@ -3055,10 +3055,10 @@ void ss_init_units()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( Parse_objects[ss_slot->sa_index].flags2 & P2_SF2_SHIP_LOCKED ) {
|
||||
if (Parse_objects[ss_slot->sa_index].flags[Mission::Parse_Object_Flags::SF_Ship_locked]) {
|
||||
ss_slot->status |= WING_SLOT_SHIPS_DISABLED;
|
||||
}
|
||||
if ( Parse_objects[ss_slot->sa_index].flags2 & P2_SF2_WEAPONS_LOCKED ) {
|
||||
if ( Parse_objects[ss_slot->sa_index].flags[Mission::Parse_Object_Flags::SF_Weapons_locked] ) {
|
||||
ss_slot->status |= WING_SLOT_WEAPONS_DISABLED;
|
||||
}
|
||||
|
||||
@@ -3066,7 +3066,7 @@ void ss_init_units()
|
||||
if (!(ss_slot->status & WING_SLOT_DISABLED)) {
|
||||
ss_slot->status = WING_SLOT_FILLED;
|
||||
}
|
||||
if ( Parse_objects[ss_slot->sa_index].flags & P_OF_PLAYER_START ) {
|
||||
if ( Parse_objects[ss_slot->sa_index].flags[Mission::Parse_Object_Flags::OF_Player_start] ) {
|
||||
if ( ss_slot->status & WING_SLOT_LOCKED ) {
|
||||
// Int3(); // Get Alan
|
||||
|
||||
|
||||
@@ -848,10 +848,10 @@ void wl_render_overhead_view(float frametime)
|
||||
{
|
||||
float rev_rate;
|
||||
rev_rate = REVOLUTION_RATE;
|
||||
if (sip->flags & SIF_BIG_SHIP) {
|
||||
if (sip->is_big_ship()) {
|
||||
rev_rate *= 1.7f;
|
||||
}
|
||||
if (sip->flags & SIF_HUGE_SHIP) {
|
||||
if (sip->is_huge_ship()) {
|
||||
rev_rate *= 3.0f;
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@ void wl_set_disabled_weapons(int ship_class)
|
||||
if (Weapon_info[i].wi_flags2 & WIF2_BALLISTIC)
|
||||
{
|
||||
// not allowed if this ship is not ballistic
|
||||
if (!(sip->flags & SIF_BALLISTIC_PRIMARIES))
|
||||
if (!(sip->flags[Ship::Info_Flags::Ballistic_primaries]))
|
||||
{
|
||||
Wl_icons[i].can_use = 0;
|
||||
}
|
||||
@@ -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 & SIF_BALLISTIC_PRIMARIES)))
|
||||
|| ((wip->wi_flags2 & WIF2_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);
|
||||
|
||||
+14
-14
@@ -390,7 +390,7 @@ void red_alert_do_frame(float frametime)
|
||||
|
||||
// commit if skipping briefing, but not in multi - Goober5000
|
||||
if (!(Game_mode & GM_MULTIPLAYER)) {
|
||||
if (The_mission.flags & MISSION_FLAG_NO_BRIEFING)
|
||||
if (The_mission.flags[Mission::Mission_Flags::No_briefing])
|
||||
{
|
||||
red_alert_button_pressed(RA_CONTINUE);
|
||||
return;
|
||||
@@ -725,11 +725,11 @@ void red_alert_store_wingman_status()
|
||||
Assert(ship_objp->type == OBJ_SHIP);
|
||||
shipp = &Ships[ship_objp->instance];
|
||||
|
||||
if ( shipp->flags & SF_DYING ) {
|
||||
if ( shipp->flags[Ship::Ship_Flags::Dying] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !(shipp->flags & SF_FROM_PLAYER_WING) && !(shipp->flags & SF_RED_ALERT_STORE_STATUS) ) {
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::From_player_wing]) && !(shipp->flags[Ship::Ship_Flags::Red_alert_store_status]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -800,10 +800,10 @@ void red_alert_delete_ship(p_object *pobjp, int ship_state)
|
||||
{
|
||||
if (ship_state == RED_ALERT_DESTROYED_SHIP_CLASS || ship_state == RED_ALERT_PLAYER_DEL_SHIP_CLASS)
|
||||
{
|
||||
pobjp->flags2 |= P2_RED_ALERT_DELETED;
|
||||
pobjp->flags[Mission::Parse_Object_Flags::Red_alert_deleted];
|
||||
|
||||
if (pobjp->wingnum < 0)
|
||||
pobjp->flags |= P_SF_CANNOT_ARRIVE;
|
||||
if (pobjp->wingnum < 0)
|
||||
pobjp->flags.set(Mission::Parse_Object_Flags::SF_Cannot_arrive);
|
||||
}
|
||||
else
|
||||
Error(LOCATION, "Red Alert: asked to delete ship (%s) with invalid ship state (%d)", pobjp->name, ship_state);
|
||||
@@ -842,7 +842,7 @@ void red_alert_bash_wingman_status()
|
||||
Assert(ship_objp->type == OBJ_SHIP);
|
||||
ship *shipp = &Ships[ship_objp->instance];
|
||||
|
||||
if ( !(shipp->flags & SF_FROM_PLAYER_WING) && !(shipp->flags & SF_RED_ALERT_STORE_STATUS) ) {
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::From_player_wing]) && !(shipp->flags[Ship::Ship_Flags::Red_alert_store_status]) ) {
|
||||
so = GET_NEXT(so);
|
||||
continue;
|
||||
}
|
||||
@@ -932,7 +932,7 @@ void red_alert_bash_wingman_status()
|
||||
}
|
||||
|
||||
// same condition as in ship_obj loop
|
||||
if ( !from_player_wing && !(pobjp->flags & P_SF_RED_ALERT_STORE_STATUS) ) {
|
||||
if ( !from_player_wing && !(pobjp->flags[Mission::Parse_Object_Flags::SF_Red_alert_store_status]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1016,11 +1016,11 @@ void red_alert_bash_wingman_status()
|
||||
if (pobjp->wingnum == ii->first)
|
||||
{
|
||||
// no waves left to arrive, so mark ships accordingly
|
||||
if (wingp->num_waves == 0)
|
||||
pobjp->flags |= P_SF_CANNOT_ARRIVE;
|
||||
// we skipped one complete wave, so clear the flag so the next wave creates all ships
|
||||
else
|
||||
pobjp->flags2 &= ~P2_RED_ALERT_DELETED;
|
||||
if (wingp->num_waves == 0)
|
||||
pobjp->flags.set(Mission::Parse_Object_Flags::SF_Cannot_arrive);
|
||||
// we skipped one complete wave, so clear the flag so the next wave creates all ships
|
||||
else
|
||||
pobjp->flags.remove(Mission::Parse_Object_Flags::Red_alert_deleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1030,7 +1030,7 @@ void red_alert_bash_wingman_status()
|
||||
// return !0 if this is a red alert mission, otherwise return 0
|
||||
int red_alert_mission()
|
||||
{
|
||||
return (The_mission.flags & MISSION_FLAG_RED_ALERT);
|
||||
return (The_mission.flags[Mission::Mission_Flags::Red_alert]);
|
||||
}
|
||||
|
||||
// called from sexpression code to start a red alert mission
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef MODEL_FLAGS_H
|
||||
#define MODEL_FLAGS_H
|
||||
|
||||
#include "globalincs/flagset.h"
|
||||
|
||||
namespace Model {
|
||||
|
||||
FLAG_LIST(Subsystem_Flags) {
|
||||
Rotates, // This means the object rotates automatically with "turn_rate"
|
||||
Stepped_rotate, // This means that the rotation occurs in steps
|
||||
Ai_rotate, // This means that the rotation is controlled by ai
|
||||
Crewpoint, // If set, this is a crew point.
|
||||
Turret_matrix, // If set, this has it's turret matrix created correctly.
|
||||
Awacs, // If set, this subsystem has AWACS capability
|
||||
Artillery, // if this rotates when weapons are fired - Goober5000
|
||||
Triggered, // rotates when triggered by something
|
||||
Untargetable, // Goober5000
|
||||
Carry_no_damage, // WMC
|
||||
Use_multiple_guns, // WMC
|
||||
Fire_on_normal, // forces a turret to fire down its normal vecs
|
||||
Turret_hull_check, // makes the turret check to see if it's going to shoot through it's own hull before fireing - Bobboau
|
||||
Turret_fixed_fp, // forces turret (when defined with multiple weapons) to prevent the firepoints from alternating
|
||||
Turret_salvo, // forces turret to fire salvos (all guns simultaneously) - independent targeting
|
||||
Fire_on_target, // prevents turret from firing unless it is pointing at the firingpoints are pointing at the target
|
||||
No_ss_targeting, // toggles the subsystem targeting for the turret
|
||||
Turret_reset_idle, // makes turret reset to their initial position if the target is out of field of view
|
||||
Turret_alt_math, // tells the game to use additional calculations should turret have a defined y fov
|
||||
Dum_rotates, // Bobboau
|
||||
Carry_shockwave, // subsystem - even with 'carry no damage' flag - will carry shockwave damage to the hull
|
||||
Allow_landing, // This subsystem can be landed on
|
||||
Fov_edge_check, // Tells the game to use better FOV edge checking with this turret
|
||||
Fov_required, // Tells game not to allow this turret to attempt targeting objects out of FOV
|
||||
No_replace, // set the subsys not to draw replacement ('destroyed') model
|
||||
No_live_debris, // sets the subsys not to release live debris
|
||||
Ignore_if_dead, // tells homing missiles to ignore the subsys if its dead and home on to hull instead of earlier subsys pos
|
||||
Allow_vanishing, // allows subsystem to vanish (prevents explosions & sounds effects from being played)
|
||||
Damage_as_hull, // applies armor damage to subsystem instead of subsystem damage - FUBAR
|
||||
Turret_locked, // Turret starts locked by default - Sushi
|
||||
No_aggregate, // Don't include with aggregate subsystem types - Goober5000
|
||||
Turret_anim_wait, // Turret won't fire until animation is complete - Sushi
|
||||
Player_turret_sound,
|
||||
Turret_only_target_if_can_fire,// Turrets only target things they're allowed to shoot at (e.g. if check-hull fails, won't keep targeting)
|
||||
No_disappear, // Submodel won't disappear when subsystem destroyed
|
||||
Collide_submodel, // subsystem takes damage only from hits which impact the associated submodel
|
||||
Destroyed_rotation, // allows subobjects to continue to rotate even if they have been destroyed
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Render_Flags) {
|
||||
Normal, // Draw a normal object
|
||||
Show_outline, // Draw the object in outline mode. Color specified by model_set_outline_color
|
||||
Show_pivots, // Show the pivot points
|
||||
Show_paths, // Show the paths associated with a model
|
||||
Show_radius, // Show the radius around the object
|
||||
Show_shields, // Show the shield mesh
|
||||
Show_thrusters, // Show the engine thrusters. See model_set_thrust for how long it draws.
|
||||
Lock_detail, // Only draw the detail level defined in model_set_detail_level
|
||||
No_polys, // Don't draw the polygons.
|
||||
No_lighting, // Don't perform any lighting on the model.
|
||||
No_texturing, // Draw textures as flat-shaded polygons.
|
||||
No_correct, // Don't to correct texture mapping
|
||||
No_smoothing, // Don't perform smoothing on vertices.
|
||||
Is_asteroid, // When set, treat this as an asteroid.
|
||||
Is_missile, // When set, treat this as a missilie. No lighting, small thrusters.
|
||||
Show_outline_preset, // Draw the object in outline mode. Color assumed to be set already.
|
||||
Show_invisible_faces, // Show invisible faces as green...
|
||||
Autocenter, // Always use the center of the hull bounding box as the center, instead of the pivot point
|
||||
Bay_paths, // draw bay paths
|
||||
All_xparent, // render it fully transparent
|
||||
No_zbuffer, // switch z-buffering off completely
|
||||
No_cull, // don't cull backfacing poly's
|
||||
Force_texture, // force a given texture to always be used
|
||||
Force_lower_detail, // force the model to draw 1 LOD lower, if possible
|
||||
Edge_alpha, // makes norms that are faceing away from you render more transparent -Bobboau
|
||||
Center_alpha, // oposite of above -Bobboau
|
||||
No_fogging, // Don't fog - taylor
|
||||
Show_outline_htl, // Show outlines (wireframe view) using HTL method
|
||||
No_glowmaps, // disable rendering of glowmaps - taylor
|
||||
Full_detail, // render all valid objects, particularly ones that are otherwise in/out of render boxes - taylor
|
||||
Force_clamp, // force clamp - Hery
|
||||
Animated_shader, // Use a animated Shader - Valathil
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3045,7 +3045,7 @@ void model_set_bay_path_nums(polymodel *pm)
|
||||
|
||||
/*
|
||||
// currently only capital ships have fighter bays
|
||||
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( !(sip->is_big_or_huge()) ) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
+11
-11
@@ -1140,7 +1140,7 @@ float model_render_determine_depth(int obj_num, int model_num, matrix* orient, v
|
||||
}
|
||||
|
||||
// nebula ?
|
||||
if (The_mission.flags & MISSION_FLAG_FULLNEB) {
|
||||
if (The_mission.flags[Mission::Mission_Flags::Fullneb]) {
|
||||
depth *= neb2_get_lod_scale(obj_num);
|
||||
}
|
||||
|
||||
@@ -1745,7 +1745,7 @@ void submodel_render_queue(model_render_params *render_info, draw_list *scene, i
|
||||
uint tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB;
|
||||
|
||||
// if we're in nebula mode
|
||||
if( ( The_mission.flags & MISSION_FLAG_FULLNEB ) && ( Neb2_render_mode != NEB2_RENDER_NONE ) ) {
|
||||
if( ( The_mission.flags[Mission::Mission_Flags::Fullneb] ) && ( Neb2_render_mode != NEB2_RENDER_NONE ) ) {
|
||||
tmap_flags |= TMAP_FLAG_PIXEL_FOG;
|
||||
}
|
||||
|
||||
@@ -1878,7 +1878,7 @@ void model_render_glowpoint(int point_num, vec3d *pos, matrix *orient, glow_poin
|
||||
vm_vec_unrotate(&world_norm, &loc_norm, orient);
|
||||
|
||||
if ( shipp != NULL ) {
|
||||
if ( (shipp->flags & (SF_ARRIVING) ) && (shipp->warpin_effect) && Ship_info[shipp->ship_info_index].warpin_type != WT_HYPERSPACE) {
|
||||
if ( (shipp->is_arriving() ) && (shipp->warpin_effect) && Ship_info[shipp->ship_info_index].warpin_type != WT_HYPERSPACE) {
|
||||
vec3d warp_pnt, tmp;
|
||||
matrix warp_orient;
|
||||
|
||||
@@ -1891,7 +1891,7 @@ void model_render_glowpoint(int point_num, vec3d *pos, matrix *orient, glow_poin
|
||||
}
|
||||
}
|
||||
|
||||
if ( (shipp->flags & (SF_DEPART_WARP) ) && (shipp->warpout_effect) && Ship_info[shipp->ship_info_index].warpout_type != WT_HYPERSPACE) {
|
||||
if ( (shipp->flags[Ship::Ship_Flags::Depart_warp] ) && (shipp->warpout_effect) && Ship_info[shipp->ship_info_index].warpout_type != WT_HYPERSPACE) {
|
||||
vec3d warp_pnt, tmp;
|
||||
matrix warp_orient;
|
||||
|
||||
@@ -1932,7 +1932,7 @@ void model_render_glowpoint(int point_num, vec3d *pos, matrix *orient, glow_poin
|
||||
|
||||
|
||||
// fade them in the nebula as well
|
||||
if ( The_mission.flags & MISSION_FLAG_FULLNEB ) {
|
||||
if ( The_mission.flags[Mission::Mission_Flags::Fullneb] ) {
|
||||
//vec3d npnt;
|
||||
//vm_vec_add(&npnt, &loc_offset, pos);
|
||||
|
||||
@@ -2078,7 +2078,7 @@ void model_render_glowpoint(int point_num, vec3d *pos, matrix *orient, glow_poin
|
||||
vm_vec_sub(&tempv,&View_position,&loc_offset);
|
||||
vm_vec_normalize(&tempv);
|
||||
|
||||
if ( The_mission.flags & MISSION_FLAG_FULLNEB ) {
|
||||
if ( The_mission.flags[Mission::Mission_Flags::Fullneb] ) {
|
||||
batch_add_quad(bank->glow_neb_bitmap, TMAP_FLAG_TILED | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT | TMAP_HTL_3D_UNLIT | TMAP_FLAG_EMISSIVE, verts);
|
||||
} else {
|
||||
batch_add_quad(bank->glow_bitmap, TMAP_FLAG_TILED | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT | TMAP_HTL_3D_UNLIT | TMAP_FLAG_EMISSIVE, verts);
|
||||
@@ -2326,7 +2326,7 @@ void model_queue_render_thrusters(model_render_params *interp, polymodel *pm, in
|
||||
|
||||
if (shipp) {
|
||||
// if ship is warping out, check position of the engine glow to the warp plane
|
||||
if ( (shipp->flags & (SF_ARRIVING) ) && (shipp->warpin_effect) && Ship_info[shipp->ship_info_index].warpin_type != WT_HYPERSPACE) {
|
||||
if ( (shipp->is_arriving() ) && (shipp->warpin_effect) && Ship_info[shipp->ship_info_index].warpin_type != WT_HYPERSPACE) {
|
||||
vec3d warp_pnt, tmp;
|
||||
matrix warp_orient;
|
||||
|
||||
@@ -2339,7 +2339,7 @@ void model_queue_render_thrusters(model_render_params *interp, polymodel *pm, in
|
||||
}
|
||||
}
|
||||
|
||||
if ( (shipp->flags & (SF_DEPART_WARP) ) && (shipp->warpout_effect) && Ship_info[shipp->ship_info_index].warpout_type != WT_HYPERSPACE) {
|
||||
if ( (shipp->flags[Ship::Ship_Flags::Depart_warp] ) && (shipp->warpout_effect) && Ship_info[shipp->ship_info_index].warpout_type != WT_HYPERSPACE) {
|
||||
vec3d warp_pnt, tmp;
|
||||
matrix warp_orient;
|
||||
|
||||
@@ -2395,7 +2395,7 @@ void model_queue_render_thrusters(model_render_params *interp, polymodel *pm, in
|
||||
float fog_int = 1.0f;
|
||||
|
||||
// fade them in the nebula as well
|
||||
if (The_mission.flags & MISSION_FLAG_FULLNEB) {
|
||||
if (The_mission.flags[Mission::Mission_Flags::Fullneb]) {
|
||||
vm_vec_unrotate(&npnt, &gpt->pnt, orient);
|
||||
vm_vec_add2(&npnt, pos);
|
||||
|
||||
@@ -2465,7 +2465,7 @@ void model_queue_render_thrusters(model_render_params *interp, polymodel *pm, in
|
||||
|
||||
vm_vec_scale_add(&norm2, &pnt, &fvec, wVal * 2 * thruster_info.glow_length_factor);
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_FULLNEB) {
|
||||
if (The_mission.flags[Mission::Mission_Flags::Fullneb]) {
|
||||
vm_vec_add(&npnt, &pnt, pos);
|
||||
d *= fog_int;
|
||||
}
|
||||
@@ -2786,7 +2786,7 @@ void model_render_queue(model_render_params *interp, draw_list *scene, int model
|
||||
uint tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB;
|
||||
|
||||
// if we're in nebula mode, fog everything except for the warp holes and other non-fogged models
|
||||
if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE) && !(model_flags & MR_NO_FOGGING)){
|
||||
if((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE) && !(model_flags & MR_NO_FOGGING)){
|
||||
tmap_flags |= TMAP_FLAG_PIXEL_FOG;
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -345,7 +345,7 @@ void neb2_post_level_init()
|
||||
}
|
||||
|
||||
// if the mission is not a fullneb mission, skip
|
||||
if ( !((The_mission.flags & MISSION_FLAG_FULLNEB) || Nebula_sexp_used) ) {
|
||||
if ( !((The_mission.flags[Mission::Mission_Flags::Fullneb]) || Nebula_sexp_used) ) {
|
||||
Neb2_render_mode = NEB2_RENDER_NONE;
|
||||
Neb2_awacs = -1.0f;
|
||||
return;
|
||||
@@ -414,7 +414,7 @@ void neb2_post_level_init()
|
||||
neb2_eye_changed();
|
||||
|
||||
// if we are going to use fullneb, but aren't fullneb yet, then be sure to reset our mode
|
||||
if ( !(The_mission.flags & MISSION_FLAG_FULLNEB) ) {
|
||||
if ( !(The_mission.flags[Mission::Mission_Flags::Fullneb]) ) {
|
||||
Neb2_render_mode = NEB2_RENDER_NONE;
|
||||
Neb2_awacs = -1.0f;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void neb2_level_close()
|
||||
}
|
||||
|
||||
// if the mission is not a fullneb mission, skip
|
||||
if ( !((The_mission.flags & MISSION_FLAG_FULLNEB) || Nebula_sexp_used) ) {
|
||||
if ( !((The_mission.flags[Mission::Mission_Flags::Fullneb]) || Nebula_sexp_used) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ void neb2_level_close()
|
||||
}
|
||||
|
||||
// unflag the mission as being fullneb so stuff doesn't fog in the techdata room :D
|
||||
The_mission.flags &= ~MISSION_FLAG_FULLNEB;
|
||||
The_mission.flags.remove(Mission::Mission_Flags::Fullneb);
|
||||
|
||||
if (Neb2_htl_fog_data) {
|
||||
delete[] Neb2_htl_fog_data;
|
||||
@@ -461,7 +461,7 @@ void neb2_render_setup(camid cid)
|
||||
}
|
||||
|
||||
// if the mission is not a fullneb mission, skip
|
||||
if ( !(The_mission.flags & MISSION_FLAG_FULLNEB) ) {
|
||||
if ( !(The_mission.flags[Mission::Mission_Flags::Fullneb]) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ void neb2_page_in()
|
||||
int idx;
|
||||
|
||||
// load in all nebula bitmaps
|
||||
if ( (The_mission.flags & MISSION_FLAG_FULLNEB) || Nebula_sexp_used ) {
|
||||
if ( (The_mission.flags[Mission::Mission_Flags::Fullneb]) || Nebula_sexp_used ) {
|
||||
for (idx = 0; idx < Neb2_poof_count; idx++) {
|
||||
if ( (Neb2_poofs[idx] >= 0) && (Neb2_poof_flags & (1<<idx)) ) {
|
||||
bm_page_in_texture(Neb2_poofs[idx]);
|
||||
@@ -562,17 +562,17 @@ int neb2_skip_render(object *objp, float z_depth)
|
||||
}
|
||||
|
||||
// small ships over the fog limit by a small factor
|
||||
if ( (sip->flags & SIF_SMALL_SHIP) && (z_depth >= (fog_far * 1.5f)) ) {
|
||||
if ( (sip->is_small_ship()) && (z_depth >= (fog_far * 1.5f)) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// big ships
|
||||
if ( (sip->flags & SIF_BIG_SHIP) && (z_depth >= (fog_far * 2.0f)) ) {
|
||||
if ( (sip->is_big_ship()) && (z_depth >= (fog_far * 2.0f)) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// huge ships
|
||||
if ( (sip->flags & SIF_HUGE_SHIP) && (z_depth >= (fog_far * 3.0f)) ) {
|
||||
if ( (sip->is_huge_ship()) && (z_depth >= (fog_far * 3.0f)) ) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -620,9 +620,9 @@ float neb2_get_lod_scale(int objnum)
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// small ship?
|
||||
if (sip->flags & SIF_SMALL_SHIP) {
|
||||
if (sip->is_small_ship()) {
|
||||
return 1.8f;
|
||||
} else if (sip->flags & SIF_BIG_SHIP) {
|
||||
} else if (sip->is_big_ship()) {
|
||||
return 1.4f;
|
||||
}
|
||||
|
||||
@@ -929,7 +929,7 @@ void neb2_render_player()
|
||||
}
|
||||
|
||||
// if the mission is not a fullneb mission, skip
|
||||
if (!(The_mission.flags & MISSION_FLAG_FULLNEB)) {
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::Fullneb])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1221,7 +1221,7 @@ int tbmap = -1;
|
||||
void neb2_pre_render(camid cid)
|
||||
{
|
||||
// if the mission is not a fullneb mission, skip
|
||||
if (!(The_mission.flags & MISSION_FLAG_FULLNEB)) {
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::Fullneb])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ void nebl_render_all()
|
||||
bolt_type *bi;
|
||||
|
||||
// no lightning in non-nebula missions
|
||||
if(!(The_mission.flags & MISSION_FLAG_FULLNEB)){
|
||||
if(!(The_mission.flags[Mission::Mission_Flags::Fullneb])){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ void nebl_process()
|
||||
uint num_bolts, idx;
|
||||
|
||||
// non-nebula mission
|
||||
if(!(The_mission.flags & MISSION_FLAG_FULLNEB)){
|
||||
if(!(The_mission.flags[Mission::Mission_Flags::Fullneb])){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ void nebl_bolt(size_t type, vec3d *start, vec3d *strike)
|
||||
bolt_type *bi;
|
||||
float bolt_len;
|
||||
|
||||
if(!(The_mission.flags & MISSION_FLAG_FULLNEB)){
|
||||
if(!(The_mission.flags[Mission::Mission_Flags::Fullneb])){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1242,7 +1242,7 @@ void multi_do_frame()
|
||||
// send my observer position/object update
|
||||
send_observer_update_packet();
|
||||
}
|
||||
} else if ( !(Player_ship->flags & SF_DEPARTING ) ){
|
||||
} else if ( !(Player_ship->is_departing() ) ){
|
||||
// if the rate limiting system says its ok
|
||||
if(multi_oo_cirate_can_send()){
|
||||
// use the new method
|
||||
|
||||
@@ -900,7 +900,7 @@ void multi_ingame_join_display_avail()
|
||||
|
||||
moveup = GET_FIRST(&Ship_obj_list);
|
||||
while(moveup != END_OF_LIST(&Ship_obj_list)){
|
||||
if( !(Ships[Objects[moveup->objnum].instance].flags & (SF_DYING|SF_DEPARTING)) && (Objects[moveup->objnum].flags & OF_COULD_BE_PLAYER) ) {
|
||||
if( !(Ships[Objects[moveup->objnum].instance].is_dying_or_departing()) && (Objects[moveup->objnum].flags[Object::Object_Flags::Could_be_player]) ) {
|
||||
// display the ship
|
||||
multi_ingame_join_display_ship(&Objects[moveup->objnum],Mi_name_field[gr_screen.res][MI_FIELD_Y] + (Multi_ingame_num_avail * Mi_spacing[gr_screen.res]));
|
||||
|
||||
@@ -971,7 +971,8 @@ void multi_ingame_handle_timeout()
|
||||
|
||||
void process_ingame_ships_packet( ubyte *data, header *hinfo )
|
||||
{
|
||||
int offset, sflags, sflags2, oflags, team, j;
|
||||
int offset, team, j;
|
||||
uint64_t oflags, sflags;
|
||||
ubyte p_type;
|
||||
ushort net_signature;
|
||||
short wing_data;
|
||||
@@ -1008,9 +1009,8 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
|
||||
|
||||
GET_STRING( ship_name );
|
||||
GET_USHORT( net_signature );
|
||||
GET_INT( sflags );
|
||||
GET_INT( sflags2 );
|
||||
GET_INT( oflags );
|
||||
GET_ULONG( sflags );
|
||||
GET_ULONG( oflags );
|
||||
GET_INT( team );
|
||||
GET_SHORT( wing_data );
|
||||
net_sig_modify = 0;
|
||||
@@ -1039,13 +1039,12 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
|
||||
multi_set_network_signature( net_signature, MULTI_SIG_SHIP );
|
||||
objnum = parse_create_object( p_objp );
|
||||
ship_num = Objects[objnum].instance;
|
||||
Objects[objnum].flags = oflags;
|
||||
Objects[objnum].flags.from_long(oflags);
|
||||
Objects[objnum].net_signature = net_signature;
|
||||
|
||||
// assign any common data
|
||||
strcpy_s(Ships[ship_num].ship_name, ship_name);
|
||||
Ships[ship_num].flags = sflags;
|
||||
Ships[ship_num].flags2 = sflags2;
|
||||
Ships[ship_num].flags.from_long(sflags);
|
||||
Ships[ship_num].team = team;
|
||||
Ships[ship_num].wingnum = (int)wing_data;
|
||||
|
||||
@@ -1077,15 +1076,15 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
|
||||
wl_bash_ship_weapons(&Ships[idx].weapons, &Wss_slots_teams[team_val][slot_index]);
|
||||
|
||||
// Be sure to mark this ship as as a could_be_player
|
||||
obj_set_flags( objp, objp->flags | OF_COULD_BE_PLAYER );
|
||||
objp->flags &= ~OF_PLAYER_SHIP;
|
||||
obj_set_flags( objp, objp->flags + Object::Object_Flags::Could_be_player );
|
||||
objp->flags.remove(Object::Object_Flags::Player_ship);
|
||||
|
||||
// if this is a player ship, make sure we find out who's it is and set their objnum accordingly
|
||||
for( j = 0; j < MAX_PLAYERS; j++){
|
||||
if(MULTI_CONNECTED(Net_players[j]) && (Net_players[j].m_player->objnum == Objects[Ships[idx].objnum].net_signature)) {
|
||||
multi_assign_player_ship( j, objp, Ships[idx].ship_info_index );
|
||||
objp->flags |= OF_PLAYER_SHIP;
|
||||
objp->flags &= ~OF_COULD_BE_PLAYER;
|
||||
objp->flags.set(Object::Object_Flags::Player_ship);
|
||||
objp->flags.remove(Object::Object_Flags::Could_be_player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1133,9 +1132,8 @@ void send_ingame_ships_packet(net_player *player)
|
||||
ADD_DATA( p_type );
|
||||
ADD_STRING( shipp->ship_name );
|
||||
ADD_USHORT( Objects[so->objnum].net_signature );
|
||||
ADD_INT( shipp->flags );
|
||||
ADD_INT( shipp->flags2 );
|
||||
ADD_INT( Objects[so->objnum].flags );
|
||||
ADD_ULONG( shipp->flags.to_long() );
|
||||
ADD_ULONG( Objects[so->objnum].flags.to_long() );
|
||||
ADD_INT( shipp->team );
|
||||
wing_data = (short)shipp->wingnum;
|
||||
ADD_SHORT(wing_data);
|
||||
@@ -1279,7 +1277,7 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo )
|
||||
|
||||
// Be sure to mark this ship as as a could_be_player
|
||||
obj_set_flags( objp, objp->flags | OF_COULD_BE_PLAYER );
|
||||
objp->flags &= ~OF_PLAYER_SHIP;
|
||||
objp->flags .remove(Object::Object_flags::Player_ship);
|
||||
}
|
||||
|
||||
// if this is a player ship, make sure we find out who's it is and set their objnum accordingly
|
||||
@@ -1288,7 +1286,7 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo )
|
||||
Assert( team != -1 ); // to help trap errors!!!
|
||||
nprintf(("Network", "Making %s ship for %s\n", Ships[shipnum].ship_name, Net_players[j].player->callsign));
|
||||
multi_assign_player_ship( j, objp, Ships[shipnum].ship_info_index );
|
||||
objp->flags |= OF_PLAYER_SHIP;
|
||||
objp->flags .set(Object::Object_Flags::Player_ship);
|
||||
objp->flags &= ~OF_COULD_BE_PLAYER;
|
||||
break;
|
||||
}
|
||||
@@ -1443,7 +1441,7 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl)
|
||||
|
||||
// add the ballistic primary flag - Goober5000
|
||||
val = 0;
|
||||
if(sip->flags & SIF_BALLISTIC_PRIMARIES){
|
||||
if(sip->flags[Ship::Info_Flags::Ballistic_primaries]){
|
||||
val |= (1<<0);
|
||||
}
|
||||
ADD_DATA(val);
|
||||
@@ -1476,10 +1474,10 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl)
|
||||
// add the link status of weapons
|
||||
// primary link status
|
||||
val = 0;
|
||||
if(shipp->flags & SF_PRIMARY_LINKED){
|
||||
if(shipp->flags[Ship::Ship_Flags::Primary_linked]){
|
||||
val |= (1<<0);
|
||||
}
|
||||
if(shipp->flags & SF_SECONDARY_DUAL_FIRE){
|
||||
if(shipp->flags[Ship::Ship_Flags::Secondary_dual_fire]){
|
||||
val |= (1<<1);
|
||||
}
|
||||
ADD_DATA(val);
|
||||
@@ -1591,7 +1589,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
|
||||
// try and find the object
|
||||
objp = NULL;
|
||||
objp = multi_get_network_object(sig_request);
|
||||
if(objp == NULL || !(objp->flags & OF_COULD_BE_PLAYER)){
|
||||
if(objp == NULL || !(objp->flags[Object::Object_Flags::Could_be_player])){
|
||||
send_ingame_ship_request_packet(INGAME_SR_DENY,0,&Net_players[player_num]);
|
||||
break;
|
||||
}
|
||||
@@ -1605,8 +1603,8 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
|
||||
// update his ets and link status stuff
|
||||
multi_server_update_player_weapons(&Net_players[player_num],&Ships[objp->instance]);
|
||||
|
||||
objp->flags &= ~(OF_COULD_BE_PLAYER);
|
||||
objp->flags |= OF_PLAYER_SHIP;
|
||||
objp->flags.remove(Object::Object_Flags::Could_be_player);
|
||||
objp->flags.set(Object::Object_Flags::Player_ship);
|
||||
|
||||
// send a player settings packet to update all other players of this guy's final choices
|
||||
send_player_settings_packet();
|
||||
@@ -1662,8 +1660,8 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
|
||||
// setup our object
|
||||
Net_player->m_player->objnum = OBJ_INDEX(objp);
|
||||
Player_obj = objp;
|
||||
Player_obj->flags &= ~(OF_COULD_BE_PLAYER);
|
||||
Player_obj->flags |= OF_PLAYER_SHIP;
|
||||
Player_obj->flags.remove(Object::Object_Flags::Could_be_player);
|
||||
Player_obj->flags.set(Object::Object_Flags::Player_ship);
|
||||
multi_assign_player_ship( MY_NET_PLAYER_NUM, objp, Ships[objp->instance].ship_info_index );
|
||||
|
||||
// must change the ship type and weapons. An ingame joiner know about the default class
|
||||
@@ -1690,7 +1688,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
|
||||
// handle the ballistic primary flag - Goober5000
|
||||
GET_DATA(val);
|
||||
if(val & (1<<0)){
|
||||
Player_ship->flags |= SIF_BALLISTIC_PRIMARIES;
|
||||
Ship_info[Player_ship->ship_info_index].flags.set(Ship::Info_Flags::Ballistic_primaries);
|
||||
}
|
||||
|
||||
// get current primary and secondary banks, and add link status
|
||||
@@ -1719,10 +1717,10 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
|
||||
// get the link status of weapons
|
||||
GET_DATA(val);
|
||||
if(val & (1<<0)){
|
||||
Player_ship->flags |= SF_PRIMARY_LINKED;
|
||||
Player_ship->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
}
|
||||
if(val & (1<<1)){
|
||||
Player_ship->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
Player_ship->flags.set(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
}
|
||||
PACKET_SET_SIZE();
|
||||
|
||||
@@ -1770,8 +1768,8 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
|
||||
nprintf(("Network", "Couldn't find ship for ingame joiner %s\n", Net_players[player_num].m_player->callsign));
|
||||
break;
|
||||
}
|
||||
objp->flags |= OF_PLAYER_SHIP;
|
||||
objp->flags &= ~OF_COULD_BE_PLAYER;
|
||||
objp->flags.set(Object::Object_Flags::Player_ship);
|
||||
objp->flags.remove(Object::Object_Flags::Could_be_player);
|
||||
|
||||
multi_assign_player_ship( player_num, objp, Ships[objp->instance].ship_info_index );
|
||||
|
||||
@@ -1795,7 +1793,7 @@ void multi_ingame_send_ship_update(net_player *p)
|
||||
// go through the list and send all ships which are mark as OF_COULD_BE_PLAYER
|
||||
while(moveup!=END_OF_LIST(&Ship_obj_list)){
|
||||
//Make sure the object can be a player and is on the same team as this guy
|
||||
if(Objects[moveup->objnum].flags & OF_COULD_BE_PLAYER && obj_team(&Objects[moveup->objnum]) == p->p_info.team){
|
||||
if(Objects[moveup->objnum].flags[Object::Object_Flags::Could_be_player] && obj_team(&Objects[moveup->objnum]) == p->p_info.team){
|
||||
// send the update
|
||||
send_ingame_ship_update_packet(p,&Ships[Objects[moveup->objnum].instance]);
|
||||
}
|
||||
@@ -1819,7 +1817,7 @@ void send_ingame_ship_update_packet(net_player *p,ship *sp)
|
||||
// just send net signature, shield and hull percentages
|
||||
objp = &Objects[sp->objnum];
|
||||
ADD_USHORT(objp->net_signature);
|
||||
ADD_UINT(objp->flags);
|
||||
ADD_ULONG(objp->flags.to_long());
|
||||
ADD_INT(objp->n_quadrants);
|
||||
ADD_FLOAT(objp->hull_strength);
|
||||
|
||||
@@ -1836,7 +1834,7 @@ void process_ingame_ship_update_packet(ubyte *data, header *hinfo)
|
||||
{
|
||||
int offset;
|
||||
float garbage;
|
||||
int flags;
|
||||
uint64_t flags;
|
||||
int idx;
|
||||
int n_quadrants;
|
||||
ushort net_sig;
|
||||
@@ -1846,7 +1844,7 @@ void process_ingame_ship_update_packet(ubyte *data, header *hinfo)
|
||||
offset = HEADER_LENGTH;
|
||||
// get the net sig for the ship and do a lookup
|
||||
GET_USHORT(net_sig);
|
||||
GET_INT(flags);
|
||||
GET_ULONG(flags);
|
||||
GET_INT(n_quadrants);
|
||||
|
||||
// get the object
|
||||
@@ -1863,7 +1861,7 @@ void process_ingame_ship_update_packet(ubyte *data, header *hinfo)
|
||||
return;
|
||||
}
|
||||
// otherwise read in the ship values
|
||||
lookup->flags = flags;
|
||||
lookup->flags.from_long(flags);
|
||||
lookup->n_quadrants = n_quadrants;
|
||||
GET_FLOAT(lookup->hull_strength);
|
||||
for(idx=0;idx<n_quadrants;idx++){
|
||||
|
||||
+20
-20
@@ -228,17 +228,17 @@ void multi_oo_build_ship_list(net_player *pl)
|
||||
}
|
||||
|
||||
// must be a ship, a weapon, and _not_ an observer
|
||||
if (Objects[moveup->objnum].flags & OF_SHOULD_BE_DEAD){
|
||||
if (Objects[moveup->objnum].flags[Object::Object_Flags::Should_be_dead]){
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't send info for dying ships
|
||||
if (Ships[Objects[moveup->objnum].instance].flags & SF_DYING){
|
||||
if (Ships[Objects[moveup->objnum].instance].flags[Ship::Ship_Flags::Dying]){
|
||||
continue;
|
||||
}
|
||||
|
||||
// never update the knossos device
|
||||
if ((Ships[Objects[moveup->objnum].instance].ship_info_index >= 0) && (Ships[Objects[moveup->objnum].instance].ship_info_index < static_cast<int>(Ship_info.size())) && (Ship_info[Ships[Objects[moveup->objnum].instance].ship_info_index].flags & SIF_KNOSSOS_DEVICE)){
|
||||
if ((Ships[Objects[moveup->objnum].instance].ship_info_index >= 0) && (Ships[Objects[moveup->objnum].instance].ship_info_index < static_cast<int>(Ship_info.size())) && (Ship_info[Ships[Objects[moveup->objnum].instance].ship_info_index].flags[Ship::Info_Flags::Knossos_device])){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ int multi_oo_pack_client_data(ubyte *data)
|
||||
if ( Player->locking_on_center ){
|
||||
out_flags |= OOC_LOCKING_ON_CENTER;
|
||||
}
|
||||
if ( (Player_ship != NULL) && (Player_ship->flags & SF_TRIGGER_DOWN) ){
|
||||
if ( (Player_ship != NULL) && (Player_ship->flags[Ship::Ship_Flags::Trigger_down]) ){
|
||||
out_flags |= OOC_TRIGGER_DOWN;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ int multi_oo_pack_client_data(ubyte *data)
|
||||
}
|
||||
|
||||
// linked or not
|
||||
if(Player_ship->flags & SF_PRIMARY_LINKED){
|
||||
if(Player_ship->flags[Ship::Ship_Flags::Primary_linked]){
|
||||
out_flags |= OOC_PRIMARY_LINKED;
|
||||
}
|
||||
}
|
||||
@@ -518,7 +518,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data
|
||||
|
||||
// if this ship is a support ship, send some extra info
|
||||
ubyte support_extra = 0;
|
||||
if(MULTIPLAYER_MASTER && (sip->flags & SIF_SUPPORT) && (shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)){
|
||||
if(MULTIPLAYER_MASTER && (sip->flags[Ship::Info_Flags::Support]) && (shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)){
|
||||
ushort dock_sig;
|
||||
|
||||
// flag
|
||||
@@ -617,9 +617,9 @@ int multi_oo_unpack_client_data(net_player *pl, ubyte *data)
|
||||
// trigger down, bank info
|
||||
if(shipp != NULL){
|
||||
if(in_flags & OOC_TRIGGER_DOWN){
|
||||
shipp->flags |= SF_TRIGGER_DOWN;
|
||||
shipp->flags.set(Ship::Ship_Flags::Trigger_down);
|
||||
} else {
|
||||
shipp->flags &= ~SF_TRIGGER_DOWN;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Trigger_down);
|
||||
}
|
||||
|
||||
if(in_flags & OOC_PRIMARY_BANK){
|
||||
@@ -629,9 +629,9 @@ int multi_oo_unpack_client_data(net_player *pl, ubyte *data)
|
||||
}
|
||||
|
||||
// linked or not
|
||||
shipp->flags &= ~SF_PRIMARY_LINKED;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Primary_linked);
|
||||
if(in_flags & OOC_PRIMARY_LINKED){
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
shipp->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -988,15 +988,15 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
|
||||
}
|
||||
|
||||
// linked or not
|
||||
shipp->flags &= ~SF_PRIMARY_LINKED;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Primary_linked);
|
||||
if(oo_flags & OO_PRIMARY_LINKED){
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
shipp->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
}
|
||||
|
||||
// trigger down or not - server doesn't care about this. he'll get it from clients anyway
|
||||
shipp->flags &= ~SF_TRIGGER_DOWN;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Trigger_down);
|
||||
if(oo_flags & OO_TRIGGER_DOWN){
|
||||
shipp->flags |= SF_TRIGGER_DOWN;
|
||||
shipp->flags.set(Ship::Ship_Flags::Trigger_down);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1149,19 +1149,19 @@ int multi_oo_maybe_update(net_player *pl, object *obj, ubyte *data)
|
||||
oo_flags = OO_POS_NEW | OO_ORIENT_NEW;
|
||||
|
||||
// if its a small ship, add weapon link info
|
||||
if((sip != NULL) && (sip->flags & (SIF_FIGHTER | SIF_BOMBER))){
|
||||
if((sip != NULL) && (sip->is_fighter_bomber())){
|
||||
// primary bank 0 or 1
|
||||
if(shipp->weapons.current_primary_bank > 0){
|
||||
oo_flags |= OO_PRIMARY_BANK;
|
||||
}
|
||||
|
||||
// linked or not
|
||||
if(shipp->flags & SF_PRIMARY_LINKED){
|
||||
if(shipp->flags[Ship::Ship_Flags::Primary_linked]){
|
||||
oo_flags |= OO_PRIMARY_LINKED;
|
||||
}
|
||||
|
||||
// trigger down or not
|
||||
if(shipp->flags & SF_TRIGGER_DOWN){
|
||||
if(shipp->flags[Ship::Ship_Flags::Trigger_down]){
|
||||
oo_flags |= OO_TRIGGER_DOWN;
|
||||
}
|
||||
}
|
||||
@@ -1345,7 +1345,7 @@ void multi_oo_process()
|
||||
|
||||
// do firing stuff for this player
|
||||
if((Net_players[idx].m_player != NULL) && (Net_players[idx].m_player->objnum >= 0) && !(Net_players[idx].flags & NETINFO_FLAG_LIMBO) && !(Net_players[idx].flags & NETINFO_FLAG_RESPAWNING)){
|
||||
if((Objects[Net_players[idx].m_player->objnum].flags & OF_PLAYER_SHIP) && !(Objects[Net_players[idx].m_player->objnum].flags & OF_SHOULD_BE_DEAD)){
|
||||
if((Objects[Net_players[idx].m_player->objnum].flags[Object::Object_Flags::Player_ship]) && !(Objects[Net_players[idx].m_player->objnum].flags[Object::Object_Flags::Should_be_dead])){
|
||||
obj_player_fire_stuff( &Objects[Net_players[idx].m_player->objnum], Net_players[idx].m_player->ci );
|
||||
}
|
||||
}
|
||||
@@ -1442,7 +1442,7 @@ void multi_oo_send_control_info()
|
||||
int packet_size = 0;
|
||||
|
||||
// if I'm dying or my object type is not a ship, bail here
|
||||
if((Player_obj != NULL) && (Player_ship->flags & SF_DYING)){
|
||||
if((Player_obj != NULL) && (Player_ship->flags[Ship::Ship_Flags::Dying])){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1849,7 +1849,7 @@ int multi_oo_is_interp_object(object *objp)
|
||||
}
|
||||
|
||||
// servers only interpolate other player ships
|
||||
if(!(objp->flags & OF_PLAYER_SHIP)){
|
||||
if(!(objp->flags[Object::Object_Flags::Player_ship])){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ void multi_obs_create_observer(net_player *pl)
|
||||
// create the basic observer object
|
||||
objnum = observer_create( &vmd_identity_matrix, &vmd_zero_vector);
|
||||
Assert(objnum != -1);
|
||||
Objects[objnum].flags |= OF_PLAYER_SHIP;
|
||||
Objects[objnum].flags.set(Object::Object_Flags::Player_ship);
|
||||
Objects[objnum].net_signature = 0;
|
||||
|
||||
// put it a 1,1,1
|
||||
@@ -135,12 +135,13 @@ void multi_obs_create_observer_client()
|
||||
// create the default player ship object and use that as my default virtual "ship", and make it "invisible"
|
||||
pobj_num = parse_create_object(Player_start_pobject);
|
||||
Assert(pobj_num != -1);
|
||||
obj_set_flags(&Objects[pobj_num],OF_PLAYER_SHIP);
|
||||
|
||||
obj_set_flags(&Objects[pobj_num], Objects[pobj_num].flags + Object::Object_Flags::Player_ship);
|
||||
Player_ship = &Ships[Objects[pobj_num].instance];
|
||||
|
||||
// make ship hidden from sensors so that this observer cannot target it. Observers really have two ships
|
||||
// one observer, and one "Player_ship". Observer needs to ignore the Player_ship.
|
||||
Player_ship->flags |= SF_HIDDEN_FROM_SENSORS;
|
||||
Player_ship->flags.set(Ship::Ship_Flags::Hidden_from_sensors);
|
||||
strcpy_s(Player_ship->ship_name, XSTR("Observer Ship",688));
|
||||
Player_ai = &Ai_info[Ships[Objects[pobj_num].instance].ai_index];
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ void multi_respawn_check(object *objp)
|
||||
}
|
||||
|
||||
// if we need to respawn this ai ship, add him to a list of ships to get respawned
|
||||
if ( (pobjp->flags & P_OF_PLAYER_START) && (pobjp->respawn_count < Netgame.respawn) && !(Netgame.type_flags & NG_TYPE_DOGFIGHT) ){
|
||||
if ( (pobjp->flags[Mission::Parse_Object_Flags::OF_Player_start]) && (pobjp->respawn_count < Netgame.respawn) && !(Netgame.type_flags & NG_TYPE_DOGFIGHT) ){
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_AI_RESPAWNS; i++ ) {
|
||||
@@ -201,7 +201,7 @@ void multi_respawn_player_leave(net_player *pl)
|
||||
|
||||
// if we need to respawn this ai ship, add him to a list of ships to get respawned
|
||||
p_object *pobjp = pl->p_info.p_objp;
|
||||
if ( (pobjp->flags & P_OF_PLAYER_START) && (pobjp->respawn_count < Netgame.respawn) ){
|
||||
if ( (pobjp->flags[Mission::Parse_Object_Flags::OF_Player_start]) && (pobjp->respawn_count < Netgame.respawn) ){
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_AI_RESPAWNS; i++ ) {
|
||||
@@ -254,14 +254,14 @@ void multi_respawn_handle_invul_players()
|
||||
int idx;
|
||||
object *objp;
|
||||
for(idx=0;idx<MAX_PLAYERS;idx++){
|
||||
if(MULTI_CONNECTED(Net_players[idx]) && (Objects[Net_players[idx].m_player->objnum].flags & OF_INVULNERABLE)){
|
||||
if(MULTI_CONNECTED(Net_players[idx]) && (Objects[Net_players[idx].m_player->objnum].flags[Object::Object_Flags::Invulnerable])){
|
||||
// make him normal (_non_ invulnerable) on either of 2 conditions :
|
||||
// 1.) More than 5 seconds have passed
|
||||
// 2.) He's fired either a primary or a secondary weapon
|
||||
if( ((Net_players[idx].s_info.invul_timestamp != -1) && (timestamp_elapsed(Net_players[idx].s_info.invul_timestamp))) ||
|
||||
((Net_players[idx].m_player->ci.fire_primary_count > 0) || (Net_players[idx].m_player->ci.fire_secondary_count > 0)) ) {
|
||||
objp = &Objects[Net_players[idx].m_player->objnum];
|
||||
obj_set_flags(objp,objp->flags & ~(OF_INVULNERABLE));
|
||||
obj_set_flags(objp, objp->flags - Object::Object_Flags::Invulnerable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void multi_respawn_build_points()
|
||||
moveup = GET_FIRST(&Ship_obj_list);
|
||||
while(moveup != END_OF_LIST(&Ship_obj_list)){
|
||||
// player ships
|
||||
if(Objects[moveup->objnum].flags & (OF_PLAYER_SHIP | OF_COULD_BE_PLAYER)){
|
||||
if(Objects[moveup->objnum].flags[Object::Object_Flags::Player_ship] || Objects[moveup->objnum].flags[Object::Object_Flags::Could_be_player]){
|
||||
r = &Multi_respawn_points[Multi_respawn_point_count++];
|
||||
|
||||
r->pos = Objects[moveup->objnum].pos;
|
||||
@@ -386,12 +386,12 @@ void multi_respawn_player(net_player *pl, char cur_primary_bank, char cur_second
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
// this is a player, so mark him as a player,
|
||||
objp->flags |= OF_PLAYER_SHIP;
|
||||
objp->flags &= ~OF_COULD_BE_PLAYER;
|
||||
objp->flags.set(Object::Object_Flags::Player_ship);
|
||||
objp->flags.remove(Object::Object_Flags::Could_be_player);
|
||||
|
||||
// server should mark this player as invulerable for a short time
|
||||
if ( MULTIPLAYER_MASTER ) {
|
||||
objp->flags |= OF_INVULNERABLE;
|
||||
objp->flags.set(Object::Object_Flags::Invulnerable);
|
||||
pl->s_info.invul_timestamp = timestamp(RESPAWN_INVUL_TIMESTAMP);
|
||||
multi_respawn_place( objp, shipp->team );
|
||||
}
|
||||
@@ -410,7 +410,7 @@ void multi_respawn_player(net_player *pl, char cur_primary_bank, char cur_second
|
||||
Player_ai = &Ai_info[Player_ship->ai_index];
|
||||
|
||||
// this is a hack to ensure that old (dead) player ships are destroyed, since at this point he's actually an OBJ_GHOST
|
||||
oldplr->flags |= OF_SHOULD_BE_DEAD;
|
||||
oldplr->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
obj_delete(OBJ_INDEX(oldplr));
|
||||
|
||||
// get rid of the annoying HUD dead message text.
|
||||
@@ -426,15 +426,16 @@ void multi_respawn_player(net_player *pl, char cur_primary_bank, char cur_second
|
||||
shipp->weapons.current_primary_bank = (int)cur_primary_bank;
|
||||
shipp->weapons.current_secondary_bank = (int)cur_secondary_bank;
|
||||
if(cur_link_status & (1<<0)){
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
shipp->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
} else {
|
||||
shipp->flags &= ~(SF_PRIMARY_LINKED);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Primary_linked);
|
||||
}
|
||||
if(cur_link_status & (1<<1)){
|
||||
shipp->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
} else {
|
||||
shipp->flags &= ~(SF_SECONDARY_DUAL_FIRE);
|
||||
}
|
||||
shipp->flags.set(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
}
|
||||
else {
|
||||
shipp->flags.remove(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
}
|
||||
|
||||
Assert( ship_ets != 0 ); // find dave or allender
|
||||
|
||||
@@ -494,8 +495,8 @@ void multi_respawn_ai( p_object *pobjp )
|
||||
objp = &Objects[objnum];
|
||||
|
||||
// be sure the the OF_PLAYER_SHIP flag is unset, and the could be player flag is set
|
||||
obj_set_flags( objp, objp->flags | OF_COULD_BE_PLAYER );
|
||||
objp->flags &= ~OF_PLAYER_SHIP;
|
||||
obj_set_flags(objp, objp->flags + Object::Object_Flags::Could_be_player);
|
||||
objp->flags.remove(Object::Object_Flags::Player_ship);
|
||||
}
|
||||
|
||||
// <server> make the given player an observer
|
||||
@@ -525,7 +526,7 @@ void multi_respawn_as_observer()
|
||||
hud_config_as_observer(Player_ship,Player_ai);
|
||||
|
||||
// blow away my old player object
|
||||
Player_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
Player_obj->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
obj_delete(OBJ_INDEX(Player_obj));
|
||||
|
||||
// create a new shiny observer object for me
|
||||
|
||||
@@ -270,6 +270,23 @@ void multi_send_int(int value)
|
||||
current_argument_count += sizeof(int);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void multi_send_flag(T value)
|
||||
{
|
||||
if (cannot_send_data()) {
|
||||
return;
|
||||
}
|
||||
|
||||
multi_sexp_ensure_space_remains(sizeof(int));
|
||||
|
||||
//Write INT into the Type buffer.
|
||||
type[packet_size] = TYPE_INT;
|
||||
//Write the int into the data buffer
|
||||
ADD_INT(static_cast<int>(value));
|
||||
//Increment the COUNT by 4 (i.e the size of an int).
|
||||
current_argument_count += sizeof(int);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a ship's net sig to the SEXP packet.
|
||||
*/
|
||||
@@ -625,6 +642,22 @@ bool multi_get_int(int &value)
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool multi_get_flag(T &value)
|
||||
{
|
||||
if (!Multi_sexp_bytes_left || !current_argument_count) {
|
||||
return false;
|
||||
}
|
||||
int tmp = 0;
|
||||
GET_INT(tmp);
|
||||
|
||||
value = static_cast<T>(tmp);
|
||||
|
||||
multi_reduce_counts(sizeof(int));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to get an index for the Ships array based on the net sig it removes from the SEXP packet. Returns it as the value
|
||||
* parameter. Returns false if unable to do so.
|
||||
|
||||
+36
-54
@@ -2476,7 +2476,7 @@ void send_ship_kill_packet( object *objp, object *other_objp, float percent_kill
|
||||
Assert ( Net_player->flags & NETINFO_FLAG_AM_MASTER );
|
||||
|
||||
// special deaths
|
||||
vaporized = ( (Ships[objp->instance].flags & SF_VAPORIZE) > 0 );
|
||||
vaporized = Ships[objp->instance].flags[Ship::Ship_Flags::Vaporize];
|
||||
|
||||
extra_death_info = 0;
|
||||
if ( vaporized ) {
|
||||
@@ -2519,7 +2519,7 @@ void send_ship_kill_packet( object *objp, object *other_objp, float percent_kill
|
||||
|
||||
// if the ship who died is a player, then send some extra info, like who killed him, etc.
|
||||
was_player = 0;
|
||||
if ( objp->flags & OF_PLAYER_SHIP ) {
|
||||
if ( objp->flags[Object::Object_Flags::Player_ship] ) {
|
||||
int pnum;
|
||||
char temp;
|
||||
short temp2;
|
||||
@@ -2599,7 +2599,7 @@ void process_ship_kill_packet( ubyte *data, header *hinfo )
|
||||
|
||||
// maybe set vaporized
|
||||
if (extra_death_info & EXTRA_DEATH_VAPORIZED) {
|
||||
Ships[sobjp->instance].flags |= SF_VAPORIZE;
|
||||
Ships[sobjp->instance].flags.set(Ship::Ship_Flags::Vaporize);
|
||||
}
|
||||
|
||||
// maybe set wash_killed
|
||||
@@ -2638,7 +2638,7 @@ void process_ship_kill_packet( ubyte *data, header *hinfo )
|
||||
if ( !(Net_player->flags & NETINFO_FLAG_INGAME_JOIN) ) {
|
||||
ship_hit_kill( sobjp, oobjp, percent_killed, sd );
|
||||
} else {
|
||||
sobjp->flags |= OF_SHOULD_BE_DEAD;
|
||||
sobjp->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
ship_cleanup(sobjp->instance, SHIP_DESTROYED);
|
||||
obj_delete( OBJ_INDEX(sobjp) );
|
||||
}
|
||||
@@ -2949,7 +2949,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting
|
||||
// get the object for this ship. If it is an AI object, send all the info to all player. Otherwise,
|
||||
// we might send the info to the other player different than the one who fired
|
||||
objp = &Objects[shipp->objnum];
|
||||
if ( !(objp->flags & OF_PLAYER_SHIP) ) {
|
||||
if ( !(objp->flags[Object::Object_Flags::Player_ship]) ) {
|
||||
if ( num_fired == 0 ) {
|
||||
return;
|
||||
}
|
||||
@@ -2973,7 +2973,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting
|
||||
sinfo |= SFPF_ALLOW_SWARM;
|
||||
}
|
||||
|
||||
if ( shipp->flags & SF_SECONDARY_DUAL_FIRE ){
|
||||
if ( shipp->flags[Ship::Ship_Flags::Secondary_dual_fire] ){
|
||||
sinfo |= SFPF_DUAL_FIRE;
|
||||
}
|
||||
|
||||
@@ -3006,7 +3006,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting
|
||||
ADD_DATA( t_subsys );
|
||||
|
||||
// just send this packet to everyone, then bail if an AI ship fired.
|
||||
if ( !(objp->flags & OF_PLAYER_SHIP) ) {
|
||||
if ( !(objp->flags[Object::Object_Flags::Player_ship]) ) {
|
||||
multi_io_send_to_all(data, packet_size);
|
||||
return;
|
||||
}
|
||||
@@ -3102,11 +3102,7 @@ void process_secondary_fired_packet(ubyte* data, header* hinfo, int from_player)
|
||||
}
|
||||
|
||||
// set the dual fire properties of the ship
|
||||
if ( sinfo & SFPF_DUAL_FIRE ){
|
||||
shipp->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
} else {
|
||||
shipp->flags &= ~SF_SECONDARY_DUAL_FIRE;
|
||||
}
|
||||
shipp->flags.set(Ship::Ship_Flags::Secondary_dual_fire, (sinfo & SFPF_DUAL_FIRE) != 0);
|
||||
|
||||
// determine whether current target is locked
|
||||
Assert( shipp->ai_index != -1 );
|
||||
@@ -4076,8 +4072,8 @@ void process_netplayer_slot_packet(ubyte *data, header *hinfo)
|
||||
}
|
||||
multi_assign_player_ship( player_num, objp, ship_class );
|
||||
Net_players[player_num].p_info.ship_index = ship_index;
|
||||
objp->flags &= ~(OF_COULD_BE_PLAYER);
|
||||
objp->flags |= OF_PLAYER_SHIP;
|
||||
objp->flags.remove(Object::Object_Flags::Could_be_player);
|
||||
objp->flags.set(Object::Object_Flags::Player_ship);
|
||||
}
|
||||
}
|
||||
GET_DATA(stop);
|
||||
@@ -4148,18 +4144,10 @@ void process_ship_weapon_change( ubyte *data, header *hinfo )
|
||||
shipp = &Ships[objp->instance];
|
||||
if ( what == MULTI_PRIMARY_CHANGED ) {
|
||||
shipp->weapons.current_primary_bank = new_bank;
|
||||
if ( link_status ){
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
} else {
|
||||
shipp->flags &= ~SF_PRIMARY_LINKED;
|
||||
}
|
||||
shipp->flags.set(Ship::Ship_Flags::Primary_linked, link_status != 0);
|
||||
} else {
|
||||
shipp->weapons.current_secondary_bank = new_bank;
|
||||
if ( link_status ){
|
||||
shipp->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
} else {
|
||||
shipp->flags &= ~SF_SECONDARY_DUAL_FIRE;
|
||||
}
|
||||
shipp->flags.set(Ship::Ship_Flags::Secondary_dual_fire, link_status != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4956,7 +4944,7 @@ void send_ai_info_update_packet( object *objp, char what, object * other_objp )
|
||||
aip = &Ai_info[Ships[objp->instance].ai_index];
|
||||
|
||||
// do an out here
|
||||
if ( Ships[objp->instance].flags & (SF_DEPARTING | SF_DYING) )
|
||||
if ( Ships[objp->instance].is_dying_or_departing())
|
||||
return;
|
||||
|
||||
switch( what ) {
|
||||
@@ -5526,8 +5514,8 @@ void send_firing_info_packet()
|
||||
Assert( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) );
|
||||
|
||||
BUILD_HEADER(FIRING_INFO);
|
||||
plinked = (ubyte)((Player_ship->flags & SF_PRIMARY_LINKED)?1:0);
|
||||
sdual = (ubyte)((Player_ship->flags & SF_SECONDARY_DUAL_FIRE)?1:0);
|
||||
plinked = (ubyte)((Player_ship->flags[Ship::Ship_Flags::Primary_linked])?1:0);
|
||||
sdual = (ubyte)((Player_ship->flags[Ship::Ship_Flags::Secondary_dual_fire])?1:0);
|
||||
ADD_DATA( plinked );
|
||||
ADD_DATA( sdual );
|
||||
|
||||
@@ -5556,15 +5544,9 @@ void process_firing_info_packet( ubyte *data, header *hinfo )
|
||||
|
||||
// get the ship pointer for this player and set the flags accordingly.
|
||||
shipp = &(Ships[Objects[Net_players[player_num].m_player->objnum].instance]);
|
||||
if ( plinked )
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
else
|
||||
shipp->flags &= ~SF_PRIMARY_LINKED;
|
||||
shipp->flags.set(Ship::Ship_Flags::Primary_linked, plinked != 0);
|
||||
shipp->flags.set(Ship::Ship_Flags::Secondary_dual_fire, sdual != 0);
|
||||
|
||||
if ( sdual )
|
||||
shipp->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
else
|
||||
shipp->flags &= ~SF_SECONDARY_DUAL_FIRE;
|
||||
}
|
||||
|
||||
// packet to deal with changing status of mission goals. used to be sent every so often from server
|
||||
@@ -5812,7 +5794,7 @@ void send_post_sync_data_packet(net_player *p, int std_request)
|
||||
shipp = &Ships[Objects[so->objnum].instance];
|
||||
|
||||
// don't process non player wing ships
|
||||
if ( !(shipp->flags & SF_FROM_PLAYER_WING ) )
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::From_player_wing] ) )
|
||||
continue;
|
||||
|
||||
ship_count++;
|
||||
@@ -5827,7 +5809,7 @@ void send_post_sync_data_packet(net_player *p, int std_request)
|
||||
shipp = &Ships[Objects[so->objnum].instance];
|
||||
|
||||
// don't process non player wing ships
|
||||
if ( !(shipp->flags & SF_FROM_PLAYER_WING ) )
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::From_player_wing] ) )
|
||||
continue;
|
||||
|
||||
// add the net signature of the object for look up
|
||||
@@ -5847,7 +5829,7 @@ void send_post_sync_data_packet(net_player *p, int std_request)
|
||||
shipp = &Ships[Objects[so->objnum].instance];
|
||||
|
||||
// don't process non player wing ships
|
||||
if ( !(shipp->flags & SF_FROM_PLAYER_WING ) )
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::From_player_wing] ) )
|
||||
continue;
|
||||
|
||||
// if this is a ship owned by a player, we should mark down his weapons bank/link settings now if we're the server
|
||||
@@ -5907,20 +5889,20 @@ void send_post_sync_data_packet(net_player *p, int std_request)
|
||||
|
||||
// send primary and secondary weapon link status
|
||||
val = 0x0;
|
||||
if(shipp->flags & SF_PRIMARY_LINKED){
|
||||
if(shipp->flags[Ship::Ship_Flags::Primary_linked]){
|
||||
if(pl != NULL){
|
||||
pl->s_info.cur_link_status |= (1<<0);
|
||||
}
|
||||
val |= (1<<0);
|
||||
}
|
||||
if(shipp->flags & SF_SECONDARY_DUAL_FIRE){
|
||||
if(shipp->flags[Ship::Ship_Flags::Secondary_dual_fire]){
|
||||
if(pl != NULL){
|
||||
pl->s_info.cur_link_status |= (1<<1);
|
||||
}
|
||||
val |= (1<<1);
|
||||
}
|
||||
// if this is a player ship add (1<<2)
|
||||
if(Objects[shipp->objnum].flags & OF_PLAYER_SHIP){
|
||||
if(Objects[shipp->objnum].flags[Object::Object_Flags::Player_ship]){
|
||||
val |= (1<<2);
|
||||
}
|
||||
ADD_DATA(val);
|
||||
@@ -6109,17 +6091,17 @@ void process_post_sync_data_packet(ubyte *data, header *hinfo)
|
||||
GET_DATA(val);
|
||||
|
||||
if(val & (1<<0)){
|
||||
shipp->flags |= SF_PRIMARY_LINKED;
|
||||
shipp->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
}
|
||||
if(val & (1<<1)){
|
||||
shipp->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
shipp->flags.set(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
}
|
||||
Objects[shipp->objnum].flags &= ~(OF_PLAYER_SHIP);
|
||||
Objects[shipp->objnum].flags &= ~(OF_COULD_BE_PLAYER);
|
||||
Objects[shipp->objnum].flags.remove(Object::Object_Flags::Player_ship);
|
||||
Objects[shipp->objnum].flags.remove(Object::Object_Flags::Could_be_player);
|
||||
if(val & (1<<2)){
|
||||
Objects[shipp->objnum].flags |= OF_PLAYER_SHIP;
|
||||
Objects[shipp->objnum].flags.set(Object::Object_Flags::Player_ship);
|
||||
} else {
|
||||
obj_set_flags( &Objects[shipp->objnum], Objects[shipp->objnum].flags | OF_COULD_BE_PLAYER );
|
||||
obj_set_flags( &Objects[shipp->objnum], Objects[shipp->objnum].flags + Object::Object_Flags::Could_be_player);
|
||||
}
|
||||
|
||||
// get ship ets
|
||||
@@ -7651,7 +7633,7 @@ void send_NEW_primary_fired_packet(ship *shipp, int banks_fired)
|
||||
// ubanks_fired |= (current_bank << CURRENT_BANK_BIT);
|
||||
|
||||
// append the SF_PRIMARY_LINKED flag on the top nibble of the banks_fired
|
||||
// if ( shipp->flags & SF_PRIMARY_LINKED ){
|
||||
// if ( shipp->flags[Ship::Ship_Flags::Primary_linked] ){
|
||||
// ubanks_fired |= (1<<7);
|
||||
// }
|
||||
|
||||
@@ -7734,7 +7716,7 @@ void process_NEW_primary_fired_packet(ubyte *data, header *hinfo)
|
||||
// if ( !linked ){
|
||||
// shipp->flags &= ~SF_PRIMARY_LINKED;
|
||||
// } else {
|
||||
// shipp->flags |= SF_PRIMARY_LINKED;
|
||||
// shipp->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
// }
|
||||
|
||||
// if we're in client firing mode, ignore ones for myself
|
||||
@@ -7745,15 +7727,15 @@ void process_NEW_primary_fired_packet(ubyte *data, header *hinfo)
|
||||
ship_fire_primary( objp, 0, 1 );
|
||||
|
||||
// Karajorma - It's still a hack but at least this way it only affects AI ships
|
||||
if (!(objp->flags & OF_PLAYER_SHIP))
|
||||
if (!(objp->flags[Object::Object_Flags::Player_ship]))
|
||||
{
|
||||
// Juke - this is the hackiest hack, but hopefully it will fix stream weapon
|
||||
// notifications generated by AI ships.
|
||||
uint flags = shipp->flags & SF_TRIGGER_DOWN;
|
||||
bool flags = shipp->flags[Ship::Ship_Flags::Trigger_down];
|
||||
|
||||
shipp->flags |= SF_TRIGGER_DOWN;
|
||||
shipp->flags.set(Ship::Ship_Flags::Trigger_down);
|
||||
ship_fire_primary( objp, 1, 1 );
|
||||
shipp->flags &= flags | ~SF_TRIGGER_DOWN;
|
||||
shipp->flags.set(Ship::Ship_Flags::Trigger_down, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7965,7 +7947,7 @@ void process_beam_fired_packet(ubyte *data, header *hinfo)
|
||||
ship *shipp = &Ships[fire_info.shooter->instance];
|
||||
|
||||
// this check is a little convoluted but should cover all bases until we decide to just break the protocol
|
||||
if ( Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER) ) {
|
||||
if ( Ship_info[shipp->ship_info_index].is_fighter_bomber() ) {
|
||||
// make sure the beam is a primary weapon and not attached to a turret or something
|
||||
for (i = 0; i < shipp->weapons.num_primary_banks; i++) {
|
||||
if ( shipp->weapons.primary_bank_weapons[i] == fire_info.beam_info_index ) {
|
||||
|
||||
@@ -39,6 +39,7 @@ class ship_subsys;
|
||||
#define ADD_USHORT(d) do { static_assert(sizeof(d) == sizeof(std::uint16_t), "Size of unsigned short is not right!"); Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); ushort swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
|
||||
#define ADD_INT(d) do { static_assert(sizeof(d) == sizeof(std::int32_t), "Size of int is not right!"); Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); int swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
|
||||
#define ADD_UINT(d) do { static_assert(sizeof(d) == sizeof(std::uint32_t), "Size of unsigned int is not right!"); Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); uint swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
|
||||
#define ADD_ULONG(d) do { static_assert(sizeof(d) == sizeof(std::uint64_t), "Size of unsigned long is not right!"); Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); std::uint64_t swap = INTEL_LONG(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
|
||||
#define ADD_FLOAT(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); float swap = INTEL_FLOAT(&d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0)
|
||||
#define ADD_STRING(s) do { Assert((packet_size + strlen(s) + 4) < MAX_PACKET_SIZE);int len = (int)strlen(s); int len_tmp = INTEL_INT(len); ADD_DATA(len_tmp); memcpy(data+packet_size, s, len ); packet_size += len; } while(0)
|
||||
#define ADD_ORIENT(d) { Assert((packet_size + 17) < MAX_PACKET_SIZE); ubyte dt[17]; multi_pack_orient_matrix(dt,&d); memcpy(data+packet_size,dt,17); packet_size += 17; }
|
||||
@@ -49,6 +50,7 @@ class ship_subsys;
|
||||
#define GET_USHORT(d) do { ushort swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_SHORT(swap); offset += sizeof(d); } while(0)
|
||||
#define GET_INT(d) do { int swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_INT(swap); offset += sizeof(d); } while(0)
|
||||
#define GET_UINT(d) do { uint swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_INT(swap); offset += sizeof(d); } while(0)
|
||||
#define GET_ULONG(d) do { ulong swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_LONG(swap); offset += sizeof(d); } while(0)
|
||||
#define GET_FLOAT(d) do { float swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_FLOAT(&swap); offset += sizeof(d); } while(0)
|
||||
#define GET_STRING(s) do { int len; memcpy(&len, data+offset, sizeof(len)); len = INTEL_INT(len); offset += sizeof(len); memcpy(s, data+offset, len); offset += len; s[len] = '\0'; } while(0)
|
||||
#define GET_ORIENT(d) { ubyte dt[17]; memcpy(dt,data+offset,17); offset+=17; multi_unpack_orient_matrix(dt,&d); }
|
||||
|
||||
@@ -731,7 +731,7 @@ int multi_ts_disabled_slot(int slot_num, int player_index)
|
||||
if(Netgame.type_flags & NG_TYPE_TEAM){
|
||||
// if i'm the team captain I can mess with my own ships as well as those of the ai ships on my team
|
||||
if(pl->flags & NETINFO_FLAG_TEAM_CAPTAIN){
|
||||
if((Multi_ts_team[pl->p_info.team].multi_ts_player[slot_num] != NULL) && (Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[slot_num]].flags & OF_PLAYER_SHIP) && (slot_num != pl->p_info.ship_index)){
|
||||
if((Multi_ts_team[pl->p_info.team].multi_ts_player[slot_num] != NULL) && (Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[slot_num]].flags[Object::Object_Flags::Player_ship]) && (slot_num != pl->p_info.ship_index)){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -743,7 +743,7 @@ int multi_ts_disabled_slot(int slot_num, int player_index)
|
||||
// if we're the host, we can our own ship and ai ships
|
||||
if(pl->flags & NETINFO_FLAG_GAME_HOST){
|
||||
// can't grab player ships
|
||||
if((Multi_ts_team[pl->p_info.team].multi_ts_player[slot_num] != NULL) && (Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[slot_num]].flags & OF_PLAYER_SHIP) && (slot_num != pl->p_info.ship_index)){
|
||||
if((Multi_ts_team[pl->p_info.team].multi_ts_player[slot_num] != NULL) && (Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[slot_num]].flags[Object::Object_Flags::Player_ship]) && (slot_num != pl->p_info.ship_index)){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ void multi_ts_assign_players_all()
|
||||
objp = GET_FIRST(&obj_used_list);
|
||||
while(objp != END_OF_LIST(&obj_used_list)){
|
||||
// find a valid player ship - ignoring the ship which was assigned to the host
|
||||
if((objp->flags & OF_PLAYER_SHIP) && stricmp(Ships[objp->instance].ship_name,name_lookup)){
|
||||
if((objp->flags[Object::Object_Flags::Player_ship]) && stricmp(Ships[objp->instance].ship_name,name_lookup)){
|
||||
// determine what team and slot this ship is
|
||||
multi_ts_get_team_and_slot(Ships[objp->instance].ship_name,&team_index,&slot_index, true);
|
||||
Assert((team_index != -1) && (slot_index != -1));
|
||||
@@ -909,8 +909,8 @@ void multi_ts_assign_players_all()
|
||||
// decrement the player count
|
||||
player_count--;
|
||||
} else {
|
||||
objp->flags &= ~OF_PLAYER_SHIP;
|
||||
obj_set_flags( objp, objp->flags | OF_COULD_BE_PLAYER );
|
||||
objp->flags.remove(Object::Object_Flags::Player_ship);
|
||||
obj_set_flags( objp, objp->flags + Object::Object_Flags::Could_be_player);
|
||||
}
|
||||
|
||||
// if we've assigned all players, we're done
|
||||
@@ -926,9 +926,9 @@ void multi_ts_assign_players_all()
|
||||
// go through and change any ships marked as player ships to be COULD_BE_PLAYER
|
||||
if ( objp != END_OF_LIST(&obj_used_list) ) {
|
||||
for ( objp = GET_NEXT(objp); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if ( objp->flags & OF_PLAYER_SHIP ){
|
||||
objp->flags &= ~OF_PLAYER_SHIP;
|
||||
obj_set_flags( objp, objp->flags | OF_COULD_BE_PLAYER );
|
||||
if ( objp->flags[Object::Object_Flags::Player_ship] ){
|
||||
objp->flags.remove(Object::Object_Flags::Player_ship);
|
||||
obj_set_flags( objp, objp->flags + Object::Object_Flags::Could_be_player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1010,8 +1010,8 @@ void multi_ts_handle_player_drop()
|
||||
if((Multi_ts_team[idx].multi_ts_player[s_idx] != NULL) && !MULTI_CONNECTED((*Multi_ts_team[idx].multi_ts_player[s_idx]))){
|
||||
Assert(Multi_ts_team[idx].multi_ts_objnum[s_idx] != -1);
|
||||
Multi_ts_team[idx].multi_ts_player[s_idx] = NULL;
|
||||
Objects[Multi_ts_team[idx].multi_ts_objnum[s_idx]].flags &= ~(OF_PLAYER_SHIP);
|
||||
obj_set_flags( &Objects[Multi_ts_team[idx].multi_ts_objnum[s_idx]], Objects[Multi_ts_team[idx].multi_ts_objnum[s_idx]].flags | OF_COULD_BE_PLAYER);
|
||||
Objects[Multi_ts_team[idx].multi_ts_objnum[s_idx]].flags.remove(Object::Object_Flags::Player_ship);
|
||||
obj_set_flags( &Objects[Multi_ts_team[idx].multi_ts_objnum[s_idx]], Objects[Multi_ts_team[idx].multi_ts_objnum[s_idx]].flags + Object::Object_Flags::Could_be_player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1263,7 +1263,7 @@ void multi_ts_blit_wing_callsigns()
|
||||
} else {
|
||||
// determine if this is a locked AI ship
|
||||
pobj = mission_parse_get_arrival_ship(Ships[Objects[Multi_ts_team[Net_player->p_info.team].multi_ts_objnum[idx]].instance].ship_name);
|
||||
if((pobj == NULL) || !(pobj->flags & P_OF_PLAYER_START)){
|
||||
if ((pobj == NULL) || !(pobj->flags[Mission::Parse_Object_Flags::OF_Player_start])) {
|
||||
strcpy_s(callsign, NOX("<"));
|
||||
strcat_s(callsign, XSTR("AI",738)); // [[ Artificial Intellegence ]]
|
||||
strcat_s(callsign, NOX(">"));
|
||||
@@ -2075,7 +2075,7 @@ int multi_ts_can_perform(int from_type,int from_index,int to_type,int to_index,i
|
||||
// if this is not a player ship type object
|
||||
if(Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index] != -1){
|
||||
pobj = mission_parse_get_arrival_ship(Ships[Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].instance].ship_name);
|
||||
if((pobj == NULL) || !(pobj->flags & P_OF_PLAYER_START)){
|
||||
if((pobj == NULL) || !(pobj->flags[Mission::Parse_Object_Flags::OF_Player_start])){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2112,7 +2112,7 @@ int multi_ts_can_perform(int from_type,int from_index,int to_type,int to_index,i
|
||||
// if this is not a player ship type object
|
||||
if(Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index] != -1){
|
||||
pobj = mission_parse_get_arrival_ship(Ships[Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].instance].ship_name);
|
||||
if((pobj == NULL) || !(pobj->flags & P_OF_PLAYER_START)){
|
||||
if((pobj == NULL) || !(pobj->flags[Mission::Parse_Object_Flags::OF_Player_start])){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2325,15 +2325,15 @@ int multi_ts_swap_player_player(int from_index,int to_index,int *sound,int playe
|
||||
}
|
||||
|
||||
// update ship flags
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags &= ~(OF_COULD_BE_PLAYER);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags &= ~(OF_PLAYER_SHIP);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags.remove(Object::Object_Flags::Could_be_player);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags.remove(Object::Object_Flags::Player_ship);
|
||||
if(Multi_ts_team[pl->p_info.team].multi_ts_player[to_index] != NULL){
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags |= OF_PLAYER_SHIP;
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags.set(Object::Object_Flags::Player_ship);
|
||||
}
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags &= ~(OF_COULD_BE_PLAYER);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags &= ~(OF_PLAYER_SHIP);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags.remove(Object::Object_Flags::Could_be_player);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags.remove(Object::Object_Flags::Player_ship);
|
||||
if(Multi_ts_team[pl->p_info.team].multi_ts_player[from_index] != NULL){
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags |= OF_PLAYER_SHIP;
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags.set(Object::Object_Flags::Player_ship);
|
||||
}
|
||||
|
||||
// recalcalate which slots are locked/unlocked, etc
|
||||
@@ -2381,15 +2381,15 @@ int multi_ts_move_player(int from_index,int to_index,int *sound,int player_index
|
||||
}
|
||||
|
||||
// update ship flags
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags &= ~(OF_COULD_BE_PLAYER);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags &= ~(OF_PLAYER_SHIP);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags.remove(Object::Object_Flags::Could_be_player);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags.remove(Object::Object_Flags::Player_ship);
|
||||
if(Multi_ts_team[pl->p_info.team].multi_ts_player[to_index] != NULL){
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags |= OF_PLAYER_SHIP;
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[to_index]].flags.set(Object::Object_Flags::Player_ship);
|
||||
}
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags &= ~(OF_COULD_BE_PLAYER);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags &= ~(OF_PLAYER_SHIP);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags.remove(Object::Object_Flags::Could_be_player);
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags.remove(Object::Object_Flags::Player_ship);
|
||||
if(Multi_ts_team[pl->p_info.team].multi_ts_player[from_index] != NULL){
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags |= OF_PLAYER_SHIP;
|
||||
Objects[Multi_ts_team[pl->p_info.team].multi_ts_objnum[from_index]].flags.set(Object::Object_Flags::Player_ship);
|
||||
}
|
||||
|
||||
// recalcalate which slots are locked/unlocked, etc
|
||||
@@ -2723,8 +2723,8 @@ int multi_ts_ok_to_commit()
|
||||
|
||||
// if the ship in this slot has a ship which can be a player but has 0 primary or secondary weapons, then he cannot continue
|
||||
if( (Multi_ts_team[Net_player->p_info.team].multi_ts_objnum[idx] != -1) &&
|
||||
((Objects[Multi_ts_team[Net_player->p_info.team].multi_ts_objnum[idx]].flags & OF_COULD_BE_PLAYER) ||
|
||||
(Objects[Multi_ts_team[Net_player->p_info.team].multi_ts_objnum[idx]].flags & OF_PLAYER_SHIP)) &&
|
||||
((Objects[Multi_ts_team[Net_player->p_info.team].multi_ts_objnum[idx]].flags[Object::Object_Flags::Could_be_player]) ||
|
||||
(Objects[Multi_ts_team[Net_player->p_info.team].multi_ts_objnum[idx]].flags[Object::Object_Flags::Player_ship])) &&
|
||||
!multi_ts_disabled_slot(idx)){
|
||||
|
||||
primary_ok = 0;
|
||||
@@ -2861,9 +2861,9 @@ void send_pslot_update_packet(int team,int code,int sound)
|
||||
}
|
||||
|
||||
// add a byte indicating what object flag should be set (0 == ~(OF_COULD_BE_PLAYER | OF_PLAYER_SHIP), 1 == player ship, 2 == could be player ship)
|
||||
if(Objects[Multi_ts_team[team].multi_ts_objnum[idx]].flags & OF_COULD_BE_PLAYER){
|
||||
if(Objects[Multi_ts_team[team].multi_ts_objnum[idx]].flags[Object::Object_Flags::Could_be_player]){
|
||||
val = 2;
|
||||
} else if(Objects[Multi_ts_team[team].multi_ts_objnum[idx]].flags & OF_PLAYER_SHIP){
|
||||
} else if(Objects[Multi_ts_team[team].multi_ts_objnum[idx]].flags[Object::Object_Flags::Player_ship]){
|
||||
val = 1;
|
||||
} else {
|
||||
val = 0;
|
||||
@@ -2998,13 +2998,14 @@ void process_pslot_update_packet(ubyte *data, header *hinfo)
|
||||
|
||||
// get the ship flag byte
|
||||
GET_DATA(val);
|
||||
Objects[objnum].flags &= ~(OF_PLAYER_SHIP | OF_COULD_BE_PLAYER);
|
||||
Objects[objnum].flags.remove(Object::Object_Flags::Player_ship);
|
||||
Objects[objnum].flags.remove(Object::Object_Flags::Could_be_player);
|
||||
switch(val){
|
||||
case 1 :
|
||||
Objects[objnum].flags |= OF_PLAYER_SHIP;
|
||||
Objects[objnum].flags.set(Object::Object_Flags::Player_ship);
|
||||
break;
|
||||
case 2 :
|
||||
obj_set_flags( &Objects[objnum], Objects[objnum].flags | OF_COULD_BE_PLAYER );
|
||||
obj_set_flags( &Objects[objnum], Objects[objnum].flags + Object::Object_Flags::Could_be_player);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+19
-21
@@ -847,9 +847,8 @@ void multi_make_player_ai( object *pobj )
|
||||
if ( pobj->type != OBJ_SHIP )
|
||||
return;
|
||||
|
||||
pobj->flags &= ~(OF_PLAYER_SHIP);
|
||||
obj_set_flags( pobj, pobj->flags | OF_COULD_BE_PLAYER );
|
||||
obj_set_flags( pobj, pobj->flags & ~(OF_INVULNERABLE)); // Newly respawned players will still be invulnerable
|
||||
pobj->flags.remove(Object::Object_Flags::Player_ship);
|
||||
obj_set_flags(pobj, pobj->flags + Object::Object_Flags::Could_be_player - Object::Object_Flags::Invulnerable);
|
||||
|
||||
// target_objnum must be -1 or else new AI ship will fire on whatever this player
|
||||
// had targeted.
|
||||
@@ -1144,7 +1143,7 @@ void multi_do_client_warp(float frame_time)
|
||||
moveup = GET_FIRST(&Ship_obj_list);
|
||||
while(moveup!=END_OF_LIST(&Ship_obj_list)){
|
||||
// do all _necessary_ ship warp in (arrival) processing
|
||||
if ( Ships[Objects[moveup->objnum].instance].flags & SF_ARRIVING )
|
||||
if ( Ships[Objects[moveup->objnum].instance].is_arriving() )
|
||||
shipfx_warpin_frame( &Objects[moveup->objnum], frame_time );
|
||||
moveup = GET_NEXT(moveup);
|
||||
}
|
||||
@@ -1407,9 +1406,9 @@ void multi_untag_player_ships()
|
||||
|
||||
moveup = GET_FIRST(&Ship_obj_list);
|
||||
while(moveup != END_OF_LIST(&Ship_obj_list)){
|
||||
if(Objects[moveup->objnum].flags & OF_PLAYER_SHIP){
|
||||
Objects[moveup->objnum].flags &= ~(OF_PLAYER_SHIP);
|
||||
obj_set_flags( &Objects[moveup->objnum], Objects[moveup->objnum].flags | OF_COULD_BE_PLAYER );
|
||||
if(Objects[moveup->objnum].flags[Object::Object_Flags::Player_ship]){
|
||||
Objects[moveup->objnum].flags.remove(Object::Object_Flags::Player_ship);
|
||||
obj_set_flags( &Objects[moveup->objnum], Objects[moveup->objnum].flags + Object::Object_Flags::Could_be_player);
|
||||
}
|
||||
moveup = GET_NEXT(moveup);
|
||||
}
|
||||
@@ -1582,21 +1581,21 @@ void multi_create_standalone_object()
|
||||
}
|
||||
|
||||
Player_obj = &Objects[objnum];
|
||||
obj_set_flags(Player_obj, Player_obj->flags & (~OF_COLLIDES) );
|
||||
//obj_set_flags(Player_obj, Player_obj->flags | OF_SHOULD_BE_DEAD);
|
||||
obj_set_flags(Player_obj, Player_obj->flags & (~OF_PLAYER_SHIP));
|
||||
Player_obj->flags.remove(Object::Object_Flags::Player_ship);
|
||||
obj_set_flags(Player_obj, Player_obj->flags - Object::Object_Flags::Collides);
|
||||
Net_player->m_player->objnum = objnum;
|
||||
|
||||
// create the default player ship object and use that as my default virtual "ship", and make it "invisible"
|
||||
pobj_num = parse_create_object(Player_start_pobject);
|
||||
Assert(pobj_num != -1);
|
||||
obj_set_flags(&Objects[pobj_num],OF_PLAYER_SHIP);
|
||||
flagset<Object::Object_Flags> tmp_flags;
|
||||
obj_set_flags(&Objects[pobj_num], tmp_flags + Object::Object_Flags::Player_ship);
|
||||
Objects[pobj_num].net_signature = STANDALONE_SHIP_SIG;
|
||||
Player_ship = &Ships[Objects[pobj_num].instance];
|
||||
|
||||
// make ship hidden from sensors so that this observer cannot target it. Observers really have two ships
|
||||
// one observer, and one "Player_ship". Observer needs to ignore the Player_ship.
|
||||
Player_ship->flags |= SF_HIDDEN_FROM_SENSORS;
|
||||
Player_ship->flags.set(Ship::Ship_Flags::Hidden_from_sensors);
|
||||
strcpy_s(Player_ship->ship_name, XSTR("Standalone Ship",904));
|
||||
Player_ai = &Ai_info[Ships[Objects[pobj_num].instance].ai_index];
|
||||
|
||||
@@ -2162,8 +2161,7 @@ void multi_warpout_all_players()
|
||||
if(MULTI_CONNECTED(Net_players[idx]) && (Net_player != &Net_players[idx]) && (Objects[Net_players[idx].m_player->objnum].type == OBJ_SHIP)){
|
||||
|
||||
objp = &Objects[Net_players[idx].m_player->objnum];
|
||||
|
||||
obj_set_flags( objp, objp->flags & (~OF_COLLIDES) );
|
||||
obj_set_flags( objp, objp->flags - Object::Object_Flags::Collides);
|
||||
shipfx_warpout_start( objp );
|
||||
}
|
||||
}
|
||||
@@ -2173,7 +2171,7 @@ void multi_warpout_all_players()
|
||||
|
||||
// if we're an observer, or we're respawning, or we can't warp out. so just jump into the debrief state
|
||||
if((Net_player->flags & NETINFO_FLAG_OBSERVER) || (Net_player->flags & NETINFO_FLAG_RESPAWNING) ||
|
||||
((Player_obj->type == OBJ_SHIP) && (Player_ship->flags & SF_CANNOT_WARP)) ){
|
||||
((Player_obj->type == OBJ_SHIP) && ( Player_ship->cannot_warp())) ){
|
||||
|
||||
multi_handle_sudden_mission_end();
|
||||
|
||||
@@ -2186,7 +2184,7 @@ void multi_warpout_all_players()
|
||||
// if we're a ship, then begin the warpout process
|
||||
else {
|
||||
// turn off collision detection for my ship
|
||||
obj_set_flags(Player_obj, Player_obj->flags & (~OF_COLLIDES) );
|
||||
obj_set_flags(Player_obj, Player_obj->flags - Object::Object_Flags::Collides);
|
||||
|
||||
// turn off gliding too or ships can't get upt to speed
|
||||
if(object_get_gliding(Player_obj)) {
|
||||
@@ -2719,7 +2717,7 @@ void multi_player_ships_available(int *team_0,int *team_1)
|
||||
moveup = GET_FIRST(&Ship_obj_list);
|
||||
while(moveup!=END_OF_LIST(&Ship_obj_list)){
|
||||
// if this ship is flagged as OF_COULD_BE_PLAYER
|
||||
if(Objects[moveup->objnum].flags & OF_COULD_BE_PLAYER){
|
||||
if(Objects[moveup->objnum].flags[Object::Object_Flags::Could_be_player]){
|
||||
// get the team # for this ship
|
||||
mp_team_num = multi_ts_get_team(Ships[Objects[moveup->objnum].instance].ship_name);
|
||||
if(mp_team_num == 0){
|
||||
@@ -2737,7 +2735,7 @@ void multi_player_ships_available(int *team_0,int *team_1)
|
||||
void multi_server_update_player_weapons(net_player *pl,ship *shipp)
|
||||
{
|
||||
// don't process when the ship is dying.
|
||||
if ( (shipp->flags & SF_DYING) || NETPLAYER_IS_DEAD(pl) )
|
||||
if ( (shipp->flags[Ship::Ship_Flags::Dying]) || NETPLAYER_IS_DEAD(pl) )
|
||||
return;
|
||||
|
||||
// primary bank status
|
||||
@@ -2745,7 +2743,7 @@ void multi_server_update_player_weapons(net_player *pl,ship *shipp)
|
||||
|
||||
// primary link status
|
||||
pl->s_info.cur_link_status &= ~(1<<0);
|
||||
if(shipp->flags & SF_PRIMARY_LINKED){
|
||||
if(shipp->flags[Ship::Ship_Flags::Primary_linked]){
|
||||
pl->s_info.cur_link_status |= (1<<0);
|
||||
}
|
||||
|
||||
@@ -2758,7 +2756,7 @@ void multi_server_update_player_weapons(net_player *pl,ship *shipp)
|
||||
|
||||
// secondary link status
|
||||
pl->s_info.cur_link_status &= ~(1<<1);
|
||||
if(shipp->flags & SF_SECONDARY_DUAL_FIRE){
|
||||
if(shipp->flags[Ship::Ship_Flags::Secondary_dual_fire]){
|
||||
pl->s_info.cur_link_status |= (1<<1);
|
||||
}
|
||||
|
||||
@@ -4158,7 +4156,7 @@ int multi_pack_unpack_desired_rotvel( int write, ubyte *data, matrix *orient, ve
|
||||
// Currently supports the dogfight kill matrix and normal debriefing stages but if new types are created they should be added here
|
||||
void send_debrief_event() {
|
||||
// we have a special debriefing screen multiplayer furballs use by default
|
||||
if((Game_mode & GM_MULTIPLAYER) && IS_MISSION_MULTI_DOGFIGHT && !(The_mission.flags & MISSION_FLAG_TOGGLE_DEBRIEFING)) {
|
||||
if((Game_mode & GM_MULTIPLAYER) && IS_MISSION_MULTI_DOGFIGHT && !(The_mission.flags[Mission::Mission_Flags::Toggle_debriefing])) {
|
||||
gameseq_post_event( GS_EVENT_MULTI_DOGFIGHT_DEBRIEF);
|
||||
}
|
||||
// do the normal debriefing for all other situations
|
||||
|
||||
@@ -44,7 +44,7 @@ int collide_debris_ship( obj_pair * pair )
|
||||
Assert( pship->type == OBJ_SHIP );
|
||||
|
||||
// don't check collision if it's our own debris and we are dying
|
||||
if ( (pdebris->parent == OBJ_INDEX(pship)) && (Ships[pship->instance].flags & SF_DYING) )
|
||||
if ( (pdebris->parent == OBJ_INDEX(pship)) && (Ships[pship->instance].flags[Ship::Ship_Flags::Dying]) )
|
||||
return 0;
|
||||
|
||||
dist = vm_vec_dist( &pdebris->pos, &pship->pos );
|
||||
@@ -98,7 +98,7 @@ int collide_debris_ship( obj_pair * pair )
|
||||
ship_damage *= Debris[pdebris->instance].damage_mult;
|
||||
|
||||
// supercaps cap damage at 10-20% max hull ship damage
|
||||
if (Ship_info[Ships[pship->instance].ship_info_index].flags & SIF_SUPERCAP) {
|
||||
if (Ship_info[Ships[pship->instance].ship_info_index].flags[Ship::Info_Flags::Supercap]) {
|
||||
float cap_percent_damage = frand_range(0.1f, 0.2f);
|
||||
ship_damage = MIN(ship_damage, cap_percent_damage * Ships[pship->instance].ship_max_hull_strength);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int collide_debris_ship( obj_pair * pair )
|
||||
|
||||
if ( debris_hit_info.heavy == pship ) {
|
||||
quadrant_num = get_ship_quadrant_from_global(&hitpos, pship);
|
||||
if ((pship->flags & OF_NO_SHIELDS) || !ship_is_shield_up(pship, quadrant_num) ) {
|
||||
if ((pship->flags[Object::Object_Flags::No_shields]) || !ship_is_shield_up(pship, quadrant_num) ) {
|
||||
quadrant_num = -1;
|
||||
}
|
||||
if (apply_ship_damage) {
|
||||
@@ -277,7 +277,7 @@ int collide_asteroid_ship( obj_pair * pair )
|
||||
int quadrant_num;
|
||||
if ( asteroid_hit_info.heavy == pship ) {
|
||||
quadrant_num = get_ship_quadrant_from_global(&hitpos, pship);
|
||||
if ((pship->flags & OF_NO_SHIELDS) || !ship_is_shield_up(pship, quadrant_num) ) {
|
||||
if ((pship->flags[Object::Object_Flags::No_shields]) || !ship_is_shield_up(pship, quadrant_num) ) {
|
||||
quadrant_num = -1;
|
||||
}
|
||||
ship_apply_local_damage(asteroid_hit_info.heavy, asteroid_hit_info.light, &hitpos, ship_damage, quadrant_num, CREATE_SPARKS, asteroid_hit_info.submodel_num);
|
||||
|
||||
@@ -132,7 +132,7 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
}
|
||||
|
||||
// Make ships that are warping in not get collision detection done
|
||||
if ( heavy_shipp->flags & SF_ARRIVING_STAGE_1 ) {
|
||||
if ( heavy_shipp->flags[Ship::Ship_Flags::Arriving_stage_1] ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
// Also, this is the only clean way I could figure to get ships to not do damage to each other for one frame
|
||||
// when they are docked and departing. Due to sequencing, they would not show up as docked, yet they
|
||||
// would still come through here, so they would harm each other, if on opposing teams. -- MK, 2/2/98
|
||||
if ((heavy_obj->flags & OF_SHOULD_BE_DEAD) || (light_obj->flags & OF_SHOULD_BE_DEAD)) {
|
||||
if ((heavy_obj->flags[Object::Object_Flags::Should_be_dead]) || (light_obj->flags[Object::Object_Flags::Should_be_dead])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
// Apparently we're doing same team collisions.
|
||||
// But, if both are offscreen, ignore the collision
|
||||
if (heavy_shipp->team == light_shipp->team) {
|
||||
if ( (!(heavy_obj->flags & OF_WAS_RENDERED) && !(light_obj->flags & OF_WAS_RENDERED)) ) {
|
||||
if ( (!(heavy_obj->flags[Object::Object_Flags::Was_rendered]) && !(light_obj->flags[Object::Object_Flags::Was_rendered])) ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -221,8 +221,8 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE); // flags
|
||||
|
||||
// Only check invisible face polygons for ship:ship of different teams.
|
||||
if ( !(heavy_shipp->flags2 & SF2_DONT_COLLIDE_INVIS) ) {
|
||||
if ((heavy_obj->flags & OF_PLAYER_SHIP) || (light_obj->flags & OF_PLAYER_SHIP) || (heavy_shipp->team != light_shipp->team) ) {
|
||||
if ( !(heavy_shipp->flags[Ship::Ship_Flags::Dont_collide_invis]) ) {
|
||||
if ((heavy_obj->flags[Object::Object_Flags::Player_ship]) || (light_obj->flags[Object::Object_Flags::Player_ship]) || (heavy_shipp->team != light_shipp->team) ) {
|
||||
mc.flags |= MC_CHECK_INVISIBLE_FACES;
|
||||
}
|
||||
}
|
||||
@@ -360,7 +360,7 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
} else if (light_obj == Player_obj) {
|
||||
collide_obj = heavy_obj;
|
||||
}
|
||||
if ((collide_obj != NULL) && (Ship_info[Ships[collide_obj->instance].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER))) {
|
||||
if ((collide_obj != NULL) && (Ship_info[Ships[collide_obj->instance].ship_info_index].is_fighter_bomber())) {
|
||||
char *submode_string = "";
|
||||
ai_info *aip;
|
||||
|
||||
@@ -407,8 +407,8 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
if (heavy_shipp->team == light_shipp->team) {
|
||||
// If a couple of small ships, just move them apart.
|
||||
|
||||
if ((heavy_sip->flags & SIF_SMALL_SHIP) && (light_sip->flags & SIF_SMALL_SHIP)) {
|
||||
if ((heavy_obj->flags & OF_PLAYER_SHIP) || (light_obj->flags & OF_PLAYER_SHIP)) {
|
||||
if ((heavy_sip->is_small_ship()) && (light_sip->is_small_ship())) {
|
||||
if ((heavy_obj->flags[Object::Object_Flags::Player_ship]) || (light_obj->flags[Object::Object_Flags::Player_ship])) {
|
||||
vec3d h_to_l_vec;
|
||||
vec3d rel_vel_h;
|
||||
vec3d perp_rel_vel;
|
||||
@@ -463,7 +463,7 @@ int check_special_cruiser_asteroid_collision(object *heavy, object *lighter, flo
|
||||
|
||||
if (heavy->type == OBJ_ASTEROID) {
|
||||
Assert(lighter->type == OBJ_SHIP);
|
||||
if (Ship_info[Ships[lighter->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[Ships[lighter->instance].ship_info_index].is_big_or_huge()) {
|
||||
|
||||
asteroid_type = Asteroids[heavy->instance].asteroid_type;
|
||||
if (asteroid_type == 0) {
|
||||
@@ -481,7 +481,7 @@ int check_special_cruiser_asteroid_collision(object *heavy, object *lighter, flo
|
||||
}
|
||||
} else if (lighter->type == OBJ_ASTEROID) {
|
||||
Assert(heavy->type == OBJ_SHIP);
|
||||
if (Ship_info[Ships[heavy->instance].ship_info_index].flags & SIF_BIG_SHIP) {
|
||||
if (Ship_info[Ships[heavy->instance].ship_info_index].is_big_or_huge()) {
|
||||
|
||||
asteroid_type = Asteroids[lighter->instance].asteroid_type;
|
||||
if (asteroid_type == 0) {
|
||||
@@ -505,7 +505,7 @@ int check_special_cruiser_asteroid_collision(object *heavy, object *lighter, flo
|
||||
* Find the subobject corresponding to the submodel hit
|
||||
*/
|
||||
bool check_subsystem_landing_allowed(ship_info *heavy_sip, collision_info_struct *ship_ship_hit_info) {
|
||||
if (!(heavy_sip->flags2 & SIF2_ALLOW_LANDINGS))
|
||||
if (!(heavy_sip->flags[Ship::Info_Flags::Allow_landings]))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < heavy_sip->n_subsystems; i++) {
|
||||
@@ -914,12 +914,12 @@ int maybe_collide_planet (object *obj1, object *obj2)
|
||||
sip1 = &Ship_info[Ships[obj1->instance].ship_info_index];
|
||||
sip2 = &Ship_info[Ships[obj2->instance].ship_info_index];
|
||||
|
||||
if (sip1->flags & SIF_PLAYER_SHIP) {
|
||||
if (sip1->flags[Ship::Info_Flags::Player_ship]) {
|
||||
if (is_planet(obj2)) {
|
||||
mcp_1(obj1, obj2);
|
||||
return 1;
|
||||
}
|
||||
} else if (sip2->flags & SIF_PLAYER_SHIP) {
|
||||
} else if (sip2->flags[Ship::Info_Flags::Player_ship]) {
|
||||
if (is_planet(obj1)) {
|
||||
mcp_1(obj2, obj1);
|
||||
return 1;
|
||||
@@ -1008,12 +1008,12 @@ void do_kamikaze_crash(object *obj1, object *obj2)
|
||||
|
||||
if (ship1->team != ship2->team) {
|
||||
if (aip1->ai_flags & AIF_KAMIKAZE) {
|
||||
if (Ship_info[ship2->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[ship2->ship_info_index].is_big_or_huge()) {
|
||||
obj1->hull_strength = KAMIKAZE_HULL_ON_DEATH;
|
||||
shield_set_strength(obj1, 0.0f);
|
||||
}
|
||||
} if (aip2->ai_flags & AIF_KAMIKAZE) {
|
||||
if (Ship_info[ship1->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[ship1->ship_info_index].is_big_or_huge()) {
|
||||
obj2->hull_strength = KAMIKAZE_HULL_ON_DEATH;
|
||||
shield_set_strength(obj2, 0.0f);
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ int collide_ship_ship( obj_pair * pair )
|
||||
//Only do damage if not a landing
|
||||
if (!ship_ship_hit_info.is_landing) {
|
||||
// Scale damage based on skill level for player.
|
||||
if ((LightOne->flags & OF_PLAYER_SHIP) || (HeavyOne->flags & OF_PLAYER_SHIP)) {
|
||||
if ((LightOne->flags[Object::Object_Flags::Player_ship]) || (HeavyOne->flags[Object::Object_Flags::Player_ship])) {
|
||||
damage *= (float) (Game_skill_level*Game_skill_level+1)/(NUM_SKILL_LEVELS+1);
|
||||
} else if (Ships[LightOne->instance].team == Ships[HeavyOne->instance].team) {
|
||||
// Decrease damage if non-player ships and not large.
|
||||
@@ -1228,7 +1228,7 @@ int collide_ship_ship( obj_pair * pair )
|
||||
float dam2 = (100.0f * damage/LightOne->phys_info.mass);
|
||||
|
||||
int quadrant_num = get_ship_quadrant_from_global(&world_hit_pos, ship_ship_hit_info.heavy);
|
||||
if ((ship_ship_hit_info.heavy->flags & OF_NO_SHIELDS) || !ship_is_shield_up(ship_ship_hit_info.heavy, quadrant_num) ) {
|
||||
if ((ship_ship_hit_info.heavy->flags[Object::Object_Flags::No_shields]) || !ship_is_shield_up(ship_ship_hit_info.heavy, quadrant_num) ) {
|
||||
quadrant_num = -1;
|
||||
}
|
||||
|
||||
@@ -1258,18 +1258,16 @@ int collide_ship_ship( obj_pair * pair )
|
||||
Script_system.RemHookVars(4, "Ship", "ShipB", "Self", "Object");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// estimate earliest time at which pair can hit
|
||||
}
|
||||
else {
|
||||
// estimate earliest time at which pair can hit
|
||||
|
||||
// cap ships warping in/out can exceed ship's expected velocity
|
||||
// if ship is warping in, in stage 1, its velocity is 0, so make ship try to collide next frame
|
||||
int sif_a_flags, sif_b_flags;
|
||||
sif_a_flags = Ship_info[Ships[A->instance].ship_info_index].flags;
|
||||
sif_b_flags = Ship_info[Ships[B->instance].ship_info_index].flags;
|
||||
// cap ships warping in/out can exceed ship's expected velocity
|
||||
// if ship is warping in, in stage 1, its velocity is 0, so make ship try to collide next frame
|
||||
|
||||
// if ship is huge and warping in or out
|
||||
if ( ((Ships[A->instance].flags & SF_ARRIVING_STAGE_1) && (sif_a_flags & (SIF_HUGE_SHIP)))
|
||||
|| ((Ships[B->instance].flags & SF_ARRIVING_STAGE_1) && (sif_b_flags & (SIF_HUGE_SHIP))) ) {
|
||||
// if ship is huge and warping in or out
|
||||
if (((Ships[A->instance].flags[Ship::Ship_Flags::Arriving_stage_1]) && (Ship_info[Ships[A->instance].ship_info_index].is_huge_ship()))
|
||||
|| ((Ships[B->instance].flags[Ship::Ship_Flags::Arriving_stage_1]) && (Ship_info[Ships[B->instance].ship_info_index].is_huge_ship())) ) {
|
||||
pair->next_check_time = timestamp(0); // check next time
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void ship_weapon_do_hit_stuff(object *pship_obj, object *weapon_obj, vec3d *worl
|
||||
vm_vec_copy_scale(&force, &weapon_obj->phys_info.vel, blast );
|
||||
|
||||
// send player pain packet
|
||||
if ( (MULTIPLAYER_MASTER) && !(shipp->flags & SF_DYING) ){
|
||||
if ( (MULTIPLAYER_MASTER) && !(shipp->flags[Ship::Ship_Flags::Dying]) ){
|
||||
int np_index = multi_find_player_by_object(pship_obj);
|
||||
|
||||
// if this is a player ship
|
||||
@@ -149,7 +149,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
Assert( shipp->objnum == OBJ_INDEX(ship_objp));
|
||||
|
||||
// Make ships that are warping in not get collision detection done
|
||||
if ( shipp->flags & SF_ARRIVING ) return 0;
|
||||
if ( shipp->is_arriving() ) return 0;
|
||||
|
||||
// Return information for AI to detect incoming fire.
|
||||
// Could perhaps be done elsewhere at lower cost --MK, 11/7/97
|
||||
@@ -206,8 +206,8 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
int hull_collision = 0;
|
||||
|
||||
// check shields for impact
|
||||
if (!(ship_objp->flags & OF_NO_SHIELDS)) {
|
||||
if (sip->flags2 & SIF2_AUTO_SPREAD_SHIELDS) {
|
||||
if (!(ship_objp->flags[Object::Object_Flags::No_shields])) {
|
||||
if (sip->flags[Ship::Info_Flags::Auto_spread_shields]) {
|
||||
// The weapon is not allowed to impact the shield before it reaches this point
|
||||
vec3d shield_ignored_until = weapon_objp->last_pos;
|
||||
|
||||
@@ -305,7 +305,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
vm_vec_sub(&tempv, &mc_shield.hit_point_world, &ship_objp->pos);
|
||||
vm_vec_rotate(&mc_shield.hit_point, &tempv, &ship_objp->orient);
|
||||
}
|
||||
} else if (sip->flags2 & SIF2_SURFACE_SHIELDS) {
|
||||
} else if (sip->flags[Ship::Info_Flags::Surface_shields]) {
|
||||
if (pm->shield.ntris > 0) {
|
||||
// If there is a shield mesh, we need to check that first
|
||||
mc_shield.flags = MC_CHECK_SHIELD;
|
||||
@@ -352,7 +352,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
quadrant_num = get_quadrant(&mc_shield.hit_point, ship_objp);
|
||||
|
||||
// make sure that the shield is active in that quadrant
|
||||
if (shipp->flags & SF_DYING || !ship_is_shield_up(ship_objp, quadrant_num))
|
||||
if (shipp->flags[Ship::Ship_Flags::Dying] || !ship_is_shield_up(ship_objp, quadrant_num))
|
||||
quadrant_num = -1;
|
||||
|
||||
// see if we hit the shield
|
||||
@@ -384,7 +384,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
}
|
||||
|
||||
// check if the hit point is beyond the clip plane when warping out.
|
||||
if ((shipp->flags & SF_DEPART_WARP) &&
|
||||
if ((shipp->flags[Ship::Ship_Flags::Depart_warp]) &&
|
||||
(shipp->warpout_effect) &&
|
||||
(valid_hit_occurred))
|
||||
{
|
||||
@@ -449,7 +449,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
|
||||
if (vm_vec_dot(&vec_to_ship, &weapon_objp->orient.vec.fvec) < 0.0f) {
|
||||
// check if we're colliding against "invisible" ship
|
||||
if (!(shipp->flags2 & SF2_DONT_COLLIDE_INVIS)) {
|
||||
if (!(shipp->flags[Ship::Ship_Flags::Dont_collide_invis])) {
|
||||
wp->lifeleft = 0.001f;
|
||||
if (ship_objp == Player_obj)
|
||||
nprintf(("Jim", "Frame %i: Weapon %d set to detonate, dist = %7.3f.\n", Framecount, OBJ_INDEX(weapon_objp), dist));
|
||||
@@ -493,13 +493,13 @@ int collide_ship_weapon( obj_pair * pair )
|
||||
// If it does hit, don't check the pair until about 200 ms before collision.
|
||||
// If it does not hit and is within error tolerance, cull the pair.
|
||||
|
||||
if ( (sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) && (Weapon_info[Weapons[weapon_obj->instance].weapon_info_index].subtype == WP_LASER) ) {
|
||||
if ( (sip->is_big_or_huge()) && (Weapon_info[Weapons[weapon_obj->instance].weapon_info_index].subtype == WP_LASER) ) {
|
||||
// Check when within ~1.1 radii.
|
||||
// This allows good transition between sphere checking (leaving the laser about 200 ms from radius) and checking
|
||||
// within the sphere with little time between. There may be some time for "small" big ships
|
||||
// Note: culling ships with auto spread shields seems to waste more performance than it saves,
|
||||
// so we're not doing that here
|
||||
if ( !(sip->flags2 & SIF2_AUTO_SPREAD_SHIELDS) && vm_vec_dist_squared(&ship->pos, &weapon_obj->pos) < (1.2f*ship->radius*ship->radius) ) {
|
||||
if ( !(sip->flags[Ship::Info_Flags::Auto_spread_shields]) && vm_vec_dist_squared(&ship->pos, &weapon_obj->pos) < (1.2f*ship->radius*ship->radius) ) {
|
||||
return check_inside_radius_for_big_ships( ship, weapon_obj, pair );
|
||||
}
|
||||
}
|
||||
|
||||
+28
-28
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
SCP_unordered_map<uint, collider_pair> Collision_cached_pairs;
|
||||
|
||||
struct checkobject;
|
||||
class checkobject;
|
||||
extern checkobject CheckObjects[MAX_OBJECTS];
|
||||
|
||||
extern int Cmdline_old_collision_sys;
|
||||
@@ -183,10 +183,10 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end )
|
||||
|
||||
if ( A==B ) return; // Don't check collisions with yourself
|
||||
|
||||
if ( !(A->flags&OF_COLLIDES) ) return; // This object doesn't collide with anything
|
||||
if ( !(B->flags&OF_COLLIDES) ) return; // This object doesn't collide with anything
|
||||
if ( !(A->flags[Object::Object_Flags::Collides]) ) return; // This object doesn't collide with anything
|
||||
if ( !(B->flags[Object::Object_Flags::Collides]) ) return; // This object doesn't collide with anything
|
||||
|
||||
if ((A->flags & OF_IMMOBILE) && (B->flags & OF_IMMOBILE)) return; // Two immobile objects will never collide with each other
|
||||
if ((A->flags[Object::Object_Flags::Immobile]) && (B->flags[Object::Object_Flags::Immobile])) return; // Two immobile objects will never collide with each other
|
||||
|
||||
// Make sure you're not checking a parent with it's kid or vicy-versy
|
||||
// if ( A->parent_sig == B->signature && !(A->type == OBJ_SHIP && B->type == OBJ_DEBRIS) ) return;
|
||||
@@ -223,26 +223,26 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end )
|
||||
break;
|
||||
case COLLISION_OF(OBJ_ASTEROID, OBJ_WEAPON):
|
||||
// Only check collision's with player weapons
|
||||
// if ( Objects[B->parent].flags & OF_PLAYER_SHIP ) {
|
||||
// if ( Objects[B->parent].flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_weapon;
|
||||
// }
|
||||
break;
|
||||
case COLLISION_OF(OBJ_WEAPON, OBJ_ASTEROID):
|
||||
swapped = 1;
|
||||
// Only check collision's with player weapons
|
||||
// if ( Objects[A->parent].flags & OF_PLAYER_SHIP ) {
|
||||
// if ( Objects[A->parent].flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_weapon;
|
||||
// }
|
||||
break;
|
||||
case COLLISION_OF(OBJ_ASTEROID, OBJ_SHIP):
|
||||
// Only check collisions with player ships
|
||||
// if ( B->flags & OF_PLAYER_SHIP ) {
|
||||
// if ( B->flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_ship;
|
||||
// }
|
||||
break;
|
||||
case COLLISION_OF(OBJ_SHIP, OBJ_ASTEROID):
|
||||
// Only check collisions with player ships
|
||||
// if ( A->flags & OF_PLAYER_SHIP ) {
|
||||
// if ( A->flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_ship;
|
||||
// }
|
||||
swapped = 1;
|
||||
@@ -389,7 +389,7 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end )
|
||||
}
|
||||
|
||||
// for nonplayer ships, only create collision pair if close enough
|
||||
if ( (B->parent >= 0) && !((Objects[B->parent].signature == B->parent_sig) && (Objects[B->parent].flags & OF_PLAYER_SHIP)) && (vm_vec_dist(&B->pos, &A->pos) < (4.0f*A->radius + 200.0f)) )
|
||||
if ( (B->parent >= 0) && !((Objects[B->parent].signature == B->parent_sig) && (Objects[B->parent].flags[Object::Object_Flags::Player_ship])) && (vm_vec_dist(&B->pos, &A->pos) < (4.0f*A->radius + 200.0f)) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -399,9 +399,9 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end )
|
||||
// weapon is B
|
||||
if ( (B->parent >= 0)
|
||||
&& (Objects[B->parent].signature == B->parent_sig)
|
||||
&& !(Objects[B->parent].flags & OF_PLAYER_SHIP)
|
||||
&& !(Objects[B->parent].flags[Object::Object_Flags::Player_ship])
|
||||
&& (Ships[Objects[B->parent].instance].team == Ships[A->instance].team)
|
||||
&& (Ship_info[Ships[A->instance].ship_info_index].flags & SIF_SMALL_SHIP)
|
||||
&& (Ship_info[Ships[A->instance].ship_info_index].is_small_ship())
|
||||
&& (Weapon_info[Weapons[B->instance].weapon_info_index].subtype == WP_LASER) ) {
|
||||
pairs_not_created++;
|
||||
return;
|
||||
@@ -978,14 +978,14 @@ int collide_predict_large_ship(object *objp, float distance)
|
||||
|
||||
for ( objp2 = GET_FIRST(&obj_used_list); objp2 != END_OF_LIST(&obj_used_list); objp2 = GET_NEXT(objp2) ) {
|
||||
if ((objp != objp2) && (objp2->type == OBJ_SHIP)) {
|
||||
if (Ship_info[Ships[objp2->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[Ships[objp2->instance].ship_info_index].is_big_or_huge()) {
|
||||
if (dock_check_find_docked_object(objp, objp2))
|
||||
continue;
|
||||
|
||||
if (cpls_aux(&goal_pos, objp2, objp))
|
||||
return 1;
|
||||
}
|
||||
} else if (!(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) && (objp2->type == OBJ_ASTEROID)) {
|
||||
} else if (!(sip->is_big_or_huge()) && (objp2->type == OBJ_ASTEROID)) {
|
||||
if (vm_vec_dist_quick(&objp2->pos, &objp->pos) < (distance + objp2->radius)*2.5f) {
|
||||
vec3d pos, delvec;
|
||||
int count;
|
||||
@@ -1167,24 +1167,24 @@ void obj_add_collider(int obj_index)
|
||||
#ifdef OBJECT_CHECK
|
||||
CheckObjects[obj_index].type = objp->type;
|
||||
CheckObjects[obj_index].signature = objp->signature;
|
||||
CheckObjects[obj_index].flags = objp->flags & ~(OF_NOT_IN_COLL);
|
||||
CheckObjects[obj_index].flags = objp->flags - Object::Object_Flags::Not_in_coll;
|
||||
CheckObjects[obj_index].parent_sig = objp->parent_sig;
|
||||
CheckObjects[obj_index].parent_type = objp->parent_type;
|
||||
#endif
|
||||
|
||||
if(!(objp->flags & OF_NOT_IN_COLL)){
|
||||
if(!(objp->flags[Object::Object_Flags::Not_in_coll])){
|
||||
return;
|
||||
}
|
||||
|
||||
Collision_sort_list.push_back(obj_index);
|
||||
|
||||
objp->flags &= ~OF_NOT_IN_COLL;
|
||||
objp->flags.remove(Object::Object_Flags::Not_in_coll);
|
||||
}
|
||||
|
||||
void obj_remove_collider(int obj_index)
|
||||
{
|
||||
#ifdef OBJECT_CHECK
|
||||
CheckObjects[obj_index].flags |= OF_NOT_IN_COLL;
|
||||
CheckObjects[obj_index].flags.set(Object::Object_Flags::Not_in_coll);
|
||||
#endif
|
||||
|
||||
size_t i;
|
||||
@@ -1197,7 +1197,7 @@ void obj_remove_collider(int obj_index)
|
||||
}
|
||||
}
|
||||
|
||||
Objects[obj_index].flags |= OF_NOT_IN_COLL;
|
||||
Objects[obj_index].flags.set(Object::Object_Flags::Not_in_coll);
|
||||
}
|
||||
|
||||
void obj_reset_colliders()
|
||||
@@ -1385,10 +1385,10 @@ void obj_collide_pair(object *A, object *B)
|
||||
|
||||
if ( A==B ) return; // Don't check collisions with yourself
|
||||
|
||||
if ( !(A->flags&OF_COLLIDES) ) return; // This object doesn't collide with anything
|
||||
if ( !(B->flags&OF_COLLIDES) ) return; // This object doesn't collide with anything
|
||||
if ( !(A->flags[Object::Object_Flags::Collides]) ) return; // This object doesn't collide with anything
|
||||
if ( !(B->flags[Object::Object_Flags::Collides]) ) return; // This object doesn't collide with anything
|
||||
|
||||
if ((A->flags & OF_IMMOBILE) && (B->flags & OF_IMMOBILE)) return; // Two immobile objects will never collide with each other
|
||||
if ((A->flags[Object::Object_Flags::Immobile]) && (B->flags[Object::Object_Flags::Immobile])) return; // Two immobile objects will never collide with each other
|
||||
|
||||
// Make sure you're not checking a parent with it's kid or vicy-versy
|
||||
// if ( A->parent_sig == B->signature && !(A->type == OBJ_SHIP && B->type == OBJ_DEBRIS) ) return;
|
||||
@@ -1425,26 +1425,26 @@ void obj_collide_pair(object *A, object *B)
|
||||
break;
|
||||
case COLLISION_OF(OBJ_ASTEROID, OBJ_WEAPON):
|
||||
// Only check collision's with player weapons
|
||||
// if ( Objects[B->parent].flags & OF_PLAYER_SHIP ) {
|
||||
// if ( Objects[B->parent].flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_weapon;
|
||||
// }
|
||||
break;
|
||||
case COLLISION_OF(OBJ_WEAPON, OBJ_ASTEROID):
|
||||
swapped = 1;
|
||||
// Only check collision's with player weapons
|
||||
// if ( Objects[A->parent].flags & OF_PLAYER_SHIP ) {
|
||||
// if ( Objects[A->parent].flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_weapon;
|
||||
// }
|
||||
break;
|
||||
case COLLISION_OF(OBJ_ASTEROID, OBJ_SHIP):
|
||||
// Only check collisions with player ships
|
||||
// if ( B->flags & OF_PLAYER_SHIP ) {
|
||||
// if ( B->flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_ship;
|
||||
// }
|
||||
break;
|
||||
case COLLISION_OF(OBJ_SHIP, OBJ_ASTEROID):
|
||||
// Only check collisions with player ships
|
||||
// if ( A->flags & OF_PLAYER_SHIP ) {
|
||||
// if ( A->flags[Object::Object_Flags::Player_ship] ) {
|
||||
check_collision = collide_asteroid_ship;
|
||||
// }
|
||||
swapped = 1;
|
||||
@@ -1621,7 +1621,7 @@ void obj_collide_pair(object *A, object *B)
|
||||
}
|
||||
|
||||
// for nonplayer ships, only create collision pair if close enough
|
||||
if ( (B->parent >= 0) && !((Objects[B->parent].signature == B->parent_sig) && (Objects[B->parent].flags & OF_PLAYER_SHIP)) && (vm_vec_dist(&B->pos, &A->pos) < (4.0f*A->radius + 200.0f)) ) {
|
||||
if ( (B->parent >= 0) && !((Objects[B->parent].signature == B->parent_sig) && (Objects[B->parent].flags[Object::Object_Flags::Player_ship])) && (vm_vec_dist(&B->pos, &A->pos) < (4.0f*A->radius + 200.0f)) ) {
|
||||
collision_info->next_check_time = -1;
|
||||
return;
|
||||
}
|
||||
@@ -1633,9 +1633,9 @@ void obj_collide_pair(object *A, object *B)
|
||||
// weapon is B
|
||||
if ( (B->parent >= 0)
|
||||
&& (Objects[B->parent].signature == B->parent_sig)
|
||||
&& !(Objects[B->parent].flags & OF_PLAYER_SHIP)
|
||||
&& !(Objects[B->parent].flags[Object::Object_Flags::Player_ship])
|
||||
&& (Ships[Objects[B->parent].instance].team == Ships[A->instance].team)
|
||||
&& (Ship_info[Ships[A->instance].ship_info_index].flags & SIF_SMALL_SHIP)
|
||||
&& (Ship_info[Ships[A->instance].ship_info_index].is_small_ship())
|
||||
&& (Weapon_info[Weapons[B->instance].weapon_info_index].subtype == WP_LASER) ) {
|
||||
collision_info->next_check_time = -1;
|
||||
return;
|
||||
|
||||
+66
-73
@@ -95,18 +95,26 @@ char *Object_type_names[MAX_OBJECT_TYPES] = {
|
||||
};
|
||||
|
||||
obj_flag_name Object_flag_names[] = {
|
||||
{OF_INVULNERABLE, "invulnerable", 1, },
|
||||
{OF_PROTECTED, "protect-ship", 1, },
|
||||
{OF_BEAM_PROTECTED, "beam-protect-ship", 1, },
|
||||
{OF_NO_SHIELDS, "no-shields", 1, },
|
||||
{OF_TARGETABLE_AS_BOMB, "targetable-as-bomb", 1, },
|
||||
{OF_FLAK_PROTECTED, "flak-protect-ship", 1, },
|
||||
{OF_LASER_PROTECTED, "laser-protect-ship", 1, },
|
||||
{OF_MISSILE_PROTECTED, "missile-protect-ship", 1, },
|
||||
{OF_IMMOBILE, "immobile", 1, },
|
||||
{OF_COLLIDES, "collides", 1, },
|
||||
{ Object::Object_Flags::Invulnerable, "invulnerable", 1, },
|
||||
{ Object::Object_Flags::Protected, "protect-ship", 1, },
|
||||
{ Object::Object_Flags::Beam_protected, "beam-protect-ship", 1, },
|
||||
{ Object::Object_Flags::No_shields, "no-shields", 1, },
|
||||
{ Object::Object_Flags::Targetable_as_bomb, "targetable-as-bomb", 1, },
|
||||
{ Object::Object_Flags::Flak_protected, "flak-protect-ship", 1, },
|
||||
{ Object::Object_Flags::Laser_protected, "laser-protect-ship", 1, },
|
||||
{ Object::Object_Flags::Missile_protected, "missile-protect-ship", 1, },
|
||||
{ Object::Object_Flags::Immobile, "immobile", 1, },
|
||||
{ Object::Object_Flags::Collides, "collides", 1, },
|
||||
};
|
||||
|
||||
#ifdef OBJECT_CHECK
|
||||
checkobject::checkobject()
|
||||
: type(0), signature(0), parent_sig(0), parent_type(0)
|
||||
{
|
||||
flags.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
// all we need to set are the pointers, but type, parent, and instance are useful to set as well
|
||||
object::object()
|
||||
: next(NULL), prev(NULL), type(OBJ_NONE), parent(-1), instance(-1), n_quadrants(0), hull_strength(0.0),
|
||||
@@ -129,7 +137,7 @@ void object::clear()
|
||||
signature = num_pairs = collision_group_id = 0;
|
||||
parent = parent_sig = instance = -1;
|
||||
type = parent_type = OBJ_NONE;
|
||||
flags = 0;
|
||||
flags.reset();
|
||||
pos = last_pos = vmd_zero_vector;
|
||||
orient = last_orient = vmd_identity_matrix;
|
||||
radius = hull_strength = sim_hull_strength = 0.0f;
|
||||
@@ -167,7 +175,7 @@ int free_object_slots(int num_used)
|
||||
return 0;
|
||||
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->flags & OF_SHOULD_BE_DEAD) {
|
||||
if (objp->flags[Object::Object_Flags::Should_be_dead]) {
|
||||
num_already_free++;
|
||||
if (MAX_OBJECTS - num_already_free < num_used)
|
||||
return num_already_free;
|
||||
@@ -216,7 +224,7 @@ int free_object_slots(int num_used)
|
||||
if ( (Objects[obj_list[i]].type == OBJ_DEBRIS) && (Debris[Objects[obj_list[i]].instance].flags & DEBRIS_EXPIRE) ) {
|
||||
num_to_free--;
|
||||
nprintf(("allender", "Freeing DEBRIS object %3i\n", obj_list[i]));
|
||||
Objects[obj_list[i]].flags |= OF_SHOULD_BE_DEAD;
|
||||
Objects[obj_list[i]].flags.set(Object::Object_Flags::Should_be_dead);
|
||||
}
|
||||
|
||||
if (!num_to_free)
|
||||
@@ -227,7 +235,7 @@ int free_object_slots(int num_used)
|
||||
if ( (tmp_obj->type == OBJ_FIREBALL) && (fireball_is_perishable(tmp_obj)) ) {
|
||||
num_to_free--;
|
||||
nprintf(("allender", "Freeing FIREBALL object %3i\n", obj_list[i]));
|
||||
tmp_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
tmp_obj->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +253,7 @@ int free_object_slots(int num_used)
|
||||
for (i=0; i<num_to_free; i++){
|
||||
if ( Objects[obj_list[i]].type == OBJ_WEAPON ) {
|
||||
num_to_free--;
|
||||
Objects[obj_list[i]].flags |= OF_SHOULD_BE_DEAD;
|
||||
Objects[obj_list[i]].flags.set(Object::Object_Flags::Should_be_dead);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +473,7 @@ void obj_free(int objnum)
|
||||
* @return the object number
|
||||
*/
|
||||
int obj_create(ubyte type,int parent_obj,int instance, matrix * orient,
|
||||
vec3d * pos, float radius, uint flags )
|
||||
vec3d * pos, float radius, const flagset<Object::Object_Flags> &flags )
|
||||
{
|
||||
int objnum;
|
||||
object *obj;
|
||||
@@ -496,7 +504,8 @@ int obj_create(ubyte type,int parent_obj,int instance, matrix * orient,
|
||||
obj->parent_type = obj->type;
|
||||
}
|
||||
|
||||
obj->flags = flags | OF_NOT_IN_COLL;
|
||||
obj->flags = flags;
|
||||
obj->flags.set(Object::Object_Flags::Not_in_coll);
|
||||
if (pos) {
|
||||
obj->pos = *pos;
|
||||
obj->last_pos = *pos;
|
||||
@@ -544,7 +553,7 @@ void obj_delete(int objnum)
|
||||
case OBJ_SHIP:
|
||||
if ((objp == Player_obj) && !Fred_running) {
|
||||
objp->type = OBJ_GHOST;
|
||||
objp->flags &= ~(OF_SHOULD_BE_DEAD);
|
||||
objp->flags.remove(Object::Object_Flags::Should_be_dead);
|
||||
|
||||
// we have to traverse the ship_obj list and remove this guy from it as well
|
||||
ship_obj *moveup = GET_FIRST(&Ship_obj_list);
|
||||
@@ -587,7 +596,7 @@ void obj_delete(int objnum)
|
||||
case OBJ_GHOST:
|
||||
if(!(Game_mode & GM_MULTIPLAYER)){
|
||||
mprintf(("Warning: Tried to delete a ghost!\n"));
|
||||
objp->flags &= ~OF_SHOULD_BE_DEAD;
|
||||
objp->flags.remove(Object::Object_Flags::Should_be_dead);
|
||||
return;
|
||||
} else {
|
||||
// we need to be able to delete GHOST objects in multiplayer to allow for player respawns.
|
||||
@@ -634,10 +643,10 @@ void obj_delete_all_that_should_be_dead()
|
||||
objp = GET_FIRST(&obj_used_list);
|
||||
while( objp !=END_OF_LIST(&obj_used_list) ) {
|
||||
// Goober5000 - HACK HACK HACK - see obj_move_all
|
||||
objp->flags &= ~OF_DOCKED_ALREADY_HANDLED;
|
||||
objp->flags.remove(Object::Object_Flags::Docked_already_handled);
|
||||
|
||||
temp = GET_NEXT(objp);
|
||||
if ( objp->flags&OF_SHOULD_BE_DEAD )
|
||||
if ( objp->flags[Object::Object_Flags::Should_be_dead] )
|
||||
obj_delete( OBJ_INDEX(objp) ); // MWA says that john says that let obj_delete handle everything because of the editor
|
||||
objp = temp;
|
||||
}
|
||||
@@ -721,7 +730,7 @@ void obj_player_fire_stuff( object *objp, control_info ci )
|
||||
{
|
||||
ship *shipp;
|
||||
|
||||
Assert( objp->flags & OF_PLAYER_SHIP);
|
||||
Assert( objp->flags[Object::Object_Flags::Player_ship]);
|
||||
|
||||
// try and get the ship pointer
|
||||
shipp = NULL;
|
||||
@@ -737,7 +746,7 @@ void obj_player_fire_stuff( object *objp, control_info ci )
|
||||
if ( ci.fire_primary_count ) {
|
||||
// flag the ship as having the trigger down
|
||||
if(shipp != NULL){
|
||||
shipp->flags |= SF_TRIGGER_DOWN;
|
||||
shipp->flags.set(Ship::Ship_Flags::Trigger_down);
|
||||
}
|
||||
|
||||
// fire non-streaming primaries here
|
||||
@@ -745,7 +754,7 @@ void obj_player_fire_stuff( object *objp, control_info ci )
|
||||
} else {
|
||||
// unflag the ship as having the trigger down
|
||||
if(shipp != NULL){
|
||||
shipp->flags &= ~(SF_TRIGGER_DOWN);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Trigger_down);
|
||||
ship_stop_fire_primary(objp); //if it hasn't fired do the "has just stoped fireing" stuff
|
||||
}
|
||||
}
|
||||
@@ -783,9 +792,9 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
int has_fired = -1; //stop fireing stuff-Bobboau
|
||||
|
||||
// Do physics for objects with OF_PHYSICS flag set and with some engine strength remaining.
|
||||
if ( objp->flags & OF_PHYSICS ) {
|
||||
if ( objp->flags[Object::Object_Flags::Physics] ) {
|
||||
// only set phys info if ship is not dead
|
||||
if ((objp->type == OBJ_SHIP) && !(Ships[objp->instance].flags & SF_DYING)) {
|
||||
if ((objp->type == OBJ_SHIP) && !(Ships[objp->instance].flags[Ship::Ship_Flags::Dying])) {
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
float engine_strength;
|
||||
|
||||
@@ -883,8 +892,8 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
|
||||
// in multiplayer, if this object was just updatd (i.e. clients send their own positions),
|
||||
// then reset the flag and don't move the object.
|
||||
if ( MULTIPLAYER_MASTER && (objp->flags & OF_JUST_UPDATED) ) {
|
||||
objp->flags &= ~OF_JUST_UPDATED;
|
||||
if (MULTIPLAYER_MASTER && (objp->flags[Object::Object_Flags::Just_updated])) {
|
||||
objp->flags.remove(Object::Object_Flags::Just_updated);
|
||||
goto obj_maybe_fire;
|
||||
}
|
||||
|
||||
@@ -894,7 +903,7 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
// is moved (like firing weapons, etc). This routine will get called either single
|
||||
// or multiplayer. We must find the player object to get to the control info field
|
||||
obj_maybe_fire:
|
||||
if ( (objp->flags & OF_PLAYER_SHIP) && (objp->type != OBJ_OBSERVER) && (objp == Player_obj)) {
|
||||
if ( (objp->flags[Object::Object_Flags::Player_ship]) && (objp->type != OBJ_OBSERVER) && (objp == Player_obj)) {
|
||||
player *pp;
|
||||
if(Player != NULL){
|
||||
pp = Player;
|
||||
@@ -918,7 +927,7 @@ obj_maybe_fire:
|
||||
//2D MODE
|
||||
//THIS IS A FREAKIN' HACK
|
||||
//Do not let ship change position on Y axis
|
||||
if(The_mission.flags & MISSION_FLAG_2D_MISSION)
|
||||
if(The_mission.flags[Mission::Mission_Flags::Mission_2d])
|
||||
{
|
||||
angles old_angles, new_angles;
|
||||
objp->pos.xyz.y = objp->last_pos.xyz.y;
|
||||
@@ -974,7 +983,7 @@ void obj_check_object( object *obj )
|
||||
mprintf(( "Object signature changed!\n" ));
|
||||
Int3();
|
||||
}
|
||||
if ( (CheckObjects[objnum].flags&IMPORTANT_FLAGS) != (obj->flags&IMPORTANT_FLAGS) ) {
|
||||
if ( (CheckObjects[objnum].flags[Object::Object_Flags::Collides]) != (obj->flags[Object::Object_Flags::Collides]) ) {
|
||||
mprintf(( "Object flags changed!\n" ));
|
||||
Int3();
|
||||
}
|
||||
@@ -997,12 +1006,12 @@ void obj_check_object( object *obj )
|
||||
* this you shouldn't get Int3's in the checkobject code. If you
|
||||
* do, then put code in here to correctly handle the case.
|
||||
*/
|
||||
void obj_set_flags( object *obj, uint new_flags )
|
||||
void obj_set_flags( object *obj, const flagset<Object::Object_Flags>& new_flags )
|
||||
{
|
||||
int objnum = OBJ_INDEX(obj);
|
||||
|
||||
// turning collision detection off
|
||||
if ( (obj->flags & OF_COLLIDES) && (!(new_flags&OF_COLLIDES))) {
|
||||
if ( (obj->flags[Object::Object_Flags::Collides]) && (!(new_flags[Object::Object_Flags::Collides]))) {
|
||||
// Remove all object pairs
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
obj_remove_pairs( obj );
|
||||
@@ -1012,17 +1021,17 @@ void obj_set_flags( object *obj, uint new_flags )
|
||||
|
||||
// update object flags properly
|
||||
obj->flags = new_flags;
|
||||
obj->flags |= OF_NOT_IN_COLL;
|
||||
obj->flags.set(Object::Object_Flags::Not_in_coll);
|
||||
#ifdef OBJECT_CHECK
|
||||
CheckObjects[objnum].flags = new_flags;
|
||||
CheckObjects[objnum].flags |= OF_NOT_IN_COLL;
|
||||
CheckObjects[objnum].flags.set(Object::Object_Flags::Not_in_coll);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// turning collision detection on
|
||||
if ( (!(obj->flags & OF_COLLIDES)) && (new_flags&OF_COLLIDES) ) {
|
||||
if ( (!(obj->flags[Object::Object_Flags::Collides])) && (new_flags[Object::Object_Flags::Collides]) ) {
|
||||
|
||||
// observers can't collide or be hit, and they therefore have no hit or collide functions
|
||||
// So, don't allow this bit to be set
|
||||
@@ -1031,7 +1040,7 @@ void obj_set_flags( object *obj, uint new_flags )
|
||||
Int3();
|
||||
}
|
||||
|
||||
obj->flags |= OF_COLLIDES;
|
||||
obj->flags.set(Object::Object_Flags::Collides);
|
||||
|
||||
// Turn on collision detection
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
@@ -1041,10 +1050,10 @@ void obj_set_flags( object *obj, uint new_flags )
|
||||
}
|
||||
|
||||
obj->flags = new_flags;
|
||||
obj->flags &= ~(OF_NOT_IN_COLL);
|
||||
obj->flags.remove(Object::Object_Flags::Not_in_coll);
|
||||
#ifdef OBJECT_CHECK
|
||||
CheckObjects[objnum].flags = new_flags;
|
||||
CheckObjects[objnum].flags &= ~(OF_NOT_IN_COLL);
|
||||
CheckObjects[objnum].flags.remove(Object::Object_Flags::Not_in_coll);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -1053,7 +1062,7 @@ void obj_set_flags( object *obj, uint new_flags )
|
||||
// marked as OF_COULD_BE_PLAYER
|
||||
// this code is pretty much debug code and shouldn't be relied on to always do the right thing
|
||||
// for flags other than
|
||||
if ( MULTIPLAYER_MASTER && !(obj->flags & OF_COULD_BE_PLAYER) && (new_flags & OF_COULD_BE_PLAYER) ) {
|
||||
if ( MULTIPLAYER_MASTER && !(obj->flags[Object::Object_Flags::Could_be_player]) && (new_flags[Object::Object_Flags::Could_be_player]) ) {
|
||||
ship *shipp;
|
||||
int team, slot;
|
||||
|
||||
@@ -1086,7 +1095,7 @@ void obj_set_flags( object *obj, uint new_flags )
|
||||
}
|
||||
|
||||
// Check for unhandled flag changing
|
||||
if ( (new_flags&IMPORTANT_FLAGS) != (obj->flags&IMPORTANT_FLAGS) ) {
|
||||
if ( (new_flags[Object::Object_Flags::Collides]) != (obj->flags[Object::Object_Flags::Collides]) ) {
|
||||
mprintf(( "Unhandled flag changing in obj_set_flags!!\n" ));
|
||||
mprintf(( "Add code to support it, see John for questions!!\n" ));
|
||||
Int3();
|
||||
@@ -1400,7 +1409,7 @@ void obj_move_all(float frametime)
|
||||
|
||||
for (objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) {
|
||||
// skip objects which should be dead
|
||||
if (objp->flags & OF_SHOULD_BE_DEAD) {
|
||||
if (objp->flags[Object::Object_Flags::Should_be_dead]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1423,7 +1432,7 @@ void obj_move_all(float frametime)
|
||||
objp->last_orient = objp->orient;
|
||||
|
||||
// Goober5000 - skip objects which don't move, but only until they're destroyed
|
||||
if (!(objp->flags & OF_IMMOBILE && objp->hull_strength > 0.0f)) {
|
||||
if (!(objp->flags[Object::Object_Flags::Immobile] && objp->hull_strength > 0.0f)) {
|
||||
// if this is an object which should be interpolated in multiplayer, do so
|
||||
if (multi_oo_is_interp_object(objp)) {
|
||||
multi_oo_interp(objp);
|
||||
@@ -1496,7 +1505,7 @@ void obj_move_all(float frametime)
|
||||
}
|
||||
|
||||
// unflag all objects as being updates
|
||||
objp->flags &= ~OF_JUST_UPDATED;
|
||||
objp->flags.remove(Object::Object_Flags::Just_updated);
|
||||
|
||||
objp = GET_NEXT(objp);
|
||||
}
|
||||
@@ -1558,7 +1567,7 @@ void obj_render(object *obj)
|
||||
|
||||
void obj_queue_render(object* obj, draw_list* scene)
|
||||
{
|
||||
if ( obj->flags & OF_SHOULD_BE_DEAD ) return;
|
||||
if ( obj->flags[Object::Object_Flags::Should_be_dead] ) return;
|
||||
|
||||
// need to figure out what to do with this hook.
|
||||
// maybe save an array of these and run the script conditions after we finish drawing
|
||||
@@ -1659,7 +1668,7 @@ void obj_client_pre_interpolate()
|
||||
}
|
||||
|
||||
// for all non-dead object which are _not_ ships
|
||||
if ( !(objp->flags&OF_SHOULD_BE_DEAD) ) {
|
||||
if ( !(objp->flags[Object::Object_Flags::Should_be_dead]) ) {
|
||||
// pre-move step
|
||||
obj_move_all_pre(objp, flFrametime);
|
||||
|
||||
@@ -1721,7 +1730,7 @@ void obj_observer_move(float frame_time)
|
||||
ft = flFrametime;
|
||||
obj_move_call_physics( objp, ft );
|
||||
obj_move_all_post(objp, frame_time);
|
||||
objp->flags &= ~OF_JUST_UPDATED;
|
||||
objp->flags.remove(Object::Object_Flags::Just_updated);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1747,25 +1756,6 @@ void obj_get_average_ship_pos( vec3d *pos )
|
||||
vm_vec_scale( pos, 1.0f/(float)count );
|
||||
}
|
||||
|
||||
|
||||
int obj_get_SIF(object *objp)
|
||||
{
|
||||
if ((objp->type == OBJ_SHIP) || (objp->type == OBJ_START))
|
||||
return Ship_info[Ships[objp->instance].ship_info_index].flags;
|
||||
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int obj_get_SIF(int obj)
|
||||
{
|
||||
if ((Objects[obj].type == OBJ_SHIP) || (Objects[obj].type == OBJ_START))
|
||||
return Ship_info[Ships[Objects[obj].instance].ship_info_index].flags;
|
||||
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the team for the object passed as a parameter
|
||||
*
|
||||
@@ -1840,14 +1830,15 @@ void obj_add_pairs(int objnum)
|
||||
objp = &Objects[objnum];
|
||||
|
||||
// don't do anything if its already in the object pair list
|
||||
if(!(objp->flags & OF_NOT_IN_COLL)){
|
||||
if(!(objp->flags[Object::Object_Flags::Not_in_coll])){
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef OBJECT_CHECK
|
||||
CheckObjects[objnum].type = objp->type;
|
||||
CheckObjects[objnum].signature = objp->signature;
|
||||
CheckObjects[objnum].flags = objp->flags & ~(OF_NOT_IN_COLL);
|
||||
CheckObjects[objnum].flags = objp->flags;
|
||||
CheckObjects[objnum].flags.remove(Object::Object_Flags::Not_in_coll);
|
||||
CheckObjects[objnum].parent_sig = objp->parent_sig;
|
||||
CheckObjects[objnum].parent_type = objp->parent_type;
|
||||
#endif
|
||||
@@ -1859,7 +1850,7 @@ void obj_add_pairs(int objnum)
|
||||
obj_add_pair( objp, A );
|
||||
}
|
||||
|
||||
objp->flags &= ~OF_NOT_IN_COLL;
|
||||
objp->flags.remove(Object::Object_Flags::Not_in_coll);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1873,9 +1864,9 @@ void obj_remove_pairs( object * a )
|
||||
{
|
||||
obj_pair *parent, *tmp;
|
||||
|
||||
a->flags |= OF_NOT_IN_COLL;
|
||||
a->flags.set(Object::Object_Flags::Not_in_coll);
|
||||
#ifdef OBJECT_CHECK
|
||||
CheckObjects[OBJ_INDEX(a)].flags |= OF_NOT_IN_COLL;
|
||||
CheckObjects[OBJ_INDEX(a)].flags.set(Object::Object_Flags::Not_in_coll);
|
||||
#endif
|
||||
|
||||
if ( a->num_pairs < 1 ) {
|
||||
@@ -1920,7 +1911,9 @@ void obj_reset_all_collisions()
|
||||
{
|
||||
// clear checkobjects
|
||||
#ifndef NDEBUG
|
||||
memset(CheckObjects, 0, sizeof(checkobject) * MAX_OBJECTS);
|
||||
for (int i = 0; i < MAX_OBJECTS; ++i) {
|
||||
CheckObjects[i] = checkobject();
|
||||
}
|
||||
#endif
|
||||
|
||||
// clear object pairs
|
||||
@@ -1935,7 +1928,7 @@ void obj_reset_all_collisions()
|
||||
moveup = GET_FIRST(&obj_used_list);
|
||||
while(moveup != END_OF_LIST(&obj_used_list)){
|
||||
// he's not in the collision list
|
||||
moveup->flags |= OF_NOT_IN_COLL;
|
||||
moveup->flags.set(Object::Object_Flags::Not_in_coll);
|
||||
|
||||
// recalc pairs for this guy
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
|
||||
+13
-40
@@ -16,6 +16,7 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "physics/physics.h"
|
||||
#include "object/object_flags.h"
|
||||
|
||||
/*
|
||||
* CONSTANTS
|
||||
@@ -69,7 +70,7 @@ extern char *Object_type_names[MAX_OBJECT_TYPES];
|
||||
// {Put a call to this in OBJECT.C, function obj_delete_all_that_should_be_dead }
|
||||
// WARNING: To kill an object, set it's OF_SHOULD_BE_DEAD flag. Then,
|
||||
// this function will get called when it's time to clean up the data.
|
||||
// Assert( obj->flags & OF_SHOULD_BE_DEAD );
|
||||
// Assert( obj->flags[Object::Object_Flags::Should_be_dead] );
|
||||
// ...
|
||||
// ... Free up all weapon-specfic data
|
||||
// obj_delete(objnum);
|
||||
@@ -99,35 +100,8 @@ extern char *Object_type_names[MAX_OBJECT_TYPES];
|
||||
// ... Reducing shields, etc
|
||||
// }
|
||||
|
||||
//Misc object flags
|
||||
#define OF_RENDERS (1<<0) // It renders as something ( objtype_render gets called)
|
||||
#define OF_COLLIDES (1<<1) // It collides with stuff (objtype_check_impact & objtype_hit gets called)
|
||||
#define OF_PHYSICS (1<<2) // It moves with standard physics.
|
||||
#define OF_SHOULD_BE_DEAD (1<<3) // this object should be dead, so next time we can, we should delete this object.
|
||||
#define OF_INVULNERABLE (1<<4) // invulnerable
|
||||
#define OF_PROTECTED (1<<5) // Don't kill this object, probably mission-critical.
|
||||
#define OF_PLAYER_SHIP (1<<6) // this object under control of some player -- don't do ai stuff on it!!!
|
||||
#define OF_NO_SHIELDS (1<<7) // object has no shield generator system (i.e. no shields)
|
||||
#define OF_JUST_UPDATED (1<<8) // for multiplayer -- indicates that we received object update this frame
|
||||
#define OF_COULD_BE_PLAYER (1<<9) // for multiplayer -- indicates that it is selectable ingame joiners as their ship
|
||||
#define OF_WAS_RENDERED (1<<10) // Set if this object was rendered this frame. Only gets set if OF_RENDERS set. Gets cleared or set in obj_render_all().
|
||||
#define OF_NOT_IN_COLL (1<<11) // object has not been added to collision list
|
||||
#define OF_BEAM_PROTECTED (1<<12) // don't fire beam weapons at this type of object, probably mission critical.
|
||||
#define OF_SPECIAL_WARPIN (1<<13) // Object has special warp-in enabled.
|
||||
#define OF_DOCKED_ALREADY_HANDLED (1<<14) // Goober5000 - a docked object that we already moved
|
||||
#define OF_TARGETABLE_AS_BOMB (1<<15)
|
||||
#define OF_FLAK_PROTECTED (1<<16) // Goober5000 - protected from flak turrets
|
||||
#define OF_LASER_PROTECTED (1<<17) // Goober5000 - protected from laser turrets
|
||||
#define OF_MISSILE_PROTECTED (1<<18) // Goober5000 - protected from missile turrets
|
||||
#define OF_IMMOBILE (1<<19) // Goober5000 - doesn't move, no matter what
|
||||
|
||||
// Flags used by Fred
|
||||
#define OF_MARKED (1<<29) // Object is marked (Fred). Can be reused in FreeSpace for anything that won't be used by Fred.
|
||||
#define OF_TEMP_MARKED (1<<30) // Temporarily marked (Fred).
|
||||
#define OF_HIDDEN (1<<31) // Object is hidden (not shown) and can't be manipulated
|
||||
|
||||
typedef struct obj_flag_name {
|
||||
int flag;
|
||||
Object::Object_Flags flag;
|
||||
char flag_name[TOKEN_LENGTH];
|
||||
int flag_list;
|
||||
} obj_flag_name;
|
||||
@@ -148,7 +122,7 @@ public:
|
||||
int parent_sig; // This object's parent's signature
|
||||
char parent_type; // This object's parent's type
|
||||
int instance; // which instance. ie.. if type is Robot, then this indexes into the Robots array
|
||||
uint flags; // misc flags. Call obj_set_flags to change this.
|
||||
flagset<Object::Object_Flags> flags; // misc flags. Call obj_set_flags to change this.
|
||||
vec3d pos; // absolute x,y,z coordinate of center of object
|
||||
matrix orient; // orientation of object in world
|
||||
float radius; // 3d size of object - for collision detection
|
||||
@@ -194,14 +168,17 @@ typedef struct object_orient_pos {
|
||||
} object_orient_pos;
|
||||
|
||||
#ifdef OBJECT_CHECK
|
||||
typedef struct checkobject
|
||||
class checkobject
|
||||
{
|
||||
public:
|
||||
int type;
|
||||
int signature;
|
||||
uint flags;
|
||||
flagset<Object::Object_Flags> flags;
|
||||
int parent_sig;
|
||||
int parent_type;
|
||||
} checkobject;
|
||||
|
||||
checkobject();
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -246,7 +223,7 @@ void obj_init();
|
||||
//object. Returns 0 if failed, otherwise object index.
|
||||
//You can pass 0 for parent if you don't care about that.
|
||||
//You can pass null for orient and/or pos if you don't care.
|
||||
int obj_create(ubyte type,int parent_obj, int instance, matrix * orient, vec3d * pos, float radius, uint flags );
|
||||
int obj_create(ubyte type,int parent_obj, int instance, matrix * orient, vec3d * pos, float radius, const flagset<Object::Object_Flags> &flags );
|
||||
|
||||
void obj_render(object* obj);
|
||||
|
||||
@@ -268,7 +245,7 @@ void obj_delete(int objnum);
|
||||
void obj_merge_created_list(void);
|
||||
|
||||
// recalculate object pairs for an object
|
||||
#define OBJ_RECALC_PAIRS(obj_to_reset) do { obj_set_flags(obj_to_reset, obj_to_reset->flags & ~(OF_COLLIDES)); obj_set_flags(obj_to_reset, obj_to_reset->flags | OF_COLLIDES); } while(0);
|
||||
#define OBJ_RECALC_PAIRS(obj_to_reset) do { obj_set_flags(obj_to_reset, obj_to_reset->flags - Object::Object_Flags::Collides); obj_set_flags(obj_to_reset, obj_to_reset->flags + Object::Object_Flags::Collides); } while(0);
|
||||
|
||||
// Removes any occurances of object 'a' from the pairs list.
|
||||
void obj_remove_pairs( object * a );
|
||||
@@ -307,11 +284,7 @@ void obj_player_fire_stuff( object *objp, control_info ci );
|
||||
// actually turn the object collision detection off. By calling
|
||||
// this you shouldn't get Int3's in the checkobject code. If you
|
||||
// do, then put code in here to correctly handle the case.
|
||||
void obj_set_flags(object *obj, uint new_flags);
|
||||
|
||||
// get the Ship_info flags for a given ship (if you have the object)
|
||||
int obj_get_SIF(object *objp);
|
||||
int obj_get_SIF(int obj);
|
||||
void obj_set_flags(object *obj, const flagset<Object::Object_Flags>& new_flags);
|
||||
|
||||
// get the team for any object
|
||||
int obj_team(object *objp);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef OBJECT_FLAGS_H
|
||||
#define OBJECT_FLAGS_H
|
||||
|
||||
#include "globalincs/flagset.h"
|
||||
|
||||
namespace Object {
|
||||
FLAG_LIST(Object_Flags) {
|
||||
Renders, // It renders as something ( objtype_render gets called)
|
||||
Collides, // It collides with stuff (objtype_check_impact & objtype_hit gets called)
|
||||
Physics, // It moves with standard physics.
|
||||
Should_be_dead, // this object should be dead, so next time we can, we should delete this object.
|
||||
Invulnerable, // invulnerable
|
||||
Protected, // Don't kill this object, probably mission-critical.
|
||||
Player_ship, // this object under control of some player -- don't do ai stuff on it!!!
|
||||
No_shields, // object has no shield generator system (i.e. no shields)
|
||||
Just_updated, // for multiplayer -- indicates that we received object update this frame
|
||||
Could_be_player, // for multiplayer -- indicates that it is selectable ingame joiners as their ship
|
||||
Was_rendered, // Set if this object was rendered this frame. Only gets set if OF_RENDERS set. Gets cleared or set in obj_render_all().
|
||||
Not_in_coll, // object has not been added to collision list
|
||||
Beam_protected, // don't fire beam weapons at this type of object, probably mission critical.
|
||||
Special_warpin, // Object has special warp-in enabled.
|
||||
Docked_already_handled, // Goober5000 - a docked object that we already moved
|
||||
Targetable_as_bomb,
|
||||
Flak_protected, // Goober5000 - protected from flak turrets
|
||||
Laser_protected, // Goober5000 - protected from laser turrets
|
||||
Missile_protected, // Goober5000 - protected from missile turrets
|
||||
Immobile, // Goober5000 - doesn't move, no matter what
|
||||
Marked, // Object is marked (Fred). Can be reused in FreeSpace for anything that won't be used by Fred.
|
||||
Temp_marked, // Temporarily marked (Fred).
|
||||
Hidden, // Object is hidden (not shown) and can't be manipulated
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -377,7 +377,7 @@ void dock_move_docked_objects(object *objp)
|
||||
return;
|
||||
|
||||
// has this object (by extension, this group of docked objects) been handled already?
|
||||
if (objp->flags & OF_DOCKED_ALREADY_HANDLED)
|
||||
if (objp->flags[Object::Object_Flags::Docked_already_handled])
|
||||
return;
|
||||
|
||||
Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS));
|
||||
@@ -414,11 +414,11 @@ void dock_move_docked_objects(object *objp)
|
||||
void dock_move_docked_children_tree(object *objp, object *parent_objp)
|
||||
{
|
||||
// has this object been handled already?
|
||||
if (objp->flags & OF_DOCKED_ALREADY_HANDLED)
|
||||
if (objp->flags[Object::Object_Flags::Docked_already_handled])
|
||||
return;
|
||||
|
||||
// mark as handled
|
||||
objp->flags |= OF_DOCKED_ALREADY_HANDLED;
|
||||
objp->flags.set(Object::Object_Flags::Docked_already_handled);
|
||||
|
||||
// if parent_objp exists
|
||||
if (parent_objp != NULL)
|
||||
@@ -646,7 +646,7 @@ bool dock_check_assume_hub()
|
||||
// evaluation fail.
|
||||
|
||||
// Assume level 2 optimization unless the mission specifies level 3.
|
||||
return !(The_mission.flags & MISSION_FLAG_ALLOW_DOCK_TREES);
|
||||
return !(The_mission.flags[Mission::Mission_Flags::Allow_dock_trees]);
|
||||
}
|
||||
|
||||
object *dock_get_hub(object *objp)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
float shield_get_strength(object *objp)
|
||||
{
|
||||
// no shield system, no strength!
|
||||
if (objp->flags & OF_NO_SHIELDS)
|
||||
if (objp->flags[Object::Object_Flags::No_shields])
|
||||
return 0.0f;
|
||||
|
||||
int i;
|
||||
@@ -135,7 +135,7 @@ float scale_quad(float generator_fraction, float quad_strength)
|
||||
float shield_get_quad(object *objp, int quadrant_num)
|
||||
{
|
||||
// no shield system, no strength!
|
||||
if (objp->flags & OF_NO_SHIELDS)
|
||||
if (objp->flags[Object::Object_Flags::No_shields])
|
||||
return 0.0f;
|
||||
|
||||
// check array bounds
|
||||
|
||||
@@ -426,7 +426,7 @@ void maybe_play_flyby_snd(float closest_dist, object *closest_objp, object *list
|
||||
ship_info *sip = &Ship_info[Ships[closest_objp->instance].ship_info_index];
|
||||
game_snd *snd;
|
||||
|
||||
if (sip->flags & SIF_BOMBER)
|
||||
if (sip->flags[Ship::Info_Flags::Bomber])
|
||||
snd = &Species_info[sip->species].snd_flyby_bomber;
|
||||
else
|
||||
snd = &Species_info[sip->species].snd_flyby_fighter;
|
||||
@@ -514,7 +514,7 @@ void obj_snd_do_frame()
|
||||
|
||||
// save closest distance (used for flyby sound) if this is a small ship (and not the observer)
|
||||
if ( (objp->type == OBJ_SHIP) && (distance < closest_dist) && (objp != observer_obj) ) {
|
||||
if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP ) {
|
||||
if ( Ship_info[Ships[objp->instance].ship_info_index].is_small_ship() ) {
|
||||
closest_dist = distance;
|
||||
closest_objp = objp;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ void obj_snd_do_frame()
|
||||
alive_vol_mult = 1.0f;
|
||||
if ( objp->type == OBJ_SHIP ) {
|
||||
ship_info *sip = &Ship_info[Ships[objp->instance].ship_info_index];
|
||||
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( !(sip->is_big_or_huge()) ) {
|
||||
if ( objp->phys_info.max_vel.xyz.z <= 0.0f ) {
|
||||
percent_max = 0.0f;
|
||||
}
|
||||
@@ -664,7 +664,7 @@ void obj_snd_do_frame()
|
||||
channel = ds_get_channel(osp->instance);
|
||||
// for DirectSound3D sounds, re-establish the maximum speed based on the
|
||||
// speed_vol_multiplier
|
||||
if ( sp == NULL || ( (sp != NULL) && (sp->flags & SF_ENGINES_ON) ) ) {
|
||||
if ( sp == NULL || ( (sp != NULL) && (sp->flags[Ship::Ship_Flags::Engines_on]) ) ) {
|
||||
snd_set_volume( osp->instance, gs->default_volume*speed_vol_multiplier*rot_vol_mult*alive_vol_mult );
|
||||
}
|
||||
else {
|
||||
@@ -676,7 +676,7 @@ void obj_snd_do_frame()
|
||||
|
||||
// Don't play doppler effect for cruisers or capitals
|
||||
if ( sp ) {
|
||||
if ( ship_get_SIF(sp) & (SIF_BIG_SHIP | SIF_HUGE_SHIP) ) {
|
||||
if ( Ship_info[sp->ship_info_index].is_big_or_huge() ) {
|
||||
vel = vmd_zero_vector;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -180,8 +180,8 @@ void obj_render_all(void (*render_function)(object *objp), bool *draw_viewer_las
|
||||
objp = Objects;
|
||||
|
||||
for (i=0;i<=Highest_object_index;i++,objp++) {
|
||||
if ( (objp->type != OBJ_NONE) && (objp->flags&OF_RENDERS) ) {
|
||||
objp->flags &= ~OF_WAS_RENDERED;
|
||||
if ( (objp->type != OBJ_NONE) && (objp->flags[Object::Object_Flags::Renders]) ) {
|
||||
objp->flags.remove(Object::Object_Flags::Was_rendered);
|
||||
|
||||
if ( obj_in_view_cone(objp) ) {
|
||||
sorted_obj osp;
|
||||
@@ -239,7 +239,7 @@ void obj_render_all(void (*render_function)(object *objp), bool *draw_viewer_las
|
||||
|
||||
Interp_no_flush = 1;
|
||||
|
||||
bool full_neb = ((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE) && !Fred_running);
|
||||
bool full_neb = ((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE) && !Fred_running);
|
||||
bool c_viewer = (!Viewer_mode || (Viewer_mode & VM_PADLOCK_ANY) || (Viewer_mode & VM_OTHER_SHIP) || (Viewer_mode & VM_TRACK));
|
||||
|
||||
// now draw them
|
||||
@@ -248,13 +248,13 @@ void obj_render_all(void (*render_function)(object *objp), bool *draw_viewer_las
|
||||
for (os = Sorted_objects.begin(); os != Sorted_objects.end(); ++os) {
|
||||
object *obj = os->obj;
|
||||
|
||||
obj->flags |= OF_WAS_RENDERED;
|
||||
obj->flags.set(Object::Object_Flags::Was_rendered);
|
||||
|
||||
//This is for ship cockpits. Bobb, feel free to optimize this any way you see fit
|
||||
if ( (obj == Viewer_obj)
|
||||
&& (obj->type == OBJ_SHIP)
|
||||
&& c_viewer
|
||||
&& (Ship_info[Ships[obj->instance].ship_info_index].flags2 & SIF2_SHOW_SHIP_MODEL) )
|
||||
&& (Ship_info[Ships[obj->instance].ship_info_index].flags[Ship::Info_Flags::Show_ship_model]) )
|
||||
{
|
||||
(*draw_viewer_last) = true;
|
||||
continue;
|
||||
@@ -300,13 +300,13 @@ void obj_render_all(void (*render_function)(object *objp), bool *draw_viewer_las
|
||||
for (os = Sorted_objects.begin(); os != Sorted_objects.end(); ++os) {
|
||||
object *obj = os->obj;
|
||||
|
||||
obj->flags |= OF_WAS_RENDERED;
|
||||
obj->flags.set(Object::Object_Flags::Was_rendered);
|
||||
|
||||
if ( obj_render_is_model(obj) )
|
||||
continue;
|
||||
|
||||
// if we're fullneb, fire up the fog - this also generates a fog table
|
||||
if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE) && !Fred_running){
|
||||
if((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE) && !Fred_running){
|
||||
// get the fog values
|
||||
neb2_get_adjusted_fog_values(&fog_near, &fog_far, obj);
|
||||
|
||||
@@ -332,7 +332,7 @@ void obj_render_all(void (*render_function)(object *objp), bool *draw_viewer_las
|
||||
batch_render_man_thrusters();
|
||||
|
||||
// if we're fullneb, switch off the fog effet
|
||||
if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE)){
|
||||
if((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE)){
|
||||
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -352,14 +352,14 @@ void obj_render_queue_all()
|
||||
scene.init();
|
||||
|
||||
for ( i = 0; i <= Highest_object_index; i++,objp++ ) {
|
||||
if ( (objp->type != OBJ_NONE) && ( objp->flags & OF_RENDERS ) ) {
|
||||
objp->flags &= ~OF_WAS_RENDERED;
|
||||
if ( (objp->type != OBJ_NONE) && ( objp->flags [Object::Object_Flags::Renders] ) ) {
|
||||
objp->flags.remove(Object::Object_Flags::Was_rendered);
|
||||
|
||||
if ( !obj_in_view_cone(objp) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( (The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE) && !Fred_running ) {
|
||||
if ( (The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE) && !Fred_running ) {
|
||||
vec3d to_obj;
|
||||
vm_vec_sub( &to_obj, &objp->pos, &Eye_position );
|
||||
float z = vm_vec_dot( &Eye_matrix.vec.fvec, &to_obj );
|
||||
@@ -375,7 +375,7 @@ void obj_render_queue_all()
|
||||
}
|
||||
}
|
||||
|
||||
objp->flags |= OF_WAS_RENDERED;
|
||||
objp->flags.set(Object::Object_Flags::Was_rendered);
|
||||
profile_begin("Queue Render");
|
||||
obj_queue_render(objp, &scene);
|
||||
profile_end("Queue Render");
|
||||
@@ -426,7 +426,7 @@ void obj_render_queue_all()
|
||||
batch_render_man_thrusters();
|
||||
|
||||
// if we're fullneb, switch off the fog effet
|
||||
if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE)){
|
||||
if((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE)){
|
||||
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ void dock_dock_docked_objects(p_object *objp)
|
||||
return;
|
||||
|
||||
// has this object (by extension, this group of docked objects) been handled already?
|
||||
if (objp->flags2 & P2_ALREADY_HANDLED)
|
||||
if (objp->flags[Mission::Parse_Object_Flags::Already_handled])
|
||||
return;
|
||||
|
||||
Assert(objp->flags & P_SF_DOCK_LEADER);
|
||||
Assert(objp->flags[Mission::Parse_Object_Flags::SF_Dock_leader]);
|
||||
|
||||
p_dock_function_info dfi;
|
||||
|
||||
@@ -189,11 +189,11 @@ void dock_dock_docked_objects(p_object *objp)
|
||||
void dock_dock_docked_children_tree(p_object *objp, p_object *parent_objp)
|
||||
{
|
||||
// has this object been handled already?
|
||||
if (objp->flags2 & P2_ALREADY_HANDLED)
|
||||
if (objp->flags[Mission::Parse_Object_Flags::Already_handled])
|
||||
return;
|
||||
|
||||
// mark as handled
|
||||
objp->flags2 |= P2_ALREADY_HANDLED;
|
||||
objp->flags.set(Mission::Parse_Object_Flags::Already_handled);
|
||||
|
||||
// if parent_objp exists
|
||||
if (parent_objp != NULL)
|
||||
|
||||
@@ -139,7 +139,9 @@ void waypoint_create_game_object(waypoint *wpt, int list_index, int wpt_index)
|
||||
Assert(wpt != NULL);
|
||||
Assert(list_index >= 0);
|
||||
Assert(wpt_index >= 0);
|
||||
wpt->objnum = obj_create(OBJ_WAYPOINT, -1, calc_waypoint_instance(list_index, wpt_index), NULL, wpt->get_pos(), 0.0f, OF_RENDERS);
|
||||
flagset<Object::Object_Flags> default_flags;
|
||||
default_flags.set(Object::Object_Flags::Renders);
|
||||
wpt->objnum = obj_create(OBJ_WAYPOINT, -1, calc_waypoint_instance(list_index, wpt_index), NULL, wpt->get_pos(), 0.0f, default_flags);
|
||||
}
|
||||
|
||||
// done immediately after mission load; originally found in aicode.cpp
|
||||
|
||||
@@ -46,14 +46,15 @@ int observer_create(matrix *orient, vec3d *pos)
|
||||
}
|
||||
|
||||
// attempt to create the object
|
||||
objnum = obj_create(OBJ_OBSERVER,-1,idx,orient,pos,1.0f,0);
|
||||
flagset<Object::Object_Flags> default_flagset;
|
||||
objnum = obj_create(OBJ_OBSERVER,-1,idx,orient,pos,1.0f, default_flagset);
|
||||
|
||||
// fail situation
|
||||
if(objnum == -1)
|
||||
return -1;
|
||||
|
||||
// give the observer Descent style physics
|
||||
Objects[objnum].flags |= OF_PHYSICS;
|
||||
Objects[objnum].flags.set(Object::Object_Flags::Physics);
|
||||
physics_init(&Objects[objnum].phys_info);
|
||||
pi = &Objects[objnum].phys_info;
|
||||
pi->flags |= PF_ACCELERATES | PF_SLIDE_ENABLED;
|
||||
|
||||
+22
-46
@@ -6411,9 +6411,9 @@ ADE_FUNC(isInTechroom, l_Shipclass, NULL, "Gets whether or not the ship class is
|
||||
return ade_set_error(L, "b", false);
|
||||
|
||||
bool b = false;
|
||||
if(Player != NULL && (Player->flags & PLAYER_FLAGS_IS_MULTI) && (Ship_info[idx].flags & SIF_IN_TECH_DATABASE_M)) {
|
||||
if(Player != NULL && (Player->flags & PLAYER_FLAGS_IS_MULTI) && (Ship_info[idx].flags[Ship::Info_Flags::In_tech_database_m])) {
|
||||
b = true;
|
||||
} else if(Ship_info[idx].flags & SIF_IN_TECH_DATABASE) {
|
||||
} else if(Ship_info[idx].flags[Ship::Info_Flags::In_tech_database]) {
|
||||
b = true;
|
||||
}
|
||||
|
||||
@@ -6485,7 +6485,7 @@ ADE_FUNC(renderTechModel, l_Shipclass, "X1, Y1, X2, Y2, [Rotation %=0, Pitch %=0
|
||||
|
||||
uint render_flags = MR_AUTOCENTER | MR_NO_FOGGING;
|
||||
|
||||
if(sip->flags2 & SIF2_NO_LIGHTING)
|
||||
if(sip->flags[Ship::Info_Flags::No_lighting])
|
||||
render_flags |= MR_NO_LIGHTING;
|
||||
|
||||
render_info.set_flags(render_flags);
|
||||
@@ -6558,7 +6558,7 @@ ADE_FUNC(renderTechModel2, l_Shipclass, "X1, Y1, X2, Y2, [orientation Orientatio
|
||||
|
||||
uint render_flags = MR_AUTOCENTER | MR_NO_FOGGING;
|
||||
|
||||
if(sip->flags2 & SIF2_NO_LIGHTING)
|
||||
if(sip->flags[Ship::Info_Flags::No_lighting])
|
||||
render_flags |= MR_NO_LIGHTING;
|
||||
|
||||
render_info.set_flags(render_flags);
|
||||
@@ -7173,13 +7173,10 @@ ADE_VIRTVAR(Linked, l_WeaponBankType, "boolean", "Whether bank is in linked or u
|
||||
{
|
||||
case SWH_PRIMARY:
|
||||
if(ADE_SETTING_VAR && numargs > 1) {
|
||||
if(newlink)
|
||||
Ships[bh->objp->instance].flags |= SF_PRIMARY_LINKED;
|
||||
else
|
||||
Ships[bh->objp->instance].flags &= ~SF_PRIMARY_LINKED;
|
||||
Ships[bh->objp->instance].flags.set(Ship::Ship_Flags::Primary_linked, newlink);
|
||||
}
|
||||
|
||||
return ade_set_args(L, "b", (Ships[bh->objp->instance].flags & SF_PRIMARY_LINKED) > 0);
|
||||
return ade_set_args(L, "b", (Ships[bh->objp->instance].flags[Ship::Ship_Flags::Primary_linked]));
|
||||
|
||||
case SWH_SECONDARY:
|
||||
case SWH_TERTIARY:
|
||||
@@ -7205,13 +7202,10 @@ ADE_VIRTVAR(DualFire, l_WeaponBankType, "boolean", "Whether bank is in dual fire
|
||||
{
|
||||
case SWH_SECONDARY:
|
||||
if(ADE_SETTING_VAR && numargs > 1) {
|
||||
if(newfire)
|
||||
Ships[bh->objp->instance].flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
else
|
||||
Ships[bh->objp->instance].flags &= ~SF_SECONDARY_DUAL_FIRE;
|
||||
Ships[bh->objp->instance].flags.set(Ship::Ship_Flags::Secondary_dual_fire, newfire);
|
||||
}
|
||||
|
||||
return ade_set_args(L, "b", (Ships[bh->objp->instance].flags & SF_SECONDARY_DUAL_FIRE) > 0);
|
||||
return ade_set_args(L, "b", (Ships[bh->objp->instance].flags[Ship::Ship_Flags::Secondary_dual_fire]));
|
||||
|
||||
case SWH_PRIMARY:
|
||||
case SWH_TERTIARY:
|
||||
@@ -9564,12 +9558,12 @@ ADE_VIRTVAR(PrimaryTriggerDown, l_Ship, "boolean", "Determines if primary trigge
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(trig)
|
||||
shipp->flags |= SF_TRIGGER_DOWN;
|
||||
shipp->flags.set(Ship::Ship_Flags::Trigger_down);
|
||||
else
|
||||
shipp->flags &= ~SF_TRIGGER_DOWN;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Trigger_down);
|
||||
}
|
||||
|
||||
if (shipp->flags & SF_TRIGGER_DOWN)
|
||||
if (shipp->flags[Ship::Ship_Flags::Trigger_down])
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
@@ -9817,13 +9811,10 @@ ADE_VIRTVAR(FlagAffectedByGravity, l_Ship, "boolean", "Checks for the \"affected
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(set)
|
||||
shipp->flags2 |= SF2_AFFECTED_BY_GRAVITY;
|
||||
else
|
||||
shipp->flags2 &= ~SF2_AFFECTED_BY_GRAVITY;
|
||||
shipp->flags.set(Ship::Ship_Flags::Affected_by_gravity, set);
|
||||
}
|
||||
|
||||
if (shipp->flags2 & SF2_AFFECTED_BY_GRAVITY)
|
||||
if (shipp->flags[Ship::Ship_Flags::Affected_by_gravity])
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
@@ -9845,19 +9836,18 @@ ADE_VIRTVAR(Disabled, l_Ship, "boolean", "The disabled state of this ship", "boo
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
shipp->flags.set(Ship::Ship_Flags::Disabled, set);
|
||||
if(set)
|
||||
{
|
||||
mission_log_add_entry(LOG_SHIP_DISABLED, shipp->ship_name, NULL );
|
||||
shipp->flags |= SF_DISABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
shipp->flags &= ~SF_DISABLED;
|
||||
ship_reset_disabled_physics( &Objects[shipp->objnum], shipp->ship_info_index );
|
||||
}
|
||||
}
|
||||
|
||||
if (shipp->flags & SF_DISABLED)
|
||||
if (shipp->flags[Ship::Ship_Flags::Disabled])
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
@@ -9878,17 +9868,10 @@ ADE_VIRTVAR(Stealthed, l_Ship, "boolean", "Stealth status of this ship", "boolea
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(stealthed)
|
||||
{
|
||||
shipp->flags2 &= ~SF2_STEALTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
shipp->flags2 |= SF2_STEALTH;
|
||||
}
|
||||
shipp->flags.set(Ship::Ship_Flags::Stealth, stealthed);
|
||||
}
|
||||
|
||||
if (shipp->flags2 & SF2_STEALTH)
|
||||
if (shipp->flags[Ship::Ship_Flags::Stealth])
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
@@ -9909,17 +9892,10 @@ ADE_VIRTVAR(HiddenFromSensors, l_Ship, "boolean", "Hidden from sensors status of
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(hidden)
|
||||
{
|
||||
shipp->flags &= ~SF_HIDDEN_FROM_SENSORS;
|
||||
}
|
||||
else
|
||||
{
|
||||
shipp->flags |= SF_HIDDEN_FROM_SENSORS;
|
||||
}
|
||||
shipp->flags.set(Ship::Ship_Flags::Hidden_from_sensors, hidden);
|
||||
}
|
||||
|
||||
if (shipp->flags & SF_HIDDEN_FROM_SENSORS)
|
||||
if (shipp->flags[Ship::Ship_Flags::Hidden_from_sensors])
|
||||
return ADE_RETURN_TRUE;
|
||||
else
|
||||
return ADE_RETURN_FALSE;
|
||||
@@ -10081,7 +10057,7 @@ ADE_FUNC(hasShipExploded, l_Ship, NULL, "Checks if the ship explosion event has
|
||||
|
||||
ship *shipp = &Ships[shiph->objp->instance];
|
||||
|
||||
if (shipp->flags & SF_DYING) {
|
||||
if (shipp->flags[Ship::Ship_Flags::Dying]) {
|
||||
if (shipp->final_death_time == 0) {
|
||||
return ade_set_args(L, "i", 2);
|
||||
}
|
||||
@@ -10557,7 +10533,7 @@ ADE_FUNC(canWarp, l_Ship, NULL, "Checks whether ship has a working subspace driv
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
ship *shipp = &Ships[objh->objp->instance];
|
||||
if(shipp->flags & SF2_NO_SUBSPACE_DRIVE){
|
||||
if(shipp->flags[Ship::Ship_Flags::No_subspace_drive]){
|
||||
return ADE_RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -10575,7 +10551,7 @@ ADE_FUNC(isWarpingIn, l_Ship, NULL, "Checks if ship is warping in", "boolean", "
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
ship *shipp = &Ships[objh->objp->instance];
|
||||
if(shipp->flags & SF_ARRIVING_STAGE_1){
|
||||
if(shipp->flags[Ship::Ship_Flags::Arriving_stage_1]){
|
||||
return ADE_RETURN_TRUE;
|
||||
}
|
||||
|
||||
|
||||
+20
-1
@@ -2329,6 +2329,25 @@ int atoi2()
|
||||
|
||||
}
|
||||
|
||||
long atol2()
|
||||
{
|
||||
char ch;
|
||||
|
||||
my_errno = 0;
|
||||
|
||||
ignore_white_space();
|
||||
|
||||
ch = *Mp;
|
||||
|
||||
if ((ch != '-') && (ch != '+') && ((ch < '0') || (ch > '9'))) {
|
||||
error_display(1, "Expecting long, found [%.32s].\n", next_tokens());
|
||||
my_errno = 1;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return atol(Mp);
|
||||
}
|
||||
|
||||
// Stuff a floating point value pointed at by Mp.
|
||||
// Advances past float characters.
|
||||
void stuff_float(float *f)
|
||||
@@ -2950,7 +2969,7 @@ int stuff_loadout_list (int *ilp, int max_ints, int lookup_type)
|
||||
}
|
||||
|
||||
// similarly, complain if this is a valid ship or weapon class that the player can't use
|
||||
if ((lookup_type == MISSION_LOADOUT_SHIP_LIST) && (!(Ship_info[index].flags & SIF_PLAYER_SHIP)) ) {
|
||||
if ((lookup_type == MISSION_LOADOUT_SHIP_LIST) && (!(Ship_info[index].flags[Ship::Info_Flags::Player_ship])) ) {
|
||||
clean_loadout_list_entry();
|
||||
Warning(LOCATION, "Ship type \"%s\" found in loadout of mission file. This class is not marked as a player ship...skipping", str);
|
||||
continue;
|
||||
|
||||
@@ -142,6 +142,63 @@ extern void stuff_ubyte(ubyte *i);
|
||||
extern int stuff_string_list(SCP_vector<SCP_string>& slp);
|
||||
extern int stuff_string_list(char slp[][NAME_LENGTH], int max_strings);
|
||||
extern int parse_string_flag_list(int *dest, flag_def_list defs[], int defs_size);
|
||||
|
||||
|
||||
// A templated version of parse_string_flag_list, to go along with the templated flag_def_list_new.
|
||||
// If the "is_special" flag is set, or a string was not found in the def list, it will be added to the unparsed_or_special_strings Vector
|
||||
// so that you can process it properly later
|
||||
template<class Flags, class Flagset>
|
||||
int parse_string_flag_list(Flagset *dest, flag_def_list_new<Flags> defs[], size_t n_defs, SCP_vector<SCP_string>* unparsed_or_special_strings)
|
||||
{
|
||||
|
||||
Assert(dest != NULL);
|
||||
|
||||
char(*slp)[NAME_LENGTH] = (char(*)[32])new char[n_defs*NAME_LENGTH];
|
||||
size_t num_strings = stuff_string_list(slp, n_defs);
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < num_strings; i++)
|
||||
{
|
||||
bool string_parsed = false;
|
||||
for (j = 0; j < n_defs; j++)
|
||||
{
|
||||
if (!stricmp(slp[i], defs[j].name)) {
|
||||
if (defs[j].def != Flags::NUM_VALUES)
|
||||
dest->set(defs[j].def);
|
||||
|
||||
if (!defs[j].is_special)
|
||||
string_parsed = true;
|
||||
}
|
||||
}
|
||||
if (!string_parsed && unparsed_or_special_strings != NULL) {
|
||||
SCP_string s = SCP_string(slp[i]);
|
||||
unparsed_or_special_strings->push_back(s);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] slp; //>_>
|
||||
//nobody saw that right
|
||||
|
||||
return num_strings;
|
||||
}
|
||||
|
||||
extern long atol2();
|
||||
extern int my_errno;
|
||||
template<class Flagset>
|
||||
void stuff_flagset(Flagset *dest) {
|
||||
dest->from_long(atol2());
|
||||
|
||||
if (my_errno)
|
||||
skip_token();
|
||||
else
|
||||
Mp += strspn(Mp, "+-0123456789");
|
||||
|
||||
if (*Mp == ',')
|
||||
Mp++;
|
||||
|
||||
diag_printf("Stuffed flagset: %i\n", dest->to_long());
|
||||
}
|
||||
|
||||
extern int stuff_int_list(int *ilp, int max_ints, int lookup_type = RAW_INTEGER_TYPE);
|
||||
extern size_t stuff_float_list(float* flp, size_t max_floats);
|
||||
extern int stuff_vec3d_list(vec3d *vlp, int max_vecs);
|
||||
|
||||
@@ -343,7 +343,7 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data)
|
||||
if (!(primary || secondary))
|
||||
return false;
|
||||
|
||||
if ((shipp->flags & SF_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_flags3 & WIF3_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 & SF_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_flags3 & WIF3_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 & SF_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_flags3 & WIF3_NOLINK))
|
||||
return false;
|
||||
|
||||
return more_data == 1 ? primary : secondary;
|
||||
|
||||
+207
-426
File diff suppressed because it is too large.
Load diff
+10
-10
@@ -431,7 +431,7 @@ void pilotfile::csg_read_techroom()
|
||||
|
||||
if (visible) {
|
||||
if (ship_list[idx].index >= 0) {
|
||||
Ship_info[ship_list[idx].index].flags |= SIF_IN_TECH_DATABASE;
|
||||
Ship_info[ship_list[idx].index].flags.set(Ship::Info_Flags::In_tech_database);
|
||||
} else {
|
||||
m_data_invalid = true;
|
||||
}
|
||||
@@ -480,16 +480,16 @@ void pilotfile::csg_write_techroom()
|
||||
startSection(Section::Techroom);
|
||||
|
||||
// visible ships
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
|
||||
// only visible if not in techroom by default
|
||||
if ( (it->flags & SIF_IN_TECH_DATABASE) && !(it->flags2 & SIF2_DEFAULT_IN_TECH_DATABASE) ) {
|
||||
visible = 1;
|
||||
} else {
|
||||
visible = 0;
|
||||
}
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
|
||||
if ((it->flags[Ship::Info_Flags::In_tech_database]) && !(it->flags[Ship::Info_Flags::Default_in_tech_database])) {
|
||||
visible = 1;
|
||||
}
|
||||
else {
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
cfwrite_ubyte(visible, cfp);
|
||||
}
|
||||
cfwrite_ubyte(visible, cfp);
|
||||
}
|
||||
|
||||
// visible weapons
|
||||
for (idx = 0; idx < Num_weapon_types; idx++) {
|
||||
|
||||
@@ -729,7 +729,7 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
|
||||
if (check_control(AFTERBURNER) && !Player_use_ai) {
|
||||
if (!afterburner_last) {
|
||||
Assert(Player_ship);
|
||||
if ( !(Ship_info[Player_ship->ship_info_index].flags & SIF_AFTERBURNER) ) {
|
||||
if ( !(Ship_info[Player_ship->ship_info_index].flags[Ship::Info_Flags::Afterburner]) ) {
|
||||
gamesnd_play_error_beep();
|
||||
} else {
|
||||
ci->afterburner_start = 1;
|
||||
@@ -766,7 +766,7 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
|
||||
}
|
||||
|
||||
// if the player is warping out, cancel gliding
|
||||
if (Player_ship->flags & SF_DEPART_WARP) {
|
||||
if (Player_ship->flags[Ship::Ship_Flags::Depart_warp]) {
|
||||
toggle_glide = 0;
|
||||
press_glide = 0;
|
||||
}
|
||||
@@ -898,7 +898,7 @@ void read_player_controls(object *objp, float frametime)
|
||||
target_warpout_speed = ship_get_warpout_speed(objp);
|
||||
|
||||
// check if warp ability has been disabled
|
||||
if (!(Warpout_forced) && Ships[objp->instance].flags & ( SF_WARP_BROKEN|SF_WARP_NEVER ) ) {
|
||||
if (!(Warpout_forced) && (Ships[objp->instance].flags[Ship::Ship_Flags::Warp_broken] || Ships[objp->instance].flags[Ship::Ship_Flags::Warp_never]) ) {
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Cannot warp out at this time.", 81));
|
||||
snd_play(&Snds[SND_PLAYER_WARP_FAIL]);
|
||||
gameseq_post_event( GS_EVENT_PLAYER_WARPOUT_STOP );
|
||||
@@ -952,7 +952,7 @@ void read_player_controls(object *objp, float frametime)
|
||||
if(Player_obj->type == OBJ_SHIP && !Player_use_ai){
|
||||
// only read player control info if player ship is not dead
|
||||
// or if Player_use_ai is disabed
|
||||
if ( !(Ships[Player_obj->instance].flags & SF_DYING) ) {
|
||||
if ( !(Ships[Player_obj->instance].flags[Ship::Ship_Flags::Dying]) ) {
|
||||
vec3d wash_rot;
|
||||
if ((Ships[objp->instance].wash_intensity > 0) && !((Player->control_mode == PCM_WARPOUT_STAGE1) || (Player->control_mode == PCM_WARPOUT_STAGE2) || (Player->control_mode == PCM_WARPOUT_STAGE3)) ) {
|
||||
float intensity = 0.3f * MIN(Ships[objp->instance].wash_intensity, 1.0f);
|
||||
@@ -1147,12 +1147,12 @@ void player_save_target_and_weapon_link_prefs()
|
||||
|
||||
// if we're in multiplayer mode don't do this because we will desync ourselves with the server
|
||||
if(!(Game_mode & GM_MULTIPLAYER)){
|
||||
if ( Player_ship->flags & SF_PRIMARY_LINKED ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Primary_linked] ) {
|
||||
Player->save_flags |= PLAYER_FLAGS_LINK_PRIMARY;
|
||||
} else {
|
||||
Player->flags &= ~PLAYER_FLAGS_LINK_PRIMARY;
|
||||
}
|
||||
if ( Player_ship->flags & SF_SECONDARY_DUAL_FIRE ) {
|
||||
if ( Player_ship->flags[Ship::Ship_Flags::Secondary_dual_fire] ) {
|
||||
Player->save_flags |= PLAYER_FLAGS_LINK_SECONDARY;
|
||||
} else {
|
||||
Player->flags &= ~PLAYER_FLAGS_LINK_SECONDARY;
|
||||
@@ -1174,14 +1174,14 @@ void player_restore_target_and_weapon_link_prefs()
|
||||
Player->flags |= Player->save_flags;
|
||||
}
|
||||
|
||||
if ( Player->flags & PLAYER_FLAGS_LINK_PRIMARY && !(player_sip->flags2 & SIF2_NO_PRIMARY_LINKING) ) {
|
||||
if ( Player->flags & PLAYER_FLAGS_LINK_PRIMARY && !(player_sip->flags[Ship::Info_Flags::No_primary_linking]) ) {
|
||||
if ( Player_ship->weapons.num_primary_banks > 1 ) {
|
||||
Player_ship->flags |= SF_PRIMARY_LINKED;
|
||||
Player_ship->flags.set(Ship::Ship_Flags::Primary_linked);
|
||||
}
|
||||
}
|
||||
|
||||
if ( Player->flags & PLAYER_FLAGS_LINK_SECONDARY && (pm->n_missiles > 0 && pm->missile_banks[0].num_slots > 1) ) {
|
||||
Player_ship->flags |= SF_SECONDARY_DUAL_FIRE;
|
||||
Player_ship->flags.set(Ship::Ship_Flags::Secondary_dual_fire);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1419,8 +1419,8 @@ int player_inspect_cargo(float frametime, char *outstr)
|
||||
cargo_sip = &Ship_info[cargo_sp->ship_info_index];
|
||||
|
||||
// Goober5000 - possibly swap cargo scan behavior
|
||||
scan_subsys = (cargo_sip->flags & SIF_HUGE_SHIP);
|
||||
if (cargo_sp->flags2 & SF2_TOGGLE_SUBSYSTEM_SCANNING)
|
||||
scan_subsys = cargo_sip->is_huge_ship();
|
||||
if (cargo_sp->flags[Ship::Ship_Flags::Toggle_subsystem_scanning])
|
||||
scan_subsys = !scan_subsys;
|
||||
if (scan_subsys)
|
||||
return player_inspect_cap_subsys_cargo(frametime, outstr);
|
||||
@@ -1433,17 +1433,17 @@ int player_inspect_cargo(float frametime, char *outstr)
|
||||
|
||||
// scannable cargo behaves differently. Scannable cargo is either "scanned" or "not scanned". This flag
|
||||
// can be set on any ship. Any ship with this set won't have "normal" cargo behavior
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) ) {
|
||||
if ( !(cargo_sip->flags & (SIF_CARGO|SIF_TRANSPORT)) ) {
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) ) {
|
||||
if (!(cargo_sip->flags[Ship::Info_Flags::Cargo] || cargo_sip->flags[Ship::Info_Flags::Transport])) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// if cargo is already revealed
|
||||
if ( cargo_sp->flags & SF_CARGO_REVEALED ) {
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) ) {
|
||||
if ( cargo_sp->flags[Ship::Ship_Flags::Cargo_revealed] ) {
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) ) {
|
||||
char *cargo_name = Cargo_names[cargo_sp->cargo1 & CARGO_INDEX_MASK];
|
||||
Assert( cargo_sip->flags & (SIF_CARGO|SIF_TRANSPORT) );
|
||||
Assert(cargo_sip->flags[Ship::Info_Flags::Cargo] || cargo_sip->flags[Ship::Info_Flags::Transport]);
|
||||
|
||||
if ( cargo_name[0] == '#' ) {
|
||||
sprintf(outstr, XSTR("passengers: %s", 83), cargo_name+1 );
|
||||
@@ -1468,7 +1468,7 @@ int player_inspect_cargo(float frametime, char *outstr)
|
||||
vm_vec_normalized_dir(&vec_to_cargo, &cargo_objp->pos, &Player_obj->pos);
|
||||
dot = vm_vec_dot(&vec_to_cargo, &Player_obj->orient.vec.fvec);
|
||||
if ( dot < CARGO_MIN_DOT_TO_REVEAL ) {
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) )
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) )
|
||||
strcpy(outstr,XSTR( "cargo: <unknown>", 86));
|
||||
else
|
||||
strcpy(outstr,XSTR( "not scanned", 87));
|
||||
@@ -1482,7 +1482,7 @@ int player_inspect_cargo(float frametime, char *outstr)
|
||||
Player->cargo_inspect_time += fl2i(frametime*1000+0.5f);
|
||||
}
|
||||
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) )
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) )
|
||||
strcpy(outstr,XSTR( "cargo: inspecting", 88));
|
||||
else
|
||||
strcpy(outstr,XSTR( "scanning", 89));
|
||||
@@ -1493,7 +1493,7 @@ int player_inspect_cargo(float frametime, char *outstr)
|
||||
Player->cargo_inspect_time = 0;
|
||||
}
|
||||
} else {
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) )
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) )
|
||||
strcpy(outstr,XSTR( "cargo: <unknown>", 86));
|
||||
else
|
||||
strcpy(outstr,XSTR( "not scanned", 87));
|
||||
@@ -1539,7 +1539,7 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
|
||||
|
||||
// if cargo is already revealed
|
||||
if (subsys->flags & SSF_CARGO_REVEALED) {
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) ) {
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) ) {
|
||||
char *cargo_name = Cargo_names[subsys->subsys_cargo_name & CARGO_INDEX_MASK];
|
||||
|
||||
if ( cargo_name[0] == '#' ) {
|
||||
@@ -1568,7 +1568,7 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
|
||||
subsys_rad = subsys->system_info->radius;
|
||||
|
||||
// Goober5000
|
||||
if (cargo_sip->flags & SIF_HUGE_SHIP) {
|
||||
if (cargo_sip->is_huge_ship()) {
|
||||
scan_dist = MAX(CAP_CARGO_REVEAL_MIN_DIST, (subsys_rad + CAPITAL_CARGO_RADIUS_DELTA));
|
||||
} else {
|
||||
scan_dist = MAX(CARGO_REVEAL_MIN_DIST, (subsys_rad + CARGO_RADIUS_DELTA));
|
||||
@@ -1583,7 +1583,7 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
|
||||
subsys_in_view = hud_targetbox_subsystem_in_view(cargo_objp, &x, &y);
|
||||
|
||||
if ( (dot < CARGO_MIN_DOT_TO_REVEAL) || (!subsys_in_view) ) {
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) )
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) )
|
||||
strcpy(outstr,XSTR( "cargo: <unknown>", 86));
|
||||
else
|
||||
strcpy(outstr,XSTR( "not scanned", 87));
|
||||
@@ -1597,7 +1597,7 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
|
||||
Player->cargo_inspect_time += fl2i(frametime*1000+0.5f);
|
||||
}
|
||||
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) )
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) )
|
||||
strcpy(outstr,XSTR( "cargo: inspecting", 88));
|
||||
else
|
||||
strcpy(outstr,XSTR( "scanning", 89));
|
||||
@@ -1608,7 +1608,7 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
|
||||
Player->cargo_inspect_time = 0;
|
||||
}
|
||||
} else {
|
||||
if ( !(cargo_sp->flags & SF_SCANNABLE) )
|
||||
if ( !(cargo_sp->flags[Ship::Ship_Flags::Scannable]) )
|
||||
strcpy(outstr,XSTR( "cargo: <unknown>", 86));
|
||||
else
|
||||
strcpy(outstr,XSTR( "not scanned", 87));
|
||||
|
||||
@@ -169,7 +169,7 @@ void popupdead_start()
|
||||
Popupdead_button_text[2] = XSTR( "Don't Show Me This Again", 1475);
|
||||
Popupdead_num_choices = POPUPDEAD_NUM_CHOICES_SKIP;
|
||||
Popupdead_skip_active = 1;
|
||||
} else if(The_mission.flags & MISSION_FLAG_RED_ALERT) {
|
||||
} else if(The_mission.flags[Mission::Mission_Flags::Red_alert]) {
|
||||
// We can't staticly declare these because they are externalized
|
||||
Popupdead_button_text[0] = XSTR( "Quick Start Mission", 105);
|
||||
Popupdead_button_text[1] = XSTR( "Return To Flight Deck", 106);
|
||||
|
||||
@@ -123,7 +123,7 @@ void HudGaugeRadarDradis::plotBlip(blip* b, vec3d *pos, float *alpha)
|
||||
float fade_multi = 1.5f;
|
||||
|
||||
if (b->objp->type == OBJ_SHIP) {
|
||||
if (Ships[b->objp->instance].flags2 & SF2_STEALTH) {
|
||||
if (Ships[b->objp->instance].flags[Ship::Ship_Flags::Stealth]) {
|
||||
fade_multi *= 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void radar_stuff_blip_info(object *objp, int is_bright, color **blip_color, int
|
||||
case OBJ_SHIP:
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (shipp->flags & SF_ARRIVING_STAGE_1)
|
||||
if (shipp->flags[Ship::Ship_Flags::Arriving_stage_1])
|
||||
{
|
||||
*blip_color = &Radar_colors[RCOL_WARPING_SHIP][is_bright];
|
||||
*blip_type = BLIP_TYPE_WARPING_SHIP;
|
||||
@@ -104,7 +104,7 @@ void radar_stuff_blip_info(object *objp, int is_bright, color **blip_color, int
|
||||
*blip_color = &Radar_colors[RCOL_TAGGED][is_bright];
|
||||
*blip_type = BLIP_TYPE_TAGGED_SHIP;
|
||||
}
|
||||
else if (Ship_info[shipp->ship_info_index].flags & (SIF_NAVBUOY|SIF_CARGO))
|
||||
else if (Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Navbuoy] || Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Cargo])
|
||||
{
|
||||
*blip_color = &Radar_colors[RCOL_NAVBUOY_CARGO][is_bright];
|
||||
*blip_type = BLIP_TYPE_NAVBUOY_CARGO;
|
||||
@@ -306,7 +306,7 @@ void radar_plot_object( object *objp )
|
||||
if (objp->type == OBJ_SHIP)
|
||||
{
|
||||
// ships specifically hidden from sensors
|
||||
if (Ships[objp->instance].flags & SF_HIDDEN_FROM_SENSORS)
|
||||
if (Ships[objp->instance].flags[Ship::Ship_Flags::Hidden_from_sensors])
|
||||
b->flags |= BLIP_DRAW_DISTORTED;
|
||||
|
||||
// determine if its AWACS distorted
|
||||
@@ -326,9 +326,9 @@ void radar_plot_object( object *objp )
|
||||
|
||||
// don't distort the sensor blips if the player has primitive sensors and the nebula effect
|
||||
// is not active
|
||||
if (Player_ship->flags2 & SF2_PRIMITIVE_SENSORS)
|
||||
if (Player_ship->flags[Ship::Ship_Flags::Primitive_sensors])
|
||||
{
|
||||
if (!(The_mission.flags & MISSION_FLAG_FULLNEB))
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::Fullneb]))
|
||||
b->flags &= ~BLIP_DRAW_DISTORTED;
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ RadarVisibility radar_is_visible( object *objp )
|
||||
{
|
||||
Assert( objp != NULL );
|
||||
|
||||
if (objp->flags & OF_SHOULD_BE_DEAD)
|
||||
if (objp->flags[Object::Object_Flags::Should_be_dead])
|
||||
{
|
||||
return NOT_VISIBLE;
|
||||
}
|
||||
@@ -534,11 +534,11 @@ RadarVisibility radar_is_visible( object *objp )
|
||||
switch (objp->type)
|
||||
{
|
||||
case OBJ_SHIP:
|
||||
if (Ships[objp->instance].flags2 & SF2_STEALTH)
|
||||
if (Ships[objp->instance].flags[Ship::Ship_Flags::Stealth])
|
||||
return NOT_VISIBLE;
|
||||
|
||||
// Ships that are warp in in are not visible on the radar
|
||||
if (Ships[objp->instance].flags & SF_ARRIVING_STAGE_1)
|
||||
if (Ships[objp->instance].flags[Ship::Ship_Flags::Arriving_stage_1])
|
||||
return NOT_VISIBLE;
|
||||
|
||||
break;
|
||||
@@ -598,7 +598,7 @@ RadarVisibility radar_is_visible( object *objp )
|
||||
if (objp->type == OBJ_SHIP)
|
||||
{
|
||||
// ships specifically hidden from sensors
|
||||
if (Ships[objp->instance].flags & SF_HIDDEN_FROM_SENSORS)
|
||||
if (Ships[objp->instance].flags[Ship::Ship_Flags::Hidden_from_sensors])
|
||||
return DISTORTED;
|
||||
|
||||
// determine if its AWACS distorted
|
||||
|
||||
@@ -84,11 +84,11 @@ void afterburners_start(object *objp)
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// bail if afterburners are locked
|
||||
if (shipp->flags2 & SF2_AFTERBURNER_LOCKED) {
|
||||
if (shipp->flags[Ship::Ship_Flags::Afterburner_locked]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (objp->flags & OF_PLAYER_SHIP) && (objp == Player_obj) ) {
|
||||
if ( (objp->flags[Object::Object_Flags::Player_ship]) && (objp == Player_obj) ) {
|
||||
unsigned int now;
|
||||
now = timer_get_milliseconds();
|
||||
|
||||
@@ -110,7 +110,7 @@ void afterburners_start(object *objp)
|
||||
if (objp->phys_info.flags & PF_BOOSTER_ON)
|
||||
return;
|
||||
|
||||
if ( !(sip->flags & SIF_AFTERBURNER) ) {
|
||||
if ( !(sip->flags[Ship::Info_Flags::Afterburner]) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,11 +180,11 @@ void afterburners_update(object *objp, float fl_frametime)
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()) );
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if ( (objp->flags & OF_PLAYER_SHIP ) && (Game_mode & GM_DEAD) ) {
|
||||
if ( (objp->flags[Object::Object_Flags::Player_ship] ) && (Game_mode & GM_DEAD) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !(sip->flags & SIF_AFTERBURNER) ) {
|
||||
if ( !(sip->flags[Ship::Info_Flags::Afterburner]) ) {
|
||||
return; // nothing to update, afterburners are not even on the ship
|
||||
}
|
||||
|
||||
@@ -289,11 +289,11 @@ void afterburners_stop(object *objp, int key_released)
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()) );
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if ( (objp->flags & OF_PLAYER_SHIP) && key_released ) {
|
||||
if ( (objp->flags[Object::Object_Flags::Player_ship]) && key_released ) {
|
||||
objp->phys_info.flags &= ~PF_AFTERBURNER_WAIT;
|
||||
}
|
||||
|
||||
if ( !(sip->flags & SIF_AFTERBURNER) ) {
|
||||
if ( !(sip->flags[Ship::Info_Flags::Afterburner]) ) {
|
||||
nprintf(("Warning","Ship type %s does not have afterburner capability\n", sip->name));
|
||||
return;
|
||||
}
|
||||
|
||||
+12
-12
@@ -118,11 +118,11 @@ void awacs_update_all_levels()
|
||||
shipp = &Ships[Objects[moveup->objnum].instance];
|
||||
|
||||
// ignore dying, departing, or arriving ships
|
||||
if ((shipp->flags & SF_DYING) || (shipp->flags & SF_DEPARTING) || (shipp->flags & SF_ARRIVING))
|
||||
if ((shipp->is_dying_or_departing() || shipp->is_arriving()))
|
||||
continue;
|
||||
|
||||
// only look at ships that have awacs subsystems
|
||||
if (!(Ship_info[shipp->ship_info_index].flags & SIF_HAS_AWACS))
|
||||
if (!(Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Has_awacs]))
|
||||
continue;
|
||||
|
||||
// traverse all subsystems
|
||||
@@ -178,7 +178,7 @@ float awacs_get_level(object *target, ship *viewer, int use_awacs)
|
||||
ship *shipp = NULL;
|
||||
ship_info *sip = NULL;
|
||||
|
||||
int viewer_has_primitive_sensors = (viewer->flags2 & SF2_PRIMITIVE_SENSORS);
|
||||
int viewer_has_primitive_sensors = (viewer->flags[Ship::Ship_Flags::Primitive_sensors]);
|
||||
|
||||
// calc distance from viewer to target
|
||||
vm_vec_sub(&dist_vec, &target->pos, &Objects[viewer->objnum].pos);
|
||||
@@ -207,13 +207,13 @@ float awacs_get_level(object *target, ship *viewer, int use_awacs)
|
||||
// Goober5000
|
||||
shipp = &Ships[target->instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
stealth_ship = (shipp->flags2 & SF2_STEALTH);
|
||||
friendly_stealth_invisible = (shipp->flags2 & SF2_FRIENDLY_STEALTH_INVIS);
|
||||
stealth_ship = (shipp->flags[Ship::Ship_Flags::Stealth]);
|
||||
friendly_stealth_invisible = (shipp->flags[Ship::Ship_Flags::Friendly_stealth_invis]);
|
||||
|
||||
check_huge_ship = (sip->flags & SIF_HUGE_SHIP);
|
||||
check_huge_ship = (sip->is_huge_ship());
|
||||
}
|
||||
|
||||
int nebula_enabled = (The_mission.flags & MISSION_FLAG_FULLNEB);
|
||||
int nebula_enabled = (The_mission.flags[Mission::Mission_Flags::Fullneb]);
|
||||
|
||||
// ships on the same team are always viewable
|
||||
if ((target->type == OBJ_SHIP) && (shipp->team == viewer->team))
|
||||
@@ -370,15 +370,15 @@ void team_visibility_update()
|
||||
shipp = &Ships[ship_num];
|
||||
|
||||
// ignore dying, departing, or arriving ships
|
||||
if ((shipp->flags & SF_DYING) || (shipp->flags & SF_DEPARTING) || (shipp->flags & SF_ARRIVING))
|
||||
if (shipp->is_dying_or_departing() || shipp->is_arriving())
|
||||
continue;
|
||||
|
||||
// check if ship is flagged as invisible
|
||||
if (shipp->flags & SF_HIDDEN_FROM_SENSORS)
|
||||
if (shipp->flags[Ship::Ship_Flags::Hidden_from_sensors])
|
||||
continue;
|
||||
|
||||
// check if ship is stealthed and friendly-invisible
|
||||
if ((shipp->flags2 & SF2_STEALTH) && (shipp->flags2 & SF2_FRIENDLY_STEALTH_INVIS))
|
||||
if ((shipp->flags[Ship::Ship_Flags::Stealth]) && (shipp->flags[Ship::Ship_Flags::Friendly_stealth_invis]))
|
||||
continue;
|
||||
|
||||
Ship_visibility_by_team[shipp->team][ship_num] = 1;
|
||||
@@ -419,7 +419,7 @@ void team_visibility_update()
|
||||
for (idx = 0; idx < cur_count; idx++)
|
||||
{
|
||||
// ignore nav buoys and cargo containers
|
||||
if (Ship_info[Ships[cur_team_ships[idx]].ship_info_index].flags & (SIF_CARGO | SIF_NAVBUOY))
|
||||
if (Ship_info[Ships[cur_team_ships[idx]].ship_info_index].flags[Ship::Info_Flags::Cargo] || Ship_info[Ships[cur_team_ships[idx]].ship_info_index].flags[Ship::Info_Flags::Navbuoy])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ int ship_is_visible_by_team(object *target, ship *viewer)
|
||||
Assert(target->type == OBJ_SHIP);
|
||||
|
||||
// not visible if viewer has primitive sensors
|
||||
if (viewer->flags2 & SF2_PRIMITIVE_SENSORS)
|
||||
if (viewer->flags[Ship::Ship_Flags::Primitive_sensors])
|
||||
return 0;
|
||||
|
||||
// not visible if out of range
|
||||
|
||||
@@ -390,12 +390,12 @@ void render_shield(int shield_num)
|
||||
|
||||
objp = &Objects[Shield_hits[shield_num].objnum];
|
||||
|
||||
if (objp->flags & OF_NO_SHIELDS) {
|
||||
if (objp->flags[Object::Object_Flags::No_shields]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If this object didn't get rendered, don't render its shields. In fact, make the shield hit go away.
|
||||
if (!(objp->flags & OF_WAS_RENDERED)) {
|
||||
if (!(objp->flags[Object::Object_Flags::Was_rendered])) {
|
||||
Shield_hits[shield_num].type = SH_UNUSED;
|
||||
return;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ void render_shield(int shield_num)
|
||||
// objp, shipp, and si are now setup correctly
|
||||
|
||||
// If this ship is in its deathroll, make the shield hit effects go away faster.
|
||||
if (shipp->flags & SF_DYING) {
|
||||
if (shipp->flags[Ship::Ship_Flags::Dying]) {
|
||||
Shield_hits[shield_num].start_time -= fl2f(2*flFrametime);
|
||||
}
|
||||
|
||||
@@ -446,7 +446,7 @@ void render_shield(int shield_num)
|
||||
bitmap_id = sa->first_frame + frame_num;
|
||||
|
||||
float alpha = 0.9999f;
|
||||
if(The_mission.flags & MISSION_FLAG_FULLNEB){
|
||||
if(The_mission.flags[Mission::Mission_Flags::Fullneb]){
|
||||
alpha *= 0.85f;
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ void create_shield_explosion(int objnum, int model_num, matrix *orient, vec3d *c
|
||||
polymodel *pm;
|
||||
int i;
|
||||
|
||||
if (Objects[objnum].flags & OF_NO_SHIELDS)
|
||||
if (Objects[objnum].flags[Object::Object_Flags::No_shields])
|
||||
return;
|
||||
|
||||
pm = model_get(model_num);
|
||||
@@ -872,7 +872,7 @@ void ship_draw_shield( object *objp)
|
||||
vec3d pnt;
|
||||
polymodel * pm;
|
||||
|
||||
if (objp->flags & OF_NO_SHIELDS)
|
||||
if (objp->flags[Object::Object_Flags::No_shields])
|
||||
return;
|
||||
|
||||
Assert(objp->instance >= 0);
|
||||
@@ -976,7 +976,7 @@ int ship_is_shield_up( object *obj, int quadrant )
|
||||
// Note: This is in the object's local reference frame. Do _not_ pass a vector in the world frame.
|
||||
int get_quadrant(vec3d *hit_pnt, object *shipobjp)
|
||||
{
|
||||
if (shipobjp != NULL && Ship_info[Ships[shipobjp->instance].ship_info_index].flags2 & SIF2_MODEL_POINT_SHIELDS) {
|
||||
if (shipobjp != NULL && Ship_info[Ships[shipobjp->instance].ship_info_index].flags[Ship::Info_Flags::Model_point_shields]) {
|
||||
int closest = -1;
|
||||
float closest_dist = FLT_MAX;
|
||||
|
||||
|
||||
+409
-398
File diff suppressed because it is too large.
Load diff
+34
-177
@@ -30,6 +30,7 @@
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "weapon/shockwave.h"
|
||||
#include "weapon/trails.h"
|
||||
#include "ship/ship_flags.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -421,98 +422,15 @@ typedef struct ship_subsys_info {
|
||||
|
||||
// Karajorma - Used by the alter-ship-flag SEXP as an alternative to having lots of ship flag SEXPs
|
||||
typedef struct ship_flag_name {
|
||||
int flag; // the actual ship flag constant as given by the define below
|
||||
Ship::Ship_Flags flag; // the actual ship flag constant as given by the define below
|
||||
char flag_name[TOKEN_LENGTH]; // the name written to the mission file for its corresponding parse_object flag
|
||||
int flag_list; // is this flag in the 1st or 2nd ship flags list?
|
||||
} ship_flag_name;
|
||||
|
||||
#define MAX_SHIP_FLAG_NAMES 19
|
||||
extern ship_flag_name Ship_flag_names[];
|
||||
|
||||
// states for the flags variable within the ship structure
|
||||
// low bits are for mission file savable flags..
|
||||
// FRED needs these to be the low-order bits with no holes,
|
||||
// because it indexes into an array, Hoffoss says.
|
||||
#define SF_IGNORE_COUNT (1 << 0) // ignore this ship when counting ship types for goals
|
||||
#define SF_REINFORCEMENT (1 << 1) // this ship is a reinforcement ship
|
||||
#define SF_ESCORT (1 << 2) // this ship is an escort ship
|
||||
#define SF_NO_ARRIVAL_MUSIC (1 << 3) // don't play arrival music when ship arrives
|
||||
#define SF_NO_ARRIVAL_WARP (1 << 4) // no arrival warp in effect
|
||||
#define SF_NO_DEPARTURE_WARP (1 << 5) // no departure warp in effect
|
||||
//#define SF_LOCKED (1 << 6) // can't manipulate ship in loadout screens
|
||||
|
||||
// high bits are for internal flags not saved to mission files
|
||||
// Go from bit 31 down to bit 6
|
||||
#define SF_KILL_BEFORE_MISSION (1 << 31)
|
||||
#define SF_DYING (1 << 30)
|
||||
#define SF_DISABLED (1 << 29)
|
||||
#define SF_DEPART_WARP (1 << 28) // ship is departing via warp-out
|
||||
#define SF_DEPART_DOCKBAY (1 << 27) // ship is departing via docking bay
|
||||
#define SF_ARRIVING_STAGE_1 (1 << 26) // ship is arriving. In other words, doing warp in effect, stage 1
|
||||
#define SF_ARRIVING_STAGE_2 (1 << 25) // ship is arriving. In other words, doing warp in effect, stage 2
|
||||
#define SF_ARRIVING (SF_ARRIVING_STAGE_1|SF_ARRIVING_STAGE_2)
|
||||
#define SF_ENGINES_ON (1 << 24) // engines sound should play if set
|
||||
#define SF_DOCK_LEADER (1 << 23) // Goober5000 - this guy is in charge of everybody he's docked to
|
||||
#define SF_CARGO_REVEALED (1 << 22) // ship's cargo is revealed to all friendly ships
|
||||
#define SF_FROM_PLAYER_WING (1 << 21) // set for ships that are members of any player starting wing
|
||||
#define SF_PRIMARY_LINKED (1 << 20) // ships primary weapons are linked together
|
||||
#define SF_SECONDARY_DUAL_FIRE (1 << 19) // ship is firing two missiles from the current secondary bank
|
||||
#define SF_WARP_BROKEN (1 << 18) // set when warp drive is not working, but is repairable
|
||||
#define SF_WARP_NEVER (1 << 17) // set when ship can never warp
|
||||
#define SF_TRIGGER_DOWN (1 << 16) // ship has its "trigger" held down
|
||||
#define SF_AMMO_COUNT_RECORDED (1 << 15) // we've recorded the initial secondary weapon count (which is used to limit support ship rearming)
|
||||
#define SF_HIDDEN_FROM_SENSORS (1 << 14) // ship doesn't show up on sensors, blinks in/out on radar
|
||||
#define SF_SCANNABLE (1 << 13) // ship is "scannable". Play scan effect and report as "Scanned" or "not scanned".
|
||||
#define SF_WARPED_SUPPORT (1 << 12) // set when this is a support ship which was warped in automatically
|
||||
#define SF_EXPLODED (1 << 11) // ship has exploded (needed for kill messages)
|
||||
#define SF_SHIP_HAS_SCREAMED (1 << 10) // ship has let out a death scream
|
||||
#define SF_RED_ALERT_STORE_STATUS (1 << 9) // ship status should be stored/restored if red alert mission
|
||||
#define SF_VAPORIZE (1<<8) // ship is vaporized by beam - alternative death sequence
|
||||
#define SF_DEPARTURE_ORDERED (1<<7) // departure of this ship was ordered by player - Goober5000, similar to WF_DEPARTURE_ORDERED
|
||||
|
||||
// MWA -- don't go below whatever bitfield is used for Fred above (currently 6)!!!!
|
||||
|
||||
#define SF_DEPARTING (SF_DEPART_WARP | SF_DEPART_DOCKBAY) // ship is departing
|
||||
#define SF_CANNOT_WARP (SF_WARP_BROKEN | SF_WARP_NEVER | SF_DISABLED) // ship cannot warp out
|
||||
|
||||
|
||||
#define DEFAULT_SHIP_PRIMITIVE_SENSOR_RANGE 10000 // Goober5000
|
||||
|
||||
|
||||
// Bits for ship.flags2
|
||||
#define SF2_PRIMITIVE_SENSORS (1<<0) // Goober5000 - primitive sensor display
|
||||
#define SF2_FRIENDLY_STEALTH_INVIS (1<<1) // Goober5000 - when stealth, don't appear on radar even if friendly
|
||||
#define SF2_STEALTH (1<<2) // Goober5000 - is this particular ship stealth
|
||||
#define SF2_DONT_COLLIDE_INVIS (1<<3) // Goober5000 - is this particular ship don't-collide-invisible
|
||||
#define SF2_NO_SUBSPACE_DRIVE (1<<4) // Goober5000 - this ship has no subspace drive
|
||||
#define SF2_NAVPOINT_CARRY (1<<5) // Kazan - This ship autopilots with the player
|
||||
#define SF2_AFFECTED_BY_GRAVITY (1<<6) // Goober5000 - ship affected by gravity points
|
||||
#define SF2_TOGGLE_SUBSYSTEM_SCANNING (1<<7) // Goober5000 - switch whether subsystems are scanned
|
||||
#define SF2_NO_BUILTIN_MESSAGES (1<<8) // Karajorma - ship should not send built-in messages
|
||||
#define SF2_PRIMARIES_LOCKED (1<<9) // Karajorma - This ship can't fire primary weapons
|
||||
#define SF2_SECONDARIES_LOCKED (1<<10) // Karajorma - This ship can't fire secondary weapons
|
||||
#define SF2_GLOWMAPS_DISABLED (1<<11) // taylor - to disable glow maps
|
||||
#define SF2_NO_DEATH_SCREAM (1<<12) // Goober5000 - for WCS
|
||||
#define SF2_ALWAYS_DEATH_SCREAM (1<<13) // Goober5000 - for WCS
|
||||
#define SF2_NAVPOINT_NEEDSLINK (1<<14) // Kazan - This ship requires "linking" for autopilot (when player ship gets within specified distance SF2_NAVPOINT_NEEDSLINK is replaced by SF2_NAVPOINT_CARRY)
|
||||
#define SF2_HIDE_SHIP_NAME (1<<15) // Karajorma - Hides the ships name (like the -wcsaga command line used to but for any selected ship)
|
||||
#define SF2_AFTERBURNER_LOCKED (1<<16) // KeldorKatarn - This ship can't use its afterburners
|
||||
#define SF2_SET_CLASS_DYNAMICALLY (1<<18) // Karajorma - This ship should have its class assigned rather than simply read from the mission file
|
||||
#define SF2_LOCK_ALL_TURRETS_INITIALLY (1<<19) // Karajorma - Lock all turrets on this ship at mission start or on arrival
|
||||
#define SF2_FORCE_SHIELDS_ON (1<<20)
|
||||
#define SF2_NO_ETS (1<<21) // The E - This ship does not have an ETS
|
||||
#define SF2_CLOAKED (1<<22) // The E - This ship will not be rendered
|
||||
#define SF2_NO_THRUSTERS (1<<23) // The E - Thrusters on this ship are not rendered.
|
||||
#define SF2_SHIP_LOCKED (1<<24) // Karajorma - Prevents the player from changing the ship class on loadout screen
|
||||
#define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen
|
||||
#define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration
|
||||
#define SF2_SCRAMBLE_MESSAGES (1<<27) // Goober5000 - all messages sent from this ship appear scrambled
|
||||
#define SF2_NO_SECONDARY_LOCKON (1<<28) // zookeeper - secondary lock-on disabled
|
||||
#define SF2_NO_DISABLED_SELF_DESTRUCT (1<<29) // Goober5000 - ship will not self-destruct after 90 seconds if engines or weapons destroyed (c.f. ai_maybe_self_destruct)
|
||||
|
||||
// If any of these bits in the ship->flags are set, ignore this ship when targeting
|
||||
extern int TARGET_SHIP_IGNORE_FLAGS;
|
||||
|
||||
#define MAX_DAMAGE_SLOTS 32
|
||||
#define MAX_SHIP_ARCS 2 // How many "arcs" can be active at once... Must be less than MAX_ARC_EFFECTS in model.h.
|
||||
#define NUM_SUB_EXPL_HANDLES 2 // How many different big ship sub explosion sounds can be played.
|
||||
@@ -641,8 +559,7 @@ public:
|
||||
float current_max_speed; // Max ship speed (based on energy diverted to engines)
|
||||
int next_manage_ets; // timestamp for when ai can next modify ets ( -1 means never )
|
||||
|
||||
uint flags; // flag variable to contain ship state (see SF_ #defines)
|
||||
uint flags2; // another flag variable (see SF2_ #defines)
|
||||
flagset<Ship::Ship_Flags> flags; // flag variable to contain ship state
|
||||
int reinforcement_index; // index into reinforcement struct or -1
|
||||
|
||||
float afterburner_fuel; // amount of afterburner fuel remaining (capacity is stored
|
||||
@@ -818,6 +735,12 @@ public:
|
||||
|
||||
// reset to a completely blank ship
|
||||
void clear();
|
||||
|
||||
//Helper functions
|
||||
inline bool is_arriving() { return flags[Ship::Ship_Flags::Arriving_stage_1] || flags[Ship::Ship_Flags::Arriving_stage_2]; }
|
||||
inline bool is_departing() { return flags[Ship::Ship_Flags::Depart_warp] || flags[Ship::Ship_Flags::Depart_dockbay]; }
|
||||
inline bool cannot_warp() { return flags[Ship::Ship_Flags::Warp_broken] || flags[Ship::Ship_Flags::Warp_never] || flags[Ship::Ship_Flags::Disabled]; }
|
||||
inline bool is_dying_or_departing() { return is_departing() || flags[Ship::Ship_Flags::Dying]; }
|
||||
};
|
||||
|
||||
struct ai_target_priority {
|
||||
@@ -828,9 +751,8 @@ struct ai_target_priority {
|
||||
SCP_vector <int> ship_class;
|
||||
SCP_vector <int> weapon_class;
|
||||
|
||||
unsigned int obj_flags;
|
||||
int sif_flags;
|
||||
int sif2_flags;
|
||||
flagset<Object::Object_Flags> obj_flags;
|
||||
flagset<Ship::Info_Flags> sif_flags;
|
||||
int wif_flags;
|
||||
int wif2_flags;
|
||||
};
|
||||
@@ -871,90 +793,6 @@ extern void ship_add_exited_ship( ship *shipp, int reason );
|
||||
extern int ship_find_exited_ship_by_name( char *name );
|
||||
extern int ship_find_exited_ship_by_signature( int signature);
|
||||
|
||||
#define SIF_NO_COLLIDE (1 << 0)
|
||||
#define SIF_PLAYER_SHIP (1 << 1)
|
||||
#define SIF_DEFAULT_PLAYER_SHIP (1 << 2)
|
||||
#define SIF_PATH_FIXUP (1 << 3) // when set, path verts have been set for this ship's model
|
||||
#define SIF_SUPPORT (1 << 4) // this ship can perform repair/rearm functions
|
||||
#define SIF_AFTERBURNER (1 << 5) // this ship has afterburners
|
||||
#define SIF_BALLISTIC_PRIMARIES (1 << 6) // this ship can equip ballistic primaries - Goober5000
|
||||
|
||||
// If you add a new ship type, then please add the appropriate type in the ship_count
|
||||
// structure later in this file!!! and let MWA know!!
|
||||
#define SIF_CARGO (1 << 7) // is this ship a cargo type ship -- used for docking purposes
|
||||
#define SIF_FIGHTER (1 << 8) // this ship is a fighter
|
||||
#define SIF_BOMBER (1 << 9) // this ship is a bomber
|
||||
#define SIF_CRUISER (1 << 10) // this ship is a cruiser
|
||||
#define SIF_FREIGHTER (1 << 11) // this ship is a freighter
|
||||
#define SIF_CAPITAL (1 << 12) // this ship is a capital/installation ship
|
||||
#define SIF_TRANSPORT (1 << 13) // this ship is a transport
|
||||
#define SIF_NAVBUOY (1 << 14) // AL 11-24-97: this is a navbuoy
|
||||
#define SIF_SENTRYGUN (1 << 15) // AL 11-24-97: this is a navbuoy with turrets
|
||||
#define SIF_ESCAPEPOD (1 << 16) // AL 12-09-97: escape pods that fire from big ships
|
||||
#define SIF_NO_SHIP_TYPE (1 << 17) // made distinct to help trap errors
|
||||
|
||||
#define SIF_SHIP_COPY (1 << 18) // this ship is a copy of another ship in the table -- meaningful for scoring and possible other things
|
||||
#define SIF_IN_TECH_DATABASE (1 << 19) // is ship type to be listed in the tech database?
|
||||
#define SIF_IN_TECH_DATABASE_M (1 << 20) // is ship type to be listed in the tech database for multiplayer?
|
||||
|
||||
#define SIF_STEALTH (1 << 21) // the ship has stealth capabilities
|
||||
#define SIF_SUPERCAP (1 << 22) // the ship is a supercap
|
||||
#define SIF_DRYDOCK (1 << 23) // the ship is a drydock
|
||||
#define SIF_SHIP_CLASS_DONT_COLLIDE_INVIS (1 << 24) // Don't collide with this ship's invisible polygons
|
||||
|
||||
#define SIF_BIG_DAMAGE (1 << 25) // this ship is classified as a big damage ship
|
||||
#define SIF_HAS_AWACS (1 << 26) // ship has an awacs subsystem
|
||||
|
||||
#define SIF_CORVETTE (1 << 27) // corvette class (currently this only means anything for briefing icons)
|
||||
#define SIF_GAS_MINER (1 << 28) // also just for briefing icons
|
||||
#define SIF_AWACS (1 << 29) // ditto
|
||||
|
||||
#define SIF_KNOSSOS_DEVICE (1 << 30) // this is the knossos device
|
||||
|
||||
#define SIF_NO_FRED (1 << 31) // not available in fred
|
||||
|
||||
|
||||
// flags2 list.
|
||||
#define SIF2_DEFAULT_IN_TECH_DATABASE (1 << 0) // default in tech database - Goober5000
|
||||
#define SIF2_DEFAULT_IN_TECH_DATABASE_M (1 << 1) // ditto - Goober5000
|
||||
#define SIF2_FLASH (1 << 2) // makes a flash when it explodes
|
||||
#define SIF2_SHOW_SHIP_MODEL (1 << 3) // Show ship model even in first person view
|
||||
#define SIF2_SURFACE_SHIELDS (1 << 4) // _argv[-1], 16 Jan 2005: Enable surface shields for this ship.
|
||||
#define SIF2_GENERATE_HUD_ICON (1 << 5) // Enable generation of a HUD shield icon
|
||||
#define SIF2_DISABLE_WEAPON_DAMAGE_SCALING (1 << 6) // WMC - Disable weapon scaling based on flags
|
||||
#define SIF2_GUN_CONVERGENCE (1 << 7) // WMC - Gun convergence based on model weapon norms.
|
||||
#define SIF2_NO_THRUSTER_GEO_NOISE (1 << 8) // Echelon9 - No thruster geometry noise.
|
||||
#define SIF2_INTRINSIC_NO_SHIELDS (1 << 9) // Chief - disables shields for this ship even without No Shields in mission.
|
||||
#define SIF2_NO_PRIMARY_LINKING (1 << 10) // Chief - slated for 3.7 originally, but this looks pretty simple to implement.
|
||||
#define SIF2_NO_PAIN_FLASH (1 << 11) // The E - disable red pain flash
|
||||
#define SIF2_ALLOW_LANDINGS (1 << 12) // SUSHI: Automatically set if any subsystems allow landings (as a shortcut)
|
||||
#define SIF2_NO_ETS (1 << 13) // The E - No ETS on this ship class
|
||||
#define SIF2_NO_LIGHTING (1 << 14) // Valathil - No lighting for this ship
|
||||
#define SIF2_DYN_PRIMARY_LINKING (1 << 15) // RSAXVC - Dynamically generate weapon linking options
|
||||
#define SIF2_AUTO_SPREAD_SHIELDS (1 << 16) // zookeeper - auto spread shields
|
||||
#define SIF2_DRAW_WEAPON_MODELS (1 << 17) // the ship draws weapon models of any sort (used to be a boolean)
|
||||
#define SIF2_MODEL_POINT_SHIELDS (1 << 18) // zookeeper - uses model-defined shield points instead of quadrants
|
||||
#define SIF2_SUBSYS_REPAIR_WHEN_DISABLED (1 << 19) // MageKing17 - Subsystems auto-repair themselves even when disabled.
|
||||
|
||||
#define SIF_DEFAULT_VALUE 0
|
||||
#define SIF2_DEFAULT_VALUE 0
|
||||
|
||||
#define SIF_ALL_SHIP_TYPES (SIF_CARGO | SIF_FIGHTER | SIF_BOMBER | SIF_CRUISER | SIF_FREIGHTER | SIF_CAPITAL | SIF_TRANSPORT | SIF_SUPPORT | SIF_NO_SHIP_TYPE | SIF_NAVBUOY | SIF_SENTRYGUN | SIF_ESCAPEPOD | SIF_SUPERCAP | SIF_CORVETTE | SIF_GAS_MINER | SIF_AWACS | SIF_KNOSSOS_DEVICE)
|
||||
#define SIF_SMALL_SHIP (SIF_FIGHTER | SIF_BOMBER | SIF_SUPPORT | SIF_ESCAPEPOD )
|
||||
#define SIF_BIG_SHIP (SIF_CRUISER | SIF_FREIGHTER | SIF_TRANSPORT | SIF_CORVETTE | SIF_GAS_MINER | SIF_AWACS)
|
||||
#define SIF_HUGE_SHIP (SIF_CAPITAL | SIF_SUPERCAP | SIF_DRYDOCK | SIF_KNOSSOS_DEVICE)
|
||||
#define SIF_NOT_FLYABLE (SIF_CARGO | SIF_NAVBUOY | SIF_SENTRYGUN) // AL 11-24-97: this useful to know for targeting reasons
|
||||
#define SIF_HARMLESS (SIF_CARGO | SIF_NAVBUOY | SIF_ESCAPEPOD) // AL 12-3-97: ships that are not a threat
|
||||
// for ships of this type, we make beam weapons miss a little bit otherwise they'd be way too powerful
|
||||
#define SIF_BEAM_JITTER (SIF_CARGO | SIF_FIGHTER | SIF_BOMBER | SIF_FREIGHTER | SIF_TRANSPORT | SIF_SENTRYGUN | SIF_NAVBUOY | SIF_ESCAPEPOD)
|
||||
// these ships avoid shockwaves
|
||||
// (the weird thing is that freighters and transports used to be explicitly allowed in one part of the code but then explicitly disallowed in another)
|
||||
#define SIF_AVOID_SHOCKWAVE SIF_SMALL_SHIP
|
||||
|
||||
// masks for preventing only non flag entry SIF flags from being cleared
|
||||
#define SIF_MASK SIF_AFTERBURNER
|
||||
#define SIF2_MASK SIF2_DRAW_WEAPON_MODELS
|
||||
|
||||
#define REGULAR_WEAPON (1<<0)
|
||||
#define DOGFIGHT_WEAPON (1<<1)
|
||||
|
||||
@@ -1225,8 +1063,7 @@ public:
|
||||
|
||||
float warpout_player_speed;
|
||||
|
||||
int flags; // See SIF_xxxx - changed to uint by Goober5000, changed back by Zacam
|
||||
int flags2; // See SIF2_xxxx - added by Goober5000, changed by Zacam
|
||||
flagset<Ship::Info_Flags> flags; // See SIF_xxxx - changed to uint by Goober5000, changed back by Zacam, and changed to something entirely different by The E!
|
||||
int ai_class; // Index into Ai_classes[]. Defined in ai.tbl
|
||||
float max_speed, min_speed, max_accel;
|
||||
|
||||
@@ -1465,6 +1302,17 @@ public:
|
||||
|
||||
void free_strings();
|
||||
|
||||
//Helper functions
|
||||
|
||||
inline bool is_small_ship() const { return flags[Ship::Info_Flags::Fighter] || flags[Ship::Info_Flags::Bomber] || flags[Ship::Info_Flags::Support] || flags[Ship::Info_Flags::Escapepod]; }
|
||||
inline bool is_big_ship() const { return flags[Ship::Info_Flags::Cruiser] || flags[Ship::Info_Flags::Freighter] || flags[Ship::Info_Flags::Transport] || flags[Ship::Info_Flags::Corvette] || flags[Ship::Info_Flags::Gas_miner] || flags[Ship::Info_Flags::Awacs]; }
|
||||
inline bool is_huge_ship() const { return flags[Ship::Info_Flags::Capital] || flags[Ship::Info_Flags::Supercap] || flags[Ship::Info_Flags::Drydock] || flags[Ship::Info_Flags::Knossos_device]; }
|
||||
inline bool is_flyable() const { return !(flags[Ship::Info_Flags::Cargo] || flags[Ship::Info_Flags::Navbuoy] || flags[Ship::Info_Flags::Escapepod]); }
|
||||
inline bool is_harmless() const { return !is_flyable(); }
|
||||
inline bool is_fighter_bomber() const { return flags[Ship::Info_Flags::Fighter] || flags[Ship::Info_Flags::Bomber]; }
|
||||
inline bool is_big_or_huge() const { return is_big_ship() || is_huge_ship(); }
|
||||
inline bool avoids_shockwaves() const { return is_small_ship(); }
|
||||
|
||||
private:
|
||||
void move(ship_info&& other);
|
||||
|
||||
@@ -1829,8 +1677,8 @@ void ship_primary_changed(ship *sp);
|
||||
void ship_secondary_changed(ship *sp);
|
||||
|
||||
// get the Ship_info flags for a given ship
|
||||
int ship_get_SIF(ship *shipp);
|
||||
int ship_get_SIF(int sh);
|
||||
flagset<Ship::Info_Flags> ship_get_SIF(ship *shipp);
|
||||
flagset<Ship::Info_Flags> ship_get_SIF(int sh);
|
||||
|
||||
// get the ship type info (objecttypes.tbl)
|
||||
ship_type_info *ship_get_type_info(object *objp);
|
||||
@@ -2046,4 +1894,13 @@ int get_default_player_ship_index();
|
||||
*/
|
||||
int get_nearest_bbox_point(object *ship_obj, vec3d *start, vec3d *box_pt);
|
||||
|
||||
extern flagset<Ship::Ship_Flags> Ignore_List;
|
||||
inline bool should_be_ignored(ship* shipp) {
|
||||
return (shipp->flags & Ignore_List).any_set();
|
||||
}
|
||||
|
||||
extern void set_default_ignore_list();
|
||||
|
||||
extern void toggle_ignore_list_flag(Ship::Ship_Flags flag);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,288 @@
|
||||
#ifndef SHIP_FLAGS_H
|
||||
#define SHIP_FLAGS_H
|
||||
|
||||
#include "globalincs/flagset.h"
|
||||
|
||||
namespace Ship {
|
||||
|
||||
FLAG_LIST(Weapon_Flags){
|
||||
Beam_Free = 0, // if this is a beam weapon, its free to fire
|
||||
Turret_Lock, // is this turret is free to fire or locked
|
||||
Tagged_Only, // only fire if target is tagged
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Subsystem_Flags) {
|
||||
Cargo_revealed = 0,
|
||||
Untargetable,
|
||||
No_SS_targeting,
|
||||
Has_fired, // used by scripting to flag a turret as having been fired
|
||||
FOV_Required,
|
||||
FOV_edge_check,
|
||||
No_replace, // prevents 'destroyed' submodel from being rendered if subsys is destroyed.
|
||||
No_live_debris, // prevents subsystem from generating live debris
|
||||
Vanished, // allows subsystem to be made to disappear without a trace (for swapping it for a true model for example.
|
||||
Missiles_ignore_if_dead, // forces homing missiles to target hull if subsystem is dead before missile hits it.
|
||||
Rotates,
|
||||
Damage_as_hull, // Applies armor damage instead of subsystem damge. - FUBAR
|
||||
No_aggregate, // exclude this subsystem from the aggregate subsystem-info tracking - Goober5000
|
||||
Play_sound_for_player, // If this subsystem is a turret on a player ship, play firing sounds - The E
|
||||
No_disappear, // prevents submodel from disappearing when subsys destroyed
|
||||
Autorepair_if_disabled, // Allows the subsystem to repair itself even when disabled - MageKing17
|
||||
No_autorepair_if_disabled, // Inversion of the above; allow a specific subsystem not to repair itself after being disabled if the ship has the "repair disabled subsystems" flag - MageKing17
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(System_Flags) {
|
||||
Alive = 0, // subsystem has active alive sound
|
||||
Dead, // subsystem has active dead sound
|
||||
Rotate, // subsystem has active rotation sound
|
||||
Turret_rotation, // rotation sound to be scaled like turrets do
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Ship_Flags) {
|
||||
Ignore_count = 0, // ignore this ship when counting ship types for goals
|
||||
Reinforcement, // this ship is a reinforcement ship
|
||||
Escort, // this ship is an escort ship
|
||||
No_arrival_music, // don't play arrival music when ship arrives
|
||||
No_arrival_warp, // no arrival warp in effect
|
||||
No_departure_warp, // no departure warp in effect
|
||||
Kill_before_mission,
|
||||
Dying,
|
||||
Disabled,
|
||||
Depart_warp, // ship is departing via warp-out
|
||||
Depart_dockbay, // ship is departing via docking bay
|
||||
Arriving_stage_1, // ship is arriving. In other words, doing warp in effect, stage 1
|
||||
Arriving_stage_2, // ship is arriving. In other words, doing warp in effect, stage 2
|
||||
Engines_on, // engines sound should play if set
|
||||
Dock_leader, // Goober5000 - this guy is in charge of everybody he's docked to
|
||||
Cargo_revealed, // ship's cargo is revealed to all friendly ships
|
||||
From_player_wing, // set for ships that are members of any player starting wing
|
||||
Primary_linked, // ships primary weapons are linked together
|
||||
Secondary_dual_fire, // ship is firing two missiles from the current secondary bank
|
||||
Warp_broken, // set when warp drive is not working, but is repairable
|
||||
Warp_never, // set when ship can never warp
|
||||
Trigger_down, // ship has its "trigger" held down
|
||||
Ammo_count_recorded, // we've recorded the initial secondary weapon count (which is used to limit support ship rearming)
|
||||
Hidden_from_sensors, // ship doesn't show up on sensors, blinks in/out on radar
|
||||
Scannable, // ship is "scannable". Play scan effect and report as "Scanned" or "not scanned".
|
||||
Warped_support, // set when this is a support ship which was warped in automatically
|
||||
Exploded, // ship has exploded (needed for kill messages)
|
||||
Ship_has_screamed, // ship has let out a death scream
|
||||
Red_alert_store_status, // ship status should be stored/restored if red alert mission
|
||||
Vaporize, // ship is vaporized by beam - alternative death sequence
|
||||
Departure_ordered, // departure of this ship was ordered by player - Goober5000, similar to WF_DEPARTURE_ORDERED
|
||||
Primitive_sensors, // Goober5000 - primitive sensor display
|
||||
Friendly_stealth_invis, // Goober5000 - when stealth, don't appear on radar even if friendly
|
||||
Stealth, // Goober5000 - is this particular ship stealth
|
||||
Dont_collide_invis, // Goober5000 - is this particular ship don't-collide-invisible
|
||||
No_subspace_drive, // Goober5000 - this ship has no subspace drive
|
||||
Navpoint_carry, // Kazan - This ship autopilots with the player
|
||||
Affected_by_gravity, // Goober5000 - ship affected by gravity points
|
||||
Toggle_subsystem_scanning, // Goober5000 - switch whether subsystems are scanned
|
||||
No_builtin_messages, // Karajorma - ship should not send built-in messages
|
||||
Primaries_locked, // Karajorma - This ship can't fire primary weapons
|
||||
Secondaries_locked, // Karajorma - This ship can't fire secondary weapons
|
||||
Glowmaps_disabled, // taylor - to disable glow maps
|
||||
No_death_scream, // Goober5000 - for WCS
|
||||
Always_death_scream, // Goober5000 - for WCS
|
||||
Navpoint_needslink, // Kazan - This ship requires "linking" for autopilot (when player ship gets within specified distance NAVPOINT_NEEDSLINK is replaced by NAVPOINT_CARRY)
|
||||
Hide_ship_name, // Karajorma - Hides the ships name (like the -wcsaga command line used to but for any selected ship)
|
||||
Afterburner_locked, // KeldorKatarn - This ship can't use its afterburners
|
||||
Set_class_dynamically, // Karajorma - This ship should have its class assigned rather than simply read from the mission file
|
||||
Lock_all_turrets_initially, // Karajorma - Lock all turrets on this ship at mission start or on arrival
|
||||
Force_shields_on,
|
||||
No_ets, // The E - This ship does not have an ETS
|
||||
Cloaked, // The E - This ship will not be rendered
|
||||
No_thrusters, // The E - Thrusters on this ship are not rendered.
|
||||
Ship_locked, // Karajorma - Prevents the player from changing the ship class on loadout screen
|
||||
Weapons_locked, // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen
|
||||
Ship_selective_linking, // RSAXVC - Allow pilot to pick firing configuration
|
||||
Scramble_messages, // Goober5000 - all messages sent from this ship appear scrambled
|
||||
No_secondary_lockon, // zookeeper - secondary lock-on disabled
|
||||
No_disabled_self_destruct, // Goober5000 - ship will not self-destruct after 90 seconds if engines or weapons destroyed (c.f. ai_maybe_self_destruct)
|
||||
|
||||
NUM_VALUES
|
||||
|
||||
};
|
||||
|
||||
FLAG_LIST(Exit_Flags) {
|
||||
Destroyed = 0,
|
||||
Departed,
|
||||
Cargo_known,
|
||||
Player_deleted,
|
||||
Been_tagged,
|
||||
Red_alert_carry,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Info_Flags) {
|
||||
No_collide = 0,
|
||||
Player_ship,
|
||||
Default_player_ship,
|
||||
Path_fixup, // when set, path verts have been set for this ship's model
|
||||
Support, // this ship can perform repair/rearm functions
|
||||
Afterburner, // this ship has afterburners
|
||||
Ballistic_primaries, // this ship can equip ballistic primaries - Goober5000
|
||||
Cargo, // is this ship a cargo type ship -- used for docking purposes
|
||||
Fighter, // this ship is a fighter
|
||||
Bomber, // this ship is a bomber
|
||||
Cruiser, // this ship is a cruiser
|
||||
Freighter, // this ship is a freighter
|
||||
Capital, // this ship is a capital/installation ship
|
||||
Transport, // this ship is a transport
|
||||
Navbuoy, // AL 11-24-97: this is a navbuoy
|
||||
Sentrygun, // AL 11-24-97: this is a navbuoy with turrets
|
||||
Escapepod, // AL 12-09-97: escape pods that fire from big ships
|
||||
No_ship_type, // made distinct to help trap errors
|
||||
Ship_copy, // this ship is a copy of another ship in the table -- meaningful for scoring and possible other things
|
||||
In_tech_database, // is ship type to be listed in the tech database?
|
||||
In_tech_database_m, // is ship type to be listed in the tech database for multiplayer?
|
||||
Stealth, // the ship has stealth capabilities
|
||||
Supercap, // the ship is a supercap
|
||||
Drydock, // the ship is a drydock
|
||||
Ship_class_dont_collide_invis, // Don't collide with this ship's invisible polygons
|
||||
Big_damage, // this ship is classified as a big damage ship
|
||||
Has_awacs, // ship has an awacs subsystem
|
||||
Corvette, // corvette class (currently this only means anything for briefing icons)
|
||||
Gas_miner, // also just for briefing icons
|
||||
Awacs, // ditto
|
||||
Knossos_device, // this is the knossos device
|
||||
No_fred, // not available in fred
|
||||
Default_in_tech_database, // default in tech database - Goober5000
|
||||
Default_in_tech_database_m, // ditto - Goober5000
|
||||
Flash, // makes a flash when it explodes
|
||||
Show_ship_model, // Show ship model even in first person view
|
||||
Surface_shields, // _argv[-1], 16 Jan 2005: Enable surface shields for this ship.
|
||||
Generate_hud_icon, // Enable generation of a HUD shield icon
|
||||
Disable_weapon_damage_scaling, // WMC - Disable weapon scaling based on flags
|
||||
Gun_convergence, // WMC - Gun convergence based on model weapon norms.
|
||||
No_thruster_geo_noise, // Echelon9 - No thruster geometry noise.
|
||||
Intrinsic_no_shields, // Chief - disables shields for this ship even without No Shields in mission.
|
||||
No_primary_linking, // Chief - slated for 3.7 originally, but this looks pretty simple to implement.
|
||||
No_pain_flash, // The E - disable red pain flash
|
||||
Allow_landings, // SUSHI: Automatically set if any subsystems allow landings (as a shortcut)
|
||||
No_ets, // The E - No ETS on this ship class
|
||||
No_lighting, // Valathil - No lighting for this ship
|
||||
Dyn_primary_linking, // RSAXVC - Dynamically generate weapon linking options
|
||||
Auto_spread_shields, // zookeeper - auto spread shields
|
||||
Draw_weapon_models, // the ship draws weapon models of any sort (used to be a boolean)
|
||||
Model_point_shields, // zookeeper - uses model-defined shield points instead of quadrants
|
||||
Subsys_repair_when_disabled, // MageKing17 - Subsystems auto-repair themselves even when disabled.
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Aiming_Flags) {
|
||||
Autoaim = 0, // has autoaim
|
||||
Auto_convergence, // has automatic convergence
|
||||
Std_convergence, // has standard - ie. non-automatic - convergence
|
||||
Autoaim_convergence, // has autoaim with convergence
|
||||
Convergence_offset, // marks that convergence has offset value
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Type_Info_Msg) {
|
||||
Counts_for_alone,
|
||||
Praise_destruction,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Type_Info_Hud) {
|
||||
Hotkey_on_list,
|
||||
Target_as_threat,
|
||||
Show_attack_direction,
|
||||
No_class_display,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Type_Info_Ship) {
|
||||
Scannable,
|
||||
Warp_pushes,
|
||||
Warp_pushable,
|
||||
Turret_tgt_ship_tgt,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Type_Info_Weapon) {
|
||||
Beams_easily_hit,
|
||||
No_huge_impact_eff,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Type_Info_AI) {
|
||||
Accept_player_orders,
|
||||
Auto_attacks,
|
||||
Attempt_broadside,
|
||||
Guards_attack,
|
||||
Turrets_attack,
|
||||
Can_form_wing,
|
||||
Protected_on_cripple,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Thruster_Flags) {
|
||||
Bank_right,
|
||||
Bank_left,
|
||||
Pitch_up,
|
||||
Pitch_down,
|
||||
Roll_right,
|
||||
Roll_left,
|
||||
Slide_right,
|
||||
Slide_left,
|
||||
Slide_up,
|
||||
Slide_down,
|
||||
Forward,
|
||||
Reverse,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Wing_Flags) {
|
||||
Gone, // all ships were either destroyed or departed
|
||||
Departing, // wing's departure cue turned true
|
||||
Ignore_count, // ignore all ships in this wing for goal counting purposes.
|
||||
Reinforcement, // is this wing a reinforcement wing
|
||||
Reset_reinforcement, // needed when we need to reset the wing's reinforcement flag (after calling it in)
|
||||
No_arrival_music, // don't play arrival music when wing arrives
|
||||
Expanded, // wing expanded in hotkey select screen
|
||||
No_arrival_message, // don't play any arrival message
|
||||
No_arrival_warp, // don't play warp effect for any arriving ships in this wing.
|
||||
No_departure_warp, // don't play warp effect for any departing ships in this wing.
|
||||
No_dynamic, // members of this wing relentlessly pursue their ai goals
|
||||
Departure_ordered, // departure of this wing was ordered by player
|
||||
Never_existed, // this wing never existed because something prevented it from being created (like its mother ship being destroyed)
|
||||
Nav_carry, // Kazan - Wing has nav-carry-status
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Subsys_Sound_Flags) {
|
||||
Alive,
|
||||
Dead,
|
||||
Rotate,
|
||||
Turret_Rotation,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
|
||||
FLAG_LIST(Awacs_Warning_Flags) {
|
||||
None = 0,
|
||||
Warn_25,
|
||||
Warn_75,
|
||||
|
||||
NUM_VALUES
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -435,10 +435,10 @@ bool ct_display_contrails()
|
||||
bool display;
|
||||
|
||||
// normally display trails in a full nebula environment
|
||||
display = (The_mission.flags & MISSION_FLAG_FULLNEB) ? true : false;
|
||||
display = (The_mission.flags[Mission::Mission_Flags::Fullneb]) ? true : false;
|
||||
|
||||
// toggle according to flag
|
||||
if (The_mission.flags & MISSION_FLAG_TOGGLE_SHIP_TRAILS)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Toggle_ship_trails])
|
||||
display = !display;
|
||||
|
||||
return display;
|
||||
|
||||
+69
-70
@@ -160,7 +160,7 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_objp, ship *ship_p,
|
||||
vm_vec_sub(&delta_x, &end_world_pos, &world_axis_pt);
|
||||
vm_vec_cross(&radial_vel, &rotvel, &delta_x);
|
||||
|
||||
if (Ship_info[ship_p->ship_info_index].flags & SIF_KNOSSOS_DEVICE) {
|
||||
if (Ship_info[ship_p->ship_info_index].flags[Ship::Info_Flags::Knossos_device]) {
|
||||
// set velocity to cross center of knossos device
|
||||
vec3d rand_vec, vec_to_center;
|
||||
|
||||
@@ -194,7 +194,7 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_objp, ship *ship_p,
|
||||
scale = exp_mag;
|
||||
}
|
||||
|
||||
if (Ship_info[ship_p->ship_info_index].flags & SIF_KNOSSOS_DEVICE) {
|
||||
if (Ship_info[ship_p->ship_info_index].flags[Ship::Info_Flags::Knossos_device]) {
|
||||
scale = 1.0f;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_objp, ship *ship_p,
|
||||
}
|
||||
|
||||
// scale up speed of debris if ship_obj > 125, but not for knossos
|
||||
if (ship_objp->radius > 250 && !(Ship_info[ship_p->ship_info_index].flags & SIF_KNOSSOS_DEVICE)) {
|
||||
if (ship_objp->radius > 250 && !(Ship_info[ship_p->ship_info_index].flags[Ship::Info_Flags::Knossos_device])) {
|
||||
vm_vec_scale(&live_debris_obj->phys_info.vel, ship_objp->radius/250.0f);
|
||||
}
|
||||
}
|
||||
@@ -525,8 +525,8 @@ float shipfx_calculate_warp_dist(object *objp)
|
||||
// fx don't work for some reason.
|
||||
void shipfx_actually_warpin(ship *shipp, object *objp)
|
||||
{
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_1);
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_2);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_1);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_2);
|
||||
|
||||
// let physics in on it too.
|
||||
objp->phys_info.flags &= (~PF_WARP_IN);
|
||||
@@ -548,7 +548,7 @@ int shipfx_special_warp_objnum_valid(int objnum)
|
||||
return 0;
|
||||
|
||||
// must be a knossos
|
||||
if (!(Ship_info[Ships[special_objp->instance].ship_info_index].flags & SIF_KNOSSOS_DEVICE))
|
||||
if (!(Ship_info[Ships[special_objp->instance].ship_info_index].flags[Ship::Info_Flags::Knossos_device]))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@@ -566,7 +566,7 @@ void shipfx_warpin_start( object *objp )
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
|
||||
if (shipp->flags & SF_ARRIVING)
|
||||
if (shipp->is_arriving())
|
||||
{
|
||||
mprintf(( "Ship '%s' is already arriving!\n", shipp->ship_name ));
|
||||
Int3();
|
||||
@@ -575,7 +575,7 @@ void shipfx_warpin_start( object *objp )
|
||||
|
||||
// docked ships who are not dock leaders don't use the warp effect code
|
||||
// (the dock leader takes care of the whole group)
|
||||
if (object_is_docked(objp) && !(shipp->flags & SF_DOCK_LEADER))
|
||||
if (object_is_docked(objp) && !(shipp->flags[Ship::Ship_Flags::Dock_leader]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ void shipfx_warpin_start( object *objp )
|
||||
}
|
||||
|
||||
// if there is no arrival warp, then skip the whole thing
|
||||
if (shipp->flags & SF_NO_ARRIVAL_WARP)
|
||||
if (shipp->flags[Ship::Ship_Flags::No_arrival_warp])
|
||||
{
|
||||
shipfx_actually_warpin(shipp,objp);
|
||||
return;
|
||||
@@ -608,7 +608,7 @@ void shipfx_warpin_frame( object *objp, float frametime )
|
||||
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if ( shipp->flags & SF_DYING ) return;
|
||||
if ( shipp->flags[Ship::Ship_Flags::Dying] ) return;
|
||||
|
||||
shipp->warpin_effect->warpFrame(frametime);
|
||||
}
|
||||
@@ -645,7 +645,7 @@ int compute_special_warpout_stuff(object *objp, float *speed, float *warp_time,
|
||||
if ((ref_objnum >= 0) && (ref_objnum < MAX_OBJECTS)) {
|
||||
sp_objp = &Objects[ref_objnum];
|
||||
if (sp_objp->type == OBJ_SHIP) {
|
||||
if (Ship_info[Ships[sp_objp->instance].ship_info_index].flags & SIF_KNOSSOS_DEVICE) {
|
||||
if (Ship_info[Ships[sp_objp->instance].ship_info_index].flags[Ship::Info_Flags::Knossos_device]) {
|
||||
valid_reference_ship = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -683,7 +683,7 @@ int compute_special_warpout_stuff(object *objp, float *speed, float *warp_time,
|
||||
|
||||
// validate angle
|
||||
float max_warpout_angle = 0.707f; // 45 degree half-angle cone for small ships
|
||||
if (Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if (Ship_info[Ships[objp->instance].ship_info_index].is_big_or_huge()) {
|
||||
max_warpout_angle = 0.866f; // 30 degree half-angle cone for BIG or HUGE
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ void compute_warpout_stuff(object *objp, float *speed, float *warp_time, vec3d *
|
||||
|
||||
|
||||
// If this is a huge ship, set the distance to the length of the ship
|
||||
if (sip->flags & SIF_HUGE_SHIP)
|
||||
if (sip->is_huge_ship())
|
||||
{
|
||||
ship_move_dist = 0.5f * ship_class_get_length(sip);
|
||||
}
|
||||
@@ -778,7 +778,7 @@ void compute_warpout_stuff(object *objp, float *speed, float *warp_time, vec3d *
|
||||
warp_dist = ship_move_dist;
|
||||
|
||||
// allow for off center
|
||||
if (sip->flags & SIF_HUGE_SHIP) {
|
||||
if (sip->is_huge_ship()) {
|
||||
polymodel *pm = model_get(sip->model_num);
|
||||
warp_dist -= pm->mins.xyz.z;
|
||||
}
|
||||
@@ -796,7 +796,7 @@ void shipfx_warpout_start( object *objp )
|
||||
ship *shipp;
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if ( shipp->flags & SF_DEPART_WARP ) {
|
||||
if ( shipp->flags[Ship::Ship_Flags::Depart_warp] ) {
|
||||
mprintf(( "Ship is already departing!\n" ));
|
||||
return;
|
||||
}
|
||||
@@ -810,30 +810,30 @@ void shipfx_warpout_start( object *objp )
|
||||
}
|
||||
|
||||
// if we're dying return
|
||||
if ( shipp->flags & SF_DYING ) {
|
||||
if ( shipp->flags[Ship::Ship_Flags::Dying] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//return if disabled
|
||||
if ( shipp->flags & SF_DISABLED ){
|
||||
if ( shipp->flags[Ship::Ship_Flags::Disabled] ){
|
||||
return;
|
||||
}
|
||||
|
||||
// if we're HUGE, keep alive - set guardian
|
||||
if (Ship_info[shipp->ship_info_index].flags & SIF_HUGE_SHIP) {
|
||||
if (Ship_info[shipp->ship_info_index].is_huge_ship()) {
|
||||
shipp->ship_guardian_threshold = SHIP_GUARDIAN_THRESHOLD_DEFAULT;
|
||||
}
|
||||
|
||||
// don't send ship depart packets for player ships
|
||||
if ( (MULTIPLAYER_MASTER) && !(objp->flags & OF_PLAYER_SHIP) ){
|
||||
if ( (MULTIPLAYER_MASTER) && !(objp->flags[Object::Object_Flags::Player_ship]) ){
|
||||
send_ship_depart_packet( objp );
|
||||
}
|
||||
|
||||
// don't do departure wormhole if ship flag is set which indicates no effect
|
||||
if ( shipp->flags & SF_NO_DEPARTURE_WARP ) {
|
||||
if ( shipp->flags[Ship::Ship_Flags::No_departure_warp] ) {
|
||||
// DKA 5/25/99 If he's going to warpout, set it.
|
||||
// Next line fixes assert in wing cleanup code when no warp effect.
|
||||
shipp->flags |= SF_DEPART_WARP;
|
||||
shipp->flags.set(Ship::Ship_Flags::Depart_warp);
|
||||
|
||||
shipfx_actually_warpout(objp->instance);
|
||||
return;
|
||||
@@ -850,12 +850,13 @@ void shipfx_warpout_frame( object *objp, float frametime )
|
||||
ship *shipp;
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if ( shipp->flags & SF_DYING ) return;
|
||||
if ( shipp->flags[Ship::Ship_Flags::Dying] ) return;
|
||||
|
||||
//disabled ships should stay on the battlefield if they were disabled during warpout
|
||||
//phreak 5/22/03
|
||||
if (shipp->flags & SF_DISABLED){
|
||||
shipp->flags &= ~(SF_DEPARTING);
|
||||
if (shipp->flags[Ship::Ship_Flags::Disabled]){
|
||||
shipp->flags.remove(Ship::Ship_Flags::Depart_dockbay);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Depart_warp);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1104,7 +1105,7 @@ bool shipfx_eye_in_shadow( vec3d *eye_pos, object * src_obj, int sun_n )
|
||||
}
|
||||
}
|
||||
|
||||
if ( sip->flags2 & SIF2_SHOW_SHIP_MODEL ) {
|
||||
if ( sip->flags[Ship::Info_Flags::Show_ship_model] ) {
|
||||
vm_vec_scale_add( &rp1, &rp0, &light_dir, Viewer_obj->radius*10.0f );
|
||||
|
||||
mc.model_instance_num = -1;
|
||||
@@ -1488,7 +1489,7 @@ void shipfx_emit_spark( int n, int sn )
|
||||
//
|
||||
// phreak: Mantis 1676 - Re-enable warpout clipping.
|
||||
|
||||
if ((shipp->flags & (SF_ARRIVING|SF_DEPART_WARP)) && (shipp->warpout_effect))
|
||||
if ((shipp->is_arriving() || shipp->flags[Ship::Ship_Flags::Depart_warp]) && (shipp->warpout_effect))
|
||||
{
|
||||
vec3d warp_pnt, tmp;
|
||||
matrix warp_orient;
|
||||
@@ -1500,10 +1501,10 @@ void shipfx_emit_spark( int n, int sn )
|
||||
|
||||
if ( vm_vec_dot( &tmp, &warp_orient.vec.fvec ) < 0.0f )
|
||||
{
|
||||
if (shipp->flags & SF_ARRIVING)// if in front of warp plane, don't create.
|
||||
if (shipp->is_arriving())// if in front of warp plane, don't create.
|
||||
create_spark = 0;
|
||||
} else {
|
||||
if (shipp->flags & SF_DEPART_WARP)
|
||||
if (shipp->flags[Ship::Ship_Flags::Depart_warp])
|
||||
create_spark = 0;
|
||||
}
|
||||
}
|
||||
@@ -1515,7 +1516,7 @@ void shipfx_emit_spark( int n, int sn )
|
||||
|
||||
pe.pos = outpnt; // Where the particles emit from
|
||||
|
||||
if ( shipp->flags & (SF_ARRIVING|SF_DEPART_WARP) ) {
|
||||
if (shipp->is_arriving() || shipp->flags[Ship::Ship_Flags::Depart_warp]) {
|
||||
// No velocity if going through warp.
|
||||
pe.vel = vmd_zero_vector;
|
||||
} else {
|
||||
@@ -1558,7 +1559,7 @@ void shipfx_emit_spark( int n, int sn )
|
||||
// first time through - set up end time and make heavier initially
|
||||
if ( sn > -1 ) {
|
||||
// Sparks for first time at this spot
|
||||
if (sip->flags & SIF_FIGHTER) {
|
||||
if (sip->flags[Ship::Info_Flags::Fighter]) {
|
||||
if (hull_percent > 0.6f) {
|
||||
// sparks only once when hull > 60%
|
||||
float spark_duration = (float)pow(2.0f, -5.0f*(hull_percent-1.3f)) * (1.0f + 0.6f*(frand()-0.5f)); // +- 30%
|
||||
@@ -2244,7 +2245,7 @@ int shipfx_large_blowup_do_frame(ship *shipp, float frametime)
|
||||
if ( timestamp_elapsed(the_split_ship->explosion_flash_timestamp) ) {
|
||||
if ( !the_split_ship->explosion_flash_started ) {
|
||||
object* objp = &Objects[shipp->objnum];
|
||||
if (objp->flags & OF_WAS_RENDERED) {
|
||||
if (objp->flags[Object::Object_Flags::Was_rendered]) {
|
||||
float excess_dist = vm_vec_dist(&Player_obj->pos, &objp->pos) - 2.0f*objp->radius - Player_obj->radius;
|
||||
float intensity = 1.0f - 0.1f*excess_dist / objp->radius;
|
||||
|
||||
@@ -2252,7 +2253,7 @@ int shipfx_large_blowup_do_frame(ship *shipp, float frametime)
|
||||
intensity = 1.0f;
|
||||
}
|
||||
|
||||
if (intensity > 0.1f && Ship_info[shipp->ship_info_index].flags2 & SIF2_FLASH) {
|
||||
if (intensity > 0.1f && Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Flash]) {
|
||||
big_explosion_flash(intensity);
|
||||
}
|
||||
}
|
||||
@@ -2562,24 +2563,24 @@ void shipfx_do_lightning_frame( ship *shipp )
|
||||
objp = &Objects[shipp->objnum];
|
||||
|
||||
// if this is not a nebula mission, don't do anything
|
||||
if(!(The_mission.flags & MISSION_FLAG_FULLNEB)){
|
||||
if(!(The_mission.flags[Mission::Mission_Flags::Fullneb])){
|
||||
shipp->lightning_stamp = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// if this not a cruiser or big ship
|
||||
if(!((sip->flags & SIF_CRUISER) || (sip->flags & SIF_BIG_SHIP) || (sip->flags & SIF_HUGE_SHIP))){
|
||||
if(!((sip->flags[Ship::Info_Flags::Cruiser]) || (sip->is_big_ship()) || (sip->is_huge_ship()))){
|
||||
shipp->lightning_stamp = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// determine stamp and count values
|
||||
if(sip->flags & SIF_CRUISER){
|
||||
if(sip->flags[Ship::Info_Flags::Cruiser]){
|
||||
stamp = (int)((float)(Nebl_cruiser_min + ((Nebl_cruiser_max - Nebl_cruiser_min) * Nebl_intensity)) * frand_range(0.8f, 1.1f));
|
||||
count = l_cruiser_count;
|
||||
}
|
||||
else {
|
||||
if(sip->flags & SIF_HUGE_SHIP){
|
||||
if(sip->is_huge_ship()){
|
||||
stamp = (int)((float)(Nebl_supercap_min + ((Nebl_supercap_max - Nebl_supercap_min) * Nebl_intensity)) * frand_range(0.8f, 1.1f));
|
||||
count = l_huge_count;
|
||||
} else {
|
||||
@@ -2729,7 +2730,7 @@ void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci)
|
||||
vm_vec_add(&shockwave_pos, &tail, &temp);
|
||||
|
||||
// if knossos device, make shockwave in center
|
||||
if (Ship_info[shipp->ship_info_index].flags & SIF_KNOSSOS_DEVICE) {
|
||||
if (Ship_info[shipp->ship_info_index].flags[Ship::Info_Flags::Knossos_device]) {
|
||||
shockwave_pos = Objects[shipp->objnum].pos;
|
||||
}
|
||||
|
||||
@@ -2780,7 +2781,7 @@ void engine_wash_ship_process(ship *shipp)
|
||||
float max_wash_dist, half_angle, radius_mult;
|
||||
|
||||
// if this is not a fighter or bomber, we don't care
|
||||
if ((objp->type != OBJ_SHIP) || !(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER|SIF_BOMBER)) ) {
|
||||
if ((objp->type != OBJ_SHIP) || !(Ship_info[shipp->ship_info_index].is_fighter_bomber()) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2822,9 +2823,9 @@ void engine_wash_ship_process(ship *shipp)
|
||||
ship_info *wash_sip = &Ship_info[wash_shipp->ship_info_index];
|
||||
|
||||
// don't do small ships
|
||||
if ( (wash_sip->flags & SIF_SMALL_SHIP) ) {
|
||||
continue;
|
||||
}
|
||||
if (wash_sip->is_small_ship()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pm = model_get(wash_sip->model_num);
|
||||
float ship_intensity = 0;
|
||||
@@ -2853,7 +2854,7 @@ void engine_wash_ship_process(ship *shipp)
|
||||
// check if thruster bank has engine wash
|
||||
if (bank->wash_info_pointer == NULL) {
|
||||
// if huge, give default engine wash
|
||||
if ((wash_sip->flags & SIF_HUGE_SHIP) && !Engine_wash_info.empty()) {
|
||||
if ((wash_sip->is_huge_ship()) && !Engine_wash_info.empty()) {
|
||||
bank->wash_info_pointer = &Engine_wash_info[0];
|
||||
nprintf(("wash", "Adding default engine wash to ship %s", wash_sip->name));
|
||||
} else {
|
||||
@@ -3397,9 +3398,9 @@ int WarpEffect::warpEnd()
|
||||
if(!this->isValid())
|
||||
return 0;
|
||||
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_1);
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_2);
|
||||
shipp->flags &= (~SF_DEPART_WARP);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_1);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_2);
|
||||
shipp->flags.remove(Ship::Ship_Flags::Depart_warp);
|
||||
|
||||
// let physics in on it too.
|
||||
objp->phys_info.flags &= (~PF_WARP_IN);
|
||||
@@ -3527,11 +3528,11 @@ int WE_Default::warpStart()
|
||||
stage_duration[2] = fl2i(shipfx_calculate_warp_time(objp, WD_WARP_IN)*1000.0f);
|
||||
stage_time_end = timestamp(stage_duration[1]);
|
||||
total_time_end = stage_duration[1] + stage_duration[2];
|
||||
shipp->flags |= SF_ARRIVING_STAGE_1;
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_1);
|
||||
}
|
||||
else if(direction == WD_WARP_OUT)
|
||||
{
|
||||
shipp->flags |= SF_DEPART_WARP;
|
||||
shipp->flags.set(Ship::Ship_Flags::Depart_warp);
|
||||
|
||||
// Make the warp effect stage 1 last SHIP_WARP_TIME1 seconds.
|
||||
if ( objp == Player_obj ) {
|
||||
@@ -3567,14 +3568,14 @@ int WE_Default::warpFrame(float frametime)
|
||||
{
|
||||
if(direction == WD_WARP_IN)
|
||||
{
|
||||
if ((shipp->flags & SF_ARRIVING_STAGE_1) && timestamp_elapsed(stage_time_end))
|
||||
if ((shipp->flags[Ship::Ship_Flags::Arriving_stage_1]) && timestamp_elapsed(stage_time_end))
|
||||
{
|
||||
// let physics know the ship is going to warp in.
|
||||
objp->phys_info.flags |= PF_WARP_IN;
|
||||
|
||||
// done doing stage 1 of warp, so go on to stage 2
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_1);
|
||||
shipp->flags |= SF_ARRIVING_STAGE_2;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_2);
|
||||
|
||||
float warp_time = shipfx_calculate_warp_time(objp, WD_WARP_IN);
|
||||
float speed = shipfx_calculate_warp_dist(objp) / warp_time; // How long it takes to move through warp effect
|
||||
@@ -3592,13 +3593,13 @@ int WE_Default::warpFrame(float frametime)
|
||||
|
||||
stage_time_end = timestamp(fl2i(warp_time*1000.0f));
|
||||
}
|
||||
else if ( (shipp->flags & SF_ARRIVING_STAGE_2) && timestamp_elapsed(stage_time_end) )
|
||||
else if ( (shipp->flags[Ship::Ship_Flags::Arriving_stage_2]) && timestamp_elapsed(stage_time_end) )
|
||||
{
|
||||
// done doing stage 2 of warp, so turn off arriving flag
|
||||
this->warpEnd();
|
||||
|
||||
// notify physics to slow down
|
||||
if (sip->flags & SIF_SUPERCAP) {
|
||||
if (sip->flags[Ship::Info_Flags::Supercap]) {
|
||||
// let physics know this is a special warp in
|
||||
objp->phys_info.flags |= PF_SPECIAL_WARP_IN;
|
||||
}
|
||||
@@ -3646,9 +3647,9 @@ int WE_Default::warpFrame(float frametime)
|
||||
}
|
||||
}
|
||||
|
||||
// MWA 10/21/97 -- added shipp->flags & SF_NO_DEPARTURE_WARP part of next if statement. For ships
|
||||
// MWA 10/21/97 -- added shipp->flags[Ship::Ship_Flags::No_departure_warp] part of next if statement. For ships
|
||||
// that don't get a wormhole effect, I wanted to drop into this code immediately.
|
||||
if ( (warp_pos > objp->radius) || (shipp->flags & SF_NO_DEPARTURE_WARP) || timed_out ) {
|
||||
if ( (warp_pos > objp->radius) || (shipp->flags[Ship::Ship_Flags::No_departure_warp]) || timed_out ) {
|
||||
this->warpEnd();
|
||||
}
|
||||
}
|
||||
@@ -3848,23 +3849,21 @@ int WE_BSG::warpStart()
|
||||
vm_vec_sub(&autocenter, &dock_center, &objp->pos);
|
||||
}
|
||||
|
||||
if(direction == WD_WARP_IN)
|
||||
shipp->flags |= SF_ARRIVING_STAGE_1;
|
||||
if (direction == WD_WARP_IN)
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_1);
|
||||
else
|
||||
shipp->flags |= SF_DEPART_WARP;
|
||||
shipp->flags.set(Ship::Ship_Flags::Depart_warp);
|
||||
|
||||
//*****Sound
|
||||
int gs_start_index = -1;
|
||||
int gs_end_index = -1;
|
||||
if(direction == WD_WARP_IN)
|
||||
{
|
||||
shipp->flags |= SF_ARRIVING_STAGE_1;
|
||||
gs_start_index = sip->warpin_snd_start;
|
||||
gs_end_index = sip->warpin_snd_end;
|
||||
}
|
||||
else if(direction == WD_WARP_OUT)
|
||||
{
|
||||
shipp->flags |= SF_DEPART_WARP;
|
||||
gs_start_index = sip->warpout_snd_start;
|
||||
gs_end_index = sip->warpout_snd_end;
|
||||
}
|
||||
@@ -3917,8 +3916,8 @@ int WE_BSG::warpFrame(float frametime)
|
||||
case 1:
|
||||
if(direction == WD_WARP_IN)
|
||||
{
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_1);
|
||||
shipp->flags |= SF_ARRIVING_STAGE_2;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -4180,12 +4179,12 @@ int WE_Homeworld::warpStart()
|
||||
int gs_index = -1;
|
||||
if(direction == WD_WARP_IN)
|
||||
{
|
||||
shipp->flags |= SF_ARRIVING_STAGE_1;
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_1);
|
||||
gs_index = sip->warpin_snd_start;
|
||||
}
|
||||
else if(direction == WD_WARP_OUT)
|
||||
{
|
||||
shipp->flags |= SF_DEPART_WARP;
|
||||
shipp->flags.set(Ship::Ship_Flags::Depart_warp);
|
||||
gs_index = sip->warpout_snd_start;
|
||||
}
|
||||
else
|
||||
@@ -4225,8 +4224,8 @@ int WE_Homeworld::warpFrame(float frametime)
|
||||
if(direction == WD_WARP_IN)
|
||||
{
|
||||
objp->phys_info.flags |= PF_WARP_IN;
|
||||
shipp->flags &= (~SF_ARRIVING_STAGE_1);
|
||||
shipp->flags |= SF_ARRIVING_STAGE_2;
|
||||
shipp->flags.remove(Ship::Ship_Flags::Arriving_stage_1);
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_2);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -4369,14 +4368,14 @@ int WE_Hyperspace::warpStart()
|
||||
|
||||
if(direction == WD_WARP_IN)
|
||||
{
|
||||
shipp->flags |= SF_ARRIVING_STAGE_1;
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_1);
|
||||
objp->phys_info.flags |= PF_WARP_IN;
|
||||
objp->phys_info.vel.xyz.z = (scale_factor / sip->warpin_time)*1000.0f;
|
||||
objp->flags &= ~OF_PHYSICS;
|
||||
objp->flags.remove(Object::Object_Flags::Physics);
|
||||
}
|
||||
else if(direction == WD_WARP_OUT)
|
||||
{
|
||||
shipp->flags |= SF_DEPART_WARP;
|
||||
shipp->flags.set(Ship::Ship_Flags::Depart_warp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4405,9 +4404,9 @@ int WE_Hyperspace::warpFrame(float frametime)
|
||||
vm_vec_scale( &vel, initial_velocity );
|
||||
objp->phys_info.vel = vel;
|
||||
objp->phys_info.desired_vel = vel;
|
||||
shipp->flags |= SF_ARRIVING_STAGE_2;
|
||||
shipp->flags.set(Ship::Ship_Flags::Arriving_stage_2);
|
||||
}
|
||||
objp->flags |= OF_PHYSICS;
|
||||
objp->flags.set(Object::Object_Flags::Physics);
|
||||
this->warpEnd();
|
||||
}
|
||||
else
|
||||
|
||||
+39
-39
@@ -252,7 +252,7 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d* hitpos
|
||||
if ( psub->type == SUBSYSTEM_TURRET ) {
|
||||
if ( ship_p->subsys_info[type].aggregate_current_hits <= 0.0f ) {
|
||||
// Don't create "disarmed" event for small ships.
|
||||
if (!(Ship_info[ship_p->ship_info_index].flags & SIF_SMALL_SHIP)) {
|
||||
if (!(Ship_info[ship_p->ship_info_index].is_small_ship())) {
|
||||
mission_log_add_entry(LOG_SHIP_DISARMED, ship_p->ship_name, NULL );
|
||||
// ship_p->flags |= SF_DISARMED;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d* hitpos
|
||||
|
||||
if ( ship_p->subsys_info[type].aggregate_current_hits <= 0.0f ) {
|
||||
mission_log_add_entry(LOG_SHIP_DISABLED, ship_p->ship_name, NULL );
|
||||
ship_p->flags |= SF_DISABLED; // add the disabled flag
|
||||
ship_p->flags.set(Ship::Ship_Flags::Disabled); // add the disabled flag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,9 +279,9 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d* hitpos
|
||||
if (notify && !no_explosion) {
|
||||
// play sound effect when subsys gets blown up
|
||||
int sound_index=-1;
|
||||
if ( Ship_info[ship_p->ship_info_index].flags & SIF_HUGE_SHIP ) {
|
||||
if ( Ship_info[ship_p->ship_info_index].is_huge_ship() ) {
|
||||
sound_index=SND_CAPSHIP_SUBSYS_EXPLODE;
|
||||
} else if ( Ship_info[ship_p->ship_info_index].flags & SIF_BIG_SHIP ) {
|
||||
} else if ( Ship_info[ship_p->ship_info_index].is_big_ship() ) {
|
||||
sound_index=SND_SUBSYS_EXPLODE;
|
||||
}
|
||||
if ( sound_index >= 0 ) {
|
||||
@@ -478,7 +478,7 @@ float do_subobj_hit_stuff(object *ship_objp, object *other_obj, vec3d *hitpos, i
|
||||
{
|
||||
// MK, 9/2/99. Shockwaves do zero subsystem damage on small ships.
|
||||
// Goober5000 - added back in via flag
|
||||
if ((Ship_info[ship_p->ship_info_index].flags & (SIF_SMALL_SHIP)) && !(The_mission.ai_profile->flags & AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS))
|
||||
if ((Ship_info[ship_p->ship_info_index].is_small_ship()) && !(The_mission.ai_profile->flags & AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS))
|
||||
return damage;
|
||||
else {
|
||||
damage_left = shockwave_get_damage(other_obj->instance) / 4.0f;
|
||||
@@ -688,7 +688,7 @@ float do_subobj_hit_stuff(object *ship_objp, object *other_obj, vec3d *hitpos, i
|
||||
if ( (damage_to_apply > 0.1f) && !(MULTIPLAYER_CLIENT) )
|
||||
{
|
||||
// Decrease damage to subsystems to player ships.
|
||||
if (ship_objp->flags & OF_PLAYER_SHIP){
|
||||
if (ship_objp->flags[Object::Object_Flags::Player_ship]){
|
||||
ss_dif_scale = The_mission.ai_profile->subsys_damage_scale[Game_skill_level];
|
||||
}
|
||||
|
||||
@@ -796,7 +796,7 @@ void shiphit_record_player_killer(object *killer_objp, player *p)
|
||||
}
|
||||
|
||||
// in multiplayer, record callsign of killer if killed by another player
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && ( Objects[killer_objp->parent].flags & OF_PLAYER_SHIP) ) {
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && ( Objects[killer_objp->parent].flags[Object::Object_Flags::Player_ship]) ) {
|
||||
int pnum;
|
||||
|
||||
pnum = multi_find_player_by_object( &Objects[killer_objp->parent] );
|
||||
@@ -820,7 +820,7 @@ void shiphit_record_player_killer(object *killer_objp, player *p)
|
||||
p->flags |= PLAYER_FLAGS_KILLED_SELF_SHOCKWAVE;
|
||||
}
|
||||
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && ( Objects[killer_objp->parent].flags & OF_PLAYER_SHIP) ) {
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && ( Objects[killer_objp->parent].flags[Object::Object_Flags::Player_ship]) ) {
|
||||
int pnum;
|
||||
|
||||
pnum = multi_find_player_by_object( &Objects[killer_objp->parent] );
|
||||
@@ -840,7 +840,7 @@ void shiphit_record_player_killer(object *killer_objp, player *p)
|
||||
p->killer_weapon_index=-1;
|
||||
p->killer_species = Ship_info[Ships[killer_objp->instance].ship_info_index].species;
|
||||
|
||||
if ( Ships[killer_objp->instance].flags & SF_EXPLODED ) {
|
||||
if ( Ships[killer_objp->instance].flags[Ship::Ship_Flags::Exploded] ) {
|
||||
p->flags |= PLAYER_FLAGS_KILLED_BY_EXPLOSION;
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ void shiphit_record_player_killer(object *killer_objp, player *p)
|
||||
}
|
||||
|
||||
// in multiplayer, record callsign of killer if killed by another player
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && (killer_objp->flags & OF_PLAYER_SHIP) ) {
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && (killer_objp->flags[Object::Object_Flags::Player_ship]) ) {
|
||||
int pnum;
|
||||
|
||||
pnum = multi_find_player_by_object( killer_objp );
|
||||
@@ -914,7 +914,7 @@ void show_dead_message(object *ship_objp, object *other_obj)
|
||||
player *player_p;
|
||||
|
||||
// not doing anything when a non player dies.
|
||||
if ( !(ship_objp->flags & OF_PLAYER_SHIP) ){
|
||||
if ( !(ship_objp->flags[Object::Object_Flags::Player_ship]) ){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1064,7 +1064,7 @@ int get_max_sparks(object* ship_objp)
|
||||
|
||||
ship *ship_p = &Ships[ship_objp->instance];
|
||||
ship_info* si = &Ship_info[ship_p->ship_info_index];
|
||||
if (si->flags & SIF_FIGHTER) {
|
||||
if (si->flags[Ship::Info_Flags::Fighter]) {
|
||||
float hull_percent = ship_objp->hull_strength / ship_p->ship_max_hull_strength;
|
||||
|
||||
if (hull_percent > 0.8f) {
|
||||
@@ -1203,7 +1203,7 @@ void ship_hit_create_sparks(object *ship_objp, vec3d *hitpos, int submodel_num)
|
||||
max_sparks = get_max_sparks(ship_objp);
|
||||
|
||||
if (n >= max_sparks) {
|
||||
if (sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if (sip->is_big_or_huge()) {
|
||||
// large ship, choose intelligently
|
||||
n = choose_next_spark(ship_objp, hitpos);
|
||||
} else {
|
||||
@@ -1386,8 +1386,8 @@ void ship_generic_kill_stuff( object *objp, float percent_killed )
|
||||
|
||||
ship_stop_fire_primary(objp); //mostly for stopping fighter beam looping sounds -Bobboau
|
||||
|
||||
sp->flags |= SF_DYING;
|
||||
objp->phys_info.flags |= (PF_DEAD_DAMP | PF_REDUCED_DAMP);
|
||||
sp->flags.set(Ship::Ship_Flags::Dying);
|
||||
objp->phys_info.flags |= (PF_DEAD_DAMP | PF_REDUCED_DAMP);
|
||||
delta_time = (int) (sip->death_roll_base_time);
|
||||
|
||||
// For smaller ships, subtract off time proportional to excess damage delivered.
|
||||
@@ -1395,7 +1395,7 @@ void ship_generic_kill_stuff( object *objp, float percent_killed )
|
||||
delta_time -= (int) (1.01f - 4*percent_killed);
|
||||
|
||||
// Cut down cargo death rolls. Looks a little silly. -- MK, 3/30/98.
|
||||
if (sip->flags & SIF_CARGO) {
|
||||
if (sip->flags[Ship::Info_Flags::Cargo]) {
|
||||
delta_time /= 4;
|
||||
}
|
||||
|
||||
@@ -1403,7 +1403,7 @@ void ship_generic_kill_stuff( object *objp, float percent_killed )
|
||||
if (delta_time < 2)
|
||||
delta_time = 2;
|
||||
|
||||
if (objp->flags & OF_PLAYER_SHIP) {
|
||||
if (objp->flags[Object::Object_Flags::Player_ship]) {
|
||||
// Note: Kamikaze ships have no minimum death time.
|
||||
if (!(Ai_info[Ships[objp->instance].ai_index].ai_flags & AIF_KAMIKAZE) && (delta_time < MIN_PLAYER_DEATHROLL_TIME))
|
||||
delta_time = MIN_PLAYER_DEATHROLL_TIME;
|
||||
@@ -1423,7 +1423,7 @@ void ship_generic_kill_stuff( object *objp, float percent_killed )
|
||||
delta_time = 2;
|
||||
|
||||
// Knossos gets 7-10 sec to die, time for "little" explosions
|
||||
if (Ship_info[sp->ship_info_index].flags & SIF_KNOSSOS_DEVICE) {
|
||||
if (Ship_info[sp->ship_info_index].flags[Ship::Info_Flags::Knossos_device]) {
|
||||
delta_time = 7000 + (int)(frand() * 3000.0f);
|
||||
Ship_info[sp->ship_info_index].explosion_propagates = 0;
|
||||
}
|
||||
@@ -1446,7 +1446,7 @@ void ship_generic_kill_stuff( object *objp, float percent_killed )
|
||||
if (sip->vaporize_chance > 0.0f)
|
||||
vapChance = sip->vaporize_chance;
|
||||
|
||||
if (sp->flags & SF_VAPORIZE || frand() < vapChance) {
|
||||
if (sp->flags[Ship::Ship_Flags::Vaporize] || frand() < vapChance) {
|
||||
// Assert(Ship_info[sp->ship_info_index].flags & SIF_SMALL_SHIP);
|
||||
|
||||
// LIVE FOR 100 MS
|
||||
@@ -1570,7 +1570,7 @@ void ship_hit_kill(object *ship_objp, object *other_obj, float percent_killed, i
|
||||
}
|
||||
|
||||
// maybe vaporize him
|
||||
if(sp->flags & SF_VAPORIZE){
|
||||
if(sp->flags[Ship::Ship_Flags::Vaporize]){
|
||||
ship_vaporize(sp);
|
||||
}
|
||||
|
||||
@@ -1679,7 +1679,7 @@ void ship_hit_kill(object *ship_objp, object *other_obj, float percent_killed, i
|
||||
}
|
||||
|
||||
// if a non-player is dying, play a scream
|
||||
if ( !(ship_objp->flags & OF_PLAYER_SHIP) ) {
|
||||
if ( !(ship_objp->flags[Object::Object_Flags::Player_ship]) ) {
|
||||
ship_maybe_scream(sp);
|
||||
}
|
||||
|
||||
@@ -1757,7 +1757,7 @@ void ship_apply_whack(vec3d *force, vec3d *hit_pos, object *objp)
|
||||
// correct torque.
|
||||
// Addendum: this block is now not executed for docked fighters or bombers because the whack
|
||||
// looks like the fighter is doing evasive maneuvers
|
||||
if ((objp->type != OBJ_SHIP) || !(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)))
|
||||
if ((objp->type != OBJ_SHIP) || !(Ship_info[Ships[objp->instance].ship_info_index].is_fighter_bomber()))
|
||||
{
|
||||
vec3d world_hit_pos, world_center_pos;
|
||||
|
||||
@@ -1799,7 +1799,7 @@ void shiphit_hit_after_death(object *ship_objp, float damage)
|
||||
}
|
||||
|
||||
// Don't adjust vaporized ship
|
||||
if (shipp->flags & SF_VAPORIZE) {
|
||||
if (shipp->flags[Ship::Ship_Flags::Vaporize]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1815,14 +1815,14 @@ void shiphit_hit_after_death(object *ship_objp, float damage)
|
||||
time_remaining = timestamp_until(shipp->final_death_time);
|
||||
|
||||
//nprintf(("AI", "Gametime = %7.3f, Time until %s dies = %7.3f, delta = %7.3f\n", f2fl(Missiontime), Ships[ship_objp->instance].ship_name, (float)time_remaining/1000.0f, delta_time));
|
||||
if (ship_objp->flags & OF_PLAYER_SHIP)
|
||||
if (ship_objp->flags[Object::Object_Flags::Player_ship])
|
||||
if (time_remaining < MIN_PLAYER_DEATHROLL_TIME)
|
||||
return;
|
||||
|
||||
// nprintf(("AI", "Subtracting off %7.3f seconds from deathroll, reducing to %7.3f\n", (float) delta_time/1000.0f, (float) (time_remaining - delta_time)/1000.0f));
|
||||
|
||||
delta_time = time_remaining - delta_time;
|
||||
if (ship_objp->flags & OF_PLAYER_SHIP)
|
||||
if (ship_objp->flags[Object::Object_Flags::Player_ship])
|
||||
if (delta_time < MIN_PLAYER_DEATHROLL_TIME)
|
||||
delta_time = MIN_PLAYER_DEATHROLL_TIME;
|
||||
|
||||
@@ -1858,7 +1858,7 @@ int maybe_shockwave_damage_adjust(object *ship_objp, object *other_obj, float *d
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(Ship_info[Ships[ship_objp->instance].ship_info_index].flags & SIF_HUGE_SHIP)) {
|
||||
if (!(Ship_info[Ships[ship_objp->instance].ship_info_index].is_huge_ship())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1982,7 +1982,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
}
|
||||
else {
|
||||
// Do a little "skill" balancing for the player in single player and coop multiplayer
|
||||
if (ship_objp->flags & OF_PLAYER_SHIP) {
|
||||
if (ship_objp->flags[Object::Object_Flags::Player_ship]) {
|
||||
// Nuke - store it in a couple factor and we will apply it where needed
|
||||
difficulty_scale_factor *= The_mission.ai_profile->player_damage_scale[Game_skill_level];
|
||||
}
|
||||
@@ -1993,7 +1993,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
// apply pain to me
|
||||
|
||||
// Goober5000: make sure other_obj doesn't cause a read violation!
|
||||
if (other_obj && !(Ship_info[Ships[Player_obj->instance].ship_info_index].flags2 & SIF2_NO_PAIN_FLASH))
|
||||
if (other_obj && !(Ship_info[Ships[Player_obj->instance].ship_info_index].flags[Ship::Info_Flags::No_pain_flash]))
|
||||
{
|
||||
// For the record, ship_hit_pain seems to simply be the red flash that appears
|
||||
// on the screen when you're hit.
|
||||
@@ -2020,19 +2020,19 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
|
||||
|
||||
// If the ship is invulnerable, do nothing
|
||||
if (ship_objp->flags & OF_INVULNERABLE) {
|
||||
if (ship_objp->flags[Object::Object_Flags::Invulnerable]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if ship is already dying, shorten deathroll.
|
||||
if (shipp->flags & SF_DYING) {
|
||||
if (shipp->flags[Ship::Ship_Flags::Dying]) {
|
||||
shiphit_hit_after_death(ship_objp, (damage * difficulty_scale_factor));
|
||||
return;
|
||||
}
|
||||
|
||||
// If we hit the shield, reduce it's strength and found
|
||||
// out how much damage is left over.
|
||||
if ( quadrant >= 0 && !(ship_objp->flags & OF_NO_SHIELDS) ) {
|
||||
if ( quadrant >= 0 && !(ship_objp->flags[Object::Object_Flags::No_shields]) ) {
|
||||
// mprintf(("applying damage ge to shield\n"));
|
||||
float shield_factor = -1.0f;
|
||||
int weapon_info_index;
|
||||
@@ -2231,8 +2231,8 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
if (bobjn >= 0)
|
||||
{
|
||||
if ( !(The_mission.ai_profile->flags & AIPF_INCLUDE_BEAMS_IN_STAT_CALCS) &&
|
||||
!(Ship_info[Ships[Objects[bobjn].instance].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) &&
|
||||
!(Objects[bobjn].flags & OF_PLAYER_SHIP) ) {
|
||||
!(Ship_info[Ships[Objects[bobjn].instance].ship_info_index].is_fighter_bomber()) &&
|
||||
!(Objects[bobjn].flags[Object::Object_Flags::Player_ship]) ) {
|
||||
bobjn = -1;
|
||||
}
|
||||
}
|
||||
@@ -2258,16 +2258,16 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
// Only vaporize once
|
||||
// multiplayer clients should skip this
|
||||
if(!MULTIPLAYER_CLIENT) {
|
||||
if ( !(shipp->flags & SF_VAPORIZE) ) {
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::Vaporize]) ) {
|
||||
// Only small ships can be vaporized
|
||||
if (sip->flags & (SIF_SMALL_SHIP)) {
|
||||
if (sip->is_small_ship()) {
|
||||
if (other_obj) { // Goober5000 check for NULL
|
||||
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)) ) {
|
||||
// Flag as vaporized
|
||||
shipp->flags |= SF_VAPORIZE;
|
||||
shipp->flags.set(Ship::Ship_Flags::Vaporize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2285,7 +2285,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
|
||||
percent_killed = 1.0f;
|
||||
}
|
||||
|
||||
if ( !(shipp->flags & SF_DYING) && !MULTIPLAYER_CLIENT) { // if not killed, then kill
|
||||
if ( !(shipp->flags[Ship::Ship_Flags::Dying]) && !MULTIPLAYER_CLIENT) { // if not killed, then kill
|
||||
ship_hit_kill(ship_objp, other_obj, percent_killed, 0);
|
||||
}
|
||||
}
|
||||
@@ -2371,7 +2371,7 @@ void ship_apply_local_damage(object *ship_objp, object *other_obj, vec3d *hitpos
|
||||
// don't do damage.
|
||||
// Ie, player can always do damage. AI can only damage team if that ship is targeted.
|
||||
if (wp->target_num != OBJ_INDEX(ship_objp)) {
|
||||
if ((ship_p->team == wp->team) && !(Objects[other_obj->parent].flags & OF_PLAYER_SHIP) ) {
|
||||
if ((ship_p->team == wp->team) && !(Objects[other_obj->parent].flags[Object::Object_Flags::Player_ship]) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2555,7 +2555,7 @@ void ship_hit_pain(float damage, int quadrant)
|
||||
ship *shipp = &Ships[Player_obj->instance];
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if (!(Player_obj->flags & OF_INVULNERABLE))
|
||||
if (!(Player_obj->flags[Object::Object_Flags::Invulnerable]))
|
||||
{
|
||||
if (Shield_pain_flash_factor != 0.0f && quadrant >= 0)
|
||||
{
|
||||
|
||||
@@ -252,6 +252,7 @@ set (file_root_globalincs
|
||||
globalincs/version.h
|
||||
globalincs/vmallocator.h
|
||||
globalincs/scp_defines.h
|
||||
globalincs/flagset.h
|
||||
)
|
||||
|
||||
IF (WIN32)
|
||||
@@ -561,6 +562,7 @@ set (file_root_mission
|
||||
mission/missionparse.h
|
||||
mission/missiontraining.cpp
|
||||
mission/missiontraining.h
|
||||
mission/mission_flags.h
|
||||
)
|
||||
|
||||
# MissionUI files
|
||||
@@ -607,6 +609,7 @@ set (file_root_model
|
||||
model/modelrender.h
|
||||
model/modelrender.cpp
|
||||
model/modelsinc.h
|
||||
model/model_flags.h
|
||||
)
|
||||
|
||||
# Nebula files
|
||||
@@ -719,6 +722,7 @@ set (file_root_object
|
||||
object/parseobjectdock.h
|
||||
object/waypoint.cpp
|
||||
object/waypoint.h
|
||||
object/object_flags.h
|
||||
)
|
||||
|
||||
# Observer files
|
||||
@@ -880,6 +884,7 @@ set (file_root_ship
|
||||
ship/shiphit.cpp
|
||||
ship/shiphit.h
|
||||
ship/subsysdamage.h
|
||||
ship/ship_flags.h
|
||||
)
|
||||
|
||||
# Sound files
|
||||
@@ -988,6 +993,7 @@ set (file_root_weapon
|
||||
weapon/trails.h
|
||||
weapon/weapon.h
|
||||
weapon/weapons.cpp
|
||||
weapon/weapon_flags.h
|
||||
)
|
||||
|
||||
# Windows stubs files
|
||||
|
||||
@@ -208,7 +208,7 @@ void nebula_render()
|
||||
gr_zbuffer_set(saved_gr_zbuffering);
|
||||
|
||||
// always switch off fogging for good measure
|
||||
if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode == NEB2_RENDER_NONE)){
|
||||
if((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode == NEB2_RENDER_NONE)){
|
||||
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,7 +790,7 @@ void stars_post_level_init()
|
||||
stars_set_background_model(The_mission.skybox_model, NULL, The_mission.skybox_flags);
|
||||
stars_set_background_orientation(&The_mission.skybox_orientation);
|
||||
|
||||
stars_load_debris( ((The_mission.flags & MISSION_FLAG_FULLNEB) || Nebula_sexp_used) );
|
||||
stars_load_debris( ((The_mission.flags[Mission::Mission_Flags::Fullneb]) || Nebula_sexp_used) );
|
||||
|
||||
// following code randomly distributes star points within a sphere volume, which
|
||||
// avoids there being denser areas along the edges and in corners that we had in the
|
||||
@@ -1229,7 +1229,7 @@ void stars_draw_bitmaps(int show_bitmaps)
|
||||
return;
|
||||
|
||||
// if we're in the nebula, don't render any backgrounds
|
||||
if (The_mission.flags & MISSION_FLAG_FULLNEB)
|
||||
if (The_mission.flags[Mission::Mission_Flags::Fullneb])
|
||||
return;
|
||||
|
||||
// detail settings
|
||||
@@ -1584,7 +1584,7 @@ void stars_draw_debris()
|
||||
gr_set_color( 0, 0, 0 );
|
||||
|
||||
// turn off fogging
|
||||
if (The_mission.flags & MISSION_FLAG_FULLNEB) {
|
||||
if (The_mission.flags[Mission::Mission_Flags::Fullneb]) {
|
||||
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1604,7 +1604,7 @@ void stars_draw_debris()
|
||||
d->vclip = i % MAX_DEBRIS_VCLIPS; //rand()
|
||||
|
||||
// if we're in full neb mode
|
||||
if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE)) {
|
||||
if((The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE)) {
|
||||
d->size = i2fl(myrand() % 4)*BASE_SIZE_NEB;
|
||||
} else {
|
||||
d->size = i2fl(myrand() % 4)*BASE_SIZE;
|
||||
@@ -1623,7 +1623,7 @@ void stars_draw_debris()
|
||||
int frame = Missiontime / (DEBRIS_ROT_MIN + (i % DEBRIS_ROT_RANGE) * DEBRIS_ROT_RANGE_SCALER);
|
||||
frame %= Debris_vclips[d->vclip].nframes;
|
||||
|
||||
if ( (The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode != NEB2_RENDER_NONE) ) {
|
||||
if ( (The_mission.flags[Mission::Mission_Flags::Fullneb]) && (Neb2_render_mode != NEB2_RENDER_NONE) ) {
|
||||
gr_set_bitmap( Debris_vclips[d->vclip].bm + frame, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.3f);
|
||||
} else {
|
||||
gr_set_bitmap( Debris_vclips[d->vclip].bm + frame, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f);
|
||||
@@ -1679,7 +1679,7 @@ void stars_draw(int show_stars, int show_suns, int show_nebulas, int show_subspa
|
||||
stars_draw_background();
|
||||
}
|
||||
|
||||
if ( !env && show_stars && (Nmodel_num < 0) && (Game_detail_flags & DETAIL_FLAG_STARS) && !(The_mission.flags & MISSION_FLAG_FULLNEB) && (supernova_active() < 3) ) {
|
||||
if ( !env && show_stars && (Nmodel_num < 0) && (Game_detail_flags & DETAIL_FLAG_STARS) && !(The_mission.flags[Mission::Mission_Flags::Fullneb]) && (supernova_active() < 3) ) {
|
||||
stars_draw_stars();
|
||||
}
|
||||
|
||||
@@ -2347,9 +2347,10 @@ const char *stars_get_name_from_instance(int index, bool is_a_sun)
|
||||
// WMC/Goober5000
|
||||
void stars_set_nebula(bool activate)
|
||||
{
|
||||
if (activate)
|
||||
The_mission.flags.set(Mission::Mission_Flags::Fullneb, activate);
|
||||
|
||||
if (activate)
|
||||
{
|
||||
The_mission.flags |= MISSION_FLAG_FULLNEB;
|
||||
Toggle_text_alpha = TOGGLE_TEXT_NEBULA_ALPHA;
|
||||
HUD_contrast = 1;
|
||||
if(Fred_running) {
|
||||
@@ -2364,7 +2365,6 @@ void stars_set_nebula(bool activate)
|
||||
}
|
||||
else
|
||||
{
|
||||
The_mission.flags &= ~MISSION_FLAG_FULLNEB;
|
||||
Toggle_text_alpha = TOGGLE_TEXT_NORMAL_ALPHA;
|
||||
Neb2_render_mode = NEB2_RENDER_NONE;
|
||||
Debris_vclips = Debris_vclips_normal;
|
||||
|
||||
+12
-12
@@ -300,13 +300,13 @@ void scoring_eval_badges(scoring_struct *sc)
|
||||
// to determine badges, we count kills based on fighter/bomber types. We must count kills in
|
||||
// all time stats + current mission stats. And, only for enemy fighters/bombers
|
||||
total_kills = 0;
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it ) {
|
||||
if ( (it->flags & SIF_FIGHTER) || (it->flags & SIF_BOMBER) ) {
|
||||
auto i = std::distance(Ship_info.cbegin(), it);
|
||||
total_kills += sc->m_okKills[i];
|
||||
total_kills += sc->kills[i];
|
||||
}
|
||||
}
|
||||
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
|
||||
if (it->is_fighter_bomber()) {
|
||||
auto i = std::distance(Ship_info.cbegin(), it);
|
||||
total_kills += sc->m_okKills[i];
|
||||
total_kills += sc->kills[i];
|
||||
}
|
||||
}
|
||||
|
||||
// total_kills should now reflect the number of kills on hostile fighters/bombers. Check this number
|
||||
// against badge kill numbers, and award the appropriate badges as neccessary.
|
||||
@@ -467,7 +467,7 @@ void scoring_level_close(int accepted)
|
||||
// If this mission doesn't allow promotion or badges
|
||||
// then be sure that these don't get done. Don't allow promotions or badges when
|
||||
// playing normally and not in a campaign.
|
||||
if ( (The_mission.flags & MISSION_FLAG_NO_PROMOTION) || ((Game_mode & GM_NORMAL) && !(Game_mode & GM_CAMPAIGN_MODE)) ) {
|
||||
if ( (The_mission.flags[Mission::Mission_Flags::No_promotion]) || ((Game_mode & GM_NORMAL) && !(Game_mode & GM_CAMPAIGN_MODE)) ) {
|
||||
if ( Player->stats.m_promotion_earned != -1) {
|
||||
Player->stats.rank--;
|
||||
Player->stats.m_promotion_earned = -1;
|
||||
@@ -708,7 +708,7 @@ int scoring_eval_kill(object *ship_objp)
|
||||
// get the ship info index of the ship type of this kill. we need to take ship
|
||||
// copies into account here.
|
||||
si_index = dead_ship->ship_info_index;
|
||||
if (Ship_info[si_index].flags & SIF_SHIP_COPY)
|
||||
if (Ship_info[si_index].flags[Ship::Info_Flags::Ship_copy])
|
||||
{
|
||||
char temp[NAME_LENGTH];
|
||||
strcpy_s(temp, Ship_info[si_index].name);
|
||||
@@ -720,7 +720,7 @@ int scoring_eval_kill(object *ship_objp)
|
||||
|
||||
// if he killed a guy on his own team increment his bonehead kills
|
||||
if((Ships[Objects[plr->objnum].instance].team == dead_ship->team) && !MULTI_DOGFIGHT ){
|
||||
if (!(The_mission.flags & MISSION_FLAG_NO_TRAITOR)) {
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::No_traitor])) {
|
||||
plr->stats.m_bonehead_kills++;
|
||||
kill_score = -(int)(dead_ship->score * scoring_get_scale_factor());
|
||||
plr->stats.m_score += kill_score;
|
||||
@@ -768,7 +768,7 @@ int scoring_eval_kill(object *ship_objp)
|
||||
// award teammates % of score value for big ship kills
|
||||
// not in dogfight tho
|
||||
// and not if there is no assist threshold (as otherwise assists could get higher scores than kills)
|
||||
if (!(Netgame.type_flags & NG_TYPE_DOGFIGHT) && (Ship_info[dead_ship->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
|
||||
if (!(Netgame.type_flags & NG_TYPE_DOGFIGHT) && (Ship_info[dead_ship->ship_info_index].is_big_or_huge())) {
|
||||
for (idx=0; idx<MAX_PLAYERS; idx++) {
|
||||
if (MULTI_CONNECTED(Net_players[idx]) && (Net_players[idx].p_info.team == net_plr->p_info.team) && (&Net_players[idx] != net_plr)) {
|
||||
assist_score = (int)(dead_ship->score * The_mission.ai_profile->assist_award_percentage_scale[Game_skill_level]);
|
||||
@@ -916,7 +916,7 @@ int scoring_eval_kill_on_weapon(object *weapon_obj, object *other_obj) {
|
||||
|
||||
// if he killed a bomb on his own team increment his bonehead kills
|
||||
if((Ships[Objects[plr->objnum].instance].team == dead_wp->team) && !MULTI_DOGFIGHT ){
|
||||
if (!(The_mission.flags & MISSION_FLAG_NO_TRAITOR)) {
|
||||
if (!(The_mission.flags[Mission::Mission_Flags::No_traitor])) {
|
||||
plr->stats.m_bonehead_kills++;
|
||||
kill_score = -(int)(dead_wip->score * scoring_get_scale_factor());
|
||||
plr->stats.m_score += kill_score;
|
||||
|
||||
Executable → Regular
+11
-7
@@ -426,8 +426,10 @@ int beam_fire(beam_fire_info *fire_info)
|
||||
beam_get_binfo(new_item, fire_info->accuracy, wip->b_info.beam_shots); // to fill in b_info - the set of directional aim vectors
|
||||
}
|
||||
|
||||
flagset<Object::Object_Flags> default_flags;
|
||||
default_flags.set(Object::Object_Flags::Collides);
|
||||
// create the associated object
|
||||
objnum = obj_create(OBJ_BEAM, ((fire_info->shooter != NULL) ? OBJ_INDEX(fire_info->shooter) : -1), BEAM_INDEX(new_item), &vmd_identity_matrix, &vmd_zero_vector, 1.0f, OF_COLLIDES);
|
||||
objnum = obj_create(OBJ_BEAM, ((fire_info->shooter != NULL) ? OBJ_INDEX(fire_info->shooter) : -1), BEAM_INDEX(new_item), &vmd_identity_matrix, &vmd_zero_vector, 1.0f, default_flags);
|
||||
if(objnum < 0){
|
||||
beam_delete(new_item);
|
||||
nprintf(("General", "obj_create() failed for beam weapon! bah!\n"));
|
||||
@@ -553,7 +555,9 @@ int beam_fire_targeting(fighter_beam_fire_info *fire_info)
|
||||
// type c is a very special weapon type - binfo has no meaning
|
||||
|
||||
// create the associated object
|
||||
objnum = obj_create(OBJ_BEAM, OBJ_INDEX(fire_info->shooter), BEAM_INDEX(new_item), &vmd_identity_matrix, &vmd_zero_vector, 1.0f, OF_COLLIDES);
|
||||
flagset<Object::Object_Flags> default_flags;
|
||||
default_flags.set(Object::Object_Flags::Collides);
|
||||
objnum = obj_create(OBJ_BEAM, OBJ_INDEX(fire_info->shooter), BEAM_INDEX(new_item), &vmd_identity_matrix, &vmd_zero_vector, 1.0f, default_flags);
|
||||
|
||||
if(objnum < 0){
|
||||
beam_delete(new_item);
|
||||
@@ -2176,7 +2180,7 @@ void beam_aim(beam *b)
|
||||
}
|
||||
|
||||
// if we're shooting at a big ship - shoot directly at the model
|
||||
if((b->target != nullptr) && (b->target->type == OBJ_SHIP) && (Ship_info[Ships[b->target->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))){
|
||||
if((b->target != nullptr) && (b->target->type == OBJ_SHIP) && (Ship_info[Ships[b->target->instance].ship_info_index].is_big_or_huge())){
|
||||
if ((b->subsys != nullptr) && (b->subsys->system_info->flags2 & MSS_FLAG2_SHARE_FIRE_DIRECTION)) {
|
||||
vec3d pnt;
|
||||
vm_vec_unrotate(&pnt, &b->binfo.dir_a, &b->target->orient);
|
||||
@@ -2483,16 +2487,16 @@ int beam_collide_ship(obj_pair *pair)
|
||||
// check shields for impact
|
||||
// (tooled ships are probably not going to be maintaining a shield over their exit hole,
|
||||
// therefore we need only check the entrance, just as with conventional weapons)
|
||||
if (!(ship_objp->flags & OF_NO_SHIELDS))
|
||||
if (!(ship_objp->flags[Object::Object_Flags::No_shields]))
|
||||
{
|
||||
// pick out the shield quadrant
|
||||
if (shield_collision)
|
||||
quadrant_num = get_quadrant(&mc_shield.hit_point, ship_objp);
|
||||
else if (hull_enter_collision && (sip->flags2 & SIF2_SURFACE_SHIELDS))
|
||||
else if (hull_enter_collision && (sip->flags[Ship::Info_Flags::Surface_shields]))
|
||||
quadrant_num = get_quadrant(&mc_hull_enter.hit_point, ship_objp);
|
||||
|
||||
// make sure that the shield is active in that quadrant
|
||||
if ((quadrant_num >= 0) && ((shipp->flags & SF_DYING) || !ship_is_shield_up(ship_objp, quadrant_num)))
|
||||
if ((quadrant_num >= 0) && ((shipp->flags[Ship::Ship_Flags::Dying]) || !ship_is_shield_up(ship_objp, quadrant_num)))
|
||||
quadrant_num = -1;
|
||||
|
||||
// see if we hit the shield
|
||||
@@ -3300,7 +3304,7 @@ void beam_get_cull_vals(object *objp, beam *b, float *cull_dot, float *cull_dist
|
||||
|
||||
case OBJ_SHIP:
|
||||
// for large ships, cull at some multiple of the radius
|
||||
if(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)){
|
||||
if(Ship_info[Ships[objp->instance].ship_info_index].is_big_or_huge()){
|
||||
*cull_dot = 1.0f - ((1.0f - beam_get_cone_dot(b)) * 1.25f);
|
||||
|
||||
*cull_dist = (objp->radius * 1.3f) * (objp->radius * 1.3f);
|
||||
|
||||
+4
-4
@@ -166,7 +166,7 @@ void emp_apply(vec3d *pos, float inner_radius, float outer_radius, float emp_int
|
||||
}
|
||||
|
||||
// if the ship is a cruiser or cap ship, only apply the EMP effect to turrets
|
||||
if(Ship_info[Ships[target->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) {
|
||||
if(Ship_info[Ships[target->instance].ship_info_index].is_big_or_huge()) {
|
||||
float capship_emp_time = use_emp_time_for_capship_turrets ? emp_time : MAX_TURRET_DISRUPT_TIME;
|
||||
|
||||
moveup = &Ships[target->instance].subsys_list;
|
||||
@@ -336,7 +336,7 @@ void emp_process_ship(ship *shipp)
|
||||
}
|
||||
|
||||
// if this is a player ship, don't do anything wacky
|
||||
if(objp->flags & OF_PLAYER_SHIP){
|
||||
if(objp->flags[Object::Object_Flags::Player_ship]){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ void emp_process_ship(ship *shipp)
|
||||
aip->nearest_locked_object = -1; // nothing near me, so I won't launch countermeasures
|
||||
|
||||
// if he's not a fighter or bomber, bail now
|
||||
if(!(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER))){
|
||||
if(!(Ship_info[shipp->ship_info_index].is_fighter_bomber())){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ void emp_process_ship(ship *shipp)
|
||||
int ship_lookup = ship_get_random_team_ship(iff_get_attackee_mask(shipp->team));
|
||||
|
||||
// if we got a valid ship object to target
|
||||
if((ship_lookup >= 0) && (Ships[ship_lookup].objnum >= 0) && !(Objects[Ships[ship_lookup].objnum].flags & OF_PROTECTED)){
|
||||
if((ship_lookup >= 0) && (Ships[ship_lookup].objnum >= 0) && !(Objects[Ships[ship_lookup].objnum].flags[Object::Object_Flags::Protected])){
|
||||
// attack the object
|
||||
ai_attack_object(objp, &Objects[Ships[ship_lookup].objnum], NULL);
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ int shockwave_create(int parent_objnum, vec3d *pos, shockwave_create_info *sci,
|
||||
|
||||
orient = vmd_identity_matrix;
|
||||
vm_angles_2_matrix(&orient, &sw->rot_angles);
|
||||
|
||||
objnum = obj_create( OBJ_SHOCKWAVE, real_parent, i, &orient, &sw->pos, sw->outer_radius, OF_RENDERS );
|
||||
flagset<Object::Object_Flags> tmp_flags;
|
||||
objnum = obj_create( OBJ_SHOCKWAVE, real_parent, i, &orient, &sw->pos, sw->outer_radius, tmp_flags + Object::Object_Flags::Renders);
|
||||
|
||||
if ( objnum == -1 ){
|
||||
Int3();
|
||||
@@ -176,7 +176,7 @@ void shockwave_delete_all()
|
||||
while ( sw != &Shockwave_list ) {
|
||||
next = sw->next;
|
||||
Assert(sw->objnum != -1);
|
||||
Objects[sw->objnum].flags |= OF_SHOULD_BE_DEAD;
|
||||
Objects[sw->objnum].flags.set(Object::Object_Flags::Should_be_dead);
|
||||
sw = next;
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@ void shockwave_move(object *shockwave_objp, float frametime)
|
||||
sw->radius += (frametime * sw->speed);
|
||||
if ( sw->radius > sw->outer_radius ) {
|
||||
sw->radius = sw->outer_radius;
|
||||
shockwave_objp->flags |= OF_SHOULD_BE_DEAD;
|
||||
shockwave_objp->flags.set(Object::Object_Flags::Should_be_dead);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ void shockwave_move(object *shockwave_objp, float frametime)
|
||||
|
||||
if ( objp->type == OBJ_SHIP ) {
|
||||
// don't blast navbuoys
|
||||
if ( ship_get_SIF(objp->instance) & SIF_NAVBUOY ) {
|
||||
if ( ship_get_SIF(objp->instance)[Ship::Info_Flags::Navbuoy] ) {
|
||||
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 & OF_INVULNERABLE) ) {
|
||||
if ( (sw->weapon_info_index >= 0) && (Weapon_info[sw->weapon_info_index].wi_flags3 & WIF3_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 );
|
||||
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user