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 9014
{ {
title = "Flame mask"; title = "Flame Mask";
sprite = "ASK2A0"; sprite = "ASK2A0";
} }
9015 9015
{ {
title = "Glaive seal"; title = "Glaive Seal";
sprite = "AFWPA0"; sprite = "AFWPA0";
} }
9016 9016
{ {
title = "Holy relic"; title = "Holy Relic";
sprite = "ACWPA0"; sprite = "ACWPA0";
width = 10; width = 10;
} }
9017 9017
{ {
title = "Sigil of the magus"; title = "Sigil of the Magus";
sprite = "AMWPA0"; sprite = "AMWPA0";
width = 10; width = 10;
} }

View file

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

View file

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

View file

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

View file

@ -16,11 +16,15 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#endregion #endregion
#region ================== mxd. Event handlers
public event EventHandler OnOpenDoorsChanged;
#endregion
#region ================== Variables #region ================== Variables
private ViewStats viewstats; private ViewStats viewstats;
private static bool opendoors; //mxd
private static bool showheatmap; //mxd
private Point oldttposition; private Point oldttposition;
#endregion #endregion
@ -28,8 +32,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#region ================== Properties #region ================== Properties
internal ViewStats ViewStats { get { return viewstats; } } internal ViewStats ViewStats { get { return viewstats; } }
internal bool OpenDoors { get { return opendoors; } } //mxd internal bool OpenDoors { get { return cbopendoors.Checked; } } //mxd
internal bool ShowHeatmap { get { return showheatmap; } } //mxd internal bool ShowHeatmap { get { return cbheatmap.Checked; } } //mxd
#endregion #endregion
@ -39,8 +43,8 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
public InterfaceForm() public InterfaceForm()
{ {
InitializeComponent(); InitializeComponent();
cbopendoors.Checked = opendoors; //mxd cbopendoors.Checked = General.Settings.ReadPluginSetting("opendoors", false); //mxd
cbheatmap.Checked = showheatmap; //mxd cbheatmap.Checked = General.Settings.ReadPluginSetting("showheatmap", false); //mxd
} }
#endregion #endregion
@ -63,6 +67,10 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
General.Interface.RemoveButton(cbopendoors); //mxd General.Interface.RemoveButton(cbopendoors); //mxd
General.Interface.RemoveButton(separator); //mxd General.Interface.RemoveButton(separator); //mxd
General.Interface.RemoveButton(statsbutton); General.Interface.RemoveButton(statsbutton);
//mxd. Save settings
General.Settings.WritePluginSetting("opendoors", cbopendoors.Checked);
General.Settings.WritePluginSetting("showheatmap", cbheatmap.Checked);
} }
// This shows a tooltip // This shows a tooltip
@ -106,18 +114,13 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
//mxd //mxd
private void cbheatmap_Click(object sender, EventArgs e) private void cbheatmap_Click(object sender, EventArgs e)
{ {
showheatmap = cbheatmap.Checked;
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
//mxd //mxd
private void cbopendoors_Click(object sender, EventArgs e) private void cbopendoors_Click(object sender, EventArgs e)
{ {
opendoors = cbopendoors.Checked; if(OnOpenDoorsChanged != null) OnOpenDoorsChanged(this, EventArgs.Empty);
// Restart processing
BuilderPlug.VPO.Restart();
General.Interface.RedrawDisplay();
} }
#endregion #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 // This clears the list of enqueued points
public void ClearPoints() /*public void ClearPoints()
{ {
lock(points) lock(points)
{ {
points.Clear(); points.Clear();
} }
} }*/
// This gives points to process and returns the total points left in the buffer // This gives points to process and returns the total points left in the buffer
public int EnqueuePoints(IEnumerable<TilePoint> newpoints) public int EnqueuePoints(IEnumerable<TilePoint> newpoints)

View file

@ -3,12 +3,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Editing; using CodeImp.DoomBuilder.Editing;
using System.Drawing.Imaging;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Rendering;
@ -29,10 +29,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
AllowCopyPaste = false)] AllowCopyPaste = false)]
public class VisplaneExplorerMode : ClassicMode public class VisplaneExplorerMode : ClassicMode
{ {
#region ================== Constants
#endregion
#region ================== APIs #region ================== APIs
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
@ -66,14 +62,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
#endregion #endregion
#region ================== Properties
#endregion
#region ================== Constructor / Destructor
#endregion
#region ================== Methods #region ================== Methods
// This cleans up anything we used for this mode // This cleans up anything we used for this mode
@ -130,8 +118,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
int viewstats = (int)BuilderPlug.InterfaceForm.ViewStats; int viewstats = (int)BuilderPlug.InterfaceForm.ViewStats;
Palette pal = (BuilderPlug.InterfaceForm.ShowHeatmap ? BuilderPlug.Palettes[(int)ViewStats.Heatmap] : 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, canvas.Size.Width, canvas.Size.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
BitmapData bd = canvas.LockBits(new Rectangle(0, 0, canvassize.Width, canvassize.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
RtlZeroMemory(bd.Scan0, bd.Width * bd.Height * 4); RtlZeroMemory(bd.Scan0, bd.Width * bd.Height * 4);
int* p = (int*)bd.Scan0.ToPointer(); int* p = (int*)bd.Scan0.ToPointer();
@ -253,9 +240,12 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
base.OnEngage(); base.OnEngage();
General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment..."); General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");
BuilderPlug.InitVPO(); //mxd
CleanUp(); CleanUp();
BuilderPlug.InterfaceForm.AddToInterface(); BuilderPlug.InterfaceForm.AddToInterface();
BuilderPlug.InterfaceForm.OnOpenDoorsChanged += OnOpenDoorsChanged; //mxd
lastviewstats = BuilderPlug.InterfaceForm.ViewStats; lastviewstats = BuilderPlug.InterfaceForm.ViewStats;
// Export the current map to a temporary WAD file // 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)); mapbounds = Rectangle.Round(MapSet.CreateArea(General.Map.Map.Vertices));
// Create tiles for all points inside the map // Create tiles for all points inside the map
Point lt = TileForPoint(mapbounds.Left - Tile.TILE_SIZE, mapbounds.Top - Tile.TILE_SIZE); CreateTiles(); //mxd
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));
}
}
QueuePoints(0); QueuePoints(0);
@ -333,6 +301,34 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
General.Interface.DisplayReady(); 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 // Mode ends
public override void OnDisengage() public override void OnDisengage()
{ {
@ -485,6 +481,17 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
BuilderPlug.InterfaceForm.HideTooltip(); 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 #endregion
} }
} }