mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Changed, Game configurations: "default" property is no longer mandatory for universal field definitions.
Fixed, Game Configurations window: map resources were not marked for reloading after pasting resources to currently used game configuration. Fixed, Game configurations: "Platform Generic Change" action's arg2 value must be in octics.
This commit is contained in:
parent
8349392829
commit
7d3a0c779d
8 changed files with 123 additions and 65 deletions
|
@ -1995,10 +1995,10 @@ zdoom
|
|||
}
|
||||
arg2
|
||||
{
|
||||
title = "Reverse Delay (tics)";
|
||||
title = "Reverse Delay (octics)";
|
||||
type = 11;
|
||||
enum = "delay_tics";
|
||||
default = 35;
|
||||
enum = "delay_octics";
|
||||
default = 24;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
|
|
|
@ -831,6 +831,21 @@ enums
|
|||
315 = "315: 9 Seconds";
|
||||
350 = "350: 10 Seconds";
|
||||
}
|
||||
|
||||
delay_octics
|
||||
{
|
||||
0 = "0: No delay";
|
||||
8 = "8: 1 Second";
|
||||
16 = "16: 2 Seconds";
|
||||
24 = "24: 3 Seconds";
|
||||
32 = "32: 4 Seconds";
|
||||
40 = "40: 5 Seconds";
|
||||
48 = "48: 6 Seconds";
|
||||
56 = "56: 7 Seconds";
|
||||
64 = "64: 8 Seconds";
|
||||
72 = "72: 9 Seconds";
|
||||
80 = "80: 10 Seconds";
|
||||
}
|
||||
|
||||
delay_seconds
|
||||
{
|
||||
|
|
|
@ -542,16 +542,20 @@ namespace CodeImp.DoomBuilder.Config
|
|||
IDictionary dic = cfg.ReadSetting("universalfields." + elementname, new Hashtable());
|
||||
foreach(DictionaryEntry de in dic)
|
||||
{
|
||||
#if !DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
// Read the field info and add to list
|
||||
UniversalFieldInfo uf = new UniversalFieldInfo(elementname, de.Key.ToString(), cfg, enums);
|
||||
UniversalFieldInfo uf = new UniversalFieldInfo(elementname, de.Key.ToString(), this.Name, cfg, enums);
|
||||
list.Add(uf);
|
||||
#if !DEBUG
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Unable to read universal field definition \"universalfields." + elementname + "." + de.Key + "\" from game configuration \"" + this.Name + "\"");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Return result
|
||||
|
|
|
@ -20,6 +20,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -53,7 +54,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
internal UniversalFieldInfo(string path, string name, Configuration cfg, IDictionary<string, EnumList> enums)
|
||||
internal UniversalFieldInfo(string path, string name, string configname, Configuration cfg, IDictionary<string, EnumList> enums)
|
||||
{
|
||||
string setting = "universalfields." + path + "." + name;
|
||||
|
||||
|
@ -61,8 +62,26 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.name = name.ToLowerInvariant();
|
||||
|
||||
// Read type
|
||||
this.type = cfg.ReadSetting(setting + ".type", 0);
|
||||
this.type = cfg.ReadSetting(setting + ".type", int.MinValue);
|
||||
this.defaultvalue = cfg.ReadSettingObject(setting + ".default", null);
|
||||
|
||||
//mxd. Check type
|
||||
if(this.type == int.MinValue)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "No type is defined for universal field \"" + name + "\" defined in \"" + configname + "\". Integer type will be used.");
|
||||
this.type = (int)UniversalType.Integer;
|
||||
}
|
||||
|
||||
TypeHandler th = General.Types.GetFieldHandler(this);
|
||||
if(th is NullHandler)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Universal field \"" + name + "\" defined in \"" + configname + "\" has unknown type " + this.type + ". String type will be used instead.");
|
||||
this.type = (int)UniversalType.String;
|
||||
if(this.defaultvalue == null) this.defaultvalue = "";
|
||||
}
|
||||
|
||||
//mxd. Default value is missing? Get it from typehandler
|
||||
if(this.defaultvalue == null) this.defaultvalue = th.GetDefaultValue();
|
||||
|
||||
// Read enum
|
||||
object enumsetting = cfg.ReadSettingObject(setting + ".enum", null);
|
||||
|
|
|
@ -27,32 +27,35 @@ namespace CodeImp.DoomBuilder.Types
|
|||
[TypeHandler(UniversalType.LinedefTag, "Linedef Tag", true)]
|
||||
internal class LinedefTagHandler : SectorTagHandler
|
||||
{
|
||||
#region ================== Setup
|
||||
#region ================== Setup (mxd)
|
||||
|
||||
protected override EnumList CreateEnumList()
|
||||
{
|
||||
//collect tags
|
||||
// Collect tags
|
||||
List<int> tags = new List<int>();
|
||||
HashSet<int> tagshash = new HashSet<int>();
|
||||
EnumList taglist = new EnumList();
|
||||
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
if(General.Map.Map != null)
|
||||
{
|
||||
if(l.Tag == 0 || tagshash.IsSupersetOf(l.Tags)) continue;
|
||||
tags.AddRange(l.Tags);
|
||||
foreach(int i in l.Tags) tagshash.Add(i);
|
||||
}
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
if(l.Tag == 0 || tagshash.IsSupersetOf(l.Tags)) continue;
|
||||
tags.AddRange(l.Tags);
|
||||
foreach(int i in l.Tags) tagshash.Add(i);
|
||||
}
|
||||
|
||||
//now sort them in descending order
|
||||
tags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
// Now sort them in descending order
|
||||
tags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
|
||||
//create enum items
|
||||
foreach(int tag in tags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
|
||||
taglist.Add(new EnumItem(tag.ToString(), General.Map.Options.TagLabels[tag]));
|
||||
else
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
|
||||
// Create enum items
|
||||
foreach(int tag in tags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) // Tag labels
|
||||
taglist.Add(new EnumItem(tag.ToString(), General.Map.Options.TagLabels[tag]));
|
||||
else
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
return taglist;
|
||||
|
|
|
@ -71,28 +71,31 @@ namespace CodeImp.DoomBuilder.Types
|
|||
//mxd
|
||||
protected virtual EnumList CreateEnumList()
|
||||
{
|
||||
//collect tags
|
||||
// Collect tags
|
||||
List<int> tags = new List<int>();
|
||||
HashSet<int> tagshash = new HashSet<int>();
|
||||
EnumList taglist = new EnumList();
|
||||
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
if(General.Map.Map != null)
|
||||
{
|
||||
if(s.Tag == 0 || tagshash.IsSupersetOf(s.Tags)) continue;
|
||||
tags.AddRange(s.Tags);
|
||||
foreach(int i in s.Tags) tagshash.Add(i);
|
||||
}
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
if(s.Tag == 0 || tagshash.IsSupersetOf(s.Tags)) continue;
|
||||
tags.AddRange(s.Tags);
|
||||
foreach(int i in s.Tags) tagshash.Add(i);
|
||||
}
|
||||
|
||||
//now sort them in descending order
|
||||
tags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
// Now sort them in descending order
|
||||
tags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
|
||||
//create enum items
|
||||
foreach(int tag in tags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag + ": " + General.Map.Options.TagLabels[tag]));
|
||||
else
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
|
||||
// Create enum items
|
||||
foreach(int tag in tags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) // Tag labels
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag + ": " + General.Map.Options.TagLabels[tag]));
|
||||
else
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
return taglist;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace CodeImp.DoomBuilder.Types
|
|||
[TypeHandler(UniversalType.ThingTag, "Thing Tag", true)]
|
||||
internal class ThingTagHandler : SectorTagHandler
|
||||
{
|
||||
#region ================== Setup
|
||||
#region ================== Setup (mxd)
|
||||
|
||||
protected override EnumList CreateEnumList()
|
||||
{
|
||||
|
@ -35,30 +35,34 @@ namespace CodeImp.DoomBuilder.Types
|
|||
List<int> tags = new List<int>();
|
||||
EnumList taglist = new EnumList();
|
||||
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
if(General.Map.Map != null)
|
||||
{
|
||||
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
|
||||
|
||||
// Check target class?
|
||||
if(arginfo.TargetClasses.Count > 0)
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
ThingTypeInfo info = General.Map.Data.GetThingInfoEx(t.Type);
|
||||
if(info != null && !arginfo.TargetClasses.Contains(info.ClassName)) continue;
|
||||
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
|
||||
|
||||
// Check target class?
|
||||
if(arginfo.TargetClasses.Count > 0)
|
||||
{
|
||||
ThingTypeInfo info = General.Map.Data.GetThingInfoEx(t.Type);
|
||||
if(info != null && !arginfo.TargetClasses.Contains(info.ClassName))
|
||||
continue;
|
||||
}
|
||||
|
||||
tags.Add(t.Tag);
|
||||
}
|
||||
|
||||
tags.Add(t.Tag);
|
||||
}
|
||||
// Now sort them in descending order
|
||||
tags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
|
||||
// Now sort them in descending order
|
||||
tags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
|
||||
// Create enum items
|
||||
foreach(int tag in tags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) // Tag labels
|
||||
taglist.Add(new EnumItem(tag.ToString(), General.Map.Options.TagLabels[tag]));
|
||||
else
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
|
||||
// Create enum items
|
||||
foreach(int tag in tags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) // Tag labels
|
||||
taglist.Add(new EnumItem(tag.ToString(), General.Map.Options.TagLabels[tag]));
|
||||
else
|
||||
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
return taglist;
|
||||
|
|
|
@ -839,13 +839,18 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
if(listconfigs.SelectedIndices.Count < 1) return;
|
||||
|
||||
//get current configinfo
|
||||
// Get current configinfo
|
||||
ConfigurationInfo current = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
|
||||
current.PasteFrom(configinfocopy);
|
||||
|
||||
//update display
|
||||
// Update display
|
||||
cbEngineSelector.Text = string.Empty; // Otherwise current text from cbEngineSelector will override the pasted one
|
||||
listconfigs_SelectedIndexChanged(listconfigs, EventArgs.Empty);
|
||||
|
||||
// Resources need reloading?
|
||||
if(General.Map != null && General.Map.ConfigSettings.Name == current.Name)
|
||||
reloadresources = true;
|
||||
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Pasted game configuration from \"" + configinfocopy.Name + "\"");
|
||||
}
|
||||
|
||||
|
@ -853,12 +858,17 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
if(listconfigs.SelectedIndices.Count < 1) return;
|
||||
|
||||
//get current configinfo
|
||||
// Get current configinfo
|
||||
ConfigurationInfo current = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
|
||||
current.PasteResourcesFrom(configinfocopy);
|
||||
|
||||
//update display
|
||||
// Update display
|
||||
listconfigs_SelectedIndexChanged(listconfigs, EventArgs.Empty);
|
||||
|
||||
// Resources need reloading?
|
||||
if(General.Map != null && General.Map.ConfigSettings.Name == current.Name)
|
||||
reloadresources = true;
|
||||
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Pasted resources from \"" + configinfocopy.Name + "\"");
|
||||
}
|
||||
|
||||
|
@ -866,11 +876,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
if(listconfigs.SelectedIndices.Count < 1) return;
|
||||
|
||||
//get current configinfo
|
||||
// Get current configinfo
|
||||
ConfigurationInfo current = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
|
||||
current.PasteTestEnginesFrom(configinfocopy);
|
||||
|
||||
//update display
|
||||
// Update display
|
||||
cbEngineSelector.Text = string.Empty; // Otherwise current text from cbEngineSelector will override the pasted one
|
||||
listconfigs_SelectedIndexChanged(listconfigs, EventArgs.Empty);
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Pasted engines list from \"" + configinfocopy.Name + "\"");
|
||||
|
@ -880,11 +890,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
if(listconfigs.SelectedIndices.Count < 1) return;
|
||||
|
||||
//get current configinfo
|
||||
// Get current configinfo
|
||||
ConfigurationInfo current = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
|
||||
current.PasteColorPresetsFrom(configinfocopy);
|
||||
|
||||
//update display
|
||||
// Update display
|
||||
listconfigs_SelectedIndexChanged(listconfigs, EventArgs.Empty);
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Pasted color presets from \"" + configinfocopy.Name + "\"");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue