Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        //Uint + テキスト (PARSER) + unit テキストを書くルーチン
        public static Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            SolidBrush brush = new SolidBrush(lb.ForeColor);

            Font normalFont = lb.Font;

            string    text;
            Rectangle bounds = listbounds;

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

            text      = R._("会話グループ") + ":" + U.ToHexString(index);
            bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

            List <U.AddrResult> units = UnitForm.MakeUnitList();
            int unitMax = Math.Min(units.Count, (int)UnitForm.MAX_PLAYER_UNIT_ID + 1); //戦績が選べるのは 0x45まで

            for (int i = 0; i < unitMax; i++)
            {
                uint talkGroup = UnitForm.GetTalkGroupByAddr(units[i].addr);
                if (talkGroup == index)
                {
                    Bitmap bitmap = UnitForm.DrawUnitMapFacePictureByAddr(units[i].addr);
                    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);
                }
            }



            bounds.Y += ListBoxEx.OWNER_DRAW_ICON_SIZE;
            return(new Size(bounds.X, bounds.Y));
        }
Exemplo n.º 3
0
        string MakeNMMDropDownList(InputFormRef ifr, string basefilename, Dictionary <string, string> addFiles, List <Control> controls, string linktype, int num)
        {
            string filename = basefilename + linktype + ".txt";

            if (addFiles.ContainsKey(linktype))
            {
                return(addFiles[filename]);
            }

            string data = "";

            if (linktype == "INDEX")
            {
                data = MakeNMMDropDownListInner(ifr.MakeList());
            }
            else if (linktype == "PORTRAIT")
            {
                data = MakeNMMDropDownListInner(ImagePortraitForm.MakePortraitList());
            }
            else if (linktype == "UNIT")
            {
                List <U.AddrResult> list = UnitForm.MakeUnitList();
                data = MakeNMMDropDownListInner(list);
            }
            else if (linktype == "CLASS")
            {
                data = MakeNMMDropDownListInner(ClassForm.MakeClassList());
            }
            else if (linktype == "ITEM")
            {
                data = MakeNMMDropDownListInner(ItemForm.MakeItemList());
            }
            else if (linktype == "SONG")
            {
                data = MakeNMMDropDownListInner(SongTableForm.MakeItemList());
            }
            else if (linktype == "COMBO")
            {
                Control c = InputFormRef.FindObject(ifr.Prefix, controls, num + "_" + linktype);
                if (c is ComboBox)
                {
                    data = MakeNMMDropDownListInner((ComboBox)c);
                    data = string.Join("\r\n", U.ComboBoxToStringList((ComboBox)c));
                }
            }
            else if (linktype == "ATTRIBUTE")
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("8");
                for (uint n = 0; n < 8; n++)
                {
                    sb.AppendLine(U.To0xHexString(n) + " " + InputFormRef.GetAttributeName(n));
                }
                data = sb.ToString();
            }
            else if (linktype == "WEAPON")
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("7");
                sb.AppendLine("0x0 -");
                sb.AppendLine("0x1 E");
                sb.AppendLine("0x31 D");
                sb.AppendLine("0x71 C");
                sb.AppendLine("0x121 B");
                sb.AppendLine("0x181 A");
                sb.AppendLine("0x251 S");
                data = sb.ToString();
            }
            else if (linktype == "FLAG")
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("128");
                string dummy;
                for (uint n = 0; n < 128; n++)
                {
                    sb.AppendLine(U.To0xHexString(n) + " " + InputFormRef.GetFlagName(n, out dummy));
                }
                data = sb.ToString();
            }
            else if (linktype == "BIT")
            {
                filename = basefilename + linktype + num + ".txt";
                if (addFiles.ContainsKey(linktype))
                {
                    return(addFiles[filename]);
                }

                data = MakeBitsListInner(ifr, controls, linktype, num);
            }

            if (data == "")
            {
                return("NULL");
            }
            addFiles[filename] = data;
            return(filename);
        }