Allow Thing flags text to be changed per type

This commit is contained in:
MascaraSnake 2016-01-14 19:31:21 +01:00
parent 841f4087b6
commit f3a756c7d4
7 changed files with 175 additions and 76 deletions

View File

@ -2108,7 +2108,7 @@ thingtypes
title = "Player Starts";
width = 16;
height = 56;
deaftext = "[8] Spawn on ceiling";
flags8text = "[8] Spawn on ceiling";
sprite = "SUPTD0";
1
@ -2320,7 +2320,7 @@ thingtypes
sprite = "BUZZA1";
width = 20;
height = 24;
deaftext = "[8] Cannot move";
flags8text = "[8] Cannot move";
}
104
{
@ -2328,7 +2328,7 @@ thingtypes
sprite = "RBUZA1";
width = 20;
height = 24;
deaftext = "[8] Cannot move";
flags8text = "[8] Cannot move";
}
124
{
@ -2343,7 +2343,7 @@ thingtypes
sprite = "JETBB1";
width = 20;
height = 48;
deaftext = "[8] Cannot move";
flags8text = "[8] Cannot move";
}
106
{
@ -2351,7 +2351,7 @@ thingtypes
sprite = "JETGB1";
width = 20;
height = 48;
deaftext = "[8] Cannot move";
flags8text = "[8] Cannot move";
}
107
{
@ -2424,7 +2424,7 @@ thingtypes
{
title = "Robo-Hood";
sprite = "ARCHA1";
deaftext = "[8] Cannot jump";
flags8text = "[8] Cannot jump";
}
118
{
@ -2439,7 +2439,7 @@ thingtypes
sprite = "ESHIA1";
width = 16;
height = 48;
deaftext = "[8] Double speed";
flags8text = "[8] Double speed";
}
120
{
@ -2486,14 +2486,16 @@ thingtypes
{
title = "Boss 1 - Egg Mobile";
sprite = "EGGMA1";
deaftext = "[8] Alternate laser attack";
flags4text = "[4] End level on death";
flags8text = "[8] Alternate laser attack";
}
201
{
title = "Boss 2 - Egg Slimer";
sprite = "EGGNA1";
height = 48;
deaftext = "[8] Speed up when hit";
flags4text = "[4] End level on death";
flags8text = "[8] Speed up when hit";
}
202
{
@ -2501,11 +2503,13 @@ thingtypes
sprite = "EGGOA1";
width = 32;
height = 80;
flags4text = "[4] End level on death";
}
203
{
title = "Boss 4 - Eggscalibur";
sprite = "EGGPA1";
flags4text = "[4] End level on death";
}
207
{
@ -2520,6 +2524,7 @@ thingtypes
sprite = "METLC1";
width = 16;
height = 48;
flags4text = "[4] End level on death";
}
209
{
@ -2527,7 +2532,8 @@ thingtypes
sprite = "BRAK[1";
width = 48;
height = 160;
deaftext = "[8] Electric barrier";
flags4text = "[4] End level on death";
flags8text = "[8] Electric barrier";
}
206
{
@ -2535,6 +2541,7 @@ thingtypes
sprite = "BRAKB1";
width = 48;
height = 160;
flags4text = "[4] End level on death";
}
290
{
@ -2558,7 +2565,7 @@ thingtypes
title = "Boss Waypoint";
width = 8;
height = 16;
deaftext = "[8] Sea Egg shooting point";
flags8text = "[8] Sea Egg shooting point";
sprite = "internal:eggmanway";
}
293
@ -2575,7 +2582,7 @@ thingtypes
width = 24;
height = 24;
deafheight = 32;
deaftext = "[8] Float";
flags8text = "[8] Float";
sprite = "RINGA0";
300
@ -2693,7 +2700,8 @@ thingtypes
width = 8;
height = 16;
deafheight = 32;
deaftext = "[8] Float";
flags4text = "[4] Mario Block version";
flags8text = "[8] Float";
}
313
{
@ -2742,7 +2750,7 @@ thingtypes
width = 8;
height = 16;
deafheight = 32;
deaftext = "[8] Float";
flags8text = "[8] Float";
}
}
@ -2753,7 +2761,8 @@ thingtypes
title = "Item Boxes";
width = 16;
height = 32;
deaftext = "[8] Random (Weak)";
flags4text = "[4] Random (Strong)";
flags8text = "[8] Random (Weak)";
sprite = "SRBXA0";
400
@ -2805,12 +2814,15 @@ thingtypes
{
title = "Extra Life";
sprite = "PRUPA0";
deaftext = "[8] Random (Weak) / 10k points";
flags4text = "[4] Random (Strong) / 10k points";
flags8text = "[8] Random (Weak) / 10k points";
}
410
{
title = "Eggman";
sprite = "EGGBA0";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
411
{
@ -2821,23 +2833,29 @@ thingtypes
{
title = "Random";
sprite = "QUESA0";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
413
{
title = "Gravity Boots";
sprite = "GBTVA0";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
414
{
title = "CTF Team Ring Monitor (Red)";
sprite = "RRBXA0";
deaftext = "[8] Ambush";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
415
{
title = "CTF Team Ring Monitor (Blue)";
sprite = "BRBXA0";
deaftext = "[8] Ambush";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
416
{
@ -2848,11 +2866,15 @@ thingtypes
{
title = "Score (1,000 Points)";
sprite = "PTTVA0";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
419
{
title = "Score (10,000 Points)";
sprite = "PTTVF0";
flags4text = "[4] Special";
flags8text = "[8] Ambush";
}
}
@ -2870,7 +2892,7 @@ thingtypes
sprite = "BUBLA0";
width = 8;
height = 16;
deaftext = "[8] No distance check";
flags8text = "[8] No distance check";
}
501
{
@ -2893,7 +2915,8 @@ thingtypes
title = "Cannonball";
sprite = "CBLLA0";
width = 20;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1000
{
@ -2901,7 +2924,8 @@ thingtypes
blocking = 2;
title = "Gargoyle";
sprite = "GARGA1";
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1102
{
@ -2911,7 +2935,8 @@ thingtypes
sprite = "ESTAA1";
width = 32;
height = 240;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1106
{
@ -2919,7 +2944,7 @@ thingtypes
title = "Chain (Swinging)";
sprite = "internal:chain1";
height = 32;
deaftext = "[8] Double size";
flags8text = "[8] Double size";
}
1107
{
@ -2927,7 +2952,7 @@ thingtypes
title = "Chain (Spinning)";
sprite = "internal:chain2";
height = 32;
deaftext = "[8] Double size";
flags8text = "[8] Double size";
}
1108
{
@ -2935,7 +2960,7 @@ thingtypes
title = "Chain (Hidden)";
sprite = "internal:chain3";
height = 32;
deaftext = "[8] Double size";
flags8text = "[8] Double size";
}
1200
{
@ -2943,7 +2968,7 @@ thingtypes
sprite = "BTBLA0";
width = 24;
height = 48;
deaftext = "[8] Moves perpetually";
flags8text = "[8] Moves perpetually";
}
1201
{
@ -2951,7 +2976,7 @@ thingtypes
sprite = "STBLA0";
width = 12;
height = 24;
deaftext = "[8] Moves perpetually";
flags8text = "[8] Moves perpetually";
}
1504
{
@ -2965,7 +2990,8 @@ thingtypes
blocking = 2;
title = "Snowman";
sprite = "XMS3A0";
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1876
{
@ -2975,7 +3001,8 @@ thingtypes
sprite = "ESTAB1";
width = 20;
height = 96;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
}
@ -2992,7 +3019,8 @@ thingtypes
title = "Fan";
sprite = "FANSA0D0";
width = 16;
deaftext = "[8] No distance check";
flags4text = "[4] Invisible";
flags8text = "[8] No distance check";
}
541
{
@ -3021,7 +3049,7 @@ thingtypes
title = "Diagonal Yellow Spring";
sprite = "YSPRD2";
width = 16;
deaftext = "[8] Rotate 22.5° CCW";
flags8text = "[8] Rotate 22.5° CCW";
}
556
{
@ -3029,7 +3057,7 @@ thingtypes
title = "Diagonal Red Spring";
sprite = "RSPRD2";
width = 16;
deaftext = "[8] Rotate 22.5° CCW";
flags8text = "[8] Rotate 22.5° CCW";
}
}
@ -3205,13 +3233,15 @@ thingtypes
754
{
title = "Push Point";
deaftext = "[8] Push using XYZ";
flags4text = "[4] Fades using XY";
flags8text = "[8] Push using XYZ";
sprite = "GWLGA0";
}
755
{
title = "Pull Point";
deaftext = "[8] Pull using XYZ";
flags4text = "[4] Fades using XY";
flags8text = "[8] Pull using XYZ";
sprite = "GWLRA0";
}
@ -3236,6 +3266,7 @@ thingtypes
{
title = "Skybox View Point";
sprite = "internal:skyb";
flags4text = "[4] In-map reference point";
}
}
@ -3254,7 +3285,7 @@ thingtypes
width = 12;
height = 24;
deafheight = 32;
deaftext = "[8] Float";
flags8text = "[8] Float";
}
523
{
@ -3262,7 +3293,8 @@ thingtypes
sprite = "USPKA0";
width = 8;
height = 42;
deaftext = "[8] Solid";
flags4text = "[4] Retractable";
flags8text = "[8] Solid";
}
524
{
@ -3296,13 +3328,15 @@ thingtypes
{
title = "Mace (Swinging)";
sprite = "internal:mace1";
deaftext = "[8] Double size";
flags4text = "[4] No sounds";
flags8text = "[8] Double size";
}
1104
{
title = "Mace (Spinning)";
sprite = "internal:mace2";
deaftext = "[8] Double size";
flags4text = "[4] No sounds";
flags8text = "[8] Double size";
}
1202
{
@ -3316,14 +3350,14 @@ thingtypes
title = "Flame Jet (Horizontal)";
sprite = "internal:flameh";
width = 16;
deaftext = "[8] Waves vertically";
flags8text = "[8] Waves vertically";
}
1301
{
title = "Flame Jet (Vertical)";
sprite = "internal:flamev";
width = 16;
deaftext = "[8] Shoot downwards";
flags8text = "[8] Shoot downwards";
}
1500
{
@ -3333,7 +3367,8 @@ thingtypes
sprite = "GARGA1";
width = 16;
height = 40;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1501
{
@ -3343,7 +3378,8 @@ thingtypes
sprite = "GARGA1";
width = 16;
height = 40;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1502
{
@ -3353,7 +3389,8 @@ thingtypes
sprite = "GARGA1";
width = 16;
height = 40;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
1503
{
@ -3363,7 +3400,8 @@ thingtypes
sprite = "GARGA1";
width = 16;
height = 40;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
3576
{
@ -3604,7 +3642,7 @@ thingtypes
sprite = "NDRNA1";
width = 16;
height = 56;
deaftext = "[8] Die upon time up";
flags8text = "[8] Die upon time up";
}
1704
{
@ -3632,36 +3670,45 @@ thingtypes
{
title = "Super Paraloop";
sprite = "NPRUA0";
deaftext = "[8] Spawn immediately";
flags4text = "[4] Bonus time only";
flags8text = "[8] Spawn immediately";
}
1708
{
title = "Drill Refill";
sprite = "NPRUB0";
deaftext = "[8] Spawn immediately";
flags4text = "[4] Bonus time only";
flags8text = "[8] Spawn immediately";
}
1709
{
title = "Nightopian Helper";
sprite = "NPRUC0";
deaftext = "[8] Spawn immediately";
flags4text = "[4] Bonus time only";
flags8text = "[8] Spawn immediately";
}
1711
{
title = "Extra Time";
sprite = "NPRUD0";
deaftext = "[8] Spawn immediately";
flags4text = "[4] Bonus time only";
flags8text = "[8] Spawn immediately";
}
1712
{
title = "Link Freeze";
sprite = "NPRUE0";
deaftext = "[8] Spawn immediately";
flags4text = "[4] Bonus time only";
flags8text = "[8] Spawn immediately";
}
1713
{
arrow = 1;
title = "Hoop (Customizable)";
flags1text = "[1] Radius +16";
flags2text = "[2] Radius +32";
flags4text = "[4] Radius +64";
flags8text = "[8] Radius +128";
sprite = "HOOPA0";
width = 80;
height = 160;
@ -3946,7 +3993,7 @@ thingtypes
sprite = "COINA0";
height = 24;
deafheight = 32;
deaftext = "[8] Float";
flags8text = "[8] Float";
}
1801
{
@ -4113,7 +4160,8 @@ thingtypes
sprite = "SRBMC0";
width = 16;
height = 40;
deaftext = "[8] Not pushable";
flags4text = "[4] Slides when pushed";
flags8text = "[8] Not pushable";
}
4014
{

View File

@ -504,7 +504,7 @@ namespace CodeImp.DoomBuilder.Config
if(de.Value is IDictionary)
{
// Make a category
ThingCategory thingcat = new ThingCategory(cfg, null, de.Key.ToString(), enums);
ThingCategory thingcat = new ThingCategory(cfg, null, de.Key.ToString(), enums, thingflags);
//mxd. Otherwise nesting problems might occure
if(thingcat.IsValid)

View File

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly string title;
private readonly bool sorted;
private readonly List<ThingCategory> children; //mxd
private IDictionary<string, string> flags;
// Thing properties for inheritance
private readonly string sprite;
@ -74,6 +75,7 @@ namespace CodeImp.DoomBuilder.Config
public string Sprite { get { return sprite; } }
public bool Sorted { get { return sorted; } }
public List<ThingCategory> Children { get { return children; } } //mxd
public IDictionary<string,string> Flags { get { return flags; } }
public int Color { get { return color; } }
public float Alpha { get { return alpha; } } //mxd
public string RenderStyle { get { return renderstyle; } } //mxd
@ -148,12 +150,14 @@ namespace CodeImp.DoomBuilder.Config
}
// Constructor
internal ThingCategory(Configuration cfg, ThingCategory parent, string name, IDictionary<string, EnumList> enums)
internal ThingCategory(Configuration cfg, ThingCategory parent, string name, IDictionary<string, EnumList> enums, IDictionary<string,string> flags)
{
// Initialize
this.name = name;
this.things = new List<ThingTypeInfo>();
this.children = new List<ThingCategory>();
this.flags = new Dictionary<string,string>(flags);
ReadCategorySpecificFlags(cfg);
// Read properties
this.title = cfg.ReadSetting("thingtypes." + name + ".title", name);
@ -236,13 +240,13 @@ namespace CodeImp.DoomBuilder.Config
else if(de.Value is string)
{
// Interpret this as the title
things.Add(new ThingTypeInfo(this, index, de.Value.ToString()));
things.Add(new ThingTypeInfo(this, index, de.Value.ToString(),cfg));
}
}
//mxd. This should be a child category
else if(de.Value is IDictionary)
{
ThingCategory child = new ThingCategory(cfg, this, name + "." + de.Key, enums);
ThingCategory child = new ThingCategory(cfg, this, name + "." + de.Key, enums,flags);
if(child.IsValid && child.things.Count > 0)
{
if(cats.ContainsKey(child.title.ToLowerInvariant()))
@ -267,6 +271,7 @@ namespace CodeImp.DoomBuilder.Config
{
// Clean up
things = null;
flags = null;
//mxd. Dispose children (oh so cruel!!11)
foreach(ThingCategory tc in children) tc.Dispose();
@ -309,6 +314,16 @@ namespace CodeImp.DoomBuilder.Config
return title;
}
private void ReadCategorySpecificFlags(Configuration cfg)
{
Dictionary<string, string> newflags = new Dictionary<string, string>(flags);
foreach (KeyValuePair<string,string> p in flags)
{
newflags[p.Key] = cfg.ReadSetting("thingtypes." + name + ".flags" + p.Key + "text", p.Value);
}
flags = newflags;
}
#endregion
}
}

View File

@ -74,6 +74,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool locksprite; //mxd
private bool obsolete; //mxd
private string obsoletemessage; //mxd
private IDictionary<string, string> flags;
//mxd. GLOOME rendering settings
private Thing.SpriteRenderMode rendermode;
@ -108,6 +109,7 @@ namespace CodeImp.DoomBuilder.Config
public bool IsNull { get { return (index == 0); } }
public bool IsObsolete { get { return obsolete; } } //mxd
public string ObsoleteMessage { get { return obsoletemessage; } } //mxd
public IDictionary<string, string> Flags { get { return flags; } }
public bool AbsoluteZ { get { return absolutez; } }
public bool XYBillboard { get { return xybillboard; } } //mxd
public SizeF SpriteScale { get { return spritescale; } }
@ -152,6 +154,7 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = false;
this.xybillboard = false;
this.locksprite = false; //mxd
this.flags = new Dictionary<string, string>();
// We have no destructor
GC.SuppressFinalize(this);
@ -190,6 +193,8 @@ namespace CodeImp.DoomBuilder.Config
this.spritescale = new SizeF(sscale, sscale);
this.locksprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".locksprite", false); //mxd
this.classname = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".class", String.Empty); //mxd
this.flags = new Dictionary<string,string>(cat.Flags);
ReadThingSpecificFlags(cfg);
// Read the args
for(int i = 0; i < Linedef.NUM_ARGS; i++)
@ -210,7 +215,7 @@ namespace CodeImp.DoomBuilder.Config
}
// Constructor
public ThingTypeInfo(ThingCategory cat, int index, string title)
public ThingTypeInfo(ThingCategory cat, int index, string title, Configuration cfg)
{
// Initialize
this.index = index;
@ -240,9 +245,11 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.locksprite = false;
this.flags = new Dictionary<string, string>(cat.Flags);
ReadThingSpecificFlags(cfg);
// Safety
if(this.radius < 4f) this.radius = 8f;
if (this.radius < 4f) this.radius = 8f;
if(this.hangs && this.absolutez) this.hangs = false; //mxd
// Make long name for sprite lookup
@ -285,9 +292,10 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = cat.FixedRotation; //mxd
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
// Safety
if(this.radius < 4f) this.radius = 8f;
if (this.radius < 4f) this.radius = 8f;
if(this.hangs && this.absolutez) this.hangs = false; //mxd
// Apply settings from actor
@ -327,9 +335,10 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = cat.FixedRotation; //mxd
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
// Safety
if(this.radius < 4f) this.radius = 8f;
if (this.radius < 4f) this.radius = 8f;
if(this.hangs && this.absolutez) this.hangs = false; //mxd
// Apply settings from actor
@ -371,6 +380,7 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = other.absolutez;
this.xybillboard = other.xybillboard; //mxd
this.spritescale = new SizeF(other.spritescale.Width, other.spritescale.Height);
this.flags = new Dictionary<string, string>(other.flags);
//mxd. Copy GLOOME properties
this.rendermode = other.rendermode;
@ -513,6 +523,16 @@ namespace CodeImp.DoomBuilder.Config
return title + " (" + index + ")";
}
private void ReadThingSpecificFlags(Configuration cfg)
{
Dictionary<string, string> newflags = new Dictionary<string, string>(flags);
string key = index.ToString(CultureInfo.InvariantCulture);
foreach (KeyValuePair<string,string> p in flags)
{
newflags[p.Key] = cfg.ReadSetting("thingtypes." + category.Name + "." + key + ".flags" + p.Key + "text", p.Value);
}
flags = newflags;
}
#endregion
}
}

View File

@ -71,6 +71,16 @@ namespace CodeImp.DoomBuilder.Controls
return c;
}
public void UpdateCheckboxes(IDictionary<string,string> newflags)
{
int i = 0;
foreach (KeyValuePair<string,string> p in newflags)
{
checkboxes[i].Text = p.Value;
i++;
}
}
//mxd
public int GetWidth()
{

View File

@ -194,7 +194,8 @@ namespace CodeImp.DoomBuilder.Controls
//mxd. Flags
flags.Items.Clear();
foreach(KeyValuePair<string, string> group in General.Map.Config.ThingFlags)
IDictionary<string, string> flagList = (ti == null || ti.Flags.Count == 0) ? General.Map.Config.ThingFlags : ti.Flags;
foreach (KeyValuePair<string, string> group in flagList)
{
if(t.Flags.ContainsKey(group.Key) && t.Flags[group.Key])
flags.Items.Add(new ListViewItem(group.Value) { Checked = true });

View File

@ -190,7 +190,10 @@ namespace CodeImp.DoomBuilder.Windows
thingtype.SelectType(ft.Type);
// Flags
foreach(CheckBox c in flags.Checkboxes)
ThingTypeInfo ti = General.Map.Data.GetThingInfoEx(ft.Type);
if (ti != null) flags.UpdateCheckboxes(ti.Flags);
foreach (CheckBox c in flags.Checkboxes)
if(ft.Flags.ContainsKey(c.Tag.ToString())) c.Checked = ft.Flags[c.Tag.ToString()];
// Coordination
@ -618,6 +621,8 @@ namespace CodeImp.DoomBuilder.Windows
t.UpdateConfiguration();
}
if (thinginfo != null) flags.UpdateCheckboxes(thinginfo.Flags);
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}