Simulate Doom brightness levels in Classic modes as well (now optional in game configs)

This commit is contained in:
codeimp 2009-07-12 09:58:05 +00:00
parent 2bbaf80b5a
commit d593294304
33 changed files with 93 additions and 19 deletions

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -35,6 +35,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -35,6 +35,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -35,6 +35,9 @@ skills
5 = "Black plague possesses thee";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -35,6 +35,9 @@ skills
5 = "Titan / Pope / Archimage";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -37,6 +37,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -37,6 +37,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -35,6 +35,9 @@ skills
5 = "Bloodbath";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -35,6 +35,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -37,6 +37,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -37,6 +37,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -37,6 +37,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -37,6 +37,9 @@ skills
5 = "Black plague possesses thee";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -37,6 +37,9 @@ skills
5 = "Titan / Pope / Archimage";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -37,6 +37,9 @@ skills
5 = "Bloodbath";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = false;

View file

@ -34,6 +34,9 @@ skills
5 = "Nightmare!";
}
// Simulate Doom brightness levels (turn this off for linear lighting)
doomlightlevels = true;
// When this is set to true, sectors with the same tag will light up when a line is highlighted
linetagindicatesectors = true;

View file

@ -72,6 +72,7 @@ namespace CodeImp.DoomBuilder.Config
private string decorategames;
private string skyflatname;
private int maxtexturenamelength;
private bool doomlightlevels;
// Skills
private List<SkillInfo> skills;
@ -155,6 +156,7 @@ namespace CodeImp.DoomBuilder.Config
public string DecorateGames { get { return decorategames; } }
public string SkyFlatName { get { return skyflatname; } }
public int MaxTextureNamelength { get { return maxtexturenamelength; } }
public bool DoomLightLevels { get { return doomlightlevels; } }
// Skills
public List<SkillInfo> Skills { get { return skills; } }
@ -259,6 +261,7 @@ namespace CodeImp.DoomBuilder.Config
decorategames = cfg.ReadSetting("decorategames", "");
skyflatname = cfg.ReadSetting("skyflatname", "F_SKY1");
maxtexturenamelength = cfg.ReadSetting("maxtexturenamelength", 8);
doomlightlevels = cfg.ReadSetting("doomlightlevels", true);
for(int i = 0; i < Linedef.NUM_ARGS; i++) makedoorargs[i] = cfg.ReadSetting("makedoorarg" + i.ToString(CultureInfo.InvariantCulture), 0);
// Flags have special (invariant culture) conversion

View file

@ -284,12 +284,8 @@ namespace CodeImp.DoomBuilder.Map
{
if(updateneeded)
{
// Brightness color (alpha is opaque)
byte clampedbright = 0;
if((brightness >= 0) && (brightness <= 255)) clampedbright = (byte)brightness;
else if(brightness > 255) clampedbright = 255;
PixelColor brightcolor = new PixelColor(255, clampedbright, clampedbright, clampedbright);
int brightint = brightcolor.ToInt();
// Brightness color
int brightint = General.Map.Renderer2D.CalculateBrightness(brightness);
// Make vertices
flatvertices = new FlatVertex[triangles.Vertices.Count];

View file

@ -53,7 +53,8 @@ namespace CodeImp.DoomBuilder.Rendering
PixelColor DetermineLinedefColor(Linedef l);
PixelColor DetermineThingColor(Thing t);
int DetermineVertexColor(Vertex v);
int CalculateBrightness(int level);
// Rendering management methods
bool StartPlotter(bool clear);
bool StartThings(bool clear);

View file

@ -58,6 +58,7 @@ namespace CodeImp.DoomBuilder.Rendering
void FinishGeometry();
// Rendering methods
int CalculateBrightness(int level);
void SetHighlightedObject(IVisualPickable obj);
void AddSectorGeometry(VisualGeometry g);
void AddThingGeometry(VisualThing t);

View file

@ -85,6 +85,20 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Methods
// This calculates the sector brightness level
public int CalculateBrightness(int level)
{
float flevel = level;
// Simulat doom light levels
if((level < 192) && General.Map.Config.DoomLightLevels)
flevel = (192.0f - (float)(192 - level) * 1.5f);
byte blevel = (byte)General.Clamp((int)flevel, 0, 255);
PixelColor c = new PixelColor(255, blevel, blevel, blevel);
return c.ToInt();
}
// This is called when the graphics need to be reset
public virtual void Reset() { }

View file

@ -156,13 +156,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// This calculates brightness level
internal static int CalculateBrightness(int level)
internal int CalculateBrightness(int level)
{
float flevel = level;
if(level < 192) flevel = (192.0f - (float)(192 - level) * 1.5f); // simulate doom light levels
byte blevel = (byte)General.Clamp((int)flevel, 0, 255);
PixelColor c = new PixelColor(255, blevel, blevel, blevel);
return c.ToInt();
return renderer.CalculateBrightness(level);
}
// This adds a selected object

View file

@ -69,7 +69,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
WorldVertex[] verts;
WorldVertex v;
Sector s = base.Sector.Sector;
int brightness = BaseVisualMode.CalculateBrightness(s.Brightness);
int brightness = mode.CalculateBrightness(s.Brightness);
// Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);

View file

@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
WorldVertex[] verts;
Sector s = base.Sector.Sector;
int brightness = BaseVisualMode.CalculateBrightness(s.Brightness);
int brightness = mode.CalculateBrightness(s.Brightness);
// Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);

View file

@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This builds the geometry. Returns false when no geometry created.
public override bool Setup()
{
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
int brightness = mode.CalculateBrightness(Sidedef.Sector.Brightness);
// Calculate size of this wall part
float geotop = (float)Sidedef.Other.Sector.FloorHeight;

View file

@ -70,7 +70,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
WorldVertex[] verts;
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
int brightness = mode.CalculateBrightness(Sidedef.Sector.Brightness);
// Calculate size of this wall part
float geotop = (float)Math.Min(Sidedef.Sector.CeilHeight, Sidedef.Other.Sector.CeilHeight);

View file

@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This builds the geometry. Returns false when no geometry created.
public override bool Setup()
{
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
int brightness = mode.CalculateBrightness(Sidedef.Sector.Brightness);
// Calculate size of this wall part
float geotop = (float)Sidedef.Sector.CeilHeight;

View file

@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This builds the geometry. Returns false when no geometry created.
public override bool Setup()
{
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
int brightness = mode.CalculateBrightness(Sidedef.Sector.Brightness);
// Calculate size of this wall part
float geotop = (float)Sidedef.Sector.CeilHeight;