Reference TMs and HMs by move instead of number (#1732)

This commit is contained in:
Martin Griffin
2023-08-09 15:51:01 +01:00
committed by GitHub
parent da238562f0
commit 912a80e27a
74 changed files with 10759 additions and 9937 deletions
+31 -10
View File
@@ -6199,15 +6199,26 @@ u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm)
{
return 0;
}
else if (tm < 32)
// Fewer than 64 moves, use GF's method (for matching).
if (sizeof(struct TMHMLearnset) <= 8)
{
u32 mask = 1 << tm;
return gTMHMLearnsets[species][0] & mask;
if (tm < 32)
{
u32 mask = 1 << tm;
return gTMHMLearnsets[species].as_u32s[0] & mask;
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species].as_u32s[1] & mask;
}
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species][1] & mask;
u32 index = tm / 32;
u32 mask = 1 << (tm % 32);
return gTMHMLearnsets[species].as_u32s[index] & mask;
}
}
@@ -6217,15 +6228,25 @@ u32 CanSpeciesLearnTMHM(u16 species, u8 tm)
{
return 0;
}
else if (tm < 32)
// Fewer than 64 moves, use GF's method (for matching).
if (sizeof(struct TMHMLearnset) <= 8)
{
u32 mask = 1 << tm;
return gTMHMLearnsets[species][0] & mask;
if (tm < 32)
{
u32 mask = 1 << tm;
return gTMHMLearnsets[species].as_u32s[0] & mask;
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species].as_u32s[1] & mask;
}
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species][1] & mask;
u32 index = tm / 32;
u32 mask = 1 << (tm % 32);
return gTMHMLearnsets[species].as_u32s[index] & mask;
}
}