From 0ff5f8716dde34fb17d38819497d06ca28048d87 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 16 Nov 2016 20:57:15 -0800 Subject: [PATCH] Add map warping & rotation value sav7 --- PKHeX/Saves/SAV7.cs | 51 +-- .../Gen7/SAV_Trainer7.Designer.cs | 304 ++++++++++-------- .../Save Editors/Gen7/SAV_Trainer7.cs | 2 + 3 files changed, 196 insertions(+), 161 deletions(-) diff --git a/PKHeX/Saves/SAV7.cs b/PKHeX/Saves/SAV7.cs index d5aa06cc7..81b21ef51 100644 --- a/PKHeX/Saves/SAV7.cs +++ b/PKHeX/Saves/SAV7.cs @@ -180,7 +180,7 @@ private void getSAVOffsets() /* 14 */ Box = 0x04E00; // [36600] BoxPokemon /* 15 */ Resort = 0x3B400; // [572C] ResortSave /* 16 */ PlayTime = 0x40C00; // [008] PlayTime - /* 17 */ //Overworld// = 0x40E00; // [1080] FieldMoveModelSave + /* 17 */ Overworld = 0x40E00; // [1080] FieldMoveModelSave /* 18 */ // = 0x42000; // [1A08] Fashion /* 19 */ // = 0x43C00; // [6408] JoinFestaPersonalSave /* 20 */ // = 0x4A200; // [6408] JoinFestaPersonalSave @@ -232,9 +232,8 @@ private void getSAVOffsets() private int LastViewedBox { get; set; } = int.MinValue; private int WondercardFlags { get; set; } = int.MinValue; private int PlayTime { get; set; } = int.MinValue; - private int JPEG { get; set; } = int.MinValue; private int ItemInfo { get; set; } = int.MinValue; - private int LinkInfo { get; set; } = int.MinValue; + private int Overworld { get; set; } = int.MinValue; // Accessible as SAV7 public int TrainerCard { get; private set; } = 0x14000; @@ -342,18 +341,38 @@ public int M public float X { get { return BitConverter.ToSingle(Data, Trainer1 + 0x08); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x08); } + set + { + BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x08); + BitConverter.GetBytes(value).CopyTo(Data, Overworld + 0x08); + } } - // 0xC probably rotation public float Z { get { return BitConverter.ToSingle(Data, Trainer1 + 0x10); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x10); } + set + { + BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x10); + BitConverter.GetBytes(value).CopyTo(Data, Overworld + 0x10); + } } public float Y + { + get { return (int)BitConverter.ToSingle(Data, Trainer1 + 0x18); } + set + { + BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x18); + BitConverter.GetBytes(value).CopyTo(Data, Overworld + 0x18); + } + } + public float R { get { return (int)BitConverter.ToSingle(Data, Trainer1 + 0x20); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x20); } + set + { + BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x20); + BitConverter.GetBytes(value).CopyTo(Data, Overworld + 0x20); + } } public override uint Money @@ -794,24 +813,6 @@ protected override MysteryGift[] MysteryGiftCards } } - public byte[] LinkBlock - { - get - { - if (LinkInfo < 0) - return null; - return Data.Skip(LinkInfo).Take(0xC48).ToArray(); - } - set - { - if (LinkInfo < 0) - return; - if (value.Length != 0xC48) - return; - value.CopyTo(Data, LinkInfo); - } - } - private WC7 getWC7(int index) { if (WondercardData < 0) diff --git a/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs b/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs index 33ab7b4bc..39ac6d369 100644 --- a/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs +++ b/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs @@ -104,15 +104,8 @@ private void InitializeComponent() this.L_SinglesC = new System.Windows.Forms.Label(); this.TC_Editor = new System.Windows.Forms.TabControl(); this.Tab_Overview = new System.Windows.Forms.TabPage(); - this.GB_Map = new System.Windows.Forms.GroupBox(); - this.NUD_Z = new System.Windows.Forms.NumericUpDown(); - this.NUD_M = new System.Windows.Forms.NumericUpDown(); - this.NUD_Y = new System.Windows.Forms.NumericUpDown(); - this.NUD_X = new System.Windows.Forms.NumericUpDown(); - this.L_Y = new System.Windows.Forms.Label(); - this.L_CurrentMap = new System.Windows.Forms.Label(); - this.L_Z = new System.Windows.Forms.Label(); - this.L_X = new System.Windows.Forms.Label(); + this.CB_AlolaTime = new System.Windows.Forms.ComboBox(); + this.L_AlolaTime = new System.Windows.Forms.Label(); this.GB_Adventure = new System.Windows.Forms.GroupBox(); this.L_Fame = new System.Windows.Forms.Label(); this.CAL_HoFDate = new System.Windows.Forms.DateTimePicker(); @@ -122,16 +115,27 @@ private void InitializeComponent() this.CAL_AdventureStartTime = new System.Windows.Forms.DateTimePicker(); this.CAL_LastSavedTime = new System.Windows.Forms.DateTimePicker(); this.Tab_BadgeMap = new System.Windows.Forms.TabPage(); - this.L_AlolaTime = new System.Windows.Forms.Label(); - this.CB_AlolaTime = new System.Windows.Forms.ComboBox(); + this.GB_Map = new System.Windows.Forms.GroupBox(); + this.NUD_Z = new System.Windows.Forms.NumericUpDown(); + this.NUD_M = new System.Windows.Forms.NumericUpDown(); + this.NUD_Y = new System.Windows.Forms.NumericUpDown(); + this.NUD_X = new System.Windows.Forms.NumericUpDown(); + this.L_Y = new System.Windows.Forms.Label(); + this.L_CurrentMap = new System.Windows.Forms.Label(); + this.L_Z = new System.Windows.Forms.Label(); + this.L_X = new System.Windows.Forms.Label(); + this.NUD_R = new System.Windows.Forms.NumericUpDown(); + this.L_R = new System.Windows.Forms.Label(); this.TC_Editor.SuspendLayout(); this.Tab_Overview.SuspendLayout(); + this.GB_Adventure.SuspendLayout(); + this.Tab_BadgeMap.SuspendLayout(); this.GB_Map.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Z)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_M)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_X)).BeginInit(); - this.GB_Adventure.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_R)).BeginInit(); this.SuspendLayout(); // // B_Cancel @@ -739,7 +743,6 @@ private void InitializeComponent() // this.Tab_Overview.Controls.Add(this.CB_AlolaTime); this.Tab_Overview.Controls.Add(this.L_AlolaTime); - this.Tab_Overview.Controls.Add(this.GB_Map); this.Tab_Overview.Controls.Add(this.GB_Adventure); this.Tab_Overview.Controls.Add(this.TB_OTName); this.Tab_Overview.Controls.Add(this.CB_Gender); @@ -768,113 +771,23 @@ private void InitializeComponent() this.Tab_Overview.Text = "Overview"; this.Tab_Overview.UseVisualStyleBackColor = true; // - // GB_Map + // CB_AlolaTime // - this.GB_Map.Controls.Add(this.NUD_Z); - this.GB_Map.Controls.Add(this.NUD_M); - this.GB_Map.Controls.Add(this.NUD_Y); - this.GB_Map.Controls.Add(this.NUD_X); - this.GB_Map.Controls.Add(this.L_Y); - this.GB_Map.Controls.Add(this.L_CurrentMap); - this.GB_Map.Controls.Add(this.L_Z); - this.GB_Map.Controls.Add(this.L_X); - this.GB_Map.Location = new System.Drawing.Point(223, 122); - this.GB_Map.Name = "GB_Map"; - this.GB_Map.Size = new System.Drawing.Size(157, 125); - this.GB_Map.TabIndex = 57; - this.GB_Map.TabStop = false; - this.GB_Map.Text = "Map Position"; + this.CB_AlolaTime.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_AlolaTime.FormattingEnabled = true; + this.CB_AlolaTime.Location = new System.Drawing.Point(287, 89); + this.CB_AlolaTime.Name = "CB_AlolaTime"; + this.CB_AlolaTime.Size = new System.Drawing.Size(93, 21); + this.CB_AlolaTime.TabIndex = 59; // - // NUD_Z + // L_AlolaTime // - this.NUD_Z.Location = new System.Drawing.Point(93, 68); - this.NUD_Z.Maximum = new decimal(new int[] { - 65535, - 0, - 0, - 0}); - this.NUD_Z.Minimum = new decimal(new int[] { - 65535, - 0, - 0, - -2147483648}); - this.NUD_Z.Name = "NUD_Z"; - this.NUD_Z.Size = new System.Drawing.Size(50, 20); - this.NUD_Z.TabIndex = 53; - // - // NUD_M - // - this.NUD_M.Location = new System.Drawing.Point(93, 16); - this.NUD_M.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this.NUD_M.Name = "NUD_M"; - this.NUD_M.Size = new System.Drawing.Size(50, 20); - this.NUD_M.TabIndex = 52; - // - // NUD_Y - // - this.NUD_Y.DecimalPlaces = 1; - this.NUD_Y.Location = new System.Drawing.Point(93, 94); - this.NUD_Y.Maximum = new decimal(new int[] { - 65535, - 0, - 0, - 0}); - this.NUD_Y.Name = "NUD_Y"; - this.NUD_Y.Size = new System.Drawing.Size(50, 20); - this.NUD_Y.TabIndex = 51; - // - // NUD_X - // - this.NUD_X.DecimalPlaces = 1; - this.NUD_X.Location = new System.Drawing.Point(93, 42); - this.NUD_X.Maximum = new decimal(new int[] { - 65535, - 0, - 0, - 0}); - this.NUD_X.Name = "NUD_X"; - this.NUD_X.Size = new System.Drawing.Size(50, 20); - this.NUD_X.TabIndex = 50; - // - // L_Y - // - this.L_Y.Location = new System.Drawing.Point(6, 94); - this.L_Y.Name = "L_Y"; - this.L_Y.Size = new System.Drawing.Size(80, 20); - this.L_Y.TabIndex = 49; - this.L_Y.Text = "Y Coordinate:"; - this.L_Y.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_CurrentMap - // - this.L_CurrentMap.Location = new System.Drawing.Point(6, 16); - this.L_CurrentMap.Name = "L_CurrentMap"; - this.L_CurrentMap.Size = new System.Drawing.Size(80, 20); - this.L_CurrentMap.TabIndex = 46; - this.L_CurrentMap.Text = "Current Map:"; - this.L_CurrentMap.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_Z - // - this.L_Z.Location = new System.Drawing.Point(6, 68); - this.L_Z.Name = "L_Z"; - this.L_Z.Size = new System.Drawing.Size(80, 20); - this.L_Z.TabIndex = 48; - this.L_Z.Text = "Z Coordinate:"; - this.L_Z.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_X - // - this.L_X.Location = new System.Drawing.Point(6, 42); - this.L_X.Name = "L_X"; - this.L_X.Size = new System.Drawing.Size(80, 20); - this.L_X.TabIndex = 47; - this.L_X.Text = "X Coordinate:"; - this.L_X.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.L_AlolaTime.Location = new System.Drawing.Point(209, 92); + this.L_AlolaTime.Name = "L_AlolaTime"; + this.L_AlolaTime.Size = new System.Drawing.Size(72, 13); + this.L_AlolaTime.TabIndex = 58; + this.L_AlolaTime.Text = "Time Offset:"; + this.L_AlolaTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // GB_Adventure // @@ -981,30 +894,145 @@ private void InitializeComponent() // // Tab_BadgeMap // + this.Tab_BadgeMap.Controls.Add(this.GB_Map); this.Tab_BadgeMap.Location = new System.Drawing.Point(4, 22); this.Tab_BadgeMap.Name = "Tab_BadgeMap"; this.Tab_BadgeMap.Size = new System.Drawing.Size(386, 253); this.Tab_BadgeMap.TabIndex = 3; - this.Tab_BadgeMap.Text = "Badges/Map"; + this.Tab_BadgeMap.Text = "Map"; this.Tab_BadgeMap.UseVisualStyleBackColor = true; // - // L_AlolaTime + // GB_Map // - this.L_AlolaTime.Location = new System.Drawing.Point(209, 92); - this.L_AlolaTime.Name = "L_AlolaTime"; - this.L_AlolaTime.Size = new System.Drawing.Size(72, 13); - this.L_AlolaTime.TabIndex = 58; - this.L_AlolaTime.Text = "Time Offset:"; - this.L_AlolaTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.GB_Map.Controls.Add(this.NUD_R); + this.GB_Map.Controls.Add(this.L_R); + this.GB_Map.Controls.Add(this.NUD_Z); + this.GB_Map.Controls.Add(this.NUD_M); + this.GB_Map.Controls.Add(this.NUD_Y); + this.GB_Map.Controls.Add(this.NUD_X); + this.GB_Map.Controls.Add(this.L_Y); + this.GB_Map.Controls.Add(this.L_CurrentMap); + this.GB_Map.Controls.Add(this.L_Z); + this.GB_Map.Controls.Add(this.L_X); + this.GB_Map.Location = new System.Drawing.Point(115, 64); + this.GB_Map.Name = "GB_Map"; + this.GB_Map.Size = new System.Drawing.Size(157, 156); + this.GB_Map.TabIndex = 58; + this.GB_Map.TabStop = false; + this.GB_Map.Text = "Map Position"; // - // CB_AlolaTime + // NUD_Z // - this.CB_AlolaTime.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_AlolaTime.FormattingEnabled = true; - this.CB_AlolaTime.Location = new System.Drawing.Point(287, 89); - this.CB_AlolaTime.Name = "CB_AlolaTime"; - this.CB_AlolaTime.Size = new System.Drawing.Size(93, 21); - this.CB_AlolaTime.TabIndex = 59; + this.NUD_Z.Location = new System.Drawing.Point(93, 68); + this.NUD_Z.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.NUD_Z.Minimum = new decimal(new int[] { + 65535, + 0, + 0, + -2147483648}); + this.NUD_Z.Name = "NUD_Z"; + this.NUD_Z.Size = new System.Drawing.Size(50, 20); + this.NUD_Z.TabIndex = 53; + // + // NUD_M + // + this.NUD_M.Location = new System.Drawing.Point(93, 16); + this.NUD_M.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.NUD_M.Name = "NUD_M"; + this.NUD_M.Size = new System.Drawing.Size(50, 20); + this.NUD_M.TabIndex = 52; + // + // NUD_Y + // + this.NUD_Y.DecimalPlaces = 1; + this.NUD_Y.Location = new System.Drawing.Point(93, 94); + this.NUD_Y.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.NUD_Y.Name = "NUD_Y"; + this.NUD_Y.Size = new System.Drawing.Size(50, 20); + this.NUD_Y.TabIndex = 51; + // + // NUD_X + // + this.NUD_X.DecimalPlaces = 1; + this.NUD_X.Location = new System.Drawing.Point(93, 42); + this.NUD_X.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.NUD_X.Name = "NUD_X"; + this.NUD_X.Size = new System.Drawing.Size(50, 20); + this.NUD_X.TabIndex = 50; + // + // L_Y + // + this.L_Y.Location = new System.Drawing.Point(6, 94); + this.L_Y.Name = "L_Y"; + this.L_Y.Size = new System.Drawing.Size(80, 20); + this.L_Y.TabIndex = 49; + this.L_Y.Text = "Y Coordinate:"; + this.L_Y.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_CurrentMap + // + this.L_CurrentMap.Location = new System.Drawing.Point(6, 16); + this.L_CurrentMap.Name = "L_CurrentMap"; + this.L_CurrentMap.Size = new System.Drawing.Size(80, 20); + this.L_CurrentMap.TabIndex = 46; + this.L_CurrentMap.Text = "Current Map:"; + this.L_CurrentMap.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_Z + // + this.L_Z.Location = new System.Drawing.Point(6, 68); + this.L_Z.Name = "L_Z"; + this.L_Z.Size = new System.Drawing.Size(80, 20); + this.L_Z.TabIndex = 48; + this.L_Z.Text = "Z Coordinate:"; + this.L_Z.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_X + // + this.L_X.Location = new System.Drawing.Point(6, 42); + this.L_X.Name = "L_X"; + this.L_X.Size = new System.Drawing.Size(80, 20); + this.L_X.TabIndex = 47; + this.L_X.Text = "X Coordinate:"; + this.L_X.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_R + // + this.NUD_R.DecimalPlaces = 1; + this.NUD_R.Location = new System.Drawing.Point(93, 120); + this.NUD_R.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.NUD_R.Name = "NUD_R"; + this.NUD_R.Size = new System.Drawing.Size(50, 20); + this.NUD_R.TabIndex = 55; + // + // L_R + // + this.L_R.Location = new System.Drawing.Point(6, 120); + this.L_R.Name = "L_R"; + this.L_R.Size = new System.Drawing.Size(80, 20); + this.L_R.TabIndex = 54; + this.L_R.Text = "Rotation:"; + this.L_R.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // SAV_Trainer7 // @@ -1024,13 +1052,15 @@ private void InitializeComponent() this.TC_Editor.ResumeLayout(false); this.Tab_Overview.ResumeLayout(false); this.Tab_Overview.PerformLayout(); + this.GB_Adventure.ResumeLayout(false); + this.GB_Adventure.PerformLayout(); + this.Tab_BadgeMap.ResumeLayout(false); this.GB_Map.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_Z)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_M)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_X)).EndInit(); - this.GB_Adventure.ResumeLayout(false); - this.GB_Adventure.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_R)).EndInit(); this.ResumeLayout(false); } @@ -1121,6 +1151,8 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Fame; private System.Windows.Forms.DateTimePicker CAL_HoFDate; private System.Windows.Forms.DateTimePicker CAL_HoFTime; + private System.Windows.Forms.Label L_AlolaTime; + private System.Windows.Forms.ComboBox CB_AlolaTime; private System.Windows.Forms.Label L_X; private System.Windows.Forms.Label L_Z; private System.Windows.Forms.Label L_CurrentMap; @@ -1130,7 +1162,7 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_M; private System.Windows.Forms.NumericUpDown NUD_Z; private System.Windows.Forms.GroupBox GB_Map; - private System.Windows.Forms.Label L_AlolaTime; - private System.Windows.Forms.ComboBox CB_AlolaTime; + private System.Windows.Forms.NumericUpDown NUD_R; + private System.Windows.Forms.Label L_R; } } diff --git a/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.cs b/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.cs index 1083d380e..632b3a705 100644 --- a/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.cs +++ b/PKHeX/Subforms/Save Editors/Gen7/SAV_Trainer7.cs @@ -102,6 +102,7 @@ private void getTextBoxes() NUD_X.Value = (decimal)SAV.X; NUD_Z.Value = (decimal)SAV.Z; NUD_Y.Value = (decimal)SAV.Y; + NUD_R.Value = (decimal)SAV.R; } catch { GB_Map.Enabled = false; } @@ -140,6 +141,7 @@ private void save() SAV.X = (float)NUD_X.Value; SAV.Z = (float)NUD_Z.Value; SAV.Y = (float)NUD_Y.Value; + SAV.R = (float)NUD_R.Value; } // Save PlayTime