Page 1 of 1


PostPosted: Sun Nov 14, 2021 6:24 pm
by Hey Doomer
Without darkness there is no light, I suppose. A natural suggestion of Darker, which changes sector lighting, is Brighter, which adds back dynamic lighting to static objects obscured in new gloom. I recall GZDoom having an option to adjust the intensity of dynamic lights, which I have added. (This only works for lighting added by this mod.)


This works similar to the former when the WorldLoaded event fires:

Code: Select allExpand view
class brighter_EventHandler : EventHandler
   struct thingcolor
      string cname;
      color lightcolor;
      int radius;
      int flags;
      vector3 offset;
   thingcolor ThingColors[50];
   int thingCounter;
   void AddThingColor(string cname, string lightcolor, int radius, int flags, vector3 offset)
      ThingColors[thingCounter].cname = cname;
      ThingColors[thingCounter].lightcolor = lightcolor;
      ThingColors[thingCounter].radius = radius;
      ThingColors[thingCounter].flags = flags;
      ThingColors[thingCounter].offset = offset;
   void LoadColors()
      thingCounter = 0;
      // static lights loaded with level
      AddThingColor("Column", "#ffff00", 64, DynamicLight.LF_ATTENUATE | DynamicLight.LF_NOSHADOWMAP, (0, 0, 46));
      AddThingColor("Candelabra", "#ffff00", 32, DynamicLight.LF_ATTENUATE | DynamicLight.LF_NOSHADOWMAP, (0, 0, 60));
      AddThingColor("ExplosiveBarrel", "#00ff00", 64, DynamicLight.LF_ATTENUATE, (0, 0, 45));
   void WorldLoaded(WorldEvent e)
      float br_strength = Cvar.FindCvar("br_strength").GetFloat();
      ThinkerIterator lightFinder = ThinkerIterator.Create("Actor", Thinker.STAT_DEFAULT);
      Actor mo;
      while (mo = Actor(lightFinder.Next()))
         string cn = mo.GetReplacee(mo.GetClassName()).GetClassName();
         // console.printf("%s", cn);
         for (int i = 0; i < thingCounter; i++)
            if (cn == ThingColors[i].cname)
               mo.A_AttachLight(ThingColors[i].cname, DynamicLight.SectorLight, ThingColors[i].lightcolor,
                  ThingColors[i].radius * br_strength, 0, ThingColors[i].flags, ThingColors[i].offset);

Still pondering the utility of this, something I wrote as a matter of course and curiosity. Sure, this can be done in GLDEFS, but this can also change the light intensity of defined objects. I'm not sure there is a way to tweak dynamic lights bound to actors using an iterator (perhaps there is), but attaching a light to an existing actor can be done. These are defined in an array called ThingColors. Instead of making sectors darker based on thresholds and neighboring lights, dynamic lights are added to objects (such as lamps) in sectors to make them a little brighter.

It's an idea that seems to work. Perhaps, options unavailable in GLDEFS may be added.