Exemplo n.º 1
0
        private void fillWith_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData != Keys.Enter)
            {
                return;
            }
            if (currentROMData.SelectionLength < 3)
            {
                return;
            }
            int  column = ROMData.SelectionStart / 3;
            byte value;

            try
            {
                value = Convert.ToByte(fillWith.Text, 16);
                byte[] values = new byte[currentROMData.SelectionLength / 3];
                Bits.Fill(values, value);
                oldProperties.Add(new Change(offset + column,
                                             Bits.GetBytes(current, offset + column, values.Length), Color.Red));
                Bits.Fill(current, value, offset + column, values.Length);
            }
            catch
            {
                return;
            }
            RefreshHexEditor();
        }
Exemplo n.º 2
0
 public override void Clear()
 {
     Bits.Fill(name, '\x20');
     startingLevel      = 1;
     startingCurrentHP  = 0;
     startingMaxHP      = 0;
     startingSpeed      = 0;
     startingAttack     = 0;
     startingDefense    = 0;
     startingMgAttack   = 0;
     startingMgDefense  = 0;
     startingExperience = 0;
     startingWeapon     = 0;
     startingArmor      = 0;
     startingAccessory  = 0;
     startingMagic      = new bool[32];
     startingCoins      = 0;
     startingCurrentFP  = 0;
     startingMaximumFP  = 0;
     startingFrogCoins  = 0;
     foreach (LevelUp levelUp in levels)
     {
         if (levelUp != null)
         {
             levelUp.Clear();
         }
     }
 }
Exemplo n.º 3
0
 public override void Clear()
 {
     Bits.Fill(name, '\x20');
     description        = new char[0];
     price              = 0;
     speed              = 0;
     attack             = 0;
     defense            = 0;
     magicAttack        = 0;
     magicDefense       = 0;
     attackRange        = 0;
     attackType         = 0;
     elemAttack         = 0;
     hideDigits         = false;
     inflictionAmount   = 0;
     effectMute         = false;
     effectSleep        = false;
     effectPoison       = false;
     effectFear         = false;
     effectMushroom     = false;
     effectScarecrow    = false;
     effectInvincible   = false;
     changeAttack       = false;
     changeDefense      = false;
     changeMagicAttack  = false;
     changeMagicDefense = false;
     elemNullIce        = false;
     elemNullFire       = false;
     elemNullThunder    = false;
     elemNullJump       = false;
     elemWeakIce        = false;
     elemWeakFire       = false;
     elemWeakThunder    = false;
     elemWeakJump       = false;
     equipMario         = false;
     equipToadstool     = false;
     equipBowser        = false;
     equipGeno          = false;
     equipMallow        = false;
     usageBattleMenu    = false;
     usageOverworldMenu = false;
     usageReusable      = false;
     usageInstantDeath  = false;
     restoreFP          = false;
     restoreHP          = false;
     targetLiveAlly     = false;
     targetEnemy        = false;
     targetAll          = false;
     targetWoundedOnly  = false;
     targetOnePartyOnly = false;
     targetNotSelf      = false;
     itemType           = 0;
     cursorBehavior     = 0;
     inflictFunction    = 0;
 }
Exemplo n.º 4
0
 // universal functions
 public override void Clear()
 {
     Bits.Fill(name, '\x20');
     psychopath           = new char[0];
     hp                   = 0;
     speed                = 0;
     attack               = 0;
     defense              = 0;
     magicAttack          = 0;
     magicDefense         = 0;
     fp                   = 0;
     evade                = 0;
     magicEvade           = 0;
     experience           = 0;
     coins                = 0;
     yoshiCookie          = 255;
     itemWinA             = 255;
     itemWinB             = 255;
     elemNullIce          = false;
     elemNullThunder      = false;
     elemNullFire         = false;
     elemNullJump         = false;
     elemWeakIce          = false;
     elemWeakThunder      = false;
     elemWeakFire         = false;
     elemWeakJump         = false;
     effectNullMute       = false;
     effectNullSleep      = false;
     effectNullPoison     = false;
     effectNullFear       = false;
     effectNullMushroom   = false;
     effectNullScarecrow  = false;
     effectNullInvincible = false;
     invincible           = false;
     mortalityProtection  = false;
     disableAutoDeath     = false;
     palette2bpp          = false;
     morphSuccess         = 0;
     flowerBonus          = 0;
     flowerOdds           = 0;
     entranceStyle        = 0;
     coinSize             = 0;
     elevation            = 0;
     spriteBehavior       = 0;
     strikeSound          = 0;
     otherSound           = 0;
 }
Exemplo n.º 5
0
 // accessor functions
 public int[] MoldPixels()
 {
     moldTilesPerPixel = new int[256 * 256];
     int[] pixels = new int[256 * 256];
     Bits.Fill(moldTilesPerPixel, 0xFF);
     if (tiles.Count == 0)
     {
         return(pixels);
     }
     //
     int[] theTile;
     for (int i = 0; i < tiles.Count; i++)
     {
         Tile  temp = (Tile)tiles[i];
         int   yc, xc, w, h;
         Point p;
         if (gridplane)
         {
             theTile = temp.GetGridplanePixels();
             yc      = 132 - temp.Height + temp.YPlusOne - temp.YMinusOne;
             xc      = 128 - (temp.Width / 2);
             w       = h = 32;
         }
         else
         {
             theTile = temp.Get16x16TilePixels();
             yc      = temp.Y; xc = temp.X; w = h = 16;
         }
         for (int y = 0; y < h; y++)
         {
             for (int x = 0; x < w; x++)
             {
                 p = new Point(x + xc, y + yc);
                 if (p.Y < 256 && p.X < 256 && pixels[p.Y * 256 + p.X] == 0)
                 {
                     pixels[p.Y * 256 + p.X] = theTile[(y * w) + x];
                     if (theTile[(y * w) + x] != 0)
                     {
                         moldTilesPerPixel[p.Y * 256 + p.X] = i;
                     }
                 }
             }
         }
     }
     return(pixels);
 }
Exemplo n.º 6
0
 // universal functions
 public override void Clear()
 {
     Bits.Fill(name, '\x20');
     hitRate          = 0;
     attackLevel      = 0;
     effectMute       = false;
     effectSleep      = false;
     effectPoison     = false;
     effectFear       = false;
     effectMushroom   = false;
     effectScarecrow  = false;
     effectInvincible = false;
     upAttack         = false;
     upDefense        = false;
     upMagicAttack    = false;
     upMagicDefense   = false;
     instantDeath     = false;
     noDamageA        = false;
     noDamageB        = false;
     hideDigits       = false;
 }
Exemplo n.º 7
0
 private void SetPixelIndexes()
 {
     pixelIndexes = new int[256 * 256];
     Bits.Fill(pixelIndexes, -1);
     int[] order = new int[8];
     for (int i = 0; i < 8; i++)
     {
         order[i] = i;
     }
     byte[] temp = Bits.Copy(this.y);
     Array.Sort(temp, order);
     for (int g = 0; g < 8; g++)
     {
         int i = order[g];
         // If monster is used in formation
         if (use[i])
         {
             // Get correct monster image
             int[] pixels    = Model.Monsters[monsters[i]].Pixels;
             int   elevation = Model.Monsters[monsters[i]].Elevation * 16;
             for (int y = 0; y < 256; y++)
             {
                 for (int x = 0; x < 256; x++)
                 {
                     int x_ = this.x[i] + x - 128;
                     int y_ = this.y[i] + y - 96 - elevation;
                     if ((pixels[y * 256 + x] & 0xFF000000) != 0)
                     {
                         if (x_ > 0 && x_ < 256 && y_ > 0 && y_ < 256)
                         {
                             pixelIndexes[(y_ - 1) * 256 + x_] = i;
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
 public override void Clear()
 {
     Bits.Fill(name, '\x20');
     description        = new char[1];
     fpCost             = 0;
     magicPower         = 0;
     hitRate            = 0;
     attackType         = 0;
     effectType         = 0;
     inflictFunction    = 0;
     inflictElement     = 0;
     checkStats         = false;
     ignoreDefense      = false;
     checkMortality     = false;
     usableOverworld    = false;
     maxAttack          = false;
     hideDigits         = false;
     effectMute         = false;
     effectSleep        = false;
     effectPoison       = false;
     effectFear         = false;
     effectMushroom     = false;
     effectScarecrow    = false;
     effectInvincible   = false;
     changeAttack       = false;
     changeDefense      = false;
     changeMagicAttack  = false;
     changeMagicDefense = false;
     targetLiveAlly     = false;
     targetEnemy        = false;
     targetAll          = false;
     targetWoundedOnly  = false;
     targetOnePartyOnly = false;
     targetNotSelf      = false;
     // timing
     //    timingPointer = 0;
     //    damagePointer = 0;
 }
Exemplo n.º 9
0
        // accessor functions
        public Bitmap[] GetSequenceImages(Animation animation, ref List <int> durations)
        {
            durations.Clear();
            List <Bitmap> croppedFrames = new List <Bitmap>();
            List <int[]>  frames        = new List <int[]>();
            Rectangle     thisBounds    = new Rectangle();
            //
            Point UL = new Point(256, 256);
            Point BR = new Point(0, 0);

            foreach (Sequence.Frame frame in this.frames)
            {
                Rectangle bounds = new Rectangle(0, 0, 1, 1);
                if (frame.Mold < animation.Molds.Count)
                {
                    int[] pixels = animation.Molds[frame.Mold].MoldPixels();
                    animation.Molds[frame.Mold].MoldTilesPerPixel = null;
                    frames.Add(pixels);
                    durations.Add(frame.Duration * (1000 / 60));
                    bounds = Do.Crop(pixels, 256, 256);
                }
                // if the mold is empty
                if (bounds.X == 0 &&
                    bounds.Y == 0 &&
                    bounds.Width == 1 &&
                    bounds.Height == 1)
                {
                    continue;
                }
                if (bounds.X < UL.X)
                {
                    UL.X = bounds.X;
                }
                if (bounds.Y < UL.Y)
                {
                    UL.Y = bounds.Y;
                }
                if (bounds.X + bounds.Width > BR.X)
                {
                    BR.X = bounds.X + bounds.Width;
                }
                if (bounds.Y + bounds.Height > BR.Y)
                {
                    BR.Y = bounds.Y + bounds.Height;
                }
            }
            if (UL.X >= BR.X ||
                UL.Y >= BR.Y)
            {
                return(croppedFrames.ToArray());
            }
            thisBounds.X      = UL.X;
            thisBounds.Y      = UL.Y;
            thisBounds.Width  = BR.X - UL.X;
            thisBounds.Height = BR.Y - UL.Y;
            foreach (int[] pixels in frames)
            {
                int[] cropped = Do.GetPixelRegion(pixels, thisBounds, 256, 256);
                Bits.Fill(cropped, Color.FromArgb(127, 127, 127).ToArgb(), true);
                Bitmap imageCropped = Do.PixelsToImage(cropped, thisBounds.Width, thisBounds.Height);
                croppedFrames.Add(new Bitmap(imageCropped));
            }
            return(croppedFrames.ToArray());
        }
Exemplo n.º 10
0
        // tileset contextmenustrip
        private void importIntoTilemap_Click(object sender, EventArgs e)
        {
            Bitmap[] imports = new Bitmap[1]; imports = (Bitmap[])Do.Import(imports);
            if (imports == null)
            {
                return;
            }
            if (imports.Length == 0)
            {
                return;
            }
            if (imports.Length > 32)
            {
                MessageBox.Show("The maximum number of imported images must not exceed 32.", "LAZY SHELL");
                return;
            }
            //
            byte[]   graphics   = new byte[0x10000];
            int[]    palette    = animation.PaletteSet.Palettes[effect.PaletteIndex];
            Tile[]   tiles      = new Tile[16 * 16];
            byte[][] tilemaps   = new byte[imports.Length][];
            bool     newPalette = false;

            if (MessageBox.Show("Would you like to create a new palette from the imported image(s)?", "LAZY SHELL",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                newPalette = true;
            }
            Do.ImagesToTilemaps(ref imports, ref palette, index, animation.Codec == 1 ? (byte)0x10 : (byte)0x20,
                                ref graphics, ref tiles, ref tilemaps, newPalette);
            for (int i = 0; i < palette.Length; i++)
            {
                animation.PaletteSet.Reds[i + (effect.PaletteIndex * 16)]   = Color.FromArgb(palette[i]).R;
                animation.PaletteSet.Greens[i + (effect.PaletteIndex * 16)] = Color.FromArgb(palette[i]).G;
                animation.PaletteSet.Blues[i + (effect.PaletteIndex * 16)]  = Color.FromArgb(palette[i]).B;
            }
            Buffer.BlockCopy(graphics, 0, animation.GraphicSet, 0, Math.Min(graphics.Length, animation.GraphicSet.Length));
            effectsEditor.E_graphicSetSize.Value = Math.Min(graphics.Length, 8192);
            if (graphics.Length > 8192)
            {
                MessageBox.Show("Not enough space to store the necessary amount of SNES graphics data for the imported images. The total required space (" +
                                graphics.Length + " bytes) for the new SNES graphics data exceeds 8192 bytes.",
                                "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            // set tileset length
            int temp = tiles.Length * 8;

            animation.TilesetLength = Math.Min(tiles.Length * 8, 512);
            animation.TilesetLength = animation.TilesetLength / 64 * 64;
            if (animation.TilesetLength == 0)
            {
                animation.TilesetLength += 64;
            }
            else if (animation.TilesetLength <= 512 - 64 && temp % 64 != 0)
            {
                animation.TilesetLength += 64;
            }
            e_tileSetSize.Value = animation.TilesetLength;
            if (tiles.Length * 8 > 512)
            {
                MessageBox.Show("Not enough space to draw the necessary amount of tiles in the tileset for the imported images. The total required space (" +
                                (tiles.Length * 8).ToString() + " bytes) for the new tileset exceeds 512 bytes.",
                                "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            // redraw data
            animation.Tileset_tiles.DrawTileset(animation.Tileset_bytes, tiles);
            animation.Tileset_tiles = new E_Tileset(animation, effect.PaletteIndex);
            for (int i = 0; i < tilemaps.Length; i++)
            {
                // add another mold if not enough
                if (i >= molds.Count)
                {
                    index = molds.Count - 1;
                    newMold.PerformClick();
                }
                Bits.Fill(molds[i].Mold, (byte)0xFF);
                Buffer.BlockCopy(tilemaps[i], 0, molds[i].Mold, 0, Math.Min(tilemaps[i].Length, molds[i].Mold.Length));
            }
            animation.Width    = (byte)Math.Min(16, imports[0].Width / 16);
            animation.Height   = (byte)Math.Min(16, imports[0].Height / 16);
            e_moldWidth.Value  = Math.Min(16, imports[0].Width / 16);
            e_moldHeight.Value = Math.Min(16, imports[0].Height / 16);
            //
            animation.Assemble();
            SetTilesetImage();
            SetTilemapImage();
            sequences.SetSequenceFrameImages();
            sequences.RealignFrames();
            effectsEditor.LoadPaletteEditor();
            effectsEditor.LoadGraphicEditor();
        }