mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-17 02:01:15 +00:00
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:
parent
65c5c94563
commit
101a560d4e
4 changed files with 16 additions and 15 deletions
|
@ -1009,10 +1009,11 @@ static int lib_pTeleportMove(lua_State *L)
|
|||
static int lib_pSlideMove(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
boolean forceslide = luaL_checkboolean(L, 2);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_SlideMove(mo);
|
||||
P_SlideMove(mo, forceslide);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -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_Move(mobj_t *actor, fixed_t speed);
|
||||
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);
|
||||
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);
|
||||
|
|
|
@ -3521,8 +3521,9 @@ stairstep:
|
|||
// and slide along it
|
||||
//
|
||||
// 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;
|
||||
INT16 hitcount = 0;
|
||||
|
@ -3600,7 +3601,7 @@ retry:
|
|||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
|
||||
// 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);
|
||||
return;
|
||||
|
|
21
src/p_mobj.c
21
src/p_mobj.c
|
@ -1809,7 +1809,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
}
|
||||
else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE))
|
||||
{ // try to slide along it
|
||||
P_SlideMove(mo);
|
||||
P_SlideMove(mo, false);
|
||||
xmove = ymove = 0;
|
||||
}
|
||||
else if (mo->type == MT_SPINFIRE)
|
||||
|
@ -1990,7 +1990,7 @@ static void P_RingXYMovement(mobj_t *mo)
|
|||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
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)
|
||||
|
@ -2004,7 +2004,7 @@ static void P_SceneryXYMovement(mobj_t *mo)
|
|||
oldy = mo->y;
|
||||
|
||||
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))
|
||||
return; // no friction when airborne
|
||||
|
@ -6622,14 +6622,13 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
if (mobj->target->player)
|
||||
mobj->scale = mobj->target->scale;
|
||||
|
||||
P_UnsetThingPosition(mobj);
|
||||
{
|
||||
const angle_t fa = mobj->angle>>ANGLETOFINESHIFT;
|
||||
mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius);
|
||||
mobj->y = mobj->target->y + FixedMul(FINESINE(fa), radius);
|
||||
mobj->z = mobj->target->z + HEIGHT;
|
||||
P_SetThingPosition(mobj);
|
||||
}
|
||||
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
|
||||
mobj->momx = FixedMul(FINECOSINE(mobj->angle>>ANGLETOFINESHIFT),radius);
|
||||
mobj->momy = FixedMul(FINESINE(mobj->angle>>ANGLETOFINESHIFT), radius);
|
||||
if (!P_TryMove(mobj, mobj->target->x + mobj->momx, mobj->target->y + mobj->momy, false))
|
||||
P_SlideMove(mobj, true);
|
||||
mobj->z = mobj->floorz;
|
||||
mobj->momx = mobj->momy = 0;
|
||||
|
||||
// Was this so hard?
|
||||
if ((mobj->type == MT_GREENSHIELD && !(mobj->target->player->kartstuff[k_greenshell] & 1))
|
||||
|
|
Loading…
Reference in a new issue