Fix trainer match call flags
This commit is contained in:
+2
-2
@@ -1615,7 +1615,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u
|
||||
// Trainer already wants a rematch. Don't bother updating it.
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)
|
||||
else if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)
|
||||
&& (Random() % 100) <= 30) // 31% chance of getting a rematch.
|
||||
{
|
||||
SetRematchIdForTrainer(table, i);
|
||||
@@ -1744,7 +1744,7 @@ static u32 GetTrainerMatchCallFlag(u32 trainerId)
|
||||
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
|
||||
{
|
||||
if (gRematchTable[i].trainerIds[0] == trainerId)
|
||||
return FLAG_MATCH_CALL_REGISTERED + i;
|
||||
return TRAINER_REGISTERED_FLAGS_START + i;
|
||||
}
|
||||
|
||||
return 0xFFFF;
|
||||
|
||||
@@ -3620,7 +3620,7 @@ bool32 IsTrainerRegistered(void)
|
||||
int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
|
||||
if (index >= 0)
|
||||
{
|
||||
if (FlagGet(FLAG_MATCH_CALL_REGISTERED + index) == TRUE)
|
||||
if (FlagGet(TRAINER_REGISTERED_FLAGS_START + index) == TRUE)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
+6
-5
@@ -131,7 +131,7 @@ static EWRAM_DATA struct MatchCallState sMatchCallState = {0};
|
||||
static EWRAM_DATA struct BattleFrontierStreakInfo sBattleFrontierStreakInfo = {0};
|
||||
|
||||
static u32 GetCurrentTotalMinutes(struct Time *);
|
||||
static u32 GetNumRegisteredNPCs(void);
|
||||
static u32 GetNumRegisteredTrainers(void);
|
||||
static u32 GetActiveMatchCallTrainerId(u32);
|
||||
static int GetTrainerMatchCallId(int);
|
||||
static u16 GetRematchTrainerLocation(int);
|
||||
@@ -1098,7 +1098,7 @@ static bool32 UpdateMatchCallStepCounter(void)
|
||||
static bool32 SelectMatchCallTrainer(void)
|
||||
{
|
||||
u32 matchCallId;
|
||||
u32 numRegistered = GetNumRegisteredNPCs();
|
||||
u32 numRegistered = GetNumRegisteredTrainers();
|
||||
if (numRegistered == 0)
|
||||
return FALSE;
|
||||
|
||||
@@ -1114,12 +1114,13 @@ static bool32 SelectMatchCallTrainer(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static u32 GetNumRegisteredNPCs(void)
|
||||
// Ignores registrable non-trainer NPCs, and special trainers like Wally and the gym leaders.
|
||||
static u32 GetNumRegisteredTrainers(void)
|
||||
{
|
||||
u32 i, count;
|
||||
for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++)
|
||||
{
|
||||
if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i))
|
||||
if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i))
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -1131,7 +1132,7 @@ static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId)
|
||||
u32 i;
|
||||
for (i = 0; i < REMATCH_SPECIAL_TRAINER_START; i++)
|
||||
{
|
||||
if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i))
|
||||
if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i))
|
||||
{
|
||||
if (!activeMatchCallId)
|
||||
return gRematchTable[i].trainerIds[0];
|
||||
|
||||
@@ -506,7 +506,7 @@ static const struct MatchCallStructTrainer sSidneyMatchCallHeader =
|
||||
{
|
||||
.type = MC_TYPE_LEADER,
|
||||
.mapSec = MAPSEC_EVER_GRANDE_CITY,
|
||||
.flag = FLAG_REMATCH_SIDNEY,
|
||||
.flag = FLAG_REGISTERED_SIDNEY,
|
||||
.rematchTableIdx = REMATCH_SIDNEY,
|
||||
.desc = gText_EliteFourMatchCallDesc,
|
||||
.name = NULL,
|
||||
@@ -522,7 +522,7 @@ static const struct MatchCallStructTrainer sPhoebeMatchCallHeader =
|
||||
{
|
||||
.type = MC_TYPE_LEADER,
|
||||
.mapSec = MAPSEC_EVER_GRANDE_CITY,
|
||||
.flag = FLAG_REMATCH_PHOEBE,
|
||||
.flag = FLAG_REGISTERED_PHOEBE,
|
||||
.rematchTableIdx = REMATCH_PHOEBE,
|
||||
.desc = gText_EliteFourMatchCallDesc,
|
||||
.name = NULL,
|
||||
@@ -538,7 +538,7 @@ static const struct MatchCallStructTrainer sGlaciaMatchCallHeader =
|
||||
{
|
||||
.type = MC_TYPE_LEADER,
|
||||
.mapSec = MAPSEC_EVER_GRANDE_CITY,
|
||||
.flag = FLAG_REMATCH_GLACIA,
|
||||
.flag = FLAG_REGISTERED_GLACIA,
|
||||
.rematchTableIdx = REMATCH_GLACIA,
|
||||
.desc = gText_EliteFourMatchCallDesc,
|
||||
.name = NULL,
|
||||
@@ -554,7 +554,7 @@ static const struct MatchCallStructTrainer sDrakeMatchCallHeader =
|
||||
{
|
||||
.type = MC_TYPE_LEADER,
|
||||
.mapSec = MAPSEC_EVER_GRANDE_CITY,
|
||||
.flag = FLAG_REMATCH_DRAKE,
|
||||
.flag = FLAG_REGISTERED_DRAKE,
|
||||
.rematchTableIdx = REMATCH_DRAKE,
|
||||
.desc = gText_EliteFourMatchCallDesc,
|
||||
.name = NULL,
|
||||
@@ -570,7 +570,7 @@ static const struct MatchCallStructTrainer sWallaceMatchCallHeader =
|
||||
{
|
||||
.type = MC_TYPE_LEADER,
|
||||
.mapSec = MAPSEC_EVER_GRANDE_CITY,
|
||||
.flag = FLAG_REMATCH_WALLACE,
|
||||
.flag = FLAG_REGISTERED_WALLACE,
|
||||
.rematchTableIdx = REMATCH_WALLACE,
|
||||
.desc = gText_ChampionMatchCallDesc,
|
||||
.name = NULL,
|
||||
@@ -1136,7 +1136,7 @@ bool32 MatchCall_HasRematchId(u32 idx)
|
||||
|
||||
void SetMatchCallRegisteredFlag(void)
|
||||
{
|
||||
int r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
|
||||
if (r0 >= 0)
|
||||
FlagSet(FLAG_MATCH_CALL_REGISTERED + r0);
|
||||
int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
|
||||
if (index >= 0)
|
||||
FlagSet(TRAINER_REGISTERED_FLAGS_START + index);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ static u32 LoopedTask_BuildMatchCallList(s32 taskState)
|
||||
bool32 IsRematchEntryRegistered(int rematchIndex)
|
||||
{
|
||||
if (rematchIndex < REMATCH_TABLE_ENTRIES)
|
||||
return FlagGet(FLAG_MATCH_CALL_REGISTERED + rematchIndex);
|
||||
return FlagGet(TRAINER_REGISTERED_FLAGS_START + rematchIndex);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user