static InputFormRef Init(Form self)
 {
     return(new InputFormRef(self
                             , ""
                             , Program.ROM.RomInfo.support_talk_pointer()
                             , 16
                             , (int i, uint addr) =>
     {    //とりあえず 0x00 00 まで読む.
         if (Program.ROM.u16(addr) == 0x0000)
         {
             return false;
         }
         if (i > 10 && Program.ROM.IsEmpty(addr, 16 * 10))
         {
             return false;
         }
         return true;
     }
                             , (int i, uint addr) =>
     {
         uint uid1 = Program.ROM.u8(addr + 0);
         uint uid2 = Program.ROM.u8(addr + 1);
         return U.ToHexString(uid1) +
         " " + UnitForm.GetUnitName(uid1) +
         " & "
         + U.ToHexString(uid2) +
         " " + UnitForm.GetUnitName(uid2)
         ;
     }
                             ));
 }
        public void SetParam(uint lv, uint grow, uint unitid, uint classid)
        {
            if (classid == 0)
            {
                classid = UnitForm.GetUnitIDWhereSupportClass(unitid);
            }

            GrowSimulator sim = new GrowSimulator();

            UnitForm.SetSimUnit(ref sim, unitid);
            ClassForm.SetSimClass(ref sim, classid);

            if (UnitForm.isHighClass(unitid) || ClassForm.isHighClass(classid))
            {
                lv += 10;
            }

            GrowSimulator.GrowOptionEnum growOption = GrowSimulator.GrowOptionEnum.None;
            if (grow == 1)
            {
                growOption = GrowSimulator.GrowOptionEnum.ClassGrow;
                sim.SetUnitLv1();
            }
            sim.Grow((int)lv, growOption);

            U.SelectedIndexSafety(X_SIM_HP, sim.sim_hp);
            U.SelectedIndexSafety(X_SIM_STR, sim.sim_str);
            U.SelectedIndexSafety(X_SIM_SKILL, sim.sim_skill);
            U.SelectedIndexSafety(X_SIM_SPD, sim.sim_spd);
            U.SelectedIndexSafety(X_SIM_DEF, sim.sim_def);
            U.SelectedIndexSafety(X_SIM_RES, sim.sim_res);
            U.SelectedIndexSafety(X_SIM_LUCK, sim.sim_luck);
            U.SelectedIndexSafety(X_SIM_MAGICEX_Value, sim.sim_ext_magic);
        }
Esempio n. 3
0
 static InputFormRef N1_Init(Form self)
 {
     return(new InputFormRef(self
                             , "N1_"
                             , Program.ROM.RomInfo.event_ballte_talk2_pointer()
                             , 12
                             , (int i, uint addr) =>
     {    //読込最大値検索
         uint unit = Program.ROM.u8(addr);
         if (unit == 0x0 || unit == 0xFF)
         {
             return false;
         }
         if (i > 10 && Program.ROM.IsEmpty(addr, 12 * 10))
         {    //終端符号を無視して 0x00等を利用している人がいるため
             return false;
         }
         return true;
     }
                             , (int i, uint addr) =>
     {
         uint unit_id = (uint)Program.ROM.u8(addr);
         return U.ToHexString(unit_id) + " " + UnitForm.GetUnitNameAndANY(unit_id);
     }
                             ));
 }
        static InputFormRef Init(Form self)
        {
            uint typeID = 0;

            return(new InputFormRef(self
                                    , ""
                                    , 0
                                    , 1
                                    , (int i, uint addr) =>
            {
                if (i == 0)
                {
                    return true;
                }
                return Program.ROM.u8(addr) != 0x00;
            }
                                    , (int i, uint addr) =>
            {
                uint id = Program.ROM.u8(addr + 0);
                if (i == 0)
                {
                    typeID = id;
                    return TypeIDToString(id);
                }
                if (typeID <= 1)
                {
                    return U.ToHexString(id) + " " + UnitForm.GetUnitName(id);
                }
                else
                {
                    return U.ToHexString(id) + " " + ClassForm.GetClassName(id);
                }
            }
                                    ));
        }
Esempio n. 5
0
        public GrowSimulator BuildSim()
        {
//            uint uid = UnitForm.GetUnitIDWhereSupportClass((uint)this.AddressList.SelectedIndex);
            uint uid = 0;

            GrowSimulator sim = new GrowSimulator();

            UnitForm.GetSim(ref sim
                            , uid //支援クラス
                            );
            sim.SetClassBase(
                (int)B11.Value                 //hp
                , (int)B12.Value               //str
                , (int)B13.Value               //skill
                , (int)B14.Value               //spd
                , (int)B15.Value               //def
                , (int)B16.Value               //res
                , (int)MagicExtClassBase.Value //magic extends
                );
            sim.SetClassGrow(
                (int)B27.Value                 //hp
                , (int)B28.Value               //str
                , (int)B29.Value               //skill
                , (int)B30.Value               //spd
                , (int)B31.Value               //def
                , (int)B32.Value               //res
                , (int)B33.Value               //luck
                , (int)MagicExtClassGrow.Value //magic extends
                );

            return(sim);
        }
Esempio n. 6
0
        void AutoCollectByTargetSupport(uint uid, uint target_uid, uint init_value, uint add_value, Undo.UndoData undodata)
        {
            if (target_uid == 0)
            {
                return;
            }
            uint addr = UnitForm.GetSupportAddrWhereUnitID(target_uid);

            if (addr == U.NOT_FOUND)
            {
                return;
            }
            if (!U.isSafetyOffset(addr))
            {
                return;
            }
            uint target_limit = addr + SUPPORT_LIMIT;

            for (; addr < target_limit; addr++)
            {
                uint target_uid2 = Program.ROM.u8(addr);
                if (uid != target_uid2)
                {
                    continue;
                }

                Program.ROM.write_u8(addr + SUPPORT_LIMIT, init_value, undodata);
                Program.ROM.write_u8(addr + SUPPORT_LIMIT + SUPPORT_LIMIT, add_value, undodata);
                return;
            }
        }
Esempio n. 7
0
 static InputFormRef N2_Init(Form self)
 {
     return(new InputFormRef(self
                             , "N2_"
                             , Program.ROM.RomInfo.ed_3a_pointer()
                             , 8
                             , (int i, uint addr) =>
     {
         return Program.ROM.u32(addr) != 0x00;
     }
                             , (int i, uint addr) =>
     {
         uint flag = Program.ROM.u8(addr + 0);
         uint uid1 = Program.ROM.u8(addr + 1);
         uint uid2 = Program.ROM.u8(addr + 2);
         if (flag == 1)
         {
             return U.ToHexString(uid1) + " " + UnitForm.GetUnitName(uid1);
         }
         if (flag == 2)
         {
             return U.ToHexString(uid1) + " " + UnitForm.GetUnitName(uid1)
             + " & " + U.ToHexString(uid2) + " " + UnitForm.GetUnitName(uid2);
         }
         return U.ToHexString(uid1) + " " + UnitForm.GetUnitName(uid1)
         + " ?? " + U.ToHexString(uid2) + " " + UnitForm.GetUnitName(uid2);
     }
                             ));
 }
Esempio n. 8
0
        public void DrawSelectedUnit()
        {
            uint unit_id  = (uint)B0.Value;
            uint class_id = (uint)B1.Value;

            if (class_id == 0)
            {//クラスIDが0だったらユーザIDで補完する
                class_id = UnitForm.GetClassID(unit_id);
            }

            List <MapPictureBox.StaticItem> list =
                EventUnitFE7Form.DrawUnit(
                    class_id
                    , (uint)B3.Value
                    , (int)B4.Value
                    , (int)B5.Value
                    , (int)B6.Value
                    , (int)B7.Value
                    );

            for (int n = list.Count - 1; n >= 0; n--)
            {
                MapPictureBox.SetStaticItem("c" + n.ToString(), list[n].x, list[n].y, list[n].bitmap, list[n].draw_x_add, list[n].draw_y_add);
            }
        }
Esempio n. 9
0
        void UpdateItemDropLabel()
        {
            uint unit_id  = (uint)this.B0.Value;
            uint class_id = (uint)this.B1.Value;

            if (unit_id > 0)
            {
                unit_id--;
            }
            uint unit_addr  = UnitForm.GetUnitAddr(unit_id);
            uint class_addr = ClassForm.GetClassAddr(class_id);

            bool isItemDrop =
                IsItemDropFlag(unit_addr) || IsItemDropFlag(class_addr);

            if (isItemDrop)
            {//アイテムドロップ
                X_ITEMDROP.Text      = R._("アイテムドロップ: ドロップする");
                X_ITEMDROP.ForeColor = OptionForm.Color_ControlComment_ForeColor();
            }
            else
            {
                X_ITEMDROP.Text      = R._("アイテムドロップ: ドロップしない");
                X_ITEMDROP.ForeColor = OptionForm.Color_Control_ForeColor();
            }
        }
Esempio n. 10
0
        static InputFormRef Init(Form self)
        {
            return(new InputFormRef(self
                                    , ""
                                    , Program.ROM.RomInfo.summons_demon_king_pointer
                                    , 20
                                    , (int i, uint addr) =>
            {
                uint max = Program.ROM.u8(Program.ROM.RomInfo.summons_demon_king_count_address);
                return i <= max;
            }
                                    , (int i, uint addr) =>
            {
                uint unit_id = Program.ROM.u8(addr);
                if (unit_id == 0)
                {
                    return "-EMPTY-";
                }
                uint class_id = Program.ROM.u8(addr + 1);
                uint unitgrow = Program.ROM.u16(addr + 3);
                if (class_id == 0)
                {    //クラスIDが0だったらユーザIDで補完する
                    class_id = UnitForm.GetClassID(unit_id);
                }

                String unit_name = UnitForm.GetUnitName(unit_id);
                String class_name = ClassForm.GetClassName(class_id);
                uint level = U.ParseUnitGrowLV(unitgrow);

                return unit_name + "(" + class_name + ")" + "  " + "Lv:" + level.ToString();
            }
                                    ));
        }
 static InputFormRef Init(Form self)
 {
     return(new InputFormRef(self
                             , ""
                             , Program.ROM.RomInfo.sound_boss_bgm_pointer
                             , 8
                             , (int i, uint addr) =>
     {    //0xFFまで
         if (Program.ROM.u16(addr) == 0xFFFF)
         {
             return false;
         }
         if (i > 10 && Program.ROM.IsEmpty(addr, 8 * 10))
         {
             return false;
         }
         return true;
     }
                             , (int i, uint addr) =>
     {
         uint unit_id = (uint)Program.ROM.u8(addr);
         uint song_id = (uint)Program.ROM.u32(addr + 4);
         return U.ToHexString(unit_id) + " " + UnitForm.GetUnitName(unit_id) + " : " + U.ToHexString(song_id) + SongTableForm.GetSongName(song_id);
     }
                             ));
 }
Esempio n. 12
0
        static void MakeCheckError_Check(List <FELint.ErrorSt> errors, uint support_addr, uint id)
        {
            uint uid = UnitForm.GetUnitIDWhereSupportAddr(support_addr);

            if (uid == U.NOT_FOUND)
            {
                return;
            }
            uid++;

            //実際の値を見る
            uint support_unit_count = 0;
            uint limit = support_addr + SUPPORT_LIMIT;

            for (uint addr = support_addr; addr < limit; addr++)
            {
                uint target_uid = Program.ROM.u8(addr);
                if (target_uid == 0)
                {
                    continue;
                }
                support_unit_count++;

                uint init_value = Program.ROM.u8(addr + SUPPORT_LIMIT);
                uint add_value  = Program.ROM.u8(addr + SUPPORT_LIMIT + SUPPORT_LIMIT);
                MakeCheckError_SelfCheck(errors, support_addr, id, uid, target_uid, init_value, add_value);

                if (target_uid > 0x45)
                {     //敵ユニット支援
                    if (add_value > 0)
                    { //敵ユニット支援に進行度があるのはおかしいよ
                        errors.Add(new FELint.ErrorSt(FELint.Type.SUPPORT_UNIT, support_addr
                                                      , R._("ユニット({0})が、ユニット({1})への支援は、支援相手のユニットがUnitID:0x45を超えているので、敵ユニット同士の支援だと思われますが、「進行度」が({2})に設定されています。\r\n敵ユニットの支援ポイントが増えることはないので、0にするべきです。\r\n(UnitID:0x45を超えるデータに仲間になるユニットを配置してはいけません)"
                                                            , UnitForm.GetUnitNameWithID(uid), UnitForm.GetUnitNameWithID(target_uid), add_value
                                                            )
                                                      , id));
                    }
                }
            }
            //件数の比較
            uint all_count = Program.ROM.u8(support_addr + 0x15);

            if (all_count != support_unit_count)
            {
                errors.Add(new FELint.ErrorSt(FELint.Type.SUPPORT_UNIT, support_addr
                                              , R._("ユニット({0})の支援人数が正しくありません。支援人数が{1}人なのに、実際のデータには、{2}人の支援があります。"
                                                    , UnitForm.GetUnitNameWithID(uid), all_count, support_unit_count
                                                    )
                                              , id));
            }
            if (all_count > SUPPORT_LIMIT)
            {
                errors.Add(new FELint.ErrorSt(FELint.Type.SUPPORT_UNIT, support_addr
                                              , R._("支援で登録できる人数は7人までです。それを上回る({0})人を、データ({1})で、指定しています。"
                                                    , all_count, U.ToHexString(support_addr)
                                                    )
                                              , id));
                return;
            }
        }
Esempio n. 13
0
        static InputFormRef Init(Form self)
        {
            return(new InputFormRef(self
                                    , ""
                                    , Program.ROM.RomInfo.event_haiku_pointer
                                    , 12
                                    , (int i, uint addr) =>
            {    //読込最大値検索
                if (Program.ROM.u16(addr) == 0xFFFF)
                {
                    return false;
                }

                if (i > 10 && Program.ROM.IsEmpty(addr, 12 * 10))
                {
                    return false;
                }
                return true;
            }
                                    , (int i, uint addr) =>
            {
                uint unit_id = (uint)Program.ROM.u8(addr);
                uint map_id = (uint)Program.ROM.u8(addr + 3);
                return U.ToHexString(unit_id) + " " + UnitForm.GetUnitNameAndANY(unit_id) +
                " " + "(" + MapSettingForm.GetMapNameAndANYFF(map_id) + ")";
            }
                                    ));
        }
Esempio n. 14
0
        public static void MakeVarsIDArray(List <UseValsID> list)
        {
            string infobase = R._("死亡セリフ");

            InputFormRef InputFormRef = Init(null);
            List <uint>  tracelist    = new List <uint>();
            uint         haiku_addr   = InputFormRef.BaseAddress;

            for (uint i = 0; i < InputFormRef.DataCount; i++, haiku_addr += InputFormRef.BlockSize)
            {
                uint unitid = Program.ROM.u8(haiku_addr + 0);

                string info   = infobase + " " + UnitForm.GetUnitName(unitid);
                uint   textid = Program.ROM.u16(haiku_addr + 6);

                if (textid <= 0)
                {
                    uint event_addr = Program.ROM.p32(haiku_addr + 8);
                    EventCondForm.MakeVarsIDArrayByEventAddress(list, event_addr, info, tracelist);
                }
                else
                {
                    UseValsID.AppendTextID(list, FELint.Type.HAIKU, haiku_addr, info, textid, i);
                }
            }
//            UseValsID.AppendTextID(list, FELint.Type.HAIKU, InputFormRef, new uint[] { 6 });
        }
Esempio n. 15
0
        //全データの取得
        public static void MakeAllDataLength(List <Address> list)
        {
            InputFormRef InputFormRef = Init(null);

            FEBuilderGBA.Address.AddAddress(list, InputFormRef, "Haiku", new uint[] { 8 });

            List <uint> tracelist = new List <uint>();
            uint        addr      = InputFormRef.BaseAddress;

            for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
            {
//                uint textid = Program.ROM.u16(addr + 6);
//                if (textid <= 0)
//                {
//                    continue;
//                }

                uint spEventP = Program.ROM.u32(addr + 8);
                if (!U.isSafetyPointer(spEventP))
                {
                    continue;
                }
                uint   unitid     = Program.ROM.u8(addr + 0);
                string event_name = "Haiku" + " " + U.ToHexString(unitid) + " " + UnitForm.GetUnitName(unitid);

                EventScriptForm.ScanScript(list, addr + 8, true, false, event_name, tracelist);
            }
        }
Esempio n. 16
0
        public static void GetWeaponType(uint uid
                                         , out bool out_melee
                                         , out bool out_magic
                                         )
        {
            uint sword = 0;
            uint lance = 0;
            uint axe   = 0;
            uint bow   = 0;
            uint staff = 0;
            uint anima = 0;
            uint light = 0;
            uint dark  = 0;

            UnitForm.GetWeaponLevel(uid
                                    , out sword
                                    , out lance
                                    , out axe
                                    , out bow
                                    , out staff
                                    , out anima
                                    , out light
                                    , out dark
                                    );
            out_melee = sword > 0 || lance > 0 || axe > 0 || bow > 0;
            out_magic = staff > 0 || anima > 0 || light > 0 || dark > 0;
        }
Esempio n. 17
0
        public static uint GetHighClassFE7(uint uid)
        {
            if (uid == 0)
            {
                return(0);
            }

            //FE7までは分岐がないので、クラスのCCクラスを参照する.
            uint shien_classs_id = UnitForm.GetClassID(uid);

            if (shien_classs_id <= 0)
            {
                return(0);
            }
            if (ClassForm.isHighClass(shien_classs_id))
            {//上位クラスなので、もう CCではない
                return(shien_classs_id);
            }

            uint change_class = ClassForm.GetChangeClassID(shien_classs_id);

            if (change_class <= 0)
            {//上位のクラスが取れないので下位クラスを返す
                return(shien_classs_id);
            }

            if (ClassForm.isHighClass(change_class))
            {//上位クラスなので、もう CCではない
                return(change_class);
            }

            //上位のクラスが取れないので下位クラスを返す
            return(shien_classs_id);
        }
Esempio n. 18
0
 static InputFormRef Init(Form self)
 {
     return(new InputFormRef(self
                             , ""
                             , Program.ROM.RomInfo.event_haiku_pointer()
                             , 16
                             , (int i, uint addr) =>
     {    //読込最大値検索
         if (Program.ROM.u8(addr) == 0x0)
         {
             return false;
         }
         if (i > 10 && Program.ROM.IsEmpty(addr, 16 * 10))
         {    //終端符号を無視して 0x00等を利用している人がいるため
             return false;
         }
         return true;
     }
                             , (int i, uint addr) =>
     {
         uint unit_id = (uint)Program.ROM.u8(addr);
         return U.ToHexString(unit_id) + " " + UnitForm.GetUnitName(unit_id);
     }
                             ));
 }
Esempio n. 19
0
        static InputFormRef Init(EventUnitFE7Form self)
        {
            return(new InputFormRef(self
                                    , ""
                                    , 0
                                    , Program.ROM.RomInfo.eventunit_data_size
                                    , (int i, uint addr) =>
            {    //読込最大値検索
                //00まで検索
                return Program.ROM.u8(addr) != 0;
            }
                                    , (int i, uint addr) =>
            {
                uint unit_id = Program.ROM.u8(addr);
                if (unit_id == 0)
                {
                    return null;
                }
                uint class_id = Program.ROM.u8(addr + 1);
                uint unitgrow = Program.ROM.u16(addr + 3);
                if (class_id == 0)
                {    //クラスIDが0だったらユーザIDで補完する
                    class_id = UnitForm.GetClassID(unit_id);
                }

                String unit_name = UnitForm.GetUnitName(unit_id);
                String class_name = ClassForm.GetClassName(class_id);
                uint level = U.ParseUnitGrowLV(unitgrow);

                return unit_name + "(" + class_name + ")" + "  " + "Lv:" + level.ToString();
            }
                                    ));
        }
Esempio n. 20
0
        public GrowSimulator BuildSim()
        {
            GrowSimulator sim = new GrowSimulator();

            UnitForm.SetSimUnit(ref sim
                                , 0 //支援クラス
                                );
            sim.SetClassBase(
                (int)B11.Value   //hp
                , (int)B12.Value //str
                , (int)B13.Value //skill
                , (int)B14.Value //spd
                , (int)B15.Value //def
                , (int)B16.Value //res
                , 0              //magic extends
                );
            sim.SetClassGrow(
                (int)B27.Value   //hp
                , (int)B28.Value //str
                , (int)B29.Value //skill
                , (int)B30.Value //spd
                , (int)B31.Value //def
                , (int)B32.Value //res
                , (int)B33.Value //luck
                , 0              //magic extends
                );

            return(sim);
        }
        public static string GetBattleAnimeHint(uint search_animeindex)
        {
            InputFormRef InputFormRef = Init(null);

            for (int id = 0; id < InputFormRef.DataCount; id++)
            {
                uint addr = InputFormRef.IDToAddr((uint)id);
                if (!U.isSafetyOffset(addr))
                {
                    continue;
                }
                for (int i = 0; true; i += 4)
                {
                    uint item  = Program.ROM.u8((uint)(addr + i + 0));
                    uint sp    = Program.ROM.u8((uint)(addr + i + 1));
                    uint anime = Program.ROM.u16((uint)(addr + i + 2));
                    if (item == 0 && sp == 0 && anime == 0)
                    {
                        break;
                    }
                    if (anime != search_animeindex)
                    {
                        continue;
                    }

                    //発見!
                    string name = UnitForm.GetNameWhereCustomBattleAnime((uint)id);
                    return(name + " " + ImageBattleAnimeForm.getSPTypeName(item, sp));
                }
            }

            //ない
            return("");
        }
Esempio n. 22
0
 public static string GetUnitNameAndANY(uint uid)
 {
     if (uid == 0)
     {
         return(R._("ANY"));
     }
     return(UnitForm.GetUnitName(uid));
 }
Esempio n. 23
0
        void MakeClassList(uint selectindex)
        {
            if (Program.ROM.RomInfo.version() >= 8)
            {//FE8の場合キャラパレット指定が別途用意されている
                uint unit_palette_color_pointer = Program.ROM.p32(Program.ROM.RomInfo.unit_palette_color_pointer());
                uint unit_palette_class_pointer = Program.ROM.p32(Program.ROM.RomInfo.unit_palette_class_pointer());

                List <U.AddrResult> list = new List <U.AddrResult>();
                for (int i = 0; i < Program.ROM.RomInfo.unit_maxcount(); i++)
                {
                    for (uint n = 0; n < 7; n++)
                    {
                        uint paletteid = Program.ROM.u8(unit_palette_color_pointer + n);
                        if (paletteid <= 0)
                        {
                            continue;
                        }
                        if (paletteid - 1 != selectindex)
                        {
                            continue;
                        }
                        uint   uid  = (uint)i + 1;
                        uint   cid  = Program.ROM.u8(unit_palette_class_pointer + n);
                        string name = U.ToHexString(uid) + " " + UnitForm.GetUnitName(uid) + " -> " + U.ToHexString(cid) + " " + ClassForm.GetClassName(cid);

                        list.Add(new U.AddrResult(cid, name, uid));
                    }

                    unit_palette_color_pointer += 7;
                    unit_palette_class_pointer += 7;
                }
                U.ConvertListBox(list, ref UNITCLASS_LIST);
            }
            else
            {//FE7 , FE6 はユニットの部分に色指定がある
                List <U.AddrResult> list = new List <U.AddrResult>();
                for (int i = 0; i < Program.ROM.RomInfo.unit_maxcount(); i++)
                {
                    uint uid        = (uint)i;
                    uint paletteid1 = UnitForm.GetPaletteLowClass(uid);
                    uint paletteid2 = UnitForm.GetPaletteHighClass(uid);

                    if (paletteid1 > 0 && paletteid1 - 1 == selectindex)
                    {
                        uint   cid  = UnitForm.GetClassID(uid);
                        string name = U.ToHexString(uid) + " " + UnitForm.GetUnitName(uid) + " -> " + U.ToHexString(cid) + " " + ClassForm.GetClassName(cid);
                        list.Add(new U.AddrResult(cid, name, uid));
                    }
                    else if (paletteid2 > 0 && paletteid2 - 1 == selectindex)
                    {
                        uint   cid  = UnitForm.GetHighClass(uid);
                        string name = U.ToHexString(uid) + " " + UnitForm.GetUnitName(uid) + " -> " + U.ToHexString(cid) + " " + ClassForm.GetClassName(cid);
                        list.Add(new U.AddrResult(cid, name, uid));
                    }
                }
                U.ConvertListBox(list, ref UNITCLASS_LIST);
            }
        }
Esempio n. 24
0
        void AutoCollect()
        {
            if (!AutoCollectCheckbox.Checked)
            {
                return;
            }

            uint support_count = 0;

            if (this.B0.Value != 0)
            {
                support_count++;
            }
            if (this.B1.Value != 0)
            {
                support_count++;
            }
            if (this.B2.Value != 0)
            {
                support_count++;
            }
            if (this.B3.Value != 0)
            {
                support_count++;
            }
            if (this.B4.Value != 0)
            {
                support_count++;
            }
            if (this.B5.Value != 0)
            {
                support_count++;
            }
            if (this.B6.Value != 0)
            {
                support_count++;
            }
            this.B21.Value = support_count;

            uint uid = UnitForm.GetUnitIDWhereSupportAddr(U.toOffset(this.Address.Value));

            if (uid == U.NOT_FOUND)
            {
                return;
            }
            uid++;

            Undo.UndoData undodata = Program.Undo.NewUndoData(this);
            AutoCollectByTargetSupport(uid, (uint)this.B0.Value, (uint)this.B7.Value, (uint)this.B14.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B1.Value, (uint)this.B8.Value, (uint)this.B15.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B2.Value, (uint)this.B9.Value, (uint)this.B16.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B3.Value, (uint)this.B10.Value, (uint)this.B17.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B4.Value, (uint)this.B11.Value, (uint)this.B18.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B5.Value, (uint)this.B12.Value, (uint)this.B19.Value, undodata);
            AutoCollectByTargetSupport(uid, (uint)this.B6.Value, (uint)this.B13.Value, (uint)this.B20.Value, undodata);
            Program.Undo.Push(undodata);
        }
Esempio n. 25
0
        //支援はなぜかポインタ指定なのでユニットの支援ポインタを書き換えます。
        public static void AddressListExpandsEvent(object sender, EventArgs arg)
        {
            InputFormRef.ExpandsEventArgs eearg = (InputFormRef.ExpandsEventArgs)arg;
            uint oldaddr  = eearg.OldBaseAddress;
            int  oldcount = (int)eearg.OldDataCount;

            uint newaddr  = eearg.NewBaseAddress;
            int  newcount = (int)eearg.NewDataCount;

            //リストを縮めた場合も考慮したい.
            uint newaddr_limit = (uint)(newaddr + (eearg.BlockSize * newcount));

            List <U.AddrResult> unitlist = UnitForm.MakeUnitList();

            Undo.UndoData undodata = Program.Undo.NewUndoData("ChangeSupportPointer");
            int           i;

            for (i = 0; i < oldcount; i++)
            {
                uint support_addr = (uint)(oldaddr + (i * eearg.BlockSize));
                for (int n = 0; n < unitlist.Count; n++)
                {
                    uint addr44 = unitlist[n].addr + 44;

                    if (support_addr == Program.ROM.p32(addr44))
                    {//FE6,FE7,FE8共通で offset+44が支援ポインタ
                        uint change_addr = (uint)(newaddr + (i * eearg.BlockSize));
                        if (change_addr > newaddr_limit)
                        {//リストが縮小されたので無効化する.
                            change_addr = 0;
                        }

                        Program.ROM.write_p32(addr44, change_addr, undodata);
                    }
                }
            }
            //増えた分はわかるように設定します.
            byte[] cleadata = new byte[eearg.BlockSize];
            cleadata[0] = 0xf;
            cleadata[1] = 0xe;
            cleadata[2] = 0xe;
            cleadata[3] = 0xe;

            for (; i < newcount; i++)
            {
                uint support_addr = (uint)(newaddr + (i * eearg.BlockSize));

                //先頭2バイトでデータ生存判定をしているので、それは残す
                undodata.list.Add(new Undo.UndoPostion(support_addr, eearg.BlockSize));
                Program.ROM.write_range(support_addr, cleadata);
            }
            Program.Undo.Push(undodata);

            //リードしなおしてください.
            eearg.IsReload = true;
        }
Esempio n. 26
0
        public void InitExportFilter(uint filter)
        {
            List <UseValsID> list = new List <UseValsID>();

            if (filter == 1)
            {//ユニット関係のみ
                UnitForm.MakeVarsIDArray(list);
            }
            else if (filter == 2)
            {//クラス関係のみ
                ClassForm.MakeVarsIDArray(list);
            }
            else if (filter == 3)
            {//アイテム関係のみ
                ItemForm.MakeVarsIDArray(list);
            }
            else if (filter == 4)
            {//サウンドルーム関係のみ
                if (Program.ROM.RomInfo.version == 6)
                {
                    SoundRoomFE6Form.MakeVarsIDArray(list);
                }
                else
                {
                    SoundRoomForm.MakeVarsIDArray(list);
                }
            }
            else if (filter == 5)
            {//支援会話関係
                SupportTalkForm.MakeVarsIDArray(list);
            }
            else if (filter == 6)
            {//スキル関係
                if (Program.ROM.RomInfo.is_multibyte)
                {
                    SkillConfigFE8NSkillForm.MakeVarsIDArray(list);
                    SkillConfigFE8NVer2SkillForm.MakeVarsIDArray(list);
                }
                else
                {
                    SkillConfigSkillSystemForm.MakeVarsIDArray(list);
                }
            }
            else
            {//all
                ExportFilterArray = null;
                return;
            }

            ExportFilterArray = new Dictionary <int, bool>();
            foreach (UseValsID val in list)
            {
                ExportFilterArray[(int)val.ID] = true;
            }
        }
Esempio n. 27
0
        public static void CheckPrologeEventPointerErrors(uint mapid, List <ErrorSt> errors)
        {
            List <U.AddrResult> units = EventCondForm.MakeUnitPointer(mapid);

            for (int i = 0; i < units.Count; i++)
            {
                uint addr     = units[i].addr;
                uint pageSize = Program.ROM.RomInfo.eventunit_data_size();
                for (; Program.ROM.u8(addr) != 0x0; addr += pageSize)
                {
                    if (!U.isSafetyOffset(addr + pageSize))
                    {
                        break;
                    }
                    uint unitGrow = Program.ROM.u8(addr + 3);
                    uint assign   = U.ParseUnitGrowAssign(unitGrow);
                    if (assign != 0)
                    {//自軍でないなら関係ない.
                        continue;
                    }

                    uint unit_id = Program.ROM.u8(addr);
                    if (!UnitForm.isMainUnit(unit_id))
                    {
                        continue;
                    }

                    if (!UnitForm.isLoadClass(unit_id))
                    {
                        uint class_id = Program.ROM.u8(addr + 1);
                        if (class_id == 0)
                        {//未入力の場合は推測します.
                            class_id = UnitForm.GetClassID(unit_id);
                        }
                        if (!ClassForm.isLoadClass(class_id))
                        {
                            continue;
                        }
                    }
                    //条件にマッチするロードユニットを発見
                    return;
                }
            }

            if (Program.ROM.RomInfo.version() == 7)
            {
                errors.Add(new FELint.ErrorSt(EventCondForm.CONDTYPE.PLAYER_UNIT, U.NOT_FOUND
                                              , R._("序章でUnitID:0x01 or 0x02 or 0x03のロードユニットを仲間にしていません。\r\n序章で、このロードユニットを仲間に入れないと多くのイベントがフリーズします。")));
            }
            else
            {
                errors.Add(new FELint.ErrorSt(EventCondForm.CONDTYPE.PLAYER_UNIT, U.NOT_FOUND
                                              , R._("序章でUnitID:0x01のロードユニットを仲間にしていません。\r\n序章で、このロードユニットを仲間に入れないと多くのイベントがフリーズします。")));
            }
        }
        //待機アイコン + テキストを書くルーチン
        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));
            }
            string text = lb.Items[index].ToString();

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

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

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

            if (index == 0)
            {
                bitmap = ImageUtil.Blank(8, 8);
            }
            else
            {
                uint typeID = GetTypeID();
                if (typeID <= 1)
                {
                    bitmap = UnitForm.DrawUnitMapFacePicture(icon);
                }
                else
                {
                    bitmap = ClassForm.DrawWaitIcon(icon, 0, true);
                }
            }
            U.MakeTransparent(bitmap);

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

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

            //テキストを描く.
            b         = bounds;
            b.Y      += textmargineY;
            bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, b);
            bounds.Y += ListBoxEx.OWNER_DRAW_ICON_SIZE;

            brush.Dispose();
            return(new Size(bounds.X, bounds.Y));
        }
Esempio n. 29
0
        public static Bitmap DrawAIUnitsList(uint units_address, int iconSize)
        {
            units_address = U.toOffset(units_address);
            if (!U.isSafetyOffset(units_address))
            {
                return(ImageUtil.BlankDummy());
            }

            int  count = 0;
            uint addr  = units_address;

            while (Program.ROM.u16(addr) != 0x0)
            {
                addr += 2;
                if (!U.isSafetyOffset(addr))
                {
                    break;
                }
                count++;
            }
            if (count <= 0)
            {
                return(ImageUtil.BlankDummy());
            }

            Bitmap    bitmap = new Bitmap(iconSize * count, iconSize);
            Rectangle bounds = new Rectangle(0, 0, bitmap.Width, bitmap.Height);

            using (Graphics g = Graphics.FromImage(bitmap))
            {
                addr = units_address;
                for (int i = 0; i < count; i++)
                {
                    uint   unit_id = Program.ROM.u8(addr + 0);
                    Bitmap icon    = UnitForm.DrawUnitMapFacePicture(unit_id);
                    if (ImageUtil.IsBlankBitmap(icon))
                    {
                        uint class_id = UnitForm.GetClassID(unit_id);
                        icon = ClassForm.DrawWaitIcon(class_id);
                    }
                    U.MakeTransparent(icon);

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

                    bounds.X += U.DrawPicture(icon, g, true, b);
                    addr     += 2;
                }
            }
            return(bitmap);
        }
Esempio n. 30
0
        public GrowSimulator BuildSim()
        {
            GrowSimulator sim = new GrowSimulator();

            UnitForm.GetSim(ref sim
                            , (uint)B0.Value //ユニット
                            );
            ClassForm.GetSim(ref sim
                             , (uint)B1.Value //クラス
                             );

            return(sim);
        }