Added shadow toggle to weather structure.
This commit is contained in:
parent
68e43a8f04
commit
a160012dbf
5 changed files with 19 additions and 3 deletions
|
@ -45,7 +45,8 @@ struct Weather
|
||||||
s8 gammaTargetIndex;
|
s8 gammaTargetIndex;
|
||||||
u8 gammaStepDelay;
|
u8 gammaStepDelay;
|
||||||
u8 gammaStepFrameCounter;
|
u8 gammaStepFrameCounter;
|
||||||
u16 fadeDestColor;
|
u16 fadeDestColor:15;
|
||||||
|
u16 noShadows:1; // Certain weathers require blend coeffs that do not work nice with shadows
|
||||||
u8 palProcessingState;
|
u8 palProcessingState;
|
||||||
u8 fadeScreenCounter;
|
u8 fadeScreenCounter;
|
||||||
bool8 readyForInit;
|
bool8 readyForInit;
|
||||||
|
|
|
@ -8856,13 +8856,13 @@ static void GroundEffect_Shadow(struct ObjectEvent *objEvent, struct Sprite *spr
|
||||||
static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite *sprite, u32 flags)
|
static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite *sprite, u32 flags)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
if (ObjectEventIsFarawayIslandMew(objEvent) == TRUE && !ShouldMewShakeGrass(objEvent))
|
if (ObjectEventIsFarawayIslandMew(objEvent) == TRUE && !ShouldMewShakeGrass(objEvent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(sGroundEffectFuncs); i++, flags >>= 1)
|
for (i = 0; i < ARRAY_COUNT(sGroundEffectFuncs); i++, flags >>= 1)
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
sGroundEffectFuncs[i](objEvent, sprite);
|
sGroundEffectFuncs[i](objEvent, sprite);
|
||||||
|
if (!gWeatherPtr->noShadows)
|
||||||
GroundEffect_Shadow(objEvent, sprite);
|
GroundEffect_Shadow(objEvent, sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,7 @@ void UpdateShadowFieldEffect(struct Sprite *sprite)
|
||||||
sprite->invisible = linkedSprite->invisible;
|
sprite->invisible = linkedSprite->invisible;
|
||||||
if (!objectEvent->active
|
if (!objectEvent->active
|
||||||
|| objectEvent->noShadow
|
|| objectEvent->noShadow
|
||||||
|
|| gWeatherPtr->noShadows
|
||||||
|| MetatileBehavior_IsPokeGrass(objectEvent->currentMetatileBehavior)
|
|| MetatileBehavior_IsPokeGrass(objectEvent->currentMetatileBehavior)
|
||||||
|| MetatileBehavior_IsSurfableWaterOrUnderwater(objectEvent->currentMetatileBehavior)
|
|| MetatileBehavior_IsSurfableWaterOrUnderwater(objectEvent->currentMetatileBehavior)
|
||||||
|| MetatileBehavior_IsSurfableWaterOrUnderwater(objectEvent->previousMetatileBehavior))
|
|| MetatileBehavior_IsSurfableWaterOrUnderwater(objectEvent->previousMetatileBehavior))
|
||||||
|
|
|
@ -255,6 +255,7 @@ static void Task_WeatherMain(u8 taskId)
|
||||||
static void None_Init(void)
|
static void None_Init(void)
|
||||||
{
|
{
|
||||||
Weather_SetBlendCoeffs(8, 12); // Indoor shadows
|
Weather_SetBlendCoeffs(8, 12); // Indoor shadows
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
gWeatherPtr->gammaTargetIndex = 0;
|
gWeatherPtr->gammaTargetIndex = 0;
|
||||||
gWeatherPtr->gammaStepDelay = 0;
|
gWeatherPtr->gammaStepDelay = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ static const struct SpriteTemplate sCloudSpriteTemplate =
|
||||||
|
|
||||||
void Clouds_InitVars(void)
|
void Clouds_InitVars(void)
|
||||||
{
|
{
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
gWeatherPtr->gammaTargetIndex = 0;
|
gWeatherPtr->gammaTargetIndex = 0;
|
||||||
gWeatherPtr->gammaStepDelay = 20;
|
gWeatherPtr->gammaStepDelay = 20;
|
||||||
gWeatherPtr->weatherGfxLoaded = FALSE;
|
gWeatherPtr->weatherGfxLoaded = FALSE;
|
||||||
|
@ -156,6 +157,7 @@ void Sunny_InitVars(void)
|
||||||
gWeatherPtr->gammaTargetIndex = 0;
|
gWeatherPtr->gammaTargetIndex = 0;
|
||||||
gWeatherPtr->gammaStepDelay = 20;
|
gWeatherPtr->gammaStepDelay = 20;
|
||||||
Weather_SetBlendCoeffs(8, 12);
|
Weather_SetBlendCoeffs(8, 12);
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sunny_InitAll(void)
|
void Sunny_InitAll(void)
|
||||||
|
@ -239,6 +241,7 @@ void Drought_InitVars(void)
|
||||||
gWeatherPtr->weatherGfxLoaded = FALSE;
|
gWeatherPtr->weatherGfxLoaded = FALSE;
|
||||||
gWeatherPtr->gammaTargetIndex = 0;
|
gWeatherPtr->gammaTargetIndex = 0;
|
||||||
gWeatherPtr->gammaStepDelay = 0;
|
gWeatherPtr->gammaStepDelay = 0;
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Drought_InitAll(void)
|
void Drought_InitAll(void)
|
||||||
|
@ -482,6 +485,7 @@ void Rain_InitVars(void)
|
||||||
gWeatherPtr->gammaStepDelay = 20;
|
gWeatherPtr->gammaStepDelay = 20;
|
||||||
SetRainStrengthFromSoundEffect(SE_RAIN);
|
SetRainStrengthFromSoundEffect(SE_RAIN);
|
||||||
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rain_InitAll(void)
|
void Rain_InitAll(void)
|
||||||
|
@ -776,6 +780,7 @@ void Snow_InitVars(void)
|
||||||
gWeatherPtr->targetSnowflakeSpriteCount = 16;
|
gWeatherPtr->targetSnowflakeSpriteCount = 16;
|
||||||
gWeatherPtr->snowflakeVisibleCounter = 0;
|
gWeatherPtr->snowflakeVisibleCounter = 0;
|
||||||
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Snow_InitAll(void)
|
void Snow_InitAll(void)
|
||||||
|
@ -1052,6 +1057,7 @@ void Thunderstorm_InitVars(void)
|
||||||
gWeatherPtr->thunderTriggered = FALSE;
|
gWeatherPtr->thunderTriggered = FALSE;
|
||||||
SetRainStrengthFromSoundEffect(SE_THUNDERSTORM);
|
SetRainStrengthFromSoundEffect(SE_THUNDERSTORM);
|
||||||
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thunderstorm_InitAll(void)
|
void Thunderstorm_InitAll(void)
|
||||||
|
@ -1081,6 +1087,7 @@ void Downpour_InitVars(void)
|
||||||
gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment
|
gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment
|
||||||
SetRainStrengthFromSoundEffect(SE_DOWNPOUR);
|
SetRainStrengthFromSoundEffect(SE_DOWNPOUR);
|
||||||
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downpour_InitAll(void)
|
void Downpour_InitAll(void)
|
||||||
|
@ -1378,6 +1385,7 @@ void FogHorizontal_InitVars(void)
|
||||||
gWeatherPtr->fogHScrollPosX = 0;
|
gWeatherPtr->fogHScrollPosX = 0;
|
||||||
Weather_SetBlendCoeffs(0, 16);
|
Weather_SetBlendCoeffs(0, 16);
|
||||||
}
|
}
|
||||||
|
gWeatherPtr->noShadows = TRUE; // TODO: Can fog be made compatible with shadows?
|
||||||
}
|
}
|
||||||
|
|
||||||
void FogHorizontal_InitAll(void)
|
void FogHorizontal_InitAll(void)
|
||||||
|
@ -1532,6 +1540,7 @@ void Ash_InitVars(void)
|
||||||
Weather_SetBlendCoeffs(0, 12);
|
Weather_SetBlendCoeffs(0, 12);
|
||||||
// SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // These aren't valid blend coefficients!
|
// SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // These aren't valid blend coefficients!
|
||||||
}
|
}
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ash_InitAll(void)
|
void Ash_InitAll(void)
|
||||||
|
@ -1748,6 +1757,7 @@ void FogDiagonal_InitVars(void)
|
||||||
gWeatherPtr->fogDPosY = 0;
|
gWeatherPtr->fogDPosY = 0;
|
||||||
Weather_SetBlendCoeffs(0, 16);
|
Weather_SetBlendCoeffs(0, 16);
|
||||||
}
|
}
|
||||||
|
gWeatherPtr->noShadows = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FogDiagonal_InitAll(void)
|
void FogDiagonal_InitAll(void)
|
||||||
|
@ -1961,6 +1971,7 @@ void Sandstorm_InitVars(void)
|
||||||
|
|
||||||
Weather_SetBlendCoeffs(0, 16);
|
Weather_SetBlendCoeffs(0, 16);
|
||||||
}
|
}
|
||||||
|
gWeatherPtr->noShadows = TRUE; // TODO: Can sandstorm be compatible with shadows?
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sandstorm_InitAll(void)
|
void Sandstorm_InitAll(void)
|
||||||
|
@ -2248,6 +2259,7 @@ void Shade_InitVars(void)
|
||||||
gWeatherPtr->gammaTargetIndex = 3;
|
gWeatherPtr->gammaTargetIndex = 3;
|
||||||
gWeatherPtr->gammaStepDelay = 20;
|
gWeatherPtr->gammaStepDelay = 20;
|
||||||
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness
|
||||||
|
gWeatherPtr->noShadows = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shade_InitAll(void)
|
void Shade_InitAll(void)
|
||||||
|
@ -2309,6 +2321,7 @@ void Bubbles_InitVars(void)
|
||||||
gWeatherPtr->bubblesCoordsIndex = 0;
|
gWeatherPtr->bubblesCoordsIndex = 0;
|
||||||
gWeatherPtr->bubblesSpriteCount = 0;
|
gWeatherPtr->bubblesSpriteCount = 0;
|
||||||
}
|
}
|
||||||
|
gWeatherPtr->noShadows = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bubbles_InitAll(void)
|
void Bubbles_InitAll(void)
|
||||||
|
|
Loading…
Reference in a new issue