diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 0ba80cbd..cc46ff2f 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -1124,6 +1124,7 @@ + diff --git a/Source/Core/Config/ProgramConfiguration.cs b/Source/Core/Config/ProgramConfiguration.cs index f7f8cf88..8b1282d8 100644 --- a/Source/Core/Config/ProgramConfiguration.cs +++ b/Source/Core/Config/ProgramConfiguration.cs @@ -125,7 +125,8 @@ namespace CodeImp.DoomBuilder.Config private bool autoClearSideTextures; private bool storeSelectedEditTab; private bool checkforupdates; - private bool rendercomments; + private bool rendercomments; //mxd + private bool fixedthingsscale; //mxd private bool rendergrid; private bool dynamicgridsize; private int ignoredremoterevision; @@ -226,6 +227,7 @@ namespace CodeImp.DoomBuilder.Config public bool StoreSelectedEditTab { get { return storeSelectedEditTab; } internal set { storeSelectedEditTab = value; } } internal bool CheckForUpdates { get { return checkforupdates; } set { checkforupdates = value; } } //mxd public bool RenderComments { get { return rendercomments; } internal set { rendercomments = value; } } //mxd + public bool FixedThingsScale { get { return fixedthingsscale; } internal set { fixedthingsscale = value; } } //mxd public bool RenderGrid { get { return rendergrid; } internal set { rendergrid = value; } } //mxd public bool DynamicGridSize { get { return dynamicgridsize; } internal set { dynamicgridsize = value; } } //mxd internal int IgnoredRemoteRevision { get { return ignoredremoterevision; } set { ignoredremoterevision = value; } } //mxd @@ -348,6 +350,7 @@ namespace CodeImp.DoomBuilder.Config storeSelectedEditTab = cfg.ReadSetting("storeselectededittab", true); checkforupdates = cfg.ReadSetting("checkforupdates", true); //mxd rendercomments = cfg.ReadSetting("rendercomments", true); //mxd + fixedthingsscale = cfg.ReadSetting("fixedthingsscale", false); //mxd rendergrid = cfg.ReadSetting("rendergrid", true); //mxd dynamicgridsize = cfg.ReadSetting("dynamicgridsize", true); //mxd ignoredremoterevision = cfg.ReadSetting("ignoredremoterevision", 0); //mxd @@ -454,6 +457,7 @@ namespace CodeImp.DoomBuilder.Config cfg.WriteSetting("storeselectededittab", storeSelectedEditTab); cfg.WriteSetting("checkforupdates", checkforupdates); //mxd cfg.WriteSetting("rendercomments", rendercomments); //mxd + cfg.WriteSetting("fixedthingsscale", fixedthingsscale); //mxd cfg.WriteSetting("rendergrid", rendergrid); //mxd cfg.WriteSetting("dynamicgridsize", dynamicgridsize); //mxd cfg.WriteSetting("ignoredremoterevision", ignoredremoterevision); //mxd diff --git a/Source/Core/GZBuilder/Geometry/Line3D.cs b/Source/Core/GZBuilder/Geometry/Line3D.cs index 9f8c16d2..3cffa1aa 100644 --- a/Source/Core/GZBuilder/Geometry/Line3D.cs +++ b/Source/Core/GZBuilder/Geometry/Line3D.cs @@ -22,6 +22,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry { this.Start = start; this.End = end; + this.Start2D = start; + this.End2D = end; this.Color = General.Colors.InfoLine; this.RenderArrowhead = true; } @@ -30,6 +32,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry { this.Start = start; this.End = end; + this.Start2D = start; + this.End2D = end; this.Color = General.Colors.InfoLine; this.RenderArrowhead = renderArrowhead; } @@ -38,6 +42,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry { this.Start = start; this.End = end; + this.Start2D = start; + this.End2D = end; this.Color = color; this.RenderArrowhead = true; } @@ -46,6 +52,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry { this.Start = start; this.End = end; + this.Start2D = start; + this.End2D = end; this.Color = color; this.RenderArrowhead = renderArrowhead; } diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index af167f07..0aabb6af 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -2727,7 +2727,7 @@ namespace CodeImp.DoomBuilder.Map { float px = t.Position.x; float py = t.Position.y; - float ts = ((t.FixedSize && General.Map.Renderer2D.Scale > 1.0f) ? t.Size / General.Map.Renderer2D.Scale : t.Size); + float ts = (((t.FixedSize || General.Settings.FixedThingsScale) && General.Map.Renderer2D.Scale > 1.0f) ? t.Size / General.Map.Renderer2D.Scale : t.Size); //mxd. Within range? if(px < range.Left - ts || px > range.Right + ts || py < range.Top - ts || py > range.Bottom + ts) continue; diff --git a/Source/Core/Properties/Resources.Designer.cs b/Source/Core/Properties/Resources.Designer.cs index 6f347c28..987ee005 100644 --- a/Source/Core/Properties/Resources.Designer.cs +++ b/Source/Core/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.5485 +// Runtime Version:2.0.50727.5466 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -270,6 +270,13 @@ namespace CodeImp.DoomBuilder.Properties { } } + internal static System.Drawing.Bitmap FixedThingsScale { + get { + object obj = ResourceManager.GetObject("FixedThingsScale", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap fog { get { object obj = ResourceManager.GetObject("fog", resourceCulture); diff --git a/Source/Core/Properties/Resources.resx b/Source/Core/Properties/Resources.resx index 934380dc..6afe9016 100644 --- a/Source/Core/Properties/Resources.resx +++ b/Source/Core/Properties/Resources.resx @@ -562,4 +562,7 @@ ..\Resources\ScriptProperty.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\FixedThingsScale.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Source/Core/Rendering/IRenderer2D.cs b/Source/Core/Rendering/IRenderer2D.cs index 314a89fa..fc421521 100644 --- a/Source/Core/Rendering/IRenderer2D.cs +++ b/Source/Core/Rendering/IRenderer2D.cs @@ -73,6 +73,7 @@ namespace CodeImp.DoomBuilder.Rendering void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect, ImageData texture); void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords); void RenderArrows(ICollection line); //mxd + void RenderArrows(ICollection line, bool transformcoords); //mxd void RenderText(TextLabel text); void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords); void RenderHighlight(FlatVertex[] vertices, int color); //mxd diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index 3d76cd06..fd10e281 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -251,7 +251,6 @@ namespace CodeImp.DoomBuilder.Rendering // BACKGROUND case RendererLayer.Background: if((backimageverts == null) || (General.Map.Grid.Background.Texture == null)) break; - graphics.Device.SetTexture(0, General.Map.Grid.Background.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Grid.Background.Texture; graphics.Shaders.Display2D.SetSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.BeginPass(aapass); @@ -262,7 +261,6 @@ namespace CodeImp.DoomBuilder.Rendering // GRID case RendererLayer.Grid: - graphics.Device.SetTexture(0, backtex); graphics.Shaders.Display2D.Texture1 = backtex; graphics.Shaders.Display2D.SetSettings(1f / backsize.Width, 1f / backsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.BeginPass(aapass); @@ -272,7 +270,6 @@ namespace CodeImp.DoomBuilder.Rendering // GEOMETRY case RendererLayer.Geometry: - graphics.Device.SetTexture(0, plottertex); graphics.Shaders.Display2D.Texture1 = plottertex; graphics.Shaders.Display2D.SetSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.BeginPass(aapass); @@ -282,7 +279,6 @@ namespace CodeImp.DoomBuilder.Rendering // THINGS case RendererLayer.Things: - graphics.Device.SetTexture(0, thingstex); graphics.Shaders.Display2D.Texture1 = thingstex; graphics.Shaders.Display2D.SetSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.BeginPass(aapass); @@ -292,7 +288,6 @@ namespace CodeImp.DoomBuilder.Rendering // OVERLAY case RendererLayer.Overlay: - graphics.Device.SetTexture(0, overlaytex); graphics.Shaders.Display2D.Texture1 = overlaytex; graphics.Shaders.Display2D.SetSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.BeginPass(aapass); @@ -302,7 +297,6 @@ namespace CodeImp.DoomBuilder.Rendering // SURFACE case RendererLayer.Surface: - graphics.Device.SetTexture(0, surfacetex); graphics.Shaders.Display2D.Texture1 = surfacetex; graphics.Shaders.Display2D.SetSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.BeginPass(aapass); @@ -318,7 +312,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Present(); // Release binds - graphics.Device.SetTexture(0, null); graphics.Shaders.Display2D.Texture1 = null; graphics.Device.SetStreamSource(0, null, 0, 0); } @@ -964,19 +957,21 @@ namespace CodeImp.DoomBuilder.Rendering // This makes vertices for a thing // Returns false when not on the screen - private bool CreateThingBoxVerts(Thing t, ref FlatVertex[] verts, Dictionary thingsByPosition, int offset, PixelColor c) + private bool CreateThingBoxVerts(Thing t, ref FlatVertex[] verts, ref List bboxes, Dictionary thingsByPosition, int offset, PixelColor c, byte bboxalpha) { if(t.Size * scale < MINIMUM_THING_RADIUS) return false; //mxd. Don't render tiny little things - // Determine size - float circlesize = (t.FixedSize && (scale > 1.0f) ? t.Size /* * THING_CIRCLE_SIZE*/ : t.Size * scale /* * THING_CIRCLE_SIZE*/); + // Determine sizes + float circlesize = ((t.FixedSize || General.Settings.FixedThingsScale) && (scale > 1.0f) ? t.Size : t.Size * scale); + float bboxsize = ((!t.FixedSize && General.Settings.FixedThingsScale) && (scale > 1.0f) ? t.Size * scale : -1); //mxd + float screensize = Math.Max(circlesize, bboxsize); //mxd // Transform to screen coordinates Vector2D screenpos = ((Vector2D)t.Position).GetTransformed(translatex, translatey, scale, -scale); // Check if the thing is actually on screen - if(((screenpos.x + circlesize) <= 0.0f) || ((screenpos.x - circlesize) >= windowsize.Width) || - ((screenpos.y + circlesize) <= 0.0f) || ((screenpos.y - circlesize) >= windowsize.Height)) + if(((screenpos.x + screensize) <= 0.0f) || ((screenpos.x - screensize) >= windowsize.Width) || + ((screenpos.y + screensize) <= 0.0f) || ((screenpos.y - screensize) >= windowsize.Height)) return false; // Get integral color @@ -1014,6 +1009,22 @@ namespace CodeImp.DoomBuilder.Rendering //mxd. Add to list thingsByPosition.Add(t, screenpos); + //mxd. Add bounding box? + if(bboxsize > 0) + { + PixelColor boxcolor = c.WithAlpha(bboxalpha); + + Vector2D tl = new Vector2D(screenpos.x - bboxsize, screenpos.y - bboxsize); + Vector2D tr = new Vector2D(screenpos.x + bboxsize, screenpos.y - bboxsize); + Vector2D bl = new Vector2D(screenpos.x - bboxsize, screenpos.y + bboxsize); + Vector2D br = new Vector2D(screenpos.x + bboxsize, screenpos.y + bboxsize); + + bboxes.Add(new Line3D(tl, tr, boxcolor, false)); + bboxes.Add(new Line3D(tr, br, boxcolor, false)); + bboxes.Add(new Line3D(bl, br, boxcolor, false)); + bboxes.Add(new Line3D(tl, bl, boxcolor, false)); + } + // Done return true; } @@ -1022,7 +1033,7 @@ namespace CodeImp.DoomBuilder.Rendering private void CreateThingArrowVerts(Thing t, ref FlatVertex[] verts, Vector2D screenpos, int offset) { // Determine size - float arrowsize = (t.FixedSize && (scale > 1.0f) ? t.Size : t.Size * scale) * THING_ARROW_SIZE; //mxd + float arrowsize = ((t.FixedSize || General.Settings.FixedThingsScale) && (scale > 1.0f) ? t.Size : t.Size * scale) * THING_ARROW_SIZE; //mxd // Setup rotated rect for arrow float sinarrowsize = (float)Math.Sin(t.Angle + Angle2D.PI * 0.25f) * arrowsize; @@ -1100,6 +1111,7 @@ namespace CodeImp.DoomBuilder.Rendering // Make alpha color Color4 alphacolor = new Color4(alpha, 1.0f, 1.0f, 1.0f); + byte bboxalpha = (byte)(alpha * (General.Editing.Mode.GetType().Name == "ThingsMode" ? 128 : 255)); // Set renderstates for things rendering graphics.Device.SetRenderState(RenderState.CullMode, Cull.None); @@ -1113,7 +1125,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride); // Set things texture - graphics.Device.SetTexture(0, thingtexture.Texture); graphics.Shaders.Things2D.Texture1 = thingtexture.Texture; SetWorldTransformation(false); graphics.Shaders.Things2D.SetSettings(alpha); @@ -1125,6 +1136,7 @@ namespace CodeImp.DoomBuilder.Rendering // Determine next lock size int locksize = (things.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : things.Count; FlatVertex[] verts = new FlatVertex[THING_BUFFER_SIZE * 6]; + List bboxes = new List(locksize); //mxd //mxd Dictionary> thingsByType = new Dictionary>(); @@ -1148,7 +1160,7 @@ namespace CodeImp.DoomBuilder.Rendering // Create vertices PixelColor tc = fixedcolor ? c : DetermineThingColor(t); - if(CreateThingBoxVerts(t, ref verts, thingsByPosition, buffercount * 6, tc)) + if(CreateThingBoxVerts(t, ref verts, ref bboxes, thingsByPosition, buffercount * 6, tc, bboxalpha)) { buffercount++; @@ -1211,8 +1223,8 @@ namespace CodeImp.DoomBuilder.Rendering } if(sprite.Texture == null) sprite.CreateTexture(); - graphics.Device.SetTexture(0, sprite.Texture); graphics.Shaders.Things2D.Texture1 = sprite.Texture; + graphics.Shaders.Things2D.ApplySettings(); // Determine next lock size locksize = (group.Value.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : group.Value.Count; @@ -1223,7 +1235,7 @@ namespace CodeImp.DoomBuilder.Rendering totalcount = 0; float spriteWidth, spriteHeight; - float spriteScale = (group.Value[0].FixedSize && (scale > 1.0f)) ? 1.0f : scale; + float spriteScale = ((group.Value[0].FixedSize || General.Settings.FixedThingsScale) && (scale > 1.0f)) ? 1.0f : scale; if(sprite.Width > sprite.Height) { @@ -1285,7 +1297,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Shaders.Things2D.EndPass(); //mxd. Render thing arrows - graphics.Device.SetTexture(0, thingtexture.Texture); graphics.Shaders.Things2D.Texture1 = thingtexture.Texture; graphics.Shaders.Things2D.BeginPass(0); @@ -1393,6 +1404,9 @@ namespace CodeImp.DoomBuilder.Rendering } graphics.Shaders.Things2D.End(); + + //mxd. Render thing boxes + RenderArrows(bboxes, false); } } @@ -1501,7 +1515,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Shaders.Display2D.Texture1 = t; - graphics.Device.SetTexture(0, t); SetWorldTransformation(transformcoords); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); @@ -1558,7 +1571,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Shaders.Display2D.Texture1 = graphics.FontTexture; SetWorldTransformation(false); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, true); - graphics.Device.SetTexture(0, graphics.FontTexture); graphics.Device.SetStreamSource(0, text.VertexBuffer, 0, FlatVertex.Stride); // Draw @@ -1621,7 +1633,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.FogEnable, false); SetWorldTransformation(false); - graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Data.WhiteTexture.Texture; graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); @@ -1660,7 +1671,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.FogEnable, false); SetWorldTransformation(false); - graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Data.WhiteTexture.Texture; graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); @@ -1696,7 +1706,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.FogEnable, false); SetWorldTransformation(false); - graphics.Device.SetTexture(0, texture.Texture); graphics.Shaders.Display2D.Texture1 = texture.Texture; graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); @@ -1709,7 +1718,8 @@ namespace CodeImp.DoomBuilder.Rendering } //mxd - public void RenderArrows(ICollection lines) + public void RenderArrows(ICollection lines) { RenderArrows(lines, true); } + public void RenderArrows(ICollection lines, bool transformcoords) { if(lines.Count == 0) return; int pointscount = 0; @@ -1717,9 +1727,12 @@ namespace CodeImp.DoomBuilder.Rendering // Translate to screen coords, determine renderability foreach(Line3D line in lines) { - // Calculate screen positions - line.Start2D = ((Vector2D)line.Start).GetTransformed(translatex, translatey, scale, -scale); //start - line.End2D = ((Vector2D)line.End).GetTransformed(translatex, translatey, scale, -scale); //end + // Calculate screen positions? + if(transformcoords) + { + line.Start2D = ((Vector2D)line.Start).GetTransformed(translatex, translatey, scale, -scale); //start + line.End2D = ((Vector2D)line.End).GetTransformed(translatex, translatey, scale, -scale); //end + } float maxx = Math.Max(line.Start2D.x, line.End2D.x); float minx = Math.Min(line.Start2D.x, line.End2D.x); @@ -1798,7 +1811,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.FogEnable, false); SetWorldTransformation(false); - graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Data.WhiteTexture.Texture; graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); @@ -1854,7 +1866,6 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.FogEnable, false); SetWorldTransformation(false); - graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Data.WhiteTexture.Texture; graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index 91d0fd21..d368d12e 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -1814,13 +1814,11 @@ namespace CodeImp.DoomBuilder.Rendering if(crosshairbusy) { if(General.Map.Data.CrosshairBusy3D.Texture == null) General.Map.Data.CrosshairBusy3D.CreateTexture(); - graphics.Device.SetTexture(0, General.Map.Data.CrosshairBusy3D.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Data.CrosshairBusy3D.Texture; } else { if(General.Map.Data.Crosshair3D.Texture == null) General.Map.Data.Crosshair3D.CreateTexture(); - graphics.Device.SetTexture(0, General.Map.Data.Crosshair3D.Texture); graphics.Shaders.Display2D.Texture1 = General.Map.Data.Crosshair3D.Texture; } diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg index 1e2d752c..d0577f86 100644 --- a/Source/Core/Resources/Actions.cfg +++ b/Source/Core/Resources/Actions.cfg @@ -1026,6 +1026,16 @@ togglecomments //mxd allowscroll = false; } +togglefixedthingsscale //mxd +{ + title = "Toggle Fixed Things Scale"; + category = "view"; + description = "When enabled, Things will no longer be scaled based on current zoom level in Classic modes."; + allowkeys = true; + allowmouse = false; + allowscroll = false; +} + togglebrightness //mxd { title = "Toggle Full Brightness"; diff --git a/Source/Core/Resources/FixedThingsScale.png b/Source/Core/Resources/FixedThingsScale.png new file mode 100644 index 00000000..b94d1acf Binary files /dev/null and b/Source/Core/Resources/FixedThingsScale.png differ diff --git a/Source/Core/Windows/MainForm.Designer.cs b/Source/Core/Windows/MainForm.Designer.cs index 80a2556a..5a440216 100644 --- a/Source/Core/Windows/MainForm.Designer.cs +++ b/Source/Core/Windows/MainForm.Designer.cs @@ -181,6 +181,7 @@ namespace CodeImp.DoomBuilder.Windows this.buttonviewceilings = new System.Windows.Forms.ToolStripButton(); this.seperatorviews = new System.Windows.Forms.ToolStripSeparator(); this.buttontogglecomments = new System.Windows.Forms.ToolStripButton(); + this.buttontogglefixedthingsscale = new System.Windows.Forms.ToolStripButton(); this.buttonsnaptogrid = new System.Windows.Forms.ToolStripButton(); this.buttonautomerge = new System.Windows.Forms.ToolStripButton(); this.buttonautoclearsidetextures = new System.Windows.Forms.ToolStripButton(); @@ -255,6 +256,7 @@ namespace CodeImp.DoomBuilder.Windows this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.modecontrolsloolbar = new System.Windows.Forms.ToolStrip(); this.itemtogglecomments = new System.Windows.Forms.ToolStripMenuItem(); + this.itemtogglefixedthingsscale = new System.Windows.Forms.ToolStripMenuItem(); this.itemdynamicgridsize = new System.Windows.Forms.ToolStripMenuItem(); toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); @@ -738,6 +740,7 @@ namespace CodeImp.DoomBuilder.Windows this.itemfullbrightness, this.itemtogglegrid, this.itemtogglecomments, + this.itemtogglefixedthingsscale, this.toolStripSeparator4, this.menuzoom, this.itemgotocoords, @@ -1243,6 +1246,7 @@ namespace CodeImp.DoomBuilder.Windows this.buttonfullbrightness, this.buttontogglegrid, this.buttontogglecomments, + this.buttontogglefixedthingsscale, this.separatorfullbrightness, this.buttonviewnormal, this.buttonviewbrightness, @@ -1658,6 +1662,19 @@ namespace CodeImp.DoomBuilder.Windows this.buttontogglecomments.Text = "Show Comments"; this.buttontogglecomments.Click += new System.EventHandler(this.InvokeTaggedAction); // + // buttontogglefixedthingsscale + // + this.buttontogglefixedthingsscale.Checked = true; + this.buttontogglefixedthingsscale.CheckState = System.Windows.Forms.CheckState.Checked; + this.buttontogglefixedthingsscale.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttontogglefixedthingsscale.Image = global::CodeImp.DoomBuilder.Properties.Resources.FixedThingsScale; + this.buttontogglefixedthingsscale.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttontogglefixedthingsscale.Name = "buttontogglefixedthingsscale"; + this.buttontogglefixedthingsscale.Size = new System.Drawing.Size(23, 22); + this.buttontogglefixedthingsscale.Tag = "builder_togglefixedthingsscale"; + this.buttontogglefixedthingsscale.Text = "Fixed Things Scale"; + this.buttontogglefixedthingsscale.Click += new System.EventHandler(this.InvokeTaggedAction); + // // buttonsnaptogrid // this.buttonsnaptogrid.Checked = true; @@ -2429,6 +2446,18 @@ namespace CodeImp.DoomBuilder.Windows this.itemtogglecomments.Text = "Show Comments"; this.itemtogglecomments.Click += new System.EventHandler(this.InvokeTaggedAction); // + // itemtogglefixedthingsscale + // + this.itemtogglefixedthingsscale.Checked = true; + this.itemtogglefixedthingsscale.CheckOnClick = true; + this.itemtogglefixedthingsscale.CheckState = System.Windows.Forms.CheckState.Checked; + this.itemtogglefixedthingsscale.Image = global::CodeImp.DoomBuilder.Properties.Resources.FixedThingsScale; + this.itemtogglefixedthingsscale.Name = "itemtogglefixedthingsscale"; + this.itemtogglefixedthingsscale.Size = new System.Drawing.Size(215, 22); + this.itemtogglefixedthingsscale.Tag = "builder_togglefixedthingsscale"; + this.itemtogglefixedthingsscale.Text = "Fixed Things Scale"; + this.itemtogglefixedthingsscale.Click += new System.EventHandler(this.InvokeTaggedAction); + // // itemdynamicgridsize // this.itemdynamicgridsize.Checked = true; @@ -2694,6 +2723,7 @@ namespace CodeImp.DoomBuilder.Windows private ToolStripMenuItem item2zoom800; private ToolStripMenuItem itemzoom800; private ToolStripButton buttontogglecomments; + private ToolStripButton buttontogglefixedthingsscale; private ToolStripMenuItem itemlinedefcolors; private ToolStripSeparator separatorlinecolors; private ToolStripButton buttonlinededfcolors; @@ -2704,5 +2734,6 @@ namespace CodeImp.DoomBuilder.Windows private ToolStripButton buttontoggledynamicgrid; private ToolStripMenuItem itemdynamicgridsize; private ToolStripMenuItem itemtogglecomments; + private ToolStripMenuItem itemtogglefixedthingsscale; } } \ No newline at end of file diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index c465a5a1..81074154 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -2021,6 +2021,8 @@ namespace CodeImp.DoomBuilder.Windows buttontogglegrid.Checked = General.Settings.RenderGrid; //mxd buttontogglecomments.Visible = General.Settings.ToolbarViewModes && maploaded && General.Map.UDMF; //mxd buttontogglecomments.Checked = General.Settings.RenderComments; //mxd + buttontogglefixedthingsscale.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd + buttontogglefixedthingsscale.Checked = General.Settings.FixedThingsScale; //mxd separatorfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd buttonviewbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; buttonviewceilings.Visible = General.Settings.ToolbarViewModes && maploaded; @@ -2764,6 +2766,19 @@ namespace CodeImp.DoomBuilder.Windows RedrawDisplay(); } + //mxd. Action to toggle fixed things scale + [BeginAction("togglefixedthingsscale")] + internal void ToggleFixedThingsScale() + { + buttontogglefixedthingsscale.Checked = !buttontogglefixedthingsscale.Checked; + itemtogglefixedthingsscale.Checked = buttontogglefixedthingsscale.Checked; + General.Settings.FixedThingsScale = buttontogglefixedthingsscale.Checked; + DisplayStatus(StatusType.Action, "Fixed things scale is " + (buttontogglefixedthingsscale.Checked ? "ENABLED" : "DISABLED")); + + // Redraw display to show changes + RedrawDisplay(); + } + // Action to toggle snap to grid [BeginAction("togglesnap")] internal void ToggleSnapToGrid() @@ -2864,6 +2879,8 @@ namespace CodeImp.DoomBuilder.Windows itemtoggleinfo.Checked = IsInfoPanelExpanded; itemtogglecomments.Visible = (General.Map != null && General.Map.UDMF); //mxd itemtogglecomments.Checked = General.Settings.RenderComments; //mxd + itemtogglefixedthingsscale.Visible = (General.Map != null); //mxd + itemtogglefixedthingsscale.Checked = General.Settings.FixedThingsScale; //mxd // View mode items if(General.Map != null) diff --git a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs index bfb39f2f..ca686ced 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs @@ -760,7 +760,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(t.Fields.ContainsKey("comment")) { - float size = ((t.FixedSize && renderer.Scale > 1.0f) ? t.Size / renderer.Scale : t.Size); + float size = (((t.FixedSize || General.Settings.FixedThingsScale) && renderer.Scale > 1.0f) ? t.Size / renderer.Scale : t.Size); if(size * renderer.Scale < 1.5f) return; // Thing is too small to render int iconindex = 0;