Merge branch 'lawofattraction' into 'next'

Fix ring attraction and homing attack math errors (resolves #1045, #1001)

Closes #1001 and #1045

See merge request STJr/SRB2!2033
This commit is contained in:
Sal 2023-08-02 14:54:33 +00:00
commit b7443cfa05
2 changed files with 3 additions and 3 deletions

View file

@ -829,7 +829,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

@ -9287,7 +9287,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)
@ -9304,7 +9304,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
}