Add emerald check trigger linedef types and deprecate the emerald check sector type

This commit is contained in:
MascaraSnake 2021-12-09 20:37:39 +01:00
parent 22420f92d2
commit 18e8ebf394
7 changed files with 134 additions and 26 deletions

View file

@ -431,7 +431,7 @@ sectortypes
48 = "Trigger Line Ex. (Floor Touch, All Players)"; 48 = "Trigger Line Ex. (Floor Touch, All Players)";
64 = "Trigger Line Ex. (Anywhere in Sector)"; 64 = "Trigger Line Ex. (Anywhere in Sector)";
80 = "Trigger Line Ex. (Floor Touch)"; 80 = "Trigger Line Ex. (Floor Touch)";
96 = "Trigger Line Ex. (Emerald Check)"; 96 = "Trigger Line Ex. (Emerald Check) <deprecated>";
112 = "Trigger Line Ex. (NiGHTS Mare)"; 112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs"; 128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule"; 144 = "Egg Capsule";
@ -486,7 +486,7 @@ gen_sectortypes
48 = "Trigger Line Ex. (Floor Touch, All Players)"; 48 = "Trigger Line Ex. (Floor Touch, All Players)";
64 = "Trigger Line Ex. (Anywhere in Sector)"; 64 = "Trigger Line Ex. (Anywhere in Sector)";
80 = "Trigger Line Ex. (Floor Touch)"; 80 = "Trigger Line Ex. (Floor Touch)";
96 = "Trigger Line Ex. (Emerald Check)"; 96 = "Trigger Line Ex. (Emerald Check) <deprecated>";
112 = "Trigger Line Ex. (NiGHTS Mare)"; 112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs"; 128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule"; 144 = "Egg Capsule";
@ -1982,6 +1982,24 @@ linedeftypes
prefix = "(336)"; prefix = "(336)";
} }
337
{
title = "Emerald Check - Continuous";
prefix = "(337)";
}
338
{
title = "Emerald Check - Each Time";
prefix = "(338)";
}
339
{
title = "Emerald Check - Once";
prefix = "(339)";
}
399 399
{ {
title = "Level Load"; title = "Level Load";

View file

@ -754,6 +754,21 @@ doom
title = "Object Dye - Once"; title = "Object Dye - Once";
prefix = "(336)"; prefix = "(336)";
} }
337
{
title = "Emerald Check - Continuous";
prefix = "(337)";
}
338
{
title = "Emerald Check - Each Time";
prefix = "(338)";
}
339
{
title = "Emerald Check - Once";
prefix = "(339)";
}
399 399
{ {
title = "Level Load"; title = "Level Load";
@ -2647,14 +2662,7 @@ udmf
{ {
title = "Check if"; title = "Check if";
type = 11; type = 11;
enum enum = "flagcheck";
{
0 = "Has all";
1 = "Has any";
2 = "Has exactly";
3 = "Doesn't have all";
4 = "Doesn't have any";
}
} }
} }
@ -3063,6 +3071,39 @@ udmf
} }
} }
337
{
title = "Emerald Check";
prefix = "(337)";
arg0
{
title = "Trigger type";
type = 11;
enum = "triggertype";
}
arg1
{
title = "Emeralds";
type = 12;
enum
{
1 = "Emerald 1";
2 = "Emerald 2";
4 = "Emerald 3";
8 = "Emerald 4";
16 = "Emerald 5";
32 = "Emerald 6";
64 = "Emerald 7";
}
}
arg2
{
title = "Check if";
type = 11;
enum = "flagcheck";
}
}
399 399
{ {
title = "Level Load"; title = "Level Load";

View file

@ -516,6 +516,15 @@ enums
0 = "Red"; 0 = "Red";
1 = "Blue"; 1 = "Blue";
} }
flagcheck
{
0 = "Has all";
1 = "Has any";
2 = "Has exactly";
3 = "Doesn't have all";
4 = "Doesn't have any";
}
} }
//Default things filters //Default things filters

View file

@ -21,7 +21,7 @@ sectortypes
48 = "Trigger Line Ex. (Floor Touch, All Players)"; 48 = "Trigger Line Ex. (Floor Touch, All Players)";
64 = "Trigger Line Ex. (Anywhere in Sector)"; 64 = "Trigger Line Ex. (Anywhere in Sector)";
80 = "Trigger Line Ex. (Floor Touch)"; 80 = "Trigger Line Ex. (Floor Touch)";
96 = "Trigger Line Ex. (Emerald Check)"; 96 = "Trigger Line Ex. (Emerald Check) <deprecated>";
112 = "Trigger Line Ex. (NiGHTS Mare)"; 112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs"; 128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule"; 144 = "Egg Capsule";
@ -74,7 +74,7 @@ gen_sectortypes
48 = "Trigger Line Ex. (Floor Touch, All Players)"; 48 = "Trigger Line Ex. (Floor Touch, All Players)";
64 = "Trigger Line Ex. (Anywhere in Sector)"; 64 = "Trigger Line Ex. (Anywhere in Sector)";
80 = "Trigger Line Ex. (Floor Touch)"; 80 = "Trigger Line Ex. (Floor Touch)";
96 = "Trigger Line Ex. (Emerald Check)"; 96 = "Trigger Line Ex. (Emerald Check) <deprecated>";
112 = "Trigger Line Ex. (NiGHTS Mare)"; 112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs"; 128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule"; 144 = "Egg Capsule";

View file

@ -3752,7 +3752,7 @@ static void P_ConvertBinaryMap(void)
case 308: //Race only - once case 308: //Race only - once
lines[i].args[0] = TMT_ONCE; lines[i].args[0] = TMT_ONCE;
lines[i].args[1] = GTR_RACE; lines[i].args[1] = GTR_RACE;
lines[i].args[2] = TMG_HASANY; lines[i].args[2] = TMF_HASANY;
break; break;
case 309: //CTF red team - continuous case 309: //CTF red team - continuous
case 310: //CTF red team - each time case 310: //CTF red team - each time
@ -3915,6 +3915,19 @@ static void P_ConvertBinaryMap(void)
} }
lines[i].special = 334; lines[i].special = 334;
break; break;
case 337: //Emerald check - continuous
case 338: //Emerald check - each time
case 339: //Emerald check - once
if (lines[i].special == 339)
lines[i].args[0] = TMT_ONCE;
else if (lines[i].special == 338)
lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER;
else
lines[i].args[0] = TMT_CONTINUOUS;
lines[i].args[1] = EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7;
lines[i].args[2] = TMF_HASALL;
lines[i].special = 337;
break;
case 400: //Set tagged sector's floor height/texture case 400: //Set tagged sector's floor height/texture
case 401: //Set tagged sector's ceiling height/texture case 401: //Set tagged sector's ceiling height/texture
lines[i].args[0] = tag; lines[i].args[0] = tag;

View file

@ -1590,6 +1590,24 @@ static boolean P_CheckPushables(line_t *triggerline, sector_t *caller)
} }
} }
static boolean P_CheckEmeralds(INT32 checktype, UINT16 target)
{
switch (checktype)
{
case TMF_HASALL:
default:
return (emeralds & target) == target;
case TMF_HASANY:
return !!(emeralds & target);
case TMF_HASEXACTLY:
return emeralds == target;
case TMF_DOESNTHAVEALL:
return (emeralds & target) != target;
case TMF_DOESNTHAVEANY:
return !(emeralds & target);
}
}
static void P_ActivateLinedefExecutor(line_t *line, mobj_t *actor, sector_t *caller) static void P_ActivateLinedefExecutor(line_t *line, mobj_t *actor, sector_t *caller)
{ {
if (line->special < 400 || line->special >= 500) if (line->special < 400 || line->special >= 500)
@ -1720,6 +1738,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
{ {
if (GETSECSPECIAL(caller->special, 2) == 6) if (GETSECSPECIAL(caller->special, 2) == 6)
{ {
CONS_Alert(CONS_WARNING, M_GetText("Deprecated emerald check sector type detected. Please use linedef types 337-339 instead.\n"));
if (!(ALL7EMERALDS(emeralds))) if (!(ALL7EMERALDS(emeralds)))
return false; return false;
} }
@ -1822,6 +1841,11 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (!!(triggerline->args[1]) ^ (triggercolor != color)) if (!!(triggerline->args[1]) ^ (triggercolor != color))
return false; return false;
} }
break;
case 337: // emerald check
if (!P_CheckEmeralds(triggerline->args[2], (UINT16)triggerline->args[1]))
return false;
break;
default: default:
break; break;
} }
@ -1858,7 +1882,8 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|| specialtype == 317 // Unlockable trigger || specialtype == 317 // Unlockable trigger
|| specialtype == 319 // Unlockable || specialtype == 319 // Unlockable
|| specialtype == 331 // Player skin || specialtype == 331 // Player skin
|| specialtype == 334) // Object dye || specialtype == 334 // Object dye
|| specialtype == 337) // Emerald check
&& triggerline->args[0] == TMT_ONCE) && triggerline->args[0] == TMT_ONCE)
triggerline->special = 0; triggerline->special = 0;
} }
@ -1907,7 +1932,8 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|| lines[masterline].special == 317 // Condition set trigger || lines[masterline].special == 317 // Condition set trigger
|| lines[masterline].special == 319 // Unlockable trigger || lines[masterline].special == 319 // Unlockable trigger
|| lines[masterline].special == 331 // Player skin || lines[masterline].special == 331 // Player skin
|| lines[masterline].special == 334) // Object dye || lines[masterline].special == 334 // Object dye
|| lines[masterline].special == 337) // Emerald check
&& lines[masterline].args[0] > TMT_EACHTIMEMASK) && lines[masterline].args[0] > TMT_EACHTIMEMASK)
continue; continue;
@ -5872,16 +5898,16 @@ static boolean P_CheckGametypeRules(INT32 checktype, UINT32 target)
{ {
switch (checktype) switch (checktype)
{ {
case TMG_HASALL: case TMF_HASALL:
default: default:
return (gametyperules & target) == target; return (gametyperules & target) == target;
case TMG_HASANY: case TMF_HASANY:
return !!(gametyperules & target); return !!(gametyperules & target);
case TMG_HASEXACTLY: case TMF_HASEXACTLY:
return gametyperules == target; return gametyperules == target;
case TMG_DOESNTHAVEALL: case TMF_DOESNTHAVEALL:
return (gametyperules & target) != target; return (gametyperules & target) != target;
case TMG_DOESNTHAVEANY: case TMF_DOESNTHAVEANY:
return !(gametyperules & target); return !(gametyperules & target);
} }
} }
@ -6694,6 +6720,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 319: // Unlockable trigger case 319: // Unlockable trigger
case 331: // Player skin case 331: // Player skin
case 334: // Object dye case 334: // Object dye
case 337: // Emerald check
if (lines[i].args[0] > TMT_EACHTIMEMASK) if (lines[i].args[0] > TMT_EACHTIMEMASK)
P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT); P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT);
break; break;

View file

@ -124,12 +124,12 @@ typedef enum
typedef enum typedef enum
{ {
TMG_HASALL = 0, TMF_HASALL = 0,
TMG_HASANY = 1, TMF_HASANY = 1,
TMG_HASEXACTLY = 2, TMF_HASEXACTLY = 2,
TMG_DOESNTHAVEALL = 3, TMF_DOESNTHAVEALL = 3,
TMG_DOESNTHAVEANY = 4, TMF_DOESNTHAVEANY = 4,
} textmapgametypecheck_t; } textmapflagcheck_t;
typedef enum typedef enum
{ {