From 291d4ac4c9ff1b8f7690a60a3f02f1ed450b8c02 Mon Sep 17 00:00:00 2001 From: spherallic <spherallic@gmail.com> Date: Thu, 22 Jun 2023 14:39:25 +0200 Subject: [PATCH] Add sector flags to disable equation slope physics --- extras/conf/udb/Includes/SRB222_misc.cfg | 4 ++++ src/p_setup.c | 8 ++++++++ src/r_defs.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index e274fece69..ce85d08b1b 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -78,6 +78,8 @@ sectorflags ropehang = "Rope Hang"; jumpflip = "Flip Gravity on Jump"; gravityoverride = "Make Reverse Gravity Temporary"; + nophysics_floor = "Disable Floor Slope Physics"; + nophysics_ceiling = "Disable Ceiling Slope Physics"; flipspecial_nofloor = "No Trigger on Floor Touch"; flipspecial_ceiling = "Trigger on Ceiling Touch"; triggerspecial_touch = "Trigger on Edge Touch"; @@ -114,6 +116,8 @@ sectorflagscategories ropehang = "special"; jumpflip = "special"; gravityoverride = "special"; + nophysics_floor = "special"; + nophysics_ceiling = "special"; flipspecial_nofloor = "trigger"; flipspecial_ceiling = "trigger"; triggerspecial_touch = "trigger"; diff --git a/src/p_setup.c b/src/p_setup.c index 74645e8771..7dda2be1f1 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1731,6 +1731,10 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char sectors[i].specialflags |= SSF_JUMPFLIP; else if (fastcmp(param, "gravityoverride") && fastcmp("true", val)) sectors[i].specialflags |= SSF_GRAVITYOVERRIDE; + else if (fastcmp(param, "nophysics_floor") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_NOPHYSICSFLOOR; + else if (fastcmp(param, "nophysics_ceiling") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_NOPHYSICSCEILING; else if (fastcmp(param, "friction")) sectors[i].friction = FLOAT_TO_FIXED(atof(val)); else if (fastcmp(param, "gravity")) @@ -2785,12 +2789,16 @@ static void P_LoadTextmap(void) { sc->f_slope = MakeViaEquationConstants(textmap_planefloor.a, textmap_planefloor.b, textmap_planefloor.c, textmap_planefloor.d); sc->hasslope = true; + if (sc->specialflags & SSF_NOPHYSICSFLOOR) + sc->f_slope->flags |= SL_NOPHYSICS|SL_DYNAMIC; } if (textmap_planeceiling.defined == (PD_A|PD_B|PD_C|PD_D)) { sc->c_slope = MakeViaEquationConstants(textmap_planeceiling.a, textmap_planeceiling.b, textmap_planeceiling.c, textmap_planeceiling.d); sc->hasslope = true; + if (sc->specialflags & SSF_NOPHYSICSCEILING) + sc->c_slope->flags |= SL_NOPHYSICS|SL_DYNAMIC; } TextmapFixFlatOffsets(sc); diff --git a/src/r_defs.h b/src/r_defs.h index 6d2b7d3d8a..fbc1c7721e 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -357,6 +357,8 @@ typedef enum SSF_ROPEHANG = 1<<18, SSF_JUMPFLIP = 1<<19, SSF_GRAVITYOVERRIDE = 1<<20, // combine with MSF_GRAVITYFLIP + SSF_NOPHYSICSFLOOR = 1<<21, + SSF_NOPHYSICSCEILING = 1<<22, } sectorspecialflags_t; typedef enum -- GitLab