Reverse engineer unusual weather events

This commit is contained in:
Phlosioneer 2019-02-27 03:42:04 -05:00
parent 231355f84d
commit fe55580fe1
18 changed files with 115 additions and 87 deletions

View File

@ -3188,7 +3188,7 @@ gUnknown_08273D1F:: @ 8273D1F
gUnknown_08273D1F:: @ 8273D1F gUnknown_08273D1F:: @ 8273D1F
lockall lockall
compare VAR_0x4037, 9 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START
goto_if_ge Route105_EventScript_273D51 goto_if_ge Route105_EventScript_273D51
goto Route105_EventScript_273D5F goto Route105_EventScript_273D5F
end end
@ -3200,7 +3200,7 @@ Route105_EventScript_273D31:: @ 8273D31
doweather doweather
call Route105_EventScript_273D6D call Route105_EventScript_273D6D
special DrawWholeMapView special DrawWholeMapView
setvar VAR_0x4037, 0 setvar VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE
setvar VAR_0x4039, 0 setvar VAR_0x4039, 0
clearflag FLAG_SPECIAL_FLAG_0x4000 clearflag FLAG_SPECIAL_FLAG_0x4000
fadescreenswapbuffers 0 fadescreenswapbuffers 0
@ -3218,23 +3218,23 @@ Route105_EventScript_273D5F:: @ 8273D5F
end end
Route105_EventScript_273D6D:: @ 8273D6D Route105_EventScript_273D6D:: @ 8273D6D
switch VAR_0x4037 switch VAR_UNUSUAL_WEATHER_LOCATION
case 1, Route105_EventScript_273E23 case UNUSUAL_WEATHER_ROUTE_114_NORTH, Route105_EventScript_273E23
case 2, Route105_EventScript_273E36 case UNUSUAL_WEATHER_ROUTE_114_SOUTH, Route105_EventScript_273E36
case 3, Route105_EventScript_273E49 case UNUSUAL_WEATHER_ROUTE_115_WEST, Route105_EventScript_273E49
case 4, Route105_EventScript_273E5C case UNUSUAL_WEATHER_ROUTE_115_EAST, Route105_EventScript_273E5C
case 5, Route105_EventScript_273E6F case UNUSUAL_WEATHER_ROUTE_116_NORTH, Route105_EventScript_273E6F
case 6, Route105_EventScript_273E82 case UNUSUAL_WEATHER_ROUTE_116_SOUTH, Route105_EventScript_273E82
case 7, Route105_EventScript_273E95 case UNUSUAL_WEATHER_ROUTE_118_EAST, Route105_EventScript_273E95
case 8, Route105_EventScript_273EA8 case UNUSUAL_WEATHER_ROUTE_118_WEST, Route105_EventScript_273EA8
case 9, Route105_EventScript_273EBB case UNUSUAL_WEATHER_ROUTE_105_NORTH, Route105_EventScript_273EBB
case 10, Route105_EventScript_273F28 case UNUSUAL_WEATHER_ROUTE_105_SOUTH, Route105_EventScript_273F28
case 11, Route105_EventScript_273F95 case UNUSUAL_WEATHER_ROUTE_125_WEST, Route105_EventScript_273F95
case 12, Route105_EventScript_274002 case UNUSUAL_WEATHER_ROUTE_125_EAST, Route105_EventScript_274002
case 13, Route105_EventScript_27406F case UNUSUAL_WEATHER_ROUTE_127_NORTH, Route105_EventScript_27406F
case 14, Route105_EventScript_2740DC case UNUSUAL_WEATHER_ROUTE_127_SOUTH, Route105_EventScript_2740DC
case 15, Route105_EventScript_274149 case UNUSUAL_WEATHER_ROUTE_129_WEST, Route105_EventScript_274149
case 16, Route105_EventScript_2741B6 case UNUSUAL_WEATHER_ROUTE_129_EAST, Route105_EventScript_2741B6
return return
Route105_EventScript_273E23:: @ 8273E23 Route105_EventScript_273E23:: @ 8273E23
@ -3401,15 +3401,15 @@ Underwater3_EventScript_274223:: @ 8274223
Underwater5_EventScript_274223:: @ 8274223 Underwater5_EventScript_274223:: @ 8274223
Underwater6_EventScript_274223:: @ 8274223 Underwater6_EventScript_274223:: @ 8274223
Underwater7_EventScript_274223:: @ 8274223 Underwater7_EventScript_274223:: @ 8274223
switch VAR_0x4037 switch VAR_UNUSUAL_WEATHER_LOCATION
case 9, Underwater3_EventScript_274281 case UNUSUAL_WEATHER_ROUTE_105_NORTH, Underwater3_EventScript_274281
case 10, Underwater3_EventScript_27428A case UNUSUAL_WEATHER_ROUTE_105_SOUTH, Underwater3_EventScript_27428A
case 11, Underwater3_EventScript_274293 case UNUSUAL_WEATHER_ROUTE_125_WEST, Underwater3_EventScript_274293
case 12, Underwater3_EventScript_27429C case UNUSUAL_WEATHER_ROUTE_125_EAST, Underwater3_EventScript_27429C
case 13, Underwater3_EventScript_2742A5 case UNUSUAL_WEATHER_ROUTE_127_NORTH, Underwater3_EventScript_2742A5
case 14, Underwater3_EventScript_2742AE case UNUSUAL_WEATHER_ROUTE_127_SOUTH, Underwater3_EventScript_2742AE
case 15, Underwater3_EventScript_2742B7 case UNUSUAL_WEATHER_ROUTE_129_WEST, Underwater3_EventScript_2742B7
case 16, Underwater3_EventScript_2742C0 case UNUSUAL_WEATHER_ROUTE_129_EAST, Underwater3_EventScript_2742C0
return return
Underwater3_EventScript_274281:: @ 8274281 Underwater3_EventScript_274281:: @ 8274281

View File

@ -6,9 +6,9 @@ Route105_MapScripts:: @ 81EE1DB
Route105_MapScript1_1EE1EB: @ 81EE1EB Route105_MapScript1_1EE1EB: @ 81EE1EB
call_if_unset FLAG_REGI_DOORS_OPENED, Route105_EventScript_1EE20B call_if_unset FLAG_REGI_DOORS_OPENED, Route105_EventScript_1EE20B
compare VAR_0x4037, 9 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_105_NORTH
call_if_eq Route105_EventScript_2739AB call_if_eq Route105_EventScript_2739AB
compare VAR_0x4037, 10 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_105_SOUTH
call_if_eq Route105_EventScript_273A18 call_if_eq Route105_EventScript_273A18
end end
@ -20,9 +20,9 @@ Route105_EventScript_1EE20B:: @ 81EE20B
Route105_MapScript1_1EE21E: @ 81EE21E Route105_MapScript1_1EE21E: @ 81EE21E
compare VAR_0x4039, 1 compare VAR_0x4039, 1
call_if_eq Route105_EventScript_273D13 call_if_eq Route105_EventScript_273D13
compare VAR_0x4037, 9 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_105_NORTH
call_if_eq Route105_EventScript_273D17 call_if_eq Route105_EventScript_273D17
compare VAR_0x4037, 10 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_105_SOUTH
call_if_eq Route105_EventScript_273D17 call_if_eq Route105_EventScript_273D17
end end

View File

@ -7,16 +7,16 @@ Route114_MapScripts:: @ 81F252F
Route114_MapScript1_1F253F: @ 81F253F Route114_MapScript1_1F253F: @ 81F253F
compare VAR_0x4039, 1 compare VAR_0x4039, 1
call_if_eq Route114_EventScript_273D13 call_if_eq Route114_EventScript_273D13
compare VAR_0x4037, 1 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_114_NORTH
call_if_eq Route114_EventScript_273D1B call_if_eq Route114_EventScript_273D1B
compare VAR_0x4037, 2 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_114_SOUTH
call_if_eq Route114_EventScript_273D1B call_if_eq Route114_EventScript_273D1B
end end
Route114_MapScript1_1F2561: @ 81F2561 Route114_MapScript1_1F2561: @ 81F2561
compare VAR_0x4037, 1 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_114_NORTH
call_if_eq Route114_EventScript_273913 call_if_eq Route114_EventScript_273913
compare VAR_0x4037, 2 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_114_SOUTH
call_if_eq Route114_EventScript_273926 call_if_eq Route114_EventScript_273926
end end

View File

@ -5,18 +5,18 @@ Route115_MapScripts:: @ 81F2920
.byte 0 .byte 0
Route115_MapScript1_1F2930: @ 81F2930 Route115_MapScript1_1F2930: @ 81F2930
compare VAR_0x4037, 3 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_115_WEST
call_if_eq Route115_EventScript_273939 call_if_eq Route115_EventScript_273939
compare VAR_0x4037, 4 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_115_EAST
call_if_eq Route115_EventScript_27394C call_if_eq Route115_EventScript_27394C
end end
Route115_MapScript1_1F2947: @ 81F2947 Route115_MapScript1_1F2947: @ 81F2947
compare VAR_0x4039, 1 compare VAR_0x4039, 1
call_if_eq Route115_EventScript_273D13 call_if_eq Route115_EventScript_273D13
compare VAR_0x4037, 3 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_115_WEST
call_if_eq Route115_EventScript_273D1B call_if_eq Route115_EventScript_273D1B
compare VAR_0x4037, 4 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_115_EAST
call_if_eq Route115_EventScript_273D1B call_if_eq Route115_EventScript_273D1B
end end

View File

@ -8,9 +8,9 @@ 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_0x4039, 1
call_if_eq Route116_EventScript_273D13 call_if_eq Route116_EventScript_273D13
compare VAR_0x4037, 5 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_116_NORTH
call_if_eq Route116_EventScript_273D1B call_if_eq Route116_EventScript_273D1B
compare VAR_0x4037, 6 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_116_SOUTH
call_if_eq Route116_EventScript_273D1B call_if_eq Route116_EventScript_273D1B
end end
@ -19,9 +19,9 @@ Route116_EventScript_1F2C47:: @ 81F2C47
return return
Route116_MapScript1_1F2C4F: @ 81F2C4F Route116_MapScript1_1F2C4F: @ 81F2C4F
compare VAR_0x4037, 5 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_116_NORTH
call_if_eq Route116_EventScript_27395F call_if_eq Route116_EventScript_27395F
compare VAR_0x4037, 6 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_116_SOUTH
call_if_eq Route116_EventScript_273972 call_if_eq Route116_EventScript_273972
end end

View File

@ -8,16 +8,16 @@ Route118_MapScript1_1F3DCC: @ 81F3DCC
call Route118_EventScript_28CCC7 call Route118_EventScript_28CCC7
compare VAR_0x4039, 1 compare VAR_0x4039, 1
call_if_eq Route118_EventScript_273D13 call_if_eq Route118_EventScript_273D13
compare VAR_0x4037, 7 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_118_EAST
call_if_eq Route118_EventScript_273D1B call_if_eq Route118_EventScript_273D1B
compare VAR_0x4037, 8 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_118_WEST
call_if_eq Route118_EventScript_273D1B call_if_eq Route118_EventScript_273D1B
end end
Route118_MapScript1_1F3DF3: @ 81F3DF3 Route118_MapScript1_1F3DF3: @ 81F3DF3
compare VAR_0x4037, 7 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_118_EAST
call_if_eq Route118_EventScript_273985 call_if_eq Route118_EventScript_273985
compare VAR_0x4037, 8 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_118_WEST
call_if_eq Route118_EventScript_273998 call_if_eq Route118_EventScript_273998
end end

View File

@ -137,11 +137,13 @@ Route119_WeatherInstitute_2F_EventScript_2700F7:: @ 82700F7
end end
Route119_WeatherInstitute_2F_EventScript_27010A:: @ 827010A Route119_WeatherInstitute_2F_EventScript_27010A:: @ 827010A
@ This code uses VAR_0x8004 to count the number of legendaries the player has defeated
@ already.
setvar VAR_0x8004, 0 setvar VAR_0x8004, 0
call_if_set FLAG_DEFEATED_KYOGRE, Route119_WeatherInstitute_2F_EventScript_270160 call_if_set FLAG_DEFEATED_KYOGRE, WeatherInstitute_UnusualWeather_IncrementLegendCount
call_if_set FLAG_DEFEATED_GROUDON, Route119_WeatherInstitute_2F_EventScript_270160 call_if_set FLAG_DEFEATED_GROUDON, WeatherInstitute_UnusualWeather_IncrementLegendCount
compare VAR_0x8004, 2 compare VAR_0x8004, 2
goto_if_eq Route119_WeatherInstitute_2F_EventScript_270166 goto_if_eq WeatherInstitute_UnusualWeather_LegendariesAlreadyDefeated
call_if_unset FLAG_TEMP_2, Route119_WeatherInstitute_2F_EventScript_270159 call_if_unset FLAG_TEMP_2, Route119_WeatherInstitute_2F_EventScript_270159
specialvar VAR_RESULT, sub_813B374 specialvar VAR_RESULT, sub_813B374
compare VAR_RESULT, 1 compare VAR_RESULT, 1
@ -156,16 +158,16 @@ Route119_WeatherInstitute_2F_EventScript_27014F:: @ 827014F
end end
Route119_WeatherInstitute_2F_EventScript_270159:: @ 8270159 Route119_WeatherInstitute_2F_EventScript_270159:: @ 8270159
special sub_813B2E4 special CreateUnusualWeatherEvent
setflag FLAG_TEMP_2 setflag FLAG_TEMP_2
return return
Route119_WeatherInstitute_2F_EventScript_270160:: @ 8270160 WeatherInstitute_UnusualWeather_IncrementLegendCount:: @ 8270160
addvar VAR_0x8004, 1 addvar VAR_0x8004, 1
return return
Route119_WeatherInstitute_2F_EventScript_270166:: @ 8270166 WeatherInstitute_UnusualWeather_LegendariesAlreadyDefeated:: @ 8270166
msgbox Route119_WeatherInstitute_2F_Text_2708FC, MSGBOX_DEFAULT msgbox WeatherInstitute_UnusualWeather_LegendariesAlreadyDefeatedText, MSGBOX_DEFAULT
release release
end end
@ -325,7 +327,7 @@ Route119_WeatherInstitute_2F_Text_270873: @ 8270873
.string "Could that mean, somewhere near\n" .string "Could that mean, somewhere near\n"
.string "{STR_VAR_1}…$" .string "{STR_VAR_1}…$"
Route119_WeatherInstitute_2F_Text_2708FC: @ 82708FC WeatherInstitute_UnusualWeather_LegendariesAlreadyDefeatedText: @ 82708FC
.string "Abnormal weather conditions are\n" .string "Abnormal weather conditions are\n"
.string "no longer being reported.\p" .string "no longer being reported.\p"
.string "The occasional rainfall is a blessing,\n" .string "The occasional rainfall is a blessing,\n"

View File

@ -8,16 +8,16 @@ 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_0x4039, 1
call_if_eq Route125_EventScript_273D13 call_if_eq Route125_EventScript_273D13
compare VAR_0x4037, 11 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_125_WEST
call_if_eq Route125_EventScript_273D17 call_if_eq Route125_EventScript_273D17
compare VAR_0x4037, 12 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_125_EAST
call_if_eq Route125_EventScript_273D17 call_if_eq Route125_EventScript_273D17
end end
Route125_MapScript1_1F6783: @ 81F6783 Route125_MapScript1_1F6783: @ 81F6783
compare VAR_0x4037, 11 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_125_WEST
call_if_eq Route125_EventScript_273A85 call_if_eq Route125_EventScript_273A85
compare VAR_0x4037, 12 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_125_EAST
call_if_eq Route125_EventScript_273AF2 call_if_eq Route125_EventScript_273AF2
end end

View File

@ -8,16 +8,16 @@ 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_0x4039, 1
call_if_eq Route127_EventScript_273D13 call_if_eq Route127_EventScript_273D13
compare VAR_0x4037, 13 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_127_NORTH
call_if_eq Route127_EventScript_273D17 call_if_eq Route127_EventScript_273D17
compare VAR_0x4037, 14 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_127_SOUTH
call_if_eq Route127_EventScript_273D17 call_if_eq Route127_EventScript_273D17
end end
Route127_MapScript1_1F6A14: @ 81F6A14 Route127_MapScript1_1F6A14: @ 81F6A14
compare VAR_0x4037, 13 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_127_NORTH
call_if_eq Route127_EventScript_273B5F call_if_eq Route127_EventScript_273B5F
compare VAR_0x4037, 14 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_127_SOUTH
call_if_eq Route127_EventScript_273BCC call_if_eq Route127_EventScript_273BCC
end end

View File

@ -5,9 +5,9 @@ Route129_MapScripts:: @ 81F7284
.byte 0 .byte 0
Route129_MapScript1_1F7294: @ 81F7294 Route129_MapScript1_1F7294: @ 81F7294
compare VAR_0x4037, 15 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_129_WEST
call_if_eq Route129_EventScript_273C39 call_if_eq Route129_EventScript_273C39
compare VAR_0x4037, 16 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_129_EAST
call_if_eq Route129_EventScript_273CA6 call_if_eq Route129_EventScript_273CA6
end end
@ -16,9 +16,9 @@ Route129_MapScript1_1F72AB: @ 81F72AB
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
compare VAR_0x4037, 15 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_129_WEST
call_if_eq Route129_EventScript_273D17 call_if_eq Route129_EventScript_273D17
compare VAR_0x4037, 16 compare VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_ROUTE_129_EAST
call_if_eq Route129_EventScript_273D17 call_if_eq Route129_EventScript_273D17
end end

View File

@ -499,7 +499,7 @@ gSpecials:: @ 81DBA64
def_special sub_813B21C def_special sub_813B21C
def_special SetMatchCallRegisteredFlag def_special SetMatchCallRegisteredFlag
def_special sub_8175280 def_special sub_8175280
def_special sub_813B2E4 def_special CreateUnusualWeatherEvent
def_special sub_813B374 def_special sub_813B374
def_special sub_813B490 def_special sub_813B490
def_special sub_80A08CC def_special sub_80A08CC

View File

@ -236,7 +236,7 @@
#define FLAG_MET_WAILMER_TRAINER 0xDA #define FLAG_MET_WAILMER_TRAINER 0xDA
#define FLAG_EVIL_LEADER_PLEASE_STOP 0xDB #define FLAG_EVIL_LEADER_PLEASE_STOP 0xDB
#define FLAG_UNUSED_0x0DC 0xDC // Unused Flag #define FLAG_NEVER_SET_0x0DC 0xDC // This flag is read, but never written to
#define FLAG_RECEIVED_GO_GOGGLES 0xDD #define FLAG_RECEIVED_GO_GOGGLES 0xDD
#define FLAG_WINGULL_SENT_ON_ERRAND 0xDE #define FLAG_WINGULL_SENT_ON_ERRAND 0xDE

View File

@ -60,7 +60,7 @@
#define VAR_POISON_STEP_COUNTER 0x402B #define VAR_POISON_STEP_COUNTER 0x402B
#define VAR_RESET_RTC_ENABLE 0x402C #define VAR_RESET_RTC_ENABLE 0x402C
#define VAR_ENIGMA_BERRY_AVAILABLE 0x402D #define VAR_ENIGMA_BERRY_AVAILABLE 0x402D
#define VAR_0x402E 0x402E // Seems to be unused. #define VAR_UNUSED_0x402E 0x402E // Unused Var
#define VAR_FRONTIER_MANIAC_FACILITY 0x402F #define VAR_FRONTIER_MANIAC_FACILITY 0x402F
#define VAR_FRONTIER_GAMBLER_FACILITY 0x4030 #define VAR_FRONTIER_GAMBLER_FACILITY 0x4030
@ -71,7 +71,7 @@
#define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034 #define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034
#define VAR_DEOXYS_ROCK_LEVEL 0x4035 #define VAR_DEOXYS_ROCK_LEVEL 0x4035
#define VAR_STORAGE_UNKNOWN 0x4036 #define VAR_STORAGE_UNKNOWN 0x4036
#define VAR_0x4037 0x4037 #define VAR_UNUSUAL_WEATHER_LOCATION 0x4037
#define VAR_0x4038 0x4038 #define VAR_0x4038 0x4038
#define VAR_0x4039 0x4039 #define VAR_0x4039 0x4039
#define VAR_0x403A 0x403A #define VAR_0x403A 0x403A

View File

@ -37,4 +37,30 @@
#define COORD_EVENT_WEATHER_ROUTE119_CYCLE 20 #define COORD_EVENT_WEATHER_ROUTE119_CYCLE 20
#define COORD_EVENT_WEATHER_ROUTE123_CYCLE 21 #define COORD_EVENT_WEATHER_ROUTE123_CYCLE 21
// These are the "unusual weather events" that are used
// to find Kyogre and Groudon.
#define UNUSUAL_WEATHER_COUNT_PER_LEGENDARY 8
#define UNUSUAL_WEATHER_GROUDON_LOCATIONS_START 1
#define UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START 1 + UNUSUAL_WEATHER_COUNT_PER_LEGENDARY
#define UNUSUAL_WEATHER_NONE 0
// Groudon locations
#define UNUSUAL_WEATHER_ROUTE_114_NORTH 1
#define UNUSUAL_WEATHER_ROUTE_114_SOUTH 2
#define UNUSUAL_WEATHER_ROUTE_115_WEST 3
#define UNUSUAL_WEATHER_ROUTE_115_EAST 4
#define UNUSUAL_WEATHER_ROUTE_116_NORTH 5
#define UNUSUAL_WEATHER_ROUTE_116_SOUTH 6
#define UNUSUAL_WEATHER_ROUTE_118_EAST 7
#define UNUSUAL_WEATHER_ROUTE_118_WEST 8
// Kyogre locations
#define UNUSUAL_WEATHER_ROUTE_105_NORTH 9
#define UNUSUAL_WEATHER_ROUTE_105_SOUTH 10
#define UNUSUAL_WEATHER_ROUTE_125_WEST 11
#define UNUSUAL_WEATHER_ROUTE_125_EAST 12
#define UNUSUAL_WEATHER_ROUTE_127_NORTH 13
#define UNUSUAL_WEATHER_ROUTE_127_SOUTH 14
#define UNUSUAL_WEATHER_ROUTE_129_WEST 15
#define UNUSUAL_WEATHER_ROUTE_129_EAST 16
#endif // GUARD_CONSTANTS_WEATHER_H #endif // GUARD_CONSTANTS_WEATHER_H

View File

@ -3421,28 +3421,28 @@ bool8 sub_813B260(void)
return FALSE; return FALSE;
} }
void sub_813B2E4(void) void CreateUnusualWeatherEvent(void)
{ {
u16 randomValue = Random(); u16 randomValue = Random();
VarSet(VAR_0x4038, 0); VarSet(VAR_0x4038, 0);
if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE) if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
{ {
VarSet(VAR_0x4037, (randomValue & 7) + 1); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
} }
else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE) else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE)
{ {
VarSet(VAR_0x4037, (randomValue & 7) + 9); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
} }
else if ((randomValue & 1) == 0) else if ((randomValue & 1) == 0)
{ {
randomValue = Random(); randomValue = Random();
VarSet(VAR_0x4037, (randomValue & 7) + 1); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
} }
else else
{ {
randomValue = Random(); randomValue = Random();
VarSet(VAR_0x4037, (randomValue & 7) + 9); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
} }
} }
@ -3450,7 +3450,7 @@ bool32 sub_813B374(void)
{ {
static const u8 gUnknown_085B3400[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; static const u8 gUnknown_085B3400[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c };
u16 var = VarGet(VAR_0x4037); u16 var = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
GetMapName(gStringVar1, gUnknown_085B3400[var - 1], 0); GetMapName(gStringVar1, gUnknown_085B3400[var - 1], 0);
@ -3466,12 +3466,12 @@ bool32 sub_813B374(void)
bool8 sub_813B3B0(void) bool8 sub_813B3B0(void)
{ {
static const u8 gUnknown_085B3410[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; static const u8 sUnusualWeatherMapNumbers[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c };
u16 var1 = VarGet(VAR_0x4038); u16 var1 = VarGet(VAR_0x4038);
u16 var2 = VarGet(VAR_0x4037); u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
if (!var2) if (unusualWeather == UNUSUAL_WEATHER_NONE)
{ {
return FALSE; return FALSE;
} }
@ -3510,14 +3510,14 @@ bool8 sub_813B3B0(void)
} }
} }
if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3410[var2 - 1] && if (gSaveBlock1Ptr->location.mapNum == sUnusualWeatherMapNumbers[unusualWeather - 1] &&
gSaveBlock1Ptr->location.mapGroup == 0) gSaveBlock1Ptr->location.mapGroup == 0)
{ {
return TRUE; return TRUE;
} }
else else
{ {
VarSet(VAR_0x4037, 0); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE);
return FALSE; return FALSE;
} }
} }

View File

@ -1016,7 +1016,7 @@ static bool32 MapAllowsMatchCall(void)
if (gMapHeader.regionMapSectionId == MAPSEC_SOOTOPOLIS_CITY if (gMapHeader.regionMapSectionId == MAPSEC_SOOTOPOLIS_CITY
&& FlagGet(FLAG_HIDE_SOOTOPOLIS_CITY_RAYQUAZA) == TRUE && FlagGet(FLAG_HIDE_SOOTOPOLIS_CITY_RAYQUAZA) == TRUE
&& FlagGet(FLAG_UNUSED_0x0DC) == FALSE) && FlagGet(FLAG_NEVER_SET_0x0DC) == FALSE)
return FALSE; return FALSE;
if (gMapHeader.regionMapSectionId == MAPSEC_MT_CHIMNEY if (gMapHeader.regionMapSectionId == MAPSEC_MT_CHIMNEY

View File

@ -411,7 +411,7 @@ static void Overworld_ResetStateAfterWhiteOut(void)
if (VarGet(VAR_0x4039) == 1) if (VarGet(VAR_0x4039) == 1)
{ {
VarSet(VAR_0x4039, 0); VarSet(VAR_0x4039, 0);
VarSet(VAR_0x4037, 0); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE);
} }
} }

View File

@ -1159,7 +1159,7 @@ static u16 RegionMap_GetTerraCaveMapSecId(void)
{ {
s16 idx; s16 idx;
idx = VarGet(VAR_0x4037) - 1; idx = VarGet(VAR_UNUSUAL_WEATHER_LOCATION) - 1;
if (idx < 0 || idx > 15) if (idx < 0 || idx > 15)
{ {
idx = 0; idx = 0;
@ -1171,7 +1171,7 @@ static void RegionMap_GetMarineCaveCoords(u16 *x, u16 *y)
{ {
u16 idx; u16 idx;
idx = VarGet(VAR_0x4037); idx = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
if (idx < 9 || idx > 16) if (idx < 9 || idx > 16)
{ {
idx = 9; idx = 9;