diff --git a/Source/Core/Actions/Action.cs b/Source/Core/Actions/Action.cs index 267db958..82ba9ca1 100644 --- a/Source/Core/Actions/Action.cs +++ b/Source/Core/Actions/Action.cs @@ -193,6 +193,11 @@ namespace CodeImp.DoomBuilder.Actions } } + //mxd. This returns the shortcut key description for an action name + public static string GetShortcutKeyDesc(string actionName) { + return GetShortcutKeyDesc(General.Actions.GetActionByName(actionName).ShortcutKey); + } + #endregion #region ================== Methods diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 303237fd..864c234f 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -14,7 +14,7 @@ Resources\GZDB2.ico - Always + OnBuildSuccess 2.0 @@ -925,6 +925,7 @@ + @@ -1105,7 +1106,7 @@ - - + call "$(DevEnvDir)..\tools\vsvars32.bat" +EDITBIN.EXE /LARGEADDRESSAWARE "$(TargetPath)" \ No newline at end of file diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 047761d0..3eb32371 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -591,6 +591,9 @@ namespace CodeImp.DoomBuilder.Editing /// public override void OnEngage() { + //mxd. Clear hint + General.Interface.ClearEditModeHints(); + // Clear display overlay renderer.StartOverlay(true); renderer.Finish(); diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index 33559665..71dc72bf 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -153,8 +153,7 @@ namespace CodeImp.DoomBuilder.Geometry foreach(Vertex v in General.Map.Map.Vertices) { // Inside the polygon bounding box? - if((v.Position.x >= bbox.Left) && (v.Position.x <= bbox.Right) && - (v.Position.y >= bbox.Top) && (v.Position.y <= bbox.Bottom)) + if(bbox.Contains(v.Position.x, v.Position.y)) //mxd { // More to the right? if((foundv == null) || (v.Position.x >= foundv.Position.x)) @@ -289,18 +288,15 @@ namespace CodeImp.DoomBuilder.Geometry Line2D testline = new Line2D(foundv.Position, foundv.Position + lineoffset); scanline = null; float foundu = float.MaxValue; - foreach(Linedef ld in General.Map.Map.Linedefs) - { + + float px = foundv.Position.x; //mxd + float py = foundv.Position.y; //mxd + + foreach(Linedef ld in General.Map.Map.Linedefs) { // Line to the right of start point? - if((ld.Start.Position.x > foundv.Position.x) || - (ld.End.Position.x > foundv.Position.x)) - { + if((ld.Start.Position.x > px) || (ld.End.Position.x > px)) { // Line intersecting the y axis? - if( !((ld.Start.Position.y > foundv.Position.y) && - (ld.End.Position.y > foundv.Position.y)) && - !((ld.Start.Position.y < foundv.Position.y) && - (ld.End.Position.y < foundv.Position.y))) - { + if((ld.Start.Position.y > py && ld.End.Position.y < py) || (ld.Start.Position.y < py && ld.End.Position.y > py)) { //mxd // Check if this linedef intersects our test line at a closer range float thisu; ld.Line.GetIntersection(testline, out thisu); @@ -390,7 +386,7 @@ namespace CodeImp.DoomBuilder.Geometry { // Trace along the next line Linedef prevline = nextline; - if(lines[0] == nextline) nextline = lines[1]; else nextline = lines[0]; + nextline = (lines[0] == nextline ? lines[1] : lines[0]); // Are we allowed to trace this line again? if(!tracecount.ContainsKey(nextline) || (tracecount[nextline] < 3)) @@ -503,12 +499,8 @@ namespace CodeImp.DoomBuilder.Geometry Linedef nearest = MapSet.NearestLinedef(nearbylines, testpoint); if(nearest != null) { - Sidedef defaultside; float side = nearest.SideOfLine(testpoint); - if(side < 0.0f) - defaultside = nearest.Front; - else - defaultside = nearest.Back; + Sidedef defaultside = (side < 0.0f ? nearest.Front : nearest.Back); if(defaultside != null) { @@ -1429,20 +1421,15 @@ namespace CodeImp.DoomBuilder.Geometry } } - //mxd - if(autoAlignTextureOffsets) { - //Auto-align new lines - if(newlines.Count > 1) { - float totalLength = 0f; + //mxd. Auto-align new lines + if(autoAlignTextureOffsets && newlines.Count > 1) { + float totalLength = 0f; + foreach(Linedef l in newlines) totalLength += l.Length; - foreach(Linedef l in newlines) - totalLength += l.Length; - - if(General.Map.UDMF) - autoAlignTexturesOnSidesUDMF(newlines, totalLength, (newlines[0].End != newlines[1].Start)); - else - autoAlignTexturesOnSides(newlines, totalLength, (newlines[0].End != newlines[1].Start)); - } + if(General.Map.UDMF) + autoAlignTexturesOnSidesUDMF(newlines, totalLength, (newlines[0].End != newlines[1].Start)); + else + autoAlignTexturesOnSides(newlines, totalLength, (newlines[0].End != newlines[1].Start)); } // Mark new geometry only diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 04d81424..871c40d2 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -1906,29 +1906,16 @@ namespace CodeImp.DoomBuilder.Map // Go for all lines foreach(Linedef l in lines) { - // Check the cs field bits - if((GetCSFieldBits(l.Start, ref area) & GetCSFieldBits(l.End, ref area)) == 0) - { - // The line could be in the area - newlines.Add(l); - } + //mxd. Not within rect? + if(!area.Contains(l.Start.Position.x, l.Start.Position.y) || !area.Contains(l.End.Position.x, l.End.Position.y)) continue; + // The line could be in the area + newlines.Add(l); } // Return result return newlines; } - // This returns the cohen-sutherland field bits for a vertex in a rectangle area - private static int GetCSFieldBits(Vertex v, ref RectangleF area) - { - int bits = 0; - if(v.Position.y < area.Top) bits |= 0x01; - if(v.Position.y > area.Bottom) bits |= 0x02; - if(v.Position.x < area.Left) bits |= 0x04; - if(v.Position.x > area.Right) bits |= 0x08; - return bits; - } - /// This filters vertices by a rectangular area. public static ICollection FilterByArea(ICollection verts, ref RectangleF area) { @@ -1938,10 +1925,7 @@ namespace CodeImp.DoomBuilder.Map foreach(Vertex v in verts) { // Within rect? - if((v.Position.x >= area.Left) && - (v.Position.x <= area.Right) && - (v.Position.y >= area.Top) && - (v.Position.y <= area.Bottom)) + if(area.Contains(v.Position.x, v.Position.y)) //mxd { // The vertex is in the area newverts.Add(v); @@ -2430,7 +2414,7 @@ namespace CodeImp.DoomBuilder.Map { // Calculate distance and check if closer than previous find d = l.SafeDistanceToSq(pos, true); - if((d <= maxrangesq) && (d < distance)) + if(d < distance && d <= maxrangesq) { // This one is closer closest = l; @@ -2540,25 +2524,24 @@ namespace CodeImp.DoomBuilder.Map RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange); Vertex closest = null; float distance = float.MaxValue; - float d; + float d, px, py; // Go for all vertices in selection foreach(Vertex v in selection) { + px = v.Position.x; + py = v.Position.y; + // Within range? - if((v.Position.x >= range.Left) && (v.Position.x <= range.Right)) + if(!range.Contains(px, py)) continue; //mxd + + // Close than previous find? + d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y); + if(d < distance) { - if((v.Position.y >= range.Top) && (v.Position.y <= range.Bottom)) - { - // Close than previous find? - d = Math.Abs(v.Position.x - pos.x) + Math.Abs(v.Position.y - pos.y); - if(d < distance) - { - // This one is closer - closest = v; - distance = d; - } - } + // This one is closer + closest = v; + distance = d; } } @@ -2572,25 +2555,24 @@ namespace CodeImp.DoomBuilder.Map RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange); Thing closest = null; float distance = float.MaxValue; - float d; + float d, px, py; - // Go for all vertices in selection + // Go for all things in selection foreach(Thing t in selection) { - // Within range? - if((t.Position.x >= (range.Left - t.Size)) && (t.Position.x <= (range.Right + t.Size))) + px = t.Position.x; + py = t.Position.y; + + //mxd. Within range? + if(px < range.Left - t.Size || px > range.Right + t.Size || py < range.Top - t.Size || py > range.Bottom + t.Size) continue; + + // Close than previous find? + d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y); + if(d < distance) { - if((t.Position.y >= (range.Top - t.Size)) && (t.Position.y <= (range.Bottom + t.Size))) - { - // Close than previous find? - d = Math.Abs(t.Position.x - pos.x) + Math.Abs(t.Position.y - pos.y); - if(d < distance) - { - // This one is closer - closest = t; - distance = d; - } - } + // This one is closer + closest = t; + distance = d; } } diff --git a/Source/Core/Properties/Resources.Designer.cs b/Source/Core/Properties/Resources.Designer.cs index 4cc61403..f8bc430f 100644 --- a/Source/Core/Properties/Resources.Designer.cs +++ b/Source/Core/Properties/Resources.Designer.cs @@ -263,6 +263,13 @@ namespace CodeImp.DoomBuilder.Properties { } } + internal static System.Drawing.Bitmap Lightbulb { + get { + object obj = ResourceManager.GetObject("Lightbulb", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap Link { get { object obj = ResourceManager.GetObject("Link", resourceCulture); diff --git a/Source/Core/Properties/Resources.resx b/Source/Core/Properties/Resources.resx index eb2606b6..e7e4ca28 100644 --- a/Source/Core/Properties/Resources.resx +++ b/Source/Core/Properties/Resources.resx @@ -1,403 +1,406 @@  + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - text/microsoft-resx + text/microsoft-resx - 2.0 + 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Monster3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\SaveScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\GZDB_Logo_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\SaveAll.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Monster2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ScriptError.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\ViewTextureCeiling.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Filter.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\GZDB2.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Grid4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Status10.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Marine.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Splash3_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ScriptPalette.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ScriptHelp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Splash3_trans.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Status2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Unpin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Status0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ViewBrightness.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Model.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\mergegeometry.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\List_Images.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\MLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Paste.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ScriptConstant.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Warning.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\fx.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\CLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\WarningOff.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\List.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Keyboard.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Keyboard.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Reset.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SaveScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\treeview.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\PasteSpecial.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Failed.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\GZDB_Logo_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SaveAll.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SearchClear.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Monster2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Prefab2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ScriptError.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ViewTextureCeiling.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\fog.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Filter.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\InfoLine.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\GZDB2.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\MissingTexture.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Grid4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ErrorLarge.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Status10.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Marine.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Zoom_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Splash3_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ScriptPalette.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Model_selected.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\NewScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ScriptKeyword.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Properties.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Script2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Cut.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Prefab.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Hourglass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\VisualVertices.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Status12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ScriptHelp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\KnownTextureSet.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\KnownTextureSet.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Angle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Splash3_trans.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ViewTextureFloor.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Status2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Status0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ViewNormal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Model.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\mergegeometry.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Test.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\List_Images.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Light.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\MLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\OpenScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Paste.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\SlimDX_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ScriptConstant.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\Status11.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Warning.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Status1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\fx.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\WarningLarge.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Text.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\CLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\WarningOff.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\List.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Unlink.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\MissingThing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Reset.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\treeview.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\PasteSpecial.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Failed.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SearchClear.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Prefab2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\fog.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\InfoLine.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\MissingTexture.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ErrorLarge.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Zoom_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Model_selected.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\NewScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Unlink.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ScriptKeyword.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Properties.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Script2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Cut.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Prefab.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Hourglass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\VisualVertices.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Status12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Test.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Unpin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Angle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ViewTextureFloor.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ViewNormal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\MissingThing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Monster3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ViewBrightness.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Light.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\OpenScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SlimDX_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Status11.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Status1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\WarningLarge.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Text.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Lightbulb.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 fd4fb654..00160224 100644 --- a/Source/Core/Rendering/IRenderer2D.cs +++ b/Source/Core/Rendering/IRenderer2D.cs @@ -77,6 +77,7 @@ namespace CodeImp.DoomBuilder.Rendering void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords); void RenderText(TextLabel text); void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords); + void RenderHighlight(FlatVertex[] vertices, int color); //mxd void RedrawSurface(); } } diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index 3763edc0..12232578 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -1468,6 +1468,30 @@ namespace CodeImp.DoomBuilder.Rendering } } + //mxd + public void RenderHighlight(FlatVertex[] vertices, int color) { + if(vertices.Length < 3) return; + + // Set renderstates for rendering + graphics.Device.SetRenderState(RenderState.CullMode, Cull.None); + graphics.Device.SetRenderState(RenderState.ZEnable, false); + graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false); + graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false); + graphics.Device.SetRenderState(RenderState.TextureFactor, -1); + graphics.Device.SetRenderState(RenderState.FogEnable, false); + + SetWorldTransformation(true); + graphics.Shaders.Things2D.FillColor = new Color4(color); + graphics.Shaders.Things2D.SetSettings(1.0f); + + // Draw + graphics.Shaders.Things2D.Begin(); + graphics.Shaders.Things2D.BeginPass(2); + graphics.Device.DrawUserPrimitives(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices); + graphics.Shaders.Things2D.EndPass(); + graphics.Shaders.Things2D.End(); + } + // This renders text public void RenderText(TextLabel text) { @@ -1493,7 +1517,7 @@ namespace CodeImp.DoomBuilder.Rendering // Draw graphics.Shaders.Display2D.Begin(); graphics.Shaders.Display2D.BeginPass(1); //mxd - graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces >> 1); + //graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces >> 1); //mxd. Seems to be working fine without this line, soooo... graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces); graphics.Shaders.Display2D.EndPass(); graphics.Shaders.Display2D.End(); diff --git a/Source/Core/Resources/Lightbulb.png b/Source/Core/Resources/Lightbulb.png new file mode 100644 index 00000000..449d95d5 Binary files /dev/null and b/Source/Core/Resources/Lightbulb.png differ diff --git a/Source/Core/Windows/IMainForm.cs b/Source/Core/Windows/IMainForm.cs index 86c57fe6..36799dcb 100644 --- a/Source/Core/Windows/IMainForm.cs +++ b/Source/Core/Windows/IMainForm.cs @@ -59,6 +59,8 @@ namespace CodeImp.DoomBuilder.Windows void ShowThingInfo(Thing t); void ShowVertexInfo(Vertex v); void HideInfo(); + void ShowEditModeHints(string[] hints); //mxd + void ClearEditModeHints(); //mxd void RefreshInfo(); void UpdateCoordinates(Vector2D coords); bool Focus(); diff --git a/Source/Core/Windows/MainForm.Designer.cs b/Source/Core/Windows/MainForm.Designer.cs index 3a2e77be..9cc51a48 100644 --- a/Source/Core/Windows/MainForm.Designer.cs +++ b/Source/Core/Windows/MainForm.Designer.cs @@ -38,6 +38,14 @@ namespace CodeImp.DoomBuilder.Windows System.Windows.Forms.ToolStripSeparator toolStripSeparator2; System.Windows.Forms.ToolStripSeparator toolStripSeparator3; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + System.Windows.Forms.ListViewItem listViewItem25 = new System.Windows.Forms.ListViewItem("Press Use to use"); + System.Windows.Forms.ListViewItem listViewItem26 = new System.Windows.Forms.ListViewItem("To look around, look around"); + System.Windows.Forms.ListViewItem listViewItem27 = new System.Windows.Forms.ListViewItem("Another usefull hint"); + System.Windows.Forms.ListViewItem listViewItem28 = new System.Windows.Forms.ListViewItem("Yet another usefull hint"); + System.Windows.Forms.ListViewItem listViewItem29 = new System.Windows.Forms.ListViewItem("Yet another usefull hint"); + System.Windows.Forms.ListViewItem listViewItem30 = new System.Windows.Forms.ListViewItem("Yet another usefull hint"); + System.Windows.Forms.ListViewItem listViewItem31 = new System.Windows.Forms.ListViewItem("Yet another usefull hint"); + System.Windows.Forms.ListViewItem listViewItem32 = new System.Windows.Forms.ListViewItem("Yet another usefull hint"); this.seperatorfileopen = new System.Windows.Forms.ToolStripSeparator(); this.seperatorfilerecent = new System.Windows.Forms.ToolStripSeparator(); this.seperatoreditgrid = new System.Windows.Forms.ToolStripSeparator(); @@ -231,11 +239,12 @@ namespace CodeImp.DoomBuilder.Windows this.yposlabel = new System.Windows.Forms.ToolStripStatusLabel(); this.warnsLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.panelinfo = new System.Windows.Forms.Panel(); + this.hintIcon = new System.Windows.Forms.PictureBox(); + this.hints = new System.Windows.Forms.ListView(); this.heightpanel1 = new System.Windows.Forms.Panel(); - this.vertexinfo = new CodeImp.DoomBuilder.Controls.VertexInfoPanel(); this.labelcollapsedinfo = new System.Windows.Forms.Label(); this.buttontoggleinfo = new System.Windows.Forms.Button(); - this.modename = new System.Windows.Forms.Label(); + this.vertexinfo = new CodeImp.DoomBuilder.Controls.VertexInfoPanel(); this.linedefinfo = new CodeImp.DoomBuilder.Controls.LinedefInfoPanel(); this.thinginfo = new CodeImp.DoomBuilder.Controls.ThingInfoPanel(); this.sectorinfo = new CodeImp.DoomBuilder.Controls.SectorInfoPanel(); @@ -258,6 +267,7 @@ namespace CodeImp.DoomBuilder.Windows this.toolbarContextMenu.SuspendLayout(); this.statusbar.SuspendLayout(); this.panelinfo.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.hintIcon)).BeginInit(); this.SuspendLayout(); // // toolStripSeparator1 @@ -1854,7 +1864,7 @@ namespace CodeImp.DoomBuilder.Windows this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.statuslabel.Name = "statuslabel"; - this.statuslabel.Size = new System.Drawing.Size(309, 18); + this.statuslabel.Size = new System.Drawing.Size(340, 18); this.statuslabel.Spring = true; this.statuslabel.Text = "Initializing user interface..."; this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -2122,11 +2132,12 @@ namespace CodeImp.DoomBuilder.Windows // // panelinfo // + this.panelinfo.Controls.Add(this.hintIcon); + this.panelinfo.Controls.Add(this.hints); this.panelinfo.Controls.Add(this.heightpanel1); - this.panelinfo.Controls.Add(this.vertexinfo); this.panelinfo.Controls.Add(this.labelcollapsedinfo); this.panelinfo.Controls.Add(this.buttontoggleinfo); - this.panelinfo.Controls.Add(this.modename); + this.panelinfo.Controls.Add(this.vertexinfo); this.panelinfo.Controls.Add(this.linedefinfo); this.panelinfo.Controls.Add(this.thinginfo); this.panelinfo.Controls.Add(this.sectorinfo); @@ -2136,6 +2147,44 @@ namespace CodeImp.DoomBuilder.Windows this.panelinfo.Size = new System.Drawing.Size(986, 106); this.panelinfo.TabIndex = 4; // + // hintIcon + // + this.hintIcon.Location = new System.Drawing.Point(4, 20); + this.hintIcon.Name = "hintIcon"; + this.hintIcon.Size = new System.Drawing.Size(16, 16); + this.hintIcon.TabIndex = 9; + this.hintIcon.TabStop = false; + this.hintIcon.Visible = false; + // + // hints + // + this.hints.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.hints.BackColor = System.Drawing.SystemColors.Control; + this.hints.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.hints.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.hints.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.hints.Items.AddRange(new System.Windows.Forms.ListViewItem[] { + listViewItem25, + listViewItem26, + listViewItem27, + listViewItem28, + listViewItem29, + listViewItem30, + listViewItem31, + listViewItem32}); + this.hints.LabelWrap = false; + this.hints.Location = new System.Drawing.Point(20, 21); + this.hints.MultiSelect = false; + this.hints.Name = "hints"; + this.hints.Scrollable = false; + this.hints.ShowGroups = false; + this.hints.Size = new System.Drawing.Size(946, 110); + this.hints.TabIndex = 8; + this.hints.UseCompatibleStateImageBehavior = false; + this.hints.View = System.Windows.Forms.View.List; + this.hints.Visible = false; + // // heightpanel1 // this.heightpanel1.BackColor = System.Drawing.Color.Navy; @@ -2146,24 +2195,13 @@ namespace CodeImp.DoomBuilder.Windows this.heightpanel1.TabIndex = 7; this.heightpanel1.Visible = false; // - // vertexinfo - // - this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.vertexinfo.Location = new System.Drawing.Point(3, 3); - this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100); - this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100); - this.vertexinfo.Name = "vertexinfo"; - this.vertexinfo.Size = new System.Drawing.Size(310, 100); - this.vertexinfo.TabIndex = 1; - this.vertexinfo.Visible = false; - // // labelcollapsedinfo // this.labelcollapsedinfo.AutoSize = true; - this.labelcollapsedinfo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelcollapsedinfo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelcollapsedinfo.Location = new System.Drawing.Point(2, 2); this.labelcollapsedinfo.Name = "labelcollapsedinfo"; - this.labelcollapsedinfo.Size = new System.Drawing.Size(137, 13); + this.labelcollapsedinfo.Size = new System.Drawing.Size(155, 13); this.labelcollapsedinfo.TabIndex = 6; this.labelcollapsedinfo.Text = "Collapsed Descriptions"; this.labelcollapsedinfo.Visible = false; @@ -2184,19 +2222,16 @@ namespace CodeImp.DoomBuilder.Windows this.buttontoggleinfo.Click += new System.EventHandler(this.InvokeTaggedAction); this.buttontoggleinfo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.buttontoggleinfo_MouseUp); // - // modename + // vertexinfo // - this.modename.AutoSize = true; - this.modename.Font = new System.Drawing.Font("Verdana", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.modename.ForeColor = System.Drawing.SystemColors.GrayText; - this.modename.Location = new System.Drawing.Point(12, 20); - this.modename.Name = "modename"; - this.modename.Size = new System.Drawing.Size(244, 59); - this.modename.TabIndex = 4; - this.modename.Text = "Vertices"; - this.modename.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.modename.UseMnemonic = false; - this.modename.Visible = false; + this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vertexinfo.Location = new System.Drawing.Point(0, 0); + this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100); + this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100); + this.vertexinfo.Name = "vertexinfo"; + this.vertexinfo.Size = new System.Drawing.Size(310, 100); + this.vertexinfo.TabIndex = 1; + this.vertexinfo.Visible = false; // // linedefinfo // @@ -2333,6 +2368,7 @@ namespace CodeImp.DoomBuilder.Windows this.statusbar.PerformLayout(); this.panelinfo.ResumeLayout(false); this.panelinfo.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.hintIcon)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -2415,7 +2451,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.ToolStripMenuItem itemgridinc; private System.Windows.Forms.ToolStripMenuItem itemgriddec; private System.Windows.Forms.ToolStripMenuItem itemgridsetup; - private System.Windows.Forms.Label modename; private System.Windows.Forms.Timer statusflasher; private System.Windows.Forms.ToolStripSplitButton buttontest; private System.Windows.Forms.ToolStripButton buttoncut; @@ -2549,5 +2584,7 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.ToolStripMenuItem itemopenmapincurwad; private System.Windows.Forms.ToolStripMenuItem itemgrid1; private System.Windows.Forms.ToolStripMenuItem itemzoom400; + private System.Windows.Forms.ListView hints; + private System.Windows.Forms.PictureBox hintIcon; } } \ No newline at end of file diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 0d008e6a..fd32a688 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -131,6 +131,7 @@ namespace CodeImp.DoomBuilder.Windows // Last info on panels private object lastinfoobject; + private string currentModeName; //mxd // Recent files private ToolStripMenuItem[] recentitems; @@ -199,6 +200,7 @@ namespace CodeImp.DoomBuilder.Windows editmodeitems = new List(); labelcollapsedinfo.Text = ""; display.Dock = DockStyle.Fill; + hintIcon.Image = Resources.Lightbulb; //mxd // Fetch pointer windowptr = base.Handle; @@ -409,11 +411,11 @@ namespace CodeImp.DoomBuilder.Windows } // This unlocks for updating - internal void ForceUnlockUpdate() + /*internal void ForceUnlockUpdate() { if(lockupdatecount > 0) General.LockWindowUpdate(IntPtr.Zero); lockupdatecount = 0; - } + }*/ // This sets the focus on the display for correct key input public bool FocusDisplay() @@ -2755,7 +2757,8 @@ namespace CodeImp.DoomBuilder.Windows if(vertexinfo.Visible) vertexinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide(); if(thinginfo.Visible) thinginfo.Hide(); - modename.Visible = false; + hints.Visible = false; //mxd + hintIcon.Visible = false; //mxd labelcollapsedinfo.Visible = true; itemtoggleinfo.Checked = false; } @@ -2784,13 +2787,9 @@ namespace CodeImp.DoomBuilder.Windows // This displays the current mode name internal void DisplayModeName(string name) { - if(lastinfoobject == null) - { - labelcollapsedinfo.Text = name; - labelcollapsedinfo.Refresh(); - } - modename.Text = name; - modename.Refresh(); + currentModeName = name; //mxd + labelcollapsedinfo.Text = name; + labelcollapsedinfo.Refresh(); } // This hides all info panels @@ -2802,10 +2801,14 @@ namespace CodeImp.DoomBuilder.Windows if(vertexinfo.Visible) vertexinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide(); if(thinginfo.Visible) thinginfo.Hide(); - labelcollapsedinfo.Text = modename.Text; + labelcollapsedinfo.Text = currentModeName; + labelcollapsedinfo.Visible = true; labelcollapsedinfo.Refresh(); - modename.Visible = ((General.Map != null) && IsInfoPanelExpanded); - modename.Refresh(); + + //mxd. Show hints? + bool showHints = ((General.Map != null) && IsInfoPanelExpanded); + hints.Visible = showHints; + hintIcon.Visible = showHints && hints.Items.Count > 0; //mxd. let the plugins know General.Plugins.OnHighlightLost(); @@ -2822,6 +2825,19 @@ namespace CodeImp.DoomBuilder.Windows //mxd. let the plugins know General.Plugins.OnHighlightRefreshed(lastinfoobject); } + + //mxd + public void ShowEditModeHints(string[] hintsText) { + hintIcon.Visible = true; + hints.Items.Clear(); + foreach (string s in hintsText) hints.Items.Add(s); + } + + //mxd + public void ClearEditModeHints() { + hintIcon.Visible = false; + hints.Items.Clear(); + } // Show linedef info public void ShowLinedefInfo(Linedef l) @@ -2833,78 +2849,81 @@ namespace CodeImp.DoomBuilder.Windows } lastinfoobject = l; - modename.Visible = false; + hints.Visible = false; //mxd + hintIcon.Visible = false; //mxd if(vertexinfo.Visible) vertexinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide(); if(thinginfo.Visible) thinginfo.Hide(); - if(IsInfoPanelExpanded) linedefinfo.ShowInfo(l); + if (IsInfoPanelExpanded) { + linedefinfo.ShowInfo(l); + } else { + // Show info on collapsed label + if(General.Map.Config.LinedefActions.ContainsKey(l.Action)) { + LinedefActionInfo act = General.Map.Config.LinedefActions[l.Action]; + labelcollapsedinfo.Text = act.ToString(); + } else if(l.Action == 0) + labelcollapsedinfo.Text = l.Action.ToString() + " - None"; + else + labelcollapsedinfo.Text = l.Action.ToString() + " - Unknown"; - // Show info on collapsed label - if(General.Map.Config.LinedefActions.ContainsKey(l.Action)) - { - LinedefActionInfo act = General.Map.Config.LinedefActions[l.Action]; - labelcollapsedinfo.Text = act.ToString(); + labelcollapsedinfo.Refresh(); } - else if(l.Action == 0) - labelcollapsedinfo.Text = l.Action.ToString() + " - None"; - else - labelcollapsedinfo.Text = l.Action.ToString() + " - Unknown"; - - labelcollapsedinfo.Refresh(); //mxd. let the plugins know General.Plugins.OnHighlightLinedef(l); } // Show vertex info - public void ShowVertexInfo(Vertex v) - { - if(v.IsDisposed) - { + public void ShowVertexInfo(Vertex v) { + if (v.IsDisposed) { HideInfo(); return; } lastinfoobject = v; - modename.Visible = false; - if(linedefinfo.Visible) linedefinfo.Hide(); - if(sectorinfo.Visible) sectorinfo.Hide(); - if(thinginfo.Visible) thinginfo.Hide(); - if(IsInfoPanelExpanded) vertexinfo.ShowInfo(v); - - // Show info on collapsed label - labelcollapsedinfo.Text = v.Position.x.ToString("0.##") + ", " + v.Position.y.ToString("0.##"); - labelcollapsedinfo.Refresh(); + hints.Visible = false; //mxd + hintIcon.Visible = false; //mxd + if (linedefinfo.Visible) linedefinfo.Hide(); + if (sectorinfo.Visible) sectorinfo.Hide(); + if (thinginfo.Visible) thinginfo.Hide(); + if (IsInfoPanelExpanded) { + vertexinfo.ShowInfo(v); + } else { + // Show info on collapsed label + labelcollapsedinfo.Text = v.Position.x.ToString("0.##") + ", " + v.Position.y.ToString("0.##"); + labelcollapsedinfo.Refresh(); + } //mxd. let the plugins know General.Plugins.OnHighlightVertex(v); } // Show sector info - public void ShowSectorInfo(Sector s) - { - if(s.IsDisposed) - { + public void ShowSectorInfo(Sector s) { + if (s.IsDisposed) { HideInfo(); return; } lastinfoobject = s; - modename.Visible = false; - if(linedefinfo.Visible) linedefinfo.Hide(); - if(vertexinfo.Visible) vertexinfo.Hide(); - if(thinginfo.Visible) thinginfo.Hide(); - if(IsInfoPanelExpanded) sectorinfo.ShowInfo(s); + hints.Visible = false; + hintIcon.Visible = false; //mxd + if (linedefinfo.Visible) linedefinfo.Hide(); + if (vertexinfo.Visible) vertexinfo.Hide(); + if (thinginfo.Visible) thinginfo.Hide(); + if (IsInfoPanelExpanded) { + sectorinfo.ShowInfo(s); + } else { + // Show info on collapsed label + if (General.Map.Config.SectorEffects.ContainsKey(s.Effect)) + labelcollapsedinfo.Text = General.Map.Config.SectorEffects[s.Effect].ToString(); + else if (s.Effect == 0) + labelcollapsedinfo.Text = s.Effect.ToString() + " - Normal"; + else + labelcollapsedinfo.Text = s.Effect.ToString() + " - Unknown"; - // Show info on collapsed label - if(General.Map.Config.SectorEffects.ContainsKey(s.Effect)) - labelcollapsedinfo.Text = General.Map.Config.SectorEffects[s.Effect].ToString(); - else if(s.Effect == 0) - labelcollapsedinfo.Text = s.Effect.ToString() + " - Normal"; - else - labelcollapsedinfo.Text = s.Effect.ToString() + " - Unknown"; - - labelcollapsedinfo.Refresh(); + labelcollapsedinfo.Refresh(); + } //mxd. let the plugins know General.Plugins.OnHighlightSector(s); @@ -2920,16 +2939,19 @@ namespace CodeImp.DoomBuilder.Windows } lastinfoobject = t; - modename.Visible = false; + hints.Visible = false; + hintIcon.Visible = false; //mxd if(linedefinfo.Visible) linedefinfo.Hide(); if(vertexinfo.Visible) vertexinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide(); - if(IsInfoPanelExpanded) thinginfo.ShowInfo(t); - - // Show info on collapsed label - ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); - labelcollapsedinfo.Text = t.Type + " - " + ti.Title; - labelcollapsedinfo.Refresh(); + if (IsInfoPanelExpanded) { + thinginfo.ShowInfo(t); + } else { + // Show info on collapsed label + ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); + labelcollapsedinfo.Text = t.Type + " - " + ti.Title; + labelcollapsedinfo.Refresh(); + } //mxd. let the plugins know General.Plugins.OnHighlightThing(t); diff --git a/Source/Core/Windows/MainForm.resx b/Source/Core/Windows/MainForm.resx index ee85b864..91ebb173 100644 --- a/Source/Core/Windows/MainForm.resx +++ b/Source/Core/Windows/MainForm.resx @@ -180,18 +180,12 @@ True - - True - True True - - True - True diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs index 8fe9e5e8..ecc091ec 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs @@ -427,6 +427,20 @@ namespace CodeImp.DoomBuilder.BuilderModes // Set cursor General.Interface.SetCursor(Cursors.Cross); + + //mxd. Show hints + string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect"); + string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit"); + string acceptKey = Actions.Action.GetShortcutKeyDesc("builder_acceptmode"); + string cancelKey = Actions.Action.GetShortcutKeyDesc("builder_cancelmode"); + string removeKey = Actions.Action.GetShortcutKeyDesc("buildermodes_removepoint"); + + string[] hints = new []{ "Press " + selectKey + " to place a vertex", + "Press " + removeKey + " to remove last vertex", + "Press " + acceptKey + " to accept", + "Press " + cancelKey + " or " + editKey + " to cancel"}; + + General.Interface.ShowEditModeHints(hints); } // Disengaging diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index a846d291..58d2bfd3 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -64,6 +64,11 @@ namespace CodeImp.DoomBuilder.BuilderModes //mxd. Effects private Dictionary effects; + //mxd. Cached overlays stuff + private FlatVertex[] overlayGeometry; + private Dictionary selectedEffectLabels; + private Dictionary unselectedEffectLabels; + #endregion #region ================== Properties @@ -154,31 +159,17 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(renderer.StartOverlay(true)) { - //mxd. Render highlighted sector - if(BuilderPlug.Me.UseHighlight && highlighted != null) { - int highlightedColor = General.Colors.Highlight.WithAlpha(64).ToInt(); - FlatVertex[] verts = new FlatVertex[highlighted.FlatVertices.Length]; - highlighted.FlatVertices.CopyTo(verts, 0); - for(int i = 0; i < verts.Length; i++) - verts[i].c = highlightedColor; - renderer.RenderGeometry(verts, null, true); - } - // Go for all selected sectors ICollection orderedselection = General.Map.Map.GetSelectedSectors(true); //mxd. Render selected sectors if (BuilderPlug.Me.UseHighlight) { - int selectedColor = General.Colors.Selection.WithAlpha(64).ToInt(); //mxd - foreach (Sector s in orderedselection) { - if (s != highlighted) { - FlatVertex[] verts = new FlatVertex[s.FlatVertices.Length]; - s.FlatVertices.CopyTo(verts, 0); - for (int i = 0; i < verts.Length; i++) - verts[i].c = selectedColor; - renderer.RenderGeometry(verts, null, true); - } - } + renderer.RenderHighlight(overlayGeometry, General.Colors.Selection.WithAlpha(64).ToInt()); + } + + //mxd. Render highlighted sector + if(BuilderPlug.Me.UseHighlight && highlighted != null) { + renderer.RenderHighlight(highlighted.FlatVertices, General.Colors.Highlight.WithAlpha(64).ToInt()); } if (BuilderPlug.Me.ViewSelectionNumbers) { @@ -195,11 +186,10 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + //mxd. Render effect labels if (BuilderPlug.Me.ViewSelectionEffects) { - //mxd. Render effect labels - if(!BuilderPlug.Me.ViewSelectionNumbers) - renderEffectLabels(orderedselection); - renderEffectLabels(General.Map.Map.GetSelectedSectors(false)); + if(!BuilderPlug.Me.ViewSelectionNumbers) renderEffectLabels(selectedEffectLabels); + renderEffectLabels(unselectedEffectLabels); } renderer.Finish(); @@ -207,53 +197,89 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd - private void renderEffectLabels(ICollection selection) { - foreach(Sector s in selection) { - string label = string.Empty; - string labelShort = string.Empty; - - if(s.Effect != 0) { - if(effects.ContainsKey(s.Effect)) { - if(s.Tag != 0) { - label = "Tag " + s.Tag + ", " + effects[s.Effect][0]; - labelShort = "T" + s.Tag + " " + "E" + s.Effect; - } else { - label = effects[s.Effect][0]; - labelShort = "E" + s.Effect; - } - } else { - if(s.Tag != 0) { - label = "Tag " + s.Tag + ", Effect " + s.Effect; - labelShort = "T" + s.Tag + " " + "E" + s.Effect; - } else { - label = "Effect " + s.Effect; - labelShort = "E" + s.Effect; - } - } - } else if(s.Tag != 0) { - label = "Tag " + s.Tag; - labelShort = "T" + s.Tag; - } - - if (string.IsNullOrEmpty(label)) continue; - - TextLabel[] labelarray = labels[s]; - for(int i = 0; i < s.Labels.Count; i++) { + private void renderEffectLabels(Dictionary labelsGroup) { + foreach(KeyValuePair group in labelsGroup) { + // Render labels + TextLabel[] labelarray = labels[group.Key]; + for(int i = 0; i < group.Key.Labels.Count; i++) { TextLabel l = labelarray[i]; l.Color = General.Colors.InfoLine; - float requiredsize = (General.Map.GetTextSize(label, l.Scale).Width) / renderer.Scale; - if(requiredsize > s.Labels[i].radius) { - requiredsize = (General.Map.GetTextSize(labelShort, l.Scale).Width) / renderer.Scale; - l.Text = (requiredsize > s.Labels[i].radius ? "+" : labelShort); + // Render only when enough space for the label to see + float requiredsize = (General.Map.GetTextSize(group.Value[0], l.Scale).Width) / renderer.Scale; + if(requiredsize > group.Key.Labels[i].radius) { + requiredsize = (General.Map.GetTextSize(group.Value[1], l.Scale).Width) / renderer.Scale; + l.Text = (requiredsize > group.Key.Labels[i].radius ? "+" : group.Value[1]); } else { - l.Text = label; + l.Text = group.Value[0]; } renderer.RenderText(l); } } } + + //mxd + private string[] getEffectText(Sector s) { + string[] result = new []{string.Empty, string.Empty}; + + if(s.Effect != 0) { + if(effects.ContainsKey(s.Effect)) { + if(s.Tag != 0) { + result[0] = "Tag " + s.Tag + ", " + effects[s.Effect][0]; + result[1] = "T" + s.Tag + " " + "E" + s.Effect; + } else { + result[0] = effects[s.Effect][0]; + result[1] = "E" + s.Effect; + } + } else { + if(s.Tag != 0) { + result[0] = "Tag " + s.Tag + ", Effect " + s.Effect; + result[1] = "T" + s.Tag + " " + "E" + s.Effect; + } else { + result[0] = "Effect " + s.Effect; + result[1] = "E" + s.Effect; + } + } + } else if(s.Tag != 0) { + result[0] = "Tag " + s.Tag; + result[1] = "T" + s.Tag; + } + + return result; + } + + //mxd + private void updateOverlaySurfaces() { + ICollection orderedselection = General.Map.Map.GetSelectedSectors(true); + List vertsList = new List(); + + // Go for all selected sectors + foreach(Sector s in orderedselection) vertsList.AddRange(s.FlatVertices); + overlayGeometry = vertsList.ToArray(); + } + + //mxd + private void updateEffectLabels() { + selectedEffectLabels = new Dictionary(); + unselectedEffectLabels = new Dictionary(); + + //update effect labels for selected sectors + ICollection orderedselection = General.Map.Map.GetSelectedSectors(true); + foreach(Sector s in orderedselection) { + string[] labelText = getEffectText(s); + if(!string.IsNullOrEmpty(labelText[0])) + selectedEffectLabels.Add(s, labelText); + } + + //update effect labels for unselected sectors + orderedselection = General.Map.Map.GetSelectedSectors(false); + foreach(Sector s in orderedselection) { + string[] labelText = getEffectText(s); + if(!string.IsNullOrEmpty(labelText[0])) + unselectedEffectLabels.Add(s, labelText); + } + } // Support function for joining and merging sectors private void JoinMergeSectors(bool removelines) @@ -403,12 +429,16 @@ namespace CodeImp.DoomBuilder.BuilderModes selectionchanged = true; // Setup labels - ICollection orderedselection = General.Map.Map.GetSelectedSectors(true); - TextLabel[] labelarray = labels[s]; - foreach(TextLabel l in labelarray) - { - l.Text = orderedselection.Count.ToString(); - l.Color = General.Colors.Selection; + //ICollection orderedselection = General.Map.Map.GetSelectedSectors(true); + if(update) { //mxd + string selectedCount = General.Map.Map.SelectedSectorsCount.ToString(); + TextLabel[] labelarray = labels[s]; + foreach(TextLabel l in labelarray) { + l.Text = selectedCount;// orderedselection.Count.ToString(); + l.Color = General.Colors.Selection; + } + + updateEffectLabels(); } } // Deselect the sector? @@ -418,11 +448,13 @@ namespace CodeImp.DoomBuilder.BuilderModes selectionchanged = true; // Clear labels - TextLabel[] labelarray = labels[s]; - foreach(TextLabel l in labelarray) l.Text = ""; + if(update) { + TextLabel[] labelarray = labels[s]; + foreach(TextLabel l in labelarray) l.Text = ""; - // Update all other labels - UpdateSelectedLabels(); + // Update all other labels + UpdateSelectedLabels(); + } } // Selection changed? @@ -436,12 +468,12 @@ namespace CodeImp.DoomBuilder.BuilderModes if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false; sd.Line.Selected = front | back; } - } - if(update) - { - UpdateOverlay(); - renderer.Present(); + if(update) + { + UpdateOverlay(); + renderer.Present(); + } } } } @@ -464,39 +496,34 @@ namespace CodeImp.DoomBuilder.BuilderModes } index++; } + + //mxd + updateEffectLabels(); } //mxd private bool isInSelectionRect(Sector s, List selectionOutline) { - bool selected = false; - - if(BuilderPlug.Me.MarqueSelectTouching) { + bool isInsideSelection = selectionrect.Contains(s.BBox); + if (isInsideSelection) return true; + + if(BuilderPlug.Me.MarqueSelectTouching && s.BBox.IntersectsWith(selectionrect)) { //check endpoints - foreach (Sidedef side in s.Sidedefs) { - selected = (selectionrect.Contains(side.Line.Start.Position.x, side.Line.Start.Position.y) - || selectionrect.Contains(side.Line.End.Position.x, side.Line.End.Position.y)); - if (selected) return true; + foreach(Sidedef side in s.Sidedefs) { + if((selectionrect.Contains(side.Line.Start.Position.x, side.Line.Start.Position.y) + || selectionrect.Contains(side.Line.End.Position.x, side.Line.End.Position.y))) + return true; } //check line intersections - foreach (Sidedef side in s.Sidedefs) { - foreach (Line2D line in selectionOutline) { + foreach(Sidedef side in s.Sidedefs) { + foreach(Line2D line in selectionOutline) { if(Line2D.GetIntersection(side.Line.Line, line)) return true; } } - - return false; } - //check endpoints - foreach(Sidedef side in s.Sidedefs) { - selected = (selectionrect.Contains(side.Line.Start.Position.x, side.Line.Start.Position.y) - && selectionrect.Contains(side.Line.End.Position.x, side.Line.End.Position.y)); - if(!selected) return false; - } - - return selected; + return false; } #endregion @@ -539,13 +566,14 @@ namespace CodeImp.DoomBuilder.BuilderModes // Convert geometry selection to sectors only General.Map.Map.ConvertSelection(SelectionType.Sectors); - updateSelectionInfo(); //mxd // Make text labels for sectors SetupLabels(); // Update UpdateSelectedLabels(); + updateOverlaySurfaces();//mxd + updateSelectionInfo(); //mxd UpdateOverlay(); } @@ -583,6 +611,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Make the highlight the selection SelectSector(highlighted, true, false); + UpdateSelectedLabels(); //mxd } } } @@ -674,12 +703,14 @@ namespace CodeImp.DoomBuilder.BuilderModes // Update overlay TextLabel[] labelarray = labels[highlighted]; foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight; + updateOverlaySurfaces(); //mxd UpdateOverlay(); renderer.Present(); //mxd } else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedSectorsCount > 0) { General.Map.Map.ClearSelectedLinedefs(); General.Map.Map.ClearSelectedSectors(); + updateOverlaySurfaces(); //mxd General.Interface.RedrawDisplay(); } @@ -705,6 +736,8 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedLinedefs(); SelectSector(highlighted, true, false); + UpdateSelectedLabels(); //mxd + updateOverlaySurfaces(); //mxd General.Interface.RedrawDisplay(); } @@ -757,9 +790,13 @@ namespace CodeImp.DoomBuilder.BuilderModes if (selected.Count == 1) { General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedLinedefs(); + updateEffectLabels(); //mxd } else if(result == DialogResult.Cancel) { //mxd. Restore selection... - foreach (Sector s in selected) SelectSector(s, true, true); + foreach (Sector s in selected) SelectSector(s, true, false); + UpdateSelectedLabels(); //mxd } + + updateOverlaySurfaces(); //mxd General.Interface.RedrawDisplay(); } } @@ -825,6 +862,7 @@ namespace CodeImp.DoomBuilder.BuilderModes SelectSector(highlighted, !highlighted.Selected, true); // Update entire display + updateOverlaySurfaces();//mxd General.Interface.RedrawDisplay(); } } else if(highlighted != null) { @@ -903,6 +941,7 @@ namespace CodeImp.DoomBuilder.BuilderModes SelectSector(highlighted, !highlighted.Selected, true); // Update entire display + updateOverlaySurfaces();//mxd General.Interface.RedrawDisplay(); } @@ -926,6 +965,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Select only this sector for dragging General.Map.Map.ClearSelectedSectors(); SelectSector(highlighted, true, true); + updateOverlaySurfaces(); //mxd } // Start dragging the selection @@ -948,7 +988,7 @@ namespace CodeImp.DoomBuilder.BuilderModes || sd.Line.End.Position.x < General.Map.Config.LeftBoundary || sd.Line.End.Position.x > General.Map.Config.RightBoundary || sd.Line.End.Position.y > General.Map.Config.TopBoundary || sd.Line.End.Position.y < General.Map.Config.BottomBoundary) { - SelectSector(s, false, true); + SelectSector(s, false, false); unaffectedCount++; break; } @@ -964,6 +1004,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(unaffectedCount > 0) General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected sectors " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!"); + UpdateSelectedLabels(); //mxd return true; } @@ -1013,7 +1054,18 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sidedef sd in General.Map.Map.Sidedefs) sd.Line.Selected = sd.Sector.Selected || (sd.Other != null && sd.Other.Sector.Selected); + //mxd. Clear labels for unselected sectors + if(marqueSelectionMode != MarqueSelectionMode.ADD) { + ICollection orderedselection = General.Map.Map.GetSelectedSectors(false); + foreach(Sector s in orderedselection){ + TextLabel[] labelarray = labels[s]; + foreach(TextLabel l in labelarray) l.Text = ""; + } + } + + UpdateSelectedLabels(); //mxd updateSelectionInfo(); //mxd + updateOverlaySurfaces(); //mxd } base.OnEndMultiSelection(); @@ -1043,6 +1095,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Make the highlight the selection SelectSector(highlighted, true, true); + updateOverlaySurfaces();//mxd } return base.OnCopyBegin(); @@ -1062,6 +1115,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Clear labels SetupLabels(); + updateEffectLabels(); //mxd } // When redo is used @@ -1078,6 +1132,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Clear labels SetupLabels(); + updateEffectLabels(); //mxd base.OnRedoEnd(); //mxd } @@ -1147,6 +1202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Map.IsChanged = true; General.Interface.RefreshInfo(); General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd + updateEffectLabels(); //mxd General.Interface.RedrawDisplay(); } } @@ -1178,6 +1234,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedLinedefs(); SelectSector(highlighted, true, false); + updateOverlaySurfaces();//mxd General.Interface.RedrawDisplay(); } @@ -1388,6 +1445,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Update cache values General.Map.IsChanged = true; General.Map.Map.Update(); + updateOverlaySurfaces(); //mxd // Make text labels for sectors SetupLabels(); @@ -1695,6 +1753,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // Clear labels foreach(TextLabel[] labelarray in labels.Values) foreach(TextLabel l in labelarray) l.Text = ""; + updateOverlaySurfaces(); //mxd + updateEffectLabels(); //mxd // Redraw General.Interface.RedrawDisplay();