From d78afca94f5949dce3ccfd1a9b0585a03262291c Mon Sep 17 00:00:00 2001 From: Hedara Date: Thu, 10 Apr 2025 22:41:38 +0200 Subject: [PATCH] More shadow options and documentation --- docs/tutorials/dns.md | 9 +++++++++ include/overworld.h | 3 ++- src/event_object_movement.c | 4 +++- src/overworld.c | 13 ++++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/dns.md b/docs/tutorials/dns.md index d2fb8ca273..71e1d6d6ac 100644 --- a/docs/tutorials/dns.md +++ b/docs/tutorials/dns.md @@ -1,5 +1,8 @@ ## Day/Night system FAQ +### Q: How do I disable DNS? +A: Set `OW_ENABLE_DNS` to `FALSE` in `include/config/overworld.h`. + ### Q: How do I mark certain colors in a palette as light-blended? A: Create a `.pla` file in the same folder as the `.pal` with the same name. @@ -14,3 +17,9 @@ on separate lines to mark those colors as being light-blended, i.e: 9 10 ``` + +### Q: How do I return to using regular shadows? +A: Set `OW_OBJECT_VANILLA_SHADOWS` to `TRUE` in `include/config/overworld.h`. + +### Q: How do I disable shadows for certain locations? +A: Shadows can be disabled for certain locations by modifying the `CurrentMapHasShadows` function in `src/overworld.c` diff --git a/include/overworld.h b/include/overworld.h index d9de4cac58..4408fd5a9d 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -141,7 +141,8 @@ bool32 IsOverworldLinkActive(void); void CB1_Overworld(void); void CB2_OverworldBasic(void); void UpdateTimeOfDay(void); -bool8 MapHasNaturalLight(u8 mapType); +bool32 MapHasNaturalLight(u8 mapType); +bool32 CurrentMapHasShadows(void); void UpdateAltBgPalettes(u16 palettes); void UpdatePalettesWithTime(u32); void CB2_Overworld(void); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 2bc70ea0e9..d7774884fa 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -10214,8 +10214,10 @@ static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite * for (i = 0; i < ARRAY_COUNT(sGroundEffectFuncs); i++, flags >>= 1) if (flags & 1) sGroundEffectFuncs[i](objEvent, sprite); - if (!OW_OBJECT_VANILLA_SHADOWS && !(gWeatherPtr->noShadows || objEvent->inHotSprings || objEvent->inSandPile || MetatileBehavior_IsPuddle(objEvent->currentMetatileBehavior))) + if (!OW_OBJECT_VANILLA_SHADOWS && CurrentMapHasShadows() && !(gWeatherPtr->noShadows || objEvent->inHotSprings || objEvent->inSandPile || MetatileBehavior_IsPuddle(objEvent->currentMetatileBehavior))) + { SetUpShadow(objEvent); + } } void filters_out_some_ground_effects(struct ObjectEvent *objEvent, u32 *flags) diff --git a/src/overworld.c b/src/overworld.c index 55a5f643a8..646e5cbbba 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1614,10 +1614,12 @@ void UpdateTimeOfDay(void) } } +#undef MORNING_HOUR_MIDDLE #undef TIME_BLEND_WEIGHT +#undef DEFAULT_WEIGHT // Whether a map type is naturally lit/outside -bool8 MapHasNaturalLight(u8 mapType) +bool32 MapHasNaturalLight(u8 mapType) { return (mapType == MAP_TYPE_TOWN || mapType == MAP_TYPE_CITY @@ -1626,6 +1628,15 @@ bool8 MapHasNaturalLight(u8 mapType) ); } +bool32 CurrentMapHasShadows(void) +{ + bool32 shouldHaveShadows = TRUE; + u32 currentMapType = gMapHeader.mapType; + if (currentMapType == MAP_TYPE_UNDERGROUND) + shouldHaveShadows = FALSE; + return shouldHaveShadows; +} + // Update & mix day / night bg palettes (into unfaded) void UpdateAltBgPalettes(u16 palettes) {