예제 #1
0
        public static void gotSection(File f, int offs, int size)
        {
            uint magic = f.getUintAt(offs);

            if (magic == 0x504C5454) //PLTT
                new PaletteViewer(new InlineFile(f, offs + 0x18, size - 0x18, f.name)).Show();
            else if (magic == 0x43484152) //CHAR
            {
                LevelChooser.showImgMgr();
                int tileWidth = f.getUshortAt(offs + 0xA);
                if (tileWidth == 0xFFFF)
                    tileWidth = 8;
                LevelChooser.imgMgr.m.addImage(new Image2D(new InlineFile(f, offs + 0x20, size - 0x20, f.name), 8*tileWidth, true, false));
            }
            else if (magic == 0x5343524E) //SCRN
            {
                if (LevelChooser.imgMgr == null) return;
                Image2D img = LevelChooser.imgMgr.m.getSelectedImage();
                Palette[] pals = LevelChooser.imgMgr.m.getPalettes();
                if (img == null) return;
                if (pals == null) return;
                if (pals.Length == 0) return;
                InlineFile ff = new InlineFile(f, offs + 0x14, size - 0x14, f.name);
                Tilemap t = new Tilemap(ff, 32, img, pals, 0, 0);
                new TilemapEditorWindow(t).Show();
            }
            else
                Console.WriteLine(String.Format("Unknown magic: {0:X8}", magic));
        }
예제 #2
0
        public void load(Tilemap t)
        {
            this.t = t;
            t.render();

            this.tileSize = 8;
            this.bufferHeight = t.height;
            this.bufferWidth = t.width;

            this.Size = this.MinimumSize = new Size(bufferWidth * tileSize, bufferHeight * tileSize);

            undobutton.Click += new EventHandler(Undo);
            redobutton.Click += new EventHandler(Redo);
        }
예제 #3
0
 public void reRender(Tilemap t)
 {
     t.reRender(x, y, width, height);
 }
예제 #4
0
 public void setTiles(Tilemap.Tile[,] tiles, Tilemap.Tile[,] allTiles)
 {
     for (int yy = 0; yy < height; yy++)
         for (int xx = 0; xx < width; xx++)
             allTiles[xx + x, yy + y] = tiles[xx, yy];
 }
예제 #5
0
 public Tilemap.Tile[,] getTiles(Tilemap.Tile[,] allTiles)
 {
     Tilemap.Tile[,] tiles = new Tilemap.Tile[width, height];
     for (int yy = 0; yy < height; yy++)
         for (int xx = 0; xx < width; xx++)
             tiles[xx, yy] = allTiles[xx + x, yy + y];
     return tiles;
 }
예제 #6
0
 public void Redo(Tilemap.Tile[,] allTiles)
 {
     setTiles(newTiles, allTiles);
 }
예제 #7
0
 public void Undo(Tilemap.Tile[,] allTiles)
 {
     setTiles(oldTiles, allTiles);
 }
예제 #8
0
 public void LoadNewTiles(Tilemap.Tile[,] allTiles)
 {
     newTiles = getTiles(allTiles);
 }
예제 #9
0
 public TilemapUndoEntry(Tilemap.Tile[,] allTiles, int x, int y, int width, int height)
 {
     this.x = x;
     this.y = y;
     this.width = width;
     this.height = height;
     oldTiles = getTiles(allTiles);
 }
예제 #10
0
        private Bitmap RenderBackground(File GFXFile, File PalFile, File LayoutFile, int offs, int palOffs)
        {
            LayoutFile = new LZFile(LayoutFile, LZFile.CompressionType.LZ);
            PalFile = new LZFile(PalFile, LZFile.CompressionType.LZ);

            Image2D i = new Image2D(GFXFile, 256, false);
            Palette pal1 = new FilePalette(new InlineFile(PalFile, 0, 512, PalFile.name));
            Palette pal2 = new FilePalette(new InlineFile(PalFile, 512, 512, PalFile.name));

            Tilemap t = new Tilemap(LayoutFile, 64, i, new Palette[] { pal1, pal2 }, offs, palOffs);
            t.render();
            return t.buffer;
        }
예제 #11
0
        private Tilemap getTilemap()
        {
            getFiles();
            if (GFXFile == null) return null;
            if (PalFile == null) return null;
            if (LayoutFile == null) return null;

            LayoutFile = new LZFile(LayoutFile, LZFile.CompressionType.LZ);

            Image2D i = new Image2D(GFXFile, 256, false);
            LZFile PalFileLz = new LZFile(PalFile, LZFile.CompressionType.LZ);
            Palette pal1 = new FilePalette(new InlineFile(PalFileLz, 0, 512, PalFile.name));
            Palette pal2 = new FilePalette(new InlineFile(PalFileLz, 512, 512, PalFile.name));

            Tilemap t = new Tilemap(LayoutFile, 64, i, new Palette[] { pal1, pal2 }, bg.topLayer ? 256 : 576, bg.topLayer ? 8 : 10);
            return t;
        }
예제 #12
0
 public void setTiles(Tilemap.Tile[,] tiles, Tilemap.Tile[,] allTiles)
 {
     for (int yy = 0; yy < height; yy++)
         for (int xx = 0; xx < width; xx++)
         {
             Console.Out.WriteLine(allTiles[xx + x, yy + y].tileNum.ToString() + "; " + tiles[xx, yy].tileNum.ToString());
             allTiles[xx + x, yy + y] = tiles[xx, yy];
             Console.Out.WriteLine(allTiles[xx + x, yy + y].tileNum.ToString() + "; " + tiles[xx, yy].tileNum.ToString());
         }
 }