Brighter

Post your example zscripts/ACS scripts/etc here.

Brighter

Postby Hey Doomer » Sun Nov 14, 2021 6:24 pm

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.)

Screenshots
https://i.postimg.cc/LXRK1bRz/Screenshot-Doom-20211114-185013.png
https://i.postimg.cc/LXTdB36G/Screenshot-Doom-20211114-185025.png

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;
      
      thingCounter++;
   }
   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));
   }
   
   override
   void WorldLoaded(WorldEvent e)
   {
      LoadColors();
      
      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);
               break;
            }
         }
      }
   }
}


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.
You do not have the required permissions to view the files attached to this post.
Hey Doomer
 
Joined: 25 Sep 2021
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests