From d9f761b619209e142c85d2508843e9f4eedd94b6 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 27 Apr 2020 11:52:31 +0200 Subject: [PATCH] Adapt setup of rising FOFs --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 52 ++++++++++++++++ src/p_setup.c | 47 ++++++++++++++ src/p_spec.c | 64 +++++++++++++------- src/p_spec.h | 6 ++ 4 files changed, 148 insertions(+), 21 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 96e711641..1043c3bf2 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -1661,6 +1661,58 @@ udmf } } } + + 190 + { + title = "Rising"; + prefix = "(190)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Visibility"; + type = 12; + enum + { + 1 = "Don't render planes"; + 2 = "Don't render sides"; + 4 = "Render insides"; + } + } + arg2 + { + title = "Tangibility"; + type = 12; + enum = "tangibility"; + } + arg3 + { + title = "Appearance"; + type = 12; + enum + { + 1 = "Translucent"; + 2 = "No shadow"; + } + } + arg4 + { + title = "Speed"; + } + arg5 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Lower"; + 2 = "Require spindash"; + } + } + } 200 { diff --git a/src/p_setup.c b/src/p_setup.c index 30e572982..06297fd52 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2998,6 +2998,53 @@ static void P_ConvertBinaryMap(void) lines[i].args[2] |= TMFC_FLOATBOB; lines[i].special = 170; break; + case 190: // FOF: Rising, solid, opaque, shadowcasting + case 191: // FOF: Rising, solid, opaque, non-shadowcasting + case 192: // FOF: Rising, solid, translucent + case 193: // FOF: Rising, solid, invisible + case 194: // FOF: Rising, intangible from bottom, opaque + case 195: // FOF: Rising, intangible from bottom, translucent + lines[i].args[0] = lines[i].tag; + + //Visibility + if (lines[i].special == 193) + lines[i].args[1] = TMFV_NOPLANES|TMFV_NOSIDES; + if (lines[i].special >= 194) + lines[i].args[1] = TMFV_TOGGLEINSIDES; + + //Tangibility + if (lines[i].flags & ML_EFFECT1) + lines[i].args[2] |= TMFT_DONTBLOCKOTHERS; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[2] |= TMFT_DONTBLOCKPLAYER; + if (lines[i].special >= 194) + lines[i].args[2] |= TMFT_INTANGIBLEBOTTOM; + + //Translucency + if (lines[i].special == 192 || lines[i].special == 195) + { + lines[i].args[3] |= TMFA_TRANSLUCENT; + 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; + } + + //Shadow? + if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB)) + lines[i].args[3] |= TMFA_NOSHADE; + + //Speed + lines[i].args[4] = FixedDiv(P_AproxDistance(lines[i].dx, lines[i].dy), 4*FRACUNIT) >> FRACBITS; + + //Flags + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[5] |= TMFR_REVERSE; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[5] |= TMFR_SPINDASH; + + lines[i].special = 190; + break; case 200: //FOF: Light block case 201: //FOF: Half light block lines[i].args[0] = lines[i].tag; diff --git a/src/p_spec.c b/src/p_spec.c index 5f07b9529..240015ad7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6825,34 +6825,56 @@ void P_SpawnSpecials(boolean fromnetsave) P_AddAirbob(lines[i].frontsector, lines + i, 16*FRACUNIT, false, false, false); break; - case 190: // Rising Platform FOF (solid, opaque, shadows) - case 191: // Rising Platform FOF (solid, opaque, no shadows) - case 192: // Rising Platform TL block: FOF (solid, translucent) - case 193: // Rising Platform FOF (solid, invisible) - case 194: // Rising Platform 'Platform' - You can jump up through it - case 195: // Rising Platform Translucent "platform" + case 190: // FOF (Rising) { - fixed_t speed = FixedDiv(P_AproxDistance(lines[i].dx, lines[i].dy), 4*FRACUNIT); fixed_t ceilingtop = P_FindHighestCeilingSurrounding(lines[i].frontsector); fixed_t ceilingbottom = P_FindLowestCeilingSurrounding(lines[i].frontsector); - ffloorflags = FF_EXISTS|FF_SOLID; - if (lines[i].special != 193) - ffloorflags |= FF_RENDERALL; - if (lines[i].special <= 191) - ffloorflags |= FF_CUTLEVEL; - if (lines[i].special == 192 || lines[i].special == 195) - ffloorflags |= FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].special >= 194) - ffloorflags |= FF_PLATFORM|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB)) - ffloorflags |= FF_NOSHADE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL; - P_AddRaiseThinker(lines[i].frontsector, &lines[i], speed, ceilingtop, ceilingbottom, !!(lines[i].flags & ML_BLOCKMONSTERS), !!(lines[i].flags & ML_NOCLIMB)); + //Visibility settings + if (lines[i].args[1] & TMFV_NOPLANES) + ffloorflags &= ~FF_RENDERPLANES; + if (lines[i].args[1] & TMFV_NOSIDES) + ffloorflags &= ~FF_RENDERSIDES; + if (lines[i].args[1] & TMFV_TOGGLEINSIDES) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_BOTHPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_ALLSIDES; + } + + //Tangibility settings + if (lines[i].args[2] & TMFT_INTANGIBLETOP) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[2] & TMFT_INTANGIBLEBOTTOM) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[2] & TMFT_DONTBLOCKPLAYER) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[2] & TMFT_DONTBLOCKOTHERS) + ffloorflags &= ~FF_BLOCKOTHERS; + + //Appearance settings + if ((lines[i].args[3] & TMFA_TRANSLUCENT) && (ffloorflags & FF_RENDERALL)) //Translucent + ffloorflags |= FF_TRANSLUCENT; + if (lines[i].args[3] & TMFA_NOSHADE) + ffloorflags |= FF_NOSHADE; + + //Cutting options + if (ffloorflags & FF_RENDERALL) + { + //If translucent or player can enter it, cut inner walls + if ((ffloorflags & FF_TRANSLUCENT) || (lines[i].args[2] & TMFT_VISIBLEFROMINSIDE)) + ffloorflags |= FF_CUTEXTRA|FF_EXTRA; + else + ffloorflags |= FF_CUTLEVEL; + } + + P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddRaiseThinker(lines[i].frontsector, &lines[i], lines[i].args[4] << FRACBITS, ceilingtop, ceilingbottom, !!(lines[i].args[5] & TMFR_REVERSE), !!(lines[i].args[5] & TMFR_SPINDASH)); break; } - case 200: // Light block ffloorflags = FF_EXISTS|FF_CUTSPRITES; if (!lines[i].args[1]) diff --git a/src/p_spec.h b/src/p_spec.h index cd3e8f737..83f7d9978 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -70,6 +70,12 @@ typedef enum TMFC_FLOATBOB = 1<<4, } textmapfofcrumbling_t; +typedef enum +{ + TMFR_REVERSE = 1, + TMFR_SPINDASH = 1<<1, +} textmapfofrising_t; + typedef enum { TMFM_BRICK = 1,