pokeemerald/include/field_weather.h

233 lines
6.2 KiB
C
Raw Normal View History

2017-10-12 09:06:19 +02:00
#ifndef GUARD_WEATHER_H
#define GUARD_WEATHER_H
2018-01-29 15:55:34 +01:00
#include "sprite.h"
2019-12-15 17:42:50 +01:00
#include "constants/field_weather.h"
2018-12-08 19:43:21 +01:00
#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
};
2018-01-29 15:55:34 +01:00
struct Weather
{
union
{
struct
{
2019-04-01 04:07:29 +02:00
struct Sprite *rainSprites[MAX_RAIN_SPRITES];
2018-01-29 15:55:34 +01:00
struct Sprite *snowflakeSprites[101];
2019-04-02 03:04:23 +02:00
struct Sprite *cloudSprites[NUM_CLOUD_SPRITES];
2018-01-29 15:55:34 +01:00
} s1;
struct
{
u8 filler0[0xA0];
struct Sprite *fogHSprites[NUM_FOG_HORIZONTAL_SPRITES];
2019-04-02 03:04:23 +02:00
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];
2018-01-29 15:55:34 +01:00
} s2;
} sprites;
u8 gammaShifts[19][32];
u8 altGammaShifts[19][32];
s8 gammaIndex;
s8 gammaTargetIndex;
u8 gammaStepDelay;
u8 gammaStepFrameCounter;
u16 fadeDestColor;
2021-04-04 06:23:06 +02:00
u8 palProcessingState;
u8 fadeScreenCounter;
bool8 readyForInit;
u8 taskId;
u8 fadeInFirstFrame;
u8 fadeInTimer;
2018-01-29 15:55:34 +01:00
u16 initStep;
u16 finishStep;
u8 currWeather;
u8 nextWeather;
u8 weatherGfxLoaded;
bool8 weatherChangeComplete;
u8 weatherPicSpritePalIndex;
u8 altGammaSpritePalIndex;
2021-04-04 06:23:06 +02:00
// Rain
2019-04-01 04:07:29 +02:00
u16 rainSpriteVisibleCounter;
u8 curRainSpriteIndex;
2019-04-02 03:04:23 +02:00
u8 targetRainSpriteCount;
2018-01-29 15:55:34 +01:00
u8 rainSpriteCount;
2019-04-01 04:07:29 +02:00
u8 rainSpriteVisibleDelay;
u8 isDownpour;
2018-01-29 15:55:34 +01:00
u8 rainStrength;
2021-04-04 06:23:06 +02:00
u8 cloudSpritesCreated;
// Snow
2019-04-02 03:04:23 +02:00
u16 snowflakeVisibleCounter;
u16 snowflakeTimer;
2018-01-29 15:55:34 +01:00
u8 snowflakeSpriteCount;
2019-04-02 03:04:23 +02:00
u8 targetSnowflakeSpriteCount;
2021-04-04 06:23:06 +02:00
// Thunderstorm
u16 thunderDelay;
2018-01-29 15:55:34 +01:00
u16 thunderCounter;
2021-04-04 06:23:06 +02:00
bool8 thunderAllowEnd;
bool8 thunderSkipShort;
u8 thunderShortRetries;
bool8 thunderTriggered;
// Horizontal fog
u16 fogHScrollPosX;
u16 fogHScrollCounter;
u16 fogHScrollOffset;
2018-01-29 15:55:34 +01:00
u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount;
u8 fogHSpritesCreated;
2021-04-04 06:23:06 +02:00
// Ash
u16 ashBaseSpritesX;
u16 ashUnused;
2018-01-29 15:55:34 +01:00
u8 ashSpritesCreated;
2021-04-04 06:23:06 +02:00
// Sandstorm
u32 sandstormXOffset;
u32 sandstormYOffset;
2021-04-04 06:23:06 +02:00
u16 sandstormUnused;
u16 sandstormBaseSpritesX;
u16 sandstormPosY;
u16 sandstormWaveIndex;
u16 sandstormWaveCounter;
u8 sandstormSpritesCreated;
u8 sandstormSwirlSpritesCreated;
2021-04-04 06:23:06 +02:00
// Diagonal fog
u16 fogDBaseSpritesX;
u16 fogDPosY;
u16 fogDScrollXCounter;
u16 fogDScrollYCounter;
u16 fogDXOffset;
u16 fogDYOffset;
u8 fogDSpritesCreated;
2021-04-04 06:23:06 +02:00
// Bubbles
u16 bubblesDelayCounter;
u16 bubblesDelayIndex;
u16 bubblesCoordsIndex;
u16 bubblesSpriteCount;
u8 bubblesSpritesCreated;
2021-04-04 06:23:06 +02:00
2018-01-29 15:55:34 +01:00
u16 currBlendEVA;
u16 currBlendEVB;
u16 targetBlendEVA;
u16 targetBlendEVB;
u8 blendUpdateCounter;
u8 blendFrameCounter;
u8 blendDelay;
2021-04-04 06:23:06 +02:00
// Drought
s16 droughtBrightnessStage;
s16 droughtLastBrightnessStage;
s16 droughtTimer;
s16 droughtState;
2021-04-04 06:23:06 +02:00
u8 droughtUnused[9];
2018-01-29 15:55:34 +01:00
s8 loadDroughtPalsIndex;
u8 loadDroughtPalsOffset;
};
2018-12-08 19:43:21 +01:00
// field_weather.c
extern struct Weather gWeather;
extern struct Weather *const gWeatherPtr;
2021-02-28 00:41:30 +01:00
extern const u16 gFogPalette[];
2018-12-20 22:20:34 +01:00
// field_weather_effect.c
extern const u8 gWeatherFogHorizontalTiles[];
2018-12-08 19:43:21 +01:00
2018-01-29 15:55:34 +01:00
void StartWeather(void);
void SetNextWeather(u8 weather);
void SetCurrentAndNextWeather(u8 weather);
void SetCurrentAndNextWeatherNoDelay(u8 weather);
2021-04-04 06:23:06 +02:00
void ApplyWeatherGammaShiftIfIdle(s8 gammaIndex);
2018-12-08 19:43:21 +01:00
void sub_80ABC7C(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay);
void FadeScreen(u8 mode, s8 delay);
2018-01-29 15:55:34 +01:00
bool8 IsWeatherNotFadingIn(void);
2018-12-08 19:43:21 +01:00
void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex);
void ApplyWeatherGammaShiftToPal(u8 paletteIndex);
void LoadCustomWeatherSpritePalette(const u16 *palette);
2018-01-29 15:55:34 +01:00
void ResetDroughtWeatherPaletteLoading(void);
bool8 LoadDroughtWeatherPalettes(void);
void DroughtStateInit(void);
void DroughtStateRun(void);
2018-12-08 19:43:21 +01:00
void Weather_SetBlendCoeffs(u8 eva, u8 evb);
void Weather_SetTargetBlendCoeffs(u8 eva, u8 evb, int delay);
bool8 Weather_UpdateBlend(void);
2018-01-29 15:55:34 +01:00
u8 GetCurrentWeather(void);
2018-12-08 19:43:21 +01:00
void SetRainStrengthFromSoundEffect(u16 soundEffect);
void PlayRainStoppingSoundEffect(void);
2018-12-08 19:43:21 +01:00
u8 IsWeatherChangeComplete(void);
2018-12-08 19:05:03 +01:00
void SetWeatherScreenFadeOut(void);
2021-04-04 23:52:07 +02:00
void SetWeatherPalStateIdle(void);
2018-12-08 19:43:21 +01:00
void PreservePaletteInWeather(u8 preservedPalIndex);
void ResetPreservedPalettesInWeather(void);
2018-01-29 15:55:34 +01:00
2018-12-08 19:43:21 +01:00
// field_weather_effect.c
void Clouds_InitVars(void);
void Clouds_Main(void);
void Clouds_InitAll(void);
bool8 Clouds_Finish(void);
2019-04-02 03:04:23 +02:00
void Sunny_InitVars(void);
void Sunny_Main(void);
void Sunny_InitAll(void);
bool8 Sunny_Finish(void);
void Rain_InitVars(void);
void Rain_Main(void);
void Rain_InitAll(void);
bool8 Rain_Finish(void);
2018-12-08 19:43:21 +01:00
void Snow_InitVars(void);
void Snow_Main(void);
void Snow_InitAll(void);
bool8 Snow_Finish(void);
void Thunderstorm_InitVars(void);
void Thunderstorm_Main(void);
void Thunderstorm_InitAll(void);
bool8 Thunderstorm_Finish(void);
void FogHorizontal_InitVars(void);
void FogHorizontal_Main(void);
void FogHorizontal_InitAll(void);
bool8 FogHorizontal_Finish(void);
2018-12-08 19:43:21 +01:00
void Ash_InitVars(void);
void Ash_Main(void);
void Ash_InitAll(void);
bool8 Ash_Finish(void);
void Sandstorm_InitVars(void);
void Sandstorm_Main(void);
void Sandstorm_InitAll(void);
bool8 Sandstorm_Finish(void);
void FogDiagonal_InitVars(void);
void FogDiagonal_Main(void);
void FogDiagonal_InitAll(void);
bool8 FogDiagonal_Finish(void);
2018-12-08 19:43:21 +01:00
void Shade_InitVars(void);
void Shade_Main(void);
void Shade_InitAll(void);
bool8 Shade_Finish(void);
void Drought_InitVars(void);
void Drought_Main(void);
void Drought_InitAll(void);
bool8 Drought_Finish(void);
void Downpour_InitVars(void);
void Downpour_InitAll(void);
2018-12-08 19:43:21 +01:00
void Bubbles_InitVars(void);
void Bubbles_Main(void);
void Bubbles_InitAll(void);
bool8 Bubbles_Finish(void);
2018-01-29 15:55:34 +01:00
2018-12-08 19:43:21 +01:00
u8 GetSav1Weather(void);
void SetSav1Weather(u32 weather);
void SetSav1WeatherFromCurrMapHeader(void);
void SetWeather(u32 weather);
void DoCurrentWeather(void);
void UpdateWeatherPerDay(u16 increment);
2019-02-25 08:28:41 +01:00
void ResumePausedWeather(void);
2017-10-12 09:06:19 +02:00
#endif // GUARD_WEATHER_H