From 9357ed82edd921af6d1f6fb88ff7fa1849920f16 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 21 Nov 2009 23:11:12 +0000 Subject: [PATCH] - extended Doom map format linedef translator so that it also handles the flags. SVN r1992 (trunk) --- docs/rh-log.txt | 3 +++ src/p_xlat.cpp | 41 ++++++++++++++++------------------ src/xlat/parse_xlat.cpp | 5 +++-- src/xlat/xlat.h | 8 +++++++ src/xlat/xlat_parser.y | 20 +++++++++++++++++ wadsrc/static/xlat/defines.i | 31 +++++++++++++++++++++++++ wadsrc/static/xlat/doom.txt | 12 ++++++++++ wadsrc/static/xlat/heretic.txt | 11 +++++++++ wadsrc/static/xlat/strife.txt | 13 +++++++++++ 9 files changed, 120 insertions(+), 24 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 2b7bbbe9a..9a04d901d 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,6 @@ +November 22, 2009 (Changes by Graf Zahl) +- extended Doom map format linedef translator so that it also handles the flags. + November 19, 2009 - Replaced toint/quickertoint with the portable routines from xs_Float.h. The former used fistp, which is not portable across platforms, so cannot be diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index da5695ece..7ec97f3e6 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -68,38 +68,35 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld) DWORD flags = LittleShort(mld->flags); INTBOOL passthrough; - if (flags & ML_TRANSLUCENT_STRIFE) + DWORD flags1 = flags; + DWORD newflags = 0; + + for(int i=0;i<16;i++) { - ld->Alpha = FRACUNIT*3/4; - } - if (gameinfo.gametype == GAME_Strife) - { - if (flags & ML_RAILING_STRIFE) + if ((flags & (1<Alpha = FRACUNIT*3/4; + break; + default: + newflags |= LineFlagTranslations[i].newvalue; + break; } } - if (flags & ML_3DMIDTEX_ETERNITY) - { - flags |= ML_3DMIDTEX; - } - passthrough = (flags & ML_PASSUSE_BOOM); } - flags = flags & 0xFFFF01FF; // Ignore flags unknown to DOOM + flags = newflags; // For purposes of maintaining BOOM compatibility, each // line also needs to have its ID set to the same as its tag. diff --git a/src/xlat/parse_xlat.cpp b/src/xlat/parse_xlat.cpp index 75f2d3d27..6221c5497 100644 --- a/src/xlat/parse_xlat.cpp +++ b/src/xlat/parse_xlat.cpp @@ -61,6 +61,7 @@ FBoomTranslator Boomish[MAX_BOOMISH]; int NumBoomish; TAutoGrowArray SectorTranslations; TArray SectorMasks; +FLineFlagTrans LineFlagTranslations[16]; struct SpecialArgs @@ -112,13 +113,13 @@ struct XlatParseContext : public FParseContext static const char *tokens[] = { "arg2", "arg3", "arg4", "arg5", "bitmask", "clear", - "define", "enum", "flags", "include", "lineid", + "define", "enum", "flags", "include", "lineflag", "lineid", "maxlinespecial", "nobitmask", "sector", "tag" }; static const short types[] = { XLAT_ARG2, XLAT_ARG3, XLAT_ARG4, XLAT_ARG5, XLAT_BITMASK, XLAT_CLEAR, - XLAT_DEFINE, XLAT_ENUM, XLAT_FLAGS, XLAT_INCLUDE, XLAT_TAG, + XLAT_DEFINE, XLAT_ENUM, XLAT_FLAGS, XLAT_INCLUDE, XLAT_LINEFLAG, XLAT_TAG, XLAT_MAXLINESPECIAL, XLAT_NOBITMASK, XLAT_SECTOR, XLAT_TAG }; diff --git a/src/xlat/xlat.h b/src/xlat/xlat.h index 3ba4381e6..018a2639e 100644 --- a/src/xlat/xlat.h +++ b/src/xlat/xlat.h @@ -80,10 +80,18 @@ struct FSectorMask int shift; }; +struct FLineFlagTrans +{ + int newvalue; + bool ismask; +}; + + extern TAutoGrowArray SimpleLineTranslations; extern FBoomTranslator Boomish[MAX_BOOMISH]; extern int NumBoomish; extern TAutoGrowArray SectorTranslations; extern TArray SectorMasks; +extern FLineFlagTrans LineFlagTranslations[16]; #endif diff --git a/src/xlat/xlat_parser.y b/src/xlat/xlat_parser.y index 420989338..d6f71b6a3 100644 --- a/src/xlat/xlat_parser.y +++ b/src/xlat/xlat_parser.y @@ -17,6 +17,7 @@ external_declaration ::= enum_statement. external_declaration ::= linetype_declaration. external_declaration ::= boom_declaration. external_declaration ::= sector_declaration. +external_declaration ::= lineflag_declaration. external_declaration ::= sector_bitmask. external_declaration ::= maxlinespecial_def. external_declaration ::= NOP. @@ -512,3 +513,22 @@ sector_bitmask ::= SECTOR BITMASK exp(mask) CLEAR SEMICOLON. sector_op(A) ::= LSHASSIGN. { A = 1; } sector_op(A) ::= RSHASSIGN. { A = -1; } +%type lineflag_op {int} + +lineflag_declaration ::= LINEFLAG exp(from) EQUALS exp(to) SEMICOLON. +{ + if (from >= 0 && from < 16) + { + LineFlagTranslations[from].newvalue = to; + LineFlagTranslations[from].ismask = false; + } +} + +lineflag_declaration ::= LINEFLAG exp(from) AND exp(mask) SEMICOLON. +{ + if (from >= 0 && from < 16) + { + LineFlagTranslations[from].newvalue = mask; + LineFlagTranslations[from].ismask = true; + } +} \ No newline at end of file diff --git a/wadsrc/static/xlat/defines.i b/wadsrc/static/xlat/defines.i index 6673b5ef5..648679894 100644 --- a/wadsrc/static/xlat/defines.i +++ b/wadsrc/static/xlat/defines.i @@ -209,3 +209,34 @@ define FRICTION_MASK (0x0800) define PUSH_MASK (0x1000) +enum +{ + ML_BLOCKING = 0x00000001, + ML_BLOCKMONSTERS = 0x00000002, + ML_TWOSIDED = 0x00000004, + ML_DONTPEGTOP = 0x00000008, + ML_DONTPEGBOTTOM = 0x00000010, + ML_SECRET = 0x00000020, + ML_SOUNDBLOCK = 0x00000040, + ML_DONTDRAW = 0x00000080, + ML_MAPPED = 0x00000100, + + // Extended flags + ML_MONSTERSCANACTIVATE = 0x00002000, + ML_BLOCK_PLAYERS = 0x00004000, + ML_BLOCKEVERYTHING = 0x00008000, + ML_ZONEBOUNDARY = 0x00010000, + ML_RAILING = 0x00020000, + ML_BLOCK_FLOATERS = 0x00040000, + ML_CLIP_MIDTEX = 0x00080000, + ML_WRAP_MIDTEX = 0x00100000, + ML_3DMIDTEX = 0x00200000, + ML_CHECKSWITCHRANGE = 0x00400000, + ML_FIRSTSIDEONLY = 0x00800000, + ML_BLOCKPROJECTILE = 0x01000000, + ML_BLOCKUSE = 0x02000000, + + // + ML_PASSTHROUGH = -1, + ML_TRANSLUCENT = -2 +} \ No newline at end of file diff --git a/wadsrc/static/xlat/doom.txt b/wadsrc/static/xlat/doom.txt index 25b84b2f0..079f5462e 100644 --- a/wadsrc/static/xlat/doom.txt +++ b/wadsrc/static/xlat/doom.txt @@ -28,3 +28,15 @@ sector 22 = LightSequenceStart; sector 23 = LightSequenceSpecial1; sector 24 = LightSequenceSpecial2; +lineflag 0 = ML_BLOCKING; +lineflag 1 = ML_BLOCKMONSTERS; +lineflag 2 = ML_TWOSIDED; +lineflag 3 = ML_DONTPEGTOP; +lineflag 4 = ML_DONTPEGBOTTOM; +lineflag 5 = ML_SECRET; +lineflag 6 = ML_SOUNDBLOCK; +lineflag 7 = ML_DONTDRAW; +lineflag 8 = ML_MAPPED; +lineflag 9 = ML_PASSTHROUGH; +lineflag 10 = ML_3DMIDTEX; +lineflag 11 & (ML_BLOCKING|ML_BLOCKMONSTERS|ML_TWOSIDED|ML_DONTPEGTOP|ML_DONTPEGBOTTOM|ML_SECRET|ML_SOUNDBLOCK|ML_DONTDRAW|ML_MAPPED); diff --git a/wadsrc/static/xlat/heretic.txt b/wadsrc/static/xlat/heretic.txt index b1a4908b0..da4d103a5 100644 --- a/wadsrc/static/xlat/heretic.txt +++ b/wadsrc/static/xlat/heretic.txt @@ -65,3 +65,14 @@ sector 50 = Wind_West_Medium; sector 51 = Wind_West_Strong; +lineflag 0 = ML_BLOCKING; +lineflag 1 = ML_BLOCKMONSTERS; +lineflag 2 = ML_TWOSIDED; +lineflag 3 = ML_DONTPEGTOP; +lineflag 4 = ML_DONTPEGBOTTOM; +lineflag 5 = ML_SECRET; +lineflag 6 = ML_SOUNDBLOCK; +lineflag 7 = ML_DONTDRAW; +lineflag 8 = ML_MAPPED; +lineflag 9 = ML_PASSTHROUGH; +lineflag 10 = ML_3DMIDTEX; diff --git a/wadsrc/static/xlat/strife.txt b/wadsrc/static/xlat/strife.txt index 72ae2686b..0c141c855 100644 --- a/wadsrc/static/xlat/strife.txt +++ b/wadsrc/static/xlat/strife.txt @@ -352,3 +352,16 @@ sector 23 = LightSequenceSpecial1; sector 24 = LightSequenceSpecial2; +lineflag 0 = ML_BLOCKING; +lineflag 1 = ML_BLOCKMONSTERS; +lineflag 2 = ML_TWOSIDED; +lineflag 3 = ML_DONTPEGTOP; +lineflag 4 = ML_DONTPEGBOTTOM; +lineflag 5 = ML_SECRET; +lineflag 6 = ML_SOUNDBLOCK; +lineflag 7 = ML_DONTDRAW; +lineflag 8 = ML_MAPPED; +lineflag 9 = ML_RAILING; +lineflag 10 = ML_BLOCK_FLOATERS; +lineflag 12 = ML_TRANSLUCENT; +