From bdc5d941c238307ae1be9a42818bd1cd3b3dc6e3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Apr 2010 07:21:35 +0000 Subject: [PATCH] - added a new 'playeruseback' linedef trigger type that allows using lines from the bxck side. SVN r2302 (trunk) --- specs/udmf_zdoom.txt | 6 ++++- src/doomdata.h | 3 ++- src/namedef.h | 1 + src/p_map.cpp | 59 +++++++++++++++++++++++++++++--------------- src/p_spec.cpp | 2 +- src/p_udmf.cpp | 4 +++ 6 files changed, 52 insertions(+), 23 deletions(-) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 7db91f302..e0ec43925 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -1,5 +1,5 @@ =============================================================================== -Universal Doom Map Format ZDoom extensions v1.9 - 17.04.2010 +Universal Doom Map Format ZDoom extensions v1.10 - 25.04.2010 Copyright (c) 2008 Christoph Oelckers. @@ -89,6 +89,7 @@ Note: All fields default to false unless mentioned otherwise. alpha = ; // Translucency of this line, default is 1.0 renderstyle = ; // Render style, can be "translucent" or "add", // default is "translucent". + playeruseback = ; // New SPAC flag, true = player can use from back side. anycross = ; // New SPAC flag, true = any non-projectile // crossing will trigger this line monsteractivate = ; // Monsters can trigger this line. @@ -259,6 +260,9 @@ Fixed conversion specifications for TranslucentLine special. 1.9 17.04.2010 Changed node specifications to deprecate compression of node lump. +1.10 25.04.2010 +Added 'playeruseback' line trigger flag. + =============================================================================== EOF =============================================================================== diff --git a/src/doomdata.h b/src/doomdata.h index 6b3002cdb..028ae5512 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -169,8 +169,9 @@ enum SPAC SPAC_AnyCross = 1<<7, // when anything without the MF2_TELEPORT flag crosses the line SPAC_MUse = 1<<8, // monsters can use SPAC_MPush = 1<<9, // monsters can push + SPAC_UseBack = 1<<10, // Can be used from the backside - SPAC_PlayerActivate = (SPAC_Cross|SPAC_Use|SPAC_Impact|SPAC_Push|SPAC_AnyCross|SPAC_UseThrough), + SPAC_PlayerActivate = (SPAC_Cross|SPAC_Use|SPAC_Impact|SPAC_Push|SPAC_AnyCross|SPAC_UseThrough|SPAC_UseBack), }; enum EMapLineFlags // These are flags that use different values internally diff --git a/src/namedef.h b/src/namedef.h index a95b4b5a0..4ee1e7c0f 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -386,6 +386,7 @@ xx(Repeatspecial) xx(Playercross) xx(Playeruse) +xx(Playeruseback) xx(Monstercross) xx(Impact) xx(Playerpush) diff --git a/src/p_map.cpp b/src/p_map.cpp index 6e5807066..9ff863e2b 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3983,7 +3983,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline } FLineOpening open; - if (in->d.line->special == 0 || !(in->d.line->activation & (SPAC_Use|SPAC_UseThrough))) + if (in->d.line->special == 0 || !(in->d.line->activation & (SPAC_Use|SPAC_UseThrough|SPAC_UseBack))) { blocked: if (in->d.line->flags & (ML_BLOCKEVERYTHING|ML_BLOCKUSE)) @@ -4029,27 +4029,46 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline } if (P_PointOnLineSide (usething->x, usething->y, in->d.line) == 1) - // [RH] continue traversal for two-sided lines - //return in->d.line->backsector != NULL; // don't use back side - goto blocked; // do a proper check for back sides of triggers - - P_ActivateLine (in->d.line, usething, 0, SPAC_Use); + { + if (!(in->d.line->activation & SPAC_UseBack)) + { + // [RH] continue traversal for two-sided lines + //return in->d.line->backsector != NULL; // don't use back side + goto blocked; // do a proper check for back sides of triggers + } + else + { + P_ActivateLine (in->d.line, usething, 1, SPAC_UseBack); + return true; + } + } + else + { + if ((in->d.line->activation & (SPAC_Use|SPAC_UseThrough|SPAC_UseBack)) == SPAC_UseBack) + { + goto blocked; // Line cannot be used from front side so treat it as a non-trigger line + } + + P_ActivateLine (in->d.line, usething, 0, SPAC_Use); + + //WAS can't use more than one special line in a row + //jff 3/21/98 NOW multiple use allowed with enabling line flag + //[RH] And now I've changed it again. If the line is of type + // SPAC_USE, then it eats the use. Everything else passes + // it through, including SPAC_USETHROUGH. + if (i_compatflags & COMPATF_USEBLOCKING) + { + if (in->d.line->activation & SPAC_UseThrough) continue; + else return true; + } + else + { + if (!(in->d.line->activation & SPAC_Use)) continue; + else return true; + } - //WAS can't use more than one special line in a row - //jff 3/21/98 NOW multiple use allowed with enabling line flag - //[RH] And now I've changed it again. If the line is of type - // SPAC_USE, then it eats the use. Everything else passes - // it through, including SPAC_USETHROUGH. - if (i_compatflags & COMPATF_USEBLOCKING) - { - if (in->d.line->activation & SPAC_UseThrough) continue; - else return true; - } - else - { - if (!(in->d.line->activation & SPAC_Use)) continue; - else return true; } + } return false; } diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 9f634ab56..eb42ef61a 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -294,7 +294,7 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType) { lineActivation |= SPAC_Cross|SPAC_MCross; } - if (activationType == SPAC_Use) + if (activationType ==SPAC_Use || activationType == SPAC_UseBack) { if (!P_CheckSwitchRange(mo, line, side)) { diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 5dfa06dd7..33fb027a7 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -721,6 +721,10 @@ struct UDMFParser Flag(ld->activation, SPAC_Use, key); continue; + case NAME_Playeruseback: + Flag(ld->activation, SPAC_UseBack, key); + continue; + case NAME_Monstercross: Flag(ld->activation, SPAC_MCross, key); continue;