GetTileCollection() public method

public GetTileCollection ( ) : CNCMaps.Engine.Game.TileCollection
return CNCMaps.Engine.Game.TileCollection
Esempio n. 1
0
        public void RedrawOreAndGems()
        {
            var tileCollection = _theater.GetTileCollection();
            var checkFunc      = new Func <OverlayObject, bool>(delegate(OverlayObject ovl) {
                return(SpecialOverlays.GetOverlayTibType(ovl, Engine) != OverlayTibType.NotSpecial);
            });

            // first redraw all required tiles (zigzag method)
            for (int y = 0; y < FullSize.Height; y++)
            {
                for (int x = FullSize.Width * 2 - 2; x >= 0; x -= 2)
                {
                    if (_tiles[x, y].AllObjects.OfType <OverlayObject>().Any(checkFunc))
                    {
                        _theater.Draw(_tiles.GetTile(x, y), _drawingSurface);
                    }
                }
                for (int x = FullSize.Width * 2 - 3; x >= 0; x -= 2)
                {
                    if (_tiles[x, y].AllObjects.OfType <OverlayObject>().Any(checkFunc))
                    {
                        _theater.Draw(_tiles.GetTile(x, y), _drawingSurface);
                    }
                }
            }
            for (int y = 0; y < FullSize.Height; y++)
            {
                for (int x = FullSize.Width * 2 - 2; x >= 0; x -= 2)
                {
                    if (_tiles[x, y].AllObjects.OfType <OverlayObject>().Any(checkFunc))
                    {
                        List <GameObject> objs = GetObjectsAt(x, y);
                        foreach (GameObject o in objs)
                        {
                            _theater.Draw(o, _drawingSurface);
                        }
                    }
                }
                for (int x = FullSize.Width * 2 - 3; x >= 0; x -= 2)
                {
                    if (_tiles[x, y].AllObjects.OfType <OverlayObject>().Any(checkFunc))
                    {
                        List <GameObject> objs = GetObjectsAt(x, y);
                        foreach (GameObject o in objs)
                        {
                            _theater.Draw(o, _drawingSurface);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        // between LoadMap and LoadTheater, the VFS should be initialized
        public bool LoadTheater()
        {
            Drawable.TileWidth  = (ushort)TileWidth;
            Drawable.TileHeight = (ushort)TileHeight;

            _theater = new Theater(TheaterType, Engine, _rules, _art);
            if (!_theater.Initialize())
            {
                return(false);
            }

            // needs to be done before drawables are set
            Operations.RecalculateOreSpread(_overlayObjects, Engine);

            RemoveUnknownObjects();
            SetDrawables();

            LoadColors();
            if (Engine >= EngineType.RedAlert2)
            {
                LoadCountries();
            }
            LoadHouses();

            Operations.FixTiles(_tiles, _theater.GetTileCollection());
            if (Engine <= EngineType.Firestorm)
            {
                Operations.RecalculateVeinsSpread(_overlayObjects, _tiles);
            }

            CreateLevelPalettes();
            LoadPalettes();
            ApplyRemappables();
            if (!IgnoreLighting)
            {
                LoadLightSources();
                ApplyLightSources();
            }

            SetBaseTiles();             // requires .AnimationDrawable set on objects

            // first preparing all palettes as above, and only now recalculating them
            // could save a large amount of work in total
            RecalculatePalettes();

            return(true);
        }
Esempio n. 3
0
		// between LoadMap and LoadTheater, the VFS should be initialized
		public bool LoadTheater() {
			Drawable.TileWidth = (ushort)TileWidth;
			Drawable.TileHeight = (ushort)TileHeight;

			_theater = new Theater(TheaterType, Engine, _rules, _art);
			if (!_theater.Initialize())
				return false;

			// needs to be done before drawables are set
			if (!ModConfig.ActiveConfig.DisableOreRandomization)
				Operations.RecalculateOreSpread(_overlayObjects, Engine);

			RemoveUnknownObjects();
			SetDrawables();

			LoadColors();
			if (Engine >= EngineType.RedAlert2)
				LoadCountries();
			LoadHouses();

			Operations.FixTiles(_tiles, _theater.GetTileCollection());
			if (Engine <= EngineType.Firestorm)
				Operations.RecalculateVeinsSpread(_overlayObjects, _tiles);

			CreateLevelPalettes();
			LoadPalettes();
			ApplyRemappables();
			if (!IgnoreLighting) {
				LoadLightSources();
				ApplyLightSources();
			}

			SetBaseTiles(); // requires .AnimationDrawable set on objects

			// first preparing all palettes as above, and only now recalculating them 
			// could save a large amount of work in total
			RecalculatePalettes();

			return true;
		}