Skip to content

Commit

Permalink
Merge pull request pret#1247 from PidgeyALT/attemptcountfix
Browse files Browse the repository at this point in the history
use constants for ball throw count
  • Loading branch information
GriffinRichards authored Nov 6, 2020
2 parents 75b12b8 + e31158d commit 8b1c2c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "battle_gfx_sfx_util.h"
#include "battle_util2.h"
#include "battle_bg.h"
#include "pokeball.h"

#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
Expand Down Expand Up @@ -255,7 +256,7 @@ struct BattleResults
u16 caughtMonSpecies; // 0x28
u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A
u8 filler35; // 0x35
u8 catchAttempts[11]; // 0x36
u8 catchAttempts[POKEBALL_COUNT - 1]; // 0x36 Doesn't include Master ball
};

struct BattleTv_Side
Expand Down
11 changes: 6 additions & 5 deletions src/tv.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "decoration.h"
#include "secret_base.h"
#include "tv.h"
#include "pokeball.h"
#include "data.h"
#include "constants/battle_frontier.h"
#include "constants/contest.h"
Expand Down Expand Up @@ -963,7 +964,7 @@ void GabbyAndTyBeforeInterview(void)
}
if (!gBattleResults.usedMasterBall)
{
for (i = 0; i < 11; i ++)
for (i = 0; i < POKEBALL_COUNT - 1; i ++)
{
if (gBattleResults.catchAttempts[i])
{
Expand Down Expand Up @@ -1135,7 +1136,7 @@ void PutPokemonTodayCaughtOnAir(void)
sCurTVShowSlot = FindEmptyTVSlotBeyondFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows);
if (sCurTVShowSlot != -1 && HasMixableShowAlreadyBeenSpawnedWithPlayerID(TVSHOW_POKEMON_TODAY_CAUGHT, FALSE) != TRUE)
{
for (i = 0; i < 11; i ++)
for (i = 0; i < POKEBALL_COUNT - 1; i ++)
{
ct += gBattleResults.catchAttempts[i];
}
Expand All @@ -1152,7 +1153,7 @@ void PutPokemonTodayCaughtOnAir(void)
}
else
{
for (i = 0; i < 11; i ++)
for (i = 0; i < POKEBALL_COUNT - 1; i ++)
{
ct += gBattleResults.catchAttempts[i];
}
Expand Down Expand Up @@ -1203,7 +1204,7 @@ void PutPokemonTodayFailedOnTheAir(void)

if (!rbernoulli(1, 1))
{
for (i = 0, ct = 0; i < 11; i ++)
for (i = 0, ct = 0; i < POKEBALL_COUNT - 1; i ++)
{
ct += gBattleResults.catchAttempts[i];
}
Expand Down Expand Up @@ -2228,7 +2229,7 @@ void sub_80EE184(void)
show->breakingNews.kind = TVSHOW_BREAKING_NEWS;
show->breakingNews.active = FALSE;
balls = 0;
for (i = 0; i < 11; i ++)
for (i = 0; i < POKEBALL_COUNT - 1; i ++)
{
balls += gBattleResults.catchAttempts[i];
}
Expand Down

0 comments on commit 8b1c2c9

Please sign in to comment.