mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
You know what? Let's just, try removing the weird hacky bounceback stuff :V
Might be better? (I had trouble reproducing the weird bounces before, so I can't tell if it's completely fixed)
This commit is contained in:
parent
bb118764e6
commit
f0bb6686d6
1 changed files with 32 additions and 30 deletions
62
src/p_map.c
62
src/p_map.c
|
|
@ -3823,7 +3823,7 @@ 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;
|
||||||
|
|
||||||
|
|
@ -3831,8 +3831,8 @@ void P_BounceMove(mobj_t *mo)
|
||||||
hitcount = 0;
|
hitcount = 0;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (++hitcount == 3)
|
if (++hitcount == 3) // don't loop forever
|
||||||
goto bounceback; // don't loop forever
|
return; //goto bounceback;
|
||||||
|
|
||||||
if (mo->player)
|
if (mo->player)
|
||||||
{
|
{
|
||||||
|
|
@ -3881,7 +3881,7 @@ retry:
|
||||||
P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||||
|
|
||||||
// move up to the wall
|
// move up to the wall
|
||||||
if (bestslidefrac == FRACUNIT + 1)
|
/*if (bestslidefrac == FRACUNIT + 1)
|
||||||
{
|
{
|
||||||
// the move must have hit the middle, so bounce straight back
|
// the move must have hit the middle, so bounce straight back
|
||||||
bounceback:
|
bounceback:
|
||||||
|
|
@ -3903,18 +3903,18 @@ bounceback:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
|
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
|
||||||
goto bounceback;
|
goto bounceback;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Now continue along the wall.
|
// Now continue along the wall.
|
||||||
// First calculate remainder.
|
// First calculate remainder.
|
||||||
|
|
@ -3926,7 +3926,31 @@ bounceback:
|
||||||
if (bestslidefrac <= 0)
|
if (bestslidefrac <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mo->type == MT_SHELL)
|
if (mo->player)
|
||||||
|
{
|
||||||
|
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
|
||||||
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
|
fx->eflags |= MFE_VERTICALFLIP;
|
||||||
|
else
|
||||||
|
fx->eflags &= ~MFE_VERTICALFLIP;
|
||||||
|
fx->scale = mo->scale;
|
||||||
|
|
||||||
|
if (cv_collidesounds.value == 1)
|
||||||
|
S_StartSound(mo, cv_collidesoundnum.value);
|
||||||
|
|
||||||
|
tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
|
||||||
|
tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
|
||||||
|
|
||||||
|
if (P_AproxDistance(tmxmove, tmymove) < 25*FRACUNIT)
|
||||||
|
{
|
||||||
|
fixed_t momdiflength = P_AproxDistance(tmxmove, tmymove);
|
||||||
|
fixed_t normalisedx = FixedDiv(tmxmove, momdiflength);
|
||||||
|
fixed_t normalisedy = FixedDiv(tmymove, momdiflength);
|
||||||
|
tmxmove = FixedMul(25*FRACUNIT, normalisedx);
|
||||||
|
tmymove = FixedMul(25*FRACUNIT, normalisedy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mo->type == MT_SHELL)
|
||||||
{
|
{
|
||||||
tmxmove = mmomx;
|
tmxmove = mmomx;
|
||||||
tmymove = mmomy;
|
tmymove = mmomy;
|
||||||
|
|
@ -3948,28 +3972,6 @@ bounceback:
|
||||||
tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
|
tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->player)
|
|
||||||
{
|
|
||||||
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
|
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
|
||||||
fx->eflags |= MFE_VERTICALFLIP;
|
|
||||||
else
|
|
||||||
fx->eflags &= ~MFE_VERTICALFLIP;
|
|
||||||
fx->scale = mo->scale;
|
|
||||||
|
|
||||||
if (cv_collidesounds.value == 1)
|
|
||||||
S_StartSound(mo, cv_collidesoundnum.value);
|
|
||||||
|
|
||||||
if (P_AproxDistance(tmxmove, tmymove) < 25*FRACUNIT)
|
|
||||||
{
|
|
||||||
fixed_t momdiflength = P_AproxDistance(tmxmove, tmymove);
|
|
||||||
fixed_t normalisedx = FixedDiv(tmxmove, momdiflength);
|
|
||||||
fixed_t normalisedy = FixedDiv(tmymove, momdiflength);
|
|
||||||
tmxmove = FixedMul(25*FRACUNIT, normalisedx);
|
|
||||||
tmymove = FixedMul(25*FRACUNIT, normalisedy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
P_HitBounceLine(bestslideline); // clip the moves
|
P_HitBounceLine(bestslideline); // clip the moves
|
||||||
|
|
||||||
mo->momx = tmxmove;
|
mo->momx = tmxmove;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue