コード例 #1
0
        private void spriteList_SelectedIndexChanged(object sender, EventArgs e)
        {
            mpf = mpfImages[(int)spriteList.SelectedItem];
            pal = Palette256.FromArchive(mpf.Palette, DATArchive.Hades);

            int maxThumbWidth  = Math.Min(128, mpf.Width);
            int maxThumbHeight = Math.Min(128, mpf.Height);
            int thumbnailSize  = Math.Max(maxThumbWidth, maxThumbHeight);

            flowLayoutPanel1.Controls.Clear();

            for (int i = 0; i < mpf.ExpectedFrames; ++i)
            {
                var frame = mpf.Frames[i];

                var thumbnail = new PictureBox();
                thumbnail.Size     = new Size(128, 128);
                thumbnail.SizeMode =
                    frame.Width > thumbnail.Width || frame.Height > thumbnail.Height
                    ? PictureBoxSizeMode.Zoom
                    : PictureBoxSizeMode.CenterImage;
                if (frame.Height > 0 && frame.Width > 0)
                {
                    thumbnail.Image = DAGraphics.RenderImage(frame, pal);
                }
                thumbnail.BackColor = Color.Teal;

                thumbnail.MouseClick += thumbnail_MouseClick;

                flowLayoutPanel1.Controls.Add(thumbnail);
            }
        }
コード例 #2
0
ファイル: SignForm.cs プロジェクト: moseleyc/editor
        static SignForm()
        {
            var epf = EPFImage.FromArchive("woodbk.epf", DATArchive.Legend);
            var pal = Palette256.FromArchive("legend.pal", DATArchive.Legend);

            woodbk = DAGraphics.RenderImage(epf[0], pal);
        }
コード例 #3
0
        public SkillIconForm(int icon, string type)
        {
            InitializeComponent();

            Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type) + " Icon";

            _icon     = icon;
            _epfImage = EPFImage.FromArchive(type + "001.epf", DATArchive.Setoa);
            _palette  = Palette256.FromArchive("gui06.pal", DATArchive.Setoa);
        }
コード例 #4
0
        private void UpdateIcon()
        {
            string epfFilename;

            switch (cmbBook.SelectedIndex)
            {
            case 0:
            case 2:
            case 4:
                epfFilename = "skill001.epf";
                break;

            default:
                epfFilename = "spell001.epf";
                break;
            }
            var _epfImage = EPFImage.FromArchive(epfFilename, DATArchive.Setoa);
            var _palette  = Palette256.FromArchive("gui06.pal", DATArchive.Setoa);
            var bitmap    = DAGraphics.RenderImage(_epfImage[_skill.Icon], _palette);

            imgIcon.Image = bitmap;
        }
コード例 #5
0
        private void DrawForeground(Bitmap image)
        {
            int xOrigin = ((image.Width / 2) - 1) - Tileset.HalfTileWidth + 1;
            int yOrigin = 256;

            for (int y = 0; y < map.Height; ++y)
            {
                for (int x = 0; x < map.Width; ++x)
                {
                    var point     = new Point(x, y);
                    int tileIndex = y * map.Width + x;

                    #region Npc
                    if (showNpcs && map.Npcs.ContainsKey(point))
                    {
                        var npc = map.Npcs[point];

                        string filename = string.Format("MNS{0:d3}.MPF", npc.Sprite);
                        var    mpf      = MPFImage.FromArchive(filename, DATArchive.Hades);
                        var    pal      = Palette256.FromArchive(mpf.Palette, DATArchive.Hades);
                        var    frame    = mpf[0];

                        DrawBitmapData(image, frame.RawData, pal, new Rectangle(
                                           xOrigin + frame.Left + x * Tileset.HalfTileWidth,
                                           yOrigin + frame.Top + (x + 1) * Tileset.HalfTileHeight - mpf.Height + Tileset.HalfTileHeight,
                                           frame.Width, frame.Height));
                    }
                    #endregion

                    #region Left Wall
                    int leftWall = map.Tiles[tileIndex].LeftWall;
                    if (showLeftWalls && (leftWall % 10000) > 1)
                    {
                        string filename = string.Format("stc{0:d5}.hpf", leftWall);
                        var    hpf      = HPFImage.FromArchive(filename, DATArchive.Ia);

                        DrawBitmapData(image, hpf.RawData, stcPaletteTable[leftWall + 1], new Rectangle(
                                           xOrigin + x * Tileset.HalfTileWidth,
                                           yOrigin + (x + 1) * Tileset.HalfTileHeight - hpf.Height + Tileset.HalfTileHeight,
                                           hpf.Width, hpf.Height), map.Tiles[tileIndex].LeftBlends);
                    }
                    #endregion

                    #region Right Wall
                    int rightWall = map.Tiles[tileIndex].RightWall;
                    if (showRightWalls && (rightWall % 10000) > 1)
                    {
                        string filename = string.Format("stc{0:d5}.hpf", rightWall);
                        var    hpf      = HPFImage.FromArchive(filename, DATArchive.Ia);

                        DrawBitmapData(image, hpf.RawData, stcPaletteTable[rightWall + 1], new Rectangle(
                                           xOrigin + (x + 1) * Tileset.HalfTileWidth,
                                           yOrigin + (x + 1) * Tileset.HalfTileHeight - hpf.Height + Tileset.HalfTileHeight,
                                           hpf.Width, hpf.Height), map.Tiles[tileIndex].RightBlends);
                    }
                    #endregion
                }

                xOrigin -= Tileset.HalfTileWidth;
                yOrigin += Tileset.HalfTileHeight;
            }
        }