Update Pokétch Unlocked Count (#4073)

Closes #4067
This commit is contained in:
Jonathan Herbert
2023-11-24 11:50:04 -04:00
committed by GitHub
parent 4f998e2fe0
commit e0fb60cdea
2 changed files with 4 additions and 1 deletions

View File

@@ -70,7 +70,7 @@ public PoketchColor PoketchColor
public bool PoketchFlag6 { get => (PoketchPacked & 0x40) != 0; set => PoketchPacked = (byte)(value ? (PoketchPacked | 0x40) : (PoketchPacked & ~0x40)); }
public bool PoketchFlag7 { get => (PoketchPacked & 0x80) != 0; set => PoketchPacked = (byte)(value ? (PoketchPacked | 0x80) : (PoketchPacked & ~0x80)); }
public byte Poketch1 { get => General[PoketchStart + 1]; set => General[PoketchStart + 1] = value; }
public byte PoketchUnlockedCount { get => General[PoketchStart + 1]; set => General[PoketchStart + 1] = value; }
public sbyte CurrentPoketchApp { get => (sbyte)General[PoketchStart + 2]; set => General[PoketchStart + 2] = (byte)Math.Min((sbyte)PoketchApp.Alarm_Clock, value); }
public bool GetPoketchAppUnlocked(PoketchApp index)

View File

@@ -249,13 +249,16 @@ private void ReadPoketch(SAV4Sinnoh s)
private void SavePoketch(SAV4Sinnoh s)
{
int unlockedCount = 0;
s.CurrentPoketchApp = (sbyte)CB_CurrentApp.SelectedIndex;
for (int i = 0; i < CLB_Poketch.Items.Count; i++)
{
var b = CLB_Poketch.GetItemChecked(i);
s.SetPoketchAppUnlocked((PoketchApp)i, b);
if (b) unlockedCount++;
}
s.SetPoketchDotArtistData(DotArtistByte);
s.PoketchUnlockedCount = (byte)unlockedCount;
}
private void SetPictureBoxFromFlags(ReadOnlySpan<byte> inp)