public static Bitmap DrawClassTypeIcon(uint id)
 {
     if ((id & 0x01) == 0x01)
     {
         return(ClassForm.DrawWaitIcon(0x09, 0, true)); //アーマー系
     }
     if ((id & 0x02) == 0x02)
     {
         return(ClassForm.DrawWaitIcon(0x05, 0, true)); //騎兵系
     }
     if ((id & 0x04) == 0x04)
     {
         return(ClassForm.DrawWaitIcon(0x48, 0, true)); //飛行系
     }
     if ((id & 0x08) == 0x08)
     {
         return(ClassForm.DrawWaitIcon(0x1f, 0, true)); //ドラゴン系
     }
     if ((id & 0x10) == 0x10)
     {
         return(ClassForm.DrawWaitIcon(0x54, 0, true)); //モンスター系
     }
     if ((id & 0x20) == 0x20)
     {
         return(ClassForm.DrawWaitIcon(0x13, 0, true)); //ソード系
     }
     return(ImageUtil.BlankDummy());
 }
Пример #2
0
        public static MapPictureBox.StaticItem DrawAfterPosUnit(uint class_id, uint unitgrow, int before_x, int before_y, int after_x, int after_y)
        {
            MapPictureBox.StaticItem st;
            int palette_type = (int)U.ParseUnitGrowAssign(unitgrow);

            Bitmap icon = ClassForm.DrawWaitIcon(class_id, palette_type);

            //アイコンの背丈の補正 中央に出すための補正値を取得
            int draw_x_add;
            int draw_y_add;

            EventUnitForm.GetDrawAddXY(icon, out draw_x_add, out draw_y_add);

            uint assign = U.ParseUnitGrowAssign(unitgrow);

            st            = new MapPictureBox.StaticItem();
            st.bitmap     = icon;
            st.x          = before_x;
            st.y          = before_y;
            st.draw_x_add = draw_x_add;
            st.draw_y_add = draw_y_add;

            if (before_x == after_x && before_y == after_y)
            {
                return(st);
            }

            st            = new MapPictureBox.StaticItem();
            st.bitmap     = icon;
            st.x          = after_x;
            st.y          = after_y;
            st.draw_x_add = draw_x_add;
            st.draw_y_add = draw_y_add;
            return(st);
        }
        private void SkillSystemsEffectivenessReworkClassTypeForm_Load(object sender, EventArgs e)
        {
            Bitmap a = ClassForm.DrawWaitIcon(0x09, 0, true);  //アーマー系

            U.MakeTransparent(a);
            IMAGE_1.Image = a;

            a = ClassForm.DrawWaitIcon(0x05, 0, true); //騎兵系
            U.MakeTransparent(a);
            IMAGE_2.Image = a;

            a = ClassForm.DrawWaitIcon(0x48, 0, true); //飛行系
            U.MakeTransparent(a);
            IMAGE_4.Image = a;

            a = ClassForm.DrawWaitIcon(0x1f, 0, true); //ドラゴン系
            U.MakeTransparent(a);
            IMAGE_8.Image = a;

            a = ClassForm.DrawWaitIcon(0x54, 0, true); //モンスター系
            U.MakeTransparent(a);
            IMAGE_10.Image = a;

            a = ClassForm.DrawWaitIcon(0x13, 0, true); //ソード系
            U.MakeTransparent(a);
            IMAGE_20.Image = a;
        }
        public void DrawUnits(uint topaddr, int max)
        {
            const uint RAMUnitSizeOf = 72; //構造体のサイズ
            bool       isFE6         = (Program.ROM.RomInfo.version == 6);

            uint addr = topaddr;

            for (int i = 0; i < max; i++, addr += RAMUnitSizeOf)
            {
                uint unitPointer  = Program.RAM.u32(addr + 0);
                uint classPointer = Program.RAM.u32(addr + 4);

                if (unitPointer == 0)
                {
                    continue;
                }

                if (!U.isSafetyPointer(unitPointer))
                {
                    continue;
                }
                if (!U.isSafetyPointer(classPointer))
                {
                    continue;
                }

                uint classid = Program.ROM.u8(U.toOffset(classPointer) + 4);

                uint   unit_number  = Program.RAM.u8(addr + 11);
                int    palette_type = GetShowPartyClassPaletteType(unit_number);
                Bitmap bitmap       = ClassForm.DrawWaitIcon(classid, palette_type);
                U.MakeTransparent(bitmap);

                uint x, y;
                if (isFE6)
                {
                    x = Program.RAM.u8(addr + 14);
                    y = Program.RAM.u8(addr + 15);
                }
                else
                {
                    x = Program.RAM.u8(addr + 16);
                    y = Program.RAM.u8(addr + 17);
                }

                MapPictureBox.StaticItem st = new MapPictureBox.StaticItem();
                st.bitmap     = bitmap;
                st.x          = (int)x;
                st.y          = (int)y;
                st.draw_x_add = 0;
                st.draw_y_add = 0;

                MapPictureBox.SetStaticItem(U.To0xHexString(addr), st.x, st.y, st.bitmap, st.draw_x_add, st.draw_y_add);
            }
        }
Пример #5
0
        //待機アイコン + テキストを書くルーチン
        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));
        }
Пример #6
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);
        }
        public static Bitmap DrawUnitsList(uint index, int iconSize, out string errorMessage)
        {
            InputFormRef InputFormRef = Init(null);
            uint         addr         = InputFormRef.IDToAddr(index);

            if (!U.isSafetyOffset(addr))
            {
                errorMessage = R._("範囲外のIDを指定しています。\r\n指定できるのは、最大{0}までです。", InputFormRef.DataCount);
                return(ImageUtil.BlankDummy());
            }
            errorMessage = "";

            Bitmap     bitmap = new Bitmap((iconSize * 2) * 5, iconSize);
            Rectangle  bounds = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
            SolidBrush brush  = new SolidBrush(OptionForm.Color_Input_ForeColor());
            Font       font   = new Font("MS UI Gothic", 8);

            using (Graphics g = Graphics.FromImage(bitmap))
            {
                for (uint i = 0; i < 5; i++)
                {
                    uint classid = Program.ROM.u8(addr + i);
                    if (classid <= 0)
                    {
                        continue;
                    }
                    Bitmap icon = ClassForm.DrawWaitIcon(classid, 2);

                    U.MakeTransparent(icon);

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

                    bounds.X += U.DrawPicture(icon, g, true, b);

                    uint probability = Program.ROM.u8(addr + 5 + i);
                    bounds.X += U.DrawText(probability + "", g, font, brush, true, bounds);
                }
            }
            brush.Dispose();
            font.Dispose();
            return(bitmap);
        }
Пример #8
0
        //Class + テキストを書く
        public static Size DrawClassAndText(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 = ClassForm.DrawWaitIcon(icon, 0, true);

            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);

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

            bitmap.Dispose();
            brush.Dispose();


            bounds.Y += OWNER_DRAW_ICON_SIZE;
            return(new Size(bounds.X, bounds.Y));
        }
Пример #9
0
        private void B0_ValueChanged(object sender, EventArgs e)
        {
            uint id = (uint)this.B0.Value;

            if (AddressList.SelectedIndex <= 0)
            {
                X_LINK.Text       = TypeIDToString(id);
                X_LINK_ICON.Image = null;
                return;
            }
            uint typeID = GetTypeID();

            if (typeID <= 1)
            {
                X_LINK.Text       = UnitForm.GetUnitName(id);
                X_LINK_ICON.Image = UnitForm.DrawUnitMapFacePicture(id);
            }
            else
            {
                X_LINK.Text       = ClassForm.GetClassName(id);
                X_LINK_ICON.Image = ClassForm.DrawWaitIcon(id, 0);
            }
        }
Пример #10
0
        //Uint + テキスト (PARSER) + Class テキストを書くルーチン
        public static Size DrawUnitAndClassAndText(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 = UnitForm.DrawUnitMapFacePicture(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 = ClassForm.DrawWaitIcon(icon, 0, true);
                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));
        }
Пример #11
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));
        }