예제 #1
0
        private void CloseEverything()
        {
            ModuleArbiter.CloseForms();

            mnuFileSave.Enabled  = false;
            mnuFileClose.Enabled = false;

            for (int i = 0; i < panelMain.Controls.Count; i++)
            {
                Control c = panelMain.Controls[i];
                if (c is Label)
                {
                    if ((c as Label).Font.Bold)
                    {
                        LabelClick(c, null);
                    }
                }
            }
        }
예제 #2
0
        public frmShopEditor()
        {
            InitializeComponent();

            // Load item names
            for (int i = 0; i < itemNames.Length; i++)
            {
                itemNames[i] = TextItemNames.GetName(i);
            }

            // Draw the tab stuff
            for (int i = 0; i < 3; i++)
            {
                tabPage[i]         = new TabPage("Page " + (i + 1).ToString());
                tabPage[i].Padding = new System.Windows.Forms.Padding(3);
                tabPage[i].UseVisualStyleBackColor = true;
                tabPage[i].TabIndex = i;

                tabMain.TabPages.Add(tabPage[i]);

                // Draw the item stuff
                for (int j = 0; j < 10; j++)
                {
                    LinkLabel ll = new LinkLabel();

                    ll.AutoSize = true;
                    ll.Text     = "Item " + ((i * 10) + j + 1).ToString();
                    ll.Left     = 6;
                    ll.Top      = (j * 27) + 10;
                    ll.Tag      = ((i * 10) + j);

                    ll.LinkClicked += (s, e) =>
                    {
                        LinkLabel l     = s as LinkLabel;
                        int       index = (int)l.Tag;

                        ModuleArbiter.ShowSelect(typeof(frmItemEditor), cboItem[index].SelectedIndex);
                    };

                    tabPage[i].Controls.Add(ll);
                    lblItem[(i * 10) + j] = ll;

                    ComboBox c = new ComboBox();

                    Helpers.CheckFont(c);

                    for (int k = 0; k < itemNames.Length; k++)
                    {
                        c.Items.Add("[" + k.ToString("X2") + "] " + itemNames[k]);
                    }

                    c.Width         = 160;
                    c.DropDownStyle = ComboBoxStyle.DropDownList;
                    c.Left          = ll.Left + 50;
                    c.Top           = ll.Top - 3;

                    tabPage[i].Controls.Add(c);
                    cboItem[(i * 10) + j] = c;
                }
            }

            // Load the shop data
            ShopData.Init();
            string[] shopNames = Properties.Resources.shopnames.SplitN();
            loading = true;
            for (int i = 0; i < ShopData.Entries; i++)
            {
                cboShop.Items.Add("[" + i.ToString("X2") + "] " + shopNames[i]);
            }
            loading = false;
            cboShop.SelectedIndex = 0;
        }
예제 #3
0
        public frmBattleBgEntryEditor()
        {
            InitializeComponent();

            pAnimation.Image   = canvas;
            pAnimation.Visible = false;

            // Draw the layer stuff
            for (int i = 0; i < 2; i++)
            {
                var p = new PictureBox();
                p.SizeMode = PictureBoxSizeMode.Normal;
                p.Width    = p.Height = 128;
                p.Left     = 15;
                p.Top      = 39 + (134 * i);
                p.Visible  = true;
                p.Paint   += (s, e) =>
                {
                    e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                    e.Graphics.Clear(this.BackColor);
                    e.Graphics.DrawImage((s as PictureBox).Image, new Rectangle(0, 0, 128, 128),
                                         0, 0, 256, 256, GraphicsUnit.Pixel);
                };

                this.Controls.Add(p);
                pLayer[i] = p;

                var ll = new LinkLabel();
                ll.AutoSize     = true;
                ll.Text         = "Layer " + (i + 1).ToString();
                ll.Left         = 149;
                ll.Top          = 42 + (134 * i);
                ll.Visible      = true;
                ll.Tag          = i;
                ll.LinkClicked += (s, e) =>
                {
                    int index = (int)((LinkLabel)s).Tag;
                    ModuleArbiter.ShowSelect(typeof(frmBattleBgLayerEditor), cboLayer[index].SelectedIndex);
                };

                this.Controls.Add(ll);
                lblLayer[i] = ll;

                var c = new ComboBox();
                c.DropDownStyle = ComboBoxStyle.DropDownList;
                c.Width         = 128;
                c.Height        = 21;
                c.Left          = 200;
                c.Top           = p.Top;
                c.Visible       = true;
                c.Tag           = i;
                for (int j = 0; j < GfxBattleBg.Entries; j++)
                {
                    c.Items.Add(j.ToString("X3"));
                }
                c.SelectedIndexChanged += (s, e) =>
                {
                    if (loading2)
                    {
                        return;
                    }
                    var cb    = s as ComboBox;
                    int index = (int)cb.Tag;
                    pLayer[index].Image = GfxBattleBg.GetLayer(cb.SelectedIndex);
                };

                this.Controls.Add(c);
                cboLayer[i] = c;

                var l = new Label();
                l.AutoSize = true;
                l.Text     = "Alpha";
                l.Left     = ll.Left;
                l.Top      = ll.Top + 28;
                l.Visible  = true;

                this.Controls.Add(l);
                lblAlpha[i] = l;

                var t = new TextBox();
                t.Width   = 64;
                t.Height  = 20;
                t.Left    = c.Left;
                t.Top     = l.Top - 3;
                t.Visible = true;

                this.Controls.Add(t);
                txtAlpha[i] = t;
            }

            // Load the entry list
            loading = true;
            for (int i = 0; i < GfxBattleBg.MasterEntries; i++)
            {
                cboEntry.Items.Add(i.ToString("X2"));
            }
            loading = false;
            cboEntry.SelectedIndex = 0;

            // Setup the animation timer
            tm.Mode       = Multimedia.TimerMode.Periodic;
            tm.Period     = 16;
            tm.Resolution = 1;
            tm.Tick      += (s, ee) =>
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke(new MethodInvoker(UpdateFrame));
                }
                else
                {
                    UpdateFrame();
                }

                t++;
            };
        }
예제 #4
0
        public frmMain()
        {
            ModuleArbiter.MainForm = this;

            InitializeComponent();

            foreach (RowStyle r in panelMain.RowStyles)
            {
                r.SizeType = SizeType.AutoSize;
            }

            // Load config
            LoadSettings();

            // Build the module layout
            AddLabel("General");
            ModuleArbiter.AddModule("Compression", typeof(frmCompression));

            AddLabel("Character data");
            ModuleArbiter.AddModule("Level-up experience editor", typeof(frmLevelExpEditor));

            AddLabel("Items");
            ModuleArbiter.AddModule("Item editor", typeof(frmItemEditor));
            ModuleArbiter.AddModule("Shop editor", typeof(frmShopEditor));

            AddLabel("Enemies");
            ModuleArbiter.AddModule("Enemy editor", typeof(frmEnemyEditor));

            AddLabel("PSI");
            ModuleArbiter.AddModule("PSI editor", typeof(frmPsiEditor));
            ModuleArbiter.AddModule("PSI level-up editor", typeof(frmLevelPsiEditor));

            AddLabel("Graphics");
            ModuleArbiter.AddModule("Sprite viewer", typeof(frmSpriteEditor));
            ModuleArbiter.AddModule("Map viewer", typeof(frmMapViewer));
            ModuleArbiter.AddModule("Battle BG entry editor", typeof(frmBattleBgEntryEditor));
            ModuleArbiter.AddModule("Battle BG layer editor", typeof(frmBattleBgLayerEditor));
            ModuleArbiter.AddModule("Battle swirl editor", typeof(frmBattleSwirlEditor));
            ModuleArbiter.AddModule("Town map editor", typeof(frmTownMapEditor));
            ModuleArbiter.AddModule("Logo editor", typeof(frmLogoEditor));

            AddLabel("Text");
            ModuleArbiter.AddModule("Main text viewer", typeof(frmMainTextViewer));
            ModuleArbiter.AddModule("Don't Care names editor", typeof(frmDontCareNamesEditor));
            ModuleArbiter.AddModule("Character names editor", typeof(frmCharNamesEditor));

            var ws = M3Settings.MainSettings.MainFormParams;

            if (ws.WindowSize == default(Size))
            {
                // If it's the first load, don't bother resizing to zero
            }
            else
            {
                this.WindowState = ws.WindowState;
                if (this.WindowState == FormWindowState.Normal)
                {
                    this.Location = ws.WindowLoc;
                    this.Size     = ws.WindowSize;
                }
            }
        }
예제 #5
0
 private void lblSprite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     ModuleArbiter.ShowSelect(typeof(frmSpriteEditor), new int[] { 0, cboEnemy.SelectedIndex + 0x100, 0 });
 }
예제 #6
0
 private void lblBg_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     ModuleArbiter.ShowSelect(typeof(frmBattleBgEntryEditor), cboBg.SelectedIndex);
 }
예제 #7
0
        public frmEnemyEditor()
        {
            InitializeComponent();

            this.Invalidate();

            Helpers.CheckFont(cboMusicSwirl);
            Helpers.CheckFont(cboMusicBattle);
            Helpers.CheckFont(cboMusicWin);
            Helpers.CheckFont(cboTextDeath);
            Helpers.CheckFont(cboTextEncounter);
            Helpers.CheckFont(cboEnemy);
            Helpers.CheckFont(txtName);
            Helpers.CheckFont(txtShortName);
            Helpers.CheckFont(txtDescription);
            cboEnemy.JapaneseSearch = M3Rom.Version == RomVersion.Japanese;
            txtShortName.ReadOnly   = M3Rom.Version != RomVersion.English;

            // Load item names
            for (int i = 0; i < itemNames.Length; i++)
            {
                itemNames[i] = TextItemNames.GetName(i);
            }

            // Load the enemy names
            for (int i = 0; i < enemyNames.Length; i++)
            {
                enemyNames[i] = TextEnemyNames.GetName(i);
            }

            // Load the enemy short names
            if (M3Rom.Version == RomVersion.English)
            {
                enemyShortNames = new string[TextEnemyShortNames.Entries];
                for (int i = 0; i < enemyShortNames.Length; i++)
                {
                    enemyShortNames[i] = TextEnemyShortNames.GetName(i);
                }
            }
            else
            {
                txtShortName.Enabled = false;
            }

            // Load the music names
            for (int i = 0; i < musicNames.Length; i++)
            {
                musicNames[i] = TextMusicNames.GetName(i);
                string str = "[" + i.ToString("X2") + "] " + musicNames[i];
                cboMusicSwirl.Items.Add(str);
                cboMusicBattle.Items.Add(str);
                cboMusicWin.Items.Add(str);
            }

            // Load the action names
            for (int i = 0; i < actions.Length; i++)
            {
                actions[i] = TextBattle.GetText(ActionTable.Actions[i].Data[0x12]);
            }

            // Load the battle text
            for (int i = 0; i < battletext.Length; i++)
            {
                battletext[i] = TextBattle.GetText(i);
                if (i < 0x100)
                {
                    string strb = "[" + i.ToString("X2") + "] " + battletext[i];
                    cboTextEncounter.Items.Add(strb);
                    cboTextDeath.Items.Add(strb);
                }
            }

            // Load the background list
            loading2 = true;
            for (int i = 0; i < GfxBattleBg.MasterEntries; i++)
            {
                cboBg.Items.Add(i.ToString("X2"));
            }
            loading2 = false;

            // Draw the weakness stuff
            string[] weaknesses = Properties.Resources.weaknesses.SplitN();
            for (int i = 0; i < 20; i++)
            {
                int colWidth = ((tabWeaknesses.ClientSize.Width - 12) / 2);

                Label l = new Label();

                l.AutoSize = true;
                l.Text     = weaknesses[i];
                l.Left     = ((i / 10) * colWidth) + 6;
                l.Top      = ((i % 10) * 27) + 9;

                tabWeaknesses.Controls.Add(l);
                lblWeakness[i] = l;

                TextBox t = new TextBox();

                t.Width     = 64;
                t.Left      = l.Left + 96;
                t.Top       = ((i % 10) * 27) + 7;
                t.MaxLength = 5;

                tabWeaknesses.Controls.Add(t);
                txtWeakness[i] = t;
            }

            // Draw item stuff
            int vBase = txtDp.Top + 39;

            for (int i = 0; i < 3; i++)
            {
                LinkLabel l1 = new LinkLabel();

                l1.AutoSize = true;
                l1.Text     = "Item " + (i + 1).ToString();
                l1.Left     = 6;
                l1.Top      = vBase + 2;
                l1.Tag      = i;

                l1.LinkClicked += (s, e) =>
                {
                    LinkLabel ll    = s as LinkLabel;
                    int       index = (int)ll.Tag;

                    ModuleArbiter.ShowSelect(typeof(frmItemEditor), cboItem[index].SelectedIndex);
                };

                tabBasic.Controls.Add(l1);
                lblItem[i] = l1;

                ComboBox c = new ComboBox();

                Helpers.CheckFont(c);

                for (int j = 0; j < itemNames.Length; j++)
                {
                    c.Items.Add("[" + j.ToString("X2") + "] " + itemNames[j]);
                }

                c.Width         = 160;
                c.DropDownStyle = ComboBoxStyle.DropDownList;
                c.Left          = txtDp.Left;
                c.Top           = vBase;

                tabBasic.Controls.Add(c);
                cboItem[i] = c;

                vBase += 27;

                Label l2 = new Label();
                l2.AutoSize = true;
                l2.Text     = l1.Text + " %";
                l2.Left     = 6;
                l2.Top      = vBase + 2;

                tabBasic.Controls.Add(l2);
                lblItemChance[i] = l2;

                TextBox t = new TextBox();
                t.Width = 96;
                t.Left  = txtDp.Left;
                t.Top   = vBase;

                tabBasic.Controls.Add(t);
                txtItemChance[i] = t;

                vBase += 27;
            }

            // Draw the action stuff
            vBase = cboTextDeath.Top + 39;
            for (int i = 0; i < 8; i++)
            {
                Label l = new Label();

                l.AutoSize = true;
                l.Text     = "Action " + (i + 1).ToString();
                l.Left     = 6;
                l.Top      = vBase + 2;

                tabBattle.Controls.Add(l);
                lblAction[i] = l;

                ComboBox c = new ComboBox();

                Helpers.CheckFont(c);
                for (int j = 0; j < actions.Length; j++)
                {
                    c.Items.Add("[" + j.ToString("X3") + "] " + actions[j].Replace(Environment.NewLine, " "));
                }

                c.Width         = 320;
                c.DropDownStyle = ComboBoxStyle.DropDownList;
                c.Left          = txtMusicWin.Left;
                c.Top           = vBase;

                tabBattle.Controls.Add(c);
                cboAction[i] = c;

                vBase += 27;
            }

            // Load enemy data
            EnemyData.Init();

            loading = true;
            for (int i = 0; i < EnemyData.Entries; i++)
            {
                cboEnemy.Items.Add("[" + i.ToString("X2") + "] " + enemyNames[i]);
            }
            loading = false;
            cboEnemy.SelectedIndex = 0;
        }
        private void lblPsi_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel ll = sender as LinkLabel;

            ModuleArbiter.ShowSelect(typeof(frmPsiEditor), cboPsi.SelectedIndex);
        }
예제 #9
0
 public frmCompression()
 {
     InitializeComponent();
     ModuleArbiter.FormLoading(this);
 }