Exemplo n.º 1
0
 void Core_LoadPaletteAndSmallTileset()
 {
     try
     {
         MapTileFrame frame   = CurrentTileAnim.Frames[TileAnim_Frame_ByteBox.Value];
         byte[]       tileset = Core.ReadData(Tileset1_PointerBox.Value, 0);
         byte[]       palette = Core.ReadData(Palette_PointerBox.Value, Map.PALETTES * Palette.LENGTH);
         if (ViewAnimation_CheckBox.Checked)
         {
             byte[] change;
             if (frame.IsPaletteAnimation())
             {
                 change = TileAnim_PaletteBox.Colors.ToBytes(false);
                 Array.Copy(change, 0, palette, TileAnim_Offset_ByteBox.Value * 2, change.Length);
             }
             else
             {
                 change = Core.ReadData(frame.FrameData, frame.Length * 8 * Tile.LENGTH);
                 Array.Copy(change, 0, tileset, 32 * 8 * Tile.LENGTH, change.Length);
             }
         }
         Tileset_PaletteBox.Load(new GBA.Palette(palette, Map.PALETTES * Palette.MAX));
         Tileset_ImageBox.Load(new Tileset(tileset).ToImage(32, 32,
                                                            palette.GetBytes((uint)(ViewPalette_ByteBox.Value * Palette.LENGTH), Palette.LENGTH)));
     }
     catch (Exception ex)
     {
         Program.ShowError("Could not load the palette.", ex);
         CurrentTileAnim = null;
     }
 }
Exemplo n.º 2
0
        void Core_LoadTileAnim()
        {
            try
            {
                TileAnim_PointerBox.ValueChanged -= TileAnim_PointerBox_ValueChanged;
                TileAnim_PointerBox.Value         = Core.ReadPointer(Core.GetPointer("Map Data Array") + TileAnim_ArrayBox.Value * 4);
                TileAnim_PointerBox.ValueChanged -= TileAnim_PointerBox_ValueChanged;

                CurrentTileAnim = new MapTileAnim(TileAnim_PointerBox.Value);

                TileAnim_Frame_ByteBox.Value   = 0;
                TileAnim_Frame_ByteBox.Maximum = CurrentTileAnim.Frames.Count - 2;
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not load the tile animation.", ex);
                CurrentTileAnim = null;
            }
        }