From 0ee81a1cc378a7983897a0f99843a0ec9f03274a Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 11 Sep 2022 19:46:57 +0200 Subject: [PATCH] Support gravity override flag in UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 10 ++++++++++ src/p_setup.c | 4 ++++ src/p_spec.c | 3 +++ src/r_defs.h | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 6da66ae21..681955b35 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -3918,6 +3918,16 @@ udmf 2 = "Remove"; } } + arg3 + { + title = "Override gravity?"; + type = 11; + enum + { + 0 = "No"; + 1 = "Yes"; + } + } stringarg0 { title = "Gravity value"; diff --git a/src/p_setup.c b/src/p_setup.c index b58df7c67..1a6d9444e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1727,6 +1727,8 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char sectors[i].specialflags |= SSF_ROPEHANG; else if (fastcmp(param, "jumpflip") && fastcmp("true", val)) sectors[i].specialflags |= SSF_JUMPFLIP; + else if (fastcmp(param, "gravityoverride") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_GRAVITYOVERRIDE; else if (fastcmp(param, "friction")) sectors[i].friction = FLOAT_TO_FIXED(atof(val)); else if (fastcmp(param, "gravity")) @@ -2582,6 +2584,8 @@ static void P_WriteTextmap(void) fprintf(f, "ropehang = true;\n"); if (wsectors[i].specialflags & SSF_JUMPFLIP) fprintf(f, "jumpflip = true;\n"); + if (wsectors[i].specialflags & SSF_GRAVITYOVERRIDE) + fprintf(f, "gravityoverride = true;\n"); if (wsectors[i].friction != ORIG_FRICTION) fprintf(f, "friction = %f;\n", FIXED_TO_FLOAT(wsectors[i].friction)); if (wsectors[i].gravity != FRACUNIT) diff --git a/src/p_spec.c b/src/p_spec.c index 4ebf5ccd3..2b9d672f3 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3826,6 +3826,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) sectors[secnum].flags |= MSF_GRAVITYFLIP; else if (line->args[2] == TMF_REMOVE) sectors[secnum].flags &= ~MSF_GRAVITYFLIP; + + if (line->args[3]) + sectors[secnum].specialflags |= SSF_GRAVITYOVERRIDE; } } break; diff --git a/src/r_defs.h b/src/r_defs.h index 38c6e25f7..d7c9a6ece 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -315,7 +315,7 @@ typedef enum SSF_FINISHLINE = 1<<17, SSF_ROPEHANG = 1<<18, SSF_JUMPFLIP = 1<<19, - SSF_GRAVITYOVERRIDE = 1<<20, + SSF_GRAVITYOVERRIDE = 1<<20, // combine with MSF_GRAVITYFLIP } sectorspecialflags_t; typedef enum