예제 #1
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);
            }
        }