summaryrefslogtreecommitdiff
path: root/src/pokemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pokemon.c')
-rw-r--r--src/pokemon.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/pokemon.c b/src/pokemon.c
index c555ca3d7..a30e20ea2 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -60,6 +60,7 @@ static void EncryptBoxMon(struct BoxPokemon *boxMon);
static void DecryptBoxMon(struct BoxPokemon *boxMon);
static void sub_806E6CC(u8 taskId);
static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
+static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
// EWRAM vars
EWRAM_DATA static u8 sLearningMoveTableID = 0;
@@ -2879,22 +2880,22 @@ u16 GiveMoveToMon(struct Pokemon *mon, u16 move)
return GiveMoveToBoxMon(&mon->box, move);
}
-u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
+static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
{
s32 i;
for (i = 0; i < MAX_MON_MOVES; i++)
{
u16 existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
- if (!existingMove)
+ if (existingMove == MOVE_NONE)
{
SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &move);
SetBoxMonData(boxMon, MON_DATA_PP1 + i, &gBattleMoves[move].pp);
return move;
}
if (existingMove == move)
- return -2;
+ return MON_ALREADY_KNOWS_MOVE;
}
- return 0xFFFF;
+ return MON_HAS_MAX_MOVES;
}
u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move)
@@ -2949,7 +2950,7 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon)
move = (gLevelUpLearnsets[species][i] & 0x1FF);
- if (GiveMoveToBoxMon(boxMon, move) == 0xFFFF)
+ if (GiveMoveToBoxMon(boxMon, move) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToBoxMon(boxMon, move);
}
}
@@ -4860,7 +4861,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (battlerId != 4)
{
gAbsentBattlerFlags &= ~gBitTable[battlerId];
- CopyPlayerPartyMonToBattleData(battlerId, pokemon_order_func(gBattlerPartyIndexes[battlerId]));
+ CopyPlayerPartyMonToBattleData(battlerId, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId]));
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleResults.numRevivesUsed < 255)
gBattleResults.numRevivesUsed++;
}
@@ -5657,21 +5658,23 @@ void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies)
SetMonData(mon, MON_DATA_NICKNAME, gSpeciesNames[newSpecies]);
}
-bool8 sub_806D7EC(void)
+// The below two functions determine which side of a multi battle the trainer battles on
+// 0 is the left (top in party menu), 1 is right (bottom in party menu)
+u8 GetPlayerFlankId(void)
{
- bool8 retVal = FALSE;
+ u8 flankId = 0;
switch (gLinkPlayers[GetMultiplayerId()].id)
{
case 0:
case 3:
- retVal = FALSE;
+ flankId = 0;
break;
case 1:
case 2:
- retVal = TRUE;
+ flankId = 1;
break;
}
- return retVal;
+ return flankId;
}
u16 GetLinkTrainerFlankId(u8 linkPlayerId)
@@ -6439,11 +6442,11 @@ void SetMonPreventsSwitchingString(void)
gBattleTextBuff1[4] = B_BUFF_EOS;
if (GetBattlerSide(gBattleStruct->battlerPreventingSwitchout) == B_SIDE_PLAYER)
- gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]);
+ gBattleTextBuff1[3] = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]);
else
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout];
- PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId]))
+ PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[gBattlerInMenuId]))
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
}