static InputFormRef N_Init(Form self)
 {
     return(new InputFormRef(self
                             , "N_"
                             , Program.ROM.RomInfo.worldmap_event_on_stageselect_pointer()
                             , 4
                             , (int i, uint addr) =>
     {
         if (i == 0)
         {
             return true;
         }
         return U.isPointer(Program.ROM.u32(addr))
         ;
     }
                             , (int i, uint addr) =>
     {
         string name = "";
         if (i > 0)
         {
             name = MapSettingForm.GetMapNameFromWorldMapEventID((uint)i);
         }
         return U.ToHexString(i) + " " + name;
     }
                             ));
 }
Exemple #2
0
        static InputFormRef N_Init(Form self)
        {
            return(new InputFormRef(self
                                    , "N_"
                                    , Program.ROM.RomInfo.map_setting_pointer()
                                    , Program.ROM.RomInfo.map_setting_datasize()
                                    , (int i, uint addr) =>
            {
                //0 がポインタであればデータがあると考える.
                uint a = Program.ROM.u32(addr + 0);
                //                    return U.isPointer(a) || a == 0;
                return U.isPointer(a);
            }
                                    , (int i, uint addr) =>
            {
                U.AddrResult r = new U.AddrResult();

                uint worldmapEventPlist = MapSettingForm.GetWorldMapEventIDWhereAddr(addr);
                if (worldmapEventPlist <= 0)
                {
                    return r;
                }

                r.name = U.ToHexString(i) + MapSettingForm.GetMapNameWhereAddr(addr);
                r.addr = Program.ROM.p32(Program.ROM.RomInfo.map_map_pointer_pointer()) + (worldmapEventPlist * 4);
                return r;
            }
                                    ));
        }
Exemple #3
0
 public void JumpToMAPID(uint mapid)
 {
     MapSettingForm.PLists plist = MapSettingForm.GetMapPListsWhereMapID(mapid);
     for (int i = 0; i < this.MapEditConf.Count; i++)
     {
         if (plist.anime1_plist == this.MapEditConf[i].anime1_plist &&
             plist.anime2_plist == this.MapEditConf[i].anime2_plist &&
             plist.config_plist == this.MapEditConf[i].config_plist &&
             plist.obj_plist == this.MapEditConf[i].obj_plist &&
             plist.palette_plist == this.MapEditConf[i].palette_plist
             )
         {
             JumpTo(i);
             return;
         }
     }
     for (int i = 0; i < this.MapEditConf.Count; i++)
     {
         if (plist.config_plist == this.MapEditConf[i].config_plist &&
             plist.obj_plist == this.MapEditConf[i].obj_plist &&
             plist.palette_plist == this.MapEditConf[i].palette_plist
             )
         {
             JumpTo(i);
             return;
         }
     }
 }
        public EventUnitFE6Form()
        {
            InitializeComponent();

            this.MAP_LISTBOX.OwnerDraw(ListBoxEx.DrawTextOnly, DrawMode.OwnerDrawFixed);
            this.AddressList.OwnerDraw(EventUnitForm.AddressList_Draw, DrawMode.OwnerDrawVariable);
            this.EVENT_LISTBOX.OwnerDraw(EventUnitForm.EVENT_LISTBOX_Draw, DrawMode.OwnerDrawVariable);

            this.InputFormRef = Init(this);

            //マップIDリストを作る.
            U.ConvertListBox(MapSettingForm.MakeMapIDList(), ref this.MAP_LISTBOX);

            //AI
            EventUnitForm.AI1ToCombo(L_12_COMBO);
            EventUnitForm.AI2ToCombo(L_13_COMBO);
            EventUnitForm.AI3ToCombo(L_14_AI3_HYOUTEKI);

            //右クリックメニューを出す.
            this.InputFormRef.MakeGeneralAddressListContextMenu(true);

            this.InputFormRef.PreAddressListExpandsEvent += EventUnitForm.OnPreClassExtendsWarningHandler;
            this.InputFormRef.AddressListExpandsEvent    += AddressListExpandsEvent;

            this.MapPictureBox.MapMouseDownEvent += MapMouseDownEvent;

//            //ユニットID重複チェック
//            //ダメ、重複が許されるケースがあった
//            this.B0.ValueChanged += EventUnitForm_CheckDuplicatePlayerUnits;
        }
        public EventUnitFE7Form()
        {
            InitializeComponent();

            this.InputFormRef = Init(this);

            this.MAP_LISTBOX.OwnerDraw(ListBoxEx.DrawTextOnly, DrawMode.OwnerDrawFixed);
            this.AddressList.OwnerDraw(EventUnitForm.AddressList_Draw, DrawMode.OwnerDrawVariable);
            this.EVENT_LISTBOX.OwnerDraw(EventUnitForm.EVENT_LISTBOX_Draw, DrawMode.OwnerDrawVariable);

            //マップIDリストを作る.
            U.ConvertListBox(MapSettingForm.MakeMapIDList(), ref this.MAP_LISTBOX);

            EventUnitForm.AI1ToCombo(L_12_COMBO);
            EventUnitForm.AI2ToCombo(L_13_COMBO);
            EventUnitForm.AI3ToCombo(L_14_AI3_HYOUTEKI);

            //右クリックメニューを出す.
            this.InputFormRef.MakeGeneralAddressListContextMenu(true, true, CustomKeydownHandler);

            this.InputFormRef.PreAddressListExpandsEvent += EventUnitForm.OnPreClassExtendsWarningHandler;
            this.InputFormRef.AddressListExpandsEvent    += AddressListExpandsEvent;

            this.MapPictureBox.MapMouseDownEvent += MapMouseDownEvent;

            this.L_3_UNITGROW_LV.ValueChanged           += Sim_Change_EventHandler;
            this.L_3_UNITGROW_GROW.SelectedIndexChanged += Sim_Change_EventHandler;

            this.L_3_UNITGROW_LV.Enter   += Sim_Show_EventHandler;
            this.L_3_UNITGROW_GROW.Enter += Sim_Show_EventHandler;

            this.L_3_UNITGROW_LV.Leave   += Sim_Hide_EventHandler;
            this.L_3_UNITGROW_GROW.Leave += Sim_Hide_EventHandler;
            this.X_Sim.Hide();
        }
        //エラー検出
        public static void MakeCheckErrors(uint mapid, List <FELint.ErrorSt> errors)
        {
            List <uint> tracelist = new List <uint>();
            uint        wmapid    = MapSettingForm.GetWorldMapEventIDWhereMapID(mapid);

            if (wmapid == 0)
            {//存在しない
                return;
            }
            //FE7はINDEX
            uint         p;
            InputFormRef InputFormRef = N_Init(null);

            p = InputFormRef.IDToAddr(wmapid);
            if (p == U.NOT_FOUND)
            {
                errors.Add(new FELint.ErrorSt(FELint.Type.MAPSETTING_WORLDMAP, U.NOT_FOUND
                                              , R._("対応するワールドマップイベント({0})が存在しません。", U.To0xHexString(wmapid))));
            }
            else
            {
                uint event_addr = Program.ROM.u32(p);
                FELint.CheckEventPointer(event_addr, errors, FELint.Type.WORLDMAP_EVENT, p, true, tracelist);
            }
        }
Exemple #7
0
        //マップのタイルの種類だけの配列を作る
        public static byte[] LoadMapTileIDs(uint mapid, out int outMapWidth, out int outMapHeight)
        {
            MapSettingForm.PLists plists = MapSettingForm.GetMapPListsWhereMapID(mapid);
            ushort[] mar = ImageUtilMap.UnLZ77MapDataUShort(plists.mappointer_plist, out outMapWidth, out outMapHeight);
            if (mar == null)
            {
                return(null);
            }

            byte[] configUZ = ImageUtilMap.UnLZ77ChipsetData(plists.config_plist);
            if (configUZ == null)
            {
                return(null);
            }

            int size = outMapWidth * outMapHeight;

            byte[] tiles = new byte[size];
            for (int i = 0; i < size; i++)
            {
                uint terrain_data = ImageUtilMap.GetChipsetID(mar[i], configUZ);
                if (terrain_data == U.NOT_FOUND)
                {
                    continue;
                }
                tiles[i] = (byte)terrain_data;
            }
            return(tiles);
        }
        static List <U.AddrResult> MakeTileAnimation2()
        {
            Dictionary <uint, bool> alreadFound = new Dictionary <uint, bool>();
            List <U.AddrResult>     ret_list    = new List <U.AddrResult>();
            uint mapmax = MapSettingForm.GetDataCount();

            for (uint i = 0; i < mapmax; i++)
            {
                MapSettingForm.PLists plist = MapSettingForm.GetMapPListsWhereMapID(i);
                if (plist.anime2_plist == 0)
                {
                    continue;
                }
                if (alreadFound.ContainsKey(plist.anime2_plist))
                {
                    continue;
                }

                uint   addr = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.ANIMATION2, plist.anime2_plist);
                string name = R._("タイルアニメーション2 パレットアニメ:{0}", U.ToHexString(plist.anime2_plist));
                if (addr == U.NOT_FOUND)
                {
                    name += R._("(破損)");
                }
                U.AddrResult ar = new U.AddrResult(addr, name, plist.anime2_plist);
                ret_list.Add(ar);

                alreadFound[plist.anime2_plist] = true;
            }
            return(ret_list);
        }
Exemple #9
0
        private void N_P8_ValueChanged(object sender, EventArgs e)
        {
            if (this.InputFormRef != null && this.InputFormRef.IsUpdateLock)
            {
                return;
            }

            U.AddrResult ar             = InputFormRef.SelectToAddrResult(this.AddressList);
            uint         mapid          = ar.tag;
            int          width          = (int)N_B3.Value;
            int          height         = (int)N_B4.Value;
            uint         change_address = (uint)N_P8.Value;

            MapPictureBox.SetDefualtIcon(
                MapSettingForm.DrawMapChange(mapid, width, height, change_address)
                );
            if (!U.isSafetyPointer(change_address))
            {
                if (change_address == 0)
                {
                    N_J_8.ErrorMessage = R._("データが設定されていません。マップエディタから、データを作成してください。");
                }
                else
                {
                    N_J_8.ErrorMessage = R._("ポインタが正しくありません");
                }
            }
            else
            {
                N_J_8.ErrorMessage = "";
            }
        }
        public static List <ChangeSt> MakeChangeList(uint mapid)
        {
            List <ChangeSt> changeList = new List <ChangeSt>();

            uint change_addr = MapSettingForm.GetMapChangeAddrWhereMapID(mapid);

            if (change_addr == U.NOT_FOUND)
            {
                return(changeList);
            }

            InputFormRef N_InputFormRef = N_Init(null);

            N_InputFormRef.ReInit(change_addr);
            for (int i = 0; i < N_InputFormRef.DataCount; i++)
            {
                ChangeSt p = new ChangeSt();
                p.no               = Program.ROM.u8(change_addr + 0);
                p.x                = Program.ROM.u8(change_addr + 1);
                p.y                = Program.ROM.u8(change_addr + 2);
                p.width            = Program.ROM.u8(change_addr + 3);
                p.height           = Program.ROM.u8(change_addr + 4);
                p.addr             = Program.ROM.p32(change_addr + 8);
                p.self_change_addr = change_addr;
                changeList.Add(p);

                change_addr += N_InputFormRef.BlockSize;
            }

            return(changeList);
        }
        private void FilterComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.InputFormRef == null)
            {
                return;
            }

            U.AddrResult ar = InputFormRef.SelectToAddrResult(FilterComboBox, FilterComboBox.SelectedIndex);
            if (ar.isNULL())
            {
                return;
            }
            //サンプルのマップを表示します.
            uint mapmax = MapSettingForm.GetDataCount();

            for (uint i = 0; i < mapmax; i++)
            {
                MapSettingForm.PLists plist = MapSettingForm.GetMapPListsWhereMapID(i);
                if (plist.anime2_plist == ar.tag)
                {
                    this.MapPictureBox.LoadMap(i);
                    break;
                }
            }

            this.InputFormRef.ReInit(ar.addr);
        }
        public static uint CheckDuplicateMapChangeID(uint mapid, int current_no)
        {
            List <ChangeSt> changeList  = new List <ChangeSt>();
            uint            change_addr = MapSettingForm.GetMapChangeAddrWhereMapID(mapid);

            if (change_addr == U.NOT_FOUND)
            {
                return(U.NOT_FOUND);
            }
            InputFormRef N_InputFormRef = N_Init(null);

            N_InputFormRef.ReInit(change_addr);
            if (current_no >= N_InputFormRef.DataCount)
            {
                return(U.NOT_FOUND);
            }

            change_addr = change_addr + (uint)(current_no * N_InputFormRef.BlockSize);
            if (!U.isSafetyOffset(change_addr))
            {
                return(U.NOT_FOUND);
            }

            uint no = Program.ROM.u8(change_addr + 0);

            if (CheckDuplicateMapChangeIDLow(mapid, N_InputFormRef, no, change_addr))
            {
                return(MakeNewUniqeMapChangeID(mapid, N_InputFormRef, change_addr));
            }

            return(U.NOT_FOUND);
        }
        //分割していない場合
        static string GetPListNameNotSplite(uint plist, List <U.AddrResult> mapSetting)
        {
            if (plist == 0)
            {//0番はnull
                return("NULL");
            }

            for (int mapid = 0; mapid < mapSetting.Count; mapid++)
            {
                uint addr = mapSetting[mapid].addr;
                MapSettingForm.PLists plists = MapSettingForm.GetMapPListsWhereAddr(addr);
                if (plists.anime1_plist == plist)
                {
                    return("ANIME1 " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (plists.anime2_plist == plist)
                {
                    return("ANIME2 " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (plists.config_plist == plist)
                {
                    return("CONFIG " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (plists.event_plist == plist)
                {
                    return("EVENT " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (plists.mapchange_plist == plist)
                {
                    return("MAPCHANGE " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (plists.mappointer_plist == plist)
                {
                    return("MAP " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (plists.palette_plist == plist)
                {
                    return("PAL " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                uint obj_plist_low  = (plists.obj_plist & 0xFF);
                uint obj_plist_high = ((plists.obj_plist >> 8) & 0xFF);
                if (obj_plist_low == plist)
                {
                    return("OBJ " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (obj_plist_high == plist)
                {
                    return("OBJ " + MapSettingForm.GetMapNameWhereAddr(addr));
                }
                if (Program.ROM.RomInfo.version() == 6)
                {
                    uint wmapevent_plist = MapSettingForm.GetWorldMapEventIDWhereAddr(addr);
                    if (wmapevent_plist == 0)
                    {
                        return("WMEVENT " + MapSettingForm.GetMapNameWhereAddr(addr));
                    }
                }
            }
            return("UNK");
        }
Exemple #14
0
        private void MAP_LISTBOX_SelectedIndexChanged(object sender, EventArgs e)
        {
            uint mapid = (uint)MAP_LISTBOX.SelectedIndex;

            if (mapid == U.NOT_FOUND)
            {
                return;
            }
            uint addr = MapSettingForm.GetEventAddrWhereMapID(mapid);

            if (!U.isSafetyOffset(addr))
            {
                return;
            }

            List <U.AddrResult> list = EventCondForm.MakeUnitPointer(mapid);

            //未記帳の拡張した領域があれば追加する.
            EventUnitForm.AppendNoWriteNewData(list, mapid);

            U.ConvertListBox(list, ref this.EVENT_LISTBOX);
            if (this.EVENT_LISTBOX.Items.Count > 0)
            {
                this.EVENT_LISTBOX.SelectedIndex = 0;
            }
            else
            {
                MapPictureBox.LoadMap(mapid);
            }
        }
Exemple #15
0
        //全データの取得
        public static void MakeAllDataLength(List <Address> list)
        {
            InputFormRef InputFormRef = Init(null);

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

            uint mapmax = MapSettingForm.GetDataCount();

            for (uint mapid = 0; mapid < mapmax; mapid++)
            {
                uint exit_addr = InputFormRef.IDToAddr(mapid);
                if (exit_addr == U.NOT_FOUND)
                {
                    continue;
                }

                {
                    uint a = Program.ROM.p32(exit_addr);
                    if (a == U.NOT_FOUND)
                    {
                        continue;
                    }

                    InputFormRef N_InputFormRef = N_Init(null);
                    N_InputFormRef.ReInitPointer(exit_addr);

                    string name = "MapExit map:" + U.To0xHexString(mapid);
                    FEBuilderGBA.Address.AddAddress(list, N_InputFormRef, name, new uint[] {  });
                }
            }

            //NPC離脱
            InputFormRef.ReInit(
                Program.ROM.p32(Program.ROM.RomInfo.map_exit_point_pointer) + (4 * Program.ROM.RomInfo.map_exit_point_npc_blockadd));
            FEBuilderGBA.Address.AddAddressButIgnorePointer(list, InputFormRef, "MapExit NPC", new uint[] { 0 });

            mapmax = MapSettingForm.GetDataCount();
            for (uint mapid = 0; mapid < mapmax; mapid++)
            {
                uint exit_addr = InputFormRef.IDToAddr(mapid);
                if (exit_addr == U.NOT_FOUND)
                {
                    continue;
                }

                {
                    uint a = Program.ROM.p32(exit_addr);
                    if (a == U.NOT_FOUND)
                    {
                        continue;
                    }

                    InputFormRef N_InputFormRef = N_Init(null);
                    N_InputFormRef.ReInitPointer(exit_addr);

                    string name = "MapExit map:" + U.To0xHexString(mapid) + " NPC";
                    FEBuilderGBA.Address.AddAddress(list, N_InputFormRef, name, new uint[] {  });
                }
            }
        }
        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) + ")";
            }
                                    ));
        }
Exemple #17
0
        //FELintスキャン(スレッドで実行する)
        void ScanFELintByThread(List <DisassemblerTrumb.LDRPointer> ldrmap)
        {
            Dictionary <uint, List <FELint.ErrorSt> > newFELintCache = new Dictionary <uint, List <FELint.ErrorSt> >();
            //システム全体の問題
            {
                List <FELint.ErrorSt> errorList = FELint.ScanMAP(FELint.SYSTEM_MAP_ID, ldrmap);
                errorList = FELint.HiddenErrorFilter(errorList);
                newFELintCache[FELint.SYSTEM_MAP_ID] = errorList;
            }

            uint mapCount = MapSettingForm.GetDataCount();

            for (int i = 0; i < mapCount; i++)
            {
                if (IsStopFlag)
                {
                    return;
                }

                uint mapid = (uint)i;

                //このマップのエラースキャン
                List <FELint.ErrorSt> errorList = FELint.ScanMAP(mapid, ldrmap);
                errorList             = FELint.HiddenErrorFilter(errorList);
                newFELintCache[mapid] = errorList;
            }
            UpdateFELintCache(newFELintCache);
        }
 public void Init(uint mapid, bool showAllError)
 {
     this.ShowAllError.Checked = showAllError;
     this.MapID = mapid;
     this.EventCond_Label.Text = R._("エラー:") + MapSettingForm.GetMapName(this.MapID);
     Scan();
 }
        static List <U.AddrResult> MakeShopListLow()
        {
            List <U.AddrResult> ret = new List <U.AddrResult>();
            uint p;

            //編成準備店.
            p = Program.ROM.RomInfo.item_shop_hensei_pointer;
            if (p != 0)
            {
                ret.Add(new U.AddrResult(
                            Program.ROM.p32(p)
                            , R._("編成準備店")
                            , p));
            }
            if (Program.ROM.RomInfo.version >= 8)
            {
                //まずワールドマップイベントをスキャン.
                List <U.AddrResult> worldmaplist = WorldMapPointForm.MakeWorldMapPointList();
                for (uint i = 0; i < worldmaplist.Count; i++)
                {
                    List <U.AddrResult> shops =
                        WorldMapPointForm.GetShopAddr(U.toOffset(worldmaplist[(int)i].addr));
                    foreach (U.AddrResult shop in shops)
                    {
                        if (Program.ROM.u8(shop.addr) == 0)
                        {//店に品物がない.
                            continue;
                        }

                        ret.Add(shop);
                    }
                }
            }
            List <U.AddrResult> maplist = MapSettingForm.MakeMapIDList();

            for (int n = 0; n < maplist.Count; n++)
            {
                uint addr = MapSettingForm.GetEventAddrWhereMapID((uint)n);
                if (!U.isSafetyOffset(addr))
                {
                    continue;
                }
                string mapname = MapSettingForm.GetMapName((uint)n);

                List <U.AddrResult> shops = EventCondForm.MakeShopPointerListBox(addr);
                foreach (U.AddrResult shop in shops)
                {
                    if (Program.ROM.u8(shop.addr) == 0)
                    {//店に品物がない.
                        continue;
                    }
                    shop.name = mapname + " " + shop.name;
                    ret.Add(shop);
                }
            }

            return(ret);
        }
Exemple #20
0
        private void MapStyleEditorForm_Load(object sender, EventArgs e)
        {
            IsInit = true;

            //マップIDリストを作る.
            List <U.AddrResult> maplist = MapSettingForm.MakeMapIDList();

            //マップスタイルリストを作る
            this.MapEditConf = MapEditorForm.MakeMapStyleList(maplist);
            //マップスタイルリストを作る
            MakeMapStyleCombo();

            U.SelectedIndexSafety(this.MapStyle, 0);

            List <U.AddrResult> terrainList = MapTerrainNameForm.MakeList();

            U.ConvertComboBox(terrainList, ref this.ConfigTerrain);

            //マップオブジェクト
            this.MAP.SetChipSize(8);
            Bitmap black = ImageUtil.BlankDummy();

            U.MakeTransparent(black);
            this.MAP.SetDefaultIcon(black);

            //パレット
            this.PFR = new PaletteFormRef(this);
            PFR.MakePaletteUI(OnChangeColor, GetSampleBitmap);
            U.SelectedIndexSafety(this.PaletteCombo, 0);

            //TSA変更のイベント適応.
            List <Control> controls = InputFormRef.GetAllControls(this);

            InputFormRef.MakeLinkEvent("Config_", controls);


            //最大化禁止
            //C#のバグである Anchorを四隅にすると、スクロールバーが消えるというバグに対処するために、
            //フォームを固定化しないとおかしなことになる。
            //クレームは microsoft あたりまでどうぞ.
            this.MaximizeBox = false;
            IsInit           = false;

            U.AllowDropFilename(this, ImageFormRef.IMAGE_FILE_FILTER, (string filename) =>
            {
                using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename))
                {
                    ObjImportButton_Click(null, null);
                }
            });
            U.AllowDropFilename(this, new string[] { ".MAPCHIP_CONFIG" }, (string filename) =>
            {
                using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename))
                {
                    MapChipImportButton_Click(null, null);
                }
            });
        }
Exemple #21
0
        private void ExportGif(string filename)
        {
            uint mapid = this.MapPictureBox.GetMapID();

            if (mapid == U.NOT_FOUND)
            {
                return;
            }
            MapSettingForm.PLists plist = MapSettingForm.GetMapPListsWhereMapID(mapid);
            if (plist.palette_plist == 0)
            {
                return;
            }
            uint palette = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.PALETTE, plist.palette_plist);

            if (palette == U.NOT_FOUND)
            {
                return;
            }
            int palette_index = SamplePaletteComboBox.SelectedIndex;

            if (palette_index < 0)
            {
                palette_index = 0;
            }

            uint addr = InputFormRef.BaseAddress;

            if (!U.isSafetyOffset(addr))
            {
                return;
            }

            //同じアニメを何度も出力しないように記録する.
            List <ImageUtilAnimeGif.Frame> bitmaps = new List <ImageUtilAnimeGif.Frame>();

            for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
            {
                uint wait   = Program.ROM.u16(addr + 0);
                uint length = Program.ROM.u16(addr + 2);
                uint p4     = Program.ROM.p32(addr + 4);
                if (!U.isSafetyOffset(p4))
                {
                    continue;
                }

                MapSettingForm.MapAnimations anime = new MapSettingForm.MapAnimations();
                anime.change_bitmap_bytes = GetTileAnime1(p4, length);

                Bitmap mapBitmap = MapSettingForm.DrawMap(mapid, anime);
                bitmaps.Add(new ImageUtilAnimeGif.Frame(mapBitmap, wait));
            }

            //アニメgif生成
            ImageUtilAnimeGif.SaveAnimatedGif(filename, bitmaps);
            U.SelectFileByExplorer(filename);
        }
Exemple #22
0
        public ToolUseFlagForm()
        {
            InitializeComponent();
            this.AddressList.OwnerDraw(Draw, DrawMode.OwnerDrawVariable);

            //マップIDリストを作る.
            U.ConvertListBox(MapSettingForm.MakeMapIDList(), ref this.MAP_LISTBOX);
            this.MAP_LISTBOX.OwnerDraw(ListBoxEx.DrawTextOnly, DrawMode.OwnerDrawFixed);
        }
        static InputFormRef Init(Form self, bool isPLISTSplit)
        {
            List <U.AddrResult> mapSetting = MapSettingForm.MakeMapIDList();
            uint limit;

            if (isPLISTSplit)
            {//plistはbyteで参照するため、255までしかありえない
                limit = 256;
            }
            else
            {
                limit = Program.ROM.RomInfo.map_map_pointer_list_default_size;
            }

            InputFormRef ifr = null;

            ifr = new InputFormRef(self
                                   , ""
                                   , 0
                                   , 4
                                   , (int i, uint addr) =>
            {
                if (i == 0)
                {
                    return(true);
                }
                if (i >= limit)
                {
                    return(false);
                }
                return(true);
            }
                                   , (int i, uint addr) =>
            {
                if (self == null)
                {
                    return("");
                }

                uint plist = (uint)i;
                string usermapname;
                if (isPLISTSplit)
                {
                    usermapname = GetPListNameSplited(plist, ifr.BaseAddress, mapSetting);
                }
                else
                {
                    usermapname = GetPListNameNotSplite(plist, mapSetting);
                }

                return(U.ToHexString(i) + " " + usermapname);
            }
                                   );
            return(ifr);
        }
        string PlistToName(uint plist)
        {
            Debug.Assert(SearchType != MapPointerForm.PLIST_TYPE.UNKNOWN);

            if (plist == 0)
            {
                IsAlreadyUse = true;
                return(R._("PLIST=0は、書き込み禁止です。"));
            }
            List <uint> maps;

            if (MapPointerForm.IsPlistSplits())
            {//分割しているので、マップ変化だけを調べる.
                maps = MapSettingForm.GetMapIDsWherePlist(this.SearchType, plist);
                if (maps.Count < 1)
                {
                    if (this.SearchType == MapPointerForm.PLIST_TYPE.PALETTE)
                    {//パレットはオブジェクトも調べる
                        maps = MapSettingForm.GetMapIDsWherePlist(MapPointerForm.PLIST_TYPE.OBJECT, plist);
                    }
                    else if (this.SearchType == MapPointerForm.PLIST_TYPE.OBJECT)
                    {//オブジェクトはパレットも調べる
                        maps = MapSettingForm.GetMapIDsWherePlist(MapPointerForm.PLIST_TYPE.PALETTE, plist);
                    }
                    if (this.SearchType == MapPointerForm.PLIST_TYPE.ANIMATION)
                    {//ANIMATION1はANIMATION2も調べる
                        maps = MapSettingForm.GetMapIDsWherePlist(MapPointerForm.PLIST_TYPE.ANIMATION2, plist);
                    }
                    else if (this.SearchType == MapPointerForm.PLIST_TYPE.ANIMATION2)
                    {//ANIMATION2はANIMATION1も調べる
                        maps = MapSettingForm.GetMapIDsWherePlist(MapPointerForm.PLIST_TYPE.ANIMATION, plist);
                    }
                }
            }
            else
            {//分割していないので、全部調べる必要がある
                maps = MapSettingForm.GetMapIDsWherePlist(MapPointerForm.PLIST_TYPE.UNKNOWN, plist);
            }
            if (maps.Count >= 1)
            {
                IsAlreadyUse = true;
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < maps.Count; i++)
                {
                    if (i != 0)
                    {
                        sb.Append(",");
                    }
                    sb.Append(MapSettingForm.GetMapName(maps[i]));
                }
                return(R._("既に利用されています。\r\n利用マップ:{0}", sb.ToString()));
            }
            IsAlreadyUse = false;
            return(R._("マップ設定では参照されていません。\r\n(このPLISTの利用を推奨します)"));
        }
        private void P8_ValueChanged(object sender, EventArgs e)
        {
            uint mapid          = (uint)MAP_LISTBOX.SelectedIndex;
            int  width          = (int)B3.Value;
            int  height         = (int)B4.Value;
            uint change_address = (uint)P8.Value;

            MapPictureBox.SetDefualtIcon(
                MapSettingForm.DrawMapChange(mapid, width, height, change_address)
                );
        }
Exemple #26
0
        public static uint GetEventByMapID(uint mapid)
        {
            uint wmapid = MapSettingForm.GetWorldMapEventIDWhereMapID(mapid);

            if (wmapid == 0)
            {//存在しない
                return(U.NOT_FOUND);
            }
            //FE6はPLISTが格納されている.
            return(MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.WORLDMAP_FE6ONLY, wmapid));
        }
        public EventMapChangeForm()
        {
            InitializeComponent();

            this.InputFormRef = Init(this);

            //マップIDリストを作る.
            U.ConvertListBox(MapSettingForm.MakeMapIDList(), ref this.MAP_LISTBOX);
            //マップを最前面に移動する.
            MapPictureBox.BringToFront();
        }
Exemple #28
0
        //マップ領域のベース領域の強制割り当て
        public static uint PreciseMapDataArea(uint mapid)
        {
            MapPointerNewPLISTPopupForm f = (MapPointerNewPLISTPopupForm)InputFormRef.JumpFormLow <MapPointerNewPLISTPopupForm>();

            f.Init(MapPointerForm.PLIST_TYPE.MAP);
            DialogResult dr = f.ShowDialog();

            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return(0);
            }

            uint plist = f.GetSelectPLIST();

            Undo.UndoData undodata = Program.Undo.NewUndoData("Precise MapDataArea", mapid.ToString("X"));


            //マップ領域を新規に割り当てる
            byte[] data = new byte[2 + (15 * 10)];
            data[0] = 15;
            data[1] = 10;

            data = LZ77.compress(data);

            MapSettingForm.PLists plists = MapSettingForm.GetMapPListsWhereMapID(mapid);
            uint map_addr = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.MAP, plists.mappointer_plist);

            if (U.isSafetyOffset(map_addr))
            {//既存マップがあればコピーする.
                uint length = LZ77.getCompressedSize(Program.ROM.Data, map_addr);
                data = Program.ROM.getBinaryData(map_addr, length);
            }

            uint write_addr = InputFormRef.AppendBinaryData(data, undodata);

            if (write_addr == U.NOT_FOUND)
            {
                Program.Undo.Rollback(undodata);
                return(0);
            }
            bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.MAP, plist, write_addr, undodata);

            if (!r)
            {
                Program.Undo.Rollback(undodata);
                return(0);
            }

            Program.Undo.Push(undodata);

            return(plist);
        }
        //マップ変化のベース領域がなければ割り当てる
        public static bool PreciseChangeList(uint mapid)
        {
            List <ChangeSt> changeList = new List <ChangeSt>();

            uint change_addr = MapSettingForm.GetMapChangeAddrWhereMapID(mapid);

            if (U.isSafetyOffset(change_addr))
            {
                return(true);
            }

            return(PreciseChangeListForce(mapid) != 0);
        }
Exemple #30
0
 private void MapSettingFE6Form_Load(object sender, EventArgs e)
 {
     //章拡張を表示するかどうか
     if (MapSettingForm.IsShowChapterExetdns(this.AddressList.Items.Count))
     {
         AddressListExpandsButton_255.Show();
     }
     else
     {
         this.AddressList.Height += AddressListExpandsButton_255.Height;
         AddressListExpandsButton_255.Hide();
     }
 }