From 126cbdd189cf2385fed537108d548050d5424518 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Thu, 9 Dec 2021 18:15:27 +0100 Subject: [PATCH] Adapt linedef types 321-322 to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 26 ++++++++++++++++++++ extras/conf/udb/Includes/SRB222_misc.cfg | 7 ++++++ src/p_setup.c | 16 ++++++++++++ src/p_spec.c | 23 +++++++---------- src/p_spec.h | 8 ++++++ 5 files changed, 66 insertions(+), 14 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index e74d4978e..76bb2c5ba 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2625,6 +2625,32 @@ udmf } } + 321 + { + title = "Trigger After X Calls"; + prefix = "(321)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "xtriggertype"; + } + arg1 + { + title = "Calls"; + } + arg2 + { + title = "Can retrigger?"; + type = 11; + enum = "noyes"; + } + arg3 + { + title = "Starting calls"; + } + } + 323 { title = "NiGHTSerize"; diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 4b37d4628..1e11ad255 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -504,6 +504,13 @@ enums 3 = "Each time on entry/exit"; } + xtriggertype + { + 0 = "Continuous"; + 1 = "Each time on entry"; + 2 = "Each time on entry/exit"; + } + team { 0 = "Red"; diff --git a/src/p_setup.c b/src/p_setup.c index 03f45eb02..a459e6401 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3775,6 +3775,22 @@ static void P_ConvertBinaryMap(void) lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].special = 319; break; + case 321: //Trigger after X calls - Continuous + case 322: //Trigger after X calls - Each time + if (lines[i].special % 2 == 0) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMXT_EACHTIMEENTERANDEXIT : TMXT_EACHTIMEENTER; + else + lines[i].args[0] = TMXT_CONTINUOUS; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + { + lines[i].args[2] = 1; + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + } + else + lines[i].args[2] = lines[i].args[3] = 0; + lines[i].special = 321; + break; case 323: //NiGHTSerize - Each time case 324: //NiGHTSerize - Once case 325: //DeNiGHTSerize - Each time diff --git a/src/p_spec.c b/src/p_spec.c index f75cd5419..5f3ce50d8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1793,8 +1793,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller return false; } break; - case 321: // continuous - case 322: // each time + case 321: // decrement calls left before triggering if (triggerline->callcount > 0) { @@ -1837,9 +1836,9 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!P_ActivateLinedefExecutorsInSector(triggerline, actor, caller)) return false; - // "Trigger on X calls" linedefs reset if noclimb is set - if ((specialtype == 321 || specialtype == 322) && triggerline->flags & ML_NOCLIMB) - triggerline->callcount = sides[triggerline->sidenum[0]].textureoffset>>FRACBITS; + // "Trigger on X calls" linedefs reset if args[2] is set + if (specialtype == 321 && triggerline->args[2]) + triggerline->callcount = triggerline->args[3]; else // These special types work only once if ((specialtype == 300 && triggerline->args[0] == TMT_ONCE) // Basic @@ -1851,7 +1850,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || (specialtype == 314 && triggerline->args[0] == TMT_ONCE) // No of pushables || (specialtype == 317 && triggerline->args[0] == TMT_ONCE) // Unlockable trigger || (specialtype == 319 && triggerline->args[0] == TMT_ONCE) // Unlockable - || specialtype == 321 || specialtype == 322 // Trigger on X calls - Continuous + Each Time + || specialtype == 321 // Trigger on X calls || (specialtype == 323 && triggerline->args[0]) // Nightserize - Once || (specialtype == 325 && triggerline->args[0]) // DeNightserize - Once || (specialtype == 327 && triggerline->args[0]) // Nights lap - Once @@ -1899,7 +1898,7 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) || lines[masterline].special == 306 // Character ability - Each time || lines[masterline].special == 310 // CTF Red team - Each time || lines[masterline].special == 312 // CTF Blue team - Each time - || lines[masterline].special == 322 // Trigger on X calls - Each Time + || (lines[masterline].special == 321 && lines[masterline].args[0] > TMXT_EACHTIMEMASK) // Trigger after X calls - Each time || lines[masterline].special == 332 // Skin - Each time || lines[masterline].special == 335)// Dye - Each time continue; @@ -6699,13 +6698,9 @@ void P_SpawnSpecials(boolean fromnetsave) // Trigger on X calls case 321: - case 322: - if (lines[i].flags & ML_NOCLIMB && sides[lines[i].sidenum[0]].rowoffset > 0) // optional "starting" count - lines[i].callcount = sides[lines[i].sidenum[0]].rowoffset>>FRACBITS; - else - lines[i].callcount = sides[lines[i].sidenum[0]].textureoffset>>FRACBITS; - if (lines[i].special == 322) // Each time - P_AddEachTimeThinker(&lines[i], !!(lines[i].flags & ML_BOUNCY)); + lines[i].callcount = (lines[i].args[2] && lines[i].args[3] > 0) ? lines[i].args[3] : lines[i].args[1]; // optional "starting" count + if (lines[i].args[0] > TMXT_EACHTIMEMASK) // Each time + P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMXT_EACHTIMEENTERANDEXIT); break; // NiGHTS trigger executors diff --git a/src/p_spec.h b/src/p_spec.h index 0ed5ad8d4..a317467f8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -114,6 +114,14 @@ typedef enum TMT_EACHTIMEENTERANDEXIT = 3, } textmaptriggertype_t; +typedef enum +{ + TMXT_CONTINUOUS = 0, + TMXT_EACHTIMEMASK = TMXT_CONTINUOUS, + TMXT_EACHTIMEENTER = 1, + TMXT_EACHTIMEENTERANDEXIT = 2, +} textmapxtriggertype_t; + typedef enum { TMT_RED = 0,