From e3b86d0c7492665986dc6198d5f2ec36f000d3bc Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 14 Apr 2020 11:45:37 +0200 Subject: [PATCH] Implement FOF types 252-256 --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 45 ++++++++++++++++++ src/p_mobj.c | 4 +- src/p_setup.c | 39 ++++++++++++++++ src/p_spec.c | 49 +++++++++++--------- src/p_user.c | 4 +- 5 files changed, 114 insertions(+), 27 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 1ee245d08..c592b09d9 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -1699,6 +1699,51 @@ udmf } } + 252 + { + title = "Bustable Block"; + prefix = "(252)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Bustable type"; + type = 11; + enum + { + 0 = "Touch"; + 1 = "Spin"; + 2 = "Regular"; + 3 = "Strong"; + } + } + arg2 + { + title = "Translucent?" + type = 11; + enum = "noyes"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bustable by pushables"; + 2 = "Trigger linedef executor"; + 4 = "Only bustable from below"; + } + } + arg4 + { + title = "Linedef executor tag"; + type = 15; + } + } + 258 { title = "Laser"; diff --git a/src/p_mobj.c b/src/p_mobj.c index b27d27a76..617c3bdd1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1688,8 +1688,8 @@ static void P_PushableCheckBustables(mobj_t *mo) if (!(rover->flags & FF_BUSTUP)) continue; - // Needs ML_EFFECT4 flag for pushables to break it - if (!(rover->master->flags & ML_EFFECT4)) continue; + // Bustable by pushables? + if (!(rover->master->args[3] & 1)) continue; if (!rover->master->frontsector->crumblestate) { diff --git a/src/p_setup.c b/src/p_setup.c index dfaa23c75..57e12d34c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2983,6 +2983,45 @@ static void P_ConvertBinaryMap(void) M_Memcpy(lines[i].stringargs[0], buffer, strlen(buffer) + 1); } break; + case 252: //FOF: Shatter block + case 253: //FOF: Shatter block, translucent + case 254: //FOF: Bustable block + case 255: //FOF: Spin-bustable block + case 256: //FOF: Spin-bustable block, translucent + lines[i].args[0] = lines[i].tag; + + //Bustable type + if (lines[i].special <= 253) + lines[i].args[1] = 0; + else if (lines[i].special >= 255) + lines[i].args[1] = 1; + else if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] = 3; + else + lines[i].args[1] = 2; + + //Translucency + if (lines[i].special == 253 || lines[i].special == 256) + { + lines[i].args[2] = 1; + if (sides[lines[i].sidenum[0]].toptexture > 0) + lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS)/255; + else + lines[i].alpha = FRACUNIT/2; + } + + if (lines[i].flags & ML_EFFECT4) + lines[i].args[3] |= 1; //Bustable by pushables + if (lines[i].flags & ML_EFFECT5) + { + lines[i].args[3] |= 2; //Trigger linedef executor + lines[i].args[4] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + } + if (lines[i].special == 252 && lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= 4; //Bust only from below + + lines[i].special = 254; + break; case 258: //FOF: Laser lines[i].args[0] = lines[i].tag; if (lines[i].flags & ML_EFFECT1) diff --git a/src/p_spec.c b/src/p_spec.c index 2bcd2a9e5..e41e30d05 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7008,34 +7008,37 @@ void P_SpawnSpecials(boolean fromnetsave) } break; - case 252: // Shatter block (breaks when touched) - ffloorflags = FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP|FF_SHATTER; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_BLOCKPLAYER|FF_SHATTERBOTTOM; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 253: // Translucent shatter block (see 76) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP|FF_SHATTER|FF_TRANSLUCENT, secthinkers); - break; - case 254: // Bustable block - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_BUSTUP; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_STRONGBUST; + ffloorflags = FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP; + + //Bustable type + switch (lines[i].args[1]) + { + case 0: + ffloorflags |= FF_SHATTER; + break; + case 1: + ffloorflags |= FF_SPINBUST; + break; + case 3: + ffloorflags |= FF_STRONGBUST; + break; + default: + break; + } + + if (lines[i].args[2]) + ffloorflags |= FF_TRANSLUCENT; + + if (lines[i].args[2] & 4) + ffloorflags |= FF_SHATTERBOTTOM; + + if (!(ffloorflags & FF_SHATTER) || ffloorflags & FF_SHATTERBOTTOM) + ffloorflags |= FF_BLOCKPLAYER; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; - case 255: // Spin bust block (breaks when jumped or spun downwards onto) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_BUSTUP|FF_SPINBUST, secthinkers); - break; - - case 256: // Translucent spin bust block (see 78) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_BUSTUP|FF_SPINBUST|FF_TRANSLUCENT, secthinkers); - break; - case 257: // Quicksand ffloorflags = FF_EXISTS|FF_QUICKSAND|FF_RENDERALL|FF_ALLSIDES|FF_CUTSPRITES; if (lines[i].flags & ML_EFFECT5) diff --git a/src/p_user.c b/src/p_user.c index c12bc0c59..aa732bc63 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2659,8 +2659,8 @@ static void P_CheckBustableBlocks(player_t *player) EV_CrumbleChain(NULL, rover); // node->m_sector // Run a linedef executor?? - if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); + if (rover->master->args[3] & 2) + P_LinedefExecute((INT16)(rover->master->args[4]), player->mo, node->m_sector); goto bustupdone; }