From 6bbb032581828760585e22b64e9dbe395ea74ee1 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 30 Dec 2022 11:19:29 +0100 Subject: [PATCH] UDMF: Use string values for the sector "triggerer" field --- extras/conf/udb/Includes/SRB222_misc.cfg | 10 ++------- src/p_setup.c | 26 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index fcc24741e..ed0488a3f 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -265,14 +265,8 @@ universalfields triggerer { - type = 0; - default = 0; - enum - { - 0 = "Player"; - 1 = "All players"; - 2 = "Object"; - } + type = 2; + default = "Player"; } } diff --git a/src/p_setup.c b/src/p_setup.c index eedda1b08..f31eca076 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1761,7 +1761,14 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char else if (fastcmp(param, "triggertag")) sectors[i].triggertag = atol(val); 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) @@ -2633,7 +2640,22 @@ static void P_WriteTextmap(void) if (wsectors[i].triggertag != 0) fprintf(f, "triggertag = %d;\n", wsectors[i].triggertag); 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"); }