Adapt linedef types 321-322 to UDMF

This commit is contained in:
MascaraSnake 2021-12-09 18:15:27 +01:00
parent 2638e1212c
commit 126cbdd189
5 changed files with 66 additions and 14 deletions

View file

@ -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";

View file

@ -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";

View file

@ -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

View file

@ -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

View file

@ -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,