summaryrefslogtreecommitdiff
path: root/src/field/coord_event_weather.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2017-10-01 19:48:31 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2017-10-01 19:52:40 -0400
commit0685dd4920c64eae6bcfbc9f201854b4da91bfab (patch)
treef759feaf819167d436ab4fde480eca35ba591b04 /src/field/coord_event_weather.c
parentd0fbed6ad50c34593002c2b540c4e3e7f4c5cd16 (diff)
parent50dc4f429d4aa68e0365adc71d17e43a0dd7b843 (diff)
Merge branch 'master' into trade
Diffstat (limited to 'src/field/coord_event_weather.c')
-rw-r--r--src/field/coord_event_weather.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/field/coord_event_weather.c b/src/field/coord_event_weather.c
new file mode 100644
index 000000000..9c5a1ca4d
--- /dev/null
+++ b/src/field/coord_event_weather.c
@@ -0,0 +1,118 @@
+#include "global.h"
+#include "coord_event_weather.h"
+#include "field_weather.h"
+
+struct CoordEventWeather
+{
+ u8 weather;
+ void (*func)(void);
+};
+
+static void CoordEventWeather_Indoor(void);
+static void CoordEventWeather_Sunny(void);
+static void CoordEventWeather_Rain(void);
+static void CoordEventWeather_Snowflakes(void);
+static void CoordEventWeather_Thunderstorm(void);
+static void CoordEventWeather_Fog(void);
+static void CoordEventWeather_DiagonalFog(void);
+static void CoordEventWeather_Snow(void);
+static void CoordEventWeather_Sandstorm(void);
+static void CoordEventWeather_Cloudy(void);
+static void CoordEventWeather_Drought(void);
+static void CoordEventWeather_UnderwaterFog(void);
+static void CoordEventWeather_UnderwaterBubbles(void);
+
+static const struct CoordEventWeather sCoordEventWeatherFuncs[] =
+{
+ { 0x1, CoordEventWeather_Indoor },
+ { 0x2, CoordEventWeather_Sunny },
+ { 0x3, CoordEventWeather_Rain },
+ { 0x4, CoordEventWeather_Snowflakes },
+ { 0x5, CoordEventWeather_Thunderstorm },
+ { 0x6, CoordEventWeather_Fog },
+ { 0x7, CoordEventWeather_DiagonalFog },
+ { 0x8, CoordEventWeather_Snow },
+ { 0x9, CoordEventWeather_Sandstorm },
+ { 0xa, CoordEventWeather_Cloudy },
+ { 0xb, CoordEventWeather_Drought },
+ { 0x14, CoordEventWeather_UnderwaterFog },
+ { 0x15, CoordEventWeather_UnderwaterBubbles },
+};
+
+static void CoordEventWeather_Indoor(void)
+{
+ SetWeather(1);
+}
+
+static void CoordEventWeather_Sunny(void)
+{
+ SetWeather(2);
+}
+
+static void CoordEventWeather_Rain(void)
+{
+ SetWeather(3);
+}
+
+static void CoordEventWeather_Snowflakes(void)
+{
+ SetWeather(4);
+}
+
+static void CoordEventWeather_Thunderstorm(void)
+{
+ SetWeather(5);
+}
+
+static void CoordEventWeather_Fog(void)
+{
+ SetWeather(6);
+}
+
+static void CoordEventWeather_DiagonalFog(void)
+{
+ SetWeather(9);
+}
+
+static void CoordEventWeather_Snow(void)
+{
+ SetWeather(7);
+}
+
+static void CoordEventWeather_Sandstorm(void)
+{
+ SetWeather(8);
+}
+
+static void CoordEventWeather_Cloudy(void)
+{
+ SetWeather(11);
+}
+
+static void CoordEventWeather_Drought(void)
+{
+ SetWeather(12);
+}
+
+static void CoordEventWeather_UnderwaterFog(void)
+{
+ SetWeather(20);
+}
+
+static void CoordEventWeather_UnderwaterBubbles(void)
+{
+ SetWeather(21);
+}
+
+void DoCoordEventWeather(u8 n)
+{
+ u8 i;
+ for (i = 0; i < ARRAY_COUNT(sCoordEventWeatherFuncs); i++)
+ {
+ if (sCoordEventWeatherFuncs[i].weather == n)
+ {
+ sCoordEventWeatherFuncs[i].func();
+ return;
+ }
+ }
+}