diff --git a/include/config/overworld.h b/include/config/overworld.h index cac35413ded0..34880644211d 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -6,6 +6,7 @@ // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. +#define OW_TIMES_OF_DAY GEN_LATEST // Different generations have the times of day change at different times // PC settings #define OW_PC_PRESS_B GEN_LATEST // In Gen4, pressing B when holding a Pokémon is equivalent to placing it. In Gen3, it gives the "You're holding a Pokémon!" error. diff --git a/include/rtc.h b/include/rtc.h index d94beafcdce4..9882d702b6fb 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -17,21 +17,75 @@ #define RTC_ERR_FLAG_MASK 0x0FF0 -#define MORNING_EVO_HOUR_BEGIN 6 -#define MORNING_EVO_HOUR_END 10 +//Morning and evening don't exist in Gen 3 +#if OW_TIMES_OF_DAY == GEN_3 + #define MORNING_HOUR_BEGIN 0 + #define MORNING_HOUR_END 0 -#define DAY_EVO_HOUR_BEGIN 10 -#define DAY_EVO_HOUR_END 19 + #define DAY_HOUR_BEGIN 12 + #define DAY_HOUR_END HOURS_PER_DAY -#define DUSK_EVO_HOUR_BEGIN 19 -#define DUSK_EVO_HOUR_END 20 + #define EVENING_HOUR_BEGIN 0 + #define EVENING_HOUR_END 0 -#define NIGHT_EVO_HOUR_BEGIN 20 -#define NIGHT_EVO_HOUR_END 6 + #define NIGHT_HOUR_BEGIN 0 + #define NIGHT_HOUR_END 12 +//Evening doesn't exist in Gen 4 +#elif OW_TIMES_OF_DAY == GEN_4 + #define MORNING_HOUR_BEGIN 4 + #define MORNING_HOUR_END 10 + + #define DAY_HOUR_BEGIN 10 + #define DAY_HOUR_END 20 + + #define EVENING_HOUR_BEGIN 0 + #define EVENING_HOUR_END 0 + + #define NIGHT_HOUR_BEGIN 20 + #define NIGHT_HOUR_END 4 +//Gen 5 currently not included as the seasons change the times of day +#elif OW_TIMES_OF_DAY <= GEN_6 + #define MORNING_HOUR_BEGIN 4 + #define MORNING_HOUR_END 11 + + #define DAY_HOUR_BEGIN 11 + #define DAY_HOUR_END 18 + + #define EVENING_HOUR_BEGIN 18 + #define EVENING_HOUR_END 21 + + #define NIGHT_HOUR_BEGIN 21 + #define NIGHT_HOUR_END 4 +//These are the Sun/Ultra Sun times +#elif OW_TIMES_OF_DAY == GEN_7 + #define MORNING_HOUR_BEGIN 6 + #define MORNING_HOUR_END 10 + + #define DAY_HOUR_BEGIN 10 + #define DAY_HOUR_END 17 + + #define EVENING_HOUR_BEGIN 17 + #define EVENING_HOUR_END 18 + + #define NIGHT_HOUR_BEGIN 18 + #define NIGHT_HOUR_END 6 +#elif OW_TIMES_OF_DAY >= GEN_8 + #define MORNING_HOUR_BEGIN 6 + #define MORNING_HOUR_END 10 + + #define DAY_HOUR_BEGIN 10 + #define DAY_HOUR_END 19 + + #define EVENING_HOUR_BEGIN 19 + #define EVENING_HOUR_END 20 + + #define NIGHT_HOUR_BEGIN 20 + #define NIGHT_HOUR_END 6 +#endif #define TIME_MORNING 0 #define TIME_DAY 1 -#define TIME_DUSK 2 +#define TIME_EVENING 2 #define TIME_NIGHT 3 extern struct Time gLocalTime; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8de129f474e6..780f630ed82e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -14858,7 +14858,7 @@ static void Cmd_handleballthrow(void) ballMultiplier = 400; break; case ITEM_DUSK_BALL: - if ((GetTimeOfDay() == TIME_DUSK || GetTimeOfDay() == TIME_NIGHT) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND) + if ((GetTimeOfDay() == TIME_EVENING || GetTimeOfDay() == TIME_NIGHT) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND) ballMultiplier = (B_DUSK_BALL_MODIFIER >= GEN_7 ? 300 : 350); break; case ITEM_QUICK_BALL: diff --git a/src/pokemon.c b/src/pokemon.c index 97577efbb06f..a9c22ae8e708 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -7076,7 +7076,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s } break; case EVO_LEVEL_DUSK: - if (GetTimeOfDay() == TIME_DUSK && gEvolutionTable[species][i].param <= level) + if (GetTimeOfDay() == TIME_EVENING && gEvolutionTable[species][i].param <= level) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL: diff --git a/src/rtc.c b/src/rtc.c index d6f5377d9831..64e6734552ce 100644 --- a/src/rtc.c +++ b/src/rtc.c @@ -304,11 +304,11 @@ bool8 IsBetweenHours(s32 hours, s32 begin, s32 end) u8 GetTimeOfDay(void) { RtcCalcLocalTime(); - if (IsBetweenHours(gLocalTime.hours, MORNING_EVO_HOUR_BEGIN, MORNING_EVO_HOUR_END)) + if (IsBetweenHours(gLocalTime.hours, MORNING_HOUR_BEGIN, MORNING_HOUR_END)) return TIME_MORNING; - else if (IsBetweenHours(gLocalTime.hours, DUSK_EVO_HOUR_BEGIN, DUSK_EVO_HOUR_END)) - return TIME_DUSK; - else if (IsBetweenHours(gLocalTime.hours, NIGHT_EVO_HOUR_BEGIN, NIGHT_EVO_HOUR_END)) + else if (IsBetweenHours(gLocalTime.hours, EVENING_HOUR_BEGIN, EVENING_HOUR_END)) + return TIME_EVENING; + else if (IsBetweenHours(gLocalTime.hours, NIGHT_HOUR_BEGIN, NIGHT_HOUR_END)) return TIME_NIGHT; return TIME_DAY; }