Exemplo n.º 1
0
 // main title tileset
 public Tileset(PaletteSet paletteSet, string type)
 {
     this.paletteSet = paletteSet;
     this.Width      = 16;
     this.Height     = 32;
     this.HeightL3   = 6;
     this.tilesize   = 2;
     this.Type       = TilesetType.Title;
     // Decompress data at offsets
     tilesets_bytes[0] = Bits.GetBytes(Model.TitleData, 0x0000, 0x1000);
     tilesets_bytes[1] = Bits.GetBytes(Model.TitleData, 0x1000, 0x1000);
     tilesets_bytes[2] = Bits.GetBytes(Model.TitleData, 0xBBE0, 0x300);
     // Create buffer the size of the combined graphicSets
     graphics   = Bits.GetBytes(Model.TitleData, 0x6C00, 0x4FE0);
     graphicsL3 = Bits.GetBytes(Model.TitleData, 0xBEA0, 0x1BC0);
     //
     tilesets_tiles[0] = new Tile[16 * 32];
     tilesets_tiles[1] = new Tile[16 * 32];
     tilesets_tiles[2] = new Tile[16 * 6];
     for (int i = 0; i < tilesets_tiles[0].Length; i++)
     {
         tilesets_tiles[0][i] = new Tile(i);
     }
     for (int i = 0; i < tilesets_tiles[1].Length; i++)
     {
         tilesets_tiles[1][i] = new Tile(i);
     }
     for (int i = 0; i < tilesets_tiles[2].Length; i++)
     {
         tilesets_tiles[2][i] = new Tile(i);
     }
     DrawTileset(tilesets_bytes[0], tilesets_tiles[0], graphics, 0x20);
     DrawTileset(tilesets_bytes[1], tilesets_tiles[1], graphics, 0x20);
     DrawTileset(tilesets_bytes[2], tilesets_tiles[2], graphicsL3, 0x20);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TileSet"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="imagePath">The image path.</param>
 public TileSet(TilesetType type, int id, string name, string imagePath)
 {
     _type            = type;
     _id              = id;
     _name            = name;
     _imagePath       = imagePath;
     _tileDefinitions = new Dictionary <int, TileDefinition>();
 }
Exemplo n.º 3
0
 public Dungeon(TilesetType tt, int height, int width)
 {
     do
     {
         Height = height;
         Width  = width;
         BoneGen bone = new BoneGen(XSSR.xsr);
         World       = BoneGen.WallWrap(bone.Generate(tt, Height, Width));
         PairedWorld = new char[Height, Width * 2];
         LogicWorld  = new int[Height, Width];
     } while (!PlaceBones());
 }
Exemplo n.º 4
0
 // level tileset
 public Tileset(LevelMap levelMap, PaletteSet paletteSet)
 {
     this.levelMap   = levelMap;   // grab the current LevelMap
     this.paletteSet = paletteSet; // grab the current Palette Set
     this.Width      = 16;
     this.Height     = 32;
     this.HeightL3   = 16;
     this.tilesize   = 2;
     this.Type       = TilesetType.Level;
     // set tileset byte arrays
     tilesets_bytes[0] = Model.Tilesets[levelMap.TilesetL1 + 0x20];
     tilesets_bytes[1] = Model.Tilesets[levelMap.TilesetL2 + 0x20];
     tilesets_bytes[2] = Model.Tilesets[levelMap.TilesetL3];
     // combine graphic sets into one array
     graphics = new byte[0x6000];
     Buffer.BlockCopy(Model.GraphicSets[levelMap.GraphicSetA + 0x48], 0, graphics, 0, 0x2000);
     Buffer.BlockCopy(Model.GraphicSets[levelMap.GraphicSetB + 0x48], 0, graphics, 0x2000, 0x1000);
     Buffer.BlockCopy(Model.GraphicSets[levelMap.GraphicSetC + 0x48], 0, graphics, 0x3000, 0x1000);
     Buffer.BlockCopy(Model.GraphicSets[levelMap.GraphicSetD + 0x48], 0, graphics, 0x4000, 0x1000);
     Buffer.BlockCopy(Model.GraphicSets[levelMap.GraphicSetE + 0x48], 0, graphics, 0x5000, 0x1000);
     if (levelMap.GraphicSetL3 != 0xFF)
     {
         graphicsL3 = Model.GraphicSets[levelMap.GraphicSetL3];
     }
     // initialize 16x16 tile arrays
     tilesets_tiles[0] = new Tile[Width * Height];
     tilesets_tiles[1] = new Tile[Width * Height];
     if (levelMap.GraphicSetL3 != 0xFF)
     {
         tilesets_tiles[2] = new Tile[Width * HeightL3];
     }
     for (int l = 0; l < 3; l++)
     {
         if (tilesets_tiles[l] == null)
         {
             continue;
         }
         for (int i = 0; i < tilesets_tiles[l].Length; i++)
         {
             tilesets_tiles[l][i] = new Tile(i);
         }
     }
     // draw all 16x16 tiles
     DrawTileset(tilesets_bytes[0], tilesets_tiles[0], graphics, 0x20);
     DrawTileset(tilesets_bytes[1], tilesets_tiles[1], graphics, 0x20);
     if (levelMap.GraphicSetL3 != 0xFF)
     {
         DrawTileset(tilesets_bytes[2], tilesets_tiles[2], graphicsL3, 0x10);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="GeometryTileLayer" /> class.
        /// </summary>
        /// <param name="map">The map which will contain the layer.</param>
        protected GeometryTileLayer(TilesetType type, Map map)
        {
            if (map == null)
            {
                throw new ArgumentNullException(nameof(map));
            }

            _type     = type;
            _map      = map;
            _tileDict = new Dictionary <ulong, GeometryTile>();
            _tileBits = new bool[map.Width * map.Height];

            HorizontalScrollMultipler = VerticalScrollMultipler = 1.0f;
            HorizontalOffset          = VerticalOffset = 0.0f;
        }
Exemplo n.º 6
0
 // minecart M7 tileset
 public Tileset(PaletteSet paletteSet)
 {
     this.paletteSet = paletteSet; // grab the current Palette Set
     this.Width      = 16;
     this.Height     = 16;
     this.tilesize   = 1;
     this.Type       = TilesetType.Mode7;
     //
     subtile_bytes = Model.MinecartM7TilesetSubtiles;
     palette_bytes = Model.MinecartM7TilesetPalettes;
     graphics      = Model.MinecartM7Graphics;
     // Create our layers for the tilesets (256x512)
     Tileset_tiles = new Tile[Width * Height];
     for (int i = 0; i < Tileset_tiles.Length; i++)
     {
         Tileset_tiles[i] = new Tile(i);
     }
     DrawTileset(subtile_bytes, Tileset_tiles, graphics, 0x20);
 }
Exemplo n.º 7
0
        // constructors
        // default tileset
        public Tileset(byte[] tileset_Bytes, byte[] graphics, PaletteSet paletteSet, int width, int height, TilesetType type)
        {
            this.paletteSet    = paletteSet;
            this.Tileset_bytes = tileset_Bytes;
            this.Width         = width;
            this.Height        = height;
            this.tilesize      = 2;
            this.Type          = type;
            //
            this.graphics = graphics;
            //
            Tileset_tiles = new Tile[Width * Height];
            for (int i = 0; i < Tileset_tiles.Length; i++)
            {
                Tileset_tiles[i] = new Tile(i);
            }
            byte format = (byte)(type != TilesetType.Opening ? 0x20 : 0x10);

            DrawTileset(Tileset_bytes, Tileset_tiles, graphics, format);
            this.tilesets_bytes[0] = this.Tileset_bytes;
            this.tilesets_tiles[0] = this.Tileset_tiles;
        }
Exemplo n.º 8
0
 // Title screen, Minecart M7
 public Tileset(PaletteSet paletteSet, TilesetType type)
 {
     this.Type = type;
     if (this.Type == TilesetType.Title)
     {
         this.Width    = 16;
         this.Height   = 32;
         this.HeightL3 = 6;
         this.tileSize = 2;
     }
     if (this.Type == TilesetType.Mode7)
     {
         this.Width    = 16;
         this.Height   = 16;
         this.tileSize = 1;
     }
     //
     this.PaletteSet = paletteSet;
     InitializeGraphics();
     InitializeTilesetBytes();
     InitializeTilesetTiles();
     BuildTilesetTiles();
 }
Exemplo n.º 9
0
        /// <summary>
        /// The main way of generating dungeons with BoneGen. Consider using BoneGen.WallWrap
        /// (a static method) to surround the edges with walls.
        /// </summary>
        /// <param name="tt">A TilesetType enum; try lots of these out to see how they look.</param>
        /// <param name="h">Height of the dungeon to generate in chars.</param>
        /// <param name="w">Width of the dungeon to generate in chars.</param>
        /// <returns>A row-major char[,] with h rows and w columns; it will be filled with '#' for walls and '.' for floors.</returns>
        public char[,] Generate(TilesetType tt, int h, int w)
        {
            Tileset ts = JsonConvert.DeserializeObject <Tileset>(new StreamReader(jsonStreams[(int)tt]).ReadToEnd());

            return(Generate(ts, h, w));
        }
Exemplo n.º 10
0
 /// <summary>
 /// The main way of generating dungeons with BoneGen. Consider using BoneGen.WallWrap
 /// (a static method) to surround the edges with walls.
 /// </summary>
 /// <param name="tt">A TilesetType enum; try lots of these out to see how they look.</param>
 /// <param name="h">Height of the dungeon to generate in chars.</param>
 /// <param name="w">Width of the dungeon to generate in chars.</param>
 /// <returns>A row-major char[,] with h rows and w columns; it will be filled with '#' for walls and '.' for floors.</returns>
 public char[,] Generate(TilesetType tt, int h, int w)
 {
     return(Generate(tilesets[((int)tt)], h, w));
 }
Exemplo n.º 11
0
 // Default
 public Tileset(byte[] tileset_bytes, byte[] graphics, PaletteSet paletteSet, int width, int height, TilesetType type)
 {
     this.Type     = type;
     this.Width    = width;
     this.Height   = height;
     this.tileSize = 2;
     //
     this.Graphics          = graphics;
     this.PaletteSet        = paletteSet;
     this.Tilesets_bytes    = new byte[3][];
     this.Tilesets_bytes[0] = tileset_bytes;
     //
     InitializeTilesetTiles();
     BuildTilesetTiles();
 }
	public Tileset getTileset(TilesetType t) {
		return tilesetDictionary[(int)t];
	}