diff --git a/data/event_scripts.s b/data/event_scripts.s index 364aae31c..d2828d5ea 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -48,7 +48,7 @@ gSpecialVars:: @ 81DBA0C .4byte gSpecialVar_ContestCategory .4byte gSpecialVar_MonBoxId .4byte gSpecialVar_MonBoxPos - .4byte gSpecialVar_0x8014 + .4byte gSpecialVar_Unused_0x8014 .4byte gTrainerBattleOpponent_A .include "data/specials.inc" diff --git a/data/maps/DewfordTown_Gym/scripts.inc b/data/maps/DewfordTown_Gym/scripts.inc index 3b39fc5d0..eb8183585 100644 --- a/data/maps/DewfordTown_Gym/scripts.inc +++ b/data/maps/DewfordTown_Gym/scripts.inc @@ -187,7 +187,7 @@ DewfordTown_Gym_EventScript_1FC7F7:: @ 81FC7F7 closemessage delay 30 setflag FLAG_ENABLE_BRAWLY_MATCH_CALL - setvar VAR_0x40F4, 0 + setvar VAR_ROXANNE_CALL_STEP_COUNTER, 0 setflag FLAG_ENABLE_ROXANNE_FIRST_CALL release end diff --git a/data/maps/FortreeCity_Gym/scripts.inc b/data/maps/FortreeCity_Gym/scripts.inc index 30cf8736a..8192e2039 100644 --- a/data/maps/FortreeCity_Gym/scripts.inc +++ b/data/maps/FortreeCity_Gym/scripts.inc @@ -43,7 +43,7 @@ FortreeCity_Gym_EventScript_2165FD:: @ 82165FD closemessage delay 30 setflag FLAG_ENABLE_WINONA_MATCH_CALL - setvar VAR_0x40F3, 0 + setvar VAR_WINONA_CALL_STEP_COUNTER, 0 setflag FLAG_REGISTER_WINONA_POKENAV release end diff --git a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc index 51ace147d..c02381982 100644 --- a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc +++ b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc @@ -195,7 +195,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_1F9E80:: @ 81F9E80 setflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCH setflag FLAG_HIDE_LITTLEROOT_TOWN_RIVAL setvar VAR_0x40D3, 2 - setvar VAR_0x40F5, 0 + setvar VAR_SCOTT_CALL_STEP_COUNTER, 0 setflag FLAG_SCOTT_CALL_NATIONAL_DEX releaseall end diff --git a/data/maps/MauvilleCity/scripts.inc b/data/maps/MauvilleCity/scripts.inc index 62c2219ea..61839d108 100644 --- a/data/maps/MauvilleCity/scripts.inc +++ b/data/maps/MauvilleCity/scripts.inc @@ -158,7 +158,7 @@ MauvilleCity_EventScript_1DF593:: @ 81DF593 clearflag FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WALLY clearflag FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WALLYS_UNCLE setflag FLAG_DEFEATED_WALLY_MAUVILLE - setvar VAR_0x40F2, 0 + setvar VAR_WALLY_CALL_STEP_COUNTER, 0 setflag FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL compare VAR_FACING, 2 call_if_eq MauvilleCity_EventScript_1DF5F3 diff --git a/data/maps/Route124/map.json b/data/maps/Route124/map.json index 7169a0299..c1a22a2d0 100644 --- a/data/maps/Route124/map.json +++ b/data/maps/Route124/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_124", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route125/map.json b/data/maps/Route125/map.json index 8071cf244..0ce520fdd 100644 --- a/data/maps/Route125/map.json +++ b/data/maps/Route125/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_125", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route126/map.json b/data/maps/Route126/map.json index 1e886a083..ea63eb80d 100644 --- a/data/maps/Route126/map.json +++ b/data/maps/Route126/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_126", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route127/map.json b/data/maps/Route127/map.json index 1b30f7d55..e4a68c3e1 100644 --- a/data/maps/Route127/map.json +++ b/data/maps/Route127/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_127", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route128/map.json b/data/maps/Route128/map.json index 826290ff3..58246c247 100644 --- a/data/maps/Route128/map.json +++ b/data/maps/Route128/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_128", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route129/map.json b/data/maps/Route129/map.json index b3e45b227..3183f9821 100644 --- a/data/maps/Route129/map.json +++ b/data/maps/Route129/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_129", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route130/map.json b/data/maps/Route130/map.json index 0a68d442c..18d168b17 100644 --- a/data/maps/Route130/map.json +++ b/data/maps/Route130/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_130", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route131/map.json b/data/maps/Route131/map.json index 3a48042f9..379b15b3d 100644 --- a/data/maps/Route131/map.json +++ b/data/maps/Route131/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_131", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route132/map.json b/data/maps/Route132/map.json index ae04ff62d..15c0de83d 100644 --- a/data/maps/Route132/map.json +++ b/data/maps/Route132/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_132", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route133/map.json b/data/maps/Route133/map.json index 2a8941e12..eed30d7ee 100644 --- a/data/maps/Route133/map.json +++ b/data/maps/Route133/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_133", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/Route134/map.json b/data/maps/Route134/map.json index 1e9123efe..8b3a9518e 100644 --- a/data/maps/Route134/map.json +++ b/data/maps/Route134/map.json @@ -6,7 +6,7 @@ "region_map_section": "MAPSEC_ROUTE_134", "requires_flash": false, "weather": "WEATHER_SUNNY", - "map_type": "MAP_TYPE_6", + "map_type": "MAP_TYPE_OCEAN_ROUTE", "allow_bike": true, "allow_escape_rope": false, "allow_running": true, diff --git a/data/maps/SeafloorCavern_Entrance/scripts.inc b/data/maps/SeafloorCavern_Entrance/scripts.inc index 045c0e065..1bf570549 100644 --- a/data/maps/SeafloorCavern_Entrance/scripts.inc +++ b/data/maps/SeafloorCavern_Entrance/scripts.inc @@ -9,7 +9,7 @@ SeafloorCavern_Entrance_MapScript1_234474: @ 8234474 SeafloorCavern_Entrance_EventScript_234485:: @ 8234485 lockall - compare VAR_0x40D9, 1 + compare VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT, 1 goto_if_eq SeafloorCavern_Entrance_EventScript_2344ED waitse playse SE_PIN @@ -25,7 +25,7 @@ SeafloorCavern_Entrance_EventScript_234485:: @ 8234485 compare VAR_FACING, 2 call_if_eq SeafloorCavern_Entrance_EventScript_234539 delay 30 - setvar VAR_0x40D9, 1 + setvar VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT, 1 moveobjectoffscreen 1 msgbox SeafloorCavern_Entrance_Text_234544, MSGBOX_DEFAULT closemessage diff --git a/data/maps/SkyPillar_Top/map.json b/data/maps/SkyPillar_Top/map.json index 5cb6a1a69..2d1a6fa1a 100644 --- a/data/maps/SkyPillar_Top/map.json +++ b/data/maps/SkyPillar_Top/map.json @@ -56,7 +56,7 @@ "x": 14, "y": 9, "elevation": 3, - "var": "VAR_0x40D7", + "var": "VAR_SKY_PILLAR_RAQUAZA_CRY_DONE", "var_value": "0", "script": "SkyPillar_Top_EventScript_23979A" } diff --git a/data/maps/SkyPillar_Top/scripts.inc b/data/maps/SkyPillar_Top/scripts.inc index 5a69001a1..d08b0b554 100644 --- a/data/maps/SkyPillar_Top/scripts.inc +++ b/data/maps/SkyPillar_Top/scripts.inc @@ -132,7 +132,7 @@ SkyPillar_Top_EventScript_23979A:: @ 823979A special RemoveCameraObject setvar VAR_RAYQUAZA_STATE, 5 setvar VAR_SKY_PILLAR_STATE, 1 - setvar VAR_0x40D7, 1 + setvar VAR_SKY_PILLAR_RAQUAZA_CRY_DONE, 1 releaseall end diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc index 9b5524a36..dbfe923f0 100644 --- a/data/maps/SootopolisCity/scripts.inc +++ b/data/maps/SootopolisCity/scripts.inc @@ -140,11 +140,11 @@ SootopolisCity_EventScript_1E5871:: @ 81E5871 setobjectxyperm 7, 29, 33 setobjectxyperm 16, 33, 35 setobjectxyperm 17, 34, 35 - compare VAR_0x40D8, 0 + compare VAR_SOOTOPOLIS_STATE, 0 call_if_eq SootopolisCity_EventScript_1E58AF - compare VAR_0x40D8, 1 + compare VAR_SOOTOPOLIS_STATE, 1 call_if_eq SootopolisCity_EventScript_1E58BB - compare VAR_0x40D8, 2 + compare VAR_SOOTOPOLIS_STATE, 2 call_if_eq SootopolisCity_EventScript_1E58C7 return @@ -1367,14 +1367,14 @@ SootopolisCity_EventScript_1E64B2:: @ 81E64B2 applymovement 18, SootopolisCity_Movement_1E64EC waitmovement 0 moveobjectoffscreen 18 - setvar VAR_0x40D8, 1 + setvar VAR_SOOTOPOLIS_STATE, 1 return SootopolisCity_EventScript_1E64C5:: @ 81E64C5 applymovement 18, SootopolisCity_Movement_1E64EF waitmovement 0 moveobjectoffscreen 18 - setvar VAR_0x40D8, 2 + setvar VAR_SOOTOPOLIS_STATE, 2 return SootopolisCity_EventScript_1E64D8:: @ 81E64D8 diff --git a/include/constants/map_types.h b/include/constants/map_types.h index 504575859..8d071fd41 100755 --- a/include/constants/map_types.h +++ b/include/constants/map_types.h @@ -1,14 +1,14 @@ #ifndef GUARD_CONSTANTS_MAP_TYPES_H #define GUARD_CONSTANTS_MAP_TYPES_H -#define MAP_TYPE_0 0 +#define MAP_TYPE_UNUSED_1 0 #define MAP_TYPE_TOWN 1 #define MAP_TYPE_CITY 2 #define MAP_TYPE_ROUTE 3 #define MAP_TYPE_UNDERGROUND 4 #define MAP_TYPE_UNDERWATER 5 -#define MAP_TYPE_6 6 -#define MAP_TYPE_7 7 +#define MAP_TYPE_OCEAN_ROUTE 6 +#define MAP_TYPE_UNUSED_2 7 #define MAP_TYPE_INDOOR 8 #define MAP_TYPE_SECRET_BASE 9 diff --git a/include/constants/vars.h b/include/constants/vars.h index 59489f051..99d1813da 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -231,9 +231,9 @@ #define VAR_SS_TIDAL_SCOTT_STATE 0x40D4 // Always equal to FLAG_MET_SCOTT_ON_SS_TIDAL #define VAR_ROAMER_POKEMON 0x40D5 // 0 = Latias, 1 = Latios #define VAR_TRAINER_HILL_IS_ACTIVE 0x40D6 -#define VAR_0x40D7 0x40D7 -#define VAR_0x40D8 0x40D8 -#define VAR_0x40D9 0x40D9 +#define VAR_SKY_PILLAR_RAQUAZA_CRY_DONE 0x40D7 +#define VAR_SOOTOPOLIS_STATE 0x40D8 +#define VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT 0x40D9 #define VAR_0x40DA 0x40DA #define VAR_UNUSED_0x40DB 0x40DB // Unused Var #define VAR_UNUSED_0x40DC 0x40DC // Unused Var @@ -252,17 +252,17 @@ #define VAR_DAILY_PLANTED_BERRIES 0x40E9 #define VAR_DAILY_PICKED_BERRIES 0x40EA #define VAR_DAILY_ROULETTE 0x40EB -#define VAR_0x40EC 0x40EC -#define VAR_0x40ED 0x40ED -#define VAR_0x40EE 0x40EE -#define VAR_0x40EF 0x40EF -#define VAR_0x40F0 0x40F0 +#define VAR_SECRET_BASE_STEP_COUNTER 0x40EC // Used by Secret Base TV programs +#define VAR_SECRET_BASE_LAST_ITEM_USED 0x40ED // Used by Secret Base TV programs +#define VAR_SECRET_BASE_LOW_TV_FLAGS 0x40EE // Used by Secret Base TV programs +#define VAR_SECRET_BASE_HIGH_TV_FLAGS 0x40EF // Used by Secret Base TV programs +#define VAR_SECRET_BASE_IS_NOT_LOCAL 0x40F0 // Set to TRUE while in another player's secret base. #define VAR_DAILY_BP 0x40F1 -#define VAR_0x40F2 0x40F2 -#define VAR_0x40F3 0x40F3 -#define VAR_0x40F4 0x40F4 -#define VAR_0x40F5 0x40F5 -#define VAR_0x40F6 0x40F6 +#define VAR_WALLY_CALL_STEP_COUNTER 0x40F2 +#define VAR_WINONA_CALL_STEP_COUNTER 0x40F3 +#define VAR_ROXANNE_CALL_STEP_COUNTER 0x40F4 +#define VAR_SCOTT_CALL_STEP_COUNTER 0x40F5 +#define VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER 0x40F6 #define VAR_UNUSED_0x40F7 0x40F7 // Unused Var #define VAR_UNUSED_0x40F8 0x40F8 // Unused Var #define VAR_UNUSED_0x40F9 0x40F9 // Unused Var @@ -296,7 +296,7 @@ #define VAR_CONTEST_CATEGORY 0x8011 #define VAR_MON_BOX_ID 0x8012 #define VAR_MON_BOX_POS 0x8013 -#define VAR_0x8014 0x8014 +#define VAR_UNUSED_0x8014 0x8014 #define VAR_NEVER_READ_0x8015 0x8015 // Written to, but never read #endif // GUARD_CONSTANTS_VARS_H diff --git a/include/event_data.h b/include/event_data.h index 3b8e2701f..11289c1ab 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -47,6 +47,6 @@ extern u16 gSpecialVar_LastTalked; extern u16 gSpecialVar_Facing; extern u16 gSpecialVar_MonBoxId; extern u16 gSpecialVar_MonBoxPos; -extern u16 gSpecialVar_0x8014; +extern u16 gSpecialVar_Unused_0x8014; #endif // GUARD_EVENT_DATA_H diff --git a/include/field_specials.h b/include/field_specials.h index 1ab2b7eb4..28e47fead 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -9,11 +9,11 @@ void sub_813BF10(void); void IncrementBirthIslandRockStepCount(void); bool8 UnusualWeatherHasExpired(void); bool8 ShouldDoBrailleRegicePuzzle(void); -bool32 is_tile_that_overrides_player_control(void); -bool32 sub_8138120(void); -bool32 sub_8138168(void); -bool32 sub_81381B0(void); -bool32 sub_81381F8(void); +bool32 ShouldDoWallyCall(void); +bool32 ShouldDoWinonaCall(void); +bool32 ShouldDoScottCall(void); +bool32 ShouldDoRoxanneCall(void); +bool32 ShouldDoRivalRayquazaCall(void); bool32 CountSSTidalStep(u16 delta); u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y); void sub_813A128(void); diff --git a/include/overworld.h b/include/overworld.h index 8caba0673..54715ecc0 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -96,7 +96,7 @@ u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum); u8 GetMapTypeByWarpData(struct WarpData *warp); u8 GetCurrentMapType(void); u8 GetLastUsedWarpMapType(void); -bool8 is_map_type_1_2_3_5_or_6(u8 mapType); +bool8 IsMapTypeOutside(u8 mapType); bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); bool8 Overworld_MapTypeIsIndoors(u8 mapType); u8 GetSavedWarpRegionMapSectionId(void); diff --git a/src/battle_setup.c b/src/battle_setup.c index 7626420e9..40423697e 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -641,7 +641,7 @@ u8 BattleSetup_GetTerrainId(void) return BATTLE_TERRAIN_BUILDING; case MAP_TYPE_UNDERWATER: return BATTLE_TERRAIN_UNDERWATER; - case MAP_TYPE_6: + case MAP_TYPE_OCEAN_ROUTE: if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior)) return BATTLE_TERRAIN_WATER; return BATTLE_TERRAIN_PLAIN; diff --git a/src/event_data.c b/src/event_data.c index 5ca288e7b..50628f984 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -23,8 +23,8 @@ EWRAM_DATA u16 gSpecialVar_LastTalked = 0; EWRAM_DATA u16 gSpecialVar_Facing = 0; EWRAM_DATA u16 gSpecialVar_MonBoxId = 0; EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0; -EWRAM_DATA u16 gSpecialVar_0x8014 = 0; -EWRAM_DATA static u8 gUnknown_020375FC[16] = {0}; +EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0; +EWRAM_DATA static u8 gSpecialFlags[16] = {0}; extern u16 *const gSpecialVars[]; @@ -32,7 +32,7 @@ void InitEventData(void) { memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags)); memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars)); - memset(gUnknown_020375FC, 0, sizeof(gUnknown_020375FC)); + memset(gSpecialFlags, 0, sizeof(gSpecialFlags)); } void ClearTempFieldEventData(void) @@ -199,7 +199,7 @@ u8 *GetFlagPointer(u16 id) else if (id < SPECIAL_FLAGS_START) return &gSaveBlock1Ptr->flags[id / 8]; else - return &gUnknown_020375FC[(id - SPECIAL_FLAGS_START) / 8]; + return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8]; } u8 FlagSet(u16 id) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 7bb2b257d..8a7076591 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -567,27 +567,27 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) ScriptContext1_SetupScript(IslandCave_EventScript_238EAF); return TRUE; } - if (is_tile_that_overrides_player_control() == TRUE) + if (ShouldDoWallyCall() == TRUE) { ScriptContext1_SetupScript(MauvilleCity_EventScript_1DF7BA); return TRUE; } - if (sub_8138120() == TRUE) + if (ShouldDoWinonaCall() == TRUE) { ScriptContext1_SetupScript(Route119_EventScript_1F49EC); return TRUE; } - if (sub_8138168() == TRUE) + if (ShouldDoScottCall() == TRUE) { ScriptContext1_SetupScript(LittlerootTown_ProfessorBirchsLab_EventScript_1FA4D6); return TRUE; } - if (sub_81381B0() == TRUE) + if (ShouldDoRoxanneCall() == TRUE) { ScriptContext1_SetupScript(RustboroCity_Gym_EventScript_21307B); return TRUE; } - if (sub_81381F8() == TRUE) + if (ShouldDoRivalRayquazaCall() == TRUE) { ScriptContext1_SetupScript(MossdeepCity_SpaceCenter_2F_EventScript_224175); return TRUE; diff --git a/src/field_effect.c b/src/field_effect.c index e7c0b39b9..74f7801bd 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2443,7 +2443,7 @@ static void sub_80B8410(struct Task *task) bool8 FldEff_FieldMoveShowMon(void) { u8 taskId; - if (is_map_type_1_2_3_5_or_6(GetCurrentMapType()) == TRUE) + if (IsMapTypeOutside(GetCurrentMapType()) == TRUE) { taskId = CreateTask(sub_80B8554, 0xff); } else diff --git a/src/field_specials.c b/src/field_specials.c index a07e987eb..e603c3ebf 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -360,17 +360,17 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) return 0; } -bool32 is_tile_that_overrides_player_control(void) +bool32 ShouldDoWallyCall(void) { if (FlagGet(FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL)) { switch (gMapHeader.mapType) { - case 1: - case 2: - case 3: - case 6: - if (++(*GetVarPointer(VAR_0x40F2)) < 0xFA) + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 0xFA) { return FALSE; } @@ -387,7 +387,7 @@ bool32 is_tile_that_overrides_player_control(void) return TRUE; } -bool32 sub_8138120(void) +bool32 ShouldDoWinonaCall(void) { if (FlagGet(FLAG_REGISTER_WINONA_POKENAV)) { @@ -396,8 +396,8 @@ bool32 sub_8138120(void) case MAP_TYPE_TOWN: case MAP_TYPE_CITY: case MAP_TYPE_ROUTE: - case MAP_TYPE_6: - if (++(*GetVarPointer(VAR_0x40F3)) < 10) + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_WINONA_CALL_STEP_COUNTER)) < 10) { return FALSE; } @@ -414,7 +414,7 @@ bool32 sub_8138120(void) return TRUE; } -bool32 sub_8138168(void) +bool32 ShouldDoScottCall(void) { if (FlagGet(FLAG_SCOTT_CALL_NATIONAL_DEX)) { @@ -424,7 +424,7 @@ bool32 sub_8138168(void) case 2: case 3: case 6: - if (++(*GetVarPointer(VAR_0x40F5)) < 0xA) + if (++(*GetVarPointer(VAR_SCOTT_CALL_STEP_COUNTER)) < 10) { return FALSE; } @@ -441,7 +441,7 @@ bool32 sub_8138168(void) return TRUE; } -bool32 sub_81381B0(void) +bool32 ShouldDoRoxanneCall(void) { if (FlagGet(FLAG_ENABLE_ROXANNE_FIRST_CALL)) { @@ -451,7 +451,7 @@ bool32 sub_81381B0(void) case 2: case 3: case 6: - if (++(*GetVarPointer(VAR_0x40F4)) < 0xFA) + if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 0xFA) { return FALSE; } @@ -468,7 +468,7 @@ bool32 sub_81381B0(void) return TRUE; } -bool32 sub_81381F8(void) +bool32 ShouldDoRivalRayquazaCall(void) { if (FlagGet(FLAG_DEFEATED_MAGMA_SPACE_CENTER)) { @@ -478,7 +478,7 @@ bool32 sub_81381F8(void) case 2: case 3: case 6: - if (++(*GetVarPointer(VAR_0x40F6)) < 0xFA) + if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 0xFA) { return FALSE; } @@ -1516,7 +1516,7 @@ bool8 FoundBlackGlasses(void) void SetRoute119Weather(void) { - if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE) + if (IsMapTypeOutside(GetLastUsedWarpMapType()) != TRUE) { SetSav1Weather(20); } @@ -1524,7 +1524,7 @@ void SetRoute119Weather(void) void SetRoute123Weather(void) { - if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE) + if (IsMapTypeOutside(GetLastUsedWarpMapType()) != TRUE) { SetSav1Weather(21); } diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index df4576a7f..d4d6075f3 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -1126,7 +1126,7 @@ void GetShieldToyTVDecorationInfo(void) if (!VarGet(VAR_CURRENT_SECRET_BASE)) return; - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x10); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x10); break; case 734: ConvertIntToDecimalStringN(gStringVar1, 50, STR_CONV_MODE_LEFT_ALIGN, 2); @@ -1137,7 +1137,7 @@ void GetShieldToyTVDecorationInfo(void) if (!VarGet(VAR_CURRENT_SECRET_BASE)) return; - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x20); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x20); break; case 756: gSpecialVar_Result = 1; @@ -1145,7 +1145,7 @@ void GetShieldToyTVDecorationInfo(void) if (!VarGet(VAR_CURRENT_SECRET_BASE)) return; - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80); break; case 757: gSpecialVar_Result = 2; @@ -1153,7 +1153,7 @@ void GetShieldToyTVDecorationInfo(void) if (!VarGet(VAR_CURRENT_SECRET_BASE)) return; - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80); break; case 758: gSpecialVar_Result = 3; @@ -1161,7 +1161,7 @@ void GetShieldToyTVDecorationInfo(void) if (!VarGet(VAR_CURRENT_SECRET_BASE)) return; - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80); break; } } diff --git a/src/item.c b/src/item.c index 71c2dc0f7..0e13ddf4c 100644 --- a/src/item.c +++ b/src/item.c @@ -539,8 +539,8 @@ bool8 RemoveBagItem(u16 itemId, u16 count) if (CurrentMapIsSecretBase() == TRUE) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x200); - VarSet(VAR_0x40ED, itemId); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x200); + VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, itemId); } var = GetItemListPosition(pocket); diff --git a/src/overworld.c b/src/overworld.c index 6055c74bb..84eb80a06 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -678,7 +678,7 @@ void UpdateEscapeWarp(s16 x, s16 y) { u8 currMapType = GetCurrentMapType(); u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum); - if (is_map_type_1_2_3_5_or_6(currMapType) && is_map_type_1_2_3_5_or_6(destMapType) != TRUE) + if (IsMapTypeOutside(currMapType) && IsMapTypeOutside(destMapType) != TRUE) SetEscapeWarp(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x - 7, y - 6); } @@ -837,7 +837,7 @@ static void mli0_load_map(u32 a1) LoadEventObjTemplatesFromHeader(); } - v2 = is_map_type_1_2_3_5_or_6(gMapHeader.mapType); + v2 = IsMapTypeOutside(gMapHeader.mapType); indoors = Overworld_MapTypeIsIndoors(gMapHeader.mapType); sub_80EB218(); @@ -925,7 +925,7 @@ static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *pla static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 transitionFlags, u16 metatileBehavior, u8 mapType) { - if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_6) + if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_OCEAN_ROUTE) return DIR_EAST; else if (MetatileBehavior_IsDeepSouthWarp(metatileBehavior) == TRUE) return DIR_NORTH; @@ -1330,13 +1330,13 @@ u8 GetLastUsedWarpMapType(void) return GetMapTypeByWarpData(&gLastUsedWarp); } -bool8 is_map_type_1_2_3_5_or_6(u8 mapType) +bool8 IsMapTypeOutside(u8 mapType) { if (mapType == MAP_TYPE_ROUTE || mapType == MAP_TYPE_TOWN || mapType == MAP_TYPE_UNDERWATER || mapType == MAP_TYPE_CITY - || mapType == MAP_TYPE_6) + || mapType == MAP_TYPE_OCEAN_ROUTE) return TRUE; else return FALSE; @@ -1346,7 +1346,7 @@ bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType) { if (mapType == MAP_TYPE_ROUTE || mapType == MAP_TYPE_TOWN - || mapType == MAP_TYPE_6 + || mapType == MAP_TYPE_OCEAN_ROUTE || mapType == MAP_TYPE_CITY) return TRUE; else diff --git a/src/region_map.c b/src/region_map.c index 5c85606a8..814849bfd 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -883,7 +883,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void) case MAP_TYPE_CITY: case MAP_TYPE_ROUTE: case MAP_TYPE_UNDERWATER: - case MAP_TYPE_6: + case MAP_TYPE_OCEAN_ROUTE: gRegionMap->mapSecId = gMapHeader.regionMapSectionId; gRegionMap->playerIsInCave = FALSE; mapWidth = gMapHeader.mapLayout->width; @@ -896,7 +896,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void) } break; case MAP_TYPE_UNDERGROUND: - case MAP_TYPE_7: + case MAP_TYPE_UNUSED_2: if (gMapHeader.flags & 0x02) { mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum); diff --git a/src/secret_base.c b/src/secret_base.c index 7ff83dec8..02d627722 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -60,7 +60,7 @@ struct SecretBaseRecordMixer { // Static RAM declarations EWRAM_DATA u8 sCurSecretBaseId = 0; -EWRAM_DATA u8 gUnknown_0203A01D = 0; +EWRAM_DATA bool8 gIsInSecretBase = FALSE; EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL; // Static ROM declarations @@ -1186,11 +1186,11 @@ void SecretBasePerStepCallback(u8 taskId) case 0: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - gUnknown_0203A01D = TRUE; + gIsInSecretBase = TRUE; } else { - gUnknown_0203A01D = FALSE; + gIsInSecretBase = FALSE; } PlayerGetDestCoords(&data[2], &data[3]); data[1] = 1; @@ -1201,103 +1201,103 @@ void SecretBasePerStepCallback(u8 taskId) { data[2] = x; data[3] = y; - VarSet(VAR_0x40EC, VarGet(VAR_0x40EC) + 1); + VarSet(VAR_SECRET_BASE_STEP_COUNTER, VarGet(VAR_SECRET_BASE_STEP_COUNTER) + 1); behavior = MapGridGetMetatileBehaviorAt(x, y); tileId = MapGridGetMetatileIdAt(x, y); if (tileId == 0x234 || tileId == 0x23C) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x20); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x20); } } else if (tileId == 0x2b8 || tileId == 0x2b9 || tileId == 0x2ba || tileId == 0x2c0 || tileId == 0x2c1 || tileId == 0x2c2 || tileId == 0x2c8 || tileId == 0x2c9 || tileId == 0x2ca) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x01); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x01); } } else if (tileId == 0x239 || tileId == 0x241 || tileId == 0x251 || tileId == 0x259) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x04); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x04); } } else if ((behavior == 0x34 && tileId == 0x26d) || (behavior == 0x35 && MapGridGetMetatileIdAt(x, y) == 0x26a)) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x200); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x200); } } else if (behavior == 0xc1 && tileId == 0x23d) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) ^ 0x1000); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x2000); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x1000); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x2000); } } else if (behavior == 0x47 && tileId == 0x23e) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x1000); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) ^ 0x2000); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x1000); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x2000); } } else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x80); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x80); } } else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE) { PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y); - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { switch ((int)MapGridGetMetatileIdAt(x, y)) { case 0x338: case 0x33c: case 0x340: - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x02); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x02); break; case 0x228: - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x100); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x100); break; } } } else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x400); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x400); } ShatterSecretBaseBreakableDoor(x, y); } else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){ - if (gUnknown_0203A01D == TRUE) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8000); + if (gIsInSecretBase == TRUE) { + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8000); } } else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4000); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4000); } } else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE) { - if (gUnknown_0203A01D == TRUE) + if (gIsInSecretBase == TRUE) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x02); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x02); } } } @@ -1780,33 +1780,33 @@ void sub_80EB18C(struct SecretBaseRecord *bases) void sub_80EB1AC(void) { - VarSet(VAR_0x40EC, 0); - VarSet(VAR_0x40ED, 0); - VarSet(VAR_0x40EE, 0); - VarSet(VAR_0x40EF, 0); + VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0); + VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, 0); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, 0); if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40F0, TRUE); + VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, TRUE); } else { - VarSet(VAR_0x40F0, FALSE); + VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE); } - gUnknown_0203A01D = FALSE; + gIsInSecretBase = FALSE; } void sub_80EB218(void) { - if (VarGet(VAR_0x40F0) && gUnknown_0203A01D == TRUE && !CurrentMapIsSecretBase()) + if (VarGet(VAR_SECRET_BASE_IS_NOT_LOCAL) && gIsInSecretBase == TRUE && !CurrentMapIsSecretBase()) { - VarSet(VAR_0x40F0, FALSE); - gUnknown_0203A01D = FALSE; + VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE); + gIsInSecretBase = FALSE; sub_80EEA70(); - VarSet(VAR_0x40EC, 0); - VarSet(VAR_0x40ED, 0); - VarSet(VAR_0x40EE, 0); - VarSet(VAR_0x40EF, 0); - VarSet(VAR_0x40F0, FALSE); + VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0); + VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, 0); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, 0); + VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE); } } @@ -1814,7 +1814,7 @@ void sub_80EB290(void) { if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x800); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x800); } } @@ -1822,7 +1822,7 @@ void sub_80EB2C8(void) { if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x400); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x400); } } @@ -1830,9 +1830,9 @@ void sub_80EB300(void) { if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x2000); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x2000); } } @@ -1840,9 +1840,9 @@ void sub_80EB368(void) { if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x800); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x800); } } @@ -1850,9 +1850,9 @@ void sub_80EB3D0(void) { if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x1000); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x1000); } } @@ -1860,9 +1860,9 @@ void sub_80EB438(void) { if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x001); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x001); } } @@ -1891,7 +1891,7 @@ void sub_80EB498(void) case 0x334: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x4000); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x4000); } break; } @@ -1909,7 +1909,7 @@ void sub_80EB56C(void) case 0x28b: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x40); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x40); } break; case 0x2d8: @@ -1932,21 +1932,21 @@ void sub_80EB56C(void) case 0x2fb: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8); + VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8); } break; case 0x22c: case 0x233: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x40); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x40); } break; case 0x288: case 0x289: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x100); } break; case 0x22d: @@ -1954,7 +1954,7 @@ void sub_80EB56C(void) case 0x22f: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x10); } break; case 0x287: @@ -1982,7 +1982,7 @@ void sub_80EB56C(void) case 0x2cf: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8); } break; } @@ -2009,7 +2009,7 @@ void sub_80EB9E0(void) case 0x2c6: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8); } break; } @@ -2047,14 +2047,14 @@ void sub_80EBB28(void) case 0x2c7: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8); } break; case 0x280: case 0x281: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x100); } break; case 0x225: @@ -2062,7 +2062,7 @@ void sub_80EBB28(void) case 0x227: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x10); } break; } @@ -2080,7 +2080,7 @@ void sub_80EBE7C(void) case 0x28e: if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { - VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4); + VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4); } break; } diff --git a/src/time_events.c b/src/time_events.c index 9702d321f..9263bffac 100644 --- a/src/time_events.c +++ b/src/time_events.c @@ -81,7 +81,7 @@ void UpdateShoalTideFlag(void) 1, // 23 }; - if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType())) + if (IsMapTypeOutside(GetLastUsedWarpMapType())) { RtcCalcLocalTime(); if (tide[gLocalTime.hours]) diff --git a/src/tv.c b/src/tv.c index 248721083..d53cec8b2 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2565,13 +2565,13 @@ void sub_80EEA70(void) show->secretBaseSecrets.kind = TVSHOW_SECRET_BASE_SECRETS; show->secretBaseSecrets.active = FALSE; StringCopy(show->secretBaseSecrets.playerName, gSaveBlock2Ptr->playerName); - show->secretBaseSecrets.stepsInBase = VarGet(VAR_0x40EC); + show->secretBaseSecrets.stepsInBase = VarGet(VAR_SECRET_BASE_STEP_COUNTER); sub_80E980C(); StringCopy(strbuf, gStringVar1); StripExtCtrlCodes(strbuf); StringCopy(show->secretBaseSecrets.baseOwnersName, strbuf); - show->secretBaseSecrets.item = VarGet(VAR_0x40ED); - show->secretBaseSecrets.flags = VarGet(VAR_0x40EE) + (VarGet(VAR_0x40EF) << 16); + show->secretBaseSecrets.item = VarGet(VAR_SECRET_BASE_LAST_ITEM_USED); + show->secretBaseSecrets.flags = VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) + (VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) << 16); tv_store_id_3x(show); show->secretBaseSecrets.language = gGameLanguage; if (show->secretBaseSecrets.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].language == LANGUAGE_JAPANESE) @@ -7350,7 +7350,7 @@ static void DoTVShowWhatsNo1InHoennToday(void) ShowFieldMessage(sTVWhatsNo1InHoennTodayTextGroup[state]); } -u8 sub_80F5180(TVShow *show) +u8 TVShowGetFlagCount(TVShow *show) { u8 i; u8 tot; @@ -7365,7 +7365,7 @@ u8 sub_80F5180(TVShow *show) return tot; } -u8 sub_80F51AC(TVShow *show, u8 a1) +u8 TVShowGetStateForFlagNumber(TVShow *show, u8 a1) { u8 i; u8 tot; @@ -7399,7 +7399,7 @@ static void DoTVShowSecretBaseSecrets(void) case 0: TVShowConvertInternationalString(gStringVar1, show->secretBaseSecrets.baseOwnersName, show->secretBaseSecrets.baseOwnersNameLanguage); TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language); - bitCount = sub_80F5180(show); + bitCount = TVShowGetFlagCount(show); if (bitCount == 0) { sTVShowState = 8; @@ -7408,12 +7408,12 @@ static void DoTVShowSecretBaseSecrets(void) { show->secretBaseSecrets.savedState = 1; sTVSecretBaseSecretsRandomValues[0] = Random() % bitCount; - sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[0]); + sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[0]); } break; case 1: TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language); - bitCount = sub_80F5180(show); + bitCount = TVShowGetFlagCount(show); switch (bitCount) { case 1: @@ -7423,11 +7423,11 @@ static void DoTVShowSecretBaseSecrets(void) show->secretBaseSecrets.savedState = 2; if (sTVSecretBaseSecretsRandomValues[0] == 0) { - sTVShowState = sub_80F51AC(show, 1); + sTVShowState = TVShowGetStateForFlagNumber(show, 1); } else { - sTVShowState = sub_80F51AC(show, 0); + sTVShowState = TVShowGetStateForFlagNumber(show, 0); } break; default: @@ -7440,13 +7440,13 @@ static void DoTVShowSecretBaseSecrets(void) } } show->secretBaseSecrets.savedState = 2; - sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[1]); + sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[1]); break; } break; case 2: TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language); - bitCount = sub_80F5180(show); + bitCount = TVShowGetFlagCount(show); if (bitCount == 2) { sTVShowState = 9; @@ -7462,7 +7462,7 @@ static void DoTVShowSecretBaseSecrets(void) } } show->secretBaseSecrets.savedState = 3; - sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[2]); + sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[2]); } break; case 3: