From 1864bc94baed205e8ec15d0cde84303ddf77b9f3 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Mon, 16 Dec 2019 18:21:11 +0100 Subject: [PATCH] Implemented the remaining FOF types, "for the most part", as per MascaraSnake's original words. --- src/p_floor.c | 12 +- src/p_mobj.c | 4 +- src/p_setup.c | 13 ++ src/p_spec.c | 597 +++++++++++++++++++++++++++++++------------------- src/p_user.c | 6 +- 5 files changed, 390 insertions(+), 242 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index c23d469bc..870fa500c 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1887,10 +1887,7 @@ void T_ThwompSector(levelspecthink_t *thwomp) sides[thwomp->sourceline->sidenum[0]].midtexture = sides[thwomp->sourceline->sidenum[0]].bottomtexture; /// \note this should only have to be done once, but is already done repeatedly, above - if (thwomp->sourceline->flags & ML_EFFECT5) - thwomp->speed = thwomp->sourceline->dx/8; - else - thwomp->speed = 2*FRACUNIT; + thwomp->speed = thwomp->sourceline->args[2]/8; res = T_MovePlane ( @@ -1926,10 +1923,7 @@ void T_ThwompSector(levelspecthink_t *thwomp) // Set the texture from the upper one (angry) sides[thwomp->sourceline->sidenum[0]].midtexture = sides[thwomp->sourceline->sidenum[0]].toptexture; - if (thwomp->sourceline->flags & ML_EFFECT5) - thwomp->speed = thwomp->sourceline->dy/8; - else - thwomp->speed = 10*FRACUNIT; + thwomp->speed = thwomp->sourceline->args[1]/8; res = T_MovePlane ( @@ -2432,7 +2426,7 @@ void T_RaiseSector(levelspecthink_t *raise) if (raise->sector->crumblestate >= 3 || raise->sector->ceilingdata) return; - for (i = -1; (i = P_FindSectorFromTag(raise->sourceline->tag, i)) >= 0 ;) + for (i = -1; (i = P_FindSectorFromTag(raise->sourceline->args[0], i)) >= 0 ;) { sector = §ors[i]; diff --git a/src/p_mobj.c b/src/p_mobj.c index af349a8e0..30f300b4f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1739,8 +1739,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; + // Needs flag for pushables to break it + if (!(rover->master->args[4] & 1)) continue; if (!rover->master->frontsector->crumblestate) { diff --git a/src/p_setup.c b/src/p_setup.c index 43d3cfb47..d8ad0f470 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2049,6 +2049,19 @@ static void P_LoadRawSideDefs2(void *data) break; } + case 259: // Custom FOF + { + if ((msd->toptexture[0] >= '0' && msd->toptexture[0] <= '9') + || (msd->toptexture[0] >= 'A' && msd->toptexture[0] <= 'F')) + { + sd->toptexture = axtoi(msd->toptexture); + sd->midtexture = R_TextureNumForName(msd->midtexture); + sd->bottomtexture = R_TextureNumForName(msd->bottomtexture); + break; + } + //else: fallthru (needed for front side alpha value) + } + default: // normal cases if (msd->toptexture[0] == '#') { diff --git a/src/p_spec.c b/src/p_spec.c index 01f6acf1c..0834400de 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5778,7 +5778,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f { fixed_t tempceiling = sec2->ceilingheight; //flip the sector around and print an error instead of crashing 12.1.08 -Inuyasha - CONS_Alert(CONS_ERROR, M_GetText("A FOF tagged %d has a top height below its bottom.\n"), master->tag); + CONS_Alert(CONS_ERROR, M_GetText("A FOF tagged %d has a top height below its bottom.\n"), master->args[0]); sec2->ceilingheight = sec2->floorheight; sec2->floorheight = tempceiling; } @@ -5838,12 +5838,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f sec->hasslope = true; #endif - if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only - flags &= ~FF_BLOCKOTHERS; - - if ((flags & FF_SOLID) && (master->flags & ML_EFFECT2)) // Block all BUT player - flags &= ~FF_BLOCKPLAYER; - fflr->spawnflags = fflr->flags = flags; fflr->master = master; fflr->norender = INFTICS; @@ -5901,12 +5895,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f if (flags & FF_TRANSLUCENT) - { - if (sides[master->sidenum[0]].toptexture > 0) - fflr->alpha = sides[master->sidenum[0]].toptexture; // for future reference, "#0" is 1, and "#255" is 256. Be warned - else - fflr->alpha = 0x80; - } + fflr->alpha = sides[master->sidenum[0]].toptexture > 0 ? (master->alpha * 0xff) >> FRACBITS : 0x80; else fflr->alpha = 0xff; @@ -6083,12 +6072,14 @@ static void P_AddBlockThinker(sector_t *sec, line_t *sourceline) * there already. * * \param sec Control sector. - * \param actionsector Target sector. * \param sourceline Control linedef. + * \param spindash Require spindash to move? + * \param speed Movement speed. + * \param reverse Sink instead of rise? * \sa P_SpawnSpecials, T_RaiseSector * \author SSNTails */ -static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline) +static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline, boolean spindash, fixed_t speed, boolean reverse) { levelspecthink_t *raise; @@ -6097,7 +6088,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline) raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector; - if (sourceline->flags & ML_BLOCKMONSTERS) + if (reverse) raise->vars[0] = 1; else raise->vars[0] = 0; @@ -6106,12 +6097,12 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline) raise->sector = sec; // Require a spindash to activate - if (sourceline->flags & ML_NOCLIMB) + if (spindash) raise->vars[1] = 1; else raise->vars[1] = 0; - raise->vars[2] = P_AproxDistance(sourceline->dx, sourceline->dy); + raise->vars[2] = speed; raise->vars[2] = FixedDiv(raise->vars[2], 4*FRACUNIT); raise->vars[3] = raise->vars[2]; @@ -6126,7 +6117,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline) raise->sourceline = sourceline; } -static void P_AddAirbob(sector_t *sec, line_t *sourceline, boolean noadjust, boolean dynamic) +static void P_AddAirbob(sector_t *sec, line_t *sourceline, boolean spindash, fixed_t distance, boolean reverse, boolean dynamic) { levelspecthink_t *airbob; @@ -6139,26 +6130,24 @@ static void P_AddAirbob(sector_t *sec, line_t *sourceline, boolean noadjust, boo airbob->sector = sec; // Require a spindash to activate - if (sourceline->flags & ML_NOCLIMB) + if (spindash) airbob->vars[1] = 1; else airbob->vars[1] = 0; airbob->vars[2] = FRACUNIT; - if (noadjust) - airbob->vars[7] = airbob->sector->ceilingheight-16*FRACUNIT; - else - airbob->vars[7] = airbob->sector->ceilingheight - P_AproxDistance(sourceline->dx, sourceline->dy); + airbob->vars[7] = airbob->sector->ceilingheight - distance; + airbob->vars[6] = airbob->vars[7] - (sec->ceilingheight - sec->floorheight); airbob->vars[3] = airbob->vars[2]; - if (sourceline->flags & ML_BLOCKMONSTERS) - airbob->vars[0] = 1; - else + if (reverse) airbob->vars[0] = 0; + else + airbob->vars[0] = 1; airbob->vars[5] = sec->ceilingheight; airbob->vars[4] = airbob->vars[5] @@ -6330,7 +6319,7 @@ void T_LaserFlash(laserthink_t *flash) { thing = node->m_thing; - if ((fflr->master->flags & ML_EFFECT1) + if ((fflr->master->args[1]) && thing->flags & MF_BOSS) continue; // Don't hurt bosses @@ -6407,13 +6396,13 @@ void P_ConvertBinaryLinedefs(void) { case 10: //Culling plane lines[i].args[0] = lines[i].tag; - lines[i].args[1] = (lines[i].flags & ML_NOCLIMB); + lines[i].args[1] = (lines[i].flags & ML_NOCLIMB) == ML_NOCLIMB; break; case 11: //Rope hang parameters lines[i].args[0] = lines[i].tag; lines[i].args[1] = abs(sides[lines[i].sidenum[0]].textureoffset) >> FRACBITS; lines[i].args[2] = abs(sides[lines[i].sidenum[0]].rowoffset) >> FRACBITS; - lines[i].args[3] = lines[i].flags & ML_EFFECT1; + lines[i].args[3] = (lines[i].flags & ML_EFFECT1) == ML_EFFECT1; if (lines[i].flags & ML_NOCLIMB) //Static lines[i].args[1] = 0; break; @@ -6529,6 +6518,226 @@ void P_ConvertBinaryLinedefs(void) lines[i].special = 100; break; + case 150: //FOF: air bobbing + case 151: //FOF: air bobbing (adjustable) + case 152: //FOF: reverse air bobbing (adjustable) + lines[i].args[0] = lines[i].tag; + lines[i].args[1] = (lines[i].special == 150) ? 16 : P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + if (lines[i].special == 152) + lines[i].args[1] = -lines[i].args[1]; + lines[i].args[2] = (lines[i].flags & ML_NOCLIMB) == ML_NOCLIMB; + if (lines[i].flags & ML_EFFECT1) + lines[i].args[3] |= 8; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[3] |= 4; + lines[i].special = 150; + break; + case 160: //FOF: floating, bobbing + lines[i].args[0] = lines[i].tag; + if (lines[i].flags & ML_EFFECT1) + lines[i].args[1] |= 8; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[1] |= 4; + break; + case 170: //FOF: crumbling, respawn + case 171: //FOF: crumbling, no respawn + case 172: //FOF: crumbling, respawn, intangible from bottom + case 173: //FOF: crumbling, no respawn, intangible from bottom + case 174: //FOF: crumbling, respawn, intangible from bottom, translucent + case 175: //FOF: crumbling, no respawn, intangible from bottom, translucent + case 176: //FOF: crumbling, respawn, floating, bobbing + case 177: //FOF: crumbling, no respawn, floating, bobbing + case 178: //FOF: crumbling, respawn, floating + case 179: //FOF: crumbling, no respawn, floating + case 180: //FOF: crumbling, respawn, air bobbing + lines[i].args[0] = lines[i].tag; + + //Intangible from below? + if (lines[i].special >= 172 && lines[i].special <= 175) + { + lines[i].args[1] = 2; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] |= 32; + } + else + lines[i].args[1] = 0; + + //Block players/others? + if (lines[i].flags & ML_EFFECT1) + lines[i].args[1] |= 8; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[1] |= 4; + + //No respawn? + if (lines[i].special % 2 == 1) + lines[i].args[2] |= 1; + + //Translucent? + if (lines[i].special == 174 || lines[i].special == 175) + { + lines[i].args[2] |= 2; + lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS) / 255; + } + + //Bobbing? + if (lines[i].special == 176 || lines[i].special == 177 || lines[i].special == 180) + { + lines[i].args[2] |= 4; + lines[i].args[3] = 16; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] |= 8; + } + + //Float on water? + if (lines[i].special >= 176 && lines[i].special <= 179) + lines[i].args[2] |= 16; + + lines[i].special = 170; + break; + case 190: //FOF: rising platform, solid, opaque, shadowcasting + case 191: //FOF: rising platform, solid, opaque, non-shadowcasting + case 192: //FOF: rising platform, solid, translucent + case 193: //FOF: rising platform, solid, invisible + case 194: //FOF: rising platform, intangible from bottom, opaque + case 195: //FOF: rising platform, intangible from bottom, translucent + lines[i].args[0] = lines[i].tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[2] = (lines[i].flags & ML_NOCLIMB) == ML_NOCLIMB; + + //Tangibility + if (lines[i].special == 194 || lines[i].special == 195) + lines[i].args[3] |= 2; + if (lines[i].flags & ML_EFFECT1) + lines[i].args[3] |= 8; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[3] |= 4; + + //Visibility + if (lines[i].special == 193) + lines[i].args[4] = 2; + else if (lines[i].special == 192 || lines[i].special == 195) + { + lines[i].args[4] = 1; + lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS) / 255; + } + else + lines[i].args[4] = 0; + + //Shadow? + if (lines[i].special == 190) + lines[i].args[5] = 0; + else if (lines[i].special == 194 || lines[i].special == 195) + lines[i].args[5] = (lines[i].flags & ML_NOCLIMB) == ML_NOCLIMB; + else + lines[i].args[5] = 1; + + lines[i].special = 190; + break; + case 200: //FOF: Light block + case 201: //FOF: Half light block + lines[i].args[0] = lines[i].tag; + lines[i].args[1] = (lines[i].special == 201) ? 1 : 0; + lines[i].special = 200; + break; + case 202: //FOF: Fog block + case 223: //FOF: intangible, invisible + lines[i].args[0] = lines[i].tag; + break; + case 220: //FOF: intangible, opaque + case 221: //FOF: intangible, translucent + case 222: //FOF: intangible, sides only + lines[i].args[0] = lines[i].tag; + if (lines[i].special == 221) + { + lines[i].args[1] |= 1; + lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS) / 255; + } + if (lines[i].special != 220 && !(lines[i].flags & ML_NOCLIMB)) + lines[i].args[1] |= 2; + if (lines[i].special == 222) + lines[i].args[2] |= 4; + lines[i].special = 220; + break; + case 250: //FOF: Mario block + lines[i].args[0] = lines[i].tag; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] |= 1; + if (lines[i].flags & ML_EFFECT1) + lines[i].args[1] |= 2; + break; + case 251: //FOF: Thwomp block + //TODO: Crushing sound + lines[i].args[0] = lines[i].tag; + lines[i].args[1] = (lines[i].flags == ML_EFFECT5) ? (lines[i].dy >> FRACBITS) : 80; + lines[i].args[2] = (lines[i].flags == ML_EFFECT5) ? (lines[i].dx >> FRACBITS) : 16; + 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; + + //Busted by? + if (lines[i].special == 252 || lines[i].special == 253) + lines[i].args[1] = 0; + else if (lines[i].special == 254) + lines[i].args[1] = (lines[i].flags == ML_NOCLIMB) ? 3 : 2; + else + lines[i].args[1] = 1; + + //Translucent? + if (lines[i].special == 253 || lines[i].special == 256) + { + lines[i].args[2] = 1; + lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS) / 255; + } + else + lines[i].args[2] = 0; + + //Tangibility + if (lines[i].flags & ML_EFFECT1) + lines[i].args[3] |= 8; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[3] |= 4; + + //Flags + if (lines[i].flags & ML_EFFECT4) + lines[i].args[4] |= 1; + if (lines[i].flags & ML_EFFECT5) + lines[i].args[4] |= 2; + if (lines[i].special == 252 && lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= 4; + + //Linedef executor tag + lines[i].args[5] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + + lines[i].special = 254; + break; + case 257: //FOF: Quicksand + lines[i].args[0] = lines[i].tag; + lines[i].args[1] = (lines[i].flags & ML_EFFECT5) != ML_EFFECT5; + lines[i].args[2] = lines[i].dx >> FRACBITS; + lines[i].args[3] = lines[i].dy >> FRACBITS; + break; + case 258: //FOF: Laser + lines[i].args[0] = lines[i].tag; + lines[i].args[1] = (lines[i].flags & ML_EFFECT1) == ML_EFFECT1; + break; + case 259: //FOF: Custom + lines[i].args[0] = lines[i].tag; + if (lines[i].sidenum[1] == 0xffff) + I_Error("Make-Your-Own FOF (tag %d) found without a 2nd linedef side!", lines[i].tag); + lines[i].args[1] = sides[lines[i].sidenum[1]].toptexture; + lines[i].args[2] = lines[i].dx >> FRACBITS; + lines[i].args[3] = lines[i].dy >> FRACBITS; + if (lines[i].flags & ML_EFFECT4) + lines[i].args[4] |= 1; + if (lines[i].flags & ML_EFFECT5) + lines[i].args[4] |= 2; + lines[i].args[5] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS) / 255; + break; case 700: //Slope front sector floor case 701: //Slope front sector ceiling case 702: //Slope front sector floor and ceiling @@ -7034,7 +7243,7 @@ void P_SpawnSpecials(INT32 fromnetsave) { if (lines[i].args[2] == 0) { - if (lines[i].args[3] & 3) + if (lines[i].args[3] & 7) { //At least partially intangible: You can see it from the inside ffloorflags |= FF_ALLSIDES; @@ -7048,7 +7257,7 @@ void P_SpawnSpecials(INT32 fromnetsave) if (lines[i].args[2] == 1) ffloorflags |= FF_TRANSLUCENT | FF_EXTRA | FF_CUTEXTRA; if (lines[i].args[2] == 2) - ffloorflags |= FF_TRANSLUCENT | FF_CUTLEVEL | FF_BOTHPLANES | FF_ALLSIDES; + ffloorflags |= FF_TRANSLUCENT | FF_CUTEXTRA | FF_BOTHPLANES | FF_ALLSIDES; } if (lines[i].args[3] & 1) @@ -7081,142 +7290,101 @@ void P_SpawnSpecials(INT32 fromnetsave) P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; - case 150: // Air bobbing platform - case 151: // Adjustable air bobbing platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; - P_AddAirbob(lines[i].frontsector, lines + i, (lines[i].special != 151), false); - break; - case 152: // Adjustable air bobbing platform in reverse - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, lines + i, true, false); - break; - case 153: // Dynamic Sinking Platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; - P_AddAirbob(lines[i].frontsector, lines + i, false, true); + case 150: // FOF (air bobbing) + ffloorflags = FF_EXISTS | FF_SOLID | FF_RENDERALL | FF_CUTLEVEL; + if (lines[i].args[1] & 1) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[1] & 2) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[1] & 4) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[1] & 7) + ffloorflags &= ~FF_CUTLEVEL; + if (lines[i].args[1] & 8) + ffloorflags &= ~FF_BLOCKOTHERS; + P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddAirbob(lines[i].frontsector, lines + i, lines[i].args[2], abs(lines[i].args[1]) << FRACBITS, lines[i].args[1] < 0, false); break; - case 160: // Float/bob platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB, secthinkers); - break; - - case 170: // Crumbling platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers); - break; - - case 171: // Crumbling platform that will not return - P_AddFakeFloorsByLine(i, - FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE|FF_NORETURN, secthinkers); - break; - - case 172: // "Platform" that crumbles and returns - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_CRUMBLE|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - + case 160: // FOF (floating, bobbing) + ffloorflags = FF_EXISTS | FF_SOLID | FF_RENDERALL | FF_CUTLEVEL | FF_FLOATBOB; + if (lines[i].args[1] & 1) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[1] & 2) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[1] & 4) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[1] & 7) + ffloorflags &= ~FF_CUTLEVEL; + if (lines[i].args[1] & 8) + ffloorflags &= ~FF_BLOCKOTHERS; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; - case 173: // "Platform" that crumbles and doesn't return - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_CRUMBLE|FF_NORETURN|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb + case 170: // FOF (crumbling) + ffloorflags = FF_EXISTS | FF_SOLID | FF_RENDERALL | FF_CRUMBLE; + if (lines[i].args[1] & 1) + ffloorflags |= FF_REVERSEPLATFORM | FF_BOTHPLANES | FF_ALLSIDES; + if (lines[i].args[1] & 2) + ffloorflags |= FF_PLATFORM | FF_BOTHPLANES | FF_ALLSIDES; + if (lines[i].args[1] & 4) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[1] & 8) + ffloorflags &= ~FF_BLOCKOTHERS; + if (lines[i].args[2] & 1) + ffloorflags |= FF_NORETURN; + if (lines[i].args[2] & 2) + ffloorflags |= FF_TRANSLUCENT | FF_CUTEXTRA; + else + { + //No FF_CUTLEVEL if FOF is partially intangible. + if (!(lines[i].args[1] & 7)) + ffloorflags |= FF_CUTLEVEL; + } + if (lines[i].args[1] & 16) + ffloorflags |= FF_FLOATBOB; + if (lines[i].args[1] & 32) ffloorflags |= FF_NOSHADE; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + if (lines[i].args[2] & 4) + P_AddAirbob(lines[i].frontsector, lines + i, lines[i].args[2] & 8, abs(lines[i].args[3]) << FRACBITS, lines[i].args[3] < 0, false); break; - case 174: // Translucent "platform" that crumbles and returns - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_PLATFORM|FF_CRUMBLE|FF_TRANSLUCENT|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb + case 190: // FOF (rising) + ffloorflags = FF_EXISTS | FF_SOLID | FF_RENDERALL; + if (lines[i].args[3] & 1) + ffloorflags |= FF_REVERSEPLATFORM | FF_BOTHPLANES | FF_ALLSIDES; + if (lines[i].args[3] & 2) + ffloorflags |= FF_PLATFORM | FF_BOTHPLANES | FF_ALLSIDES; + if (lines[i].args[3] & 4) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[3] & 8) + ffloorflags &= ~FF_BLOCKOTHERS; + if (lines[i].args[4] == 0) + { + //No FF_CUTLEVEL if FOF is partially intangible. + if (!(lines[i].args[1] & 7)) + ffloorflags |= FF_CUTLEVEL; + } + else if (lines[i].args[4] == 1) + ffloorflags |= FF_TRANSLUCENT | FF_EXTRA | FF_CUTEXTRA; + else + ffloorflags &= ~FF_RENDERALL; + if (lines[i].args[5]) ffloorflags |= FF_NOSHADE; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddRaiseThinker(lines[i].frontsector, &lines[i], lines[i].args[2], abs(lines[i].args[1]) << FRACBITS, lines[i].args[1] < 0); break; - case 175: // Translucent "platform" that crumbles and doesn't return - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_PLATFORM|FF_CRUMBLE|FF_NORETURN|FF_TRANSLUCENT|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - + case 200: // Light effect + ffloorflags = FF_EXISTS | FF_CUTSPRITES; + if (!(lines[i].args[1])) + ffloorflags |= FF_DOUBLESHADOW; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; - case 176: // Air bobbing platform that will crumble and bob on the water when it falls and hits - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB|FF_CRUMBLE, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; - P_AddAirbob(lines[i].frontsector, lines + i, true, false); - break; - - case 177: // Air bobbing platform that will crumble and bob on - // the water when it falls and hits, then never return - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB|FF_CRUMBLE|FF_NORETURN, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; - P_AddAirbob(lines[i].frontsector, lines + i, true, false); - break; - - case 178: // Crumbling platform that will float when it hits water - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CRUMBLE|FF_FLOATBOB, secthinkers); - break; - - case 179: // Crumbling platform that will float when it hits water, but not return - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE|FF_FLOATBOB|FF_NORETURN, secthinkers); - break; - - case 180: // Air bobbing platform that will crumble - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; - P_AddAirbob(lines[i].frontsector, lines + i, true, false); - break; - - case 190: // Rising Platform FOF (solid, opaque, shadows) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, &lines[i]); - break; - - case 191: // Rising Platform FOF (solid, opaque, no shadows) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_NOSHADE|FF_CUTLEVEL, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, &lines[i]); - break; - - case 192: // Rising Platform TL block: FOF (solid, translucent) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_NOSHADE|FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, &lines[i]); - break; - - case 193: // Rising Platform FOF (solid, invisible) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_NOSHADE, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, &lines[i]); - break; - - case 194: // Rising Platform 'Platform' - You can jump up through it - // If line has no-climb set, don't give it shadows, otherwise do - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, &lines[i]); - break; - - case 195: // Rising Platform Translucent "platform" - // If line has no-climb set, don't give it shadows, otherwise do - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_TRANSLUCENT|FF_BOTHPLANES|FF_ALLSIDES|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - P_AddRaiseThinker(lines[i].frontsector, &lines[i]); - break; - - case 200: // Double light effect - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES|FF_DOUBLESHADOW, secthinkers); - break; - - case 201: // Light effect - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES, secthinkers); - break; - case 202: // Fog ffloorflags = FF_EXISTS|FF_RENDERALL|FF_FOG|FF_BOTHPLANES|FF_INVERTPLANES|FF_ALLSIDES|FF_INVERTSIDES|FF_CUTEXTRA|FF_EXTRA|FF_DOUBLESHADOW|FF_CUTSPRITES; sec = sides[*lines[i].sidenum].sector - sectors; @@ -7227,24 +7395,21 @@ void P_SpawnSpecials(INT32 fromnetsave) P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; - case 220: // Like opaque water, but not swimmable. (Good for snow effect on FOFs) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_RENDERALL|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES, secthinkers); - break; - - case 221: // FOF (intangible, translucent) - // If line has no-climb set, give it shadows, otherwise don't - ffloorflags = FF_EXISTS|FF_RENDERALL|FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA|FF_CUTSPRITES; - if (!(lines[i].flags & ML_NOCLIMB)) + case 220: // FOF (intangible) + ffloorflags = FF_EXISTS | FF_RENDERSIDES | FF_CUTSPRITES; + if (lines[i].args[1] & 1) + ffloorflags |= FF_TRANSLUCENT | FF_EXTRA | FF_CUTEXTRA; + else + ffloorflags |= FF_ALLSIDES; + if (lines[i].args[1] & 2) ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 222: // FOF with no floor/ceiling (good for GFZGRASS effect on FOFs) - // If line has no-climb set, give it shadows, otherwise don't - ffloorflags = FF_EXISTS|FF_RENDERSIDES|FF_ALLSIDES; - if (!(lines[i].flags & ML_NOCLIMB)) - ffloorflags |= FF_NOSHADE|FF_CUTSPRITES; + if (lines[i].args[1] & 4) + { + if (!(lines[i].args[1] & 2)) + ffloorflags &= ~FF_CUTSPRITES; + } + else + ffloorflags |= FF_RENDERPLANES | FF_BOTHPLANES | FF_CUTEXTRA | FF_EXTRA; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; @@ -7255,9 +7420,9 @@ void P_SpawnSpecials(INT32 fromnetsave) case 250: // Mario Block ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_MARIO; - if (lines[i].flags & ML_NOCLIMB) + if (lines[i].args[1] & 1) ffloorflags |= FF_SHATTERBOTTOM; - if (lines[i].flags & ML_EFFECT1) + if (lines[i].args[1] & 2) ffloorflags &= ~(FF_SOLID|FF_RENDERALL|FF_CUTLEVEL); P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); @@ -7265,7 +7430,7 @@ void P_SpawnSpecials(INT32 fromnetsave) case 251: // A THWOMP! sec = sides[*lines[i].sidenum].sector - sectors; - for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) + for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;) { P_AddThwompThinker(§ors[sec], §ors[s], &lines[i]); P_AddFakeFloor(§ors[s], §ors[sec], lines + i, @@ -7273,37 +7438,43 @@ void P_SpawnSpecials(INT32 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_RENDERALL|FF_BUSTUP; + switch (lines[i].args[1]) + { + case 0: + ffloorflags |= FF_SHATTER; + break; + case 1: + ffloorflags |= FF_SPINBUST; + break; + case 2: + ffloorflags |= FF_SOLID; + break; + case 3: + ffloorflags |= FF_SOLID | FF_STRONGBUST; + break; + default: + break; + } + if (lines[i].args[2]) + ffloorflags |= FF_TRANSLUCENT; + if (lines[i].args[3] & 1) + ffloorflags |= FF_REVERSEPLATFORM | FF_BOTHPLANES | FF_ALLSIDES; + if (lines[i].args[3] & 2) + ffloorflags |= FF_PLATFORM | FF_BOTHPLANES | FF_ALLSIDES; + if (lines[i].args[3] & 4) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[3] & 8) + ffloorflags &= ~FF_BLOCKOTHERS; + if (lines[i].args[4] & 4) + ffloorflags |= FF_SOLID | FF_SHATTERBOTTOM; 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) + if (lines[i].args[1]) ffloorflags |= FF_RIPPLE; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); @@ -7313,42 +7484,12 @@ void P_SpawnSpecials(INT32 fromnetsave) sec = sides[*lines[i].sidenum].sector - sectors; // No longer totally disrupts netgames - for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) + for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;) EV_AddLaserThinker(§ors[s], §ors[sec], lines + i, secthinkers); break; case 259: // Make-Your-Own FOF! - if (lines[i].sidenum[1] != 0xffff) - { - UINT8 *data; - UINT16 b; - - if (!virt) - virt = vres_GetMap(lastloadedmaplumpnum); - - data = (UINT8*) vres_Find(virt, "SIDEDEFS")->data; - - for (b = 0; b < (INT16)numsides; b++) - { - register mapsidedef_t *msd = (mapsidedef_t *)data + b; - - if (b == lines[i].sidenum[1]) - { - if ((msd->toptexture[0] >= '0' && msd->toptexture[0] <= '9') - || (msd->toptexture[0] >= 'A' && msd->toptexture[0] <= 'F')) - { - ffloortype_e FOF_Flags = axtoi(msd->toptexture); - - P_AddFakeFloorsByLine(i, FOF_Flags, secthinkers); - break; - } - else - I_Error("Make-Your-Own-FOF (tag %d) needs a value in the linedef's second side upper texture field.", lines[i].tag); - } - } - } - else - I_Error("Make-Your-Own FOF (tag %d) found without a 2nd linedef side!", lines[i].tag); + P_AddFakeFloorsByLine(i, lines[i].args[1], secthinkers); break; case 300: // Linedef executor (combines with sector special 974/975) and commands @@ -7620,7 +7761,7 @@ static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinker INT32 s; size_t sec = sides[*lines[line].sidenum].sector-sectors; - for (s = -1; (s = P_FindSectorFromLineTag(lines+line, s)) >= 0 ;) + for (s = -1; (s = P_FindSectorFromTag(lines[line].args[0], s)) >= 0 ;) P_AddFakeFloor(§ors[s], §ors[sec], lines+line, ffloorflags, secthinkers); } diff --git a/src/p_user.c b/src/p_user.c index d409f6bcd..98169bd6e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2627,7 +2627,7 @@ static void P_CheckBustableBlocks(player_t *player) EV_CrumbleChain(NULL, rover); // node->m_sector // Run a linedef executor?? - if (rover->master->flags & ML_EFFECT5) + if (rover->master->args[4] & 2) P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); goto bustupdone; @@ -2827,7 +2827,7 @@ static void P_CheckQuicksand(player_t *player) if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height) { - sinkspeed = abs(rover->master->v1->x - rover->master->v2->x)>>1; + sinkspeed = rover->master->args[2]>>1; sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT); @@ -2856,7 +2856,7 @@ static void P_CheckQuicksand(player_t *player) P_PlayerHitFloor(player, false); } - friction = abs(rover->master->v1->y - rover->master->v2->y)>>6; + friction = rover->master->args[3]>>6; player->mo->momx = FixedMul(player->mo->momx, friction); player->mo->momy = FixedMul(player->mo->momy, friction);