Adapt linedef types 309-312 to UDMF

This commit is contained in:
MascaraSnake 2021-12-09 08:49:50 +01:00
parent 9d87e97275
commit 875ba7915c
5 changed files with 54 additions and 18 deletions

View file

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

View file

@ -503,6 +503,12 @@ enums
2 = "Each time on entry";
3 = "Each time on entry/exit";
}
team
{
0 = "Red";
1 = "Blue";
}
}
//Default things filters

View file

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

View file

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

View file

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