brighter maps

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
Kappes Buur
 
 
Posts: 4138
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada

brighter maps

Post by Kappes Buur »

What would be an easy way to make all maps in a multimap pwad brighter by a certain amount of brightness, instead of doing this one map at a time in an editor?
User avatar
Kappes Buur
 
 
Posts: 4138
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada

Re: brighter maps

Post by Kappes Buur »

Anybody have some 'bright' idea how this could be done?

I tried various options but none work with specifying the value of brightness.
But then my programming skills are almost non-existing.
User avatar
Xeotroid
Posts: 442
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: brighter maps

Post by Xeotroid »

This ZScript works:

Code: Select all

int im = Level.Sectors.Size(); //calling .Size() every loop iteration can get slow in my experience, and the Sectors array's size should be fixed
for(int i = 0; i < im; i++) {
	Level.Sectors[i].lightlevel += 128;
}
You can put it in an event handler's WorldLoaded() method and replace the constant with some table lookup (via Map) that stores what light value to add for each map. This looks pretty off as it loads up the Map<> on each level load, but putting the map and .Insert into a static handler would be overkill.

Code: Select all

class MyHandler : EventHandler {
	Map<string, int> LightShifts;
	
	override void WorldLoaded(WorldEvent e) {
		LightShifts.Insert("MAP01", 64);
		LightShifts.Insert("MAP02", -94);
		
		LightShifts.Get(Level.MapName);
		//if map name is not in the map, you get 0, meaning no change		
		int im = Level.Sectors.Size();
		for(int i = 0; i < im; i++) {
			Level.Sectors[i].lightlevel += amount;
		}
	}
}
User avatar
Kappes Buur
 
 
Posts: 4138
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada

Re: brighter maps

Post by Kappes Buur »

Xeotroid wrote: Thu Aug 31, 2023 9:00 pm This ZScript works:
.....
That is confusing to me.
I guess that needs to be imported into a pwad.

I was thinking more in line of a separate utility into which I can specify the pwad and the amount of brightness.

But thank you for responding.
Meanwhile I just do it map by map in UDB.
User avatar
Caligari87
Admin
Posts: 6190
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him

Re: brighter maps

Post by Caligari87 »

ZSCRIPT.txt

Code: Select all

class LightLevelBooster : EventHandler {	
	override void WorldLoaded(WorldEvent e) {
		int im = Level.Sectors.Size();
		for(int i = 0; i < im; i++) {
			int boost = int((256 - Level.Sectors[i].lightlevel) / 2);
			Level.Sectors[i].lightlevel += boost;
		}
	}
}
MAPINFO.txt

Code: Select all

GameInfo {
	AddEventHandlers = "LightLevelBooster";
}
Just put these two files into a pk3 or wad and load after your pwads. It boosts the light level of all sectors in a map by half the distance to the maximum (so a light level of 0 would be boosted to 128, a light level of 128 would be boosted to 192, 160 would become 208, etc.

Changing the divide by 2 to a larger number (like divide by 4) would make the boost less aggressive.

There's absolutely no reason to edit the light levels by hand.

8-)

Return to “Mapping”