Sector edit form: Add fadestart/fadeend

This commit is contained in:
MascaraSnake 2022-12-30 15:29:05 +01:00
parent c28d1c42b3
commit 646ee17bdc
6 changed files with 213 additions and 91 deletions

View file

@ -171,6 +171,8 @@ sectorbrightness
0;
}
numbrightnesslevels = 32;
/*
TEXTURES AND FLAT SOURCES
This tells Doom Builder where to find the information for textures
@ -221,18 +223,6 @@ universalfields
{
sector
{
fadestart
{
type = 0;
default = 0;
}
fadeend
{
type = 0;
default = 33;
}
foglighting
{
type = 3;

View file

@ -114,6 +114,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool distinctfloorandceilingbrightness;
private readonly bool distinctwallbrightness;
private readonly int maxcolormapalpha;
private readonly int numbrightnesslevels;
// Skills
private readonly List<SkillInfo> skills;
@ -293,6 +294,7 @@ namespace CodeImp.DoomBuilder.Config
public bool DistinctFloorAndCeilingBrightness { get { return distinctfloorandceilingbrightness; } }
public bool DistinctWallBrightness { get { return distinctwallbrightness; } }
public int MaxColormapAlpha { get { return maxcolormapalpha; } }
public int NumBrightnessLevels { get { return numbrightnesslevels; } }
// Texture/flat/voxel sources
public IDictionary TextureRanges { get { return textureranges; } }
@ -473,6 +475,7 @@ namespace CodeImp.DoomBuilder.Config
distinctfloorandceilingbrightness = cfg.ReadSetting("distinctfloorandceilingbrightness", false);
distinctwallbrightness = cfg.ReadSetting("distinctwallbrightness", false);
maxcolormapalpha = cfg.ReadSetting("maxcolormapalpha", 25);
numbrightnesslevels = cfg.ReadSetting("numbrightnesslevels", 32);
for (int i = 0; i < makedoorargs.Length; i++) makedoorargs[i] = cfg.ReadSetting("makedoorarg" + i.ToString(CultureInfo.InvariantCulture), 0);
//mxd. Update map format flags

View file

@ -84,6 +84,8 @@ uifields
color_floor = 0;
lightalpha = 0;
fadealpha = 0;
fadestart = 0;
fadeend = 0;
triggertag = 15;
triggerer = 2;
}

View file

@ -31,6 +31,8 @@
this.components = new System.ComponentModel.Container();
System.Windows.Forms.GroupBox groupaction;
System.Windows.Forms.GroupBox groupeffect;
System.Windows.Forms.Label labelTriggerer;
System.Windows.Forms.Label labelTriggerTag;
System.Windows.Forms.Label label16;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SectorEditFormSRB2));
System.Windows.Forms.Label label9;
@ -41,9 +43,11 @@
System.Windows.Forms.Label label5;
System.Windows.Forms.Label labelLightAlpha;
System.Windows.Forms.Label labelFadeAlpha;
System.Windows.Forms.Label labelTriggerTag;
System.Windows.Forms.Label labelTriggerer;
System.Windows.Forms.Label labelFadeStart;
System.Windows.Forms.Label labelFadeEnd;
this.tagsselector = new CodeImp.DoomBuilder.Controls.TagsSelector();
this.triggerer = new System.Windows.Forms.ComboBox();
this.triggerTag = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.resetdamagetype = new System.Windows.Forms.Button();
this.brightness = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.damagetype = new System.Windows.Forms.ComboBox();
@ -53,8 +57,6 @@
this.sectorheightlabel = new System.Windows.Forms.Label();
this.sectorheight = new System.Windows.Forms.Label();
this.floorheight = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.triggerTag = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.triggerer = new System.Windows.Forms.ComboBox();
this.tabs = new System.Windows.Forms.TabControl();
this.tabproperties = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
@ -106,8 +108,12 @@
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.fadeStart = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.fadeEnd = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
groupaction = new System.Windows.Forms.GroupBox();
groupeffect = new System.Windows.Forms.GroupBox();
labelTriggerer = new System.Windows.Forms.Label();
labelTriggerTag = new System.Windows.Forms.Label();
label16 = new System.Windows.Forms.Label();
label9 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
@ -117,8 +123,8 @@
label5 = new System.Windows.Forms.Label();
labelLightAlpha = new System.Windows.Forms.Label();
labelFadeAlpha = new System.Windows.Forms.Label();
labelTriggerTag = new System.Windows.Forms.Label();
labelTriggerer = new System.Windows.Forms.Label();
labelFadeStart = new System.Windows.Forms.Label();
labelFadeEnd = new System.Windows.Forms.Label();
groupaction.SuspendLayout();
groupeffect.SuspendLayout();
groupfloorceiling.SuspendLayout();
@ -178,6 +184,50 @@
groupeffect.TabStop = false;
groupeffect.Text = " Effects ";
//
// labelTriggerer
//
labelTriggerer.Location = new System.Drawing.Point(218, 16);
labelTriggerer.Name = "labelTriggerer";
labelTriggerer.Size = new System.Drawing.Size(74, 14);
labelTriggerer.TabIndex = 7;
labelTriggerer.Text = "Triggerer:";
labelTriggerer.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// triggerer
//
this.triggerer.FormattingEnabled = true;
this.triggerer.Location = new System.Drawing.Point(298, 12);
this.triggerer.Name = "triggerer";
this.triggerer.Size = new System.Drawing.Size(167, 21);
this.triggerer.TabIndex = 8;
//
// labelTriggerTag
//
labelTriggerTag.Location = new System.Drawing.Point(9, 16);
labelTriggerTag.Name = "labelTriggerTag";
labelTriggerTag.Size = new System.Drawing.Size(74, 14);
labelTriggerTag.TabIndex = 21;
labelTriggerTag.Text = "Trigger tag:";
labelTriggerTag.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// triggerTag
//
this.triggerTag.AllowDecimal = false;
this.triggerTag.AllowExpressions = false;
this.triggerTag.AllowNegative = false;
this.triggerTag.AllowRelative = false;
this.triggerTag.ButtonStep = 1;
this.triggerTag.ButtonStepBig = 1F;
this.triggerTag.ButtonStepFloat = 1F;
this.triggerTag.ButtonStepSmall = 1F;
this.triggerTag.ButtonStepsUseModifierKeys = true;
this.triggerTag.ButtonStepsWrapAround = false;
this.triggerTag.Location = new System.Drawing.Point(89, 11);
this.triggerTag.Name = "triggerTag";
this.triggerTag.Size = new System.Drawing.Size(81, 24);
this.triggerTag.StepValues = null;
this.triggerTag.TabIndex = 20;
//
// label16
//
label16.Location = new System.Drawing.Point(218, 50);
@ -397,6 +447,7 @@
labelLightAlpha.Size = new System.Drawing.Size(62, 13);
labelLightAlpha.TabIndex = 18;
labelLightAlpha.Text = "Light alpha:";
labelLightAlpha.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// labelFadeAlpha
//
@ -406,50 +457,7 @@
labelFadeAlpha.Size = new System.Drawing.Size(63, 13);
labelFadeAlpha.TabIndex = 20;
labelFadeAlpha.Text = "Fade alpha:";
//
// labelTriggerTag
//
labelTriggerTag.Location = new System.Drawing.Point(9, 16);
labelTriggerTag.Name = "labelTriggerTag";
labelTriggerTag.Size = new System.Drawing.Size(74, 14);
labelTriggerTag.TabIndex = 21;
labelTriggerTag.Text = "Trigger tag:";
labelTriggerTag.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// triggerTag
//
this.triggerTag.AllowDecimal = false;
this.triggerTag.AllowExpressions = false;
this.triggerTag.AllowNegative = false;
this.triggerTag.AllowRelative = false;
this.triggerTag.ButtonStep = 1;
this.triggerTag.ButtonStepBig = 1F;
this.triggerTag.ButtonStepFloat = 1F;
this.triggerTag.ButtonStepSmall = 1F;
this.triggerTag.ButtonStepsUseModifierKeys = true;
this.triggerTag.ButtonStepsWrapAround = false;
this.triggerTag.Location = new System.Drawing.Point(89, 11);
this.triggerTag.Name = "triggerTag";
this.triggerTag.Size = new System.Drawing.Size(81, 24);
this.triggerTag.StepValues = null;
this.triggerTag.TabIndex = 20;
//
// labelTriggerer
//
labelTriggerer.Location = new System.Drawing.Point(218, 16);
labelTriggerer.Name = "labelTriggerer";
labelTriggerer.Size = new System.Drawing.Size(74, 14);
labelTriggerer.TabIndex = 7;
labelTriggerer.Text = "Triggerer:";
labelTriggerer.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// triggerer
//
this.triggerer.FormattingEnabled = true;
this.triggerer.Location = new System.Drawing.Point(298, 12);
this.triggerer.Name = "triggerer";
this.triggerer.Size = new System.Drawing.Size(167, 21);
this.triggerer.TabIndex = 8;
labelFadeAlpha.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// tabs
//
@ -523,6 +531,10 @@
//
// groupBox8
//
this.groupBox8.Controls.Add(this.fadeEnd);
this.groupBox8.Controls.Add(labelFadeEnd);
this.groupBox8.Controls.Add(this.fadeStart);
this.groupBox8.Controls.Add(labelFadeStart);
this.groupBox8.Controls.Add(this.fadeAlpha);
this.groupBox8.Controls.Add(labelFadeAlpha);
this.groupBox8.Controls.Add(this.lightAlpha);
@ -531,7 +543,7 @@
this.groupBox8.Controls.Add(this.fadeColor);
this.groupBox8.Location = new System.Drawing.Point(3, 3);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(277, 196);
this.groupBox8.Size = new System.Drawing.Size(277, 229);
this.groupBox8.TabIndex = 18;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "Global sector colors";
@ -677,7 +689,7 @@
//
// floorAngleControl
//
this.floorAngleControl.Angle = -2250;
this.floorAngleControl.Angle = -2340;
this.floorAngleControl.AngleOffset = 90;
this.floorAngleControl.DoomAngleClamping = false;
this.floorAngleControl.Location = new System.Drawing.Point(6, 156);
@ -874,7 +886,7 @@
//
// ceilAngleControl
//
this.ceilAngleControl.Angle = -2250;
this.ceilAngleControl.Angle = -2340;
this.ceilAngleControl.AngleOffset = 90;
this.ceilAngleControl.DoomAngleClamping = false;
this.ceilAngleControl.Location = new System.Drawing.Point(6, 156);
@ -1139,6 +1151,65 @@
this.tooltip.InitialDelay = 10;
this.tooltip.ReshowDelay = 100;
//
// fadeStart
//
this.fadeStart.AllowDecimal = false;
this.fadeStart.AllowExpressions = false;
this.fadeStart.AllowNegative = false;
this.fadeStart.AllowRelative = false;
this.fadeStart.ButtonStep = 1;
this.fadeStart.ButtonStepBig = 1F;
this.fadeStart.ButtonStepFloat = 1F;
this.fadeStart.ButtonStepSmall = 1F;
this.fadeStart.ButtonStepsUseModifierKeys = true;
this.fadeStart.ButtonStepsWrapAround = false;
this.fadeStart.Location = new System.Drawing.Point(74, 144);
this.fadeStart.Name = "fadeStart";
this.fadeStart.Size = new System.Drawing.Size(81, 24);
this.fadeStart.StepValues = null;
this.fadeStart.TabIndex = 23;
this.fadeStart.WhenTextChanged += new System.EventHandler(this.fadeStart_WhenTextChanged);
//
// labelFadeStart
//
labelFadeStart.AutoSize = true;
labelFadeStart.Location = new System.Drawing.Point(11, 149);
labelFadeStart.Name = "labelFadeStart";
labelFadeStart.Size = new System.Drawing.Size(57, 13);
labelFadeStart.TabIndex = 22;
labelFadeStart.Text = "Fade start:";
labelFadeStart.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// fadeEnd
//
this.fadeEnd.AllowDecimal = false;
this.fadeEnd.AllowExpressions = false;
this.fadeEnd.AllowNegative = false;
this.fadeEnd.AllowRelative = false;
this.fadeEnd.ButtonStep = 1;
this.fadeEnd.ButtonStepBig = 1F;
this.fadeEnd.ButtonStepFloat = 1F;
this.fadeEnd.ButtonStepSmall = 1F;
this.fadeEnd.ButtonStepsUseModifierKeys = true;
this.fadeEnd.ButtonStepsWrapAround = false;
this.fadeEnd.Location = new System.Drawing.Point(74, 172);
this.fadeEnd.Name = "fadeEnd";
this.fadeEnd.Size = new System.Drawing.Size(81, 24);
this.fadeEnd.StepValues = null;
this.fadeEnd.TabIndex = 25;
this.fadeEnd.WhenTextChanged += new System.EventHandler(this.fadeEnd_WhenTextChanged);
//
// labelFadeEnd
//
labelFadeEnd.AutoSize = true;
labelFadeEnd.Location = new System.Drawing.Point(12, 177);
labelFadeEnd.Name = "labelFadeEnd";
labelFadeEnd.Size = new System.Drawing.Size(55, 13);
labelFadeEnd.TabIndex = 24;
labelFadeEnd.Text = "Fade end:";
labelFadeEnd.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// SectorEditFormSRB2
//
this.AcceptButton = this.apply;
@ -1250,5 +1321,7 @@
private Controls.ButtonsNumericTextbox fadeAlpha;
private System.Windows.Forms.ComboBox triggerer;
private Controls.ButtonsNumericTextbox triggerTag;
private Controls.ButtonsNumericTextbox fadeEnd;
private Controls.ButtonsNumericTextbox fadeStart;
}
}

View file

@ -59,6 +59,8 @@ namespace CodeImp.DoomBuilder.Windows
public readonly int FadeColor;
public readonly int LightAlpha;
public readonly int FadeAlpha;
public readonly int FadeStart;
public readonly int FadeEnd;
//UDMF Ceiling
public readonly double CeilOffsetX;
@ -103,6 +105,8 @@ namespace CodeImp.DoomBuilder.Windows
FadeColor = UniFields.GetInteger(s.Fields, "fadecolor", 0);
LightAlpha = UniFields.GetInteger(s.Fields, "lightalpha", General.Map.Config.MaxColormapAlpha);
FadeAlpha = UniFields.GetInteger(s.Fields, "fadealpha", General.Map.Config.MaxColormapAlpha);
FadeStart = UniFields.GetInteger(s.Fields, "fadestart", 0);
FadeEnd = UniFields.GetInteger(s.Fields, "fadeend", General.Map.Config.NumBrightnessLevels - 1);
//UDMF Ceiling
CeilOffsetX = UniFields.GetFloat(s.Fields, "xpanningceiling", 0.0);
@ -304,6 +308,8 @@ namespace CodeImp.DoomBuilder.Windows
lightColor.SetValueFrom(sc.Fields, true);
lightAlpha.Text = UniFields.GetInteger(sc.Fields, "lightalpha", General.Map.Config.MaxColormapAlpha).ToString();
fadeAlpha.Text = UniFields.GetInteger(sc.Fields, "fadealpha", General.Map.Config.MaxColormapAlpha).ToString();
fadeStart.Text = UniFields.GetInteger(sc.Fields, "fadestart", 0).ToString();
fadeEnd.Text = UniFields.GetInteger(sc.Fields, "fadeend", General.Map.Config.NumBrightnessLevels - 1).ToString();
// Slopes
SetupFloorSlope(sc, true);
@ -406,6 +412,18 @@ namespace CodeImp.DoomBuilder.Windows
if (alpha != fadeAlpha.GetResult(alpha)) fadeAlpha.Text = string.Empty;
}
if (!string.IsNullOrEmpty(fadeStart.Text))
{
int val = UniFields.GetInteger(s.Fields, "fadestart", 0);
if (val != fadeStart.GetResult(val)) fadeStart.Text = string.Empty;
}
if (!string.IsNullOrEmpty(fadeEnd.Text))
{
int val = UniFields.GetInteger(s.Fields, "fadeend", General.Map.Config.NumBrightnessLevels - 1);
if (val != fadeEnd.GetResult(val)) fadeEnd.Text = string.Empty;
}
// Slopes
SetupFloorSlope(s, false);
SetupCeilingSlope(s, false);
@ -1054,6 +1072,60 @@ namespace CodeImp.DoomBuilder.Windows
if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void fadeStart_WhenTextChanged(object sender, EventArgs e)
{
if (preventchanges) return;
MakeUndo(); //mxd
// Reset increment steps, otherwise it's just keep counting and counting
fadeStart.ResetIncrementStep();
//restore values
if (string.IsNullOrEmpty(fadeStart.Text))
{
foreach (Sector s in sectors)
UniFields.SetInteger(s.Fields, "fadestart", sectorprops[s].FadeStart, 0);
}
else //update values
{
foreach (Sector s in sectors)
{
int val = General.Clamp(fadeStart.GetResult(sectorprops[s].FadeStart), 0, General.Map.Config.NumBrightnessLevels - 2);
UniFields.SetInteger(s.Fields, "fadestart", val, 0);
}
}
General.Map.IsChanged = true;
if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void fadeEnd_WhenTextChanged(object sender, EventArgs e)
{
if (preventchanges) return;
MakeUndo(); //mxd
// Reset increment steps, otherwise it's just keep counting and counting
fadeEnd.ResetIncrementStep();
//restore values
if (string.IsNullOrEmpty(fadeEnd.Text))
{
foreach (Sector s in sectors)
UniFields.SetInteger(s.Fields, "fadeend", sectorprops[s].FadeEnd, General.Map.Config.NumBrightnessLevels - 1);
}
else //update values
{
foreach (Sector s in sectors)
{
int val = General.Clamp(fadeEnd.GetResult(sectorprops[s].FadeEnd), 1, General.Map.Config.NumBrightnessLevels - 1);
UniFields.SetInteger(s.Fields, "fadeend", val, General.Map.Config.NumBrightnessLevels - 1);
}
}
General.Map.IsChanged = true;
if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
#endregion
#region ================== Ceiling/Floor realtime events (mxd)

View file

@ -132,15 +132,6 @@
<metadata name="label16.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label16.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="resetdamagetype.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -177,32 +168,20 @@
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label15.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelLightAlpha.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelFadeAlpha.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelTriggerTag.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelTriggerer.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabcustom.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
<metadata name="labelFadeEnd.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelFadeStart.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<data name="resetfloorlight.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -232,4 +211,7 @@
b2gw2QkAAAAASUVORK5CYII=
</value>
</data>
<metadata name="tabcustom.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>