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(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(); } )); }
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); } }
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); }
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); } }
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序章で、このロードユニットを仲間に入れないと多くのイベントがフリーズします。"))); } }
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 MapPictureBox.StaticItem DrawAfterPosUnit(uint addr) { uint unit_id = Program.ROM.u8(addr); uint class_id = Program.ROM.u8(addr + 1); uint unitgrow = Program.ROM.u8(addr + 3); int before_x = (int)Program.ROM.u8(addr + 4); int before_y = (int)Program.ROM.u8(addr + 5); int after_x = (int)Program.ROM.u8(addr + 6); int after_y = (int)Program.ROM.u8(addr + 7); if (class_id == 0) {//クラスIDが0だったらユーザIDで補完する class_id = UnitForm.GetClassID(unit_id); } return (DrawAfterPosUnit(class_id, unitgrow, before_x, before_y, after_x, after_y)); }
public MainSimpleMenuImageSubForm() { InitializeComponent(); ImageBGButton.BackgroundImage = MakeTransparent(Trim(ImageBGForm.DrawBG(0))); if (Program.ROM.RomInfo.version() >= 7) { BigCGButton.BackgroundImage = MakeTransparent(Trim(ImageCGForm.DrawImageByID(0))); } else { BigCGButton.Hide(); } ImagePortraitButton.BackgroundImage = MakeTransparent(ImagePortraitForm.DrawPortraitUnit(2)); ImageBattleAnimeButton.BackgroundImage = MakeTransparent(BattleZoom(ImageBattleAnimeForm.DrawBattleAnime(1, ImageBattleAnimeForm.ScaleTrim.SCALE_90))); ImageUnitWaitIconButton.BackgroundImage = MakeTransparent(ImageUnitWaitIconFrom.DrawWaitUnitIconBitmap(1, 0, false)); ImageUnitMoveIconButton.BackgroundImage = MakeTransparent(ImageUnitMoveIconFrom.DrawMoveUnitIconBitmap(3, 0, 0)); ImageIconButton.BackgroundImage = MakeTransparent(ImageItemIconForm.DrawIconWhereID(0xB)); SystemIconButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.YubiYoko()); //BattleScreenButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.Allows(8)); BattleScreenButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.WeaponIcon(0)); ImageBattleFieldButton.BackgroundImage = MakeTransparent(ImageBattleBGForm.DrawBG(2)); ImageBattleTerrainButton.BackgroundImage = MakeTransparent((ImageBattleTerrainForm.Draw(2))); if (Program.ROM.RomInfo.version() == 8) { ImageUnitPaletteButton.BackgroundImage = MakeTransparent(BattleZoom(UnitPaletteForm.DrawSample(2, 3))); } else {//for FE6 , FE7 ImageUnitPaletteButton.BackgroundImage = MakeTransparent(BattleZoom(ImageBattleAnimeForm.DrawBattleAnime(ImageBattleAnimeForm.GetAnimeIDByClassID(UnitForm.GetClassID(2)) , ImageBattleAnimeForm.ScaleTrim.SCALE_90, UnitForm.GetPaletteLowClass(2)))); } WorldMapImageButton.BackgroundImage = MakeTransparent(WorldMapImageForm.DrawWorldMap()); if (Program.ROM.RomInfo.version() == 7 && Program.ROM.RomInfo.is_multibyte() == false) {//英語版FE7は、章タイトルをテキストで保持していて、40260c nazo fontで、描画している. ImageChapterTitleButton.Hide(); } else { ImageChapterTitleButton.BackgroundImage = MakeTransparent(ImageChapterTitleForm.DrawSample(0)); } if (ImageUtilMagic.SearchMagicSystem() != ImageUtilMagic.magic_system_enum.NO) { ImageMagicButton.BackgroundImage = MakeTransparent(ImageSystemIconForm.WeaponIcon(8 - 3)); } else { ImageMagicButton.Hide(); } if (Program.ROM.RomInfo.is_multibyte()) { OptionForm.textencoding_enum textencoding = OptionForm.textencoding(); if (textencoding == OptionForm.textencoding_enum.ZH_TBL) { // FontButton.BackgroundImage = MakeTransparent(FontZHForm.DrawFontString("字形", true)); } else { FontButton.BackgroundImage = MakeTransparent(FontForm.DrawFontString("フォント", true)); } } else { FontButton.BackgroundImage = MakeTransparent(FontForm.DrawFontString("Font", true)); } }