From 1f73c9cf9954e736c567ffe0bc144ed51b9868e3 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 11 Sep 2022 16:15:50 +0200 Subject: [PATCH] Add flag to per-sector gravity for overriding MF2_OBJECTFLIP --- extras/conf/SRB2-22.cfg | 1 + src/p_mobj.c | 8 ++++++++ src/p_spec.c | 3 +++ src/r_defs.h | 1 + 4 files changed, 13 insertions(+) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 006430422..6abf14a35 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -578,6 +578,7 @@ linedeftypes title = "Per-Sector Gravity"; prefix = "(1)"; flags64text = "[6] Flip in reverse gravity"; + flags8192text = "[13] Override MF2_OBJECTFLIP"; } 5 diff --git a/src/p_mobj.c b/src/p_mobj.c index 36253569b..a4f2147e5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1464,7 +1464,11 @@ fixed_t P_GetMobjGravity(mobj_t *mo) gravityadd = -FixedMul(gravity, gravfactor); if ((rover->master->frontsector->flags & MSF_GRAVITYFLIP) && gravityadd > 0) + { + if (rover->master->frontsector->specialflags & SSF_GRAVITYOVERRIDE) + mo->flags2 &= ~MF2_OBJECTFLIP; mo->eflags |= MFE_VERTICALFLIP; + } no3dfloorgrav = false; break; @@ -1476,7 +1480,11 @@ fixed_t P_GetMobjGravity(mobj_t *mo) gravityadd = -FixedMul(gravity, P_GetSectorGravityFactor(mo->subsector->sector)); if ((mo->subsector->sector->flags & MSF_GRAVITYFLIP) && gravityadd > 0) + { + if (mo->subsector->sector->specialflags & SSF_GRAVITYOVERRIDE) + mo->flags2 &= ~MF2_OBJECTFLIP; mo->eflags |= MFE_VERTICALFLIP; + } } // Less gravity underwater. diff --git a/src/p_spec.c b/src/p_spec.c index 03ed298e8..4ebf5ccd3 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6283,6 +6283,9 @@ void P_SpawnSpecials(boolean fromnetsave) else sectors[s].flags &= ~MSF_GRAVITYFLIP; + if (lines[i].flags & ML_EFFECT6) + sectors[s].specialflags |= SSF_GRAVITYOVERRIDE; + CheckForReverseGravity |= (sectors[s].flags & MSF_GRAVITYFLIP); } break; diff --git a/src/r_defs.h b/src/r_defs.h index e91f864ac..38c6e25f7 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -315,6 +315,7 @@ typedef enum SSF_FINISHLINE = 1<<17, SSF_ROPEHANG = 1<<18, SSF_JUMPFLIP = 1<<19, + SSF_GRAVITYOVERRIDE = 1<<20, } sectorspecialflags_t; typedef enum