From 875ba7915ccbc0f85fad81f27c635e69f702d660 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Thu, 9 Dec 2021 08:49:50 +0100 Subject: [PATCH] Adapt linedef types 309-312 to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 18 ++++++++++++ extras/conf/udb/Includes/SRB222_misc.cfg | 6 ++++ src/p_setup.c | 11 +++++++ src/p_spec.c | 31 ++++++++------------ src/p_spec.h | 6 ++++ 5 files changed, 54 insertions(+), 18 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index f5eddf380..e74d4978e 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2542,6 +2542,24 @@ udmf } } + 309 + { + title = "CTF Team"; + prefix = "(309)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Team"; + type = 11; + enum = "team"; + } + } + 313 { title = "No More Enemies - Once"; diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 2f2992b0d..4b37d4628 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -503,6 +503,12 @@ enums 2 = "Each time on entry"; 3 = "Each time on entry/exit"; } + + team + { + 0 = "Red"; + 1 = "Blue"; + } } //Default things filters diff --git a/src/p_setup.c b/src/p_setup.c index add37c25b..4b567d324 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3737,6 +3737,17 @@ static void P_ConvertBinaryMap(void) lines[i].args[3] = !!(lines[i].flags & ML_EFFECT4); lines[i].special = 303; break; + case 309: //CTF red team - continuous + case 310: //CTF red team - each time + case 311: //CTF blue team - continuous + case 312: //CTF blue team - each time + if (lines[i].special % 2 == 1) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = (lines[i].special > 310) ? TMT_BLUE : TMT_RED; + lines[i].special = 309; + break; case 313: //No more enemies - once lines[i].args[0] = tag; break; diff --git a/src/p_spec.c b/src/p_spec.c index ca084750b..f75cd5419 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1752,16 +1752,11 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!(actor && actor->player && actor->player->charability == dist/10)) return false; break; - case 309: // continuous - case 310: // each time - // Only red team members can activate this. - if (!(actor && actor->player && actor->player->ctfteam == 1)) + case 309: + // Only red/blue team members can activate this. + if (!(actor && actor->player)) return false; - break; - case 311: // continuous - case 312: // each time - // Only blue team members can activate this. - if (!(actor && actor->player && actor->player->ctfteam == 2)) + if (actor->player->ctfteam != ((triggerline->args[1] == TMT_RED) ? 1 : 2)) return false; break; case 314: @@ -1851,6 +1846,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || (specialtype == 303 && triggerline->args[0] == TMT_ONCE) // Ring count || specialtype == 307 // Character ability - Once || specialtype == 308 // Race only - Once + || (specialtype == 309 && triggerline->args[0] == TMT_ONCE) // CTF team || specialtype == 313 // No More Enemies - Once || (specialtype == 314 && triggerline->args[0] == TMT_ONCE) // No of pushables || (specialtype == 317 && triggerline->args[0] == TMT_ONCE) // Unlockable trigger @@ -6662,6 +6658,14 @@ void P_SpawnSpecials(boolean fromnetsave) } break; + // Linedef executor triggers for CTF teams. + case 309: + if (!(gametyperules & GTR_TEAMFLAGS)) + { + lines[i].special = 0; + break; + } + /* FALLTHRU */ case 300: // Trigger linedef executor case 303: // Count rings case 314: // Pushable linedef executors (count # of pushables) @@ -6681,17 +6685,8 @@ void P_SpawnSpecials(boolean fromnetsave) lines[i].special = 0; break; - // Linedef executor triggers for CTF teams. - case 309: - case 311: - if (!(gametyperules & GTR_TEAMFLAGS)) - lines[i].special = 0; - break; - // Each time executors case 306: - case 310: - case 312: case 332: case 335: P_AddEachTimeThinker(&lines[i], !!(lines[i].flags & ML_BOUNCY)); diff --git a/src/p_spec.h b/src/p_spec.h index b7968432c..0ed5ad8d4 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -114,6 +114,12 @@ typedef enum TMT_EACHTIMEENTERANDEXIT = 3, } textmaptriggertype_t; +typedef enum +{ + TMT_RED = 0, + TMT_BLUE = 1, +} textmapteam_t; + typedef enum { TMC_EQUAL = 0,