コード例 #1
0
        public MapSpriteEditor()
        {
            InitializeComponent();

            try
            {
                Idle_EntryArrayBox.Load("Map Sprite List.txt");
                Move_EntryArrayBox.Load("Class List.txt");
                CurrentIdle         = new StructFile("Map Sprite Idle Struct.txt");
                CurrentMove         = new StructFile("Map Sprite Move Struct.txt");
                CurrentIdle.Address = Core.GetPointer("Map Sprite Idle Array");
                CurrentMove.Address = Core.GetPointer("Map Sprite Move Array");

                PaletteArrayBox.Load("Map Sprite Palettes.txt");

                Idle_Size_ComboBox.DataSource = new KeyValuePair <string, byte>[3]
                {
                    new KeyValuePair <string, byte>("16x16", 0x00),
                    new KeyValuePair <string, byte>("16x32", 0x01),
                    new KeyValuePair <string, byte>("32x32", 0x02)
                };
                Idle_Size_ComboBox.ValueMember   = "Value";
                Idle_Size_ComboBox.DisplayMember = "Key";

                CurrentPalette = Core.ReadPalette(Core.CurrentROM.Address_MapSpritePalettes(), GBA.Palette.LENGTH);

                Test_PaletteBox.Load(CurrentPalette);
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not properly open the " + this.Text, ex);

                Core_CloseEditor(this, null);
            }
        }
コード例 #2
0
 public Background(
     int width, int height,
     GBA.Bitmap image,
     GBA.Palette palette,
     int paletteAmount,
     bool checkRedundantTiles)
     : base(width, height, image, palette, paletteAmount, checkRedundantTiles)
 {
 }
コード例 #3
0
        void Core_UpdateTestView()
        {
            try
            {
                GBA.Palette palette = new GBA.Palette(CurrentPortrait.Colors);
                palette[0] = palette[0].SetAlpha(true);
                for (int i = 1; i < palette.Count; i++)
                {
                    palette[i] = palette[i].SetAlpha(false);
                }   // force correct alpha on the palette (1st color transparent, all others opaque)
                GBA.TileMap tilemap = new TileMap(Portrait.Map_Test(IsGenericClassCard));

                TestPortrait = new SpriteSheet(tilemap.Width * 8, tilemap.Height * 8);

                if (!IsGenericClassCard)
                {
                    tilemap = new GBA.TileMap(GetTileMap_Mouth(
                                                  Test_Mouth_Smile_RadioButton.Checked,
                                                  Test_Mouth_TrackBar.Value));
                    TestPortrait.AddSprite(
                        new Sprite(palette,
                                   (Core.CurrentROM is FE6 || (Test_Mouth_Smile_RadioButton.Checked && Test_Mouth_TrackBar.Value == 0)) ?
                                   CurrentPortrait.Sprites[Portrait.MAIN].Sheet :
                                   CurrentPortrait.Sprites[Portrait.MOUTH].Sheet,
                                   tilemap),
                        (byte)Current["MouthX"] * 8,
                        (byte)Current["MouthY"] * 8);

                    tilemap = new GBA.TileMap(GetTileMap_Eyes(
                                                  EyesClosed_CheckBox.Checked,
                                                  Test_Blink_TrackBar.Value));
                    TestPortrait.AddSprite(
                        new Sprite(palette,
                                   CurrentPortrait.Sprites[Portrait.MAIN].Sheet,
                                   tilemap),
                        (byte)Current["BlinkX"] * 8,
                        (byte)Current["BlinkY"] * 8);
                }
                tilemap = new TileMap(Portrait.Map_Test(IsGenericClassCard));
                TestPortrait.AddSprite(
                    new Sprite(palette,
                               CurrentPortrait.Sprites[Portrait.MAIN].Sheet,
                               tilemap),
                    0, 0);

                Test_ImageBox.Load(TestPortrait);
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not load the portrait test view.", ex);
                Test_ImageBox.Reset();
            }
        }
コード例 #4
0
        void Core_LoadPalette()
        {
            try
            {
                CurrentPalette = Core.ReadPalette(CurrentPaletteAddress, GBA.Palette.LENGTH);

                Test_PaletteBox.Load(CurrentPalette);
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not load the palette.", ex);
                Test_PaletteBox.Reset();
            }
        }
コード例 #5
0
 void Core_LoadTestView()
 {
     try
     {
         GBA.Palette palette = new GBA.Palette(CurrentPalette);
         palette[0] = palette[0].SetAlpha(true);
         GBA.Tileset tileset = null;
         byte        size    = (byte)CurrentIdle["Size"];
         int         frame   = Test_TrackBar.Value * 16;
         GBA.TileMap tilemap = new TileMap(4, 4);
         if (Test_Idle.Checked)
         {
             tilemap.Map(MapSprite.Map_Test(frame, size));
             tileset = CurrentMapSprite.Sprites[MapSprite.IDLE].Sheet;
         }
         frame++;
         if (Test_MoveSide.Checked)
         {
             tilemap.Map(MapSprite.Map_Test(frame));
             tileset = CurrentMapSprite.Sprites[MapSprite.WALK].Sheet;
         }
         frame += 16 * 4;
         if (Test_MoveDown.Checked)
         {
             tilemap.Map(MapSprite.Map_Test(frame));
             tileset = CurrentMapSprite.Sprites[MapSprite.WALK].Sheet;
         }
         frame += 16 * 4;
         if (Test_MoveUp.Checked)
         {
             tilemap.Map(MapSprite.Map_Test(frame));
             tileset = CurrentMapSprite.Sprites[MapSprite.WALK].Sheet;
         }
         frame += 16 * 4;
         if (Test_Selected.Checked)
         {
             tilemap.Map(MapSprite.Map_Test(frame));
             tileset = CurrentMapSprite.Sprites[MapSprite.WALK].Sheet;
         }
         TestSprite = new GBA.Sprite(palette, tileset, tilemap);
         Test_ImageBox.Load(TestSprite);
     }
     catch (Exception ex)
     {
         Program.ShowError("Could not load the map sprite test image.", ex);
     }
 }
コード例 #6
0
        void Core_LoadTitleScreen_FE8(
            Palette bg_palette, Tileset bg_tileset, TSA_Array bg_tsa,
            Palette mg_palette, Tileset mg_tileset, TSA_Array mg_tsa,
            Palette fg_palette, Tileset fg_tileset)
        {
            GBA.Bitmap result;
            Palette    palette = Palette.Empty(256);

            for (int i = 0; i < bg_palette.Count; i++)
            {
                bg_palette[i] = bg_palette[i].SetAlpha(false);
                palette.Set(GBA.Palette.MAX * 15 + i, bg_palette[i]);
            }
            for (int i = 0; i < mg_palette.Count; i++)
            {
                palette.Set(GBA.Palette.MAX * 14 + i, mg_palette[i]);
            }
            for (int i = 0; i < fg_palette.Count; i++)
            {
                palette.Set(i, fg_palette[i]);
            }
            result        = new GBA.Bitmap(GBA.Screen.WIDTH, GBA.Screen.HEIGHT);
            result.Colors = palette;

            if (BG_CheckBox.Checked)
            {
                TSA_Image bg = new TSA_Image(bg_palette, bg_tileset, bg_tsa);
                for (int y = 0; y < bg.Height; y++)
                {
                    for (int x = 0; x < bg.Width; x++)
                    {
                        if (bg[x, y] != 0)
                        {
                            result[x, y] = GBA.Palette.MAX * 15 + bg[x, y];
                        }
                    }
                }
            }
            if (MG_CheckBox.Checked)
            {
                TSA_Image mg = new TSA_Image(mg_palette, mg_tileset, mg_tsa);
                for (int y = 0; y < mg.Height; y++)
                {
                    for (int x = 0; x < mg.Width; x++)
                    {
                        if (mg[x, y] != 0)
                        {
                            result[x, y] = GBA.Palette.MAX * 14 + mg[x, y];
                        }
                    }
                }
            }
            if (FG_CheckBox.Checked)
            {
                Palette[] palettes = Palette.Split(fg_palette, 8);
                GBA.Image fg;
                if (Core.CurrentROM.Version == GameVersion.JAP)
                {
                    // large 'FIRE EMBLEM' title logo
                    fg = fg_tileset.ToImage(32, 32, palettes[2].ToBytes(false));
                    Core_DrawLayer(result, fg, new Rectangle(0, 48, 240, 48), 0, 44);   // shadow
                    Core_DrawLayer(result, fg, new Rectangle(0, 0, 240, 48), 0, 39);    // logo
                    Core_DrawLayer(result, fg, new Rectangle(240, 0, 16, 16), 216, 39); // TM
                    // small 'FIRE EMBLEM' overhead
                    fg.Colors = palettes[1];
                    Core_DrawLayer(result, fg, new Rectangle(128, 104, 120, 16), 60, 26);
                    // 'THE SACRED STONES' subtitle/scroll thingy
                    fg.Colors = palettes[3];
                    Core_DrawLayer(result, fg, new Rectangle(0, 104, 128, 32), 56, 87);
                    // 'Press START'
                    fg.Colors = palettes[0];
                    Core_DrawLayer(result, fg, new Rectangle(128, 120, 80, 16), 80, 124);
                    // Nintendo & IS copyrights
                    fg.Colors = palettes[1];
                    Core_DrawLayer(result, fg, new Rectangle(0, 96, 240, 8), 16, 148);
                }
                else
                {
                    // large 'FIRE EMBLEM' title logo
                    fg = fg_tileset.ToImage(32, 32, palettes[2].ToBytes(false));
                    Core_DrawLayer(result, fg, new Rectangle(0, 32, 240, 32), 4, 53);   // shadow
                    Core_DrawLayer(result, fg, new Rectangle(0, 0, 240, 32), 4, 48);    // logo
                    Core_DrawLayer(result, fg, new Rectangle(240, 0, 16, 16), 220, 41); // TM
                    // 'THE SACRED STONES' subtitle/scroll thingy
                    fg.Colors = palettes[3];
                    Core_DrawLayer(result, fg, new Rectangle(0, 72, 208, 32), 16, 85);
                    // 'Press START'
                    fg.Colors = palettes[0];
                    Core_DrawLayer(result, fg, new Rectangle(208, 72, 48, 16), 72, 124);
                    Core_DrawLayer(result, fg, new Rectangle(208, 88, 48, 16), 120, 124);
                    // Nintendo & IS copyrights
                    fg.Colors = palettes[1];
                    Core_DrawLayer(result, fg, new Rectangle(0, 64, 240, 8), 4, 148);
                }
            }
            Current        = result;
            CurrentPalette = palette;
        }
コード例 #7
0
        void Core_LoadTitleScreen_FE7(
            Palette bg_palette, Tileset bg_tileset,
            Palette mg_palette, Tileset mg_tileset, TSA_Array mg_tsa,
            Palette fg_palette, Tileset fg_tileset)
        {
            GBA.Bitmap result;
            Palette    palette = Palette.Empty(256);

            for (int i = 0; i < bg_palette.Count; i++)
            {
                palette.Set(GBA.Palette.MAX * 15 + i, bg_palette[i]);
            }
            for (int i = 0; i < mg_palette.Count; i++)
            {
                palette.Set(GBA.Palette.MAX * 14 + i, mg_palette[i]);
            }
            for (int i = 0; i < fg_palette.Count; i++)
            {
                palette.Set(i, fg_palette[i]);
            }
            result        = new GBA.Bitmap(GBA.Screen.WIDTH, GBA.Screen.HEIGHT);
            result.Colors = palette;

            if (BG_CheckBox.Checked)
            {
                GBA.Image bg = bg_tileset.ToImage(GBA.Screen.W_TILES, GBA.Screen.H_TILES + 1, bg_palette.ToBytes(false));
                for (int y = 0; y < GBA.Screen.HEIGHT; y++)
                {
                    for (int x = 0; x < GBA.Screen.WIDTH; x++)
                    {
                        if (x < 8 && y < 8)
                        {
                            result[x, y] = GBA.Palette.MAX * 15 + bg[x, GBA.Screen.HEIGHT + y];
                        }
                        else
                        {
                            result[x, y] = GBA.Palette.MAX * 15 + bg[x, y];
                        }
                    }
                }
            }
            if (MG_CheckBox.Checked)
            {
                TSA_Image mg = new TSA_Image(mg_palette, mg_tileset, mg_tsa);
                for (int y = 0; y < mg.Height; y++)
                {
                    for (int x = 0; x < mg.Width; x++)
                    {
                        if (mg[x, y] != 0)
                        {
                            result[x, 8 + y] = GBA.Palette.MAX * 14 + mg[x, y];
                        }
                    }
                }
            }
            if (FG_CheckBox.Checked)
            {
                bool      jap      = (Core.CurrentROM.Version == GameVersion.JAP);
                bool      eur      = (Core.CurrentROM.Version == GameVersion.EUR);
                Palette[] palettes = Palette.Split(fg_palette, 8);
                GBA.Image fg;
                // durandal sword
                fg = fg_tileset.ToImage(32, 32, palettes[0].ToBytes(false));
                Core_DrawLayer(result, fg, new Rectangle(0, 0, 192, 112), 32, 16);
                // large 'FIRE EMBLEM' title
                fg.Colors = palettes[4];
                Core_DrawLayer(result, fg, new Rectangle(0, GBA.Screen.HEIGHT, GBA.Screen.WIDTH, 48), 2, jap ? 52 : 54);
                Core_DrawLayer(result, fg, new Rectangle(0, GBA.Screen.HEIGHT - 48, GBA.Screen.WIDTH, 48), 0, jap ? 48 : 52);
                // Nintendo & IS copyrights
                fg.Colors = palettes[2];
                Core_DrawLayer(result, fg, new Rectangle(0, GBA.Screen.WIDTH - 16, GBA.Screen.HEIGHT - 16, 8), eur ?   8 : 16, GBA.Screen.HEIGHT - 16);
                Core_DrawLayer(result, fg, new Rectangle(0, GBA.Screen.WIDTH - 8, GBA.Screen.HEIGHT - 64, 8), eur ? 136 : GBA.Screen.HEIGHT, GBA.Screen.HEIGHT - 16);
                // 'Press Start'
                fg.Colors = palettes[1];
                Core_DrawLayer(result, fg, new Rectangle(128, 208, 96, 16), jap ? 80 : 72, 120);
                if (jap)
                {   // japanese subtitle
                    fg.Colors = palettes[3];
                    Core_DrawLayer(result, fg, new Rectangle(144, 224, 112, 32), 64, 96);
                    // japanese 'FIRE EMBLEM' overhead
                    fg.Colors = palettes[2];
                    Core_DrawLayer(result, fg, new Rectangle(0, 208, 128, 16), 56, 40);
                }
            }
            Current        = result;
            CurrentPalette = palette;
        }
コード例 #8
0
        void Core_LoadTitleScreen_FE6(
            Palette mg_palette, Tileset mg_tileset,
            Tileset fg_tileset, TSA_Array mg_tsa,
            Palette bg_palette, Tileset bg_tileset)
        {
            GBA.Bitmap result;
            Palette    palette = Palette.Empty(256);

            for (int i = 0; i < mg_palette.Count; i++)
            {
                palette.Set(i, mg_palette[i]);
            }
            for (int i = 0; i < bg_palette.Count; i++)
            {
                bg_palette[i] = bg_palette[i].SetAlpha(false);
                palette.Set(GBA.Palette.MAX * 15 + i, bg_palette[i]);
            }
            result        = new GBA.Bitmap(GBA.Screen.WIDTH, GBA.Screen.HEIGHT);
            result.Colors = palette;

            if (BG_CheckBox.Checked)
            {
                GBA.Image bg = bg_tileset.ToImage(GBA.Screen.W_TILES + 2, GBA.Screen.H_TILES, bg_palette.ToBytes(false));
                for (int y = 0; y < GBA.Screen.HEIGHT; y++)
                {
                    for (int x = 0; x < GBA.Screen.WIDTH; x++)
                    {
                        result[x, y] = GBA.Palette.MAX * 15 + bg[x, y];
                    }
                }
            }
            if (MG_CheckBox.Checked)
            {
                TSA_Image mg = new TSA_Image(mg_palette, mg_tileset, mg_tsa);
                for (int y = 0; y < GBA.Screen.HEIGHT; y++)
                {
                    for (int x = 0; x < GBA.Screen.WIDTH; x++)
                    {
                        if (mg.GetColor(x, y).Value != 0)
                        {
                            result[x, y] = mg[x, y];
                        }
                    }
                }
            }
            if (FG_CheckBox.Checked)
            {
                Palette[] palettes = Palette.Split(mg_palette, 8);
                GBA.Image fg;
                // large japanese 'FIRE EMBLEM' title
                fg = mg_tileset.ToImage(32, 25, palettes[4].ToBytes(false));
                Core_DrawLayer(result, fg, new Rectangle(0, 152, GBA.Screen.WIDTH, 48), 0, 48);
                Core_DrawLayer(result, fg, new Rectangle(0, 104, GBA.Screen.WIDTH, 48), 0, 40);
                // small english 'FIRE EMBLEM'
                fg = fg_tileset.ToImage(32, 32, palettes[2].ToBytes(false));
                Core_DrawLayer(result, fg, new Rectangle(0, 0, 128, 16), 99, 27);
                // Nintendo & IS copyrights
                Core_DrawLayer(result, fg, new Rectangle(0, 48, 208, 8), 16, 152);
                // japanese subtitle scroll thingy
                fg.Colors = palettes[3];
                Core_DrawLayer(result, fg, new Rectangle(128, 16, 120, 32), 64, 85);
                // 'Press Start'
                fg.Colors = palettes[1];
                Core_DrawLayer(result, fg, new Rectangle(128, 0, 80, 16), 80, 120);
            }
            Current        = result;
            CurrentPalette = palette;
        }
コード例 #9
0
 /// <summary>
 /// Creates a sprite from a block of OAM data
 /// </summary>
 public Sprite(Palette palette, Tileset tileset, OAM oam)
 {
     Load(palette, tileset, new TileMap(oam.GetTileMap(oam.GetDimensions())), oam.FlipH, oam.FlipV);
 }
コード例 #10
0
 /// <summary>
 /// Creates a GBA.Sprite from the given GBA.Palette, GBA.Tileset and GBA.Tilemap
 /// </summary>
 public Sprite(Palette palette, Tileset tileset, TileMap tilemap)
 {
     Load(palette, tileset, tilemap, false, false);
 }