Indicate teamlocks in boxes

This commit is contained in:
Kurt
2021-11-26 19:54:07 -08:00
parent d9a87f908d
commit fd4dd6e2fb
2 changed files with 19 additions and 1 deletions

View File

@@ -83,8 +83,10 @@ private void Initialize()
Box = 0x14EF4;
Party = PartyInfo.Offset;
PokeDex = Zukan.PokeDex;
BoxLayout.LoadBattleTeams();
DaycareOffset = Daycare.Offset;
ReloadBattleTeams();
TeamSlots = BoxLayout.TeamSlots;
}
public override bool HasEvents => true;
@@ -143,6 +145,19 @@ protected void ReloadBattleTeams()
BoxLayout.LoadBattleTeams();
}
public override StorageSlotFlag GetSlotFlags(int index)
{
int team = Array.IndexOf(TeamSlots, index);
if (team < 0)
return StorageSlotFlag.None;
team /= 6;
var val = (StorageSlotFlag)((int)StorageSlotFlag.BattleTeam1 << team);
if (BoxLayout.GetIsTeamLocked(team))
val |= StorageSlotFlag.Locked;
return val;
}
#region Checksums
private const int HashOffset = SaveUtil.SIZE_G8BDSP - 0x10;

View File

@@ -98,6 +98,7 @@ public void SaveBattleTeams()
}
}
// bitflags
public byte LockedTeam
{
get => Data[Offset + 0x61C];
@@ -126,6 +127,8 @@ public byte CurrentBox
set => Data[Offset + 0x61E] = value;
}
public bool GetIsTeamLocked(int team) => (LockedTeam & (1 << team)) != 0;
public int GetBoxWallpaperOffset(int box) => Offset + 0x620 + box;
public int GetBoxWallpaper(int box)