From cb8473fa09b5c624856ec379bbc92b0aba275dee Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Wed, 1 Feb 2017 20:16:42 +0200 Subject: [PATCH] Added: 3D floor should be affected by control sector's color_floor and color_ceiling. --- Source/Core/Properties/AssemblyInfo.cs | 4 ++-- .../BuilderModes/Properties/AssemblyInfo.cs | 2 +- .../BuilderModes/VisualModes/Effect3DFloor.cs | 13 ++++++++++++ .../BuilderModes/VisualModes/VisualCeiling.cs | 8 +++++--- .../BuilderModes/VisualModes/VisualFloor.cs | 20 +++++++++++-------- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs index d0dd9ba1..e7059ac2 100755 --- a/Source/Core/Properties/AssemblyInfo.cs +++ b/Source/Core/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ using CodeImp.DoomBuilder; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2854")] +[assembly: AssemblyVersion("2.3.0.2855")] [assembly: NeutralResourcesLanguageAttribute("en")] -[assembly: AssemblyHash("71440fb")] +[assembly: AssemblyHash("76b2b1b")] diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs index 8cd1d101..f0475b25 100755 --- a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs +++ b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Resources; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2854")] +[assembly: AssemblyVersion("2.3.0.2855")] [assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/Source/Plugins/BuilderModes/VisualModes/Effect3DFloor.cs b/Source/Plugins/BuilderModes/VisualModes/Effect3DFloor.cs index 0fe1e0c1..61f9f74c 100755 --- a/Source/Plugins/BuilderModes/VisualModes/Effect3DFloor.cs +++ b/Source/Plugins/BuilderModes/VisualModes/Effect3DFloor.cs @@ -16,7 +16,9 @@ namespace CodeImp.DoomBuilder.BuilderModes private readonly Linedef linedef; // Floor and ceiling planes + public PixelColor ColorFloor { get; private set; } private SectorLevel floor; + public PixelColor ColorCeiling { get; private set; } private SectorLevel ceiling; // Alpha transparency @@ -197,6 +199,17 @@ namespace CodeImp.DoomBuilder.BuilderModes ceiling.colorbelow = PixelColor.FromInt(0); } } + + if (VavoomType) + { + ColorFloor = sd.ColorFloor; + ColorCeiling = sd.ColorCeiling; + } + else + { + ColorFloor = sd.ColorCeiling; + ColorCeiling = sd.ColorFloor; + } } } } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs index 18a48a6b..031d0b67 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs @@ -115,13 +115,13 @@ namespace CodeImp.DoomBuilder.BuilderModes byte alpha = (byte)General.Clamp(level.alpha, 0, 255); int color = PixelColor.FromInt(level.color).WithAlpha(alpha).ToInt(); int targetbrightness; - if(extrafloor != null && !extrafloor.VavoomType && !level.disablelighting) + SectorData sd = mode.GetSectorData(this.Sector.Sector); + if (extrafloor != null && !extrafloor.VavoomType && !level.disablelighting) { //mxd. Top extrafloor level should calculate fogdensity from the brightness of the level above it if(!innerside) { targetbrightness = 0; - SectorData sd = mode.GetSectorData(this.Sector.Sector); for(int i = 0; i < sd.LightLevels.Count - 1; i++) { if(sd.LightLevels[i] == level) @@ -135,7 +135,6 @@ namespace CodeImp.DoomBuilder.BuilderModes else { targetbrightness = level.brightnessbelow; - SectorData sd = mode.GetSectorData(this.Sector.Sector); for(int i = 0; i < sd.LightLevels.Count; i++) { if(sd.LightLevels[i] == level) @@ -151,6 +150,9 @@ namespace CodeImp.DoomBuilder.BuilderModes targetbrightness = level.brightnessbelow; } + // [ZZ] Apply Doom 64 lighting here (for extrafloor) + if (extrafloor != null) color = PixelColor.Modulate(PixelColor.FromInt(color), extrafloor.VavoomType ? extrafloor.ColorCeiling : extrafloor.ColorFloor).WithAlpha(alpha).ToInt(); + //mxd. Determine fog density fogfactor = CalculateFogFactor(targetbrightness); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs index 0fafc513..f23444a8 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs @@ -111,16 +111,17 @@ namespace CodeImp.DoomBuilder.BuilderModes else texscale = new Vector2D(1.0f / 64.0f, 1.0f / 64.0f); - // Determine brightness - int color = PixelColor.FromInt(level.color).WithAlpha((byte)General.Clamp(level.alpha, 0, 255)).ToInt(); + // Determine brightness + byte alpha = (byte)General.Clamp(level.alpha, 0, 255); + int color = PixelColor.FromInt(level.color).WithAlpha(alpha).ToInt(); - //mxd. Top extrafloor level should calculate fogdensity - //from the brightness of the level above it - int targetbrightness; + //mxd. Top extrafloor level should calculate fogdensity + //from the brightness of the level above it + SectorData sd = mode.GetSectorData(this.Sector.Sector); + int targetbrightness; if(extrafloor != null && extrafloor.VavoomType && !level.disablelighting) { targetbrightness = 0; - SectorData sd = mode.GetSectorData(this.Sector.Sector); for(int i = 0; i < sd.LightLevels.Count - 1; i++) { if(sd.LightLevels[i] == level) @@ -135,8 +136,11 @@ namespace CodeImp.DoomBuilder.BuilderModes targetbrightness = level.brightnessbelow; } - //mxd. Determine fog density - fogfactor = CalculateFogFactor(targetbrightness); + // [ZZ] Apply Doom 64 lighting here (for extrafloor) + if (extrafloor != null) color = PixelColor.Modulate(PixelColor.FromInt(color), extrafloor.VavoomType ? extrafloor.ColorFloor : extrafloor.ColorCeiling).WithAlpha(alpha).ToInt(); + + //mxd. Determine fog density + fogfactor = CalculateFogFactor(targetbrightness); // Make vertices ReadOnlyCollection triverts = Sector.Sector.Triangles.Vertices;