Update field_specials.c to match the style

This commit is contained in:
sphericalice 2021-12-31 16:24:44 +00:00 committed by GitHub
parent 643cc62f73
commit 4f6323606f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,59 +193,40 @@ static void DetermineCyclingRoadResults(u32 numFrames, u8 numBikeCollisions)
result = 0; result = 0;
if (numBikeCollisions == 0) if (numBikeCollisions == 0)
{
result = 5; result = 5;
}
else if (numBikeCollisions < 4) else if (numBikeCollisions < 4)
{
result = 4; result = 4;
}
else if (numBikeCollisions < 10) else if (numBikeCollisions < 10)
{
result = 3; result = 3;
}
else if (numBikeCollisions < 20) else if (numBikeCollisions < 20)
{
result = 2; result = 2;
}
else if (numBikeCollisions < 100) else if (numBikeCollisions < 100)
{
result = 1; result = 1;
}
if (numFrames / 60 <= 10) if (numFrames / 60 <= 10)
{
result += 5; result += 5;
}
else if (numFrames / 60 <= 15) else if (numFrames / 60 <= 15)
{
result += 4; result += 4;
}
else if (numFrames / 60 <= 20) else if (numFrames / 60 <= 20)
{
result += 3; result += 3;
}
else if (numFrames / 60 <= 40) else if (numFrames / 60 <= 40)
{
result += 2; result += 2;
}
else if (numFrames / 60 < 60) else if (numFrames / 60 < 60)
{
result += 1; result += 1;
}
gSpecialVar_Result = result; gSpecialVar_Result = result;
} }
void FinishCyclingRoadChallenge(void) { void FinishCyclingRoadChallenge(void)
{
const u32 numFrames = gMain.vblankCounter1 - sBikeCyclingTimer; const u32 numFrames = gMain.vblankCounter1 - sBikeCyclingTimer;
DetermineCyclingRoadResults(numFrames, gBikeCollisions); DetermineCyclingRoadResults(numFrames, gBikeCollisions);
RecordCyclingRoadResults(numFrames, gBikeCollisions); RecordCyclingRoadResults(numFrames, gBikeCollisions);
} }
static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) { static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions)
{
u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L); u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L);
u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H); u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H);
u32 framesRecord = low + (high << 16); u32 framesRecord = low + (high << 16);
@ -258,25 +239,23 @@ static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) {
} }
} }
u16 GetRecordedCyclingRoadResults(void) { u16 GetRecordedCyclingRoadResults(void)
{
u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L); u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L);
u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H); u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H);
u32 framesRecord = low + (high << 16); u32 framesRecord = low + (high << 16);
if (framesRecord == 0) if (framesRecord == 0)
{
return FALSE; return FALSE;
}
DetermineCyclingRoadResults(framesRecord, VarGet(VAR_CYCLING_ROAD_RECORD_COLLISIONS)); DetermineCyclingRoadResults(framesRecord, VarGet(VAR_CYCLING_ROAD_RECORD_COLLISIONS));
return TRUE; return TRUE;
} }
void UpdateCyclingRoadState(void) { void UpdateCyclingRoadState(void)
{
if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE)) if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE))
{
return; return;
}
if (VarGet(VAR_CYCLING_CHALLENGE_STATE) == 2 || VarGet(VAR_CYCLING_CHALLENGE_STATE) == 3) if (VarGet(VAR_CYCLING_CHALLENGE_STATE) == 2 || VarGet(VAR_CYCLING_CHALLENGE_STATE) == 3)
{ {
@ -300,9 +279,8 @@ void ResetSSTidalFlag(void)
bool32 CountSSTidalStep(u16 delta) bool32 CountSSTidalStep(u16 delta)
{ {
if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) < SS_TIDAL_MAX_STEPS) if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) < SS_TIDAL_MAX_STEPS)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -373,9 +351,7 @@ bool32 ShouldDoWallyCall(void)
case MAP_TYPE_ROUTE: case MAP_TYPE_ROUTE:
case MAP_TYPE_OCEAN_ROUTE: case MAP_TYPE_OCEAN_ROUTE:
if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250) if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250)
{
return FALSE; return FALSE;
}
break; break;
default: default:
return FALSE; return FALSE;
@ -589,11 +565,9 @@ void SpawnLinkPartnerObjectEvent(void)
LoadLinkPartnerObjectEventSpritePalette(linkSpriteId, 240 - i, i); LoadLinkPartnerObjectEventSpritePalette(linkSpriteId, 240 - i, i);
j++; j++;
if (j == MAX_LINK_PLAYERS) if (j == MAX_LINK_PLAYERS)
{
j = 0; j = 0;
} }
} }
}
} }
static void LoadLinkPartnerObjectEventSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum) static void LoadLinkPartnerObjectEventSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum)
@ -930,25 +904,17 @@ u8 GetPlayerTrainerIdOnesDigit(void)
void GetPlayerBigGuyGirlString(void) void GetPlayerBigGuyGirlString(void)
{ {
if (gSaveBlock2Ptr->playerGender == MALE) if (gSaveBlock2Ptr->playerGender == MALE)
{
StringCopy(gStringVar1, gText_BigGuy); StringCopy(gStringVar1, gText_BigGuy);
}
else else
{
StringCopy(gStringVar1, gText_BigGirl); StringCopy(gStringVar1, gText_BigGirl);
}
} }
void GetRivalSonDaughterString(void) void GetRivalSonDaughterString(void)
{ {
if (gSaveBlock2Ptr->playerGender == MALE) if (gSaveBlock2Ptr->playerGender == MALE)
{
StringCopy(gStringVar1, gText_Daughter); StringCopy(gStringVar1, gText_Daughter);
}
else else
{
StringCopy(gStringVar1, gText_Son); StringCopy(gStringVar1, gText_Son);
}
} }
u8 GetBattleOutcome(void) u8 GetBattleOutcome(void)
@ -983,29 +949,18 @@ u8 GetLeadMonFriendshipScore(void)
{ {
struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()]; struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()];
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP)
{
return 6; return 6;
}
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200)
{
return 5; return 5;
}
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150)
{
return 4; return 4;
}
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100)
{
return 3; return 3;
}
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50)
{
return 2; return 2;
}
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1)
{
return 1; return 1;
}
return 0; return 0;
} }
@ -1036,9 +991,7 @@ static void Task_PCTurnOnEffect(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
if (task->data[0] == 0) if (task->data[0] == 0)
{
PCTurnOnEffect_0(task); PCTurnOnEffect_0(task);
}
} }
static void PCTurnOnEffect_0(struct Task *task) static void PCTurnOnEffect_0(struct Task *task)
@ -1069,10 +1022,8 @@ static void PCTurnOnEffect_0(struct Task *task)
DrawWholeMapView(); DrawWholeMapView();
task->data[4] ^= 1; task->data[4] ^= 1;
if ((++task->data[2]) == 5) if ((++task->data[2]) == 5)
{
DestroyTask(task->data[1]); DestroyTask(task->data[1]);
} }
}
task->data[3]++; task->data[3]++;
} }
@ -1082,33 +1033,21 @@ static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy)
if (isPcTurnedOn) if (isPcTurnedOn)
{ {
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
{
tileId = METATILE_Building_PC_Off; tileId = METATILE_Building_PC_Off;
}
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
{
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
}
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
{
tileId = METATILE_BrendansMaysHouse_MayPC_Off; tileId = METATILE_BrendansMaysHouse_MayPC_Off;
} }
}
else else
{ {
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
{
tileId = METATILE_Building_PC_On; tileId = METATILE_Building_PC_On;
}
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
{
tileId = METATILE_BrendansMaysHouse_BrendanPC_On; tileId = METATILE_BrendansMaysHouse_BrendanPC_On;
}
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
{
tileId = METATILE_BrendansMaysHouse_MayPC_On; tileId = METATILE_BrendansMaysHouse_MayPC_On;
} }
}
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK); MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK);
} }
@ -1139,17 +1078,11 @@ static void PCTurnOffEffect(void)
break; break;
} }
if (gSpecialVar_0x8004 == 0) if (gSpecialVar_0x8004 == 0)
{
tileId = METATILE_Building_PC_Off; tileId = METATILE_Building_PC_Off;
}
else if (gSpecialVar_0x8004 == 1) else if (gSpecialVar_0x8004 == 1)
{
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
}
else if (gSpecialVar_0x8004 == 2) else if (gSpecialVar_0x8004 == 2)
{
tileId = METATILE_BrendansMaysHouse_MayPC_Off; tileId = METATILE_BrendansMaysHouse_MayPC_Off;
}
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK); MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK);
DrawWholeMapView(); DrawWholeMapView();
} }
@ -1171,9 +1104,7 @@ static void Task_LotteryCornerComputerEffect(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
if (task->data[0] == 0) if (task->data[0] == 0)
{
LotteryCornerComputerEffect(task); LotteryCornerComputerEffect(task);
}
} }
static void LotteryCornerComputerEffect(struct Task *task) static void LotteryCornerComputerEffect(struct Task *task)
@ -1194,10 +1125,8 @@ static void LotteryCornerComputerEffect(struct Task *task)
DrawWholeMapView(); DrawWholeMapView();
task->data[4] ^= 1; task->data[4] ^= 1;
if ((++task->data[2]) == 5) if ((++task->data[2]) == 5)
{
DestroyTask(task->data[1]); DestroyTask(task->data[1]);
} }
}
task->data[3]++; task->data[3]++;
} }
@ -1227,45 +1156,40 @@ void ResetTrickHouseNuggetFlag(void)
bool8 CheckLeadMonCool(void) bool8 CheckLeadMonCool(void)
{ {
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_COOL) < 200) if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_COOL) < 200)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
bool8 CheckLeadMonBeauty(void) bool8 CheckLeadMonBeauty(void)
{ {
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_BEAUTY) < 200) if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_BEAUTY) < 200)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
bool8 CheckLeadMonCute(void) bool8 CheckLeadMonCute(void)
{ {
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_CUTE) < 200) if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_CUTE) < 200)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
bool8 CheckLeadMonSmart(void) bool8 CheckLeadMonSmart(void)
{ {
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SMART) < 200) if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SMART) < 200)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
bool8 CheckLeadMonTough(void) bool8 CheckLeadMonTough(void)
{ {
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_TOUGH) < 200) if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_TOUGH) < 200)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -1373,9 +1297,8 @@ bool8 FoundAbandonedShipRoom1Key(void)
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY; u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY;
*specVar = flag; *specVar = flag;
if (!FlagGet(flag)) if (!FlagGet(flag))
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -1385,9 +1308,8 @@ bool8 FoundAbandonedShipRoom2Key(void)
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY; u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY;
*specVar = flag; *specVar = flag;
if (!FlagGet(flag)) if (!FlagGet(flag))
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -1397,9 +1319,8 @@ bool8 FoundAbandonedShipRoom4Key(void)
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY; u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY;
*specVar = flag; *specVar = flag;
if (!FlagGet(flag)) if (!FlagGet(flag))
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -1409,9 +1330,8 @@ bool8 FoundAbandonedShipRoom6Key(void)
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_6_KEY; u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_6_KEY;
*specVar = flag; *specVar = flag;
if (!FlagGet(flag)) if (!FlagGet(flag))
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -1430,17 +1350,14 @@ void GiveLeadMonEffortRibbon(void)
leadMon = &gPlayerParty[GetLeadMonIndex()]; leadMon = &gPlayerParty[GetLeadMonIndex()];
SetMonData(leadMon, MON_DATA_EFFORT_RIBBON, &ribbonSet); SetMonData(leadMon, MON_DATA_EFFORT_RIBBON, &ribbonSet);
if (GetRibbonCount(leadMon) > NUM_CUTIES_RIBBONS) if (GetRibbonCount(leadMon) > NUM_CUTIES_RIBBONS)
{
TryPutSpotTheCutiesOnAir(leadMon, MON_DATA_EFFORT_RIBBON); TryPutSpotTheCutiesOnAir(leadMon, MON_DATA_EFFORT_RIBBON);
}
} }
bool8 Special_AreLeadMonEVsMaxedOut(void) bool8 Special_AreLeadMonEVsMaxedOut(void)
{ {
if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= MAX_TOTAL_EVS) if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= MAX_TOTAL_EVS)
{
return TRUE; return TRUE;
}
return FALSE; return FALSE;
} }
@ -1491,10 +1408,8 @@ bool8 IsStarterInParty(void)
for (i = 0; i < partyCount; i++) for (i = 0; i < partyCount; i++)
{ {
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) == starter) if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) == starter)
{
return TRUE; return TRUE;
} }
}
return FALSE; return FALSE;
} }
@ -1506,9 +1421,8 @@ bool8 ScriptCheckFreePokemonStorageSpace(void)
bool8 IsPokerusInParty(void) bool8 IsPokerusInParty(void)
{ {
if (!CheckPartyPokerus(gPlayerParty, 0x3f)) if (!CheckPartyPokerus(gPlayerParty, 0x3f))
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -1586,10 +1500,8 @@ u8 GetLeadMonIndex(void)
for (i = 0; i < partyCount; i++) for (i = 0; i < partyCount; i++)
{ {
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0) if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0)
{
return i; return i;
} }
}
return 0; return 0;
} }
@ -1608,13 +1520,10 @@ u16 GetDaysUntilPacifidlogTMAvailable(void)
{ {
u16 tmReceivedDay = VarGet(VAR_PACIFIDLOG_TM_RECEIVED_DAY); u16 tmReceivedDay = VarGet(VAR_PACIFIDLOG_TM_RECEIVED_DAY);
if (gLocalTime.days - tmReceivedDay >= 7) if (gLocalTime.days - tmReceivedDay >= 7)
{
return 0; return 0;
}
else if (gLocalTime.days < 0) else if (gLocalTime.days < 0)
{
return 8; return 8;
}
return 7 - (gLocalTime.days - tmReceivedDay); return 7 - (gLocalTime.days - tmReceivedDay);
} }
@ -1969,23 +1878,25 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
if (data[2] == FALSE) if (data[2] == FALSE)
{ {
for (y = 0; y < 3; y++) for (y = 0; y < 3; y++)
{
for (x = 0; x < 3; x++) for (x = 0; x < 3; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | METATILE_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | METATILE_COLLISION_MASK);
} }
}
// descending // descending
else else
{ {
for (y = 0; y < 3; y++) for (y = 0; y < 3; y++)
{
for (x = 0; x < 3; x++) for (x = 0; x < 3; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | METATILE_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | METATILE_COLLISION_MASK);
} }
}
DrawWholeMapView(); DrawWholeMapView();
data[1] = 0; data[1] = 0;
if (data[0] == data[3]) if (data[0] == data[3])
{
DestroyTask(taskId); DestroyTask(taskId);
} }
}
data[1]++; data[1]++;
} }
@ -2004,9 +1915,7 @@ void BufferVarsForIVRater(void)
gSpecialVar_0x8005 = 0; gSpecialVar_0x8005 = 0;
for (i = 0; i < NUM_STATS; i++) for (i = 0; i < NUM_STATS; i++)
{
gSpecialVar_0x8005 += ivStorage[i]; gSpecialVar_0x8005 += ivStorage[i];
}
gSpecialVar_0x8006 = 0; gSpecialVar_0x8006 = 0;
gSpecialVar_0x8007 = ivStorage[STAT_HP]; gSpecialVar_0x8007 = ivStorage[STAT_HP];
@ -2070,9 +1979,8 @@ bool8 UsedPokemonCenterWarp(void)
bool32 PlayerNotAtTrainerHillEntrance(void) bool32 PlayerNotAtTrainerHillEntrance(void)
{ {
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_HILL_ENTRANCE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_HILL_ENTRANCE)) if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_HILL_ENTRANCE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_HILL_ENTRANCE))
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@ -2175,79 +2083,51 @@ void ShowFrontierManiacMessage(void)
case FRONTIER_MANIAC_TOWER_LINK: case FRONTIER_MANIAC_TOWER_LINK:
if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN];
}
break; break;
case FRONTIER_MANIAC_DOME: case FRONTIER_MANIAC_DOME:
if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
}
break; break;
case FRONTIER_MANIAC_FACTORY: case FRONTIER_MANIAC_FACTORY:
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
}
break; break;
case FRONTIER_MANIAC_PALACE: case FRONTIER_MANIAC_PALACE:
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
}
break; break;
case FRONTIER_MANIAC_ARENA: case FRONTIER_MANIAC_ARENA:
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN];
}
break; break;
case FRONTIER_MANIAC_PIKE: case FRONTIER_MANIAC_PIKE:
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN];
}
break; break;
case FRONTIER_MANIAC_PYRAMID: case FRONTIER_MANIAC_PYRAMID:
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50] if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]
>= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]) >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN])
{
winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]; winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50];
}
else else
{
winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]; winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN];
}
break; break;
} }
@ -2627,14 +2507,10 @@ static void Task_ShowScrollableMultichoice(u8 taskId)
{ {
int adjustedLeft = MAX_MULTICHOICE_WIDTH + 1 - task->tWidth; int adjustedLeft = MAX_MULTICHOICE_WIDTH + 1 - task->tWidth;
if (adjustedLeft < 0) if (adjustedLeft < 0)
{
task->tLeft = 0; task->tLeft = 0;
}
else else
{
task->tLeft = adjustedLeft; task->tLeft = adjustedLeft;
} }
}
template = CreateWindowTemplate(0, task->tLeft, task->tTop, task->tWidth, task->tHeight, 0xF, 0x64); template = CreateWindowTemplate(0, task->tLeft, task->tTop, task->tWidth, task->tHeight, 0xF, 0x64);
windowId = AddWindow(&template); windowId = AddWindow(&template);
@ -2713,13 +2589,14 @@ static void ScrollableMultichoice_ProcessInput(u8 taskId)
{ {
CloseScrollableMultichoice(taskId); CloseScrollableMultichoice(taskId);
} }
// if selected option was the last one (Exit)
else if (input == task->tNumItems - 1) else if (input == task->tNumItems - 1)
{ {
// if selected option was the last one (Exit)
CloseScrollableMultichoice(taskId); CloseScrollableMultichoice(taskId);
} }
else // Handle selection while keeping the menu open else
{ {
// Handle selection while keeping the menu open
ScrollableMultichoice_RemoveScrollArrows(taskId); ScrollableMultichoice_RemoveScrollArrows(taskId);
task->func = Task_ScrollableMultichoice_WaitReturnToList; task->func = Task_ScrollableMultichoice_WaitReturnToList;
EnableBothScriptContexts(); EnableBothScriptContexts();
@ -2828,14 +2705,10 @@ void SetBattleTowerLinkPlayerGfx(void)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
if (gLinkPlayers[i].gender == MALE) if (gLinkPlayers[i].gender == MALE)
{
VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_BRENDAN_NORMAL); VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_BRENDAN_NORMAL);
}
else else
{
VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL); VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL);
} }
}
} }
void ShowNatureGirlMessage(void) void ShowNatureGirlMessage(void)
@ -2871,9 +2744,7 @@ void ShowNatureGirlMessage(void)
u8 nature; u8 nature;
if (gSpecialVar_0x8004 >= PARTY_SIZE) if (gSpecialVar_0x8004 >= PARTY_SIZE)
{
gSpecialVar_0x8004 = 0; gSpecialVar_0x8004 = 0;
}
nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]); nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]);
ShowFieldMessage(sNatureGirlMessages[nature]); ShowFieldMessage(sNatureGirlMessages[nature]);
@ -2957,15 +2828,11 @@ void FrontierGamblerSetWonOrLost(bool8 won)
if (sFrontierChallenges[challenge] == FRONTIER_CHALLENGE(frontierFacilityId, battleMode)) if (sFrontierChallenges[challenge] == FRONTIER_CHALLENGE(frontierFacilityId, battleMode))
{ {
if (won) if (won)
{
VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON); VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON);
}
else else
{
VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_LOST); VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_LOST);
} }
} }
}
} }
void UpdateBattlePointsWindow(void) void UpdateBattlePointsWindow(void)
@ -2979,7 +2846,8 @@ void UpdateBattlePointsWindow(void)
void ShowBattlePointsWindow(void) void ShowBattlePointsWindow(void)
{ {
static const struct WindowTemplate sBattlePoints_WindowTemplate = { static const struct WindowTemplate sBattlePoints_WindowTemplate =
{
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 1, .tilemapTop = 1,
@ -3024,7 +2892,8 @@ u16 GetFrontierBattlePoints(void)
void ShowFrontierExchangeCornerItemIconWindow(void) void ShowFrontierExchangeCornerItemIconWindow(void)
{ {
static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate = { static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate =
{
.bg = 0, .bg = 0,
.tilemapLeft = 2, .tilemapLeft = 2,
.tilemapTop = 9, .tilemapTop = 9,
@ -3156,13 +3025,9 @@ static const u16 sBattleFrontier_TutorMoves2[] =
void BufferBattleFrontierTutorMoveName(void) void BufferBattleFrontierTutorMoveName(void)
{ {
if (gSpecialVar_0x8005 != 0) if (gSpecialVar_0x8005 != 0)
{
StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves2[gSpecialVar_0x8004]]); StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves2[gSpecialVar_0x8004]]);
}
else else
{
StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves1[gSpecialVar_0x8004]]); StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves1[gSpecialVar_0x8004]]);
}
} }
static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection) static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection)
@ -3225,14 +3090,10 @@ static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection)
{ {
FillWindowPixelRect(sTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48); FillWindowPixelRect(sTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48);
if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2)
{
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL);
}
else else
{
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL);
} }
}
} }
void CloseBattleFrontierTutorWindow(void) void CloseBattleFrontierTutorWindow(void)
@ -3453,14 +3314,10 @@ void IncrementBirthIslandRockStepCount(void)
{ {
var++; var++;
if (var > 99) if (var > 99)
{
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0); VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0);
}
else else
{
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var); VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var);
} }
}
} }
void SetDeoxysRockPalette(void) void SetDeoxysRockPalette(void)
@ -3505,18 +3362,14 @@ bool8 IsDestinationBoxFull(void)
if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == SPECIES_NONE) if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == SPECIES_NONE)
{ {
if (GetPCBoxToSendMon() != box) if (GetPCBoxToSendMon() != box)
{
FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE); FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE);
}
VarSet(VAR_PC_BOX_TO_SEND_MON, box); VarSet(VAR_PC_BOX_TO_SEND_MON, box);
return ShouldShowBoxWasFullMessage(); return ShouldShowBoxWasFullMessage();
} }
} }
if (++box == TOTAL_BOXES_COUNT) if (++box == TOTAL_BOXES_COUNT)
{
box = 0; box = 0;
}
} while (box != StorageGetCurrentBox()); } while (box != StorageGetCurrentBox());
return FALSE; return FALSE;
} }
@ -3582,7 +3435,8 @@ bool32 GetAbnormalWeatherMapNameAndType(void)
bool8 AbnormalWeatherHasExpired(void) bool8 AbnormalWeatherHasExpired(void)
{ {
// Duplicate array. // Duplicate array.
static const u8 sAbnormalWeatherMapNumbers[] = { static const u8 sAbnormalWeatherMapNumbers[] =
{
MAP_NUM(ROUTE114), MAP_NUM(ROUTE114),
MAP_NUM(ROUTE114), MAP_NUM(ROUTE114),
MAP_NUM(ROUTE115), MAP_NUM(ROUTE115),
@ -3605,9 +3459,7 @@ bool8 AbnormalWeatherHasExpired(void)
u16 abnormalWeather = VarGet(VAR_ABNORMAL_WEATHER_LOCATION); u16 abnormalWeather = VarGet(VAR_ABNORMAL_WEATHER_LOCATION);
if (abnormalWeather == ABNORMAL_WEATHER_NONE) if (abnormalWeather == ABNORMAL_WEATHER_NONE)
{
return FALSE; return FALSE;
}
if (++steps > 999) if (++steps > 999)
{ {
@ -3691,11 +3543,9 @@ u32 GetMartEmployeeObjectEventId(void)
if (gSaveBlock1Ptr->location.mapGroup == sPokeMarts[i][0]) if (gSaveBlock1Ptr->location.mapGroup == sPokeMarts[i][0])
{ {
if (gSaveBlock1Ptr->location.mapNum == sPokeMarts[i][1]) if (gSaveBlock1Ptr->location.mapNum == sPokeMarts[i][1])
{
return sPokeMarts[i][2]; return sPokeMarts[i][2];
} }
} }
}
return 1; return 1;
} }
@ -3748,9 +3598,7 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
{ {
case 0: case 0:
if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers)) if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers))
{
gTasks[taskId].tState++; gTasks[taskId].tState++;
}
break; break;
case 1: case 1:
if (IsLinkTaskFinished() == TRUE) if (IsLinkTaskFinished() == TRUE)
@ -3781,24 +3629,16 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE
&& gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE)
{
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_BOTH_RETIRE; gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_BOTH_RETIRE;
}
else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_CONTINUE else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_CONTINUE
&& gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE)
{
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE; gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE;
}
else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE
&& gSpecialVar_0x8005 == BATTLE_TOWER_LINK_CONTINUE) && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_CONTINUE)
{
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_LEADER_RETIRE; gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_LEADER_RETIRE;
}
else else
{
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_CONTINUE; gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_CONTINUE;
} }
}
gTasks[taskId].tState++; gTasks[taskId].tState++;
} }
break; break;
@ -3912,9 +3752,7 @@ static void Task_LoopWingFlapSE(u8 taskId)
} }
if (playCount == gSpecialVar_0x8004 - 1) if (playCount == gSpecialVar_0x8004 - 1)
{
DestroyTask(taskId); DestroyTask(taskId);
}
} }
#undef playCount #undef playCount
@ -3976,9 +3814,7 @@ void GetBattlePyramidHint(void)
void ResetHealLocationFromDewford(void) void ResetHealLocationFromDewford(void)
{ {
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN)) if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN))
{
SetLastHealLocationWarp(HEAL_LOCATION_PETALBURG_CITY); SetLastHealLocationWarp(HEAL_LOCATION_PETALBURG_CITY);
}
} }
bool8 InPokemonCenter(void) bool8 InPokemonCenter(void)
@ -4015,10 +3851,8 @@ bool8 InPokemonCenter(void)
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++) for (i = 0; sPokemonCenters[i] != 0xFFFF; i++)
{ {
if (sPokemonCenters[i] == map) if (sPokemonCenters[i] == map)
{
return TRUE; return TRUE;
} }
}
return FALSE; return FALSE;
} }
@ -4192,9 +4026,7 @@ static u16 PlayerLoseRandomTrainerFan(void)
u8 idx = 0; u8 idx = 0;
if (GetNumFansOfPlayerInTrainerFanClub() == 1) if (GetNumFansOfPlayerInTrainerFanClub() == 1)
{
return 0; return 0;
}
for (i = 0; i < ARRAY_COUNT(sFanClubMemberIds); i++) for (i = 0; i < ARRAY_COUNT(sFanClubMemberIds); i++)
{ {
@ -4210,9 +4042,7 @@ static u16 PlayerLoseRandomTrainerFan(void)
} }
if (GET_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx])) if (GET_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx]))
{
FLIP_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx]); FLIP_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx]);
}
return idx; return idx;
} }