SLOPE-TO-WALL TRANSFER

This commit is contained in:
toasterbabe 2017-01-22 18:26:05 +00:00
parent acfbce21c9
commit aa6453382e
3 changed files with 30 additions and 0 deletions

View File

@ -2124,6 +2124,11 @@ void P_XYMovement(mobj_t *mo)
// blocked move
moved = false;
#ifdef ESLOPE
if (oldslope && predictedz > mo->z) // Only for moving up, otherwise there's a failed launch when going down slopes and hitting walls
P_SlopeToWallTransfer(mo);
#endif
if (player) {
if (player->bot)
B_MoveBlocked(player);

View File

@ -804,6 +804,30 @@ void P_SlopeLaunch(mobj_t *mo)
mo->standingslope = NULL;
}
//
// P_SlopeToWallTransfer
//
// Handles slope-to-wall transfer for objects.
void P_SlopeToWallTransfer(mobj_t *mo)
{
if (!(mo->standingslope->flags & SL_NOPHYSICS)) // If there's physics, time for launching.
{
// Doesn't kill the vertical momentum as much as P_SlopeLaunch does.
vector3_t slopemom;
slopemom.x = mo->momx;
slopemom.y = mo->momy;
slopemom.z = 3*(mo->momz/2);
P_QuantizeMomentumToSlope(&slopemom, mo->standingslope);
mo->momx = slopemom.x;
mo->momy = slopemom.y;
mo->momz = 2*(slopemom.z/3);
}
//CONS_Printf("Transferred off of slope.\n");
mo->standingslope = NULL;
}
// Function to help handle landing on slopes
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
{

View File

@ -37,6 +37,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
void P_SlopeLaunch(mobj_t *mo);
void P_SlopeToWallTransfer(mobj_t *mo);
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
void P_ButteredSlope(mobj_t *mo);