Sectors mode: optimized rectangular selection logic.

Sectors mode: optimized sector highlight rendering logic.
Sectors mode: optimized sector effect/tag labels update logic.
Geometry tools: optimized several core functions.
Hints for current editing mode can now be displayed when nothing is highlighted (currently the hints are shown only in Draw Geometry mode).  
GZDB is now build with LARGEADDRESSAWARE flag, which increases amount of RAM GZDB can use from 1.4 to 2.8 GB.
This commit is contained in:
MaxED 2013-12-10 12:19:27 +00:00
parent a99811a106
commit 4e52d9bb9c
16 changed files with 768 additions and 626 deletions

View file

@ -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 #endregion
#region ================== Methods #region ================== Methods

View file

@ -14,7 +14,7 @@
<ApplicationIcon>Resources\GZDB2.ico</ApplicationIcon> <ApplicationIcon>Resources\GZDB2.ico</ApplicationIcon>
<Win32Resource> <Win32Resource>
</Win32Resource> </Win32Resource>
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>2.0</OldToolsVersion>
@ -925,6 +925,7 @@
<None Include="Resources\InfoLine.png" /> <None Include="Resources\InfoLine.png" />
<None Include="Resources\Keyboard.png" /> <None Include="Resources\Keyboard.png" />
<Content Include="Resources\Light.png" /> <Content Include="Resources\Light.png" />
<None Include="Resources\Lightbulb.png" />
<Content Include="Resources\Light_animate.png" /> <Content Include="Resources\Light_animate.png" />
<None Include="Resources\MLogo.png" /> <None Include="Resources\MLogo.png" />
<None Include="Resources\Marine.png" /> <None Include="Resources\Marine.png" />
@ -1105,7 +1106,7 @@
<PropertyGroup> <PropertyGroup>
<PreBuildEvent> <PreBuildEvent>
</PreBuildEvent> </PreBuildEvent>
<PostBuildEvent> <PostBuildEvent>call "$(DevEnvDir)..\tools\vsvars32.bat"
</PostBuildEvent> EDITBIN.EXE /LARGEADDRESSAWARE "$(TargetPath)"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -591,6 +591,9 @@ namespace CodeImp.DoomBuilder.Editing
/// </summary> /// </summary>
public override void OnEngage() public override void OnEngage()
{ {
//mxd. Clear hint
General.Interface.ClearEditModeHints();
// Clear display overlay // Clear display overlay
renderer.StartOverlay(true); renderer.StartOverlay(true);
renderer.Finish(); renderer.Finish();

View file

@ -153,8 +153,7 @@ namespace CodeImp.DoomBuilder.Geometry
foreach(Vertex v in General.Map.Map.Vertices) foreach(Vertex v in General.Map.Map.Vertices)
{ {
// Inside the polygon bounding box? // Inside the polygon bounding box?
if((v.Position.x >= bbox.Left) && (v.Position.x <= bbox.Right) && if(bbox.Contains(v.Position.x, v.Position.y)) //mxd
(v.Position.y >= bbox.Top) && (v.Position.y <= bbox.Bottom))
{ {
// More to the right? // More to the right?
if((foundv == null) || (v.Position.x >= foundv.Position.x)) 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); Line2D testline = new Line2D(foundv.Position, foundv.Position + lineoffset);
scanline = null; scanline = null;
float foundu = float.MaxValue; 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? // Line to the right of start point?
if((ld.Start.Position.x > foundv.Position.x) || if((ld.Start.Position.x > px) || (ld.End.Position.x > px)) {
(ld.End.Position.x > foundv.Position.x))
{
// Line intersecting the y axis? // Line intersecting the y axis?
if( !((ld.Start.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
(ld.End.Position.y > foundv.Position.y)) &&
!((ld.Start.Position.y < foundv.Position.y) &&
(ld.End.Position.y < foundv.Position.y)))
{
// Check if this linedef intersects our test line at a closer range // Check if this linedef intersects our test line at a closer range
float thisu; float thisu;
ld.Line.GetIntersection(testline, out thisu); ld.Line.GetIntersection(testline, out thisu);
@ -390,7 +386,7 @@ namespace CodeImp.DoomBuilder.Geometry
{ {
// Trace along the next line // Trace along the next line
Linedef prevline = nextline; 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? // Are we allowed to trace this line again?
if(!tracecount.ContainsKey(nextline) || (tracecount[nextline] < 3)) if(!tracecount.ContainsKey(nextline) || (tracecount[nextline] < 3))
@ -503,12 +499,8 @@ namespace CodeImp.DoomBuilder.Geometry
Linedef nearest = MapSet.NearestLinedef(nearbylines, testpoint); Linedef nearest = MapSet.NearestLinedef(nearbylines, testpoint);
if(nearest != null) if(nearest != null)
{ {
Sidedef defaultside;
float side = nearest.SideOfLine(testpoint); float side = nearest.SideOfLine(testpoint);
if(side < 0.0f) Sidedef defaultside = (side < 0.0f ? nearest.Front : nearest.Back);
defaultside = nearest.Front;
else
defaultside = nearest.Back;
if(defaultside != null) if(defaultside != null)
{ {
@ -1429,21 +1421,16 @@ namespace CodeImp.DoomBuilder.Geometry
} }
} }
//mxd //mxd. Auto-align new lines
if(autoAlignTextureOffsets) { if(autoAlignTextureOffsets && newlines.Count > 1) {
//Auto-align new lines
if(newlines.Count > 1) {
float totalLength = 0f; float totalLength = 0f;
foreach(Linedef l in newlines) totalLength += l.Length;
foreach(Linedef l in newlines)
totalLength += l.Length;
if(General.Map.UDMF) if(General.Map.UDMF)
autoAlignTexturesOnSidesUDMF(newlines, totalLength, (newlines[0].End != newlines[1].Start)); autoAlignTexturesOnSidesUDMF(newlines, totalLength, (newlines[0].End != newlines[1].Start));
else else
autoAlignTexturesOnSides(newlines, totalLength, (newlines[0].End != newlines[1].Start)); autoAlignTexturesOnSides(newlines, totalLength, (newlines[0].End != newlines[1].Start));
} }
}
// Mark new geometry only // Mark new geometry only
General.Map.Map.ClearMarkedLinedefs(false); General.Map.Map.ClearMarkedLinedefs(false);

View file

@ -1906,29 +1906,16 @@ namespace CodeImp.DoomBuilder.Map
// Go for all lines // Go for all lines
foreach(Linedef l in lines) foreach(Linedef l in lines)
{ {
// Check the cs field bits //mxd. Not within rect?
if((GetCSFieldBits(l.Start, ref area) & GetCSFieldBits(l.End, ref area)) == 0) 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 // The line could be in the area
newlines.Add(l); newlines.Add(l);
} }
}
// Return result // Return result
return newlines; 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;
}
/// <summary>This filters vertices by a rectangular area.</summary> /// <summary>This filters vertices by a rectangular area.</summary>
public static ICollection<Vertex> FilterByArea(ICollection<Vertex> verts, ref RectangleF area) public static ICollection<Vertex> FilterByArea(ICollection<Vertex> verts, ref RectangleF area)
{ {
@ -1938,10 +1925,7 @@ namespace CodeImp.DoomBuilder.Map
foreach(Vertex v in verts) foreach(Vertex v in verts)
{ {
// Within rect? // Within rect?
if((v.Position.x >= area.Left) && if(area.Contains(v.Position.x, v.Position.y)) //mxd
(v.Position.x <= area.Right) &&
(v.Position.y >= area.Top) &&
(v.Position.y <= area.Bottom))
{ {
// The vertex is in the area // The vertex is in the area
newverts.Add(v); newverts.Add(v);
@ -2430,7 +2414,7 @@ namespace CodeImp.DoomBuilder.Map
{ {
// Calculate distance and check if closer than previous find // Calculate distance and check if closer than previous find
d = l.SafeDistanceToSq(pos, true); d = l.SafeDistanceToSq(pos, true);
if((d <= maxrangesq) && (d < distance)) if(d < distance && d <= maxrangesq)
{ {
// This one is closer // This one is closer
closest = l; closest = l;
@ -2540,18 +2524,19 @@ namespace CodeImp.DoomBuilder.Map
RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange); RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange);
Vertex closest = null; Vertex closest = null;
float distance = float.MaxValue; float distance = float.MaxValue;
float d; float d, px, py;
// Go for all vertices in selection // Go for all vertices in selection
foreach(Vertex v in selection) foreach(Vertex v in selection)
{ {
px = v.Position.x;
py = v.Position.y;
// Within range? // Within range?
if((v.Position.x >= range.Left) && (v.Position.x <= range.Right)) if(!range.Contains(px, py)) continue; //mxd
{
if((v.Position.y >= range.Top) && (v.Position.y <= range.Bottom))
{
// Close than previous find? // Close than previous find?
d = Math.Abs(v.Position.x - pos.x) + Math.Abs(v.Position.y - pos.y); d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y);
if(d < distance) if(d < distance)
{ {
// This one is closer // This one is closer
@ -2559,8 +2544,6 @@ namespace CodeImp.DoomBuilder.Map
distance = d; distance = d;
} }
} }
}
}
// Return result // Return result
return closest; return closest;
@ -2572,18 +2555,19 @@ namespace CodeImp.DoomBuilder.Map
RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange); RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange);
Thing closest = null; Thing closest = null;
float distance = float.MaxValue; 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) foreach(Thing t in selection)
{ {
// Within range? px = t.Position.x;
if((t.Position.x >= (range.Left - t.Size)) && (t.Position.x <= (range.Right + t.Size))) py = t.Position.y;
{
if((t.Position.y >= (range.Top - t.Size)) && (t.Position.y <= (range.Bottom + t.Size))) //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? // Close than previous find?
d = Math.Abs(t.Position.x - pos.x) + Math.Abs(t.Position.y - pos.y); d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y);
if(d < distance) if(d < distance)
{ {
// This one is closer // This one is closer
@ -2591,8 +2575,6 @@ namespace CodeImp.DoomBuilder.Map
distance = d; distance = d;
} }
} }
}
}
// Return result // Return result
return closest; return closest;

View file

@ -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 { internal static System.Drawing.Bitmap Link {
get { get {
object obj = ResourceManager.GetObject("Link", resourceCulture); object obj = ResourceManager.GetObject("Link", resourceCulture);

View file

@ -118,11 +118,11 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="mergegeometry2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Monster3" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Keyboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Monster3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Keyboard.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -178,6 +178,9 @@
<data name="ScriptHelp" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ScriptHelp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ScriptHelp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ScriptHelp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="KnownTextureSet" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\KnownTextureSet.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Splash3_trans" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Splash3_trans" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash3_trans.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Splash3_trans.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -187,18 +190,12 @@
<data name="Status2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Status2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Status2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Status2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Unpin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Unpin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Redo" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Redo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Status0" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Status0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Status0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Status0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ViewBrightness" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ViewBrightness.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Model" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Model" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Model.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Model.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -226,6 +223,9 @@
<data name="fx" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="fx" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fx.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\fx.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="mergegeometry2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CLogo" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="CLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\CLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -235,9 +235,6 @@
<data name="List" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="List" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\List.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\List.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Keyboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Keyboard.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Question" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Question" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -280,6 +277,9 @@
<data name="ErrorLarge" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ErrorLarge" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ErrorLarge.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ErrorLarge.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="MCrash" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ScriptCompile" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ScriptCompile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -295,6 +295,9 @@
<data name="NewScript" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="NewScript" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\NewScript.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Unlink" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Unlink.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ScriptKeyword" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ScriptKeyword" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ScriptKeyword.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\Resources\ScriptKeyword.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
@ -325,17 +328,23 @@
<data name="Light_animate" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Light_animate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Link" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TagStatistics" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="TagStatistics" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Test" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Test.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Undo" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="KnownTextureSet" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Unpin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\KnownTextureSet.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Unpin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Angle" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Angle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Angle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Angle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -346,20 +355,23 @@
<data name="Grid2_arrowup" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Grid2_arrowup" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Pin" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Pin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ViewNormal" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ViewNormal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ViewNormal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ViewNormal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="MissingThing" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MissingThing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Monster3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Monster3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Copy" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Copy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Test" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ViewBrightness" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Test.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ViewBrightness.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Light" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Light" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Light.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Light.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -388,16 +400,7 @@
<data name="Check" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Check" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Link" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Lightbulb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Lightbulb.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Unlink" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Unlink.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MissingThing" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MissingThing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MCrash" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

View file

@ -77,6 +77,7 @@ namespace CodeImp.DoomBuilder.Rendering
void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords); void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords);
void RenderText(TextLabel text); void RenderText(TextLabel text);
void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords); void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords);
void RenderHighlight(FlatVertex[] vertices, int color); //mxd
void RedrawSurface(); void RedrawSurface();
} }
} }

View file

@ -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 // This renders text
public void RenderText(TextLabel text) public void RenderText(TextLabel text)
{ {
@ -1493,7 +1517,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw // Draw
graphics.Shaders.Display2D.Begin(); graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(1); //mxd 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.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces);
graphics.Shaders.Display2D.EndPass(); graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End(); graphics.Shaders.Display2D.End();

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

View file

@ -59,6 +59,8 @@ namespace CodeImp.DoomBuilder.Windows
void ShowThingInfo(Thing t); void ShowThingInfo(Thing t);
void ShowVertexInfo(Vertex v); void ShowVertexInfo(Vertex v);
void HideInfo(); void HideInfo();
void ShowEditModeHints(string[] hints); //mxd
void ClearEditModeHints(); //mxd
void RefreshInfo(); void RefreshInfo();
void UpdateCoordinates(Vector2D coords); void UpdateCoordinates(Vector2D coords);
bool Focus(); bool Focus();

View file

@ -38,6 +38,14 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.ToolStripSeparator toolStripSeparator2; System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
System.Windows.Forms.ToolStripSeparator toolStripSeparator3; System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); 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.seperatorfileopen = new System.Windows.Forms.ToolStripSeparator();
this.seperatorfilerecent = new System.Windows.Forms.ToolStripSeparator(); this.seperatorfilerecent = new System.Windows.Forms.ToolStripSeparator();
this.seperatoreditgrid = 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.yposlabel = new System.Windows.Forms.ToolStripStatusLabel();
this.warnsLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.warnsLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.panelinfo = new System.Windows.Forms.Panel(); 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.heightpanel1 = new System.Windows.Forms.Panel();
this.vertexinfo = new CodeImp.DoomBuilder.Controls.VertexInfoPanel();
this.labelcollapsedinfo = new System.Windows.Forms.Label(); this.labelcollapsedinfo = new System.Windows.Forms.Label();
this.buttontoggleinfo = new System.Windows.Forms.Button(); 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.linedefinfo = new CodeImp.DoomBuilder.Controls.LinedefInfoPanel();
this.thinginfo = new CodeImp.DoomBuilder.Controls.ThingInfoPanel(); this.thinginfo = new CodeImp.DoomBuilder.Controls.ThingInfoPanel();
this.sectorinfo = new CodeImp.DoomBuilder.Controls.SectorInfoPanel(); this.sectorinfo = new CodeImp.DoomBuilder.Controls.SectorInfoPanel();
@ -258,6 +267,7 @@ namespace CodeImp.DoomBuilder.Windows
this.toolbarContextMenu.SuspendLayout(); this.toolbarContextMenu.SuspendLayout();
this.statusbar.SuspendLayout(); this.statusbar.SuspendLayout();
this.panelinfo.SuspendLayout(); this.panelinfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.hintIcon)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// toolStripSeparator1 // toolStripSeparator1
@ -1854,7 +1864,7 @@ namespace CodeImp.DoomBuilder.Windows
this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.statuslabel.Name = "statuslabel"; 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.Spring = true;
this.statuslabel.Text = "Initializing user interface..."; this.statuslabel.Text = "Initializing user interface...";
this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -2122,11 +2132,12 @@ namespace CodeImp.DoomBuilder.Windows
// //
// panelinfo // panelinfo
// //
this.panelinfo.Controls.Add(this.hintIcon);
this.panelinfo.Controls.Add(this.hints);
this.panelinfo.Controls.Add(this.heightpanel1); this.panelinfo.Controls.Add(this.heightpanel1);
this.panelinfo.Controls.Add(this.vertexinfo);
this.panelinfo.Controls.Add(this.labelcollapsedinfo); this.panelinfo.Controls.Add(this.labelcollapsedinfo);
this.panelinfo.Controls.Add(this.buttontoggleinfo); 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.linedefinfo);
this.panelinfo.Controls.Add(this.thinginfo); this.panelinfo.Controls.Add(this.thinginfo);
this.panelinfo.Controls.Add(this.sectorinfo); 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.Size = new System.Drawing.Size(986, 106);
this.panelinfo.TabIndex = 4; 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 // heightpanel1
// //
this.heightpanel1.BackColor = System.Drawing.Color.Navy; this.heightpanel1.BackColor = System.Drawing.Color.Navy;
@ -2146,24 +2195,13 @@ namespace CodeImp.DoomBuilder.Windows
this.heightpanel1.TabIndex = 7; this.heightpanel1.TabIndex = 7;
this.heightpanel1.Visible = false; 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 // labelcollapsedinfo
// //
this.labelcollapsedinfo.AutoSize = true; 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.Location = new System.Drawing.Point(2, 2);
this.labelcollapsedinfo.Name = "labelcollapsedinfo"; 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.TabIndex = 6;
this.labelcollapsedinfo.Text = "Collapsed Descriptions"; this.labelcollapsedinfo.Text = "Collapsed Descriptions";
this.labelcollapsedinfo.Visible = false; this.labelcollapsedinfo.Visible = false;
@ -2184,19 +2222,16 @@ namespace CodeImp.DoomBuilder.Windows
this.buttontoggleinfo.Click += new System.EventHandler(this.InvokeTaggedAction); this.buttontoggleinfo.Click += new System.EventHandler(this.InvokeTaggedAction);
this.buttontoggleinfo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.buttontoggleinfo_MouseUp); this.buttontoggleinfo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.buttontoggleinfo_MouseUp);
// //
// modename // vertexinfo
// //
this.modename.AutoSize = true; this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.modename.Font = new System.Drawing.Font("Verdana", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.vertexinfo.Location = new System.Drawing.Point(0, 0);
this.modename.ForeColor = System.Drawing.SystemColors.GrayText; this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.modename.Location = new System.Drawing.Point(12, 20); this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.modename.Name = "modename"; this.vertexinfo.Name = "vertexinfo";
this.modename.Size = new System.Drawing.Size(244, 59); this.vertexinfo.Size = new System.Drawing.Size(310, 100);
this.modename.TabIndex = 4; this.vertexinfo.TabIndex = 1;
this.modename.Text = "Vertices"; this.vertexinfo.Visible = false;
this.modename.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.modename.UseMnemonic = false;
this.modename.Visible = false;
// //
// linedefinfo // linedefinfo
// //
@ -2333,6 +2368,7 @@ namespace CodeImp.DoomBuilder.Windows
this.statusbar.PerformLayout(); this.statusbar.PerformLayout();
this.panelinfo.ResumeLayout(false); this.panelinfo.ResumeLayout(false);
this.panelinfo.PerformLayout(); this.panelinfo.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.hintIcon)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -2415,7 +2451,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripMenuItem itemgridinc; private System.Windows.Forms.ToolStripMenuItem itemgridinc;
private System.Windows.Forms.ToolStripMenuItem itemgriddec; private System.Windows.Forms.ToolStripMenuItem itemgriddec;
private System.Windows.Forms.ToolStripMenuItem itemgridsetup; private System.Windows.Forms.ToolStripMenuItem itemgridsetup;
private System.Windows.Forms.Label modename;
private System.Windows.Forms.Timer statusflasher; private System.Windows.Forms.Timer statusflasher;
private System.Windows.Forms.ToolStripSplitButton buttontest; private System.Windows.Forms.ToolStripSplitButton buttontest;
private System.Windows.Forms.ToolStripButton buttoncut; 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 itemopenmapincurwad;
private System.Windows.Forms.ToolStripMenuItem itemgrid1; private System.Windows.Forms.ToolStripMenuItem itemgrid1;
private System.Windows.Forms.ToolStripMenuItem itemzoom400; private System.Windows.Forms.ToolStripMenuItem itemzoom400;
private System.Windows.Forms.ListView hints;
private System.Windows.Forms.PictureBox hintIcon;
} }
} }

View file

@ -131,6 +131,7 @@ namespace CodeImp.DoomBuilder.Windows
// Last info on panels // Last info on panels
private object lastinfoobject; private object lastinfoobject;
private string currentModeName; //mxd
// Recent files // Recent files
private ToolStripMenuItem[] recentitems; private ToolStripMenuItem[] recentitems;
@ -199,6 +200,7 @@ namespace CodeImp.DoomBuilder.Windows
editmodeitems = new List<ToolStripItem>(); editmodeitems = new List<ToolStripItem>();
labelcollapsedinfo.Text = ""; labelcollapsedinfo.Text = "";
display.Dock = DockStyle.Fill; display.Dock = DockStyle.Fill;
hintIcon.Image = Resources.Lightbulb; //mxd
// Fetch pointer // Fetch pointer
windowptr = base.Handle; windowptr = base.Handle;
@ -409,11 +411,11 @@ namespace CodeImp.DoomBuilder.Windows
} }
// This unlocks for updating // This unlocks for updating
internal void ForceUnlockUpdate() /*internal void ForceUnlockUpdate()
{ {
if(lockupdatecount > 0) General.LockWindowUpdate(IntPtr.Zero); if(lockupdatecount > 0) General.LockWindowUpdate(IntPtr.Zero);
lockupdatecount = 0; lockupdatecount = 0;
} }*/
// This sets the focus on the display for correct key input // This sets the focus on the display for correct key input
public bool FocusDisplay() public bool FocusDisplay()
@ -2755,7 +2757,8 @@ namespace CodeImp.DoomBuilder.Windows
if(vertexinfo.Visible) vertexinfo.Hide(); if(vertexinfo.Visible) vertexinfo.Hide();
if(sectorinfo.Visible) sectorinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide();
if(thinginfo.Visible) thinginfo.Hide(); if(thinginfo.Visible) thinginfo.Hide();
modename.Visible = false; hints.Visible = false; //mxd
hintIcon.Visible = false; //mxd
labelcollapsedinfo.Visible = true; labelcollapsedinfo.Visible = true;
itemtoggleinfo.Checked = false; itemtoggleinfo.Checked = false;
} }
@ -2784,14 +2787,10 @@ namespace CodeImp.DoomBuilder.Windows
// This displays the current mode name // This displays the current mode name
internal void DisplayModeName(string name) internal void DisplayModeName(string name)
{ {
if(lastinfoobject == null) currentModeName = name; //mxd
{
labelcollapsedinfo.Text = name; labelcollapsedinfo.Text = name;
labelcollapsedinfo.Refresh(); labelcollapsedinfo.Refresh();
} }
modename.Text = name;
modename.Refresh();
}
// This hides all info panels // This hides all info panels
public void HideInfo() public void HideInfo()
@ -2802,10 +2801,14 @@ namespace CodeImp.DoomBuilder.Windows
if(vertexinfo.Visible) vertexinfo.Hide(); if(vertexinfo.Visible) vertexinfo.Hide();
if(sectorinfo.Visible) sectorinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide();
if(thinginfo.Visible) thinginfo.Hide(); if(thinginfo.Visible) thinginfo.Hide();
labelcollapsedinfo.Text = modename.Text; labelcollapsedinfo.Text = currentModeName;
labelcollapsedinfo.Visible = true;
labelcollapsedinfo.Refresh(); 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 //mxd. let the plugins know
General.Plugins.OnHighlightLost(); General.Plugins.OnHighlightLost();
@ -2823,6 +2826,19 @@ namespace CodeImp.DoomBuilder.Windows
General.Plugins.OnHighlightRefreshed(lastinfoobject); 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 // Show linedef info
public void ShowLinedefInfo(Linedef l) public void ShowLinedefInfo(Linedef l)
{ {
@ -2833,78 +2849,81 @@ namespace CodeImp.DoomBuilder.Windows
} }
lastinfoobject = l; lastinfoobject = l;
modename.Visible = false; hints.Visible = false; //mxd
hintIcon.Visible = false; //mxd
if(vertexinfo.Visible) vertexinfo.Hide(); if(vertexinfo.Visible) vertexinfo.Hide();
if(sectorinfo.Visible) sectorinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide();
if(thinginfo.Visible) thinginfo.Hide(); if(thinginfo.Visible) thinginfo.Hide();
if(IsInfoPanelExpanded) linedefinfo.ShowInfo(l); if (IsInfoPanelExpanded) {
linedefinfo.ShowInfo(l);
} else {
// Show info on collapsed label // Show info on collapsed label
if(General.Map.Config.LinedefActions.ContainsKey(l.Action)) if(General.Map.Config.LinedefActions.ContainsKey(l.Action)) {
{
LinedefActionInfo act = General.Map.Config.LinedefActions[l.Action]; LinedefActionInfo act = General.Map.Config.LinedefActions[l.Action];
labelcollapsedinfo.Text = act.ToString(); labelcollapsedinfo.Text = act.ToString();
} } else if(l.Action == 0)
else if(l.Action == 0)
labelcollapsedinfo.Text = l.Action.ToString() + " - None"; labelcollapsedinfo.Text = l.Action.ToString() + " - None";
else else
labelcollapsedinfo.Text = l.Action.ToString() + " - Unknown"; labelcollapsedinfo.Text = l.Action.ToString() + " - Unknown";
labelcollapsedinfo.Refresh(); labelcollapsedinfo.Refresh();
}
//mxd. let the plugins know //mxd. let the plugins know
General.Plugins.OnHighlightLinedef(l); General.Plugins.OnHighlightLinedef(l);
} }
// Show vertex info // Show vertex info
public void ShowVertexInfo(Vertex v) public void ShowVertexInfo(Vertex v) {
{ if (v.IsDisposed) {
if(v.IsDisposed)
{
HideInfo(); HideInfo();
return; return;
} }
lastinfoobject = v; lastinfoobject = v;
modename.Visible = false; hints.Visible = false; //mxd
if(linedefinfo.Visible) linedefinfo.Hide(); hintIcon.Visible = false; //mxd
if(sectorinfo.Visible) sectorinfo.Hide(); if (linedefinfo.Visible) linedefinfo.Hide();
if(thinginfo.Visible) thinginfo.Hide(); if (sectorinfo.Visible) sectorinfo.Hide();
if(IsInfoPanelExpanded) vertexinfo.ShowInfo(v); if (thinginfo.Visible) thinginfo.Hide();
if (IsInfoPanelExpanded) {
vertexinfo.ShowInfo(v);
} else {
// Show info on collapsed label // Show info on collapsed label
labelcollapsedinfo.Text = v.Position.x.ToString("0.##") + ", " + v.Position.y.ToString("0.##"); labelcollapsedinfo.Text = v.Position.x.ToString("0.##") + ", " + v.Position.y.ToString("0.##");
labelcollapsedinfo.Refresh(); labelcollapsedinfo.Refresh();
}
//mxd. let the plugins know //mxd. let the plugins know
General.Plugins.OnHighlightVertex(v); General.Plugins.OnHighlightVertex(v);
} }
// Show sector info // Show sector info
public void ShowSectorInfo(Sector s) public void ShowSectorInfo(Sector s) {
{ if (s.IsDisposed) {
if(s.IsDisposed)
{
HideInfo(); HideInfo();
return; return;
} }
lastinfoobject = s; lastinfoobject = s;
modename.Visible = false; hints.Visible = false;
if(linedefinfo.Visible) linedefinfo.Hide(); hintIcon.Visible = false; //mxd
if(vertexinfo.Visible) vertexinfo.Hide(); if (linedefinfo.Visible) linedefinfo.Hide();
if(thinginfo.Visible) thinginfo.Hide(); if (vertexinfo.Visible) vertexinfo.Hide();
if(IsInfoPanelExpanded) sectorinfo.ShowInfo(s); if (thinginfo.Visible) thinginfo.Hide();
if (IsInfoPanelExpanded) {
sectorinfo.ShowInfo(s);
} else {
// Show info on collapsed label // Show info on collapsed label
if(General.Map.Config.SectorEffects.ContainsKey(s.Effect)) if (General.Map.Config.SectorEffects.ContainsKey(s.Effect))
labelcollapsedinfo.Text = General.Map.Config.SectorEffects[s.Effect].ToString(); labelcollapsedinfo.Text = General.Map.Config.SectorEffects[s.Effect].ToString();
else if(s.Effect == 0) else if (s.Effect == 0)
labelcollapsedinfo.Text = s.Effect.ToString() + " - Normal"; labelcollapsedinfo.Text = s.Effect.ToString() + " - Normal";
else else
labelcollapsedinfo.Text = s.Effect.ToString() + " - Unknown"; labelcollapsedinfo.Text = s.Effect.ToString() + " - Unknown";
labelcollapsedinfo.Refresh(); labelcollapsedinfo.Refresh();
}
//mxd. let the plugins know //mxd. let the plugins know
General.Plugins.OnHighlightSector(s); General.Plugins.OnHighlightSector(s);
@ -2920,16 +2939,19 @@ namespace CodeImp.DoomBuilder.Windows
} }
lastinfoobject = t; lastinfoobject = t;
modename.Visible = false; hints.Visible = false;
hintIcon.Visible = false; //mxd
if(linedefinfo.Visible) linedefinfo.Hide(); if(linedefinfo.Visible) linedefinfo.Hide();
if(vertexinfo.Visible) vertexinfo.Hide(); if(vertexinfo.Visible) vertexinfo.Hide();
if(sectorinfo.Visible) sectorinfo.Hide(); if(sectorinfo.Visible) sectorinfo.Hide();
if(IsInfoPanelExpanded) thinginfo.ShowInfo(t); if (IsInfoPanelExpanded) {
thinginfo.ShowInfo(t);
} else {
// Show info on collapsed label // Show info on collapsed label
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
labelcollapsedinfo.Text = t.Type + " - " + ti.Title; labelcollapsedinfo.Text = t.Type + " - " + ti.Title;
labelcollapsedinfo.Refresh(); labelcollapsedinfo.Refresh();
}
//mxd. let the plugins know //mxd. let the plugins know
General.Plugins.OnHighlightThing(t); General.Plugins.OnHighlightThing(t);

View file

@ -180,18 +180,12 @@
<metadata name="heightpanel1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="heightpanel1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="vertexinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="labelcollapsedinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="labelcollapsedinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="buttontoggleinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="buttontoggleinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="modename.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="linedefinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="linedefinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View file

@ -427,6 +427,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Set cursor // Set cursor
General.Interface.SetCursor(Cursors.Cross); 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 // Disengaging

View file

@ -64,6 +64,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Effects //mxd. Effects
private Dictionary<int, string[]> effects; private Dictionary<int, string[]> effects;
//mxd. Cached overlays stuff
private FlatVertex[] overlayGeometry;
private Dictionary<Sector, string[]> selectedEffectLabels;
private Dictionary<Sector, string[]> unselectedEffectLabels;
#endregion #endregion
#region ================== Properties #region ================== Properties
@ -154,31 +159,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(renderer.StartOverlay(true)) 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 // Go for all selected sectors
ICollection<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true); ICollection<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true);
//mxd. Render selected sectors //mxd. Render selected sectors
if (BuilderPlug.Me.UseHighlight) { if (BuilderPlug.Me.UseHighlight) {
int selectedColor = General.Colors.Selection.WithAlpha(64).ToInt(); //mxd renderer.RenderHighlight(overlayGeometry, General.Colors.Selection.WithAlpha(64).ToInt());
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);
}
} }
//mxd. Render highlighted sector
if(BuilderPlug.Me.UseHighlight && highlighted != null) {
renderer.RenderHighlight(highlighted.FlatVertices, General.Colors.Highlight.WithAlpha(64).ToInt());
} }
if (BuilderPlug.Me.ViewSelectionNumbers) { if (BuilderPlug.Me.ViewSelectionNumbers) {
@ -195,11 +186,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
if (BuilderPlug.Me.ViewSelectionEffects) {
//mxd. Render effect labels //mxd. Render effect labels
if(!BuilderPlug.Me.ViewSelectionNumbers) if (BuilderPlug.Me.ViewSelectionEffects) {
renderEffectLabels(orderedselection); if(!BuilderPlug.Me.ViewSelectionNumbers) renderEffectLabels(selectedEffectLabels);
renderEffectLabels(General.Map.Map.GetSelectedSectors(false)); renderEffectLabels(unselectedEffectLabels);
} }
renderer.Finish(); renderer.Finish();
@ -207,47 +197,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
//mxd //mxd
private void renderEffectLabels(ICollection<Sector> selection) { private void renderEffectLabels(Dictionary<Sector, string[]> labelsGroup) {
foreach(Sector s in selection) { foreach(KeyValuePair<Sector, string[]> group in labelsGroup) {
string label = string.Empty; // Render labels
string labelShort = string.Empty; TextLabel[] labelarray = labels[group.Key];
for(int i = 0; i < group.Key.Labels.Count; i++) {
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++) {
TextLabel l = labelarray[i]; TextLabel l = labelarray[i];
l.Color = General.Colors.InfoLine; l.Color = General.Colors.InfoLine;
float requiredsize = (General.Map.GetTextSize(label, l.Scale).Width) / renderer.Scale;
if(requiredsize > s.Labels[i].radius) { // Render only when enough space for the label to see
requiredsize = (General.Map.GetTextSize(labelShort, l.Scale).Width) / renderer.Scale; float requiredsize = (General.Map.GetTextSize(group.Value[0], l.Scale).Width) / renderer.Scale;
l.Text = (requiredsize > s.Labels[i].radius ? "+" : labelShort); 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 { } else {
l.Text = label; l.Text = group.Value[0];
} }
renderer.RenderText(l); renderer.RenderText(l);
@ -255,6 +219,68 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
//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<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true);
List<FlatVertex> vertsList = new List<FlatVertex>();
// Go for all selected sectors
foreach(Sector s in orderedselection) vertsList.AddRange(s.FlatVertices);
overlayGeometry = vertsList.ToArray();
}
//mxd
private void updateEffectLabels() {
selectedEffectLabels = new Dictionary<Sector, string[]>();
unselectedEffectLabels = new Dictionary<Sector, string[]>();
//update effect labels for selected sectors
ICollection<Sector> 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 // Support function for joining and merging sectors
private void JoinMergeSectors(bool removelines) private void JoinMergeSectors(bool removelines)
{ {
@ -403,13 +429,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
selectionchanged = true; selectionchanged = true;
// Setup labels // Setup labels
ICollection<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true); //ICollection<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true);
if(update) { //mxd
string selectedCount = General.Map.Map.SelectedSectorsCount.ToString();
TextLabel[] labelarray = labels[s]; TextLabel[] labelarray = labels[s];
foreach(TextLabel l in labelarray) foreach(TextLabel l in labelarray) {
{ l.Text = selectedCount;// orderedselection.Count.ToString();
l.Text = orderedselection.Count.ToString();
l.Color = General.Colors.Selection; l.Color = General.Colors.Selection;
} }
updateEffectLabels();
}
} }
// Deselect the sector? // Deselect the sector?
else if(!selectstate && s.Selected) else if(!selectstate && s.Selected)
@ -418,12 +448,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
selectionchanged = true; selectionchanged = true;
// Clear labels // Clear labels
if(update) {
TextLabel[] labelarray = labels[s]; TextLabel[] labelarray = labels[s];
foreach(TextLabel l in labelarray) l.Text = ""; foreach(TextLabel l in labelarray) l.Text = "";
// Update all other labels // Update all other labels
UpdateSelectedLabels(); UpdateSelectedLabels();
} }
}
// Selection changed? // Selection changed?
if(selectionchanged) if(selectionchanged)
@ -436,7 +468,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false; if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false;
sd.Line.Selected = front | back; sd.Line.Selected = front | back;
} }
}
if(update) if(update)
{ {
@ -445,6 +476,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
} }
}
// This updates labels from the selected sectors // This updates labels from the selected sectors
private void UpdateSelectedLabels() private void UpdateSelectedLabels()
@ -464,41 +496,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
index++; index++;
} }
//mxd
updateEffectLabels();
} }
//mxd //mxd
private bool isInSelectionRect(Sector s, List<Line2D> selectionOutline) { private bool isInSelectionRect(Sector s, List<Line2D> selectionOutline) {
bool selected = false; bool isInsideSelection = selectionrect.Contains(s.BBox);
if (isInsideSelection) return true;
if(BuilderPlug.Me.MarqueSelectTouching) { if(BuilderPlug.Me.MarqueSelectTouching && s.BBox.IntersectsWith(selectionrect)) {
//check endpoints //check endpoints
foreach (Sidedef side in s.Sidedefs) { foreach(Sidedef side in s.Sidedefs) {
selected = (selectionrect.Contains(side.Line.Start.Position.x, side.Line.Start.Position.y) 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)); || selectionrect.Contains(side.Line.End.Position.x, side.Line.End.Position.y)))
if (selected) return true; return true;
} }
//check line intersections //check line intersections
foreach (Sidedef side in s.Sidedefs) { foreach(Sidedef side in s.Sidedefs) {
foreach (Line2D line in selectionOutline) { foreach(Line2D line in selectionOutline) {
if(Line2D.GetIntersection(side.Line.Line, line)) if(Line2D.GetIntersection(side.Line.Line, line))
return true; return true;
} }
} }
}
return false; 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;
}
#endregion #endregion
#region ================== Events #region ================== Events
@ -539,13 +566,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Convert geometry selection to sectors only // Convert geometry selection to sectors only
General.Map.Map.ConvertSelection(SelectionType.Sectors); General.Map.Map.ConvertSelection(SelectionType.Sectors);
updateSelectionInfo(); //mxd
// Make text labels for sectors // Make text labels for sectors
SetupLabels(); SetupLabels();
// Update // Update
UpdateSelectedLabels(); UpdateSelectedLabels();
updateOverlaySurfaces();//mxd
updateSelectionInfo(); //mxd
UpdateOverlay(); UpdateOverlay();
} }
@ -583,6 +611,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// Make the highlight the selection // Make the highlight the selection
SelectSector(highlighted, true, false); SelectSector(highlighted, true, false);
UpdateSelectedLabels(); //mxd
} }
} }
} }
@ -674,12 +703,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update overlay // Update overlay
TextLabel[] labelarray = labels[highlighted]; TextLabel[] labelarray = labels[highlighted];
foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight; foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight;
updateOverlaySurfaces(); //mxd
UpdateOverlay(); UpdateOverlay();
renderer.Present(); renderer.Present();
//mxd //mxd
} else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedSectorsCount > 0) { } else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedSectorsCount > 0) {
General.Map.Map.ClearSelectedLinedefs(); General.Map.Map.ClearSelectedLinedefs();
General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedSectors();
updateOverlaySurfaces(); //mxd
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
@ -705,6 +736,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs(); General.Map.Map.ClearSelectedLinedefs();
SelectSector(highlighted, true, false); SelectSector(highlighted, true, false);
UpdateSelectedLabels(); //mxd
updateOverlaySurfaces(); //mxd
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
@ -757,9 +790,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (selected.Count == 1) { if (selected.Count == 1) {
General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs(); General.Map.Map.ClearSelectedLinedefs();
updateEffectLabels(); //mxd
} else if(result == DialogResult.Cancel) { //mxd. Restore selection... } 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(); General.Interface.RedrawDisplay();
} }
} }
@ -825,6 +862,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
SelectSector(highlighted, !highlighted.Selected, true); SelectSector(highlighted, !highlighted.Selected, true);
// Update entire display // Update entire display
updateOverlaySurfaces();//mxd
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
} else if(highlighted != null) { } else if(highlighted != null) {
@ -903,6 +941,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
SelectSector(highlighted, !highlighted.Selected, true); SelectSector(highlighted, !highlighted.Selected, true);
// Update entire display // Update entire display
updateOverlaySurfaces();//mxd
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
@ -926,6 +965,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Select only this sector for dragging // Select only this sector for dragging
General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedSectors();
SelectSector(highlighted, true, true); SelectSector(highlighted, true, true);
updateOverlaySurfaces(); //mxd
} }
// Start dragging the selection // 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.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) { || 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++; unaffectedCount++;
break; break;
} }
@ -964,6 +1004,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(unaffectedCount > 0) if(unaffectedCount > 0)
General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected sectors " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!"); General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected sectors " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!");
UpdateSelectedLabels(); //mxd
return true; return true;
} }
@ -1013,7 +1054,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef sd in General.Map.Map.Sidedefs) foreach(Sidedef sd in General.Map.Map.Sidedefs)
sd.Line.Selected = sd.Sector.Selected || (sd.Other != null && sd.Other.Sector.Selected); sd.Line.Selected = sd.Sector.Selected || (sd.Other != null && sd.Other.Sector.Selected);
//mxd. Clear labels for unselected sectors
if(marqueSelectionMode != MarqueSelectionMode.ADD) {
ICollection<Sector> 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 updateSelectionInfo(); //mxd
updateOverlaySurfaces(); //mxd
} }
base.OnEndMultiSelection(); base.OnEndMultiSelection();
@ -1043,6 +1095,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// Make the highlight the selection // Make the highlight the selection
SelectSector(highlighted, true, true); SelectSector(highlighted, true, true);
updateOverlaySurfaces();//mxd
} }
return base.OnCopyBegin(); return base.OnCopyBegin();
@ -1062,6 +1115,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// Clear labels // Clear labels
SetupLabels(); SetupLabels();
updateEffectLabels(); //mxd
} }
// When redo is used // When redo is used
@ -1078,6 +1132,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// Clear labels // Clear labels
SetupLabels(); SetupLabels();
updateEffectLabels(); //mxd
base.OnRedoEnd(); //mxd base.OnRedoEnd(); //mxd
} }
@ -1147,6 +1202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.IsChanged = true; General.Map.IsChanged = true;
General.Interface.RefreshInfo(); General.Interface.RefreshInfo();
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
updateEffectLabels(); //mxd
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
} }
@ -1178,6 +1234,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs(); General.Map.Map.ClearSelectedLinedefs();
SelectSector(highlighted, true, false); SelectSector(highlighted, true, false);
updateOverlaySurfaces();//mxd
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
@ -1388,6 +1445,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update cache values // Update cache values
General.Map.IsChanged = true; General.Map.IsChanged = true;
General.Map.Map.Update(); General.Map.Map.Update();
updateOverlaySurfaces(); //mxd
// Make text labels for sectors // Make text labels for sectors
SetupLabels(); SetupLabels();
@ -1695,6 +1753,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Clear labels // Clear labels
foreach(TextLabel[] labelarray in labels.Values) foreach(TextLabel[] labelarray in labels.Values)
foreach(TextLabel l in labelarray) l.Text = ""; foreach(TextLabel l in labelarray) l.Text = "";
updateOverlaySurfaces(); //mxd
updateEffectLabels(); //mxd
// Redraw // Redraw
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();