mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
bugfixes in UDMF support
This commit is contained in:
parent
e30b68c9c3
commit
8d3b7a554b
10 changed files with 46 additions and 26 deletions
|
@ -18,10 +18,10 @@ formatinterface = "UniversalMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = "blocksound";
|
||||
singlesidedflag = "blocking";
|
||||
doublesidedflag = "twosided";
|
||||
impassableflag = "blocking";
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -19,10 +19,10 @@ defaultlumpname = "MAP01";
|
|||
|
||||
// Special linedefs
|
||||
// See linedefflags
|
||||
soundlinedefflag = 64;
|
||||
singlesidedflag = 1;
|
||||
doublesidedflag = 4;
|
||||
impassableflag = 1;
|
||||
soundlinedefflag = "blocksound";
|
||||
singlesidedflag = "blocking";
|
||||
doublesidedflag = "twosided";
|
||||
impassableflag = "blocking";
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -186,11 +186,11 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// because they are allowed to be written as integers in the configs
|
||||
obj = cfg.ReadSettingObject("soundlinedefflag", 0);
|
||||
if(obj is int) soundlinedefflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else soundlinedefflag = obj.ToString();
|
||||
obj = cfg.ReadSetting("singlesidedflag", 0);
|
||||
obj = cfg.ReadSettingObject("singlesidedflag", 0);
|
||||
if(obj is int) singlesidedflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else singlesidedflag = obj.ToString();
|
||||
obj = cfg.ReadSetting("doublesidedflag", 0);
|
||||
obj = cfg.ReadSettingObject("doublesidedflag", 0);
|
||||
if(obj is int) doublesidedflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else doublesidedflag = obj.ToString();
|
||||
obj = cfg.ReadSetting("impassableflag", 0);
|
||||
obj = cfg.ReadSettingObject("impassableflag", 0);
|
||||
if(obj is int) impassableflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else impassableflag = obj.ToString();
|
||||
|
||||
// Get map lumps
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Constants
|
||||
private const string ADD_FIELD_TEXT = " (click to add custom field)";
|
||||
|
||||
// Variables
|
||||
private string elementname;
|
||||
|
||||
// Constructor
|
||||
public FieldsEditorControl()
|
||||
{
|
||||
|
@ -50,8 +53,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
// This sets up the control
|
||||
public void Setup()
|
||||
public void Setup(string elementname)
|
||||
{
|
||||
// Keep element name
|
||||
this.elementname = elementname;
|
||||
|
||||
// Make types list
|
||||
fieldtype.Items.Clear();
|
||||
fieldtype.Items.AddRange(General.Types.GetCustomUseAttributes());
|
||||
|
@ -191,6 +197,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
object oldvalue = null;
|
||||
if(tofields.ContainsKey(frow.Name)) oldvalue = tofields[frow.Name].Value;
|
||||
tofields[frow.Name] = new UniValue(frow.TypeHandler.Index, frow.GetResult(oldvalue));
|
||||
|
||||
// Custom row?
|
||||
if(!frow.IsFixed)
|
||||
{
|
||||
// Write type to map configuration
|
||||
General.Map.Options.SetUniversalFieldType(elementname, frow.Name, frow.TypeHandler.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,8 +298,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
string validname = UniValue.ValidateName(row.Cells[0].Value.ToString());
|
||||
if(validname.Length > 0)
|
||||
{
|
||||
// Try to find the type in the map options
|
||||
int type = General.Map.Options.GetUniversalFieldType(elementname, validname, 0);
|
||||
|
||||
// Make new row
|
||||
frow = new FieldsEditorRow(fieldslist, validname, 0, 0);
|
||||
frow = new FieldsEditorRow(fieldslist, validname, type, null);
|
||||
frow.Visible = false;
|
||||
fieldslist.Rows.Insert(e.RowIndex + 1, frow);
|
||||
}
|
||||
|
|
|
@ -81,11 +81,11 @@ namespace CodeImp.DoomBuilder.Map
|
|||
internal MapOptions()
|
||||
{
|
||||
// Initialize
|
||||
this.mapconfig = new Configuration(true);
|
||||
this.previousname = "";
|
||||
this.currentname = "";
|
||||
this.configfile = "";
|
||||
this.resources = new DataLocationList();
|
||||
this.mapconfig = new Configuration(true);
|
||||
}
|
||||
|
||||
// Constructor to load from Doom Builder Map Settings Configuration
|
||||
|
@ -99,10 +99,12 @@ namespace CodeImp.DoomBuilder.Map
|
|||
this.currentname = mapname;
|
||||
this.configfile = cfg.ReadSetting("config", "");
|
||||
this.resources = new DataLocationList();
|
||||
this.mapconfig = new Configuration(true);
|
||||
|
||||
// Go for all items in the map info
|
||||
this.mapconfig.Root = cfg.ReadSetting(mapname, new Hashtable());
|
||||
foreach(DictionaryEntry mp in this.mapconfig.Root)
|
||||
this.mapconfig.Root = cfg.ReadSetting("maps." + mapname, new Hashtable());
|
||||
IDictionary reslist = this.mapconfig.ReadSetting("resources", new Hashtable());
|
||||
foreach(DictionaryEntry mp in reslist)
|
||||
{
|
||||
// Item is a structure?
|
||||
if(mp.Value is IDictionary)
|
||||
|
|
|
@ -48,27 +48,28 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
// This shows the dialog, returns false when cancelled
|
||||
public static bool ShowDialog(IWin32Window owner, string title, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
|
||||
public static bool ShowDialog(IWin32Window owner, string title, string elementname, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
|
||||
{
|
||||
bool result;
|
||||
CustomFieldsForm f = new CustomFieldsForm();
|
||||
f.Setup(title, elements, fixedfields);
|
||||
f.Setup(title, elementname, elements, fixedfields);
|
||||
result = (f.ShowDialog(owner) == DialogResult.OK);
|
||||
f.Dispose();
|
||||
return result;
|
||||
}
|
||||
|
||||
// This sets up the dialog
|
||||
public void Setup(string title, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
|
||||
public void Setup(string title, string elementname, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
|
||||
{
|
||||
// Keep list
|
||||
// Initialize
|
||||
this.elements = elements;
|
||||
this.Text = title;
|
||||
|
||||
// Fill universal fields list
|
||||
fieldslist.ListFixedFields(fixedfields);
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
fieldslist.Setup(elementname);
|
||||
|
||||
// Setup from first element
|
||||
MapElement fe = General.GetByIndex<MapElement>(elements, 0);
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
backlow.Initialize();
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
fieldslist.Setup("linedef");
|
||||
|
||||
// THE CODE BELOW IS ABSOLUTELY UGLY
|
||||
// I should make different controls for each format
|
||||
|
@ -462,7 +462,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
foreach(Linedef l in lines) if(l.Front != null) sides.Add(l.Front);
|
||||
|
||||
// Edit these
|
||||
CustomFieldsForm.ShowDialog(this, "Front side custom fields", sides, General.Map.Config.SidedefFields);
|
||||
CustomFieldsForm.ShowDialog(this, "Front side custom fields", "sidedef", sides, General.Map.Config.SidedefFields);
|
||||
}
|
||||
|
||||
// Custom fields on back sides
|
||||
|
@ -473,7 +473,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
foreach(Linedef l in lines) if(l.Back != null) sides.Add(l.Back);
|
||||
|
||||
// Edit these
|
||||
CustomFieldsForm.ShowDialog(this, "Back side custom fields", sides, General.Map.Config.SidedefFields);
|
||||
CustomFieldsForm.ShowDialog(this, "Back side custom fields", "sidedef", sides, General.Map.Config.SidedefFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -375,6 +375,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
// Get the map name
|
||||
selectedmapname = mapslist.SelectedItems[0].Text;
|
||||
options = new MapOptions(mapsettings, selectedmapname);
|
||||
|
||||
// Get locations from previous selected map settings
|
||||
locations = new DataLocationList(mapsettings, "maps." + selectedmapname + ".resources");
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
ceilingtex.Initialize();
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
fieldslist.Setup("sector");
|
||||
}
|
||||
|
||||
// This sets up the form to edit the given sectors
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
fieldslist.ListFixedFields(General.Map.Config.ThingFields);
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup();
|
||||
fieldslist.Setup("thing");
|
||||
|
||||
// Go for all predefined categories
|
||||
typelist.Nodes.Clear();
|
||||
|
|
Loading…
Reference in a new issue