From b1905c16ef5c93bb148453577f0de64e37283a85 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Dec 2011 16:07:32 +0000 Subject: [PATCH] - added UDMF LOcknumber property, submitted by Nightfall. SVN r3331 (trunk) --- src/am_map.cpp | 62 ++++++++++++++++++++++++++++---------------------- src/namedef.h | 13 ++++++----- src/p_spec.cpp | 27 ++++++++++++---------- src/p_udmf.cpp | 17 +++++++++----- src/r_defs.h | 13 ++++++----- 5 files changed, 75 insertions(+), 57 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index ec7e99859..d2046f33e 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1913,12 +1913,13 @@ bool AM_Check3DFloors(line_t *line) //============================================================================= void AM_drawWalls (bool allmap) -{ - int i; - static mline_t l; - - for (i = 0; i < numlines; i++) - { +{ + int i; + static mline_t l; + int lock, color; + + for (i = 0; i < numlines; i++) + { l.a.x = lines[i].v1->x >> FRACTOMAPBITS; l.a.y = lines[i].v1->y >> FRACTOMAPBITS; l.b.x = lines[i].v2->x >> FRACTOMAPBITS; @@ -1948,14 +1949,22 @@ void AM_drawWalls (bool allmap) else if (lines[i].flags & ML_SECRET) { // secret door if (am_cheat != 0 && lines[i].backsector != NULL) - AM_drawMline(&l, SecretWallColor); - else - AM_drawMline(&l, WallColor); - } - else if ((lines[i].special == Teleport || - lines[i].special == Teleport_NoFog || - lines[i].special == Teleport_ZombieChanger || - lines[i].special == Teleport_Line) && + AM_drawMline(&l, SecretWallColor); + else + AM_drawMline(&l, WallColor); + } else if (lines[i].locknumber > 0) { // [Dusk] specials w/ locknumbers + lock = lines[i].locknumber; + color = P_GetMapColorForLock(lock); + + AMColor c; + if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color)); + else c = LockedColor; + + AM_drawMline (&l, c); + } else if ((lines[i].special == Teleport || + lines[i].special == Teleport_NoFog || + lines[i].special == Teleport_ZombieChanger || + lines[i].special == Teleport_Line) && (lines[i].activation & SPAC_PlayerActivate) && am_colorset == 0) { // intra-level teleporters @@ -1975,19 +1984,18 @@ void AM_drawWalls (bool allmap) (lines[i].special == Door_Animated && lines[i].args[3] != 0) || (lines[i].special == Generic_Door && lines[i].args[4] != 0)) { - if (am_colorset == 0 || am_colorset == 3) // Raven games show door colors - { - int P_GetMapColorForLock(int lock); - int lock; - - if (lines[i].special==Door_LockedRaise || lines[i].special==Door_Animated) - lock=lines[i].args[3]; - else lock=lines[i].args[4]; - - int color = P_GetMapColorForLock(lock); - - AMColor c; - + if (am_colorset == 0 || am_colorset == 3) // Raven games show door colors + { + int P_GetMapColorForLock(int lock); + + if (lines[i].special==Door_LockedRaise || lines[i].special==Door_Animated) + lock=lines[i].args[3]; + else lock=lines[i].args[4]; + + color = P_GetMapColorForLock(lock); + + AMColor c; + if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color)); else c = LockedColor; diff --git a/src/namedef.h b/src/namedef.h index a98de3692..6cf7f322c 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -379,12 +379,13 @@ xx(Midtex3d) xx(Checkswitchrange) xx(Firstsideonly) xx(Transparent) -xx(Passuse) -xx(Repeatspecial) -xx(Conversation) - -xx(Playercross) -xx(Playeruse) +xx(Passuse) +xx(Repeatspecial) +xx(Conversation) +xx(Locknumber) + +xx(Playercross) +xx(Playeruse) xx(Playeruseback) xx(Monstercross) xx(Impact) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index a60751aa2..d0c28bc89 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -57,12 +57,13 @@ #include "gi.h" #include "statnums.h" #include "g_level.h" -#include "v_font.h" -#include "a_sharedglobal.h" -#include "farchive.h" - -// State. -#include "r_state.h" +#include "v_font.h" +#include "a_sharedglobal.h" +#include "farchive.h" +#include "a_keys.h" + +// State. +#include "r_state.h" #include "c_console.h" @@ -232,12 +233,14 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType) BYTE special; if (!P_TestActivateLine (line, mo, side, activationType)) - { - return false; - } - lineActivation = line->activation; - repeat = line->flags & ML_REPEAT_SPECIAL; - buttonSuccess = false; + { + return false; + } + int remote = (line->special != 7 && line->special != 8 && (line->special < 11 || line->special > 14)); + if (line->locknumber > 0 && !P_CheckKeys (mo, line->locknumber, remote)) return false; + lineActivation = line->activation; + repeat = line->flags & ML_REPEAT_SPECIAL; + buttonSuccess = false; buttonSuccess = P_ExecuteSpecial(line->special, line, mo, side == 1, line->args[0], line->args[1], line->args[2], diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index e1e0f371a..20ef4ffd2 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -877,12 +877,17 @@ public: Flag(ld->flags, ML_BLOCKUSE, key); continue; - case NAME_blocksight: - Flag(ld->flags, ML_BLOCKSIGHT, key); - continue; - - default: - break; + case NAME_blocksight: + Flag(ld->flags, ML_BLOCKSIGHT, key); + continue; + + // [Dusk] lock number + case NAME_Locknumber: + ld->locknumber = CheckInt(key); + continue; + + default: + break; } if (!strnicmp("user_", key.GetChars(), 5)) diff --git a/src/r_defs.h b/src/r_defs.h index 7af5eabde..03c2290c2 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -907,12 +907,13 @@ struct line_t side_t *sidedef[2]; //DWORD sidenum[2]; // sidenum[1] will be NO_SIDE if one sided fixed_t bbox[4]; // bounding box, for the extent of the LineDef. - slopetype_t slopetype; // To aid move clipping. - sector_t *frontsector, *backsector; - int validcount; // if == validcount, already checked -}; - -// phares 3/14/98 + slopetype_t slopetype; // To aid move clipping. + sector_t *frontsector, *backsector; + int validcount; // if == validcount, already checked + int locknumber; // [Dusk] lock number for special +}; + +// phares 3/14/98 // // Sector list node showing all sectors an object appears in. //