diff --git a/src/lua_baselib.c b/src/lua_baselib.c index e8e8fd02..aa2ebf65 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -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; } diff --git a/src/p_local.h b/src/p_local.h index c86256ae..7533429a 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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); diff --git a/src/p_map.c b/src/p_map.c index bf7ad90d..547444ec 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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; diff --git a/src/p_mobj.c b/src/p_mobj.c index 5e2c25f3..ccce7bf9 100644 --- a/src/p_mobj.c +++ b/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))