Add indication for party/starter slots

This commit is contained in:
Kurt 2018-12-09 23:18:37 -08:00
parent 7054b38e44
commit 8a0b9cd88c
12 changed files with 153 additions and 22 deletions

View file

@ -6,18 +6,22 @@ namespace PKHeX.Core
public enum StorageSlotFlag
{
None,
Party1 = 1 << 0,
Party2 = 1 << 1,
Party3 = 1 << 2,
Party4 = 1 << 3,
Party5 = 1 << 4,
Party6 = 1 << 5,
BattleTeam1 = 1 << 6,
BattleTeam2 = 1 << 7,
BattleTeam3 = 1 << 8,
BattleTeam4 = 1 << 9,
BattleTeam5 = 1 << 10,
BattleTeam6 = 1 << 11,
Party = 1 << 0,
Party1 = Party << 0,
Party2 = Party << 1,
Party3 = Party << 2,
Party4 = Party << 3,
Party5 = Party << 4,
Party6 = Party << 5,
BattleTeam = 1 << 6,
BattleTeam1 = BattleTeam << 0,
BattleTeam2 = BattleTeam << 1,
BattleTeam3 = BattleTeam << 2,
BattleTeam4 = BattleTeam << 3,
BattleTeam5 = BattleTeam << 4,
BattleTeam6 = BattleTeam << 5,
Starter = 1 << 29,
Locked = 1 << 30,
@ -35,25 +39,43 @@ namespace PKHeX.Core
if (value.HasFlagFast(StorageSlotFlag.Starter))
return true;
return value.IsBattleTeam();
return value.IsBattleTeam() >= 0;
}
public static bool IsBattleTeam(this StorageSlotFlag value)
public static int IsBattleTeam(this StorageSlotFlag value)
{
if (value.HasFlagFast(StorageSlotFlag.BattleTeam1))
return true;
return 0;
if (value.HasFlagFast(StorageSlotFlag.BattleTeam2))
return true;
return 1;
if (value.HasFlagFast(StorageSlotFlag.BattleTeam3))
return true;
return 2;
if (value.HasFlagFast(StorageSlotFlag.BattleTeam4))
return true;
return 3;
if (value.HasFlagFast(StorageSlotFlag.BattleTeam5))
return true;
return 4;
if (value.HasFlagFast(StorageSlotFlag.BattleTeam6))
return true;
return 5;
return false;
return -1;
}
public static int IsParty(this StorageSlotFlag value)
{
if (value.HasFlagFast(StorageSlotFlag.Party1))
return 0;
if (value.HasFlagFast(StorageSlotFlag.Party2))
return 1;
if (value.HasFlagFast(StorageSlotFlag.Party3))
return 2;
if (value.HasFlagFast(StorageSlotFlag.Party4))
return 3;
if (value.HasFlagFast(StorageSlotFlag.Party5))
return 4;
if (value.HasFlagFast(StorageSlotFlag.Party6))
return 5;
return -1;
}
}
}

View file

@ -1972,6 +1972,13 @@
<None Include="Resources\img\Pokemon Sprites\133-1p.png" />
<None Include="Resources\img\Pokemon Sprites\25-8p.png" />
<None Include="Resources\img\misc\icon_favo.png" />
<None Include="Resources\img\misc\party1.png" />
<None Include="Resources\img\misc\party2.png" />
<None Include="Resources\img\misc\party3.png" />
<None Include="Resources\img\misc\party4.png" />
<None Include="Resources\img\misc\party5.png" />
<None Include="Resources\img\misc\party6.png" />
<None Include="Resources\img\misc\starter.png" />
<Content Include="Resources\img\Pokemon Sprites\803.png" />
<Content Include="Resources\img\Pokemon Sprites\804.png" />
<Content Include="Resources\img\Pokemon Sprites\805.png" />

View file

@ -28218,6 +28218,66 @@ namespace PKHeX.WinForms.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap party1 {
get {
object obj = ResourceManager.GetObject("party1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap party2 {
get {
object obj = ResourceManager.GetObject("party2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap party3 {
get {
object obj = ResourceManager.GetObject("party3", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap party4 {
get {
object obj = ResourceManager.GetObject("party4", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap party5 {
get {
object obj = ResourceManager.GetObject("party5", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap party6 {
get {
object obj = ResourceManager.GetObject("party6", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
@ -29416,6 +29476,16 @@ namespace PKHeX.WinForms.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap starter {
get {
object obj = ResourceManager.GetObject("starter", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -9235,4 +9235,25 @@
<data name="icon_favo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\icon_favo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="party1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\party1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="party2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\party2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="party3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\party3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="party4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\party4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="party5" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\party5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="party6" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\party6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="starter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\starter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

View file

@ -130,13 +130,24 @@ namespace PKHeX.WinForms
var flags = SAV.GetSlotFlags(box, slot);
if (flags.HasFlagFast(StorageSlotFlag.Locked))
sprite = ImageUtil.LayerImage(sprite, Resources.locked, 26, 0);
else if (flags != 0)
int team = flags.IsBattleTeam();
if (team >= 0)
sprite = ImageUtil.LayerImage(sprite, Resources.team, 21, 0);
int party = flags.IsParty();
if (party >= 0)
sprite = ImageUtil.LayerImage(sprite, PartyMarks[party], 24, 0);
if (flags.HasFlagFast(StorageSlotFlag.Starter))
sprite = ImageUtil.LayerImage(sprite, Resources.starter, 0, 0);
}
return sprite;
}
private static readonly Image[] PartyMarks =
{
Resources.party1, Resources.party2, Resources.party3, Resources.party4, Resources.party5, Resources.party6,
};
public static void GetSpriteGlow(PKM pk, byte[] bgr, out byte[] pixels, out Image baseSprite, bool forceHollow = false)
{
bool egg = pk.IsEgg;