Example #1
0
        public void Undo_Sector_Rejoin(clsShadowSector Shadow_Sector_To_Rejoin)
        {
            int TileX = 0;
            int TileZ = 0;
            int StartX = 0;
            int StartZ = 0;
            int X = 0;
            int Y = 0;
            int LastTileX = 0;
            int LastTileZ = 0;

            StartX = Shadow_Sector_To_Rejoin.Num.X * Constants.SectorTileSize;
            StartZ = Shadow_Sector_To_Rejoin.Num.Y * Constants.SectorTileSize;
            LastTileX = Math.Min(Constants.SectorTileSize, Terrain.TileSize.X - StartX);
            LastTileZ = Math.Min(Constants.SectorTileSize, Terrain.TileSize.Y - StartZ);
            for ( Y = 0; Y <= LastTileZ; Y++ )
            {
                for ( X = 0; X <= LastTileX; X++ )
                {
                    TileX = StartX + X;
                    TileZ = StartZ + Y;
                    Terrain.Vertices[TileX, TileZ].Height = Shadow_Sector_To_Rejoin.Terrain.Vertices[X, Y].Height;
                    Terrain.Vertices[TileX, TileZ].Terrain = Shadow_Sector_To_Rejoin.Terrain.Vertices[X, Y].Terrain;
                }
            }
            for ( Y = 0; Y <= LastTileZ - 1; Y++ )
            {
                for ( X = 0; X <= LastTileX - 1; X++ )
                {
                    TileX = StartX + X;
                    TileZ = StartZ + Y;
                    Terrain.Tiles[TileX, TileZ].Copy(Shadow_Sector_To_Rejoin.Terrain.Tiles[X, Y]);
                }
            }
            for ( Y = 0; Y <= LastTileZ; Y++ )
            {
                for ( X = 0; X <= LastTileX - 1; X++ )
                {
                    TileX = StartX + X;
                    TileZ = StartZ + Y;
                    Terrain.SideH[TileX, TileZ].Road = Shadow_Sector_To_Rejoin.Terrain.SideH[X, Y].Road;
                }
            }
            for ( Y = 0; Y <= LastTileZ - 1; Y++ )
            {
                for ( X = 0; X <= LastTileX; X++ )
                {
                    TileX = StartX + X;
                    TileZ = StartZ + Y;
                    Terrain.SideV[TileX, TileZ].Road = Shadow_Sector_To_Rejoin.Terrain.SideV[X, Y].Road;
                }
            }
        }
Example #2
0
        public void ShadowSector_Create(sXY_int SectorNum)
        {
            int TileX = 0;
            int TileY = 0;
            int StartX = 0;
            int StartY = 0;
            int X = 0;
            int Y = 0;
            clsShadowSector Sector = default(clsShadowSector);
            int LastTileX = 0;
            int LastTileY = 0;

            Sector = new clsShadowSector();
            ShadowSectors[SectorNum.X, SectorNum.Y] = Sector;
            Sector.Num = SectorNum;
            StartX = SectorNum.X * Constants.SectorTileSize;
            StartY = SectorNum.Y * Constants.SectorTileSize;
            LastTileX = Math.Min(Constants.SectorTileSize, Terrain.TileSize.X - StartX);
            LastTileY = Math.Min(Constants.SectorTileSize, Terrain.TileSize.Y - StartY);
            for ( Y = 0; Y <= LastTileY; Y++ )
            {
                for ( X = 0; X <= LastTileX; X++ )
                {
                    TileX = StartX + X;
                    TileY = StartY + Y;
                    Sector.Terrain.Vertices[X, Y].Height = Terrain.Vertices[TileX, TileY].Height;
                    Sector.Terrain.Vertices[X, Y].Terrain = Terrain.Vertices[TileX, TileY].Terrain;
                }
            }
            for ( Y = 0; Y <= LastTileY - 1; Y++ )
            {
                for ( X = 0; X <= LastTileX - 1; X++ )
                {
                    TileX = StartX + X;
                    TileY = StartY + Y;
                    Sector.Terrain.Tiles[X, Y].Copy(Terrain.Tiles[TileX, TileY]);
                }
            }
            for ( Y = 0; Y <= LastTileY; Y++ )
            {
                for ( X = 0; X <= LastTileX - 1; X++ )
                {
                    TileX = StartX + X;
                    TileY = StartY + Y;
                    Sector.Terrain.SideH[X, Y].Road = Terrain.SideH[TileX, TileY].Road;
                }
            }
            for ( Y = 0; Y <= LastTileY - 1; Y++ )
            {
                for ( X = 0; X <= LastTileX; X++ )
                {
                    TileX = StartX + X;
                    TileY = StartY + Y;
                    Sector.Terrain.SideV[X, Y].Road = Terrain.SideV[TileX, TileY].Road;
                }
            }
        }