diff --git a/Source/Core/Builder.sln b/Source/Core/Builder.sln index e219fd98..f9758a07 100644 --- a/Source/Core/Builder.sln +++ b/Source/Core/Builder.sln @@ -5,13 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Builder.csproj", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "..\Plugins\BuilderModes\BuilderModes.csproj", "{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StairSectorBuilder", "..\Plugins\StairSectorBuilder\StairSectorBuilder.csproj", "{3F365121-906B-409D-BB1E-37E0A78056C2}" - ProjectSection(ProjectDependencies) = postProject - {818B3D10-F791-4C3F-9AF5-BB2D0079B63C} = {818B3D10-F791-4C3F-9AF5-BB2D0079B63C} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "..\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,26 +35,6 @@ Global {B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|Mixed Platforms.Build.0 = Release|x86 {B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.ActiveCfg = Release|x86 {B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.Build.0 = Release|x86 - {3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x86.ActiveCfg = Debug|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Release|Any CPU.Build.0 = Release|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.ActiveCfg = Release|Any CPU - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Any CPU.ActiveCfg = Debug|x86 - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|x86.ActiveCfg = Debug|x86 - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|x86.Build.0 = Debug|x86 - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Any CPU.ActiveCfg = Release|x86 - {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/Core/Config/ProgramConfiguration.cs b/Source/Core/Config/ProgramConfiguration.cs index e0938d05..d6efed63 100644 --- a/Source/Core/Config/ProgramConfiguration.cs +++ b/Source/Core/Config/ProgramConfiguration.cs @@ -102,9 +102,11 @@ namespace CodeImp.DoomBuilder.Config private bool gzAnimateLights; private bool gzDrawFog; private bool gzToolbarGZDoom; + private bool gzSynchCameras; private int gzMaxDynamicLights; private float gzDynamicLightRadius; private float gzDynamicLightIntensity; + private bool gzTestFromCurrentPosition; // These are not stored in the configuration, only used at runtime private string defaulttexture; @@ -176,6 +178,8 @@ namespace CodeImp.DoomBuilder.Config public bool GZAnimateLights { get { return gzAnimateLights; } internal set { gzAnimateLights = value; } } public bool GZDrawFog { get { return gzDrawFog; } internal set { gzDrawFog = value; } } public bool GZToolbarGZDoom { get { return gzToolbarGZDoom; } internal set { gzToolbarGZDoom = value; } } + public bool GZSynchCameras { get { return gzSynchCameras; } internal set { gzSynchCameras = value; } } + public bool GZTestFromCurrentPosition { get { return gzTestFromCurrentPosition; } internal set { gzTestFromCurrentPosition = value; } } public int GZMaxDynamicLights { get { return gzMaxDynamicLights; } internal set { gzMaxDynamicLights = value; } } public float GZDynamicLightRadius { get { return gzDynamicLightRadius; } internal set { gzDynamicLightRadius = value; } } public float GZDynamicLightIntensity { get { return gzDynamicLightIntensity; } internal set { gzDynamicLightIntensity = value; } } @@ -267,6 +271,7 @@ namespace CodeImp.DoomBuilder.Config gzAnimateLights = cfg.ReadSetting("gzanimatelights", false); gzDrawFog = cfg.ReadSetting("gzdrawfog", false); gzToolbarGZDoom = cfg.ReadSetting("gztoolbargzdoom", true); + gzSynchCameras = cfg.ReadSetting("gzsynchcameras", true); gzMaxDynamicLights = cfg.ReadSetting("gzmaxdynamiclights", 16); gzDynamicLightRadius = cfg.ReadSetting("gzdynamiclightradius", 1.0f); gzDynamicLightIntensity = cfg.ReadSetting("gzdynamiclightintensity", 1.0f); @@ -339,6 +344,8 @@ namespace CodeImp.DoomBuilder.Config cfg.WriteSetting("gzdrawlights", gzDrawLights); cfg.WriteSetting("gzanimatelights", gzAnimateLights); cfg.WriteSetting("gzdrawfog", gzDrawFog); + cfg.WriteSetting("gzsynchcameras", gzSynchCameras); + cfg.WriteSetting("gztoolbargzdoom", gzToolbarGZDoom); cfg.WriteSetting("gzmaxdynamiclights", gzMaxDynamicLights); cfg.WriteSetting("gzdynamiclightradius", gzDynamicLightRadius); cfg.WriteSetting("gzdynamiclightintensity", gzDynamicLightIntensity); diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index db4e977a..7beac46e 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -30,6 +30,7 @@ using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Actions; using CodeImp.DoomBuilder.Geometry; +using CodeImp.DoomBuilder.VisualModes; using System.Drawing; #endregion @@ -79,6 +80,10 @@ namespace CodeImp.DoomBuilder.Editing // View panning protected bool panning; private bool autopanenabled; + + //mxd. used in "Play From Here" Action + private Thing playerStart; + private Vector3D playerStartPosition; #endregion @@ -131,7 +136,12 @@ namespace CodeImp.DoomBuilder.Editing mousebuttons = oldmode.mousebuttons; mouseinside = oldmode.mouseinside; mousedragging = oldmode.mousedragging; - } + + } else if (General.Settings.GZSynchCameras && General.Editing.Mode is VisualMode) { //mxd + //center 2d view on camera position in 3d view + Vector2D campos = new Vector2D(General.Map.VisualCamera.Position.x, General.Map.VisualCamera.Position.y); + renderer2d.PositionView(campos.x, campos.y); + } } // Disposer @@ -601,6 +611,63 @@ namespace CodeImp.DoomBuilder.Editing base.OnCancel(); } + //mxd + public override bool OnMapTestBegin() { + if (General.Settings.GZTestFromCurrentPosition) { + if(!mouseinside){ + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: mouse is outside editing vindow!"); + return false; + } + + //find Single Player Start. Should have Type 1 in all games + Thing start = null; + + foreach (Thing t in General.Map.Map.Things) { + if (t.Type == 1) { + //store thing and position + start = t; + break; + } + } + + if (start == null) { + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: no Player 1 start found!"); + return false; + } + + //now check if cursor is located inside a sector + Sector s = General.Map.Map.GetSectorByCoordinates(mousemappos); + + if(s == null){ + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: cursor is not inside sector!"); + return false; + } + + //41 = player's height in Doom. Is that so in all other games as well? + if (s.CeilHeight - s.FloorHeight < 41) { + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: sector is too low!"); + return false; + } + + //store initial position + playerStart = start; + playerStartPosition = start.Position; + + //everything should be valid, let's move player start here + start.Move(new Vector3D(mousemappos.x, mousemappos.y, s.FloorHeight)); + } + + return true; + } + + public override void OnMapTestEnd() { + if (General.Settings.GZTestFromCurrentPosition) { + //restore position + playerStart.Move(playerStartPosition); + playerStart = null; + } + } + /// /// This is called automatically when the Edit button is pressed. /// (in Doom Builder 1, this was always the right mousebutton) diff --git a/Source/Core/Editing/EditMode.cs b/Source/Core/Editing/EditMode.cs index 1524d0bf..95d4b31c 100644 --- a/Source/Core/Editing/EditMode.cs +++ b/Source/Core/Editing/EditMode.cs @@ -215,6 +215,10 @@ namespace CodeImp.DoomBuilder.Editing public virtual void OnReloadResources() { } public virtual void OnMapSetChangeBegin() { } public virtual void OnMapSetChangeEnd() { } + + //mxd. map testing events + public virtual bool OnMapTestBegin() { return true; } //called before test map is launched. Returns false if map launch is impossible + public virtual void OnMapTestEnd() { } //called after game engine is closed #endregion } diff --git a/Source/Core/General/Launcher.cs b/Source/Core/General/Launcher.cs index 33204cd9..536f5663 100644 --- a/Source/Core/General/Launcher.cs +++ b/Source/Core/General/Launcher.cs @@ -231,8 +231,40 @@ namespace CodeImp.DoomBuilder [BeginAction("testmap")] public void Test() { - TestAtSkill(General.Map.ConfigSettings.TestSkill); + General.Settings.GZTestFromCurrentPosition = false; //mxd + + bool canTest = true; //mxd + canTest = General.Editing.Mode.OnMapTestBegin(); //mxd + if (!canTest) return; //mxd + + //mxd. will that be EVER needed by someone other than me?.. + //canTest = General.Plugins.OnMapTestBegin(); //mxd + //if (!canTest) return; //mxd + + TestAtSkill(General.Map.ConfigSettings.TestSkill); + + General.Editing.Mode.OnMapTestEnd(); //mxd + //General.Plugins.OnMapTestEnd(); //mxd } + + //mxd + [BeginAction("testmapfromview")] + public void TestFromView() { + General.Settings.GZTestFromCurrentPosition = true; + + bool canTest = true; + canTest = General.Editing.Mode.OnMapTestBegin(); + if (!canTest) return; + + //canTest = General.Plugins.OnMapTestBegin(); + //if (!canTest) return; + + TestAtSkill(General.Map.ConfigSettings.TestSkill); + + General.Editing.Mode.OnMapTestEnd(); + //General.Plugins.OnMapTestEnd(); + General.MainWindow.RedrawDisplay(); + } // This saves the map to a temporary file and launches a test wit hthe given skill public void TestAtSkill(int skill) diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 43c71cb1..a56357ff 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -2733,6 +2733,26 @@ namespace CodeImp.DoomBuilder.Map return new List(lines.Values); } + //mxd + /// This returns a sector if given coordinates lie inide one. + public Sector GetSectorByCoordinates(Vector2D pos) { + Linedef nl; + Sector sector = null; + + nl = NearestLinedef(pos); + if (nl != null) { + // Check what side of line we are at + if (nl.SideOfLine(pos) < 0f) { + // Front side + if (nl.Front != null) sector = nl.Front.Sector; else sector = null; + } else { + // Back side + if (nl.Back != null) sector = nl.Back.Sector; else sector = null; + } + } + return sector; + } + /// This finds the line closest to the specified position. public Linedef NearestLinedef(Vector2D pos) { return MapSet.NearestLinedef(linedefs, pos); } diff --git a/Source/Core/Map/Thing.cs b/Source/Core/Map/Thing.cs index e4eb08a4..ab2dc356 100644 --- a/Source/Core/Map/Thing.cs +++ b/Source/Core/Map/Thing.cs @@ -214,7 +214,10 @@ namespace CodeImp.DoomBuilder.Map // This determines which sector the thing is in and links it public void DetermineSector() { - Linedef nl; + //mxd + sector = map.GetSectorByCoordinates(pos); + + /*Linedef nl; // Find the nearest linedef on the map nl = map.NearestLinedef(pos); @@ -235,7 +238,7 @@ namespace CodeImp.DoomBuilder.Map else { sector = null; - } + }*/ } // This determines which sector the thing is in and links it diff --git a/Source/Core/Plugins/Plug.cs b/Source/Core/Plugins/Plug.cs index aea5fef5..0e7aa054 100644 --- a/Source/Core/Plugins/Plug.cs +++ b/Source/Core/Plugins/Plug.cs @@ -184,6 +184,18 @@ namespace CodeImp.DoomBuilder.Plugins /// public virtual void OnMapSaveEnd(SavePurpose purpose) { } + //mxd + /// + /// Occurs before test map is launched. Return false if map launch is not desired. + /// + public virtual bool OnMapTestBegin() { return true; } + + //mxd + /// + /// Occurs after game engine is closed. + /// + public virtual void OnMapTestEnd() { } + /// /// Occurs before the MapSet is changed. This means that the active MapSet will be disposed and changed to a new one. /// diff --git a/Source/Core/Plugins/PluginManager.cs b/Source/Core/Plugins/PluginManager.cs index 2788ae51..48e89a9d 100644 --- a/Source/Core/Plugins/PluginManager.cs +++ b/Source/Core/Plugins/PluginManager.cs @@ -301,6 +301,17 @@ namespace CodeImp.DoomBuilder.Plugins public void OnEditRedrawDisplayBegin() { foreach(Plugin p in plugins) p.Plug.OnEditRedrawDisplayBegin(); } public void OnEditRedrawDisplayEnd() { foreach(Plugin p in plugins) p.Plug.OnEditRedrawDisplayEnd(); } public void OnPresentDisplayBegin() { foreach(Plugin p in plugins) p.Plug.OnPresentDisplayBegin(); } + + //mxd. test map events + public bool OnMapTestBegin() { + bool canLaunch; + foreach (Plugin p in plugins) { + canLaunch = p.Plug.OnMapTestBegin(); + if (!canLaunch) return false; + } + return true; + } + public void OnMapTestEnd() { foreach (Plugin p in plugins) p.Plug.OnMapTestEnd(); } #endregion } diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index 6ab1085b..5263287c 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -150,6 +150,8 @@ namespace CodeImp.DoomBuilder.Rendering public int VertexSize { get { return vertexsize; } } public ViewMode ViewMode { get { return viewmode; } } public SurfaceManager Surfaces { get { return surfaces; } } + //mxd + public RectangleF Viewport { get { return viewport; } } #endregion diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg index 427f7164..9dc1b55f 100644 --- a/Source/Core/Resources/Actions.cfg +++ b/Source/Core/Resources/Actions.cfg @@ -454,6 +454,18 @@ testmap allowscroll = false; } +//mxd +testmapfromview +{ + title = "Test Map from current position"; + category = "tools"; + description = "Starts the game and loads this map for playing. Player start is placed either at cursor position (in 2D-Modes) or at camera position (in Visual Modes)."; + allowkeys = true; + allowmouse = false; + allowscroll = false; + default = 131192; +} + thingsfilterssetup { title = "Configure Things Filters"; diff --git a/Source/Core/VisualModes/VisualMode.cs b/Source/Core/VisualModes/VisualMode.cs index 1b072a29..b9c2ef06 100644 --- a/Source/Core/VisualModes/VisualMode.cs +++ b/Source/Core/VisualModes/VisualMode.cs @@ -73,6 +73,10 @@ namespace CodeImp.DoomBuilder.VisualModes //mxd private List selectedVisualThings; private List selectedVisualSectors; + //used in "Play From Here" Action + private Thing playerStart; + private Vector3D playerStartPosition; + private float playerStartAngle; // Map protected VisualBlockMap blockmap; @@ -115,6 +119,34 @@ namespace CodeImp.DoomBuilder.VisualModes this.visiblethings = new List(100); this.processgeometry = true; this.processthings = true; + + //mxd. Synch camera position to cursor position or center of the screen in 2d-mode + if (General.Settings.GZSynchCameras && General.Editing.Mode is ClassicMode) { + ClassicMode oldmode = General.Editing.Mode as ClassicMode; + Vector2D pos2d; + + if (oldmode.IsMouseInside) + pos2d = new Vector2D(oldmode.MouseMapPos.x, oldmode.MouseMapPos.y); + else + pos2d = new Vector2D(General.Map.CRenderer2D.Viewport.Left + General.Map.CRenderer2D.Viewport.Width / 2.0f, General.Map.CRenderer2D.Viewport.Top + General.Map.CRenderer2D.Viewport.Height / 2.0f); + + //if position is inside sector - adjust camera.z accordingly + Sector sector = General.Map.Map.GetSectorByCoordinates(pos2d); + + float posz = 0; + if (sector != null) { + int sectorHeight = sector.CeilHeight - sector.FloorHeight; + if (sectorHeight < 41) { + posz = sector.FloorHeight + sectorHeight / 2; + } else { + posz = sector.FloorHeight + 41; // same as in doom + } + }else{ + posz = General.Map.VisualCamera.Position.z; + } + + General.Map.VisualCamera.Position = new Vector3D(pos2d.x, pos2d.y, posz); + } } // Disposer @@ -226,6 +258,62 @@ namespace CodeImp.DoomBuilder.VisualModes base.OnReloadResources(); ResourcesReloaded(); } + + //mxd + public override bool OnMapTestBegin() { + if (General.Settings.GZTestFromCurrentPosition) { + //find Single Player Start. Should have Type 1 in all games + Thing start = null; + + foreach (Thing t in General.Map.Map.Things) { + if (t.Type == 1) { + //store thing and position + start = t; + break; + } + } + + if (start == null) { + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: no Player 1 start found!"); + return false; + } + + //now check if camera is located inside a sector + Vector3D camPos = General.Map.VisualCamera.Position; + Sector s = General.Map.Map.GetSectorByCoordinates(new Vector2D(camPos.x, camPos.y)); + + if (s == null) { + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: cursor is not inside sector!"); + return false; + } + + //41 = player's height in Doom. Is that so in all other games as well? + if (s.CeilHeight - s.FloorHeight < 41) { + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: sector is too low!"); + return false; + } + + //store initial position + playerStart = start; + playerStartPosition = start.Position; + playerStartAngle = start.Angle; + + //everything should be valid, let's move player start here + start.Move(new Vector3D(camPos.x, camPos.y, s.FloorHeight)); + start.Rotate(General.Map.VisualCamera.AngleXY - (float)Math.PI); + } + return true; + } + + //mxd + public override void OnMapTestEnd() { + if (General.Settings.GZTestFromCurrentPosition) { + //restore position + playerStart.Move(playerStartPosition); + playerStart.Rotate(playerStartAngle); + playerStart = null; + } + } #endregion diff --git a/Source/Core/Windows/PreferencesForm.Designer.cs b/Source/Core/Windows/PreferencesForm.Designer.cs index f7091440..089a4444 100644 --- a/Source/Core/Windows/PreferencesForm.Designer.cs +++ b/Source/Core/Windows/PreferencesForm.Designer.cs @@ -115,6 +115,8 @@ namespace CodeImp.DoomBuilder.Windows this.actiondescription = new System.Windows.Forms.Label(); this.tabcolors = new System.Windows.Forms.TabPage(); this.appearancegroup1 = new System.Windows.Forms.GroupBox(); + this.labelDynLightIntensity = new System.Windows.Forms.Label(); + this.tbDynLightIntensity = new Dotnetrix.Controls.TrackBar(); this.labelDynLightSize = new System.Windows.Forms.Label(); this.tbDynLightSize = new Dotnetrix.Controls.TrackBar(); this.labelDynLightCount = new System.Windows.Forms.Label(); @@ -146,8 +148,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabpasting = new System.Windows.Forms.TabPage(); this.label16 = new System.Windows.Forms.Label(); this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl(); - this.labelDynLightIntensity = new System.Windows.Forms.Label(); - this.tbDynLightIntensity = new Dotnetrix.Controls.TrackBar(); + this.cbSynchCameras = new System.Windows.Forms.CheckBox(); label7 = new System.Windows.Forms.Label(); label6 = new System.Windows.Forms.Label(); label5 = new System.Windows.Forms.Label(); @@ -175,13 +176,13 @@ namespace CodeImp.DoomBuilder.Windows this.actioncontrolpanel.SuspendLayout(); this.tabcolors.SuspendLayout(); this.appearancegroup1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tbDynLightIntensity)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbDynLightSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbDynLightCount)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).BeginInit(); this.colorsgroup3.SuspendLayout(); this.panel1.SuspendLayout(); this.tabpasting.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.tbDynLightIntensity)).BeginInit(); this.SuspendLayout(); // // label7 @@ -213,6 +214,7 @@ namespace CodeImp.DoomBuilder.Windows // // groupBox1 // + groupBox1.Controls.Add(this.cbSynchCameras); groupBox1.Controls.Add(this.showtexturesizes); groupBox1.Controls.Add(this.scriptontop); groupBox1.Controls.Add(this.zoomfactor); @@ -236,7 +238,7 @@ namespace CodeImp.DoomBuilder.Windows // showtexturesizes // this.showtexturesizes.AutoSize = true; - this.showtexturesizes.Location = new System.Drawing.Point(32, 276); + this.showtexturesizes.Location = new System.Drawing.Point(32, 258); this.showtexturesizes.Name = "showtexturesizes"; this.showtexturesizes.Size = new System.Drawing.Size(222, 18); this.showtexturesizes.TabIndex = 41; @@ -246,7 +248,7 @@ namespace CodeImp.DoomBuilder.Windows // scriptontop // this.scriptontop.AutoSize = true; - this.scriptontop.Location = new System.Drawing.Point(32, 248); + this.scriptontop.Location = new System.Drawing.Point(32, 234); this.scriptontop.Name = "scriptontop"; this.scriptontop.Size = new System.Drawing.Size(237, 18); this.scriptontop.TabIndex = 40; @@ -256,7 +258,7 @@ namespace CodeImp.DoomBuilder.Windows // zoomfactor // this.zoomfactor.LargeChange = 1; - this.zoomfactor.Location = new System.Drawing.Point(127, 187); + this.zoomfactor.Location = new System.Drawing.Point(127, 181); this.zoomfactor.Minimum = 1; this.zoomfactor.Name = "zoomfactor"; this.zoomfactor.Size = new System.Drawing.Size(116, 45); @@ -268,7 +270,7 @@ namespace CodeImp.DoomBuilder.Windows // zoomfactorlabel // this.zoomfactorlabel.AutoSize = true; - this.zoomfactorlabel.Location = new System.Drawing.Point(249, 199); + this.zoomfactorlabel.Location = new System.Drawing.Point(249, 193); this.zoomfactorlabel.Name = "zoomfactorlabel"; this.zoomfactorlabel.Size = new System.Drawing.Size(29, 14); this.zoomfactorlabel.TabIndex = 39; @@ -277,7 +279,7 @@ namespace CodeImp.DoomBuilder.Windows // label19 // this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(52, 199); + this.label19.Location = new System.Drawing.Point(52, 193); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(69, 14); this.label19.TabIndex = 38; @@ -286,7 +288,7 @@ namespace CodeImp.DoomBuilder.Windows // autoscrollspeed // this.autoscrollspeed.LargeChange = 1; - this.autoscrollspeed.Location = new System.Drawing.Point(127, 135); + this.autoscrollspeed.Location = new System.Drawing.Point(127, 129); this.autoscrollspeed.Maximum = 5; this.autoscrollspeed.Name = "autoscrollspeed"; this.autoscrollspeed.Size = new System.Drawing.Size(116, 45); @@ -297,7 +299,7 @@ namespace CodeImp.DoomBuilder.Windows // autoscrollspeedlabel // this.autoscrollspeedlabel.AutoSize = true; - this.autoscrollspeedlabel.Location = new System.Drawing.Point(249, 147); + this.autoscrollspeedlabel.Location = new System.Drawing.Point(249, 141); this.autoscrollspeedlabel.Name = "autoscrollspeedlabel"; this.autoscrollspeedlabel.Size = new System.Drawing.Size(23, 14); this.autoscrollspeedlabel.TabIndex = 36; @@ -306,7 +308,7 @@ namespace CodeImp.DoomBuilder.Windows // label15 // this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(29, 147); + this.label15.Location = new System.Drawing.Point(29, 141); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(92, 14); this.label15.TabIndex = 35; @@ -315,7 +317,7 @@ namespace CodeImp.DoomBuilder.Windows // previewsize // this.previewsize.LargeChange = 1; - this.previewsize.Location = new System.Drawing.Point(127, 81); + this.previewsize.Location = new System.Drawing.Point(127, 75); this.previewsize.Maximum = 5; this.previewsize.Name = "previewsize"; this.previewsize.Size = new System.Drawing.Size(116, 45); @@ -327,7 +329,7 @@ namespace CodeImp.DoomBuilder.Windows // previewsizelabel // this.previewsizelabel.AutoSize = true; - this.previewsizelabel.Location = new System.Drawing.Point(249, 93); + this.previewsizelabel.Location = new System.Drawing.Point(249, 87); this.previewsizelabel.Name = "previewsizelabel"; this.previewsizelabel.Size = new System.Drawing.Size(55, 14); this.previewsizelabel.TabIndex = 33; @@ -336,7 +338,7 @@ namespace CodeImp.DoomBuilder.Windows // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(17, 93); + this.label12.Location = new System.Drawing.Point(17, 87); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(104, 14); this.label12.TabIndex = 32; @@ -345,7 +347,7 @@ namespace CodeImp.DoomBuilder.Windows // label14 // this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(50, 41); + this.label14.Location = new System.Drawing.Point(50, 35); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(71, 14); this.label14.TabIndex = 14; @@ -360,7 +362,7 @@ namespace CodeImp.DoomBuilder.Windows "Brightness Levels", "Floor Textures", "Ceiling Textures"}); - this.defaultviewmode.Location = new System.Drawing.Point(135, 38); + this.defaultviewmode.Location = new System.Drawing.Point(135, 32); this.defaultviewmode.Name = "defaultviewmode"; this.defaultviewmode.Size = new System.Drawing.Size(145, 22); this.defaultviewmode.TabIndex = 0; @@ -395,6 +397,16 @@ namespace CodeImp.DoomBuilder.Windows label20.Text = "Dynamic light size:"; label20.TextAlign = System.Drawing.ContentAlignment.TopRight; // + // label21 + // + label21.AutoSize = true; + label21.Location = new System.Drawing.Point(55, 174); + label21.Name = "label21"; + label21.Size = new System.Drawing.Size(116, 14); + label21.TabIndex = 31; + label21.Text = "Dynamic light intensity:"; + label21.TextAlign = System.Drawing.ContentAlignment.TopRight; + // // keyusedlabel // this.keyusedlabel.AutoSize = true; @@ -1183,6 +1195,27 @@ namespace CodeImp.DoomBuilder.Windows this.appearancegroup1.TabStop = false; this.appearancegroup1.Text = " Additional Options "; // + // labelDynLightIntensity + // + this.labelDynLightIntensity.AutoSize = true; + this.labelDynLightIntensity.Location = new System.Drawing.Point(337, 174); + this.labelDynLightIntensity.Name = "labelDynLightIntensity"; + this.labelDynLightIntensity.Size = new System.Drawing.Size(22, 14); + this.labelDynLightIntensity.TabIndex = 32; + this.labelDynLightIntensity.Text = "1.0"; + // + // tbDynLightIntensity + // + this.tbDynLightIntensity.LargeChange = 1; + this.tbDynLightIntensity.Location = new System.Drawing.Point(176, 161); + this.tbDynLightIntensity.Minimum = 1; + this.tbDynLightIntensity.Name = "tbDynLightIntensity"; + this.tbDynLightIntensity.Size = new System.Drawing.Size(154, 45); + this.tbDynLightIntensity.TabIndex = 30; + this.tbDynLightIntensity.TickStyle = System.Windows.Forms.TickStyle.Both; + this.tbDynLightIntensity.Value = 10; + this.tbDynLightIntensity.ValueChanged += new System.EventHandler(this.tbDynLightIntensity_ValueChanged); + // // labelDynLightSize // this.labelDynLightSize.AutoSize = true; @@ -1551,36 +1584,15 @@ namespace CodeImp.DoomBuilder.Windows this.pasteoptions.Size = new System.Drawing.Size(666, 427); this.pasteoptions.TabIndex = 0; // - // label21 + // cbSynchCameras // - label21.AutoSize = true; - label21.Location = new System.Drawing.Point(55, 174); - label21.Name = "label21"; - label21.Size = new System.Drawing.Size(116, 14); - label21.TabIndex = 31; - label21.Text = "Dynamic light intensity:"; - label21.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // labelDynLightIntensity - // - this.labelDynLightIntensity.AutoSize = true; - this.labelDynLightIntensity.Location = new System.Drawing.Point(337, 174); - this.labelDynLightIntensity.Name = "labelDynLightIntensity"; - this.labelDynLightIntensity.Size = new System.Drawing.Size(22, 14); - this.labelDynLightIntensity.TabIndex = 32; - this.labelDynLightIntensity.Text = "1.0"; - // - // tbDynLightIntensity - // - this.tbDynLightIntensity.LargeChange = 1; - this.tbDynLightIntensity.Location = new System.Drawing.Point(176, 161); - this.tbDynLightIntensity.Minimum = 1; - this.tbDynLightIntensity.Name = "tbDynLightIntensity"; - this.tbDynLightIntensity.Size = new System.Drawing.Size(154, 45); - this.tbDynLightIntensity.TabIndex = 30; - this.tbDynLightIntensity.TickStyle = System.Windows.Forms.TickStyle.Both; - this.tbDynLightIntensity.Value = 10; - this.tbDynLightIntensity.ValueChanged += new System.EventHandler(this.tbDynLightIntensity_ValueChanged); + this.cbSynchCameras.AutoSize = true; + this.cbSynchCameras.Location = new System.Drawing.Point(32, 282); + this.cbSynchCameras.Name = "cbSynchCameras"; + this.cbSynchCameras.Size = new System.Drawing.Size(270, 18); + this.cbSynchCameras.TabIndex = 42; + this.cbSynchCameras.Text = "Synch camera position between 2D and 3D modes"; + this.cbSynchCameras.UseVisualStyleBackColor = true; // // PreferencesForm // @@ -1630,6 +1642,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabcolors.ResumeLayout(false); this.appearancegroup1.ResumeLayout(false); this.appearancegroup1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tbDynLightIntensity)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tbDynLightSize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tbDynLightCount)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).EndInit(); @@ -1637,7 +1650,6 @@ namespace CodeImp.DoomBuilder.Windows this.colorsgroup3.PerformLayout(); this.panel1.ResumeLayout(false); this.tabpasting.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.tbDynLightIntensity)).EndInit(); this.ResumeLayout(false); } @@ -1755,5 +1767,6 @@ namespace CodeImp.DoomBuilder.Windows private Dotnetrix.Controls.TrackBar tbDynLightSize; private System.Windows.Forms.Label labelDynLightIntensity; private Dotnetrix.Controls.TrackBar tbDynLightIntensity; + private System.Windows.Forms.CheckBox cbSynchCameras; } } \ No newline at end of file diff --git a/Source/Core/Windows/PreferencesForm.cs b/Source/Core/Windows/PreferencesForm.cs index aee1d76b..162c7d6c 100644 --- a/Source/Core/Windows/PreferencesForm.cs +++ b/Source/Core/Windows/PreferencesForm.cs @@ -93,9 +93,10 @@ namespace CodeImp.DoomBuilder.Windows toolbar_viewmodes.Checked = General.Settings.ToolbarViewModes; toolbar_geometry.Checked = General.Settings.ToolbarGeometry; toolbar_testing.Checked = General.Settings.ToolbarTesting; + showtexturesizes.Checked = General.Settings.ShowTextureSizes; //mxd toolbar_gzdoom.Checked = General.Settings.GZToolbarGZDoom; - showtexturesizes.Checked = General.Settings.ShowTextureSizes; + cbSynchCameras.Checked = General.Settings.GZSynchCameras; tbDynLightCount.Value = General.Settings.GZMaxDynamicLights; labelDynLightCount.Text = General.Settings.GZMaxDynamicLights.ToString(); tbDynLightSize.Value = (int)(General.Settings.GZDynamicLightRadius * 10); @@ -268,6 +269,8 @@ namespace CodeImp.DoomBuilder.Windows General.Settings.QualityDisplay = qualitydisplay.Checked; //mxd + General.Settings.GZSynchCameras = cbSynchCameras.Checked; + General.Settings.GZToolbarGZDoom = toolbar_gzdoom.Checked; General.Settings.GZMaxDynamicLights = tbDynLightCount.Value; General.Settings.GZDynamicLightRadius = ((float)tbDynLightSize.Value / 10.0f); General.Settings.GZDynamicLightIntensity = ((float)tbDynLightIntensity.Value / 10.0f); diff --git a/Source/Plugins/BuilderModes/BuilderModes.csproj b/Source/Plugins/BuilderModes/BuilderModes.csproj index 5be9879e..65be6100 100644 --- a/Source/Plugins/BuilderModes/BuilderModes.csproj +++ b/Source/Plugins/BuilderModes/BuilderModes.csproj @@ -266,6 +266,7 @@ + UserControl diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs index be114e76..d2b49dd9 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs @@ -35,7 +35,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes { //got shape int bevelSign = (bevelWidth > 0 ? 1 : -1); - int bevel = Math.Min(Math.Abs(bevelWidth), Math.Min(width, height) / 2) * bevelSign; + currentBevelWidth = Math.Min(Math.Abs(bevelWidth), Math.Min(width, height) / 2) * bevelSign; Vector2D[] shape = new Vector2D[subdivisions + 1]; @@ -43,8 +43,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes { int hw = width / 2; int hh = height / 2; - if (bevel != bevelWidth) bevelWidth = bevel; - Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh); float curAngle = 0; float angleStep = -(float)Math.PI / subdivisions * 2; @@ -52,8 +50,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes { for (int i = 0; i < subdivisions; i++) { if (doBevel) { - px = (int)(center.x - (float)Math.Sin(curAngle) * (hw + bevel)); - py = (int)(center.y - (float)Math.Cos(curAngle) * (hh + bevel)); + px = (int)(center.x - (float)Math.Sin(curAngle) * (hw + currentBevelWidth)); + py = (int)(center.y - (float)Math.Cos(curAngle) * (hh + currentBevelWidth)); } else { px = (int)(center.x - (float)Math.Sin(curAngle) * hw); py = (int)(center.y - (float)Math.Cos(curAngle) * hh); @@ -67,6 +65,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes { return shape; } + protected override string getHintText() { + return "BVL: "+bevelWidth+"; VERTS: "+subdivisions; + } + //ACTIONS override protected void increaseSubdivLevel() { if (subdivisions < maxSubdivisions) { diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs index 81f55433..d506164e 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs @@ -21,8 +21,9 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes public class DrawRectangleMode : DrawGeometryMode { - //private LineLengthLabel hintLabel; + private HintLabel hintLabel; protected int bevelWidth; + protected int currentBevelWidth; protected int subdivisions; protected int maxSubdivisions = 16; @@ -36,8 +37,11 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes protected int width; protected int height; + protected PixelColor cornersColor; + public DrawRectangleMode() : base() { snaptogrid = true; + cornersColor = General.Colors.BrightColors[new Random().Next(General.Colors.BrightColors.Length - 1)]; } override protected void Update() { @@ -63,25 +67,33 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes for (int i = 1; i < shape.Length; i++) renderer.RenderLine(shape[i - 1], shape[i], LINE_THICKNESS, color, true); + //vertices + for (int i = 0; i < shape.Length; i++) + renderer.RenderRectangleFilled(new RectangleF(shape[i].x - vsize, shape[i].y - vsize, vsize * 2.0f, vsize * 2.0f), color, true); + //and labels - Vector2D[] labelCoords = new Vector2D[]{start, new Vector2D(end.x, start.y), end, new Vector2D(start.x, end.y), start}; + Vector2D[] labelCoords = new Vector2D[] { start, new Vector2D(end.x, start.y), end, new Vector2D(start.x, end.y), start }; for (int i = 1; i < 5; i++) { labels[i - 1].Start = labelCoords[i - 1]; labels[i - 1].End = labelCoords[i]; renderer.RenderText(labels[i - 1].TextLabel); } - //render hint - /*if (width > 64 * vsize && height > 32 * vsize) { - float vPos = start.y + height / 2.0f; - hintLabel.Start = new Vector2D(start.x, vPos); - hintLabel.End = new Vector2D(end.x, vPos); - renderer.RenderText(hintLabel.TextLabel); //todo: extend LieLengthLabel class - }*/ - - // Render vertices - for (int i = 0; i < shape.Length; i++) - renderer.RenderRectangleFilled(new RectangleF(shape[i].x - vsize, shape[i].y - vsize, vsize * 2.0f, vsize * 2.0f), color, true); + //got beveled corners? + if (shape.Length > 5) { + //render hint + if (width > 64 * vsize && height > 16 * vsize) { + float vPos = start.y + height / 2.0f; + hintLabel.Start = new Vector2D(start.x, vPos); + hintLabel.End = new Vector2D(end.x, vPos); + hintLabel.Text = getHintText(); + renderer.RenderText(hintLabel.TextLabel); + } + + //and shape corners + for (int i = 0; i < 4; i++) + renderer.RenderRectangleFilled(new RectangleF(labelCoords[i].x - vsize, labelCoords[i].y - vsize, vsize * 2.0f, vsize * 2.0f), cornersColor, true); + } } else { // Render vertex at cursor renderer.RenderRectangleFilled(new RectangleF(curp.pos.x - vsize, curp.pos.y - vsize, vsize * 2.0f, vsize * 2.0f), color, true); @@ -97,37 +109,39 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes protected virtual Vector2D[] getShape(Vector2D pStart, Vector2D pEnd) { //no shape - if (pEnd.x == pStart.x && pEnd.y == pStart.y) + if (pEnd.x == pStart.x && pEnd.y == pStart.y) { + currentBevelWidth = 0; return new Vector2D[0]; + } //no corners - if (bevelWidth == 0) + if (bevelWidth == 0) { + currentBevelWidth = 0; return new Vector2D[] { pStart, new Vector2D((int)pEnd.x, (int)pStart.y), pEnd, new Vector2D((int)pStart.x, (int)pEnd.y), pStart }; + } //got corners bool reverse = false; - int bevel = Math.Min(Math.Abs(bevelWidth), Math.Min(width, height) / 2); + currentBevelWidth = Math.Min(Math.Abs(bevelWidth), Math.Min(width, height) / 2); - if (subdivisions > 0 && bevelWidth < 0) { - bevel *= -1; + if (bevelWidth < 0) { + currentBevelWidth *= -1; reverse = true; } - if (bevel != bevelWidth) bevelWidth = bevel; - List l_points = new List(); //top-left corner - l_points.AddRange(getCornerPoints(pStart, bevel, bevel, !reverse)); + l_points.AddRange(getCornerPoints(pStart, currentBevelWidth, currentBevelWidth, !reverse)); //top-right corner - l_points.AddRange(getCornerPoints(new Vector2D(pEnd.x, pStart.y), -bevel, bevel, reverse)); + l_points.AddRange(getCornerPoints(new Vector2D(pEnd.x, pStart.y), -currentBevelWidth, currentBevelWidth, reverse)); //bottom-right corner - l_points.AddRange(getCornerPoints(pEnd, -bevel, -bevel, !reverse)); + l_points.AddRange(getCornerPoints(pEnd, -currentBevelWidth, -currentBevelWidth, !reverse)); //bottom-left corner - l_points.AddRange(getCornerPoints(new Vector2D(pStart.x, pEnd.y), bevel, -bevel, reverse)); + l_points.AddRange(getCornerPoints(new Vector2D(pStart.x, pEnd.y), currentBevelWidth, -currentBevelWidth, reverse)); //closing point l_points.Add(l_points[0]); @@ -139,15 +153,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes private Vector2D[] getCornerPoints(Vector2D startPoint, int bevel_width, int bevel_height, bool reverse) { Vector2D[] points; - if (subdivisions == 0) { - points = new Vector2D[2]; - points[0] = new Vector2D(startPoint.x, startPoint.y + bevel_height); - points[1] = new Vector2D(startPoint.x + bevel_width, startPoint.y); - - if (!reverse) Array.Reverse(points); - return points; - } - Vector2D center = (bevelWidth > 0 ? new Vector2D(startPoint.x + bevel_width, startPoint.y + bevel_height) : startPoint); float curAngle = (float)Math.PI; @@ -164,6 +169,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes return points; } + protected virtual string getHintText() { + return "BVL: " + bevelWidth + "; SUB: " + subdivisions; + } + //update top-left and bottom-right points, which define drawing shape private void updateReferencePoints(DrawnVertex p1, DrawnVertex p2) { if (p1.pos.x < p2.pos.x) { @@ -200,7 +209,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes if (points.Count == 1) { //add point and labels labels.AddRange(new LineLengthLabel[] { new LineLengthLabel(), new LineLengthLabel(), new LineLengthLabel(), new LineLengthLabel() }); - //hintLabel = new LineLengthLabel(); + hintLabel = new HintLabel(); Update(); } else if (points[0].pos == points[1].pos) { //nothing is drawn points = new List(); @@ -298,14 +307,18 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes [BeginAction("increasebevel")] protected virtual void increaseBevel() { - bevelWidth += General.Map.Grid.GridSize; - Update(); + if (currentBevelWidth == bevelWidth || bevelWidth < 0) { + bevelWidth += General.Map.Grid.GridSize; + Update(); + } } [BeginAction("decreasebevel")] protected virtual void decreaseBevel() { - bevelWidth -= General.Map.Grid.GridSize; - Update(); + if (currentBevelWidth == bevelWidth || bevelWidth > 0) { + bevelWidth -= General.Map.Grid.GridSize; + Update(); + } } } } diff --git a/Source/Plugins/BuilderModes/General/HintLabel.cs b/Source/Plugins/BuilderModes/General/HintLabel.cs new file mode 100644 index 00000000..3a7c1d86 --- /dev/null +++ b/Source/Plugins/BuilderModes/General/HintLabel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; + +using CodeImp.DoomBuilder.Rendering; +using CodeImp.DoomBuilder.Geometry; + +namespace CodeImp.DoomBuilder.BuilderModes +{ + public class HintLabel : LineLengthLabel + { + private const int TEXT_CAPACITY = 32; + private const float TEXT_SCALE = 10f; + + private string text = ""; + public string Text { + get { + return text; + } + set { + text = value; + Update(); + } + } + + public HintLabel() : base() { + label.Color = General.Colors.BrightColors[new Random().Next(General.Colors.BrightColors.Length - 1)]; + } + + protected override void Update() { + Vector2D delta = end - start; + float length = delta.GetLength(); + label.Text = text; + label.Rectangle = new RectangleF(start.x + delta.x * 0.5f, start.y + delta.y * 0.5f, 0f, 0f); + } + } +} diff --git a/Source/Plugins/BuilderModes/General/LineLengthLabel.cs b/Source/Plugins/BuilderModes/General/LineLengthLabel.cs index 2d6a4709..82f2be78 100644 --- a/Source/Plugins/BuilderModes/General/LineLengthLabel.cs +++ b/Source/Plugins/BuilderModes/General/LineLengthLabel.cs @@ -48,9 +48,9 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Variables - private TextLabel label; - private Vector2D start; - private Vector2D end; + protected TextLabel label; + protected Vector2D start; + protected Vector2D end; #endregion @@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Initialization - private void Initialize() + protected virtual void Initialize() { label = new TextLabel(TEXT_CAPACITY); label.AlignX = TextAlignmentX.Center; @@ -102,7 +102,7 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Methods // This updates the text - private void Update() + protected virtual void Update() { Vector2D delta = end - start; float length = delta.GetLength();