mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Visual mode, UDMF: "nofakecontrast", "smoothlighting" and "lightabsolute" flags are now taken into account when calculating fake contrast/smooth lighting brightness values for walls.
This commit is contained in:
parent
7a2aafbb6b
commit
c441c5640a
1 changed files with 32 additions and 15 deletions
|
@ -99,23 +99,40 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
//mxd. This calculates wall brightness level with doom-style shading
|
||||
public int CalculateBrightness(int level, Sidedef sd) {
|
||||
if (level < 253 && !General.Map.Data.MapInfo.EvenLighting && sd != null) {
|
||||
//all walls are shaded by their angle
|
||||
if (General.Map.Data.MapInfo.SmoothLighting) {
|
||||
float ammount = Math.Abs((float)Math.Sin(sd.Angle));
|
||||
int hAmmount = (int)((1.0f - ammount) * General.Map.Data.MapInfo.HorizWallShade);
|
||||
int vAmmount = (int)(ammount * General.Map.Data.MapInfo.VertWallShade);
|
||||
if(level < 253 && sd != null) {
|
||||
bool evenlighting = General.Map.Data.MapInfo.EvenLighting;
|
||||
bool smoothlighting = General.Map.Data.MapInfo.SmoothLighting;
|
||||
|
||||
level = General.Clamp(level - hAmmount - vAmmount, 0, 255);
|
||||
//check for possiburu UDMF overrides
|
||||
if(General.Map.UDMF) {
|
||||
if(sd.IsFlagSet("lightabsolute") && sd.Fields.ContainsKey("light")) {
|
||||
evenlighting = true;
|
||||
} else {
|
||||
if(sd.IsFlagSet("nofakecontrast"))
|
||||
evenlighting = true;
|
||||
if(sd.IsFlagSet("smoothlighting"))
|
||||
smoothlighting = true;
|
||||
}
|
||||
}
|
||||
|
||||
} else { //only horizontal/verticel walls are shaded
|
||||
int angle = (int)Angle2D.RadToDeg(sd.Angle);// * 180.0f / Math.PI);
|
||||
//horizontal wall
|
||||
if (angle == 270 || angle == 90) {
|
||||
level = General.Clamp(level + General.Map.Data.MapInfo.HorizWallShade, 0, 255);
|
||||
//vertical wall
|
||||
} else if (angle == 0 || angle == 180) {
|
||||
level = General.Clamp(level + General.Map.Data.MapInfo.VertWallShade, 0, 255);
|
||||
if(!evenlighting) {
|
||||
//all walls are shaded by their angle
|
||||
if(smoothlighting) {
|
||||
float ammount = Math.Abs((float)Math.Sin(sd.Angle));
|
||||
int hAmmount = (int)((1.0f - ammount) * General.Map.Data.MapInfo.HorizWallShade);
|
||||
int vAmmount = (int)(ammount * General.Map.Data.MapInfo.VertWallShade);
|
||||
|
||||
level = General.Clamp(level - hAmmount - vAmmount, 0, 255);
|
||||
|
||||
} else { //only horizontal/verticel walls are shaded
|
||||
int angle = (int)Angle2D.RadToDeg(sd.Angle);
|
||||
//horizontal wall
|
||||
if(angle == 270 || angle == 90) {
|
||||
level = General.Clamp(level + General.Map.Data.MapInfo.HorizWallShade, 0, 255);
|
||||
//vertical wall
|
||||
} else if(angle == 0 || angle == 180) {
|
||||
level = General.Clamp(level + General.Map.Data.MapInfo.VertWallShade, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue