Pass player powerup_flags to ai_fire_laser_at_player
This commit is contained in:
parent
8cfa1508b6
commit
bb65d3ce97
|
@ -1017,7 +1017,7 @@ static int lead_player(const object_base &objp, const vms_vector &fire_point, co
|
|||
// Note: Parameter vec_to_player is only passed now because guns which aren't on the forward vector from the
|
||||
// center of the robot will not fire right at the player. We need to aim the guns at the player. Barring that, we cheat.
|
||||
// When this routine is complete, the parameter vec_to_player should not be necessary.
|
||||
static void ai_fire_laser_at_player(const vobjptridx_t obj, const vms_vector &fire_point, int gun_num
|
||||
static void ai_fire_laser_at_player(const vobjptridx_t obj, const player_flags powerup_flags, const vms_vector &fire_point, int gun_num
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
, const vms_vector &believed_player_pos
|
||||
#endif
|
||||
|
@ -1055,8 +1055,7 @@ static void ai_fire_laser_at_player(const vobjptridx_t obj, const vms_vector &fi
|
|||
#endif
|
||||
|
||||
// If player is cloaked, maybe don't fire based on how long cloaked and randomness.
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if (player_info.powerup_flags & PLAYER_FLAGS_CLOAKED) {
|
||||
if (powerup_flags & PLAYER_FLAGS_CLOAKED) {
|
||||
fix64 cloak_time = Ai_cloak_info[static_cast<objptridx_t::index_type>(obj) % MAX_AI_CLOAK_INFO].last_time;
|
||||
|
||||
if (GameTime64 - cloak_time > CLOAK_TIME_MAX/4)
|
||||
|
@ -2580,7 +2579,8 @@ static void ai_do_actual_firing_stuff(const vobjptridx_t obj, ai_static *aip, ai
|
|||
} else {
|
||||
if (!ai_multiplayer_awareness(obj, ROBOT_FIRE_AGITATION))
|
||||
return;
|
||||
ai_fire_laser_at_player(obj, gun_point, 0);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2605,7 +2605,8 @@ static void ai_do_actual_firing_stuff(const vobjptridx_t obj, ai_static *aip, ai
|
|||
&& (vm_vec_dist_quick(Hit_pos, obj->pos) > F1_0*40)) {
|
||||
if (!ai_multiplayer_awareness(obj, ROBOT_FIRE_AGITATION))
|
||||
return;
|
||||
ai_fire_laser_at_player(obj, gun_point, 0);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, 0);
|
||||
|
||||
aip->GOAL_STATE = AIS_RECO;
|
||||
ailp->goal_state[aip->CURRENT_GUN] = AIS_RECO;
|
||||
|
@ -2667,18 +2668,21 @@ static void ai_do_actual_firing_stuff(const vobjptridx_t obj, ai_static *aip, ai
|
|||
// New, multi-weapon-type system, 06/05/95 (life is slipping away...)
|
||||
if (gun_num != 0) {
|
||||
if (ready_to_fire_weapon1(ailp, 0)) {
|
||||
ai_fire_laser_at_player(obj, gun_point, gun_num, fire_pos);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, gun_num, fire_pos);
|
||||
Last_fired_upon_player_pos = fire_pos;
|
||||
}
|
||||
|
||||
if (ready_to_fire_weapon2(robptr, ailp, 0)) {
|
||||
calc_gun_point(gun_point, obj, 0);
|
||||
ai_fire_laser_at_player(obj, gun_point, 0, fire_pos);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, 0, fire_pos);
|
||||
Last_fired_upon_player_pos = fire_pos;
|
||||
}
|
||||
|
||||
} else if (ready_to_fire_weapon1(ailp, 0)) {
|
||||
ai_fire_laser_at_player(obj, gun_point, gun_num, fire_pos);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, gun_num, fire_pos);
|
||||
Last_fired_upon_player_pos = fire_pos;
|
||||
}
|
||||
}
|
||||
|
@ -2715,7 +2719,8 @@ static void ai_do_actual_firing_stuff(const vobjptridx_t obj, ai_static *aip, ai
|
|||
&& (vm_vec_dist_quick(Hit_pos, obj->pos) > F1_0*40)) {
|
||||
if (!ai_multiplayer_awareness(obj, ROBOT_FIRE_AGITATION))
|
||||
return;
|
||||
ai_fire_laser_at_player(obj, gun_point, gun_num, Believed_player_pos);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, gun_num, Believed_player_pos);
|
||||
|
||||
aip->GOAL_STATE = AIS_RECO;
|
||||
ailp->goal_state[aip->CURRENT_GUN] = AIS_RECO;
|
||||
|
@ -2756,12 +2761,16 @@ static void ai_do_actual_firing_stuff(const vobjptridx_t obj, ai_static *aip, ai
|
|||
return;
|
||||
// New, multi-weapon-type system, 06/05/95 (life is slipping away...)
|
||||
if (ready_to_fire_weapon1(ailp, 0))
|
||||
ai_fire_laser_at_player(obj, gun_point, gun_num, Last_fired_upon_player_pos);
|
||||
{
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, gun_num, Last_fired_upon_player_pos);
|
||||
}
|
||||
if (gun_num != 0) {
|
||||
|
||||
if (ready_to_fire_weapon2(robptr, ailp, 0)) {
|
||||
calc_gun_point(gun_point, obj, 0);
|
||||
ai_fire_laser_at_player(obj, gun_point, 0, Last_fired_upon_player_pos);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
ai_fire_laser_at_player(obj, player_info.powerup_flags, gun_point, 0, Last_fired_upon_player_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue