private void savePersonal() { pkm.HP = Convert.ToByte(TB_BaseHP.Text); pkm.ATK = Convert.ToByte(TB_BaseATK.Text); pkm.DEF = Convert.ToByte(TB_BaseDEF.Text); pkm.SPE = Convert.ToByte(TB_BaseSPE.Text); pkm.SPA = Convert.ToByte(TB_BaseSPA.Text); pkm.SPD = Convert.ToByte(TB_BaseSPD.Text); pkm.EV_HP = Convert.ToByte(TB_HPEVs.Text); pkm.EV_ATK = Convert.ToByte(TB_ATKEVs.Text); pkm.EV_DEF = Convert.ToByte(TB_DEFEVs.Text); pkm.EV_SPE = Convert.ToByte(TB_SPEEVs.Text); pkm.EV_SPA = Convert.ToByte(TB_SPAEVs.Text); pkm.EV_SPD = Convert.ToByte(TB_SPDEVs.Text); pkm.CatchRate = Convert.ToByte(TB_CatchRate.Text); pkm.EvoStage = Convert.ToByte(TB_Stage.Text); pkm.Types = new[] { CB_Type1.SelectedIndex, CB_Type2.SelectedIndex }; pkm.Items = new[] { CB_HeldItem1.SelectedIndex, CB_HeldItem2.SelectedIndex, CB_HeldItem3.SelectedIndex }; pkm.Gender = Convert.ToByte(TB_Gender.Text); pkm.HatchCycles = Convert.ToByte(TB_HatchCycles.Text); pkm.BaseFriendship = Convert.ToByte(TB_Friendship.Text); pkm.EXPGrowth = (byte)CB_EXPGroup.SelectedIndex; pkm.EggGroups = new[] { CB_EggGroup1.SelectedIndex, CB_EggGroup2.SelectedIndex }; pkm.Abilities = new[] { CB_Ability1.SelectedIndex, CB_Ability2.SelectedIndex, CB_Ability3.SelectedIndex }; pkm.FormeSprite = Convert.ToUInt16(TB_FormeSprite.Text); pkm.FormeCount = Convert.ToByte(TB_FormeCount.Text); pkm.Color = (byte)(Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0)); pkm.BaseEXP = Convert.ToUInt16(TB_BaseExp.Text); decimal h; decimal.TryParse(TB_Height.Text, out h); decimal w; decimal.TryParse(TB_Weight.Text, out w); pkm.Height = (int)(h * 100); pkm.Weight = (int)(w * 10); for (int i = 0; i < CLB_TMHM.Items.Count; i++) { pkm.TMHM[i] = CLB_TMHM.GetItemChecked(i); } for (int t = 0; t < CLB_MoveTutors.Items.Count; t++) { pkm.TypeTutors[t] = CLB_MoveTutors.GetItemChecked(t); } if (!Main.Config.ORAS) { return; } int[] len = { tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length }; int ctr = 0; for (int i = 0; i < 4; i++) { for (int t = 0; t < len[i]; t++) { pkm.SpecialTutors[i][t] = CLB_OrasTutors.GetItemChecked(ctr++); } } }
private void readInfo() { pkm = Main.SpeciesStat[entry]; TB_BaseHP.Text = pkm.HP.ToString("000"); TB_BaseATK.Text = pkm.ATK.ToString("000"); TB_BaseDEF.Text = pkm.DEF.ToString("000"); TB_BaseSPE.Text = pkm.SPE.ToString("000"); TB_BaseSPA.Text = pkm.SPA.ToString("000"); TB_BaseSPD.Text = pkm.SPD.ToString("000"); TB_HPEVs.Text = pkm.EV_HP.ToString("0"); TB_ATKEVs.Text = pkm.EV_ATK.ToString("0"); TB_DEFEVs.Text = pkm.EV_DEF.ToString("0"); TB_SPEEVs.Text = pkm.EV_SPE.ToString("0"); TB_SPAEVs.Text = pkm.EV_SPA.ToString("0"); TB_SPDEVs.Text = pkm.EV_SPD.ToString("0"); CB_Type1.SelectedIndex = pkm.Types[0]; CB_Type2.SelectedIndex = pkm.Types[1]; TB_CatchRate.Text = pkm.CatchRate.ToString("000"); TB_Stage.Text = pkm.EvoStage.ToString("0"); CB_HeldItem1.SelectedIndex = pkm.Items[0]; CB_HeldItem2.SelectedIndex = pkm.Items[1]; CB_HeldItem3.SelectedIndex = pkm.Items[2]; TB_Gender.Text = pkm.Gender.ToString("000"); TB_HatchCycles.Text = pkm.HatchCycles.ToString("000"); TB_Friendship.Text = pkm.BaseFriendship.ToString("000"); CB_EXPGroup.SelectedIndex = pkm.EXPGrowth; CB_EggGroup1.SelectedIndex = pkm.EggGroups[0]; CB_EggGroup2.SelectedIndex = pkm.EggGroups[1]; CB_Ability1.SelectedIndex = pkm.Abilities[0]; CB_Ability2.SelectedIndex = pkm.Abilities[1]; CB_Ability3.SelectedIndex = pkm.Abilities[2]; TB_FormeCount.Text = pkm.FormeCount.ToString("000"); TB_FormeSprite.Text = pkm.FormeSprite.ToString("000"); TB_RawColor.Text = pkm.Color.ToString("000"); CB_Color.SelectedIndex = pkm.Color & 0xF; TB_BaseExp.Text = pkm.BaseEXP.ToString("000"); TB_BST.Text = pkm.BST.ToString("000"); TB_Height.Text = ((decimal)pkm.Height / 100).ToString("00.00"); TB_Weight.Text = ((decimal)pkm.Weight / 10).ToString("000.0"); for (int i = 0; i < CLB_TMHM.Items.Count; i++) { CLB_TMHM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TMHM } for (int i = 0; i < CLB_MoveTutors.Items.Count; i++) { CLB_MoveTutors.SetItemChecked(i, pkm.TypeTutors[i]); // Bitflags for Tutors } if (pkm.SpecialTutors.Length > 0) { int[] len = { tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length }; int ctr = 0; for (int i = 0; i < len.Length; i++) { for (int b = 0; b < len[i]; b++) { CLB_OrasTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]); } } } }
private void B_Randomize_Click(object sender, EventArgs e) { Random rnd = new Random(); const int TMPercent = 35; // Average Learnable TMs is 35.260. const int TutorPercent = 2; //136 special tutor moves learnable by species in Untouched ORAS. const int OrasTutorPercent = 30; //10001 tutor moves learnable by 826 species in Untouched ORAS. ushort[] itemlist = Main.Config.ORAS ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY; ushort[] berrylist = Legal.Pouch_Berry_XY; Array.Resize(ref itemlist, itemlist.Length + berrylist.Length); Array.Copy(berrylist, 0, itemlist, itemlist.Length - berrylist.Length, berrylist.Length); int itemlen = itemlist.Length; int abillen = CB_Ability1.Items.Count; int typelen = CB_Type1.Items.Count; for (int i = 1; i < CB_Species.Items.Count; i++) { CB_Species.SelectedIndex = i; // Get new Species // Fiddle with TM Learnsets if (CHK_TM.Checked) { for (int t = 0; t < 100; t++) { CLB_TMHM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked); } } if (CHK_HM.Checked) { for (int t = 100; t < CLB_TMHM.Items.Count; t++) { CLB_TMHM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked); } } if (CHK_Tutors.Checked) { for (int t = 0; t < CLB_MoveTutors.Items.Count; t++) { CLB_MoveTutors.SetItemCheckState(t, rnd.Next(0, 100) < TutorPercent ? CheckState.Checked : CheckState.Unchecked); } if (Main.Config.ORAS && (CB_Species.SelectedIndex == 384 || CB_Species.SelectedIndex == 814)) //Make sure Rayquaza can learn Dragon Ascent. { CLB_MoveTutors.SetItemCheckState(CLB_MoveTutors.Items.Count - 1, CheckState.Checked); } } if (Main.Config.ORAS && CHK_ORASTutors.Checked) { for (int t = 0; t < CLB_OrasTutors.Items.Count; t++) { CLB_OrasTutors.SetItemCheckState(t, rnd.Next(0, 100) < OrasTutorPercent ? CheckState.Checked : CheckState.Unchecked); } } // Abilities: if (CHK_Ability.Checked) { ComboBox[] abils = { CB_Ability1, CB_Ability2, CB_Ability3 }; for (int a = 0; a < 3; a++) // Set 3 New Abilities, none being Wonder Guard (25) unless CHK_WGuard is checked. { int newabil = rnd.Next(1, abillen); while (newabil == 25 && !CHK_WGuard.Checked) { newabil = rnd.Next(1, abillen); } if (abils[a].SelectedIndex != 25 || CHK_WGuard.Checked) { abils[a].SelectedIndex = newabil; } } } // Fiddle with Base Stats, don't muck with Shedinja. if (CHK_Stats.Checked) { if (Convert.ToByte(byte_boxes[0].Text) != 1) { for (int z = 0; z < 6; z++) { if (rstat_boxes[z].Checked) { byte_boxes[z].Text = Math.Max(5, rnd.Next( Math.Min(255, (int)(Convert.ToByte(byte_boxes[z].Text) * (1 - NUD_StatDev.Value / 100))), Math.Min(255, (int)(Convert.ToByte(byte_boxes[z].Text) * (1 + NUD_StatDev.Value / 100))) )).ToString("000"); } } } } // EV yield stays the same... if (CHK_CatchRate.Checked) { TB_CatchRate.Text = rnd.Next(3, 251).ToString("000"); //Random Catch Rate between 3 and 250. Should I make this normally distributed? } if (CHK_EggGroup.Checked) { if (rnd.Next(0, 100) < NUD_Egg.Value) // 50% chance to have either One or Two Egg Groups { CB_EggGroup1.SelectedIndex = CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count); } else { CB_EggGroup1.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count); CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup2.Items.Count); } } // Items if (CHK_Item.Checked) { CB_HeldItem1.SelectedIndex = itemlist[rnd.Next(1, itemlen)]; CB_HeldItem2.SelectedIndex = itemlist[rnd.Next(1, itemlen)]; CB_HeldItem3.SelectedIndex = itemlist[rnd.Next(1, itemlen)]; } // Type if (CHK_Type.Checked) { if (rnd.Next(0, 100) < NUD_TypePercent.Value) // 50% chance to have either Single or Dual Typing { CB_Type1.SelectedIndex = CB_Type2.SelectedIndex = rnd.Next(0, typelen); } else { CB_Type1.SelectedIndex = rnd.Next(0, typelen); CB_Type2.SelectedIndex = rnd.Next(0, typelen); } } } saveEntry(); WinFormsUtil.Alert("All relevant Pokemon Personal Entries have been randomized!"); }
private void readInfo() { byte[] array = new byte[Main.oras ? 0x50 : 0x40]; Array.Copy(data, array.Length * entry, array, 0, array.Length); pkm = new PersonalInfo(array); TB_BaseHP.Text = pkm.HP.ToString("000"); TB_BaseATK.Text = pkm.ATK.ToString("000"); TB_BaseDEF.Text = pkm.DEF.ToString("000"); TB_BaseSPE.Text = pkm.SPE.ToString("000"); TB_BaseSPA.Text = pkm.SPA.ToString("000"); TB_BaseSPD.Text = pkm.SPD.ToString("000"); TB_HPEVs.Text = pkm.EV_HP.ToString("0"); TB_ATKEVs.Text = pkm.EV_ATK.ToString("0"); TB_DEFEVs.Text = pkm.EV_DEF.ToString("0"); TB_SPEEVs.Text = pkm.EV_SPE.ToString("0"); TB_SPAEVs.Text = pkm.EV_SPA.ToString("0"); TB_SPDEVs.Text = pkm.EV_SPD.ToString("0"); CB_Type1.SelectedIndex = pkm.Types[0]; CB_Type2.SelectedIndex = pkm.Types[1]; TB_CatchRate.Text = pkm.CatchRate.ToString("000"); TB_Stage.Text = pkm.EvoStage.ToString("0"); CB_HeldItem1.SelectedIndex = pkm.Items[0]; CB_HeldItem2.SelectedIndex = pkm.Items[1]; CB_HeldItem3.SelectedIndex = pkm.Items[2]; TB_Gender.Text = pkm.Gender.ToString("000"); TB_HatchCycles.Text = pkm.HatchCycles.ToString("000"); TB_Friendship.Text = pkm.BaseFriendship.ToString("000"); CB_EXPGroup.SelectedIndex = pkm.EXPGrowth; CB_EggGroup1.SelectedIndex = pkm.EggGroups[0]; CB_EggGroup2.SelectedIndex = pkm.EggGroups[1]; CB_Ability1.SelectedIndex = pkm.Abilities[0]; CB_Ability2.SelectedIndex = pkm.Abilities[1]; CB_Ability3.SelectedIndex = pkm.Abilities[2]; TB_FormeCount.Text = pkm.FormeCount.ToString("000"); TB_FormeSprite.Text = pkm.FormeSprite.ToString("000"); TB_RawColor.Text = pkm.Color.ToString("000"); CB_Color.SelectedIndex = pkm.Color & 0xF; TB_BaseExp.Text = pkm.BaseEXP.ToString("000"); TB_Height.Text = (pkm.Height / 100).ToString("00.0"); TB_Weight.Text = (pkm.Weight / 10).ToString("000.0"); for (int i = 0; i < CLB_TMHM.Items.Count; i++) { CLB_TMHM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TMHM } for (int i = 0; i < CLB_MoveTutors.Items.Count; i++) { CLB_MoveTutors.SetItemChecked(i, pkm.Tutors[i]); // Bitflags for Tutors } if (pkm.ORASTutors[0] != null) { int[] len = { tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length }; int ctr = 0; for (int i = 0; i < len.Length; i++) { for (int b = 0; b < len[i]; b++) { CLB_OrasTutors.SetItemChecked(ctr++, pkm.ORASTutors[i][b]); } } } }
private void saveEntry() { int len = 0; if (mode == "XY") { len = 0x40; } else if (mode == "ORAS") { len = 0x50; } byte[] edits = new byte[len]; Array.Copy(data, len * entry, edits, 0, len); //edit raw data for easiness's sake edits[0] = Convert.ToByte(TB_BaseHP.Text); edits[1] = Convert.ToByte(TB_BaseATK.Text); edits[2] = Convert.ToByte(TB_BaseDEF.Text); edits[3] = Convert.ToByte(TB_BaseSPE.Text); edits[4] = Convert.ToByte(TB_BaseSPA.Text); edits[5] = Convert.ToByte(TB_BaseSPD.Text); ushort evs = 0; evs |= (ushort)((Convert.ToByte(TB_HPEVs.Text) & 3) << 0); evs |= (ushort)((Convert.ToByte(TB_ATKEVs.Text) & 3) << 2); evs |= (ushort)((Convert.ToByte(TB_DEFEVs.Text) & 3) << 4); evs |= (ushort)((Convert.ToByte(TB_SPEEVs.Text) & 3) << 6); evs |= (ushort)((Convert.ToByte(TB_SPAEVs.Text) & 3) << 8); evs |= (ushort)((Convert.ToByte(TB_SPDEVs.Text) & 3) << 10); Array.Copy(BitConverter.GetBytes(evs), 0, edits, 0xa, 2); edits[6] = (byte)CB_Type1.SelectedIndex; edits[7] = (byte)CB_Type2.SelectedIndex; edits[8] = Convert.ToByte(TB_CatchRate.Text); edits[9] = Convert.ToByte(TB_Stage.Text); Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem1.SelectedIndex), 0, edits, 0xC, 2); Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem2.SelectedIndex), 0, edits, 0xE, 2); Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem3.SelectedIndex), 0, edits, 0x10, 2); edits[0x12] = Convert.ToByte(TB_Gender.Text); edits[0x13] = Convert.ToByte(TB_HatchCycles.Text); edits[0x14] = Convert.ToByte(TB_Friendship.Text); edits[0x15] = (byte)CB_EXPGroup.SelectedIndex; edits[0x16] = (byte)CB_EggGroup1.SelectedIndex; edits[0x17] = (byte)CB_EggGroup2.SelectedIndex; edits[0x18] = (byte)CB_Ability1.SelectedIndex; edits[0x19] = (byte)CB_Ability2.SelectedIndex; edits[0x1A] = (byte)CB_Ability3.SelectedIndex; //edits[0x20] = Convert.ToByte(TB_FormeCount.Text); //Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(TB_FormeSprite.Text)),0, edits, 0x1E,2); byte color = Convert.ToByte(CB_Color.SelectedIndex); color |= (byte)(Convert.ToByte(TB_RawColor.Text) & (byte)0xF0); edits[0x21] = color; Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(TB_BaseExp.Text)), 0, edits, 0x22, 2); float height = (float)Convert.ToDouble(TB_Height.Text) * 100; float weight = (float)Convert.ToDouble(TB_Weight.Text) * 10; Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(height)), 0, edits, 0x24, 2); Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(weight)), 0, edits, 0x26, 2); //TMHM for (int i = 0; i < 16; i++) { for (int j = 0; j < 8; j++) { if (i * 8 + j < CLB_TMHM.Items.Count) { if (CLB_TMHM.GetItemChecked(i * 8 + j)) { edits[0x28 + i] |= (byte)(1 << j); } } } } uint tutors = 0; for (int t = 0; t < 8; t++) { if (t < CLB_MoveTutors.Items.Count && CLB_MoveTutors.GetItemChecked(t)) { tutors |= (uint)(1 << t); } } Array.Copy(BitConverter.GetBytes(tutors), 0, edits, 0x38, 4); if (mode == "ORAS") { uint[] tutorm = new uint[4]; int ofs = 0; for (int j = 0; j < tutor1.Length; j++) { if (CLB_OrasTutors.GetItemChecked(ofs++)) { tutorm[0] |= (uint)(1 << j); } } for (int j = 0; j < tutor2.Length; j++) { if (CLB_OrasTutors.GetItemChecked(ofs++)) { tutorm[1] |= (uint)(1 << j); } } for (int j = 0; j < tutor3.Length; j++) { if (CLB_OrasTutors.GetItemChecked(ofs++)) { tutorm[2] |= (uint)(1 << j); } } for (int j = 0; j < tutor4.Length; j++) { if (CLB_OrasTutors.GetItemChecked(ofs++)) { tutorm[3] |= (uint)(1 << j); } } for (int j = 0x40; j < 0x50; j += 4) { Array.Copy(BitConverter.GetBytes(tutorm[(j - 0x40) / 4]), 0, edits, j, 4); } } File.WriteAllBytes(paths[entry], edits); Array.Copy(edits, 0, data, entry * len, len); File.WriteAllBytes(paths[paths.Length - 1], data); }
private void readEntry() { int len = 0; if (mode == "ORAS") { len = 0x50; } else if (mode == "XY") { len = 0x40; } byte[] file = new byte[len]; Array.Copy(data, len * entry, file, 0, len); TB_BaseHP.Text = file[0].ToString("000"); TB_BaseATK.Text = file[1].ToString("000"); TB_BaseDEF.Text = file[2].ToString("000"); TB_BaseSPE.Text = file[3].ToString("000"); TB_BaseSPA.Text = file[4].ToString("000"); TB_BaseSPD.Text = file[5].ToString("000"); bst = file[0] + file[1] + file[2] + file[3] + file[4] + file[5]; int EVs = BitConverter.ToInt16(file, 0xA); TB_HPEVs.Text = ((EVs >> 0) & 0x3).ToString("0"); TB_ATKEVs.Text = ((EVs >> 2) & 0x3).ToString("0"); TB_DEFEVs.Text = ((EVs >> 4) & 0x3).ToString("0"); TB_SPEEVs.Text = ((EVs >> 6) & 0x3).ToString("0"); TB_SPAEVs.Text = ((EVs >> 8) & 0x3).ToString("0"); TB_SPDEVs.Text = ((EVs >> 10) & 0x3).ToString("0"); CB_Type1.SelectedIndex = file[6]; CB_Type2.SelectedIndex = file[7]; TB_CatchRate.Text = file[8].ToString("000"); TB_Stage.Text = file[9].ToString("0"); CB_HeldItem1.SelectedIndex = BitConverter.ToUInt16(file, 0xC); CB_HeldItem2.SelectedIndex = BitConverter.ToUInt16(file, 0xE); CB_HeldItem3.SelectedIndex = BitConverter.ToUInt16(file, 0x10); TB_Gender.Text = file[0x12].ToString("000"); TB_HatchCycles.Text = file[0x13].ToString("000"); TB_Friendship.Text = file[0x14].ToString("000"); CB_EXPGroup.SelectedIndex = file[0x15]; CB_EggGroup1.SelectedIndex = file[0x16]; CB_EggGroup2.SelectedIndex = file[0x17]; CB_Ability1.SelectedIndex = file[0x18]; CB_Ability2.SelectedIndex = file[0x19]; CB_Ability3.SelectedIndex = file[0x1A]; TB_FormeCount.Text = file[0x20].ToString("000"); TB_FormeSprite.Text = BitConverter.ToUInt16(file, 0x1E).ToString("000"); int color = file[0x21] & 0xF; TB_RawColor.Text = file[0x21].ToString("000"); CB_Color.SelectedIndex = color; TB_BaseExp.Text = BitConverter.ToUInt16(file, 0x22).ToString("000"); TB_Height.Text = ((float)BitConverter.ToUInt16(file, 0x24) / 100).ToString("00.0"); TB_Weight.Text = ((float)BitConverter.ToUInt16(file, 0x26) / 10).ToString("000.0"); for (int i = 0; i < 16; i++) { for (int j = 0; j < 8; j++) { if (i * 8 + j < CLB_TMHM.Items.Count) { CLB_TMHM.SetItemChecked(i * 8 + j, ((file[0x28 + i] >> j) & 0x1) == 1); //Bitflags for TMHM } } } uint tutors = BitConverter.ToUInt32(file, 0x38); for (int t = 0; t < 8; t++) { if (t < CLB_MoveTutors.Items.Count) { CLB_MoveTutors.SetItemChecked(t, ((tutors >> t) & 1) == 1); } } if (mode == "ORAS") { uint[] tutorm = new uint[4]; for (int j = 0x40; j < 0x50; j += 4) { tutorm[(j - 0x40) / 4] = BitConverter.ToUInt32(file, j); } int ofs = 0; for (int j = 0; j < tutorm.Length; j++) { for (int i = 0; i < 32; i++) { if (ofs + i < CLB_OrasTutors.Items.Count) { CLB_OrasTutors.SetItemChecked(ofs + i, ((tutorm[j] >> i) & 1) == 1); } } // hardcode this, bad, I know if (j == 0) { ofs += tutor1.Length; } else if (j == 1) { ofs += tutor2.Length; } else if (j == 2) { ofs += tutor3.Length; } else { ofs += tutor4.Length; } } } if (!dumping) { int[] specForm = Personal.getSpecies(data, Main.oras, CB_Species.SelectedIndex); string filename = "_" + specForm[0] + ((CB_Species.SelectedIndex > 721) ? "_" + (specForm[1] + 1) : ""); Bitmap rawImg = (Bitmap)Properties.Resources.ResourceManager.GetObject(filename); Bitmap bigImg = new Bitmap(rawImg.Width * 2, rawImg.Height * 2); for (int x = 0; x < rawImg.Width; x++) { for (int y = 0; y < rawImg.Height; y++) { Color c = rawImg.GetPixel(x, y); bigImg.SetPixel(2 * x, 2 * y, c); bigImg.SetPixel(2 * x + 1, 2 * y, c); bigImg.SetPixel(2 * x, 2 * y + 1, c); bigImg.SetPixel(2 * x + 1, 2 * y + 1, c); } } PB_MonSprite.Image = bigImg; } }