Slight palette update optimization.
This commit is contained in:
parent
a80de91463
commit
0d8467c2a9
1 changed files with 9 additions and 10 deletions
|
@ -1526,32 +1526,31 @@ static bool8 FadePalettesWithTime(void) { // Only used to fade back in
|
|||
|
||||
void UpdatePalettesWithTime(u32 palettes) {
|
||||
if (MapHasNaturalLight(gMapHeader.mapType)) {
|
||||
u8 i, j;
|
||||
u16 i;
|
||||
u16 tempPaletteBuffer[16];
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (GetSpritePaletteTagByPaletteNum(i) & 0x8000) // Don't blend special sprite palette tags
|
||||
if (GetSpritePaletteTagByPaletteNum(i) >> 15) // Don't blend special sprite palette tags
|
||||
palettes &= ~(1 << (i + 16));
|
||||
}
|
||||
palettes &= ~0xE000; // Don't blend tile palettes [13,15]
|
||||
gTimeOfDay = min(TIME_OF_DAY_MAX, gTimeOfDay);
|
||||
if (!palettes)
|
||||
return;
|
||||
for (i = 0; palettes; i++) {
|
||||
for (i = 0; palettes; i+=16) {
|
||||
if (palettes & 1) {
|
||||
if (sTimeOfDayBlendVars[currentTimeBlend.time0].isTint)
|
||||
TintPalette_RGB_Copy(i*16, sTimeOfDayBlendVars[currentTimeBlend.time0].blendColor);
|
||||
TintPalette_RGB_Copy(i, sTimeOfDayBlendVars[currentTimeBlend.time0].blendColor);
|
||||
else
|
||||
TimeBlendPalette(i*16, sTimeOfDayBlendVars[currentTimeBlend.time0].coeff, sTimeOfDayBlendVars[currentTimeBlend.time0].blendColor);
|
||||
TimeBlendPalette(i, sTimeOfDayBlendVars[currentTimeBlend.time0].coeff, sTimeOfDayBlendVars[currentTimeBlend.time0].blendColor);
|
||||
if (currentTimeBlend.weight == 256) {
|
||||
palettes >>= 1;
|
||||
continue;
|
||||
}
|
||||
CpuFastCopy(&gPlttBufferFaded[i*16], tempPaletteBuffer, 32);
|
||||
CpuFastCopy(&gPlttBufferFaded[i], tempPaletteBuffer, 32);
|
||||
if (sTimeOfDayBlendVars[currentTimeBlend.time1].isTint)
|
||||
TintPalette_RGB_Copy(i*16, sTimeOfDayBlendVars[currentTimeBlend.time1].blendColor);
|
||||
TintPalette_RGB_Copy(i, sTimeOfDayBlendVars[currentTimeBlend.time1].blendColor);
|
||||
else
|
||||
TimeBlendPalette(i*16, sTimeOfDayBlendVars[currentTimeBlend.time1].coeff, sTimeOfDayBlendVars[currentTimeBlend.time1].blendColor);
|
||||
AveragePalettes(tempPaletteBuffer, &gPlttBufferFaded[i*16], &gPlttBufferFaded[i*16], currentTimeBlend.weight);
|
||||
TimeBlendPalette(i, sTimeOfDayBlendVars[currentTimeBlend.time1].coeff, sTimeOfDayBlendVars[currentTimeBlend.time1].blendColor);
|
||||
AveragePalettes(tempPaletteBuffer, &gPlttBufferFaded[i], &gPlttBufferFaded[i], currentTimeBlend.weight);
|
||||
}
|
||||
palettes >>= 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue