mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
Update gen4/5 map saving
Trainer Editor now only writes back coordinates if they were changed by the user. DP coordinate offsets for overworld data fixed. PokeSAV didn't have Platinum overworld offsets programmed, so I had to figure those out myself.
This commit is contained in:
parent
7a4dcf0a3a
commit
1c1b90cd38
3 changed files with 45 additions and 37 deletions
|
@ -447,7 +447,7 @@ namespace PKHeX
|
|||
int ofs = 0;
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP:
|
||||
case GameVersion.DP: ofs = 0x1238; break;
|
||||
case GameVersion.HGSS: ofs = 0x1234; break;
|
||||
case GameVersion.Pt: ofs = 0x1280; break;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ namespace PKHeX
|
|||
int ofs = 0;
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP:
|
||||
case GameVersion.DP: ofs = 0x1238; break;
|
||||
case GameVersion.HGSS: ofs = 0x1234; break;
|
||||
case GameVersion.Pt: ofs = 0x1280; break;
|
||||
}
|
||||
|
@ -483,22 +483,16 @@ namespace PKHeX
|
|||
}
|
||||
set
|
||||
{
|
||||
int ofs = 0;
|
||||
int ofs = 0; int ofs2 = 0;
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP: ofs = 0x25FA; break;
|
||||
case GameVersion.Pt: ofs = 0x287E; break;
|
||||
case GameVersion.HGSS: ofs = 0x236E; break;
|
||||
case GameVersion.DP: ofs = 0x25FA; ofs2 = 0x1240; break;
|
||||
case GameVersion.Pt: ofs = 0x287E; ofs2 = 0x1288; break;
|
||||
case GameVersion.HGSS: ofs = 0x236E; ofs2 = 0x123C; break;
|
||||
}
|
||||
ofs += GBO;
|
||||
ofs += GBO; ofs2 += GBO;
|
||||
BitConverter.GetBytes((ushort)value).CopyTo(Data, ofs);
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP:
|
||||
case GameVersion.HGSS:
|
||||
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x123C + GBO);
|
||||
break;
|
||||
}
|
||||
BitConverter.GetBytes((ushort)value).CopyTo(Data, ofs2);
|
||||
}
|
||||
}
|
||||
public int Z
|
||||
|
@ -544,22 +538,16 @@ namespace PKHeX
|
|||
}
|
||||
set
|
||||
{
|
||||
int ofs = 0;
|
||||
int ofs = 0; int ofs2 = 0;
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP: ofs = 0x25FE; break;
|
||||
case GameVersion.Pt: ofs = 0x2882; break;
|
||||
case GameVersion.HGSS: ofs = 0x2372; break;
|
||||
case GameVersion.DP: ofs = 0x25FE; ofs2 = 0x1244; break;
|
||||
case GameVersion.Pt: ofs = 0x2882; ofs2 = 0x128C; break;
|
||||
case GameVersion.HGSS: ofs = 0x2372; ofs2 = 0x1240; break;
|
||||
}
|
||||
ofs += GBO;
|
||||
ofs += GBO; ofs2 += GBO;
|
||||
BitConverter.GetBytes((ushort)value).CopyTo(Data, ofs);
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP:
|
||||
case GameVersion.HGSS:
|
||||
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1240 + GBO);
|
||||
break;
|
||||
}
|
||||
BitConverter.GetBytes((ushort)value).CopyTo(Data, ofs2);
|
||||
}
|
||||
}
|
||||
public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
|
||||
|
|
|
@ -353,7 +353,7 @@
|
|||
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(217, 100);
|
||||
this.GB_Map.Location = new System.Drawing.Point(217, 98);
|
||||
this.GB_Map.Name = "GB_Map";
|
||||
this.GB_Map.Size = new System.Drawing.Size(157, 125);
|
||||
this.GB_Map.TabIndex = 71;
|
||||
|
@ -376,6 +376,7 @@
|
|||
this.NUD_Z.Name = "NUD_Z";
|
||||
this.NUD_Z.Size = new System.Drawing.Size(50, 20);
|
||||
this.NUD_Z.TabIndex = 53;
|
||||
this.NUD_Z.ValueChanged += new System.EventHandler(this.changeMapValue);
|
||||
//
|
||||
// NUD_M
|
||||
//
|
||||
|
@ -388,6 +389,7 @@
|
|||
this.NUD_M.Name = "NUD_M";
|
||||
this.NUD_M.Size = new System.Drawing.Size(50, 20);
|
||||
this.NUD_M.TabIndex = 52;
|
||||
this.NUD_M.ValueChanged += new System.EventHandler(this.changeMapValue);
|
||||
//
|
||||
// NUD_Y
|
||||
//
|
||||
|
@ -400,6 +402,7 @@
|
|||
this.NUD_Y.Name = "NUD_Y";
|
||||
this.NUD_Y.Size = new System.Drawing.Size(50, 20);
|
||||
this.NUD_Y.TabIndex = 51;
|
||||
this.NUD_Y.ValueChanged += new System.EventHandler(this.changeMapValue);
|
||||
//
|
||||
// NUD_X
|
||||
//
|
||||
|
@ -412,6 +415,7 @@
|
|||
this.NUD_X.Name = "NUD_X";
|
||||
this.NUD_X.Size = new System.Drawing.Size(50, 20);
|
||||
this.NUD_X.TabIndex = 50;
|
||||
this.NUD_X.ValueChanged += new System.EventHandler(this.changeMapValue);
|
||||
//
|
||||
// L_Y
|
||||
//
|
||||
|
@ -716,7 +720,7 @@
|
|||
this.GB_Options.Controls.Add(this.LBL_BattleStyle);
|
||||
this.GB_Options.Controls.Add(this.CB_BattleStyle);
|
||||
this.GB_Options.Controls.Add(this.CHK_BattleEffects);
|
||||
this.GB_Options.Location = new System.Drawing.Point(217, 99);
|
||||
this.GB_Options.Location = new System.Drawing.Point(217, 98);
|
||||
this.GB_Options.Name = "GB_Options";
|
||||
this.GB_Options.Size = new System.Drawing.Size(157, 125);
|
||||
this.GB_Options.TabIndex = 72;
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace PKHeX
|
|||
{
|
||||
public SAV_SimpleTrainer()
|
||||
{
|
||||
Loading = true;
|
||||
InitializeComponent();
|
||||
Util.TranslateInterface(this, Main.curlanguage);
|
||||
|
||||
|
@ -101,10 +102,13 @@ namespace PKHeX
|
|||
if (SAV is SAV4)
|
||||
{
|
||||
SAV4 s = (SAV4)SAV;
|
||||
if (MapUpdated)
|
||||
{
|
||||
NUD_M.Value = s.M;
|
||||
NUD_X.Value = s.X;
|
||||
NUD_Z.Value = s.Z;
|
||||
NUD_Y.Value = s.Y;
|
||||
}
|
||||
|
||||
badgeval = s.Badges;
|
||||
if (s.Version == GameVersion.HGSS)
|
||||
|
@ -116,10 +120,13 @@ namespace PKHeX
|
|||
else if (SAV is SAV5)
|
||||
{
|
||||
SAV5 s = (SAV5)SAV;
|
||||
if (MapUpdated)
|
||||
{
|
||||
NUD_M.Value = s.M;
|
||||
NUD_X.Value = s.X;
|
||||
NUD_Z.Value = s.Z;
|
||||
NUD_Y.Value = s.Y;
|
||||
}
|
||||
|
||||
badgeval = s.Badges;
|
||||
}
|
||||
|
@ -134,9 +141,13 @@ namespace PKHeX
|
|||
CAL_HoFTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame % 86400);
|
||||
CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart);
|
||||
CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400);
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
private readonly CheckBox[] cba;
|
||||
private readonly SaveFile SAV = Main.SAV.Clone();
|
||||
private readonly bool Loading;
|
||||
private bool MapUpdated;
|
||||
|
||||
private void changeFFFF(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -228,5 +239,10 @@ namespace PKHeX
|
|||
val += (int)(time.Value - new DateTime(2000, 1, 1)).TotalSeconds;
|
||||
return val;
|
||||
}
|
||||
private void changeMapValue(object sender, EventArgs e)
|
||||
{
|
||||
if (!Loading)
|
||||
MapUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue