Fixed DNS off config sometimes breaking palettes on map change (#6603)

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
hedara90 2025-04-13 21:04:21 +02:00 committed by GitHub
parent a6c73a5885
commit 3236ea62aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1560,8 +1560,6 @@ const struct BlendSettings gTimeOfDayBlend[] =
void UpdateTimeOfDay(void)
{
if (!OW_ENABLE_DNS)
return;
s32 hours, minutes;
RtcCalcLocalTime();
hours = sHoursOverride ? sHoursOverride : gLocalTime.hours;
@ -1621,10 +1619,11 @@ void UpdateTimeOfDay(void)
// Whether a map type is naturally lit/outside
bool32 MapHasNaturalLight(u8 mapType)
{
return (mapType == MAP_TYPE_TOWN
|| mapType == MAP_TYPE_CITY
|| mapType == MAP_TYPE_ROUTE
|| mapType == MAP_TYPE_OCEAN_ROUTE);
return (OW_ENABLE_DNS
&& (mapType == MAP_TYPE_TOWN
|| mapType == MAP_TYPE_CITY
|| mapType == MAP_TYPE_ROUTE
|| mapType == MAP_TYPE_OCEAN_ROUTE));
}
bool32 CurrentMapHasShadows(void)
@ -1637,8 +1636,6 @@ bool32 CurrentMapHasShadows(void)
// Update & mix day / night bg palettes (into unfaded)
void UpdateAltBgPalettes(u16 palettes)
{
if (!OW_ENABLE_DNS)
return;
const struct Tileset *primary = gMapHeader.mapLayout->primaryTileset;
const struct Tileset *secondary = gMapHeader.mapLayout->secondaryTileset;
u32 i = 1;
@ -1666,7 +1663,7 @@ void UpdateAltBgPalettes(u16 palettes)
void UpdatePalettesWithTime(u32 palettes)
{
if (!OW_ENABLE_DNS || !MapHasNaturalLight(gMapHeader.mapType))
if (!MapHasNaturalLight(gMapHeader.mapType))
return;
u32 i;
u32 mask = 1 << 16;
@ -1685,8 +1682,7 @@ void UpdatePalettesWithTime(u32 palettes)
u8 UpdateSpritePaletteWithTime(u8 paletteNum)
{
if (OW_ENABLE_DNS
&& MapHasNaturalLight(gMapHeader.mapType)
if (MapHasNaturalLight(gMapHeader.mapType)
&& !IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(paletteNum)))
TimeMixPalettes(1, &gPlttBufferUnfaded[OBJ_PLTT_ID(paletteNum)], &gPlttBufferFaded[OBJ_PLTT_ID(paletteNum)], &gTimeBlend.startBlend, &gTimeBlend.endBlend, gTimeBlend.weight);
return paletteNum;