From 70b72a2157019b8686be171a43e3644f769d0110 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Wed, 29 Sep 2021 17:42:48 +0800 Subject: [PATCH] - Recognize the new lightmap UDMF keywords - Add dummy actors to hold the UDMF keys for lightmapping. These actors will despawn at map start - Make light probe despawn at map start as well --- src/common/engine/namedef.h | 13 ++++++++ src/maploader/udmf.cpp | 25 ++++++++++++++- wadsrc/static/mapinfo/common.txt | 2 ++ wadsrc/static/zscript.txt | 2 +- .../zscript/actors/shared/lightprobe.zs | 9 ------ .../zscript/actors/shared/staticlights.zs | 31 +++++++++++++++++++ 6 files changed, 71 insertions(+), 11 deletions(-) delete mode 100644 wadsrc/static/zscript/actors/shared/lightprobe.zs create mode 100644 wadsrc/static/zscript/actors/shared/staticlights.zs diff --git a/src/common/engine/namedef.h b/src/common/engine/namedef.h index b836dd6fb..47dea4f10 100644 --- a/src/common/engine/namedef.h +++ b/src/common/engine/namedef.h @@ -690,6 +690,19 @@ xx(HealthCeilingGroup) xx(Health3DGroup) xx(HealthGroup) +// Lightmap keywords +//xx(lightcolor) // already defined +xx(lightintensity) +xx(lightdistance) +xx(lightinnerangle) +xx(lightouterangle) +xx(lightcolorfloor) +xx(lightintensityfloor) +xx(lightdistancefloor) +xx(lightcolorceiling) +xx(lightintensityceiling) +xx(lightdistanceceiling) + // USDF keywords xx(Amount) xx(Text) diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index 256a119e6..8cdfe3d3d 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -752,6 +752,14 @@ public: th->friendlyseeblocks = CheckInt(key); break; + case NAME_Lightcolor: + case NAME_lightintensity: + case NAME_lightdistance: + case NAME_lightinnerangle: + case NAME_lightouterangle: + CHECK_N(Zd | Zdt) + break; + default: CHECK_N(Zd | Zdt) if (0 == strnicmp("user_", key.GetChars(), 5)) @@ -1122,6 +1130,12 @@ public: ld->healthgroup = CheckInt(key); break; + case NAME_Lightcolor: + case NAME_lightintensity: + case NAME_lightdistance: + CHECK_N(Zd | Zdt) + break; + default: if (strnicmp("user_", key.GetChars(), 5)) DPrintf(DMSG_WARNING, "Unknown UDMF linedef key %s\n", key.GetChars()); @@ -1947,7 +1961,16 @@ public: case NAME_Health3DGroup: sec->health3dgroup = CheckInt(key); break; - + + case NAME_lightcolorfloor: + case NAME_lightintensityfloor: + case NAME_lightdistancefloor: + case NAME_lightcolorceiling: + case NAME_lightintensityceiling: + case NAME_lightdistanceceiling: + CHECK_N(Zd | Zdt) + break; + default: if (strnicmp("user_", key.GetChars(), 5)) DPrintf(DMSG_WARNING, "Unknown UDMF sector key %s\n", key.GetChars()); diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index 6a4b230d4..864fe5132 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -137,6 +137,8 @@ DoomEdNums 9873 = SectorSpotLightAttenuated 9874 = SpotLightFlickerRandomAttenuated 9875 = LightProbe + 9876 = PointLightStatic + 9881 = SpotLightStatic 9982 = SecActEyesAboveC 9983 = SecActEyesBelowC 9988 = CustomSprite diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index bd709f1bf..71916bf89 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -90,7 +90,7 @@ version "4.6" #include "zscript/actors/shared/fastprojectile.zs" #include "zscript/actors/shared/randomspawner.zs" #include "zscript/actors/shared/dynlights.zs" -#include "zscript/actors/shared/lightprobe.zs" +#include "zscript/actors/shared/staticlights.zs" #include "zscript/actors/doom/doomplayer.zs" #include "zscript/actors/doom/possessed.zs" diff --git a/wadsrc/static/zscript/actors/shared/lightprobe.zs b/wadsrc/static/zscript/actors/shared/lightprobe.zs deleted file mode 100644 index b51253f73..000000000 --- a/wadsrc/static/zscript/actors/shared/lightprobe.zs +++ /dev/null @@ -1,9 +0,0 @@ -class LightProbe : Actor native -{ - States - { - Spawn: - LPRO A 0; - Stop; - } -} diff --git a/wadsrc/static/zscript/actors/shared/staticlights.zs b/wadsrc/static/zscript/actors/shared/staticlights.zs new file mode 100644 index 000000000..ede5e2c1d --- /dev/null +++ b/wadsrc/static/zscript/actors/shared/staticlights.zs @@ -0,0 +1,31 @@ +// Light probes provide ZDRay points of light to sample lighting data from. +// Will despawn from the world as they serve no purpose at runtime. +// Currently used to light Actor sprites. + +class LightProbe : Actor native +{ + States + { + Spawn: + LPRO A 0; + Stop; + } +} + +// Dummy Actors used to hold UDMF keys that ZDRay will parse lighting data from. +// These will simply despawn from the world at map start, as they serve no purpose at runtime. +// Currently only covers the basic point and spot lights. +// Lightmaps currently do not animate, so the various animated lights (pulsating, flickering etc) are skipped for now. + +class StaticLightBase : Actor +{ + States + { + Spawn: + TNT1 A 0; + Stop; + } +} + +class PointLightStatic : StaticLightBase {} +class SpotLightStatic : StaticLightBase {}