summaryrefslogtreecommitdiff
path: root/src/pokemon.c
diff options
context:
space:
mode:
authorDiegoisawesome <diego@domoreaweso.me>2018-12-31 02:30:30 -0600
committerDiegoisawesome <diego@domoreaweso.me>2018-12-31 02:30:30 -0600
commitd004ce065c9cc6425df6f567dff39eb831f84875 (patch)
tree2c20338324f10a553e78e731d999dd58669266c3 /src/pokemon.c
parentec780bb2098be75e591b212e85947f88c91d4e37 (diff)
parent58f130d007b97623dd5c7a3b373800c138f75c5e (diff)
Merge branch 'master' of github.com:pret/pokeemerald into trade
Diffstat (limited to 'src/pokemon.c')
-rw-r--r--src/pokemon.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/pokemon.c b/src/pokemon.c
index 7c4103855..580216b2c 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -931,7 +931,7 @@ const u16 gSpeciesToNationalPokedexNum[] = // Assigns all species to the Nationa
SPECIES_TO_NATIONAL(CHIMECHO),
};
-const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index)
+const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index)
{
HOENN_TO_NATIONAL(TREECKO),
HOENN_TO_NATIONAL(GROVYLE),
@@ -1135,7 +1135,7 @@ const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National
HOENN_TO_NATIONAL(RAYQUAZA),
HOENN_TO_NATIONAL(JIRACHI),
HOENN_TO_NATIONAL(DEOXYS),
- HOENN_TO_NATIONAL(BULBASAUR), // Pokémon from here onwards are UNSEEN in the HoennDex.
+ HOENN_TO_NATIONAL(BULBASAUR), // Pokémon from here onwards are UNSEEN in the HoennDex.
HOENN_TO_NATIONAL(IVYSAUR),
HOENN_TO_NATIONAL(VENUSAUR),
HOENN_TO_NATIONAL(CHARMANDER),
@@ -2588,7 +2588,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
SetBoxMonData(boxMon, MON_DATA_SPECIES, &species);
SetBoxMonData(boxMon, MON_DATA_EXP, &gExperienceTables[gBaseStats[species].growthRate][level]);
SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &gBaseStats[species].friendship);
- value = sav1_map_get_name();
+ value = GetCurrentRegionMapSectionId();
SetBoxMonData(boxMon, MON_DATA_MET_LOCATION, &value);
SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &level);
SetBoxMonData(boxMon, MON_DATA_MET_GAME, &gGameVersion);
@@ -2754,7 +2754,7 @@ void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src)
CreateMon(mon, src->species, src->level, 0, 1, src->personality, 1, src->otId);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
SetMonMoveSlot(mon, src->moves[i], i);
SetMonData(mon, MON_DATA_PP_BONUSES, &src->ppBonuses);
@@ -2816,7 +2816,7 @@ void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl5
CreateMon(mon, src->species, level, 0, 1, src->personality, 1, src->otId);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
SetMonMoveSlot(mon, src->moves[i], i);
SetMonData(mon, MON_DATA_PP_BONUSES, &src->ppBonuses);
@@ -2880,7 +2880,7 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m
otId);
SetMonData(mon, MON_DATA_HELD_ITEM, &src->party[monId].item);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
SetMonMoveSlot(mon, src->party[monId].moves[i], i);
evAmount = MAX_TOTAL_EVS / NUM_STATS;
@@ -2940,7 +2940,7 @@ void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest)
dest->heldItem = heldItem;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
dest->moves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
dest->level = GetMonData(mon, MON_DATA_LEVEL, NULL);
@@ -3266,7 +3266,7 @@ u16 GiveMoveToMon(struct Pokemon *mon, u16 move)
u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
u16 existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
if (!existingMove)
@@ -3285,7 +3285,7 @@ u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (!mon->moves[i])
{
@@ -3388,7 +3388,7 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move)
moves[3] = move;
pp[3] = gBattleMoves[move].pp;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
SetMonData(mon, MON_DATA_MOVE1 + i, &moves[i]);
SetMonData(mon, MON_DATA_PP1 + i, &pp[i]);
@@ -3415,7 +3415,7 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
moves[3] = move;
pp[3] = gBattleMoves[move].pp;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moves[i]);
SetBoxMonData(boxMon, MON_DATA_PP1 + i, &pp[i]);
@@ -4849,7 +4849,7 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
for (j = 0; j < 6; j++)
SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gBattleResources->secretBase->party.EVs[i]);
- for (j = 0; j < 4; j++)
+ for (j = 0; j < MAX_MON_MOVES; j++)
{
SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, &gBattleResources->secretBase->party.moves[i * 4 + j]);
SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gBattleResources->secretBase->party.moves[i * 4 + j]].pp);
@@ -4938,7 +4938,7 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
gBattleMons[battlerId].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL);
gBattleMons[battlerId].item = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HELD_ITEM, NULL);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
gBattleMons[battlerId].moves[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE1 + i, NULL);
gBattleMons[battlerId].pp[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP1 + i, NULL);
@@ -5457,7 +5457,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
{
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
friendship++;
- if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == sav1_map_get_name())
+ if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
friendship++;
}
if (friendship < 0)
@@ -5483,7 +5483,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
{
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
friendship++;
- if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == sav1_map_get_name())
+ if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
friendship++;
}
if (friendship < 0)
@@ -5508,7 +5508,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
{
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
friendship++;
- if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == sav1_map_get_name())
+ if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
friendship++;
}
if (friendship < 0)
@@ -6156,7 +6156,7 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
{
if (GetMonData(mon, MON_DATA_POKEBALL, 0) == ITEM_LUXURY_BALL)
friendship++;
- if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == sav1_map_get_name())
+ if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == GetCurrentRegionMapSectionId())
friendship++;
}
if (friendship < 0)
@@ -6480,7 +6480,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
int i, j, k;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
for (i = 0; i < 20; i++)
@@ -6494,10 +6494,10 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
if (moveLevel <= (level << 9))
{
- for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
+ for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
;
- if (j == 4)
+ if (j == MAX_MON_MOVES)
{
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++)
;
@@ -6534,7 +6534,7 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
if (species == SPECIES_EGG)
return 0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
for (i = 0; i < 20; i++)
@@ -6548,10 +6548,10 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
if (moveLevel <= (level << 9))
{
- for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
+ for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
;
- if (j == 4)
+ if (j == MAX_MON_MOVES)
{
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++)
;
@@ -6701,7 +6701,7 @@ const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32
{
u32 shinyValue;
- if (species > SPECIES_EGG)
+ if (species > NUM_SPECIES)
return gMonPaletteTable[0].data;
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
@@ -6795,7 +6795,7 @@ void BoxMonRestorePP(struct BoxPokemon *boxMon)
{
int i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, 0))
{