public Band(StarSystem parent, Section section) { if (parent == null) { throw new ArgumentNullException("parent"); } if (section == null) { throw new ArgumentNullException("section"); } this.parent = parent; foreach (Entry e in section) { switch (e.Name.ToLowerInvariant()) { case "zone": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (zoneName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } zoneName = e[0].ToString(); break; case "render_parts": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (RenderParts != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } RenderParts = e[0].ToInt32(); break; case "shape": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Shape != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Shape = e[0].ToString(); break; case "height": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Height != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Height = e[0].ToInt32(); break; case "offset_dist": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (OffsetDist != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } OffsetDist = e[0].ToInt32(); break; case "fade": //if (e.Count != 4) throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); if (Fade != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Fade = new List <float>(); foreach (IValue i in e) { Fade.Add(i.ToSingle()); } break; case "texture_aspect": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (TextureAspect != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } TextureAspect = e[0].ToSingle(); break; case "color_shift": if (e.Count != 3) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (ColorShift != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } ColorShift = new Vector3(e[0].ToSingle(), e[1].ToSingle(), e[2].ToSingle()); break; case "ambient_intensity": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (AmbientIntensity != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } AmbientIntensity = e[0].ToSingle(); break; case "cull_mode": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (CullMode != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } CullMode = e[0].ToInt32(); break; case "vert_increase": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (VertIncrease != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } VertIncrease = e[0].ToInt32(); break; default: throw new Exception("Invalid Entry in " + section.Name + ": " + e.Name); } } }
public AsteroidField(StarSystem parent, Section section, FreelancerData data) : base(parent, section, data) { Cube = new List <CubeAsteroid>(); DynamicAsteroids = new List <DynamicAsteroids>(); LootableZones = new List <LootableZone>(); foreach (Section s in ParseFile(data.Freelancer.DataPath + file, data.VFS)) { switch (s.Name.ToLowerInvariant()) { case "texturepanels": TexturePanels = new TexturePanelsRef(s, data); break; case "properties": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "flag": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } Properties.Add(e[0].ToString()); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; case "exclusion zones": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "exclusion": case "exclude": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } ExclusionZones.Add(new ExclusionZone(parent, e[0].ToString())); break; case "fog_far": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].FogFar = e[0].ToSingle(); break; case "zone_shell": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } break; case "shell_scalar": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].ShellScalar = e[0].ToSingle(); break; case "max_alpha": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].MaxAlpha = e[0].ToSingle(); break; case "color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].Color = new Color4(e[0].ToInt32() / 255f, e[0].ToInt32() / 255f, e[0].ToInt32() / 255f, 1f); break; case "exclusion_tint": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].Tint = new Color3f(e[0].ToInt32() / 255f, e[0].ToInt32() / 255f, e[0].ToInt32() / 255f); break; case "exclude_billboards": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].ExcludeBillboards = e[0].ToInt32(); break; case "exclude_dynamic_asteroids": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].ExcludeDynamicAsteroids = e[0].ToInt32(); break; case "empty_cube_frequency": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].EmptyCubeFrequency = e[0].ToSingle(); break; case "billboard_count": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].BillboardCount = e[0].ToInt32(); break; default: FLLog.Warning("Ini", "Invalid Entry in " + s.Name + ": " + e.Name); break; } } break; case "field": Field = new Field(s); break; case "cube": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "xaxis_rotation": Cube_RotationX = new Vector4(e[0].ToSingle(), e[1].ToSingle(), e[2].ToSingle(), e[3].ToSingle()); break; case "yaxis_rotation": Cube_RotationY = new Vector4(e[0].ToSingle(), e[1].ToSingle(), e[2].ToSingle(), e[3].ToSingle()); break; case "zaxis_rotation": Cube_RotationZ = new Vector4(e[0].ToSingle(), e[1].ToSingle(), e[2].ToSingle(), e[3].ToSingle()); break; case "asteroid": //if (e.Count < 7 || e.Count > 8) throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); Cube.Add(new CubeAsteroid(e)); break; } } break; case "band": Band = new Band(parent, s); break; case "exclusionband": ExclusionBand = new Band(parent, s); break; case "asteroidbillboards": AsteroidBillboards = new AsteroidBillboards(s); break; case "dynamicasteroids": DynamicAsteroids.Add(new DynamicAsteroids(s)); break; case "lootablezone": LootableZones.Add(new LootableZone(s)); break; default: throw new Exception("Invalid Section in " + file + ": " + s.Name); } } }
public SystemObject(UniverseIni universe, StarSystem system, Section section, FreelancerData freelancerIni) : base(section, freelancerIni) { if (universe == null) { throw new ArgumentNullException("universe"); } if (system == null) { throw new ArgumentNullException("system"); } if (section == null) { throw new ArgumentNullException("section"); } this.universe = universe; this.system = system; TradelaneSpaceName = new List <int>(); foreach (Entry e in section) { if (!parentEntry(e)) { switch (e.Name.ToLowerInvariant()) { case "ambient_color": case "ambient": if (e.Count != 3) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (AmbientColor != null) { FLLog.Warning("Ini", "Duplicate " + e.Name + " Entry in " + section.Name); } AmbientColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; case "archetype": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (archetypeName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } archetypeName = e[0].ToString(); break; case "star": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Star != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Star = e[0].ToString(); break; case "atmosphere_range": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (AtmosphereRange != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } AtmosphereRange = e[0].ToInt32(); break; case "burn_color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (BurnColor != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } BurnColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; case "base": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (baseName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } baseName = e[0].ToString(); break; case "msg_id_prefix": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (MsgIdPrefix != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } MsgIdPrefix = e[0].ToString(); break; case "jump_effect": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (JumpEffect != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } JumpEffect = e[0].ToString(); break; case "behavior": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Behavior != null && Behavior != e[0].ToString()) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Behavior = e[0].ToString(); break; case "difficulty_level": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (DifficultyLevel != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } DifficultyLevel = e[0].ToInt32(); break; case "goto": if (e.Count != 3) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Goto != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Goto = new JumpReference(e[0].ToString(), e[1].ToString(), e[2].ToString()); break; case "loadout": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (LoadoutName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } LoadoutName = e[0].ToString(); break; case "pilot": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Pilot != null && Pilot != e[0].ToString()) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Pilot = e[0].ToString(); break; case "dock_with": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (dockWithName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } dockWithName = e[0].ToString(); break; case "voice": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Voice != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Voice = e[0].ToString(); break; case "space_costume": if (e.Count < 1 /*|| e.Count > 3*/) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (SpaceCostume != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } SpaceCostume = new Costume(e[0].ToString(), e[1].ToString(), e.Count >= 3 ? e[2].ToString() : string.Empty, freelancerIni); break; case "faction": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (Faction != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } Faction = e[0].ToString(); break; case "prev_ring": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (PrevRing != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } PrevRing = e[0].ToString(); break; case "next_ring": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (nextRingName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } nextRingName = e[0].ToString(); break; case "tradelane_space_name": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } TradelaneSpaceName.Add(e[0].ToInt32()); break; case "parent": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (parentName != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } parentName = e[0].ToString(); break; case "info_card_ids": case "info_card": case "info_ids": if (e.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } if (InfoCardIds != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); } InfoCardIds = e[0].ToInt32(); break; case "ring": if (e.Count != 2) { throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count); } //if ( != null) throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name); //TODO break; case "260800": // Strange error break; case "rot": FLLog.Warning("SystemObject", "unimplemented: rot"); break; default: throw new Exception("Invalid Entry in " + section.Name + ": " + e.Name); } } } }
public Nebula(StarSystem parent, Section section, FreelancerData data) : base(parent, section, data) { ExteriorShape = new List <string>(); NebulaLights = new List <NebulaLight>(); foreach (Section s in ParseFile(data.Freelancer.DataPath + file, data.VFS)) { switch (s.Name.ToLowerInvariant()) { case "texturepanels": TexturePanels = new TexturePanelsRef(s, data); break; case "properties": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "flag": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } Properties.Add(e[0].ToString()); break; default: FLLog.Warning("Ini", "Invalid Entry in " + s.Name + ": " + e.Name); break; } } break; case "fog": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "fog_enabled": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (FogEnabled != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } FogEnabled = e[0].ToInt32(); break; case "near": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (FogNear != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } FogNear = e[0].ToInt32(); break; case "distance": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (FogDistance != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } FogDistance = e[0].ToInt32(); break; case "color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (FogColor != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } FogColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; case "opacity": FLLog.Warning("Nebula", "unimplemented fog opacity"); break; case "max_alpha": FLLog.Warning("Nebula", "unimplemented max alpha"); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; case "exclusion zones": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "exclusion": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } ExclusionZones.Add(new ExclusionZone(parent, e[0].ToString())); break; case "fog_far": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].FogFar = e[0].ToSingle(); break; case "fog_near": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].FogNear = e[0].ToSingle(); break; case "zone_shell": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].ZoneShellPath = e[0].ToString(); break; case "shell_scalar": //if (e.Count != 1) throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].ShellScalar = e[0].ToSingle(); break; case "max_alpha": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].MaxAlpha = e[0].ToSingle(); break; case "color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].Color = new Color4(e[0].ToInt32() / 255f, e[0].ToInt32() / 255f, e[0].ToInt32() / 255f, 1f); break; case "exclusion_tint": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExclusionZones.Count == 0) { throw new Exception(e.Name + " before exclusion"); } ExclusionZones[ExclusionZones.Count - 1].Tint = new Color3f(e[0].ToInt32() / 255f, e[0].ToInt32() / 255f, e[0].ToInt32() / 255f); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; case "exterior": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "shape": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } ExteriorShape.Add(e[0].ToString()); break; case "shape_weights": //if (e.Count != 4) throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); if (ExteriorShapeWeights != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorShapeWeights = new List <int>(); foreach (IValue i in e) { ExteriorShapeWeights.Add(i.ToInt32()); } break; case "fill_shape": if (e.Count == 0) { FLLog.Warning("Nebula", "empty fill_shape in " + file); break; } if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorFillShape != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorFillShape = e[0].ToString(); break; case "plane_slices": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorPlaneSlices != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorPlaneSlices = e[0].ToInt32(); break; case "bit_radius": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorBitRadius != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorBitRadius = e[0].ToInt32(); break; case "bit_radius_random_variation": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorBitRadiusRandomVariation != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorBitRadiusRandomVariation = e[0].ToSingle(); break; case "min_bits": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorMinBits != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorMinBits = e[0].ToInt32(); break; case "max_bits": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorMaxBits != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorMaxBits = e[0].ToInt32(); break; case "move_bit_percent": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorMoveBitPercent != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorMoveBitPercent = e[0].ToSingle(); break; case "equator_bias": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorEquatorBias != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorEquatorBias = e[0].ToSingle(); break; case "color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (ExteriorColor != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } ExteriorColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; case "opacity": FLLog.Warning("Nebula", "Exterior opacity not implemented"); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; case "nebulalight": NebulaLights.Add(new NebulaLight(s)); break; case "clouds": if (CloudsMaxDistance != null) { FLLog.Warning("Ini", "Multiple [Clouds] in Nebula " + ZoneName); break; } foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "max_distance": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsMaxDistance != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsMaxDistance = e[0].ToInt32(); break; case "puff_count": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffCount != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffCount = e[0].ToInt32(); break; case "puff_radius": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffRadius != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffRadius = e[0].ToInt32(); break; case "puff_cloud_size": FLLog.Warning("Nebula", "puff_cloud_size unimplemented"); break; case "puff_colora": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffColorA != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffColorA = new Color3f(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f); break; case "puff_colorb": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffColorB != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffColorB = new Color3f(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f); break; case "puff_max_alpha": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffMaxAlpha != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffMaxAlpha = e[0].ToSingle(); break; case "puff_shape": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffShape == null) { CloudsPuffShape = new List <string>(); } CloudsPuffShape.Add(e[0].ToString()); break; case "puff_weights": if (e.Count != 4) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffWeights != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffWeights = new List <int>(); foreach (IValue i in e) { CloudsPuffWeights.Add(i.ToInt32()); } break; case "puff_drift": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsPuffDrift != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsPuffDrift = e[0].ToSingle(); break; case "near_fade_distance": if (e.Count != 2) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsNearFadeDistance != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsNearFadeDistance = new Vector2(e[0].ToSingle(), e[1].ToSingle()); break; case "lightning_intensity": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsLightningIntensity != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsLightningIntensity = e[0].ToSingle(); break; case "lightning_color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsLightningColor != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsLightningColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; case "lightning_gap": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsLightningGap != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsLightningGap = e[0].ToSingle(); break; case "lightning_duration": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (CloudsLightningDuration != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } CloudsLightningDuration = e[0].ToSingle(); break; case "disable_clouds": FLLog.Warning("Nebula", "disable_clouds not implemented"); break; case "zwrite_clouds": FLLog.Warning("Nebula", "disable_clouds not implemented"); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; case "backgroundlightning": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "duration": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (BackgroundLightningDuration != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } BackgroundLightningDuration = e[0].ToSingle(); break; case "gap": if (e.Count != 1) { FLLog.Warning("Ini", "Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (BackgroundLightningGap != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } BackgroundLightningGap = e[0].ToSingle(); break; case "color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (BackgroundLightningColor != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } BackgroundLightningColor = BackgroundLightningColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; case "dynamiclightning": foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "gap": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (DynamicLightningGap != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } DynamicLightningGap = e[0].ToSingle(); break; case "duration": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (DynamicLightningDuration != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } DynamicLightningDuration = e[0].ToSingle(); break; case "color": if (e.Count != 3) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (DynamicLightningColor != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } DynamicLightningColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f); break; case "ambient_intensity": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (DynamicLightningAmbientIntensity != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } DynamicLightningAmbientIntensity = e[0].ToSingle(); break; case "intensity_increase": if (e.Count != 1) { throw new Exception("Invalid number of values in " + s.Name + " Entry " + e.Name + ": " + e.Count); } if (DynamicLightningIntensityIncrease != null) { throw new Exception("Duplicate " + e.Name + " Entry in " + s.Name); } DynamicLightningIntensityIncrease = e[0].ToInt32(); break; default: throw new Exception("Invalid Entry in " + s.Name + ": " + e.Name); } } break; default: throw new Exception("Invalid Section in " + file + ": " + s.Name); } } }