pokefirered/include/field_weather.h

188 lines
5.0 KiB
C

#ifndef GUARD_WEATHER_H
#define GUARD_WEATHER_H
#include "global.h"
#include "constants/field_weather.h"
enum
{
COLOR_MAP_NONE,
COLOR_MAP_DARK_CONTRAST,
COLOR_MAP_CONTRAST,
};
#define TAG_WEATHER_START 0x1200
enum {
GFXTAG_CLOUD = TAG_WEATHER_START,
GFXTAG_FOG_H,
GFXTAG_ASH,
GFXTAG_FOG_D,
GFXTAG_SANDSTORM,
GFXTAG_BUBBLE,
GFXTAG_RAIN,
};
enum {
PALTAG_WEATHER = TAG_WEATHER_START,
PALTAG_WEATHER_2
};
#define NUM_WEATHER_COLOR_MAPS 19
struct Weather
{
union
{
struct
{
struct Sprite *rainSprites[MAX_RAIN_SPRITES];
struct Sprite *snowflakeSprites[101];
struct Sprite *cloudSprites[NUM_CLOUD_SPRITES];
} s1;
struct
{
u8 filler0[0xA0];
struct Sprite *fogHSprites[NUM_FOG_HORIZONTAL_SPRITES];
struct Sprite *ashSprites[NUM_ASH_SPRITES];
struct Sprite *fogDSprites[NUM_FOG_DIAGONAL_SPRITES];
struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES];
struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES];
} s2;
} sprites;
s8 colorMapIndex;
s8 targetColorMapIndex;
u8 colorMapStepDelay;
u8 colorMapStepCounter;
u16 fadeDestColor;
u8 palProcessingState;
u8 fadeScreenCounter;
bool8 readyForInit;
u8 taskId;
u8 fadeInFirstFrame;
u8 fadeInTimer;
u16 initStep;
u16 finishStep;
u8 currWeather;
u8 nextWeather;
u8 weatherGfxLoaded;
bool8 weatherChangeComplete;
u8 weatherPicSpritePalIndex;
u8 contrastColorMapSpritePalIndex;
// Rain
u16 rainSpriteVisibleCounter;
u8 curRainSpriteIndex;
u8 targetRainSpriteCount;
u8 rainSpriteCount;
u8 rainSpriteVisibleDelay;
u8 isDownpour;
u8 rainStrength;
bool8 cloudSpritesCreated;
// Snow
u16 snowflakeVisibleCounter;
u16 snowflakeTimer;
u8 snowflakeSpriteCount;
u8 targetSnowflakeSpriteCount;
// Thunderstorm
u16 thunderTimer;
u16 thunderSETimer;
bool8 thunderAllowEnd;
bool8 thunderLongBolt;
u8 thunderShortBolts;
bool8 thunderEnqueued;
// Horizontal fog
u16 fogHScrollPosX;
u16 fogHScrollCounter;
u16 fogHScrollOffset;
u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount;
bool8 fogHSpritesCreated;
// Ash
u16 ashBaseSpritesX;
u16 ashUnused;
bool8 ashSpritesCreated;
// Sandstorm
u32 sandstormXOffset;
u32 sandstormYOffset;
u16 sandstormUnused;
u16 sandstormBaseSpritesX;
u16 sandstormPosY;
u16 sandstormWaveIndex;
u16 sandstormWaveCounter;
bool8 sandstormSpritesCreated;
bool8 sandstormSwirlSpritesCreated;
// Diagonal fog
u16 fogDBaseSpritesX;
u16 fogDPosY;
u16 fogDScrollXCounter;
u16 fogDScrollYCounter;
u16 fogDXOffset;
u16 fogDYOffset;
bool8 fogDSpritesCreated;
// Bubbles
u16 bubblesDelayCounter;
u16 bubblesDelayIndex;
u16 bubblesCoordsIndex;
u16 bubblesSpriteCount;
bool8 bubblesSpritesCreated;
u16 currBlendEVA;
u16 currBlendEVB;
u16 targetBlendEVA;
u16 targetBlendEVB;
u8 blendUpdateCounter;
u8 blendFrameCounter;
u8 blendDelay;
// Drought
s16 droughtBrightnessStage;
s16 droughtLastBrightnessStage;
s16 droughtTimer;
s16 droughtState;
u8 droughtUnused[9];
u8 loadDroughtPalsIndex;
u8 loadDroughtPalsOffset;
};
extern struct Weather *const gWeatherPtr;
void FadeScreen(u8 mode, s8 delay);
u32 FadeScreenHardware(u32 mode, s32 delay);
void SetSavedWeather(u32);
u8 GetSavedWeather(void);
void DoCurrentWeather(void);
void SetSavedWeatherFromCurrMapHeader(void);
void SlightlyDarkenPalsInWeather(u16 *, u16 *, u32);
void PlayRainStoppingSoundEffect(void);
bool8 IsWeatherNotFadingIn(void);
void SetWeatherScreenFadeOut(void);
void SetWeatherPalStateIdle(void);
u8 GetCurrentWeather(void);
void delay(u8, u8, u32);
void UpdateSpritePaletteWithWeather(u8 palIdx, bool32 allowFog);
void ResetPreservedPalettesInWeather(void);
const u8* SetPaletteColorMapType(u8 paletteIndex, u8 colorMapType);
void PreservePaletteInWeather(u8 palIdx);
bool32 IsWeatherAlphaBlend(void);
void SetNextWeather(u8 weather);
void SetCurrentAndNextWeather(u8 weather);
void Weather_SetBlendCoeffs(u8 eva, u8 evb);
void Weather_SetTargetBlendCoeffs(u8 eva, u8 evb, int delay);
bool8 Weather_UpdateBlend(void);
void LoadCustomWeatherSpritePalette(const u16 *palette);
void ResetDroughtWeatherPaletteLoading(void);
bool8 LoadDroughtWeatherPalettes(void);
void DroughtStateInit(void);
void DroughtStateRun(void);
void SetRainStrengthFromSoundEffect(u16 soundEffect);
void ApplyWeatherColorMapIfIdle(s8 colorMapIndex);
void ApplyWeatherColorMapIfIdle_Gradual(u8 colorMapIndex, u8 targetColorMapIndex, u8 colorMapStepDelay);
void ApplyWeatherColorMapToPals(u8 startPalIndex, u8 numPalettes);
void StartWeather(void);
void SetWeather(u32 weather);
void ResumePausedWeather(void);
void FadeSelectedPals(u8 mode, s8 delay, u32 selectedPalettes);
#endif // GUARD_WEATHER_H