mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Rearranging some things
Player minimum bounce is set in P_HitBounceLine instead of P_BounceMove, which is simpler and appears to give even more consistent results
This commit is contained in:
parent
02d50629c7
commit
c096b97b12
1 changed files with 17 additions and 25 deletions
42
src/p_map.c
42
src/p_map.c
|
|
@ -3169,6 +3169,7 @@ static void P_HitBounceLine(line_t *ld)
|
||||||
|
|
||||||
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
|
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
|
||||||
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy)-ANGLE_90;
|
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy)-ANGLE_90;
|
||||||
|
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
lineangle += ANGLE_180;
|
lineangle += ANGLE_180;
|
||||||
|
|
||||||
|
|
@ -3176,6 +3177,9 @@ static void P_HitBounceLine(line_t *ld)
|
||||||
|
|
||||||
movelen = P_AproxDistance(tmxmove, tmymove);
|
movelen = P_AproxDistance(tmxmove, tmymove);
|
||||||
|
|
||||||
|
if (slidemo->player && movelen < 25*FRACUNIT)
|
||||||
|
movelen = 25*FRACUNIT;
|
||||||
|
|
||||||
tmxmove += FixedMul(movelen, FINECOSINE(lineangle));
|
tmxmove += FixedMul(movelen, FINECOSINE(lineangle));
|
||||||
tmymove += FixedMul(movelen, FINESINE(lineangle));
|
tmymove += FixedMul(movelen, FINESINE(lineangle));
|
||||||
}
|
}
|
||||||
|
|
@ -3909,31 +3913,7 @@ bounceback:
|
||||||
if (bestslidefrac <= 0)
|
if (bestslidefrac <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mo->player)
|
if (mo->type == MT_SHELL)
|
||||||
{
|
|
||||||
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;
|
||||||
|
|
@ -3953,6 +3933,18 @@ bounceback:
|
||||||
{
|
{
|
||||||
tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
|
tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P_HitBounceLine(bestslideline); // clip the moves
|
P_HitBounceLine(bestslideline); // clip the moves
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue