Esempio n. 1
0
        public MonsterSpriteForm(int sprite, IWindowsFormsEditorService editorService)
        {
            InitializeComponent();
            this.sprite = Math.Max(sprite, 1);

            this.mpfImages = new Dictionary <int, MPFImage>();

            foreach (var file in DATArchive.Hades.Files)
            {
                var match = Regex.Match(file.Name, @"^MNS(\d+)\.MPF$");
                if (match.Success)
                {
                    int id  = int.Parse(match.Groups[1].Value);
                    var mpf = MPFImage.FromArchive(file.Name, DATArchive.Hades);
                    mpfImages.Add(id, mpf);
                    spriteList.Items.Add(id);
                }
            }
        }
Esempio n. 2
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;
            }
        }