// Things and thing categories private void LoadThingCategories() { IDictionary dic; ThingCategory thingcat; // Get thing categories dic = cfg.ReadSetting("thingtypes", new Hashtable()); foreach (DictionaryEntry de in dic) { if (de.Value is IDictionary) { // Make a category thingcat = new ThingCategory(cfg, de.Key.ToString(), enums); // Add all things in category to the big list foreach (ThingTypeInfo t in thingcat.Things) { if (!things.ContainsKey(t.Index)) { things.Add(t.Index, t); } else { General.ErrorLogger.Add(ErrorType.Warning, "Thing number " + t.Index + " is defined more than once (as '" + things[t.Index].Title + "' and '" + t.Title + "') in game configuration '" + this.Name + "'"); } } // Add category to list thingcategories.Add(thingcat); } } }
// Constructor internal ThingTypeInfo(int index) { // Initialize this.index = index; this.category = null; this.actor = null; this.title = "<" + index.ToString(CultureInfo.InvariantCulture) + ">"; this.sprite = DataManager.INTERNAL_PREFIX + "unknownthing"; this.color = 0; this.arrow = true; this.radius = 10f; this.height = 20f; this.hangs = false; this.blocking = 0; this.errorcheck = 0; this.spritescale = new SizeF(1.0f, 1.0f); this.fixedsize = false; this.spritelongname = long.MaxValue; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; this.isknown = false; this.absolutez = false; // We have no destructor GC.SuppressFinalize(this); }
//mxd. Constructor internal ThingTypeInfo(ThingCategory cat, ActorStructure actor, int index) { // Initialize this.index = index; this.category = cat; this.title = ""; this.actor = actor; this.classname = actor.ClassName; //mxd this.isknown = true; this.bright = false; //mxd this.distancechecksq = int.MaxValue; //mxd this.args = new ArgumentInfo[Linedef.NUM_ARGS]; for (int i = 0; i < Linedef.NUM_ARGS; i++) { this.args[i] = new ArgumentInfo(i); } // Read properties this.sprite = cat.Sprite; this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true), } }; //mxd this.color = cat.Color; this.alpha = cat.Alpha; //mxd this.alphabyte = (byte)(this.alpha * 255); //mxd this.renderstyle = cat.RenderStyle; //mxd this.arrow = (cat.Arrow != 0); this.radius = cat.Radius; this.height = cat.Height; this.hangs = (cat.Hangs != 0); this.blocking = cat.Blocking; this.errorcheck = cat.ErrorCheck; this.fixedsize = cat.FixedSize; this.fixedrotation = cat.FixedRotation; //mxd this.absolutez = cat.AbsoluteZ; this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale); this.flagsrename = new Dictionary <string, Dictionary <string, string> >(StringComparer.OrdinalIgnoreCase); //mxd // Safety if (this.hangs && this.absolutez) { this.hangs = false; //mxd } // Apply settings from actor ModifyByDecorateActor(actor); //mxd. Create sprite frame this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } }; // this.optional = false; // [ZZ] // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingTypeInfo(int index, ThingTypeInfo other) { // Initialize this.index = index; this.category = other.category; this.title = other.title; this.actor = other.actor; this.classname = other.classname; //mxd this.isknown = true; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; for (int i = 0; i < Linedef.NUM_ARGS; i++) { this.args[i] = other.args[i]; } // Copy properties this.sprite = other.sprite; this.spriteframe = new SpriteFrameInfo[other.spriteframe.Length]; //mxd other.spriteframe.CopyTo(this.spriteframe, 0); //mxd this.color = other.color; this.alpha = other.alpha; //mxd this.alphabyte = other.alphabyte; //mxd this.renderstyle = other.renderstyle; //mxd this.bright = other.bright; //mxd this.arrow = other.arrow; this.radius = other.radius; this.height = other.height; this.distancechecksq = other.distancechecksq; //mxd this.hangs = other.hangs; this.blocking = other.blocking; this.errorcheck = other.errorcheck; this.fixedsize = other.fixedsize; this.fixedrotation = other.fixedrotation; //mxd this.absolutez = other.absolutez; this.xybillboard = other.xybillboard; //mxd this.spritescale = new SizeF(other.spritescale.Width, other.spritescale.Height); this.flagsrename = new Dictionary <string, Dictionary <string, string> >(StringComparer.OrdinalIgnoreCase); //mxd //mxd. Copy GZDoom rendering properties this.rendermode = other.rendermode; this.rollsprite = other.rollsprite; this.rollcenter = other.rollcenter; // this.dynamiclighttype = other.dynamiclighttype; // this.optional = other.optional; // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingTypeInfo(ThingCategory cat, int index, Configuration cfg, IDictionary <string, EnumList> enums) { string key = index.ToString(CultureInfo.InvariantCulture); // Initialize this.index = index; this.category = cat; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; this.isknown = true; this.actor = null; // Read properties this.title = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".title", "<" + key + ">"); this.sprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".sprite", cat.Sprite); this.color = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".color", cat.Color); this.arrow = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".arrow", cat.Arrow) != 0); this.radius = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".width", cat.Radius); this.height = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".height", cat.Height); this.hangs = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".hangs", cat.Hangs) != 0); this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking); this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".error", cat.ErrorCheck); this.fixedsize = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedsize", cat.FixedSize); this.absolutez = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".absolutez", cat.AbsoluteZ); float sscale = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".spritescale", cat.SpriteScale); this.spritescale = new SizeF(sscale, sscale); // Read the args for (int i = 0; i < Linedef.NUM_ARGS; i++) { this.args[i] = new ArgumentInfo(cfg, "thingtypes." + cat.Name + "." + key, i, enums); } // Safety if (this.radius < 4f) { this.radius = 8f; } // Make long name for sprite lookup if (this.sprite.Length <= 8) { this.spritelongname = Lump.MakeLongName(this.sprite); } else { this.spritelongname = long.MaxValue; } // We have no destructor GC.SuppressFinalize(this); }
// Constructor public ThingTypeInfo(ThingCategory cat, int index, string title) { string key = index.ToString(CultureInfo.InvariantCulture); // Initialize this.index = index; this.category = cat; this.title = title; this.actor = null; this.isknown = true; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; for (int i = 0; i < Linedef.NUM_ARGS; i++) { this.args[i] = new ArgumentInfo(i); } // Read properties this.sprite = cat.Sprite; this.color = cat.Color; this.arrow = (cat.Arrow != 0); this.radius = cat.Radius; this.height = cat.Height; this.hangs = (cat.Hangs != 0); this.blocking = cat.Blocking; this.errorcheck = cat.ErrorCheck; this.fixedsize = cat.FixedSize; this.absolutez = cat.AbsoluteZ; this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale); // Safety if (this.radius < 4f) { this.radius = 8f; } // Make long name for sprite lookup if (this.sprite.Length <= 8) { this.spritelongname = Lump.MakeLongName(this.sprite); } else { this.spritelongname = long.MaxValue; } // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingTypeInfo(int index) { // Initialize this.index = index; this.category = null; this.actor = null; this.title = "<" + index.ToString(CultureInfo.InvariantCulture) + ">"; this.sprite = DataManager.INTERNAL_PREFIX + "unknownthing"; this.classname = string.Empty; //mxd this.color = 0; this.alpha = 1f; //mxd this.alphabyte = 255; //mxd this.renderstyle = "normal"; //mxd this.bright = false; //mxd this.arrow = true; this.radius = 10f; this.renderradius = 10f; this.height = 20f; this.distancechecksq = int.MaxValue; //mxd this.hangs = false; this.blocking = 0; this.errorcheck = 0; this.spritescale = new SizeF(1.0f, 1.0f); this.fixedsize = false; this.fixedrotation = false; //mxd this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } }; //mxd this.args = new ArgumentInfo[Linedef.NUM_ARGS]; this.isknown = false; this.absolutez = false; this.xybillboard = false; this.locksprite = false; //mxd this.flagsrename = new Dictionary <string, Dictionary <string, string> >(StringComparer.OrdinalIgnoreCase); //mxd this.thinglink = 0; this.optional = false; // [ZZ] // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingTypeInfo(ThingCategory cat, ActorStructure actor) { // Initialize this.index = actor.DoomEdNum; this.category = cat; this.title = ""; this.actor = actor; this.isknown = true; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; for (int i = 0; i < Linedef.NUM_ARGS; i++) { this.args[i] = new ArgumentInfo(i); } // Read properties this.sprite = cat.Sprite; this.color = cat.Color; this.arrow = (cat.Arrow != 0); this.radius = cat.Radius; this.height = cat.Height; this.hangs = (cat.Hangs != 0); this.blocking = cat.Blocking; this.errorcheck = cat.ErrorCheck; this.fixedsize = cat.FixedSize; this.absolutez = cat.AbsoluteZ; this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale); // Safety if (this.radius < 4f) { this.radius = 8f; } // Apply settings from actor ModifyByDecorateActor(actor); // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingCategory(Configuration cfg, ThingCategory parent, string name, IDictionary <string, EnumList> enums) { // Initialize this.name = name; this.things = new List <ThingTypeInfo>(); this.children = new List <ThingCategory>(); // Read properties this.title = cfg.ReadSetting("thingtypes." + name + ".title", name); //mxd. If current block has no settings, it should be a grouping block, not a thing category. if (this.title == name) { string[] props = new[] { "sprite", "sort", "color", "alpha", "renderstyle", "arrow", "width", "height", "hangs", "blocking", "error", "fixedsize", "fixedrotation", "absolutez", "spritescale" }; isinvalid = true; foreach (string prop in props) { if (cfg.SettingExists("thingtypes." + name + "." + prop)) { isinvalid = false; break; } } if (isinvalid) { return; } } if (parent != null) //mxd { this.sprite = cfg.ReadSetting("thingtypes." + name + ".sprite", parent.sprite); this.sorted = (cfg.ReadSetting("thingtypes." + name + ".sort", (parent.sorted ? 1 : 0)) != 0); this.color = cfg.ReadSetting("thingtypes." + name + ".color", parent.color); this.alpha = cfg.ReadSetting("thingtypes." + name + ".alpha", parent.alpha); this.renderstyle = cfg.ReadSetting("thingtypes." + name + ".renderstyle", parent.renderstyle).ToLower(); this.arrow = cfg.ReadSetting("thingtypes." + name + ".arrow", parent.arrow); this.radius = cfg.ReadSetting("thingtypes." + name + ".width", parent.radius); this.height = cfg.ReadSetting("thingtypes." + name + ".height", parent.height); this.hangs = cfg.ReadSetting("thingtypes." + name + ".hangs", parent.hangs); this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", parent.blocking); this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".error", parent.errorcheck); this.fixedsize = cfg.ReadSetting("thingtypes." + name + ".fixedsize", parent.fixedsize); this.fixedrotation = cfg.ReadSetting("thingtypes." + name + ".fixedrotation", parent.fixedrotation); this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", parent.absolutez); this.spritescale = cfg.ReadSetting("thingtypes." + name + ".spritescale", parent.spritescale); } else { this.sprite = cfg.ReadSetting("thingtypes." + name + ".sprite", ""); this.sorted = (cfg.ReadSetting("thingtypes." + name + ".sort", 0) != 0); this.color = cfg.ReadSetting("thingtypes." + name + ".color", 0); this.alpha = General.Clamp(cfg.ReadSetting("thingtypes." + name + ".alpha", 1f), 0f, 1f); this.renderstyle = cfg.ReadSetting("thingtypes." + name + ".renderstyle", "normal").ToLower(); this.arrow = cfg.ReadSetting("thingtypes." + name + ".arrow", 0); this.radius = cfg.ReadSetting("thingtypes." + name + ".width", 10); this.height = cfg.ReadSetting("thingtypes." + name + ".height", 20); this.hangs = cfg.ReadSetting("thingtypes." + name + ".hangs", 0); this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", 0); this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".error", 1); this.fixedsize = cfg.ReadSetting("thingtypes." + name + ".fixedsize", false); this.fixedrotation = cfg.ReadSetting("thingtypes." + name + ".fixedrotation", false); //mxd this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", false); this.spritescale = cfg.ReadSetting("thingtypes." + name + ".spritescale", 1.0f); } // Safety if (this.radius < 4f) { this.radius = 8f; } // Go for all items in category IDictionary dic = cfg.ReadSetting("thingtypes." + name, new Hashtable()); Dictionary <string, ThingCategory> cats = new Dictionary <string, ThingCategory>(StringComparer.Ordinal); //mxd foreach (DictionaryEntry de in dic) { // Check if the item key is numeric int index; if (int.TryParse(de.Key.ToString(), NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, CultureInfo.InvariantCulture, out index)) { // Check if the item value is a structure if (de.Value is IDictionary) { // Create this thing things.Add(new ThingTypeInfo(this, index, cfg, enums)); } // Check if the item value is a string else if (de.Value is string) { // Interpret this as the title things.Add(new ThingTypeInfo(this, index, de.Value.ToString())); } } //mxd. This should be a child category else if (de.Value is IDictionary) { ThingCategory child = new ThingCategory(cfg, this, name + "." + de.Key, enums); if (child.IsValid && child.things.Count > 0) { if (cats.ContainsKey(child.title.ToLowerInvariant())) { General.ErrorLogger.Add(ErrorType.Warning, "Thing Category \"" + child.title + "\" is double defined in " + this.title); } cats[child.title.ToLowerInvariant()] = child; } } } //mxd. Add to main collection foreach (ThingCategory tc in cats.Values) { children.Add(tc); } // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingCategory(ThingCategory parent, string name, string title, DecorateCategoryInfo catinfo) { // Initialize this.name = name; this.title = title; this.things = new List <ThingTypeInfo>(); this.children = new List <ThingCategory>(); //mxd. Copy properties from the parent if (parent != null) { this.sprite = parent.sprite; this.sorted = parent.sorted; this.color = parent.color; this.alpha = parent.alpha; this.renderstyle = parent.renderstyle; this.arrow = parent.arrow; this.radius = parent.radius; this.height = parent.height; this.hangs = parent.hangs; this.blocking = parent.blocking; this.errorcheck = parent.errorcheck; this.fixedsize = parent.fixedsize; this.fixedrotation = parent.fixedrotation; this.absolutez = parent.absolutez; this.spritescale = parent.spritescale; } // Set default properties else { this.sprite = ""; this.sorted = true; this.color = 18; this.alpha = 1f; //mxd this.renderstyle = "normal"; //mxd this.arrow = 1; this.radius = 10; this.height = 20; this.hangs = 0; this.blocking = 0; this.errorcheck = 1; this.fixedsize = false; this.fixedrotation = false; //mxd this.absolutez = false; this.spritescale = 1.0f; } //mxd. Apply DecorateCategoryInfo overrides... if (catinfo != null && catinfo.Properties.Count > 0) { this.sprite = catinfo.GetPropertyValueString("$sprite", 0, this.sprite); this.sorted = (catinfo.GetPropertyValueInt("$sort", 0, (this.sorted ? 1 : 0)) != 0); this.color = catinfo.GetPropertyValueInt("$color", 0, this.color); this.arrow = catinfo.GetPropertyValueInt("$arrow", 0, this.arrow); this.errorcheck = catinfo.GetPropertyValueInt("$error", 0, this.errorcheck); this.fixedsize = catinfo.GetPropertyValueBool("$fixedsize", 0, this.fixedsize); this.fixedrotation = catinfo.GetPropertyValueBool("$fixedrotation", 0, this.fixedrotation); this.absolutez = catinfo.GetPropertyValueBool("$absolutez", 0, this.absolutez); } // We have no destructor GC.SuppressFinalize(this); }
// Constructor internal ThingTypeInfo(ThingCategory cat, int index, Configuration cfg, IDictionary <string, EnumList> enums) { string key = index.ToString(CultureInfo.InvariantCulture); // Initialize this.index = index; this.category = cat; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; this.isknown = true; this.actor = null; this.bright = false; //mxd this.distancechecksq = int.MaxValue; //mxd // Read properties this.title = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".title", "<" + key + ">"); this.sprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".sprite", cat.Sprite); this.color = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".color", cat.Color); this.alpha = General.Clamp(cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".alpha", cat.Alpha), 0f, 1f); //mxd this.alphabyte = (byte)(this.alpha * 255); //mxd this.renderstyle = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".renderstyle", cat.RenderStyle).ToLower(); //mxd this.arrow = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".arrow", cat.Arrow) != 0); this.radius = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".width", cat.Radius); this.height = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".height", cat.Height); this.hangs = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".hangs", cat.Hangs) != 0); this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking); this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".error", cat.ErrorCheck); this.fixedsize = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedsize", cat.FixedSize); this.fixedrotation = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedrotation", cat.FixedRotation); //mxd this.absolutez = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".absolutez", cat.AbsoluteZ); float sscale = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".spritescale", cat.SpriteScale); 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 //mxd. Read flagsrename this.flagsrename = new Dictionary <string, Dictionary <string, string> >(StringComparer.OrdinalIgnoreCase); IDictionary maindic = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".flagsrename", new Hashtable()); foreach (DictionaryEntry de in maindic) { string ioname = de.Key.ToString().ToLowerInvariant(); switch (ioname) { case "doommapsetio": case "hexenmapsetio": case "universalmapsetio": IDictionary flagdic = de.Value as IDictionary; if (flagdic == null) { continue; } flagsrename.Add(ioname, new Dictionary <string, string>()); foreach (DictionaryEntry fe in flagdic) { flagsrename[ioname].Add(fe.Key.ToString(), fe.Value.ToString()); } break; default: throw new NotImplementedException("Unsupported MapSetIO"); } } // Read the args for (int i = 0; i < Linedef.NUM_ARGS; i++) { this.args[i] = new ArgumentInfo(cfg, "thingtypes." + cat.Name + "." + key, i, enums); } // Safety if (this.radius < 4f || this.fixedsize) { this.radius = THING_FIXED_SIZE; } if (this.hangs && this.absolutez) { this.hangs = false; //mxd } //mxd. Create sprite frame this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } }; // We have no destructor GC.SuppressFinalize(this); }