forked from pret/pokefirered
-
Notifications
You must be signed in to change notification settings - Fork 0
/
field_weather.h
176 lines (166 loc) · 4.93 KB
/
field_weather.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#ifndef GUARD_WEATHER_H
#define GUARD_WEATHER_H
#include "global.h"
#include "constants/field_weather.h"
#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,
};
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;
u8 gammaShifts[19][32];
u8 altGammaShifts[19][32];
s8 gammaIndex;
s8 gammaTargetIndex;
u8 gammaStepDelay;
u8 gammaStepFrameCounter;
u16 fadeDestColor;
u8 palProcessingState;
u8 fadeScreenCounter;
bool8 readyForInit;
u8 taskId;
u8 fadeInActive;
u8 fadeInCounter;
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 isDownpour;
u8 rainStrength;
bool8 cloudSpritesCreated;
u16 snowflakeVisibleCounter;
u16 snowflakeTimer;
u8 snowflakeSpriteCount;
u8 targetSnowflakeSpriteCount;
u16 thunderDelay;
u16 thunderCounter;
bool8 thunderAllowEnd;
bool8 thunderSkipShort;
u8 thunderShortRetries;
bool8 thunderTriggered;
u16 fogHScrollPosX;
u16 fogHScrollCounter;
u16 fogHScrollOffset;
u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount;
bool8 fogHSpritesCreated;
u16 ashBaseSpritesX;
u16 ashUnused;
bool8 ashSpritesCreated;
u32 sandstormXOffset;
u32 sandstormYOffset;
u8 filler_70C[2];
u16 sandstormBaseSpritesX;
u16 sandstormPosY;
u16 sandstormWaveIndex;
u16 sandstormWaveCounter;
bool8 sandstormSpritesCreated;
bool8 sandstormSwirlSpritesCreated;
u16 fogDBaseSpritesX;
u16 fogDPosY;
u16 fogDScrollXCounter;
u16 fogDScrollYCounter;
u16 fogDXOffset;
u16 fogDYOffset;
bool8 fogDSpritesCreated;
u16 bubblesDelayCounter;
u16 bubblesDelayIndex;
u16 bubblesCoordsIndex;
u16 bubblesSpriteCount;
bool8 bubblesSpritesCreated;
u16 currBlendEVA;
u16 currBlendEVB;
u16 targetBlendEVA;
u16 targetBlendEVB;
u8 blendUpdateCounter;
u8 blendFrameCounter;
u8 blendDelay;
s16 droughtBrightnessStage;
s16 droughtLastBrightnessStage;
s16 droughtTimer;
s16 droughtState;
u8 filler_744[0xD-4];
s8 loadDroughtPalsIndex;
u8 loadDroughtPalsOffset;
};
extern struct Weather *const gWeatherPtr;
void FadeScreen(u8 mode, s8 delay);
void SetSavedWeather(u32);
u8 GetSav1Weather(void);
void DoCurrentWeather(void);
void SetSavedWeatherFromCurrMapHeader(void);
void SlightlyDarkenPalsInWeather(u16 *, u16 *, u32);
void PlayRainStoppingSoundEffect(void);
bool8 IsWeatherNotFadingIn(void);
void SetWeatherScreenFadeOut(void);
void WeatherProcessingIdle(void);
u8 GetCurrentWeather(void);
void delay(u8, u8, u32);
void UpdateSpritePaletteWithWeather(u8 palIdx);
void ResetPreservedPalettesInWeather(void);
void PreservePaletteInWeather(u8 palIdx);
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 WeatherShiftGammaIfPalStateIdle(s8 gammaIndex);
void WeatherBeginGammaFade(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay);
void ApplyWeatherGammaShiftToPal(u8 paletteIndex);
void StartWeather(void);
void ResumePausedWeather(void);
void FadeSelectedPals(u8 mode, s8 delay, u32 selectedPalettes);
extern const u16 gCloudsWeatherPalette[];
extern const u16 gSandstormWeatherPalette[];
extern const u8 gWeatherFogDiagonalTiles[];
extern const u8 gWeatherFogHorizontalTiles[];
extern const u8 gWeatherCloudTiles[];
extern const u8 gWeatherSnow1Tiles[];
extern const u8 gWeatherSnow2Tiles[];
extern const u8 gWeatherBubbleTiles[];
extern const u8 gWeatherAshTiles[];
extern const u8 gWeatherRainTiles[];
extern const u8 gWeatherSandstormTiles[];
#endif // GUARD_WEATHER_H