void MakeWorldMap() { MapPictureBox.LoadWorldMap(); MapPictureBox.ClearStaticItem(); int pathid = this.AddressList.SelectedIndex; if (pathid >= 0) { //道の描画 List <MapPictureBox.StaticItem> list = WorldMapPathForm.DrawPath((uint)pathid); for (int n = 0; n < list.Count; n++) { MapPictureBox.SetStaticItem("road" + pathid.ToString() + "_" + n.ToString(), list[n].x, list[n].y, list[n].bitmap); } } //拠点を追加 List <U.AddrResult> arlist = WorldMapPointForm.MakeWorldMapPointList(); for (int i = 0; i < arlist.Count; i++) { MapPictureBox.StaticItem item = WorldMapPointForm.DrawBasePointAddr(arlist[i].addr); MapPictureBox.SetStaticItem("base" + i.ToString(), item.x, item.y, item.bitmap, item.draw_x_add, item.draw_y_add); } MapPictureBox.InvalidateMap(); }
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); }
public static List <MapPictureBox.StaticItem> DrawRoad(uint id) { List <MapPictureBox.StaticItem> list = new List <MapPictureBox.StaticItem>(); Bitmap roadbase = GetRoadImage(); InputFormRef InputFormRef = Init(null); //現在のIDに対応するデータ uint addr = InputFormRef.IDToAddr(id); if (!Program.ROM.isSafetyOffset(addr)) { return(list); } uint road = Program.ROM.p32(addr + 0); while (true) { uint x8 = Program.ROM.u8(road + 0); uint y8 = Program.ROM.u8(road + 1); uint count = Program.ROM.u8(road + 2); if (x8 == 0xFF) { return(list); } road += 4; for (uint ix = 0; ix < count; ix++) { uint tile = Program.ROM.u8(road + 0); uint flag = Program.ROM.u8(road + 1); road += 2; MapPictureBox.StaticItem si = new MapPictureBox.StaticItem(); si.x = (int)(x8 * 8 + (ix * 8)); si.y = (int)y8 * 8; if (flag == 4) { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, false, true); } else if (flag == 8) { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, true, false); } else if (flag == 0xC) { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, true, true); } else { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8); } si.bitmap.MakeTransparent(si.bitmap.Palette.Entries[0]); list.Add(si); } } }
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); } }
public static MapPictureBox.StaticItem DrawBasePointAddr(uint addr) { MapPictureBox.StaticItem item = new MapPictureBox.StaticItem(); uint icon = Program.ROM.u8(addr + 2); item.x = (int)Program.ROM.u16(addr + 24); item.y = (int)Program.ROM.u16(addr + 26); item.bitmap = WorldMapImageForm.DrawWorldMapIcon(icon); item.draw_x_add -= item.bitmap.Width / 2; item.draw_y_add -= item.bitmap.Height / 2; return(item); }
public void DrawAllUnits() { MapPictureBox.ClearStaticItem(); List <U.AddrResult> list = InputFormRef.MakeList(); for (int i = 0; i < list.Count; i++) { if (AddressList.SelectedIndex == i) {//選択しているものは別ルーチンで詳細に描画する. DrawSelectedUnit(); } else {//選択していないものは、移動後座標だけ描画する. MapPictureBox.StaticItem sitem = DrawAfterPosUnit(list[i].addr); MapPictureBox.SetStaticItem("o" + i.ToString(), sitem.x, sitem.y, sitem.bitmap, sitem.draw_x_add, sitem.draw_y_add); } } MapPictureBox.Invalidate(); }
public static List <MapPictureBox.StaticItem> DrawPath(uint id) { List <MapPictureBox.StaticItem> list = new List <MapPictureBox.StaticItem>(); Bitmap roadbase = GetPathImage(); InputFormRef InputFormRef = Init(null); //現在のIDに対応するデータ uint addr = InputFormRef.IDToAddr(id); if (!U.isSafetyOffset(addr)) { return(list); } uint p = Program.ROM.p32(addr + 0); if (!U.isSafetyOffset(p)) { return(list); } while (true) { if (!U.isSafetyOffset(p + 4)) { Log.Error("Worldmap Path Broken : " + id); return(list); } uint x8 = Program.ROM.u8(p + 0); uint y8 = Program.ROM.u8(p + 1); uint count = Program.ROM.u8(p + 2); if (x8 == 0xFF) { return(list); } if (count >= 200) {//ありえないデータなので打ち切る Log.Error("Worldmap Path Broken : " + id); return(list); } p += 4; if (!U.isSafetyOffset(p + (count * 2))) { Log.Error("Worldmap Path Broken : " + id); return(list); } for (uint ix = 0; ix < count; ix++) { uint tile = Program.ROM.u8(p + 0); uint flag = Program.ROM.u8(p + 1); p += 2; MapPictureBox.StaticItem si = new MapPictureBox.StaticItem(); si.x = (int)(x8 * 8 + (ix * 8)); si.y = (int)y8 * 8; if (flag == 4) { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, true, false); } else if (flag == 8) { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, false, true); } else if (flag == 0xC) { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, true, true); } else { si.bitmap = ImageUtil.Copy(roadbase, 0, (int)tile * 8, 8, 8, false, false); } list.Add(si); } } }