mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-03 16:20:44 +01:00
Merge pull request #745 from Gudf/master
Use a constant instead of integer literals when checking for shinyness
This commit is contained in:
commit
3f762629e8
@ -82,4 +82,7 @@
|
|||||||
#define NUM_STATS 6
|
#define NUM_STATS 6
|
||||||
#define NUM_BATTLE_STATS 8
|
#define NUM_BATTLE_STATS 8
|
||||||
|
|
||||||
|
// Shiny odds
|
||||||
|
#define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_POKEMON_H
|
#endif // GUARD_CONSTANTS_POKEMON_H
|
||||||
|
@ -2029,7 +2029,7 @@ void sub_8172EF0(u8 battler, struct Pokemon *mon)
|
|||||||
if (IsBattlerSpriteVisible(battler))
|
if (IsBattlerSpriteVisible(battler))
|
||||||
{
|
{
|
||||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||||
if (shinyValue < 8)
|
if (shinyValue < SHINY_ODDS)
|
||||||
isShiny = TRUE;
|
isShiny = TRUE;
|
||||||
|
|
||||||
if (isShiny)
|
if (isShiny)
|
||||||
|
@ -2183,7 +2183,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
|||||||
{
|
{
|
||||||
value = Random32();
|
value = Random32();
|
||||||
shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
|
shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||||
} while (shinyValue < 8);
|
} while (shinyValue < SHINY_ODDS);
|
||||||
}
|
}
|
||||||
else if (otIdType == OT_ID_PRESET) //Pokemon has a preset OT ID
|
else if (otIdType == OT_ID_PRESET) //Pokemon has a preset OT ID
|
||||||
{
|
{
|
||||||
@ -6332,7 +6332,7 @@ const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32
|
|||||||
return gMonPaletteTable[0].data;
|
return gMonPaletteTable[0].data;
|
||||||
|
|
||||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||||
if (shinyValue < 8)
|
if (shinyValue < SHINY_ODDS)
|
||||||
return gMonShinyPaletteTable[species].data;
|
return gMonShinyPaletteTable[species].data;
|
||||||
else
|
else
|
||||||
return gMonPaletteTable[species].data;
|
return gMonPaletteTable[species].data;
|
||||||
@ -6351,7 +6351,7 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u
|
|||||||
u32 shinyValue;
|
u32 shinyValue;
|
||||||
|
|
||||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||||
if (shinyValue < 8)
|
if (shinyValue < SHINY_ODDS)
|
||||||
return &gMonShinyPaletteTable[species];
|
return &gMonShinyPaletteTable[species];
|
||||||
else
|
else
|
||||||
return &gMonPaletteTable[species];
|
return &gMonPaletteTable[species];
|
||||||
@ -6525,7 +6525,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality)
|
|||||||
{
|
{
|
||||||
bool8 retVal = FALSE;
|
bool8 retVal = FALSE;
|
||||||
u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||||
if (shinyValue < 8)
|
if (shinyValue < SHINY_ODDS)
|
||||||
retVal = TRUE;
|
retVal = TRUE;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user