Add config for times of day (#3579)
* Added initial config for times of day * Changed TIME_DUSK/DUSK_EVO to EVENING * Added morning and evening to Gens 3/4 * Renamed *_EVO_HOUR_BEGIN/END to just *_HOUR_BEGIN/END * Incorporated comments
This commit is contained in:
parent
b6ff973f38
commit
b7cd6502d4
5 changed files with 70 additions and 15 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue