public LightData(LightDef d, int num) { LightDef = d; LightNum = num; LightDefNum = GetLightDefNum(LightDef); LightDefClass = GetLightDefClass(LightDef); LightDefModifier = GetLightDefModifier(LightDef); LightDefRenderStyle = GetLightDefRenderStyle(LightDef); LightClass = LightDefClass.Classes[Array.IndexOf(LightDefNum.DoomEdNums, LightNum)]; if (LightDefModifier != null) { LightModifier = LightDefModifier.Modifiers[Array.IndexOf(LightDefNum.DoomEdNums, LightNum)]; } else { LightModifier = LightModifier.NORMAL; } if (LightDefRenderStyle != null) { LightRenderStyle = LightDefRenderStyle.RenderStyle; } else { LightRenderStyle = LightRenderStyle.NONE; } LightAnimated = (LightModifier == LightModifier.PULSE || LightModifier == LightModifier.FLICKER || LightModifier == LightModifier.FLICKERRANDOM); LightInternal = true; UpdateLightType(); LightVavoom = (LightType == LightType.VAVOOM); }
public LightData(LightDef d, string cls) { LightDef = d; LightClass = cls; LightDefNum = GetLightDefNum(LightDef); LightDefClass = GetLightDefClass(LightDef); LightDefModifier = GetLightDefModifier(LightDef); LightDefRenderStyle = GetLightDefRenderStyle(LightDef); LightNum = LightDefNum.DoomEdNums[Array.IndexOf(LightDefClass.Classes, cls)]; if (LightDefModifier != null) { LightModifier = LightDefModifier.Modifiers[Array.IndexOf(LightDefClass.Classes, cls)]; } else { LightModifier = LightModifier.NORMAL; } if (LightDefRenderStyle != null) { LightRenderStyle = LightDefRenderStyle.RenderStyle; } else { LightRenderStyle = LightRenderStyle.NONE; } LightAnimated = (LightModifier == LightModifier.PULSE || LightModifier == LightModifier.FLICKER || LightModifier == LightModifier.FLICKERRANDOM); LightInternal = true; LightVavoom = (LightDef == LightDef.VAVOOM_GENERIC || LightDef == LightDef.VAVOOM_COLORED); UpdateLightType(); LightVavoom = (LightType == LightType.VAVOOM); }
public static LightDefRenderStyle GetLightDefRenderStyle(LightDef d) { FieldInfo fi = typeof(LightDef).GetField(d.ToString()); LightDefRenderStyle[] attrs = (LightDefRenderStyle[])fi.GetCustomAttributes(typeof(LightDefRenderStyle), false); if (attrs.Length != 0) { return(attrs[0]); } return(null); }