From c86d92ce634dda686498d2b2b8af5ccd3c24290f Mon Sep 17 00:00:00 2001 From: MaxED Date: Thu, 5 Jul 2012 00:03:40 +0000 Subject: [PATCH] 3d-floor's floor and ceiling can be dragged properly in GZDoom Visual mode. Things with "hangs" flag are now aligned to ceiling properly in GZDoom Visual mode. Things can now be added and deleted in GZDoom Visual mode. Several fixes in Doom, Doom 2, Heretic and Hexen configs (based on Doom Builder 2 SVN 1553 and 1560) Added "countsecret" thing UDMF flag to configs. UDMF Controls plugin: Scale of 3d-floor's sidedefs textures is now applied properly. Translation of 3d-floor's sidedefs textures is now applied properly. Added "hidden" UDMF flag. Tag Explorer plugin: TreeView is now updated when thing is deleted. Tag Explorer plugin is now compatible with Doom Builder 2. --- .../Configurations/Includes/Doom2_things.cfg | 9 +- Build/Configurations/Includes/Doom_things.cfg | 14 +- .../Includes/Heretic_things.cfg | 9 +- .../Configurations/Includes/Hexen_things.cfg | 58 +++++++ Build/Configurations/Includes/ZDoom_misc.cfg | 23 ++- Source/Core/Builder.sln | 24 +-- Source/Core/Editing/ThingsFilter.cs | 3 +- Source/Core/Rendering/IRenderer2D.cs | 3 - Source/Core/Windows/ThingEditForm.Designer.cs | 116 ++++++------- Source/Core/Windows/ThingEditForm.resx | 3 - .../GZDoomEditing/General/BuilderPlug.cs | 9 + .../GZDoomEditing/Resources/Actions.cfg | 1 + .../VisualModes/BaseVisualMode.cs | 94 ++++++++-- .../VisualModes/BaseVisualThing.cs | 11 +- .../VisualModes/VisualCeiling.cs | 12 +- .../GZDoomEditing/VisualModes/VisualFloor.cs | 13 +- .../VisualModes/VisualMiddle3D.cs | 2 +- Source/Plugins/TagExplorer/BuilderPlug.cs | 10 +- .../TagExplorer/Controls/TagExplorer.cs | 160 +++++++++++++++--- Source/Plugins/TagExplorer/NodeInfo.cs | 16 +- Source/Plugins/UMDFControls/BuilderPlug.cs | 2 +- .../Windows/UDMFControlsForm.Designer.cs | 22 ++- .../UMDFControls/Windows/UDMFControlsForm.cs | 129 ++++++++++++-- 23 files changed, 583 insertions(+), 160 deletions(-) diff --git a/Build/Configurations/Includes/Doom2_things.cfg b/Build/Configurations/Includes/Doom2_things.cfg index 0a6e922e..859f292f 100644 --- a/Build/Configurations/Includes/Doom2_things.cfg +++ b/Build/Configurations/Includes/Doom2_things.cfg @@ -157,15 +157,13 @@ obstacles color = 3; // Cyan arrow = 0; title = "Obstacles"; - width = 20; sort = 1; - height = 20; blocking = 1; 70 { title = "Burning barrel"; - width = 10; + width = 16; sprite = "FCANA0"; height = 32; class = "BurningBarrel"; @@ -209,7 +207,7 @@ decoration sort = 1; height = 16; hangs = 0; - blocking = 0; + blocking = 1; 79 { @@ -238,7 +236,6 @@ decoration sprite = "HDB1A0"; height = 88; hangs = 1; - blocking = 1; class = "HangNoGuts"; } @@ -248,7 +245,6 @@ decoration sprite = "HDB2A0"; height = 88; hangs = 1; - blocking = 1; class = "HangBNoBrain"; } @@ -258,7 +254,6 @@ decoration sprite = "HDB3A0"; height = 64; hangs = 1; - blocking = 1; class = "HangTLookingDown"; } diff --git a/Build/Configurations/Includes/Doom_things.cfg b/Build/Configurations/Includes/Doom_things.cfg index 04ead12c..8d085cc1 100644 --- a/Build/Configurations/Includes/Doom_things.cfg +++ b/Build/Configurations/Includes/Doom_things.cfg @@ -445,7 +445,7 @@ obstacles color = 3; // Cyan arrow = 0; title = "Obstacles"; - width = 20; + width = 16; sort = 1; height = 20; hangs = 0; @@ -555,6 +555,7 @@ lights { title = "Candle"; sprite = "CANDA0"; + width = 20; blocking = 0; class = "Candlestick"; } @@ -607,7 +608,7 @@ decoration color = 4; // Red arrow = 0; title = "Decoration"; - width = 16; + width = 20; sort = 1; height = 16; hangs = 0; @@ -618,6 +619,7 @@ decoration title = "Hanging victim, twitching (blocking)"; sprite = "GOR1A0"; height = 68; + width = 16; hangs = 1; blocking = 1; class = "BloodyTwitch"; @@ -660,6 +662,7 @@ decoration title = "Hanging pair of legs (blocking)"; sprite = "GOR4A0"; height = 68; + width = 16; hangs = 1; blocking = 1; class = "Meat4"; @@ -681,6 +684,7 @@ decoration title = "Hanging victim, 1-legged (blocking)"; sprite = "GOR3A0"; height = 84; + width = 16; hangs = 1; blocking = 1; class = "HangingCorpse"; @@ -702,6 +706,7 @@ decoration title = "Hanging leg (blocking)"; sprite = "GOR5A0"; height = 52; + width = 16; hangs = 1; blocking = 1; class = "Meat5"; @@ -722,6 +727,7 @@ decoration { title = "Impaled human"; sprite = "POL1A0"; + width = 16; blocking = 1; class = "DeadStick"; } @@ -731,6 +737,7 @@ decoration { title = "Twitching impaled human"; sprite = "POL6A0"; + width = 16; blocking = 1; class = "LiveStick"; } @@ -740,6 +747,7 @@ decoration { title = "Skull on a pole"; sprite = "POL4A0"; + width = 16; blocking = 1; class = "HeadOnAStick"; } @@ -749,6 +757,7 @@ decoration { title = "5 skulls shish kebob"; sprite = "POL2A0"; + width = 16; blocking = 1; class = "HeadsOnAStick"; } @@ -758,6 +767,7 @@ decoration { title = "Pile of skulls and candles"; sprite = "POL3A0"; + width = 16; blocking = 1; class = "HeadCandles"; } diff --git a/Build/Configurations/Includes/Heretic_things.cfg b/Build/Configurations/Includes/Heretic_things.cfg index 53b88a10..8bf8ccb6 100644 --- a/Build/Configurations/Includes/Heretic_things.cfg +++ b/Build/Configurations/Includes/Heretic_things.cfg @@ -480,12 +480,14 @@ obstacles title = "Stalactite (Small)"; sprite = "STCSA0"; height = 36; + hangs = 1; } 40 { title = "Stalactite (Large)"; sprite = "STCLA0"; height = 68; + hangs = 1; } 44 { @@ -562,25 +564,27 @@ decoration title = "Decoration"; width = 16; sort = 1; - blocking = 2; - + 94 { title = "Blue Key Marker"; sprite = "KGZBA0"; height = 50; + blocking = 2; } 95 { title = "Green Key Marker"; sprite = "KGZGA0"; height = 50; + blocking = 2; } 96 { title = "Yellow Key Marker"; sprite = "KGZYA0"; height = 50; + blocking = 2; } 51 { @@ -588,6 +592,7 @@ decoration sprite = "HCORA0"; hangs = 1; height = 104; + blocking = 2; } 17 { diff --git a/Build/Configurations/Includes/Hexen_things.cfg b/Build/Configurations/Includes/Hexen_things.cfg index 96180cdf..9f076637 100644 --- a/Build/Configurations/Includes/Hexen_things.cfg +++ b/Build/Configurations/Includes/Hexen_things.cfg @@ -7,6 +7,7 @@ players width = 16; sort = 1; error = 2; + blocking = 2; 1 { @@ -63,6 +64,7 @@ teleports width = 16; sort = 1; error = 1; + blocking = 0; 14 { @@ -84,6 +86,7 @@ monsters width = 20; sort = 1; error = 2; + blocking = 2; 107 { @@ -221,6 +224,7 @@ weapons title = "Weapons"; width = 20; sort = 1; + blocking = 0; 10 { @@ -306,6 +310,7 @@ ammunition title = "Mana"; width = 8; sort = 1; + blocking = 0; 122 { @@ -331,6 +336,7 @@ health title = "Health and Armor"; width = 20; sort = 1; + blocking = 0; 8005 { @@ -367,6 +373,7 @@ powerups width = 20; height = 20; sort = 1; + blocking = 0; 30 { @@ -452,6 +459,7 @@ puzzle title = "Puzzle Items"; width = 20; sort = 1; + blocking = 0; 9002 { @@ -561,6 +569,7 @@ keys title = "Keys"; width = 8; sort = 1; + blocking = 0; 8030 { @@ -626,6 +635,7 @@ obstacles title = "Obstacles"; width = 20; sort = 1; + blocking = 2; 8064 { @@ -691,18 +701,21 @@ obstacles title = "Stalactite (small)"; sprite = "SLC3A0"; width = 8; + hangs = 1; } 56 { title = "Stalactite (medium)"; sprite = "SLC2A0"; width = 6; + hangs = 1; } 52 { title = "Stalactite (large)"; sprite = "SLC1A0"; width = 8; + hangs = 1; } 48 { @@ -829,24 +842,28 @@ obstacles title = "Icicle (tiny)"; sprite = "ICT4A0"; width = 4; + hangs = 1; } 91 { title = "Icicle (small)"; sprite = "ICT3A0"; width = 4; + hangs = 1; } 90 { title = "Icicle (medium)"; sprite = "ICT2A0"; width = 5; + hangs = 1; } 89 { title = "Icicle (large)"; sprite = "ICT1A0"; width = 8; + hangs = 1; } 8068 { @@ -1003,17 +1020,20 @@ lights arrow = 0; title = "Light sources"; width = 20; + blocking = 2; sort = 1; 17 { title = "Chandelier (lit)"; sprite = "CDLRA0"; + hangs = 1; } 8063 { title = "Chandelier (unlit)"; sprite = "CDLRD0"; + hangs = 1; } 8066 { @@ -1125,54 +1145,70 @@ decoration title = "Decoration"; width = 20; sort = 1; + blocking = 0; 8071 { title = "Chain (short)"; sprite = "CHNSA0"; width = 4; + hangs = 1; + height = 32; } 8072 { title = "Chain (long)"; sprite = "CHNSB0"; width = 4; + hangs = 1; + height = 64; } 8073 { title = "Hook With Heart"; sprite = "CHNSC0"; width = 4; + hangs = 1; } 8077 { title = "Hook With Skull"; sprite = "CHNSG0"; width = 4; + hangs = 1; } 8074 { title = "Chain With Large Hook"; sprite = "CHNSD0"; width = 4; + hangs = 1; + height = 32; } 8075 { title = "Chain With Small Hook"; sprite = "CHNSE0"; width = 4; + hangs = 1; + height = 32; } 8076 { title = "Chain with Spike Ball"; sprite = "CHNSF0"; width = 4; + hangs = 1; + height = 32; } 8103 { title = "Hanging Bucket"; sprite = "BCKTA0"; width = 8; + hangs = 1; + height = 72; + blocking = 2; } 6 { @@ -1260,12 +1296,14 @@ decoration title = "Shrub"; sprite = "SHB1A0"; width = 8; + blocking = 2; } 8102 { title = "Shrub 2"; sprite = "SHB2A0"; width = 16; + blocking = 2; } 111 { @@ -1277,30 +1315,43 @@ decoration title= "Hanging Corpse"; sprite = "CPS3A0"; width = 6; + hangs = 1; + height = 75; + blocking = 2; } 61 { title = "Impaled Corpse"; sprite = "CPS1A0"; width = 10; + height = 92; + blocking = 2; } 108 { title = "Lynched Corpse"; sprite = "CPS4A0"; width = 11; + hangs = 1; + height = 95; + blocking = 2; } 109 { title = "Lynched Corpse (heartless)"; sprite = "CPS5A0"; width = 10; + hangs = 1; + height = 95; + blocking = 2; } 110 { title = "Corpse (sitting)"; sprite = "CPS6A0"; width = 15; + height = 35; + blocking = 2; } 62 { @@ -1347,6 +1398,7 @@ decoration title = "Pot (tall)"; sprite = "POT1A0"; width = 10; + blocking = 2; arg0 { title = "Contained Item"; @@ -1359,6 +1411,7 @@ decoration title = "Pot (medium)"; sprite = "POT2A0"; width = 10; + blocking = 2; arg0 { title = "Contained Item"; @@ -1371,6 +1424,7 @@ decoration title = "Pot (short)"; sprite = "POT3A0"; width = 15; + blocking = 2; arg0 { title = "Contained Item"; @@ -1382,11 +1436,13 @@ decoration { title = "Hanging Moss 1"; sprite = "MSS1A0"; + hangs = 1; } 59 { title = "Hanging Moss 2"; sprite = "MSS2A0"; + hangs = 1; } 10090 { @@ -1410,6 +1466,7 @@ sounds width = 0; sort = 1; fixedsize = true; + blocking = 0; 1403 = "Creak"; 1408 = "Earth Crack"; @@ -1432,6 +1489,7 @@ other width = 0; sort = 1; fixedsize = true; + blocking = 0; 118 { diff --git a/Build/Configurations/Includes/ZDoom_misc.cfg b/Build/Configurations/Includes/ZDoom_misc.cfg index 72b07fdc..2ac84a59 100644 --- a/Build/Configurations/Includes/ZDoom_misc.cfg +++ b/Build/Configurations/Includes/ZDoom_misc.cfg @@ -37,6 +37,7 @@ linedefflags_udmf wrapmidtex = "Wrap middle texture"; midtex3d = "Walkable middle texture"; blockprojectiles = "Block projectiles"; + blockuse = "Block use actions"; } @@ -60,7 +61,8 @@ thingflags thingflags_udmf { - skill6 = "Skill 6"; + countsecret = "Count as secret"; + skill6 = "Skill 6"; skill7 = "Skill 7"; skill8 = "Skill 8"; class1 = "Class 1"; @@ -336,6 +338,11 @@ universalfields type = 2; default = ""; } + conversation + { + type = 0; + default = 0; + } } sector @@ -477,6 +484,18 @@ universalfields type = 3; default = false; } + + soundsequence + { + type = 2; + default = ""; + } + + hidden + { + type = 3; + default = false; + } } } @@ -541,7 +560,7 @@ udmfmaplumpnames { required = false; nodebuild = false; - blindcopy = true; + script = "ZDoom_USDF.cfg"; } ZNODES diff --git a/Source/Core/Builder.sln b/Source/Core/Builder.sln index 0c6ae3b6..41e6d77c 100644 --- a/Source/Core/Builder.sln +++ b/Source/Core/Builder.sln @@ -7,10 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "..\Plugins\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "..\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommentsPanel", "..\Plugins\CommentsPanel\CommentsPanel.csproj", "{58BD8A5B-1B48-435D-8473-A92F27D06C49}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagExplorer", "..\Plugins\TagExplorer\TagExplorer.csproj", "{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UDMFControls", "..\Plugins\UMDFControls\UDMFControls.csproj", "{2D11C828-295C-463A-8545-CA1AD6D51518}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -51,16 +51,6 @@ Global {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.Build.0 = Release|x86 {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.ActiveCfg = Release|x86 {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.Build.0 = Release|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|Any CPU.ActiveCfg = Debug|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x86.ActiveCfg = Debug|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x86.Build.0 = Debug|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|Any CPU.ActiveCfg = Release|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|Mixed Platforms.Build.0 = Release|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x86.ActiveCfg = Release|x86 - {58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x86.Build.0 = Release|x86 {BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Any CPU.Build.0 = Debug|Any CPU {BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -71,6 +61,16 @@ Global {BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.Build.0 = Release|Any CPU {BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.ActiveCfg = Release|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|x86.ActiveCfg = Debug|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Any CPU.Build.0 = Release|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/Core/Editing/ThingsFilter.cs b/Source/Core/Editing/ThingsFilter.cs index 9fdb5a35..f8e10537 100644 --- a/Source/Core/Editing/ThingsFilter.cs +++ b/Source/Core/Editing/ThingsFilter.cs @@ -227,7 +227,8 @@ namespace CodeImp.DoomBuilder.Editing /// public bool IsThingVisible(Thing t) { - return thingsvisiblestate[t]; + if (t.IsDisposed) return false; //mxd + return thingsvisiblestate[t]; } // This writes the filter to configuration diff --git a/Source/Core/Rendering/IRenderer2D.cs b/Source/Core/Rendering/IRenderer2D.cs index b1072507..ff729934 100644 --- a/Source/Core/Rendering/IRenderer2D.cs +++ b/Source/Core/Rendering/IRenderer2D.cs @@ -85,8 +85,5 @@ namespace CodeImp.DoomBuilder.Rendering void RenderText(TextLabel text); void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords); void RedrawSurface(); - - //mxd. Center camera on given coordinates - void PositionView(float x, float y); } } diff --git a/Source/Core/Windows/ThingEditForm.Designer.cs b/Source/Core/Windows/ThingEditForm.Designer.cs index c0b13db6..383b5703 100644 --- a/Source/Core/Windows/ThingEditForm.Designer.cs +++ b/Source/Core/Windows/ThingEditForm.Designer.cs @@ -34,6 +34,10 @@ namespace CodeImp.DoomBuilder.Windows System.Windows.Forms.Label taglabel; System.Windows.Forms.Label label7; this.thingtype = new CodeImp.DoomBuilder.Controls.ThingBrowserControl(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.posX = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.posY = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.height = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.angle = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.heightlabel = new System.Windows.Forms.Label(); @@ -66,10 +70,6 @@ namespace CodeImp.DoomBuilder.Windows this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl(); this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); - this.posY = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); - this.posX = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); groupBox1 = new System.Windows.Forms.GroupBox(); groupBox2 = new System.Windows.Forms.GroupBox(); label5 = new System.Windows.Forms.Label(); @@ -128,6 +128,51 @@ namespace CodeImp.DoomBuilder.Windows groupBox2.TabStop = false; groupBox2.Text = " Coordination "; // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(45, 44); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(17, 14); + this.label2.TabIndex = 15; + this.label2.Text = "X:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(45, 69); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(17, 14); + this.label1.TabIndex = 14; + this.label1.Text = "Y:"; + // + // posX + // + this.posX.AllowDecimal = false; + this.posX.AllowNegative = true; + this.posX.AllowRelative = true; + this.posX.ButtonStep = 8; + this.posX.Location = new System.Drawing.Point(68, 39); + this.posX.Name = "posX"; + this.posX.Size = new System.Drawing.Size(72, 24); + this.posX.StepValues = null; + this.posX.TabIndex = 13; + // + // posY + // + this.posY.AllowDecimal = false; + this.posY.AllowNegative = true; + this.posY.AllowRelative = true; + this.posY.ButtonStep = 8; + this.posY.Location = new System.Drawing.Point(68, 64); + this.posY.Name = "posY"; + this.posY.Size = new System.Drawing.Size(72, 24); + this.posY.StepValues = null; + this.posY.TabIndex = 12; + // // height // this.height.AllowDecimal = false; @@ -265,10 +310,10 @@ namespace CodeImp.DoomBuilder.Windows | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flags.AutoScroll = true; - this.flags.Columns = 2; - this.flags.Location = new System.Drawing.Point(18, 26); + this.flags.Columns = 3; + this.flags.Location = new System.Drawing.Point(19, 19); this.flags.Name = "flags"; - this.flags.Size = new System.Drawing.Size(338, 195); + this.flags.Size = new System.Drawing.Size(337, 202); this.flags.TabIndex = 0; // // tabeffects @@ -279,7 +324,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabeffects.Location = new System.Drawing.Point(4, 23); this.tabeffects.Name = "tabeffects"; this.tabeffects.Padding = new System.Windows.Forms.Padding(3); - this.tabeffects.Size = new System.Drawing.Size(652, 352); + this.tabeffects.Size = new System.Drawing.Size(652, 365); this.tabeffects.TabIndex = 1; this.tabeffects.Text = "Action"; this.tabeffects.UseVisualStyleBackColor = true; @@ -296,7 +341,7 @@ namespace CodeImp.DoomBuilder.Windows this.actiongroup.Controls.Add(this.doompanel); this.actiongroup.Location = new System.Drawing.Point(6, 78); this.actiongroup.Name = "actiongroup"; - this.actiongroup.Size = new System.Drawing.Size(640, 268); + this.actiongroup.Size = new System.Drawing.Size(640, 281); this.actiongroup.TabIndex = 22; this.actiongroup.TabStop = false; this.actiongroup.Text = " Action "; @@ -318,7 +363,7 @@ namespace CodeImp.DoomBuilder.Windows this.hexenpanel.Controls.Add(this.arg4label); this.hexenpanel.Location = new System.Drawing.Point(6, 53); this.hexenpanel.Name = "hexenpanel"; - this.hexenpanel.Size = new System.Drawing.Size(628, 208); + this.hexenpanel.Size = new System.Drawing.Size(628, 221); this.hexenpanel.TabIndex = 13; // // arg2 @@ -444,7 +489,7 @@ namespace CodeImp.DoomBuilder.Windows | System.Windows.Forms.AnchorStyles.Right))); this.doompanel.Location = new System.Drawing.Point(6, 54); this.doompanel.Name = "doompanel"; - this.doompanel.Size = new System.Drawing.Size(628, 208); + this.doompanel.Size = new System.Drawing.Size(628, 221); this.doompanel.TabIndex = 12; // // groupBox3 @@ -487,7 +532,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabcustom.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabcustom.Location = new System.Drawing.Point(4, 23); this.tabcustom.Name = "tabcustom"; - this.tabcustom.Size = new System.Drawing.Size(652, 352); + this.tabcustom.Size = new System.Drawing.Size(652, 365); this.tabcustom.TabIndex = 2; this.tabcustom.Text = "Custom"; this.tabcustom.UseVisualStyleBackColor = true; @@ -506,7 +551,7 @@ namespace CodeImp.DoomBuilder.Windows this.fieldslist.Name = "fieldslist"; this.fieldslist.PropertyColumnVisible = true; this.fieldslist.PropertyColumnWidth = 150; - this.fieldslist.Size = new System.Drawing.Size(636, 334); + this.fieldslist.Size = new System.Drawing.Size(636, 347); this.fieldslist.TabIndex = 1; this.fieldslist.TypeColumnVisible = true; this.fieldslist.TypeColumnWidth = 100; @@ -535,51 +580,6 @@ namespace CodeImp.DoomBuilder.Windows this.apply.UseVisualStyleBackColor = true; this.apply.Click += new System.EventHandler(this.apply_Click); // - // posY - // - this.posY.AllowDecimal = false; - this.posY.AllowNegative = true; - this.posY.AllowRelative = true; - this.posY.ButtonStep = 8; - this.posY.Location = new System.Drawing.Point(68, 64); - this.posY.Name = "posY"; - this.posY.Size = new System.Drawing.Size(72, 24); - this.posY.StepValues = null; - this.posY.TabIndex = 12; - // - // posX - // - this.posX.AllowDecimal = false; - this.posX.AllowNegative = true; - this.posX.AllowRelative = true; - this.posX.ButtonStep = 8; - this.posX.Location = new System.Drawing.Point(68, 39); - this.posX.Name = "posX"; - this.posX.Size = new System.Drawing.Size(72, 24); - this.posX.StepValues = null; - this.posX.TabIndex = 13; - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(45, 69); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(17, 14); - this.label1.TabIndex = 14; - this.label1.Text = "Y:"; - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(45, 44); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(17, 14); - this.label2.TabIndex = 15; - this.label2.Text = "X:"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // ThingEditForm // this.AcceptButton = this.apply; diff --git a/Source/Core/Windows/ThingEditForm.resx b/Source/Core/Windows/ThingEditForm.resx index ea0585f4..e3212e91 100644 --- a/Source/Core/Windows/ThingEditForm.resx +++ b/Source/Core/Windows/ThingEditForm.resx @@ -147,9 +147,6 @@ True - - True - True diff --git a/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs b/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs index 825c8afe..b4526180 100644 --- a/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs +++ b/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs @@ -74,6 +74,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing private bool usegravity; private bool usehighlight; private float stitchrange; + + //mxd + private bool editnewthing; // Copy/paste private string copiedtexture; @@ -102,6 +105,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing public bool UseGravity { get { return usegravity; } set { usegravity = value; } } public bool UseHighlight { get { return usehighlight; } set { usehighlight = value; } } public float StitchRange { get { return stitchrange; } } + + //mxd + public bool EditNewThing { get { return editnewthing; } } // Copy/paste public string CopiedTexture { get { return copiedtexture; } set { copiedtexture = value; } } @@ -148,6 +154,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing changeheightbysidedef = General.Settings.ReadPluginSetting("BuilderModes", "changeheightbysidedef", 0); visualmodeclearselection = General.Settings.ReadPluginSetting("BuilderModes", "visualmodeclearselection", false); stitchrange = (float)General.Settings.ReadPluginSetting("BuilderModes", "stitchrange", 20); + + //mxd + editnewthing = General.Settings.ReadPluginSetting("BuilderModes", "editnewthing", true); } #endregion diff --git a/Source/Plugins/GZDoomEditing/Resources/Actions.cfg b/Source/Plugins/GZDoomEditing/Resources/Actions.cfg index 0b1db40c..95693cfd 100644 --- a/Source/Plugins/GZDoomEditing/Resources/Actions.cfg +++ b/Source/Plugins/GZDoomEditing/Resources/Actions.cfg @@ -10,6 +10,7 @@ gzdoomvisualmode allowkeys = true; allowmouse = true; allowscroll = true; + default = 81; } flooralignmode diff --git a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs index 02843c37..f7cfff7d 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs @@ -43,7 +43,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing SwitchAction = "gzdoomvisualmode", // Action name used to switch to this mode ButtonImage = "VisualModeZ.png", // Image resource name for the button ButtonOrder = 1, // Position of the button (lower is more to the left) - ButtonGroup = "001_visual")] + ButtonGroup = "001_visual", + UseByDefault = true)] public class BaseVisualMode : VisualMode { @@ -1202,6 +1203,39 @@ namespace CodeImp.DoomBuilder.GZDoomEditing return new NullVisualEventReceiver(); } } + + //mxd. Copied from BuilderModes.ThingsMode + // This creates a new thing + private Thing InsertThing(Vector2D pos) { + if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary || + pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary) { + General.Interface.DisplayStatus(StatusType.Warning, "Failed to insert thing: outside of map boundaries."); + return null; + } + + // Create thing + Thing t = General.Map.Map.CreateThing(); + if (t != null) { + General.Settings.ApplyDefaultThingSettings(t); + t.Move(pos); + t.UpdateConfiguration(); + General.Map.IsChanged = true; + + // Update things filter so that it includes this thing + General.Map.ThingsFilter.Update(); + + // Snap to grid enabled? + if (General.Interface.SnapToGrid) { + // Snap to grid + t.SnapToGrid(); + } else { + // Snap to map format accuracy + t.SnapToAccuracy(); + } + } + + return t; + } #endregion @@ -1553,22 +1587,60 @@ namespace CodeImp.DoomBuilder.GZDoomEditing foreach(IVisualEventReceiver i in objs) i.OnPasteProperties(); PostAction(); } - - [BeginAction("insertitem", BaseAction = true)] + + [BeginAction("insertitem", BaseAction = true)] //mxd. now we can actually insert things in Visual modes public void Insert() { - PreAction(UndoGroup.None); - List objs = GetSelectedObjects(true, true, true); - foreach(IVisualEventReceiver i in objs) i.OnInsert(); - PostAction(); + PickTarget(); + + if (target.picked == null) { + General.Interface.DisplayStatus(StatusType.Warning, "Cannot insert item here!"); + return; + } + + ClearSelection(); + PreActionNoChange(); + + General.Map.UndoRedo.CreateUndo("Insert thing"); + Thing t = InsertThing(new Vector2D(target.hitpos.x, target.hitpos.y)); + + if (t == null) { + General.Map.UndoRedo.WithdrawUndo(); + return; + } + + // Edit the thing? + if (BuilderPlug.Me.EditNewThing) + General.Interface.ShowEditThings(new List { t }); + + //add thing to blockmap + blockmap.AddThing(t); + + General.Interface.DisplayStatus(StatusType.Action, "Inserted a new thing."); + General.Map.IsChanged = true; + General.Map.ThingsFilter.Update(); + PostAction(); } - [BeginAction("deleteitem", BaseAction = true)] + [BeginAction("deleteitem", BaseAction = true)] //mxd. now we can actually delete things in Visual modes public void Delete() { - PreAction(UndoGroup.None); - List objs = GetSelectedObjects(true, true, true); - foreach(IVisualEventReceiver i in objs) i.OnDelete(); + List objs = GetSelectedObjects(false, false, true); + if(objs.Count == 0) return; + + string rest = objs.Count + " thing" + (objs.Count > 1 ? "s." : "."); + + //make undo + General.Map.UndoRedo.CreateUndo("Delete " + rest); + General.Interface.DisplayStatus(StatusType.Info, "Deleted " + rest); + + PreActionNoChange(); + foreach(IVisualEventReceiver i in objs) i.OnDelete(); //are they deleted from BlockMap automatically?.. + + // Update cache values + General.Map.IsChanged = true; + General.Map.ThingsFilter.Update(); + PostAction(); } diff --git a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualThing.cs b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualThing.cs index 34bf0243..ecce5255 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualThing.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualThing.cs @@ -203,7 +203,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing if(Thing.Position.z > 0) pos.z = sd.Ceiling.plane.GetZ(Thing.Position) - info.Height; else - pos.z = Thing.Sector.CeilHeight; + pos.z = Thing.Sector.CeilHeight - info.Height; //mxd. was [pos.z = Thing.Sector.CeilHeight;] } pos.z -= Thing.Position.z; @@ -424,10 +424,17 @@ namespace CodeImp.DoomBuilder.GZDoomEditing public virtual void OnProcess(double deltatime) { } public virtual void OnTextureFloodfill() { } public virtual void OnInsert() { } - public virtual void OnDelete() { } + //public virtual void OnDelete() { } public virtual void ApplyTexture(string texture) { } public virtual void ApplyUpperUnpegged(bool set) { } public virtual void ApplyLowerUnpegged(bool set) { } + + //mxd. Delete thing + public virtual void OnDelete() { + this.Thing.Dispose(); + this.Dispose(); + } + // Return texture name public virtual string GetTextureName() { return ""; } diff --git a/Source/Plugins/GZDoomEditing/VisualModes/VisualCeiling.cs b/Source/Plugins/GZDoomEditing/VisualModes/VisualCeiling.cs index d6688928..47dc4c26 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/VisualCeiling.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/VisualCeiling.cs @@ -167,12 +167,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing // Move texture coordinates protected override void MoveTextureOffset(Point xy) { - Sector.Sector.Fields.BeforeFieldsChange(); + //mxd + Sector s = GetControlSector(); + float oldx = s.Fields.GetValue("xpanningceiling", 0.0f); + float oldy = s.Fields.GetValue("ypanningceiling", 0.0f); + s.Fields["xpanningceiling"] = new UniValue(UniversalType.Float, oldx + (float)xy.X); + s.Fields["ypanningceiling"] = new UniValue(UniversalType.Float, oldy + (float)xy.Y); + s.UpdateNeeded = true; + + /*Sector.Sector.Fields.BeforeFieldsChange(); float oldx = Sector.Sector.Fields.GetValue("xpanningceiling", 0.0f); float oldy = Sector.Sector.Fields.GetValue("ypanningceiling", 0.0f); Sector.Sector.Fields["xpanningceiling"] = new UniValue(UniversalType.Float, oldx + (float)xy.X); Sector.Sector.Fields["ypanningceiling"] = new UniValue(UniversalType.Float, oldy + (float)xy.Y); - Sector.Sector.UpdateNeeded = true; + Sector.Sector.UpdateNeeded = true;*/ } // Paste texture diff --git a/Source/Plugins/GZDoomEditing/VisualModes/VisualFloor.cs b/Source/Plugins/GZDoomEditing/VisualModes/VisualFloor.cs index ad2fb558..58893ce3 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/VisualFloor.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/VisualFloor.cs @@ -166,12 +166,21 @@ namespace CodeImp.DoomBuilder.GZDoomEditing // Move texture coordinates protected override void MoveTextureOffset(Point xy) { - Sector.Sector.Fields.BeforeFieldsChange(); + //mxd + Sector s = GetControlSector(); + s.Fields.BeforeFieldsChange(); + float oldx = s.Fields.GetValue("xpanningfloor", 0.0f); + float oldy = s.Fields.GetValue("ypanningfloor", 0.0f); + s.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, oldx + (float)xy.X); + s.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, oldy + (float)xy.Y); + s.UpdateNeeded = true; + + /*Sector.Sector.Fields.BeforeFieldsChange(); float oldx = Sector.Sector.Fields.GetValue("xpanningfloor", 0.0f); float oldy = Sector.Sector.Fields.GetValue("ypanningfloor", 0.0f); Sector.Sector.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, oldx + (float)xy.X); Sector.Sector.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, oldy + (float)xy.Y); - Sector.Sector.UpdateNeeded = true; + Sector.Sector.UpdateNeeded = true;*/ } // Paste texture diff --git a/Source/Plugins/GZDoomEditing/VisualModes/VisualMiddle3D.cs b/Source/Plugins/GZDoomEditing/VisualModes/VisualMiddle3D.cs index 94919299..195c6aae 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/VisualMiddle3D.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/VisualMiddle3D.cs @@ -190,7 +190,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing // Determine initial color int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue; - //mxd + //mxd. This calculates light with doom-style wall shading //PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel)); PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef)); PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness); diff --git a/Source/Plugins/TagExplorer/BuilderPlug.cs b/Source/Plugins/TagExplorer/BuilderPlug.cs index 04347086..403c79cc 100644 --- a/Source/Plugins/TagExplorer/BuilderPlug.cs +++ b/Source/Plugins/TagExplorer/BuilderPlug.cs @@ -22,11 +22,6 @@ namespace CodeImp.DoomBuilder.TagExplorer // This event is called when the plugin is initialized public override void OnInitialize() { - if (GZBuilder.GZGeneral.Version < 1.10f) { - General.ErrorLogger.Add(ErrorType.Error, "Tag Explorer plugin: GZDoom Builder 1.10 or later required!"); - return; - } - base.OnInitialize(); // Keep a static reference @@ -76,5 +71,10 @@ namespace CodeImp.DoomBuilder.TagExplorer if (tagExplorer != null) tagExplorer.UpdateTree(); } + + public override void OnActionEnd(CodeImp.DoomBuilder.Actions.Action action) { + if (tagExplorer != null && action.Name == "builder_deleteitem") + tagExplorer.UpdateTree(); + } } } diff --git a/Source/Plugins/TagExplorer/Controls/TagExplorer.cs b/Source/Plugins/TagExplorer/Controls/TagExplorer.cs index 34c6c787..68d5493a 100644 --- a/Source/Plugins/TagExplorer/Controls/TagExplorer.cs +++ b/Source/Plugins/TagExplorer/Controls/TagExplorer.cs @@ -9,6 +9,7 @@ using System.Windows.Forms; using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Editing; using CodeImp.DoomBuilder.Types; namespace CodeImp.DoomBuilder.TagExplorer @@ -30,6 +31,9 @@ namespace CodeImp.DoomBuilder.TagExplorer private Color commentColor = Color.DarkMagenta; private SelectedNode selection; + private static bool udmf; + internal static bool UDMF { get { return udmf; } } + public TagExplorer() { InitializeComponent(); @@ -48,7 +52,9 @@ namespace CodeImp.DoomBuilder.TagExplorer cbCenterOnSelected.Checked = General.Settings.ReadPluginSetting("centeronselected", false); cbSelectOnClick.Checked = General.Settings.ReadPluginSetting("doselect", false); - if (GZBuilder.GZGeneral.UDMF) { + udmf = (General.Map.Config.FormatInterface == "UniversalMapSetIO"); + + if (udmf) { cbCommentsOnly.Checked = General.Settings.ReadPluginSetting("commentsonly", false); treeView.LabelEdit = true; toolTip1.SetToolTip(tbSearch, "Enter text to find comment\r\nEnter # + tag number to show only specified tag. Example: #667\r\nEnter $ + effect number to show only specified effect. Example: $80"); @@ -66,13 +72,9 @@ namespace CodeImp.DoomBuilder.TagExplorer General.Settings.WritePluginSetting("displaymode", cbDisplayMode.SelectedIndex); General.Settings.WritePluginSetting("centeronselected", cbCenterOnSelected.Checked); General.Settings.WritePluginSetting("doselect", cbSelectOnClick.Checked); - - if (GZBuilder.GZGeneral.UDMF) - General.Settings.WritePluginSetting("commentsonly", cbCommentsOnly.Checked); - - if (disposing && (components != null)) - components.Dispose(); + if (udmf) General.Settings.WritePluginSetting("commentsonly", cbCommentsOnly.Checked); + if (disposing && (components != null)) components.Dispose(); base.Dispose(disposing); } @@ -96,7 +98,7 @@ namespace CodeImp.DoomBuilder.TagExplorer int filteredAction = -1; getSpecialValues(serachStr, ref filteredTag, ref filteredAction); - if (filteredTag != -1 || filteredAction != -1) serachStr = ""; + if (!udmf || filteredTag != -1 || filteredAction != -1) serachStr = ""; TreeNode selectedNode = null; @@ -118,7 +120,7 @@ namespace CodeImp.DoomBuilder.TagExplorer if (!hasComment && cbCommentsOnly.Checked) continue; - if (!GZBuilder.GZGeneral.UDMF || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) { + if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) { TreeNode node = new TreeNode(name, 1, 1); node.Tag = info; if (hasComment) node.ForeColor = commentColor; @@ -180,8 +182,32 @@ namespace CodeImp.DoomBuilder.TagExplorer treeView.Nodes.Add(new TreeNode(CAT_THINGS, 0, 0, catNodes)); - } else { //sort by tag. just add them as they are - treeView.Nodes.Add(new TreeNode(CAT_THINGS, 0, 0, nodes.ToArray())); + } else { //sort by tag + Dictionary categories = new Dictionary(); + TreeNode noTag = new TreeNode("No Tag", 0, 0); + + foreach (TreeNode node in nodes) { + NodeInfo nodeInfo = node.Tag as NodeInfo; + + if (nodeInfo.Tag == 0) { + noTag.Nodes.Add(node); + continue; + } + + if (!categories.ContainsKey(nodeInfo.Tag)) + categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 0, 0, new TreeNode[] { node })); + else + categories[nodeInfo.Tag].Nodes.Add(node); + } + + TreeNode[] catNodes = new TreeNode[categories.Values.Count]; + categories.Values.CopyTo(catNodes, 0); + + TreeNode category = new TreeNode(CAT_THINGS, 0, 0, catNodes); + if (noTag.Nodes.Count > 0) + category.Nodes.Add(noTag); + + treeView.Nodes.Add(category); } } @@ -202,7 +228,7 @@ namespace CodeImp.DoomBuilder.TagExplorer if (!hasComment && cbCommentsOnly.Checked) continue; - if (!GZBuilder.GZGeneral.UDMF || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) { + if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) { TreeNode node = new TreeNode(name, 3, 3); node.Tag = info; if (hasComment) node.ForeColor = commentColor; @@ -246,7 +272,32 @@ namespace CodeImp.DoomBuilder.TagExplorer category.Nodes.Add(noAction); treeView.Nodes.Add(category); - } else { //just add them as they are + } else if (currentSortMode == SortMode.SORT_BY_TAG) { + Dictionary categories = new Dictionary(); + TreeNode noTag = new TreeNode("No Tag", 2, 2); + + foreach (TreeNode node in nodes) { + NodeInfo nodeInfo = node.Tag as NodeInfo; + + if (nodeInfo.Tag == 0) { + noTag.Nodes.Add(node); + continue; + } + + if (!categories.ContainsKey(nodeInfo.Tag)) + categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 2, 2, new TreeNode[] { node })); + else + categories[nodeInfo.Tag].Nodes.Add(node); + } + TreeNode[] catNodes = new TreeNode[categories.Values.Count]; + categories.Values.CopyTo(catNodes, 0); + + TreeNode category = new TreeNode(CAT_SECTORS, 2, 2, catNodes); + if (noTag.Nodes.Count > 0) + category.Nodes.Add(noTag); + + treeView.Nodes.Add(category); + } else {//just add them as they are treeView.Nodes.Add(new TreeNode(CAT_SECTORS, 2, 2, nodes.ToArray())); } } @@ -268,7 +319,7 @@ namespace CodeImp.DoomBuilder.TagExplorer if (!hasComment && cbCommentsOnly.Checked) continue; - if (!GZBuilder.GZGeneral.UDMF || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) { + if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) { TreeNode node = new TreeNode(name, 5, 5); node.Tag = info; if (hasComment) node.ForeColor = commentColor; @@ -313,6 +364,31 @@ namespace CodeImp.DoomBuilder.TagExplorer treeView.Nodes.Add(category); + } else if (currentSortMode == SortMode.SORT_BY_TAG) { + Dictionary categories = new Dictionary(); + TreeNode noTag = new TreeNode("No Tag", 4, 4); + + foreach (TreeNode node in nodes) { + NodeInfo nodeInfo = node.Tag as NodeInfo; + + if (nodeInfo.Tag == 0) { + noTag.Nodes.Add(node); + continue; + } + + if (!categories.ContainsKey(nodeInfo.Tag)) + categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 4, 4, new TreeNode[] { node })); + else + categories[nodeInfo.Tag].Nodes.Add(node); + } + TreeNode[] catNodes = new TreeNode[categories.Values.Count]; + categories.Values.CopyTo(catNodes, 0); + + TreeNode category = new TreeNode(CAT_LINEDEFS, 4, 4, catNodes); + if (noTag.Nodes.Count > 0) + category.Nodes.Add(noTag); + + treeView.Nodes.Add(category); } else { //just add them as they are treeView.Nodes.Add(new TreeNode(CAT_LINEDEFS, 4, 4, nodes.ToArray())); } @@ -438,7 +514,7 @@ namespace CodeImp.DoomBuilder.TagExplorer break; default: - GZBuilder.GZGeneral.Trace("Got unknown category: " + info.Type); + General.ErrorLogger.Add(ErrorType.Warning, "Tag Explorer: got unknown category: " + info.Type); break; } @@ -465,6 +541,8 @@ namespace CodeImp.DoomBuilder.TagExplorer General.Editing.ChangeMode("SectorsMode"); Sector s = General.Map.Map.GetSectorByIndex(info.Index); if (s != null) { + s.Selected = true; + foreach (Sidedef sd in s.Sidedefs) sd.Line.Selected = true; } @@ -473,8 +551,51 @@ namespace CodeImp.DoomBuilder.TagExplorer //focus on element? if (cbCenterOnSelected.Checked) { - Vector2D pos = info.GetPosition(); - General.Map.Renderer2D.PositionView(pos.x, pos.y); + List points = new List(); + RectangleF area = MapSet.CreateEmptyArea(); + + if (info.Type == NodeInfoType.LINEDEF) { + Linedef l = General.Map.Map.GetLinedefByIndex(info.Index); + points.Add(l.Start.Position); + points.Add(l.End.Position); + } else if (info.Type == NodeInfoType.SECTOR) { + Sector s = General.Map.Map.GetSectorByIndex(info.Index); + foreach (Sidedef sd in s.Sidedefs) { + points.Add(sd.Line.Start.Position); + points.Add(sd.Line.End.Position); + } + } else if (info.Type == NodeInfoType.THING) { + Thing t = General.Map.Map.GetThingByIndex(info.Index); + Vector2D p = (Vector2D)t.Position; + points.Add(p); + points.Add(p + new Vector2D(t.Size * 2.0f, t.Size * 2.0f)); + points.Add(p + new Vector2D(t.Size * 2.0f, -t.Size * 2.0f)); + points.Add(p + new Vector2D(-t.Size * 2.0f, t.Size * 2.0f)); + points.Add(p + new Vector2D(-t.Size * 2.0f, -t.Size * 2.0f)); + } else { + General.Fail("Tag Explorer: unknown object type given to zoom in on!"); + } + + // Make a view area from the points + foreach (Vector2D p in points) area = MapSet.IncreaseArea(area, p); + + // Make the area square, using the largest side + if (area.Width > area.Height) { + float delta = area.Width - area.Height; + area.Y -= delta * 0.5f; + area.Height += delta; + } else { + float delta = area.Height - area.Width; + area.X -= delta * 0.5f; + area.Width += delta; + } + + // Add padding + area.Inflate(100f, 100f); + + // Zoom to area + ClassicMode editmode = (General.Editing.Mode as ClassicMode); + editmode.CenterOnArea(area, 0.6f); } //update view @@ -484,7 +605,7 @@ namespace CodeImp.DoomBuilder.TagExplorer private void treeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { //edit comment - if (GZBuilder.GZGeneral.UDMF) { + if (udmf) { NodeInfo info = e.Node.Tag as NodeInfo; if (info == null) return; @@ -495,7 +616,7 @@ namespace CodeImp.DoomBuilder.TagExplorer //we don't want to edit categories if we are in UDMF private void treeView_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e) { - if (!GZBuilder.GZGeneral.UDMF || e.Node.Tag == null) { + if (!udmf || e.Node.Tag == null) { e.CancelEdit = true; return; } @@ -514,7 +635,6 @@ namespace CodeImp.DoomBuilder.TagExplorer //apply comment info.Comment = e.Label; e.Node.Text = info.GetName(ref comment, currentSortMode); - //e.Node.ForeColor = (comment == "" ? Color.Black : commentColor); e.Node.ForeColor = commentColor; } else { //Edit cancelled. info.Comment = ""; //Remove comment diff --git a/Source/Plugins/TagExplorer/NodeInfo.cs b/Source/Plugins/TagExplorer/NodeInfo.cs index 7d9769da..4405466d 100644 --- a/Source/Plugins/TagExplorer/NodeInfo.cs +++ b/Source/Plugins/TagExplorer/NodeInfo.cs @@ -108,10 +108,18 @@ namespace CodeImp.DoomBuilder.TagExplorer UniFields fields = getFields(); if (comment == "") { - if (fields.ContainsKey("comment")) fields.Remove("comment"); + if (fields.ContainsKey("comment")) { + General.Map.UndoRedo.CreateUndo("Remove comment"); + fields.BeforeFieldsChange(); + fields.Remove("comment"); + } return; } + //create undo stuff + General.Map.UndoRedo.CreateUndo("Set comment"); + fields.BeforeFieldsChange(); + if (!fields.ContainsKey("comment")) fields.Add("comment", new UniValue((int)UniversalType.String, comment)); else @@ -147,7 +155,7 @@ namespace CodeImp.DoomBuilder.TagExplorer private string getThingName(Thing t, ref string comment, string sortMode) { bool isDefaultName = true; comment = ""; - if (GZBuilder.GZGeneral.UDMF && t.Fields.ContainsKey("comment")) { + if (TagExplorer.UDMF && t.Fields.ContainsKey("comment")) { comment = t.Fields["comment"].Value.ToString(); isDefaultName = false; } @@ -157,7 +165,7 @@ namespace CodeImp.DoomBuilder.TagExplorer private string getSectorName(Sector s, ref string comment, string sortMode) { bool isDefaultName = true; comment = ""; - if (GZBuilder.GZGeneral.UDMF && s.Fields.ContainsKey("comment")) { + if (TagExplorer.UDMF && s.Fields.ContainsKey("comment")) { comment = s.Fields["comment"].Value.ToString(); isDefaultName = false; } @@ -167,7 +175,7 @@ namespace CodeImp.DoomBuilder.TagExplorer private string getLinedefName(Linedef l, ref string comment, string sortMode) { bool isDefaultName = true; comment = ""; - if (GZBuilder.GZGeneral.UDMF && l.Fields.ContainsKey("comment")) { + if (TagExplorer.UDMF && l.Fields.ContainsKey("comment")) { comment = l.Fields["comment"].Value.ToString(); isDefaultName = false; } diff --git a/Source/Plugins/UMDFControls/BuilderPlug.cs b/Source/Plugins/UMDFControls/BuilderPlug.cs index 50f6d884..d70fbc45 100644 --- a/Source/Plugins/UMDFControls/BuilderPlug.cs +++ b/Source/Plugins/UMDFControls/BuilderPlug.cs @@ -11,7 +11,7 @@ using CodeImp.DoomBuilder.VisualModes; namespace CodeImp.DoomBuilder.UDMFControls { - public class BuilderPlug: Plug { + public sealed class BuilderPlug: Plug { private static BuilderPlug me; public static BuilderPlug Me { get { return me; } } diff --git a/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.Designer.cs b/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.Designer.cs index 549f044f..1466a95c 100644 --- a/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.Designer.cs +++ b/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.Designer.cs @@ -59,6 +59,7 @@ this.cbnofakecontrast = new System.Windows.Forms.CheckBox(); this.cbwrapmidtex = new System.Windows.Forms.CheckBox(); this.cbclipmidtex = new System.Windows.Forms.CheckBox(); + this.cbhidden = new System.Windows.Forms.CheckBox(); this.gbRotation.SuspendLayout(); this.gbPosition.SuspendLayout(); this.gbScale.SuspendLayout(); @@ -336,13 +337,14 @@ // // gbFlagsFloor // + this.gbFlagsFloor.Controls.Add(this.cbhidden); this.gbFlagsFloor.Controls.Add(this.cbsilent); this.gbFlagsFloor.Controls.Add(this.cbnorespawn); this.gbFlagsFloor.Controls.Add(this.cbnofallingdamage); this.gbFlagsFloor.Controls.Add(this.cbdropactors); this.gbFlagsFloor.Location = new System.Drawing.Point(6, 150); this.gbFlagsFloor.Name = "gbFlagsFloor"; - this.gbFlagsFloor.Size = new System.Drawing.Size(235, 112); + this.gbFlagsFloor.Size = new System.Drawing.Size(235, 139); this.gbFlagsFloor.TabIndex = 3; this.gbFlagsFloor.TabStop = false; this.gbFlagsFloor.Text = "Floor and Ceiling flags:"; @@ -350,7 +352,7 @@ // cbsilent // this.cbsilent.AutoSize = true; - this.cbsilent.Location = new System.Drawing.Point(6, 91); + this.cbsilent.Location = new System.Drawing.Point(6, 115); this.cbsilent.Name = "cbsilent"; this.cbsilent.Size = new System.Drawing.Size(52, 18); this.cbsilent.TabIndex = 3; @@ -361,7 +363,7 @@ // cbnorespawn // this.cbnorespawn.AutoSize = true; - this.cbnorespawn.Location = new System.Drawing.Point(6, 67); + this.cbnorespawn.Location = new System.Drawing.Point(6, 91); this.cbnorespawn.Name = "cbnorespawn"; this.cbnorespawn.Size = new System.Drawing.Size(89, 18); this.cbnorespawn.TabIndex = 2; @@ -372,7 +374,7 @@ // cbnofallingdamage // this.cbnofallingdamage.AutoSize = true; - this.cbnofallingdamage.Location = new System.Drawing.Point(6, 43); + this.cbnofallingdamage.Location = new System.Drawing.Point(6, 67); this.cbnofallingdamage.Name = "cbnofallingdamage"; this.cbnofallingdamage.Size = new System.Drawing.Size(114, 18); this.cbnofallingdamage.TabIndex = 1; @@ -461,6 +463,17 @@ this.cbclipmidtex.Text = "Clip Middle Texture"; this.cbclipmidtex.UseVisualStyleBackColor = true; // + // cbhidden + // + this.cbhidden.AutoSize = true; + this.cbhidden.Location = new System.Drawing.Point(6, 43); + this.cbhidden.Name = "cbhidden"; + this.cbhidden.Size = new System.Drawing.Size(59, 18); + this.cbhidden.TabIndex = 4; + this.cbhidden.Tag = "hidden"; + this.cbhidden.Text = "Hidden"; + this.cbhidden.UseVisualStyleBackColor = true; + // // UDMFControlsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -538,5 +551,6 @@ private System.Windows.Forms.CheckBox cblightabsolute; private System.Windows.Forms.CheckBox cbRelativeMode; private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox cbhidden; } } \ No newline at end of file diff --git a/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.cs b/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.cs index 73b6dbc2..595484f5 100644 --- a/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.cs +++ b/Source/Plugins/UMDFControls/Windows/UDMFControlsForm.cs @@ -55,7 +55,7 @@ namespace CodeImp.DoomBuilder.UDMFControls updateList = new List(); wallFlags = new CheckBox[] { cbnodecals, cbnofakecontrast, cbclipmidtex, cbsmoothlighting }; - sectorFlags = new CheckBox[] { cbsilent, cbnofallingdamage, cbdropactors, cbnorespawn }; + sectorFlags = new CheckBox[] { cbsilent, cbnofallingdamage, cbdropactors, cbnorespawn, cbhidden }; renderStyles = new List() { "translucent", "add" }; @@ -108,10 +108,10 @@ namespace CodeImp.DoomBuilder.UDMFControls setDefaultUniversalProperties(sp.Linedef.Fields, defaultLinedefFields); break; - case VisualGeometryType.WALL_MIDDLE_3D: //all 3D-walls in a sector are linked to the same sidedef of control sector, so if many are selected, we need only one. + case VisualGeometryType.WALL_MIDDLE_3D: walls3dCount++; - if (wall3DIndeces.IndexOf(vg.Sector.Sector.FixedIndex) != -1) - break; + //if (wall3DIndeces.IndexOf(vg.Sector.Sector.FixedIndex) != -1) + //break; wall3DIndeces.Add(vg.Sector.Sector.FixedIndex); goto case VisualGeometryType.WALL_MIDDLE; @@ -120,6 +120,9 @@ namespace CodeImp.DoomBuilder.UDMFControls wallsMid.Add(sp); setDefaultUniversalProperties(sp.Sidedef.Fields, defaultSidedefFields); setDefaultUniversalProperties(sp.Linedef.Fields, defaultLinedefFields); + + if (sp.HasControlLinedef) + setDefaultUniversalProperties(sp.ControlSidedef.Fields, defaultSidedefFields); break; case VisualGeometryType.WALL_UPPER: @@ -176,8 +179,8 @@ namespace CodeImp.DoomBuilder.UDMFControls if (firstWall != null) { if(firstFloor == null){ //get shared values from wall //get values - float scaleX = (float)firstWall.Sidedef.Fields[KeyNames.GetScaleX(firstWall.GeometryType)].Value; - float scaleY = (float)firstWall.Sidedef.Fields[KeyNames.GetScaleY(firstWall.GeometryType)].Value; + float scaleX = (float)firstWall.ControlSidedef.Fields[KeyNames.GetScaleX(firstWall.GeometryType)].Value; + float scaleY = (float)firstWall.ControlSidedef.Fields[KeyNames.GetScaleY(firstWall.GeometryType)].Value; float translateX = (float)firstWall.Sidedef.Fields[KeyNames.GetTranslationX(firstWall.GeometryType)].Value; float translateY = (float)firstWall.Sidedef.Fields[KeyNames.GetTranslationY(firstWall.GeometryType)].Value; @@ -196,6 +199,8 @@ namespace CodeImp.DoomBuilder.UDMFControls if (walls3dCount == wallsMid.Count && wallsTop.Count == 0 && wallsBottom.Count == 0) { gbAlpha.Enabled = false; bgBrightness.Enabled = false; + //cblightabsolute.Checked = true; + //cblightabsolute.Enabled = false; } } @@ -248,6 +253,9 @@ namespace CodeImp.DoomBuilder.UDMFControls foreach (SurfaceProperties wall in list) { removeDefaultUniversalProperties(wall.Sidedef.Fields, defaultSidedefFields); removeDefaultUniversalProperties(wall.Linedef.Fields, defaultLinedefFields); + + if(wall.HasControlLinedef) + removeDefaultUniversalProperties(wall.ControlSidedef.Fields, defaultSidedefFields); } } } @@ -280,21 +288,41 @@ namespace CodeImp.DoomBuilder.UDMFControls //sidedef props private void setSidedefProperty(string propName, object value) { //special cases - if (propName == "scale" || propName == "offset") { + if (propName == "scale") { + General.Fail("use SetSidedefScale instead!"); + return; + }else if(propName == "offset"){ setPairedSidedefProperty(propName, (Vector2D)value); return; } //apply value - foreach (List list in walls) { - foreach (SurfaceProperties vg in list) - vg.Sidedef.Fields[propName].Value = value; - } + /*if (propName == "light" && !cblightabsolute.Checked) { + int light = (int)value > 0 ? (int)value : 0; + + //3d walls are lit as if "absolutelighting" flag is always set + foreach (List list in walls) { + foreach (SurfaceProperties vg in list) { + if (vg.GeometryType == VisualGeometryType.WALL_MIDDLE_3D) + vg.Sidedef.Fields[propName].Value = light; + else + vg.Sidedef.Fields[propName].Value = value; + } + } + } else {*/ + foreach (List list in walls) { + foreach (SurfaceProperties vg in list) { + if ((propName == "light" || propName == "lightabsolute") && vg.GeometryType == VisualGeometryType.WALL_MIDDLE_3D) //just... skip it for now + continue; + vg.Sidedef.Fields[propName].Value = value; + } + } + //} } private void setPairedSidedefProperty(string propName, Vector2D value) { - if (propName != "scale" && propName != "offset") - return; + if (propName == "scale") General.Fail("use SetScale instead!"); //dbg + if (propName != "offset") return; string upperNameX = "x_top"; string upperNameY = "y_top"; @@ -318,7 +346,7 @@ namespace CodeImp.DoomBuilder.UDMFControls val = (float)vg.Sidedef.Fields[props[index]].Value + value.x; vg.Sidedef.Fields[props[index]].Value = val; - val = (float)vg.Sidedef.Fields[props[index+1]].Value + value.y; + val = (float)vg.Sidedef.Fields[props[index + 1]].Value + value.y; vg.Sidedef.Fields[props[index + 1]].Value = val; } index += 2; @@ -427,6 +455,58 @@ namespace CodeImp.DoomBuilder.UDMFControls } } } + + private void setSidedefScale(Vector2D value) { + string[] props = new string[] { "scalex_top", "scaley_top", "scalex_mid", "scaley_mid", "scalex_bottom", "scaley_bottom" }; + List controlSectors = new List(); + int index = 0; + + //apply values + if (relativeMode) { + float val; + foreach (List list in walls) { //top -> middle -> bottom + foreach (SurfaceProperties vg in list) { + if (vg.HasControlLinedef) { + if (controlSectors.Contains(vg.ControlSidedef.Sector.FixedIndex)) + continue; + + val = (float)vg.ControlSidedef.Fields[props[index]].Value + value.x; + vg.ControlSidedef.Fields[props[index]].Value = val; + + val = (float)vg.ControlSidedef.Fields[props[index + 1]].Value + value.y; + vg.ControlSidedef.Fields[props[index + 1]].Value = val; + + controlSectors.Add(vg.ControlSidedef.Sector.FixedIndex); + } else { + val = (float)vg.Sidedef.Fields[props[index]].Value + value.x; + vg.Sidedef.Fields[props[index]].Value = val; + + val = (float)vg.Sidedef.Fields[props[index + 1]].Value + value.y; + vg.Sidedef.Fields[props[index + 1]].Value = val; + } + } + index += 2; + } + } else { + foreach (List list in walls) { //top -> middle -> bottom + foreach (SurfaceProperties vg in list) { + if (vg.HasControlLinedef) { + if (controlSectors.Contains(vg.ControlSidedef.Sector.FixedIndex)) + continue; + + vg.ControlSidedef.Fields[props[index]].Value = value.x; + vg.ControlSidedef.Fields[props[index + 1]].Value = value.y; + + controlSectors.Add(vg.ControlSidedef.Sector.FixedIndex); + } else { + vg.Sidedef.Fields[props[index]].Value = value.x; + vg.Sidedef.Fields[props[index + 1]].Value = value.y; + } + } + index += 2; + } + } + } //EVENTS private void btnOK_Click(object sender, EventArgs e) { @@ -495,7 +575,8 @@ namespace CodeImp.DoomBuilder.UDMFControls //scale private void scaleControl_OnValueChanged(object sender, EventArgs e) { - setSharedPairedProperty((string)scaleControl.Tag, relativeMode ? scaleControl.Delta : scaleControl.Value); + setPairedSectorProperty((string)scaleControl.Tag, relativeMode ? scaleControl.Delta : scaleControl.Value); + setSidedefScale(relativeMode ? scaleControl.Delta : scaleControl.Value); update(); } @@ -543,10 +624,13 @@ namespace CodeImp.DoomBuilder.UDMFControls } } - internal class SurfaceProperties { + internal sealed class SurfaceProperties { private Sector sector; public Sector Sector { get { return sector; } } + private Sidedef controlSidedef; + public Sidedef ControlSidedef { get { return controlSidedef; } } + private Sidedef sidedef; public Sidedef Sidedef { get { return sidedef; } } @@ -555,6 +639,9 @@ namespace CodeImp.DoomBuilder.UDMFControls public VisualGeometryType GeometryType { get { return vg.GeometryType; } } private VisualGeometry vg; + + private bool hasControlLinedef; + public bool HasControlLinedef { get { return hasControlLinedef; } } public SurfaceProperties(VisualGeometry visualGeometry) { vg = visualGeometry; @@ -563,8 +650,14 @@ namespace CodeImp.DoomBuilder.UDMFControls sector.Fields.BeforeFieldsChange(); } else { linedef = vg.GetControlLinedef(); - sidedef = linedef.Front; + + controlSidedef = linedef.Front; + sidedef = vg.Sidedef; + + hasControlLinedef = (controlSidedef.Sector.FixedIndex != sidedef.Sector.FixedIndex); + linedef.Fields.BeforeFieldsChange(); + controlSidedef.Fields.BeforeFieldsChange(); sidedef.Fields.BeforeFieldsChange(); } } @@ -575,7 +668,7 @@ namespace CodeImp.DoomBuilder.UDMFControls } - internal class KeyNames { + internal sealed class KeyNames { //SCALE public static string GetScaleX(VisualGeometryType type) { return getScale(type).Replace("$", "x");