Changed, Visplane Explorer mode: calculated data is now fully reset when toggling "Open doors" option.

Changed, Visplane Explorer mode: vpo.dll is now initialized when entering the mode instead of after opening a map.
Fixed inconsistent Hexen Puzzle Gears names between game configuration and spawn numbers list.
Updated ZDoom_DECORATE.cfg (GetMissileDamage).
This commit is contained in:
MaxED 2016-09-22 20:24:32 +00:00
parent 9403028903
commit 9c4969cc02
7 changed files with 96 additions and 90 deletions

View file

@ -519,23 +519,23 @@ puzzle
}
9014
{
title = "Flame mask";
title = "Flame Mask";
sprite = "ASK2A0";
}
9015
{
title = "Glaive seal";
title = "Glaive Seal";
sprite = "AFWPA0";
}
9016
{
title = "Holy relic";
title = "Holy Relic";
sprite = "ACWPA0";
width = 10;
}
9017
{
title = "Sigil of the magus";
title = "Sigil of the Magus";
sprite = "AMWPA0";
width = 10;
}

View file

@ -1426,20 +1426,20 @@ enums_hexen
0 = "Yorick's skull";
1 = "Heart of D'Sparil";
2 = "Ruby Planet";
3 = "Emerald Planet (1)";
4 = "Emerald Planet (2)";
5 = "Sapphire Planet (1)";
6 = "Sapphire Planet (2)";
3 = "Emerald Planet 1";
4 = "Emerald Planet 2";
5 = "Sapphire Planet 1";
6 = "Sapphire Planet 2";
7 = "Daemon Codex";
8 = "Liber Obscura";
9 = "Flame Mask";
10 = "Glaive Seal";
11 = "Holy Relic";
12 = "Sigil of the Magus";
13 = "Iron gear";
14 = "Brass gear";
15 = "Brass and iron gear";
16 = "Silver and brass gear";
13 = "Clock Gear (steel)";
14 = "Clock Gear (bronze)";
15 = "Clock Gear (steel and bronze)";
16 = "Clock Gear (bronze and steel)";
}
}

View file

@ -442,6 +442,7 @@ keywords
GetCrouchFactor = "float GetCrouchFactor(int ptr = AAPTR_PLAYER1)";
GetDistance = "float GetDistance(bool checkz[, int ptr_select = AAPTR_TARGET])";
GetGibHealth = "int GetGibHealth()";
GetMissileDamage = "int GetMissileDamage(int mask, int add[, int pointer = AAPTR_DEFAULT])";
GetPlayerInput = "int GetPlayerInput(int numinput[, int ptr = AAPTR_DEFAULT])";
GetSpawnHealth = "int GetSpawnHealth()";
GetSpriteAngle = "int GetSpriteAngle(int ptr)";

View file

@ -34,7 +34,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
private static BuilderPlug me;
private VPOManager vpo;
private InterfaceForm interfaceform;
private bool enabled; //mxd
// Palettes
private Palette[] palettes;
@ -54,22 +53,22 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#region ================== Initialize / Dispose
//mxd. Initialize when we can check the map format
public override void OnMapNewEnd() { OnMapOpenEnd(); }
public override void OnMapOpenEnd()
public override void OnInitialize()
{
enabled = (General.Map.DOOM || General.Map.HEXEN);
if(enabled)
{
// Load interface controls
interfaceform = new InterfaceForm();
// Load VPO manager (manages multithreading and communication with vpo.dll)
vpo = new VPOManager();
base.OnInitialize();
// Keep a static reference
me = this;
}
//mxd
public static void InitVPO()
{
// Load interface controls
if(me.interfaceform == null) me.interfaceform = new InterfaceForm();
// Load VPO manager (manages multithreading and communication with vpo.dll)
if(me.vpo == null) me.vpo = new VPOManager();
}
// Preferences changed
@ -85,17 +84,20 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
//mxd. Active and not already disposed?
if(!IsDisposed)
{
if(enabled)
if(interfaceform != null)
{
// Clean up
interfaceform.Dispose();
interfaceform = null;
}
if(vpo != null)
{
vpo.Dispose();
vpo = null;
}
// Done
me = null;
}
base.Dispose();
}

View file

@ -16,11 +16,15 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#endregion
#region ================== mxd. Event handlers
public event EventHandler OnOpenDoorsChanged;
#endregion
#region ================== Variables
private ViewStats viewstats;
private static bool opendoors; //mxd
private static bool showheatmap; //mxd
private Point oldttposition;
#endregion
@ -28,8 +32,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#region ================== Properties
internal ViewStats ViewStats { get { return viewstats; } }
internal bool OpenDoors { get { return opendoors; } } //mxd
internal bool ShowHeatmap { get { return showheatmap; } } //mxd
internal bool OpenDoors { get { return cbopendoors.Checked; } } //mxd
internal bool ShowHeatmap { get { return cbheatmap.Checked; } } //mxd
#endregion
@ -39,8 +43,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
public InterfaceForm()
{
InitializeComponent();
cbopendoors.Checked = opendoors; //mxd
cbheatmap.Checked = showheatmap; //mxd
cbopendoors.Checked = General.Settings.ReadPluginSetting("opendoors", false); //mxd
cbheatmap.Checked = General.Settings.ReadPluginSetting("showheatmap", false); //mxd
}
#endregion
@ -63,6 +67,10 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
General.Interface.RemoveButton(cbopendoors); //mxd
General.Interface.RemoveButton(separator); //mxd
General.Interface.RemoveButton(statsbutton);
//mxd. Save settings
General.Settings.WritePluginSetting("opendoors", cbopendoors.Checked);
General.Settings.WritePluginSetting("showheatmap", cbheatmap.Checked);
}
// This shows a tooltip
@ -106,18 +114,13 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
//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();
if(OnOpenDoorsChanged != null) OnOpenDoorsChanged(this, EventArgs.Empty);
}
#endregion

View file

@ -251,21 +251,14 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
}
}
//mxd
internal void Restart()
{
Stop();
Start(filename, mapname);
}
// This clears the list of enqueued points
public void ClearPoints()
/*public void ClearPoints()
{
lock(points)
{
points.Clear();
}
}
}*/
// This gives points to process and returns the total points left in the buffer
public int EnqueuePoints(IEnumerable<TilePoint> newpoints)

View file

@ -3,12 +3,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Editing;
using System.Drawing.Imaging;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
@ -29,10 +29,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
AllowCopyPaste = false)]
public class VisplaneExplorerMode : ClassicMode
{
#region ================== Constants
#endregion
#region ================== APIs
[DllImport("kernel32.dll")]
@ -66,14 +62,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#endregion
#region ================== Properties
#endregion
#region ================== Constructor / Destructor
#endregion
#region ================== Methods
// This cleans up anything we used for this mode
@ -130,8 +118,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
int viewstats = (int)BuilderPlug.InterfaceForm.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);
BitmapData bd = canvas.LockBits(new Rectangle(0, 0, canvas.Size.Width, canvas.Size.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
RtlZeroMemory(bd.Scan0, bd.Width * bd.Height * 4);
int* p = (int*)bd.Scan0.ToPointer();
@ -253,9 +240,12 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
base.OnEngage();
General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");
BuilderPlug.InitVPO(); //mxd
CleanUp();
BuilderPlug.InterfaceForm.AddToInterface();
BuilderPlug.InterfaceForm.OnOpenDoorsChanged += OnOpenDoorsChanged; //mxd
lastviewstats = BuilderPlug.InterfaceForm.ViewStats;
// Export the current map to a temporary WAD file
@ -276,29 +266,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
mapbounds = Rectangle.Round(MapSet.CreateArea(General.Map.Map.Vertices));
// Create tiles for all points inside the map
Point lt = TileForPoint(mapbounds.Left - Tile.TILE_SIZE, mapbounds.Top - Tile.TILE_SIZE);
Point rb = TileForPoint(mapbounds.Right + Tile.TILE_SIZE, mapbounds.Bottom + Tile.TILE_SIZE);
Rectangle tilesrect = new Rectangle(lt.X, lt.Y, rb.X - lt.X, rb.Y - lt.Y);
NearestLineBlockmap blockmap = new NearestLineBlockmap(tilesrect);
for(int x = tilesrect.X; x <= tilesrect.Right; x += Tile.TILE_SIZE)
{
for(int y = tilesrect.Y; y <= tilesrect.Bottom; y += Tile.TILE_SIZE)
{
// If the tile is obviously outside the map, don't create it
Vector2D pc = new Vector2D(x + (Tile.TILE_SIZE >> 1), y + (Tile.TILE_SIZE >> 1));
Linedef ld = MapSet.NearestLinedef(blockmap.GetBlockAt(pc).Lines, pc);
float distancesq = ld.DistanceToSq(pc, true);
if(distancesq > (Tile.TILE_SIZE * Tile.TILE_SIZE))
{
float side = ld.SideOfLine(pc);
if((side > 0.0f) && (ld.Back == null))
continue;
}
Point tp = new Point(x, y);
tiles.Add(tp, new Tile(tp));
}
}
CreateTiles(); //mxd
QueuePoints(0);
@ -333,6 +301,34 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
General.Interface.DisplayReady();
}
//mxd
private void CreateTiles()
{
Point lt = TileForPoint(mapbounds.Left - Tile.TILE_SIZE, mapbounds.Top - Tile.TILE_SIZE);
Point rb = TileForPoint(mapbounds.Right + Tile.TILE_SIZE, mapbounds.Bottom + Tile.TILE_SIZE);
Rectangle tilesrect = new Rectangle(lt.X, lt.Y, rb.X - lt.X, rb.Y - lt.Y);
NearestLineBlockmap blockmap = new NearestLineBlockmap(tilesrect);
for(int x = tilesrect.X; x <= tilesrect.Right; x += Tile.TILE_SIZE)
{
for(int y = tilesrect.Y; y <= tilesrect.Bottom; y += Tile.TILE_SIZE)
{
// If the tile is obviously outside the map, don't create it
Vector2D pc = new Vector2D(x + (Tile.TILE_SIZE >> 1), y + (Tile.TILE_SIZE >> 1));
Linedef ld = MapSet.NearestLinedef(blockmap.GetBlockAt(pc).Lines, pc);
float distancesq = ld.DistanceToSq(pc, true);
if(distancesq > (Tile.TILE_SIZE * Tile.TILE_SIZE))
{
float side = ld.SideOfLine(pc);
if((side > 0.0f) && (ld.Back == null))
continue;
}
Point tp = new Point(x, y);
tiles.Add(tp, new Tile(tp));
}
}
}
// Mode ends
public override void OnDisengage()
{
@ -485,6 +481,17 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
BuilderPlug.InterfaceForm.HideTooltip();
}
//mxd
private void OnOpenDoorsChanged(object sender, EventArgs e)
{
// Restart processing
BuilderPlug.VPO.Stop();
tiles.Clear();
CreateTiles();
BuilderPlug.VPO.Start(tempfile, General.Map.Options.LevelName);
General.Interface.RedrawDisplay();
}
#endregion
}
}