diff options
author | Marcus Huderle <huderlem@gmail.com> | 2019-01-19 15:32:25 -0600 |
---|---|---|
committer | huderlem <huderlem@gmail.com> | 2019-01-29 14:36:02 -0600 |
commit | e81838dba397903afbd5bdacf3a54061446e7721 (patch) | |
tree | cb416163a9e2771ad10f8b083e32e5df54cfeed8 /src/field_weather.c | |
parent | 5bfd802dbbeeb3af1e43fa839e0c879160343248 (diff) |
Misc. documentation and move some data into .c files
Diffstat (limited to 'src/field_weather.c')
-rw-r--r-- | src/field_weather.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/field_weather.c b/src/field_weather.c index f0615dabf..21168426c 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -17,7 +17,7 @@ #include "trig.h" #include "gpu_regs.h" -#define MACRO1(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00)) +#define DROUGHT_COLOR_INDEX(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00)) enum { @@ -65,15 +65,21 @@ static void None_Init(void); static void None_Main(void); static u8 None_Finish(void); -// EWRAM EWRAM_DATA struct Weather gWeather = {0}; EWRAM_DATA static u8 sFieldEffectPaletteGammaTypes[32] = {0}; -// IWRAM bss IWRAM_DATA static const u8 *sPaletteGammaTypes; -// CONST -extern const u16 gUnknown_0854014C[][4096]; +// The drought weather effect uses a precalculated color lookup table. Presumably this +// is because the underlying color shift calculation is slow. +const u16 sDroughtWeatherColors[][0x1000] = { + INCBIN_U16("graphics/weather/drought/0.gbapal"), + INCBIN_U16("graphics/weather/drought/1.gbapal"), + INCBIN_U16("graphics/weather/drought/2.gbapal"), + INCBIN_U16("graphics/weather/drought/3.gbapal"), + INCBIN_U16("graphics/weather/drought/4.gbapal"), + INCBIN_U16("graphics/weather/drought/5.gbapal"), +}; // This is a pointer to gWeather. All code in this file accesses gWeather directly, // while code in other field weather files accesses gWeather through this pointer. @@ -513,7 +519,7 @@ static void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex) { for (i = 0; i < 16; i++) { - gPlttBufferFaded[palOffset] = gUnknown_0854014C[gammaIndex][MACRO1(gPlttBufferUnfaded[palOffset])]; + gPlttBufferFaded[palOffset] = sDroughtWeatherColors[gammaIndex][DROUGHT_COLOR_INDEX(gPlttBufferUnfaded[palOffset])]; palOffset++; } } @@ -619,7 +625,7 @@ static void ApplyDroughtGammaShiftWithBlend(s8 gammaIndex, u8 blendCoeff, u16 bl b1 = color1.b; offset = ((b1 & 0x1E) << 7) | ((g1 & 0x1E) << 3) | ((r1 & 0x1E) >> 1); - color2 = *(struct RGBColor *)&gUnknown_0854014C[gammaIndex][offset]; + color2 = *(struct RGBColor *)&sDroughtWeatherColors[gammaIndex][offset]; r2 = color2.r; g2 = color2.g; b2 = color2.b; |