mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'waterstep' into 'master'
Waterstep fixes (resolves #319) Closes #319 See merge request KartKrew/Kart!771
This commit is contained in:
commit
c331958ef4
3 changed files with 38 additions and 20 deletions
|
|
@ -3420,7 +3420,7 @@ boolean K_TripwirePass(player_t *player)
|
|||
|
||||
boolean K_MovingHorizontally(mobj_t *mobj)
|
||||
{
|
||||
return (P_AproxDistance(mobj->momx, mobj->momy) / 5 > abs(mobj->momz));
|
||||
return (P_AproxDistance(mobj->momx, mobj->momy) / 4 > abs(mobj->momz));
|
||||
}
|
||||
|
||||
boolean K_WaterRun(mobj_t *mobj)
|
||||
|
|
|
|||
|
|
@ -2618,7 +2618,7 @@ increment_move
|
|||
if (!(thing->flags & MF_NOCLIP))
|
||||
{
|
||||
//All things are affected by their scale.
|
||||
fixed_t maxstep = P_GetThingStepUp(thing, x, y);
|
||||
fixed_t maxstep = P_GetThingStepUp(thing, tryx, tryy);
|
||||
|
||||
if (tmceilingz - tmfloorz < thing->height)
|
||||
{
|
||||
|
|
|
|||
54
src/p_mobj.c
54
src/p_mobj.c
|
|
@ -3126,16 +3126,14 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover)
|
|||
fixed_t surfaceheight = INT32_MAX;
|
||||
fixed_t surfDiff = INT32_MAX;
|
||||
|
||||
fixed_t floorheight = INT32_MAX;
|
||||
fixed_t floorDiff = INT32_MAX;
|
||||
|
||||
fixed_t mobjbottom = INT32_MAX;
|
||||
fixed_t maxStep = INT32_MAX;
|
||||
boolean doifit = false;
|
||||
|
||||
pslope_t *waterSlope = NULL;
|
||||
angle_t ourZAng = 0;
|
||||
angle_t waterZAng = 0;
|
||||
angle_t moveDir = 0;
|
||||
fixed_t ourZAng = 0;
|
||||
fixed_t waterZAng = 0;
|
||||
|
||||
if (rover == NULL)
|
||||
{
|
||||
|
|
@ -3169,20 +3167,36 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (mobj->standingslope != NULL)
|
||||
moveDir = K_MomentumAngle(mobj);
|
||||
|
||||
if (mobj->standingslope != NULL && mobj->standingslope->zangle != 0)
|
||||
{
|
||||
ourZAng = mobj->standingslope->zangle;
|
||||
angle_t dir = mobj->standingslope->xydirection;
|
||||
angle_t workang = mobj->standingslope->zangle;
|
||||
if (workang >= ANGLE_180)
|
||||
{
|
||||
workang = InvAngle(workang);
|
||||
dir = InvAngle(dir);
|
||||
}
|
||||
ourZAng = P_ReturnThrustX(mobj, dir - moveDir, AngleFixed(workang));
|
||||
}
|
||||
|
||||
waterSlope = (flip ? *rover->b_slope : *rover->t_slope);
|
||||
if (waterSlope != NULL)
|
||||
if (waterSlope != NULL && waterSlope->zangle != 0)
|
||||
{
|
||||
waterZAng = waterSlope->zangle;
|
||||
angle_t dir = waterSlope->xydirection;
|
||||
angle_t workang = waterSlope->zangle;
|
||||
if (workang >= ANGLE_180)
|
||||
{
|
||||
workang = InvAngle(workang);
|
||||
dir = InvAngle(dir);
|
||||
}
|
||||
waterZAng = P_ReturnThrustX(mobj, dir - moveDir, AngleFixed(workang));
|
||||
}
|
||||
|
||||
if (ourZAng != waterZAng)
|
||||
if (abs(ourZAng - waterZAng) > 11*FRACUNIT)
|
||||
{
|
||||
// The surface slopes are different.
|
||||
// The surface slopes are too different.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3200,16 +3214,20 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover)
|
|||
maxStep = P_GetThingStepUp(mobj, mobj->x, mobj->y);
|
||||
|
||||
surfDiff = flip ? (surfaceheight - mobjbottom) : (mobjbottom - surfaceheight);
|
||||
|
||||
// We start water run IF we can step onto it!
|
||||
if (surfDiff <= maxStep && surfDiff >= 0)
|
||||
{
|
||||
// We start water run IF we can step-down!
|
||||
floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y);
|
||||
floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight);
|
||||
if (floorDiff <= maxStep && floorDiff >= 0)
|
||||
if (ourZAng < 0)
|
||||
{
|
||||
// ... but NOT if real floor is in range.
|
||||
// FIXME: Count solid FOFs in this check
|
||||
return false;
|
||||
fixed_t floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y);
|
||||
fixed_t floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight);
|
||||
if (floorDiff <= maxStep && floorDiff >= -maxStep)
|
||||
{
|
||||
// ... but NOT if going down and real floor is in range.
|
||||
// FIXME: Count solid FOFs in this check
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue