Fixed weather gamma blending.
This commit is contained in:
parent
0cc6c7b111
commit
c0d6692ce8
2 changed files with 9 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "task.h"
|
||||
#include "trig.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "overworld.h"
|
||||
|
||||
#define DROUGHT_COLOR_INDEX(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00))
|
||||
|
||||
|
@ -473,10 +474,12 @@ static void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex)
|
|||
// Loop through the speficied palette range and apply necessary gamma shifts to the colors.
|
||||
while (curPalIndex < numPalettes)
|
||||
{
|
||||
CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16));
|
||||
UpdatePalettesWithTime(1 << (palOffset >> 4));
|
||||
if (sPaletteGammaTypes[curPalIndex] == GAMMA_NONE)
|
||||
{
|
||||
// No palette change.
|
||||
CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16));
|
||||
// CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16));
|
||||
palOffset += 16;
|
||||
}
|
||||
else
|
||||
|
@ -491,7 +494,7 @@ static void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex)
|
|||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
// Apply gamma shift to the original color.
|
||||
struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset];
|
||||
struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferFaded[palOffset];
|
||||
r = gammaTable[baseColor.r];
|
||||
g = gammaTable[baseColor.g];
|
||||
b = gammaTable[baseColor.b];
|
||||
|
@ -554,10 +557,11 @@ static void ApplyGammaShiftWithBlend(u8 startPalIndex, u8 numPalettes, s8 gammaI
|
|||
|
||||
while (curPalIndex < numPalettes)
|
||||
{
|
||||
UpdatePalettesWithTime(1 << (palOffset >> 4)); // Apply TOD blend
|
||||
if (sPaletteGammaTypes[curPalIndex] == GAMMA_NONE)
|
||||
{
|
||||
// No gamma shift. Simply blend the colors.
|
||||
BlendPalette(palOffset, 16, blendCoeff, blendColor);
|
||||
BlendPalettesFine(1 << (palOffset >> 4), gPlttBufferFaded, gPlttBufferFaded, blendCoeff, blendColor);
|
||||
palOffset += 16;
|
||||
}
|
||||
else
|
||||
|
@ -571,7 +575,7 @@ static void ApplyGammaShiftWithBlend(u8 startPalIndex, u8 numPalettes, s8 gammaI
|
|||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset];
|
||||
struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferFaded[palOffset];
|
||||
u8 r = gammaTable[baseColor.r];
|
||||
u8 g = gammaTable[baseColor.g];
|
||||
u8 b = gammaTable[baseColor.b];
|
||||
|
|
|
@ -1511,6 +1511,7 @@ static bool8 MapHasNaturalLight(u8 mapType) { // Whether a map type is naturally
|
|||
|| mapType == MAP_TYPE_OCEAN_ROUTE;
|
||||
}
|
||||
|
||||
// TODO: Rewrite palette fading to work with FadeScreen
|
||||
static bool8 FadePalettesWithTime(void) { // Only used to fade back in
|
||||
gTimeOfDay = UpdateTimeOfDay();
|
||||
if (MapHasNaturalLight(gMapHeader.mapType)) {
|
||||
|
|
Loading…
Reference in a new issue