Visual mode: Sector_Set3dFloor and ExtraFloor_LightOnly effects now affect sidedef brightness more similarly to GZDoom.

Visual mode, Linedef info panel: info for currently highlighted side is now shown using a different color.
Updated ZDoom_ACS.cfg.
This commit is contained in:
MaxED 2015-02-25 19:59:17 +00:00
parent e84f7d1fe8
commit 5f37b315d4
9 changed files with 95 additions and 51 deletions

View file

@ -564,11 +564,12 @@ constants
APROP_TracerTID;
APROP_ViewHeight;
APROP_Waterlevel;
ARMORINFO_ClassName;
ARMORINFO_SaveAmount;
ARMORINFO_SavePercent;
ARMORINFO_MaxAbsorb;
ARMORINFO_MaxFullAbsorb;
ARMORINFO_CLASSNAME;
ARMORINFO_SAVEAMOUNT;
ARMORINFO_ACTUALSAVEAMOUNT;
ARMORINFO_SAVEPERCENT;
ARMORINFO_MAXABSORB;
ARMORINFO_MAXFULLABSORB;
ATTN_IDLE;
ATTN_NONE;
ATTN_NORM;

View file

@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.Controls
}
// This shows the info
public void ShowInfo(Linedef l)
public void ShowInfo(Linedef l, Sidedef highlightside)
{
string peggedness;
@ -188,6 +188,10 @@ namespace CodeImp.DoomBuilder.Controls
bool hasTopFields = false;
bool hasMiddleFields = false;
bool hasBottomFields = false;
//mxd. Highlight this side?
bool highlight = (l.Front == highlightside);
frontpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd
// Show sidedef info
frontpanel.Visible = true; //mxd
@ -198,22 +202,22 @@ namespace CodeImp.DoomBuilder.Controls
{
//light
frontoffsetlabel.Text = "Front light:";
SetUDMFLight(l.Front, frontoffsetlabel, frontoffset);
SetUDMFLight(l.Front, frontoffsetlabel, frontoffset, highlight);
//global offset, sector index
frontpanel.Text += ". Offset " + l.Front.OffsetX + ", " + l.Front.OffsetY + ". Sector " + l.Front.Sector.Index + " ";
//sidedef top
hasTopFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_top", "offsety_top", 0.0f, frontTopUDMFOffsetLabel, frontTopUDMFOffset);
hasTopFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_top", "scaley_top", 1.0f, frontTopUDMFScaleLabel, frontTopUDMFScale);
hasTopFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_top", "offsety_top", 0.0f, frontTopUDMFOffsetLabel, frontTopUDMFOffset, highlight);
hasTopFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_top", "scaley_top", 1.0f, frontTopUDMFScaleLabel, frontTopUDMFScale, highlight);
//sidedef middle
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_mid", "offsety_mid", 0.0f, frontMidUDMFOffsetLabel, frontMidUDMFOffset);
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_mid", "scaley_mid", 1.0f, frontMidUDMFScaleLabel, frontMidUDMFScale);
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_mid", "offsety_mid", 0.0f, frontMidUDMFOffsetLabel, frontMidUDMFOffset, highlight);
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_mid", "scaley_mid", 1.0f, frontMidUDMFScaleLabel, frontMidUDMFScale, highlight);
//sidedef bottom
hasBottomFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_bottom", "offsety_bottom", 0.0f, frontBottomUDMFOffsetLabel, frontBottomUDMFOffset);
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_bottom", "scaley_bottom", 1.0f, frontBottomUDMFScaleLabel, frontBottomUDMFScale);
hasBottomFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_bottom", "offsety_bottom", 0.0f, frontBottomUDMFOffsetLabel, frontBottomUDMFOffset, highlight);
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_bottom", "scaley_bottom", 1.0f, frontBottomUDMFScaleLabel, frontBottomUDMFScale, highlight);
//visibility
frontTopUDMFOffset.Visible = hasTopFields;
@ -299,7 +303,11 @@ namespace CodeImp.DoomBuilder.Controls
bool hasTopFields = false;
bool hasMiddleFields = false;
bool hasBottomFields = false;
//mxd. Highlight this side?
bool highlight = l.Back == highlightside;
backpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd
// Show sidedef info
backpanel.Visible = true; //mxd
backpanel.Text = " Back Sidedef " + l.Back.Index;
@ -309,22 +317,22 @@ namespace CodeImp.DoomBuilder.Controls
{
//light
backoffsetlabel.Text = "Back light:";
SetUDMFLight(l.Back, backoffsetlabel, backoffset);
SetUDMFLight(l.Back, backoffsetlabel, backoffset, highlight);
//global offset, sector index
backpanel.Text += ". Offset " + l.Back.OffsetX + ", " + l.Back.OffsetY + ". Sector " + l.Back.Sector.Index + " ";
//sidedef top
hasTopFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_top", "offsety_top", 0f, backTopUDMFOffsetLabel, backTopUDMFOffset);
hasTopFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_top", "scaley_top", 1.0f, backTopUDMFScaleLabel, backTopUDMFScale);
hasTopFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_top", "offsety_top", 0f, backTopUDMFOffsetLabel, backTopUDMFOffset, highlight);
hasTopFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_top", "scaley_top", 1.0f, backTopUDMFScaleLabel, backTopUDMFScale, highlight);
//sidedef middle
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_mid", "offsety_mid", 0f, backMidUDMFOffsetLabel, backMidUDMFOffset);
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_mid", "scaley_mid", 1.0f, backMidUDMFScaleLabel, backMidUDMFScale);
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_mid", "offsety_mid", 0f, backMidUDMFOffsetLabel, backMidUDMFOffset, highlight);
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_mid", "scaley_mid", 1.0f, backMidUDMFScaleLabel, backMidUDMFScale, highlight);
//sidedef bottom
hasBottomFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_bottom", "offsety_bottom", 0f, backBottomUDMFOffsetLabel, backBottomUDMFOffset);
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_bottom", "scaley_bottom", 1.0f, backBottomUDMFScaleLabel, backBottomUDMFScale);
hasBottomFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_bottom", "offsety_bottom", 0f, backBottomUDMFOffsetLabel, backBottomUDMFOffset, highlight);
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_bottom", "scaley_bottom", 1.0f, backBottomUDMFScaleLabel, backBottomUDMFScale, highlight);
//visibility
backTopUDMFOffset.Visible = hasTopFields;
@ -463,7 +471,7 @@ namespace CodeImp.DoomBuilder.Controls
}
//mxd
private static bool SetPairedUDMFFieldsLabel(UniFields fields, string paramX, string paramY, float defaultvalue, Label namelabel, Label valuelabel)
private static bool SetPairedUDMFFieldsLabel(UniFields fields, string paramX, string paramY, float defaultvalue, Label namelabel, Label valuelabel, bool highlight)
{
float x = UDMFTools.GetFloat(fields, paramX, defaultvalue);
float y = UDMFTools.GetFloat(fields, paramY, defaultvalue);
@ -476,19 +484,19 @@ namespace CodeImp.DoomBuilder.Controls
valuelabel.Text = String.Format("{0:0.##}", x) + ", " + String.Format("{0:0.##}", y);
valuelabel.Enabled = true;
namelabel.Enabled = true;
return true;
}
else
{
valuelabel.Text = "--, --";
valuelabel.Enabled = false;
namelabel.Enabled = false;
valuelabel.Enabled = highlight;
namelabel.Enabled = highlight;
return false;
}
return valuelabel.Enabled;
}
//mxd
private static void SetUDMFLight(Sidedef sd, Label label, Label value)
private static void SetUDMFLight(Sidedef sd, Label label, Label value, bool highlight)
{
if(sd.Fields.ContainsKey("light"))
{
@ -504,10 +512,13 @@ namespace CodeImp.DoomBuilder.Controls
}
else
{
value.Text = "--";
label.Enabled = false;
value.Enabled = false;
value.Text = "-- (" + sd.Sector.Brightness + ")";
label.Enabled = highlight;
value.Enabled = highlight;
}
label.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText);
value.ForeColor = label.ForeColor;
}
//mxd

View file

@ -56,6 +56,7 @@ namespace CodeImp.DoomBuilder.Windows
DialogResult ShowEditSectors(ICollection<Sector> sectors);
DialogResult ShowEditThings(ICollection<Thing> things);
void ShowLinedefInfo(Linedef l);
void ShowLinedefInfo(Linedef l, Sidedef highlightside); //mxd
void ShowSectorInfo(Sector s);
void ShowThingInfo(Thing t);
void ShowVertexInfo(Vertex v);

View file

@ -3294,9 +3294,15 @@ namespace CodeImp.DoomBuilder.Windows
{
dockerspanel.Remove(hintsDocker);
}
//mxd. Show linedef info
public void ShowLinedefInfo(Linedef l)
{
ShowLinedefInfo(l, null);
}
// Show linedef info
public void ShowLinedefInfo(Linedef l)
//mxd. Show linedef info and highlight given sidedef
public void ShowLinedefInfo(Linedef l, Sidedef highlightside)
{
if(l.IsDisposed)
{
@ -3313,7 +3319,7 @@ namespace CodeImp.DoomBuilder.Windows
if(vertexinfo.Visible) vertexinfo.Hide();
if(sectorinfo.Visible) sectorinfo.Hide();
if(thinginfo.Visible) thinginfo.Hide();
if(IsInfoPanelExpanded) linedefinfo.ShowInfo(l);
if(IsInfoPanelExpanded) linedefinfo.ShowInfo(l, highlightside);
// Show info on collapsed label
if(General.Map.Config.LinedefActions.ContainsKey(l.Action))

View file

@ -173,19 +173,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
SectorLevel l = sd.LightLevels[i];
if((l != sd.Floor) && (l != sd.Ceiling) && (l.type != SectorLevelType.Floor))
if((l != sd.Floor) && (l != sd.Ceiling) && (l.type != SectorLevelType.Floor || l.alpha < 255))
{
// Go for all polygons
int num = polygons.Count;
Plane plane = (l.type == SectorLevelType.Ceiling ? l.plane : l.plane.GetInverted()); //mxd
for(int pi = 0; pi < num; pi++)
{
// Split by plane
WallPolygon p = polygons[pi];
WallPolygon np = SplitPoly(ref p, l.plane, false);
WallPolygon np = SplitPoly(ref p, plane, false);
if(np.Count > 0)
{
// Determine color
int lightlevel = lightabsolute ? lightvalue : l.brightnessbelow + lightvalue;
//mxd. Determine color
int lightlevel;
if(l.disablelighting) //sidedef part is not affected by 3d floor brightness
{
lightlevel = lightabsolute ? lightvalue : l.brightnessbelow + lightvalue;
}
else if(l.restrictlighting || (l.type == SectorLevelType.Floor && l.alpha < 255)) //only happens to a sidedef part inside of a non-opaque 3d floor.
{
lightlevel = l.sector.Brightness;
}
else // "Regular" 3d floor transfers brightness below it ignoring sidedef's brightness.
{
lightlevel = l.brightnessbelow;
}
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef)); //mxd
PixelColor wallcolor = PixelColor.Modulate(l.colorbelow, wallbrightness);
np.color = wallcolor.WithAlpha(255).ToInt();

View file

@ -459,7 +459,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(pickedgeo is BaseVisualGeometrySidedef)
{
BaseVisualGeometrySidedef pickedsidedef = (pickedgeo as BaseVisualGeometrySidedef);
General.Interface.ShowLinedefInfo(pickedsidedef.GetControlLinedef()); //mxd
General.Interface.ShowLinedefInfo(pickedsidedef.GetControlLinedef(), pickedsidedef.Sidedef); //mxd
}
// Sector?
else if(pickedgeo is BaseVisualGeometrySector)

View file

@ -41,7 +41,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. 3D-Floor Flags
[Flags]
public enum Flags : int
public enum Flags
{
None = 0,
DisableLighting = 1,
@ -55,7 +55,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. 3D-Floor Types
[Flags]
public enum FloorTypes : int
public enum FloorTypes
{
VavoomStyle = 0,
Solid = 1,
@ -137,14 +137,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
ceiling.alpha = alpha;
// Do not adjust light? (works only for non-vavoom types)
if(!vavoomtype && (((linedef.Args[2] & (int)Flags.DisableLighting) == (int)Flags.DisableLighting) || (((linedef.Args[2] & (int)Flags.RestrictLighting) == (int)Flags.RestrictLighting)))) //mxd
if(!vavoomtype)
{
floor.brightnessbelow = -1;
floor.colorbelow = PixelColor.FromInt(0);
ceiling.color = 0;
ceiling.brightnessbelow = -1;
ceiling.transferbrightness = false; //mxd
ceiling.colorbelow = PixelColor.FromInt(0);
bool disablelighting = ((linedef.Args[2] & (int) Flags.DisableLighting) == (int) Flags.DisableLighting); //mxd
bool restrictlighting = alpha < 255 && ((linedef.Args[2] & (int) Flags.RestrictLighting) == (int) Flags.RestrictLighting); //mxd
if(disablelighting || restrictlighting)
{
floor.brightnessbelow = -1;
floor.restrictlighting = restrictlighting; //mxd
floor.disablelighting = disablelighting; //mxd
floor.colorbelow = PixelColor.FromInt(0);
ceiling.color = 0;
ceiling.brightnessbelow = -1;
ceiling.disablelighting = true; //mxd
ceiling.colorbelow = PixelColor.FromInt(0);
}
}
}
}

View file

@ -296,7 +296,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
SectorLevel pl = lightlevels[i + 1];
//mxd. If the real floor has "lightfloor" value and the 3d floor above it doesn't cast down light, use real floor's brightness
if(General.Map.UDMF && l == floor && lightlevels.Count > 2 && !pl.transferbrightness && l.sector.Fields.ContainsKey("lightfloor"))
if(General.Map.UDMF && l == floor && lightlevels.Count > 2 && (pl.disablelighting || pl.restrictlighting) && l.sector.Fields.ContainsKey("lightfloor"))
{
int light = l.sector.Fields.GetValue("lightfloor", pl.brightnessbelow);
pl.brightnessbelow = (l.sector.Fields.GetValue("lightfloorabsolute", false) ? light : l.sector.Brightness + light);

View file

@ -30,7 +30,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// When this is 0, it takes the color from the sector above
public int brightnessbelow;
public PixelColor colorbelow;
public bool transferbrightness; //mxd
public bool disablelighting; //mxd
public bool restrictlighting; //mxd
// Constructor
public SectorLevel(Sector s, SectorLevelType type)
@ -38,7 +39,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.type = type;
this.sector = s;
this.alpha = 255;
this.transferbrightness = true; //mxd
}
// Copy constructor
@ -57,7 +57,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
target.color = this.color;
target.brightnessbelow = this.brightnessbelow;
target.colorbelow = this.colorbelow;
target.transferbrightness = this.transferbrightness; //mxd
target.disablelighting = this.disablelighting; //mxd
target.restrictlighting = this.restrictlighting; //mxd
}
}
}