Example #1
0
        private ObjectDefTile[,] createSection(List <List <ObjectDefTile> > tiles)
        {
            //calculate width
            int width = 0;

            foreach (List <ObjectDefTile> row in tiles)
            {
                int thiswidth = countTiles(row);
                if (width < thiswidth)
                {
                    width = thiswidth;
                }
            }

            //allocate array
            ObjectDefTile[,] section = new ObjectDefTile[width, tiles.Count];
            for (int y = 0; y < tiles.Count; y++)
            {
                int x = 0;
                foreach (ObjectDefTile t in tiles[y])
                {
                    if (!t.controlTile)
                    {
                        section[x, y] = t;
                        x++;
                    }
                }
            }

            return(section);
        }
Example #2
0
 private void putTile(int[,] Dest, int x, int y, int width, int height, ObjectDefTile t, ref bool put)
 {
     if (x >= 0 && x < width)
     {
         if (y >= 0 && y < height)
         {
             put = true;
             if (t != null)
             {
                 Dest[x, y] = t.tileID;
             }
         }
     }
 }
Example #3
0
            public void load(ByteArrayInputStream inp)
            {
                tiles = new List <List <ObjectDefTile> >();
                List <ObjectDefTile> row = new List <ObjectDefTile>();

                while (true)
                {
                    ObjectDefTile t = new ObjectDefTile(inp, this.t);
                    if (t.lineBreak)
                    {
                        tiles.Add(row);
                        row = new List <ObjectDefTile>();
                    }
                    else if (t.objectEnd)
                    {
                        break;
                    }
                    else
                    {
                        row.Add(t);
                    }
                }
            }
Example #4
0
            public void load(ByteArrayInputStream inp)
            {
                tiles = new List<List<ObjectDefTile>>();
                List<ObjectDefTile> row = new List<ObjectDefTile>();

                while (true)
                {
                    ObjectDefTile t = new ObjectDefTile(inp, this.t);
                    if (t.lineBreak)
                    {
                        tiles.Add(row);
                        row = new List<ObjectDefTile>();
                    }
                    else if (t.objectEnd)
                        break;
                    else
                        row.Add(t);
                }
            }
Example #5
0
 private void putTile(int[,] Dest, int x, int y, int width, int height, ObjectDefTile t, ref bool put)
 {
     if (x >= 0 && x < width)
         if (y >= 0 && y < height)
         {
             put = true;
             if(t != null)
                 Dest[x, y] = t.tileID;
         }
 }
Example #6
0
 private void putArray(int[,] Dest, int xo, int yo, ObjectDefTile[,] block, int width, int height, ref bool put)
 {
     for (int x = 0; x < block.GetLength(0); x++)
         for (int y = 0; y < block.GetLength(1); y++)
             putTile(Dest, x + xo, y + yo, width, height, block[x, y], ref put);
 }
Example #7
0
        private ObjectDefTile[,] createSection(List<List<ObjectDefTile>> tiles)
        {
            //calculate width
            int width = 0;
            foreach (List<ObjectDefTile> row in tiles)
            {
                int thiswidth = countTiles(row);
                if (width < thiswidth)
                    width = thiswidth;
            }

            //allocate array
            ObjectDefTile[,] section = new ObjectDefTile[width, tiles.Count];
            for (int y = 0; y < tiles.Count; y++)
            {
                int x = 0;
                foreach(ObjectDefTile t in tiles[y])
                    if (!t.controlTile)
                    {
                        section[x, y] = t;
                        x++;
                    }
            }

            return section;
        }