Brighter

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Brighter

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

Screenshots
https://i.postimg.cc/LXRK1bRz/Screensho ... 185013.png
https://i.postimg.cc/LXTdB36G/Screensho ... 185025.png

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

Code: Select all

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.

Return to “Script Library”