From 14caf665679a474105dfe502d8d287b10b60513b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 4 Jun 2018 23:23:52 -0400 Subject: [PATCH] MFE_JUSTBOUNCEDWALL Hopefully, this should prevent instances where shells/Oni get caught on walls. --- src/dehacked.c | 2 +- src/p_map.c | 9 ++++++++- src/p_mobj.c | 2 +- src/p_mobj.h | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 71d1d8f4..0196806a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7306,7 +7306,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water - "\x01", // free: 1<<7 (name un-matchable) + "JUSTBOUNCEDWALL", // SRB2Kart: Mobj already bounced off a wall this tic "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_map.c b/src/p_map.c index 16a3838b..ece49f26 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3886,6 +3886,12 @@ void P_BounceMove(mobj_t *mo) //INT32 hitcount; fixed_t mmomx = 0, mmomy = 0; + if (mo->eflags & MFE_JUSTBOUNCEDWALL) + { + P_SlideMove(mo, true); + return; + } + slidemo = mo; //hitcount = 0; @@ -4018,7 +4024,8 @@ bounceback: } } - P_HitBounceLine(bestslideline); // clip the moves + P_HitBounceLine(bestslideline); + mo->eflags |= MFE_JUSTBOUNCEDWALL; mo->momx = tmxmove; mo->momy = tmymove; diff --git a/src/p_mobj.c b/src/p_mobj.c index 479c8f99..2ba98af0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6407,7 +6407,7 @@ void P_MobjThinker(mobj_t *mobj) P_SetTarget(&mobj->tracer, NULL); mobj->flags2 &= ~MF2_PUSHED; - mobj->eflags &= ~MFE_SPRUNG; + mobj->eflags &= ~(MFE_SPRUNG|MFE_JUSTBOUNCEDWALL); tmfloorthing = tmhitthing = NULL; diff --git a/src/p_mobj.h b/src/p_mobj.h index 3617ea40..01171a57 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -233,7 +233,8 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 + // SRB2Kart: The mobj just hit & bounced off a wall, this is cleared on next frame + MFE_JUSTBOUNCEDWALL = 1<<7, // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement