From ac8590132be12a864d8780619c672e36f4a20554 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Mon, 13 Jul 2020 11:09:19 +0200 Subject: [PATCH] Add a provisional GZDoom-esque 3D floor setup for the sake of immediate UDB usability. --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 45 ++++++++++++++ src/p_spec.c | 65 ++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index a899f9488..0b92442e6 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2195,6 +2195,51 @@ udmf } } } + 260 + { + title = "Generalized 3D Floor"; + id = "Sector_Set3dFloor"; + requiresactivation = false; + + arg0 + { + title = "Sector Tag"; + type = 13; + } + arg1 + { + title = "Type"; + type = 26; + default = 1; + enum + { + 1 = "Solid"; + 2 = "Water"; + 3 = "Intangible"; + } + flags + { + 4 = "Render Both Sides"; + 16 = "Invert Sides"; + } + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Disable shadowcast"; + 2 = "Double shadowcast"; + 4 = "Fog block"; + } + } + arg3 + { + title = "Opacity"; + default = 255; + } + } } linedefexecmisc diff --git a/src/p_spec.c b/src/p_spec.c index 5baf99700..c76136fb8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6963,6 +6963,71 @@ void P_SpawnSpecials(boolean fromnetsave) } break; + case 260: // GZDoom-like 3D Floor. + { + UINT8 dtype = lines[i].args[1] & 3; + UINT8 dflags1 = lines[i].args[1] - dtype; + UINT8 dflags2 = lines[i].args[2]; + UINT8 dopacity = lines[i].args[3]; + boolean isfog = false; + + if (dtype == 0) + dtype = 1; + + ffloorflags = FF_EXISTS; + + if (dflags2 & 1) ffloorflags |= FF_NOSHADE; // Disable light effects (Means no shadowcast) + if (dflags2 & 2) ffloorflags |= FF_DOUBLESHADOW; // Restrict light inside (Means doubleshadow) + if (dflags2 & 4) isfog = true; // Fog effect (Explicitly render like a fog block) + + if (dflags1 & 4) ffloorflags |= FF_BOTHPLANES|FF_ALLSIDES; // Render-inside + if (dflags1 & 16) ffloorflags |= FF_INVERTSIDES|FF_INVERTPLANES; // Invert visibility rules + + // Fog block + if (isfog) + ffloorflags |= FF_RENDERALL|FF_CUTEXTRA|FF_CUTSPRITES|FF_BOTHPLANES|FF_EXTRA|FF_FOG|FF_INVERTPLANES|FF_ALLSIDES|FF_INVERTSIDES; + else + { + ffloorflags |= FF_RENDERALL; + + // Solid + if (dtype == 1) + ffloorflags |= FF_SOLID|FF_CUTLEVEL; + // Water + else if (dtype == 2) + ffloorflags |= FF_SWIMMABLE|FF_CUTEXTRA|FF_CUTSPRITES|FF_EXTRA|FF_RIPPLE; + // Intangible + else if (dtype == 3) + ffloorflags |= FF_CUTEXTRA|FF_CUTSPRITES|FF_EXTRA; + } + + // Non-opaque + if (dopacity < 255) + { + // Invisible + if (dopacity == 0) + { + // True invisible + if (ffloorflags & FF_NOSHADE) + ffloorflags &= ~(FF_RENDERALL|FF_CUTEXTRA|FF_CUTSPRITES|FF_EXTRA|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTLEVEL); + // Shadow block + else + { + ffloorflags |= FF_CUTSPRITES; + ffloorflags &= ~(FF_RENDERALL|FF_CUTEXTRA|FF_EXTRA|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTLEVEL); + } + } + else + { + ffloorflags |= FF_TRANSLUCENT|FF_CUTEXTRA|FF_EXTRA; + ffloorflags &= ~FF_CUTLEVEL; + } + } + + P_AddFakeFloorsByLine(i, dopacity, ffloorflags, secthinkers); + } + break; + case 300: // Linedef executor (combines with sector special 974/975) and commands case 302: case 303: