Add NiGHTS mare trigger linedef type and deprecate the NiGHTS mare sector type

This commit is contained in:
MascaraSnake 2021-12-09 20:57:44 +01:00
parent 18e8ebf394
commit dc4dd75810
4 changed files with 111 additions and 5 deletions

View file

@ -432,7 +432,7 @@ sectortypes
64 = "Trigger Line Ex. (Anywhere in Sector)";
80 = "Trigger Line Ex. (Floor Touch)";
96 = "Trigger Line Ex. (Emerald Check) <deprecated>";
112 = "Trigger Line Ex. (NiGHTS Mare)";
112 = "Trigger Line Ex. (NiGHTS Mare) <deprecated>";
128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule";
160 = "Special Stage Time/Spheres Parameters";
@ -487,7 +487,7 @@ gen_sectortypes
64 = "Trigger Line Ex. (Anywhere in Sector)";
80 = "Trigger Line Ex. (Floor Touch)";
96 = "Trigger Line Ex. (Emerald Check) <deprecated>";
112 = "Trigger Line Ex. (NiGHTS Mare)";
112 = "Trigger Line Ex. (NiGHTS Mare) <deprecated>";
128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule";
160 = "Special Stage Time/Spheres Parameters";
@ -2000,6 +2000,30 @@ linedeftypes
prefix = "(339)";
}
340
{
title = "NiGHTS Mare - Continuous";
flags2text = "[1] Mare greater or equal";
flags64text = "[6] Mare less or equal";
prefix = "(340)";
}
341
{
title = "NiGHTS Mare - Each Time";
flags2text = "[1] Mare greater or equal";
flags64text = "[6] Mare less or equal";
prefix = "(341)";
}
342
{
title = "NiGHTS Mare - Once";
flags2text = "[1] Mare greater or equal";
flags64text = "[6] Mare less or equal";
prefix = "(342)";
}
399
{
title = "Level Load";

View file

@ -769,6 +769,21 @@ doom
title = "Emerald Check - Once";
prefix = "(339)";
}
340
{
title = "NiGHTS Mare - Continuous";
prefix = "(340)";
}
341
{
title = "NiGHTS Mare - Each Time";
prefix = "(341)";
}
342
{
title = "NiGHTS Mare - Once";
prefix = "(342)";
}
399
{
title = "Level Load";
@ -3104,6 +3119,28 @@ udmf
}
}
340
{
title = "NiGHTS Mare";
prefix = "(340)";
arg0
{
title = "Trigger type";
type = 11;
enum = "triggertype";
}
arg1
{
title = "Mare";
}
arg2
{
title = "Comparison";
type = 11;
enum = "comparison";
}
}
399
{
title = "Level Load";

View file

@ -3775,7 +3775,7 @@ static void P_ConvertBinaryMap(void)
if (lines[i].flags & ML_NOCLIMB)
lines[i].args[2] = TMC_GTE;
else if (lines[i].flags & ML_EFFECT4)
lines[i].args[2] = TMC_GTE;
lines[i].args[2] = TMC_LTE;
else
lines[i].args[2] = TMC_EQUAL;
lines[i].special = 314;
@ -3928,6 +3928,24 @@ static void P_ConvertBinaryMap(void)
lines[i].args[2] = TMF_HASALL;
lines[i].special = 337;
break;
case 340: //NiGHTS mare - continuous
case 341: //NiGHTS mare - each time
case 342: //NiGHTS mare - once
if (lines[i].special == 342)
lines[i].args[0] = TMT_ONCE;
else if (lines[i].special == 341)
lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER;
else
lines[i].args[0] = TMT_CONTINUOUS;
lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
if (lines[i].flags & ML_NOCLIMB)
lines[i].args[2] = TMC_LTE;
else if (lines[i].flags & ML_BLOCKMONSTERS)
lines[i].args[2] = TMC_GTE;
else
lines[i].args[2] = TMC_EQUAL;
lines[i].special = 340;
break;
case 400: //Set tagged sector's floor height/texture
case 401: //Set tagged sector's ceiling height/texture
lines[i].args[0] = tag;

View file

@ -1501,7 +1501,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor)
return true;
}
static boolean P_CheckPlayerMare(line_t *triggerline)
static boolean P_CheckPlayerMareOld(line_t *triggerline)
{
UINT8 mare;
INT32 targetmare = P_AproxDistance(triggerline->dx, triggerline->dy) >> FRACBITS;
@ -1520,6 +1520,28 @@ static boolean P_CheckPlayerMare(line_t *triggerline)
return mare == targetmare;
}
static boolean P_CheckPlayerMare(line_t *triggerline)
{
UINT8 mare;
INT32 targetmare = triggerline->args[1];
if (!(maptol & TOL_NIGHTS))
return false;
mare = P_FindLowestMare();
switch (triggerline->args[2])
{
case TMC_EQUAL:
default:
return mare == targetmare;
case TMC_GTE:
return mare >= targetmare;
case TMC_LTE:
return mare <= targetmare;
}
}
static boolean P_CheckPlayerRings(line_t *triggerline, mobj_t *actor)
{
INT32 rings = 0;
@ -1744,7 +1766,8 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
}
else if (GETSECSPECIAL(caller->special, 2) == 7)
{
if (!P_CheckPlayerMare(triggerline))
CONS_Alert(CONS_WARNING, M_GetText("Deprecated NiGHTS mare sector type detected. Please use linedef types 340-342 instead.\n"));
if (!P_CheckPlayerMareOld(triggerline))
return false;
}
// If we were not triggered by a sector type especially for the purpose,
@ -1846,6 +1869,10 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (!P_CheckEmeralds(triggerline->args[2], (UINT16)triggerline->args[1]))
return false;
break;
case 340: // NiGHTS mare
if (!P_CheckPlayerMare(triggerline))
return false;
break;
default:
break;
}