Ejemplo n.º 1
0
        public bool Initialize()
        {
            Logger.Info("Initializing theater of type {0}", _theaterType);

            if (!ModConfig.SetActiveTheater(_theaterType))
            {
                return(false);
            }
            Active = this;

            // load palettes and additional mix files for this theater
            _palettes             = new PaletteCollection();
            _palettes.IsoPalette  = new Palette(VFS.Open <PalFile>(ModConfig.ActiveTheater.IsoPaletteName));
            _palettes.OvlPalette  = new Palette(VFS.Open <PalFile>(ModConfig.ActiveTheater.OverlayPaletteName));
            _palettes.UnitPalette = new Palette(VFS.Open <PalFile>(ModConfig.ActiveTheater.UnitPaletteName), ModConfig.ActiveTheater.UnitPaletteName, true);

            foreach (string mix in ModConfig.ActiveTheater.Mixes)
            {
                VFS.Add(mix, CacheMethod.Cache);                 // we wish for these to be cached as they're gonna be hit often
            }
            _palettes.AnimPalette = new Palette(VFS.Open <PalFile>("anim.pal"));

            _animations = new ObjectCollection(CollectionType.Animation, _theaterType, _engine, _rules, _art,
                                               _rules.GetSection("Animations"), _palettes);

            _tileTypes = new TileCollection(CollectionType.Tiles, _theaterType, _engine, _rules, _art, ModConfig.ActiveTheater);

            _buildingTypes = new ObjectCollection(CollectionType.Building, _theaterType, _engine, _rules, _art,
                                                  _rules.GetSection("BuildingTypes"), _palettes);

            _aircraftTypes = new ObjectCollection(CollectionType.Aircraft, _theaterType, _engine, _rules, _art,
                                                  _rules.GetSection("AircraftTypes"), _palettes);

            _infantryTypes = new ObjectCollection(CollectionType.Infantry, _theaterType, _engine, _rules, _art,
                                                  _rules.GetSection("InfantryTypes"), _palettes);

            _overlayTypes = new ObjectCollection(CollectionType.Overlay, _theaterType, _engine, _rules, _art,
                                                 _rules.GetSection("OverlayTypes"), _palettes);

            _terrainTypes = new ObjectCollection(CollectionType.Terrain, _theaterType, _engine, _rules, _art,
                                                 _rules.GetSection("TerrainTypes"), _palettes);

            _smudgeTypes = new ObjectCollection(CollectionType.Smudge, _theaterType, _engine, _rules, _art,
                                                _rules.GetSection("SmudgeTypes"), _palettes);

            _vehicleTypes = new ObjectCollection(CollectionType.Vehicle, _theaterType, _engine, _rules, _art,
                                                 _rules.GetSection("VehicleTypes"), _palettes);

            _tileTypes.InitTilesets();
            _tileTypes.InitAnimations(_animations);

            return(true);
        }
Ejemplo n.º 2
0
        // Large-degree changes to make the lighting better mimic the way it is in the game.
        private void CreateLevelPalettes()
        {
            Logger.Info("Creating per-height palettes");
            PaletteCollection palettes = _theater.GetPalettes();

            for (int i = 0; i < 19; i++)
            {
                Palette isoHeight = palettes.IsoPalette.Clone();
                isoHeight.ApplyLighting(_lighting, i);
                isoHeight.IsShared = true;
                isoHeight.Name     = string.Format("{0} lvl.{1}", isoHeight.Name, i);
                _palettePerLevel.Add(isoHeight);
                _palettesToBeRecalculated.Add(isoHeight);
            }
        }
Ejemplo n.º 3
0
        public ObjectCollection(CollectionType type, TheaterType theater, EngineType engine, IniFile rules, IniFile art,
                                IniFile.IniSection objectsList, PaletteCollection palettes)
            : base(type, theater, engine, rules, art)
        {
            Palettes = palettes;
            if (engine >= EngineType.RedAlert2)
            {
                string fireNames = Rules.ReadString(Engine == EngineType.RedAlert2 ? "AudioVisual" : "General",
                                                    "DamageFireTypes", "FIRE01,FIRE02,FIRE03");
                FireNames = fireNames.Split(new[] { ',', '.' }, StringSplitOptions.RemoveEmptyEntries);
            }

            foreach (var entry in objectsList.OrderedEntries)
            {
                if (!string.IsNullOrEmpty(entry.Value))
                {
                    Logger.Trace("Loading object {0}.{1}", objectsList.Name, entry.Value);
                    AddObject(entry.Value);
                }
            }
        }