コード例 #1
0
    //----------------------------------------------------------------------------------------------

    public void PrintWord()
    {
        posX += spaceBetweenChars;

        char     current = Dialogue[index].ToCharArray()[charIndex];
        CharData?attempt = spriteData.GetSprite(current);

        if (CheckNullCharData(attempt, current))
        {
            return;
        }

        CharData data = (CharData)attempt;

        if (CheckWordWrapping(data.width))
        {
            return;
        }

        Vector3 transform = new Vector3(posX + data.offsetX, posY + data.offsetY, -5f);

        PrintLetter(transform, current, data.sprite);

        timer = 0;
        charIndex++;
        currentWord.length--;
    }
コード例 #2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (dlgSave.ShowDialog() == DialogResult.OK)
            {
                // Get the sprite indices
                int bank   = cboBank.SelectedIndex;
                int chr    = indexmap[cboChar.SelectedIndex];
                int sprite = cboSprite.SelectedIndex;

                // Get the bitmap
                Bitmap bmp = SpriteData.GetSprite(bank, chr, sprite, cboPalNum.SelectedIndex, false);

                // Get the palette
                var palette = SpritePalettes.GetPalette(sprite);

                // Create the target bitmap
                Bitmap   target = new Bitmap(Math.Max(128, bmp.Width), 32 + bmp.Height, PixelFormat.Format32bppArgb);
                Graphics g      = Graphics.FromImage(target);

                // Draw the palette
                for (int i = 0; i < 16; i++)
                {
                    int x = (i & 7) << 4;
                    int y = ((i & 8) << 1);

                    g.FillRectangle(new SolidBrush(palette.Entries[0][i]), new Rectangle(x, y, 16, 16));
                }

                // Draw the sprite
                g.DrawImage(bmp, new Point(0, 32));

                // Save
                target.Save(dlgSave.FileName);
                g.Dispose();
            }
        }
コード例 #3
0
        private void RefreshSprite()
        {
            // Get the sprite indices
            int bank   = cboBank.SelectedIndex;
            int chr    = indexmap[cboChar.SelectedIndex];
            int sprite = cboSprite.SelectedIndex;
            int oam    = cboOam.SelectedIndex;

            // Try getting the sprite
            Bitmap bmp = SpriteData.GetSprite(bank, chr, sprite, cboPalNum.SelectedIndex, true);

            pSprite.Image = null;
            pOam.Image    = null;
            if (bmp != null)
            {
                // Stretch the sprite according to our zoom
                zoom = (int)Math.Pow(2, tbZoom.Value);
                Bitmap   bmpZoom = new Bitmap(bmp.Width * zoom, bmp.Height * zoom, PixelFormat.Format32bppArgb);
                Graphics g       = Graphics.FromImage(bmpZoom);
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
                g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;
                g.DrawImage(bmp, new Rectangle(0, 0, bmpZoom.Width, bmpZoom.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel);

                // Show the sprite
                pSprite.Width  = bmpZoom.Width;
                pSprite.Height = bmpZoom.Height;
                pSprite.Image  = bmpZoom;
            }

            // Sprite arrangement
            if (oam < 0)
            {
                txtOamX.Text     = "";
                txtOamY.Text     = "";
                chkFlipH.Checked = false;
                chkFlipV.Checked = false;

                txtOamX.Enabled  = false;
                txtOamY.Enabled  = false;
                chkFlipH.Enabled = false;
                chkFlipV.Enabled = false;

                btnApply.Enabled = false;

                pOam.Image = null;
            }
            else
            {
                var si = SpriteInfo.InfoEntries[bank][chr].Sprites[sprite].Sprites[oam];

                txtOamX.Text     = si.CoordX.ToString();
                txtOamY.Text     = si.CoordY.ToString();
                chkFlipH.Checked = si.FlipH;
                chkFlipV.Checked = si.FlipV;

                txtOamX.Enabled  = true;
                txtOamY.Enabled  = true;
                chkFlipH.Enabled = true;
                chkFlipV.Enabled = true;

                btnApply.Enabled = true;

                pOam.Image = SpriteData.GetOam(bank, chr, sprite, oam, cboPalNum.SelectedIndex, true);
            }
        }
コード例 #4
0
 public Sprite GetSprite(SpriteEnum _spriteEnum)
 {
     return(spriteData.GetSprite(_spriteEnum));
 }
コード例 #5
0
        private void cboEnemy_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (loading)
            {
                return;
            }

            int index = cboEnemy.SelectedIndex;
            var ed    = EnemyData.Enemies[index];

            txtName.Text = enemyNames[index];
            if (M3Rom.Version == RomVersion.English)
            {
                txtShortName.Text = enemyShortNames[index];
            }
            txtDescription.Text = TextEnemyDescriptions.GetDescription(index + 1);

            txtLevel.Text = ed.Level.ToString();
            txtHp.Text    = ed.Hp.ToString();
            txtPp.Text    = ed.Pp.ToString();
            txtExp.Text   = ed.Exp.ToString();
            txtDp.Text    = ed.Dp.ToString();

            txtOff.Text   = ed.Off.ToString();
            txtDef.Text   = ed.Def.ToString();
            txtIq.Text    = ed.Iq.ToString();
            txtSpeed.Text = ed.Speed.ToString();

            txtOffBack.Text   = ed.OffBack.ToString();
            txtDefBack.Text   = ed.DefBack.ToString();
            txtIqBack.Text    = ed.IqBack.ToString();
            txtSpeedBack.Text = ed.SpeedBack.ToString();

            for (int i = 0; i < 20; i++)
            {
                txtWeakness[i].Text = ed.Weaknesses[i].ToString();
            }

            for (int i = 0; i < 3; i++)
            {
                cboItem[i].SelectedIndex = ed.Item[i];
                txtItemChance[i].Text    = ed.ItemChance[i].ToString();
            }

            int ms = ed.MusicSwirl;
            int mb = ed.MusicBattle;
            int mw = ed.MusicWin;

            loading2            = true;
            txtMusicSwirl.Text  = ms.ToString();
            txtMusicBattle.Text = mb.ToString();
            txtMusicWin.Text    = mw.ToString();

            cboMusicSwirl.SelectedIndex =
                MusicPlayerTable.TableLookup.ContainsKey(ms) ? MusicPlayerTable.TableLookup[ms] : -1;

            cboMusicBattle.SelectedIndex =
                MusicPlayerTable.TableLookup.ContainsKey(mb) ? MusicPlayerTable.TableLookup[mb] : -1;

            cboMusicWin.SelectedIndex =
                MusicPlayerTable.TableLookup.ContainsKey(mw) ? MusicPlayerTable.TableLookup[mw] : -1;

            loading2 = false;

            for (int i = 0; i < 8; i++)
            {
                int a = ed.Action[i];
                if (a < actions.Length)
                {
                    cboAction[i].SelectedIndex = a;
                }
                else
                {
                    cboAction[i].SelectedIndex = -1;
                }
            }

            cboTextEncounter.SelectedIndex = ed.TextEncounter;
            cboTextDeath.SelectedIndex     = ed.TextDeath;

            Bitmap[] bmpBattleSprites = GfxBattleSprites.GetEnemySprite(index);
            pFront.Image = bmpBattleSprites[0];
            pBack.Image  = bmpBattleSprites[1];
            pFront.Refresh();
            pBack.Refresh();

            loading2 = true;
            if (cboShowLayer.SelectedIndex < 0)
            {
                cboShowLayer.SelectedIndex = 0;
            }
            cboBg.SelectedIndex = (ed.Bg < GfxBattleBg.MasterEntries) ? ed.Bg : -1;;
            loading2            = false;

            cboShowLayer_SelectedIndexChanged(null, null);

            pSprite.Image = SpriteData.GetSprite(0, index + 0x100, 0);
        }