mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
- updated default program config
- more regarding UDMF editing - added some ideas and todo items
This commit is contained in:
parent
a04500f071
commit
9f15de8cd5
25 changed files with 425 additions and 83 deletions
|
@ -12,7 +12,7 @@ shortcuts
|
|||
builder_zoomin = 65530;
|
||||
builder_zoomout = 65531;
|
||||
builder_preferences = 116;
|
||||
builder_savemap = 0;
|
||||
builder_savemap = 131155;
|
||||
builder_savemapas = 0;
|
||||
builder_savemapinto = 0;
|
||||
builder_mapoptions = 113;
|
||||
|
@ -34,6 +34,27 @@ shortcuts
|
|||
buildermodes_linedefsmode = 76;
|
||||
buildermodes_verticesmode = 86;
|
||||
buildermodes_sectorsmode = 83;
|
||||
builder_insertvertex = 65622;
|
||||
builder_testmap = 120;
|
||||
builder_acceptmode = 13;
|
||||
builder_classicedit = 2;
|
||||
builder_classicselect = 1;
|
||||
builder_deleteitem = 46;
|
||||
buildermodes_triangulatormode = 0;
|
||||
buildermodes_finishdraw = 2;
|
||||
buildermodes_drawpoint = 1;
|
||||
buildermodes_drawlinesmode = 131140;
|
||||
buildermodes_wauthormode = 0;
|
||||
buildermodes_flipsidedefs = 65606;
|
||||
buildermodes_fliplinedefs = 70;
|
||||
buildermodes_joinsectors = 74;
|
||||
buildermodes_removepoint = 4;
|
||||
buildermodes_brightnessmode = 0;
|
||||
buildermodes_mergesectors = 65610;
|
||||
buildermodes_splitlinedefs = 0;
|
||||
buildermodes_visualmode = 87;
|
||||
buildermodes_curvelinesmode = 65603;
|
||||
builder_thingsfilterssetup = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,3 +121,13 @@ recentfiles
|
|||
configurations
|
||||
{
|
||||
}
|
||||
|
||||
blackbrowsers = false;
|
||||
undolevels = 20;
|
||||
visualfov = 80;
|
||||
visualmousesensx = 40f;
|
||||
visualmousesensy = 40f;
|
||||
visualviewrange = 1000f;
|
||||
imagebrightness = 3;
|
||||
qualitydisplay = true;
|
||||
squarethings = false;
|
||||
|
|
|
@ -228,6 +228,8 @@ maplumpnames
|
|||
/*
|
||||
ADDITIONAL UNIVERSAL DOOM MAP FORMAT FIELD DEFINITIONS
|
||||
Only add fields here that Doom Builder does not edit with its own user-interface!
|
||||
The "default" is the editor's default value. Set "specdefault" to the UDMF specification's
|
||||
default when "default" differs from the UDMF specification's default!
|
||||
|
||||
Field data types:
|
||||
0 = integer *
|
||||
|
|
|
@ -21,4 +21,13 @@ typed linedef arguments
|
|||
the possible types are also defined in the configuration
|
||||
this allows a user to pick from a list instead of entering a number for the linedef args
|
||||
|
||||
===========================================================================================
|
||||
|
||||
Slider to change transparency amount of doublesided lines
|
||||
|
||||
===========================================================================================
|
||||
|
||||
Draw association on top of highlight so that a highligted sector referring to it's own
|
||||
lines still show the line association. But for a line referring to the sector the association
|
||||
should be drawn underneath the highlight or the highlight would be invisible.
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
- Complete Things filter with UDMF fields
|
||||
|
||||
- Controls to increase/decrease grid size
|
||||
|
||||
- Make "Make Sector" mode
|
||||
- On mousemove (?) already show the sector outline it will create
|
||||
- On click make the sector
|
||||
|
@ -28,6 +30,8 @@
|
|||
|
||||
- Make quick sector draw (square/circle) mode
|
||||
|
||||
- Make script editor
|
||||
|
||||
- Make dialog and editing mode help documentation
|
||||
|
||||
- Make Plugin Development Kit
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private string name;
|
||||
private int type;
|
||||
private object defaultvalue;
|
||||
private object specdefault;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -52,6 +53,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public string Name { get { return name; } }
|
||||
public int Type { get { return type; } }
|
||||
public object Default { get { return defaultvalue; } }
|
||||
public object SpecDefault { get { return specdefault; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -63,11 +65,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
string setting = "universalfields." + path + "." + name;
|
||||
|
||||
// Initialize
|
||||
this.name = name;
|
||||
this.name = name.ToLowerInvariant();
|
||||
|
||||
// Read type
|
||||
this.type = cfg.ReadSetting(setting + ".type", 0);
|
||||
this.defaultvalue = cfg.ReadSettingObject(setting + ".default", null);
|
||||
this.specdefault = cfg.ReadSettingObject(setting + ".specdefault", this.defaultvalue);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
1
Source/Controls/FieldsEditorControl.Designer.cs
generated
1
Source/Controls/FieldsEditorControl.Designer.cs
generated
|
@ -81,7 +81,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.fieldslist.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.fieldslist_CellBeginEdit);
|
||||
this.fieldslist.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.fieldslist_CellEndEdit);
|
||||
this.fieldslist.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.fieldslist_CellClick);
|
||||
this.fieldslist.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.fieldslist_DataError);
|
||||
this.fieldslist.SelectionChanged += new System.EventHandler(this.fieldslist_SelectionChanged);
|
||||
//
|
||||
// deleterowstimer
|
||||
|
|
|
@ -47,12 +47,16 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public FieldsEditorControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
// This sets up the control
|
||||
public void Setup()
|
||||
{
|
||||
// Make types list
|
||||
fieldtype.Items.Clear();
|
||||
fieldtype.Items.AddRange(General.Types.GetCustomUseAttributes());
|
||||
}
|
||||
|
||||
|
||||
// This adds a list of fixed fields (in undefined state)
|
||||
public void ListFixedFields(List<UniversalFieldInfo> list)
|
||||
{
|
||||
|
@ -64,6 +68,135 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
SetupNewRowStyle();
|
||||
}
|
||||
|
||||
// This sets up the fields and values from a UniFields object
|
||||
// When first is true, the values are applied unconditionally
|
||||
// When first is false, the values in the grid are erased when
|
||||
// they differ from the given values (for multiselection)
|
||||
public void SetValues(UniFields fromfields, bool first)
|
||||
{
|
||||
// Go for all the fields
|
||||
foreach(KeyValuePair<string, UniValue> f in fromfields)
|
||||
{
|
||||
// Go for all rows
|
||||
bool foundrow = false;
|
||||
foreach(DataGridViewRow row in fieldslist.Rows)
|
||||
{
|
||||
// Row is a field?
|
||||
if(row is FieldsEditorRow)
|
||||
{
|
||||
FieldsEditorRow frow = row as FieldsEditorRow;
|
||||
|
||||
// Row name matches with field
|
||||
if(frow.Name == f.Key)
|
||||
{
|
||||
// First time?
|
||||
if(first)
|
||||
{
|
||||
// Set type when row is not fixed
|
||||
if(!frow.IsFixed) frow.ChangeType(f.Value.Type);
|
||||
|
||||
// Apply value of field to row
|
||||
frow.Define(f.Value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if the value is different
|
||||
if(!frow.TypeHandler.GetValue().Equals(f.Value.Value))
|
||||
{
|
||||
// Clear the value in the row
|
||||
frow.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Done
|
||||
foundrow = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Is this row defined previously?
|
||||
if(frow.IsDefined)
|
||||
{
|
||||
// Check if this row can not be found in the fields at all
|
||||
if(!fromfields.ContainsKey(frow.Name))
|
||||
{
|
||||
// It is not defined in these fields, clear the value
|
||||
frow.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Row not found?
|
||||
if(!foundrow)
|
||||
{
|
||||
// Make new row
|
||||
FieldsEditorRow frow = new FieldsEditorRow(fieldslist, f.Key, f.Value.Type, f.Value.Value);
|
||||
fieldslist.Rows.Insert(fieldslist.Rows.Count - 1, frow);
|
||||
|
||||
// When not the first, clear the field
|
||||
// because the others did not define this one
|
||||
if(!first) frow.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This applies the current fields to a UniFields object
|
||||
public void Apply(UniFields tofields)
|
||||
{
|
||||
// Go for all the fields
|
||||
UniFields tempfields = new UniFields(tofields);
|
||||
foreach(KeyValuePair<string, UniValue> f in tempfields)
|
||||
{
|
||||
// Go for all rows
|
||||
bool foundrow = false;
|
||||
foreach(DataGridViewRow row in fieldslist.Rows)
|
||||
{
|
||||
// Row is a field and matches field name?
|
||||
if((row is FieldsEditorRow) && (row.Cells[0].Value.ToString() == f.Key))
|
||||
{
|
||||
FieldsEditorRow frow = row as FieldsEditorRow;
|
||||
|
||||
// Field is defined?
|
||||
if(frow.IsDefined)
|
||||
{
|
||||
foundrow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No such row?
|
||||
if(!foundrow)
|
||||
{
|
||||
// Remove the definition from the fields
|
||||
tofields.Remove(f.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Go for all rows
|
||||
foreach(DataGridViewRow row in fieldslist.Rows)
|
||||
{
|
||||
// Row is a field?
|
||||
if(row is FieldsEditorRow)
|
||||
{
|
||||
FieldsEditorRow frow = row as FieldsEditorRow;
|
||||
|
||||
// Field is defined?
|
||||
if(frow.IsDefined)
|
||||
{
|
||||
// Only apply when not empty
|
||||
if(!frow.IsEmpty)
|
||||
{
|
||||
// Apply field
|
||||
object oldvalue = null;
|
||||
if(tofields.ContainsKey(frow.Name)) oldvalue = tofields[frow.Name].Value;
|
||||
tofields[frow.Name] = new UniValue(frow.TypeHandler.Index, frow.GetResult(oldvalue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This sets up the new row
|
||||
private void SetupNewRowStyle()
|
||||
{
|
||||
|
@ -145,13 +278,18 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Row is a new row?
|
||||
if(frow == null)
|
||||
{
|
||||
// Valid property name given?
|
||||
if((row.Cells[0].Value != null) && (row.Cells[0].Value.ToString().Trim().Length > 0))
|
||||
// Name given?
|
||||
if(row.Cells[0].Value != null)
|
||||
{
|
||||
// Make new row
|
||||
frow = new FieldsEditorRow(fieldslist, row.Cells[0].Value.ToString().Trim(), 0, 0);
|
||||
frow.Visible = false;
|
||||
fieldslist.Rows.Insert(e.RowIndex + 1, frow);
|
||||
// Make a valid UDMF field name
|
||||
string validname = UniValue.ValidateName(row.Cells[0].Value.ToString());
|
||||
if(validname.Length > 0)
|
||||
{
|
||||
// Make new row
|
||||
frow = new FieldsEditorRow(fieldslist, validname, 0, 0);
|
||||
frow.Visible = false;
|
||||
fieldslist.Rows.Insert(e.RowIndex + 1, frow);
|
||||
}
|
||||
}
|
||||
|
||||
// Mark the row for delete
|
||||
|
@ -261,10 +399,5 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
browsebutton.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void fieldslist_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
||||
{
|
||||
e.ThrowException = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
public bool IsFixed { get { return isfixed; } }
|
||||
public bool IsDefined { get { return isdefined; } }
|
||||
public bool IsEmpty { get { return (this.Cells[2].Value.ToString().Length == 0); } }
|
||||
public string Name { get { return this.Cells[0].Value.ToString(); } }
|
||||
public TypeHandler TypeHandler { get { return fieldtype; } }
|
||||
public UniversalFieldInfo Info { get { return fieldinfo; } }
|
||||
|
||||
|
@ -160,9 +162,24 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
}
|
||||
|
||||
// Validate value
|
||||
fieldtype.SetValue(this.Cells[2].Value);
|
||||
this.Cells[2].Value = fieldtype.GetStringValue();
|
||||
// Anything in the box?
|
||||
if(this.Cells[2].Value.ToString().Length > 0)
|
||||
{
|
||||
// Validate value
|
||||
fieldtype.SetValue(this.Cells[2].Value);
|
||||
this.Cells[2].Value = fieldtype.GetStringValue();
|
||||
|
||||
// This is a fixed field?
|
||||
if(isfixed)
|
||||
{
|
||||
// Does this match the default setting?
|
||||
if(fieldtype.GetValue().Equals(fieldinfo.Default))
|
||||
{
|
||||
// Undefine this field!
|
||||
Undefine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This undefines the field
|
||||
|
@ -174,7 +191,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
if(!isfixed) throw new InvalidOperationException();
|
||||
|
||||
// Now undefined
|
||||
this.Cells[2].Value = fieldinfo.Default;
|
||||
fieldtype.SetValue(fieldinfo.Default);
|
||||
this.Cells[2].Value = fieldtype.GetStringValue();
|
||||
this.DefaultCellStyle.ForeColor = SystemColors.GrayText;
|
||||
isdefined = false;
|
||||
}
|
||||
|
@ -183,10 +201,47 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public void Define(object value)
|
||||
{
|
||||
// Now defined
|
||||
this.Cells[2].Value = value;
|
||||
fieldtype.SetValue(value);
|
||||
this.Cells[2].Value = fieldtype.GetStringValue();
|
||||
this.DefaultCellStyle.ForeColor = SystemColors.WindowText;
|
||||
isdefined = true;
|
||||
}
|
||||
|
||||
// This changes the type
|
||||
public void ChangeType(int typeindex)
|
||||
{
|
||||
// Different?
|
||||
if(typeindex != fieldtype.Index)
|
||||
{
|
||||
// Change field type!
|
||||
TypeHandlerAttribute attrib = General.Types.GetAttribute(typeindex);
|
||||
fieldtype = General.Types.GetFieldHandler(typeindex, this.Cells[2].Value);
|
||||
this.Cells[1].Value = attrib;
|
||||
}
|
||||
}
|
||||
|
||||
// This clears the field
|
||||
public void Clear()
|
||||
{
|
||||
this.Cells[2].Value = "";
|
||||
}
|
||||
|
||||
// This returns the result
|
||||
public object GetResult(object value)
|
||||
{
|
||||
// Anything in the box?
|
||||
if(this.Cells[2].Value.ToString().Length > 0)
|
||||
{
|
||||
// Return validated value
|
||||
fieldtype.SetValue(this.Cells[2].Value);
|
||||
return fieldtype.GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return old value
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const string NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789_";
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
@ -56,7 +58,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
set
|
||||
{
|
||||
// Value may only be a primitive type
|
||||
if(!(value is int) || !(value is float) || !(value is string) || !(value is bool))
|
||||
if((!(value is int) && !(value is float) && !(value is string) && !(value is bool)) || (value == null))
|
||||
throw new ArgumentException("Universal field values can only be of type int, float, string or bool.");
|
||||
|
||||
this.value = value;
|
||||
|
@ -69,6 +71,16 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
#region ================== Constructor
|
||||
|
||||
// Constructor
|
||||
public UniValue(int type, object value)
|
||||
{
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
public UniValue()
|
||||
{
|
||||
|
@ -80,6 +92,19 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This validates a UDMF field name and returns the valid part
|
||||
public static string ValidateName(string name)
|
||||
{
|
||||
// Keep only valid characters
|
||||
string fieldname = name.Trim().ToLowerInvariant();
|
||||
string validname = "";
|
||||
for(int c = 0; c < fieldname.Length; c++)
|
||||
{
|
||||
if(NAME_CHARS.IndexOf(fieldname[c]) > -1) validname += fieldname[c];
|
||||
}
|
||||
return validname;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
bool result;
|
||||
|
||||
// null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = false;
|
||||
}
|
||||
// already bool?
|
||||
if(value is bool)
|
||||
else if(value is bool)
|
||||
{
|
||||
this.value = (bool)value;
|
||||
}
|
||||
|
|
|
@ -76,8 +76,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
int result;
|
||||
|
||||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
// Already an int or float?
|
||||
if(value is int)
|
||||
else if(value is int)
|
||||
{
|
||||
// Set directly
|
||||
this.value = (int)value;
|
||||
|
|
|
@ -77,8 +77,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
int result;
|
||||
|
||||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
// Already an int?
|
||||
if(value is int)
|
||||
else if(value is int)
|
||||
{
|
||||
// Set directly
|
||||
this.value = (int)value;
|
||||
|
|
|
@ -71,58 +71,66 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
this.value = null;
|
||||
|
||||
// Value is an integer?
|
||||
if(value is int)
|
||||
// Input null?
|
||||
if(value == null)
|
||||
{
|
||||
int intvalue = (int)value;
|
||||
this.value = new EnumItem("0", "NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Value is an integer?
|
||||
if(value is int)
|
||||
{
|
||||
int intvalue = (int)value;
|
||||
|
||||
// First try to match the value against the enum values
|
||||
foreach(EnumItem item in list)
|
||||
{
|
||||
// Matching value?
|
||||
if(item.GetIntValue() == intvalue)
|
||||
// First try to match the value against the enum values
|
||||
foreach(EnumItem item in list)
|
||||
{
|
||||
// Set this value
|
||||
this.value = item;
|
||||
// Matching value?
|
||||
if(item.GetIntValue() == intvalue)
|
||||
{
|
||||
// Set this value
|
||||
this.value = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No match found yet?
|
||||
if(this.value == null)
|
||||
{
|
||||
// First try to match the value against the enum values
|
||||
foreach(EnumItem item in list)
|
||||
{
|
||||
// Matching value?
|
||||
if(item.Value == value.ToString())
|
||||
{
|
||||
// Set this value
|
||||
this.value = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No match found yet?
|
||||
if(this.value == null)
|
||||
{
|
||||
// Try to match against the titles
|
||||
foreach(EnumItem item in list)
|
||||
{
|
||||
// Matching value?
|
||||
if(item.Title.ToLowerInvariant() == value.ToString().ToLowerInvariant())
|
||||
{
|
||||
// Set this value
|
||||
this.value = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Still no match found?
|
||||
if(this.value == null)
|
||||
{
|
||||
// Make a dummy value
|
||||
this.value = new EnumItem(value.ToString(), value.ToString());
|
||||
// No match found yet?
|
||||
if(this.value == null)
|
||||
{
|
||||
// First try to match the value against the enum values
|
||||
foreach(EnumItem item in list)
|
||||
{
|
||||
// Matching value?
|
||||
if(item.Value == value.ToString())
|
||||
{
|
||||
// Set this value
|
||||
this.value = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No match found yet?
|
||||
if(this.value == null)
|
||||
{
|
||||
// Try to match against the titles
|
||||
foreach(EnumItem item in list)
|
||||
{
|
||||
// Matching value?
|
||||
if(item.Title.ToLowerInvariant() == value.ToString().ToLowerInvariant())
|
||||
{
|
||||
// Set this value
|
||||
this.value = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Still no match found?
|
||||
if(this.value == null)
|
||||
{
|
||||
// Make a dummy value
|
||||
this.value = new EnumItem(value.ToString(), value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
private string value;
|
||||
private string value = "";
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -60,7 +60,10 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
public override void SetValue(object value)
|
||||
{
|
||||
this.value = value.ToString();
|
||||
if(value != null)
|
||||
this.value = value.ToString();
|
||||
else
|
||||
this.value = "";
|
||||
}
|
||||
|
||||
public override object GetValue()
|
||||
|
|
|
@ -53,8 +53,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
float result;
|
||||
|
||||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0.0f;
|
||||
}
|
||||
// Already an int or float?
|
||||
if((value is int) || (value is float))
|
||||
else if((value is int) || (value is float))
|
||||
{
|
||||
// Set directly
|
||||
this.value = (float)value;
|
||||
|
|
|
@ -53,8 +53,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
int result;
|
||||
|
||||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
// Already an int or float?
|
||||
if((value is int) || (value is float))
|
||||
else if((value is int) || (value is float))
|
||||
{
|
||||
// Set directly
|
||||
this.value = (int)value;
|
||||
|
|
|
@ -67,8 +67,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
int result;
|
||||
|
||||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
// Already an int or float?
|
||||
if((value is int) || (value is float))
|
||||
else if((value is int) || (value is float))
|
||||
{
|
||||
// Set directly
|
||||
this.value = (int)value;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
private object value;
|
||||
private object value = (int)0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -50,7 +50,10 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
public override void SetValue(object value)
|
||||
{
|
||||
this.value = value;
|
||||
if(value != null)
|
||||
this.value = value;
|
||||
else
|
||||
this.value = (int)0;
|
||||
}
|
||||
|
||||
public override object GetValue()
|
||||
|
|
|
@ -67,8 +67,13 @@ namespace CodeImp.DoomBuilder.Types
|
|||
{
|
||||
int result;
|
||||
|
||||
// Null?
|
||||
if(value == null)
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
// Already an int or float?
|
||||
if((value is int) || (value is float))
|
||||
else if((value is int) || (value is float))
|
||||
{
|
||||
// Set directly
|
||||
this.value = (int)value;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
private string value;
|
||||
private string value = "";
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -51,7 +51,10 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
public override void SetValue(object value)
|
||||
{
|
||||
this.value = value.ToString();
|
||||
if(value != null)
|
||||
this.value = value.ToString();
|
||||
else
|
||||
this.value = "";
|
||||
}
|
||||
|
||||
public override object GetValue()
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
private string value;
|
||||
private string value = "";
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -60,7 +60,10 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
public override void SetValue(object value)
|
||||
{
|
||||
this.value = value.ToString();
|
||||
if(value != null)
|
||||
this.value = value.ToString();
|
||||
else
|
||||
this.value = "";
|
||||
}
|
||||
|
||||
public override object GetValue()
|
||||
|
|
|
@ -161,6 +161,14 @@ namespace CodeImp.DoomBuilder.Types
|
|||
// Nothing found
|
||||
return null;
|
||||
}
|
||||
|
||||
// This returns the attribute with the give type
|
||||
public TypeHandlerAttribute GetAttribute(int type)
|
||||
{
|
||||
// Do we have a handler type for this?
|
||||
if(handlertypes.ContainsKey(type)) return handlertypes[type];
|
||||
else return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -66,6 +66,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
backmid.Initialize();
|
||||
backlow.Initialize();
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
|
||||
// Show appropriate panels/tabs
|
||||
doompanel.Visible = General.Map.IsType(typeof(DoomMapSetIO));
|
||||
hexenpanel.Visible = General.Map.IsType(typeof(HexenMapSetIO));
|
||||
|
@ -132,6 +135,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
backoffsety.Text = fl.Back.OffsetY.ToString();
|
||||
}
|
||||
|
||||
// Custom fields
|
||||
fieldslist.SetValues(fl.Fields, true);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Now go for all lines and change the options when a setting is different
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -204,6 +210,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(backoffsetx.Text != l.Back.OffsetX.ToString()) backoffsetx.Text = "";
|
||||
if(backoffsety.Text != l.Back.OffsetY.ToString()) backoffsety.Text = "";
|
||||
}
|
||||
|
||||
// Custom fields
|
||||
fieldslist.SetValues(l.Fields, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,6 +329,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
l.Back.SetTextureMid(backmid.GetResult(l.Back.MiddleTexture));
|
||||
l.Back.SetTextureLow(backlow.GetResult(l.Back.LowTexture));
|
||||
}
|
||||
|
||||
// Custom fields
|
||||
fieldslist.Apply(l.Fields);
|
||||
}
|
||||
|
||||
// Done
|
||||
|
|
|
@ -54,6 +54,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Initialize image selectors
|
||||
floortex.Initialize();
|
||||
ceilingtex.Initialize();
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
}
|
||||
|
||||
// This sets up the form to edit the given sectors
|
||||
|
|
|
@ -62,6 +62,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Fill actions list
|
||||
action.GeneralizedCategories = General.Map.Config.GenActionCategories;
|
||||
action.AddInfo(General.Map.Config.SortedLinedefActions.ToArray());
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
|
||||
// Go for all predefined categories
|
||||
typelist.Nodes.Clear();
|
||||
|
|
Loading…
Reference in a new issue