diff options
author | Marcus Huderle <huderlem@gmail.com> | 2017-12-25 14:56:02 -0600 |
---|---|---|
committer | Marcus Huderle <huderlem@gmail.com> | 2017-12-26 16:08:39 -0600 |
commit | 6000e19e94c36b5d4b8c45b829b0506191282b44 (patch) | |
tree | 46fd27e466e21ebf4125479e1dad21a6961d1544 /src | |
parent | e3078400bbdb3e8416806127290b9a2d68cfb3b8 (diff) |
Add coord_weather_event macro, and define COORD_EVENT_WEATHER_* constants
Diffstat (limited to 'src')
-rw-r--r-- | src/battle/battle_3.c | 11 | ||||
-rw-r--r-- | src/field/coord_event_weather.c | 87 | ||||
-rw-r--r-- | src/field/field_weather.c | 25 | ||||
-rw-r--r-- | src/field/field_weather_effects.c | 1 |
4 files changed, 64 insertions, 60 deletions
diff --git a/src/battle/battle_3.c b/src/battle/battle_3.c index f627e50f0..b21ec1572 100644 --- a/src/battle/battle_3.c +++ b/src/battle/battle_3.c @@ -7,6 +7,7 @@ #include "event_data.h" #include "constants/hold_effects.h" #include "constants/species.h" +#include "constants/weather.h" #include "pokemon.h" #include "data2.h" #include "random.h" @@ -1500,9 +1501,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) //_08018586 switch (weather_get_current()) { - case 3: - case 5: - case 13: + case WEATHER_RAIN_LIGHT: + case WEATHER_RAIN_MED: + case WEATHER_RAIN_HEAVY: if (!(gBattleWeather & WEATHER_RAIN_ANY)) { gBattleWeather = (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_PERMANENT); @@ -1511,7 +1512,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) effect++; } break; - case 8: + case WEATHER_SANDSTORM: if (!(gBattleWeather & WEATHER_SANDSTORM_ANY)) { gBattleWeather = (WEATHER_SANDSTORM_PERMANENT | WEATHER_SANDSTORM_TEMPORARY); @@ -1520,7 +1521,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) effect++; } break; - case 12: + case WEATHER_DROUGHT: if (!(gBattleWeather & WEATHER_SUN_ANY)) { gBattleWeather = (WEATHER_SUN_PERMANENT | WEATHER_SUN_TEMPORARY); diff --git a/src/field/coord_event_weather.c b/src/field/coord_event_weather.c index 9c5a1ca4d..db4e9c161 100644 --- a/src/field/coord_event_weather.c +++ b/src/field/coord_event_weather.c @@ -1,115 +1,116 @@ #include "global.h" +#include "constants/weather.h" #include "coord_event_weather.h" #include "field_weather.h" struct CoordEventWeather { - u8 weather; + u8 coordEventWeather; void (*func)(void); }; -static void CoordEventWeather_Indoor(void); +static void CoordEventWeather_Clouds(void); static void CoordEventWeather_Sunny(void); -static void CoordEventWeather_Rain(void); -static void CoordEventWeather_Snowflakes(void); +static void CoordEventWeather_LightRain(void); +static void CoordEventWeather_Snow(void); static void CoordEventWeather_Thunderstorm(void); static void CoordEventWeather_Fog(void); static void CoordEventWeather_DiagonalFog(void); -static void CoordEventWeather_Snow(void); +static void CoordEventWeather_Ash(void); static void CoordEventWeather_Sandstorm(void); -static void CoordEventWeather_Cloudy(void); +static void CoordEventWeather_Dark(void); static void CoordEventWeather_Drought(void); -static void CoordEventWeather_UnderwaterFog(void); -static void CoordEventWeather_UnderwaterBubbles(void); +static void CoordEventWeather_Route119Cycle(void); +static void CoordEventWeather_Route123Cycle(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 }, + { COORD_EVENT_WEATHER_CLOUDS, CoordEventWeather_Clouds }, + { COORD_EVENT_WEATHER_SUNNY, CoordEventWeather_Sunny }, + { COORD_EVENT_WEATHER_RAIN_LIGHT, CoordEventWeather_LightRain }, + { COORD_EVENT_WEATHER_SNOW, CoordEventWeather_Snow }, + { COORD_EVENT_WEATHER_RAIN_MED, CoordEventWeather_Thunderstorm }, + { COORD_EVENT_WEATHER_FOG_1, CoordEventWeather_Fog }, + { COORD_EVENT_WEATHER_FOG_2, CoordEventWeather_DiagonalFog }, + { COORD_EVENT_WEATHER_ASH, CoordEventWeather_Ash }, + { COORD_EVENT_WEATHER_SANDSTORM, CoordEventWeather_Sandstorm }, + { COORD_EVENT_WEATHER_DARK, CoordEventWeather_Dark }, + { COORD_EVENT_WEATHER_DROUGHT, CoordEventWeather_Drought }, + { COORD_EVENT_WEATHER_ROUTE119_CYCLE, CoordEventWeather_Route119Cycle }, + { COORD_EVENT_WEATHER_ROUTE123_CYCLE, CoordEventWeather_Route123Cycle }, }; -static void CoordEventWeather_Indoor(void) +static void CoordEventWeather_Clouds(void) { - SetWeather(1); + SetWeather(WEATHER_CLOUDS); } static void CoordEventWeather_Sunny(void) { - SetWeather(2); + SetWeather(WEATHER_SUNNY); } -static void CoordEventWeather_Rain(void) +static void CoordEventWeather_LightRain(void) { - SetWeather(3); + SetWeather(WEATHER_RAIN_LIGHT); } -static void CoordEventWeather_Snowflakes(void) +static void CoordEventWeather_Snow(void) { - SetWeather(4); + SetWeather(WEATHER_SNOW); } static void CoordEventWeather_Thunderstorm(void) { - SetWeather(5); + SetWeather(WEATHER_RAIN_MED); } static void CoordEventWeather_Fog(void) { - SetWeather(6); + SetWeather(WEATHER_FOG_1); } static void CoordEventWeather_DiagonalFog(void) { - SetWeather(9); + SetWeather(WEATHER_FOG_2); } -static void CoordEventWeather_Snow(void) +static void CoordEventWeather_Ash(void) { - SetWeather(7); + SetWeather(WEATHER_ASH); } static void CoordEventWeather_Sandstorm(void) { - SetWeather(8); + SetWeather(WEATHER_SANDSTORM); } -static void CoordEventWeather_Cloudy(void) +static void CoordEventWeather_Dark(void) { - SetWeather(11); + SetWeather(WEATHER_DARK); } static void CoordEventWeather_Drought(void) { - SetWeather(12); + SetWeather(WEATHER_DROUGHT); } -static void CoordEventWeather_UnderwaterFog(void) +static void CoordEventWeather_Route119Cycle(void) { - SetWeather(20); + SetWeather(WEATHER_ROUTE119_CYCLE); } -static void CoordEventWeather_UnderwaterBubbles(void) +static void CoordEventWeather_Route123Cycle(void) { - SetWeather(21); + SetWeather(WEATHER_ROUTE123_CYCLE); } -void DoCoordEventWeather(u8 n) +void DoCoordEventWeather(u8 coordEventWeather) { u8 i; for (i = 0; i < ARRAY_COUNT(sCoordEventWeatherFuncs); i++) { - if (sCoordEventWeatherFuncs[i].weather == n) + if (sCoordEventWeatherFuncs[i].coordEventWeather == coordEventWeather) { sCoordEventWeatherFuncs[i].func(); return; diff --git a/src/field/field_weather.c b/src/field/field_weather.c index 19ccca3bf..4a819bddf 100644 --- a/src/field/field_weather.c +++ b/src/field/field_weather.c @@ -5,6 +5,7 @@ #include "palette.h" #include "random.h" #include "script.h" +#include "constants/weather.h" #include "constants/songs.h" #include "sound.h" #include "sprite.h" @@ -397,31 +398,31 @@ void sub_807CCAC(void) case WEATHER_RAIN_MED: case WEATHER_RAIN_HEAVY: case WEATHER_SNOW: - case 11: + case WEATHER_DARK: if (sub_807CDC4() == 0) { gWeatherPtr->unknown_6C0 = 3; gWeatherPtr->unknown_6C6 = 3; } break; - case 12: + case WEATHER_DROUGHT: if (sub_807CE24() == 0) { gWeatherPtr->unknown_6C0 = -6; gWeatherPtr->unknown_6C6 = 3; } break; - case 6: + case WEATHER_FOG_1: if (sub_807CE7C() == 0) { gWeatherPtr->unknown_6C0 = 0; gWeatherPtr->unknown_6C6 = 3; } break; - case 7: - case 8: - case 9: - case 10: + case WEATHER_ASH: + case WEATHER_SANDSTORM: + case WEATHER_FOG_2: + case WEATHER_FOG_3: default: if (!gPaletteFade.active) { @@ -807,9 +808,9 @@ void fade_screen(u8 a, u8 delay) case WEATHER_RAIN_MED: case WEATHER_RAIN_HEAVY: case WEATHER_SNOW: - case 6: - case 11: - case 12: + case WEATHER_FOG_1: + case WEATHER_DARK: + case WEATHER_DROUGHT: r2 = 1; break; default: @@ -854,7 +855,7 @@ void sub_807D78C(u8 a) case 1: if (gWeatherPtr->unknown_6CA != 0) { - if (gWeatherPtr->currWeather == 6) + if (gWeatherPtr->currWeather == WEATHER_FOG_1) sub_807D540(r4); r4 *= 16; for (i = 0; i < 16; i++) @@ -867,7 +868,7 @@ void sub_807D78C(u8 a) BlendPalette(r4, 16, gPaletteFade.y, gPaletteFade.blendColor); break; default: - if (gWeatherPtr->currWeather != 6) + if (gWeatherPtr->currWeather != WEATHER_FOG_1) { sub_807CEBC(r4, 1, gWeatherPtr->unknown_6C0); } diff --git a/src/field/field_weather_effects.c b/src/field/field_weather_effects.c index 31eda4393..5a59d6c2a 100644 --- a/src/field/field_weather_effects.c +++ b/src/field/field_weather_effects.c @@ -4,6 +4,7 @@ #include "overworld.h" #include "random.h" #include "script.h" +#include "constants/weather.h" #include "constants/songs.h" #include "sound.h" #include "sprite.h" |