Fixed shadow brightness during battle transition.
This commit is contained in:
parent
68497d81ce
commit
f94a92fe1f
3 changed files with 37 additions and 13 deletions
|
@ -193,6 +193,7 @@ void Thunderstorm_Main(void);
|
||||||
void Thunderstorm_InitAll(void);
|
void Thunderstorm_InitAll(void);
|
||||||
bool8 Thunderstorm_Finish(void);
|
bool8 Thunderstorm_Finish(void);
|
||||||
void FogHorizontal_InitVars(void);
|
void FogHorizontal_InitVars(void);
|
||||||
|
u8 UpdateShadowColor(u16 color);
|
||||||
void FogHorizontal_Main(void);
|
void FogHorizontal_Main(void);
|
||||||
void FogHorizontal_InitAll(void);
|
void FogHorizontal_InitAll(void);
|
||||||
bool8 FogHorizontal_Finish(void);
|
bool8 FogHorizontal_Finish(void);
|
||||||
|
|
|
@ -1390,6 +1390,7 @@ static void InitPatternWeaveTransition(struct Task *task)
|
||||||
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
||||||
sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL;
|
sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL;
|
||||||
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1);
|
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1);
|
||||||
|
UpdateShadowColor(0x3DEF); // force shadows to gray
|
||||||
|
|
||||||
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
||||||
gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH;
|
gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH;
|
||||||
|
@ -3961,6 +3962,8 @@ static void VBlankCB_AngledWipes(void)
|
||||||
#define tFadeFromGrayIncrement data[5]
|
#define tFadeFromGrayIncrement data[5]
|
||||||
#define tDelayTimer data[6]
|
#define tDelayTimer data[6]
|
||||||
#define tBlend data[7]
|
#define tBlend data[7]
|
||||||
|
#define tBldCntSaved data[8]
|
||||||
|
#define tShadowColor data[9]
|
||||||
|
|
||||||
static void CreateIntroTask(s16 fadeToGrayDelay, s16 fadeFromGrayDelay, s16 numFades, s16 fadeToGrayIncrement, s16 fadeFromGrayIncrement)
|
static void CreateIntroTask(s16 fadeToGrayDelay, s16 fadeFromGrayDelay, s16 numFades, s16 fadeToGrayIncrement, s16 fadeFromGrayIncrement)
|
||||||
{
|
{
|
||||||
|
@ -3988,17 +3991,29 @@ void Task_BattleTransition_Intro(u8 taskId)
|
||||||
|
|
||||||
static bool8 TransitionIntro_FadeToGray(struct Task *task)
|
static bool8 TransitionIntro_FadeToGray(struct Task *task)
|
||||||
{
|
{
|
||||||
|
u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START);
|
||||||
|
u16 index = (paletteNum+16)*16+9; // SHADOW_COLOR_INDEX
|
||||||
if (task->tDelayTimer == 0 || --task->tDelayTimer == 0)
|
if (task->tDelayTimer == 0 || --task->tDelayTimer == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
task->tDelayTimer = task->tFadeToGrayDelay;
|
task->tDelayTimer = task->tFadeToGrayDelay;
|
||||||
task->tBlend += task->tFadeToGrayIncrement;
|
task->tBlend += task->tFadeToGrayIncrement;
|
||||||
if (task->tBlend > 16)
|
if (task->tBlend > 16)
|
||||||
task->tBlend = 16;
|
task->tBlend = 16;
|
||||||
|
if (paletteNum < 16)
|
||||||
|
task->tShadowColor = gPlttBufferFaded[index];
|
||||||
BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11));
|
BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11));
|
||||||
|
if (paletteNum < 16)
|
||||||
|
gPlttBufferFaded[index] = task->tShadowColor;
|
||||||
}
|
}
|
||||||
if (task->tBlend >= 16)
|
if (task->tBlend >= 16)
|
||||||
{
|
{
|
||||||
// Fade to gray complete, start fade back
|
// Fade to gray complete, start fade back
|
||||||
|
// Save BLDCNT and turn off targets temporarily
|
||||||
|
task->tBldCntSaved = GetGpuReg(REG_OFFSET_BLDCNT);
|
||||||
|
SetGpuReg(REG_OFFSET_BLDCNT, task->tBldCntSaved & ~BLDCNT_TGT2_BG_ALL);
|
||||||
|
if (paletteNum < 16)
|
||||||
|
gPlttBufferFaded[index] = RGB(11, 11, 11);
|
||||||
task->tState++;
|
task->tState++;
|
||||||
task->tDelayTimer = task->tFadeFromGrayDelay;
|
task->tDelayTimer = task->tFadeFromGrayDelay;
|
||||||
}
|
}
|
||||||
|
@ -4009,11 +4024,18 @@ static bool8 TransitionIntro_FadeFromGray(struct Task *task)
|
||||||
{
|
{
|
||||||
if (task->tDelayTimer == 0 || --task->tDelayTimer == 0)
|
if (task->tDelayTimer == 0 || --task->tDelayTimer == 0)
|
||||||
{
|
{
|
||||||
|
u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START);
|
||||||
task->tDelayTimer = task->tFadeFromGrayDelay;
|
task->tDelayTimer = task->tFadeFromGrayDelay;
|
||||||
task->tBlend -= task->tFadeFromGrayIncrement;
|
task->tBlend -= task->tFadeFromGrayIncrement;
|
||||||
if (task->tBlend < 0)
|
if (task->tBlend < 0)
|
||||||
task->tBlend = 0;
|
task->tBlend = 0;
|
||||||
BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11));
|
BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11));
|
||||||
|
// Restore BLDCNT
|
||||||
|
SetGpuReg(REG_OFFSET_BLDCNT, task->tBldCntSaved);
|
||||||
|
if (paletteNum < 16) {
|
||||||
|
u16 index = (paletteNum+16)*16+9; // SHADOW_COLOR_INDEX
|
||||||
|
gPlttBufferFaded[index] = task->tShadowColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (task->tBlend == 0)
|
if (task->tBlend == 0)
|
||||||
{
|
{
|
||||||
|
@ -4306,6 +4328,7 @@ static bool8 FrontierLogoWave_Init(struct Task *task)
|
||||||
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
|
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
|
||||||
LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette));
|
LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette));
|
||||||
sTransitionData->cameraY = 0;
|
sTransitionData->cameraY = 0;
|
||||||
|
UpdateShadowColor(0x3DEF); // force shadows to gray
|
||||||
|
|
||||||
task->tState++;
|
task->tState++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ static void DestroyFogHorizontalSprites(void);
|
||||||
#define SHADOW_COLOR_INDEX 9
|
#define SHADOW_COLOR_INDEX 9
|
||||||
|
|
||||||
// Updates just the color of shadows to match special weather blending
|
// Updates just the color of shadows to match special weather blending
|
||||||
static u8 UpdateShadowColor(u16 color) {
|
u8 UpdateShadowColor(u16 color) {
|
||||||
u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START);
|
u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START);
|
||||||
u16 tempBuffer[16];
|
u16 tempBuffer[16];
|
||||||
u16 blendedColor;
|
u16 blendedColor;
|
||||||
|
|
Loading…
Reference in a new issue