Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up time of day code #3585

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions src/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading