From 613ae5e0228bf55f959b2c57550c8ceb99355c5d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 22 Feb 2009 15:39:42 +0000 Subject: [PATCH] - added ML_BLOCKPROJECTILE flag to lines. SVN r1440 (trunk) --- docs/rh-log.txt | 1 + specs/udmf_zdoom.txt | 6 +++++- src/doomdata.h | 1 + src/namedef.h | 1 + src/p_lnspec.cpp | 37 +++++++++++++++++++++++++++++++++++-- src/p_map.cpp | 3 ++- src/p_udmf.cpp | 4 ++++ 7 files changed, 49 insertions(+), 4 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index bb7a05666..d286c6abd 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ February 22, 2009 (Changes by Graf Zahl) +- added ML_BLOCKPROJECTILE flag to lines. - Fixed: With opl_onechip set the second OPL chip was never set to anything valid so it contained an invalid pointer. There were also a few other places that simply assumed that the second chip is set to something valid. diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 26facab13..b0b7b00b3 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -1,5 +1,5 @@ =============================================================================== -Universal Doom Map Format ZDoom extensions v1.2 - 21.08.2008 +Universal Doom Map Format ZDoom extensions v1.5 - 22.02.2009 Copyright (c) 2008 Christoph Oelckers. @@ -102,6 +102,7 @@ Note: All fields default to false unless mentioned otherwise. wrapmidtex = ; // Line's mid textures are wrapped. midtex3d = ; // Actors can walk on mid texture. checkswitchrange = ;// Switches can only be activated when vertically reachable. + blockprojectiles = ;// Line blocks all projectiles } @@ -200,6 +201,7 @@ Note: All fields default to false unless mentioned otherwise. Bit 4 (Value 16): wrapmidtex Bit 5 (Value 32): midtex3d Bit 6 (Value 64): checkswitchrange + Bit 7 (Value 128): firstsideonly When used in special 208 this arg should be cleared afterward. @@ -229,6 +231,8 @@ integer, not float Changed description of class and skill thing flags to avoid the impression that this uses array syntax. No functional changes +1.5 22.02.2009 +Added blockprojectiles to lines and firstsideonly to conversion notes =============================================================================== EOF diff --git a/src/doomdata.h b/src/doomdata.h index 700c21ae0..533cc8845 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -149,6 +149,7 @@ enum ELineFlags ML_3DMIDTEX = 0x00200000, ML_CHECKSWITCHRANGE = 0x00400000, ML_FIRSTSIDEONLY = 0x00800000, // activated only when crossed from front side + ML_BLOCKPROJECTILE = 0x01000000, }; diff --git a/src/namedef.h b/src/namedef.h index bbdefc82d..2506aae25 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -409,5 +409,6 @@ xx(light) xx(lightabsolute) xx(nofakecontrast) xx(smoothlighting) +xx(blockprojectiles) xx(Renderstyle) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index a26e71be0..5ee13ce49 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2357,6 +2357,39 @@ FUNC(LS_Line_SetTextureOffset) return true; } +FUNC(LS_Line_SetBlocking) +// Line_SetBlocking (id, setflags, clearflags) +{ + static const int flagtrans[] = + { + ML_BLOCKING, + ML_BLOCKMONSTERS, + ML_BLOCK_PLAYERS, + ML_BLOCK_FLOATERS, + ML_BLOCKPROJECTILE, + ML_BLOCKEVERYTHING, + ML_RAILING, + -1 + }; + + if (arg0 == 0) return false; + + int setflags = 0; + int clearflags = 0; + + for(int i = 0; flagtrans[i] != -1; i++, arg1 >>= 1, arg2 >>= 1) + { + if (arg1 & 1) setflags |= flagtrans[i]; + if (arg2 & 1) clearflags |= flagtrans[i]; + } + + for(int line = -1; (line = P_FindLineFromID (arg0, line)) >= 0; ) + { + lines[line].flags = (lines[line].flags & ~clearflags) | setflags; + } + return true; +} + FUNC(LS_ChangeCamera) @@ -2942,8 +2975,8 @@ lnSpecFunc LineSpecials[256] = LS_Sector_SetLink, LS_Scroll_Wall, LS_Line_SetTextureOffset, - LS_NOP, // 54 - LS_NOP, // 55 + LS_Sector_ChangeFlags, + LS_Line_SetBlocking, LS_NOP, // 56 LS_NOP, // 57 LS_NOP, // 58 diff --git a/src/p_map.cpp b/src/p_map.cpp index 3e93882b7..3c5cf23c8 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -562,7 +562,7 @@ bool PIT_CheckLine (line_t *ld, const FBoundingBox &box, FCheckPosition &tm) return false; } - if (!(tm.thing->flags & MF_MISSILE) || (ld->flags & ML_BLOCKEVERYTHING)) + if (!(tm.thing->flags & MF_MISSILE) || (ld->flags & (ML_BLOCKEVERYTHING|ML_BLOCKPROJECTILE))) { if (ld->flags & ML_RAILING) { @@ -571,6 +571,7 @@ bool PIT_CheckLine (line_t *ld, const FBoundingBox &box, FCheckPosition &tm) else if ((ld->flags & (ML_BLOCKING|ML_BLOCKEVERYTHING)) || // explicitly blocking everything (!(tm.thing->flags3 & MF3_NOBLOCKMONST) && (ld->flags & ML_BLOCKMONSTERS)) || // block monsters only (tm.thing->player != NULL && (ld->flags & ML_BLOCK_PLAYERS)) || // block players + ((tm.thing->flags & MF_MISSILE) && (ld->flags & ML_BLOCKPROJECTILE)) || // block projectiles ((ld->flags & ML_BLOCK_FLOATERS) && (tm.thing->flags & MF_FLOAT))) // block floaters { if (tm.thing->flags2 & MF2_BLASTED) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 6bd5b26c9..ccb9b4f89 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -628,6 +628,10 @@ struct UDMFParser Flag(ld->flags, ML_FIRSTSIDEONLY, key); break; + case NAME_blockprojectiles: + Flag(ld->flags, ML_BLOCKPROJECTILE, key); + break; + default: break; }