From 5f36b86013018c5a7b76b069952c0ef94d87d3f9 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 4 Jan 2018 17:58:11 +0100 Subject: [PATCH 1/9] - Add dynamic spot lights --- src/g_shared/a_dynlight.cpp | 7 ++- src/g_shared/a_dynlight.h | 9 ++-- src/g_shared/a_dynlightdata.cpp | 59 +++++++++++++++++++++- src/gl/dynlights/gl_dynlight1.cpp | 29 ++++++++++- src/scripting/thingdef_data.cpp | 1 + wadsrc/static/shaders/glsl/main.fp | 34 ++++++++++--- wadsrc/static/zscript/shared/dynlights.txt | 8 ++- 7 files changed, 134 insertions(+), 13 deletions(-) diff --git a/src/g_shared/a_dynlight.cpp b/src/g_shared/a_dynlight.cpp index 0cad5e9ba7..1858a9a929 100644 --- a/src/g_shared/a_dynlight.cpp +++ b/src/g_shared/a_dynlight.cpp @@ -114,6 +114,9 @@ DEFINE_CLASS_PROPERTY(type, S, DynamicLight) //========================================================================== IMPLEMENT_CLASS(ADynamicLight, false, false) +DEFINE_FIELD(ADynamicLight, SpotInnerAngle) +DEFINE_FIELD(ADynamicLight, SpotOuterAngle) + static FRandom randLight; //========================================================================== @@ -134,7 +137,9 @@ void ADynamicLight::Serialize(FSerializer &arc) arc("lightflags", lightflags, def->lightflags) ("lighttype", lighttype, def->lighttype) ("tickcount", m_tickCount, def->m_tickCount) - ("currentradius", m_currentRadius, def->m_currentRadius); + ("currentradius", m_currentRadius, def->m_currentRadius) + ("spotinnerangle", SpotInnerAngle, def->SpotInnerAngle) + ("spotouterangle", SpotOuterAngle, def->SpotOuterAngle); if (lighttype == PulseLight) arc("lastupdate", m_lastUpdate, def->m_lastUpdate) diff --git a/src/g_shared/a_dynlight.h b/src/g_shared/a_dynlight.h index 5446ba8cf9..b659507d12 100644 --- a/src/g_shared/a_dynlight.h +++ b/src/g_shared/a_dynlight.h @@ -28,7 +28,8 @@ enum LightFlag LF_DONTLIGHTSELF = 4, LF_ATTENUATE = 8, LF_NOSHADOWMAP = 16, - LF_DONTLIGHTACTORS = 32 + LF_DONTLIGHTACTORS = 32, + LF_SPOT = 64 }; typedef TFlags LightFlags; @@ -42,7 +43,7 @@ enum ELightType FlickerLight, RandomFlickerLight, SectorLight, - SpotLight, + DummyLight, ColorPulseLight, ColorFlickerLight, RandomColorFlickerLight @@ -100,6 +101,7 @@ public: bool IsActive() const { return !(flags2&MF2_DORMANT); } bool IsSubtractive() { return !!(lightflags & LF_SUBTRACTIVE); } bool IsAdditive() { return !!(lightflags & LF_ADDITIVE); } + bool IsSpot() { return !!(lightflags & LF_SPOT); } FState *targetState; FLightNode * touching_sides; FLightNode * touching_subsectors; @@ -127,6 +129,7 @@ public: bool shadowmapped; int bufferindex; LightFlags lightflags; - + DAngle SpotInnerAngle = 10.0; + DAngle SpotOuterAngle = 25.0; }; diff --git a/src/g_shared/a_dynlightdata.cpp b/src/g_shared/a_dynlightdata.cpp index fcdbcd3d10..817e7a80b2 100644 --- a/src/g_shared/a_dynlightdata.cpp +++ b/src/g_shared/a_dynlightdata.cpp @@ -128,6 +128,9 @@ public: void SetAttenuate(bool on) { m_attenuate = on; } void SetHalo(bool halo) { m_halo = halo; } void SetDontLightActors(bool on) { m_dontlightactors = on; } + void SetSpot(bool spot) { m_spot = spot; } + void SetSpotInnerAngle(double angle) { m_spotInnerAngle = angle; } + void SetSpotOuterAngle(double angle) { m_spotOuterAngle = angle; } void OrderIntensities() { @@ -151,6 +154,9 @@ protected: bool m_dontlightself = false; bool m_dontlightactors = false; bool m_swapped = false; + bool m_spot = false; + double m_spotInnerAngle = 10.0; + double m_spotOuterAngle = 25.0; }; TDeletingArray LightDefaults; @@ -183,6 +189,10 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const if (m_additive) light->lightflags |= LF_ADDITIVE; if (m_dontlightself) light->lightflags |= LF_DONTLIGHTSELF; if (m_dontlightactors) light->lightflags |= LF_DONTLIGHTACTORS; + if (m_spot) + light->lightflags |= LF_SPOT; + light->SpotInnerAngle = m_spotInnerAngle; + light->SpotOuterAngle = m_spotOuterAngle; light->m_tickCount = 0; if (m_type == PulseLight) { @@ -233,7 +243,8 @@ static const char *LightTags[]= "dontlightself", "attenuate", "dontlightactors", - NULL + "spot", + nullptr }; @@ -255,6 +266,7 @@ enum { LIGHTTAG_DONTLIGHTSELF, LIGHTTAG_ATTENUATE, LIGHTTAG_DONTLIGHTACTORS, + LIGHTTAG_SPOT }; @@ -395,6 +407,15 @@ static void ParsePointLight(FScanner &sc) case LIGHTTAG_DONTLIGHTACTORS: defaults->SetDontLightActors(ParseInt(sc) != 0); break; + case LIGHTTAG_SPOT: + { + float innerAngle = ParseFloat(sc); + float outerAngle = ParseFloat(sc); + defaults->SetSpot(true); + defaults->SetSpotInnerAngle(innerAngle); + defaults->SetSpotOuterAngle(outerAngle); + } + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -480,6 +501,15 @@ static void ParsePulseLight(FScanner &sc) case LIGHTTAG_DONTLIGHTACTORS: defaults->SetDontLightActors(ParseInt(sc) != 0); break; + case LIGHTTAG_SPOT: + { + float innerAngle = ParseFloat(sc); + float outerAngle = ParseFloat(sc); + defaults->SetSpot(true); + defaults->SetSpotInnerAngle(innerAngle); + defaults->SetSpotOuterAngle(outerAngle); + } + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -567,6 +597,15 @@ void ParseFlickerLight(FScanner &sc) case LIGHTTAG_DONTLIGHTACTORS: defaults->SetDontLightActors(ParseInt(sc) != 0); break; + case LIGHTTAG_SPOT: + { + float innerAngle = ParseFloat(sc); + float outerAngle = ParseFloat(sc); + defaults->SetSpot(true); + defaults->SetSpotInnerAngle(innerAngle); + defaults->SetSpotOuterAngle(outerAngle); + } + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -653,6 +692,15 @@ void ParseFlickerLight2(FScanner &sc) case LIGHTTAG_DONTLIGHTACTORS: defaults->SetDontLightActors(ParseInt(sc) != 0); break; + case LIGHTTAG_SPOT: + { + float innerAngle = ParseFloat(sc); + float outerAngle = ParseFloat(sc); + defaults->SetSpot(true); + defaults->SetSpotInnerAngle(innerAngle); + defaults->SetSpotOuterAngle(outerAngle); + } + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -736,6 +784,15 @@ static void ParseSectorLight(FScanner &sc) case LIGHTTAG_DONTLIGHTACTORS: defaults->SetDontLightActors(ParseInt(sc) != 0); break; + case LIGHTTAG_SPOT: + { + float innerAngle = ParseFloat(sc); + float outerAngle = ParseFloat(sc); + defaults->SetSpot(true); + defaults->SetSpotInnerAngle(innerAngle); + defaults->SetSpotOuterAngle(outerAngle); + } + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } diff --git a/src/gl/dynlights/gl_dynlight1.cpp b/src/gl/dynlights/gl_dynlight1.cpp index e42f89ac4b..a9efdd8807 100644 --- a/src/gl/dynlights/gl_dynlight1.cpp +++ b/src/gl/dynlights/gl_dynlight1.cpp @@ -128,7 +128,26 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata) if (attenuate) shadowIndex = -shadowIndex; - float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(8)]; + float lightType = 0.0f; + float spotInnerAngle = 0.0f; + float spotOuterAngle = 0.0f; + float spotDirX = 0.0f; + float spotDirY = 0.0f; + float spotDirZ = 0.0f; + if (light->IsSpot()) + { + lightType = 1.0f; + spotInnerAngle = light->SpotInnerAngle.Cos(); + spotOuterAngle = light->SpotOuterAngle.Cos(); + + DAngle negPitch = -light->Angles.Pitch; + float xyLen = negPitch.Cos(); + spotDirX = light->Angles.Yaw.Cos() * xyLen; + spotDirY = light->Angles.Yaw.Sin() * xyLen; + spotDirZ = negPitch.Sin(); + } + + float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(16)]; data[0] = pos.X; data[1] = pos.Z; data[2] = pos.Y; @@ -137,5 +156,13 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata) data[5] = g; data[6] = b; data[7] = shadowIndex; + data[8] = spotDirX; + data[9] = spotDirY; + data[10] = spotDirZ; + data[11] = lightType; + data[12] = spotInnerAngle; + data[13] = spotOuterAngle; + data[14] = 0.0f; // unused + data[15] = 0.0f; // unused } diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index c746c536d7..09e28ba556 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -494,6 +494,7 @@ static FFlagDef DynLightFlagDefs[] = DEFINE_FLAG(LF, ATTENUATE, ADynamicLight, lightflags), DEFINE_FLAG(LF, NOSHADOWMAP, ADynamicLight, lightflags), DEFINE_FLAG(LF, DONTLIGHTACTORS, ADynamicLight, lightflags), + DEFINE_FLAG(LF, SPOT, ADynamicLight, lightflags), }; static FFlagDef PowerSpeedFlagDefs[] = diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index 83cabbd0d3..25a2c14d2a 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -278,6 +278,13 @@ float pointLightAttenuation(vec4 lightpos, float lightcolorA) } } +float spotLightAttenuation(vec4 lightpos, vec3 spotdir, float lightCosInnerAngle, float lightCosOuterAngle) +{ + vec3 lightDirection = normalize(lightpos.xyz - pixelpos.xyz); + float cosDir = dot(lightDirection, spotdir); + return smoothstep(lightCosOuterAngle, lightCosInnerAngle, cosDir); +} + //=========================================================================== // // Calculate light @@ -348,23 +355,33 @@ vec4 getLightColor(float fogdist, float fogfactor) // // modulated lights // - for(int i=lightRange.x; i Date: Thu, 4 Jan 2018 19:09:12 +0100 Subject: [PATCH 2/9] - Fix wrong spot direction --- src/gl/dynlights/gl_dynlight1.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gl/dynlights/gl_dynlight1.cpp b/src/gl/dynlights/gl_dynlight1.cpp index a9efdd8807..c412907405 100644 --- a/src/gl/dynlights/gl_dynlight1.cpp +++ b/src/gl/dynlights/gl_dynlight1.cpp @@ -142,9 +142,9 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata) DAngle negPitch = -light->Angles.Pitch; float xyLen = negPitch.Cos(); - spotDirX = light->Angles.Yaw.Cos() * xyLen; - spotDirY = light->Angles.Yaw.Sin() * xyLen; - spotDirZ = negPitch.Sin(); + spotDirX = -light->Angles.Yaw.Cos() * xyLen; + spotDirY = -light->Angles.Yaw.Sin() * xyLen; + spotDirZ = -negPitch.Sin(); } float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(16)]; From bae36205404bdc5c348ef9f68a31c66faa45385a Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 4 Jan 2018 19:27:03 +0100 Subject: [PATCH 3/9] - Added spot light support to gl_SetDynSpriteLight --- src/gl/dynlights/gl_dynlight1.cpp | 8 ++++---- src/gl/scene/gl_spritelight.cpp | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/gl/dynlights/gl_dynlight1.cpp b/src/gl/dynlights/gl_dynlight1.cpp index c412907405..42f1c27cfb 100644 --- a/src/gl/dynlights/gl_dynlight1.cpp +++ b/src/gl/dynlights/gl_dynlight1.cpp @@ -141,10 +141,10 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata) spotOuterAngle = light->SpotOuterAngle.Cos(); DAngle negPitch = -light->Angles.Pitch; - float xyLen = negPitch.Cos(); - spotDirX = -light->Angles.Yaw.Cos() * xyLen; - spotDirY = -light->Angles.Yaw.Sin() * xyLen; - spotDirZ = -negPitch.Sin(); + double xzLen = negPitch.Cos(); + spotDirX = -light->Angles.Yaw.Cos() * xzLen; + spotDirY = -negPitch.Sin(); + spotDirZ = -light->Angles.Yaw.Sin() * xzLen; } float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(16)]; diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index 2d2e65b760..bde9f1450c 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -49,6 +49,13 @@ FDynLightData modellightdata; int modellightindex = -1; +template +T smoothstep(const T edge0, const T edge1, const T x) +{ + auto t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); + return t * t * (3.0 - 2.0 * t); +} + //========================================================================== // // Sets a single light value from all dynamic lights affecting the specified location @@ -70,6 +77,7 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t * if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->lightflags&LF_DONTLIGHTSELF) || light->target != self) && !(light->lightflags&LF_DONTLIGHTACTORS)) { float dist; + FVector3 L; // This is a performance critical section of code where we cannot afford to let the compiler decide whether to inline the function or not. // This will do the calculations explicitly rather than calling one of AActor's utility functions. @@ -80,14 +88,15 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t * if (fromgroup == togroup || fromgroup == 0 || togroup == 0) goto direct; DVector2 offset = Displacements.getOffset(fromgroup, togroup); - dist = FVector3(x - light->X() - offset.X, y - light->Y() - offset.Y, z - light->Z()).LengthSquared(); + L = FVector3(x - light->X() - offset.X, y - light->Y() - offset.Y, z - light->Z()); } else { direct: - dist = FVector3(x - light->X(), y - light->Y(), z - light->Z()).LengthSquared(); + L = FVector3(x - light->X(), y - light->Y(), z - light->Z()); } + dist = L.LengthSquared(); radius = light->GetRadius(); if (dist < radius * radius) @@ -96,6 +105,17 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t * frac = 1.0f - (dist / radius); + if (light->IsSpot()) + { + DAngle negPitch = -light->Angles.Pitch; + double xzLen = negPitch.Cos(); + double spotDirX = -light->Angles.Yaw.Cos() * xzLen; + double spotDirY = -negPitch.Sin(); + double spotDirZ = -light->Angles.Yaw.Sin() * xzLen; + double cosDir = L.X * spotDirX + L.Y * spotDirY + L.Z * spotDirZ; + frac *= (float)smoothstep(light->SpotOuterAngle.Cos(), light->SpotInnerAngle.Cos(), cosDir); + } + if (frac > 0 && GLRenderer->mShadowMap.ShadowTest(light, { x, y, z })) { lr = light->GetRed() / 255.0f; From 79440d70141eb504990acf5e8023108e070ed66e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 4 Jan 2018 19:42:52 +0100 Subject: [PATCH 4/9] - Fix sprite spot light calculation --- src/gl/scene/gl_spritelight.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index bde9f1450c..ac7e6971e5 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -107,11 +107,12 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t * if (light->IsSpot()) { + L *= -1.0f / dist; DAngle negPitch = -light->Angles.Pitch; - double xzLen = negPitch.Cos(); - double spotDirX = -light->Angles.Yaw.Cos() * xzLen; - double spotDirY = -negPitch.Sin(); - double spotDirZ = -light->Angles.Yaw.Sin() * xzLen; + double xyLen = negPitch.Cos(); + double spotDirX = -light->Angles.Yaw.Cos() * xyLen; + double spotDirY = -light->Angles.Yaw.Sin() * xyLen; + double spotDirZ = -negPitch.Sin(); double cosDir = L.X * spotDirX + L.Y * spotDirY + L.Z * spotDirZ; frac *= (float)smoothstep(light->SpotOuterAngle.Cos(), light->SpotInnerAngle.Cos(), cosDir); } From 7f7c720883e6841ced9c5e66cdae5e6b531872ad Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 4 Jan 2018 22:41:57 +0000 Subject: [PATCH 5/9] - added UDMF properties for spotlights (args have all been used up for dynlights) --- src/doomdata.h | 2 ++ src/p_mobj.cpp | 11 ++++++ wadsrc/static/mapinfo/common.txt | 5 +++ wadsrc/static/zscript/shared/dynlights.txt | 40 ++++++++++++++++++++++ 4 files changed, 58 insertions(+) diff --git a/src/doomdata.h b/src/doomdata.h index 5f681fa76e..d11a45ce7d 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -371,6 +371,8 @@ struct FMapThing int16_t roll; uint32_t RenderStyle; int FloatbobPhase; + double SpotInnerAngle; + double SpotOuterAngle; }; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d5c5e93ea6..78b41facc4 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -108,6 +108,7 @@ #include "a_morph.h" #include "events.h" #include "actorinlines.h" +#include "a_dynlight.h" // MACROS ------------------------------------------------------------------ @@ -6001,6 +6002,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) } } + + // spawn it double sz; @@ -6087,6 +6090,14 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) mobj->fillcolor = (mthing->fillcolor & 0xffffff) | (ColorMatcher.Pick((mthing->fillcolor & 0xff0000) >> 16, (mthing->fillcolor & 0xff00) >> 8, (mthing->fillcolor & 0xff)) << 24); + if (i->IsDescendantOf(RUNTIME_CLASS(ADynamicLight))) + { + if (mthing->SpotInnerAngle != 0) + ((ADynamicLight*)mobj)->SpotInnerAngle = mthing->SpotInnerAngle; + if (mthing->SpotOuterAngle != 0) + ((ADynamicLight*)mobj)->SpotOuterAngle = mthing->SpotOuterAngle; + } + mobj->CallBeginPlay (); if (!(mobj->ObjectFlags & OF_EuthanizeMe)) { diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index 5782f8808a..d183675c0c 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -109,6 +109,11 @@ DoomEdNums 9832 = PointLightFlickerAttenuated 9833 = SectorPointLightAttenuated 9834 = PointLightFlickerRandomAttenuated + 9840 = SpotLight + 9841 = SpotLightPulse + 9842 = SpotLightFlicker + 9843 = SectorSpotLight + 9844 = SpotLightFlickerRandom 9982 = SecActEyesAboveC 9983 = SecActEyesBelowC 9988 = CustomSprite diff --git a/wadsrc/static/zscript/shared/dynlights.txt b/wadsrc/static/zscript/shared/dynlights.txt index 8cdd3b2670..362389b8a7 100644 --- a/wadsrc/static/zscript/shared/dynlights.txt +++ b/wadsrc/static/zscript/shared/dynlights.txt @@ -205,6 +205,46 @@ class PointLightFlickerRandomAttenuated :PointLightFlickerRandom } } +class SpotLight : DynamicLight +{ + Default + { + DynamicLight.Type "Point"; + +DYNAMICLIGHT.SPOT + } +} + +class SpotLightPulse : SpotLight +{ + Default + { + DynamicLight.Type "Pulse"; + } +} + +class SpotLightFlicker : SpotLight +{ + Default + { + DynamicLight.Type "Flicker"; + } +} + +class SectorSpotLight : SpotLight +{ + Default + { + DynamicLight.Type "Sector"; + } +} + +class SpotLightFlickerRandom : SpotLight +{ + Default + { + DynamicLight.Type "RandomFlicker"; + } +} class VavoomLight : DynamicLight { From 254501d3e8ee3ec77ff24d68a1bc364f3da71aaa Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 4 Jan 2018 23:09:48 +0000 Subject: [PATCH 6/9] - fixing last commit, which didn't seem to work correctly --- src/namedef.h | 2 + src/p_udmf.cpp | 8 ++ wadsrc/static/mapinfo/common.txt | 21 ++++ wadsrc/static/zscript/shared/dynlights.txt | 126 +++++++++++++++++++++ 4 files changed, 157 insertions(+) diff --git a/src/namedef.h b/src/namedef.h index 054c53e492..f94d008588 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -502,6 +502,8 @@ xx(Roll) xx(Scale) xx(ScaleX) xx(ScaleY) +xx(SpotInnerAngle) +xx(SpotOuterAngle) xx(Floatbobphase) xx(Floatbobstrength) xx(Target) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 24257dbcd0..4df2d08eba 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -799,6 +799,14 @@ public: th->Scale.X = th->Scale.Y = CheckFloat(key); break; + case NAME_SpotInnerAngle: + th->SpotInnerAngle = CheckFloat(key); + break; + + case NAME_SpotOuterAngle: + th->SpotOuterAngle = CheckFloat(key); + break; + default: CHECK_N(Zd | Zdt) if (0 == strnicmp("user_", key.GetChars(), 5)) diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index d183675c0c..500e9b3c76 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -114,6 +114,27 @@ DoomEdNums 9842 = SpotLightFlicker 9843 = SectorSpotLight 9844 = SpotLightFlickerRandom +<<<<<<< Updated upstream +======= +<<<<<<< HEAD + 9850 = SpotLightAdditive + 9851 = SpotLightPulseAdditive + 9852 = SpotLightFlickerAdditive + 9853 = SectorSpotLightAdditive + 9854 = SpotLightFlickerRandomSubtractive + 9860 = SpotLightSubtractive + 9861 = SpotLightPulseSubtractive + 9862 = SpotLightFlickerSubtractive + 9863 = SectorSpotLightSubtractive + 9864 = SpotLightFlickerRandomSubtractive + 9870 = SpotLightAttenuated + 9871 = SpotLightPulseAttenuated + 9872 = SpotLightFlickerAttenuated + 9873 = SectorSpotLightAttenuated + 9874 = SpotLightFlickerRandomAttenuated +======= +>>>>>>> 7f7c720883e6841ced9c5e66cdae5e6b531872ad +>>>>>>> Stashed changes 9982 = SecActEyesAboveC 9983 = SecActEyesBelowC 9988 = CustomSprite diff --git a/wadsrc/static/zscript/shared/dynlights.txt b/wadsrc/static/zscript/shared/dynlights.txt index 362389b8a7..59584bb235 100644 --- a/wadsrc/static/zscript/shared/dynlights.txt +++ b/wadsrc/static/zscript/shared/dynlights.txt @@ -245,6 +245,132 @@ class SpotLightFlickerRandom : SpotLight DynamicLight.Type "RandomFlicker"; } } +<<<<<<< Updated upstream +======= +<<<<<<< HEAD + +class SpotLightAdditive : SpotLight +{ + Default + { + +DYNAMICLIGHT.ADDITIVE + } +} + +class SpotLightPulseAdditive : SpotLightPulse +{ + Default + { + +DYNAMICLIGHT.ADDITIVE + } +} + +class SpotLightFlickerAdditive : SpotLightFlicker +{ + Default + { + +DYNAMICLIGHT.ADDITIVE + } +} + +class SectorSpotLightAdditive : SectorSpotLight +{ + Default + { + +DYNAMICLIGHT.ADDITIVE + } +} + +class SpotLightFlickerRandomAdditive : SpotLightFlickerRandom +{ + Default + { + +DYNAMICLIGHT.ADDITIVE + } +} + +class SpotLightSubtractive : SpotLight +{ + Default + { + +DYNAMICLIGHT.SUBTRACTIVE + } +} + +class SpotLightPulseSubtractive : SpotLightPulse +{ + Default + { + +DYNAMICLIGHT.SUBTRACTIVE + } +} + +class SpotLightFlickerSubtractive : SpotLightFlicker +{ + Default + { + +DYNAMICLIGHT.SUBTRACTIVE + } +} + +class SectorSpotLightSubtractive : SectorSpotLight +{ + Default + { + +DYNAMICLIGHT.SUBTRACTIVE + } +} + +class SpotLightFlickerRandomSubtractive : SpotLightFlickerRandom +{ + Default + { + +DYNAMICLIGHT.SUBTRACTIVE + } +} + +class SpotLightAttenuated : SpotLight +{ + Default + { + +DYNAMICLIGHT.ATTENUATE + } +} + +class SpotLightPulseAttenuated : SpotLightPulse +{ + Default + { + +DYNAMICLIGHT.ATTENUATE + } +} + +class SpotLightFlickerAttenuated : SpotLightFlicker +{ + Default + { + +DYNAMICLIGHT.ATTENUATE + } +} + +class SectorSpotLightAttenuated : SectorSpotLight +{ + Default + { + +DYNAMICLIGHT.ATTENUATE + } +} + +class SpotLightFlickerRandomAttenuated : SpotLightFlickerRandom +{ + Default + { + +DYNAMICLIGHT.ATTENUATE + } +} +======= +>>>>>>> 7f7c720883e6841ced9c5e66cdae5e6b531872ad +>>>>>>> Stashed changes class VavoomLight : DynamicLight { From acf83c2a74445d697a46fa463f605f624fe7f3dc Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 4 Jan 2018 23:13:14 +0000 Subject: [PATCH 7/9] - fixing the last commit... --- wadsrc/static/mapinfo/common.txt | 6 ------ wadsrc/static/zscript/shared/dynlights.txt | 6 ------ 2 files changed, 12 deletions(-) diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index 500e9b3c76..1c1559b061 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -114,9 +114,6 @@ DoomEdNums 9842 = SpotLightFlicker 9843 = SectorSpotLight 9844 = SpotLightFlickerRandom -<<<<<<< Updated upstream -======= -<<<<<<< HEAD 9850 = SpotLightAdditive 9851 = SpotLightPulseAdditive 9852 = SpotLightFlickerAdditive @@ -132,9 +129,6 @@ DoomEdNums 9872 = SpotLightFlickerAttenuated 9873 = SectorSpotLightAttenuated 9874 = SpotLightFlickerRandomAttenuated -======= ->>>>>>> 7f7c720883e6841ced9c5e66cdae5e6b531872ad ->>>>>>> Stashed changes 9982 = SecActEyesAboveC 9983 = SecActEyesBelowC 9988 = CustomSprite diff --git a/wadsrc/static/zscript/shared/dynlights.txt b/wadsrc/static/zscript/shared/dynlights.txt index 59584bb235..c2c005bd88 100644 --- a/wadsrc/static/zscript/shared/dynlights.txt +++ b/wadsrc/static/zscript/shared/dynlights.txt @@ -245,9 +245,6 @@ class SpotLightFlickerRandom : SpotLight DynamicLight.Type "RandomFlicker"; } } -<<<<<<< Updated upstream -======= -<<<<<<< HEAD class SpotLightAdditive : SpotLight { @@ -368,9 +365,6 @@ class SpotLightFlickerRandomAttenuated : SpotLightFlickerRandom +DYNAMICLIGHT.ATTENUATE } } -======= ->>>>>>> 7f7c720883e6841ced9c5e66cdae5e6b531872ad ->>>>>>> Stashed changes class VavoomLight : DynamicLight { From e754fe04efc8720d46f5fb266899219bb7f24c1f Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 4 Jan 2018 23:22:45 +0000 Subject: [PATCH 8/9] - removed the 0 check on the UDMF property, so 0 can be a valid aperture --- src/p_mobj.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 78b41facc4..fc41dd3b07 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6092,10 +6092,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (i->IsDescendantOf(RUNTIME_CLASS(ADynamicLight))) { - if (mthing->SpotInnerAngle != 0) - ((ADynamicLight*)mobj)->SpotInnerAngle = mthing->SpotInnerAngle; - if (mthing->SpotOuterAngle != 0) - ((ADynamicLight*)mobj)->SpotOuterAngle = mthing->SpotOuterAngle; + ((ADynamicLight*)mobj)->SpotInnerAngle = mthing->SpotInnerAngle; + ((ADynamicLight*)mobj)->SpotOuterAngle = mthing->SpotOuterAngle; } mobj->CallBeginPlay (); From 67e3106254e987f5acb9534e725d4f5c3eaa82b2 Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 4 Jan 2018 23:31:10 +0000 Subject: [PATCH 9/9] - add the default spotlight apertures in FMapThing --- src/doomdata.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doomdata.h b/src/doomdata.h index d11a45ce7d..e01bab0306 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -371,8 +371,8 @@ struct FMapThing int16_t roll; uint32_t RenderStyle; int FloatbobPhase; - double SpotInnerAngle; - double SpotOuterAngle; + double SpotInnerAngle = 10; + double SpotOuterAngle = 25; };