summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2017-12-25 14:56:02 -0600
committerMarcus Huderle <huderlem@gmail.com>2017-12-26 16:08:39 -0600
commit6000e19e94c36b5d4b8c45b829b0506191282b44 (patch)
tree46fd27e466e21ebf4125479e1dad21a6961d1544
parente3078400bbdb3e8416806127290b9a2d68cfb3b8 (diff)
Add coord_weather_event macro, and define COORD_EVENT_WEATHER_* constants
-rw-r--r--asm/macros/map.inc4
-rw-r--r--constants/battle.inc8
-rw-r--r--data/battle_ai_scripts.s36
-rw-r--r--data/map_events.s1
-rw-r--r--data/maps/events/JaggedPass.inc10
-rw-r--r--data/maps/events/Route113.inc38
-rw-r--r--data/maps/events/Route119.inc46
-rw-r--r--data/maps/events/Route120.inc38
-rw-r--r--data/maps/events/Route123.inc44
-rw-r--r--include/constants/weather.h39
-rw-r--r--include/field_weather.h12
-rw-r--r--src/battle/battle_3.c11
-rw-r--r--src/field/coord_event_weather.c87
-rw-r--r--src/field/field_weather.c25
-rw-r--r--src/field/field_weather_effects.c1
15 files changed, 218 insertions, 182 deletions
diff --git a/asm/macros/map.inc b/asm/macros/map.inc
index 9c68e8414..a80a662b4 100644
--- a/asm/macros/map.inc
+++ b/asm/macros/map.inc
@@ -40,6 +40,10 @@
inc _num_traps
.endm
+ .macro coord_weather_event x, y, height, weather
+ coord_event \x, \y, \height, 0, \weather, 0, 0, 0x0
+ .endm
+
.macro bg_event x, y, byte, kind, word, arg6, arg7, arg8
.2byte \x, \y
.byte \byte, \kind
diff --git a/constants/battle.inc b/constants/battle.inc
index 94b7a6d48..dfaa14779 100644
--- a/constants/battle.inc
+++ b/constants/battle.inc
@@ -40,10 +40,10 @@
.equiv TARGET, 0
.equiv USER, 1
-.equiv WEATHER_SUN, 0
-.equiv WEATHER_RAIN, 1
-.equiv WEATHER_SANDSTORM, 2
-.equiv WEATHER_HAIL, 3
+.equiv BATTLE_WEATHER_SUN, 0
+.equiv BATTLE_WEATHER_RAIN, 1
+.equiv BATTLE_WEATHER_SANDSTORM, 2
+.equiv BATTLE_WEATHER_HAIL, 3
enum_start 1
enum ATTACK
diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s
index 7c58160f6..270386359 100644
--- a/data/battle_ai_scripts.s
+++ b/data/battle_ai_scripts.s
@@ -439,7 +439,7 @@ AI_CBM_PerishSong: @ 81DA6BB
AI_CBM_Sandstorm: @ 81DA6C6
get_weather
- if_equal WEATHER_SANDSTORM, Score_Down8
+ if_equal BATTLE_WEATHER_SANDSTORM, Score_Down8
end
AI_CBM_Attract: @ 81DA6CE
@@ -479,12 +479,12 @@ AI_CBM_BatonPass: @ 81DA729
AI_CBM_RainDance: @ 81DA732
get_weather
- if_equal WEATHER_RAIN, Score_Down8
+ if_equal BATTLE_WEATHER_RAIN, Score_Down8
end
AI_CBM_SunnyDay: @ 81DA73A
get_weather
- if_equal WEATHER_SUN, Score_Down8
+ if_equal BATTLE_WEATHER_SUN, Score_Down8
end
AI_CBM_FutureSight: @ 81DA742
@@ -509,7 +509,7 @@ AI_CBM_SpitUpAndSwallow: @ 81DA75F
AI_CBM_Hail: @ 81DA76E
get_weather
- if_equal WEATHER_HAIL, Score_Down8
+ if_equal BATTLE_WEATHER_HAIL, Score_Down8
end
AI_CBM_Torment: @ 81DA776
@@ -1361,9 +1361,9 @@ AI_CV_Conversion_End: @ 81DB190
AI_CV_HealWeather: @ 81DB191
get_weather
- if_equal WEATHER_HAIL, AI_CV_HealWeather_ScoreDown2
- if_equal WEATHER_RAIN, AI_CV_HealWeather_ScoreDown2
- if_equal WEATHER_SANDSTORM, AI_CV_HealWeather_ScoreDown2
+ if_equal BATTLE_WEATHER_HAIL, AI_CV_HealWeather_ScoreDown2
+ if_equal BATTLE_WEATHER_RAIN, AI_CV_HealWeather_ScoreDown2
+ if_equal BATTLE_WEATHER_SANDSTORM, AI_CV_HealWeather_ScoreDown2
jump AI_CV_Heal
AI_CV_HealWeather_ScoreDown2: @ 81DB1A9
@@ -2107,9 +2107,9 @@ AI_CV_RainDance: @ 81DB8E9
AI_CV_RainDance2: @ 81DB8F7
if_hp_less_than USER, 40, AI_CV_RainDance_ScoreDown1
get_weather
- if_equal WEATHER_HAIL, AI_CV_RainDance3
- if_equal WEATHER_SUN, AI_CV_RainDance3
- if_equal WEATHER_SANDSTORM, AI_CV_RainDance3
+ if_equal BATTLE_WEATHER_HAIL, AI_CV_RainDance3
+ if_equal BATTLE_WEATHER_SUN, AI_CV_RainDance3
+ if_equal BATTLE_WEATHER_SANDSTORM, AI_CV_RainDance3
get_ability USER
if_equal ABILITY_RAIN_DISH, AI_CV_RainDance3
jump AI_CV_RainDance_End
@@ -2127,9 +2127,9 @@ AI_CV_RainDance_End: @ 81DB927
AI_CV_SunnyDay: @ 81DB928
if_hp_less_than USER, 40, AI_CV_SunnyDay_ScoreDown1
get_weather
- if_equal WEATHER_HAIL, AI_CV_SunnyDay2
- if_equal WEATHER_RAIN, AI_CV_SunnyDay2
- if_equal WEATHER_SANDSTORM, AI_CV_SunnyDay2
+ if_equal BATTLE_WEATHER_HAIL, AI_CV_SunnyDay2
+ if_equal BATTLE_WEATHER_RAIN, AI_CV_SunnyDay2
+ if_equal BATTLE_WEATHER_SANDSTORM, AI_CV_SunnyDay2
jump AI_CV_SunnyDay_End
AI_CV_SunnyDay2: @ 81DB947
@@ -2264,8 +2264,8 @@ AI_CV_Fly2: @ 81DBA9F
if_status2 TARGET, S_CURSED, AI_CV_Fly6
if_status3 TARGET, S_LEECH_SEED, AI_CV_Fly6
get_weather
- if_equal WEATHER_HAIL, AI_CV_Fly3
- if_equal WEATHER_SANDSTORM, AI_CV_Fly4
+ if_equal BATTLE_WEATHER_HAIL, AI_CV_Fly3
+ if_equal BATTLE_WEATHER_SANDSTORM, AI_CV_Fly4
jump AI_CV_Fly5
AI_CV_Fly3: @ 81DBACF
@@ -2317,9 +2317,9 @@ AI_CV_SpitUp_End: @ 81DBB2E
AI_CV_Hail: @ 81DBB2F
if_hp_less_than USER, 40, AI_CV_Hail_ScoreDown1
get_weather
- if_equal WEATHER_SUN, AI_CV_Hail2
- if_equal WEATHER_RAIN, AI_CV_Hail2
- if_equal WEATHER_SANDSTORM, AI_CV_Hail2
+ if_equal BATTLE_WEATHER_SUN, AI_CV_Hail2
+ if_equal BATTLE_WEATHER_RAIN, AI_CV_Hail2
+ if_equal BATTLE_WEATHER_SANDSTORM, AI_CV_Hail2
jump AI_CV_Hail_End
AI_CV_Hail2: @ 81DBB4E
diff --git a/data/map_events.s b/data/map_events.s
index 0a2a25fb0..6bfcc0292 100644
--- a/data/map_events.s
+++ b/data/map_events.s
@@ -3,6 +3,7 @@
#include "constants/map_objects.h"
#include "constants/maps.h"
#include "constants/vars.h"
+#include "constants/weather.h"
.include "asm/macros.inc"
.include "constants/constants.inc"
diff --git a/data/maps/events/JaggedPass.inc b/data/maps/events/JaggedPass.inc
index 654cbb9ae..a41d8ac7d 100644
--- a/data/maps/events/JaggedPass.inc
+++ b/data/maps/events/JaggedPass.inc
@@ -11,11 +11,11 @@ JaggedPass_MapWarps:: @ 838C67C
warp_def 14, 5, 3, 3, MAP_MT_CHIMNEY
JaggedPass_MapCoordEvents:: @ 838C69C
- coord_event 13, 15, 3, 0, 2, 0, 0, 0x0
- coord_event 21, 12, 3, 0, 8, 0, 0, 0x0
- coord_event 14, 15, 3, 0, 2, 0, 0, 0x0
- coord_event 18, 17, 3, 0, 2, 0, 0, 0x0
- coord_event 22, 19, 3, 0, 2, 0, 0, 0x0
+ coord_weather_event 13, 15, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 21, 12, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 14, 15, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 18, 17, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 22, 19, 3, COORD_EVENT_WEATHER_SUNNY
JaggedPass_MapBGEvents:: @ 838C6EC
bg_event 8, 10, 3, 7, 0, ITEM_FULL_HEAL, 77, 0
diff --git a/data/maps/events/Route113.inc b/data/maps/events/Route113.inc
index dec48e2e1..7a39850fd 100644
--- a/data/maps/events/Route113.inc
+++ b/data/maps/events/Route113.inc
@@ -15,25 +15,25 @@ Route113_MapWarps:: @ 8382AA8
warp_def 33, 5, 0, 0, MAP_ROUTE113_GLASS_WORKSHOP
Route113_MapCoordEvents:: @ 8382AB0
- coord_event 19, 11, 3, 0, 8, 0, 0, 0x0
- coord_event 19, 10, 3, 0, 8, 0, 0, 0x0
- coord_event 19, 12, 3, 0, 8, 0, 0, 0x0
- coord_event 19, 13, 3, 0, 8, 0, 0, 0x0
- coord_event 87, 9, 3, 0, 8, 0, 0, 0x0
- coord_event 86, 10, 3, 0, 8, 0, 0, 0x0
- coord_event 86, 11, 3, 0, 8, 0, 0, 0x0
- coord_event 14, 10, 3, 0, 2, 0, 0, 0x0
- coord_event 14, 11, 3, 0, 2, 0, 0, 0x0
- coord_event 14, 12, 3, 0, 2, 0, 0, 0x0
- coord_event 14, 13, 3, 0, 2, 0, 0, 0x0
- coord_event 94, 8, 3, 0, 2, 0, 0, 0x0
- coord_event 94, 9, 3, 0, 2, 0, 0, 0x0
- coord_event 94, 10, 3, 0, 2, 0, 0, 0x0
- coord_event 94, 11, 0, 0, 2, 0, 0, 0x0
- coord_event 19, 14, 3, 0, 8, 0, 0, 0x0
- coord_event 88, 8, 3, 0, 8, 0, 0, 0x0
- coord_event 88, 6, 3, 0, 8, 0, 0, 0x0
- coord_event 88, 7, 3, 0, 8, 0, 0, 0x0
+ coord_weather_event 19, 11, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 19, 10, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 19, 12, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 19, 13, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 87, 9, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 86, 10, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 86, 11, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 14, 10, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 14, 11, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 14, 12, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 14, 13, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 94, 8, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 94, 9, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 94, 10, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 94, 11, 0, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 19, 14, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 88, 8, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 88, 6, 3, COORD_EVENT_WEATHER_ASH
+ coord_weather_event 88, 7, 3, COORD_EVENT_WEATHER_ASH
Route113_MapBGEvents:: @ 8382BE0
bg_event 85, 6, 0, 0, 0, Route113_EventScript_150617
diff --git a/data/maps/events/Route119.inc b/data/maps/events/Route119.inc
index ae3cdce20..889f1b000 100644
--- a/data/maps/events/Route119.inc
+++ b/data/maps/events/Route119.inc
@@ -44,29 +44,29 @@ Route119_MapWarps:: @ 8383C8C
Route119_MapCoordEvents:: @ 8383C9C
coord_event 25, 31, 0, 0, VAR_ROUTE119_STATE, 0, 0, Route119_EventScript_1511C5
coord_event 26, 31, 0, 0, VAR_ROUTE119_STATE, 0, 0, Route119_EventScript_1511D0
- coord_event 28, 13, 0, 0, 20, 0, 0, 0x0
- coord_event 29, 13, 3, 0, 20, 0, 0, 0x0
- coord_event 30, 13, 3, 0, 20, 0, 0, 0x0
- coord_event 31, 13, 3, 0, 20, 0, 0, 0x0
- coord_event 32, 13, 3, 0, 20, 0, 0, 0x0
- coord_event 33, 13, 3, 0, 20, 0, 0, 0x0
- coord_event 15, 133, 3, 0, 20, 0, 0, 0x0
- coord_event 16, 132, 3, 0, 20, 0, 0, 0x0
- coord_event 17, 131, 3, 0, 20, 0, 0, 0x0
- coord_event 18, 130, 3, 0, 20, 0, 0, 0x0
- coord_event 19, 131, 3, 0, 20, 0, 0, 0x0
- coord_event 20, 132, 3, 0, 20, 0, 0, 0x0
- coord_event 21, 133, 3, 0, 20, 0, 0, 0x0
- coord_event 36, 6, 3, 0, 2, 0, 0, 0x0
- coord_event 36, 7, 3, 0, 2, 0, 0, 0x0
- coord_event 35, 8, 3, 0, 2, 0, 0, 0x0
- coord_event 35, 9, 3, 0, 2, 0, 0, 0x0
- coord_event 34, 10, 3, 0, 2, 0, 0, 0x0
- coord_event 16, 137, 3, 0, 2, 0, 0, 0x0
- coord_event 17, 137, 3, 0, 2, 0, 0, 0x0
- coord_event 18, 137, 3, 0, 2, 0, 0, 0x0
- coord_event 19, 137, 3, 0, 2, 0, 0, 0x0
- coord_event 20, 137, 3, 0, 2, 0, 0, 0x0
+ coord_weather_event 28, 13, 0, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 29, 13, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 30, 13, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 31, 13, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 32, 13, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 33, 13, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 15, 133, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 16, 132, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 17, 131, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 18, 130, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 19, 131, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 20, 132, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 21, 133, 3, COORD_EVENT_WEATHER_ROUTE119_CYCLE
+ coord_weather_event 36, 6, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 36, 7, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 35, 8, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 35, 9, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 34, 10, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 16, 137, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 17, 137, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 18, 137, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 19, 137, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 20, 137, 3, COORD_EVENT_WEATHER_SUNNY
Route119_MapBGEvents:: @ 8383E2C
bg_event 9, 33, 0, 0, 0, Route119_EventScript_15142C
diff --git a/data/maps/events/Route120.inc b/data/maps/events/Route120.inc
index 4ddfe4978..65fa580b3 100644
--- a/data/maps/events/Route120.inc
+++ b/data/maps/events/Route120.inc
@@ -46,25 +46,25 @@ Route120_MapWarps:: @ 8384308
warp_def 19, 23, 1, 0, MAP_SCORCHED_SLAB
Route120_MapCoordEvents:: @ 8384318
- coord_event 7, 15, 0, 0, 3, 0, 0, 0x0
- coord_event 7, 16, 0, 0, 3, 0, 0, 0x0
- coord_event 22, 61, 3, 0, 3, 0, 0, 0x0
- coord_event 12, 64, 3, 0, 3, 0, 0, 0x0
- coord_event 35, 63, 3, 0, 1, 0, 0, 0x0
- coord_event 36, 63, 3, 0, 1, 0, 0, 0x0
- coord_event 37, 63, 3, 0, 1, 0, 0, 0x0
- coord_event 38, 63, 3, 0, 1, 0, 0, 0x0
- coord_event 32, 88, 5, 0, 1, 0, 0, 0x0
- coord_event 28, 15, 0, 0, 2, 0, 0, 0x0
- coord_event 28, 16, 0, 0, 2, 0, 0, 0x0
- coord_event 28, 17, 3, 0, 2, 0, 0, 0x0
- coord_event 32, 89, 5, 0, 1, 0, 0, 0x0
- coord_event 32, 90, 5, 0, 1, 0, 0, 0x0
- coord_event 32, 91, 5, 0, 1, 0, 0, 0x0
- coord_event 10, 75, 3, 0, 1, 0, 0, 0x0
- coord_event 11, 75, 3, 0, 1, 0, 0, 0x0
- coord_event 12, 75, 3, 0, 1, 0, 0, 0x0
- coord_event 13, 75, 3, 0, 1, 0, 0, 0x0
+ coord_weather_event 7, 15, 0, COORD_EVENT_WEATHER_RAIN_LIGHT
+ coord_weather_event 7, 16, 0, COORD_EVENT_WEATHER_RAIN_LIGHT
+ coord_weather_event 22, 61, 3, COORD_EVENT_WEATHER_RAIN_LIGHT
+ coord_weather_event 12, 64, 3, COORD_EVENT_WEATHER_RAIN_LIGHT
+ coord_weather_event 35, 63, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 36, 63, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 37, 63, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 38, 63, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 32, 88, 5, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 28, 15, 0, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 28, 16, 0, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 28, 17, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 32, 89, 5, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 32, 90, 5, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 32, 91, 5, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 10, 75, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 11, 75, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 12, 75, 3, COORD_EVENT_WEATHER_CLOUDS
+ coord_weather_event 13, 75, 3, COORD_EVENT_WEATHER_CLOUDS
Route120_MapBGEvents:: @ 8384448
bg_event 27, 3, 3, 0, 0, Route120_EventScript_1519A1
diff --git a/data/maps/events/Route123.inc b/data/maps/events/Route123.inc
index ff4f066b8..a861aa4fc 100644
--- a/data/maps/events/Route123.inc
+++ b/data/maps/events/Route123.inc
@@ -38,28 +38,28 @@ Route123_MapWarps:: @ 8384B28
warp_def 22, 6, 0, 0, MAP_ROUTE123_BERRY_MASTERS_HOUSE
Route123_MapCoordEvents:: @ 8384B30
- coord_event 90, 16, 3, 0, 21, 0, 0, 0x0
- coord_event 92, 9, 3, 0, 21, 0, 0, 0x0
- coord_event 93, 12, 3, 0, 21, 0, 0, 0x0
- coord_event 92, 13, 3, 0, 21, 0, 0, 0x0
- coord_event 91, 14, 3, 0, 21, 0, 0, 0x0
- coord_event 19, 13, 3, 0, 21, 0, 0, 0x0
- coord_event 19, 12, 3, 0, 21, 0, 0, 0x0
- coord_event 34, 13, 3, 0, 21, 0, 0, 0x0
- coord_event 19, 14, 3, 0, 21, 0, 0, 0x0
- coord_event 19, 15, 3, 0, 21, 0, 0, 0x0
- coord_event 19, 16, 3, 0, 21, 0, 0, 0x0
- coord_event 108, 14, 3, 0, 2, 0, 0, 0x0
- coord_event 109, 15, 3, 0, 2, 0, 0, 0x0
- coord_event 110, 16, 3, 0, 2, 0, 0, 0x0
- coord_event 111, 17, 3, 0, 2, 0, 0, 0x0
- coord_event 112, 18, 3, 0, 2, 0, 0, 0x0
- coord_event 9, 12, 3, 0, 2, 0, 0, 0x0
- coord_event 9, 13, 3, 0, 2, 0, 0, 0x0
- coord_event 9, 14, 3, 0, 2, 0, 0, 0x0
- coord_event 9, 15, 3, 0, 2, 0, 0, 0x0
- coord_event 9, 16, 3, 0, 2, 0, 0, 0x0
- coord_event 94, 10, 3, 0, 21, 0, 0, 0x0
+ coord_weather_event 90, 16, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 92, 9, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 93, 12, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 92, 13, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 91, 14, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 19, 13, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 19, 12, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 34, 13, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 19, 14, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 19, 15, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 19, 16, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
+ coord_weather_event 108, 14, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 109, 15, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 110, 16, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 111, 17, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 112, 18, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 9, 12, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 9, 13, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 9, 14, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 9, 15, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 9, 16, 3, COORD_EVENT_WEATHER_SUNNY
+ coord_weather_event 94, 10, 3, COORD_EVENT_WEATHER_ROUTE123_CYCLE
Route123_MapBGEvents:: @ 8384C90
bg_event 117, 10, 0, 0, 0, Route123_EventScript_151CBF
diff --git a/include/constants/weather.h b/include/constants/weather.h
new file mode 100644
index 000000000..946316984
--- /dev/null
+++ b/include/constants/weather.h
@@ -0,0 +1,39 @@
+#ifndef GUARD_CONSTANTS_WEATHER_H
+#define GUARD_CONSTANTS_WEATHER_H
+
+#define WEATHER_NONE 0
+#define WEATHER_CLOUDS 1
+#define WEATHER_SUNNY 2
+#define WEATHER_RAIN_LIGHT 3
+#define WEATHER_SNOW 4
+#define WEATHER_RAIN_MED 5
+#define WEATHER_FOG_1 6
+#define WEATHER_ASH 7
+#define WEATHER_SANDSTORM 8
+#define WEATHER_FOG_2 9
+#define WEATHER_FOG_3 10
+#define WEATHER_DARK 11
+#define WEATHER_DROUGHT 12
+#define WEATHER_RAIN_HEAVY 13
+#define WEATHER_BUBBLES 14
+#define WEATHER_ROUTE119_CYCLE 20
+#define WEATHER_ROUTE123_CYCLE 21
+
+// These are used in maps' coord_weather_event entries.
+// They are not a one-to-one mapping with the engine's
+// internal weather constants above.
+#define COORD_EVENT_WEATHER_CLOUDS 1
+#define COORD_EVENT_WEATHER_SUNNY 2
+#define COORD_EVENT_WEATHER_RAIN_LIGHT 3
+#define COORD_EVENT_WEATHER_SNOW 4
+#define COORD_EVENT_WEATHER_RAIN_MED 5
+#define COORD_EVENT_WEATHER_FOG_1 6
+#define COORD_EVENT_WEATHER_FOG_2 7
+#define COORD_EVENT_WEATHER_ASH 8
+#define COORD_EVENT_WEATHER_SANDSTORM 9
+#define COORD_EVENT_WEATHER_DARK 10
+#define COORD_EVENT_WEATHER_DROUGHT 11
+#define COORD_EVENT_WEATHER_ROUTE119_CYCLE 20
+#define COORD_EVENT_WEATHER_ROUTE123_CYCLE 21
+
+#endif // GUARD_CONSTANTS_WEATHER_H
diff --git a/include/field_weather.h b/include/field_weather.h
index ed16b2bf6..c96d4055e 100644
--- a/include/field_weather.h
+++ b/include/field_weather.h
@@ -1,18 +1,6 @@
#ifndef GUARD_WEATHER_H
#define GUARD_WEATHER_H
-#define WEATHER_NONE 0
-#define WEATHER_CLOUDS 1
-#define WEATHER_RAIN_LIGHT 3
-#define WEATHER_SNOW 4
-#define WEATHER_RAIN_MED 5
-#define WEATHER_FOG_1 6
-#define WEATHER_ASH 7
-#define WEATHER_FOG_2 9
-#define WEATHER_DROUGHT 12
-#define WEATHER_RAIN_HEAVY 13
-#define WEATHER_BUBBLES 14
-
struct Sprite;
struct Weather
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"