Document some pokenav and region map

This commit is contained in:
GriffinR 2020-02-05 02:47:32 -05:00
parent 27c4329e45
commit 86354f1d50
65 changed files with 1477 additions and 1453 deletions

View File

@ -3,7 +3,7 @@
"name": "AlteringCave",
"layout": "LAYOUT_ALTERING_CAVE",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_ALTERING_CAVE_2",
"region_map_section": "MAPSEC_ALTERING_CAVE",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "BirthIsland_Exterior",
"layout": "LAYOUT_BIRTH_ISLAND_EXTERIOR",
"music": "MUS_NONE",
"region_map_section": "MAPSEC_BIRTH_ISLAND_2",
"region_map_section": "MAPSEC_BIRTH_ISLAND",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_INDOOR",

View File

@ -3,7 +3,7 @@
"name": "BirthIsland_Harbor",
"layout": "LAYOUT_ISLAND_HARBOR",
"music": "MUS_NONE",
"region_map_section": "MAPSEC_BIRTH_ISLAND_2",
"region_map_section": "MAPSEC_BIRTH_ISLAND",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_INDOOR",

View File

@ -4,7 +4,7 @@ EverGrandeCity_PokemonCenter_1F_MapScripts:: @ 8229A34
.byte 0
EverGrandeCity_PokemonCenter_1F_OnTransition: @ 8229A3F
setrespawn HEAL_LOCATION_EVER_GRANDE_CITY_1
setrespawn HEAL_LOCATION_EVER_GRANDE_CITY
call_if_unset FLAG_MET_SCOTT_IN_EVERGRANDE, EverGrandeCity_PokemonCenter_1F_EventScript_TryShowScott
end

View File

@ -4,7 +4,7 @@ EverGrandeCity_PokemonLeague_1F_MapScripts:: @ 82295D2
.byte 0
EverGrandeCity_PokemonLeague_1F_OnTransition: @ 82295DD
setrespawn HEAL_LOCATION_EVER_GRANDE_CITY_2
setrespawn HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE
setflag FLAG_LANDMARK_POKEMON_LEAGUE
call_if_unset FLAG_ENTERED_ELITE_FOUR, EverGrandeCity_PokemonLeague_1F_EventScript_GuardsBlockDoor
end

View File

@ -3,7 +3,7 @@
"name": "NavelRock_B1F",
"layout": "LAYOUT_NAVEL_ROCK_B1F",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Bottom",
"layout": "LAYOUT_NAVEL_ROCK_BOTTOM",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down01",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down02",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down03",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down04",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down05",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down06",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down07",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down08",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down09",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down10",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Down11",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Entrance",
"layout": "LAYOUT_NAVEL_ROCK_ENTRANCE",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Exterior",
"layout": "LAYOUT_NAVEL_ROCK_EXTERIOR",
"music": "MUS_RG_NANASHIMA",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_INDOOR",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Fork",
"layout": "LAYOUT_NAVEL_ROCK_FORK",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Harbor",
"layout": "LAYOUT_ISLAND_HARBOR",
"music": "MUS_RG_NANASHIMA",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_INDOOR",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Top",
"layout": "LAYOUT_NAVEL_ROCK_TOP",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_SHADE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Up1",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Up2",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Up3",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM1",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -3,7 +3,7 @@
"name": "NavelRock_Up4",
"layout": "LAYOUT_NAVEL_ROCK_LADDER_ROOM2",
"music": "MUS_RG_NANADUNGEON",
"region_map_section": "MAPSEC_NAVEL_ROCK2",
"region_map_section": "MAPSEC_NAVEL_ROCK",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_UNDERGROUND",

View File

@ -172,7 +172,7 @@ AbnormalWeather_StartGroudonWeather:: @ 8273D1B
AbnormalWeather_EventScript_EndEventAndCleanup_1:: @ 8273D1F
lockall
compare VAR_ABNORMAL_WEATHER_LOCATION, ABNORMAL_WEATHER_KYOGRE_LOCATIONS_START
compare VAR_ABNORMAL_WEATHER_LOCATION, MARINE_CAVE_LOCATIONS_START
goto_if_ge AbnormalWeather_EventScript_ShowRainEndedMessage
goto AbnormalWeather_EventScript_ShowSunEndedMessage
end

View File

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

View File

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 431 B

View File

@ -11,16 +11,16 @@
#define HEAL_LOCATION_LILYCOVE_CITY 8
#define HEAL_LOCATION_MOSSDEEP_CITY 9
#define HEAL_LOCATION_SOOTOPOLIS_CITY 10
#define HEAL_LOCATION_EVER_GRANDE_CITY_1 11
#define HEAL_LOCATION_LITTLEROOT_TOWN_1 12
#define HEAL_LOCATION_LITTLEROOT_TOWN_2 13
#define HEAL_LOCATION_EVER_GRANDE_CITY 11
#define HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE 12
#define HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE 13
#define HEAL_LOCATION_OLDALE_TOWN 14
#define HEAL_LOCATION_DEWFORD_TOWN 15
#define HEAL_LOCATION_LAVARIDGE_TOWN 16
#define HEAL_LOCATION_FALLARBOR_TOWN 17
#define HEAL_LOCATION_VERDANTURF_TOWN 18
#define HEAL_LOCATION_PACIFIDLOG_TOWN 19
#define HEAL_LOCATION_EVER_GRANDE_CITY_2 20
#define HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE 20
#define HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR 21
#define HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST 22

View File

@ -175,7 +175,7 @@
#define MAPSEC_SEVII_ISLE_22 0xAB
#define MAPSEC_SEVII_ISLE_23 0xAC
#define MAPSEC_SEVII_ISLE_24 0xAD
#define MAPSEC_NAVEL_ROCK 0xAE
#define MAPSEC_NAVEL_ROCK_FRLG 0xAE
#define MAPSEC_MT_EMBER 0xAF
#define MAPSEC_BERRY_FOREST 0xB0
#define MAPSEC_ICEFALL_CAVE 0xB1
@ -184,11 +184,11 @@
#define MAPSEC_DOTTED_HOLE 0xB4
#define MAPSEC_LOST_CAVE 0xB5
#define MAPSEC_PATTERN_BUSH 0xB6
#define MAPSEC_ALTERING_CAVE 0xB7
#define MAPSEC_ALTERING_CAVE_FRLG 0xB7
#define MAPSEC_TANOBY_CHAMBERS 0xB8
#define MAPSEC_THREE_ISLE_PATH 0xB9
#define MAPSEC_TANOBY_KEY 0xBA
#define MAPSEC_BIRTH_ISLAND 0xBB
#define MAPSEC_BIRTH_ISLAND_FRLG 0xBB
#define MAPSEC_MONEAN_CHAMBER 0xBC
#define MAPSEC_LIPTOO_CHAMBER 0xBD
#define MAPSEC_WEEPTH_CHAMBER 0xBE
@ -201,7 +201,7 @@
#define MAPSEC_AQUA_HIDEOUT 0xC5
#define MAPSEC_MAGMA_HIDEOUT 0xC6
#define MAPSEC_MIRAGE_TOWER 0xC7
#define MAPSEC_BIRTH_ISLAND_2 0xC8
#define MAPSEC_BIRTH_ISLAND 0xC8
#define MAPSEC_FARAWAY_ISLAND 0xC9
#define MAPSEC_ARTISAN_CAVE 0xCA
#define MAPSEC_MARINE_CAVE 0xCB
@ -211,8 +211,8 @@
#define MAPSEC_UNDERWATER_UNK1 0xCF
#define MAPSEC_UNDERWATER_129 0xD0
#define MAPSEC_DESERT_UNDERPASS 0xD1
#define MAPSEC_ALTERING_CAVE_2 0xD2
#define MAPSEC_NAVEL_ROCK2 0xD3
#define MAPSEC_ALTERING_CAVE 0xD2
#define MAPSEC_NAVEL_ROCK 0xD3
#define MAPSEC_TRAINER_HILL 0xD4
#define MAPSEC_NONE 0xD5

View File

@ -39,28 +39,31 @@
// These are the "abnormal weather events" that are used
// to find Kyogre and Groudon.
#define ABNORMAL_WEATHER_COUNT_PER_LEGENDARY 8
#define ABNORMAL_WEATHER_GROUDON_LOCATIONS_START 1
#define ABNORMAL_WEATHER_KYOGRE_LOCATIONS_START 1 + ABNORMAL_WEATHER_COUNT_PER_LEGENDARY
#define ABNORMAL_WEATHER_LOCATIONS (MARINE_CAVE_LOCATIONS + TERRA_CAVE_LOCATIONS)
#define ABNORMAL_WEATHER_NONE 0
// Groudon locations
#define ABNORMAL_WEATHER_ROUTE_114_NORTH 1
#define ABNORMAL_WEATHER_ROUTE_114_SOUTH 2
#define ABNORMAL_WEATHER_ROUTE_115_WEST 3
#define ABNORMAL_WEATHER_ROUTE_115_EAST 4
#define ABNORMAL_WEATHER_ROUTE_116_NORTH 5
#define ABNORMAL_WEATHER_ROUTE_116_SOUTH 6
#define ABNORMAL_WEATHER_ROUTE_118_EAST 7
#define ABNORMAL_WEATHER_ROUTE_118_WEST 8
// Kyogre locations
#define ABNORMAL_WEATHER_ROUTE_105_NORTH 9
#define ABNORMAL_WEATHER_ROUTE_105_SOUTH 10
#define ABNORMAL_WEATHER_ROUTE_125_WEST 11
#define ABNORMAL_WEATHER_ROUTE_125_EAST 12
#define ABNORMAL_WEATHER_ROUTE_127_NORTH 13
#define ABNORMAL_WEATHER_ROUTE_127_SOUTH 14
#define ABNORMAL_WEATHER_ROUTE_129_WEST 15
#define ABNORMAL_WEATHER_ROUTE_129_EAST 16
// Groudon/Terra Cave locations
#define TERRA_CAVE_LOCATIONS_START 1
#define ABNORMAL_WEATHER_ROUTE_114_NORTH (TERRA_CAVE_LOCATIONS_START + 0)
#define ABNORMAL_WEATHER_ROUTE_114_SOUTH (TERRA_CAVE_LOCATIONS_START + 1)
#define ABNORMAL_WEATHER_ROUTE_115_WEST (TERRA_CAVE_LOCATIONS_START + 2)
#define ABNORMAL_WEATHER_ROUTE_115_EAST (TERRA_CAVE_LOCATIONS_START + 3)
#define ABNORMAL_WEATHER_ROUTE_116_NORTH (TERRA_CAVE_LOCATIONS_START + 4)
#define ABNORMAL_WEATHER_ROUTE_116_SOUTH (TERRA_CAVE_LOCATIONS_START + 5)
#define ABNORMAL_WEATHER_ROUTE_118_EAST (TERRA_CAVE_LOCATIONS_START + 6)
#define ABNORMAL_WEATHER_ROUTE_118_WEST (TERRA_CAVE_LOCATIONS_START + 7)
#define TERRA_CAVE_LOCATIONS 8
// Kyogre/Marina Cave locations
#define MARINE_CAVE_LOCATIONS_START (TERRA_CAVE_LOCATIONS_START + TERRA_CAVE_LOCATIONS)
#define ABNORMAL_WEATHER_ROUTE_105_NORTH (MARINE_CAVE_LOCATIONS_START + 0)
#define ABNORMAL_WEATHER_ROUTE_105_SOUTH (MARINE_CAVE_LOCATIONS_START + 1)
#define ABNORMAL_WEATHER_ROUTE_125_WEST (MARINE_CAVE_LOCATIONS_START + 2)
#define ABNORMAL_WEATHER_ROUTE_125_EAST (MARINE_CAVE_LOCATIONS_START + 3)
#define ABNORMAL_WEATHER_ROUTE_127_NORTH (MARINE_CAVE_LOCATIONS_START + 4)
#define ABNORMAL_WEATHER_ROUTE_127_SOUTH (MARINE_CAVE_LOCATIONS_START + 5)
#define ABNORMAL_WEATHER_ROUTE_129_WEST (MARINE_CAVE_LOCATIONS_START + 6)
#define ABNORMAL_WEATHER_ROUTE_129_EAST (MARINE_CAVE_LOCATIONS_START + 7)
#define MARINE_CAVE_LOCATIONS 8
#endif // GUARD_CONSTANTS_WEATHER_H

View File

@ -0,0 +1,17 @@
#ifndef GUARD_POKEDEX_AREA_REGION_MAP_H
#define GUARD_POKEDEX_AREA_REGION_MAP_H
struct PokedexAreaMapTemplate
{
u32 bg:2;
u32 offset:8;
u32 mode:2;
u32 unk:20; // never read
};
void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *);
bool32 sub_81C4E90(void);
void PokedexAreaMapChangeBgY(u32);
void FreePokedexAreaMapBgNum(void);
#endif // GUARD_POKEDEX_AREA_REGION_MAP_H

View File

@ -65,24 +65,44 @@ enum
POKENAV_MODE_FORCE_CALL_EXIT, // Pokenav tutorial after calling Mr. Stone
};
enum
{
POKENAV_GFX_MAIN_MENU,
POKENAV_GFX_CONDITION_MENU,
POKENAV_GFX_RIBBONS_MENU,
POKENAV_GFX_MATCH_CALL_MENU,
POKENAV_GFX_MAP_MENU_ZOOMED_OUT,
POKENAV_GFX_MAP_MENU_ZOOMED_IN,
POKENAV_GFX_PARTY_MENU,
POKENAV_GFX_SEARCH_MENU,
POKENAV_GFX_COOL_MENU,
POKENAV_GFX_BEAUTY_MENU,
POKENAV_GFX_CUTE_MENU,
POKENAV_GFX_SMART_MENU,
POKENAV_GFX_TOUGH_MENU,
POKENAV_GFX_MENUS_END,
};
#define POKENAV_GFX_SUBMENUS_START POKENAV_GFX_PARTY_MENU
#define POKENAV_MENU_IDS_START 100000
enum
{
POKENAV_MENU_0 = POKENAV_MENU_IDS_START,
POKENAV_MENU_1,
POKENAV_MENU_2,
POKENAV_MENU_3,
POKENAV_MENU_4,
POKENAV_MENU_5,
POKENAV_MENU_6,
POKENAV_MENU_7,
POKENAV_MENU_8,
POKENAV_MENU_9,
POKENAV_MENU_A,
POKENAV_MENU_B,
POKENAV_MENU_C,
POKENAV_MENU_D,
POKENAV_MENU_E,
POKENAV_MAIN_MENU = POKENAV_MENU_IDS_START,
POKENAV_MAIN_MENU_CURSOR_ON_MAP,
POKENAV_CONDITION_MENU,
POKENAV_CONDITION_SEARCH_MENU,
POKENAV_MAIN_MENU_CURSOR_ON_MATCH_CALL,
POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS,
POKENAV_REGION_MAP,
POKENAV_CONDITION_PARTY,
POKENAV_CONDITION_SEARCH_RESULTS,
POKENAV_MENU_9, // Condition
POKENAV_MENU_A, // Condition
POKENAV_MATCH_CALL,
POKENAV_RIBBONS_MON_LIST,
POKENAV_MENU_D, // Ribbons
POKENAV_MENU_E, // Ribbons
};
enum
@ -220,6 +240,15 @@ enum
POKENAV_MC_FUNC_EXIT
};
enum
{
POKENAV_MAP_FUNC_NONE,
POKENAV_MAP_FUNC_CURSOR_MOVED,
POKENAV_MAP_FUNC_ZOOM_OUT,
POKENAV_MAP_FUNC_ZOOM_IN,
POKENAV_MAP_FUNC_EXIT,
};
// pokenav.c
void SetSelectedConditionSearch(u32);
u32 GetSelectedConditionSearch(void);
@ -275,7 +304,7 @@ void sub_81C7850(u32 a0);
u32 sub_81C786C(void);
void LoadLeftHeaderGfxForIndex(u32 arg0);
void sub_81C7FA0(u32 arg0, bool32 arg1, bool32 arg2);
void sub_81C7AC0(s32 a0);
void PokenavFadeScreen(s32 fadeType);
bool32 sub_81C8010(void);
void InitBgTemplates(const struct BgTemplate *templates, int count);
bool32 IsPaletteFadeActive(void);
@ -298,30 +327,30 @@ void sub_81C7834(void *func1, void *func2);
void ShutdownPokenav(void);
// pokenav_menu_handler_1.c
bool32 PokenavCallback_Init_0(void);
bool32 PokenavCallback_Init_4(void);
bool32 PokenavCallback_Init_5(void);
bool32 PokenavCallback_Init_2(void);
bool32 PokenavCallback_Init_3(void);
u32 sub_81C941C(void);
void sub_81C9430(void);
bool32 PokenavCallback_Init_MainMenuCursorOnMap(void);
bool32 PokenavCallback_Init_MainMenuCursorOnMatchCall(void);
bool32 PokenavCallback_Init_MainMenuCursorOnRibbons(void);
bool32 PokenavCallback_Init_ConditionMenu(void);
bool32 PokenavCallback_Init_ConditionSearchMenu(void);
u32 GetMenuHandlerCallback(void);
void FreeMenuHandlerSubstruct1(void);
int GetPokenavMenuType(void);
int GetPokenavCursorPos(void);
int GetCurrentMenuItemId(void);
u16 GetHelpBarTextId(void);
// pokenav_menu_handler_2.c
bool32 sub_81C9924(void);
bool32 sub_81C9940(void);
bool32 OpenPokenavMenuInitial(void);
bool32 OpenPokenavMenuNotInitial(void);
void CreateMenuHandlerLoopedTask(s32 ltIdx);
bool32 sub_81C99C0(void);
void sub_81C99D4(void);
bool32 IsMenuHandlerLoopedTaskActive(void);
void FreeMenuHandlerSubstruct2(void);
void sub_81CAADC(void);
// pokenav_match_call_1.c
bool32 PokenavCallback_Init_11(void);
u32 sub_81CAB24(void);
void sub_81CAB38(void);
bool32 PokenavCallback_Init_MatchCall(void);
u32 GetMatchCallCallback(void);
void FreeMatchCallSubstruct1(void);
int sub_81CAE28(void);
int GetNumberRegistered(void);
int sub_81CAE48(void);
@ -341,19 +370,19 @@ int GetIndexDeltaOfNextCheckPageUp(int index);
bool32 IsRematchEntryRegistered(int index);
// pokenav_match_call_2.c
bool32 sub_81CB260(void);
bool32 OpenMatchCall(void);
void CreateMatchCallLoopedTask(s32 index);
u32 sub_81CB2CC(void);
void sub_81CB2E0(void);
bool32 IsMatchCallLoopedTaskActive(void);
void FreeMatchCallSubstruct2(void);
// pokenav_region_map.c
u32 PokenavCallback_Init_6(void);
void sub_81CC524(void);
u32 sub_81CC554(void);
bool32 sub_81CC5F4(void);
void sub_81CC62C(s32);
u32 sub_81CC65C(void);
void sub_81CC670(void);
u32 PokenavCallback_Init_RegionMap(void);
u32 GetRegionMapCallback(void);
bool32 OpenPokenavRegionMap(void);
void CreateRegionMapLoopedTask(s32);
bool32 IsRegionMapLoopedTaskActive(void);
void FreeRegionMapSubstruct1(void);
void FreeRegionMapSubstruct2(void);
// pokenav_conditions_1.c
u32 PokenavCallback_Init_7(void);

View File

@ -4,20 +4,21 @@
#include "bg.h"
// Exported type declarations
#define MAP_NAME_LENGTH 16
enum
{
INPUT_EVENT_NONE,
INPUT_EVENT_MOVE_START,
INPUT_EVENT_MOVE_CONT,
INPUT_EVENT_MOVE_END,
INPUT_EVENT_A_BUTTON,
INPUT_EVENT_B_BUTTON,
MAP_INPUT_NONE,
MAP_INPUT_MOVE_START,
MAP_INPUT_MOVE_CONT,
MAP_INPUT_MOVE_END,
MAP_INPUT_A_BUTTON,
MAP_INPUT_B_BUTTON,
};
enum {
MAPSECTYPE_NONE,
MAPSECTYPE_PLAIN,
MAPSECTYPE_ROUTE,
MAPSECTYPE_CITY_CANFLY,
MAPSECTYPE_CITY_CANTFLY,
MAPSECTYPE_BATTLE_FRONTIER
@ -25,9 +26,9 @@ enum {
struct RegionMap {
/*0x000*/ u16 mapSecId;
/*0x002*/ u8 iconDrawType;
/*0x002*/ u8 mapSecType;
/*0x003*/ u8 posWithinMapSec;
/*0x004*/ u8 mapSecName[0x14];
/*0x004*/ u8 mapSecName[20];
/*0x018*/ u8 (*inputCallback)(void);
/*0x01c*/ struct Sprite *cursorSprite;
/*0x020*/ struct Sprite *playerIconSprite;
@ -90,28 +91,28 @@ struct RegionMapLocation
// Exported RAM declarations
// Exported ROM declarations
void sub_8122CF8(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed);
bool8 sub_8122DB0(void);
void InitRegionMapData(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed);
bool8 LoadRegionMapGfx(void);
void UpdateRegionMapVideoRegs(void);
void InitRegionMap(struct RegionMap *regionMap, u8 argument);
u8 sub_81230AC(void);
bool8 sub_8123514(void);
u8 DoRegionMapInputCallback(void);
bool8 UpdateRegionMapZoom(void);
void FreeRegionMapIconResources(void);
u16 GetRegionMapSectionIdAt(u16 x, u16 y);
u16 GetRegionMapSecIdAt(u16 x, u16 y);
void CreateRegionMapPlayerIcon(u16 x, u16 y);
void CreateRegionMapCursor(u16 tileTag, u16 paletteTag);
bool32 IsEventIslandMapSecId(u8 mapSecId);
u8 *GetMapName(u8 *, u16, u16);
bool32 sub_8124668(u8 mapSecId);
u8 *GetMapNameGeneric(u8 *dest, u16 mapSecId);
u8 *sub_8124610(u8 *dest, u16 mapSecId);
u8 *GetMapNameHandleAquaHideout(u8 *dest, u16 mapSecId);
u16 CorrectSpecialMapSecId(u16 mapSecId);
void sub_8122D88(struct RegionMap *regionMap);
void ShowRegionMapForPokedexAreaScreen(struct RegionMap *regionMap);
void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y);
void MCB2_FlyMap(void);
bool8 sub_8124658(void);
void sub_812454C(void);
void sub_8123030(u16 a0, u32 a1);
void sub_8123418(void);
void CB2_OpenFlyMap(void);
bool8 IsRegionMapZoomed(void);
void TrySetPlayerIconBlink(void);
void sub_8123030(u16 color, u32 coeff);
void SetRegionMapDataForZoom(void);
extern const struct RegionMapLocation gRegionMapEntries[];

View File

@ -1,17 +0,0 @@
#ifndef GUARD_UNK_POKEDEX_AREA_SCREEN_HELPER_H
#define GUARD_UNK_POKEDEX_AREA_SCREEN_HELPER_H
struct UnkStruct_1C4D70
{
u32 bg:2;
u32 unk2:8;
u32 unk10:2;
u32 unk12:20;
};
void sub_81C4D70(const struct UnkStruct_1C4D70 *);
bool32 sub_81C4E90(void);
void sub_81C4ED0(u32);
void sub_81C4EB4(void);
#endif // GUARD_UNK_POKEDEX_AREA_SCREEN_HELPER_H

View File

@ -302,7 +302,7 @@ SECTIONS {
src/mirage_tower.o(.text);
src/berry_fix_program.o(.text);
src/pokemon_summary_screen.o(.text);
src/unk_pokedex_area_screen_helper.o(.text);
src/pokedex_area_region_map.o(.text);
src/battle_pyramid_bag.o(.text);
src/pokenav.o(.text);
src/pokenav_main_menu.o(.text);
@ -659,7 +659,7 @@ SECTIONS {
src/mirage_tower.o(.rodata);
src/berry_fix_program.o(.rodata);
src/pokemon_summary_screen.o(.rodata);
src/unk_pokedex_area_screen_helper.o(.rodata);
src/pokedex_area_region_map.o(.rodata);
src/battle_pyramid_bag.o(.rodata);
src/pokenav.o(.rodata);
src/pokenav_main_menu.o(.rodata);

View File

@ -1,112 +1,112 @@
const struct CityMapEntry gPokenavCityMaps[] =
static const struct CityMapEntry sPokenavCityMaps[NUM_CITY_MAPS] =
{
{
.mapSecId = 0,
.mapSecId = MAPSEC_LITTLEROOT_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Littleroot_0,
},
{
.mapSecId = 1,
.mapSecId = MAPSEC_OLDALE_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Oldale_0,
},
{
.mapSecId = 2,
.mapSecId = MAPSEC_DEWFORD_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Dewford_0,
},
{
.mapSecId = 3,
.mapSecId = MAPSEC_LAVARIDGE_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Lavarige_0,
},
{
.mapSecId = 4,
.mapSecId = MAPSEC_FALLARBOR_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Fallarbor_0,
},
{
.mapSecId = 5,
.mapSecId = MAPSEC_VERDANTURF_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Verdanturf_0,
},
{
.mapSecId = 6,
.mapSecId = MAPSEC_PACIFIDLOG_TOWN,
.index = 0,
.tilemap = gPokenavCityMap_Pacifidlog_0,
},
{
.mapSecId = 7,
.mapSecId = MAPSEC_PETALBURG_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Petalburg_0,
},
{
.mapSecId = 8,
.mapSecId = MAPSEC_SLATEPORT_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Slateport_0,
},
{
.mapSecId = 8,
.mapSecId = MAPSEC_SLATEPORT_CITY,
.index = 1,
.tilemap = gPokenavCityMap_Slateport_1,
},
{
.mapSecId = 9,
.mapSecId = MAPSEC_MAUVILLE_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Mauville_0,
},
{
.mapSecId = 9,
.mapSecId = MAPSEC_MAUVILLE_CITY,
.index = 1,
.tilemap = gPokenavCityMap_Mauville_1,
},
{
.mapSecId = 10,
.mapSecId = MAPSEC_RUSTBORO_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Rustboro_0,
},
{
.mapSecId = 10,
.mapSecId = MAPSEC_RUSTBORO_CITY,
.index = 1,
.tilemap = gPokenavCityMap_Rustboro_1,
},
{
.mapSecId = 11,
.mapSecId = MAPSEC_FORTREE_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Fortree_0,
},
{
.mapSecId = 12,
.mapSecId = MAPSEC_LILYCOVE_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Lilycove_0,
},
{
.mapSecId = 12,
.mapSecId = MAPSEC_LILYCOVE_CITY,
.index = 1,
.tilemap = gPokenavCityMap_Lilycove_1,
},
{
.mapSecId = 13,
.mapSecId = MAPSEC_MOSSDEEP_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Mossdeep_0,
},
{
.mapSecId = 13,
.mapSecId = MAPSEC_MOSSDEEP_CITY,
.index = 1,
.tilemap = gPokenavCityMap_Mossdeep_1,
},
{
.mapSecId = 14,
.mapSecId = MAPSEC_SOOTOPOLIS_CITY,
.index = 0,
.tilemap = gPokenavCityMap_Sootopolis_0,
},
{
.mapSecId = 15,
.mapSecId = MAPSEC_EVER_GRANDE_CITY,
.index = 0,
.tilemap = gPokenavCityMap_EverGrande_0,
},
{
.mapSecId = 15,
.mapSecId = MAPSEC_EVER_GRANDE_CITY,
.index = 1,
.tilemap = gPokenavCityMap_EverGrande_1,
},

View File

@ -374,7 +374,7 @@ const struct RegionMapLocation gRegionMapEntries[] = {
[MAPSEC_SEVII_ISLE_22] = { 0, 0, 1, 1, sMapName_SeviiIsle22},
[MAPSEC_SEVII_ISLE_23] = { 0, 0, 1, 1, sMapName_SeviiIsle23},
[MAPSEC_SEVII_ISLE_24] = { 0, 0, 1, 1, sMapName_SeviiIsle24},
[MAPSEC_NAVEL_ROCK] = { 0, 0, 1, 1, sMapName_NavelRock},
[MAPSEC_NAVEL_ROCK_FRLG] = { 0, 0, 1, 1, sMapName_NavelRock},
[MAPSEC_MT_EMBER] = { 0, 0, 1, 1, sMapName_MtEmber},
[MAPSEC_BERRY_FOREST] = { 0, 0, 1, 1, sMapName_BerryForest},
[MAPSEC_ICEFALL_CAVE] = { 0, 0, 1, 1, sMapName_IcefallCave},
@ -383,11 +383,11 @@ const struct RegionMapLocation gRegionMapEntries[] = {
[MAPSEC_DOTTED_HOLE] = { 0, 0, 1, 1, sMapName_DottedHole},
[MAPSEC_LOST_CAVE] = { 0, 0, 1, 1, sMapName_LostCave},
[MAPSEC_PATTERN_BUSH] = { 0, 0, 1, 1, sMapName_PatternBush},
[MAPSEC_ALTERING_CAVE] = { 0, 0, 1, 1, sMapName_AlteringCave},
[MAPSEC_ALTERING_CAVE_FRLG] = { 0, 0, 1, 1, sMapName_AlteringCave},
[MAPSEC_TANOBY_CHAMBERS] = { 0, 0, 1, 1, sMapName_TanobyChambers},
[MAPSEC_THREE_ISLE_PATH] = { 0, 0, 1, 1, sMapName_ThreeIslePath},
[MAPSEC_TANOBY_KEY] = { 0, 0, 1, 1, sMapName_TanobyKey},
[MAPSEC_BIRTH_ISLAND] = { 0, 0, 1, 1, sMapName_BirthIsland},
[MAPSEC_BIRTH_ISLAND_FRLG] = { 0, 0, 1, 1, sMapName_BirthIsland},
[MAPSEC_MONEAN_CHAMBER] = { 0, 0, 1, 1, sMapName_MoneanChamber},
[MAPSEC_LIPTOO_CHAMBER] = { 0, 0, 1, 1, sMapName_LiptooChamber},
[MAPSEC_WEEPTH_CHAMBER] = { 0, 0, 1, 1, sMapName_WeepthChamber},
@ -400,7 +400,7 @@ const struct RegionMapLocation gRegionMapEntries[] = {
[MAPSEC_AQUA_HIDEOUT] = {19, 3, 1, 1, sMapName_AquaHideout},
[MAPSEC_MAGMA_HIDEOUT] = { 6, 3, 1, 1, sMapName_MagmaHideout},
[MAPSEC_MIRAGE_TOWER] = { 8, 2, 1, 1, sMapName_MirageTower},
[MAPSEC_BIRTH_ISLAND_2] = { 0, 0, 1, 1, sMapName_BirthIsland},
[MAPSEC_BIRTH_ISLAND] = { 0, 0, 1, 1, sMapName_BirthIsland},
[MAPSEC_FARAWAY_ISLAND] = { 0, 0, 1, 1, sMapName_FarawayIsland},
[MAPSEC_ARTISAN_CAVE] = {22, 12, 1, 1, sMapName_ArtisanCave},
[MAPSEC_MARINE_CAVE] = { 0, 0, 1, 1, sMapName_MarineCave},
@ -410,8 +410,8 @@ const struct RegionMapLocation gRegionMapEntries[] = {
[MAPSEC_UNDERWATER_UNK1] = {24, 3, 2, 2, sMapName_Underwater},
[MAPSEC_UNDERWATER_129] = {24, 10, 2, 1, sMapName_Underwater},
[MAPSEC_DESERT_UNDERPASS] = { 2, 0, 1, 1, sMapName_DesertUnderpass},
[MAPSEC_ALTERING_CAVE_2] = { 6, 8, 1, 1, sMapName_AlteringCave},
[MAPSEC_NAVEL_ROCK2] = { 0, 0, 1, 1, sMapName_NavelRock},
[MAPSEC_ALTERING_CAVE] = { 6, 8, 1, 1, sMapName_AlteringCave},
[MAPSEC_NAVEL_ROCK] = { 0, 0, 1, 1, sMapName_NavelRock},
[MAPSEC_TRAINER_HILL] = { 8, 4, 1, 1, sMapName_TrainerHill}
};

View File

@ -13,13 +13,23 @@
#include "window.h"
#include "constants/rgb.h"
/*
* This is the type of map shown when interacting with the metatiles for
* a wall-mounted Region Map (on the wall of the Pokemon Centers near the PC)
* It does not zoom, and pressing A or B closes the map
*
* For the region map in the pokenav, see pokenav_region_map.c
* For the region map in the pokedex, see pokdex_area_screen.c/pokedex_area_region_map.c
* For the fly map, and utility functions all of the maps use, see region_map.c
*/
// Static type declarations
// Static RAM declarations
static EWRAM_DATA struct {
MainCallback callback;
u32 filler_004;
u32 unused;
struct RegionMap regionMap;
u16 state;
} *sFieldRegionMapHandler = NULL;
@ -34,7 +44,7 @@ static void PrintRegionMapSecName(void);
// .rodata
static const struct BgTemplate gUnknown_085E5068[] = {
static const struct BgTemplate sFieldRegionMapBgTemplates[] = {
{
.bg = 0,
.charBaseIndex = 0,
@ -54,7 +64,7 @@ static const struct BgTemplate gUnknown_085E5068[] = {
}
};
static const struct WindowTemplate gUnknown_085E5070[] =
static const struct WindowTemplate sFieldRegionMapWindowTemplates[] =
{
{
.bg = 0,
@ -102,8 +112,8 @@ static void MCB2_InitRegionMapRegisters(void)
ResetSpriteData();
FreeAllSpritePalettes();
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(1, gUnknown_085E5068, 2);
InitWindows(gUnknown_085E5070);
InitBgsFromTemplates(1, sFieldRegionMapBgTemplates, 2);
InitWindows(sFieldRegionMapWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 0x27, 0xd0);
clear_scheduled_bg_copies_to_vram();
@ -134,7 +144,7 @@ static void FieldUpdateRegionMap(void)
switch (sFieldRegionMapHandler->state)
{
case 0:
InitRegionMap(&sFieldRegionMapHandler->regionMap, 0);
InitRegionMap(&sFieldRegionMapHandler->regionMap, FALSE);
CreateRegionMapPlayerIcon(0, 0);
CreateRegionMapCursor(1, 1);
sFieldRegionMapHandler->state++;
@ -162,13 +172,13 @@ static void FieldUpdateRegionMap(void)
}
break;
case 4:
switch (sub_81230AC())
switch (DoRegionMapInputCallback())
{
case INPUT_EVENT_MOVE_END:
case MAP_INPUT_MOVE_END:
PrintRegionMapSecName();
break;
case INPUT_EVENT_A_BUTTON:
case INPUT_EVENT_B_BUTTON:
case MAP_INPUT_A_BUTTON:
case MAP_INPUT_B_BUTTON:
sFieldRegionMapHandler->state++;
break;
}
@ -184,8 +194,7 @@ static void FieldUpdateRegionMap(void)
SetMainCallback2(sFieldRegionMapHandler->callback);
if (sFieldRegionMapHandler != NULL)
{
free(sFieldRegionMapHandler);
sFieldRegionMapHandler = NULL;
FREE_AND_SET_NULL(sFieldRegionMapHandler);
}
FreeAllWindowBuffers();
}
@ -195,7 +204,7 @@ static void FieldUpdateRegionMap(void)
static void PrintRegionMapSecName(void)
{
if (sFieldRegionMapHandler->regionMap.iconDrawType != MAPSECTYPE_NONE)
if (sFieldRegionMapHandler->regionMap.mapSecType != MAPSECTYPE_NONE)
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);

View File

@ -3550,21 +3550,21 @@ void CreateAbnormalWeatherEvent(void)
if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
{
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % ABNORMAL_WEATHER_COUNT_PER_LEGENDARY) + ABNORMAL_WEATHER_GROUDON_LOCATIONS_START);
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % TERRA_CAVE_LOCATIONS) + TERRA_CAVE_LOCATIONS_START);
}
else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE)
{
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % ABNORMAL_WEATHER_COUNT_PER_LEGENDARY) + ABNORMAL_WEATHER_KYOGRE_LOCATIONS_START);
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % MARINE_CAVE_LOCATIONS) + MARINE_CAVE_LOCATIONS_START);
}
else if ((randomValue & 1) == 0)
{
randomValue = Random();
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % ABNORMAL_WEATHER_COUNT_PER_LEGENDARY) + ABNORMAL_WEATHER_GROUDON_LOCATIONS_START);
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % TERRA_CAVE_LOCATIONS) + TERRA_CAVE_LOCATIONS_START);
}
else
{
randomValue = Random();
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % ABNORMAL_WEATHER_COUNT_PER_LEGENDARY) + ABNORMAL_WEATHER_KYOGRE_LOCATIONS_START);
VarSet(VAR_ABNORMAL_WEATHER_LOCATION, (randomValue % MARINE_CAVE_LOCATIONS) + MARINE_CAVE_LOCATIONS_START);
}
}
@ -3595,14 +3595,10 @@ bool32 GetAbnormalWeatherMapNameAndType(void)
GetMapName(gStringVar1, sAbnormalWeatherMapNumbers[abnormalWeather - 1], 0);
if (abnormalWeather < ABNORMAL_WEATHER_KYOGRE_LOCATIONS_START)
{
if (abnormalWeather < MARINE_CAVE_LOCATIONS_START)
return FALSE;
}
else
{
return TRUE;
}
}
bool8 AbnormalWeatherHasExpired(void)

View File

@ -1355,8 +1355,8 @@ const u16 gPokenavMessageBox_Pal[] = INCBIN_U16("graphics/pokenav/message.gbapal
const u32 gPokenavMessageBox_Gfx[] = INCBIN_U32("graphics/pokenav/message.4bpp.lz");
const u32 gPokenavMessageBox_Tilemap[] = INCBIN_U32("graphics/pokenav/message.bin.lz");
const u16 gHoennMapZoomIcons_Pal[] = INCBIN_U16("graphics/pokenav/zoom_tiles.gbapal");
const u32 gHoennMapZoomIcons_Gfx[] = INCBIN_U32("graphics/pokenav/zoom.4bpp.lz");
const u16 gRegionMapCityZoomTiles_Pal[] = INCBIN_U16("graphics/pokenav/city_zoom_tiles.gbapal");
const u32 gRegionMapCityZoomText_Gfx[] = INCBIN_U32("graphics/pokenav/city_zoom_text.4bpp.lz");
const u16 gPokenavConditionCancel_Pal[] = INCBIN_U16("graphics/pokenav/cancel.gbapal");
const u8 gPokenavConditionCancel_Gfx[] = INCBIN_U8("graphics/pokenav/cancel.4bpp");

View File

@ -161,7 +161,7 @@ static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] =
[MAPSEC_AQUA_HIDEOUT - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_MAGMA_HIDEOUT - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_MIRAGE_TOWER - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_BIRTH_ISLAND_2 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_WOOD,
[MAPSEC_BIRTH_ISLAND - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_WOOD,
[MAPSEC_FARAWAY_ISLAND - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_WOOD,
[MAPSEC_ARTISAN_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_MARINE_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
@ -171,8 +171,8 @@ static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] =
[MAPSEC_UNDERWATER_UNK1 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2,
[MAPSEC_UNDERWATER_129 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2,
[MAPSEC_DESERT_UNDERPASS - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_ALTERING_CAVE_2 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_NAVEL_ROCK2 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_ALTERING_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_NAVEL_ROCK - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE
};

View File

@ -3680,7 +3680,7 @@ static void CursorCb_FieldMove(u8 taskId)
sPartyMenuInternal->data[0] = fieldMove;
break;
case FIELD_MOVE_FLY:
gPartyMenu.exitCallback = MCB2_FlyMap;
gPartyMenu.exitCallback = CB2_OpenFlyMap;
Task_ClosePartyMenu(taskId);
break;
default:

View File

@ -0,0 +1,66 @@
#include "global.h"
#include "main.h"
#include "menu.h"
#include "bg.h"
#include "malloc.h"
#include "palette.h"
#include "pokedex_area_region_map.h"
static EWRAM_DATA u8 *sPokedexAreaMapBgNum = NULL;
static const u16 sPokedexAreaMap_Pal[] = INCBIN_U16("graphics/interface/region_map.gbapal");
static const u32 sPokedexAreaMap_Gfx[] = INCBIN_U32("graphics/interface/region_map.8bpp.lz");
static const u32 sPokedexAreaMap_Tilemap[] = INCBIN_U32("graphics/interface/region_map.bin.lz");
static const u32 sPokedexAreaMapAffine_Gfx[] = INCBIN_U32("graphics/interface/region_map_affine.8bpp.lz");
static const u32 sPokedexAreaMapAffine_Tilemap[] = INCBIN_U32("graphics/interface/region_map_affine.bin.lz");
void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
{
u8 mode;
sPokedexAreaMapBgNum = Alloc(4);
mode = template->mode;
if (mode == 0)
{
SetBgAttribute(template->bg, BG_ATTR_METRIC, 0);
decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMap_Gfx, 0, template->offset, 0);
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMap_Tilemap, 0, 0, 1), template->offset, 32, 32, FALSE);
}
else
{
SetBgAttribute(template->bg, BG_ATTR_METRIC, 2);
SetBgAttribute(template->bg, BG_ATTR_TYPE, 1);
decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMapAffine_Gfx, 0, template->offset, 0);
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMapAffine_Tilemap, 0, 0, 1), template->offset, 64, 64, TRUE);
}
ChangeBgX(template->bg, 0, 0);
ChangeBgY(template->bg, 0, 0);
SetBgAttribute(template->bg, BG_ATTR_PALETTEMODE, 1);
CpuCopy32(sPokedexAreaMap_Pal, &gPlttBufferUnfaded[0x70], 0x60);
*sPokedexAreaMapBgNum = template->bg;
}
bool32 sub_81C4E90(void)
{
if (!free_temp_tile_data_buffers_if_possible())
{
ShowBg(*sPokedexAreaMapBgNum);
return FALSE;
}
else
{
return TRUE;
}
}
void FreePokedexAreaMapBgNum(void)
{
if (sPokedexAreaMapBgNum != NULL)
FREE_AND_SET_NULL(sPokedexAreaMapBgNum);
}
void PokedexAreaMapChangeBgY(u32 a0)
{
ChangeBgY(*sPokedexAreaMapBgNum, a0 * 0x100, 0);
}

View File

@ -14,7 +14,7 @@
#include "sound.h"
#include "string_util.h"
#include "trig.h"
#include "unk_pokedex_area_screen_helper.h"
#include "pokedex_area_region_map.h"
#include "wild_encounter.h"
#include "constants/maps.h"
#include "constants/region_map_sections.h"
@ -113,7 +113,7 @@ static const u16 sLandmarkData[][2] =
{
{MAPSEC_SKY_PILLAR, FLAG_LANDMARK_SKY_PILLAR},
{MAPSEC_SEAFLOOR_CAVERN, FLAG_LANDMARK_SEAFLOOR_CAVERN},
{MAPSEC_ALTERING_CAVE_2, FLAG_LANDMARK_ALTERING_CAVE},
{MAPSEC_ALTERING_CAVE, FLAG_LANDMARK_ALTERING_CAVE},
{MAPSEC_MIRAGE_TOWER, FLAG_LANDMARK_MIRAGE_TOWER},
{MAPSEC_DESERT_UNDERPASS, FLAG_LANDMARK_DESERT_UNDERPASS},
{MAPSEC_ARTISAN_CAVE, FLAG_LANDMARK_ARTISAN_CAVE},
@ -230,12 +230,12 @@ static const u8 sAreaGlowTilemapMapping[] = {
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
};
static const struct UnkStruct_1C4D70 sUnknown_085B4018 =
static const struct PokedexAreaMapTemplate sPokedexAreaMapTemplate =
{
.bg = 3,
.unk2 = 0,
.unk10 = 0,
.unk12 = 2,
.offset = 0,
.mode = 0,
.unk = 2,
};
static const u8 sAreaMarkerTiles[];
@ -456,7 +456,7 @@ static u16 GetRegionMapSectionId(u8 mapGroup, u8 mapNum)
static bool8 MapHasMon(const struct WildPokemonHeader *info, u16 species)
{
if (GetRegionMapSectionId(info->mapGroup, info->mapNum) == MAPSEC_ALTERING_CAVE_2)
if (GetRegionMapSectionId(info->mapGroup, info->mapNum) == MAPSEC_ALTERING_CAVE)
{
sPokedexAreaScreen->unk6E2++;
if (sPokedexAreaScreen->unk6E2 != sPokedexAreaScreen->unk6E4 + 1)
@ -503,7 +503,7 @@ static void BuildAreaGlowTilemap(void)
{
for (x = 0; x < AREA_SCREEN_WIDTH; x++)
{
if (GetRegionMapSectionIdAt(x, y) == sPokedexAreaScreen->overworldAreasWithMons[i].regionMapSectionId)
if (GetRegionMapSecIdAt(x, y) == sPokedexAreaScreen->overworldAreasWithMons[i].regionMapSectionId)
sPokedexAreaScreen->areaGlowTilemap[j] = GLOW_TILE_FULL;
j++;
@ -662,13 +662,13 @@ static void Task_PokedexAreaScreen_0(u8 taskId)
break;
case 1:
SetBgAttribute(3, BG_ATTR_CHARBASEINDEX, 3);
sub_81C4D70(&sUnknown_085B4018);
LoadPokedexAreaMapGfx(&sPokedexAreaMapTemplate);
StringFill(sPokedexAreaScreen->charBuffer, CHAR_SPACE, 16);
break;
case 2:
if (sub_81C4E90() == TRUE)
return;
sub_81C4ED0(-8);
PokedexAreaMapChangeBgY(-8);
break;
case 3:
ResetDrawAreaGlowState();
@ -678,7 +678,7 @@ static void Task_PokedexAreaScreen_0(u8 taskId)
return;
break;
case 5:
sub_8122D88(&sPokedexAreaScreen->regionMap);
ShowRegionMapForPokedexAreaScreen(&sPokedexAreaScreen->regionMap);
CreateRegionMapPlayerIcon(1, 1);
PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(0, -8);
break;
@ -746,7 +746,7 @@ static void Task_PokedexAreaScreen_1(u8 taskId)
sPokedexAreaScreen->errno[0] = gTasks[taskId].data[1];
sub_813D6B4();
DestroyTask(taskId);
sub_81C4EB4();
FreePokedexAreaMapBgNum();
FREE_AND_SET_NULL(sPokedexAreaScreen);
return;
}

View File

@ -3095,7 +3095,7 @@ static void BufferMonTrainerMemo(void)
if (sum->metLocation < MAPSEC_NONE)
{
sub_8124610(metLocationString, sum->metLocation);
GetMapNameHandleAquaHideout(metLocationString, sum->metLocation);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, metLocationString);
}

View File

@ -26,18 +26,18 @@ struct PokenavResources
void *field10[SUBSTRUCT_COUNT];
};
struct UnknownPokenavCallbackStruct
struct PokenavCallbacks
{
bool32 (*unk0)(void);
u32 (*unk4)(void);
bool32 (*unk8)(void);
void (*unkC)(s32);
u32 (*unk10)(void);
void (*unk14)(void);
void (*unk18)(void);
bool32 (*init)(void);
u32 (*callback)(void);
bool32 (*open)(void);
void (*createLoopTask)(s32);
bool32 (*isLoopTaskActive)(void);
void (*free1)(void);
void (*free2)(void);
};
static u32 sub_81C75E0(void);
static u32 GetCurrentMenuCB(void);
static u32 sub_81C75D4(void);
static bool32 SetActivePokenavMenu(u32 menuId);
static bool32 AnyMonHasRibbon(void);
@ -51,142 +51,158 @@ static void Task_RunLoopedTask(u8 taskId);
static void Task_Pokenav(u8 taskId);
static void CB2_InitPokenavForTutorial(void);
const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
// TODO: Use MENU ids
const struct PokenavCallbacks PokenavMenuCallbacks[15] =
{
[POKENAV_MAIN_MENU - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_0,
.unk4 = sub_81C941C,
.unk8 = sub_81C9924,
.unkC = CreateMenuHandlerLoopedTask,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
.init = PokenavCallback_Init_MainMenuCursorOnMap,
.callback = GetMenuHandlerCallback,
.open = OpenPokenavMenuInitial,
.createLoopTask = CreateMenuHandlerLoopedTask,
.isLoopTaskActive = IsMenuHandlerLoopedTaskActive,
.free1 = FreeMenuHandlerSubstruct1,
.free2 = FreeMenuHandlerSubstruct2,
},
[POKENAV_MAIN_MENU_CURSOR_ON_MAP - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_0,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = CreateMenuHandlerLoopedTask,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
.init = PokenavCallback_Init_MainMenuCursorOnMap,
.callback = GetMenuHandlerCallback,
.open = OpenPokenavMenuNotInitial,
.createLoopTask = CreateMenuHandlerLoopedTask,
.isLoopTaskActive = IsMenuHandlerLoopedTaskActive,
.free1 = FreeMenuHandlerSubstruct1,
.free2 = FreeMenuHandlerSubstruct2,
},
[POKENAV_CONDITION_MENU - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_2,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = CreateMenuHandlerLoopedTask,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
.init = PokenavCallback_Init_ConditionMenu,
.callback = GetMenuHandlerCallback,
.open = OpenPokenavMenuNotInitial,
.createLoopTask = CreateMenuHandlerLoopedTask,
.isLoopTaskActive = IsMenuHandlerLoopedTaskActive,
.free1 = FreeMenuHandlerSubstruct1,
.free2 = FreeMenuHandlerSubstruct2,
},
[POKENAV_CONDITION_SEARCH_MENU - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_3,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = CreateMenuHandlerLoopedTask,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
.init = PokenavCallback_Init_ConditionSearchMenu,
.callback = GetMenuHandlerCallback,
.open = OpenPokenavMenuNotInitial,
.createLoopTask = CreateMenuHandlerLoopedTask,
.isLoopTaskActive = IsMenuHandlerLoopedTaskActive,
.free1 = FreeMenuHandlerSubstruct1,
.free2 = FreeMenuHandlerSubstruct2,
},
[POKENAV_MAIN_MENU_CURSOR_ON_MATCH_CALL - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_4,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = CreateMenuHandlerLoopedTask,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
.init = PokenavCallback_Init_MainMenuCursorOnMatchCall,
.callback = GetMenuHandlerCallback,
.open = OpenPokenavMenuNotInitial,
.createLoopTask = CreateMenuHandlerLoopedTask,
.isLoopTaskActive = IsMenuHandlerLoopedTaskActive,
.free1 = FreeMenuHandlerSubstruct1,
.free2 = FreeMenuHandlerSubstruct2,
},
[POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_5,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = CreateMenuHandlerLoopedTask,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
.init = PokenavCallback_Init_MainMenuCursorOnRibbons,
.callback = GetMenuHandlerCallback,
.open = OpenPokenavMenuNotInitial,
.createLoopTask = CreateMenuHandlerLoopedTask,
.isLoopTaskActive = IsMenuHandlerLoopedTaskActive,
.free1 = FreeMenuHandlerSubstruct1,
.free2 = FreeMenuHandlerSubstruct2,
},
[POKENAV_REGION_MAP - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_6,
.unk4 = sub_81CC554,
.unk8 = sub_81CC5F4,
.unkC = sub_81CC62C,
.unk10 = sub_81CC65C,
.unk14 = sub_81CC524,
.unk18 = sub_81CC670,
.init = PokenavCallback_Init_RegionMap,
.callback = GetRegionMapCallback,
.open = OpenPokenavRegionMap,
.createLoopTask = CreateRegionMapLoopedTask,
.isLoopTaskActive = IsRegionMapLoopedTaskActive,
.free1 = FreeRegionMapSubstruct1,
.free2 = FreeRegionMapSubstruct2,
},
[POKENAV_CONDITION_PARTY - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_7,
.unk4 = sub_81CD070,
.unk8 = sub_81CDDD4,
.unkC = sub_81CDE2C,
.unk10 = sub_81CDE64,
.unk14 = sub_81CD1C0,
.unk18 = sub_81CECA0,
.init = PokenavCallback_Init_7,
.callback = sub_81CD070,
.open = sub_81CDDD4,
.createLoopTask = sub_81CDE2C,
.isLoopTaskActive = sub_81CDE64,
.free1 = sub_81CD1C0,
.free2 = sub_81CECA0,
},
[POKENAV_CONDITION_SEARCH_RESULTS - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_8,
.unk4 = sub_81CEFDC,
.unk8 = sub_81CF330,
.unkC = sub_81CF3A0,
.unk10 = sub_81CF3D0,
.unk14 = sub_81CEFF0,
.unk18 = sub_81CF3F8,
.init = PokenavCallback_Init_8,
.callback = sub_81CEFDC,
.open = sub_81CF330,
.createLoopTask = sub_81CF3A0,
.isLoopTaskActive = sub_81CF3D0,
.free1 = sub_81CEFF0,
.free2 = sub_81CF3F8,
},
[POKENAV_MENU_9 - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_9,
.unk4 = sub_81CD070,
.unk8 = sub_81CDDD4,
.unkC = sub_81CDE2C,
.unk10 = sub_81CDE64,
.unk14 = sub_81CD1C0,
.unk18 = sub_81CECA0,
.init = PokenavCallback_Init_9,
.callback = sub_81CD070,
.open = sub_81CDDD4,
.createLoopTask = sub_81CDE2C,
.isLoopTaskActive = sub_81CDE64,
.free1 = sub_81CD1C0,
.free2 = sub_81CECA0,
},
[POKENAV_MENU_A - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_10,
.unk4 = sub_81CEFDC,
.unk8 = sub_81CF368,
.unkC = sub_81CF3A0,
.unk10 = sub_81CF3D0,
.unk14 = sub_81CEFF0,
.unk18 = sub_81CF3F8,
.init = PokenavCallback_Init_10,
.callback = sub_81CEFDC,
.open = sub_81CF368,
.createLoopTask = sub_81CF3A0,
.isLoopTaskActive = sub_81CF3D0,
.free1 = sub_81CEFF0,
.free2 = sub_81CF3F8,
},
[POKENAV_MATCH_CALL - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_11,
.unk4 = sub_81CAB24,
.unk8 = sub_81CB260,
.unkC = CreateMatchCallLoopedTask,
.unk10 = sub_81CB2CC,
.unk14 = sub_81CAB38,
.unk18 = sub_81CB2E0,
.init = PokenavCallback_Init_MatchCall,
.callback = GetMatchCallCallback,
.open = OpenMatchCall,
.createLoopTask = CreateMatchCallLoopedTask,
.isLoopTaskActive = IsMatchCallLoopedTaskActive,
.free1 = FreeMatchCallSubstruct1,
.free2 = FreeMatchCallSubstruct2,
},
[POKENAV_RIBBONS_MON_LIST - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_12,
.unk4 = sub_81CFA34,
.unk8 = sub_81CFDD0,
.unkC = sub_81CFE40,
.unk10 = sub_81CFE70,
.unk14 = sub_81CFA48,
.unk18 = sub_81CFE98,
.init = PokenavCallback_Init_12,
.callback = sub_81CFA34,
.open = sub_81CFDD0,
.createLoopTask = sub_81CFE40,
.isLoopTaskActive = sub_81CFE70,
.free1 = sub_81CFA48,
.free2 = sub_81CFE98,
},
[POKENAV_MENU_D - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_13,
.unk4 = sub_81D04A0,
.unk8 = sub_81D0978,
.unkC = sub_81D09B0,
.unk10 = sub_81D09E0,
.unk14 = sub_81D04B8,
.unk18 = sub_81D09F4,
.init = PokenavCallback_Init_13,
.callback = sub_81D04A0,
.open = sub_81D0978,
.createLoopTask = sub_81D09B0,
.isLoopTaskActive = sub_81D09E0,
.free1 = sub_81D04B8,
.free2 = sub_81D09F4,
},
[POKENAV_MENU_E - POKENAV_MENU_IDS_START] =
{
.unk0 = PokenavCallback_Init_14,
.unk4 = sub_81CFA34,
.unk8 = sub_81CFE08,
.unkC = sub_81CFE40,
.unk10 = sub_81CFE70,
.unk14 = sub_81CFA48,
.unk18 = sub_81CFE98,
.init = PokenavCallback_Init_14,
.callback = sub_81CFA34,
.open = sub_81CFE08,
.createLoopTask = sub_81CFE40,
.isLoopTaskActive = sub_81CFE70,
.free1 = sub_81CFA48,
.free2 = sub_81CFE98,
},
};
@ -416,66 +432,68 @@ static void VBlankCB_Pokenav(void)
ProcessSpriteCopyRequests();
}
#define tState data[0]
static void Task_Pokenav(u8 taskId)
{
u32 v1;
u32 menuId;
s16 *data = gTasks[taskId].data;
switch (data[0])
switch (tState)
{
case 0:
InitPokenavMainMenu();
data[0] = 1;
tState = 1;
break;
case 1:
// Wait for LoopedTask_InitPokenavMenu to finish
if (PokenavMainMenuLoopedTaskIsActive())
break;
SetActivePokenavMenu(POKENAV_MENU_0);
data[0] = 4;
SetActivePokenavMenu(POKENAV_MAIN_MENU);
tState = 4;
break;
case 2:
if (sub_81C786C())
break;
data[0] = 3;
tState = 3;
case 3:
v1 = sub_81C75E0();
if (v1 == -1)
menuId = GetCurrentMenuCB();
if (menuId == -1)
{
ShutdownPokenav();
data[0] = 5;
tState = 5;
}
else if (v1 >= POKENAV_MENU_IDS_START)
else if (menuId >= POKENAV_MENU_IDS_START)
{
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex].unk18();
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex].unk14();
if (SetActivePokenavMenu(v1))
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex].free2();
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex].free1();
if (SetActivePokenavMenu(menuId))
{
data[0] = 4;
tState = 4;
}
else
{
ShutdownPokenav();
data[0] = 5;
tState = 5;
}
}
else if (v1 != 0)
else if (menuId != 0)
{
sub_81C7850(v1);
sub_81C7850(menuId);
if (sub_81C786C())
data[0] = 2;
tState = 2;
}
break;
case 4:
if (!sub_81C75D4())
data[0] = 3;
tState = 3;
break;
case 5:
if (!WaitForPokenavShutdownFade())
{
bool32 calledFromScript = (gPokenavResources->mode != POKENAV_MODE_NORMAL);
sub_81C9430();
FreeMenuHandlerSubstruct1();
FreePokenavResources();
if (calledFromScript)
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
@ -486,18 +504,20 @@ static void Task_Pokenav(u8 taskId)
}
}
#undef tState
static bool32 SetActivePokenavMenu(u32 menuId)
{
u32 index = menuId - POKENAV_MENU_IDS_START;
InitKeys_();
if (!PokenavMenuCallbacks[index].unk0())
if (!PokenavMenuCallbacks[index].init())
return FALSE;
if (!PokenavMenuCallbacks[index].unk8())
if (!PokenavMenuCallbacks[index].open())
return FALSE;
sub_81C7834(PokenavMenuCallbacks[index].unkC, PokenavMenuCallbacks[index].unk10);
gPokenavResources->currentMenuCb1 = PokenavMenuCallbacks[index].unk4;
sub_81C7834(PokenavMenuCallbacks[index].createLoopTask, PokenavMenuCallbacks[index].isLoopTaskActive);
gPokenavResources->currentMenuCb1 = PokenavMenuCallbacks[index].callback;
gPokenavResources->currentMenuIndex = index;
return TRUE;
}
@ -507,7 +527,7 @@ static u32 sub_81C75D4(void)
return sub_81C786C();
}
static u32 sub_81C75E0(void)
static u32 GetCurrentMenuCB(void)
{
return gPokenavResources->currentMenuCb1();
}

View File

@ -147,7 +147,7 @@ u32 sub_81CD110(struct PokenavSub11 *structPtr)
u32 sub_81CD19C(struct PokenavSub11 *structPtr)
{
if (structPtr->unk6300 == 0)
return POKENAV_MENU_2;
return POKENAV_CONDITION_MENU;
else
return POKENAV_MENU_A;
}

View File

@ -296,7 +296,7 @@ u32 sub_81CDE94(s32 state)
PrintHelpBarText(HELPBAR_CONDITION_MON_STATUS);
return LT_INC_AND_PAUSE;
case 15:
sub_81C7AC0(1);
PokenavFadeScreen(1);
if (!sub_81CDD5C())
{
LoadLeftHeaderGfxForIndex(6);
@ -353,7 +353,7 @@ u32 sub_81CE2D0(s32 state)
sub_81CEE74(FALSE);
return 1;
case 2:
sub_81C7AC0(0);
PokenavFadeScreen(0);
if (!sub_81CDD5C())
sub_81C78A0();
return 0;

View File

@ -197,12 +197,12 @@ static u32 sub_81CF030(struct PokenavSub7 *structPtr)
static u32 sub_81CF0B0(struct PokenavSub7 *structPtr)
{
return 100003;
return POKENAV_CONDITION_SEARCH_MENU;
}
static u32 sub_81CF0B8(struct PokenavSub7 *structPtr)
{
return 100009;
return POKENAV_MENU_9;
}
static u32 sub_81CF0C0(void)
@ -448,7 +448,7 @@ static u32 sub_81CF418(s32 state)
sub_81C7FA0(r4, 1, 0);
sub_81C7FA0(1, 1, 0);
}
sub_81C7AC0(1);
PokenavFadeScreen(1);
return LT_INC_AND_PAUSE;
case 5:
if (IsPaletteFadeActive())
@ -598,7 +598,7 @@ static u32 sub_81CF758(s32 state)
{
case 0:
PlaySE(SE_SELECT);
sub_81C7AC0(0);
PokenavFadeScreen(0);
sub_81C78A0();
return LT_INC_AND_PAUSE;
case 1:
@ -618,7 +618,7 @@ static u32 sub_81CF798(s32 state)
{
case 0:
PlaySE(SE_SELECT);
sub_81C7AC0(0);
PokenavFadeScreen(0);
return LT_INC_AND_PAUSE;
case 1:
if (IsPaletteFadeActive())

View File

@ -13,28 +13,6 @@
#include "menu.h"
#include "dma3.h"
enum
{
POKENAV_GFX_MAIN_MENU,
POKENAV_GFX_CONDITION_MENU,
POKENAV_GFX_RIBBONS_MENU,
POKENAV_GFX_MATCH_CALL_MENU,
// One of these is for the zoomed-in map, and the other is for the
// zoomed-out map. Don't know which is which yet.
POKENAV_GFX_MAP_MENU_UNK0,
POKENAV_GFX_MAP_MENU_UNK1,
POKENAV_GFX_PARTY_MENU,
POKENAV_GFX_SEARCH_MENU,
POKENAV_GFX_COOL_MENU,
POKENAV_GFX_BEAUTY_MENU,
POKENAV_GFX_CUTE_MENU,
POKENAV_GFX_SMART_MENU,
POKENAV_GFX_TOUGH_MENU,
POKENAV_GFX_MENUS_END,
};
#define POKENAV_GFX_SUBMENUS_START POKENAV_GFX_PARTY_MENU
struct PokenavMainMenuResources
{
void (*unk0)(u32);
@ -42,7 +20,7 @@ struct PokenavMainMenuResources
u32 unk8;
u32 currentTaskId;
u32 helpBarWindowId;
u32 unk14;
u32 palettes;
struct Sprite *spinningPokenav;
struct Sprite *leftHeaderSprites[2];
struct Sprite *submenuLeftHeaderSprites[2];
@ -174,12 +152,12 @@ static const struct CompressedSpriteSheet sPokenavMenuLeftHeaderSpriteSheets[] =
.size = 0x20,
.tag = 4
},
[POKENAV_GFX_MAP_MENU_UNK0] = {
[POKENAV_GFX_MAP_MENU_ZOOMED_OUT] = {
.data = gPokenavLeftHeaderHoennMap_Gfx,
.size = 0x20,
.tag = 0
},
[POKENAV_GFX_MAP_MENU_UNK1] = {
[POKENAV_GFX_MAP_MENU_ZOOMED_IN] = {
.data = gPokenavLeftHeaderHoennMap_Gfx,
.size = 0x40,
.tag = 0
@ -343,7 +321,7 @@ bool32 WaitForPokenavShutdownFade(void)
{
if (!gPaletteFade.active)
{
sub_81C99D4();
FreeMenuHandlerSubstruct2();
CleanupPokenavMainMenuResources();
FreeAllWindowBuffers();
return FALSE;
@ -629,17 +607,17 @@ _081C7AAE:\n\
.syntax divided");
}
void sub_81C7AC0(s32 a0)
void PokenavFadeScreen(s32 fadeType)
{
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
switch (a0)
switch (fadeType)
{
case 0:
BeginNormalPaletteFade(structPtr->unk14, -2, 0, 16, RGB_BLACK);
BeginNormalPaletteFade(structPtr->palettes, -2, 0, 16, RGB_BLACK);
break;
case 1:
BeginNormalPaletteFade(structPtr->unk14, -2, 16, 0, RGB_BLACK);
BeginNormalPaletteFade(structPtr->palettes, -2, 16, 0, RGB_BLACK);
break;
case 2:
BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK);
@ -708,7 +686,7 @@ static void InitPokenavMainMenuResources(void)
LoadCompressedSpriteSheet(&gSpinningPokenavSpriteSheet[i]);
Pokenav_AllocAndLoadPalettes(gSpinningNavgearPalettes);
structPtr->unk14 = ~1 & ~(0x10000 << IndexOfSpritePaletteTag(0));
structPtr->palettes = ~1 & ~(0x10000 << IndexOfSpritePaletteTag(0));
spriteId = CreateSprite(&sSpinningPokenavSpriteTemplate, 220, 12, 0);
structPtr->spinningPokenav = &gSprites[spriteId];
}
@ -772,61 +750,61 @@ static void InitHoennMapHeaderSprites(void)
}
}
void LoadLeftHeaderGfxForIndex(u32 arg0)
void LoadLeftHeaderGfxForIndex(u32 menuGfxId)
{
if (arg0 < POKENAV_GFX_SUBMENUS_START)
LoadLeftHeaderGfxForMenu(arg0);
if (menuGfxId < POKENAV_GFX_SUBMENUS_START)
LoadLeftHeaderGfxForMenu(menuGfxId);
else
LoadLeftHeaderGfxForSubMenu(arg0 - POKENAV_GFX_SUBMENUS_START);
LoadLeftHeaderGfxForSubMenu(menuGfxId - POKENAV_GFX_SUBMENUS_START);
}
void sub_81C7E14(u32 arg0)
void sub_81C7E14(u32 menuGfxId)
{
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
if (arg0 == 4)
if (menuGfxId == POKENAV_GFX_MAP_MENU_ZOOMED_OUT)
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + 32;
else
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + 64;
}
static void LoadLeftHeaderGfxForMenu(u32 index)
static void LoadLeftHeaderGfxForMenu(u32 menuGfxId)
{
struct PokenavMainMenuResources *structPtr;
u32 size, tag;
if (index >= POKENAV_GFX_SUBMENUS_START)
if (menuGfxId >= POKENAV_GFX_SUBMENUS_START)
return;
structPtr = GetSubstructPtr(0);
tag = sPokenavMenuLeftHeaderSpriteSheets[index].tag;
size = GetDecompressedDataSize(sPokenavMenuLeftHeaderSpriteSheets[index].data);
tag = sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].tag;
size = GetDecompressedDataSize(sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].data);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(1) * 16) + 0x100, 0x20);
LZ77UnCompWram(sPokenavMenuLeftHeaderSpriteSheets[index].data, gDecompressionBuffer);
LZ77UnCompWram(sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].data, gDecompressionBuffer);
RequestDma3Copy(gDecompressionBuffer, (void *)VRAM + 0x10000 + (GetSpriteTileStartByTag(2) * 32), size, 1);
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + sPokenavMenuLeftHeaderSpriteSheets[index].size;
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].size;
if (index == POKENAV_GFX_MAP_MENU_UNK0 || index == POKENAV_GFX_MAP_MENU_UNK1)
if (menuGfxId == POKENAV_GFX_MAP_MENU_ZOOMED_OUT || menuGfxId == POKENAV_GFX_MAP_MENU_ZOOMED_IN)
structPtr->leftHeaderSprites[1]->pos2.x = 56;
else
structPtr->leftHeaderSprites[1]->pos2.x = 64;
}
static void LoadLeftHeaderGfxForSubMenu(u32 arg0)
static void LoadLeftHeaderGfxForSubMenu(u32 menuGfxId)
{
u32 size, tag;
if (arg0 >= POKENAV_GFX_MENUS_END - POKENAV_GFX_SUBMENUS_START)
if (menuGfxId >= POKENAV_GFX_MENUS_END - POKENAV_GFX_SUBMENUS_START)
return;
tag = sPokenavSubMenuLeftHeaderSpriteSheets[arg0].tag;
size = GetDecompressedDataSize(sPokenavSubMenuLeftHeaderSpriteSheets[arg0].data);
tag = sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].tag;
size = GetDecompressedDataSize(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(2) * 16) + 0x100, 0x20);
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[arg0].data, &gDecompressionBuffer[0x1000]);
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data, &gDecompressionBuffer[0x1000]);
RequestDma3Copy(&gDecompressionBuffer[0x1000], (void *)VRAM + 0x10800 + (GetSpriteTileStartByTag(2) * 32), size, 1);
}
void sub_81C7FA0(u32 arg0, bool32 arg1, bool32 arg2)
void sub_81C7FA0(u32 menuGfxId, bool32 arg1, bool32 arg2)
{
u32 var;
@ -835,7 +813,7 @@ void sub_81C7FA0(u32 arg0, bool32 arg1, bool32 arg2)
else
var = 0x10;
if (arg0 < 6)
if (menuGfxId < POKENAV_GFX_SUBMENUS_START)
ShowLeftHeaderSprites(var, arg2);
else
ShowLeftHeaderSubmenuSprites(var, arg2);

View File

@ -30,7 +30,7 @@ struct Pokenav3Struct
};
static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *);
static u32 sub_81CABFC(struct Pokenav3Struct *);
static u32 GetExitMatchCallMenuId(struct Pokenav3Struct *);
static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *);
static u32 CB2_HandleCheckPageInput(struct Pokenav3Struct *);
static u32 CB2_HandleCallInput(struct Pokenav3Struct *);
@ -52,7 +52,7 @@ static const u8 sMatchCallOptionsHasCheckPage[] =
MATCH_CALL_OPTION_CANCEL
};
bool32 PokenavCallback_Init_11(void)
bool32 PokenavCallback_Init_MatchCall(void)
{
struct Pokenav3Struct *state = AllocSubstruct(5, sizeof(struct Pokenav3Struct));
if (!state)
@ -65,13 +65,13 @@ bool32 PokenavCallback_Init_11(void)
return TRUE;
}
u32 sub_81CAB24(void)
u32 GetMatchCallCallback(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->callback(state);
}
void sub_81CAB38(void)
void FreeMatchCallSubstruct1(void)
{
FreePokenavSubstruct(5);
}
@ -113,7 +113,7 @@ static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *state)
{
if (GetPokenavMode() != POKENAV_MODE_FORCE_CALL_READY)
{
state->callback = sub_81CABFC;
state->callback = GetExitMatchCallMenuId;
return POKENAV_MC_FUNC_EXIT;
}
else
@ -126,9 +126,9 @@ static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *state)
return POKENAV_MC_FUNC_NONE;
}
static u32 sub_81CABFC(struct Pokenav3Struct *state)
static u32 GetExitMatchCallMenuId(struct Pokenav3Struct *state)
{
return POKENAV_MENU_4;
return POKENAV_MAIN_MENU_CURSOR_ON_MATCH_CALL;
}
static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *state)

View File

@ -27,8 +27,8 @@
struct Pokenav4Struct
{
bool32 (*unk0)(void);
u32 unk4;
bool32 (*isTaskActiveCB)(void);
u32 loopTaskId;
u8 filler8[0x6];
u8 unkE;
u8 unkF;
@ -49,8 +49,8 @@ struct Pokenav4Struct
u8 unk2028[0x20];
};
static bool32 sub_81CB310(void);
static u32 sub_81CB324(s32);
static bool32 GetCurrentLoopedTaskActive(void);
static u32 LoopedTask_OpenMatchCall(s32);
static void sub_81CBBB8(void);
static void sub_81CBC1C(void);
static void sub_81CC2B4(void);
@ -274,32 +274,32 @@ static const struct SpriteTemplate sTrainerPicSpriteTemplate =
.callback = SpriteCallbackDummy,
};
bool32 sub_81CB260(void)
bool32 OpenMatchCall(void)
{
struct Pokenav4Struct *state = AllocSubstruct(6, sizeof(struct Pokenav4Struct));
if (!state)
return FALSE;
state->unk19 = 0;
state->unk4 = CreateLoopedTask(sub_81CB324, 1);
state->unk0 = sub_81CB310;
state->loopTaskId = CreateLoopedTask(LoopedTask_OpenMatchCall, 1);
state->isTaskActiveCB = GetCurrentLoopedTaskActive;
return TRUE;
}
void CreateMatchCallLoopedTask(s32 index)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
state->unk4 = CreateLoopedTask(sMatchCallLoopTaskFuncs[index], 1);
state->unk0 = sub_81CB310;
state->loopTaskId = CreateLoopedTask(sMatchCallLoopTaskFuncs[index], 1);
state->isTaskActiveCB = GetCurrentLoopedTaskActive;
}
u32 sub_81CB2CC(void)
bool32 IsMatchCallLoopedTaskActive(void)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
return state->unk0();
return state->isTaskActiveCB();
}
void sub_81CB2E0(void)
void FreeMatchCallSubstruct2(void)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
sub_81CC2B4();
@ -310,13 +310,13 @@ void sub_81CB2E0(void)
FreePokenavSubstruct(6);
}
static bool32 sub_81CB310(void)
static bool32 GetCurrentLoopedTaskActive(void)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
return IsLoopedTaskActive(state->unk4);
return IsLoopedTaskActive(state->loopTaskId);
}
static u32 sub_81CB324(s32 taskState)
static u32 LoopedTask_OpenMatchCall(s32 taskState)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
switch (taskState)
@ -376,7 +376,7 @@ static u32 sub_81CB324(s32 taskState)
sub_81CC214();
LoadLeftHeaderGfxForIndex(3);
sub_81C7FA0(3, 1, 0);
sub_81C7AC0(1);
PokenavFadeScreen(1);
return LT_INC_AND_PAUSE;
case 7:
if (IsPaletteFadeActive() || sub_81C8010())
@ -849,7 +849,7 @@ u32 ExitMatchCall(s32 taskState)
case 0:
PlaySE(SE_SELECT);
sub_81CBC38(0);
sub_81C7AC0(0);
PokenavFadeScreen(0);
sub_81C78A0();
return LT_INC_AND_PAUSE;
case 1:

View File

@ -7,6 +7,8 @@
#include "menu.h"
#include "decompress.h"
// TODO: This UI isnt just for match call, seems to be the general pokenav list UI
struct UnknownSubSubStruct_0203CF40 {
u8 bg;
u8 unk1;

View File

@ -11,15 +11,15 @@ struct Pokenav1Struct
s16 cursorPos;
u16 currMenuItem;
u16 helpBarIndex;
u32 unk8;
u32 menuId;
u32 (*callback)(struct Pokenav1Struct*);
};
static bool32 UpdateMenuCursorPos(struct Pokenav1Struct *state);
static void ReturnToConditionMenu(struct Pokenav1Struct *state);
static void ReturnToMainMenu(struct Pokenav1Struct *state);
static u32 sub_81C97BC(struct Pokenav1Struct *state);
static void sub_81C97B0(struct Pokenav1Struct *state, u32 a1);
static u32 GetMenuId(struct Pokenav1Struct *state);
static void SetMenuIdAndCB(struct Pokenav1Struct *state, u32 a1);
static u32 CB2_ReturnToConditionMenu(struct Pokenav1Struct *state);
static u32 CB2_ReturnToMainMenu(struct Pokenav1Struct *state);
static u32 HandleConditionSearchMenuInput(struct Pokenav1Struct *state);
@ -97,7 +97,7 @@ static u8 GetPokenavMainMenuType(void)
return menuType;
}
bool32 PokenavCallback_Init_0(void)
bool32 PokenavCallback_Init_MainMenuCursorOnMap(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
@ -111,7 +111,7 @@ bool32 PokenavCallback_Init_0(void)
return TRUE;
}
bool32 PokenavCallback_Init_4(void)
bool32 PokenavCallback_Init_MainMenuCursorOnMatchCall(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
@ -125,7 +125,7 @@ bool32 PokenavCallback_Init_4(void)
return TRUE;
}
bool32 PokenavCallback_Init_5(void)
bool32 PokenavCallback_Init_MainMenuCursorOnRibbons(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
@ -138,7 +138,7 @@ bool32 PokenavCallback_Init_5(void)
return TRUE;
}
bool32 PokenavCallback_Init_2(void)
bool32 PokenavCallback_Init_ConditionMenu(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
@ -152,7 +152,7 @@ bool32 PokenavCallback_Init_2(void)
return TRUE;
}
bool32 PokenavCallback_Init_3(void)
bool32 PokenavCallback_Init_ConditionSearchMenu(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
@ -200,13 +200,13 @@ static u32 (*GetMainMenuInputHandler(void))(struct Pokenav1Struct*)
}
}
u32 sub_81C941C(void)
u32 GetMenuHandlerCallback(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->callback(state);
}
void sub_81C9430(void)
void FreeMenuHandlerSubstruct1(void)
{
FreePokenavSubstruct(1);
}
@ -222,7 +222,7 @@ static u32 HandleMainMenuInput(struct Pokenav1Struct *state)
{
case POKENAV_MENUITEM_MAP:
state->helpBarIndex = gSaveBlock2Ptr->regionMapZoom ? HELPBAR_MAP_ZOOMED_IN : HELPBAR_MAP_ZOOMED_OUT;
sub_81C97B0(state, POKENAV_MENU_6);
SetMenuIdAndCB(state, POKENAV_REGION_MAP);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
case POKENAV_MENUITEM_CONDITION:
state->menuType = POKENAV_MENU_TYPE_CONDITION;
@ -232,13 +232,13 @@ static u32 HandleMainMenuInput(struct Pokenav1Struct *state)
return POKENAV_MENU_FUNC_OPEN_CONDITION;
case POKENAV_MENUITEM_MATCH_CALL:
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(state, POKENAV_MENU_B);
SetMenuIdAndCB(state, POKENAV_MATCH_CALL);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
case POKENAV_MENUITEM_RIBBONS:
if (CanViewRibbonsMenu())
{
state->helpBarIndex = HELPBAR_RIBBONS_MON_LIST;
sub_81C97B0(state, POKENAV_MENU_C);
SetMenuIdAndCB(state, POKENAV_RIBBONS_MON_LIST);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
else
@ -268,7 +268,7 @@ static u32 HandleMainMenuInputTutorial(struct Pokenav1Struct *state)
if (sMenuItems[state->menuType][state->cursorPos] == POKENAV_MENUITEM_MATCH_CALL)
{
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(state, POKENAV_MENU_B);
SetMenuIdAndCB(state, POKENAV_MATCH_CALL);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
else
@ -304,7 +304,7 @@ static u32 HandleMainMenuInputEndTutorial(struct Pokenav1Struct *state)
else if (menuItem == POKENAV_MENUITEM_MATCH_CALL)
{
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(state, POKENAV_MENU_B);
SetMenuIdAndCB(state, POKENAV_MATCH_CALL);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
else
@ -355,7 +355,7 @@ static u32 HandleConditionMenuInput(struct Pokenav1Struct *state)
return POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH;
case POKENAV_MENUITEM_CONDITION_PARTY:
state->helpBarIndex = 0;
sub_81C97B0(state, POKENAV_MENU_7);
SetMenuIdAndCB(state, POKENAV_CONDITION_PARTY);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
case POKENAV_MENUITEM_CONDITION_CANCEL:
PlaySE(SE_SELECT);
@ -393,7 +393,7 @@ static u32 HandleConditionSearchMenuInput(struct Pokenav1Struct *state)
if (menuItem != POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL)
{
SetSelectedConditionSearch(menuItem - POKENAV_MENUITEM_CONDITION_SEARCH_COOL);
sub_81C97B0(state, POKENAV_MENU_8);
SetMenuIdAndCB(state, POKENAV_CONDITION_SEARCH_RESULTS);
state->helpBarIndex = HELPBAR_CONDITION_MON_LIST;
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
@ -434,15 +434,15 @@ static u32 CB2_ReturnToConditionMenu(struct Pokenav1Struct *state)
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
}
static void sub_81C97B0(struct Pokenav1Struct *state, u32 a1)
static void SetMenuIdAndCB(struct Pokenav1Struct *state, u32 menuId)
{
state->unk8 = a1;
state->callback = sub_81C97BC;
state->menuId = menuId;
state->callback = GetMenuId;
}
static u32 sub_81C97BC(struct Pokenav1Struct *state)
static u32 GetMenuId(struct Pokenav1Struct *state)
{
return state->unk8;
return state->menuId;
}
static void ReturnToMainMenu(struct Pokenav1Struct *state)

View File

@ -17,26 +17,24 @@
#include "constants/songs.h"
#include "constants/rgb.h"
// Top Menu
struct Pokenav2Struct
{
bool32 (*callback)(void);
bool32 (*isTaskActiveCB)(void);
u32 loopedTaskId;
u16 optionDescWindowId;
u8 bg3ScrollTaskId;
u8 cursorPos;
bool8 otherIconsInMotion;
u8 field_00d;
bool8 pokenavAlreadyOpen;
bool32 iconVisible[MAX_POKENAV_MENUITEMS];
struct Sprite * field_028;
struct Sprite * iconSprites[MAX_POKENAV_MENUITEMS][4];
u16 bg1TilemapBuffer[0x400];
};
static struct Pokenav2Struct * sub_81C9958(void);
static bool32 sub_81C99FC(void);
static u32 sub_81C9A10(s32 state);
static struct Pokenav2Struct * OpenPokenavMenu(void);
static bool32 GetCurrentLoopedTaskActive(void);
static u32 LoopedTask_OpenMenu(s32 state);
static u32 LoopedTask_MoveMenuCursor(s32 state);
static u32 LoopedTask_OpenConditionMenu(s32 state);
static u32 LoopedTask_ReturnToMainMenu(s32 state);
@ -337,59 +335,56 @@ static bool32 sub_81C98D4(void)
return FALSE;
}
bool32 sub_81C9924(void)
bool32 OpenPokenavMenuInitial(void)
{
struct Pokenav2Struct * unk = sub_81C9958();
struct Pokenav2Struct * state = OpenPokenavMenu();
if (unk == NULL)
if (state == NULL)
return FALSE;
unk->field_00d = 0;
state->pokenavAlreadyOpen = FALSE;
return TRUE;
}
bool32 sub_81C9940(void)
bool32 OpenPokenavMenuNotInitial(void)
{
struct Pokenav2Struct * unk = sub_81C9958();
struct Pokenav2Struct * state = OpenPokenavMenu();
if (unk == NULL)
if (state == NULL)
return FALSE;
unk->field_00d = 1;
state->pokenavAlreadyOpen = TRUE;
return TRUE;
}
static struct Pokenav2Struct * sub_81C9958(void)
static struct Pokenav2Struct * OpenPokenavMenu(void)
{
struct Pokenav2Struct * unk = AllocSubstruct(2, sizeof(struct Pokenav2Struct));
struct Pokenav2Struct * state = AllocSubstruct(2, sizeof(struct Pokenav2Struct));
if (unk != NULL)
if (state != NULL)
{
unk->otherIconsInMotion = FALSE;
unk->loopedTaskId = CreateLoopedTask(sub_81C9A10, 1);
unk->callback = sub_81C99FC;
state->otherIconsInMotion = FALSE;
state->loopedTaskId = CreateLoopedTask(LoopedTask_OpenMenu, 1);
state->isTaskActiveCB = GetCurrentLoopedTaskActive;
}
return unk;
return state;
}
void CreateMenuHandlerLoopedTask(s32 ltIdx)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
unk->loopedTaskId = CreateLoopedTask(sMenuHandlerLoopTaskFuncs[ltIdx], 1);
unk->callback = sub_81C99FC;
struct Pokenav2Struct * state = GetSubstructPtr(2);
state->loopedTaskId = CreateLoopedTask(sMenuHandlerLoopTaskFuncs[ltIdx], 1);
state->isTaskActiveCB = GetCurrentLoopedTaskActive;
}
bool32 sub_81C99C0(void)
bool32 IsMenuHandlerLoopedTaskActive(void)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
return unk->callback();
struct Pokenav2Struct * state = GetSubstructPtr(2);
return state->isTaskActiveCB();
}
void sub_81C99D4(void)
void FreeMenuHandlerSubstruct2(void)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
@ -400,14 +395,14 @@ void sub_81C99D4(void)
FreePokenavSubstruct(2);
}
static bool32 sub_81C99FC(void)
static bool32 GetCurrentLoopedTaskActive(void)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
return IsLoopedTaskActive(unk->loopedTaskId);
}
static u32 sub_81C9A10(s32 state)
static u32 LoopedTask_OpenMenu(s32 state)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
@ -466,12 +461,12 @@ static u32 sub_81C9A10(s32 state)
ShowBg(1);
ShowBg(2);
ShowBg(3);
if (unk->field_00d)
sub_81C7AC0(1);
if (unk->pokenavAlreadyOpen)
PokenavFadeScreen(1);
else
{
PlaySE(SE_PN_ON);
sub_81C7AC0(3);
PokenavFadeScreen(3);
}
switch (GetPokenavMenuType())
{
@ -741,7 +736,7 @@ static u32 LoopedTask_OpenPokenavFeature(s32 state)
return LT_PAUSE;
if (sub_81C8010())
return LT_PAUSE;
sub_81C7AC0(0);
PokenavFadeScreen(0);
return LT_INC_AND_PAUSE;
case 3:
if (IsPaletteFadeActive())

View File

@ -13,23 +13,27 @@
#include "task.h"
#include "text_window.h"
#include "window.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/region_map_sections.h"
#define NUM_CITY_MAPS 22
struct Pokenav5Struct
{
u8 filler0[0xC];
bool32 unkC;
u32 (*unk10)(struct Pokenav5Struct *);
bool32 zoomDisabled;
u32 (*callback)(struct Pokenav5Struct *);
};
struct Pokenav5Struct_2
{
bool32 (*unk0)(void);
u32 unk4;
u16 unk8;
struct Sprite *cityFeatureTextSprites[3];
u8 unk18[0x800];
u8 cityZoomPics[22][0xC8];
bool32 (*isTaskActiveCB)(void);
u32 loopTaskId;
u16 infoWindowId;
struct Sprite *cityZoomTextSprites[3];
u8 tilemapBuffer[0x800];
u8 cityZoomPics[NUM_CITY_MAPS][200];
};
struct CityMapEntry
@ -39,45 +43,43 @@ struct CityMapEntry
const u32 *tilemap;
};
static u32 sub_81CC568(struct Pokenav5Struct *);
static u32 sub_81CC5B4(struct Pokenav5Struct *);
static u32 sub_81CC5DC(struct Pokenav5Struct *);
static u32 sub_81CC6F4(s32);
static u32 sub_81CCD34(s32);
static bool32 sub_81CC6BC(void);
static void sub_81CC9EC(void);
static void sub_81CC9C0(void);
static void sub_81CCD10(void);
static bool32 sub_81CCD24(void);
static void sub_81CCA1C(struct Pokenav5Struct_2 *);
static bool32 sub_81CCAFC(void);
static void sub_81CCB0C(struct Pokenav5Struct_2 *);
static bool32 sub_81CCC4C(struct Pokenav5Struct_2 *);
static void sub_81CCC5C(int);
static bool32 sub_81CCC88(void);
static void sub_81CCE58(void);
static void sub_81CCD70(struct Pokenav5Struct_2 *, int, int);
static void sub_81CCDE8(struct Pokenav5Struct_2 *, int, int);
static void sub_81CCFA4(int);
static void sub_81CCC9C(u8 taskId);
static void sub_81CCF78(void);
void sub_81CCEF4(struct Sprite *sprite);
u32 sub_81CC848(s32);
u32 sub_81CC878(s32);
u32 sub_81CC8D8(s32);
u32 sub_81CC95C(s32);
static u32 HandleRegionMapInput(struct Pokenav5Struct *);
static u32 HandleRegionMapInputZoomDisabled(struct Pokenav5Struct *);
static u32 GetExitRegionMapMenuId(struct Pokenav5Struct *);
static u32 LoopedTask_OpenRegionMap(s32);
static u32 LoopedTask_DecompressCityMaps(s32);
static bool32 GetCurrentLoopedTaskActive(void);
static void FreeCityZoomViewGfx(void);
static void LoadCityZoomViewGfx(void);
static void DecompressCityMaps(void);
static bool32 IsDecompressCityMapsActive(void);
static void LoadPokenavRegionMapGfx(struct Pokenav5Struct_2 *);
static bool32 TryFreeTempTileDataBuffers(void);
static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *);
static bool32 IsDma3ManagerBusyWithBgCopy_(struct Pokenav5Struct_2 *);
static void ChangeBgYForZoom(bool32);
static bool32 IsChangeBgYForZoomActive(void);
static void CreateCityZoomTextSprites(void);
static void DrawCityMap(struct Pokenav5Struct_2 *, int, int);
static void PrintLandmarkNames(struct Pokenav5Struct_2 *, int, int);
static void SetCityZoomTextInvisibility(bool32);
static void Task_ChangeBgYForZoom(u8 taskId);
static void UpdateCityZoomTextPosition(void);
static void SpriteCB_CityZoomText(struct Sprite *sprite);
static u32 LoopedTask_UpdateInfoAfterCursorMove(s32);
static u32 LoopedTask_RegionMapZoomOut(s32);
static u32 LoopedTask_RegionMapZoomIn(s32);
static u32 LoopedTask_ExitRegionMap(s32);
extern const u16 gHoennMapZoomIcons_Pal[];
extern const struct SpriteTemplate gUnknown_086231D0;
extern const u32 gHoennMapZoomIcons_Gfx[];
extern const u16 gRegionMapCityZoomTiles_Pal[];
extern const u32 gRegionMapCityZoomText_Gfx[];
const u16 gUnknown_08622868[] = INCBIN_U16("graphics/pokenav/8622868.gbapal");
const u32 gUnknown_08622888[] = INCBIN_U32("graphics/pokenav/zoom_tiles.4bpp.lz");
static const u16 sMapSecInfoWindow_Pal[] = INCBIN_U16("graphics/pokenav/region_map_info_window.gbapal");
static const u32 sRegionMapCityZoomTiles_Gfx[] = INCBIN_U32("graphics/pokenav/city_zoom_tiles.4bpp.lz");
#include "data/region_map/city_map_tilemaps.h"
const struct BgTemplate gUnknown_086230D8[3] =
static const struct BgTemplate sRegionMapBgTemplates[3] =
{
{
.bg = 1,
@ -108,27 +110,27 @@ const struct BgTemplate gUnknown_086230D8[3] =
},
};
const LoopedTask gUnknown_086230E4[] =
static const LoopedTask sRegionMapLoopTaskFuncs[] =
{
NULL,
sub_81CC848,
sub_81CC878,
sub_81CC8D8,
sub_81CC95C
[POKENAV_MAP_FUNC_NONE] = NULL,
[POKENAV_MAP_FUNC_CURSOR_MOVED] = LoopedTask_UpdateInfoAfterCursorMove,
[POKENAV_MAP_FUNC_ZOOM_OUT] = LoopedTask_RegionMapZoomOut,
[POKENAV_MAP_FUNC_ZOOM_IN] = LoopedTask_RegionMapZoomIn,
[POKENAV_MAP_FUNC_EXIT] = LoopedTask_ExitRegionMap
};
const struct CompressedSpriteSheet gUnknown_086230F8[1] =
static const struct CompressedSpriteSheet sCityZoomTextSpriteSheet[1] =
{
{gHoennMapZoomIcons_Gfx, 0x800, 6}
{gRegionMapCityZoomText_Gfx, 0x800, 6}
};
const struct SpritePalette gUnknown_08623100[] =
static const struct SpritePalette sCityZoomTilesSpritePalette[] =
{
{gHoennMapZoomIcons_Pal, 11},
{gRegionMapCityZoomTiles_Pal, 11},
{}
};
const struct WindowTemplate gUnknown_08623110 =
static const struct WindowTemplate sMapSecInfoWindowTemplate =
{
.bg = 1,
.tilemapLeft = 17,
@ -141,7 +143,7 @@ const struct WindowTemplate gUnknown_08623110 =
#include "data/region_map/city_map_entries.h"
const struct OamData gUnknown_086231C8 =
const struct OamData sCityZoomTextSprite_OamData =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -155,18 +157,18 @@ const struct OamData gUnknown_086231C8 =
.paletteNum = 0,
};
const struct SpriteTemplate gUnknown_086231D0 =
static const struct SpriteTemplate sCityZoomTextSpriteTemplate =
{
.tileTag = 6,
.paletteTag = 11,
.oam = &gUnknown_086231C8,
.oam = &sCityZoomTextSprite_OamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81CCEF4,
.callback = SpriteCB_CityZoomText,
};
u32 PokenavCallback_Init_6(void)
u32 PokenavCallback_Init_RegionMap(void)
{
struct Pokenav5Struct *state = AllocSubstruct(3, sizeof(struct Pokenav5Struct));
if (!state)
@ -175,105 +177,105 @@ u32 PokenavCallback_Init_6(void)
if (!AllocSubstruct(16, sizeof(struct RegionMap)))
return FALSE;
state->unkC = sub_8124668(gMapHeader.regionMapSectionId);
if (!state->unkC)
state->unk10 = sub_81CC568;
state->zoomDisabled = IsEventIslandMapSecId(gMapHeader.regionMapSectionId);
if (!state->zoomDisabled)
state->callback = HandleRegionMapInput;
else
state->unk10 = sub_81CC5B4;
state->callback = HandleRegionMapInputZoomDisabled;
return TRUE;
}
void sub_81CC524(void)
void FreeRegionMapSubstruct1(void)
{
gSaveBlock2Ptr->regionMapZoom = sub_8124658();
gSaveBlock2Ptr->regionMapZoom = IsRegionMapZoomed();
FreePokenavSubstruct(16);
FreePokenavSubstruct(3);
}
u32 sub_81CC554(void)
u32 GetRegionMapCallback(void)
{
struct Pokenav5Struct *state = GetSubstructPtr(3);
return state->unk10(state);
return state->callback(state);
}
static u32 sub_81CC568(struct Pokenav5Struct *state)
static u32 HandleRegionMapInput(struct Pokenav5Struct *state)
{
switch (sub_81230AC())
switch (DoRegionMapInputCallback())
{
case 3:
return 1;
case 4:
if (!sub_8124658())
return 3;
return 2;
case 5:
state->unk10 = sub_81CC5DC;
return 4;
case MAP_INPUT_MOVE_END:
return POKENAV_MAP_FUNC_CURSOR_MOVED;
case MAP_INPUT_A_BUTTON:
if (!IsRegionMapZoomed())
return POKENAV_MAP_FUNC_ZOOM_IN;
return POKENAV_MAP_FUNC_ZOOM_OUT;
case MAP_INPUT_B_BUTTON:
state->callback = GetExitRegionMapMenuId;
return POKENAV_MAP_FUNC_EXIT;
}
return 0;
return POKENAV_MAP_FUNC_NONE;
}
static u32 sub_81CC5B4(struct Pokenav5Struct *state)
static u32 HandleRegionMapInputZoomDisabled(struct Pokenav5Struct *state)
{
if (gMain.newKeys & B_BUTTON)
{
state->unk10 = sub_81CC5DC;
return 4;
state->callback = GetExitRegionMapMenuId;
return POKENAV_MAP_FUNC_EXIT;
}
return 0;
return POKENAV_MAP_FUNC_NONE;
}
static u32 sub_81CC5DC(struct Pokenav5Struct *state)
static u32 GetExitRegionMapMenuId(struct Pokenav5Struct *state)
{
return POKENAV_MENU_1;
return POKENAV_MAIN_MENU_CURSOR_ON_MAP;
}
bool32 sub_81CC5E4(void)
bool32 GetZoomDisabled(void)
{
struct Pokenav5Struct *state = GetSubstructPtr(3);
return state->unkC;
return state->zoomDisabled;
}
bool32 sub_81CC5F4(void)
bool32 OpenPokenavRegionMap(void)
{
struct Pokenav5Struct_2 *state = AllocSubstruct(4, sizeof(struct Pokenav5Struct_2));
if (!state)
return FALSE;
state->unk4 = CreateLoopedTask(sub_81CC6F4, 1);
state->unk0 = sub_81CC6BC;
state->loopTaskId = CreateLoopedTask(LoopedTask_OpenRegionMap, 1);
state->isTaskActiveCB = GetCurrentLoopedTaskActive;
return TRUE;
}
void sub_81CC62C(s32 index)
void CreateRegionMapLoopedTask(s32 index)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
state->unk4 = CreateLoopedTask(gUnknown_086230E4[index], 1);
state->unk0 = sub_81CC6BC;
state->loopTaskId = CreateLoopedTask(sRegionMapLoopTaskFuncs[index], 1);
state->isTaskActiveCB = GetCurrentLoopedTaskActive;
}
u32 sub_81CC65C(void)
bool32 IsRegionMapLoopedTaskActive(void)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
return state->unk0();
return state->isTaskActiveCB();
}
void sub_81CC670(void)
void FreeRegionMapSubstruct2(void)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
FreeRegionMapIconResources();
sub_81CC9EC();
RemoveWindow(state->unk8);
FreeCityZoomViewGfx();
RemoveWindow(state->infoWindowId);
FreePokenavSubstruct(16);
FreePokenavSubstruct(4);
SetPokenavVBlankCallback();
SetBgMode(0);
}
static void sub_81CC6A4(void)
static void VBlankCB_RegionMap(void)
{
TransferPlttBuffer();
LoadOam();
@ -281,23 +283,23 @@ static void sub_81CC6A4(void)
UpdateRegionMapVideoRegs();
}
static bool32 sub_81CC6BC(void)
static bool32 GetCurrentLoopedTaskActive(void)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
return IsLoopedTaskActive(state->unk4);
return IsLoopedTaskActive(state->loopTaskId);
}
static bool8 sub_81CC6D0(void)
static bool8 ShouldOpenRegionMapZoomed(void)
{
if (sub_81CC5E4())
if (GetZoomDisabled())
return FALSE;
return gSaveBlock2Ptr->regionMapZoom == 1;
return gSaveBlock2Ptr->regionMapZoom == TRUE;
}
static u32 sub_81CC6F4(s32 taskState)
static u32 LoopedTask_OpenRegionMap(s32 taskState)
{
int var0;
int menuGfxId;
struct RegionMap *regionMap;
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
switch (taskState)
@ -308,209 +310,209 @@ static u32 sub_81CC6F4(s32 taskState)
HideBg(2);
HideBg(3);
SetBgMode(1);
InitBgTemplates(gUnknown_086230D8, ARRAY_COUNT(gUnknown_086230D8) - 1);
InitBgTemplates(sRegionMapBgTemplates, ARRAY_COUNT(sRegionMapBgTemplates) - 1);
regionMap = GetSubstructPtr(16);
sub_8122CF8(regionMap, &gUnknown_086230D8[1], sub_81CC6D0());
sub_81CC9C0();
return 0;
InitRegionMapData(regionMap, &sRegionMapBgTemplates[1], ShouldOpenRegionMapZoomed());
LoadCityZoomViewGfx();
return LT_INC_AND_PAUSE;
case 1:
if (sub_8122DB0())
return 2;
if (LoadRegionMapGfx())
return LT_PAUSE;
if (!sub_81CC5E4())
if (!GetZoomDisabled())
{
CreateRegionMapPlayerIcon(4, 9);
CreateRegionMapCursor(5, 10);
sub_812454C();
TrySetPlayerIconBlink();
}
else
{
sub_8123030(0, 6);
sub_8123030(RGB_BLACK, 6);
}
return 0;
return LT_INC_AND_PAUSE;
case 2:
sub_81CCD10();
return 1;
DecompressCityMaps();
return LT_INC_AND_CONTINUE;
case 3:
if (sub_81CCD24())
return 2;
if (IsDecompressCityMapsActive())
return LT_PAUSE;
sub_81CCA1C(state);
return 1;
LoadPokenavRegionMapGfx(state);
return LT_INC_AND_CONTINUE;
case 4:
if (sub_81CCAFC())
return 2;
if (TryFreeTempTileDataBuffers())
return LT_PAUSE;
sub_81CCB0C(state);
UpdateMapSecInfoWindow(state);
sub_81C7B40();
return 0;
return LT_INC_AND_PAUSE;
case 5:
if (sub_81CCC4C(state))
return 2;
if (IsDma3ManagerBusyWithBgCopy_(state))
return LT_PAUSE;
ShowBg(1);
ShowBg(2);
SetVBlankCallback_(sub_81CC6A4);
return 0;
SetVBlankCallback_(VBlankCB_RegionMap);
return LT_INC_AND_PAUSE;
case 6:
if (!sub_81CC6D0())
var0 = 4;
if (!ShouldOpenRegionMapZoomed())
menuGfxId = POKENAV_GFX_MAP_MENU_ZOOMED_OUT;
else
var0 = 5;
menuGfxId = POKENAV_GFX_MAP_MENU_ZOOMED_IN;
LoadLeftHeaderGfxForIndex(var0);
sub_81C7FA0(var0, 1, 1);
sub_81C7AC0(1);
return 0;
LoadLeftHeaderGfxForIndex(menuGfxId);
sub_81C7FA0(menuGfxId, 1, 1);
PokenavFadeScreen(1);
return LT_INC_AND_PAUSE;
case 7:
if (IsPaletteFadeActive() || sub_81C8010())
return 2;
return 1;
return LT_PAUSE;
return LT_INC_AND_CONTINUE;
default:
return 4;
return LT_FINISH;
}
}
u32 sub_81CC848(s32 taskState)
static u32 LoopedTask_UpdateInfoAfterCursorMove(s32 taskState)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
switch (taskState)
{
case 0:
sub_81CCB0C(state);
return 0;
UpdateMapSecInfoWindow(state);
return LT_INC_AND_PAUSE;
case 1:
if (sub_81CCC4C(state))
return 2;
if (IsDma3ManagerBusyWithBgCopy_(state))
return LT_PAUSE;
break;
}
return 4;
return LT_FINISH;
}
u32 sub_81CC878(s32 taskState)
static u32 LoopedTask_RegionMapZoomOut(s32 taskState)
{
switch (taskState)
{
case 0:
PlaySE(SE_SELECT);
sub_81CCC5C(0);
sub_8123418();
return 0;
ChangeBgYForZoom(FALSE);
SetRegionMapDataForZoom();
return LT_INC_AND_PAUSE;
case 1:
if (sub_8123514() || sub_81CCC88())
return 2;
if (UpdateRegionMapZoom() || IsChangeBgYForZoomActive())
return LT_PAUSE;
PrintHelpBarText(HELPBAR_MAP_ZOOMED_OUT);
return 0;
return LT_INC_AND_PAUSE;
case 2:
if (WaitForHelpBar())
return 2;
return LT_PAUSE;
sub_81C7E14(4);
sub_81C7E14(POKENAV_GFX_MAP_MENU_ZOOMED_OUT);
break;
}
return 4;
return LT_FINISH;
}
u32 sub_81CC8D8(s32 taskState)
static u32 LoopedTask_RegionMapZoomIn(s32 taskState)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
switch (taskState)
{
case 0:
PlaySE(SE_SELECT);
sub_81CCB0C(state);
return 0;
UpdateMapSecInfoWindow(state);
return LT_INC_AND_PAUSE;
case 1:
if (sub_81CCC4C(state))
return 2;
if (IsDma3ManagerBusyWithBgCopy_(state))
return LT_PAUSE;
sub_81CCC5C(1);
sub_8123418();
return 0;
ChangeBgYForZoom(TRUE);
SetRegionMapDataForZoom();
return LT_INC_AND_PAUSE;
case 2:
if (sub_8123514() || sub_81CCC88())
return 2;
if (UpdateRegionMapZoom() || IsChangeBgYForZoomActive())
return LT_PAUSE;
PrintHelpBarText(HELPBAR_MAP_ZOOMED_IN);
return 0;
return LT_INC_AND_PAUSE;
case 3:
if (WaitForHelpBar())
return 2;
return LT_PAUSE;
sub_81C7E14(5);
sub_81C7E14(POKENAV_GFX_MAP_MENU_ZOOMED_IN);
break;
}
return 4;
return LT_FINISH;
}
u32 sub_81CC95C(s32 taskState)
static u32 LoopedTask_ExitRegionMap(s32 taskState)
{
switch (taskState)
{
case 0:
PlaySE(SE_SELECT);
sub_81C7AC0(0);
return 0;
PokenavFadeScreen(0);
return LT_INC_AND_PAUSE;
case 1:
if (IsPaletteFadeActive())
return 2;
return LT_PAUSE;
sub_81C7FDC();
sub_81C78A0();
return 0;
return LT_INC_AND_PAUSE;
case 2:
if (MainMenuLoopedTaskIsBusy())
return 2;
return LT_PAUSE;
HideBg(1);
HideBg(2);
HideBg(3);
return 0;
return LT_INC_AND_PAUSE;
}
return 4;
return LT_FINISH;
}
static void sub_81CC9C0(void)
static void LoadCityZoomViewGfx(void)
{
int i;
for (i = 0; i < ARRAY_COUNT(gUnknown_086230F8); i++)
LoadCompressedSpriteSheet(&gUnknown_086230F8[i]);
for (i = 0; i < ARRAY_COUNT(sCityZoomTextSpriteSheet); i++)
LoadCompressedSpriteSheet(&sCityZoomTextSpriteSheet[i]);
Pokenav_AllocAndLoadPalettes(gUnknown_08623100);
sub_81CCE58();
Pokenav_AllocAndLoadPalettes(sCityZoomTilesSpritePalette);
CreateCityZoomTextSprites();
}
static void sub_81CC9EC(void)
static void FreeCityZoomViewGfx(void)
{
int i;
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
FreeSpriteTilesByTag(6);
FreeSpritePaletteByTag(11);
for (i = 0; i < 3; i++)
DestroySprite(state->cityFeatureTextSprites[i]);
for (i = 0; i < (int)ARRAY_COUNT(state->cityZoomTextSprites); i++)
DestroySprite(state->cityZoomTextSprites[i]);
}
static void sub_81CCA1C(struct Pokenav5Struct_2 *state)
static void LoadPokenavRegionMapGfx(struct Pokenav5Struct_2 *state)
{
sub_8199DF0(1, PIXEL_FILL(0), 0x40, 1);
sub_8199DF0(1, PIXEL_FILL(1), 0x41, 1);
CpuFill16(0x1040, state->unk18, 0x800);
SetBgTilemapBuffer(1, state->unk18);
state->unk8 = AddWindow(&gUnknown_08623110);
LoadUserWindowBorderGfx_(state->unk8, 0x42, 0x40);
DrawTextBorderOuter(state->unk8, 0x42, 4);
decompress_and_copy_tile_data_to_vram(1, gUnknown_08622888, 0, 0, 0);
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
PutWindowTilemap(state->unk8);
CopyWindowToVram(state->unk8, 3);
CopyPaletteIntoBufferUnfaded(gUnknown_08622868, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gHoennMapZoomIcons_Pal, 0x30, 0x20);
if (!sub_8124658())
CpuFill16(0x1040, state->tilemapBuffer, 0x800);
SetBgTilemapBuffer(1, state->tilemapBuffer);
state->infoWindowId = AddWindow(&sMapSecInfoWindowTemplate);
LoadUserWindowBorderGfx_(state->infoWindowId, 0x42, 0x40);
DrawTextBorderOuter(state->infoWindowId, 0x42, 4);
decompress_and_copy_tile_data_to_vram(1, sRegionMapCityZoomTiles_Gfx, 0, 0, 0);
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowTilemap(state->infoWindowId);
CopyWindowToVram(state->infoWindowId, 3);
CopyPaletteIntoBufferUnfaded(sMapSecInfoWindow_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gRegionMapCityZoomTiles_Pal, 0x30, 0x20);
if (!IsRegionMapZoomed())
ChangeBgY(1, -0x6000, 0);
else
ChangeBgY(1, 0, 0);
@ -518,68 +520,70 @@ static void sub_81CCA1C(struct Pokenav5Struct_2 *state)
ChangeBgX(1, 0, 0);
}
static bool32 sub_81CCAFC(void)
static bool32 TryFreeTempTileDataBuffers(void)
{
return free_temp_tile_data_buffers_if_possible();
}
static void sub_81CCB0C(struct Pokenav5Struct_2 *state)
static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *state)
{
struct RegionMap *regionMap = GetSubstructPtr(16);
switch (regionMap->iconDrawType)
switch (regionMap->mapSecType)
{
case MAPSECTYPE_CITY_CANFLY:
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
PutWindowRectTilemap(state->unk8, 0, 0, 12, 2);
AddTextPrinterParameterized(state->unk8, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
sub_81CCD70(state, regionMap->mapSecId, regionMap->posWithinMapSec);
CopyWindowToVram(state->unk8, 3);
sub_81CCFA4(0);
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowRectTilemap(state->infoWindowId, 0, 0, 12, 2);
AddTextPrinterParameterized(state->infoWindowId, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
DrawCityMap(state, regionMap->mapSecId, regionMap->posWithinMapSec);
CopyWindowToVram(state->infoWindowId, 3);
SetCityZoomTextInvisibility(FALSE);
break;
case MAPSECTYPE_CITY_CANTFLY:
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
PutWindowRectTilemap(state->unk8, 0, 0, 12, 2);
AddTextPrinterParameterized(state->unk8, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowRectTilemap(state->infoWindowId, 0, 0, 12, 2);
AddTextPrinterParameterized(state->infoWindowId, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
FillBgTilemapBufferRect(1, 0x1041, 17, 6, 12, 11, 17);
CopyWindowToVram(state->unk8, 3);
sub_81CCFA4(1);
CopyWindowToVram(state->infoWindowId, 3);
SetCityZoomTextInvisibility(TRUE);
break;
case MAPSECTYPE_PLAIN:
case MAPSECTYPE_ROUTE:
case MAPSECTYPE_BATTLE_FRONTIER:
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
PutWindowTilemap(state->unk8);
AddTextPrinterParameterized(state->unk8, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
sub_81CCDE8(state, regionMap->mapSecId, regionMap->posWithinMapSec);
CopyWindowToVram(state->unk8, 3);
sub_81CCFA4(1);
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowTilemap(state->infoWindowId);
AddTextPrinterParameterized(state->infoWindowId, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
PrintLandmarkNames(state, regionMap->mapSecId, regionMap->posWithinMapSec);
CopyWindowToVram(state->infoWindowId, 3);
SetCityZoomTextInvisibility(TRUE);
break;
case MAPSECTYPE_NONE:
FillBgTilemapBufferRect(1, 0x1041, 17, 4, 12, 13, 17);
CopyBgTilemapBufferToVram(1);
sub_81CCFA4(1);
SetCityZoomTextInvisibility(TRUE);
break;
}
}
static bool32 sub_81CCC4C(struct Pokenav5Struct_2 *state)
static bool32 IsDma3ManagerBusyWithBgCopy_(struct Pokenav5Struct_2 *state)
{
return IsDma3ManagerBusyWithBgCopy();
}
static void sub_81CCC5C(int arg0)
#define tZoomIn data[0]
static void ChangeBgYForZoom(bool32 zoomIn)
{
u8 taskId = CreateTask(sub_81CCC9C, 3);
gTasks[taskId].data[0] = arg0;
u8 taskId = CreateTask(Task_ChangeBgYForZoom, 3);
gTasks[taskId].tZoomIn = zoomIn;
}
static bool32 sub_81CCC88(void)
static bool32 IsChangeBgYForZoomActive(void)
{
return FuncIsActiveTask(sub_81CCC9C);
return FuncIsActiveTask(Task_ChangeBgYForZoom);
}
static void sub_81CCC9C(u8 taskId)
static void Task_ChangeBgYForZoom(u8 taskId)
{
if (gTasks[taskId].data[0])
if (gTasks[taskId].tZoomIn)
{
if (ChangeBgY(1, 0x480, 1) >= 0)
{
@ -587,7 +591,7 @@ static void sub_81CCC9C(u8 taskId)
DestroyTask(taskId);
}
sub_81CCF78();
UpdateCityZoomTextPosition();
}
else
{
@ -597,46 +601,48 @@ static void sub_81CCC9C(u8 taskId)
DestroyTask(taskId);
}
sub_81CCF78();
UpdateCityZoomTextPosition();
}
}
static void sub_81CCD10(void)
#undef tZoomIn
static void DecompressCityMaps(void)
{
CreateLoopedTask(sub_81CCD34, 1);
CreateLoopedTask(LoopedTask_DecompressCityMaps, 1);
}
static bool32 sub_81CCD24(void)
static bool32 IsDecompressCityMapsActive(void)
{
return FuncIsActiveLoopedTask(sub_81CCD34);
return FuncIsActiveLoopedTask(LoopedTask_DecompressCityMaps);
}
static u32 sub_81CCD34(s32 taskState)
static u32 LoopedTask_DecompressCityMaps(s32 taskState)
{
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
if (taskState < (int)ARRAY_COUNT(gPokenavCityMaps))
if (taskState < NUM_CITY_MAPS)
{
LZ77UnCompWram(gPokenavCityMaps[taskState].tilemap, state->cityZoomPics[taskState]);
return 1;
LZ77UnCompWram(sPokenavCityMaps[taskState].tilemap, state->cityZoomPics[taskState]);
return LT_INC_AND_CONTINUE;
}
return 4;
return LT_FINISH;
}
static void sub_81CCD70(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
static void DrawCityMap(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
{
int i;
for (i = 0; i < (int)ARRAY_COUNT(gPokenavCityMaps) && (gPokenavCityMaps[i].mapSecId != mapSecId || gPokenavCityMaps[i].index != pos); i++)
for (i = 0; i < NUM_CITY_MAPS && (sPokenavCityMaps[i].mapSecId != mapSecId || sPokenavCityMaps[i].index != pos); i++)
;
if (i == ARRAY_COUNT(gPokenavCityMaps))
if (i == NUM_CITY_MAPS)
return;
FillBgTilemapBufferRect_Palette0(1, 0x1041, 17, 6, 12, 11);
CopyToBgTilemapBufferRect(1, state->cityZoomPics[i], 18, 6, 10, 10);
}
static void sub_81CCDE8(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
static void PrintLandmarkNames(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
{
int i = 0;
while (1)
@ -646,26 +652,27 @@ static void sub_81CCDE8(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
break;
StringCopyPadded(gStringVar1, landmarkName, CHAR_SPACE, 12);
AddTextPrinterParameterized(state->unk8, 7, gStringVar1, 0, i * 16 + 17, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(state->infoWindowId, 7, gStringVar1, 0, i * 16 + 17, TEXT_SPEED_FF, NULL);
i++;
}
}
static void sub_81CCE58(void)
static void CreateCityZoomTextSprites(void)
{
int i;
int y;
struct Sprite *sprite;
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
if (!sub_8124658())
// When not zoomed in the text is still created but its pushed off screen
if (!IsRegionMapZoomed())
y = 228;
else
y = 132;
for (i = 0; i < 3; i++)
for (i = 0; i < (int)ARRAY_COUNT(state->cityZoomTextSprites); i++)
{
u8 spriteId = CreateSprite(&gUnknown_086231D0, 152 + i * 32, y, 8);
u8 spriteId = CreateSprite(&sCityZoomTextSpriteTemplate, 152 + i * 32, y, 8);
sprite = &gSprites[spriteId];
sprite->data[0] = 0;
sprite->data[1] = i * 4;
@ -673,11 +680,12 @@ static void sub_81CCE58(void)
sprite->data[3] = 150;
sprite->data[4] = i * 4;
sprite->oam.tileNum += i * 4;
state->cityFeatureTextSprites[i] = sprite;
state->cityZoomTextSprites[i] = sprite;
}
}
void sub_81CCEF4(struct Sprite *sprite)
// Slide and cycle through the text key showing what the features on the zoomed city map are
static void SpriteCB_CityZoomText(struct Sprite *sprite)
{
if (sprite->data[3])
{
@ -711,19 +719,19 @@ void sub_81CCEF4(struct Sprite *sprite)
}
}
static void sub_81CCF78(void)
static void UpdateCityZoomTextPosition(void)
{
int i;
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
int y = 132 - (GetBgY(1) >> 8);
for (i = 0; i < 3; i++)
state->cityFeatureTextSprites[i]->pos1.y = y;
for (i = 0; i < (int)ARRAY_COUNT(state->cityZoomTextSprites); i++)
state->cityZoomTextSprites[i]->pos1.y = y;
}
static void sub_81CCFA4(int invisible)
static void SetCityZoomTextInvisibility(bool32 invisible)
{
int i;
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
for (i = 0; i < 3; i++)
state->cityFeatureTextSprites[i]->invisible = invisible;
for (i = 0; i < (int)ARRAY_COUNT(state->cityZoomTextSprites); i++)
state->cityZoomTextSprites[i]->invisible = invisible;
}

View File

@ -188,7 +188,7 @@ static u32 sub_81CFA88(struct PokenavSub9 *structPtr)
static u32 sub_81CFB08(struct PokenavSub9 *structPtr)
{
return POKENAV_MENU_5;
return POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS;
}
static u32 sub_81CFB10(struct PokenavSub9 *structPtr)
@ -446,7 +446,7 @@ static u32 sub_81CFEB8(s32 state)
ShowBg(2);
HideBg(3);
PrintHelpBarText(HELPBAR_RIBBONS_MON_LIST);
sub_81C7AC0(1);
PokenavFadeScreen(1);
if (!unk->unkC)
{
LoadLeftHeaderGfxForIndex(2);
@ -601,7 +601,7 @@ static u32 sub_81D01DC(s32 state)
{
case 0:
PlaySE(SE_SELECT);
sub_81C7AC0(0);
PokenavFadeScreen(0);
sub_81C78A0();
return LT_INC_AND_PAUSE;
case 1:
@ -621,7 +621,7 @@ static u32 sub_81D021C(s32 state)
{
case 0:
PlaySE(SE_SELECT);
sub_81C7AC0(0);
PokenavFadeScreen(0);
return LT_INC_AND_PAUSE;
case 1:
if (IsPaletteFadeActive())

View File

@ -586,7 +586,7 @@ u32 sub_81D0A6C(s32 state)
ShowBg(1);
ShowBg(2);
HideBg(3);
sub_81C7AC0(1);
PokenavFadeScreen(1);
return LT_INC_AND_PAUSE;
}
return LT_PAUSE;
@ -604,7 +604,7 @@ u32 sub_81D0C54(s32 state)
{
case 0:
PlaySE(SE_SELECT);
sub_81C7AC0(0);
PokenavFadeScreen(0);
return LT_INC_AND_PAUSE;
case 1:
if (IsPaletteFadeActive())

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +0,0 @@
#include "global.h"
#include "main.h"
#include "menu.h"
#include "bg.h"
#include "malloc.h"
#include "palette.h"
#include "unk_pokedex_area_screen_helper.h"
EWRAM_DATA u8 *gUnknown_0203CF28 = NULL;
static const u16 gUnknown_0861D140[] = INCBIN_U16("graphics/interface/region_map.gbapal");
static const u32 gUnknown_0861D1A0[] = INCBIN_U32("graphics/interface/region_map.8bpp.lz");
static const u32 gUnknown_0861DEF4[] = INCBIN_U32("graphics/interface/region_map.bin.lz");
static const u32 gUnknown_0861E208[] = INCBIN_U32("graphics/interface/region_map_affine.8bpp.lz");
static const u32 gUnknown_0861EF64[] = INCBIN_U32("graphics/interface/region_map_affine.bin.lz");
void sub_81C4D70(const struct UnkStruct_1C4D70 *template)
{
u8 unk;
gUnknown_0203CF28 = Alloc(4);
unk = template->unk10;
if (unk == 0)
{
SetBgAttribute(template->bg, BG_ATTR_METRIC, 0);
decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861D1A0, 0, template->unk2, unk);
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861DEF4, 0, 0, 1), template->unk2, 32, 32, unk);
}
else
{
SetBgAttribute(template->bg, BG_ATTR_METRIC, 2);
SetBgAttribute(template->bg, BG_ATTR_TYPE, 1);
decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861E208, 0, template->unk2, 0);
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861EF64, 0, 0, 1), template->unk2, 64, 64, 1);
}
ChangeBgX(template->bg, 0, 0);
ChangeBgY(template->bg, 0, 0);
SetBgAttribute(template->bg, BG_ATTR_PALETTEMODE, 1);
CpuCopy32(gUnknown_0861D140, &gPlttBufferUnfaded[0x70], 0x60);
*gUnknown_0203CF28 = template->bg;
}
bool32 sub_81C4E90(void)
{
if (!free_temp_tile_data_buffers_if_possible())
{
ShowBg(*gUnknown_0203CF28);
return FALSE;
}
else
{
return TRUE;
}
}
void sub_81C4EB4(void)
{
if (gUnknown_0203CF28 != NULL)
{
FREE_AND_SET_NULL(gUnknown_0203CF28);
}
}
void sub_81C4ED0(u32 a0)
{
ChangeBgY(*gUnknown_0203CF28, a0 * 0x100, 0);
}

View File

@ -137,7 +137,7 @@
.include "src/party_menu.o"
.include "src/mirage_tower.o"
.include "src/pokemon_summary_screen.o"
.include "src/unk_pokedex_area_screen_helper.o"
.include "src/pokedex_area_region_map.o"
.include "src/battle_pyramid_bag.o"
.include "src/pokenav.o"
.include "src/pokenav_match_call_ui.o"