diff --git a/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs b/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs index fd77c4d9..cb4df3b6 100644 --- a/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs +++ b/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs @@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.Windows System.Windows.Forms.Label labelRepeatcntBack; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LinedefEditFormSRB2)); this.labelrenderstyle = new System.Windows.Forms.Label(); + this.labelLightFront = new System.Windows.Forms.Label(); this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.actiongroup = new System.Windows.Forms.GroupBox(); @@ -79,8 +80,14 @@ namespace CodeImp.DoomBuilder.Windows this.pfcFrontOffsetBottom = new CodeImp.DoomBuilder.Controls.PairedFieldsControl(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.repeatcntFront = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.lightfrontlower = new CodeImp.DoomBuilder.Controls.SidedefPartLightControl(); + this.lightfrontmiddle = new CodeImp.DoomBuilder.Controls.SidedefPartLightControl(); + this.lightfrontupper = new CodeImp.DoomBuilder.Controls.SidedefPartLightControl(); + this.resetfrontlight = new System.Windows.Forms.Button(); this.frontsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.customfrontbutton = new System.Windows.Forms.Button(); + this.lightFront = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.cbLightAbsoluteFront = new System.Windows.Forms.CheckBox(); this.frontlow = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); this.frontmid = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); this.fronthigh = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); @@ -89,8 +96,15 @@ namespace CodeImp.DoomBuilder.Windows this.backgroup = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.repeatcntBack = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.lightbacklower = new CodeImp.DoomBuilder.Controls.SidedefPartLightControl(); + this.lightbackmiddle = new CodeImp.DoomBuilder.Controls.SidedefPartLightControl(); + this.lightbackupper = new CodeImp.DoomBuilder.Controls.SidedefPartLightControl(); + this.resetbacklight = new System.Windows.Forms.Button(); this.backsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.custombackbutton = new System.Windows.Forms.Button(); + this.lightBack = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.labelLightBack = new System.Windows.Forms.Label(); + this.cbLightAbsoluteBack = new System.Windows.Forms.CheckBox(); this.backflagsgroup = new System.Windows.Forms.GroupBox(); this.flagsBack = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl(); this.backscalegroup = new System.Windows.Forms.GroupBox(); @@ -219,6 +233,16 @@ namespace CodeImp.DoomBuilder.Windows this.labelrenderstyle.TabIndex = 11; this.labelrenderstyle.Text = "Render style:"; // + // labelLightFront + // + this.labelLightFront.Location = new System.Drawing.Point(15, 53); + this.labelLightFront.Name = "labelLightFront"; + this.labelLightFront.Size = new System.Drawing.Size(80, 14); + this.labelLightFront.TabIndex = 25; + this.labelLightFront.Tag = ""; + this.labelLightFront.Text = "Brightness:"; + this.labelLightFront.TextAlign = System.Drawing.ContentAlignment.TopRight; + // // cancel // this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -285,7 +309,6 @@ namespace CodeImp.DoomBuilder.Windows this.argscontrol.Name = "argscontrol"; this.argscontrol.Size = new System.Drawing.Size(521, 173); this.argscontrol.TabIndex = 11; - this.argscontrol.Load += new System.EventHandler(this.argscontrol_Load); // // actionhelp // @@ -759,12 +782,19 @@ namespace CodeImp.DoomBuilder.Windows // this.groupBox5.Controls.Add(this.repeatcntFront); this.groupBox5.Controls.Add(labelRepeatcntFront); + this.groupBox5.Controls.Add(this.lightfrontlower); + this.groupBox5.Controls.Add(this.lightfrontmiddle); + this.groupBox5.Controls.Add(this.lightfrontupper); + this.groupBox5.Controls.Add(this.resetfrontlight); this.groupBox5.Controls.Add(this.frontsector); this.groupBox5.Controls.Add(label11); this.groupBox5.Controls.Add(this.customfrontbutton); + this.groupBox5.Controls.Add(this.lightFront); + this.groupBox5.Controls.Add(this.labelLightFront); + this.groupBox5.Controls.Add(this.cbLightAbsoluteFront); this.groupBox5.Location = new System.Drawing.Point(12, 19); this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(290, 117); + this.groupBox5.Size = new System.Drawing.Size(290, 203); this.groupBox5.TabIndex = 42; this.groupBox5.TabStop = false; // @@ -787,6 +817,38 @@ namespace CodeImp.DoomBuilder.Windows this.repeatcntFront.TabIndex = 74; this.repeatcntFront.WhenTextChanged += new System.EventHandler(this.repeatcntFront_WhenTextChanged); // + // lightfrontlower + // + this.lightfrontlower.Location = new System.Drawing.Point(0, 137); + this.lightfrontlower.Name = "lightfrontlower"; + this.lightfrontlower.Size = new System.Drawing.Size(262, 29); + this.lightfrontlower.TabIndex = 29; + // + // lightfrontmiddle + // + this.lightfrontmiddle.Location = new System.Drawing.Point(0, 107); + this.lightfrontmiddle.Name = "lightfrontmiddle"; + this.lightfrontmiddle.Size = new System.Drawing.Size(262, 29); + this.lightfrontmiddle.TabIndex = 29; + // + // lightfrontupper + // + this.lightfrontupper.Location = new System.Drawing.Point(0, 77); + this.lightfrontupper.Name = "lightfrontupper"; + this.lightfrontupper.Size = new System.Drawing.Size(262, 29); + this.lightfrontupper.TabIndex = 29; + // + // resetfrontlight + // + this.resetfrontlight.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset; + this.resetfrontlight.Location = new System.Drawing.Point(236, 50); + this.resetfrontlight.Name = "resetfrontlight"; + this.resetfrontlight.Size = new System.Drawing.Size(23, 23); + this.resetfrontlight.TabIndex = 28; + this.tooltip.SetToolTip(this.resetfrontlight, "Reset Front Brightness"); + this.resetfrontlight.UseVisualStyleBackColor = true; + this.resetfrontlight.Click += new System.EventHandler(this.resetfrontlight_Click); + // // frontsector // this.frontsector.AllowDecimal = false; @@ -807,7 +869,7 @@ namespace CodeImp.DoomBuilder.Windows // // customfrontbutton // - this.customfrontbutton.Location = new System.Drawing.Point(96, 79); + this.customfrontbutton.Location = new System.Drawing.Point(96, 170); this.customfrontbutton.Name = "customfrontbutton"; this.customfrontbutton.Size = new System.Drawing.Size(130, 25); this.customfrontbutton.TabIndex = 3; @@ -815,6 +877,38 @@ namespace CodeImp.DoomBuilder.Windows this.customfrontbutton.UseVisualStyleBackColor = true; this.customfrontbutton.Click += new System.EventHandler(this.customfrontbutton_Click); // + // lightFront + // + this.lightFront.AllowDecimal = false; + this.lightFront.AllowExpressions = false; + this.lightFront.AllowNegative = true; + this.lightFront.AllowRelative = true; + this.lightFront.ButtonStep = 16; + this.lightFront.ButtonStepBig = 32F; + this.lightFront.ButtonStepFloat = 1F; + this.lightFront.ButtonStepSmall = 1F; + this.lightFront.ButtonStepsUseModifierKeys = true; + this.lightFront.ButtonStepsWrapAround = false; + this.lightFront.Location = new System.Drawing.Point(99, 49); + this.lightFront.Name = "lightFront"; + this.lightFront.Size = new System.Drawing.Size(62, 24); + this.lightFront.StepValues = null; + this.lightFront.TabIndex = 26; + this.lightFront.Tag = ""; + this.lightFront.WhenTextChanged += new System.EventHandler(this.lightFront_WhenTextChanged); + // + // cbLightAbsoluteFront + // + this.cbLightAbsoluteFront.AutoSize = true; + this.cbLightAbsoluteFront.Location = new System.Drawing.Point(167, 54); + this.cbLightAbsoluteFront.Name = "cbLightAbsoluteFront"; + this.cbLightAbsoluteFront.Size = new System.Drawing.Size(67, 17); + this.cbLightAbsoluteFront.TabIndex = 27; + this.cbLightAbsoluteFront.Tag = "lightabsolute"; + this.cbLightAbsoluteFront.Text = "Absolute"; + this.cbLightAbsoluteFront.UseVisualStyleBackColor = true; + this.cbLightAbsoluteFront.CheckedChanged += new System.EventHandler(this.cbLightAbsoluteFront_CheckedChanged); + // // frontlow // this.frontlow.Location = new System.Drawing.Point(309, 409); @@ -897,12 +991,19 @@ namespace CodeImp.DoomBuilder.Windows // this.groupBox4.Controls.Add(this.repeatcntBack); this.groupBox4.Controls.Add(labelRepeatcntBack); + this.groupBox4.Controls.Add(this.lightbacklower); + this.groupBox4.Controls.Add(this.lightbackmiddle); + this.groupBox4.Controls.Add(this.lightbackupper); + this.groupBox4.Controls.Add(this.resetbacklight); this.groupBox4.Controls.Add(this.backsector); this.groupBox4.Controls.Add(label12); this.groupBox4.Controls.Add(this.custombackbutton); + this.groupBox4.Controls.Add(this.lightBack); + this.groupBox4.Controls.Add(this.labelLightBack); + this.groupBox4.Controls.Add(this.cbLightAbsoluteBack); this.groupBox4.Location = new System.Drawing.Point(12, 19); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(290, 117); + this.groupBox4.Size = new System.Drawing.Size(290, 203); this.groupBox4.TabIndex = 46; this.groupBox4.TabStop = false; // @@ -925,6 +1026,38 @@ namespace CodeImp.DoomBuilder.Windows this.repeatcntBack.TabIndex = 76; this.repeatcntBack.WhenTextChanged += new System.EventHandler(this.repeatcntBack_WhenTextChanged); // + // lightbacklower + // + this.lightbacklower.Location = new System.Drawing.Point(0, 137); + this.lightbacklower.Name = "lightbacklower"; + this.lightbacklower.Size = new System.Drawing.Size(262, 29); + this.lightbacklower.TabIndex = 32; + // + // lightbackmiddle + // + this.lightbackmiddle.Location = new System.Drawing.Point(0, 107); + this.lightbackmiddle.Name = "lightbackmiddle"; + this.lightbackmiddle.Size = new System.Drawing.Size(262, 29); + this.lightbackmiddle.TabIndex = 33; + // + // lightbackupper + // + this.lightbackupper.Location = new System.Drawing.Point(0, 77); + this.lightbackupper.Name = "lightbackupper"; + this.lightbackupper.Size = new System.Drawing.Size(262, 29); + this.lightbackupper.TabIndex = 34; + // + // resetbacklight + // + this.resetbacklight.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset; + this.resetbacklight.Location = new System.Drawing.Point(236, 50); + this.resetbacklight.Name = "resetbacklight"; + this.resetbacklight.Size = new System.Drawing.Size(23, 23); + this.resetbacklight.TabIndex = 31; + this.tooltip.SetToolTip(this.resetbacklight, "Reset Back Brightness"); + this.resetbacklight.UseVisualStyleBackColor = true; + this.resetbacklight.Click += new System.EventHandler(this.resetbacklight_Click); + // // backsector // this.backsector.AllowDecimal = false; @@ -945,7 +1078,8 @@ namespace CodeImp.DoomBuilder.Windows // // custombackbutton // - this.custombackbutton.Location = new System.Drawing.Point(96, 79); + this.custombackbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.custombackbutton.Location = new System.Drawing.Point(96, 170); this.custombackbutton.Name = "custombackbutton"; this.custombackbutton.Size = new System.Drawing.Size(130, 25); this.custombackbutton.TabIndex = 3; @@ -953,12 +1087,54 @@ namespace CodeImp.DoomBuilder.Windows this.custombackbutton.UseVisualStyleBackColor = true; this.custombackbutton.Click += new System.EventHandler(this.custombackbutton_Click); // + // lightBack + // + this.lightBack.AllowDecimal = false; + this.lightBack.AllowExpressions = false; + this.lightBack.AllowNegative = true; + this.lightBack.AllowRelative = true; + this.lightBack.ButtonStep = 1; + this.lightBack.ButtonStepBig = 16F; + this.lightBack.ButtonStepFloat = 1F; + this.lightBack.ButtonStepSmall = 1F; + this.lightBack.ButtonStepsUseModifierKeys = true; + this.lightBack.ButtonStepsWrapAround = false; + this.lightBack.Location = new System.Drawing.Point(99, 49); + this.lightBack.Name = "lightBack"; + this.lightBack.Size = new System.Drawing.Size(62, 24); + this.lightBack.StepValues = null; + this.lightBack.TabIndex = 29; + this.lightBack.Tag = "light"; + this.lightBack.WhenTextChanged += new System.EventHandler(this.lightBack_WhenTextChanged); + // + // labelLightBack + // + this.labelLightBack.Location = new System.Drawing.Point(15, 53); + this.labelLightBack.Name = "labelLightBack"; + this.labelLightBack.Size = new System.Drawing.Size(80, 14); + this.labelLightBack.TabIndex = 28; + this.labelLightBack.Tag = ""; + this.labelLightBack.Text = "Brightness:"; + this.labelLightBack.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // cbLightAbsoluteBack + // + this.cbLightAbsoluteBack.AutoSize = true; + this.cbLightAbsoluteBack.Location = new System.Drawing.Point(167, 54); + this.cbLightAbsoluteBack.Name = "cbLightAbsoluteBack"; + this.cbLightAbsoluteBack.Size = new System.Drawing.Size(67, 17); + this.cbLightAbsoluteBack.TabIndex = 30; + this.cbLightAbsoluteBack.Tag = "lightabsolute"; + this.cbLightAbsoluteBack.Text = "Absolute"; + this.cbLightAbsoluteBack.UseVisualStyleBackColor = true; + this.cbLightAbsoluteBack.CheckedChanged += new System.EventHandler(this.cbLightAbsoluteBack_CheckedChanged); + // // backflagsgroup // this.backflagsgroup.Controls.Add(this.flagsBack); - this.backflagsgroup.Location = new System.Drawing.Point(12, 409); + this.backflagsgroup.Location = new System.Drawing.Point(12, 490); this.backflagsgroup.Name = "backflagsgroup"; - this.backflagsgroup.Size = new System.Drawing.Size(290, 190); + this.backflagsgroup.Size = new System.Drawing.Size(290, 9); this.backflagsgroup.TabIndex = 45; this.backflagsgroup.TabStop = false; this.backflagsgroup.Text = " Flags "; @@ -973,7 +1149,7 @@ namespace CodeImp.DoomBuilder.Windows this.flagsBack.Columns = 2; this.flagsBack.Location = new System.Drawing.Point(16, 16); this.flagsBack.Name = "flagsBack"; - this.flagsBack.Size = new System.Drawing.Size(269, 168); + this.flagsBack.Size = new System.Drawing.Size(269, 87); this.flagsBack.TabIndex = 1; this.flagsBack.VerticalSpacing = 3; this.flagsBack.OnValueChanged += new System.EventHandler(this.flagsBack_OnValueChanged); @@ -986,7 +1162,7 @@ namespace CodeImp.DoomBuilder.Windows this.backscalegroup.Controls.Add(this.pfcBackScaleTop); this.backscalegroup.Controls.Add(this.pfcBackScaleBottom); this.backscalegroup.Controls.Add(this.pfcBackScaleMid); - this.backscalegroup.Location = new System.Drawing.Point(12, 291); + this.backscalegroup.Location = new System.Drawing.Point(12, 377); this.backscalegroup.Name = "backscalegroup"; this.backscalegroup.Size = new System.Drawing.Size(290, 112); this.backscalegroup.TabIndex = 44; @@ -1090,7 +1266,7 @@ namespace CodeImp.DoomBuilder.Windows this.groupBox1.Controls.Add(this.pfcBackOffsetMid); this.groupBox1.Controls.Add(this.pfcBackOffsetBottom); this.groupBox1.Controls.Add(this.backTextureOffset); - this.groupBox1.Location = new System.Drawing.Point(12, 142); + this.groupBox1.Location = new System.Drawing.Point(12, 228); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(290, 143); this.groupBox1.TabIndex = 43; @@ -1381,6 +1557,8 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Button custombackbutton; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox frontsector; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backsector; + private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox lightFront; + private System.Windows.Forms.CheckBox cbLightAbsoluteFront; private CodeImp.DoomBuilder.Controls.PairedFieldsControl pfcFrontOffsetTop; private CodeImp.DoomBuilder.Controls.PairedFieldsControl pfcFrontOffsetBottom; private CodeImp.DoomBuilder.Controls.PairedFieldsControl pfcFrontOffsetMid; @@ -1395,6 +1573,10 @@ namespace CodeImp.DoomBuilder.Windows private CodeImp.DoomBuilder.Controls.PairedFieldsControl pfcBackOffsetTop; private System.Windows.Forms.GroupBox groupsettings; private System.Windows.Forms.ComboBox renderStyle; + private System.Windows.Forms.Label labelLightFront; + private System.Windows.Forms.CheckBox cbLightAbsoluteBack; + private System.Windows.Forms.Label labelLightBack; + private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox lightBack; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox alpha; private CodeImp.DoomBuilder.Controls.PairedIntControl frontTextureOffset; private CodeImp.DoomBuilder.Controls.PairedIntControl backTextureOffset; @@ -1431,7 +1613,15 @@ namespace CodeImp.DoomBuilder.Windows private CodeImp.DoomBuilder.Controls.CommentEditor commenteditor; private CodeImp.DoomBuilder.Controls.ArgumentsControlSRB2 argscontrol; private CodeImp.DoomBuilder.Controls.TagsSelector tagsselector; + private System.Windows.Forms.Button resetfrontlight; + private System.Windows.Forms.Button resetbacklight; private System.Windows.Forms.Button resetalpha; + private Controls.SidedefPartLightControl lightfrontupper; + private Controls.SidedefPartLightControl lightfrontlower; + private Controls.SidedefPartLightControl lightfrontmiddle; + private Controls.SidedefPartLightControl lightbacklower; + private Controls.SidedefPartLightControl lightbackmiddle; + private Controls.SidedefPartLightControl lightbackupper; private Controls.ButtonsNumericTextbox executordelay; private Controls.ButtonsNumericTextbox repeatcntFront; private Controls.ButtonsNumericTextbox repeatcntBack; diff --git a/Source/Core/Windows/LinedefEditFormSRB2.cs b/Source/Core/Windows/LinedefEditFormSRB2.cs index d8952021..8f5c4061 100644 --- a/Source/Core/Windows/LinedefEditFormSRB2.cs +++ b/Source/Core/Windows/LinedefEditFormSRB2.cs @@ -207,6 +207,16 @@ namespace CodeImp.DoomBuilder.Windows pfcBackScaleMid.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkbackmidscale", false); pfcBackScaleBottom.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkbackbottomscale", false); + // Upper/middle/lower brightness of front sidedef + lightfrontupper.Setup(VisualModes.VisualGeometryType.WALL_UPPER); + lightfrontmiddle.Setup(VisualModes.VisualGeometryType.WALL_MIDDLE); + lightfrontlower.Setup(VisualModes.VisualGeometryType.WALL_LOWER); + + // Upper/middle/lower brightness of back sidedef + 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) { @@ -226,6 +236,18 @@ namespace CodeImp.DoomBuilder.Windows labelBackOffsetMid.Enabled = false; labelBackOffsetBottom.Enabled = false; } + + // Diable brightness controls? + if (!General.Map.Config.DistinctWallBrightness) + { + lightFront.Enabled = false; + cbLightAbsoluteFront.Enabled = false; + resetfrontlight.Enabled = false; + + lightBack.Enabled = false; + cbLightAbsoluteBack.Enabled = false; + resetbacklight.Enabled = false; + } } #endregion @@ -312,9 +334,17 @@ namespace CodeImp.DoomBuilder.Windows pfc.SetValuesFrom(fl.Front.Fields, true); repeatcntFront.Text = UniFields.GetInteger(fl.Front.Fields, "repeatcnt", 0).ToString(); + + lightFront.Text = UniFields.GetInteger(fl.Front.Fields, "light", 0).ToString(); + cbLightAbsoluteFront.Checked = fl.Front.Fields.GetValue("lightabsolute", false); frontTextureOffset.SetValues(fl.Front.OffsetX, fl.Front.OffsetY, true); //mxd + // Upper/middle/lower brightness of front sidedef + lightfrontupper.SetValues(fl.Front, true); + lightfrontmiddle.SetValues(fl.Front, true); + lightfrontlower.SetValues(fl.Front, true); + } // Back settings @@ -338,7 +368,15 @@ namespace CodeImp.DoomBuilder.Windows repeatcntBack.Text = UniFields.GetInteger(fl.Back.Fields, "repeatcnt", 0).ToString(); + lightBack.Text = UniFields.GetInteger(fl.Back.Fields, "light", 0).ToString(); + cbLightAbsoluteBack.Checked = fl.Back.Fields.GetValue("lightabsolute", false); + backTextureOffset.SetValues(fl.Back.OffsetX, fl.Back.OffsetY, true); //mxd + + // Upper/middle/lower brightness of back sidedef + lightbackupper.SetValues(fl.Back, true); + lightbackmiddle.SetValues(fl.Back, true); + lightbacklower.SetValues(fl.Back, true); } //////////////////////////////////////////////////////////////////////// @@ -448,7 +486,18 @@ namespace CodeImp.DoomBuilder.Windows if (repeatcnt != repeatcntFront.GetResult(repeatcnt)) repeatcntFront.Text = string.Empty; } + if (l.Front.Fields.GetValue("lightabsolute", false) != cbLightAbsoluteFront.Checked) + { + cbLightAbsoluteFront.ThreeState = true; + cbLightAbsoluteFront.CheckState = CheckState.Indeterminate; + } + frontTextureOffset.SetValues(l.Front.OffsetX, l.Front.OffsetY, false); //mxd + + // Upper/middle/lower brightness of front sidedef + lightfrontupper.SetValues(l.Front, false); + lightfrontmiddle.SetValues(l.Front, false); + lightfrontlower.SetValues(l.Front, false); } // Back settings @@ -496,7 +545,25 @@ namespace CodeImp.DoomBuilder.Windows if (repeatcnt != repeatcntBack.GetResult(repeatcnt)) repeatcntBack.Text = string.Empty; } + if (!string.IsNullOrEmpty(lightBack.Text)) + { + int light = UniFields.GetInteger(l.Back.Fields, "light", 0); + if (light != lightBack.GetResult(light)) + lightBack.Text = string.Empty; + } + + if (l.Back.Fields.GetValue("lightabsolute", false) != cbLightAbsoluteBack.Checked) + { + cbLightAbsoluteBack.ThreeState = true; + cbLightAbsoluteBack.CheckState = CheckState.Indeterminate; + } + backTextureOffset.SetValues(l.Back.OffsetX, l.Back.OffsetY, false); //mxd + + // Upper/middle/lower brightness of back sidedef + lightbackupper.SetValues(l.Back, false); + lightbackmiddle.SetValues(l.Back, false); + lightbacklower.SetValues(l.Back, false); } //mxd @@ -521,11 +588,23 @@ namespace CodeImp.DoomBuilder.Windows commenteditor.FinishSetup(); //mxd //mxd. Update "Reset" buttons - if(alpha.Text == "1") resetalpha.Visible = false; + resetfrontlight.Visible = (cbLightAbsoluteFront.CheckState != CheckState.Unchecked || lightFront.GetResult(0) != 0); + resetbacklight.Visible = (cbLightAbsoluteBack.CheckState != CheckState.Unchecked || lightBack.GetResult(0) != 0); + if (alpha.Text == "1") resetalpha.Visible = false; + + // Upper/middle/lower brightness of front sidedef + lightfrontupper.FinalizeSetup(); + lightfrontmiddle.FinalizeSetup(); + lightfrontlower.FinalizeSetup(); + + // Upper/middle/lower brightness of back sidedef + lightbackupper.FinalizeSetup(); + lightbackmiddle.FinalizeSetup(); + lightbacklower.FinalizeSetup(); } //mxd - private void MakeUndo() + public void MakeUndo() { if(undocreated) return; undocreated = true; @@ -933,6 +1012,10 @@ namespace CodeImp.DoomBuilder.Windows repeatcntFront.Text = UniFields.GetInteger(fs.Fields, "repeatcnt", 0).ToString(); + lightFront.Text = UniFields.GetInteger(fs.Fields, "light", 0).ToString(); + cbLightAbsoluteFront.ThreeState = false; + cbLightAbsoluteFront.Checked = fs.Fields.GetValue("lightabsolute", false); + //flags foreach (CheckBox c in flagsFront.Checkboxes) if(fs.Flags.ContainsKey(c.Tag.ToString())) c.Checked = fs.Flags[c.Tag.ToString()]; @@ -949,6 +1032,18 @@ namespace CodeImp.DoomBuilder.Windows if (repeatcnt != repeatcntFront.GetResult(repeatcnt)) repeatcntFront.Text = string.Empty; } + if (!string.IsNullOrEmpty(lightFront.Text)) + { + int light = UniFields.GetInteger(s.Fields, "light", 0); + if (light != lightFront.GetResult(light)) lightFront.Text = string.Empty; + } + + if (s.Fields.GetValue("lightabsolute", false) != cbLightAbsoluteFront.Checked) + { + cbLightAbsoluteFront.ThreeState = true; + cbLightAbsoluteFront.CheckState = CheckState.Indeterminate; + } + //flags foreach (CheckBox c in flagsFront.Checkboxes) { @@ -988,6 +1083,10 @@ namespace CodeImp.DoomBuilder.Windows repeatcntBack.Text = UniFields.GetInteger(fs.Fields, "repeatcnt", 0).ToString(); + lightBack.Text = UniFields.GetInteger(fs.Fields, "light", 0).ToString(); + cbLightAbsoluteBack.ThreeState = false; + cbLightAbsoluteBack.Checked = fs.Fields.GetValue("lightabsolute", false); + //flags foreach (CheckBox c in flagsBack.Checkboxes) if(fs.Flags.ContainsKey(c.Tag.ToString())) c.Checked = fs.Flags[c.Tag.ToString()]; @@ -1004,6 +1103,18 @@ namespace CodeImp.DoomBuilder.Windows if (repeatcnt != repeatcntBack.GetResult(repeatcnt)) repeatcntBack.Text = string.Empty; } + if (!string.IsNullOrEmpty(lightBack.Text)) + { + int light = UniFields.GetInteger(s.Fields, "light", 0); + if (light != lightBack.GetResult(light)) lightBack.Text = string.Empty; + } + + if (s.Fields.GetValue("lightabsolute", false) != cbLightAbsoluteBack.Checked) + { + cbLightAbsoluteBack.ThreeState = true; + cbLightAbsoluteBack.CheckState = CheckState.Indeterminate; + } + //flags foreach (CheckBox c in flagsBack.Checkboxes) { @@ -1211,9 +1322,248 @@ namespace CodeImp.DoomBuilder.Windows if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); } - #endregion + #endregion - #region Global texture offsets changed + #region Brightness changed + + private void lightFront_WhenTextChanged(object sender, EventArgs e) + { + if (preventchanges) return; + MakeUndo(); //mxd + int i = 0; + + // Reset increment steps, otherwise it's just keep counting and counting + lightFront.ResetIncrementStep(); + + //restore values + if (string.IsNullOrEmpty(lightFront.Text)) + { + foreach (Linedef l in lines) + { + if (l.Front != null) + UniFields.SetInteger(l.Front.Fields, "light", (linedefprops[i].Front != null ? linedefprops[i].Front.Brightness : 0), 0); + i++; + } + } + else //update values + { + foreach (Linedef l in lines) + { + if (l.Front != null) + { + bool absolute = false; + switch (cbLightAbsoluteFront.CheckState) + { + case CheckState.Indeterminate: + absolute = l.Front.Fields.GetValue("lightabsolute", false); + break; + case CheckState.Checked: + absolute = true; + break; + } + + int value = General.Clamp(lightFront.GetResult((linedefprops[i].Front != null ? linedefprops[i].Front.Brightness : 0)), (absolute ? 0 : -255), 255); + UniFields.SetInteger(l.Front.Fields, "light", value, 0); + } + i++; + } + } + + resetfrontlight.Visible = (cbLightAbsoluteFront.CheckState != CheckState.Unchecked || lightFront.Text != "0"); + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + + private void lightBack_WhenTextChanged(object sender, EventArgs e) + { + if (preventchanges) return; + MakeUndo(); //mxd + int i = 0; + + //restore values + if (string.IsNullOrEmpty(lightBack.Text)) + { + foreach (Linedef l in lines) + { + if (l.Back != null) + UniFields.SetInteger(l.Back.Fields, "light", (linedefprops[i].Back != null ? linedefprops[i].Back.Brightness : 0), 0); + i++; + } + } + else //update values + { + foreach (Linedef l in lines) + { + if (l.Back != null) + { + bool absolute = false; + switch (cbLightAbsoluteBack.CheckState) + { + case CheckState.Indeterminate: + absolute = l.Back.Fields.GetValue("lightabsolute", false); + break; + case CheckState.Checked: + absolute = true; + break; + } + + int value = General.Clamp(lightBack.GetResult((linedefprops[i].Back != null ? linedefprops[i].Back.Brightness : 0)), (absolute ? 0 : -255), 255); + UniFields.SetInteger(l.Back.Fields, "light", value, 0); + } + i++; + } + } + + resetbacklight.Visible = (cbLightAbsoluteBack.CheckState != CheckState.Unchecked || lightBack.Text != "0"); + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + + private void cbLightAbsoluteFront_CheckedChanged(object sender, EventArgs e) + { + if (preventchanges) return; + MakeUndo(); //mxd + + if (cbLightAbsoluteFront.Checked) + { + foreach (Linedef l in lines) + { + if (l.Front == null) continue; + l.Front.Fields["lightabsolute"] = new UniValue(UniversalType.Boolean, true); + } + } + else if (cbLightAbsoluteFront.CheckState == CheckState.Indeterminate) + { + int i = 0; + + foreach (Linedef l in lines) + { + if (l.Front != null) + { + if (linedefprops[i].Front != null && linedefprops[i].Front.AbsoluteBrightness) + { + l.Front.Fields["lightabsolute"] = new UniValue(UniversalType.Boolean, true); + } + else if (l.Front.Fields.ContainsKey("lightabsolute")) + { + l.Front.Fields.Remove("lightabsolute"); + } + } + i++; + } + } + else + { + foreach (Linedef l in lines) + { + if (l.Front == null) continue; + if (l.Front.Fields.ContainsKey("lightabsolute")) l.Front.Fields.Remove("lightabsolute"); + } + } + + resetfrontlight.Visible = (cbLightAbsoluteFront.CheckState != CheckState.Unchecked || lightFront.Text != "0"); + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + + private void cbLightAbsoluteBack_CheckedChanged(object sender, EventArgs e) + { + if (preventchanges) return; + MakeUndo(); //mxd + + if (cbLightAbsoluteBack.Checked) + { + foreach (Linedef l in lines) + { + if (l.Back == null) continue; + l.Back.Fields["lightabsolute"] = new UniValue(UniversalType.Boolean, true); + } + } + else if (cbLightAbsoluteBack.CheckState == CheckState.Indeterminate) + { + int i = 0; + + foreach (Linedef l in lines) + { + if (l.Back != null) + { + if (linedefprops[i].Back != null && linedefprops[i].Back.AbsoluteBrightness) + { + l.Back.Fields["lightabsolute"] = new UniValue(UniversalType.Boolean, true); + } + else if (l.Back.Fields.ContainsKey("lightabsolute")) + { + l.Back.Fields.Remove("lightabsolute"); + } + } + i++; + } + } + else + { + foreach (Linedef l in lines) + { + if (l.Back == null) continue; + if (l.Back.Fields.ContainsKey("lightabsolute")) l.Back.Fields.Remove("lightabsolute"); + } + } + + resetbacklight.Visible = (cbLightAbsoluteBack.CheckState != CheckState.Unchecked || lightBack.Text != "0"); + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + + private void resetfrontlight_Click(object sender, EventArgs e) + { + MakeUndo(); //mxd + + preventchanges = true; + + cbLightAbsoluteFront.Checked = false; + lightFront.Text = "0"; + + foreach (Linedef l in lines) + { + if (l.Front == null) continue; + if (l.Front.Fields.ContainsKey("lightabsolute")) l.Front.Fields.Remove("lightabsolute"); + if (l.Front.Fields.ContainsKey("light")) l.Front.Fields.Remove("light"); + } + + preventchanges = false; + + resetfrontlight.Visible = false; + lightFront.Focus(); + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + + private void resetbacklight_Click(object sender, EventArgs e) + { + MakeUndo(); //mxd + + preventchanges = true; + + cbLightAbsoluteBack.Checked = false; + lightBack.Text = "0"; + + foreach (Linedef l in lines) + { + if (l.Back == null) continue; + if (l.Back.Fields.ContainsKey("lightabsolute")) l.Back.Fields.Remove("lightabsolute"); + if (l.Back.Fields.ContainsKey("light")) l.Back.Fields.Remove("light"); + } + + preventchanges = false; + + resetbacklight.Visible = false; + lightBack.Focus(); + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + + #endregion + + #region Global texture offsets changed private void frontTextureOffset_OnValuesChanged(object sender, EventArgs e) { @@ -1434,6 +1784,7 @@ namespace CodeImp.DoomBuilder.Windows #endregion + #region Scale changed private void pfcFrontScaleTop_OnValuesChanged(object sender, EventArgs e) @@ -1653,10 +2004,5 @@ namespace CodeImp.DoomBuilder.Windows #endregion #endregion - - private void argscontrol_Load(object sender, EventArgs e) - { - - } } } diff --git a/Source/Core/Windows/LinedefEditFormSRB2.resx b/Source/Core/Windows/LinedefEditFormSRB2.resx index 6515b5f9..b6a0c5c5 100644 --- a/Source/Core/Windows/LinedefEditFormSRB2.resx +++ b/Source/Core/Windows/LinedefEditFormSRB2.resx @@ -155,7 +155,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADM - CAAAAk1TRnQBSQFMAgEBAgEAAQgBAQEIAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAARABAQEQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -195,4 +195,7 @@ BAAB/wKAAQEEAAH/AcECgQQAAf8B4wLDBAAC/wLnBAAE/wQACw== + + 67 + \ No newline at end of file