Adjust Trailing items to behave nicer

Added extra boolean for P_SlideMove forceslide, since kart's walls are almost all bouncy slidemove will almost always bounce things instead, even if we don't want it to.
This commit is contained in:
Sryder13 2017-10-25 01:58:25 +01:00
parent 65c5c94563
commit 101a560d4e
4 changed files with 16 additions and 15 deletions

View file

@ -1009,10 +1009,11 @@ static int lib_pTeleportMove(lua_State *L)
static int lib_pSlideMove(lua_State *L) static int lib_pSlideMove(lua_State *L)
{ {
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
boolean forceslide = luaL_checkboolean(L, 2);
NOHUD NOHUD
if (!mo) if (!mo)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_SlideMove(mo); P_SlideMove(mo, forceslide);
return 0; return 0;
} }

View file

@ -326,7 +326,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff); boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
boolean P_Move(mobj_t *actor, fixed_t speed); boolean P_Move(mobj_t *actor, fixed_t speed);
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z); boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
void P_SlideMove(mobj_t *mo); void P_SlideMove(mobj_t *mo, boolean forceslide);
void P_BounceMove(mobj_t *mo); void P_BounceMove(mobj_t *mo);
boolean P_CheckSight(mobj_t *t1, mobj_t *t2); boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius); void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);

View file

@ -3521,8 +3521,9 @@ stairstep:
// and slide along it // and slide along it
// //
// This is a kludgy mess. // This is a kludgy mess.
// Kart 2017-10-25: add forceslide to hav the option to force something to slide instead of bounce
// //
void P_SlideMove(mobj_t *mo) void P_SlideMove(mobj_t *mo, boolean forceslide)
{ {
fixed_t leadx, leady, trailx, traily, newx, newy; fixed_t leadx, leady, trailx, traily, newx, newy;
INT16 hitcount = 0; INT16 hitcount = 0;
@ -3600,7 +3601,7 @@ retry:
PT_ADDLINES, PTR_SlideTraverse); PT_ADDLINES, PTR_SlideTraverse);
// Some walls are bouncy even if you're not // Some walls are bouncy even if you're not
if (bestslideline && !(bestslideline->flags & ML_BOUNCY)) // SRB2kart - All walls are bouncy unless specified otherwise if (!forceslide && bestslideline && !(bestslideline->flags & ML_BOUNCY)) // SRB2kart - All walls are bouncy unless specified otherwise
{ {
P_BounceMove(mo); P_BounceMove(mo);
return; return;

View file

@ -1809,7 +1809,7 @@ void P_XYMovement(mobj_t *mo)
} }
else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE)) else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE))
{ // try to slide along it { // try to slide along it
P_SlideMove(mo); P_SlideMove(mo, false);
xmove = ymove = 0; xmove = ymove = 0;
} }
else if (mo->type == MT_SPINFIRE) else if (mo->type == MT_SPINFIRE)
@ -1990,7 +1990,7 @@ static void P_RingXYMovement(mobj_t *mo)
I_Assert(!P_MobjWasRemoved(mo)); I_Assert(!P_MobjWasRemoved(mo));
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy)) if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_SlideMove(mo); P_SlideMove(mo, false);
} }
static void P_SceneryXYMovement(mobj_t *mo) static void P_SceneryXYMovement(mobj_t *mo)
@ -2004,7 +2004,7 @@ static void P_SceneryXYMovement(mobj_t *mo)
oldy = mo->y; oldy = mo->y;
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy)) if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_SlideMove(mo); P_SlideMove(mo, false);
if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz)) if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
return; // no friction when airborne return; // no friction when airborne
@ -6622,14 +6622,13 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target->player) if (mobj->target->player)
mobj->scale = mobj->target->scale; mobj->scale = mobj->target->scale;
P_UnsetThingPosition(mobj); P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
{ mobj->momx = FixedMul(FINECOSINE(mobj->angle>>ANGLETOFINESHIFT),radius);
const angle_t fa = mobj->angle>>ANGLETOFINESHIFT; mobj->momy = FixedMul(FINESINE(mobj->angle>>ANGLETOFINESHIFT), radius);
mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); if (!P_TryMove(mobj, mobj->target->x + mobj->momx, mobj->target->y + mobj->momy, false))
mobj->y = mobj->target->y + FixedMul(FINESINE(fa), radius); P_SlideMove(mobj, true);
mobj->z = mobj->target->z + HEIGHT; mobj->z = mobj->floorz;
P_SetThingPosition(mobj); mobj->momx = mobj->momy = 0;
}
// Was this so hard? // Was this so hard?
if ((mobj->type == MT_GREENSHIELD && !(mobj->target->player->kartstuff[k_greenshell] & 1)) if ((mobj->type == MT_GREENSHIELD && !(mobj->target->player->kartstuff[k_greenshell] & 1))