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

View file

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

View file

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

View file

@ -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,21 +1421,16 @@ namespace CodeImp.DoomBuilder.Geometry
}
}
//mxd
if(autoAlignTextureOffsets) {
//Auto-align new lines
if(newlines.Count > 1) {
//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));
}
}
// Mark new geometry only
General.Map.Map.ClearMarkedLinedefs(false);

View file

@ -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)
{
//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;
}
/// <summary>This filters vertices by a rectangular area.</summary>
public static ICollection<Vertex> FilterByArea(ICollection<Vertex> 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,18 +2524,19 @@ 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((v.Position.y >= range.Top) && (v.Position.y <= range.Bottom))
{
if(!range.Contains(px, py)) continue; //mxd
// 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)
{
// This one is closer
@ -2559,8 +2544,6 @@ namespace CodeImp.DoomBuilder.Map
distance = d;
}
}
}
}
// Return result
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);
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)))
{
if((t.Position.y >= (range.Top - t.Size)) && (t.Position.y <= (range.Bottom + 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(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)
{
// This one is closer
@ -2591,8 +2575,6 @@ namespace CodeImp.DoomBuilder.Map
distance = d;
}
}
}
}
// Return result
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 {
get {
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>
</resheader>
<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">
<value>..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<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="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 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="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>
@ -178,6 +178,9 @@
<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>
</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">
<value>..\Resources\Splash3_trans.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -187,18 +190,12 @@
<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>
</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">
<value>..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</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">
<value>..\Resources\Model.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -226,6 +223,9 @@
<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>
</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">
<value>..\Resources\CLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -235,9 +235,6 @@
<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>
</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">
<value>..\Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -280,6 +277,9 @@
<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>
</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">
<value>..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -295,6 +295,9 @@
<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>
</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">
<value>..\Resources\ScriptKeyword.xpm;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
@ -325,17 +328,23 @@
<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>
</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">
<value>..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</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">
<value>..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</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 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="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>
@ -346,20 +355,23 @@
<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>
</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">
<value>..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</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">
<value>..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</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 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="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>
@ -388,16 +400,7 @@
<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>
</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="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 name="Lightbulb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Lightbulb.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -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();
}
}

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
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();

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 ShowVertexInfo(Vertex v);
void HideInfo();
void ShowEditModeHints(string[] hints); //mxd
void ClearEditModeHints(); //mxd
void RefreshInfo();
void UpdateCoordinates(Vector2D coords);
bool Focus();

View file

@ -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;
}
}

View file

@ -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<ToolStripItem>();
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,14 +2787,10 @@ namespace CodeImp.DoomBuilder.Windows
// This displays the current mode name
internal void DisplayModeName(string name)
{
if(lastinfoobject == null)
{
currentModeName = name; //mxd
labelcollapsedinfo.Text = name;
labelcollapsedinfo.Refresh();
}
modename.Text = name;
modename.Refresh();
}
// This hides all info panels
public void HideInfo()
@ -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();
@ -2823,6 +2826,19 @@ namespace CodeImp.DoomBuilder.Windows
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))
{
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)
} 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);
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))
if (General.Map.Config.SectorEffects.ContainsKey(s.Effect))
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";
else
labelcollapsedinfo.Text = s.Effect.ToString() + " - Unknown";
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);
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);

View file

@ -180,18 +180,12 @@
<metadata name="heightpanel1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</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">
<value>True</value>
</metadata>
<metadata name="buttontoggleinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</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">
<value>True</value>
</metadata>

View file

@ -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

View file

@ -64,6 +64,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Effects
private Dictionary<int, string[]> effects;
//mxd. Cached overlays stuff
private FlatVertex[] overlayGeometry;
private Dictionary<Sector, string[]> selectedEffectLabels;
private Dictionary<Sector, string[]> 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<Sector> 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
}
}
if (BuilderPlug.Me.ViewSelectionEffects) {
//mxd. Render effect labels
if(!BuilderPlug.Me.ViewSelectionNumbers)
renderEffectLabels(orderedselection);
renderEffectLabels(General.Map.Map.GetSelectedSectors(false));
if (BuilderPlug.Me.ViewSelectionEffects) {
if(!BuilderPlug.Me.ViewSelectionNumbers) renderEffectLabels(selectedEffectLabels);
renderEffectLabels(unselectedEffectLabels);
}
renderer.Finish();
@ -207,47 +197,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd
private void renderEffectLabels(ICollection<Sector> 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<Sector, string[]> labelsGroup) {
foreach(KeyValuePair<Sector, string[]> 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);
@ -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
private void JoinMergeSectors(bool removelines)
{
@ -403,13 +429,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
selectionchanged = true;
// 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];
foreach(TextLabel l in labelarray)
{
l.Text = orderedselection.Count.ToString();
foreach(TextLabel l in labelarray) {
l.Text = selectedCount;// orderedselection.Count.ToString();
l.Color = General.Colors.Selection;
}
updateEffectLabels();
}
}
// Deselect the sector?
else if(!selectstate && s.Selected)
@ -418,12 +448,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
selectionchanged = true;
// Clear labels
if(update) {
TextLabel[] labelarray = labels[s];
foreach(TextLabel l in labelarray) l.Text = "";
// Update all other labels
UpdateSelectedLabels();
}
}
// Selection changed?
if(selectionchanged)
@ -436,7 +468,6 @@ 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)
{
@ -445,6 +476,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
}
// This updates labels from the selected sectors
private void UpdateSelectedLabels()
@ -464,41 +496,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
index++;
}
//mxd
updateEffectLabels();
}
//mxd
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
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;
}
#endregion
#region ================== Events
@ -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<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
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();