Add new linedef executor trigger that checks gravity

This commit is contained in:
spherallic 2022-09-17 02:14:25 +02:00
parent 9e9e3f4cca
commit 872a2001c8
5 changed files with 95 additions and 2 deletions

View file

@ -2065,6 +2065,30 @@ linedeftypes
prefix = "(342)"; prefix = "(342)";
} }
343
{
title = "Gravity Check - Continuous";
flags2text = "[1] Check temporary reverse gravity";
flags64text = "[6] Check for reverse gravity";
prefix = "(343)";
}
344
{
title = "Gravity Check - Each Time";
flags2text = "[1] Check temporary reverse gravity";
flags64text = "[6] Check for reverse gravity";
prefix = "(344)";
}
345
{
title = "Gravity Check - Once";
flags2text = "[1] Check temporary reverse gravity";
flags64text = "[6] Check for reverse gravity";
prefix = "(345)";
}
399 399
{ {
title = "Level Load"; title = "Level Load";

View file

@ -779,6 +779,21 @@ doom
title = "NiGHTS Mare - Once"; title = "NiGHTS Mare - Once";
prefix = "(342)"; prefix = "(342)";
} }
343
{
title = "Gravity Check - Continuous";
prefix = "(343)";
}
344
{
title = "Gravity Check - Each Time";
prefix = "(344)";
}
345
{
title = "Gravity Check - Once";
prefix = "(345)";
}
399 399
{ {
title = "Level Load"; title = "Level Load";
@ -3581,6 +3596,29 @@ udmf
} }
} }
343
{
title = "Gravity Check";
prefix = "(343)";
arg0
{
title = "Trigger type";
type = 11;
enum = "triggertype";
}
arg1
{
title = "Gravity";
type = 11;
enum
{
0 = "Normal gravity";
1 = "Reverse gravity";
2 = "Reverse gravity (no MF2_OBJECTFLIP)";
}
}
}
399 399
{ {
title = "Level Load"; title = "Level Load";

View file

@ -4893,6 +4893,21 @@ static void P_ConvertBinaryLinedefTypes(void)
lines[i].args[2] = TMC_EQUAL; lines[i].args[2] = TMC_EQUAL;
lines[i].special = 340; lines[i].special = 340;
break; break;
case 343: //Gravity check - continuous
case 344: //Gravity check - each time
case 345: //Gravity check - once
if (lines[i].special == 345)
lines[i].args[0] = TMT_ONCE;
else if (lines[i].special == 344)
lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER;
else
lines[i].args[0] = TMT_CONTINUOUS;
if (lines[i].flags & ML_BLOCKMONSTERS)
lines[i].args[1] = TMG_TEMPREVERSE;
else if (lines[i].flags & ML_NOCLIMB)
lines[i].args[1] = TMG_REVERSE;
lines[i].special = 343;
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

@ -1862,6 +1862,12 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (!P_CheckPlayerMare(triggerline)) if (!P_CheckPlayerMare(triggerline))
return false; return false;
break; break;
case 343: // gravity check
if ((!(actor->flags2 & MF2_OBJECTFLIP) != !(actor->player->powers[pw_gravityboots])) && triggerline->args[1] == TMG_TEMPREVERSE)
return false;
if (!(actor->eflags & MFE_VERTICALFLIP) != (triggerline->args[1] == TMG_NORMAL))
return false;
break;
default: default:
break; break;
} }
@ -1899,7 +1905,8 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|| 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 || specialtype == 337 // Emerald check
|| specialtype == 343) // Gravity check
&& triggerline->args[0] == TMT_ONCE) && triggerline->args[0] == TMT_ONCE)
triggerline->special = 0; triggerline->special = 0;
} }
@ -1949,7 +1956,8 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|| 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].special == 337 // Emerald check
|| lines[masterline].special == 343) // Gravity check
&& lines[masterline].args[0] > TMT_EACHTIMEMASK) && lines[masterline].args[0] > TMT_EACHTIMEMASK)
continue; continue;
@ -6906,6 +6914,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 331: // Player skin case 331: // Player skin
case 334: // Object dye case 334: // Object dye
case 337: // Emerald check case 337: // Emerald check
case 343: // Gravity 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

@ -254,6 +254,13 @@ typedef enum
TMC_GTE = 2, TMC_GTE = 2,
} textmapcomparison_t; } textmapcomparison_t;
typedef enum
{
TMG_NORMAL = 0,
TMG_REVERSE = 1,
TMG_TEMPREVERSE = 2,
} textmapgravity_t;
typedef enum typedef enum
{ {
TMNP_FASTEST = 0, TMNP_FASTEST = 0,