Identify unused, never read, and never written vars

This commit is contained in:
Phlosioneer 2019-02-27 14:42:32 -05:00
parent c1348d22f3
commit 4137dd7b0b
19 changed files with 112 additions and 110 deletions

View File

@ -3193,7 +3193,7 @@ UnusualWeather_EventScript_EndEventAndCleanup_2:: @ 8273D31
call UnusualWeather_EventScript_CleanupMapTiles call UnusualWeather_EventScript_CleanupMapTiles
special DrawWholeMapView special DrawWholeMapView
setvar VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE setvar VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE
setvar VAR_0x4039, 0 setvar VAR_SHOULD_END_UNUSUAL_WEATHER, 0
clearflag FLAG_SPECIAL_FLAG_0x4000 clearflag FLAG_SPECIAL_FLAG_0x4000
fadescreenswapbuffers 0 fadescreenswapbuffers 0
releaseall releaseall

View File

@ -38,7 +38,7 @@ FarawayIsland_Interior_EventScript_267D5E:: @ 8267D5E
return return
FarawayIsland_Interior_MapScript1_267D72: @ 8267D72 FarawayIsland_Interior_MapScript1_267D72: @ 8267D72
setvar VAR_0x403A, 0 setvar VAR_NEVER_READ_0x403A, 0
setvar VAR_TEMP_1, 1 setvar VAR_TEMP_1, 1
call_if_unset FLAG_CAUGHT_MEW, FarawayIsland_Interior_EventScript_267D86 call_if_unset FLAG_CAUGHT_MEW, FarawayIsland_Interior_EventScript_267D86
end end

View File

@ -47,13 +47,13 @@ MarineCave_End_EventScript_23B01B:: @ 823B01B
goto_if_eq MarineCave_End_EventScript_23B092 goto_if_eq MarineCave_End_EventScript_23B092
compare VAR_RESULT, 5 compare VAR_RESULT, 5
goto_if_eq MarineCave_End_EventScript_23B092 goto_if_eq MarineCave_End_EventScript_23B092
setvar VAR_0x4039, 1 setvar VAR_SHOULD_END_UNUSUAL_WEATHER, 1
setflag FLAG_DEFEATED_KYOGRE setflag FLAG_DEFEATED_KYOGRE
releaseall releaseall
end end
MarineCave_End_EventScript_23B084:: @ 823B084 MarineCave_End_EventScript_23B084:: @ 823B084
setvar VAR_0x4039, 1 setvar VAR_SHOULD_END_UNUSUAL_WEATHER, 1
setflag FLAG_DEFEATED_KYOGRE setflag FLAG_DEFEATED_KYOGRE
goto MarineCave_End_EventScript_27376D goto MarineCave_End_EventScript_27376D
end end

View File

@ -60,7 +60,7 @@ PetalburgCity_Gym_EventScript_204955:: @ 8204955
return return
PetalburgCity_Gym_EventScript_20495D:: @ 820495D PetalburgCity_Gym_EventScript_20495D:: @ 820495D
setorcopyvar VAR_0x8015, 269 setorcopyvar VAR_NEVER_READ_0x8015, 269
specialvar VAR_RESULT, IsTrainerReadyForRematch specialvar VAR_RESULT, IsTrainerReadyForRematch
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq PetalburgCity_Gym_EventScript_204985 goto_if_eq PetalburgCity_Gym_EventScript_204985

View File

@ -18,7 +18,7 @@ Route105_EventScript_1EE20B:: @ 81EE20B
return return
Route105_MapScript1_1EE21E: @ 81EE21E Route105_MapScript1_1EE21E: @ 81EE21E
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route105_EventScript_273D13 call_if_eq Route105_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_105_NORTH compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_105_NORTH
call_if_eq UnusualWeather_StartKyogreWeather call_if_eq UnusualWeather_StartKyogreWeather
@ -27,7 +27,7 @@ Route105_MapScript1_1EE21E: @ 81EE21E
end end
Route105_MapScript2_1EE240: @ 81EE240 Route105_MapScript2_1EE240: @ 81EE240
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route105_EventScript_1EE24A:: @ 81EE24A Route105_EventScript_1EE24A:: @ 81EE24A

View File

@ -5,7 +5,7 @@ Route114_MapScripts:: @ 81F252F
.byte 0 .byte 0
Route114_MapScript1_1F253F: @ 81F253F Route114_MapScript1_1F253F: @ 81F253F
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route114_EventScript_273D13 call_if_eq Route114_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_114_NORTH compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_114_NORTH
call_if_eq UnusualWeather_StartGroudonWeather call_if_eq UnusualWeather_StartGroudonWeather
@ -21,7 +21,7 @@ Route114_MapScript1_1F2561: @ 81F2561
end end
Route114_MapScript2_1F2578: @ 81F2578 Route114_MapScript2_1F2578: @ 81F2578
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route114_EventScript_1F2582:: @ 81F2582 Route114_EventScript_1F2582:: @ 81F2582

View File

@ -12,7 +12,7 @@ Route115_MapScript1_1F2930: @ 81F2930
end end
Route115_MapScript1_1F2947: @ 81F2947 Route115_MapScript1_1F2947: @ 81F2947
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route115_EventScript_273D13 call_if_eq Route115_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_115_WEST compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_115_WEST
call_if_eq UnusualWeather_StartGroudonWeather call_if_eq UnusualWeather_StartGroudonWeather
@ -21,7 +21,7 @@ Route115_MapScript1_1F2947: @ 81F2947
end end
Route115_MapScript2_1F2969: @ 81F2969 Route115_MapScript2_1F2969: @ 81F2969
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route115_EventScript_1F2973:: @ 81F2973 Route115_EventScript_1F2973:: @ 81F2973

View File

@ -6,7 +6,7 @@ Route116_MapScripts:: @ 81F2C0C
Route116_MapScript1_1F2C1C: @ 81F2C1C Route116_MapScript1_1F2C1C: @ 81F2C1C
call_if_set FLAG_RECOVERED_DEVON_GOODS, Route116_EventScript_1F2C47 call_if_set FLAG_RECOVERED_DEVON_GOODS, Route116_EventScript_1F2C47
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route116_EventScript_273D13 call_if_eq Route116_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_116_NORTH compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_116_NORTH
call_if_eq UnusualWeather_StartGroudonWeather call_if_eq UnusualWeather_StartGroudonWeather
@ -26,7 +26,7 @@ Route116_MapScript1_1F2C4F: @ 81F2C4F
end end
Route116_MapScript2_1F2C66: @ 81F2C66 Route116_MapScript2_1F2C66: @ 81F2C66
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route116_EventScript_1F2C70:: @ 81F2C70 Route116_EventScript_1F2C70:: @ 81F2C70

View File

@ -6,7 +6,7 @@ Route118_MapScripts:: @ 81F3DBC
Route118_MapScript1_1F3DCC: @ 81F3DCC Route118_MapScript1_1F3DCC: @ 81F3DCC
call Route118_EventScript_28CCC7 call Route118_EventScript_28CCC7
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route118_EventScript_273D13 call_if_eq Route118_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_118_EAST compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_118_EAST
call_if_eq UnusualWeather_StartGroudonWeather call_if_eq UnusualWeather_StartGroudonWeather
@ -22,7 +22,7 @@ Route118_MapScript1_1F3DF3: @ 81F3DF3
end end
Route118_MapScript2_1F3E0A: @ 81F3E0A Route118_MapScript2_1F3E0A: @ 81F3E0A
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route118_EventScript_1F3E14:: @ 81F3E14 Route118_EventScript_1F3E14:: @ 81F3E14

View File

@ -6,7 +6,7 @@ Route125_MapScripts:: @ 81F6748
Route125_MapScript1_1F6758: @ 81F6758 Route125_MapScript1_1F6758: @ 81F6758
call_if_set FLAG_SYS_WEATHER_CTRL, Common_EventScript_SetWeather15 call_if_set FLAG_SYS_WEATHER_CTRL, Common_EventScript_SetWeather15
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route125_EventScript_273D13 call_if_eq Route125_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_125_WEST compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_125_WEST
call_if_eq UnusualWeather_StartKyogreWeather call_if_eq UnusualWeather_StartKyogreWeather
@ -22,7 +22,7 @@ Route125_MapScript1_1F6783: @ 81F6783
end end
Route125_MapScript2_1F679A: @ 81F679A Route125_MapScript2_1F679A: @ 81F679A
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route125_EventScript_1F67A4:: @ 81F67A4 Route125_EventScript_1F67A4:: @ 81F67A4

View File

@ -6,7 +6,7 @@ Route127_MapScripts:: @ 81F69D9
Route127_MapScript1_1F69E9: @ 81F69E9 Route127_MapScript1_1F69E9: @ 81F69E9
call_if_set FLAG_SYS_WEATHER_CTRL, Common_EventScript_SetWeather15 call_if_set FLAG_SYS_WEATHER_CTRL, Common_EventScript_SetWeather15
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route127_EventScript_273D13 call_if_eq Route127_EventScript_273D13
compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_127_NORTH compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_127_NORTH
call_if_eq UnusualWeather_StartKyogreWeather call_if_eq UnusualWeather_StartKyogreWeather
@ -22,7 +22,7 @@ Route127_MapScript1_1F6A14: @ 81F6A14
end end
Route127_MapScript2_1F6A2B: @ 81F6A2B Route127_MapScript2_1F6A2B: @ 81F6A2B
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route127_EventScript_1F6A35:: @ 81F6A35 Route127_EventScript_1F6A35:: @ 81F6A35

View File

@ -12,7 +12,7 @@ Route129_MapScript1_1F7294: @ 81F7294
end end
Route129_MapScript1_1F72AB: @ 81F72AB Route129_MapScript1_1F72AB: @ 81F72AB
compare VAR_0x4039, 1 compare VAR_SHOULD_END_UNUSUAL_WEATHER, 1
call_if_eq Route129_EventScript_273D13 call_if_eq Route129_EventScript_273D13
compare VAR_0x405E, 4 compare VAR_0x405E, 4
call_if_ge Route129_EventScript_1F72D8 call_if_ge Route129_EventScript_1F72D8
@ -27,7 +27,7 @@ Route129_EventScript_1F72D8:: @ 81F72D8
return return
Route129_MapScript2_1F72E2: @ 81F72E2 Route129_MapScript2_1F72E2: @ 81F72E2
map_script_2 VAR_0x4039, 1, UnusualWeather_EventScript_EndEventAndCleanup_1 map_script_2 VAR_SHOULD_END_UNUSUAL_WEATHER, 1, UnusualWeather_EventScript_EndEventAndCleanup_1
.2byte 0 .2byte 0
Route129_EventScript_1F72EC:: @ 81F72EC Route129_EventScript_1F72EC:: @ 81F72EC

View File

@ -47,13 +47,13 @@ TerraCave_End_EventScript_23B0EC:: @ 823B0EC
goto_if_eq TerraCave_End_EventScript_23B163 goto_if_eq TerraCave_End_EventScript_23B163
compare VAR_RESULT, 5 compare VAR_RESULT, 5
goto_if_eq TerraCave_End_EventScript_23B163 goto_if_eq TerraCave_End_EventScript_23B163
setvar VAR_0x4039, 1 setvar VAR_SHOULD_END_UNUSUAL_WEATHER, 1
setflag FLAG_DEFEATED_GROUDON setflag FLAG_DEFEATED_GROUDON
releaseall releaseall
end end
TerraCave_End_EventScript_23B155:: @ 823B155 TerraCave_End_EventScript_23B155:: @ 823B155
setvar VAR_0x4039, 1 setvar VAR_SHOULD_END_UNUSUAL_WEATHER, 1
setflag FLAG_DEFEATED_GROUDON setflag FLAG_DEFEATED_GROUDON
goto TerraCave_End_EventScript_27376D goto TerraCave_End_EventScript_27376D
end end

View File

@ -72,9 +72,9 @@
#define VAR_DEOXYS_ROCK_LEVEL 0x4035 #define VAR_DEOXYS_ROCK_LEVEL 0x4035
#define VAR_STORAGE_UNKNOWN 0x4036 #define VAR_STORAGE_UNKNOWN 0x4036
#define VAR_UNUSUAL_WEATHER_LOCATION 0x4037 #define VAR_UNUSUAL_WEATHER_LOCATION 0x4037
#define VAR_0x4038 0x4038 #define VAR_UNUSUAL_WEATHER_STEP_COUNTER 0x4038
#define VAR_0x4039 0x4039 #define VAR_SHOULD_END_UNUSUAL_WEATHER 0x4039
#define VAR_0x403A 0x403A #define VAR_NEVER_READ_0x403A 0x403A // Var is written to, but never checked
#define VAR_REGICE_STEPS_1 0x403B #define VAR_REGICE_STEPS_1 0x403B
#define VAR_REGICE_STEPS_2 0x403C #define VAR_REGICE_STEPS_2 0x403C
#define VAR_REGICE_STEPS_3 0x403D #define VAR_REGICE_STEPS_3 0x403D
@ -94,60 +94,60 @@
#define VAR_POKELOT_RND1 0x404B #define VAR_POKELOT_RND1 0x404B
#define VAR_POKELOT_RND2 0x404C #define VAR_POKELOT_RND2 0x404C
#define VAR_0x404D 0x404D #define VAR_0x404D 0x404D
#define VAR_0x404E 0x404E #define VAR_UNUSED_0x404E 0x404E // Unused Var
#define VAR_LOTAD_SIZE_RECORD 0x404F #define VAR_LOTAD_SIZE_RECORD 0x404F
#define VAR_0x4050 0x4050 #define VAR_0x4050 0x4050
#define VAR_ROUTE102_ACCESSIBLE 0x4051 #define VAR_ROUTE102_ACCESSIBLE 0x4051
#define VAR_0x4052 0x4052 #define VAR_UNUSED_0x4052 0x4052 // Unused Var
#define VAR_LAVARIDGE_RIVAL_STATE 0x4053 #define VAR_LAVARIDGE_RIVAL_STATE 0x4053
#define VAR_CURRENT_SECRET_BASE 0x4054 #define VAR_CURRENT_SECRET_BASE 0x4054
#define VAR_0x4055 0x4055 #define VAR_UNUSED_0x4055 0x4055 // Unused Var
#define VAR_0x4056 0x4056 #define VAR_UNUSED_0x4056 0x4056 // Unused Var
#define VAR_PETALBURG_STATE 0x4057 #define VAR_PETALBURG_STATE 0x4057
#define VAR_SLATEPORT_STATE 0x4058 #define VAR_SLATEPORT_STATE 0x4058
#define VAR_0x4059 0x4059 #define VAR_UNUSED_0x4059 0x4059 // Unused Var
#define VAR_RUSTBORO_STATE 0x405A #define VAR_RUSTBORO_STATE 0x405A
#define VAR_0x405B 0x405B #define VAR_UNUSED_0x405B 0x405B // Unused Var
#define VAR_0x405C 0x405C #define VAR_UNUSED_0x405C 0x405C // Unused Var
#define VAR_0x405D 0x405D #define VAR_0x405D 0x405D
#define VAR_0x405E 0x405E #define VAR_0x405E 0x405E
#define VAR_0x405F 0x405F #define VAR_UNUSED_0x405F 0x405F // Unused Var
#define VAR_ROUTE101_STATE 0x4060 #define VAR_ROUTE101_STATE 0x4060
#define VAR_0x4061 0x4061 #define VAR_UNUSED_0x4061 0x4061 // Unused Var
#define VAR_0x4062 0x4062 #define VAR_UNUSED_0x4062 0x4062 // Unused Var
#define VAR_0x4063 0x4063 #define VAR_0x4063 0x4063
#define VAR_0x4064 0x4064 #define VAR_UNUSED_0x4064 0x4064 // Unused Var
#define VAR_0x4065 0x4065 #define VAR_UNUSED_0x4065 0x4065 // Unused Var
#define VAR_0x4066 0x4066 #define VAR_UNUSED_0x4066 0x4066 // Unused Var
#define VAR_0x4067 0x4067 #define VAR_UNUSED_0x4067 0x4067 // Unused Var
#define VAR_0x4068 0x4068 #define VAR_UNUSED_0x4068 0x4068 // Unused Var
#define VAR_ROUTE110_STATE 0x4069 #define VAR_ROUTE110_STATE 0x4069
#define VAR_0x406A 0x406A #define VAR_UNUSED_0x406A 0x406A // Unused Var
#define VAR_0x406B 0x406B #define VAR_UNUSED_0x406B 0x406B // Unused Var
#define VAR_0x406C 0x406C #define VAR_UNUSED_0x406C 0x406C // Unused Var
#define VAR_0x406D 0x406D #define VAR_UNUSED_0x406D 0x406D // Unused Var
#define VAR_0x406E 0x406E #define VAR_UNUSED_0x406E 0x406E // Unused Var
#define VAR_ROUTE116_STATE 0x406F #define VAR_ROUTE116_STATE 0x406F
#define VAR_0x4070 0x4070 #define VAR_UNUSED_0x4070 0x4070 // Unused Var
#define VAR_ROUTE118_STATE 0x4071 #define VAR_ROUTE118_STATE 0x4071
#define VAR_ROUTE119_STATE 0x4072 #define VAR_ROUTE119_STATE 0x4072
#define VAR_0x4073 0x4073 #define VAR_UNUSED_0x4073 0x4073 // Unused Var
#define VAR_ROUTE121_STATE 0x4074 #define VAR_ROUTE121_STATE 0x4074
#define VAR_0x4075 0x4075 #define VAR_UNUSED_0x4075 0x4075 // Unused Var
#define VAR_0x4076 0x4076 #define VAR_UNUSED_0x4076 0x4076 // Unused Var
#define VAR_0x4077 0x4077 #define VAR_UNUSED_0x4077 0x4077 // Unused Var
#define VAR_0x4078 0x4078 #define VAR_UNUSED_0x4078 0x4078 // Unused Var
#define VAR_0x4079 0x4079 #define VAR_UNUSED_0x4079 0x4079 // Unused Var
#define VAR_0x407A 0x407A #define VAR_UNUSED_0x407A 0x407A // Unused Var
#define VAR_ROUTE128_STATE 0x407B #define VAR_ROUTE128_STATE 0x407B
#define VAR_0x407C 0x407C #define VAR_UNUSED_0x407C 0x407C // Unused Var
#define VAR_0x407D 0x407D #define VAR_UNUSED_0x407D 0x407D // Unused Var
#define VAR_0x407E 0x407E #define VAR_UNUSED_0x407E 0x407E // Unused Var
#define VAR_0x407F 0x407F #define VAR_UNUSED_0x407F 0x407F // Unused Var
#define VAR_0x4080 0x4080 #define VAR_UNUSED_0x4080 0x4080 // Unused Var
#define VAR_0x4081 0x4081 #define VAR_UNUSED_0x4081 0x4081 // Unused Var
#define VAR_LITTLEROOT_HOUSES_STATE 0x4082 #define VAR_LITTLEROOT_HOUSES_STATE 0x4082
#define VAR_0x4083 0x4083 #define VAR_UNUSED_0x4083 0x4083 // Unused Var
#define VAR_BIRCH_LAB_STATE 0x4084 #define VAR_BIRCH_LAB_STATE 0x4084
#define VAR_PETALBURG_GYM_STATE 0x4085 #define VAR_PETALBURG_GYM_STATE 0x4085
#define VAR_LINK_CONTEST_ROOM_STATE 0x4086 #define VAR_LINK_CONTEST_ROOM_STATE 0x4086
@ -155,13 +155,13 @@
#define VAR_CONTEST_LOCATION 0x4088 #define VAR_CONTEST_LOCATION 0x4088
#define VAR_0x4089 0x4089 #define VAR_0x4089 0x4089
#define VAR_CONTEST_PRIZE_PICKUP 0x408A #define VAR_CONTEST_PRIZE_PICKUP 0x408A
#define VAR_0x408B 0x408B #define VAR_UNUSED_0x408B 0x408B // Unused Var
#define VAR_LITTLEROOT_HOUSES_STATE_2 0x408C #define VAR_LITTLEROOT_HOUSES_STATE_2 0x408C
#define VAR_LITTLEROOT_RIVAL_STATE 0x408D #define VAR_LITTLEROOT_RIVAL_STATE 0x408D
#define VAR_BOARD_BRINEY_BOAT_ROUTE104_STATE 0x408E #define VAR_BOARD_BRINEY_BOAT_ROUTE104_STATE 0x408E
#define VAR_DEVON_CORP_3F_STATE 0x408F #define VAR_DEVON_CORP_3F_STATE 0x408F
#define VAR_BRINEY_HOUSE_STATE 0x4090 #define VAR_BRINEY_HOUSE_STATE 0x4090
#define VAR_0x4091 0x4091 #define VAR_UNUSED_0x4091 0x4091 // Unused Var
#define VAR_LITTLEROOT_INTRO_STATE 0x4092 #define VAR_LITTLEROOT_INTRO_STATE 0x4092
#define VAR_MAUVILLE_GYM_STATE 0x4093 #define VAR_MAUVILLE_GYM_STATE 0x4093
#define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094 #define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094
@ -171,20 +171,20 @@
#define VAR_PETALBURG_WOODS_STATE 0x4098 #define VAR_PETALBURG_WOODS_STATE 0x4098
#define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099 #define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099
#define VAR_RUSTURF_TUNNEL_STATE 0x409A #define VAR_RUSTURF_TUNNEL_STATE 0x409A
#define VAR_0x409B 0x409B #define VAR_UNUSED_0x409B 0x409B // Unused Var
#define VAR_ELITE_4_STATE 0x409C #define VAR_ELITE_4_STATE 0x409C
#define VAR_0x409D 0x409D #define VAR_UNUSED_0x409D 0x409D // Unused Var
#define VAR_0x409E 0x409E #define VAR_0x409E 0x409E
#define VAR_0x409F 0x409F #define VAR_0x409F 0x409F
#define VAR_SLATEPORT_HARBOR_STATE 0x40A0 #define VAR_SLATEPORT_HARBOR_STATE 0x40A0
#define VAR_0x40A1 0x40A1 #define VAR_UNUSED_0x40A1 0x40A1 // Unused var
#define VAR_SEAFLOOR_CAVERN_STATE 0x40A2 #define VAR_SEAFLOOR_CAVERN_STATE 0x40A2
#define VAR_CABLE_CAR_STATION_STATE 0x40A3 #define VAR_CABLE_CAR_STATION_STATE 0x40A3
#define VAR_SAFARI_ZONE_STATE 0x40A4 #define VAR_SAFARI_ZONE_STATE 0x40A4
#define VAR_TRICK_HOUSE_ENTRANCE_STATE_1 0x40A5 #define VAR_TRICK_HOUSE_ENTRANCE_STATE_1 0x40A5
#define VAR_TRICK_HOUSE_ENTRANCE_STATE_2 0x40A6 #define VAR_TRICK_HOUSE_ENTRANCE_STATE_2 0x40A6
#define VAR_TRICK_HOUSE_ENTRANCE_STATE_3 0x40A7 #define VAR_TRICK_HOUSE_ENTRANCE_STATE_3 0x40A7
#define VAR_0x40A8 0x40A8 #define VAR_UNUSED_0x40A8 0x40A8 // Unused Var
#define VAR_CYCLING_CHALLENGE_STATE 0x40A9 #define VAR_CYCLING_CHALLENGE_STATE 0x40A9
#define VAR_SLATEPORT_MUSEUM_1F_STATE 0x40AA #define VAR_SLATEPORT_MUSEUM_1F_STATE 0x40AA
#define VAR_TRICK_HOUSE_PUZZLE_1_STATE 0x40AB #define VAR_TRICK_HOUSE_PUZZLE_1_STATE 0x40AB
@ -200,10 +200,10 @@
#define VAR_TRICK_HOUSE_STATE 0x40B5 // TODO: needs some further investigation #define VAR_TRICK_HOUSE_STATE 0x40B5 // TODO: needs some further investigation
#define VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 0x40B6 #define VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 0x40B6
#define VAR_SLATEPORT_FAN_CLUB_STATE 0x40B7 #define VAR_SLATEPORT_FAN_CLUB_STATE 0x40B7
#define VAR_0x40B8 0x40B8 #define VAR_UNUSED_0x40B8 0x40B8 // Unused Var
#define VAR_MT_PYRE_STATE 0x40B9 #define VAR_MT_PYRE_STATE 0x40B9
#define VAR_NEW_MAUVILLE_STATE 0x40BA #define VAR_NEW_MAUVILLE_STATE 0x40BA
#define VAR_0x40BB 0x40BB #define VAR_UNUSED_0x40BB 0x40BB // Unused Var
#define VAR_BRAVO_TRAINER_BATTLE_TOWER_ON 0x40BC #define VAR_BRAVO_TRAINER_BATTLE_TOWER_ON 0x40BC
#define VAR_JAGGED_PASS_ASH_WEATHER 0x40BD #define VAR_JAGGED_PASS_ASH_WEATHER 0x40BD
#define VAR_GLASS_WORKSHOP_STATE 0x40BE #define VAR_GLASS_WORKSHOP_STATE 0x40BE
@ -235,17 +235,17 @@
#define VAR_0x40D8 0x40D8 #define VAR_0x40D8 0x40D8
#define VAR_0x40D9 0x40D9 #define VAR_0x40D9 0x40D9
#define VAR_0x40DA 0x40DA #define VAR_0x40DA 0x40DA
#define VAR_0x40DB 0x40DB #define VAR_UNUSED_0x40DB 0x40DB // Unused Var
#define VAR_0x40DC 0x40DC #define VAR_UNUSED_0x40DC 0x40DC // Unused Var
#define VAR_EVENT_PICHU_SLOT 0x40DD #define VAR_EVENT_PICHU_SLOT 0x40DD
#define VAR_0x40DE 0x40DE #define VAR_NEVER_READ_0x40DE 0x40DE // Var is written to, but never read
#define VAR_0x40DF 0x40DF #define VAR_NEVER_READ_0x40DF 0x40DF // Var is written to, but never read
#define VAR_0x40E0 0x40E0 #define VAR_NEVER_READ_0x40E0 0x40E0 // Var is written to, but never read
#define VAR_0x40E1 0x40E1 #define VAR_NEVER_READ_0x40E1 0x40E1 // Var is written to, but never read
#define VAR_0x40E2 0x40E2 #define VAR_NEVER_READ_0x40E2 0x40E2 // Var is written to, but never read
#define VAR_0x40E3 0x40E3 #define VAR_NEVER_READ_0x40E3 0x40E3 // Var is written to, but never read
#define VAR_0x40E4 0x40E4 #define VAR_NEVER_READ_0x40E4 0x40E4 // var is written to, but never read
#define VAR_0x40E5 0x40E5 #define VAR_UNUSED_0x40E5 0x40E5 // Unused Var
#define VAR_DAILY_SLOTS 0x40E6 #define VAR_DAILY_SLOTS 0x40E6
#define VAR_DAILY_WILDS 0x40E7 #define VAR_DAILY_WILDS 0x40E7
#define VAR_DAILY_BLENDER 0x40E8 #define VAR_DAILY_BLENDER 0x40E8
@ -263,15 +263,15 @@
#define VAR_0x40F4 0x40F4 #define VAR_0x40F4 0x40F4
#define VAR_0x40F5 0x40F5 #define VAR_0x40F5 0x40F5
#define VAR_0x40F6 0x40F6 #define VAR_0x40F6 0x40F6
#define VAR_0x40F7 0x40F7 #define VAR_UNUSED_0x40F7 0x40F7 // Unused Var
#define VAR_0x40F8 0x40F8 #define VAR_UNUSED_0x40F8 0x40F8 // Unused Var
#define VAR_0x40F9 0x40F9 #define VAR_UNUSED_0x40F9 0x40F9 // Unused Var
#define VAR_0x40FA 0x40FA #define VAR_UNUSED_0x40FA 0x40FA // Unused Var
#define VAR_0x40FB 0x40FB #define VAR_UNUSED_0x40FB 0x40FB // Unused Var
#define VAR_0x40FC 0x40FC #define VAR_UNUSED_0x40FC 0x40FC // Unused Var
#define VAR_0x40FD 0x40FD #define VAR_UNUSED_0x40FD 0x40FD // Unused Var
#define VAR_0x40FE 0x40FE #define VAR_UNUSED_0x40FE 0x40FE // Unused Var
#define VAR_0x40FF 0x40FF #define VAR_UNUSED_0x40FF 0x40FF // Unused Var
#define SPECIAL_VARS_START 0x8000 #define SPECIAL_VARS_START 0x8000
// special vars // special vars
@ -297,6 +297,6 @@
#define VAR_MON_BOX_ID 0x8012 #define VAR_MON_BOX_ID 0x8012
#define VAR_MON_BOX_POS 0x8013 #define VAR_MON_BOX_POS 0x8013
#define VAR_0x8014 0x8014 #define VAR_0x8014 0x8014
#define VAR_0x8015 0x8015 #define VAR_NEVER_READ_0x8015 0x8015 // Written to, but never read
#endif // GUARD_CONSTANTS_VARS_H #endif // GUARD_CONSTANTS_VARS_H

View File

@ -7,7 +7,7 @@ u16 get_unknown_box_id(void);
bool8 InMultiBattleRoom(void); bool8 InMultiBattleRoom(void);
void sub_813BF10(void); void sub_813BF10(void);
void IncrementBirthIslandRockStepCount(void); void IncrementBirthIslandRockStepCount(void);
bool8 sub_813B3B0(void); bool8 UnusualWeatherHasExpired(void);
bool8 ShouldDoBrailleRegicePuzzle(void); bool8 ShouldDoBrailleRegicePuzzle(void);
bool32 is_tile_that_overrides_player_control(void); bool32 is_tile_that_overrides_player_control(void);
bool32 sub_8138120(void); bool32 sub_8138120(void);

View File

@ -131,13 +131,13 @@ void sub_809D4D8(void)
void sub_809D570(void) void sub_809D570(void)
{ {
VarSet(VAR_EVENT_PICHU_SLOT, 0); VarSet(VAR_EVENT_PICHU_SLOT, 0);
VarSet(VAR_0x40DE, 0); VarSet(VAR_NEVER_READ_0x40DE, 0);
VarSet(VAR_0x40DF, 0); VarSet(VAR_NEVER_READ_0x40DF, 0);
VarSet(VAR_0x40E0, 0); VarSet(VAR_NEVER_READ_0x40E0, 0);
VarSet(VAR_0x40E1, 0); VarSet(VAR_NEVER_READ_0x40E1, 0);
VarSet(VAR_0x40E2, 0); VarSet(VAR_NEVER_READ_0x40E2, 0);
VarSet(VAR_0x40E3, 0); VarSet(VAR_NEVER_READ_0x40E3, 0);
VarSet(VAR_0x40E4, 0); VarSet(VAR_NEVER_READ_0x40E4, 0);
} }
void DisableResetRTC(void) void DisableResetRTC(void)

View File

@ -557,7 +557,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
ScriptContext1_SetupScript(EventScript_EggHatch); ScriptContext1_SetupScript(EventScript_EggHatch);
return TRUE; return TRUE;
} }
if (sub_813B3B0() == TRUE) if (UnusualWeatherHasExpired() == TRUE)
{ {
ScriptContext1_SetupScript(UnusualWeather_EventScript_EndEventAndCleanup_1); ScriptContext1_SetupScript(UnusualWeather_EventScript_EndEventAndCleanup_1);
return TRUE; return TRUE;

View File

@ -3424,7 +3424,7 @@ bool8 sub_813B260(void)
void CreateUnusualWeatherEvent(void) void CreateUnusualWeatherEvent(void)
{ {
u16 randomValue = Random(); u16 randomValue = Random();
VarSet(VAR_0x4038, 0); VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, 0);
if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE) if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
{ {
@ -3466,12 +3466,12 @@ bool32 GetUnusualWeatherMapNameAndType(void)
} }
} }
bool8 sub_813B3B0(void) bool8 UnusualWeatherHasExpired(void)
{ {
// Duplicate array. // Duplicate array.
static const u8 sUnusualWeatherMapNumbers_2[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; static const u8 sUnusualWeatherMapNumbers_2[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c };
u16 var1 = VarGet(VAR_0x4038); u16 steps = VarGet(VAR_UNUSUAL_WEATHER_STEP_COUNTER);
u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION); u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
if (unusualWeather == UNUSUAL_WEATHER_NONE) if (unusualWeather == UNUSUAL_WEATHER_NONE)
@ -3479,9 +3479,9 @@ bool8 sub_813B3B0(void)
return FALSE; return FALSE;
} }
if (++var1 > 999) if (++steps > 999)
{ {
VarSet(VAR_0x4038, 0); VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, 0);
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE)) if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE))
{ {
switch (gSaveBlock1Ptr->location.mapNum) switch (gSaveBlock1Ptr->location.mapNum)
@ -3491,7 +3491,7 @@ bool8 sub_813B3B0(void)
case MAP_NUM(MARINE_CAVE_END): case MAP_NUM(MARINE_CAVE_END):
case MAP_NUM(TERRA_CAVE_ENTRANCE): case MAP_NUM(TERRA_CAVE_ENTRANCE):
case MAP_NUM(TERRA_CAVE_END): case MAP_NUM(TERRA_CAVE_END):
VarSet(VAR_0x4039, 1); VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 1);
return FALSE; return FALSE;
default: default:
break; break;
@ -3506,7 +3506,7 @@ bool8 sub_813B3B0(void)
case MAP_NUM(UNDERWATER5): case MAP_NUM(UNDERWATER5):
case MAP_NUM(UNDERWATER6): case MAP_NUM(UNDERWATER6):
case MAP_NUM(UNDERWATER7): case MAP_NUM(UNDERWATER7):
VarSet(VAR_0x4039, 1); VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 1);
return FALSE; return FALSE;
default: default:
break; break;
@ -3526,7 +3526,7 @@ bool8 sub_813B3B0(void)
} }
else else
{ {
VarSet(VAR_0x4038, var1); VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, steps);
return FALSE; return FALSE;
} }
} }

View File

@ -408,9 +408,11 @@ static void Overworld_ResetStateAfterWhiteOut(void)
FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_SAFARI_MODE);
FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_USE_FLASH); FlagClear(FLAG_SYS_USE_FLASH);
if (VarGet(VAR_0x4039) == 1) // If you were defeated by Kyogre/Groudon and the step counter has
// maxed out, end the unusual weather.
if (VarGet(VAR_SHOULD_END_UNUSUAL_WEATHER) == 1)
{ {
VarSet(VAR_0x4039, 0); VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 0);
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE);
} }
} }