diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 7c53d99f6..9aeada89b 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -432,7 +432,7 @@ sectortypes 64 = "Trigger Line Ex. (Anywhere in Sector)"; 80 = "Trigger Line Ex. (Floor Touch)"; 96 = "Trigger Line Ex. (Emerald Check) "; - 112 = "Trigger Line Ex. (NiGHTS Mare)"; + 112 = "Trigger Line Ex. (NiGHTS Mare) "; 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) "; - 112 = "Trigger Line Ex. (NiGHTS Mare)"; + 112 = "Trigger Line Ex. (NiGHTS Mare) "; 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"; diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 940d4b650..d108821f7 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -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"; diff --git a/src/p_setup.c b/src/p_setup.c index 6a1218f41..aa687bfa2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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; diff --git a/src/p_spec.c b/src/p_spec.c index 7c3f01333..58f28cddb 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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; }