Rewrote P_HitBounceLine

Instead of reflecting momentum (iirc), it thrusts you away prependicular
from the wall.
This commit is contained in:
TehRealSalt 2018-01-04 01:49:34 -05:00
parent f303dec437
commit 28384f465d

View file

@ -3163,38 +3163,21 @@ static void P_HitSlideLine(line_t *ld)
// //
static void P_HitBounceLine(line_t *ld) static void P_HitBounceLine(line_t *ld)
{ {
angle_t lineangle, moveangle, deltaangle; INT32 side;
angle_t lineangle;
fixed_t movelen; fixed_t movelen;
if (ld->slopetype == ST_HORIZONTAL) side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
{ lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy)-ANGLE_90;
tmymove = -tmymove; if (side == 1)
return; lineangle += ANGLE_180;
}
if (ld->slopetype == ST_VERTICAL)
{
tmxmove = -tmxmove;
return;
}
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
if (lineangle >= ANGLE_180)
lineangle -= ANGLE_180;
moveangle = R_PointToAngle2(0, 0, tmxmove, tmymove);
deltaangle = moveangle + 2*(lineangle - moveangle);
lineangle >>= ANGLETOFINESHIFT; lineangle >>= ANGLETOFINESHIFT;
deltaangle >>= ANGLETOFINESHIFT;
movelen = P_AproxDistance(tmxmove, tmymove); movelen = P_AproxDistance(tmxmove, tmymove);
tmxmove = FixedMul(movelen, FINECOSINE(deltaangle)); tmxmove += FixedMul(movelen, FINECOSINE(lineangle));
tmymove = FixedMul(movelen, FINESINE(deltaangle)); tmymove += FixedMul(movelen, FINESINE(lineangle));
deltaangle = R_PointToAngle2(0, 0, tmxmove, tmymove);
} }
// //
@ -3824,15 +3807,15 @@ void P_BounceMove(mobj_t *mo)
fixed_t leadx, leady; fixed_t leadx, leady;
fixed_t trailx, traily; fixed_t trailx, traily;
//fixed_t newx, newy; //fixed_t newx, newy;
INT32 hitcount; //INT32 hitcount;
fixed_t mmomx = 0, mmomy = 0; fixed_t mmomx = 0, mmomy = 0;
slidemo = mo; slidemo = mo;
hitcount = 0; //hitcount = 0;
retry: /*retry:
if (++hitcount == 3) // don't loop forever if (++hitcount == 3)
return; //goto bounceback; goto bounceback; // don't loop forever*/
if (mo->player) if (mo->player)
{ {
@ -3906,8 +3889,8 @@ bounceback:
}*/ }*/
// fudge a bit to make sure it doesn't hit // fudge a bit to make sure it doesn't hit
bestslidefrac -= 0x800; /*bestslidefrac -= 0x800;
/*if (bestslidefrac > 0) if (bestslidefrac > 0)
{ {
newx = FixedMul(mmomx, bestslidefrac); newx = FixedMul(mmomx, bestslidefrac);
newy = FixedMul(mmomy, bestslidefrac); newy = FixedMul(mmomy, bestslidefrac);
@ -3983,8 +3966,9 @@ bounceback:
mo->player->cmomy = tmymove; mo->player->cmomy = tmymove;
} }
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) /*if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
goto retry; goto retry;*/
P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true);
} }
// //