- extended Doom map format linedef translator so that it also handles the flags.

SVN r1992 (trunk)
This commit is contained in:
Christoph Oelckers 2009-11-21 23:11:12 +00:00
parent 82db01f5ef
commit 9357ed82ed
9 changed files with 120 additions and 24 deletions

View file

@ -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

View file

@ -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++)
{
if ((flags & (1<<i)) && LineFlagTranslations[i].ismask)
{
flags1 &= LineFlagTranslations[i].newvalue;
}
}
for(int i=0;i<16;i++)
{
if ((flags1 & (1<<i)) && !LineFlagTranslations[i].ismask)
{
switch (LineFlagTranslations[i].newvalue)
{
case -1:
passthrough = true;
break;
case -2:
ld->Alpha = FRACUNIT*3/4;
}
if (gameinfo.gametype == GAME_Strife)
{
if (flags & ML_RAILING_STRIFE)
{
flags |= ML_RAILING;
}
if (flags & ML_BLOCK_FLOATERS_STRIFE)
{
flags |= ML_BLOCK_FLOATERS;
}
passthrough = 0;
}
else
{
if (gameinfo.gametype & GAME_DoomChex)
{
if (flags & ML_RESERVED_ETERNITY)
{
flags &= 0x1FF;
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.

View file

@ -61,6 +61,7 @@ FBoomTranslator Boomish[MAX_BOOMISH];
int NumBoomish;
TAutoGrowArray<FSectorTrans> SectorTranslations;
TArray<FSectorMask> 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
};

View file

@ -80,10 +80,18 @@ struct FSectorMask
int shift;
};
struct FLineFlagTrans
{
int newvalue;
bool ismask;
};
extern TAutoGrowArray<FLineTrans> SimpleLineTranslations;
extern FBoomTranslator Boomish[MAX_BOOMISH];
extern int NumBoomish;
extern TAutoGrowArray<FSectorTrans> SectorTranslations;
extern TArray<FSectorMask> SectorMasks;
extern FLineFlagTrans LineFlagTranslations[16];
#endif

View file

@ -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;
}
}

View file

@ -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
}

View file

@ -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);

View file

@ -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;

View file

@ -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;