From df3c077bf14c65e08c0ff8822f901a474468c640 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 10 Oct 2022 01:51:42 -0400 Subject: [PATCH] Block Monsters is a flag again --- extras/conf/udb/Includes/Kart2_misc.cfg | 11 ++-- src/deh_tables.c | 2 +- src/doomdata.h | 71 ++++++++++++++----------- src/p_map.c | 31 ++++++++--- src/p_saveg.c | 4 +- src/p_setup.c | 36 +++++++------ src/r_defs.h | 2 +- src/slope_anchors.c | 4 +- 8 files changed, 96 insertions(+), 65 deletions(-) diff --git a/extras/conf/udb/Includes/Kart2_misc.cfg b/extras/conf/udb/Includes/Kart2_misc.cfg index 8de7cc3ba..9291ba62f 100644 --- a/extras/conf/udb/Includes/Kart2_misc.cfg +++ b/extras/conf/udb/Includes/Kart2_misc.cfg @@ -25,7 +25,7 @@ linedefflags linedefflagstranslation { 1 = "blocking"; - 2 = "blockmonsters"; + 2 = "blockplayers"; 4 = "twosided"; 8 = "dontpegtop"; 16 = "dontpegbottom"; @@ -37,8 +37,8 @@ linedefflagstranslation 1024 = "wrapmidtex"; 2048 = "netonly"; 4096 = "nonet"; - 8192 = "effect6"; - 16384 = "bouncy"; + 8192 = "blockmonsters"; + 16384 = "notbouncy"; 32768 = "transfer"; } @@ -46,7 +46,7 @@ linedefflagstranslation linedefflags_udmf { blocking = "Impassable"; - blockmonsters = "Block Enemies"; + blockplayers = "Block Players"; twosided = "Double-Sided"; dontpegtop = "Upper Unpegged"; dontpegbottom = "Lower Unpegged"; @@ -58,7 +58,8 @@ linedefflags_udmf wrapmidtex = "Repeat Midtexture"; netonly = "Netgame Only"; nonet = "No Netgame"; - bouncy = "Bouncy Wall"; + blockmonsters = "Block Enemies"; + bouncy = "Not Bouncy"; transfer = "Transfer Line"; } diff --git a/src/deh_tables.c b/src/deh_tables.c index 6a799d277..ec35ff611 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5812,7 +5812,7 @@ const char *const ML_LIST[] = { "WRAPMIDTEX", "NETONLY", "NONET", - "EFFECT6", + "BLOCKMONSTERS", "NOTBOUNCY", "TFERLINE", NULL diff --git a/src/doomdata.h b/src/doomdata.h index 3bd5b522d..6d3a6386c 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -99,48 +99,57 @@ typedef struct // LineDef attributes. // -// Solid, is an obstacle. -#define ML_IMPASSABLE 1 +enum +{ + // Solid, is an obstacle. + ML_IMPASSABLE = 0x00000001, -// SRB2Kart: Blocks players only; items can be thrown through these. -#define ML_BLOCKPLAYERS 2 + // SRB2Kart: Blocks players only; items can be thrown through these. + ML_BLOCKPLAYERS = 0x00000002, -// Backside will not be present at all if not two sided. -#define ML_TWOSIDED 4 + // Backside will not be present at all if not two sided. + ML_TWOSIDED = 0x00000004, -// If a texture is pegged, the texture will have -// the end exposed to air held constant at the -// top or bottom of the texture (stairs or pulled -// down things) and will move with a height change -// of one of the neighbor sectors. -// Unpegged textures allways have the first row of -// the texture at the top pixel of the line for both -// top and bottom textures (use next to windows). + // If a texture is pegged, the texture will have + // the end exposed to air held constant at the + // top or bottom of the texture (stairs or pulled + // down things) and will move with a height change + // of one of the neighbor sectors. + // Unpegged textures allways have the first row of + // the texture at the top pixel of the line for both + // top and bottom textures (use next to windows). -// upper texture unpegged -#define ML_DONTPEGTOP 8 + // upper texture unpegged + ML_DONTPEGTOP = 0x00000008, -// lower texture unpegged -#define ML_DONTPEGBOTTOM 16 + // lower texture unpegged + ML_DONTPEGBOTTOM = 0x00000010, -#define ML_SKEWTD 32 + ML_SKEWTD = 0x00000020, -// Don't let Knuckles climb on this line -#define ML_NOCLIMB 64 + // Don't let Knuckles climb on this line + ML_NOCLIMB = 0x00000040, -#define ML_NOSKEW 128 -#define ML_MIDPEG 256 -#define ML_MIDSOLID 512 -#define ML_WRAPMIDTEX 1024 + ML_NOSKEW = 0x00000080, + ML_MIDPEG = 0x00000100, + ML_MIDSOLID = 0x00000200, + ML_WRAPMIDTEX = 0x00000400, -#define ML_NETONLY 2048 // Apply effect only in netgames -#define ML_NONET 4096 // Apply effect only in single player games -#define ML_EFFECT6 8192 + // Apply effect only in netgames + ML_NETONLY = 0x00000800, -// Don't bounce off this wall! -#define ML_NOTBOUNCY 16384 + // Apply effect only in single player games + ML_NONET = 0x00001000, -#define ML_TFERLINE 32768 + // Blocks enemies only + ML_BLOCKMONSTERS = 0x00002000, + + // Don't bounce off this wall! + ML_NOTBOUNCY = 0x00004000, + + // Transfers FOF properties. + ML_TFERLINE = 0x00008000, +}; // Sector definition, from editing. typedef struct diff --git a/src/p_map.c b/src/p_map.c index 96e8747b0..ef3d30ef1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1620,17 +1620,34 @@ boolean P_IsLineBlocking(const line_t *ld, const mobj_t *thing) { // missiles can cross uncrossable lines if ((thing->flags & MF_MISSILE)) + { return false; + } else { - return - ( - (ld->flags & ML_IMPASSABLE) || // block objects from moving through this linedef. - (thing->player && !thing->player->spectator && - ld->flags & ML_BLOCKPLAYERS) || // SRB2Kart: Only block players, not items - ((thing->flags & (MF_ENEMY|MF_BOSS)) && ld->special == 81) // case 81: block monsters only - ); + if (thing->player && thing->player->spectator) + { + // Allow spectators thru blocking lines. + return false; + } + + if (ld->flags & ML_IMPASSABLE) + { + // block objects from moving through this linedef. + return true; + } + + if (thing->player) + { + return (ld->flags & ML_BLOCKPLAYERS); + } + else if (thing->flags & (MF_ENEMY|MF_BOSS)) + { + return (ld->flags & ML_BLOCKMONSTERS); + } } + + return false; } boolean P_IsLineTripWire(const line_t *ld) diff --git a/src/p_saveg.c b/src/p_saveg.c index 91960e4d2..105ab1a74 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1480,7 +1480,7 @@ static void ArchiveLines(void) if (diff & LD_DIFF2) WRITEUINT8(save_p, diff2); if (diff & LD_FLAG) - WRITEINT16(save_p, li->flags); + WRITEUINT32(save_p, li->flags); if (diff & LD_SPECIAL) WRITEINT16(save_p, li->special); if (diff & LD_CLLCOUNT) @@ -1562,7 +1562,7 @@ static void UnArchiveLines(void) diff2 = 0; if (diff & LD_FLAG) - li->flags = READINT16(save_p); + li->flags = READUINT32(save_p); if (diff & LD_SPECIAL) li->special = READINT16(save_p); if (diff & LD_CLLCOUNT) diff --git a/src/p_setup.c b/src/p_setup.c index 294a79220..ea2a574e9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1631,8 +1631,8 @@ static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char lines[i].flags |= ML_MIDSOLID; else if (fastcmp(param, "wrapmidtex") && fastcmp("true", val)) lines[i].flags |= ML_WRAPMIDTEX; - /*else if (fastcmp(param, "effect6") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT6;*/ + else if (fastcmp(param, "blockmonsters") && fastcmp("true", val)) + lines[i].flags |= ML_BLOCKMONSTERS; else if (fastcmp(param, "nonet") && fastcmp("true", val)) lines[i].flags |= ML_NONET; else if (fastcmp(param, "netonly") && fastcmp("true", val)) @@ -3714,7 +3714,7 @@ static void P_LinkMapData(void) static void P_AddBinaryMapTagsFromLine(sector_t *sector, line_t *line) { Tag_Add(§or->tags, Tag_FGet(&line->tags)); - if (line->flags & ML_EFFECT6) { + if (line->flags & ML_BLOCKMONSTERS) { if (sides[line->sidenum[0]].textureoffset) Tag_Add(§or->tags, (INT32)sides[line->sidenum[0]].textureoffset / FRACUNIT); if (sides[line->sidenum[0]].rowoffset) @@ -3756,7 +3756,7 @@ static void P_AddBinaryMapTags(void) tag = Tag_FGet(&lines[i].frontsector->tags); target_tag = Tag_FGet(&lines[i].tags); memset(offset_tags, 0, sizeof(mtag_t)*4); - if (lines[i].flags & ML_EFFECT6) { + if (lines[i].flags & ML_BLOCKMONSTERS) { offset_tags[0] = (INT32)sides[lines[i].sidenum[0]].textureoffset / FRACUNIT; offset_tags[1] = (INT32)sides[lines[i].sidenum[0]].rowoffset / FRACUNIT; } @@ -3975,7 +3975,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[1] = TMP_BOTH; lines[i].flags &= ~(ML_NETONLY|ML_NONET); - if (lines[i].flags & ML_EFFECT6) // Set offset through x and y texture offsets + if (lines[i].flags & ML_BLOCKMONSTERS) // Set offset through x and y texture offsets { angle_t flatangle = InvAngle(R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y)); fixed_t xoffs = sides[lines[i].sidenum[0]].textureoffset; @@ -4093,7 +4093,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] &= ~TMPF_INVISIBLEPLANES; /*if (lines[paramline].flags & ML_WRAPMIDTEX) lines[i].args[3] |= TMPF_DONTCLIPPLANES;*/ - if (lines[paramline].flags & ML_EFFECT6) + if (lines[paramline].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= TMPF_SPLAT; if (lines[paramline].flags & ML_NOCLIMB) lines[i].args[3] |= TMPF_EXECUTOR; @@ -4198,6 +4198,10 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[0] = tag; lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; break; + case 81: //Block enemies + lines[i].flags |= ML_BLOCKMONSTERS; + lines[i].special = 0; + break; case 100: //FOF: solid, opaque, shadowcasting case 101: //FOF: solid, opaque, non-shadowcasting case 102: //FOF: solid, translucent @@ -4229,7 +4233,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] |= TMFA_NOPLANES; if (lines[i].special != 100 && (lines[i].special != 104 || !(lines[i].flags & ML_NOCLIMB))) lines[i].args[3] |= TMFA_NOSHADE; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= TMFA_SPLAT; //Tangibility @@ -4277,7 +4281,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] |= TMFW_GOOWATER; //Splat rendering? - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= TMFW_SPLAT; lines[i].special = 120; @@ -4312,7 +4316,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] |= TMFA_NOPLANES; if (lines[i].special != 146 && (lines[i].flags & ML_NOCLIMB)) lines[i].args[3] |= TMFA_NOSHADE; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= TMFA_SPLAT; //Tangibility @@ -4388,7 +4392,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[4] |= TMFC_AIRBOB; if (lines[i].special >= 176 && lines[i].special <= 179) lines[i].args[4] |= TMFC_FLOATBOB; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[4] |= TMFC_SPLAT; if (lines[i].flags & ML_SKEWTD) @@ -4425,7 +4429,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] |= TMFA_INSIDES; if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB)) lines[i].args[3] |= TMFA_NOSHADE; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= TMFA_SPLAT; //Tangibility @@ -4482,7 +4486,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[3] |= TMFA_INSIDES; if (lines[i].special != 220 && !(lines[i].flags & ML_NOCLIMB)) lines[i].args[3] |= TMFA_NOSHADE; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= TMFA_SPLAT; lines[i].special = 220; @@ -4548,7 +4552,7 @@ static void P_ConvertBinaryLinedefTypes(void) } if (lines[i].special == 252 && lines[i].flags & ML_NOCLIMB) lines[i].args[4] |= TMFB_ONLYBOTTOM; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[4] |= TMFB_SPLAT; lines[i].special = 254; @@ -4570,7 +4574,7 @@ static void P_ConvertBinaryLinedefTypes(void) if (lines[i].flags & ML_SKEWTD) lines[i].args[3] |= TMFL_NOBOSSES; //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels - if (lines[i].flags & ML_EFFECT6 || lines[i].args[1] == 256) + if (lines[i].flags & ML_BLOCKMONSTERS || lines[i].args[1] == 256) lines[i].args[3] |= TMFL_SPLAT; break; @@ -4580,7 +4584,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[0] = tag; lines[i].args[3] = P_GetFOFFlags(sides[lines[i].sidenum[1]].toptexture); - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) lines[i].args[3] |= FOF_SPLAT; lines[i].args[4] = P_GetFOFBusttype(sides[lines[i].sidenum[1]].toptexture); if (sides[lines[i].sidenum[1]].toptexture & FF_OLD_SHATTERBOTTOM) @@ -5656,7 +5660,7 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[1] = tag; - if (lines[i].flags & ML_EFFECT6) + if (lines[i].flags & ML_BLOCKMONSTERS) { UINT8 side = lines[i].special >= 714; diff --git a/src/r_defs.h b/src/r_defs.h index 58ba6ee9d..3f801c197 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -525,7 +525,7 @@ typedef struct line_s angle_t angle; // Precalculated angle between dx and dy // Animation related. - INT16 flags; + UINT32 flags; INT16 special; taglist_t tags; INT32 args[NUMLINEARGS]; diff --git a/src/slope_anchors.c b/src/slope_anchors.c index 071dfe7c2..2c8f4959d 100644 --- a/src/slope_anchors.c +++ b/src/slope_anchors.c @@ -411,7 +411,7 @@ slope_sector (*slope) = new_vertex_slope(anchors, flags); /* Effect 6 - invert slope to opposite side */ - if (flags & ML_EFFECT6) + if (flags & ML_BLOCKMONSTERS) { (*alt) = new_vertex_slope(flip_slope(anchors, sector), flags); } @@ -446,7 +446,7 @@ make_anchored_slope if (plane == (FLOOR|CEILING)) { - flags &= ~ML_EFFECT6; + flags &= ~ML_BLOCKMONSTERS; } if (plane & FLOOR)