Using TIME instead of TIME_OF_DAY

This commit is contained in:
Eduardo Quezada 2024-09-12 10:26:58 -03:00
parent 757ed7054d
commit 56859e35e0
4 changed files with 28 additions and 29 deletions

View File

@ -25,10 +25,6 @@
#define MOVEMENT_MODE_SCRIPTED 2
#define SKIP_OBJECT_EVENT_LOAD 1
#define TIME_OF_DAY_NIGHT 0
#define TIME_OF_DAY_TWILIGHT 1
#define TIME_OF_DAY_DAY 2
#define TIME_OF_DAY_MAX TIME_OF_DAY_DAY
struct InitialPlayerAvatarState
{

View File

@ -29,6 +29,7 @@
#include "pokeball.h"
#include "random.h"
#include "region_map.h"
#include "rtc.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
@ -2505,7 +2506,7 @@ void UpdateLightSprite(struct Sprite *sprite)
return;
}
if (gTimeOfDay != TIME_OF_DAY_NIGHT)
if (gTimeOfDay != TIME_NIGHT)
{
sprite->invisible = TRUE;
return;

View File

@ -3,6 +3,7 @@
#include "event_scripts.h"
#include "follower_helper.h"
#include "overworld.h"
#include "rtc.h"
#include "constants/battle.h"
#include "constants/followers.h"
#include "constants/metatile_behaviors.h"
@ -362,14 +363,14 @@ const struct FollowerMsgInfoExtended gFollowerConditionalMessages[COND_MSG_COUNT
.text = (u8*)sDayTexts,
.textSpread = 1,
.emotion = FOLLOWER_EMOTION_MUSIC,
.conditions = {MATCH_TIME_OF_DAY(TIME_OF_DAY_DAY)},
.conditions = {MATCH_TIME_OF_DAY(TIME_DAY)},
},
[COND_MSG_NIGHT] =
{
.text = (u8*)sNightTexts,
.textSpread = 1,
.emotion = FOLLOWER_EMOTION_MUSIC,
.conditions = {MATCH_TIME_OF_DAY(TIME_OF_DAY_NIGHT)},
.conditions = {MATCH_TIME_OF_DAY(TIME_NIGHT)},
},
};

View File

@ -1532,9 +1532,10 @@ void CB1_Overworld(void)
const struct BlendSettings gTimeOfDayBlend[] =
{
[TIME_OF_DAY_NIGHT] = {.coeff = 10, .blendColor = TINT_NIGHT, .isTint = TRUE},
[TIME_OF_DAY_TWILIGHT] = {.coeff = 4, .blendColor = 0xA8B0E0, .isTint = TRUE},
[TIME_OF_DAY_DAY] = {.coeff = 0, .blendColor = 0},
[TIME_MORNING] = {.coeff = 4, .blendColor = 0xA8B0E0, .isTint = TRUE}, // Originally TIME_OF_DAY_TWILIGHT
[TIME_DAY] = {.coeff = 0, .blendColor = 0, .isTint = FALSE},
[TIME_EVENING] = {.coeff = 4, .blendColor = 0xA8B0E0, .isTint = TRUE}, // Originally TIME_OF_DAY_TWILIGHT
[TIME_NIGHT] = {.coeff = 10, .blendColor = TINT_NIGHT, .isTint = TRUE},
};
u8 UpdateTimeOfDay(void)
@ -1547,50 +1548,50 @@ u8 UpdateTimeOfDay(void)
{
currentTimeBlend.weight = 256;
currentTimeBlend.altWeight = 0;
gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_NIGHT;
gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_NIGHT;
}
else if (hours < 7) // night->twilight
else if (hours < 7) // night->morning
{
currentTimeBlend.time0 = TIME_OF_DAY_NIGHT;
currentTimeBlend.time1 = TIME_OF_DAY_TWILIGHT;
currentTimeBlend.time0 = TIME_NIGHT;
currentTimeBlend.time1 = TIME_MORNING;
currentTimeBlend.weight = 256 - 256 * ((hours - 4) * 60 + minutes) / ((7-4)*60);
currentTimeBlend.altWeight = (256 - currentTimeBlend.weight) / 2;
gTimeOfDay = TIME_OF_DAY_DAY;
gTimeOfDay = TIME_MORNING;
}
else if (hours < 10) // twilight->day
else if (hours < 10) // morning->day
{
currentTimeBlend.time0 = TIME_OF_DAY_TWILIGHT;
currentTimeBlend.time1 = TIME_OF_DAY_DAY;
currentTimeBlend.time0 = TIME_MORNING;
currentTimeBlend.time1 = TIME_DAY;
currentTimeBlend.weight = 256 - 256 * ((hours - 7) * 60 + minutes) / ((10-7)*60);
currentTimeBlend.altWeight = (256 - currentTimeBlend.weight) / 2 + 128;
gTimeOfDay = TIME_OF_DAY_DAY;
gTimeOfDay = TIME_DAY;
}
else if (hours < 18) // day
{
currentTimeBlend.weight = currentTimeBlend.altWeight = 256;
gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_DAY;
gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_DAY;
}
else if (hours < 20)
else if (hours < 20) // evening
{
currentTimeBlend.time0 = TIME_OF_DAY_DAY;
currentTimeBlend.time1 = TIME_OF_DAY_TWILIGHT;
currentTimeBlend.time0 = TIME_DAY;
currentTimeBlend.time1 = TIME_EVENING;
currentTimeBlend.weight = 256 - 256 * ((hours - 18) * 60 + minutes) / ((20-18)*60);
currentTimeBlend.altWeight = currentTimeBlend.weight / 2 + 128;
gTimeOfDay = TIME_OF_DAY_TWILIGHT;
gTimeOfDay = TIME_EVENING;
}
else if (hours < 22) // twilight->night
else if (hours < 22) // evening->night
{
currentTimeBlend.time0 = TIME_OF_DAY_TWILIGHT;
currentTimeBlend.time1 = TIME_OF_DAY_NIGHT;
currentTimeBlend.time0 = TIME_EVENING;
currentTimeBlend.time1 = TIME_NIGHT;
currentTimeBlend.weight = 256 - 256 * ((hours - 20) * 60 + minutes) / ((22-20)*60);
currentTimeBlend.altWeight = currentTimeBlend.weight / 2;
gTimeOfDay = TIME_OF_DAY_NIGHT;
gTimeOfDay = TIME_NIGHT;
}
else // 22-24, night
{
currentTimeBlend.weight = 256;
currentTimeBlend.altWeight = 0;
gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_NIGHT;
gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_NIGHT;
}
return gTimeOfDay;
}