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;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Map
|
|
|
|
{
|
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 enum MapElementType
|
|
|
|
{
|
|
|
|
UNKNOWN,
|
|
|
|
VERTEX,
|
|
|
|
SIDEDEF,
|
|
|
|
LINEDEF,
|
|
|
|
SECTOR,
|
|
|
|
THING
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
public abstract class MapElement : IDisposable
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
2009-06-05 19:03:56 +00:00
|
|
|
|
|
|
|
// List index
|
|
|
|
protected int listindex;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Univeral fields
|
|
|
|
private UniFields fields;
|
|
|
|
|
|
|
|
// Marking
|
|
|
|
protected bool marked;
|
|
|
|
|
|
|
|
// Disposing
|
2014-02-21 14:42:12 +00:00
|
|
|
protected bool isdisposed;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2014-09-12 21:08:11 +00:00
|
|
|
// Error Ignoring (mxd)
|
|
|
|
private List<Type> ignorederrorchecks;
|
2015-10-02 14:47:34 +00:00
|
|
|
|
|
|
|
//mxd. Hashing
|
|
|
|
private static int hashcounter;
|
|
|
|
private readonly int hashcode;
|
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. Element type
|
|
|
|
protected MapElementType elementtype;
|
2014-09-12 21:08:11 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
2009-06-05 19:03:56 +00:00
|
|
|
|
|
|
|
public int Index { get { return listindex; } internal set { listindex = value; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
public UniFields Fields { get { return fields; } }
|
|
|
|
public bool Marked { get { return marked; } set { marked = value; } }
|
|
|
|
public bool IsDisposed { get { return isdisposed; } }
|
2014-09-12 21:08:11 +00:00
|
|
|
public List<Type> IgnoredErrorChecks { get { return ignorederrorchecks; } } //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
|
|
|
public MapElementType ElementType { get { return elementtype; } } //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
2015-05-27 12:38:03 +00:00
|
|
|
protected MapElement()
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Initialize
|
2009-06-11 21:21:20 +00:00
|
|
|
fields = new UniFields(this);
|
2014-09-12 21:08:11 +00:00
|
|
|
ignorederrorchecks = new List<Type>(); //mxd
|
2015-10-02 14:47:34 +00:00
|
|
|
hashcode = hashcounter++; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Disposer
|
|
|
|
public virtual void Dispose()
|
|
|
|
{
|
2015-09-16 12:10:43 +00:00
|
|
|
if(!isdisposed)
|
|
|
|
{
|
|
|
|
// Clean up
|
|
|
|
fields.Owner = null;
|
|
|
|
fields = null;
|
|
|
|
|
|
|
|
// Done
|
|
|
|
isdisposed = true;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// Serialize / deserialize
|
|
|
|
internal void ReadWrite(IReadWriteStream s)
|
|
|
|
{
|
|
|
|
int c = fields.Count;
|
|
|
|
s.rwInt(ref c);
|
|
|
|
|
|
|
|
if(s.IsWriting)
|
|
|
|
{
|
|
|
|
foreach(KeyValuePair<string, UniValue> f in fields)
|
|
|
|
{
|
|
|
|
s.wString(f.Key);
|
|
|
|
f.Value.ReadWrite(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-11 21:21:20 +00:00
|
|
|
fields = new UniFields(this, c);
|
2009-04-19 18:07:22 +00:00
|
|
|
for(int i = 0; i < c; i++)
|
|
|
|
{
|
|
|
|
string t; s.rString(out t);
|
|
|
|
UniValue v = new UniValue(); v.ReadWrite(s);
|
|
|
|
fields.Add(t, v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This copies properties to any other element
|
|
|
|
public void CopyPropertiesTo(MapElement element)
|
|
|
|
{
|
2013-11-20 13:29:41 +00:00
|
|
|
//element.fields = new UniFields(this, this.fields);
|
|
|
|
element.fields = new UniFields(element, this.fields); //mxd
|
2009-06-11 21:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This must implement the call to the undo system to record the change of properties
|
|
|
|
protected abstract void BeforePropsChange();
|
|
|
|
|
|
|
|
// This is called before the custom fields change
|
|
|
|
internal void BeforeFieldsChange()
|
|
|
|
{
|
|
|
|
BeforePropsChange();
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
2015-10-02 14:47:34 +00:00
|
|
|
|
|
|
|
//mxd. This greatly speeds up Dictionary lookups
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
|
|
|
return hashcode;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|