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

View File

@ -504,7 +504,7 @@ namespace CodeImp.DoomBuilder.Config
if(de.Value is IDictionary) if(de.Value is IDictionary)
{ {
// Make a category // 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 //mxd. Otherwise nesting problems might occure
if(thingcat.IsValid) if(thingcat.IsValid)

View File

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly string title; private readonly string title;
private readonly bool sorted; private readonly bool sorted;
private readonly List<ThingCategory> children; //mxd private readonly List<ThingCategory> children; //mxd
private IDictionary<string, string> flags;
// Thing properties for inheritance // Thing properties for inheritance
private readonly string sprite; private readonly string sprite;
@ -74,7 +75,8 @@ namespace CodeImp.DoomBuilder.Config
public string Sprite { get { return sprite; } } public string Sprite { get { return sprite; } }
public bool Sorted { get { return sorted; } } public bool Sorted { get { return sorted; } }
public List<ThingCategory> Children { get { return children; } } //mxd public List<ThingCategory> Children { get { return children; } } //mxd
public int Color { get { return color; } } public IDictionary<string,string> Flags { get { return flags; } }
public int Color { get { return color; } }
public float Alpha { get { return alpha; } } //mxd public float Alpha { get { return alpha; } } //mxd
public string RenderStyle { get { return renderstyle; } } //mxd public string RenderStyle { get { return renderstyle; } } //mxd
public int Arrow { get { return arrow; } } public int Arrow { get { return arrow; } }
@ -148,12 +150,14 @@ namespace CodeImp.DoomBuilder.Config
} }
// Constructor // 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 // Initialize
this.name = name; this.name = name;
this.things = new List<ThingTypeInfo>(); this.things = new List<ThingTypeInfo>();
this.children = new List<ThingCategory>(); this.children = new List<ThingCategory>();
this.flags = new Dictionary<string,string>(flags);
ReadCategorySpecificFlags(cfg);
// Read properties // Read properties
this.title = cfg.ReadSetting("thingtypes." + name + ".title", name); this.title = cfg.ReadSetting("thingtypes." + name + ".title", name);
@ -236,13 +240,13 @@ namespace CodeImp.DoomBuilder.Config
else if(de.Value is string) else if(de.Value is string)
{ {
// Interpret this as the title // 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 //mxd. This should be a child category
else if(de.Value is IDictionary) 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(child.IsValid && child.things.Count > 0)
{ {
if(cats.ContainsKey(child.title.ToLowerInvariant())) if(cats.ContainsKey(child.title.ToLowerInvariant()))
@ -267,6 +271,7 @@ namespace CodeImp.DoomBuilder.Config
{ {
// Clean up // Clean up
things = null; things = null;
flags = null;
//mxd. Dispose children (oh so cruel!!11) //mxd. Dispose children (oh so cruel!!11)
foreach(ThingCategory tc in children) tc.Dispose(); foreach(ThingCategory tc in children) tc.Dispose();
@ -308,8 +313,18 @@ namespace CodeImp.DoomBuilder.Config
{ {
return title; return title;
} }
#endregion 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 readonly bool locksprite; //mxd
private bool obsolete; //mxd private bool obsolete; //mxd
private string obsoletemessage; //mxd private string obsoletemessage; //mxd
private IDictionary<string, string> flags;
//mxd. GLOOME rendering settings //mxd. GLOOME rendering settings
private Thing.SpriteRenderMode rendermode; private Thing.SpriteRenderMode rendermode;
@ -108,7 +109,8 @@ namespace CodeImp.DoomBuilder.Config
public bool IsNull { get { return (index == 0); } } public bool IsNull { get { return (index == 0); } }
public bool IsObsolete { get { return obsolete; } } //mxd public bool IsObsolete { get { return obsolete; } } //mxd
public string ObsoleteMessage { get { return obsoletemessage; } } //mxd public string ObsoleteMessage { get { return obsoletemessage; } } //mxd
public bool AbsoluteZ { get { return absolutez; } } public IDictionary<string, string> Flags { get { return flags; } }
public bool AbsoluteZ { get { return absolutez; } }
public bool XYBillboard { get { return xybillboard; } } //mxd public bool XYBillboard { get { return xybillboard; } } //mxd
public SizeF SpriteScale { get { return spritescale; } } public SizeF SpriteScale { get { return spritescale; } }
public string ClassName { get { return classname; } } //mxd. Need this to add model overrides for things defined in configs public string ClassName { get { return classname; } } //mxd. Need this to add model overrides for things defined in configs
@ -152,6 +154,7 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = false; this.absolutez = false;
this.xybillboard = false; this.xybillboard = false;
this.locksprite = false; //mxd this.locksprite = false; //mxd
this.flags = new Dictionary<string, string>();
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
@ -190,6 +193,8 @@ namespace CodeImp.DoomBuilder.Config
this.spritescale = new SizeF(sscale, sscale); this.spritescale = new SizeF(sscale, sscale);
this.locksprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".locksprite", false); //mxd this.locksprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".locksprite", false); //mxd
this.classname = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".class", String.Empty); //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 // Read the args
for(int i = 0; i < Linedef.NUM_ARGS; i++) for(int i = 0; i < Linedef.NUM_ARGS; i++)
@ -210,7 +215,7 @@ namespace CodeImp.DoomBuilder.Config
} }
// Constructor // Constructor
public ThingTypeInfo(ThingCategory cat, int index, string title) public ThingTypeInfo(ThingCategory cat, int index, string title, Configuration cfg)
{ {
// Initialize // Initialize
this.index = index; this.index = index;
@ -240,9 +245,11 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = cat.AbsoluteZ; this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale); this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.locksprite = false; this.locksprite = false;
this.flags = new Dictionary<string, string>(cat.Flags);
ReadThingSpecificFlags(cfg);
// Safety // Safety
if(this.radius < 4f) this.radius = 8f; if (this.radius < 4f) this.radius = 8f;
if(this.hangs && this.absolutez) this.hangs = false; //mxd if(this.hangs && this.absolutez) this.hangs = false; //mxd
// Make long name for sprite lookup // Make long name for sprite lookup
@ -285,9 +292,10 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = cat.FixedRotation; //mxd this.fixedrotation = cat.FixedRotation; //mxd
this.absolutez = cat.AbsoluteZ; this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale); this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
// Safety // Safety
if(this.radius < 4f) this.radius = 8f; if (this.radius < 4f) this.radius = 8f;
if(this.hangs && this.absolutez) this.hangs = false; //mxd if(this.hangs && this.absolutez) this.hangs = false; //mxd
// Apply settings from actor // Apply settings from actor
@ -327,9 +335,10 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = cat.FixedRotation; //mxd this.fixedrotation = cat.FixedRotation; //mxd
this.absolutez = cat.AbsoluteZ; this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale); this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
// Safety // Safety
if(this.radius < 4f) this.radius = 8f; if (this.radius < 4f) this.radius = 8f;
if(this.hangs && this.absolutez) this.hangs = false; //mxd if(this.hangs && this.absolutez) this.hangs = false; //mxd
// Apply settings from actor // Apply settings from actor
@ -371,9 +380,10 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = other.absolutez; this.absolutez = other.absolutez;
this.xybillboard = other.xybillboard; //mxd this.xybillboard = other.xybillboard; //mxd
this.spritescale = new SizeF(other.spritescale.Width, other.spritescale.Height); this.spritescale = new SizeF(other.spritescale.Width, other.spritescale.Height);
this.flags = new Dictionary<string, string>(other.flags);
//mxd. Copy GLOOME properties //mxd. Copy GLOOME properties
this.rendermode = other.rendermode; this.rendermode = other.rendermode;
this.sticktoplane = other.sticktoplane; this.sticktoplane = other.sticktoplane;
this.rollsprite = other.rollsprite; this.rollsprite = other.rollsprite;
@ -512,7 +522,17 @@ namespace CodeImp.DoomBuilder.Config
{ {
return title + " (" + index + ")"; 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 #endregion
} }
} }

View File

@ -71,6 +71,16 @@ namespace CodeImp.DoomBuilder.Controls
return c; 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 //mxd
public int GetWidth() public int GetWidth()
{ {

View File

@ -194,7 +194,8 @@ namespace CodeImp.DoomBuilder.Controls
//mxd. Flags //mxd. Flags
flags.Items.Clear(); 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]) if(t.Flags.ContainsKey(group.Key) && t.Flags[group.Key])
flags.Items.Add(new ListViewItem(group.Value) { Checked = true }); flags.Items.Add(new ListViewItem(group.Value) { Checked = true });

View File

@ -188,9 +188,12 @@ namespace CodeImp.DoomBuilder.Windows
// Set type // Set type
thingtype.SelectType(ft.Type); thingtype.SelectType(ft.Type);
// Flags // 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()]; if(ft.Flags.ContainsKey(c.Tag.ToString())) c.Checked = ft.Flags[c.Tag.ToString()];
// Coordination // Coordination
@ -618,7 +621,9 @@ namespace CodeImp.DoomBuilder.Windows
t.UpdateConfiguration(); t.UpdateConfiguration();
} }
General.Map.IsChanged = true; if (thinginfo != null) flags.UpdateCheckboxes(thinginfo.Flags);
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
} }