Add sector flags to disable equation slope physics

This commit is contained in:
sphere 2024-03-13 17:38:45 +00:00
parent 5ab1fc2102
commit 70626a683f
4 changed files with 17 additions and 1 deletions

View file

@ -228,6 +228,8 @@ Sonic Robo Blast 2 defines the following standardized fields:
ropehang = <bool>; // Sector is a rope hang. Must be applied to a 3D floor.
jumpflip = <bool>; // Sector flips the gravity of players who jump from it.
gravityoverride = <bool>; // Reverse gravity effect is only applied when an object is in the sector.
nophysics_floor = <bool>; // Disables floor slope physics if created through a plane equation.
nophysics_ceiling = <bool>; // Disables ceiling slope physics if created through a plane equation.
friction = <float>; // Sector's friction factor.
gravity = <float>; // Sector's gravity. Default is 1.0.

View file

@ -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";

View file

@ -1816,6 +1816,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"))
@ -2954,12 +2958,16 @@ static void P_LoadTextmap(void)
{
sc->f_slope = P_MakeSlopeViaEquationConstants(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;
}
if (textmap_planeceiling.defined == (PD_A|PD_B|PD_C|PD_D))
{
sc->c_slope = P_MakeSlopeViaEquationConstants(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;
}
TextmapFixFlatOffsets(sc);

View file

@ -405,6 +405,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