Add raw weather seed reading (not shifted)

#309
This commit is contained in:
Kurt 2020-06-12 23:04:44 -07:00
parent 70ff8508e9
commit a14ddcade6
7 changed files with 47 additions and 5 deletions

View File

@ -11,8 +11,9 @@ public sealed class MainSave : EncryptedFilePair
public readonly MainSaveOffsets Offsets;
public MainSave(string folder) : base(folder, "main") => Offsets = MainSaveOffsets.GetOffsets(Info);
public Hemisphere Hemisphere { get => (Hemisphere)Data[Offsets.Hemisphere]; set => Data[Offsets.Hemisphere] = (byte)value; }
public Hemisphere Hemisphere { get => (Hemisphere)Data[Offsets.WeatherArea]; set => Data[Offsets.WeatherArea] = (byte)value; }
public AirportColor AirportThemeColor { get => (AirportColor)Data[Offsets.AirportThemeColor]; set => Data[Offsets.AirportThemeColor] = (byte)value; }
public uint WeatherSeed { get => BitConverter.ToUInt32(Data, Offsets.WeatherRandSeed); set => BitConverter.GetBytes(value).CopyTo(Data, Offsets.WeatherRandSeed); }
public Villager GetVillager(int index) => Offsets.ReadVillager(Data, index);
public void SetVillager(Villager value, int index) => Offsets.WriteVillager(value, Data, index);

View File

@ -21,7 +21,8 @@ public abstract class MainSaveOffsets
public abstract int PatternFlag { get; }
public abstract int PatternTailor { get; }
public abstract int Hemisphere { get; }
public abstract int WeatherArea { get; }
public abstract int WeatherRandSeed { get; }
public abstract int MainFieldStructure { get; }

View File

@ -15,7 +15,8 @@ public class MainSaveOffsets10 : MainSaveOffsets
public override int PatternTailor => PatternFlag + DesignPattern.SIZE;
public const int GSaveWeather = GSaveLandStart + 0x1D6FB0;
public override int Hemisphere => GSaveWeather + 0x14;
public override int WeatherArea => GSaveWeather + 0x14; // Hemisphere
public override int WeatherRandSeed => GSaveWeather + 0x18;
public override int EventFlagLand => GSaveLandStart + 0x200FF4;

View File

@ -15,7 +15,8 @@ public class MainSaveOffsets11 : MainSaveOffsets
public override int PatternTailor => PatternFlag + DesignPattern.SIZE;
public const int GSaveWeather = GSaveLandStart + 0x1D6F98;
public override int Hemisphere => GSaveWeather + 0x14;
public override int WeatherArea => GSaveWeather + 0x14; // Hemisphere
public override int WeatherRandSeed => GSaveWeather + 0x18;
public override int EventFlagLand => GSaveLandStart + 0x20100C;

View File

@ -15,7 +15,8 @@ public class MainSaveOffsets12 : MainSaveOffsets
public override int PatternTailor => PatternFlag + DesignPattern.SIZE;
public const int GSaveWeather = GSaveLandStart + 0x1D6FB0;
public override int Hemisphere => GSaveWeather + 0x14;
public override int WeatherArea => GSaveWeather + 0x14; // Hemisphere
public override int WeatherRandSeed => GSaveWeather + 0x18;
public override int EventFlagLand => GSaveLandStart + 0x20100C;

View File

@ -96,6 +96,8 @@ private void InitializeComponent()
this.CB_Players = new System.Windows.Forms.ComboBox();
this.PB_Player = new System.Windows.Forms.PictureBox();
this.TC_Editors = new System.Windows.Forms.TabControl();
this.L_WeatherSeed = new System.Windows.Forms.Label();
this.NUD_WeatherSeed = new System.Windows.Forms.NumericUpDown();
this.Menu_Editor.SuspendLayout();
this.CM_Picture.SuspendLayout();
this.Tab_Map.SuspendLayout();
@ -111,6 +113,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_BankBells)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Player)).BeginInit();
this.TC_Editors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_WeatherSeed)).BeginInit();
this.SuspendLayout();
//
// Menu_Editor
@ -236,6 +239,8 @@ private void InitializeComponent()
//
// Tab_Map
//
this.Tab_Map.Controls.Add(this.NUD_WeatherSeed);
this.Tab_Map.Controls.Add(this.L_WeatherSeed);
this.Tab_Map.Controls.Add(this.B_EditDesignsTailor);
this.Tab_Map.Controls.Add(this.B_EditPatternFlag);
this.Tab_Map.Controls.Add(this.CB_AirportColor);
@ -786,6 +791,33 @@ private void InitializeComponent()
this.TC_Editors.Size = new System.Drawing.Size(404, 237);
this.TC_Editors.TabIndex = 1;
//
// L_WeatherSeed
//
this.L_WeatherSeed.AutoSize = true;
this.L_WeatherSeed.Location = new System.Drawing.Point(301, 66);
this.L_WeatherSeed.Name = "L_WeatherSeed";
this.L_WeatherSeed.Size = new System.Drawing.Size(63, 13);
this.L_WeatherSeed.TabIndex = 64;
this.L_WeatherSeed.Text = "Hemisphere";
//
// NUD_WeatherSeed
//
this.NUD_WeatherSeed.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.NUD_WeatherSeed.Location = new System.Drawing.Point(202, 59);
this.NUD_WeatherSeed.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.NUD_WeatherSeed.Name = "NUD_WeatherSeed";
this.NUD_WeatherSeed.Size = new System.Drawing.Size(93, 20);
this.NUD_WeatherSeed.TabIndex = 65;
this.NUD_WeatherSeed.Value = new decimal(new int[] {
1234567890,
0,
0,
0});
//
// Editor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -817,6 +849,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_BankBells)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Player)).EndInit();
this.TC_Editors.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_WeatherSeed)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -890,6 +923,8 @@ private void InitializeComponent()
private System.Windows.Forms.Button B_EditPatternFlag;
private System.Windows.Forms.ToolStripMenuItem B_EditMuseum_Click;
private System.Windows.Forms.ToolStripMenuItem B_EditVisitors;
private System.Windows.Forms.Label L_WeatherSeed;
private System.Windows.Forms.NumericUpDown NUD_WeatherSeed;
}
}

View File

@ -180,6 +180,7 @@ private void LoadMain()
foreach (var n in names)
CB_AirportColor.Items.Add(n);
CB_AirportColor.SelectedIndex = (int)m.AirportThemeColor;
NUD_WeatherSeed.Value = m.WeatherSeed;
}
private void SaveMain()
@ -187,6 +188,7 @@ private void SaveMain()
var m = SAV.Main;
m.Hemisphere = (Hemisphere)CB_Hemisphere.SelectedIndex;
m.AirportThemeColor = (AirportColor)CB_AirportColor.SelectedIndex;
m.WeatherSeed = (uint)NUD_WeatherSeed.Value;
}
#region Player Editing