Merge branch 'udmf-triggerer' into 'next'

UDMF: Use string values for the sector "triggerer" field

See merge request STJr/SRB2!1902
This commit is contained in:
MascaraSnake 2023-01-28 06:32:29 +00:00
commit 6055b1490b
2 changed files with 26 additions and 10 deletions

View file

@ -265,14 +265,8 @@ universalfields
triggerer triggerer
{ {
type = 0; type = 2;
default = 0; default = "Player";
enum
{
0 = "Player";
1 = "All players";
2 = "Object";
}
} }
} }

View file

@ -1761,7 +1761,14 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char
else if (fastcmp(param, "triggertag")) else if (fastcmp(param, "triggertag"))
sectors[i].triggertag = atol(val); sectors[i].triggertag = atol(val);
else if (fastcmp(param, "triggerer")) else if (fastcmp(param, "triggerer"))
sectors[i].triggerer = atol(val); {
if (fastcmp(val, "Player"))
sectors[i].triggerer = TO_PLAYER;
if (fastcmp(val, "AllPlayers"))
sectors[i].triggerer = TO_ALLPLAYERS;
if (fastcmp(val, "Mobj"))
sectors[i].triggerer = TO_MOBJ;
}
} }
static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char *val) static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char *val)
@ -2633,7 +2640,22 @@ static void P_WriteTextmap(void)
if (wsectors[i].triggertag != 0) if (wsectors[i].triggertag != 0)
fprintf(f, "triggertag = %d;\n", wsectors[i].triggertag); fprintf(f, "triggertag = %d;\n", wsectors[i].triggertag);
if (wsectors[i].triggerer != 0) if (wsectors[i].triggerer != 0)
fprintf(f, "triggerer = %d;\n", wsectors[i].triggerer); {
switch (wsectors[i].triggerer)
{
case TO_PLAYER:
fprintf(f, "triggerer = \"Player\";\n");
break;
case TO_ALLPLAYERS:
fprintf(f, "triggerer = \"AllPlayers\";\n");
break;
case TO_MOBJ:
fprintf(f, "triggerer = \"Mobj\";\n");
break;
default:
break;
}
}
fprintf(f, "}\n"); fprintf(f, "}\n");
fprintf(f, "\n"); fprintf(f, "\n");
} }