Apply config-field-based controls to SRB2 editing forms

This commit is contained in:
spherallic 2023-10-24 18:18:41 +02:00
parent aea6808cee
commit a2c0c40102
7 changed files with 488 additions and 124 deletions

View file

@ -229,20 +229,302 @@ Field data types:
*/
universalfields
{
sector
{
}
linedef
{
alpha
{
type = 1;
default = 1.0;
}
comment
{
type = 2;
default = "";
}
renderstyle
{
type = 2;
default = "";
}
}
sidedef
{
comment
{
type = 2;
default = "";
}
//light
//{
// type = 0;
// default = 0;
//}
//
//lightabsolute
//{
// type = 3;
// default = false;
//}
//
//light_top
//{
// type = 0;
// default = 0;
//}
//
//lightabsolute_top
//{
// type = 3;
// default = false;
//}
//
//light_mid
//{
// type = 0;
// default = 0;
//}
//
//lightabsolute_mid
//{
// type = 3;
// default = false;
//}
//
//light_bottom
//{
// type = 0;
// default = 0;
//}
//
//lightabsolute_bottom
//{
// type = 3;
// default = false;
//}
offsetx_bottom
{
type = 1;
default = 0.0;
}
offsetx_mid
{
type = 1;
default = 0.0;
}
offsetx_top
{
type = 1;
default = 0.0;
}
offsety_bottom
{
type = 1;
default = 0.0;
}
offsety_mid
{
type = 1;
default = 0.0;
}
offsety_top
{
type = 1;
default = 0.0;
}
//scalex_bottom
//{
// type = 1;
// default = 1.0;
//}
//
//scalex_mid
//{
// type = 1;
// default = 1.0;
//}
//
//scalex_top
//{
// type = 1;
// default = 1.0;
//}
//
//scaley_bottom
//{
// type = 1;
// default = 1.0;
//}
//
//scaley_mid
//{
// type = 1;
// default = 1.0;
//}
//
//scaley_top
//{
// type = 1;
// default = 1.0;
//}
}
thing
{
comment
{
type = 2;
default = "";
}
pitch
{
type = 0;
}
roll
{
type = 0;
}
scalex
{
type = 1;
default = 1.0;
}
scaley
{
type = 1;
default = 1.0;
}
}
sector
{
comment
{
type = 2;
default = "";
}
damagetype
{
type = 2;
default = "";
}
gravity
{
type = 1;
default = 1.0;
}
lightcolor
{
type = 0;
default = 0;
}
fadecolor
{
type = 0;
default = 0;
}
xpanningfloor
{
type = 1;
default = 0.0;
}
ypanningfloor
{
type = 1;
default = 0.0;
}
rotationfloor
{
type = 1;
default = 0.0;
}
//xscalefloor
//{
// type = 1;
// default = 1.0;
//}
//
//yscalefloor
//{
// type = 1;
// default = 1.0;
//}
lightfloor
{
type = 0;
default = 0;
}
lightfloorabsolute
{
type = 3;
default = false;
}
xpanningceiling
{
type = 1;
default = 0.0;
}
ypanningceiling
{
type = 1;
default = 0.0;
}
rotationceiling
{
type = 1;
default = 0.0;
}
//xscaleceiling
//{
// type = 1;
// default = 1.0;
//}
//
//yscaleceiling
//{
// type = 1;
// default = 1.0;
//}
lightceiling
{
type = 0;
default = 0;
}
lightceilingabsolute
{
type = 3;
default = false;
}
}
}

View file

@ -195,6 +195,7 @@ namespace CodeImp.DoomBuilder.Windows
label6.Name = "label6";
label6.Size = new System.Drawing.Size(37, 13);
label6.TabIndex = 17;
label6.Tag = "alpha";
label6.Text = "Alpha:";
//
// executordelaylabel
@ -231,6 +232,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelrenderstyle.Name = "labelrenderstyle";
this.labelrenderstyle.Size = new System.Drawing.Size(69, 13);
this.labelrenderstyle.TabIndex = 11;
this.labelrenderstyle.Tag = "renderstyle";
this.labelrenderstyle.Text = "Render style:";
//
// labelLightFront
@ -239,7 +241,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelLightFront.Name = "labelLightFront";
this.labelLightFront.Size = new System.Drawing.Size(80, 14);
this.labelLightFront.TabIndex = 25;
this.labelLightFront.Tag = "";
this.labelLightFront.Tag = "light";
this.labelLightFront.Text = "Brightness:";
this.labelLightFront.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -426,6 +428,7 @@ namespace CodeImp.DoomBuilder.Windows
this.resetalpha.Name = "resetalpha";
this.resetalpha.Size = new System.Drawing.Size(23, 23);
this.resetalpha.TabIndex = 70;
this.resetalpha.Tag = "alpha";
this.tooltip.SetToolTip(this.resetalpha, "Reset");
this.resetalpha.UseVisualStyleBackColor = true;
this.resetalpha.Click += new System.EventHandler(this.resetalpha_Click);
@ -570,7 +573,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelFrontScaleBottom.Name = "labelFrontScaleBottom";
this.labelFrontScaleBottom.Size = new System.Drawing.Size(80, 14);
this.labelFrontScaleBottom.TabIndex = 42;
this.labelFrontScaleBottom.Tag = "";
this.labelFrontScaleBottom.Tag = "scalex_bottom";
this.labelFrontScaleBottom.Text = "Lower scale:";
this.labelFrontScaleBottom.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -580,7 +583,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelFrontScaleMid.Name = "labelFrontScaleMid";
this.labelFrontScaleMid.Size = new System.Drawing.Size(80, 14);
this.labelFrontScaleMid.TabIndex = 41;
this.labelFrontScaleMid.Tag = "";
this.labelFrontScaleMid.Tag = "scalex_mid";
this.labelFrontScaleMid.Text = "Middle scale:";
this.labelFrontScaleMid.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -590,7 +593,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelFrontScaleTop.Name = "labelFrontScaleTop";
this.labelFrontScaleTop.Size = new System.Drawing.Size(80, 14);
this.labelFrontScaleTop.TabIndex = 28;
this.labelFrontScaleTop.Tag = "";
this.labelFrontScaleTop.Tag = "scalex_top";
this.labelFrontScaleTop.Text = "Upper scale:";
this.labelFrontScaleTop.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -611,6 +614,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pfcFrontScaleTop.Name = "pfcFrontScaleTop";
this.pfcFrontScaleTop.Size = new System.Drawing.Size(186, 26);
this.pfcFrontScaleTop.TabIndex = 38;
this.pfcFrontScaleTop.Tag = "scalex_top";
this.pfcFrontScaleTop.OnValuesChanged += new System.EventHandler(this.pfcFrontScaleTop_OnValuesChanged);
//
// pfcFrontScaleBottom
@ -630,6 +634,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pfcFrontScaleBottom.Name = "pfcFrontScaleBottom";
this.pfcFrontScaleBottom.Size = new System.Drawing.Size(186, 26);
this.pfcFrontScaleBottom.TabIndex = 40;
this.pfcFrontScaleBottom.Tag = "scalex_bottom";
this.pfcFrontScaleBottom.OnValuesChanged += new System.EventHandler(this.pfcFrontScaleBottom_OnValuesChanged);
//
// pfcFrontScaleMid
@ -649,6 +654,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pfcFrontScaleMid.Name = "pfcFrontScaleMid";
this.pfcFrontScaleMid.Size = new System.Drawing.Size(186, 26);
this.pfcFrontScaleMid.TabIndex = 39;
this.pfcFrontScaleMid.Tag = "scalex_mid";
this.pfcFrontScaleMid.OnValuesChanged += new System.EventHandler(this.pfcFrontScaleMid_OnValuesChanged);
//
// groupBox6
@ -684,7 +690,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelFrontOffsetBottom.Name = "labelFrontOffsetBottom";
this.labelFrontOffsetBottom.Size = new System.Drawing.Size(80, 14);
this.labelFrontOffsetBottom.TabIndex = 45;
this.labelFrontOffsetBottom.Tag = "";
this.labelFrontOffsetBottom.Tag = "offsetx_bottom";
this.labelFrontOffsetBottom.Text = "Lower offset:";
this.labelFrontOffsetBottom.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -707,7 +713,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelFrontOffsetMid.Name = "labelFrontOffsetMid";
this.labelFrontOffsetMid.Size = new System.Drawing.Size(80, 14);
this.labelFrontOffsetMid.TabIndex = 44;
this.labelFrontOffsetMid.Tag = "";
this.labelFrontOffsetMid.Tag = "offsetx_mid";
this.labelFrontOffsetMid.Text = "Middle offset:";
this.labelFrontOffsetMid.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -736,7 +742,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelFrontOffsetTop.Name = "labelFrontOffsetTop";
this.labelFrontOffsetTop.Size = new System.Drawing.Size(80, 14);
this.labelFrontOffsetTop.TabIndex = 43;
this.labelFrontOffsetTop.Tag = "";
this.labelFrontOffsetTop.Tag = "offsetx_top";
this.labelFrontOffsetTop.Text = "Upper offset:";
this.labelFrontOffsetTop.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -823,6 +829,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightfrontlower.Name = "lightfrontlower";
this.lightfrontlower.Size = new System.Drawing.Size(262, 29);
this.lightfrontlower.TabIndex = 29;
this.lightfrontlower.Tag = "light_bottom";
//
// lightfrontmiddle
//
@ -830,6 +837,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightfrontmiddle.Name = "lightfrontmiddle";
this.lightfrontmiddle.Size = new System.Drawing.Size(262, 29);
this.lightfrontmiddle.TabIndex = 29;
this.lightfrontmiddle.Tag = "light_mid";
//
// lightfrontupper
//
@ -837,6 +845,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightfrontupper.Name = "lightfrontupper";
this.lightfrontupper.Size = new System.Drawing.Size(262, 29);
this.lightfrontupper.TabIndex = 29;
this.lightfrontupper.Tag = "light_top";
//
// resetfrontlight
//
@ -845,6 +854,7 @@ namespace CodeImp.DoomBuilder.Windows
this.resetfrontlight.Name = "resetfrontlight";
this.resetfrontlight.Size = new System.Drawing.Size(23, 23);
this.resetfrontlight.TabIndex = 28;
this.resetfrontlight.Tag = "light";
this.tooltip.SetToolTip(this.resetfrontlight, "Reset Front Brightness");
this.resetfrontlight.UseVisualStyleBackColor = true;
this.resetfrontlight.Click += new System.EventHandler(this.resetfrontlight_Click);
@ -894,7 +904,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightFront.Size = new System.Drawing.Size(62, 24);
this.lightFront.StepValues = null;
this.lightFront.TabIndex = 26;
this.lightFront.Tag = "";
this.lightFront.Tag = "light";
this.lightFront.WhenTextChanged += new System.EventHandler(this.lightFront_WhenTextChanged);
//
// cbLightAbsoluteFront
@ -1032,6 +1042,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightbacklower.Name = "lightbacklower";
this.lightbacklower.Size = new System.Drawing.Size(262, 29);
this.lightbacklower.TabIndex = 32;
this.lightbacklower.Tag = "light_bottom";
//
// lightbackmiddle
//
@ -1039,6 +1050,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightbackmiddle.Name = "lightbackmiddle";
this.lightbackmiddle.Size = new System.Drawing.Size(262, 29);
this.lightbackmiddle.TabIndex = 33;
this.lightbackmiddle.Tag = "light_middle";
//
// lightbackupper
//
@ -1046,6 +1058,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightbackupper.Name = "lightbackupper";
this.lightbackupper.Size = new System.Drawing.Size(262, 29);
this.lightbackupper.TabIndex = 34;
this.lightbackupper.Tag = "light_top";
//
// resetbacklight
//
@ -1054,6 +1067,7 @@ namespace CodeImp.DoomBuilder.Windows
this.resetbacklight.Name = "resetbacklight";
this.resetbacklight.Size = new System.Drawing.Size(23, 23);
this.resetbacklight.TabIndex = 31;
this.resetbacklight.Tag = "light";
this.tooltip.SetToolTip(this.resetbacklight, "Reset Back Brightness");
this.resetbacklight.UseVisualStyleBackColor = true;
this.resetbacklight.Click += new System.EventHandler(this.resetbacklight_Click);
@ -1113,7 +1127,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelLightBack.Name = "labelLightBack";
this.labelLightBack.Size = new System.Drawing.Size(80, 14);
this.labelLightBack.TabIndex = 28;
this.labelLightBack.Tag = "";
this.labelLightBack.Tag = "light";
this.labelLightBack.Text = "Brightness:";
this.labelLightBack.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1175,7 +1189,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelBackScaleBottom.Name = "labelBackScaleBottom";
this.labelBackScaleBottom.Size = new System.Drawing.Size(80, 14);
this.labelBackScaleBottom.TabIndex = 45;
this.labelBackScaleBottom.Tag = "";
this.labelBackScaleBottom.Tag = "scalex_bottom";
this.labelBackScaleBottom.Text = "Lower scale:";
this.labelBackScaleBottom.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1185,7 +1199,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelBackScaleMid.Name = "labelBackScaleMid";
this.labelBackScaleMid.Size = new System.Drawing.Size(80, 14);
this.labelBackScaleMid.TabIndex = 44;
this.labelBackScaleMid.Tag = "";
this.labelBackScaleMid.Tag = "scalex_mid";
this.labelBackScaleMid.Text = "Middle scale:";
this.labelBackScaleMid.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1195,7 +1209,7 @@ namespace CodeImp.DoomBuilder.Windows
this.labelBackScaleTop.Name = "labelBackScaleTop";
this.labelBackScaleTop.Size = new System.Drawing.Size(80, 14);
this.labelBackScaleTop.TabIndex = 43;
this.labelBackScaleTop.Tag = "";
this.labelBackScaleTop.Tag = "scalex_top";
this.labelBackScaleTop.Text = "Upper scale:";
this.labelBackScaleTop.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1216,6 +1230,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pfcBackScaleTop.Name = "pfcBackScaleTop";
this.pfcBackScaleTop.Size = new System.Drawing.Size(186, 26);
this.pfcBackScaleTop.TabIndex = 38;
this.pfcBackScaleTop.Tag = "scalex_top";
this.pfcBackScaleTop.OnValuesChanged += new System.EventHandler(this.pfcBackScaleTop_OnValuesChanged);
//
// pfcBackScaleBottom
@ -1235,6 +1250,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pfcBackScaleBottom.Name = "pfcBackScaleBottom";
this.pfcBackScaleBottom.Size = new System.Drawing.Size(186, 26);
this.pfcBackScaleBottom.TabIndex = 40;
this.pfcBackScaleBottom.Tag = "scalex_bottom";
this.pfcBackScaleBottom.OnValuesChanged += new System.EventHandler(this.pfcBackScaleBottom_OnValuesChanged);
//
// pfcBackScaleMid
@ -1254,6 +1270,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pfcBackScaleMid.Name = "pfcBackScaleMid";
this.pfcBackScaleMid.Size = new System.Drawing.Size(186, 26);
this.pfcBackScaleMid.TabIndex = 39;
this.pfcBackScaleMid.Tag = "scalex_mid";
this.pfcBackScaleMid.OnValuesChanged += new System.EventHandler(this.pfcBackScaleMid_OnValuesChanged);
//
// groupBox1

View file

@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Controls;
@ -142,8 +143,12 @@ namespace CodeImp.DoomBuilder.Windows
// Initialize
InitializeComponent();
DoUDMFControls(tabproperties, General.Map.Config.LinedefFields);
DoUDMFControls(tabfront, General.Map.Config.SidedefFields);
DoUDMFControls(tabback, General.Map.Config.SidedefFields);
// Widow setup
if(General.Settings.StoreSelectedEditTab)
if (General.Settings.StoreSelectedEditTab)
{
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
@ -216,58 +221,6 @@ namespace CodeImp.DoomBuilder.Windows
lightbackupper.Setup(VisualModes.VisualGeometryType.WALL_UPPER);
lightbackmiddle.Setup(VisualModes.VisualGeometryType.WALL_MIDDLE);
lightbacklower.Setup(VisualModes.VisualGeometryType.WALL_LOWER);
// Disable top/mid/bottom texture offset controls?
if (!General.Map.Config.UseLocalSidedefTextureOffsets)
{
pfcFrontOffsetTop.Enabled = false;
pfcFrontOffsetMid.Enabled = false;
pfcFrontOffsetBottom.Enabled = false;
pfcBackOffsetTop.Enabled = false;
pfcBackOffsetMid.Enabled = false;
pfcBackOffsetBottom.Enabled = false;
labelFrontOffsetTop.Enabled = false;
labelFrontOffsetMid.Enabled = false;
labelFrontOffsetBottom.Enabled = false;
labelBackOffsetTop.Enabled = false;
labelBackOffsetMid.Enabled = false;
labelBackOffsetBottom.Enabled = false;
}
// Disable brightness controls?
if (!General.Map.Config.DistinctWallBrightness)
{
labelLightFront.Enabled = false;
lightFront.Enabled = false;
cbLightAbsoluteFront.Enabled = false;
resetfrontlight.Enabled = false;
labelLightBack.Enabled = false;
lightBack.Enabled = false;
cbLightAbsoluteBack.Enabled = false;
resetbacklight.Enabled = false;
}
// Disable texture scaling, for now.
pfcFrontScaleTop.Enabled = false;
pfcFrontScaleMid.Enabled = false;
pfcFrontScaleBottom.Enabled = false;
pfcBackScaleTop.Enabled = false;
pfcBackScaleMid.Enabled = false;
pfcBackScaleBottom.Enabled = false;
labelFrontScaleTop.Enabled = false;
labelFrontScaleMid.Enabled = false;
labelFrontScaleBottom.Enabled = false;
labelBackScaleTop.Enabled = false;
labelBackScaleMid.Enabled = false;
labelBackScaleBottom.Enabled = false;
}
#endregion
@ -654,6 +607,36 @@ namespace CodeImp.DoomBuilder.Windows
OnValuesChanged?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls(Control control, List<UniversalFieldInfo> info)
{
if (control.Tag is string name && !string.IsNullOrWhiteSpace(name))
{
EnableDisableControlAndChildren(control, info.Any(f => f.Name == name));
}
else
{
foreach (Control c in control.Controls)
DoUDMFControls(c, info);
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren(Control control, bool state)
{
control.Enabled = state;
foreach (Control c in control.Controls)
EnableDisableControlAndChildren(c, state);
}
#endregion
#region ================== Events

View file

@ -108,9 +108,9 @@
this.ceilOffsets = new CodeImp.DoomBuilder.Controls.PairedFieldsControl();
this.ceilingtex = new CodeImp.DoomBuilder.Controls.FlatSelectorControl();
this.tabslopes = new System.Windows.Forms.TabPage();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.gbFloorSlope = new System.Windows.Forms.GroupBox();
this.floorslopecontrol = new CodeImp.DoomBuilder.Controls.SectorSlopeControl();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.gbCeilingSlope = new System.Windows.Forms.GroupBox();
this.ceilingslopecontrol = new CodeImp.DoomBuilder.Controls.SectorSlopeControl();
this.tabcomment = new System.Windows.Forms.TabPage();
this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor();
@ -152,8 +152,8 @@
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabslopes.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox4.SuspendLayout();
this.gbFloorSlope.SuspendLayout();
this.gbCeilingSlope.SuspendLayout();
this.tabcomment.SuspendLayout();
this.tabcustom.SuspendLayout();
this.SuspendLayout();
@ -245,6 +245,7 @@
label16.Name = "label16";
label16.Size = new System.Drawing.Size(74, 14);
label16.TabIndex = 0;
label16.Tag = "damagetype";
label16.Text = "Damage:";
label16.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -294,6 +295,7 @@
label2.Name = "label2";
label2.Size = new System.Drawing.Size(74, 14);
label2.TabIndex = 5;
label2.Tag = "gravity";
label2.Text = "Gravity:";
label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -429,6 +431,7 @@
labelLightAlpha.Name = "labelLightAlpha";
labelLightAlpha.Size = new System.Drawing.Size(62, 13);
labelLightAlpha.TabIndex = 18;
labelLightAlpha.Tag = "lightcolor";
labelLightAlpha.Text = "Light alpha:";
labelLightAlpha.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -439,6 +442,7 @@
labelFadeAlpha.Name = "labelFadeAlpha";
labelFadeAlpha.Size = new System.Drawing.Size(63, 13);
labelFadeAlpha.TabIndex = 20;
labelFadeAlpha.Tag = "fadecolor";
labelFadeAlpha.Text = "Fade alpha:";
labelFadeAlpha.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -449,6 +453,7 @@
labelFadeStart.Name = "labelFadeStart";
labelFadeStart.Size = new System.Drawing.Size(57, 13);
labelFadeStart.TabIndex = 22;
labelFadeStart.Tag = "fadecolor";
labelFadeStart.Text = "Fade start:";
labelFadeStart.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -459,6 +464,7 @@
labelFadeEnd.Name = "labelFadeEnd";
labelFadeEnd.Size = new System.Drawing.Size(55, 13);
labelFadeEnd.TabIndex = 24;
labelFadeEnd.Tag = "fadecolor";
labelFadeEnd.Text = "Fade end:";
labelFadeEnd.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -514,6 +520,7 @@
this.gravity.Size = new System.Drawing.Size(81, 24);
this.gravity.StepValues = null;
this.gravity.TabIndex = 6;
this.gravity.Tag = "gravity";
//
// brightness
//
@ -699,6 +706,7 @@
this.lightColor.Name = "lightColor";
this.lightColor.Size = new System.Drawing.Size(207, 29);
this.lightColor.TabIndex = 16;
this.lightColor.Tag = "lightcolor";
this.lightColor.OnValueChanged += new System.EventHandler(this.lightColor_OnValueChanged);
//
// fadeColor
@ -710,6 +718,7 @@
this.fadeColor.Name = "fadeColor";
this.fadeColor.Size = new System.Drawing.Size(207, 31);
this.fadeColor.TabIndex = 17;
this.fadeColor.Tag = "fadecolor";
this.fadeColor.OnValueChanged += new System.EventHandler(this.fadeColor_OnValueChanged);
//
// groupBox3
@ -837,6 +846,7 @@
this.resetfloorlight.Name = "resetfloorlight";
this.resetfloorlight.Size = new System.Drawing.Size(23, 23);
this.resetfloorlight.TabIndex = 12;
this.resetfloorlight.Tag = "lightfloor";
this.tooltip.SetToolTip(this.resetfloorlight, "Reset");
this.resetfloorlight.UseVisualStyleBackColor = true;
this.resetfloorlight.Click += new System.EventHandler(this.resetfloorlight_Click);
@ -847,7 +857,7 @@
this.labelFloorOffsets.Name = "labelFloorOffsets";
this.labelFloorOffsets.Size = new System.Drawing.Size(98, 14);
this.labelFloorOffsets.TabIndex = 0;
this.labelFloorOffsets.Tag = "";
this.labelFloorOffsets.Tag = "xpanningfloor";
this.labelFloorOffsets.Text = "Texture offsets:";
this.labelFloorOffsets.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -857,7 +867,7 @@
this.labelFloorScale.Name = "labelFloorScale";
this.labelFloorScale.Size = new System.Drawing.Size(98, 14);
this.labelFloorScale.TabIndex = 2;
this.labelFloorScale.Tag = "";
this.labelFloorScale.Tag = "xscalefloor";
this.labelFloorScale.Text = "Texture scale:";
this.labelFloorScale.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -868,7 +878,7 @@
this.cbUseFloorLineAngles.Name = "cbUseFloorLineAngles";
this.cbUseFloorLineAngles.Size = new System.Drawing.Size(113, 17);
this.cbUseFloorLineAngles.TabIndex = 16;
this.cbUseFloorLineAngles.Tag = "";
this.cbUseFloorLineAngles.Tag = "rotationfloor";
this.cbUseFloorLineAngles.Text = "Use linedef angles";
this.cbUseFloorLineAngles.UseVisualStyleBackColor = true;
this.cbUseFloorLineAngles.CheckedChanged += new System.EventHandler(this.cbUseFloorLineAngles_CheckedChanged);
@ -882,6 +892,7 @@
this.floorAngleControl.Name = "floorAngleControl";
this.floorAngleControl.Size = new System.Drawing.Size(44, 44);
this.floorAngleControl.TabIndex = 13;
this.floorAngleControl.Tag = "rotationfloor";
this.floorAngleControl.AngleChanged += new System.EventHandler(this.floorAngleControl_AngleChanged);
//
// label11
@ -890,7 +901,7 @@
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(80, 14);
this.label11.TabIndex = 14;
this.label11.Tag = "";
this.label11.Tag = "rotationfloor";
this.label11.Text = "Rotation:";
this.label11.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -911,7 +922,7 @@
this.floorRotation.Size = new System.Drawing.Size(62, 24);
this.floorRotation.StepValues = null;
this.floorRotation.TabIndex = 15;
this.floorRotation.Tag = "";
this.floorRotation.Tag = "rotationfloor";
this.floorRotation.WhenTextChanged += new System.EventHandler(this.floorRotation_WhenTextChanged);
//
// floorLightAbsolute
@ -921,6 +932,7 @@
this.floorLightAbsolute.Name = "floorLightAbsolute";
this.floorLightAbsolute.Size = new System.Drawing.Size(67, 17);
this.floorLightAbsolute.TabIndex = 11;
this.floorLightAbsolute.Tag = "lightfloorabsolute";
this.floorLightAbsolute.Text = "Absolute";
this.floorLightAbsolute.UseVisualStyleBackColor = true;
this.floorLightAbsolute.CheckedChanged += new System.EventHandler(this.floorLightAbsolute_CheckedChanged);
@ -931,7 +943,7 @@
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(80, 14);
this.label12.TabIndex = 9;
this.label12.Tag = "";
this.label12.Tag = "lightfloor";
this.label12.Text = "Brightness:";
this.label12.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -972,6 +984,7 @@
this.floorScale.Name = "floorScale";
this.floorScale.Size = new System.Drawing.Size(186, 26);
this.floorScale.TabIndex = 3;
this.floorScale.Tag = "xscalefloor";
this.floorScale.OnValuesChanged += new System.EventHandler(this.floorScale_OnValuesChanged);
//
// floorOffsets
@ -991,6 +1004,7 @@
this.floorOffsets.Name = "floorOffsets";
this.floorOffsets.Size = new System.Drawing.Size(186, 26);
this.floorOffsets.TabIndex = 1;
this.floorOffsets.Tag = "xpanningfloor";
this.floorOffsets.OnValuesChanged += new System.EventHandler(this.floorOffsets_OnValuesChanged);
//
// floortex
@ -1034,6 +1048,7 @@
this.resetceillight.Name = "resetceillight";
this.resetceillight.Size = new System.Drawing.Size(23, 23);
this.resetceillight.TabIndex = 12;
this.resetceillight.Tag = "lightceiling";
this.tooltip.SetToolTip(this.resetceillight, "Reset");
this.resetceillight.UseVisualStyleBackColor = true;
this.resetceillight.Click += new System.EventHandler(this.resetceillight_Click);
@ -1044,7 +1059,7 @@
this.labelCeilOffsets.Name = "labelCeilOffsets";
this.labelCeilOffsets.Size = new System.Drawing.Size(98, 14);
this.labelCeilOffsets.TabIndex = 0;
this.labelCeilOffsets.Tag = "";
this.labelCeilOffsets.Tag = "xpanningceiling";
this.labelCeilOffsets.Text = "Texture offsets:";
this.labelCeilOffsets.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1054,7 +1069,7 @@
this.labelCeilScale.Name = "labelCeilScale";
this.labelCeilScale.Size = new System.Drawing.Size(98, 14);
this.labelCeilScale.TabIndex = 2;
this.labelCeilScale.Tag = "";
this.labelCeilScale.Tag = "xscaleceiling";
this.labelCeilScale.Text = "Texture scale:";
this.labelCeilScale.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1065,7 +1080,7 @@
this.cbUseCeilLineAngles.Name = "cbUseCeilLineAngles";
this.cbUseCeilLineAngles.Size = new System.Drawing.Size(113, 17);
this.cbUseCeilLineAngles.TabIndex = 16;
this.cbUseCeilLineAngles.Tag = "";
this.cbUseCeilLineAngles.Tag = "rotationceiling";
this.cbUseCeilLineAngles.Text = "Use linedef angles";
this.cbUseCeilLineAngles.UseVisualStyleBackColor = true;
this.cbUseCeilLineAngles.CheckedChanged += new System.EventHandler(this.cbUseCeilLineAngles_CheckedChanged);
@ -1079,6 +1094,7 @@
this.ceilAngleControl.Name = "ceilAngleControl";
this.ceilAngleControl.Size = new System.Drawing.Size(44, 44);
this.ceilAngleControl.TabIndex = 13;
this.ceilAngleControl.Tag = "rotationceiling";
this.ceilAngleControl.AngleChanged += new System.EventHandler(this.ceilAngleControl_AngleChanged);
//
// label1
@ -1087,7 +1103,7 @@
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 14);
this.label1.TabIndex = 14;
this.label1.Tag = "";
this.label1.Tag = "rotationceiling";
this.label1.Text = "Rotation:";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1108,7 +1124,7 @@
this.ceilRotation.Size = new System.Drawing.Size(62, 24);
this.ceilRotation.StepValues = null;
this.ceilRotation.TabIndex = 15;
this.ceilRotation.Tag = "";
this.ceilRotation.Tag = "rotationceiling";
this.ceilRotation.WhenTextChanged += new System.EventHandler(this.ceilRotation_WhenTextChanged);
//
// ceilLightAbsolute
@ -1118,7 +1134,7 @@
this.ceilLightAbsolute.Name = "ceilLightAbsolute";
this.ceilLightAbsolute.Size = new System.Drawing.Size(67, 17);
this.ceilLightAbsolute.TabIndex = 11;
this.ceilLightAbsolute.Tag = "";
this.ceilLightAbsolute.Tag = "lightceilingabsolute";
this.ceilLightAbsolute.Text = "Absolute";
this.ceilLightAbsolute.UseVisualStyleBackColor = true;
this.ceilLightAbsolute.CheckedChanged += new System.EventHandler(this.ceilLightAbsolute_CheckedChanged);
@ -1129,7 +1145,7 @@
this.labelLightFront.Name = "labelLightFront";
this.labelLightFront.Size = new System.Drawing.Size(80, 14);
this.labelLightFront.TabIndex = 9;
this.labelLightFront.Tag = "";
this.labelLightFront.Tag = "lightceiling";
this.labelLightFront.Text = "Brightness:";
this.labelLightFront.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -1170,6 +1186,7 @@
this.ceilScale.Name = "ceilScale";
this.ceilScale.Size = new System.Drawing.Size(186, 26);
this.ceilScale.TabIndex = 3;
this.ceilScale.Tag = "xscaleceiling";
this.ceilScale.OnValuesChanged += new System.EventHandler(this.ceilScale_OnValuesChanged);
//
// ceilOffsets
@ -1189,6 +1206,7 @@
this.ceilOffsets.Name = "ceilOffsets";
this.ceilOffsets.Size = new System.Drawing.Size(186, 26);
this.ceilOffsets.TabIndex = 1;
this.ceilOffsets.Tag = "xpanningceiling";
this.ceilOffsets.OnValuesChanged += new System.EventHandler(this.ceilOffsets_OnValuesChanged);
//
// ceilingtex
@ -1203,8 +1221,8 @@
//
// tabslopes
//
this.tabslopes.Controls.Add(this.groupBox5);
this.tabslopes.Controls.Add(this.groupBox4);
this.tabslopes.Controls.Add(this.gbFloorSlope);
this.tabslopes.Controls.Add(this.gbCeilingSlope);
this.tabslopes.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabslopes.Location = new System.Drawing.Point(4, 22);
this.tabslopes.Name = "tabslopes";
@ -1213,15 +1231,15 @@
this.tabslopes.Text = "Slopes";
this.tabslopes.UseVisualStyleBackColor = true;
//
// groupBox5
// gbFloorSlope
//
this.groupBox5.Controls.Add(this.floorslopecontrol);
this.groupBox5.Location = new System.Drawing.Point(3, 261);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(298, 266);
this.groupBox5.TabIndex = 1;
this.groupBox5.TabStop = false;
this.groupBox5.Text = " Floor slope ";
this.gbFloorSlope.Controls.Add(this.floorslopecontrol);
this.gbFloorSlope.Location = new System.Drawing.Point(3, 261);
this.gbFloorSlope.Name = "gbFloorSlope";
this.gbFloorSlope.Size = new System.Drawing.Size(298, 266);
this.gbFloorSlope.TabIndex = 1;
this.gbFloorSlope.TabStop = false;
this.gbFloorSlope.Text = " Floor slope ";
//
// floorslopecontrol
//
@ -1235,15 +1253,15 @@
this.floorslopecontrol.OnPivotModeChanged += new System.EventHandler(this.floorslopecontrol_OnPivotModeChanged);
this.floorslopecontrol.OnResetClicked += new System.EventHandler(this.floorslopecontrol_OnResetClicked);
//
// groupBox4
// gbCeilingSlope
//
this.groupBox4.Controls.Add(this.ceilingslopecontrol);
this.groupBox4.Location = new System.Drawing.Point(3, 3);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(298, 252);
this.groupBox4.TabIndex = 0;
this.groupBox4.TabStop = false;
this.groupBox4.Text = " Ceiling slope ";
this.gbCeilingSlope.Controls.Add(this.ceilingslopecontrol);
this.gbCeilingSlope.Location = new System.Drawing.Point(3, 3);
this.gbCeilingSlope.Name = "gbCeilingSlope";
this.gbCeilingSlope.Size = new System.Drawing.Size(298, 252);
this.gbCeilingSlope.TabIndex = 0;
this.gbCeilingSlope.TabStop = false;
this.gbCeilingSlope.Text = " Ceiling slope ";
//
// ceilingslopecontrol
//
@ -1379,8 +1397,8 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tabslopes.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.gbFloorSlope.ResumeLayout(false);
this.gbCeilingSlope.ResumeLayout(false);
this.tabcomment.ResumeLayout(false);
this.tabcustom.ResumeLayout(false);
this.ResumeLayout(false);
@ -1427,8 +1445,8 @@
private System.Windows.Forms.CheckBox cbUseFloorLineAngles;
private System.Windows.Forms.CheckBox cbUseCeilLineAngles;
private System.Windows.Forms.TabPage tabslopes;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox gbFloorSlope;
private System.Windows.Forms.GroupBox gbCeilingSlope;
private CodeImp.DoomBuilder.Controls.SectorSlopeControl floorslopecontrol;
private CodeImp.DoomBuilder.Controls.SectorSlopeControl ceilingslopecontrol;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox heightoffset;

View file

@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Geometry;
@ -168,8 +169,14 @@ namespace CodeImp.DoomBuilder.Windows
{
InitializeComponent();
DoUDMFControls(this);
// Plane equation slopes are handled internally instead through the UDMF fields, so they need special attention
EnableDisableControlAndChildren(gbCeilingSlope, General.Map.Config.PlaneEquationSupport);
EnableDisableControlAndChildren(gbFloorSlope, General.Map.Config.PlaneEquationSupport);
//mxd. Load settings
if(General.Settings.StoreSelectedEditTab)
if (General.Settings.StoreSelectedEditTab)
{
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
tabs.SelectTab(activetab);
@ -240,21 +247,6 @@ namespace CodeImp.DoomBuilder.Windows
ceilingslopecontrol.PivotMode = (SlopePivotMode)General.Settings.ReadSetting("windows." + configname + ".ceilpivotmode", (int)SlopePivotMode.LOCAL);
floorslopecontrol.PivotMode = (SlopePivotMode)General.Settings.ReadSetting("windows." + configname + ".floorpivotmode", (int)SlopePivotMode.LOCAL);
// Diable brightness controls?
if(!General.Map.Config.DistinctFloorAndCeilingBrightness)
{
ceilBrightness.Enabled = false;
ceilLightAbsolute.Enabled = false;
resetceillight.Enabled = false;
floorBrightness.Enabled = false;
floorLightAbsolute.Enabled = false;
resetfloorlight.Enabled = false;
}
ceilScale.Enabled = false;
floorScale.Enabled = false;
}
#endregion
@ -690,6 +682,36 @@ namespace CodeImp.DoomBuilder.Windows
}
}
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls(Control control)
{
if (control.Tag is string name && !string.IsNullOrWhiteSpace(name))
{
EnableDisableControlAndChildren(control, General.Map.Config.SectorFields.Any(f => f.Name == name));
}
else
{
foreach (Control c in control.Controls)
DoUDMFControls(c);
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren(Control control, bool state)
{
control.Enabled = state;
foreach (Control c in control.Controls)
EnableDisableControlAndChildren(c, state);
}
#endregion
#region ================== Events

View file

@ -143,6 +143,7 @@
this.cbrandomroll.Name = "cbrandomroll";
this.cbrandomroll.Size = new System.Drawing.Size(66, 17);
this.cbrandomroll.TabIndex = 5;
this.cbrandomroll.Tag = "roll";
this.cbrandomroll.Text = "Random";
this.cbrandomroll.UseVisualStyleBackColor = true;
this.cbrandomroll.CheckedChanged += new System.EventHandler(this.cbrandomroll_CheckedChanged);
@ -154,6 +155,7 @@
this.cbrandompitch.Name = "cbrandompitch";
this.cbrandompitch.Size = new System.Drawing.Size(66, 17);
this.cbrandompitch.TabIndex = 3;
this.cbrandompitch.Tag = "pitch";
this.cbrandompitch.Text = "Random";
this.cbrandompitch.UseVisualStyleBackColor = true;
this.cbrandompitch.CheckedChanged += new System.EventHandler(this.cbrandompitch_CheckedChanged);
@ -186,6 +188,7 @@
this.roll.Size = new System.Drawing.Size(60, 24);
this.roll.StepValues = null;
this.roll.TabIndex = 4;
this.roll.Tag = "roll";
this.roll.WhenTextChanged += new System.EventHandler(this.roll_WhenTextChanged);
//
// labelroll
@ -214,6 +217,7 @@
this.pitch.Size = new System.Drawing.Size(60, 24);
this.pitch.StepValues = null;
this.pitch.TabIndex = 2;
this.pitch.Tag = "pitch";
this.pitch.WhenTextChanged += new System.EventHandler(this.pitch_WhenTextChanged);
//
// labelpitch
@ -355,6 +359,7 @@
this.rollControl.Name = "rollControl";
this.rollControl.Size = new System.Drawing.Size(64, 64);
this.rollControl.TabIndex = 20;
this.rollControl.Tag = "roll";
this.rollControl.AngleChanged += new System.EventHandler(this.rollControl_AngleChanged);
//
// grouppitch
@ -376,6 +381,7 @@
this.pitchControl.Name = "pitchControl";
this.pitchControl.Size = new System.Drawing.Size(64, 64);
this.pitchControl.TabIndex = 20;
this.pitchControl.Tag = "pitch";
this.pitchControl.AngleChanged += new System.EventHandler(this.pitchControl_AngleChanged);
//
// groupangle
@ -530,6 +536,7 @@
this.labelScale.Name = "labelScale";
this.labelScale.Size = new System.Drawing.Size(80, 14);
this.labelScale.TabIndex = 32;
this.labelScale.Tag = "scalex";
this.labelScale.Text = "Scale:";
this.labelScale.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
@ -551,6 +558,7 @@
this.scale.Size = new System.Drawing.Size(72, 24);
this.scale.StepValues = null;
this.scale.TabIndex = 0;
this.scale.Tag = "scalex";
this.scale.WhenTextChanged += new System.EventHandler(this.scale_WhenTextChanged);
//
// actiongroup

View file

@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Controls;
@ -93,6 +94,8 @@ namespace CodeImp.DoomBuilder.Windows
// Initialize
InitializeComponent();
DoUDMFControls(this);
//mxd. Load settings
useabsoluteheight = General.Settings.ReadSetting("windows." + configname + ".useabsoluteheight", false);
@ -361,6 +364,37 @@ namespace CodeImp.DoomBuilder.Windows
flagsrename = newflagsrename;
}
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls(Control control)
{
if (control.Tag is string name && !string.IsNullOrWhiteSpace(name))
{
//EnableDisableControlAndChildren(control, General.Map.Config.HasUniversalFieldOrFlag<Thing>(name));
EnableDisableControlAndChildren(control, General.Map.Config.ThingFields.Any(f => f.Name == name));
}
else
{
foreach (Control c in control.Controls)
DoUDMFControls(c);
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren(Control control, bool state)
{
control.Enabled = state;
foreach (Control c in control.Controls)
EnableDisableControlAndChildren(c, state);
}
#endregion
#region ================== Events