From 926cbc414103e98905ed02e52f2538c0ad17cbad Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 11 Jan 2020 14:41:37 +0000 Subject: [PATCH] Make P_HomingAttack and P_LookForEnemies consistent, preventing targeting TNT barrels just launching you in place. --- src/p_user.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index b40e647b6..953641471 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9279,6 +9279,7 @@ mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, // If nonenemies is true, includes monitors and springs! // If bullet is true, you can look up and the distance is further, // but your total angle span you can look is limited to compensate. (Also, allows monitors.) +// If you modify this, please also modify P_HomingAttack. // mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet) { @@ -9374,15 +9375,18 @@ boolean P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target if (!enemy) return false; - if (!enemy->health) + if (enemy->flags & MF_NOCLIPTHING) + return false; + + if (enemy->health <= 0) // dead + return false; + + if (!((enemy->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR) && (enemy->flags & MF_SHOOTABLE)) || (enemy->flags & MF_SPRING)) == !(enemy->flags2 & MF2_INVERTAIMABLE)) // allows if it has the flags desired XOR it has the invert aimable flag return false; if (enemy->flags2 & MF2_FRET) return false; - if (!(enemy->flags & (MF_SHOOTABLE|MF_SPRING)) == !(enemy->flags2 & MF2_INVERTAIMABLE)) // allows if it has the flags desired XOR it has the invert aimable flag - return false; - // change angle source->angle = R_PointToAngle2(source->x, source->y, enemy->x, enemy->y); if (source->player)