diff options
author | Diegoisawesome <diego@domoreaweso.me> | 2018-12-31 02:30:30 -0600 |
---|---|---|
committer | Diegoisawesome <diego@domoreaweso.me> | 2018-12-31 02:30:30 -0600 |
commit | d004ce065c9cc6425df6f567dff39eb831f84875 (patch) | |
tree | 2c20338324f10a553e78e731d999dd58669266c3 /src/battle_controller_player.c | |
parent | ec780bb2098be75e591b212e85947f88c91d4e37 (diff) | |
parent | 58f130d007b97623dd5c7a3b373800c138f75c5e (diff) |
Merge branch 'master' of github.com:pret/pokeemerald into trade
Diffstat (limited to 'src/battle_controller_player.c')
-rw-r--r-- | src/battle_controller_player.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index a007c7b30..12ffca381 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -403,7 +403,7 @@ static void HandleInputChooseTarget(void) do { if (--i < 0) - i = 4; // UB: array out of range + i = MAX_BATTLERS_COUNT; // UB: array out of range gMultiUsePlayerCursor = GetBattlerAtPosition(identities[i]); } while (gMultiUsePlayerCursor == gBattlersCount); @@ -704,7 +704,7 @@ static void HandleMoveSwitching(void) MoveSelectionDisplayMoveNames(); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) perMovePPBonuses[i] = (gBattleMons[gActiveBattler].ppBonuses & (3 << (i * 2))) >> (i * 2); totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBattler]]; @@ -712,12 +712,12 @@ static void HandleMoveSwitching(void) perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; totalPPBonuses = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) totalPPBonuses |= perMovePPBonuses[i] << (i * 2); gBattleMons[gActiveBattler].ppBonuses = totalPPBonuses; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { gBattleMons[gActiveBattler].moves[i] = moveInfo->moves[i]; gBattleMons[gActiveBattler].pp[i] = moveInfo->currentPp[i]; @@ -725,14 +725,14 @@ static void HandleMoveSwitching(void) if (!(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i); moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i); } totalPPBonuses = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP_BONUSES); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2); i = moveStruct.moves[gMoveSelectionCursor[gActiveBattler]]; @@ -748,10 +748,10 @@ static void HandleMoveSwitching(void) perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; totalPPBonuses = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) totalPPBonuses |= perMovePPBonuses[i] << (i * 2); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); @@ -1446,7 +1446,7 @@ static void MoveSelectionDisplayMoveNames(void) struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]); gNumberOfMovesToChoose = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { MoveSelectionDestroyCursorAt(i); StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]); @@ -1609,7 +1609,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) case REQUEST_ALL_BATTLE: battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < 4; size++) + for (size = 0; size < MAX_MON_MOVES; size++) { battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); @@ -1656,7 +1656,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < 4; size++) + for (size = 0; size < MAX_MON_MOVES; size++) { moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); @@ -1676,7 +1676,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < 4; size++) + for (size = 0; size < MAX_MON_MOVES; size++) dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); size++; @@ -1950,7 +1950,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); @@ -1989,7 +1989,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]); break; case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); |