Testing updating sprite palettes with weather + time.
This commit is contained in:
parent
37d0e17be4
commit
4a5dbcb52b
3 changed files with 12 additions and 7 deletions
|
@ -770,8 +770,8 @@ void FieldEffectScript_LoadFadedPalette(u8 **script)
|
||||||
{
|
{
|
||||||
struct SpritePalette *palette = (struct SpritePalette *)FieldEffectScript_ReadWord(script);
|
struct SpritePalette *palette = (struct SpritePalette *)FieldEffectScript_ReadWord(script);
|
||||||
LoadSpritePalette(palette);
|
LoadSpritePalette(palette);
|
||||||
UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(palette->tag));
|
|
||||||
UpdateSpritePaletteWithTime(IndexOfSpritePaletteTag(palette->tag)); // Ensure field effects are blended
|
UpdateSpritePaletteWithTime(IndexOfSpritePaletteTag(palette->tag)); // Ensure field effects are blended
|
||||||
|
UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(palette->tag));
|
||||||
(*script) += 4;
|
(*script) += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,6 @@ static void LoadObjectRegularReflectionPalette(struct ObjectEvent *objectEvent,
|
||||||
}
|
}
|
||||||
paletteNum = LoadSpritePalette(&filteredPalette);
|
paletteNum = LoadSpritePalette(&filteredPalette);
|
||||||
UpdateSpritePaletteWithWeather(paletteNum);
|
UpdateSpritePaletteWithWeather(paletteNum);
|
||||||
UpdateSpritePaletteWithTime(paletteNum);
|
|
||||||
}
|
}
|
||||||
sprite->oam.paletteNum = paletteNum;
|
sprite->oam.paletteNum = paletteNum;
|
||||||
sprite->oam.objMode = 1; // Alpha blending
|
sprite->oam.objMode = 1; // Alpha blending
|
||||||
|
@ -205,7 +204,6 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite)
|
||||||
}
|
}
|
||||||
paletteNum = LoadSpritePalette(&filteredPalette);
|
paletteNum = LoadSpritePalette(&filteredPalette);
|
||||||
UpdateSpritePaletteWithWeather(paletteNum);
|
UpdateSpritePaletteWithWeather(paletteNum);
|
||||||
UpdateSpritePaletteWithTime(paletteNum);
|
|
||||||
}
|
}
|
||||||
reflectionSprite->oam.paletteNum = paletteNum;
|
reflectionSprite->oam.paletteNum = paletteNum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,8 +536,13 @@ static void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No palette blending.
|
u32 palettes = 0;
|
||||||
|
u32 mask = 1 << startPalIndex;
|
||||||
|
u8 i;
|
||||||
CpuFastCopy(gPlttBufferUnfaded + startPalIndex * 16, gPlttBufferFaded + startPalIndex * 16, numPalettes * 16 * sizeof(u16));
|
CpuFastCopy(gPlttBufferUnfaded + startPalIndex * 16, gPlttBufferFaded + startPalIndex * 16, numPalettes * 16 * sizeof(u16));
|
||||||
|
for (i = 0; i < numPalettes; i++, mask <<= 1)
|
||||||
|
palettes |= mask;
|
||||||
|
UpdatePalettesWithTime(palettes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +830,6 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex)
|
||||||
{
|
{
|
||||||
u16 paletteIndex = 16 + spritePaletteIndex;
|
u16 paletteIndex = 16 + spritePaletteIndex;
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
switch (gWeatherPtr->palProcessingState)
|
switch (gWeatherPtr->palProcessingState)
|
||||||
{
|
{
|
||||||
case WEATHER_PAL_STATE_SCREEN_FADING_IN:
|
case WEATHER_PAL_STATE_SCREEN_FADING_IN:
|
||||||
|
@ -853,7 +857,10 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paletteIndex *= 16;
|
paletteIndex *= 16;
|
||||||
BlendPalette(paletteIndex, 16, 12, RGB(28, 31, 28));
|
// First blend with time
|
||||||
|
CpuFastCopy(gPlttBufferUnfaded + paletteIndex, gPlttBufferFaded + paletteIndex, 32);
|
||||||
|
UpdateSpritePaletteWithTime(spritePaletteIndex);
|
||||||
|
BlendPalettesFine(1 << (spritePaletteIndex + 16), gPlttBufferFaded + paletteIndex, gPlttBufferFaded + paletteIndex, 12, RGB(28, 31, 28));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -876,8 +883,8 @@ static bool8 IsFirstFrameOfWeatherFadeIn(void)
|
||||||
void LoadCustomWeatherSpritePalette(const u16 *palette)
|
void LoadCustomWeatherSpritePalette(const u16 *palette)
|
||||||
{
|
{
|
||||||
LoadPalette(palette, 0x100 + gWeatherPtr->weatherPicSpritePalIndex * 16, 32);
|
LoadPalette(palette, 0x100 + gWeatherPtr->weatherPicSpritePalIndex * 16, 32);
|
||||||
UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex);
|
|
||||||
UpdateSpritePaletteWithTime(gWeatherPtr->weatherPicSpritePalIndex);
|
UpdateSpritePaletteWithTime(gWeatherPtr->weatherPicSpritePalIndex);
|
||||||
|
UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadDroughtWeatherPalette(u8 *gammaIndexPtr, u8 *a1)
|
static void LoadDroughtWeatherPalette(u8 *gammaIndexPtr, u8 *a1)
|
||||||
|
|
Loading…
Reference in a new issue