Clean up time of day code (#3585)

This commit is contained in:
ghoulslash 2023-11-20 14:39:50 -05:00 committed by GitHub
commit 34c608724d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 8 deletions

View file

@ -14878,8 +14878,7 @@ static void Cmd_handleballthrow(void)
ballMultiplier = 400;
break;
case ITEM_DUSK_BALL:
RtcCalcLocalTime();
if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND)
if ((GetTimeOfDay() == TIME_DUSK || GetTimeOfDay() == TIME_NIGHT) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND)
ballMultiplier = (B_DUSK_BALL_MODIFIER >= GEN_7 ? 300 : 350);
break;
case ITEM_QUICK_BALL:

View file

@ -9072,13 +9072,11 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32
switch (formChanges[i].param1)
{
case DAY:
RtcCalcLocalTime();
if (gLocalTime.hours >= DAY_EVO_HOUR_BEGIN && gLocalTime.hours < DAY_EVO_HOUR_END)
if (GetTimeOfDay() != TIME_NIGHT)
targetSpecies = formChanges[i].targetSpecies;
break;
case NIGHT:
RtcCalcLocalTime();
if (gLocalTime.hours >= NIGHT_EVO_HOUR_BEGIN && gLocalTime.hours < NIGHT_EVO_HOUR_END)
if (GetTimeOfDay() == TIME_NIGHT)
targetSpecies = formChanges[i].targetSpecies;
break;
}

View file

@ -310,8 +310,7 @@ u8 GetTimeOfDay(void)
return TIME_DUSK;
else if (IsBetweenHours(gLocalTime.hours, NIGHT_EVO_HOUR_BEGIN, NIGHT_EVO_HOUR_END))
return TIME_NIGHT;
else
return TIME_DAY;
return TIME_DAY;
}
void RtcInitLocalTimeOffset(s32 hour, s32 minute)