Merge branch 'shocksplit' into 'next'

Split up x/y/z averages in A_Boss3ShockThink (resolves #589)

Closes #589

See merge request STJr/SRB2!1538
This commit is contained in:
Tatsuru 2021-09-12 21:49:28 +00:00
commit 9187656b90

View file

@ -8272,7 +8272,7 @@ void A_Boss3ShockThink(mobj_t *actor)
fixed_t x0, y0, x1, y1;
// Break the link if movements are too different
if (FixedHypot(snext->momx - actor->momx, snext->momy - actor->momy) > 12*actor->scale)
if (R_PointToDist2(0, 0, snext->momx - actor->momx, snext->momy - actor->momy) > 12*actor->scale)
{
P_SetTarget(&actor->hnext, NULL);
return;
@ -8283,9 +8283,11 @@ void A_Boss3ShockThink(mobj_t *actor)
y0 = actor->y;
x1 = snext->x;
y1 = snext->y;
if (FixedHypot(x1 - x0, y1 - y0) > 2*actor->radius)
if (R_PointToDist2(0, 0, x1 - x0, y1 - y0) > 2*actor->radius)
{
snew = P_SpawnMobj((x0 + x1) >> 1, (y0 + y1) >> 1, (actor->z + snext->z) >> 1, actor->type);
snew = P_SpawnMobj((x0 >> 1) + (x1 >> 1),
(y0 >> 1) + (y1 >> 1),
(actor->z >> 1) + (snext->z >> 1), actor->type);
snew->momx = (actor->momx + snext->momx) >> 1;
snew->momy = (actor->momy + snext->momy) >> 1;
snew->momz = (actor->momz + snext->momz) >> 1; // is this really needed?