Fix homing attack and ring attraction math dumbs

This commit is contained in:
katsy 2023-07-03 16:27:07 -05:00
parent 8ce0328423
commit 2c66f2ce27
2 changed files with 3 additions and 3 deletions

View file

@ -828,7 +828,7 @@ static boolean P_LookForShield(mobj_t *actor)
continue;
if ((player->powers[pw_shield] & SH_PROTECTELECTRIC)
&& (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale)))
&& (R_PointToDist2(0, 0, R_PointToDist2(0, 0, actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale)))
{
P_SetTarget(&actor->tracer, player->mo);

View file

@ -9217,7 +9217,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet)
{
fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2);
dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y);
dist = R_PointToDist2(0, 0, player->mo->x-mo->x, player->mo->y-mo->y);
if (bullet)
{
if ((R_PointToAngle2(0, 0, dist, zdist) + span) > span*2)
@ -9234,7 +9234,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet)
continue;
}
dist = P_AproxDistance(dist, zdist);
dist = R_PointToDist2(0, 0, dist, zdist);
if (dist > maxdist)
continue; // out of range
}