Visplane Explorer: added "Open Doors" and "Heat Colors" options.

This commit is contained in:
MaxED 2014-09-11 11:51:02 +00:00
parent a7488939af
commit 22c5d6c0b7
14 changed files with 108 additions and 23 deletions

View file

@ -132,7 +132,7 @@
// gridlock
//
this.gridlock.Checked = false;
this.gridlock.Margin = new System.Windows.Forms.Padding(6, 1, 0, 2);
this.gridlock.Margin = new System.Windows.Forms.Padding(12, 1, 0, 2);
this.gridlock.Name = "gridlock";
this.gridlock.Size = new System.Drawing.Size(120, 22);
this.gridlock.Text = "Lock slices to grid";

View file

@ -88,6 +88,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
palettes[(int)ViewStats.Drawsegs] = new Palette(Resources.Drawsegs_pal);
palettes[(int)ViewStats.Solidsegs] = new Palette(Resources.Solidsegs_pal);
palettes[(int)ViewStats.Openings] = new Palette(Resources.Openings_pal);
palettes[(int)ViewStats.Heatmap] = new Palette(Resources.Heatmap_pal); //mxd
ApplyUserColors();
}
}
@ -107,7 +108,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
interfaceform = null;
vpo.Dispose();
vpo = null;
//General.Actions.UnbindMethods(this); //mxd. But... we have no methods to unbind!
base.Dispose();
}

View file

@ -35,14 +35,20 @@
this.dsstats = new System.Windows.Forms.ToolStripMenuItem();
this.ssstats = new System.Windows.Forms.ToolStripMenuItem();
this.opstats = new System.Windows.Forms.ToolStripMenuItem();
this.cbopendoors = new CodeImp.DoomBuilder.Controls.ToolStripCheckBox();
this.cbheatmap = new CodeImp.DoomBuilder.Controls.ToolStripCheckBox();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.separator = new System.Windows.Forms.ToolStripSeparator();
this.toolstrip.SuspendLayout();
this.SuspendLayout();
//
// toolstrip
//
this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.statsbutton});
this.statsbutton,
this.separator,
this.cbopendoors,
this.cbheatmap});
this.toolstrip.Location = new System.Drawing.Point(0, 0);
this.toolstrip.Name = "toolstrip";
this.toolstrip.Size = new System.Drawing.Size(465, 25);
@ -68,7 +74,7 @@
this.vpstats.CheckState = System.Windows.Forms.CheckState.Checked;
this.vpstats.Image = global::CodeImp.DoomBuilder.Plugins.VisplaneExplorer.Properties.Resources.Visplanes;
this.vpstats.Name = "vpstats";
this.vpstats.Size = new System.Drawing.Size(132, 22);
this.vpstats.Size = new System.Drawing.Size(152, 22);
this.vpstats.Tag = "0";
this.vpstats.Text = "Visplanes";
this.vpstats.Click += new System.EventHandler(this.stats_Click);
@ -77,7 +83,7 @@
//
this.dsstats.Image = global::CodeImp.DoomBuilder.Plugins.VisplaneExplorer.Properties.Resources.Drawsegs;
this.dsstats.Name = "dsstats";
this.dsstats.Size = new System.Drawing.Size(132, 22);
this.dsstats.Size = new System.Drawing.Size(152, 22);
this.dsstats.Tag = "1";
this.dsstats.Text = "Drawsegs";
this.dsstats.Click += new System.EventHandler(this.stats_Click);
@ -86,7 +92,7 @@
//
this.ssstats.Image = global::CodeImp.DoomBuilder.Plugins.VisplaneExplorer.Properties.Resources.Solidsegs;
this.ssstats.Name = "ssstats";
this.ssstats.Size = new System.Drawing.Size(132, 22);
this.ssstats.Size = new System.Drawing.Size(152, 22);
this.ssstats.Tag = "2";
this.ssstats.Text = "Solidsegs";
this.ssstats.Click += new System.EventHandler(this.stats_Click);
@ -95,11 +101,28 @@
//
this.opstats.Image = global::CodeImp.DoomBuilder.Plugins.VisplaneExplorer.Properties.Resources.Openings;
this.opstats.Name = "opstats";
this.opstats.Size = new System.Drawing.Size(132, 22);
this.opstats.Size = new System.Drawing.Size(152, 22);
this.opstats.Tag = "3";
this.opstats.Text = "Openings";
this.opstats.Click += new System.EventHandler(this.stats_Click);
//
// cbopendoors
//
this.cbopendoors.Checked = false;
this.cbopendoors.Margin = new System.Windows.Forms.Padding(12, 1, 0, 2);
this.cbopendoors.Name = "cbopendoors";
this.cbopendoors.Size = new System.Drawing.Size(89, 22);
this.cbopendoors.Text = "Open Doors";
this.cbopendoors.Click += new System.EventHandler(this.cbopendoors_Click);
//
// cbheatmap
//
this.cbheatmap.Checked = false;
this.cbheatmap.Name = "cbheatmap";
this.cbheatmap.Size = new System.Drawing.Size(88, 22);
this.cbheatmap.Text = "Heat Colors";
this.cbheatmap.Click += new System.EventHandler(this.cbheatmap_Click);
//
// tooltip
//
this.tooltip.AutomaticDelay = 1;
@ -108,6 +131,11 @@
this.tooltip.ReshowDelay = 0;
this.tooltip.ShowAlways = true;
//
// separator
//
this.separator.Name = "separator";
this.separator.Size = new System.Drawing.Size(6, 25);
//
// InterfaceForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -138,6 +166,9 @@
private System.Windows.Forms.ToolStripMenuItem ssstats;
private System.Windows.Forms.ToolStripMenuItem opstats;
private System.Windows.Forms.ToolTip tooltip;
private CodeImp.DoomBuilder.Controls.ToolStripCheckBox cbopendoors;
private CodeImp.DoomBuilder.Controls.ToolStripCheckBox cbheatmap;
private System.Windows.Forms.ToolStripSeparator separator;
}
}

View file

@ -19,13 +19,17 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#region ================== Variables
private ViewStats viewstats;
Point oldttposition;
private static bool opendoors; //mxd
private static bool showheatmap; //mxd
private Point oldttposition;
#endregion
#region ================== Properties
internal ViewStats ViewStats { get { return viewstats; } }
internal bool OpenDoors { get { return opendoors; } } //mxd
internal bool ShowHeatmap { get { return showheatmap; } } //mxd
#endregion
@ -35,6 +39,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
public InterfaceForm()
{
InitializeComponent();
cbopendoors.Checked = opendoors; //mxd
cbheatmap.Checked = showheatmap; //mxd
}
#endregion
@ -44,12 +50,18 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
// This adds the buttons to the toolbar
public void AddToInterface()
{
General.Interface.AddButton(statsbutton, ToolbarSection.Custom);
General.Interface.AddButton(statsbutton);
General.Interface.AddButton(separator); //mxd
General.Interface.AddButton(cbopendoors); //mxd
General.Interface.AddButton(cbheatmap); //mxd
}
// This removes the buttons from the toolbar
public void RemoveFromInterface()
{
General.Interface.RemoveButton(cbheatmap); //mxd
General.Interface.RemoveButton(cbopendoors); //mxd
General.Interface.RemoveButton(separator); //mxd
General.Interface.RemoveButton(statsbutton);
}
@ -91,6 +103,23 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
General.Interface.RedrawDisplay();
}
//mxd
private void cbheatmap_Click(object sender, EventArgs e)
{
showheatmap = cbheatmap.Checked;
General.Interface.RedrawDisplay();
}
//mxd
private void cbopendoors_Click(object sender, EventArgs e)
{
opendoors = cbopendoors.Checked;
// Restart processing
BuilderPlug.VPO.Restart();
General.Interface.RedrawDisplay();
}
#endregion
}
}

View file

@ -9,7 +9,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
internal class Palette
{
// Members
private int[] colors;
private readonly int[] colors;
// Properties
public int[] Colors { get { return colors; } }
@ -20,7 +20,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
// Initialize
colors = new int[bmp.Size.Width];
for(int x = 0; x < bmp.Size.Width; x++)
colors[x] = bmp.GetPixel(x, 1).ToArgb();
colors[x] = bmp.GetPixel(x, 0).ToArgb();
}
// This overrides a color

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
// Runtime Version:2.0.50727.5420
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -19,7 +19,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -74,6 +74,13 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer.Properties {
}
}
internal static System.Drawing.Bitmap Heatmap_pal {
get {
object obj = ResourceManager.GetObject("Heatmap_pal", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Openings {
get {
object obj = ResourceManager.GetObject("Openings", resourceCulture);

View file

@ -142,4 +142,7 @@
<data name="Visplanes_pal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Visplanes_pal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Heatmap_pal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Heatmap_pal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

View file

@ -58,6 +58,9 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void VPO_CloseMap();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] //mxd
private delegate void VPO_OpenDoorSectors(int dir);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int VPO_TestSpot(int x, int y, int dz, int angle,
ref int visplanes, ref int drawsegs, ref int openings, ref int solidsegs);
@ -67,7 +70,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#region ================== Variables
// Main objects
private string[] tempfiles;
private readonly string[] tempfiles;
private IntPtr[] dlls;
private Thread[] threads;
@ -76,8 +79,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
private string mapname;
// Input and output queue (both require a lock on 'points' !)
private Queue<TilePoint> points = new Queue<TilePoint>(EXPECTED_RESULTS_BUFFER);
private Queue<PointData> results = new Queue<PointData>(EXPECTED_RESULTS_BUFFER);
private readonly Queue<TilePoint> points = new Queue<TilePoint>(EXPECTED_RESULTS_BUFFER);
private readonly Queue<PointData> results = new Queue<PointData>(EXPECTED_RESULTS_BUFFER);
#endregion
@ -146,6 +149,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
VPO_OpenMap OpenMap = (VPO_OpenMap)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_OpenMap"), typeof(VPO_OpenMap));
VPO_FreeWAD FreeWAD = (VPO_FreeWAD)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_FreeWAD"), typeof(VPO_FreeWAD));
VPO_CloseMap CloseMap = (VPO_CloseMap)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_CloseMap"), typeof(VPO_CloseMap));
VPO_OpenDoorSectors OpenDoors = (VPO_OpenDoorSectors)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_OpenDoorSectors"), typeof(VPO_OpenDoorSectors)); //mxd
VPO_TestSpot TestSpot = (VPO_TestSpot)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_TestSpot"), typeof(VPO_TestSpot));
try
@ -154,6 +158,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
bool isHexen = (General.Map.Config.FormatInterface == "HexenMapSetIO");
if(LoadWAD(filename) != 0) throw new Exception("VPO is unable to read this file.");
if(OpenMap(mapname, ref isHexen) != 0) throw new Exception("VPO is unable to open this map.");
OpenDoors(BuilderPlug.InterfaceForm.OpenDoors ? 1 : -1); //mxd
// Processing
Queue<TilePoint> todo = new Queue<TilePoint>(POINTS_PER_ITERATION);
@ -246,6 +251,13 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
}
}
//mxd
internal void Restart()
{
Stop();
Start(filename, mapname);
}
// This clears the list of enqueued points
public void ClearPoints()
{

View file

@ -6,10 +6,11 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
{
internal enum ViewStats
{
Visplanes = 0,
Drawsegs = 1,
Solidsegs = 2,
Openings = 3,
NumStats = 4
Visplanes,
Drawsegs,
Solidsegs,
Openings,
Heatmap, //mxd
NumStats
}
}

View file

@ -85,6 +85,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Resources\Gauge.png" />
<Content Include="Resources\Gauge_large.ico" />
<None Include="Resources\Heatmap_pal.png" />
<EmbeddedResource Include="Resources\vpo.dll" />
<None Include="Resources\Solidsegs_pal.png" />
<None Include="Resources\Openings_pal.png" />

View file

@ -128,8 +128,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
Rectangle mapviewrect = new Rectangle((int)mapleftbot.x - Tile.TILE_SIZE, (int)maprighttop.y - Tile.TILE_SIZE, (int)maprighttop.x - (int)mapleftbot.x + Tile.TILE_SIZE, (int)mapleftbot.y - (int)maprighttop.y + Tile.TILE_SIZE);
int viewstats = (int)BuilderPlug.InterfaceForm.ViewStats;
Palette pal = BuilderPlug.Palettes[viewstats];
Palette pal = (BuilderPlug.InterfaceForm.ShowHeatmap ? BuilderPlug.Palettes[(int)ViewStats.Heatmap] : BuilderPlug.Palettes[viewstats]);
Size canvassize = canvas.Size;
BitmapData bd = canvas.LockBits(new Rectangle(0, 0, canvassize.Width, canvassize.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
RtlZeroMemory(bd.Scan0, bd.Width * bd.Height * 4);

View file

@ -8,5 +8,6 @@ EXPORTS
VPO_OpenMap
VPO_CloseMap
VPO_GetLinedef
VPO_OpenDoorSectors
VPO_TestSpot