public bool Initialize(MapFile mf, EngineType et, List<string> customRulesININames, List<string> customArtININames) { if (et == EngineType.AutoDetect) { Logger.Fatal("Engine type needs to be known by now!"); return false; } Engine = et; TheaterType = Theater.TheaterTypeFromString(mf.ReadString("Map", "Theater")); FullSize = mf.FullSize; LocalSize = mf.LocalSize; _tiles = new TileLayer(FullSize.Size); LoadAllObjects(mf); if (!IgnoreLighting) _lighting = mf.Lighting; else _lighting = new Lighting(); _wayPoints.AddRange(mf.Waypoints); if (!LoadInis(customRulesININames, customArtININames)) { Logger.Fatal("Ini files couldn't be loaded"); return false; } Logger.Info("Overriding rules.ini with map INI entries"); _rules.MergeWith(mf); return true; }
public void ApplyLighting(Lighting l, int level = 0, bool applyTints = true) { _ambientMult = (l.Ambient + l.Ground) + l.Level * level; if (applyTints) { _redMult = l.Red; _greenMult = l.Green; _blueMult = l.Blue; } }
public void Initialize() { var map = GetSection("Map"); string[] size = map.ReadString("Size").Split(','); FullSize = new Rectangle(int.Parse(size[0]), int.Parse(size[1]), int.Parse(size[2]), int.Parse(size[3])); Tiles = new TileLayer(FullSize.Width, FullSize.Height); size = map.ReadString("LocalSize").Split(','); LocalSize = new Rectangle(int.Parse(size[0]), int.Parse(size[1]), int.Parse(size[2]), int.Parse(size[3])); Logger.Info("Reading map"); Logger.Debug("Reading tiles"); ReadTiles(); Logger.Debug("Reading map overlay"); ReadOverlay(); Logger.Debug("Reading map terrain objects"); ReadTerrain(); Logger.Debug("Reading map smudge objects"); ReadSmudges(); Logger.Debug("Reading infantry on map"); ReadInfantry(); Logger.Debug("Reading vehicles on map"); ReadUnits(); Logger.Debug("Reading aircraft on map"); ReadAircraft(); Logger.Debug("Reading map structures"); ReadStructures(); Logger.Debug("Waypoints"); ReadWaypoints(); Lighting = new Lighting(GetOrCreateSection("Lighting")); }
void Initialize(IniFile.IniSection lamp, Lighting scenario) { logger.Trace("Loading LightSource {0} at ({1},{2})", lamp.Name, Tile); // Read and assume default values LightVisibility = lamp.ReadDouble("LightVisibility", 5000.0); LightIntensity = lamp.ReadDouble("LightIntensity", 0.0); LightRedTint = lamp.ReadDouble("LightRedTint", 1.0); LightGreenTint = lamp.ReadDouble("LightGreenTint", 1.0); LightBlueTint = lamp.ReadDouble("LightBlueTint", 1.0); this.scenario = scenario; }
public LightSource(IniFile.IniSection lamp, Lighting scenario) : base("nobody", lamp.Name, 0, 0) { Initialize(lamp, scenario); }