pokeemerald/src/coord_event_weather.c

120 lines
3.2 KiB
C
Raw Normal View History

2018-01-29 16:46:56 +01:00
#include "global.h"
#include "constants/weather.h"
#include "coord_event_weather.h"
#include "field_weather.h"
struct CoordEventWeather
{
u8 coordEventWeather;
void (*func)(void);
};
static void CoordEventWeather_Clouds(void);
static void CoordEventWeather_Sunny(void);
2019-12-02 01:19:47 +01:00
static void CoordEventWeather_Rain(void);
2018-01-29 16:46:56 +01:00
static void CoordEventWeather_Snow(void);
static void CoordEventWeather_Thunderstorm(void);
2019-12-02 01:19:47 +01:00
static void CoordEventWeather_HorizontalFog(void);
2018-01-29 16:46:56 +01:00
static void CoordEventWeather_DiagonalFog(void);
static void CoordEventWeather_Ash(void);
static void CoordEventWeather_Sandstorm(void);
2019-12-06 08:27:58 +01:00
static void CoordEventWeather_Shade(void);
2018-01-29 16:46:56 +01:00
static void CoordEventWeather_Drought(void);
static void CoordEventWeather_Route119Cycle(void);
static void CoordEventWeather_Route123Cycle(void);
static const struct CoordEventWeather sCoordEventWeatherFuncs[] =
{
2019-12-06 20:16:07 +01:00
{ COORD_EVENT_WEATHER_SUNNY_CLOUDS, CoordEventWeather_Clouds },
{ COORD_EVENT_WEATHER_SUNNY, CoordEventWeather_Sunny },
{ COORD_EVENT_WEATHER_RAIN, CoordEventWeather_Rain },
{ COORD_EVENT_WEATHER_SNOW, CoordEventWeather_Snow },
2019-12-02 01:19:47 +01:00
{ COORD_EVENT_WEATHER_RAIN_THUNDERSTORM, CoordEventWeather_Thunderstorm },
2019-12-06 20:16:07 +01:00
{ COORD_EVENT_WEATHER_FOG_HORIZONTAL, CoordEventWeather_HorizontalFog },
{ COORD_EVENT_WEATHER_FOG_DIAGONAL, CoordEventWeather_DiagonalFog },
{ COORD_EVENT_WEATHER_VOLCANIC_ASH, CoordEventWeather_Ash },
{ COORD_EVENT_WEATHER_SANDSTORM, CoordEventWeather_Sandstorm },
{ COORD_EVENT_WEATHER_SHADE, CoordEventWeather_Shade },
{ COORD_EVENT_WEATHER_DROUGHT, CoordEventWeather_Drought },
{ COORD_EVENT_WEATHER_ROUTE119_CYCLE, CoordEventWeather_Route119Cycle },
{ COORD_EVENT_WEATHER_ROUTE123_CYCLE, CoordEventWeather_Route123Cycle },
2018-01-29 16:46:56 +01:00
};
static void CoordEventWeather_Clouds(void)
{
2019-12-02 01:19:47 +01:00
SetWeather(WEATHER_SUNNY_CLOUDS);
2018-01-29 16:46:56 +01:00
}
static void CoordEventWeather_Sunny(void)
{
SetWeather(WEATHER_SUNNY);
}
2019-12-02 01:19:47 +01:00
static void CoordEventWeather_Rain(void)
2018-01-29 16:46:56 +01:00
{
2019-12-02 01:19:47 +01:00
SetWeather(WEATHER_RAIN);
2018-01-29 16:46:56 +01:00
}
static void CoordEventWeather_Snow(void)
{
SetWeather(WEATHER_SNOW);
}
static void CoordEventWeather_Thunderstorm(void)
{
2019-12-02 01:19:47 +01:00
SetWeather(WEATHER_RAIN_THUNDERSTORM);
2018-01-29 16:46:56 +01:00
}
2019-12-02 01:19:47 +01:00
static void CoordEventWeather_HorizontalFog(void)
2018-01-29 16:46:56 +01:00
{
2019-12-02 01:19:47 +01:00
SetWeather(WEATHER_FOG_HORIZONTAL);
2018-01-29 16:46:56 +01:00
}
static void CoordEventWeather_DiagonalFog(void)
{
2019-12-02 01:19:47 +01:00
SetWeather(WEATHER_FOG_DIAGONAL);
2018-01-29 16:46:56 +01:00
}
static void CoordEventWeather_Ash(void)
{
2019-12-02 01:19:47 +01:00
SetWeather(WEATHER_VOLCANIC_ASH);
2018-01-29 16:46:56 +01:00
}
static void CoordEventWeather_Sandstorm(void)
{
SetWeather(WEATHER_SANDSTORM);
}
2019-12-06 08:27:58 +01:00
static void CoordEventWeather_Shade(void)
2018-01-29 16:46:56 +01:00
{
2019-12-06 08:27:58 +01:00
SetWeather(WEATHER_SHADE);
2018-01-29 16:46:56 +01:00
}
static void CoordEventWeather_Drought(void)
{
SetWeather(WEATHER_DROUGHT);
}
static void CoordEventWeather_Route119Cycle(void)
{
SetWeather(WEATHER_ROUTE119_CYCLE);
}
static void CoordEventWeather_Route123Cycle(void)
{
SetWeather(WEATHER_ROUTE123_CYCLE);
}
void DoCoordEventWeather(u8 coordEventWeather)
{
u8 i;
for (i = 0; i < ARRAY_COUNT(sCoordEventWeatherFuncs); i++)
{
if (sCoordEventWeatherFuncs[i].coordEventWeather == coordEventWeather)
{
sCoordEventWeatherFuncs[i].func();
return;
}
}
}