UltimateZoneBuilder/Source/Plugins/BuilderModes/VisualModes/SectorLevel.cs
MaxED 098e9724d9 Visual mode: rewritten most of the 3d floor clipping and light/color assignment logic. As a result, 3d floors should look much closer to what's seen in GZDoom.
Fixed, Visual mode: glow effect was not updated when changing sector textures using the "Select Texture" action.
Browse Textures/Flats window: when textures list is focused, you can now start typing to change the Filter.
2015-11-20 14:31:54 +00:00

110 lines
3.2 KiB
C#

#region === Copyright (c) 2010 Pascal van der Heiden ===
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class SectorLevel
{
// Type of level
public SectorLevelType type;
//mxd. Type of extralight
public LightLevelType lighttype = LightLevelType.UNKNOWN;
// Sector where this level originates from
public Sector sector;
// Plane in the sector
public Plane plane;
// Alpha for translucency (255=opaque)
public int alpha;
// Color of the plane (includes brightness)
// When this is 0, it takes the color from the sector above
public int color;
// Color and brightness below the plane
// When this is 0, it takes the color from the sector above
public int brightnessbelow;
public PixelColor colorbelow;
public bool disablelighting; //mxd
public bool restrictlighting; //mxd
public bool affectedbyglow; //mxd
public bool extrafloor; //mxd
public bool splitsides; //mxd
// Constructor
public SectorLevel(Sector s, SectorLevelType type)
{
this.type = type;
this.sector = s;
this.alpha = 255;
this.splitsides = true; //mxd
}
// Copy constructor
public SectorLevel(SectorLevel source)
{
source.CopyProperties(this);
}
// Copy properties
public void CopyProperties(SectorLevel target)
{
target.sector = this.sector;
target.type = this.type;
target.lighttype = this.lighttype; //mxd
target.plane = this.plane;
target.alpha = this.alpha;
target.color = this.color;
target.brightnessbelow = this.brightnessbelow;
target.colorbelow = this.colorbelow;
target.affectedbyglow = this.affectedbyglow; //mxd
target.disablelighting = this.disablelighting; //mxd
target.restrictlighting = this.restrictlighting; //mxd
target.splitsides = this.splitsides; //mxd
}
//mxd. Compare light properties
public bool LightPropertiesMatch(SectorLevel other)
{
return (this.type == other.type && this.lighttype == other.lighttype && this.alpha == other.alpha && this.splitsides == other.splitsides
&& this.color == other.color && this.brightnessbelow == other.brightnessbelow && this.colorbelow.ToInt() == other.colorbelow.ToInt()
&& this.disablelighting == other.disablelighting && this.restrictlighting == other.restrictlighting);
}
#if DEBUG
//mxd. Handy when debugging
public override string ToString()
{
switch(type)
{
case SectorLevelType.Ceiling: return (extrafloor ? "ExtraCeiling" : "Ceiling");
case SectorLevelType.Floor: return (extrafloor ? "ExtraFloor" : "Floor");
case SectorLevelType.Glow: return "Glow Level";
case SectorLevelType.Light: return "Light Level (" + GetLightType() + ")";
default: return "Unknown Level Type!!!";
}
}
//mxd. Handy when debugging
private string GetLightType()
{
switch(lighttype)
{
case LightLevelType.TYPE0: return "Type 0";
case LightLevelType.TYPE1: return "Type 1";
case LightLevelType.TYPE1_BOTTOM: return "Type 1 (bottom)";
case LightLevelType.TYPE2: return "Type 2";
default: return "Unknown";
}
}
#endif
}
}