From f913f2884bd0905729bd8f6d905018e6debb63d6 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 8 Oct 2024 12:21:06 -0300 Subject: [PATCH] Add config for shadow intensity --- include/config/overworld.h | 5 ++++- include/constants/field_weather.h | 4 ++++ src/field_weather.c | 2 +- src/field_weather_effect.c | 14 ++++++++------ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index 3298a03209..0762197c7b 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -72,11 +72,14 @@ // These generational defines only make a distinction for OW_ALTERED_TIME_RATIO #define GEN_8_PLA GEN_LATEST + 2 -//Time +// Time #define OW_TIMES_OF_DAY GEN_LATEST // Different generations have the times of day change at different times. #define OW_USE_FAKE_RTC FALSE // When TRUE, seconds on the in-game clock will only advance once every 60 playTimeVBlanks (every 60 frames). #define OW_ALTERED_TIME_RATIO GEN_LATEST // In GEN_8_PLA, the time in game moves forward 60 seconds for every second in the RTC. In GEN_9, it is 20 seconds. This has no effect if OW_USE_FAKE_RTC is FALSE. +// Lighting +#define OW_SHADOW_INTENSITY 4 // Ranges from 0 to 16, where 0 is fully transparent and 16 is black. + // Overworld flags // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. diff --git a/include/constants/field_weather.h b/include/constants/field_weather.h index fe7eb6a1ae..bc4826ee36 100644 --- a/include/constants/field_weather.h +++ b/include/constants/field_weather.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_FIELD_WEATHER_H #define GUARD_CONSTANTS_FIELD_WEATHER_H +#include "config/overworld.h" + #define MAX_RAIN_SPRITES 24 #define NUM_CLOUD_SPRITES 3 #define NUM_FOG_HORIZONTAL_SPRITES 20 @@ -22,4 +24,6 @@ #define FADE_FROM_WHITE 2 #define FADE_TO_WHITE 3 +#define BASE_SHADOW_INTENSITY (16 - OW_SHADOW_INTENSITY) + #endif // GUARD_CONSTANTS_FIELD_WEATHER_H diff --git a/src/field_weather.c b/src/field_weather.c index 2322550780..d3ca7ee052 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -301,7 +301,7 @@ static void Task_WeatherMain(u8 taskId) static void None_Init(void) { - Weather_SetBlendCoeffs(8, 12); // Indoor shadows + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // Indoor shadows gWeatherPtr->noShadows = FALSE; gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 0; diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 724ad76ae8..f7203ab445 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -153,11 +153,13 @@ bool8 Clouds_Finish(void) return FALSE; } +STATIC_ASSERT(OW_SHADOW_INTENSITY >= 0 && OW_SHADOW_INTENSITY <= 16, ObjEventShadowTransparencyNotInRange) + void Sunny_InitVars(void) { gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 20; - Weather_SetBlendCoeffs(8, 12); + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // preserve shadow darkness gWeatherPtr->noShadows = FALSE; } @@ -485,7 +487,7 @@ void Rain_InitVars(void) gWeatherPtr->targetColorMapIndex = 3; gWeatherPtr->colorMapStepDelay = 20; SetRainStrengthFromSoundEffect(SE_RAIN); - Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // preserve shadow darkness gWeatherPtr->noShadows = FALSE; } @@ -780,7 +782,7 @@ void Snow_InitVars(void) gWeatherPtr->colorMapStepDelay = 20; gWeatherPtr->targetSnowflakeSpriteCount = NUM_SNOWFLAKE_SPRITES; gWeatherPtr->snowflakeVisibleCounter = 0; - Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // preserve shadow darkness gWeatherPtr->noShadows = FALSE; } @@ -1029,7 +1031,7 @@ void Thunderstorm_InitVars(void) gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment gWeatherPtr->thunderEnqueued = FALSE; SetRainStrengthFromSoundEffect(SE_THUNDERSTORM); - Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // preserve shadow darkness gWeatherPtr->noShadows = FALSE; } @@ -1059,7 +1061,7 @@ void Downpour_InitVars(void) gWeatherPtr->colorMapStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment SetRainStrengthFromSoundEffect(SE_DOWNPOUR); - Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // preserve shadow darkness gWeatherPtr->noShadows = FALSE; } @@ -2272,7 +2274,7 @@ void Shade_InitVars(void) gWeatherPtr->initStep = 0; gWeatherPtr->targetColorMapIndex = 3; gWeatherPtr->colorMapStepDelay = 20; - Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + Weather_SetBlendCoeffs(8, BASE_SHADOW_INTENSITY); // preserve shadow darkness gWeatherPtr->noShadows = FALSE; }