private void JumpToSystemPalette_Click(object sender, EventArgs e)
        {
            ImageSystemIconForm f = (ImageSystemIconForm)InputFormRef.JumpForm <ImageSystemIconForm>();

            f.JumpToPage(1);
        }
        private void SystemIconForm_Load(object sender, EventArgs e)
        {
            Size system_icon_size = GetSystemIconImageSize();

            system_icon             = new ImageFormRef(this, "system_icon", system_icon_size.Width, system_icon_size.Height, 1, Program.ROM.RomInfo.system_icon_pointer(), 0, Program.ROM.RomInfo.system_icon_palette_pointer());
            system_move_allowicon   = new ImageFormRef(this, "system_move_allowicon", 32 * 8, 2 * 8, 1, Program.ROM.RomInfo.system_move_allowicon_pointer(), 0, Program.ROM.RomInfo.system_move_allowicon_palette_pointer());
            system_weapon_icon_icon = new ImageFormRef(this, "system_weapon_icon_icon", 32 * 8, 32, 1, Program.ROM.RomInfo.system_weapon_icon_pointer(), 0, Program.ROM.RomInfo.system_weapon_icon_palette_pointer());
            system_music_icon_icon  = new ImageFormRef(this, "system_music_icon_icon", 32 * 8, 32, 1, Program.ROM.RomInfo.system_music_icon_pointer(), 0, Program.ROM.RomInfo.system_music_icon_palette_pointer());

            if (Program.ROM.RomInfo.version() >= 7)
            {
                systemmenu_goal = new ImageFormRef(this, "systemmenu_goal", 256, 256, 4, Program.ROM.RomInfo.systemmenu_common_image_pointer(), Program.ROM.RomInfo.systemmenu_goal_tsa_pointer(), Program.ROM.RomInfo.systemmenu_common_palette_pointer());
                systemmenu_goal_panel.Show();
            }
            else
            {//FE6
                systemmenu_goal_panel.Hide();
            }

            if (Program.ROM.RomInfo.version() >= 8)
            {//FE8
                systemmenu_badstatus = new ImageFormRef(this, "systemmenu_badstatus", 40, 8 * 9, 1, Program.ROM.RomInfo.systemmenu_badstatus_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                systemmenu_old_badstatus_panel.Hide();

                systemmenu_badstatus_panel.Height   = systemmenu_badstatus_panel.Height * 2;
                systemmenu_badstatus_Picture.Height = systemmenu_badstatus_Picture.Height * 2;
                InputFormRef.markupJumpLabel(X_StatusBackgroundLink);
                InputFormRef.markupJumpLabel(X_SystemMenuPaletteLink);
            }
            else if (Program.ROM.RomInfo.version() >= 7)
            {//FE7
                systemmenu_badstatus     = new ImageFormRef(this, "systemmenu_badstatus", 32, 8 * 4, 1, Program.ROM.RomInfo.systemmenu_badstatus_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                systemmenu_old_badstatus = new ImageFormRef(this, "systemmenu_old_badstatus", 256, 32, 1, Program.ROM.RomInfo.systemmenu_badstatus_old_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                X_StatusBackgroundLink.Hide();
                X_SystemMenuPaletteLink.Hide();
            }
            else
            {//FE6
                systemmenu_old_badstatus = new ImageFormRef(this, "systemmenu_old_badstatus", 256, 32, 1, Program.ROM.RomInfo.systemmenu_badstatus_old_image_pointer(), 0, Program.ROM.RomInfo.systemmenu_badstatus_palette_pointer());
                systemmenu_badstatus_panel.Hide();
                systemmenu_old_badstatus_panel.Location = systemmenu_badstatus_panel.Location;
                X_StatusBackgroundLink.Hide();
                X_SystemMenuPaletteLink.Hide();
            }

            systemmenu_terrain = new ImageFormRef(this, "systemmenu_terrain", 256, 256, 4, Program.ROM.RomInfo.systemmenu_common_image_pointer(), Program.ROM.RomInfo.systemmenu_terrain_tsa_pointer(), Program.ROM.RomInfo.systemmenu_common_palette_pointer());

            systemmenu_name = new ImageFormRef(this, "systemmenu_name", 256, 256, 4, Program.ROM.RomInfo.systemmenu_name_image_pointer(), Program.ROM.RomInfo.systemmenu_name_tsa_pointer(), Program.ROM.RomInfo.systemmenu_name_palette_pointer());

            systemmenu_battlepreview = new ImageFormRef(this, "systemmenu_battlepreview", 256, 256, 4, Program.ROM.RomInfo.systemmenu_battlepreview_image_pointer(), Program.ROM.RomInfo.systemmenu_battlepreview_tsa_pointer(), Program.ROM.RomInfo.systemmenu_battlepreview_palette_pointer());

            systemarea_move_gradation_palette.Value   = Program.ROM.p32(Program.ROM.RomInfo.systemarea_move_gradation_palette_pointer());
            systemarea_attack_gradation_palette.Value = Program.ROM.p32(Program.ROM.RomInfo.systemarea_attack_gradation_palette_pointer());
            systemarea_staff_gradation_palette.Value  = Program.ROM.p32(Program.ROM.RomInfo.systemarea_staff_gradation_palette_pointer());

            InputFormRef.markupJumpLabel(X_Jump_Patch);
            InputFormRef.markupJumpLabel(X_GraphicsTool);
            InputFormRef.markupJumpLabel(X_Internet);
            systemIconPictureBox1.Image = ImageSystemIconForm.Allows(8);
            systemIconPictureBox2.Image = ImageSystemIconForm.Fort();
            systemIconPictureBox3.Image = ImageSystemIconForm.Vendor();
            IconRedraw();
        }
Esempio n. 3
0
        public MainSimpleMenuImageSubForm()
        {
            InitializeComponent();

            ImageBGButton.BackgroundImage = MakeTransparent(Trim(ImageBGForm.DrawBG(0)));

            if (Program.ROM.RomInfo.version >= 7)
            {
                BigCGButton.BackgroundImage = MakeTransparent(Trim(ImageCGForm.DrawImageByID(0)));
            }
            else
            {
                BigCGButton.Hide();
            }

            ImagePortraitButton.BackgroundImage     = MakeTransparent(ImagePortraitForm.DrawPortraitUnit(2));
            ImageBattleAnimeButton.BackgroundImage  = MakeTransparent(BattleZoom(ImageBattleAnimeForm.DrawBattleAnime(1, ImageBattleAnimeForm.ScaleTrim.SCALE_90)));
            ImageUnitWaitIconButton.BackgroundImage = MakeTransparent(ImageUnitWaitIconFrom.DrawWaitUnitIconBitmap(1, 0, false));
            ImageUnitMoveIconButton.BackgroundImage = MakeTransparent(ImageUnitMoveIconFrom.DrawMoveUnitIconBitmap(3, 0, 0));
            ImageIconButton.BackgroundImage         = MakeTransparent(ImageItemIconForm.DrawIconWhereID(0xB));
            SystemIconButton.BackgroundImage        = MakeTransparent(ImageSystemIconForm.YubiYoko());
            //BattleScreenButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.Allows(8));
            BattleScreenButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.WeaponIcon(0));

            ImageBattleFieldButton.BackgroundImage   = MakeTransparent(ImageBattleBGForm.DrawBG(2));
            ImageBattleTerrainButton.BackgroundImage = MakeTransparent((ImageBattleTerrainForm.Draw(2)));

            if (Program.ROM.RomInfo.version == 8)
            {
                ImageUnitPaletteButton.BackgroundImage = MakeTransparent(BattleZoom(UnitPaletteForm.DrawSample(2, 3)));
            }
            else
            {//for FE6 , FE7
                ImageUnitPaletteButton.BackgroundImage = MakeTransparent(BattleZoom(ImageBattleAnimeForm.DrawBattleAnime(ImageBattleAnimeForm.GetAnimeIDByClassID(UnitForm.GetClassID(2))
                                                                                                                         , ImageBattleAnimeForm.ScaleTrim.SCALE_90, UnitForm.GetPaletteLowClass(2))));
            }

            WorldMapImageButton.BackgroundImage = MakeTransparent(WorldMapImageForm.DrawWorldMap());

            if (Program.ROM.RomInfo.version == 7 && Program.ROM.RomInfo.is_multibyte == false)
            {//英語版FE7は、章タイトルをテキストで保持していて、40260c nazo fontで、描画している.
                ImageChapterTitleButton.Hide();
            }
            else
            {
                ImageChapterTitleButton.BackgroundImage = MakeTransparent(ImageChapterTitleForm.DrawSample(0));
            }


            if (ImageUtilMagic.SearchMagicSystem() != ImageUtilMagic.magic_system_enum.NO)
            {
                ImageMagicButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.WeaponIcon(8 - 3));
            }
            else
            {
                ImageMagicButton.Hide();
            }

            if (Program.ROM.RomInfo.is_multibyte)
            {
                OptionForm.textencoding_enum textencoding = OptionForm.textencoding();
                if (textencoding == OptionForm.textencoding_enum.ZH_TBL)
                {
//                    FontButton.BackgroundImage = MakeTransparent(FontZHForm.DrawFontString("字形", true));
                }
                else
                {
                    FontButton.BackgroundImage = MakeTransparent(FontForm.DrawFontString("フォント", true));
                }
            }
            else
            {
                FontButton.BackgroundImage = MakeTransparent(FontForm.DrawFontString("Font", true));
            }
        }
Esempio n. 4
0
        //ROM読みこみに伴うシステムの初期化.
        static void InitSystem(string fullfilename)
        {
            Log.Notify("InitSystem:", Path.GetFileName(ROM.Filename), "ver:", ROM.RomInfo.VersionToFilename(), "length:", ROM.Data.Length.ToString("X"));

            //Undoバッファの準備
            Undo = new Undo();


            //数を求める部分はあまりにたくさん呼び出すのでキャッシュすることにしました.
            InputFormRef.ClearCacheDataCount();
            //パッチのインストールの是非の判定 FE8には策パッチがあるのでキャッシュする.
            PatchForm.ClearCheckIF();

            if (fullfilename != "")
            {
                //変更監視
                UpdateWatcher.RegistMain(fullfilename);
            }


            //tbl適応判定
            OptionForm.AutoUpdateTBLOption();

            //システム側のテキストエンコード どうやってUnicodeにするかどうか.
            ReBuildSystemTextEncoder();

            //FEテキストエンコード用のハフマンツリーマップの構成
            ReBuildFETextEncoder();

            //イベントの読込
            ReLoadEventScript();

            //イベント条件の解釈リスト
            EventCondForm.PreLoadResource(U.ConfigDataFilename("eventcond_"));

            //AI1 と 2, 3
            EventUnitForm.PreLoadResourceAI1(U.ConfigDataFilename("ai1_"));
            EventUnitForm.PreLoadResourceAI2(U.ConfigDataFilename("ai2_"));
            EventUnitForm.PreLoadResourceAI3(U.ConfigDataFilename("ai3_"));

            //SondEffectリスト
            SongTableForm.PreLoadResource(U.ConfigDataFilename("sound_"));
            //UnitActionリスト
            UnitActionPointerForm.PreLoadResource(U.ConfigDataFilename("unitaction_"));

            //ROM内アニメ
            ImageRomAnimeForm.PreLoadResource();
            ImageTSAAnimeForm.PreLoadResource();
            if (Program.ROM.RomInfo.version() == 8)
            {
                ImageTSAAnime2Form.PreLoadResource();
            }

            //MODの読込.
            ReLoadMod();

            //新規に追加ユニットリストキャッシュの削除
            EventUnitForm.ClearNewData();

            //システムアイコンキャッシュのクリア
            ImageSystemIconForm.ClearCache();

            //EVENTとASMのキャッシュをクリア
            AsmMapFileAsmCache = new FEBuilderGBA.AsmMapFileAsmCache();
            //asm mapキャッシュの更新.
            AsmMapFileAsmCache.ClearCache();

            //RAM
            ReBuildRAM();

            if (fullfilename != "" &&
                fullfilename != Program.Config.at("Last_Rom_Filename"))
            {//最後に開いたファイル名を保存する.
                Program.Config["Last_Rom_Filename"] = fullfilename;
                Program.Config.Save();
            }
            Log.Notify("InitSystem:Complate");
        }
Esempio n. 5
0
        //WeaponTypeIcon + テキスト + (PARSER) + WeaponTypeIcon + テキスト  を書く
        public static Size DrawWeaponTypeIcon2AndText(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            string text = lb.Items[index].ToString();

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            Font       normalFont = lb.Font;
            Rectangle  bounds     = listbounds;

            int textmargineY = (OWNER_DRAW_ICON_SIZE - (int)lb.Font.Height) / 2;

            //テキストの先頭にアイコン番号(キャラ番号が入っている. 無駄だが汎用性を考えるとほかに方法がない)
            uint   icon   = U.atoh(text);
            Bitmap bitmap = ImageSystemIconForm.WeaponIcon(icon);

            U.MakeTransparent(bitmap);

            //アイコンを描く. 処理速度を稼ぐためにマップアイコンの方を描画
            Rectangle b = bounds;

            b.Width   = OWNER_DRAW_ICON_SIZE;
            b.Height  = OWNER_DRAW_ICON_SIZE;
            bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
            bitmap.Dispose();

            string[] parsers = new string[] { " -> ", " <- ", " ?? ", " & " };
            bool     found   = false;

            foreach (string parser in parsers)
            {
                int p = text.IndexOf(parser);
                if (p < 0)
                {
                    continue;
                }

                p += parser.Length;

                //前半
                string a1 = text.Substring(0, p);
                b         = bounds;
                b.Y      += textmargineY;
                bounds.X += U.DrawText(a1, g, normalFont, brush, isWithDraw, b);

                //後半
                string a2 = text.Substring(p);

                //後半のアイコンを描く
                icon   = U.atoh(a2);
                bitmap = ImageSystemIconForm.WeaponIcon(icon);
                U.MakeTransparent(bitmap);

                b         = bounds;
                b.Width   = OWNER_DRAW_ICON_SIZE;
                b.Height  = OWNER_DRAW_ICON_SIZE;
                bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                bitmap.Dispose();

                //後半の文字列
                b         = bounds;
                b.Y      += textmargineY;
                bounds.X += U.DrawText(a2, g, normalFont, brush, isWithDraw, b);

                found = true;
                break;
            }

            if (found == false)
            {
                //見つからなかったので、普通にテキストを描く.
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
            }

            brush.Dispose();

            bounds.Y += OWNER_DRAW_ICON_SIZE;
            return(new Size(bounds.X, bounds.Y));
        }
Esempio n. 6
0
        public static Size DrawEventCategory(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            string text = lb.Items[index].ToString();

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            Font       normalFont = lb.Font;
            Rectangle  bounds     = listbounds;

            int lineHeight = (int)lb.Font.Height;

            string[] sp = text.Split(new string[] { "[", "//" }, StringSplitOptions.None);
            bounds.X += U.DrawText(sp[0], g, normalFont, brush, isWithDraw, bounds);
            for (int i = 1; i < sp.Length - 1; i++)
            {
                bounds.X += U.DrawText("[", g, normalFont, brush, isWithDraw, bounds);

                string nn = sp[i];
                int    p  = nn.IndexOf(':');
                if (p < 0)
                {
                    bounds.X += U.DrawText(nn, g, normalFont, brush, isWithDraw, bounds);
                    continue;
                }

                string item = nn.Substring(0, p);

                Bitmap bitmap = null;
                if (item == "UNIT")
                {
                    bitmap = UnitForm.DrawUnitMapFacePicture(1);
                }
                else if (item == "CLASS")
                {
                    bitmap = ClassForm.DrawWaitIcon(3);
                }
                else if (item == "POINTER_PROCS")
                {
                    bitmap = ImageSystemIconForm.WeaponIcon(4);
                }
                else if (item == "POINTER_ASM")
                {
                    bitmap = ImageSystemIconForm.WeaponIcon(8);
                }
                else if (item == "POINTER_UNIT")
                {
                    bitmap = ClassForm.DrawWaitIcon(7);
                }
                else if (item == "POINTER_EVENT")
                {//サブルーチンは目立つ緑のアイコン
                    bitmap = ImageSystemIconForm.MusicIcon(3);
                }
                else if (item == "MUSIC")
                {
                    bitmap = ImageSystemIconForm.MusicIcon(6);
                }
                else if (item == "SOUND")
                {
                    bitmap = ImageSystemIconForm.MusicIcon(7);
                }
                else if (item == "ITEM")
                {//アイテムアイコン
                    bitmap = ImageSystemIconForm.WeaponIcon(8);
                }
                else if (item == "FLAG")
                {
                    bitmap = ImageSystemIconForm.FlagIcon();
                }
                else if (item == "WMLOCATION")
                {//拠点
                    bitmap = WorldMapImageForm.DrawWorldMapIcon(0xB);
                }
                else if (item == "WMPATH")
                {//道
                    bitmap = WorldMapImageForm.DrawWorldMapIcon(0xB);
                }
                if (bitmap != null)
                {
                    U.MakeTransparent(bitmap);

                    Rectangle b = bounds;
                    b.Width  = lineHeight;
                    b.Height = lineHeight;

                    bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                    bitmap.Dispose();

                    bounds.X += U.DrawText(nn.Substring(p), g, normalFont, brush, isWithDraw, bounds);
                }
                else
                {
                    bounds.X += U.DrawText(nn.Substring(p + 1), g, normalFont, brush, isWithDraw, bounds);
                }
            }

            //コードをコメント形式で描画
            if (sp.Length > 0)
            {
                int        i            = sp.Length - 1;
                SolidBrush commentBrush = new SolidBrush(OptionForm.Color_Comment_ForeColor());
                if (bounds.X < 700)
                {
                    bounds.X = 700;
                }
                bounds.X += U.DrawText("//" + sp[i], g, normalFont, commentBrush, isWithDraw, bounds);
                commentBrush.Dispose();
            }
            brush.Dispose();
            bounds.Y += lineHeight;
            return(new Size(bounds.X, bounds.Y));
        }
Esempio n. 7
0
        public Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            SolidBrush brush            = new SolidBrush(lb.ForeColor);
            SolidBrush foreKeywordBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor());
            Font       normalFont       = lb.Font;
            Font       boldFont         = new Font(lb.Font, FontStyle.Bold);
            Rectangle  bounds           = listbounds;
            int        lineHeight       = normalFont.Height;

            UseFlagID current = this.FlagList[index];
            string    text;
            int       maxWidth = 0;

            if (index == 0 || current.ID != this.FlagList[index - 1].ID)
            {     //フラグ名を描画
                if (index != 0)
                { //空行を入れる
                    bounds.Y += lineHeight;
                }

                //フラグのアイコンを描画
                Bitmap bitmap = ImageSystemIconForm.FlagIcon();
                U.MakeTransparent(bitmap);

                Rectangle b = bounds;
                b.Width   = lineHeight;
                b.Height  = lineHeight;
                bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                bitmap.Dispose();

                //フラグ名を書く
                string dummy;
                text      = ":";
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                text      = U.ToHexString(current.ID);
                bounds.X += U.DrawText(text, g, boldFont, brush, isWithDraw, bounds);

                text      = "  " + InputFormRef.GetFlagName(current.ID, out dummy);
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                //次の行へ
                maxWidth  = bounds.X;
                bounds.Y += lineHeight;
                bounds.X  = listbounds.X;
            }

            //名称の表示
            bounds.X += 10;
            text      = MainSimpleMenuEventErrorForm.TypeToString(current.DataType, current.Addr, current.Tag);
            bounds.X += U.DrawText(text, g, boldFont, foreKeywordBrush, isWithDraw, bounds);

            //次の行へ
            maxWidth  = Math.Max(bounds.X, maxWidth);
            bounds.Y += lineHeight;
            bounds.X  = listbounds.X;

            //情報を書く.
            bounds.X += 6;
            text      = current.Info;

            Size ss;

            if (current.DataType == FELint.Type.BATTTLE_TALK || current.DataType == FELint.Type.HAIKU)
            {
                ss = DrawUnitAllowToAllow(text, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_ALWAYS)
            {
                ss = EventCondForm.DrawEventListAlwaysOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_OBJECT)
            {
                ss = EventCondForm.DrawEventListObjectOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TALK)
            {
                ss = EventCondForm.DrawEventListTalkOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TURN)
            {
                ss = EventCondForm.DrawEventListTurnOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENTSCRIPT)
            {
                EventScript.OneCode code = Program.EventScript.DisAseemble(Program.ROM.Data, current.Tag);
                ss = EventScriptForm.DrawCode(lb, g, bounds, isWithDraw, code);
            }
            else
            {
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
                bounds.Y += lineHeight;
                ss        = new Size(bounds.X, bounds.Y);
            }
            bounds.X = ss.Width;
            bounds.Y = ss.Height;

            brush.Dispose();
            foreKeywordBrush.Dispose();

            //最後の改行
            maxWidth = Math.Max(bounds.X, maxWidth);
            return(new Size(maxWidth, bounds.Y));
        }