From a4680ed572c831138450a673677c5cb439db53a2 Mon Sep 17 00:00:00 2001 From: Ariel Antonitis Date: Sat, 24 Apr 2021 00:57:11 -0400 Subject: [PATCH] Minor TOD documentation. --- src/overworld.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/overworld.c b/src/overworld.c index ce68cfbd89..659d8bec92 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1474,7 +1474,7 @@ u8 UpdateTimeOfDay(void) { RtcCalcLocalTime(); hours = gLocalTime.hours; minutes = gLocalTime.minutes; - if (hours >= 22 || hours < 4) { + if (hours >= 22 || hours < 4) { // night currentTimeBlend.weight = 256; return gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_NIGHT; } else if (hours >= 4 && hours < 7) { // night->twilight @@ -1501,7 +1501,8 @@ u8 UpdateTimeOfDay(void) { currentTimeBlend.weight = 256 - 256 * ((hours - 20) * 60 + minutes) / ((22-20)*60); return gTimeOfDay = TIME_OF_DAY_NIGHT; } else { // This should never occur - return TIME_OF_DAY_MAX; + currentTimeBlend.weight = 256; + return gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_DAY; } } @@ -1557,6 +1558,7 @@ static void OverworldBasic(void) UpdatePaletteFade(); UpdateTilesetAnimations(); DoScheduledBgTilemapCopiesToVram(); + // Every minute if no palette fade is active, update TOD blending as needed if (!(gPaletteFade.active || (timeCounter++ % 3600))) { struct TimeBlendSettings cachedBlend = { .time0 = currentTimeBlend.time0,