From d6a104f8a5eec263652610754172d78ca0a48e5a Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 12 Jun 2020 09:57:56 +0200 Subject: [PATCH] Revamp alpha setup for custom FOFs --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 6 +++++- src/p_setup.c | 14 +++++++++----- src/p_spec.c | 10 +++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 95986acc7..b0e7543aa 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2163,6 +2163,11 @@ udmf type = 13; } arg1 + { + title = "Alpha"; + default = 255; + } + arg2 { title = "Flags"; type = 12; @@ -2180,7 +2185,6 @@ udmf 512 = "Split sprites"; 1024 = "Render inside planes"; 2048 = "Extra"; - 4096 = "Translucent"; 8192 = "Fog"; 16384 = "Only render inside planes"; 32768 = "Render inside walls"; diff --git a/src/p_setup.c b/src/p_setup.c index e0f64fcba..a75cf7cb3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3381,15 +3381,19 @@ static void P_ConvertBinaryMap(void) I_Error("Custom FOF (tag %d) found without a linedef back side!", lines[i].tag); lines[i].args[0] = lines[i].tag; - lines[i].args[1] = sides[lines[i].sidenum[1]].toptexture; - lines[i].args[2] = sides[lines[i].sidenum[1]].midtexture; - if (lines[i].args[1] & FF_TRANSLUCENT) + lines[i].args[2] = sides[lines[i].sidenum[1]].toptexture; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[2] |= FF_SPLAT; + lines[i].args[3] = sides[lines[i].sidenum[1]].midtexture; + if (lines[i].args[2] & FF_TRANSLUCENT) { if (sides[lines[i].sidenum[0]].toptexture > 0) - lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS)/255; + lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture; else - lines[i].alpha = FRACUNIT/2; + lines[i].args[1] = 128; } + else + lines[i].args[1] = 255; break; case 443: //Call Lua function if (lines[i].text) diff --git a/src/p_spec.c b/src/p_spec.c index 2e7290271..ce01cb669 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6934,17 +6934,17 @@ void P_SpawnSpecials(boolean fromnetsave) case 259: // Custom FOF for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;) { - ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, (lines[i].args[1] & FF_TRANSLUCENT) ? (lines[i].alpha * 0xff) >> FRACBITS : 0xff, lines[i].args[1], secthinkers); + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], secthinkers); if (!udmf) // Ugly backwards compatibility stuff { - if (lines[i].args[1] & FF_QUICKSAND) + if (lines[i].args[2] & FF_QUICKSAND) { fflr->sinkspeed = abs(lines[i].dx) >> 1; fflr->friction = abs(lines[i].dy) >> 6; } - if (lines[i].args[1] & FF_BUSTUP) + if (lines[i].args[2] & FF_BUSTUP) { - switch (lines[i].args[2] % TMFB_ONLYBOTTOM) + switch (lines[i].args[3] % TMFB_ONLYBOTTOM) { case TMFB_TOUCH: fflr->busttype = BT_TOUCH; @@ -6960,7 +6960,7 @@ void P_SpawnSpecials(boolean fromnetsave) break; } - if (lines[i].args[2] & TMFB_ONLYBOTTOM) + if (lines[i].args[3] & TMFB_ONLYBOTTOM) fflr->specialflags |= FS_ONLYBOTTOM; if (lines[i].flags & ML_EFFECT4) fflr->specialflags |= FS_PUSHABLES;