Support gravity override flag in UDMF

This commit is contained in:
spherallic 2022-09-11 19:46:57 +02:00
parent 5e6185abe2
commit 0ee81a1cc3
4 changed files with 18 additions and 1 deletions

View file

@ -3918,6 +3918,16 @@ udmf
2 = "Remove"; 2 = "Remove";
} }
} }
arg3
{
title = "Override gravity?";
type = 11;
enum
{
0 = "No";
1 = "Yes";
}
}
stringarg0 stringarg0
{ {
title = "Gravity value"; title = "Gravity value";

View file

@ -1727,6 +1727,8 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char
sectors[i].specialflags |= SSF_ROPEHANG; sectors[i].specialflags |= SSF_ROPEHANG;
else if (fastcmp(param, "jumpflip") && fastcmp("true", val)) else if (fastcmp(param, "jumpflip") && fastcmp("true", val))
sectors[i].specialflags |= SSF_JUMPFLIP; sectors[i].specialflags |= SSF_JUMPFLIP;
else if (fastcmp(param, "gravityoverride") && fastcmp("true", val))
sectors[i].specialflags |= SSF_GRAVITYOVERRIDE;
else if (fastcmp(param, "friction")) else if (fastcmp(param, "friction"))
sectors[i].friction = FLOAT_TO_FIXED(atof(val)); sectors[i].friction = FLOAT_TO_FIXED(atof(val));
else if (fastcmp(param, "gravity")) else if (fastcmp(param, "gravity"))
@ -2582,6 +2584,8 @@ static void P_WriteTextmap(void)
fprintf(f, "ropehang = true;\n"); fprintf(f, "ropehang = true;\n");
if (wsectors[i].specialflags & SSF_JUMPFLIP) if (wsectors[i].specialflags & SSF_JUMPFLIP)
fprintf(f, "jumpflip = true;\n"); fprintf(f, "jumpflip = true;\n");
if (wsectors[i].specialflags & SSF_GRAVITYOVERRIDE)
fprintf(f, "gravityoverride = true;\n");
if (wsectors[i].friction != ORIG_FRICTION) if (wsectors[i].friction != ORIG_FRICTION)
fprintf(f, "friction = %f;\n", FIXED_TO_FLOAT(wsectors[i].friction)); fprintf(f, "friction = %f;\n", FIXED_TO_FLOAT(wsectors[i].friction));
if (wsectors[i].gravity != FRACUNIT) if (wsectors[i].gravity != FRACUNIT)

View file

@ -3826,6 +3826,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
sectors[secnum].flags |= MSF_GRAVITYFLIP; sectors[secnum].flags |= MSF_GRAVITYFLIP;
else if (line->args[2] == TMF_REMOVE) else if (line->args[2] == TMF_REMOVE)
sectors[secnum].flags &= ~MSF_GRAVITYFLIP; sectors[secnum].flags &= ~MSF_GRAVITYFLIP;
if (line->args[3])
sectors[secnum].specialflags |= SSF_GRAVITYOVERRIDE;
} }
} }
break; break;

View file

@ -315,7 +315,7 @@ typedef enum
SSF_FINISHLINE = 1<<17, SSF_FINISHLINE = 1<<17,
SSF_ROPEHANG = 1<<18, SSF_ROPEHANG = 1<<18,
SSF_JUMPFLIP = 1<<19, SSF_JUMPFLIP = 1<<19,
SSF_GRAVITYOVERRIDE = 1<<20, SSF_GRAVITYOVERRIDE = 1<<20, // combine with MSF_GRAVITYFLIP
} sectorspecialflags_t; } sectorspecialflags_t;
typedef enum typedef enum