Use MAX_MON_MOVES constants
This commit is contained in:
+4
-4
@@ -1100,7 +1100,7 @@ void ResetAllApprenticeData(void)
|
||||
gSaveBlock2Ptr->apprentices[i].lvlMode = 0;
|
||||
gSaveBlock2Ptr->apprentices[i].number = 0;
|
||||
gSaveBlock2Ptr->apprentices[i].field_1 = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < TRAINER_ID_LENGTH; j++)
|
||||
gSaveBlock2Ptr->apprentices[i].playerId[j] = 0;
|
||||
gSaveBlock2Ptr->apprentices[i].language = gGameLanguage;
|
||||
gSaveBlock2Ptr->apprentices[i].checksum = 0;
|
||||
@@ -1410,7 +1410,7 @@ static void GetLatestLearnedMoves(u16 species, u16 *moves)
|
||||
|
||||
static u16 sub_81A0284(u8 arg0, u8 speciesTableId, u8 arg2)
|
||||
{
|
||||
u16 moves[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u8 i, count;
|
||||
|
||||
if (PLAYER_APPRENTICE.field_B1_1 < 3)
|
||||
@@ -2063,7 +2063,7 @@ static void sub_81A1370(void)
|
||||
|
||||
r10 = 0xFFFF;
|
||||
r9 = -1;
|
||||
for (i = 1; i < 4; i++)
|
||||
for (i = 1; i < TRAINER_ID_LENGTH; i++)
|
||||
{
|
||||
if (GetTrainerId(gSaveBlock2Ptr->apprentices[i].playerId) == GetTrainerId(gSaveBlock2Ptr->playerTrainerId)
|
||||
&& gSaveBlock2Ptr->apprentices[i].number < r10)
|
||||
@@ -2092,7 +2092,7 @@ static void sub_81A1438(void)
|
||||
gSaveBlock2Ptr->apprentices[0].number++;
|
||||
|
||||
sub_81A0390(gSaveBlock2Ptr->apprentices[0].field_1);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
gSaveBlock2Ptr->apprentices[0].playerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
|
||||
StringCopy(gSaveBlock2Ptr->apprentices[0].playerName, gSaveBlock2Ptr->playerName);
|
||||
|
||||
@@ -397,8 +397,8 @@ u8 BattleAI_ChooseMoveOrAction(void)
|
||||
|
||||
static u8 ChooseMoveOrAction_Singles(void)
|
||||
{
|
||||
u8 currentMoveArray[4];
|
||||
u8 consideredMoveArray[4];
|
||||
u8 currentMoveArray[MAX_MON_MOVES];
|
||||
u8 consideredMoveArray[MAX_MON_MOVES];
|
||||
u8 numOfBestMoves;
|
||||
s32 i;
|
||||
|
||||
@@ -452,11 +452,11 @@ static u8 ChooseMoveOrAction_Doubles(void)
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 scriptsToRun;
|
||||
s16 bestMovePointsForTarget[4];
|
||||
s8 mostViableTargetsArray[4];
|
||||
u8 actionOrMoveIndex[4];
|
||||
u8 mostViableMovesScores[4];
|
||||
u8 mostViableMovesIndices[4];
|
||||
s16 bestMovePointsForTarget[MAX_BATTLERS_COUNT];
|
||||
s8 mostViableTargetsArray[MAX_BATTLERS_COUNT];
|
||||
u8 actionOrMoveIndex[MAX_BATTLERS_COUNT];
|
||||
u8 mostViableMovesScores[MAX_MON_MOVES];
|
||||
u8 mostViableMovesIndices[MAX_MON_MOVES];
|
||||
s32 mostViableTargetsNo;
|
||||
s32 mostViableMovesNo;
|
||||
s16 mostMovePoints;
|
||||
@@ -543,7 +543,7 @@ static u8 ChooseMoveOrAction_Doubles(void)
|
||||
mostViableTargetsArray[0] = 0;
|
||||
mostViableTargetsNo = 1;
|
||||
|
||||
for (i = 1; i < MAX_MON_MOVES; i++)
|
||||
for (i = 1; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (mostMovePoints == bestMovePointsForTarget[i])
|
||||
{
|
||||
@@ -1167,7 +1167,7 @@ static void BattleAICmd_get_considered_move_power(void)
|
||||
static void BattleAICmd_get_how_powerful_move_is(void)
|
||||
{
|
||||
s32 i, checkedMove;
|
||||
s32 moveDmgs[4];
|
||||
s32 moveDmgs[MAX_MON_MOVES];
|
||||
|
||||
for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++)
|
||||
{
|
||||
|
||||
@@ -664,7 +664,7 @@ u32 sub_8057FBC(void) // unused
|
||||
|
||||
static void HandleMoveSwitching(void)
|
||||
{
|
||||
u8 perMovePPBonuses[4];
|
||||
u8 perMovePPBonuses[MAX_MON_MOVES];
|
||||
struct ChooseMoveStruct moveStruct;
|
||||
u8 totalPPBonuses;
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ struct PikeWildMon
|
||||
{
|
||||
u16 species;
|
||||
u8 levelDelta;
|
||||
u16 moves[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
};
|
||||
|
||||
// IWRAM bss
|
||||
|
||||
@@ -77,7 +77,7 @@ struct PyramidWildMon
|
||||
u16 species;
|
||||
u8 lvl;
|
||||
u8 abilityNum;
|
||||
u16 moves[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
};
|
||||
|
||||
struct PyramidFloorTemplate
|
||||
|
||||
+4
-4
@@ -1019,7 +1019,7 @@ struct
|
||||
u8 level;
|
||||
u8 nature;
|
||||
u8 evs[6];
|
||||
u16 moves[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
} const sStevenMons[3] =
|
||||
{
|
||||
{
|
||||
@@ -1561,7 +1561,7 @@ void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
k = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < TRAINER_ID_LENGTH; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].trainerId[j] != newRecord->trainerId[j])
|
||||
break;
|
||||
@@ -3308,7 +3308,7 @@ bool32 RubyBattleTowerRecordToEmerald(struct RSBattleTowerRecord *src, struct Em
|
||||
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++)
|
||||
dst->name[i] = src->name[i];
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
dst->trainerId[i] = src->trainerId[i];
|
||||
for (i = 0; i < 6; i++)
|
||||
dst->greeting[i] = src->greeting[i];
|
||||
@@ -3357,7 +3357,7 @@ bool32 EmeraldBattleTowerRecordToRuby(struct EmeraldBattleTowerRecord *src, stru
|
||||
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++)
|
||||
dst->name[i] = src->name[i];
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
dst->trainerId[i] = src->trainerId[i];
|
||||
for (i = 0; i < 6; i++)
|
||||
dst->greeting[i] = src->greeting[i];
|
||||
|
||||
+3
-3
@@ -34,10 +34,10 @@ static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y);
|
||||
|
||||
// RAM buffers used to assist with BuildEggMoveset()
|
||||
EWRAM_DATA static u16 sHatchedEggLevelUpMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggFatherMoves[4] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggFinalMoves[4] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggFatherMoves[MAX_MON_MOVES] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggFinalMoves[MAX_MON_MOVES] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggEggMoves[EGG_MOVES_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggMotherMoves[4] = {0};
|
||||
EWRAM_DATA static u16 sHatchedEggMotherMoves[MAX_MON_MOVES] = {0};
|
||||
|
||||
#include "data/pokemon/egg_moves.h"
|
||||
|
||||
|
||||
+3
-3
@@ -298,13 +298,13 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
||||
u16 species;
|
||||
u32 personality, pokerus;
|
||||
u8 i, friendship, language, gameMet, markings, obedience;
|
||||
u16 moves[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u32 ivs[NUM_STATS];
|
||||
|
||||
|
||||
species = GetMonData(egg, MON_DATA_SPECIES);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
moves[i] = GetMonData(egg, MON_DATA_MOVE1 + i);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
||||
|
||||
CreateMon(temp, species, EGG_HATCH_LEVEL, 32, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ static EWRAM_DATA struct
|
||||
{
|
||||
u8 state;
|
||||
u8 heartSpriteIds[16]; /*0x001*/
|
||||
u16 movesToLearn[4]; /*0x012*/
|
||||
u16 movesToLearn[MAX_MON_MOVES]; /*0x012*/
|
||||
u8 filler1A[0x44 - 0x1A]; /*0x01A*/
|
||||
u8 partyMon; /*0x044*/
|
||||
u8 moveSlot; /*0x045*/
|
||||
|
||||
+11
-11
@@ -2989,11 +2989,11 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
|
||||
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move)
|
||||
{
|
||||
s32 i;
|
||||
u16 moves[4];
|
||||
u8 pp[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u8 pp[MAX_MON_MOVES];
|
||||
u8 ppBonuses;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES - 1; i++)
|
||||
{
|
||||
moves[i] = GetMonData(mon, MON_DATA_MOVE2 + i, NULL);
|
||||
pp[i] = GetMonData(mon, MON_DATA_PP2 + i, NULL);
|
||||
@@ -3016,11 +3016,11 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move)
|
||||
void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
|
||||
{
|
||||
s32 i;
|
||||
u16 moves[4];
|
||||
u8 pp[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u8 pp[MAX_MON_MOVES];
|
||||
u8 ppBonuses;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES - 1; i++)
|
||||
{
|
||||
moves[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL);
|
||||
pp[i] = GetBoxMonData(boxMon, MON_DATA_PP2 + i, NULL);
|
||||
@@ -3304,21 +3304,21 @@ u8 CountAliveMonsInBattle(u8 caseId)
|
||||
switch (caseId)
|
||||
{
|
||||
case BATTLE_ALIVE_EXCEPT_ACTIVE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (i != gActiveBattler && !(gAbsentBattlerFlags & gBitTable[i]))
|
||||
retVal++;
|
||||
}
|
||||
break;
|
||||
case BATTLE_ALIVE_ATK_SIDE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerSide(i) == GetBattlerSide(gBattlerAttacker) && !(gAbsentBattlerFlags & gBitTable[i]))
|
||||
retVal++;
|
||||
}
|
||||
break;
|
||||
case BATTLE_ALIVE_DEF_SIDE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerSide(i) == GetBattlerSide(gBattlerTarget) && !(gAbsentBattlerFlags & gBitTable[i]))
|
||||
retVal++;
|
||||
@@ -6096,7 +6096,7 @@ u32 CanSpeciesLearnTMHM(u16 species, u8 tm)
|
||||
|
||||
u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
|
||||
{
|
||||
u16 learnedMoves[4];
|
||||
u16 learnedMoves[MAX_MON_MOVES];
|
||||
u8 numMoves = 0;
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, 0);
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
|
||||
@@ -6146,7 +6146,7 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves)
|
||||
|
||||
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
|
||||
{
|
||||
u16 learnedMoves[4];
|
||||
u16 learnedMoves[MAX_MON_MOVES];
|
||||
u16 moves[20];
|
||||
u8 numMoves = 0;
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
|
||||
|
||||
@@ -121,8 +121,8 @@ static EWRAM_DATA struct PokemonSummaryScreenData
|
||||
u8 metGame; // 0xB
|
||||
u32 pid; // 0xC
|
||||
u32 exp; // 0x10
|
||||
u16 moves[4]; // 0x14
|
||||
u8 pp[4]; // 0x1C
|
||||
u16 moves[MAX_MON_MOVES]; // 0x14
|
||||
u8 pp[MAX_MON_MOVES]; // 0x1C
|
||||
u16 currentHP; // 0x20
|
||||
u16 maxHP; // 0x22
|
||||
u16 atk; // 0x24
|
||||
|
||||
@@ -37,8 +37,8 @@ struct PlayerInfo
|
||||
|
||||
struct MovePp
|
||||
{
|
||||
u16 moves[4];
|
||||
u8 pp[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u8 pp[MAX_MON_MOVES];
|
||||
};
|
||||
|
||||
struct RecordedBattleSave
|
||||
@@ -91,7 +91,7 @@ EWRAM_DATA static u32 sBattleFlags = 0;
|
||||
EWRAM_DATA static u32 sAI_Scripts = 0;
|
||||
EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA static u16 sPlayerMonMoves[2][4] = {0};
|
||||
EWRAM_DATA static u16 sPlayerMonMoves[2][MAX_MON_MOVES] = {0};
|
||||
EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA static u8 sUnknown_0203CCD0 = 0;
|
||||
EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0};
|
||||
@@ -766,11 +766,11 @@ void sub_818603C(u8 arg0)
|
||||
{
|
||||
if (sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == ACTION_MOVE_CHANGE)
|
||||
{
|
||||
u8 ppBonuses[4];
|
||||
u8 array1[4];
|
||||
u8 array2[4];
|
||||
u8 ppBonuses[MAX_MON_MOVES];
|
||||
u8 array1[MAX_MON_MOVES];
|
||||
u8 array2[MAX_MON_MOVES];
|
||||
struct MovePp movePp;
|
||||
u8 array3[8];
|
||||
u8 array3[(MAX_MON_MOVES * 2)];
|
||||
u8 var;
|
||||
|
||||
RecordedBattle_GetBattlerAction(battlerId);
|
||||
|
||||
+3
-3
@@ -349,7 +349,7 @@ void SetPlayerSecretBase(void)
|
||||
u16 i;
|
||||
|
||||
gSaveBlock1Ptr->secretBases[0].secretBaseId = sCurSecretBaseId;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
gSaveBlock1Ptr->secretBases[0].trainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
|
||||
VarSet(VAR_CURRENT_SECRET_BASE, 0);
|
||||
@@ -1291,7 +1291,7 @@ static void SetSecretBaseDataAndLanguage(u8 secretBaseId, struct SecretBase *sec
|
||||
static bool8 SecretBasesHaveSameTrainerId(struct SecretBase *secretBase1, struct SecretBase *secretBase2)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
{
|
||||
if (secretBase1->trainerId[i] != secretBase2->trainerId[i])
|
||||
return FALSE;
|
||||
@@ -1445,7 +1445,7 @@ bool8 SecretBaseBelongsToPlayer(struct SecretBase *secretBase)
|
||||
return FALSE;
|
||||
|
||||
// Check if the player's trainer Id matches the secret base's id.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
{
|
||||
if (secretBase->trainerId[i] != gSaveBlock2Ptr->playerTrainerId[i])
|
||||
return FALSE;
|
||||
|
||||
+5
-5
@@ -3032,7 +3032,7 @@ static u8 sub_8079A3C(u8 *str, u8 whichParty, u8 monIdx)
|
||||
|
||||
static void sub_8079AA4(u8 *a0, u8 a1, u8 a2)
|
||||
{
|
||||
u16 arr[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u16 i;
|
||||
|
||||
if (!gUnknown_0203229C->unk_51[a1][a2])
|
||||
@@ -3041,11 +3041,11 @@ static void sub_8079AA4(u8 *a0, u8 a1, u8 a2)
|
||||
{
|
||||
if (!a1)
|
||||
{
|
||||
arr[i] = GetMonData(&gPlayerParty[a2], i + MON_DATA_MOVE1, NULL);
|
||||
moves[i] = GetMonData(&gPlayerParty[a2], i + MON_DATA_MOVE1, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
arr[i] = GetMonData(&gEnemyParty[a2], i + MON_DATA_MOVE1, NULL);
|
||||
moves[i] = GetMonData(&gEnemyParty[a2], i + MON_DATA_MOVE1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3053,9 +3053,9 @@ static void sub_8079AA4(u8 *a0, u8 a1, u8 a2)
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (arr[i] != MOVE_NONE)
|
||||
if (moves[i] != MOVE_NONE)
|
||||
{
|
||||
StringAppend(a0, gMoveNames[arr[i]]);
|
||||
StringAppend(a0, gMoveNames[moves[i]]);
|
||||
}
|
||||
|
||||
StringAppend(a0, gText_NewLine3);
|
||||
|
||||
@@ -182,7 +182,7 @@ static void DoTVShowPokemonContestLiveUpdates2(void);
|
||||
|
||||
static const struct {
|
||||
u16 species;
|
||||
u16 moves[4];
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
u8 level;
|
||||
u8 location;
|
||||
} sPokeOutbreakSpeciesList[] = {
|
||||
@@ -2329,7 +2329,7 @@ void sub_80EE35C(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u1
|
||||
show->battleSeminar.foeSpecies = foeSpecies;
|
||||
show->battleSeminar.species = species;
|
||||
show->battleSeminar.move = movePtr[moveIdx];
|
||||
for (i = 0, j = 0; i < 4; i ++)
|
||||
for (i = 0, j = 0; i < MAX_MON_MOVES; i ++)
|
||||
{
|
||||
if (i != moveIdx && movePtr[i])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user