2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
2015-05-27 12:38:03 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Diagnostics;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.Globalization;
|
|
|
|
using System.Reflection;
|
2015-05-27 12:38:03 +00:00
|
|
|
using CodeImp.DoomBuilder.Map;
|
2013-08-10 11:28:51 +00:00
|
|
|
using CodeImp.DoomBuilder.Types;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.IO
|
|
|
|
{
|
|
|
|
internal abstract class MapSetIO : IMapSetIO
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
// WAD File
|
|
|
|
protected WAD wad;
|
|
|
|
|
|
|
|
// Map manager
|
|
|
|
protected MapManager manager;
|
|
|
|
|
2013-08-27 14:22:19 +00:00
|
|
|
//mxd
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
protected Dictionary<MapElementType, Dictionary<string, UniversalType>> uifields;
|
2013-08-27 14:22:19 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public abstract int MaxSidedefs { get; }
|
|
|
|
public abstract int MaxVertices { get; }
|
|
|
|
public abstract int MaxLinedefs { get; }
|
|
|
|
public abstract int MaxSectors { get; }
|
|
|
|
public abstract int MaxThings { get; }
|
|
|
|
public abstract int MinTextureOffset { get; }
|
|
|
|
public abstract int MaxTextureOffset { get; }
|
|
|
|
public abstract int VertexDecimals { get; }
|
|
|
|
public abstract string DecimalsFormat { get; }
|
|
|
|
public abstract bool HasLinedefTag { get; }
|
|
|
|
public abstract bool HasThingTag { get; }
|
|
|
|
public abstract bool HasThingAction { get; }
|
|
|
|
public abstract bool HasCustomFields { get; }
|
|
|
|
public abstract bool HasThingHeight { get; }
|
|
|
|
public abstract bool HasActionArgs { get; }
|
|
|
|
public abstract bool HasMixedActivations { get; }
|
|
|
|
public abstract bool HasPresetActivations { get; }
|
|
|
|
public abstract bool HasBuiltInActivations { get; }
|
2009-07-31 11:00:11 +00:00
|
|
|
public abstract bool HasNumericLinedefFlags { get; }
|
|
|
|
public abstract bool HasNumericThingFlags { get; }
|
|
|
|
public abstract bool HasNumericLinedefActivations { get; }
|
2009-04-19 18:07:22 +00:00
|
|
|
public abstract int MaxTag { get; }
|
|
|
|
public abstract int MinTag { get; }
|
|
|
|
public abstract int MaxAction { get; }
|
|
|
|
public abstract int MinAction { get; }
|
2010-08-14 10:21:38 +00:00
|
|
|
public abstract int MaxArgument { get; }
|
|
|
|
public abstract int MinArgument { get; }
|
2009-04-19 18:07:22 +00:00
|
|
|
public abstract int MaxEffect { get; }
|
|
|
|
public abstract int MinEffect { get; }
|
|
|
|
public abstract int MaxBrightness { get; }
|
|
|
|
public abstract int MinBrightness { get; }
|
|
|
|
public abstract int MaxThingType { get; }
|
|
|
|
public abstract int MinThingType { get; }
|
2012-07-12 22:34:12 +00:00
|
|
|
public abstract float MaxCoordinate { get; }
|
|
|
|
public abstract float MinCoordinate { get; }
|
2010-10-05 08:31:27 +00:00
|
|
|
public abstract int MaxThingAngle { get; }
|
|
|
|
public abstract int MinThingAngle { get; }
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
public abstract Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get; } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
2015-05-27 12:38:03 +00:00
|
|
|
protected MapSetIO(WAD wad, MapManager manager)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
this.wad = wad;
|
|
|
|
this.manager = manager;
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
this.uifields = new Dictionary<MapElementType, Dictionary<string, UniversalType>>(); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Static Methods
|
|
|
|
|
2009-07-31 11:00:11 +00:00
|
|
|
// This returns and instance of the specified IO class
|
|
|
|
public static MapSetIO Create(string classname)
|
|
|
|
{
|
|
|
|
return Create(classname, null, null);
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// This returns and instance of the specified IO class
|
|
|
|
public static MapSetIO Create(string classname, WAD wadfile, MapManager manager)
|
|
|
|
{
|
|
|
|
object[] args;
|
|
|
|
MapSetIO result;
|
|
|
|
string fullname;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Create arguments
|
|
|
|
args = new object[2];
|
|
|
|
args[0] = wadfile;
|
|
|
|
args[1] = manager;
|
|
|
|
|
|
|
|
// Make the full class name
|
|
|
|
fullname = "CodeImp.DoomBuilder.IO." + classname;
|
|
|
|
|
|
|
|
// Create IO class
|
|
|
|
result = (MapSetIO)General.ThisAssembly.CreateInstance(fullname, false,
|
|
|
|
BindingFlags.Default, null, args, CultureInfo.CurrentCulture, new object[0]);
|
|
|
|
|
|
|
|
// Check result
|
|
|
|
if(result != null)
|
|
|
|
{
|
|
|
|
// Success
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No such class
|
|
|
|
throw new ArgumentException("No such map format interface found: \"" + classname + "\"");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Catch errors
|
|
|
|
catch(TargetInvocationException e)
|
|
|
|
{
|
|
|
|
// Throw the actual exception
|
|
|
|
Debug.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
|
|
|
Debug.WriteLine(e.InnerException.Source + " throws " + e.InnerException.GetType().Name + ":");
|
|
|
|
Debug.WriteLine(e.InnerException.Message);
|
|
|
|
Debug.WriteLine(e.InnerException.StackTrace);
|
|
|
|
throw e.InnerException;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// Required implementations
|
|
|
|
public abstract MapSet Read(MapSet map, string mapname);
|
|
|
|
public abstract void Write(MapSet map, string mapname, int position);
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
|
|
|
//mxd.
|
|
|
|
public string GetElementName(MapElementType elementtype)
|
|
|
|
{
|
|
|
|
switch(elementtype)
|
|
|
|
{
|
|
|
|
case MapElementType.VERTEX: return "vertex";
|
|
|
|
case MapElementType.LINEDEF: return "linedef";
|
|
|
|
case MapElementType.SIDEDEF: return "sidedef";
|
|
|
|
case MapElementType.SECTOR: return "sector";
|
|
|
|
case MapElementType.THING: return "thing";
|
|
|
|
default: throw new NotSupportedException("Tried to get element name of unsupported map element type!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public MapElementType GetElementType(string elementname)
|
|
|
|
{
|
|
|
|
switch(elementname)
|
|
|
|
{
|
|
|
|
case "vertex": return MapElementType.VERTEX;
|
|
|
|
case "linedef": return MapElementType.LINEDEF;
|
|
|
|
case "sidedef": return MapElementType.SIDEDEF;
|
|
|
|
case "sector": return MapElementType.SECTOR;
|
|
|
|
case "thing": return MapElementType.THING;
|
|
|
|
default: throw new NotSupportedException("Tried to get element type of unsupported map element type!");
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|