Example #1
0
        private static Bitmap GetTileBitmap(int x, int y)
        {
            Map.Tile mapTile = activeMap[x, y];
            if (mapTile == null || mapTile.TileNumber == 0)
            {
                return(null);
            }
            if (mapTile.TileNumber >= TileManager.Epf[0].max)
            {
                return(null);
            }

            return(ImageRenderer.Singleton.GetTileBitmap(mapTile.TileNumber));
        }
Example #2
0
        private static Bitmap GetObjectBitmap(int x, int y)
        {
            Bitmap bitmap = null;

            for (int i = 0; i < 10; i++)
            {
                if ((i + y) >= activeMap.Size.Height)
                {
                    break;
                }

                Map.Tile mapTile = activeMap[x, y + i];
                if (mapTile == null)
                {
                    continue;
                }

                int objectNumber = mapTile.ObjectNumber - 1;
                if (objectNumber < 0 || objectNumber >= TileManager.ObjectInfos.Length)
                {
                    continue;
                }

                int objectHeight = TileManager.ObjectInfos[objectNumber].Indices.Length;
                if (objectHeight <= i)
                {
                    continue;
                }

                int tile = TileManager.ObjectInfos[objectNumber].Indices[objectHeight - i - 1];
                if (bitmap == null)
                {
                    bitmap = ImageRenderer.Singleton.GetObjectBitmap(tile);
                }
                else
                {
                    Graphics graphics  = Graphics.FromImage(bitmap);
                    Bitmap   tmpBitmap = ImageRenderer.Singleton.GetObjectBitmap(tile);
                    graphics.DrawImage(tmpBitmap, 0, 0);
                    tmpBitmap.Dispose();
                    graphics.Dispose();
                }
            }

            return(bitmap);
        }