diff options
Diffstat (limited to 'src/field_region_map.c')
-rw-r--r-- | src/field_region_map.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/field_region_map.c b/src/field_region_map.c index 184c49b40..57f95f93e 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -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, ARRAY_COUNT(sFieldRegionMapBgTemplates)); + 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); |