diff --git a/src/r_data/a_dynlightdata.cpp b/src/r_data/a_dynlightdata.cpp index b9c09a690..6cab5d02c 100644 --- a/src/r_data/a_dynlightdata.cpp +++ b/src/r_data/a_dynlightdata.cpp @@ -137,7 +137,7 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const extern int ScriptDepth; -void AddLightDefaults(FLightDefaults *defaults) +void AddLightDefaults(FLightDefaults *defaults, double attnFactor) { FLightDefaults *temp; unsigned int i; @@ -153,6 +153,11 @@ void AddLightDefaults(FLightDefaults *defaults) break; } } + if (defaults->GetAttenuate()) + { + defaults->SetArg(LIGHT_INTENSITY, int(defaults->GetArg(LIGHT_INTENSITY) * attnFactor)); + defaults->SetArg(LIGHT_SECONDARY_INTENSITY, int(defaults->GetArg(LIGHT_SECONDARY_INTENSITY) * attnFactor)); + } LightDefaults.Push(defaults); } diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index 92c7a91d7..c01b905d9 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -52,7 +52,7 @@ #include "textures/skyboxtexture.h" #include "gl/shaders/gl_postprocessshader.h" -void AddLightDefaults(FLightDefaults *defaults); +void AddLightDefaults(FLightDefaults *defaults, double attnFactor); void AddLightAssociation(const char *actor, const char *frame, const char *light); void InitializeActorLights(TArray &LightAssociations); @@ -193,6 +193,7 @@ static const char *CoreKeywords[]= "detail", "#include", "material", + "lightsizefactor", nullptr }; @@ -215,7 +216,8 @@ enum TAG_HARDWARESHADER, TAG_DETAIL, TAG_INCLUDE, - TAG_MATERIAL + TAG_MATERIAL, + TAG_LIGHTSIZEFACTOR, }; //========================================================================== @@ -230,6 +232,7 @@ class GLDefsParser int workingLump; int ScriptDepth = 0; TArray &LightAssociations; + double lightSizeFactor = 1.; //========================================================================== // @@ -470,7 +473,7 @@ class GLDefsParser sc.ScriptError("Unknown tag: %s\n", sc.String); } } - AddLightDefaults(defaults); + AddLightDefaults(defaults, lightSizeFactor); } else { @@ -565,7 +568,7 @@ class GLDefsParser } defaults->OrderIntensities(); - AddLightDefaults(defaults); + AddLightDefaults(defaults, lightSizeFactor); } else { @@ -660,7 +663,7 @@ class GLDefsParser } } defaults->OrderIntensities(); - AddLightDefaults(defaults); + AddLightDefaults(defaults, lightSizeFactor); } else { @@ -760,7 +763,7 @@ class GLDefsParser defaults->SetArg(LIGHT_SECONDARY_INTENSITY, defaults->GetArg(LIGHT_INTENSITY)); defaults->SetArg(LIGHT_INTENSITY, v); } - AddLightDefaults(defaults); + AddLightDefaults(defaults, lightSizeFactor); } else { @@ -846,7 +849,7 @@ class GLDefsParser sc.ScriptError("Unknown tag: %s\n", sc.String); } } - AddLightDefaults(defaults); + AddLightDefaults(defaults, lightSizeFactor); } else { @@ -1427,7 +1430,6 @@ class GLDefsParser } } } - public: @@ -1461,6 +1463,7 @@ public: sc.ScriptError("Lump '%s' not found", sc.String); GLDefsParser newscanner(lump, LightAssociations); + newscanner.lightSizeFactor = lightSizeFactor; newscanner.DoParseDefs(); break; } @@ -1508,6 +1511,9 @@ public: case TAG_DETAIL: ParseDetailTexture(); break; + case TAG_LIGHTSIZEFACTOR: + lightSizeFactor = ParseFloat(sc); + break; case TAG_DISABLE_FB: { /* not implemented.