From 5212079f5f3794c95feb25513f4a789faf70eca2 Mon Sep 17 00:00:00 2001 From: MaxED Date: Sun, 5 Jun 2016 22:06:56 +0000 Subject: [PATCH] Removed: activating the same 2D mode repeatedly no longer toggles View modes. Added "Next View Mode" and "Previous View Mode" actions. Removed "Replace unused textures" checkboxes from Edit Linedefs window. Fixed, SNDINFO parser: commented $ambient sound definitions were treated as editor comments (and still processed). --- Source/Core/Editing/ClassicMode.cs | 24 +++ Source/Core/Editing/EditModeInfo.cs | 43 +++--- Source/Core/Resources/Actions.cfg | 20 +++ .../Core/Windows/LinedefEditForm.Designer.cs | 30 ---- Source/Core/Windows/LinedefEditForm.cs | 138 +----------------- .../Windows/LinedefEditFormUDMF.Designer.cs | 54 ++----- Source/Core/Windows/LinedefEditFormUDMF.cs | 138 +----------------- Source/Core/ZDoom/SndInfoParser.cs | 1 + Source/Core/ZDoom/ZDTextParser.cs | 3 +- 9 files changed, 88 insertions(+), 363 deletions(-) diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 0425c92c..8e466696 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -17,7 +17,9 @@ #region ================== Namespaces using System; +using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Windows.Forms; using CodeImp.DoomBuilder.Actions; using CodeImp.DoomBuilder.Geometry; @@ -943,6 +945,28 @@ namespace CodeImp.DoomBuilder.Editing SetViewMode(ViewMode.CeilingTextures); } + //mxd + [BeginAction("nextviewmode", BaseAction = true)] + protected virtual void NextViewMode() + { + List vmodes = new List(Enum.GetValues(typeof(ViewMode)).Cast()); + int curmode = vmodes.IndexOf(General.Map.Renderer2D.ViewMode); + curmode = (curmode == vmodes.Count - 1 ? 0 : ++curmode); + + SetViewMode(vmodes[curmode]); + } + + //mxd + [BeginAction("previousviewmode", BaseAction = true)] + protected virtual void PreviousViewMode() + { + List vmodes = new List(Enum.GetValues(typeof(ViewMode)).Cast()); + int curmode = vmodes.IndexOf(General.Map.Renderer2D.ViewMode); + curmode = (curmode == 0 ? vmodes.Count - 1 : --curmode); + + SetViewMode(vmodes[curmode]); + } + //mxd [BeginAction("centeroncoordinates", BaseAction = true)] protected virtual void CenterOnCoordinates() diff --git a/Source/Core/Editing/EditModeInfo.cs b/Source/Core/Editing/EditModeInfo.cs index 1abb009a..aaff8c20 100644 --- a/Source/Core/Editing/EditModeInfo.cs +++ b/Source/Core/Editing/EditModeInfo.cs @@ -143,43 +143,34 @@ namespace CodeImp.DoomBuilder.Editing } } - // This switches to the mode by user command - // (when user presses shortcut key) + // This switches to the mode by user command (when user presses shortcut key) public void UserSwitchToMode() { // Only when a map is opened if(General.Map != null) { - // Switching from volatile mode to volatile mode? - if((General.Editing.Mode != null) && General.Editing.Mode.Attributes.Volatile && this.attribs.Volatile) + //mxd. Not the same mode? + if(type != General.Editing.Mode.GetType()) { - // First cancel previous volatile mode - General.Editing.CancelVolatileMode(); + // Switching from volatile mode to a different volatile mode? + if((General.Editing.Mode != null) && General.Editing.Mode.Attributes.Volatile && this.attribs.Volatile) + { + // First cancel previous volatile mode + General.Editing.CancelVolatileMode(); + } + + // Create instance + EditMode newmode = plugin.CreateObject(type); + + //mxd. Switch mode? + if(newmode != null) General.Editing.ChangeMode(newmode); } - - // When in VisualMode and switching to the same VisualMode, then we switch back to the previous classic mode - if((General.Editing.Mode is VisualMode) && (type == General.Editing.Mode.GetType())) + // When in VisualMode and switching to the same VisualMode, switch back to the previous classic mode + else if(General.Editing.Mode is VisualMode) { // Switch back to last classic mode General.Editing.ChangeMode(General.Editing.PreviousClassicMode.Name); } - //mxd. The same mode? Switch view modes instead - else if(General.Editing.Mode is ClassicMode && General.Editing.Mode.GetType().FullName == type.FullName) - { - List vmodes = new List(Enum.GetValues(typeof(ViewMode)).Cast()); - int curmode = vmodes.IndexOf(General.Map.Renderer2D.ViewMode); - curmode = (curmode == vmodes.Count - 1 ? 0 : ++curmode); - - ClassicMode.SetViewMode(vmodes[curmode]); - } - else - { - // Create instance - EditMode newmode = plugin.CreateObject(type); - - //mxd. Switch mode? - if(newmode != null) General.Editing.ChangeMode(newmode); - } } } diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg index ec570210..ff40bfa7 100644 --- a/Source/Core/Resources/Actions.cfg +++ b/Source/Core/Resources/Actions.cfg @@ -1046,6 +1046,26 @@ viewmodeceilings allowscroll = false; } +nextviewmode //mxd +{ + title = "Next View Mode"; + category = "view"; + description = "This switches to next view mode."; + allowkeys = true; + allowmouse = true; + allowscroll = false; +} + +previousviewmode //mxd +{ + title = "Previous View Mode"; + category = "view"; + description = "This switches to previous view mode."; + allowkeys = true; + allowmouse = true; + allowscroll = false; +} + togglecomments //mxd { title = "Toggle Comments"; diff --git a/Source/Core/Windows/LinedefEditForm.Designer.cs b/Source/Core/Windows/LinedefEditForm.Designer.cs index a90756d1..f121f47a 100644 --- a/Source/Core/Windows/LinedefEditForm.Designer.cs +++ b/Source/Core/Windows/LinedefEditForm.Designer.cs @@ -56,7 +56,6 @@ namespace CodeImp.DoomBuilder.Windows this.tagSelector = new CodeImp.DoomBuilder.Controls.TagSelector(); this.frontside = new System.Windows.Forms.CheckBox(); this.frontgroup = new System.Windows.Forms.GroupBox(); - this.replaceunusedfronttextures = new System.Windows.Forms.CheckBox(); this.frontsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.frontlow = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); this.frontmid = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); @@ -64,7 +63,6 @@ namespace CodeImp.DoomBuilder.Windows this.frontTextureOffset = new CodeImp.DoomBuilder.Controls.PairedIntControl(); this.backside = new System.Windows.Forms.CheckBox(); this.backgroup = new System.Windows.Forms.GroupBox(); - this.replaceunusedbacktextures = new System.Windows.Forms.CheckBox(); this.backsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.backlow = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); this.backmid = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); @@ -365,7 +363,6 @@ namespace CodeImp.DoomBuilder.Windows // this.frontgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.frontgroup.Controls.Add(this.replaceunusedfronttextures); this.frontgroup.Controls.Add(this.labelFrontTextureOffset); this.frontgroup.Controls.Add(this.frontsector); this.frontgroup.Controls.Add(label11); @@ -384,17 +381,6 @@ namespace CodeImp.DoomBuilder.Windows this.frontgroup.TabStop = false; this.frontgroup.Text = " "; // - // replaceunusedfronttextures - // - this.replaceunusedfronttextures.AutoSize = true; - this.replaceunusedfronttextures.Location = new System.Drawing.Point(90, 121); - this.replaceunusedfronttextures.Name = "replaceunusedfronttextures"; - this.replaceunusedfronttextures.Size = new System.Drawing.Size(144, 17); - this.replaceunusedfronttextures.TabIndex = 43; - this.replaceunusedfronttextures.Text = "Replace unused textures"; - this.replaceunusedfronttextures.UseVisualStyleBackColor = true; - this.replaceunusedfronttextures.CheckedChanged += new System.EventHandler(this.replaceunusedfronttextures_CheckedChanged); - // // frontsector // this.frontsector.AllowDecimal = false; @@ -476,7 +462,6 @@ namespace CodeImp.DoomBuilder.Windows // this.backgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.backgroup.Controls.Add(this.replaceunusedbacktextures); this.backgroup.Controls.Add(this.labelBackTextureOffset); this.backgroup.Controls.Add(this.backsector); this.backgroup.Controls.Add(label12); @@ -495,17 +480,6 @@ namespace CodeImp.DoomBuilder.Windows this.backgroup.TabStop = false; this.backgroup.Text = " "; // - // replaceunusedbacktextures - // - this.replaceunusedbacktextures.AutoSize = true; - this.replaceunusedbacktextures.Location = new System.Drawing.Point(90, 121); - this.replaceunusedbacktextures.Name = "replaceunusedbacktextures"; - this.replaceunusedbacktextures.Size = new System.Drawing.Size(144, 17); - this.replaceunusedbacktextures.TabIndex = 44; - this.replaceunusedbacktextures.Text = "Replace unused textures"; - this.replaceunusedbacktextures.UseVisualStyleBackColor = true; - this.replaceunusedbacktextures.CheckedChanged += new System.EventHandler(this.replaceunusedbacktextures_CheckedChanged); - // // backsector // this.backsector.AllowDecimal = false; @@ -617,9 +591,7 @@ namespace CodeImp.DoomBuilder.Windows this.flagsgroup.ResumeLayout(false); this.idgroup.ResumeLayout(false); this.frontgroup.ResumeLayout(false); - this.frontgroup.PerformLayout(); this.backgroup.ResumeLayout(false); - this.backgroup.PerformLayout(); this.panel.ResumeLayout(false); this.panel.PerformLayout(); this.ResumeLayout(false); @@ -659,7 +631,5 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Label labelFrontTextureOffset; private System.Windows.Forms.Label labelBackTextureOffset; private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol; - private System.Windows.Forms.CheckBox replaceunusedfronttextures; - private System.Windows.Forms.CheckBox replaceunusedbacktextures; } } \ No newline at end of file diff --git a/Source/Core/Windows/LinedefEditForm.cs b/Source/Core/Windows/LinedefEditForm.cs index 192892c9..9247d931 100644 --- a/Source/Core/Windows/LinedefEditForm.cs +++ b/Source/Core/Windows/LinedefEditForm.cs @@ -149,12 +149,6 @@ namespace CodeImp.DoomBuilder.Windows apply.Top = panel.Bottom + panel.Margin.Bottom + apply.Margin.Top; cancel.Top = apply.Top; - //mxd. Apply texture replacement settings - preventchanges = true; - replaceunusedfronttextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedfronttextures", true); - replaceunusedbacktextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedbacktextures", true); - preventchanges = false; - // Update window height this.Height = apply.Bottom + apply.Margin.Bottom * 2 + (this.Height - this.ClientRectangle.Height) + 1; } @@ -534,10 +528,6 @@ namespace CodeImp.DoomBuilder.Windows { // Save location location = this.Location; - - // Save persistent settings - General.Settings.WriteSetting("editlinedefswindow.replaceunusedfronttextures", replaceunusedfronttextures.Checked); - General.Settings.WriteSetting("editlinedefswindow.replaceunusedbacktextures", replaceunusedbacktextures.Checked); } // Help! @@ -601,15 +591,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Front != null - && (replaceunusedfronttextures.Checked - || (l.Front.HighRequired() - || (linedefprops[i].Front != null && linedefprops[i].Front.HighTexture != "-")))) - l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture)); - i++; + if(l.Front != null) l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture)); } } @@ -638,15 +622,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Front != null - && (replaceunusedfronttextures.Checked - || (l.Front.MiddleRequired() - || (linedefprops[i].Front != null && linedefprops[i].Front.MiddleTexture != "-")))) - l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture)); - i++; + if(l.Front != null) l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture)); } } @@ -675,15 +653,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Front != null - && (replaceunusedfronttextures.Checked - || (l.Front.LowRequired() - || (linedefprops[i].Front != null && linedefprops[i].Front.LowTexture != "-")))) - l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture)); - i++; + if(l.Front != null) l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture)); } } @@ -712,15 +684,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Back != null - && (replaceunusedbacktextures.Checked - || (l.Back.HighRequired() - || (linedefprops[i].Back != null && linedefprops[i].Back.HighTexture != "-")))) - l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture)); - i++; + if(l.Back != null) l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture)); } } @@ -749,15 +715,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Back != null - && (replaceunusedbacktextures.Checked - || (l.Back.MiddleRequired() - || (linedefprops[i].Back != null && linedefprops[i].Back.MiddleTexture != "-")))) - l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture)); - i++; + if(l.Back != null) l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture)); } } @@ -786,15 +746,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Back != null - && (replaceunusedbacktextures.Checked - || (l.Back.LowRequired() - || (linedefprops[i].Back != null && linedefprops[i].Back.LowTexture != "-")))) - l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture)); - i++; + if(l.Back != null) l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture)); } } @@ -805,86 +759,6 @@ namespace CodeImp.DoomBuilder.Windows if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); } - private void replaceunusedfronttextures_CheckedChanged(object sender, EventArgs e) - { - //Re-apply front textures - if(preventchanges) return; - MakeUndo(); - - // Set values - int i = 0; - foreach(Linedef l in lines) - { - if(l.Front == null) continue; - - // Update top texture - if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(fronthigh.TextureName)) - l.Front.SetTextureHigh(linedefprops[i].Front != null ? linedefprops[i].Front.HighTexture : "-"); - else - l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture)); - - // Update middle texture - if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontmid.TextureName)) - l.Front.SetTextureMid(linedefprops[i].Front != null ? linedefprops[i].Front.MiddleTexture : "-"); - else - l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture)); - - // Update bottom texture - if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontlow.TextureName)) - l.Front.SetTextureLow(linedefprops[i].Front != null ? linedefprops[i].Front.LowTexture : "-"); - else - l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture)); - - i++; - } - - // Update the used textures - General.Map.Data.UpdateUsedTextures(); - - General.Map.IsChanged = true; - if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); - } - - private void replaceunusedbacktextures_CheckedChanged(object sender, EventArgs e) - { - //Re-apply back textures - if(preventchanges) return; - MakeUndo(); - - // Set values - int i = 0; - foreach(Linedef l in lines) - { - if(l.Back == null) continue; - - // Update top texture - if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backhigh.TextureName)) - l.Back.SetTextureHigh(linedefprops[i].Back != null ? linedefprops[i].Back.HighTexture : "-"); - else - l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture)); - - // Update middle texture - if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backmid.TextureName)) - l.Back.SetTextureMid(linedefprops[i].Back != null ? linedefprops[i].Back.MiddleTexture : "-"); - else - l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture)); - - // Update bottom texture - if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backlow.TextureName)) - l.Back.SetTextureLow(linedefprops[i].Back != null ? linedefprops[i].Back.LowTexture : "-"); - else - l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture)); - - i++; - } - - // Update the used textures - General.Map.Data.UpdateUsedTextures(); - - General.Map.IsChanged = true; - if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); - } - private void frontTextureOffset_OnValuesChanged(object sender, EventArgs e) { if(preventchanges) return; diff --git a/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs b/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs index 946594ed..9a7cedbb 100644 --- a/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs +++ b/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs @@ -60,7 +60,6 @@ namespace CodeImp.DoomBuilder.Windows this.tabfront = new System.Windows.Forms.TabPage(); this.frontside = new System.Windows.Forms.CheckBox(); this.frontgroup = new System.Windows.Forms.GroupBox(); - this.replaceunusedfronttextures = new System.Windows.Forms.CheckBox(); this.frontflagsgroup = new System.Windows.Forms.GroupBox(); this.flagsFront = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl(); this.frontscalegroup = new System.Windows.Forms.GroupBox(); @@ -91,7 +90,6 @@ namespace CodeImp.DoomBuilder.Windows this.tabback = new System.Windows.Forms.TabPage(); this.backside = new System.Windows.Forms.CheckBox(); this.backgroup = new System.Windows.Forms.GroupBox(); - this.replaceunusedbacktextures = new System.Windows.Forms.CheckBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.resetbacklight = new System.Windows.Forms.Button(); this.backsector = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); @@ -498,7 +496,6 @@ namespace CodeImp.DoomBuilder.Windows this.frontgroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.frontgroup.Controls.Add(this.replaceunusedfronttextures); this.frontgroup.Controls.Add(this.frontflagsgroup); this.frontgroup.Controls.Add(this.frontscalegroup); this.frontgroup.Controls.Add(this.groupBox6); @@ -514,17 +511,6 @@ namespace CodeImp.DoomBuilder.Windows this.frontgroup.TabStop = false; this.frontgroup.Text = " "; // - // replaceunusedfronttextures - // - this.replaceunusedfronttextures.AutoSize = true; - this.replaceunusedfronttextures.Location = new System.Drawing.Point(312, 15); - this.replaceunusedfronttextures.Name = "replaceunusedfronttextures"; - this.replaceunusedfronttextures.Size = new System.Drawing.Size(144, 17); - this.replaceunusedfronttextures.TabIndex = 46; - this.replaceunusedfronttextures.Text = "Replace unused textures"; - this.replaceunusedfronttextures.UseVisualStyleBackColor = true; - this.replaceunusedfronttextures.CheckedChanged += new System.EventHandler(this.replaceunusedfronttextures_CheckedChanged); - // // frontflagsgroup // this.frontflagsgroup.Controls.Add(this.flagsFront); @@ -864,11 +850,11 @@ namespace CodeImp.DoomBuilder.Windows // // frontlow // - this.frontlow.Location = new System.Drawing.Point(309, 415); + this.frontlow.Location = new System.Drawing.Point(309, 409); this.frontlow.MultipleTextures = false; this.frontlow.Name = "frontlow"; this.frontlow.Required = false; - this.frontlow.Size = new System.Drawing.Size(220, 184); + this.frontlow.Size = new System.Drawing.Size(220, 189); this.frontlow.TabIndex = 6; this.frontlow.TextureName = ""; this.frontlow.UsePreviews = false; @@ -876,11 +862,11 @@ namespace CodeImp.DoomBuilder.Windows // // frontmid // - this.frontmid.Location = new System.Drawing.Point(309, 225); + this.frontmid.Location = new System.Drawing.Point(309, 214); this.frontmid.MultipleTextures = false; this.frontmid.Name = "frontmid"; this.frontmid.Required = false; - this.frontmid.Size = new System.Drawing.Size(220, 184); + this.frontmid.Size = new System.Drawing.Size(220, 189); this.frontmid.TabIndex = 5; this.frontmid.TextureName = ""; this.frontmid.UsePreviews = false; @@ -888,11 +874,11 @@ namespace CodeImp.DoomBuilder.Windows // // fronthigh // - this.fronthigh.Location = new System.Drawing.Point(309, 35); + this.fronthigh.Location = new System.Drawing.Point(309, 19); this.fronthigh.MultipleTextures = false; this.fronthigh.Name = "fronthigh"; this.fronthigh.Required = false; - this.fronthigh.Size = new System.Drawing.Size(220, 184); + this.fronthigh.Size = new System.Drawing.Size(220, 189); this.fronthigh.TabIndex = 4; this.fronthigh.TextureName = ""; this.fronthigh.UsePreviews = false; @@ -928,7 +914,6 @@ namespace CodeImp.DoomBuilder.Windows this.backgroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.backgroup.Controls.Add(this.replaceunusedbacktextures); this.backgroup.Controls.Add(this.groupBox4); this.backgroup.Controls.Add(this.backflagsgroup); this.backgroup.Controls.Add(this.backscalegroup); @@ -944,17 +929,6 @@ namespace CodeImp.DoomBuilder.Windows this.backgroup.TabStop = false; this.backgroup.Text = " "; // - // replaceunusedbacktextures - // - this.replaceunusedbacktextures.AutoSize = true; - this.replaceunusedbacktextures.Location = new System.Drawing.Point(312, 15); - this.replaceunusedbacktextures.Name = "replaceunusedbacktextures"; - this.replaceunusedbacktextures.Size = new System.Drawing.Size(144, 17); - this.replaceunusedbacktextures.TabIndex = 47; - this.replaceunusedbacktextures.Text = "Replace unused textures"; - this.replaceunusedbacktextures.UseVisualStyleBackColor = true; - this.replaceunusedbacktextures.CheckedChanged += new System.EventHandler(this.replaceunusedbacktextures_CheckedChanged); - // // groupBox4 // this.groupBox4.Controls.Add(this.resetbacklight); @@ -1304,11 +1278,11 @@ namespace CodeImp.DoomBuilder.Windows // // backlow // - this.backlow.Location = new System.Drawing.Point(309, 415); + this.backlow.Location = new System.Drawing.Point(309, 409); this.backlow.MultipleTextures = false; this.backlow.Name = "backlow"; this.backlow.Required = false; - this.backlow.Size = new System.Drawing.Size(220, 184); + this.backlow.Size = new System.Drawing.Size(220, 189); this.backlow.TabIndex = 6; this.backlow.TextureName = ""; this.backlow.UsePreviews = false; @@ -1316,11 +1290,11 @@ namespace CodeImp.DoomBuilder.Windows // // backmid // - this.backmid.Location = new System.Drawing.Point(309, 225); + this.backmid.Location = new System.Drawing.Point(309, 214); this.backmid.MultipleTextures = false; this.backmid.Name = "backmid"; this.backmid.Required = false; - this.backmid.Size = new System.Drawing.Size(220, 184); + this.backmid.Size = new System.Drawing.Size(220, 189); this.backmid.TabIndex = 5; this.backmid.TextureName = ""; this.backmid.UsePreviews = false; @@ -1328,11 +1302,11 @@ namespace CodeImp.DoomBuilder.Windows // // backhigh // - this.backhigh.Location = new System.Drawing.Point(309, 35); + this.backhigh.Location = new System.Drawing.Point(309, 19); this.backhigh.MultipleTextures = false; this.backhigh.Name = "backhigh"; this.backhigh.Required = false; - this.backhigh.Size = new System.Drawing.Size(220, 184); + this.backhigh.Size = new System.Drawing.Size(220, 189); this.backhigh.TabIndex = 4; this.backhigh.TextureName = ""; this.backhigh.UsePreviews = false; @@ -1433,7 +1407,6 @@ namespace CodeImp.DoomBuilder.Windows this.tabfront.ResumeLayout(false); this.tabfront.PerformLayout(); this.frontgroup.ResumeLayout(false); - this.frontgroup.PerformLayout(); this.frontflagsgroup.ResumeLayout(false); this.frontscalegroup.ResumeLayout(false); this.groupBox6.ResumeLayout(false); @@ -1442,7 +1415,6 @@ namespace CodeImp.DoomBuilder.Windows this.tabback.ResumeLayout(false); this.tabback.PerformLayout(); this.backgroup.ResumeLayout(false); - this.backgroup.PerformLayout(); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); this.backflagsgroup.ResumeLayout(false); @@ -1546,7 +1518,5 @@ namespace CodeImp.DoomBuilder.Windows private CodeImp.DoomBuilder.Controls.TagsSelector tagsselector; private System.Windows.Forms.Button resetfrontlight; private System.Windows.Forms.Button resetbacklight; - private System.Windows.Forms.CheckBox replaceunusedfronttextures; - private System.Windows.Forms.CheckBox replaceunusedbacktextures; } } \ No newline at end of file diff --git a/Source/Core/Windows/LinedefEditFormUDMF.cs b/Source/Core/Windows/LinedefEditFormUDMF.cs index d7fdd614..7b6f1b7a 100644 --- a/Source/Core/Windows/LinedefEditFormUDMF.cs +++ b/Source/Core/Windows/LinedefEditFormUDMF.cs @@ -232,12 +232,6 @@ namespace CodeImp.DoomBuilder.Windows pfcBackScaleTop.LinkValues = linkBackTopScale; pfcBackScaleMid.LinkValues = linkBackMidScale; pfcBackScaleBottom.LinkValues = linkBackBottomScale; - - // Apply texture replacement settings - preventchanges = true; - replaceunusedfronttextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedfronttextures", true); - replaceunusedbacktextures.Checked = General.Settings.ReadSetting("editlinedefswindow.replaceunusedbacktextures", true); - preventchanges = false; } #endregion @@ -839,10 +833,6 @@ namespace CodeImp.DoomBuilder.Windows // Save location and active tab location = this.Location; activetab = tabs.SelectedIndex; - - // Save persistent settings - General.Settings.WriteSetting("editlinedefswindow.replaceunusedfronttextures", replaceunusedfronttextures.Checked); - General.Settings.WriteSetting("editlinedefswindow.replaceunusedbacktextures", replaceunusedbacktextures.Checked); } // Help! @@ -1079,15 +1069,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Front != null - && (replaceunusedfronttextures.Checked - || (l.Front.HighRequired() - || (linedefprops[i].Front != null && linedefprops[i].Front.HighTexture != "-")))) - l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture)); - i++; + if(l.Front != null) l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture)); } } @@ -1116,15 +1100,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Front != null - && (replaceunusedfronttextures.Checked - || (l.Front.MiddleRequired() - || (linedefprops[i].Front != null && linedefprops[i].Front.MiddleTexture != "-")))) - l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture)); - i++; + if(l.Front != null) l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture)); } } @@ -1153,15 +1131,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Front != null - && (replaceunusedfronttextures.Checked - || (l.Front.LowRequired() - || (linedefprops[i].Front != null && linedefprops[i].Front.LowTexture != "-")))) - l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture)); - i++; + if(l.Front != null) l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture)); } } @@ -1190,15 +1162,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Back != null - && (replaceunusedbacktextures.Checked - || (l.Back.HighRequired() - || (linedefprops[i].Back != null && linedefprops[i].Back.HighTexture != "-")))) - l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture)); - i++; + if(l.Back != null) l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture)); } } @@ -1227,15 +1193,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Back != null - && (replaceunusedbacktextures.Checked - || (l.Back.MiddleRequired() - || (linedefprops[i].Back != null && linedefprops[i].Back.MiddleTexture != "-")))) - l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture)); - i++; + if(l.Back != null) l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture)); } } @@ -1264,15 +1224,9 @@ namespace CodeImp.DoomBuilder.Windows // Update values else { - int i = 0; foreach(Linedef l in lines) { - if(l.Back != null - && (replaceunusedbacktextures.Checked - || (l.Back.LowRequired() - || (linedefprops[i].Back != null && linedefprops[i].Back.LowTexture != "-")))) - l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture)); - i++; + if(l.Back != null) l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture)); } } @@ -1283,86 +1237,6 @@ namespace CodeImp.DoomBuilder.Windows if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); } - private void replaceunusedfronttextures_CheckedChanged(object sender, EventArgs e) - { - //Re-apply front textures - if(preventchanges) return; - MakeUndo(); - - // Set values - int i = 0; - foreach(Linedef l in lines) - { - if(l.Front == null) continue; - - // Update top texture - if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(fronthigh.TextureName)) - l.Front.SetTextureHigh(linedefprops[i].Front != null ? linedefprops[i].Front.HighTexture : "-"); - else - l.Front.SetTextureHigh(fronthigh.GetResult(l.Front.HighTexture)); - - // Update middle texture - if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontmid.TextureName)) - l.Front.SetTextureMid(linedefprops[i].Front != null ? linedefprops[i].Front.MiddleTexture : "-"); - else - l.Front.SetTextureMid(frontmid.GetResult(l.Front.MiddleTexture)); - - // Update bottom texture - if(!replaceunusedfronttextures.Checked || string.IsNullOrEmpty(frontlow.TextureName)) - l.Front.SetTextureLow(linedefprops[i].Front != null ? linedefprops[i].Front.LowTexture : "-"); - else - l.Front.SetTextureLow(frontlow.GetResult(l.Front.LowTexture)); - - i++; - } - - // Update the used textures - General.Map.Data.UpdateUsedTextures(); - - General.Map.IsChanged = true; - if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); - } - - private void replaceunusedbacktextures_CheckedChanged(object sender, EventArgs e) - { - //Re-apply back textures - if(preventchanges) return; - MakeUndo(); - - // Set values - int i = 0; - foreach(Linedef l in lines) - { - if(l.Back == null) continue; - - // Update top texture - if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backhigh.TextureName)) - l.Back.SetTextureHigh(linedefprops[i].Back != null ? linedefprops[i].Back.HighTexture : "-"); - else - l.Back.SetTextureHigh(backhigh.GetResult(l.Back.HighTexture)); - - // Update middle texture - if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backmid.TextureName)) - l.Back.SetTextureMid(linedefprops[i].Back != null ? linedefprops[i].Back.MiddleTexture : "-"); - else - l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture)); - - // Update bottom texture - if(!replaceunusedbacktextures.Checked || string.IsNullOrEmpty(backlow.TextureName)) - l.Back.SetTextureLow(linedefprops[i].Back != null ? linedefprops[i].Back.LowTexture : "-"); - else - l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture)); - - i++; - } - - // Update the used textures - General.Map.Data.UpdateUsedTextures(); - - General.Map.IsChanged = true; - if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); - } - #endregion #region Brightness changed diff --git a/Source/Core/ZDoom/SndInfoParser.cs b/Source/Core/ZDoom/SndInfoParser.cs index f8676443..14cb3813 100644 --- a/Source/Core/ZDoom/SndInfoParser.cs +++ b/Source/Core/ZDoom/SndInfoParser.cs @@ -30,6 +30,7 @@ namespace CodeImp.DoomBuilder.ZDoom { specialtokens = ""; ambientsounds = new Dictionary(); + skipeditorcomments = true; // otherwise //$AMBIENT will be treated like one... } #endregion diff --git a/Source/Core/ZDoom/ZDTextParser.cs b/Source/Core/ZDoom/ZDTextParser.cs index 129a91ee..ef567aa6 100644 --- a/Source/Core/ZDoom/ZDTextParser.cs +++ b/Source/Core/ZDoom/ZDTextParser.cs @@ -47,6 +47,7 @@ namespace CodeImp.DoomBuilder.ZDoom protected string whitespace = "\n \t\r\u00A0\0"; //mxd. non-breaking space is also space :) protected string specialtokens = ":{}+-\n;"; protected bool skipregions; //mxd + protected bool skipeditorcomments; //mxd // Input data stream protected Stream datastream; @@ -238,7 +239,7 @@ namespace CodeImp.DoomBuilder.ZDoom // Check if not a special comment with a token if(datastream.Position == datastream.Length) return false; char c3 = (char)datareader.ReadByte(); - if(c3 != '$') + if(skipeditorcomments || c3 != '$') //mxd. Added skipeditorcomments { // Skip entire line char c4 = ' ';