mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 13:53:52 +01:00
Merge pull request #1585 from sphericalice/patch-2
Update field_specials.c to match the style
This commit is contained in:
commit
434086be69
@ -193,59 +193,40 @@ static void DetermineCyclingRoadResults(u32 numFrames, u8 numBikeCollisions)
|
||||
|
||||
result = 0;
|
||||
if (numBikeCollisions == 0)
|
||||
{
|
||||
result = 5;
|
||||
}
|
||||
else if (numBikeCollisions < 4)
|
||||
{
|
||||
result = 4;
|
||||
}
|
||||
else if (numBikeCollisions < 10)
|
||||
{
|
||||
result = 3;
|
||||
}
|
||||
else if (numBikeCollisions < 20)
|
||||
{
|
||||
result = 2;
|
||||
}
|
||||
else if (numBikeCollisions < 100)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
|
||||
if (numFrames / 60 <= 10)
|
||||
{
|
||||
result += 5;
|
||||
}
|
||||
else if (numFrames / 60 <= 15)
|
||||
{
|
||||
result += 4;
|
||||
}
|
||||
else if (numFrames / 60 <= 20)
|
||||
{
|
||||
result += 3;
|
||||
}
|
||||
else if (numFrames / 60 <= 40)
|
||||
{
|
||||
result += 2;
|
||||
}
|
||||
else if (numFrames / 60 < 60)
|
||||
{
|
||||
result += 1;
|
||||
}
|
||||
|
||||
|
||||
gSpecialVar_Result = result;
|
||||
}
|
||||
|
||||
void FinishCyclingRoadChallenge(void) {
|
||||
void FinishCyclingRoadChallenge(void)
|
||||
{
|
||||
const u32 numFrames = gMain.vblankCounter1 - sBikeCyclingTimer;
|
||||
|
||||
DetermineCyclingRoadResults(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 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H);
|
||||
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 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H);
|
||||
u32 framesRecord = low + (high << 16);
|
||||
|
||||
if (framesRecord == 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DetermineCyclingRoadResults(framesRecord, VarGet(VAR_CYCLING_ROAD_RECORD_COLLISIONS));
|
||||
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))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (VarGet(VAR_CYCLING_CHALLENGE_STATE) == 2 || VarGet(VAR_CYCLING_CHALLENGE_STATE) == 3)
|
||||
{
|
||||
@ -300,9 +279,8 @@ void ResetSSTidalFlag(void)
|
||||
bool32 CountSSTidalStep(u16 delta)
|
||||
{
|
||||
if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) < SS_TIDAL_MAX_STEPS)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -346,7 +324,8 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y)
|
||||
*mapNum = MAP_NUM(ROUTE132);
|
||||
*x = 65 - *varCruiseStepCount;
|
||||
}
|
||||
else if (*varCruiseStepCount < 146) {
|
||||
else if (*varCruiseStepCount < 146)
|
||||
{
|
||||
*mapNum = MAP_NUM(ROUTE133);
|
||||
*x = 145 - *varCruiseStepCount;
|
||||
}
|
||||
@ -373,9 +352,7 @@ bool32 ShouldDoWallyCall(void)
|
||||
case MAP_TYPE_ROUTE:
|
||||
case MAP_TYPE_OCEAN_ROUTE:
|
||||
if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
@ -589,11 +566,9 @@ void SpawnLinkPartnerObjectEvent(void)
|
||||
LoadLinkPartnerObjectEventSpritePalette(linkSpriteId, 240 - i, i);
|
||||
j++;
|
||||
if (j == MAX_LINK_PLAYERS)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadLinkPartnerObjectEventSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum)
|
||||
@ -930,25 +905,17 @@ u8 GetPlayerTrainerIdOnesDigit(void)
|
||||
void GetPlayerBigGuyGirlString(void)
|
||||
{
|
||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||
{
|
||||
StringCopy(gStringVar1, gText_BigGuy);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gStringVar1, gText_BigGirl);
|
||||
}
|
||||
}
|
||||
|
||||
void GetRivalSonDaughterString(void)
|
||||
{
|
||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||
{
|
||||
StringCopy(gStringVar1, gText_Daughter);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gStringVar1, gText_Son);
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetBattleOutcome(void)
|
||||
@ -983,29 +950,18 @@ u8 GetLeadMonFriendshipScore(void)
|
||||
{
|
||||
struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()];
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1036,9 +992,7 @@ static void Task_PCTurnOnEffect(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
if (task->data[0] == 0)
|
||||
{
|
||||
PCTurnOnEffect_0(task);
|
||||
}
|
||||
}
|
||||
|
||||
static void PCTurnOnEffect_0(struct Task *task)
|
||||
@ -1069,10 +1023,8 @@ static void PCTurnOnEffect_0(struct Task *task)
|
||||
DrawWholeMapView();
|
||||
task->data[4] ^= 1;
|
||||
if ((++task->data[2]) == 5)
|
||||
{
|
||||
DestroyTask(task->data[1]);
|
||||
}
|
||||
}
|
||||
task->data[3]++;
|
||||
}
|
||||
|
||||
@ -1082,33 +1034,21 @@ static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy)
|
||||
if (isPcTurnedOn)
|
||||
{
|
||||
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
||||
{
|
||||
tileId = METATILE_Building_PC_Off;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
||||
{
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||
{
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
||||
{
|
||||
tileId = METATILE_Building_PC_On;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
||||
{
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_On;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||
{
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_On;
|
||||
}
|
||||
}
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK);
|
||||
}
|
||||
|
||||
@ -1139,17 +1079,11 @@ static void PCTurnOffEffect(void)
|
||||
break;
|
||||
}
|
||||
if (gSpecialVar_0x8004 == 0)
|
||||
{
|
||||
tileId = METATILE_Building_PC_Off;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == 1)
|
||||
{
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == 2)
|
||||
{
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
}
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
}
|
||||
@ -1171,9 +1105,7 @@ static void Task_LotteryCornerComputerEffect(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
if (task->data[0] == 0)
|
||||
{
|
||||
LotteryCornerComputerEffect(task);
|
||||
}
|
||||
}
|
||||
|
||||
static void LotteryCornerComputerEffect(struct Task *task)
|
||||
@ -1194,10 +1126,8 @@ static void LotteryCornerComputerEffect(struct Task *task)
|
||||
DrawWholeMapView();
|
||||
task->data[4] ^= 1;
|
||||
if ((++task->data[2]) == 5)
|
||||
{
|
||||
DestroyTask(task->data[1]);
|
||||
}
|
||||
}
|
||||
task->data[3]++;
|
||||
}
|
||||
|
||||
@ -1227,45 +1157,40 @@ void ResetTrickHouseNuggetFlag(void)
|
||||
bool8 CheckLeadMonCool(void)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_COOL) < 200)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 CheckLeadMonBeauty(void)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_BEAUTY) < 200)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 CheckLeadMonCute(void)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_CUTE) < 200)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 CheckLeadMonSmart(void)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SMART) < 200)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 CheckLeadMonTough(void)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_TOUGH) < 200)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1373,9 +1298,8 @@ bool8 FoundAbandonedShipRoom1Key(void)
|
||||
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY;
|
||||
*specVar = flag;
|
||||
if (!FlagGet(flag))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1385,9 +1309,8 @@ bool8 FoundAbandonedShipRoom2Key(void)
|
||||
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY;
|
||||
*specVar = flag;
|
||||
if (!FlagGet(flag))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1397,9 +1320,8 @@ bool8 FoundAbandonedShipRoom4Key(void)
|
||||
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY;
|
||||
*specVar = flag;
|
||||
if (!FlagGet(flag))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1409,9 +1331,8 @@ bool8 FoundAbandonedShipRoom6Key(void)
|
||||
u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_6_KEY;
|
||||
*specVar = flag;
|
||||
if (!FlagGet(flag))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1430,17 +1351,14 @@ void GiveLeadMonEffortRibbon(void)
|
||||
leadMon = &gPlayerParty[GetLeadMonIndex()];
|
||||
SetMonData(leadMon, MON_DATA_EFFORT_RIBBON, &ribbonSet);
|
||||
if (GetRibbonCount(leadMon) > NUM_CUTIES_RIBBONS)
|
||||
{
|
||||
TryPutSpotTheCutiesOnAir(leadMon, MON_DATA_EFFORT_RIBBON);
|
||||
}
|
||||
}
|
||||
|
||||
bool8 Special_AreLeadMonEVsMaxedOut(void)
|
||||
{
|
||||
if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= MAX_TOTAL_EVS)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1491,10 +1409,8 @@ bool8 IsStarterInParty(void)
|
||||
for (i = 0; i < partyCount; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) == starter)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1506,9 +1422,8 @@ bool8 ScriptCheckFreePokemonStorageSpace(void)
|
||||
bool8 IsPokerusInParty(void)
|
||||
{
|
||||
if (!CheckPartyPokerus(gPlayerParty, 0x3f))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1586,10 +1501,8 @@ u8 GetLeadMonIndex(void)
|
||||
for (i = 0; i < partyCount; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1608,13 +1521,10 @@ u16 GetDaysUntilPacifidlogTMAvailable(void)
|
||||
{
|
||||
u16 tmReceivedDay = VarGet(VAR_PACIFIDLOG_TM_RECEIVED_DAY);
|
||||
if (gLocalTime.days - tmReceivedDay >= 7)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (gLocalTime.days < 0)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
return 7 - (gLocalTime.days - tmReceivedDay);
|
||||
}
|
||||
|
||||
@ -1969,23 +1879,25 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
|
||||
if (data[2] == FALSE)
|
||||
{
|
||||
for (y = 0; y < 3; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | METATILE_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
// descending
|
||||
else
|
||||
{
|
||||
for (y = 0; y < 3; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | METATILE_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
DrawWholeMapView();
|
||||
data[1] = 0;
|
||||
if (data[0] == data[3])
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
data[1]++;
|
||||
}
|
||||
|
||||
@ -2004,9 +1916,7 @@ void BufferVarsForIVRater(void)
|
||||
gSpecialVar_0x8005 = 0;
|
||||
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
gSpecialVar_0x8005 += ivStorage[i];
|
||||
}
|
||||
|
||||
gSpecialVar_0x8006 = 0;
|
||||
gSpecialVar_0x8007 = ivStorage[STAT_HP];
|
||||
@ -2070,9 +1980,8 @@ bool8 UsedPokemonCenterWarp(void)
|
||||
bool32 PlayerNotAtTrainerHillEntrance(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_HILL_ENTRANCE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_HILL_ENTRANCE))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2175,79 +2084,51 @@ void ShowFrontierManiacMessage(void)
|
||||
case FRONTIER_MANIAC_TOWER_LINK:
|
||||
if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
case FRONTIER_MANIAC_DOME:
|
||||
if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
case FRONTIER_MANIAC_FACTORY:
|
||||
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
case FRONTIER_MANIAC_PALACE:
|
||||
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
case FRONTIER_MANIAC_ARENA:
|
||||
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
case FRONTIER_MANIAC_PIKE:
|
||||
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
case FRONTIER_MANIAC_PYRAMID:
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]
|
||||
>= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN])
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50];
|
||||
}
|
||||
else
|
||||
{
|
||||
winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2627,14 +2508,10 @@ static void Task_ShowScrollableMultichoice(u8 taskId)
|
||||
{
|
||||
int adjustedLeft = MAX_MULTICHOICE_WIDTH + 1 - task->tWidth;
|
||||
if (adjustedLeft < 0)
|
||||
{
|
||||
task->tLeft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
task->tLeft = adjustedLeft;
|
||||
}
|
||||
}
|
||||
|
||||
template = CreateWindowTemplate(0, task->tLeft, task->tTop, task->tWidth, task->tHeight, 0xF, 0x64);
|
||||
windowId = AddWindow(&template);
|
||||
@ -2713,13 +2590,14 @@ static void ScrollableMultichoice_ProcessInput(u8 taskId)
|
||||
{
|
||||
CloseScrollableMultichoice(taskId);
|
||||
}
|
||||
// if selected option was the last one (Exit)
|
||||
else if (input == task->tNumItems - 1)
|
||||
{
|
||||
// Selected option was the last one (Exit)
|
||||
CloseScrollableMultichoice(taskId);
|
||||
}
|
||||
else // Handle selection while keeping the menu open
|
||||
else
|
||||
{
|
||||
// Handle selection while keeping the menu open
|
||||
ScrollableMultichoice_RemoveScrollArrows(taskId);
|
||||
task->func = Task_ScrollableMultichoice_WaitReturnToList;
|
||||
EnableBothScriptContexts();
|
||||
@ -2828,14 +2706,10 @@ void SetBattleTowerLinkPlayerGfx(void)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (gLinkPlayers[i].gender == MALE)
|
||||
{
|
||||
VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_BRENDAN_NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShowNatureGirlMessage(void)
|
||||
@ -2871,9 +2745,7 @@ void ShowNatureGirlMessage(void)
|
||||
u8 nature;
|
||||
|
||||
if (gSpecialVar_0x8004 >= PARTY_SIZE)
|
||||
{
|
||||
gSpecialVar_0x8004 = 0;
|
||||
}
|
||||
|
||||
nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]);
|
||||
ShowFieldMessage(sNatureGirlMessages[nature]);
|
||||
@ -2957,15 +2829,11 @@ void FrontierGamblerSetWonOrLost(bool8 won)
|
||||
if (sFrontierChallenges[challenge] == FRONTIER_CHALLENGE(frontierFacilityId, battleMode))
|
||||
{
|
||||
if (won)
|
||||
{
|
||||
VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON);
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_LOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateBattlePointsWindow(void)
|
||||
@ -2979,7 +2847,8 @@ void UpdateBattlePointsWindow(void)
|
||||
|
||||
void ShowBattlePointsWindow(void)
|
||||
{
|
||||
static const struct WindowTemplate sBattlePoints_WindowTemplate = {
|
||||
static const struct WindowTemplate sBattlePoints_WindowTemplate =
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 1,
|
||||
@ -3024,7 +2893,8 @@ u16 GetFrontierBattlePoints(void)
|
||||
|
||||
void ShowFrontierExchangeCornerItemIconWindow(void)
|
||||
{
|
||||
static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate = {
|
||||
static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate =
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 2,
|
||||
.tilemapTop = 9,
|
||||
@ -3156,13 +3026,9 @@ static const u16 sBattleFrontier_TutorMoves2[] =
|
||||
void BufferBattleFrontierTutorMoveName(void)
|
||||
{
|
||||
if (gSpecialVar_0x8005 != 0)
|
||||
{
|
||||
StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves2[gSpecialVar_0x8004]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves1[gSpecialVar_0x8004]]);
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection)
|
||||
@ -3225,14 +3091,10 @@ static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection)
|
||||
{
|
||||
FillWindowPixelRect(sTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48);
|
||||
if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2)
|
||||
{
|
||||
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CloseBattleFrontierTutorWindow(void)
|
||||
@ -3453,14 +3315,10 @@ void IncrementBirthIslandRockStepCount(void)
|
||||
{
|
||||
var++;
|
||||
if (var > 99)
|
||||
{
|
||||
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetDeoxysRockPalette(void)
|
||||
@ -3505,18 +3363,14 @@ bool8 IsDestinationBoxFull(void)
|
||||
if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == SPECIES_NONE)
|
||||
{
|
||||
if (GetPCBoxToSendMon() != box)
|
||||
{
|
||||
FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE);
|
||||
}
|
||||
VarSet(VAR_PC_BOX_TO_SEND_MON, box);
|
||||
return ShouldShowBoxWasFullMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (++box == TOTAL_BOXES_COUNT)
|
||||
{
|
||||
box = 0;
|
||||
}
|
||||
} while (box != StorageGetCurrentBox());
|
||||
return FALSE;
|
||||
}
|
||||
@ -3582,7 +3436,8 @@ bool32 GetAbnormalWeatherMapNameAndType(void)
|
||||
bool8 AbnormalWeatherHasExpired(void)
|
||||
{
|
||||
// Duplicate array.
|
||||
static const u8 sAbnormalWeatherMapNumbers[] = {
|
||||
static const u8 sAbnormalWeatherMapNumbers[] =
|
||||
{
|
||||
MAP_NUM(ROUTE114),
|
||||
MAP_NUM(ROUTE114),
|
||||
MAP_NUM(ROUTE115),
|
||||
@ -3605,9 +3460,7 @@ bool8 AbnormalWeatherHasExpired(void)
|
||||
u16 abnormalWeather = VarGet(VAR_ABNORMAL_WEATHER_LOCATION);
|
||||
|
||||
if (abnormalWeather == ABNORMAL_WEATHER_NONE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (++steps > 999)
|
||||
{
|
||||
@ -3691,11 +3544,9 @@ u32 GetMartEmployeeObjectEventId(void)
|
||||
if (gSaveBlock1Ptr->location.mapGroup == sPokeMarts[i][0])
|
||||
{
|
||||
if (gSaveBlock1Ptr->location.mapNum == sPokeMarts[i][1])
|
||||
{
|
||||
return sPokeMarts[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -3748,9 +3599,7 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers))
|
||||
{
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (IsLinkTaskFinished() == TRUE)
|
||||
@ -3781,24 +3630,16 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
|
||||
|
||||
if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE
|
||||
&& gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE)
|
||||
{
|
||||
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_BOTH_RETIRE;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_CONTINUE
|
||||
&& gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE)
|
||||
{
|
||||
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE;
|
||||
}
|
||||
else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE
|
||||
&& gSpecialVar_0x8005 == BATTLE_TOWER_LINK_CONTINUE)
|
||||
{
|
||||
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_LEADER_RETIRE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_CONTINUE;
|
||||
}
|
||||
}
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -3912,9 +3753,7 @@ static void Task_LoopWingFlapSE(u8 taskId)
|
||||
}
|
||||
|
||||
if (playCount == gSpecialVar_0x8004 - 1)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
#undef playCount
|
||||
@ -3976,9 +3815,7 @@ void GetBattlePyramidHint(void)
|
||||
void ResetHealLocationFromDewford(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN))
|
||||
{
|
||||
SetLastHealLocationWarp(HEAL_LOCATION_PETALBURG_CITY);
|
||||
}
|
||||
}
|
||||
|
||||
bool8 InPokemonCenter(void)
|
||||
@ -4015,10 +3852,8 @@ bool8 InPokemonCenter(void)
|
||||
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++)
|
||||
{
|
||||
if (sPokemonCenters[i] == map)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -4192,9 +4027,7 @@ static u16 PlayerLoseRandomTrainerFan(void)
|
||||
u8 idx = 0;
|
||||
|
||||
if (GetNumFansOfPlayerInTrainerFanClub() == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sFanClubMemberIds); i++)
|
||||
{
|
||||
@ -4210,9 +4043,7 @@ static u16 PlayerLoseRandomTrainerFan(void)
|
||||
}
|
||||
|
||||
if (GET_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx]))
|
||||
{
|
||||
FLIP_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx]);
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user