mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
247 lines
6.5 KiB
C
247 lines
6.5 KiB
C
#ifndef GUARD_WEATHER_H
|
|
#define GUARD_WEATHER_H
|
|
|
|
#include "sprite.h"
|
|
|
|
#define MAX_RAIN_SPRITES 24
|
|
#define NUM_CLOUD_SPRITES 3
|
|
#define NUM_FOG1_SPRITES 20
|
|
#define NUM_ASH_SPRITES 20
|
|
#define NUM_FOG2_SPRITES 20
|
|
#define NUM_SANDSTORM_SPRITES 20
|
|
#define NUM_SWIRL_SANDSTORM_SPRITES 5
|
|
|
|
// Controls how the weather should be changing the screen palettes.
|
|
enum
|
|
{
|
|
WEATHER_PAL_STATE_CHANGING_WEATHER,
|
|
WEATHER_PAL_STATE_SCREEN_FADING_IN,
|
|
WEATHER_PAL_STATE_SCREEN_FADING_OUT,
|
|
WEATHER_PAL_STATE_IDLE,
|
|
};
|
|
|
|
// For the FadeScreen function.
|
|
enum
|
|
{
|
|
FADE_FROM_BLACK,
|
|
FADE_TO_BLACK,
|
|
FADE_FROM_WHITE,
|
|
FADE_TO_WHITE,
|
|
};
|
|
|
|
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 *fog1Sprites[NUM_FOG1_SPRITES];
|
|
struct Sprite *ashSprites[NUM_ASH_SPRITES];
|
|
struct Sprite *fog2Sprites[NUM_FOG2_SPRITES];
|
|
struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES];
|
|
struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES];
|
|
} s2;
|
|
} sprites;
|
|
u8 gammaShifts[19][32];
|
|
u8 altGammaShifts[19][32];
|
|
s8 gammaIndex;
|
|
s8 gammaTargetIndex;
|
|
u8 gammaStepDelay;
|
|
u8 gammaStepFrameCounter;
|
|
u16 fadeDestColor;
|
|
/*0x6C6*/ u8 palProcessingState;
|
|
/*0x6C7*/ u8 fadeScreenCounter;
|
|
/*0x6C8*/ bool8 readyForInit;
|
|
/*0x6C9*/ u8 taskId;
|
|
/*0x6CA*/ u8 unknown_6CA;
|
|
u8 unknown_6CB;
|
|
u16 initStep;
|
|
u16 finishStep;
|
|
u8 currWeather;
|
|
u8 nextWeather;
|
|
u8 weatherGfxLoaded;
|
|
bool8 weatherChangeComplete;
|
|
u8 weatherPicSpritePalIndex;
|
|
u8 altGammaSpritePalIndex;
|
|
u16 rainSpriteVisibleCounter;
|
|
u8 curRainSpriteIndex;
|
|
u8 targetRainSpriteCount;
|
|
u8 rainSpriteCount;
|
|
u8 rainSpriteVisibleDelay;
|
|
u8 isHeavyRain;
|
|
u8 rainStrength;
|
|
/*0x6DE*/ u8 cloudSpritesCreated;
|
|
u8 filler_6DF[1];
|
|
u16 snowflakeVisibleCounter;
|
|
u16 unknown_6E2;
|
|
u8 snowflakeSpriteCount;
|
|
u8 targetSnowflakeSpriteCount;
|
|
u16 unknown_6E6;
|
|
u16 thunderCounter;
|
|
u8 unknown_6EA;
|
|
u8 unknown_6EB;
|
|
u8 unknown_6EC;
|
|
u8 thunderTriggered;
|
|
u16 fog1ScrollPosX;
|
|
u16 fog1ScrollCounter;
|
|
u16 fog1ScrollOffset;
|
|
u8 lightenedFogSpritePals[6];
|
|
u8 lightenedFogSpritePalsCount;
|
|
u8 fog1SpritesCreated;
|
|
u16 ashBaseSpritesX;
|
|
u16 unknown_6FE;
|
|
u8 ashSpritesCreated;
|
|
u8 filler_701[3];
|
|
u32 sandstormXOffset;
|
|
u32 sandstormYOffset;
|
|
u8 filler_70C[2];
|
|
u16 sandstormBaseSpritesX;
|
|
u16 sandstormPosY;
|
|
u16 sandstormWaveIndex;
|
|
u16 sandstormWaveCounter;
|
|
u8 sandstormSpritesCreated;
|
|
u8 sandstormSwirlSpritesCreated;
|
|
u16 fog2BaseSpritesX;
|
|
u16 fog2PosY;
|
|
u16 fog2ScrollXCounter;
|
|
u16 fog2ScrollYCounter;
|
|
u16 fog2XOffset;
|
|
u16 fog2YOffset;
|
|
u8 fog2SpritesCreated;
|
|
u8 filler_725[1];
|
|
u16 bubblesDelayCounter;
|
|
u16 bubblesDelayIndex;
|
|
u16 bubblesCoordsIndex;
|
|
u16 bubblesSpriteCount;
|
|
u8 bubblesSpritesCreated;
|
|
u8 filler_72F;
|
|
u16 currBlendEVA;
|
|
u16 currBlendEVB;
|
|
u16 targetBlendEVA;
|
|
u16 targetBlendEVB;
|
|
u8 blendUpdateCounter;
|
|
u8 blendFrameCounter;
|
|
u8 blendDelay;
|
|
u8 filler_73B[0x3C-0x3B];
|
|
s16 unknown_73C;
|
|
s16 unknown_73E;
|
|
s16 unknown_740;
|
|
s16 unknown_742;
|
|
u8 filler_744[0xD-4];
|
|
s8 loadDroughtPalsIndex;
|
|
u8 loadDroughtPalsOffset;
|
|
};
|
|
|
|
// field_weather.c
|
|
extern struct Weather gWeather;
|
|
extern struct Weather *const gWeatherPtr;
|
|
extern const u16 gUnknown_083970E8[];
|
|
|
|
// field_weather_effect.c
|
|
extern const u8 gWeatherFog1Tiles[];
|
|
|
|
void StartWeather(void);
|
|
void SetNextWeather(u8 weather);
|
|
void SetCurrentAndNextWeather(u8 weather);
|
|
void SetCurrentAndNextWeatherNoDelay(u8 weather);
|
|
void sub_80ABC48(s8 gammaIndex);
|
|
void sub_80ABC7C(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay);
|
|
void FadeScreen(u8 mode, s8 delay);
|
|
bool8 IsWeatherNotFadingIn(void);
|
|
void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex);
|
|
void ApplyWeatherGammaShiftToPal(u8 paletteIndex);
|
|
u8 sub_80ABF20(void);
|
|
void LoadCustomWeatherSpritePalette(const u16 *palette);
|
|
void ResetDroughtWeatherPaletteLoading(void);
|
|
bool8 LoadDroughtWeatherPalettes(void);
|
|
void sub_80ABFE0(s8 gammaIndex);
|
|
void sub_80ABFF0(void);
|
|
void sub_80AC01C(void);
|
|
void Weather_SetBlendCoeffs(u8 eva, u8 evb);
|
|
void Weather_SetTargetBlendCoeffs(u8 eva, u8 evb, int delay);
|
|
bool8 Weather_UpdateBlend(void);
|
|
void sub_80AC274(u8 a);
|
|
u8 GetCurrentWeather(void);
|
|
void SetRainStrengthFromSoundEffect(u16 soundEffect);
|
|
void PlayRainStoppingSoundEffect(void);
|
|
u8 IsWeatherChangeComplete(void);
|
|
void SetWeatherScreenFadeOut(void);
|
|
void sub_80AC3E4(void);
|
|
void PreservePaletteInWeather(u8 preservedPalIndex);
|
|
void ResetPreservedPalettesInWeather(void);
|
|
|
|
// field_weather_effect.c
|
|
void Clouds_InitVars(void);
|
|
void Clouds_Main(void);
|
|
void Clouds_InitAll(void);
|
|
bool8 Clouds_Finish(void);
|
|
void Sunny_InitVars(void);
|
|
void Sunny_Main(void);
|
|
void Sunny_InitAll(void);
|
|
bool8 Sunny_Finish(void);
|
|
void LightRain_InitVars(void);
|
|
void LightRain_Main(void);
|
|
void LightRain_InitAll(void);
|
|
bool8 LightRain_Finish(void);
|
|
void Snow_InitVars(void);
|
|
void Snow_Main(void);
|
|
void Snow_InitAll(void);
|
|
bool8 Snow_Finish(void);
|
|
void MedRain_InitVars(void);
|
|
void Rain_Main(void);
|
|
void MedRain_InitAll(void);
|
|
bool8 Rain_Finish(void);
|
|
void Fog1_InitVars(void);
|
|
void Fog1_Main(void);
|
|
void Fog1_InitAll(void);
|
|
bool8 Fog1_Finish(void);
|
|
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 Fog2_InitVars(void);
|
|
void Fog2_Main(void);
|
|
void Fog2_InitAll(void);
|
|
bool8 Fog2_Finish(void);
|
|
void Fog1_InitVars(void);
|
|
void Fog1_Main(void);
|
|
void Fog1_InitAll(void);
|
|
bool8 Fog1_Finish(void);
|
|
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 HeavyRain_InitVars(void);
|
|
void Rain_Main(void);
|
|
void HeavyRain_InitAll(void);
|
|
bool8 Rain_Finish(void);
|
|
void Bubbles_InitVars(void);
|
|
void Bubbles_Main(void);
|
|
void Bubbles_InitAll(void);
|
|
bool8 Bubbles_Finish(void);
|
|
|
|
u8 GetSav1Weather(void);
|
|
void SetSav1Weather(u32 weather);
|
|
void SetSav1WeatherFromCurrMapHeader(void);
|
|
void SetWeather(u32 weather);
|
|
void DoCurrentWeather(void);
|
|
void UpdateWeatherPerDay(u16 increment);
|
|
void ResumePausedWeather(void);
|
|
|
|
#endif // GUARD_WEATHER_H
|