From 34fd49bfd8f3888821c35f7f85bbe4f64ea4fc94 Mon Sep 17 00:00:00 2001 From: Flash1Lucky <99516581+Flash1Lucky@users.noreply.github.com> Date: Fri, 27 Feb 2026 08:02:51 -0500 Subject: [PATCH] Document Pokedex default main info page (#972) --- include/applications/pokedex/infomain.h | 44 + .../applications/pokedex/infomain_foreign.h | 7 +- include/applications/pokedex/ov21_021DE668.h | 20 - .../pokedex/struct_ov21_021DE6D4.h | 18 - platinum.us/main.lsf | 2 +- src/applications/pokedex/infomain.c | 1003 ++++++++++++++++ src/applications/pokedex/infomain_foreign.c | 64 +- src/applications/pokedex/ov21_021DE668.c | 1008 ----------------- src/applications/pokedex/ov21_021E1924.c | 33 +- src/applications/pokedex/ov21_021E29DC.c | 32 +- src/applications/pokedex/ov21_021E8D48.c | 6 +- src/applications/pokedex/pokedex_main.c | 6 +- src/meson.build | 2 +- 13 files changed, 1119 insertions(+), 1126 deletions(-) create mode 100644 include/applications/pokedex/infomain.h delete mode 100644 include/applications/pokedex/ov21_021DE668.h delete mode 100644 include/applications/pokedex/struct_ov21_021DE6D4.h create mode 100644 src/applications/pokedex/infomain.c delete mode 100644 src/applications/pokedex/ov21_021DE668.c diff --git a/include/applications/pokedex/infomain.h b/include/applications/pokedex/infomain.h new file mode 100644 index 0000000000..d6dc262321 --- /dev/null +++ b/include/applications/pokedex/infomain.h @@ -0,0 +1,44 @@ +#ifndef POKEPLATINUM_POKEDEX_INFOMAIN_H +#define POKEPLATINUM_POKEDEX_INFOMAIN_H + +/** + * Animation modes for Pokedex info screen transitions. + * Used by both the default language and multi-language info screens. + */ +enum AnimationMode { + ANIM_POSITION_BLEND = 0, // Animate position and blend transparency + ANIM_BLEND, // Animate blend transparency only + ANIM_POSITION, // Animate position only +}; + +#include "applications/pokedex/pokedex_app.h" +#include "applications/pokedex/pokedex_sort_data.h" +#include "applications/pokedex/pokedex_text_manager.h" +#include "applications/pokedex/struct_ov21_021E68F4.h" + +#include "bg_window.h" +#include "heap.h" + +/** + * State information for the Pokedex info main screen. + */ +typedef struct InfoMainState { + int *displayWorkData; // Work data pointer set from ov21_021D138C + PokedexSortData *sortData; // Pokemon sort/listing data + int displayPositionX; // X coordinate for display position animation + int displayPositionY; // Y coordinate for display position animation + const PokedexScreenManager *screenManager; // Screen manager reference + enum AnimationMode animationMode; + int entryOffset; // Dex entry offset (0 = current entry) + BOOL playCry; // Flag to play Pokemon cry +} InfoMainState; + +void InfoMain_InitScreen(PokedexScreenManager *screenManager, PokedexApp *pokedexApp, enum HeapID heapID); +void InfoMain_FreeScreen(PokedexScreenManager *screenManager); +BOOL InfoMain_SetDisplayPosition(InfoMainState *displayState, int unused); +BOOL InfoMain_SetEntryOffset(InfoMainState *displayState, int entryOffset); +void InfoMain_RenderHeightWeightEntry(Window *window, int species, enum HeapID heapID, int entryOffset, u32 textColor); +int PokedexGraphics_GetAnimIDfromType(int monType); +Window *InfoMain_CreateCategoryWindow(PokedexTextManager *textMan, enum Species species, enum HeapID heapID); + +#endif // POKEPLATINUM_POKEDEX_INFOMAIN_H diff --git a/include/applications/pokedex/infomain_foreign.h b/include/applications/pokedex/infomain_foreign.h index 410286dc2e..b42282231f 100644 --- a/include/applications/pokedex/infomain_foreign.h +++ b/include/applications/pokedex/infomain_foreign.h @@ -1,17 +1,12 @@ #ifndef POKEPLATINUM_POKEDEX_INFOMAIN_FOREIGN_H #define POKEPLATINUM_POKEDEX_INFOMAIN_FOREIGN_H +#include "applications/pokedex/infomain.h" #include "applications/pokedex/pokedex_app.h" #include "applications/pokedex/struct_ov21_021E68F4.h" #include "heap.h" -enum AnimationMode { - ANIM_MODE_POSITION_BLEND = 0, - ANIM_MODE_BLEND = 1, - ANIM_MODE_POSITION = 2, -}; - void InfoMainForeign_InitScreen(PokedexScreenManager *screenManager, PokedexApp *pokedexApp, enum HeapID heapID); void InfoMainForeign_FreeScreen(PokedexScreenManager *screenManager); void InfoMainForeign_SetDisplayPosition(PokedexScreenManager *screenManager, int posX, int posY); diff --git a/include/applications/pokedex/ov21_021DE668.h b/include/applications/pokedex/ov21_021DE668.h deleted file mode 100644 index 84f8b46481..0000000000 --- a/include/applications/pokedex/ov21_021DE668.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef POKEPLATINUM_OV21_021DE668_H -#define POKEPLATINUM_OV21_021DE668_H - -#include "applications/pokedex/pokedex_app.h" -#include "applications/pokedex/pokedex_text_manager.h" -#include "applications/pokedex/struct_ov21_021DE6D4.h" -#include "applications/pokedex/struct_ov21_021E68F4.h" - -#include "bg_window.h" -#include "heap.h" - -void ov21_021DE668(PokedexScreenManager *param0, PokedexApp *param1, enum HeapID heapID); -void ov21_021DE6C0(PokedexScreenManager *param0); -BOOL ov21_021DE6D4(UnkStruct_ov21_021DE6D4 *param0, int param1); -BOOL ov21_021DE6D8(UnkStruct_ov21_021DE6D4 *param0, int param1); -void ov21_021DEB8C(Window *param0, int param1, enum HeapID heapID, int param3, u32 param4); -int PokedexGraphics_GetAnimIDfromType(int monType); -Window *ov21_021DF30C(PokedexTextManager *textMan, int param1, int param2); - -#endif // POKEPLATINUM_OV21_021DE668_H diff --git a/include/applications/pokedex/struct_ov21_021DE6D4.h b/include/applications/pokedex/struct_ov21_021DE6D4.h deleted file mode 100644 index 050cf5569b..0000000000 --- a/include/applications/pokedex/struct_ov21_021DE6D4.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_OV21_021DE6D4_H -#define POKEPLATINUM_STRUCT_OV21_021DE6D4_H - -#include "applications/pokedex/pokedex_sort_data.h" -#include "applications/pokedex/struct_ov21_021E68F4.h" - -typedef struct { - int *unk_00; - PokedexSortData *unk_04; - int unk_08; - int unk_0C; - const PokedexScreenManager *unk_10; - int unk_14; - int unk_18; - BOOL unk_1C; -} UnkStruct_ov21_021DE6D4; - -#endif // POKEPLATINUM_STRUCT_OV21_021DE6D4_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index f4d23d9ace..1fed91ea07 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -796,7 +796,7 @@ Overlay pokedex Object main.nef.p/src_applications_pokedex_ov21_021D94BC.c.o Object main.nef.p/src_applications_pokedex_ov21_021DC9BC.c.o Object main.nef.p/src_applications_pokedex_ov21_021DDD2C.c.o - Object main.nef.p/src_applications_pokedex_ov21_021DE668.c.o + Object main.nef.p/src_applications_pokedex_infomain.c.o Object main.nef.p/src_applications_pokedex_formmain.c.o Object main.nef.p/src_applications_pokedex_infomain_foreign.c.o Object main.nef.p/src_applications_pokedex_ov21_021E1924.c.o diff --git a/src/applications/pokedex/infomain.c b/src/applications/pokedex/infomain.c new file mode 100644 index 0000000000..1c2935bcde --- /dev/null +++ b/src/applications/pokedex/infomain.c @@ -0,0 +1,1003 @@ +#include "applications/pokedex/infomain.h" + +#include +#include + +#include "generated/pokemon_types.h" + +#include "applications/pokedex/footprint.h" +#include "applications/pokedex/ov21_021E29DC.h" +#include "applications/pokedex/pokedex_app.h" +#include "applications/pokedex/pokedex_data_manager.h" +#include "applications/pokedex/pokedex_graphics.h" +#include "applications/pokedex/pokedex_graphics_manager.h" +#include "applications/pokedex/pokedex_main.h" +#include "applications/pokedex/pokedex_sort.h" +#include "applications/pokedex/pokedex_text.h" +#include "applications/pokedex/pokedex_text_manager.h" +#include "applications/pokedex/species_caught_status.h" +#include "applications/pokedex/struct_ov21_021E68F4.h" + +#include "bg_window.h" +#include "font.h" +#include "heap.h" +#include "message.h" +#include "narc.h" +#include "pokedex_data_index.h" +#include "pokemon.h" +#include "pokemon_sprite.h" +#include "sound_playback.h" +#include "sprite.h" +#include "sprite_resource.h" +#include "sprite_transfer.h" +#include "sprite_util.h" +#include "string_gf.h" +#include "text.h" +#include "unk_02012744.h" + +#include "res/graphics/pokedex/zukan.naix" +#include "res/text/bank/pokedex.h" + +#define POKEDEX_TYPE_ICON_BACKGROUND_BOX_CELL 0x11 +#define POKEDEX_TYPE_ICON_RESOURCE_OFFSET 4000 +#define STRING_BUFFER_SIZE 64 + +enum InfoMainGraphicsSpriteIndex { + INFOMAIN_SPRITE_FOOTPRINT = 0, // Footprint sprite + INFOMAIN_SPRITE_TYPE_ICON_1 = 1, // Type icon sprite 1 + INFOMAIN_SPRITE_TYPE_ICON_2 = 2, // Type icon sprite 2 + INFOMAIN_SPRITE_MAX = 3, // Maximum number of sprites +}; + +typedef struct InfoMainGraphics { + Sprite *footprintAndTypeSprites[INFOMAIN_SPRITE_MAX]; + Sprite *categoryBoxSprite; + PokedexTextData *categoryTextData; + SpriteResource *typeIconResources[MAX_SPRITE_RESOURCE_GEN4]; + SpriteResource *footprintResources[MAX_SPRITE_RESOURCE_GEN4]; + SpriteTransformation transformPokemon; + SpriteTransformation transformLabel; +} InfoMainGraphics; + +static InfoMainState *AllocateState(enum HeapID heapID, PokedexApp *pokedexApp); +static PokedexGraphicData **AllocateGraphicsData(enum HeapID heapID, PokedexApp *pokedexApp); +static void FreeState(InfoMainState *displayState); +static void FreeGraphicsData(PokedexGraphicData **graphicsData); +static int GetNumScreenStates(void); +static int InitData(PokedexDataManager *dataMan, void *data); +static int UpdateData(PokedexDataManager *dataMan, void *data); +static int FinalizeData(PokedexDataManager *dataMan, void *data); +static int InitGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); +static int UpdateGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); +static int FinalizeGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); +static void InitBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing); +static BOOL UpdateBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing); +static void InitPositionBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing); +static BOOL UpdatePositionBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing); +static void InitPositionMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing); +static BOOL UpdatePositionMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing); +static void BlendPokemonSprite(PokedexGraphicData **graphicsData); +static void SetXluMode(InfoMainGraphics *graphicsStruct); +static void SetNormalMode(InfoMainGraphics *graphicsStruct); +static void InitPokemonTransform(InfoMainGraphics *graphicsStruct, int posX, int posY, int numSteps); +static BOOL UpdatePokemonTransform(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData); +static void InitLabelTransform(InfoMainGraphics *graphicsStruct); +static BOOL UpdateLabelTransform(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData); +static void SetupGraphics(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, enum HeapID heapID); +static void CleanupGraphics(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData); +static void LoadBackground(PokedexGraphicData **graphicsData, enum HeapID heapID); +static void RenderAllText(PokedexGraphicData **graphicsData, const InfoMainState *displayState, enum HeapID heapID); +static void RenderHeight(Window *window, enum HeapID heapID, int species, u32 textColor); +static void RenderWeight(Window *window, enum HeapID heapID, int species, u32 textColor); +static void RenderDexEntry(Window *window, enum HeapID heapID, int species, int entryOffset, u32 textColor); +static void CreateFootprintSprite(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID); +static void DeleteFootprintSprite(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData); +static void LoadFootprintResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, int heapID, int footprintSpecies); +static void UnloadFootprintResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData); +static void CreateFootprintSpriteFromResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, int heapID); +static void DeleteFootprintSpriteInstance(InfoMainGraphics *graphicsStruct); +static void RenderEntryName(PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID); +static void ConfigureLabel(PokedexGraphicData **graphicsData); +static void ShowPokemonSprite(PokedexGraphicData **graphicsData, const InfoMainState *displayState); +static void HidePokemonSprite(PokedexGraphicData **graphicsData); +static void LoadTypeIconResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, int heapID); +static void UnloadTypeIconResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData); +static void CreateTypeIconSprites(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID); +static void DeleteTypeIconSprites(InfoMainGraphics *graphicsStruct); +static void CreateCategoryBox(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID); +static void DeleteCategoryBox(InfoMainGraphics *graphicsStruct); + +void InfoMain_InitScreen(PokedexScreenManager *screenManager, PokedexApp *pokedexApp, enum HeapID heapID) +{ + InfoMainState *displayState = AllocateState(heapID, pokedexApp); + PokedexGraphicData **graphicsData = AllocateGraphicsData(heapID, pokedexApp); + + screenManager->pageData = displayState; + screenManager->pageGraphics = graphicsData; + screenManager->screenStates = NULL; + screenManager->numStates = GetNumScreenStates(); + screenManager->dataFunc[0] = InitData; + screenManager->dataFunc[1] = UpdateData; + screenManager->dataFunc[2] = FinalizeData; + screenManager->graphicsFunc[0] = InitGraphics; + screenManager->graphicsFunc[1] = UpdateGraphics; + screenManager->graphicsFunc[2] = FinalizeGraphics; +} + +void InfoMain_FreeScreen(PokedexScreenManager *screenManager) +{ + FreeState(screenManager->pageData); + FreeGraphicsData(screenManager->pageGraphics); +} + +// Compatibility stub for InfoMainForeign_SetDisplayPosition. Main screen doesn't support position animations. +BOOL InfoMain_SetDisplayPosition(InfoMainState *displayState, int unused) +{ + return FALSE; +} + +BOOL InfoMain_SetEntryOffset(InfoMainState *displayState, int entryOffset) +{ + BOOL result = TRUE; + + if (entryOffset == 1) { + entryOffset = 0; + result = FALSE; + } + + displayState->entryOffset = entryOffset; + return result; +} + +static InfoMainState *AllocateState(enum HeapID heapID, PokedexApp *pokedexApp) +{ + InfoMainState *displayState = Heap_Alloc(heapID, sizeof(InfoMainState)); + + GF_ASSERT(displayState); + memset(displayState, 0, sizeof(InfoMainState)); + + displayState->displayWorkData = ov21_021D138C(pokedexApp); + displayState->sortData = PokedexMain_GetSortData(pokedexApp); + displayState->screenManager = ov21_021D1410(pokedexApp, 5); + + return displayState; +} + +static PokedexGraphicData **AllocateGraphicsData(enum HeapID heapID, PokedexApp *pokedexApp) +{ + PokedexGraphicData **graphicsData = Heap_Alloc(heapID, sizeof(PokedexGraphicData *)); + + GF_ASSERT(graphicsData); + memset(graphicsData, 0, sizeof(PokedexGraphicData *)); + + *graphicsData = PokedexMain_GetGraphicData(pokedexApp); + + return graphicsData; +} + +static void FreeState(InfoMainState *displayState) +{ + GF_ASSERT(displayState); + Heap_Free(displayState); +} + +static void FreeGraphicsData(PokedexGraphicData **graphicsData) +{ + GF_ASSERT(graphicsData); + Heap_Free(graphicsData); +} + +static int GetNumScreenStates(void) +{ + return 0; +} + +static int InitData(PokedexDataManager *dataMan, void *data) +{ + InfoMainState *displayState = data; + + PokedexSort_SetCurrentSpecies(displayState->sortData, PokedexSort_CurrentSpecies(displayState->sortData)); + PokedexSort_SetBootMode(displayState->sortData, PokedexSort_IsNationalDex(displayState->sortData)); + + return TRUE; +} + +static int UpdateData(PokedexDataManager *dataMan, void *data) +{ + InfoMainState *displayState = data; + + if (dataMan->exit == TRUE) { + return TRUE; + } + + if (dataMan->unchanged == TRUE) { + return FALSE; + } + + switch (dataMan->state) { + case 0: + if (displayState->playCry == TRUE) { + // The pan, volume, and heapID parameters are unused by the sound system's code path, which is why their values are set to 0x1ff + Sound_PlayPokemonCryEx(POKECRY_POKEDEX, PokedexSort_CurrentSpecies(displayState->sortData), 0x1ff, 0x1ff, 0x1ff, 0); + displayState->playCry = FALSE; + } + + dataMan->state++; + break; + default: + break; + } + + return FALSE; +} + +static int FinalizeData(PokedexDataManager *dataMan, void *data) +{ + Sound_StopPokemonCries(0); + return TRUE; +} + +static int InitGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) +{ + const InfoMainState *displayState = data; + PokedexGraphicData **graphicsData = graphics; + InfoMainGraphics *graphicsStruct = graphicsMan->pageGraphics; + BOOL animationComplete; + + switch (graphicsMan->state) { + case 0: + graphicsMan->pageGraphics = Heap_Alloc(graphicsMan->heapID, sizeof(InfoMainGraphics)); + memset(graphicsMan->pageGraphics, 0, sizeof(InfoMainGraphics)); + graphicsMan->state++; + break; + case 1: + SetupGraphics(graphicsStruct, graphicsData, displayState, graphicsMan->heapID); + + switch (displayState->animationMode) { + case ANIM_POSITION_BLEND: + InitPositionBlendMode(graphicsStruct, graphicsData, displayState, TRUE); + break; + case ANIM_BLEND: + InitBlendMode(graphicsStruct, graphicsData, displayState, TRUE); + break; + case ANIM_POSITION: + InitPositionMode(graphicsStruct, graphicsData, displayState, TRUE); + break; + } + + graphicsMan->state++; + break; + case 2: + switch (displayState->animationMode) { + case ANIM_POSITION_BLEND: + animationComplete = UpdatePositionBlendMode(graphicsStruct, graphicsData, displayState, TRUE); + break; + case ANIM_BLEND: + animationComplete = UpdateBlendMode(graphicsStruct, graphicsData, displayState, TRUE); + break; + case ANIM_POSITION: + animationComplete = UpdatePositionMode(graphicsStruct, graphicsData, displayState, TRUE); + break; + } + + if (animationComplete) { + graphicsMan->state++; + } + break; + case 3: + G2_BlendNone(); + return TRUE; + default: + break; + } + + return FALSE; +} + +static int UpdateGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) +{ + return FALSE; +} + +static int FinalizeGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) +{ + const InfoMainState *displayState = data; + PokedexGraphicData **graphicsData = graphics; + InfoMainGraphics *graphicsStruct = graphicsMan->pageGraphics; + BOOL animationComplete; + + switch (graphicsMan->state) { + case 0: + switch (displayState->animationMode) { + case ANIM_POSITION_BLEND: + InitPositionBlendMode(graphicsStruct, graphicsData, displayState, FALSE); + break; + case ANIM_BLEND: + InitBlendMode(graphicsStruct, graphicsData, displayState, FALSE); + break; + case ANIM_POSITION: + InitPositionMode(graphicsStruct, graphicsData, displayState, FALSE); + break; + } + + graphicsMan->state++; + break; + case 1: + switch (displayState->animationMode) { + case ANIM_POSITION_BLEND: + animationComplete = UpdatePositionBlendMode(graphicsStruct, graphicsData, displayState, FALSE); + break; + case ANIM_BLEND: + animationComplete = UpdateBlendMode(graphicsStruct, graphicsData, displayState, FALSE); + break; + case ANIM_POSITION: + animationComplete = UpdatePositionMode(graphicsStruct, graphicsData, displayState, FALSE); + break; + } + + if (animationComplete) { + graphicsMan->state++; + } + break; + case 2: + CleanupGraphics(graphicsStruct, graphicsData); + graphicsMan->state++; + break; + case 3: + Heap_Free(graphicsMan->pageGraphics); + graphicsMan->state++; + break; + case 4: + return TRUE; + default: + break; + } + + return FALSE; +} + +static void SetupGraphics(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, enum HeapID heapID) +{ + RenderEntryName(graphicsData, displayState, heapID); + ShowPokemonSprite(graphicsData, displayState); + LoadTypeIconResources(graphicsStruct, graphicsData, heapID); + CreateCategoryBox(graphicsStruct, graphicsData, displayState, heapID); + LoadBackground(graphicsData, heapID); + RenderAllText(graphicsData, displayState, heapID); + + if (PokedexSort_CurrentCaughtStatus(displayState->sortData) == CS_CAUGHT) { + CreateFootprintSprite(graphicsStruct, graphicsData, displayState, heapID); + CreateTypeIconSprites(graphicsStruct, graphicsData, displayState, heapID); + } +} + +static void CleanupGraphics(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData) +{ + DeleteCategoryBox(graphicsStruct); + + Window_FillTilemap(&(*graphicsData)->window, 0); + + DeleteFootprintSprite(graphicsStruct, graphicsData); + DeleteTypeIconSprites(graphicsStruct); + UnloadTypeIconResources(graphicsStruct, graphicsData); + + Bg_ClearTilemap((*graphicsData)->bgConfig, BG_LAYER_MAIN_1); +} + +static void LoadBackground(PokedexGraphicData **graphicsData, enum HeapID heapID) +{ + void *tilemapData; + NNSG2dScreenData *screenData; + + PokedexGraphics_LoadGraphicNarcCharacterData(*graphicsData, entry_main_NCGR_lz, (*graphicsData)->bgConfig, BG_LAYER_MAIN_3, 0, 0, TRUE, heapID); + + tilemapData = PokedexGraphics_GetGraphicNarcTilemapData(*graphicsData, info_main_NSCR_lz, TRUE, &screenData, heapID); + Bg_LoadToTilemapRect((*graphicsData)->bgConfig, BG_LAYER_MAIN_3, screenData->rawData, 0, 0, screenData->screenWidth / 8, screenData->screenHeight / 8); + Heap_Free(tilemapData); + + tilemapData = PokedexGraphics_GetGraphicNarcTilemapData(*graphicsData, info_species_window_NSCR_lz, TRUE, &screenData, heapID); + Bg_LoadToTilemapRect((*graphicsData)->bgConfig, BG_LAYER_MAIN_3, screenData->rawData, 0, 3, screenData->screenWidth / 8, screenData->screenHeight / 8); + Heap_Free(tilemapData); + + tilemapData = PokedexGraphics_GetGraphicNarcTilemapData(*graphicsData, info_footprint_window_NSCR_lz, TRUE, &screenData, heapID); + Bg_LoadToTilemapRect((*graphicsData)->bgConfig, BG_LAYER_MAIN_3, screenData->rawData, 12, 8, screenData->screenWidth / 8, screenData->screenHeight / 8); + Heap_Free(tilemapData); + + tilemapData = PokedexGraphics_GetGraphicNarcTilemapData(*graphicsData, info_entry_window_NSCR_lz, TRUE, &screenData, heapID); + Bg_LoadToTilemapRect((*graphicsData)->bgConfig, BG_LAYER_MAIN_3, screenData->rawData, 0, 16, screenData->screenWidth / 8, screenData->screenHeight / 8); + Heap_Free(tilemapData); + Bg_ScheduleTilemapTransfer((*graphicsData)->bgConfig, BG_LAYER_MAIN_3); +} + +static void RenderAllText(PokedexGraphicData **graphicsData, const InfoMainState *displayState, enum HeapID heapID) +{ + int species = PokedexSort_CurrentSpecies(displayState->sortData); + + if (PokedexSort_CurrentCaughtStatus(displayState->sortData) != CS_CAUGHT) { + species = SPECIES_NONE; + } + + InfoMain_RenderHeightWeightEntry(&(*graphicsData)->window, species, heapID, displayState->entryOffset, TEXT_COLOR(2, 1, 0)); +} + +void InfoMain_RenderHeightWeightEntry(Window *window, int species, enum HeapID heapID, int entryOffset, u32 textColor) +{ + String *labelString = String_Init(STRING_BUFFER_SIZE, heapID); + MessageLoader *pokedexMessageBank = MessageLoader_Init(MSG_LOADER_PRELOAD_ENTIRE_BANK, NARC_INDEX_MSGDATA__PL_MSG, TEXT_BANK_POKEDEX, heapID); + + MessageLoader_GetString(pokedexMessageBank, pl_msg_pokedex_ht, labelString); + Text_AddPrinterWithParamsAndColor(window, FONT_SYSTEM, labelString, 152, 88, TEXT_SPEED_INSTANT, textColor, NULL); + + MessageLoader_GetString(pokedexMessageBank, pl_msg_pokedex_wt, labelString); + Text_AddPrinterWithParamsAndColor(window, FONT_SYSTEM, labelString, 152, 104, TEXT_SPEED_INSTANT, textColor, NULL); + String_Free(labelString); + MessageLoader_Free(pokedexMessageBank); + + RenderHeight(window, heapID, species, textColor); + RenderWeight(window, heapID, species, textColor); + RenderDexEntry(window, heapID, species, entryOffset, textColor); +} + +static void RenderHeight(Window *window, enum HeapID heapID, int species, u32 textColor) +{ + String *heightString = String_Init(STRING_BUFFER_SIZE, heapID); + MessageLoader *heightMsgLoader = MessageLoader_Init(MSG_LOADER_PRELOAD_ENTIRE_BANK, NARC_INDEX_MSGDATA__PL_MSG, Height_Message_Bank_Index(), heapID); + + MessageLoader_GetString(heightMsgLoader, species, heightString); + Text_AddPrinterWithParamsAndColor(window, FONT_SYSTEM, heightString, 184, 88, TEXT_SPEED_INSTANT, textColor, NULL); + String_Free(heightString); + MessageLoader_Free(heightMsgLoader); +} + +static void RenderWeight(Window *window, enum HeapID heapID, int species, u32 textColor) +{ + String *weightString = String_Init(STRING_BUFFER_SIZE, heapID); + MessageLoader *weightMsgLoader = MessageLoader_Init(MSG_LOADER_PRELOAD_ENTIRE_BANK, NARC_INDEX_MSGDATA__PL_MSG, Weight_Message_Bank_Index(), heapID); + + MessageLoader_GetString(weightMsgLoader, species, weightString); + Text_AddPrinterWithParamsAndColor(window, FONT_SYSTEM, weightString, 184, 104, TEXT_SPEED_INSTANT, textColor, NULL); + String_Free(weightString); + MessageLoader_Free(weightMsgLoader); +} + +static void RenderDexEntry(Window *window, enum HeapID heapID, int species, int entryOffset, u32 textColor) +{ + String *entryString = PokedexText_DexEntry(species, GAME_LANGUAGE, entryOffset, heapID); + u32 stringWidth = Font_CalcMaxLineWidth(FONT_SYSTEM, entryString, 0); + u32 xPosition = (stringWidth < 240) ? 128 - stringWidth / 2 : 8; + + Text_AddPrinterWithParamsAndColor(window, FONT_SYSTEM, entryString, xPosition, 136, TEXT_SPEED_INSTANT, textColor, NULL); + PokedexText_Free(entryString); +} + +static void CreateFootprintSprite(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID) +{ + enum Species species = PokedexSort_CurrentSpecies(displayState->sortData); + int form = PokedexSort_DefaultForm(displayState->sortData, species); + + if ((species == SPECIES_GIRATINA) && (form > 0)) { + species = SPECIES_METAPOD; + } + + LoadFootprintResources(graphicsStruct, graphicsData, heapID, species); + CreateFootprintSpriteFromResources(graphicsStruct, graphicsData, heapID); +} + +static void DeleteFootprintSprite(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData) +{ + DeleteFootprintSpriteInstance(graphicsStruct); + UnloadFootprintResources(graphicsStruct, graphicsData); +} + +static void LoadFootprintResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, int heapID, int footprintSpecies) +{ + PokedexGraphicData *gfxData = *graphicsData; + int narcID = GetPokedexFootprintsNarcID(); + int tilesFileID = GetSpeciesFootprintTiles(footprintSpecies); + int paletteFileID = GetSharedFootprintPalette(); + int cellsFileID = GetSharedFootprintCells(); + int animsFileID = GetSharedFootprintAnims(); + + graphicsStruct->footprintResources[SPRITE_RESOURCE_CHAR] = SpriteResourceCollection_AddTiles(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], narcID, tilesFileID, TRUE, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, NNS_G2D_VRAM_TYPE_2DMAIN, heapID); + + SpriteTransfer_RequestCharAtEnd(graphicsStruct->footprintResources[SPRITE_RESOURCE_CHAR]); + SpriteResource_ReleaseData(graphicsStruct->footprintResources[SPRITE_RESOURCE_CHAR]); + + graphicsStruct->footprintResources[SPRITE_RESOURCE_PLTT] = SpriteResourceCollection_AddPalette(gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], narcID, paletteFileID, FALSE, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, NNS_G2D_VRAM_TYPE_2DMAIN, 1, heapID); + + SpriteTransfer_RequestPlttFreeSpace(graphicsStruct->footprintResources[SPRITE_RESOURCE_PLTT]); + SpriteResource_ReleaseData(graphicsStruct->footprintResources[SPRITE_RESOURCE_PLTT]); + + graphicsStruct->footprintResources[SPRITE_RESOURCE_CELL] = SpriteResourceCollection_Add(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], narcID, cellsFileID, TRUE, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, SPRITE_RESOURCE_CELL, heapID); + graphicsStruct->footprintResources[SPRITE_RESOURCE_ANIM] = SpriteResourceCollection_Add(gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], narcID, animsFileID, TRUE, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, SPRITE_RESOURCE_ANIM, heapID); +} + +static void UnloadFootprintResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData) +{ + PokedexGraphicData *gfxData = *graphicsData; + + if (graphicsStruct->footprintResources[SPRITE_RESOURCE_CHAR] == NULL) { + return; + } + + SpriteTransfer_ResetCharTransfer(graphicsStruct->footprintResources[SPRITE_RESOURCE_CHAR]); + SpriteTransfer_ResetPlttTransfer(graphicsStruct->footprintResources[SPRITE_RESOURCE_PLTT]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], graphicsStruct->footprintResources[SPRITE_RESOURCE_CHAR]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], graphicsStruct->footprintResources[SPRITE_RESOURCE_PLTT]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], graphicsStruct->footprintResources[SPRITE_RESOURCE_CELL]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], graphicsStruct->footprintResources[SPRITE_RESOURCE_ANIM]); +} + +static void CreateFootprintSpriteFromResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, int heapID) +{ + SpriteResourcesHeader resourceHeader; + SpriteListTemplate spriteTemplate; + PokedexGraphicData *gfxData = *graphicsData; + + SpriteResourcesHeader_Init(&resourceHeader, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, POKEDEX_TYPE_ICON_RESOURCE_OFFSET, 0xffffffff, 0xffffffff, FALSE, 0, gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], NULL, NULL); + + spriteTemplate.list = gfxData->spriteList; + spriteTemplate.resourceData = &resourceHeader; + spriteTemplate.priority = 32; + spriteTemplate.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; + spriteTemplate.heapID = heapID; + spriteTemplate.position.y = (88 * FX32_ONE); + spriteTemplate.position.x = (120 * FX32_ONE); + + graphicsStruct->footprintAndTypeSprites[0] = SpriteList_Add(&spriteTemplate); +} + +static void DeleteFootprintSpriteInstance(InfoMainGraphics *graphicsStruct) +{ + if (graphicsStruct->footprintAndTypeSprites[0]) { + Sprite_Delete(graphicsStruct->footprintAndTypeSprites[0]); + } +} + +static void RenderEntryName(PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID) +{ + PokedexMain_EntryNameNumber(*graphicsData, displayState->sortData, heapID, PokedexSort_CurrentStatusIndex(displayState->sortData), (172 * FX32_ONE), (32 * FX32_ONE)); + PokedexGraphics_SetSpeciesLabelPriority(*graphicsData, 0); +} + +static void ConfigureLabel(PokedexGraphicData **graphicsData) +{ + PokedexGraphics_SetPokedexSpeciesLabelDraw(*graphicsData, 0); + PokedexGraphics_SetSpeciesLabelGXOamMode(*graphicsData, GX_OAM_MODE_NORMAL); +} + +static void ShowPokemonSprite(PokedexGraphicData **graphicsData, const InfoMainState *displayState) +{ + PokemonSprite *pokemonSprite = PokemonGraphics_GetPokemonChar(*graphicsData); + int species = PokedexSort_CurrentSpecies(displayState->sortData); + + PokedexMain_DisplayPokemonSprite(*graphicsData, displayState->sortData, species, 2, 48, 72); + PokemonSprite_SetAttribute(pokemonSprite, MON_SPRITE_HIDE, FALSE); +} + +static void HidePokemonSprite(PokedexGraphicData **graphicsData) +{ + PokemonSprite *pokemonSprite = PokemonGraphics_GetPokemonChar(*graphicsData); + + PokemonSprite_SetAttribute(pokemonSprite, MON_SPRITE_HIDE, TRUE); + PokemonSprite_ClearFade(pokemonSprite); +} + +static void LoadTypeIconResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, int heapID) +{ + PokedexGraphicData *gfxData = *graphicsData; + NARC *pokedexNarc = PokedexGraphics_GetNARC(*graphicsData); + + graphicsStruct->typeIconResources[SPRITE_RESOURCE_CHAR] = SpriteResourceCollection_AddTilesFrom(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], pokedexNarc, type_icons_NCGR_lz, TRUE, type_icons_NCGR_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, NNS_G2D_VRAM_TYPE_2DMAIN, heapID); + + SpriteTransfer_RequestCharAtEnd(graphicsStruct->typeIconResources[SPRITE_RESOURCE_CHAR]); + SpriteResource_ReleaseData(graphicsStruct->typeIconResources[SPRITE_RESOURCE_CHAR]); + + graphicsStruct->typeIconResources[SPRITE_RESOURCE_PLTT] = SpriteResourceCollection_AddPaletteFrom(gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], pokedexNarc, type_icons_NCLR, FALSE, type_icons_NCLR + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, NNS_G2D_VRAM_TYPE_2DMAIN, 5, heapID); + + SpriteTransfer_RequestPlttFreeSpace(graphicsStruct->typeIconResources[SPRITE_RESOURCE_PLTT]); + SpriteResource_ReleaseData(graphicsStruct->typeIconResources[SPRITE_RESOURCE_PLTT]); + + graphicsStruct->typeIconResources[SPRITE_RESOURCE_CELL] = SpriteResourceCollection_AddFrom(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], pokedexNarc, type_icons_cell_NCER_lz, TRUE, type_icons_cell_NCER_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, SPRITE_RESOURCE_CELL, heapID); + graphicsStruct->typeIconResources[SPRITE_RESOURCE_ANIM] = SpriteResourceCollection_AddFrom(gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], pokedexNarc, type_icons_anim_NANR_lz, TRUE, type_icons_anim_NANR_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, SPRITE_RESOURCE_ANIM, heapID); +} + +static void UnloadTypeIconResources(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData) +{ + PokedexGraphicData *gfxData = *graphicsData; + + SpriteTransfer_ResetCharTransfer(graphicsStruct->typeIconResources[SPRITE_RESOURCE_CHAR]); + SpriteTransfer_ResetPlttTransfer(graphicsStruct->typeIconResources[SPRITE_RESOURCE_PLTT]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], graphicsStruct->typeIconResources[SPRITE_RESOURCE_CHAR]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], graphicsStruct->typeIconResources[SPRITE_RESOURCE_PLTT]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], graphicsStruct->typeIconResources[SPRITE_RESOURCE_CELL]); + SpriteResourceCollection_Remove(gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], graphicsStruct->typeIconResources[SPRITE_RESOURCE_ANIM]); +} + +static void CreateTypeIconSprites(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID) +{ + SpriteResourcesHeader resourceHeader; + SpriteListTemplate spriteTemplate; + PokedexGraphicData *gfxData = *graphicsData; + int species = PokedexSort_CurrentSpecies(displayState->sortData); + int formID = PokedexSort_DefaultForm(displayState->sortData, species); + int type1 = SpeciesData_GetFormValue(species, formID, SPECIES_DATA_TYPE_1); + int type2 = SpeciesData_GetFormValue(species, formID, SPECIES_DATA_TYPE_2); + type1 = PokedexGraphics_GetAnimIDfromType(type1); + type2 = PokedexGraphics_GetAnimIDfromType(type2); + + SpriteResourcesHeader_Init(&resourceHeader, type_icons_NCGR_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, type_icons_NCLR + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, type_icons_cell_NCER_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, type_icons_anim_NANR_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, 0xffffffff, 0xffffffff, FALSE, 0, gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], NULL, NULL); + + spriteTemplate.list = gfxData->spriteList; + spriteTemplate.resourceData = &resourceHeader; + spriteTemplate.priority = 32; + spriteTemplate.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; + spriteTemplate.heapID = heapID; + spriteTemplate.position.x = (170 * FX32_ONE); + spriteTemplate.position.y = (72 * FX32_ONE); + + graphicsStruct->footprintAndTypeSprites[1] = SpriteList_Add(&spriteTemplate); + + Sprite_SetAnim(graphicsStruct->footprintAndTypeSprites[1], 0 + type1); + + if (type1 != type2) { + spriteTemplate.position.x = (220 * FX32_ONE); + spriteTemplate.position.y = (72 * FX32_ONE); + graphicsStruct->footprintAndTypeSprites[2] = SpriteList_Add(&spriteTemplate); + Sprite_SetAnim(graphicsStruct->footprintAndTypeSprites[2], 0 + type2); + } else { + graphicsStruct->footprintAndTypeSprites[2] = NULL; + } +} + +// This maps the type to an animation ID used in the Pokedex graphics. See zukan.narc -> files type_icons_cell_NCER_lz, type_icons_anim_NANR_lz, type_icons_NCGR_lz +int PokedexGraphics_GetAnimIDfromType(int monType) +{ + int animID; + + switch (monType) { + case TYPE_NORMAL: + animID = 0; + break; + case TYPE_FIGHTING: + animID = 6; + break; + case TYPE_FLYING: + animID = 14; + break; + case TYPE_POISON: + animID = 10; + break; + case TYPE_GROUND: + animID = 8; + break; + case TYPE_ROCK: + animID = 5; + break; + case TYPE_BUG: + animID = 11; + break; + case TYPE_GHOST: + case TYPE_MYSTERY: + animID = 7; + break; + case TYPE_STEEL: + animID = 9; + break; + case TYPE_FIRE: + animID = 1; + break; + case TYPE_WATER: + animID = 3; + break; + case TYPE_GRASS: + animID = 2; + break; + case TYPE_ELECTRIC: + animID = 4; + break; + case TYPE_PSYCHIC: + animID = 15; + break; + case TYPE_ICE: + animID = 13; + break; + case TYPE_DRAGON: + animID = 16; + break; + case TYPE_DARK: + animID = 12; + break; + } + + return animID; +} + +static void DeleteTypeIconSprites(InfoMainGraphics *graphicsStruct) +{ + if (graphicsStruct->footprintAndTypeSprites[1]) { + Sprite_Delete(graphicsStruct->footprintAndTypeSprites[1]); + } + + if (graphicsStruct->footprintAndTypeSprites[2]) { + Sprite_Delete(graphicsStruct->footprintAndTypeSprites[2]); + } +} + +static void CreateCategoryBox(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, int heapID) +{ + SpriteResourcesHeader resourceHeader; + SpriteListTemplate spriteTemplate; + PokedexGraphicData *gfxData = *graphicsData; + int species = PokedexSort_CurrentSpecies(displayState->sortData); + PokedexDisplayBox displayBox; + + SpriteResourcesHeader_Init(&resourceHeader, type_icons_NCGR_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, type_icons_NCLR + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, type_icons_cell_NCER_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, type_icons_anim_NANR_lz + POKEDEX_TYPE_ICON_RESOURCE_OFFSET, 0xffffffff, 0xffffffff, FALSE, 0, gfxData->spriteResourceCollection[SPRITE_RESOURCE_CHAR], gfxData->spriteResourceCollection[SPRITE_RESOURCE_PLTT], gfxData->spriteResourceCollection[SPRITE_RESOURCE_CELL], gfxData->spriteResourceCollection[SPRITE_RESOURCE_ANIM], NULL, NULL); + + spriteTemplate.list = gfxData->spriteList; + spriteTemplate.resourceData = &resourceHeader; + spriteTemplate.priority = 32; + spriteTemplate.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; + spriteTemplate.heapID = heapID; + spriteTemplate.position.x = (192 * FX32_ONE); + spriteTemplate.position.y = (52 * FX32_ONE); + + graphicsStruct->categoryBoxSprite = SpriteList_Add(&spriteTemplate); + + Sprite_SetAnim(graphicsStruct->categoryBoxSprite, POKEDEX_TYPE_ICON_BACKGROUND_BOX_CELL); + + if (PokedexSort_CurrentCaughtStatus(displayState->sortData) != CS_CAUGHT) { + species = SPECIES_NONE; + } + + Window *categoryWindow = InfoMain_CreateCategoryWindow((*graphicsData)->textMan, species, heapID); + SpriteResource *paletteResource = PokedexGraphics_GetSpeciesLabelSpriteResource(*graphicsData, SPRITE_RESOURCE_PLTT); + + displayBox.textMan = (*graphicsData)->textMan; + displayBox.paletteProxy = SpriteTransfer_GetPaletteProxy(paletteResource, NULL); + displayBox.sprite = graphicsStruct->categoryBoxSprite; + displayBox.x = -78; + displayBox.y = -8; + displayBox.spriteResourcePriority = 0; + displayBox.spriteListPriority = 32 - 1; + displayBox.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; + displayBox.heapID = heapID; + displayBox.window = categoryWindow; + + graphicsStruct->categoryTextData = PokedexTextManager_NextTextData(&displayBox); + + PokedexTextManager_FreeWindow(categoryWindow); +} + +Window *InfoMain_CreateCategoryWindow(PokedexTextManager *textMan, enum Species species, enum HeapID heapID) +{ + Window *categoryWindow = PokedexTextManager_NewWindow(textMan, 18, 2); + String *categoryString = PokedexText_Category(species, GAME_LANGUAGE, heapID); + + { + u32 stringWidth = Font_CalcStringWidth(FONT_SUBSCREEN, categoryString, 0); + u32 xOffset = (stringWidth < 136) ? (136 - stringWidth) / 2 : 0; + + PokedexTextManager_DisplayString(textMan, categoryWindow, categoryString, xOffset, 0); + } + + PokedexText_Free(categoryString); + + return categoryWindow; +} + +static void DeleteCategoryBox(InfoMainGraphics *graphicsStruct) +{ + Sprite_Delete(graphicsStruct->categoryBoxSprite); + graphicsStruct->categoryBoxSprite = NULL; + PokedexTextManager_FreeTextData(graphicsStruct->categoryTextData); +} + +static void InitBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing) +{ + PokedexGraphics_SetSpeciesLabelGXOamMode(*graphicsData, GX_OAM_MODE_XLU); + SetXluMode(graphicsStruct); + + if (ov21_021E2A54(displayState->screenManager)) { + if (isInitializing) { + PokedexGraphics_InitBlendTransition(&(*graphicsData)->blendMain, 1, -16, 0, 0, 16, (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), GX_BLEND_PLANEMASK_BG3, 0); + } else { + PokedexGraphics_InitBlendTransition(&(*graphicsData)->blendMain, 1, 0, -16, 16, 0, (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), GX_BLEND_PLANEMASK_BG3, 0); + } + } + + BlendPokemonSprite(graphicsData); +} + +static BOOL UpdateBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing) +{ + BOOL blendComplete; + + if (ov21_021E2A54(displayState->screenManager)) { + blendComplete = PokedexGraphics_TakeBlendTransitionStep(&(*graphicsData)->blendMain); + } else { + blendComplete = PokedexGraphics_BlendTransitionComplete(&(*graphicsData)->blendMain); + } + + if (blendComplete == TRUE) { + if (isInitializing == TRUE) { + SetNormalMode(graphicsStruct); + PokedexGraphics_SetSpeciesLabelGXOamMode(*graphicsData, GX_OAM_MODE_NORMAL); + } else { + HidePokemonSprite(graphicsData); + ConfigureLabel(graphicsData); + } + } else { + BlendPokemonSprite(graphicsData); + } + + return blendComplete; +} + +static void InitPositionBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing) +{ + SetXluMode(graphicsStruct); + + if (isInitializing == FALSE) { + InitPokemonTransform(graphicsStruct, displayState->displayPositionX, displayState->displayPositionY, 4); + InitLabelTransform(graphicsStruct); + } + + if (ov21_021E2A54(displayState->screenManager)) { + if (isInitializing) { + PokedexGraphics_InitBlendTransition(&(*graphicsData)->blendMain, 4, -16, 0, 0, 16, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); + } else { + PokedexGraphics_InitBlendTransition(&(*graphicsData)->blendMain, 4, 0, -16, 16, 0, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); + } + } +} + +static BOOL UpdatePositionBlendMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing) +{ + BOOL allComplete[3]; + int i; + + if (isInitializing == FALSE) { + allComplete[0] = UpdatePokemonTransform(graphicsStruct, graphicsData); + allComplete[1] = UpdateLabelTransform(graphicsStruct, graphicsData); + } else { + allComplete[0] = TRUE; + allComplete[1] = TRUE; + } + + if (ov21_021E2A54(displayState->screenManager)) { + allComplete[2] = PokedexGraphics_TakeBlendTransitionStep(&(*graphicsData)->blendMain); + } else { + allComplete[2] = PokedexGraphics_BlendTransitionComplete(&(*graphicsData)->blendMain); + } + + for (i = 0; i < 3; i++) { + if (allComplete[i] == FALSE) { + break; + } + } + + if (i == 3) { + if (isInitializing == TRUE) { + SetNormalMode(graphicsStruct); + } + + return TRUE; + } + + return FALSE; +} + +static void InitPositionMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing) +{ + SetXluMode(graphicsStruct); + PokedexGraphics_SetSpeciesLabelGXOamMode(*graphicsData, GX_OAM_MODE_XLU); + + if (isInitializing == FALSE) { + InitPokemonTransform(graphicsStruct, displayState->displayPositionX, displayState->displayPositionY, 1); + } + + if (ov21_021E2A54(displayState->screenManager)) { + if (isInitializing) { + PokedexGraphics_InitBlendTransition(&(*graphicsData)->blendMain, 1, -16, 0, 0, 16, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); + } else { + PokedexGraphics_InitBlendTransition(&(*graphicsData)->blendMain, 1, 0, -16, 16, 0, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); + } + } +} + +static BOOL UpdatePositionMode(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const InfoMainState *displayState, BOOL isInitializing) +{ + BOOL allComplete[2]; + int i; + + if (isInitializing == FALSE) { + allComplete[0] = UpdatePokemonTransform(graphicsStruct, graphicsData); + } else { + allComplete[0] = TRUE; + } + + if (ov21_021E2A54(displayState->screenManager)) { + allComplete[1] = PokedexGraphics_TakeBlendTransitionStep(&(*graphicsData)->blendMain); + } else { + allComplete[1] = PokedexGraphics_BlendTransitionComplete(&(*graphicsData)->blendMain); + } + + for (i = 0; i < 2; i++) { + if (allComplete[i] == FALSE) { + break; + } + } + + if (i == 2) { + if (isInitializing == TRUE) { + SetNormalMode(graphicsStruct); + PokedexGraphics_SetSpeciesLabelGXOamMode(*graphicsData, GX_OAM_MODE_NORMAL); + } else { + ConfigureLabel(graphicsData); + } + + return TRUE; + } + + return FALSE; +} + +static void SetXluMode(InfoMainGraphics *graphicsStruct) +{ + int i; + + for (i = 0; i < 3; i++) { + if (graphicsStruct->footprintAndTypeSprites[i]) { + Sprite_SetExplicitOAMMode(graphicsStruct->footprintAndTypeSprites[i], GX_OAM_MODE_XLU); + } + } + + Sprite_SetExplicitOAMMode(graphicsStruct->categoryBoxSprite, GX_OAM_MODE_XLU); + sub_02012AF0(graphicsStruct->categoryTextData->fontOAM, GX_OAM_MODE_XLU); +} + +static void SetNormalMode(InfoMainGraphics *graphicsStruct) +{ + int i; + + for (i = 0; i < 3; i++) { + if (graphicsStruct->footprintAndTypeSprites[i]) { + Sprite_SetExplicitOAMMode(graphicsStruct->footprintAndTypeSprites[i], GX_OAM_MODE_NORMAL); + } + } + + Sprite_SetExplicitOAMMode(graphicsStruct->categoryBoxSprite, GX_OAM_MODE_NORMAL); + sub_02012AF0(graphicsStruct->categoryTextData->fontOAM, GX_OAM_MODE_NORMAL); +} + +static void BlendPokemonSprite(PokedexGraphicData **graphicsData) +{ + PokedexGraphics_BlendPokemonChar(*graphicsData, &(*graphicsData)->blendMain); +} + +static void InitPokemonTransform(InfoMainGraphics *graphicsStruct, int posX, int posY, int numSteps) +{ + PokedexGraphics_InitTransformation(&graphicsStruct->transformPokemon, 48, posX, 72, posY, numSteps); +} + +static BOOL UpdatePokemonTransform(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData) +{ + BOOL transformComplete = PokedexGraphics_TakeTransformStep(&graphicsStruct->transformPokemon); + PokemonGraphics_SetCharCenterXY(*graphicsData, graphicsStruct->transformPokemon.currentX, graphicsStruct->transformPokemon.currentY); + + return transformComplete; +} + +static void InitLabelTransform(InfoMainGraphics *graphicsStruct) +{ + PokedexGraphics_InitTransformation(&graphicsStruct->transformLabel, 172, 170, 32, 82, 4); +} + +static BOOL UpdateLabelTransform(InfoMainGraphics *graphicsStruct, PokedexGraphicData **graphicsData) +{ + BOOL transformComplete = PokedexGraphics_TakeTransformStep(&graphicsStruct->transformLabel); + ov21_021D1848(*graphicsData, graphicsStruct->transformLabel.currentX, graphicsStruct->transformLabel.currentY); + + return transformComplete; +} diff --git a/src/applications/pokedex/infomain_foreign.c b/src/applications/pokedex/infomain_foreign.c index ffa0d6a025..471ce233ea 100644 --- a/src/applications/pokedex/infomain_foreign.c +++ b/src/applications/pokedex/infomain_foreign.c @@ -61,12 +61,12 @@ static PokedexGraphicData **AllocateGraphicsData(enum HeapID heapID, PokedexApp static void FreeState(PokedexEntryDisplayState *displayState); static void FreeGraphicsData(PokedexGraphicData **graphicsData); static int GetNumScreenStates(void); -static int ProcessInitData(PokedexDataManager *dataMan, void *data); -static int ProcessUpdateData(PokedexDataManager *dataMan, void *data); -static int ProcessFinalizeData(PokedexDataManager *dataMan, void *data); -static int ProcessInitGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); -static int ProcessUpdateGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); -static int ProcessFinalizeGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); +static int InitData(PokedexDataManager *dataMan, void *data); +static int UpdateData(PokedexDataManager *dataMan, void *data); +static int FinalizeData(PokedexDataManager *dataMan, void *data); +static int InitGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); +static int UpdateGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); +static int FinalizeGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); static void InitBlendMode(PokedexEntryDisplayGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const PokedexEntryDisplayState *displayState, BOOL isInitializing); static BOOL UpdateBlendMode(PokedexEntryDisplayGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const PokedexEntryDisplayState *displayState, BOOL isInitializing); static void InitPositionBlendMode(PokedexEntryDisplayGraphics *graphicsStruct, PokedexGraphicData **graphicsData, const PokedexEntryDisplayState *displayState, BOOL isInitializing); @@ -108,12 +108,12 @@ void InfoMainForeign_InitScreen(PokedexScreenManager *screenManager, PokedexApp screenManager->pageGraphics = graphicsData; screenManager->screenStates = NULL; screenManager->numStates = GetNumScreenStates(); - screenManager->dataFunc[0] = ProcessInitData; - screenManager->dataFunc[1] = ProcessUpdateData; - screenManager->dataFunc[2] = ProcessFinalizeData; - screenManager->graphicsFunc[0] = ProcessInitGraphics; - screenManager->graphicsFunc[1] = ProcessUpdateGraphics; - screenManager->graphicsFunc[2] = ProcessFinalizeGraphics; + screenManager->dataFunc[0] = InitData; + screenManager->dataFunc[1] = UpdateData; + screenManager->dataFunc[2] = FinalizeData; + screenManager->graphicsFunc[0] = InitGraphics; + screenManager->graphicsFunc[1] = UpdateGraphics; + screenManager->graphicsFunc[2] = FinalizeGraphics; } void InfoMainForeign_FreeScreen(PokedexScreenManager *screenManager) @@ -214,15 +214,13 @@ static int GetNumScreenStates(void) return 0; } -static int ProcessInitData(PokedexDataManager *dataMan, void *data) +static int InitData(PokedexDataManager *dataMan, void *data) { return TRUE; } -static int ProcessUpdateData(PokedexDataManager *dataMan, void *data) +static int UpdateData(PokedexDataManager *dataMan, void *data) { - PokedexEntryDisplayState *displayState = data; - if (dataMan->exit == TRUE) { return TRUE; } @@ -234,12 +232,12 @@ static int ProcessUpdateData(PokedexDataManager *dataMan, void *data) return FALSE; } -static int ProcessFinalizeData(PokedexDataManager *dataMan, void *data) +static int FinalizeData(PokedexDataManager *dataMan, void *data) { return TRUE; } -static int ProcessInitGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) +static int InitGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) { const PokedexEntryDisplayState *displayState = data; PokedexGraphicData **graphicsData = graphics; @@ -256,13 +254,13 @@ static int ProcessInitGraphics(void *graphics, PokedexGraphicsManager *graphicsM SetupGraphics(graphicsStruct, graphicsData, displayState, graphicsMan->heapID); switch (displayState->animationMode) { - case 0: + case ANIM_POSITION_BLEND: InitPositionBlendMode(graphicsStruct, graphicsData, displayState, 1); break; - case 1: + case ANIM_BLEND: InitBlendMode(graphicsStruct, graphicsData, displayState, 1); break; - case 2: + case ANIM_POSITION: InitPositionMode(graphicsStruct, graphicsData, displayState, 1); break; } @@ -272,13 +270,13 @@ static int ProcessInitGraphics(void *graphics, PokedexGraphicsManager *graphicsM case 2: switch (displayState->animationMode) { - case 0: + case ANIM_POSITION_BLEND: animationComplete = UpdatePositionBlendMode(graphicsStruct, graphicsData, displayState, 1); break; - case 1: + case ANIM_BLEND: animationComplete = UpdateBlendMode(graphicsStruct, graphicsData, displayState, 1); break; - case 2: + case ANIM_POSITION: animationComplete = UpdatePositionMode(graphicsStruct, graphicsData, displayState, 1); break; } @@ -297,12 +295,12 @@ static int ProcessInitGraphics(void *graphics, PokedexGraphicsManager *graphicsM return FALSE; } -static int ProcessUpdateGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) +static int UpdateGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) { return FALSE; } -static int ProcessFinalizeGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) +static int FinalizeGraphics(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) { const PokedexEntryDisplayState *displayState = data; PokedexGraphicData **graphicsData = graphics; @@ -312,13 +310,13 @@ static int ProcessFinalizeGraphics(void *graphics, PokedexGraphicsManager *graph switch (graphicsMan->state) { case 0: switch (displayState->animationMode) { - case 0: + case ANIM_POSITION_BLEND: InitPositionBlendMode(graphicsStruct, graphicsData, displayState, 0); break; - case 1: + case ANIM_BLEND: InitBlendMode(graphicsStruct, graphicsData, displayState, 0); break; - case 2: + case ANIM_POSITION: InitPositionMode(graphicsStruct, graphicsData, displayState, 0); break; } @@ -327,13 +325,13 @@ static int ProcessFinalizeGraphics(void *graphics, PokedexGraphicsManager *graph break; case 1: switch (displayState->animationMode) { - case 0: + case ANIM_POSITION_BLEND: animationComplete = UpdatePositionBlendMode(graphicsStruct, graphicsData, displayState, 0); break; - case 1: + case ANIM_BLEND: animationComplete = UpdateBlendMode(graphicsStruct, graphicsData, displayState, 0); break; - case 2: + case ANIM_POSITION: animationComplete = UpdatePositionMode(graphicsStruct, graphicsData, displayState, 0); break; } @@ -376,7 +374,7 @@ static void CleanupGraphics(PokedexEntryDisplayGraphics *graphicsStruct, Pokedex Window_FillTilemap(&(*graphicsData)->window, 0); UnloadTypeIconSprites(graphicsStruct, graphicsData); - Bg_ClearTilemap((*graphicsData)->bgConfig, 1); + Bg_ClearTilemap((*graphicsData)->bgConfig, BG_LAYER_MAIN_1); } static void LoadBackground(PokedexGraphicData **graphicsData, enum HeapID heapID) diff --git a/src/applications/pokedex/ov21_021DE668.c b/src/applications/pokedex/ov21_021DE668.c deleted file mode 100644 index fc26bf8cf9..0000000000 --- a/src/applications/pokedex/ov21_021DE668.c +++ /dev/null @@ -1,1008 +0,0 @@ -#include "applications/pokedex/ov21_021DE668.h" - -#include -#include - -#include "generated/pokemon_types.h" - -#include "applications/pokedex/footprint.h" -#include "applications/pokedex/ov21_021E29DC.h" -#include "applications/pokedex/pokedex_app.h" -#include "applications/pokedex/pokedex_data_manager.h" -#include "applications/pokedex/pokedex_graphics.h" -#include "applications/pokedex/pokedex_graphics_manager.h" -#include "applications/pokedex/pokedex_main.h" -#include "applications/pokedex/pokedex_sort.h" -#include "applications/pokedex/pokedex_text.h" -#include "applications/pokedex/pokedex_text_manager.h" -#include "applications/pokedex/struct_ov21_021DE6D4.h" -#include "applications/pokedex/struct_ov21_021E68F4.h" - -#include "bg_window.h" -#include "font.h" -#include "heap.h" -#include "message.h" -#include "narc.h" -#include "pokedex_data_index.h" -#include "pokemon.h" -#include "pokemon_sprite.h" -#include "sound_playback.h" -#include "sprite.h" -#include "sprite_resource.h" -#include "sprite_transfer.h" -#include "sprite_util.h" -#include "string_gf.h" -#include "text.h" -#include "unk_02012744.h" - -#include "res/graphics/pokedex/zukan.naix" -#include "res/text/bank/pokedex.h" - -typedef struct { - Sprite *unk_00[3]; - Sprite *unk_0C; - PokedexTextData *unk_10; - SpriteResource *unk_14[4]; - SpriteResource *unk_24[4]; - SpriteTransformation unk_34; - SpriteTransformation unk_54; -} UnkStruct_ov21_021DF374; - -static UnkStruct_ov21_021DE6D4 *ov21_021DE6E8(enum HeapID heapID, PokedexApp *param1); -static PokedexGraphicData **ov21_021DE724(enum HeapID heapID, PokedexApp *param1); -static void ov21_021DE74C(UnkStruct_ov21_021DE6D4 *param0); -static void ov21_021DE760(PokedexGraphicData **param0); -static int ov21_021DE774(void); -static int ov21_021DE778(PokedexDataManager *dataMan, void *data); -static int ov21_021DE79C(PokedexDataManager *dataMan, void *data); -static int ov21_021DE7F8(PokedexDataManager *dataMan, void *data); -static int ov21_021DE804(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); -static int ov21_021DE8E4(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); -static int ov21_021DE8E8(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan); -static void ov21_021DF374(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3); -static BOOL ov21_021DF3F0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3); -static void ov21_021DF44C(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3); -static BOOL ov21_021DF4D0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3); -static void ov21_021DF548(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3); -static BOOL ov21_021DF5D0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3); -static void ov21_021DF6B4(PokedexGraphicData **param0); -static void ov21_021DF64C(UnkStruct_ov21_021DF374 *param0); -static void ov21_021DF680(UnkStruct_ov21_021DF374 *param0); -static void ov21_021DF6C4(UnkStruct_ov21_021DF374 *param0, int param1, int param2, int param3); -static BOOL ov21_021DF6E0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1); -static void ov21_021DF6FC(UnkStruct_ov21_021DF374 *param0); -static BOOL ov21_021DF718(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1); -static void ov21_021DE9A4(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, enum HeapID heapID); -static void ov21_021DEA0C(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1); -static void ov21_021DEA44(PokedexGraphicData **param0, enum HeapID heapID); -static void ov21_021DEB58(PokedexGraphicData **param0, const UnkStruct_ov21_021DE6D4 *param1, int param2); -static void ov21_021DEC2C(Window *param0, enum HeapID heapID, int param2, u32 param3); -static void ov21_021DEC80(Window *param0, enum HeapID heapID, int param2, u32 param3); -static void ov21_021DECD4(Window *param0, enum HeapID heapID, int param2, int param3, u32 param4); -static void ov21_021DED24(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, int param3); -static void ov21_021DED68(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1); -static void ov21_021DED7C(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, int param2, int param3); -static void ov21_021DEE38(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1); -static void ov21_021DEE80(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, int param2); -static void ov21_021DEEF8(UnkStruct_ov21_021DF374 *param0); -static void ov21_021DEFA8(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, int param2); -static void ov21_021DF054(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1); -static void ov21_021DF098(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, int param3); -static void ov21_021DF1F8(UnkStruct_ov21_021DF374 *param0); -static void ov21_021DF214(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, int param3); -static void ov21_021DF35C(UnkStruct_ov21_021DF374 *param0); -static void ov21_021DEF08(PokedexGraphicData **param0, const UnkStruct_ov21_021DE6D4 *param1, int param2); -static void ov21_021DEF3C(PokedexGraphicData **param0); -static void ov21_021DEF54(PokedexGraphicData **param0, const UnkStruct_ov21_021DE6D4 *param1); -static void ov21_021DEF8C(PokedexGraphicData **param0); - -void ov21_021DE668(PokedexScreenManager *param0, PokedexApp *param1, enum HeapID heapID) -{ - UnkStruct_ov21_021DE6D4 *v0; - PokedexGraphicData **v1; - - v0 = ov21_021DE6E8(heapID, param1); - v1 = ov21_021DE724(heapID, param1); - - param0->pageData = v0; - param0->pageGraphics = v1; - param0->screenStates = NULL; - param0->numStates = ov21_021DE774(); - param0->dataFunc[0] = ov21_021DE778; - param0->dataFunc[1] = ov21_021DE79C; - param0->dataFunc[2] = ov21_021DE7F8; - param0->graphicsFunc[0] = ov21_021DE804; - param0->graphicsFunc[1] = ov21_021DE8E4; - param0->graphicsFunc[2] = ov21_021DE8E8; -} - -void ov21_021DE6C0(PokedexScreenManager *param0) -{ - ov21_021DE74C(param0->pageData); - ov21_021DE760(param0->pageGraphics); -} - -BOOL ov21_021DE6D4(UnkStruct_ov21_021DE6D4 *param0, int param1) -{ - return 0; -} - -BOOL ov21_021DE6D8(UnkStruct_ov21_021DE6D4 *param0, int param1) -{ - BOOL v0 = 1; - - if (param1 == 1) { - param1 = 0; - v0 = 0; - } - - param0->unk_18 = param1; - return v0; -} - -static UnkStruct_ov21_021DE6D4 *ov21_021DE6E8(enum HeapID heapID, PokedexApp *param1) -{ - UnkStruct_ov21_021DE6D4 *v0; - PokedexScreenManager *v1; - - v0 = Heap_Alloc(heapID, sizeof(UnkStruct_ov21_021DE6D4)); - - GF_ASSERT(v0); - memset(v0, 0, sizeof(UnkStruct_ov21_021DE6D4)); - - v0->unk_00 = ov21_021D138C(param1); - v0->unk_04 = PokedexMain_GetSortData(param1); - v1 = ov21_021D1410(param1, 5); - v0->unk_10 = v1; - - return v0; -} - -static PokedexGraphicData **ov21_021DE724(enum HeapID heapID, PokedexApp *param1) -{ - PokedexGraphicData **v0; - PokedexScreenManager *v1; - - v0 = Heap_Alloc(heapID, sizeof(PokedexGraphicData **)); - - GF_ASSERT(v0); - memset(v0, 0, sizeof(PokedexGraphicData **)); - - *v0 = PokedexMain_GetGraphicData(param1); - - return v0; -} - -static void ov21_021DE74C(UnkStruct_ov21_021DE6D4 *param0) -{ - GF_ASSERT(param0); - Heap_Free(param0); -} - -static void ov21_021DE760(PokedexGraphicData **param0) -{ - GF_ASSERT(param0); - Heap_Free(param0); -} - -static int ov21_021DE774(void) -{ - return 0; -} - -static int ov21_021DE778(PokedexDataManager *dataMan, void *data) -{ - UnkStruct_ov21_021DE6D4 *v0 = data; - - PokedexSort_SetCurrentSpecies(v0->unk_04, PokedexSort_CurrentSpecies(v0->unk_04)); - PokedexSort_SetBootMode(v0->unk_04, PokedexSort_IsNationalDex(v0->unk_04)); - - return 1; -} - -static int ov21_021DE79C(PokedexDataManager *dataMan, void *data) -{ - UnkStruct_ov21_021DE6D4 *v0 = data; - - if (dataMan->exit == 1) { - return 1; - } - - if (dataMan->unchanged == 1) { - return 0; - } - - switch (dataMan->state) { - case 0: - if (v0->unk_1C == 1) { - Sound_PlayPokemonCryEx(POKECRY_POKEDEX, PokedexSort_CurrentSpecies(v0->unk_04), 0x1ff, 0x1ff, 0x1ff, 0); - v0->unk_1C = 0; - } - - dataMan->state++; - break; - default: - break; - } - - return 0; -} - -static int ov21_021DE7F8(PokedexDataManager *dataMan, void *data) -{ - Sound_StopPokemonCries(0); - return 1; -} - -static int ov21_021DE804(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) -{ - const UnkStruct_ov21_021DE6D4 *v0 = data; - PokedexGraphicData **v1 = graphics; - UnkStruct_ov21_021DF374 *v2 = graphicsMan->pageGraphics; - BOOL v3; - - switch (graphicsMan->state) { - case 0: - graphicsMan->pageGraphics = Heap_Alloc(graphicsMan->heapID, sizeof(UnkStruct_ov21_021DF374)); - memset(graphicsMan->pageGraphics, 0, sizeof(UnkStruct_ov21_021DF374)); - graphicsMan->state++; - break; - case 1: - ov21_021DE9A4(v2, v1, v0, graphicsMan->heapID); - - switch (v0->unk_14) { - case 0: - ov21_021DF44C(v2, v1, v0, 1); - break; - case 1: - ov21_021DF374(v2, v1, v0, 1); - break; - case 2: - ov21_021DF548(v2, v1, v0, 1); - break; - } - - graphicsMan->state++; - break; - case 2: - switch (v0->unk_14) { - case 0: - v3 = ov21_021DF4D0(v2, v1, v0, 1); - break; - case 1: - v3 = ov21_021DF3F0(v2, v1, v0, 1); - break; - case 2: - v3 = ov21_021DF5D0(v2, v1, v0, 1); - break; - } - - if (v3) { - graphicsMan->state++; - } - break; - case 3: - G2_BlendNone(); - return 1; - default: - break; - } - - return 0; -} - -static int ov21_021DE8E4(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) -{ - return 0; -} - -static int ov21_021DE8E8(void *graphics, PokedexGraphicsManager *graphicsMan, const void *data, const PokedexDataManager *dataMan) -{ - const UnkStruct_ov21_021DE6D4 *v0 = data; - PokedexGraphicData **v1 = graphics; - UnkStruct_ov21_021DF374 *v2 = graphicsMan->pageGraphics; - BOOL v3; - - switch (graphicsMan->state) { - case 0: - switch (v0->unk_14) { - case 0: - ov21_021DF44C(v2, v1, v0, 0); - break; - case 1: - ov21_021DF374(v2, v1, v0, 0); - break; - case 2: - ov21_021DF548(v2, v1, v0, 0); - break; - } - - graphicsMan->state++; - break; - case 1: - switch (v0->unk_14) { - case 0: - v3 = ov21_021DF4D0(v2, v1, v0, 0); - break; - case 1: - v3 = ov21_021DF3F0(v2, v1, v0, 0); - break; - case 2: - v3 = ov21_021DF5D0(v2, v1, v0, 0); - break; - } - - if (v3) { - graphicsMan->state++; - } - break; - case 2: - ov21_021DEA0C(v2, v1); - graphicsMan->state++; - break; - case 3: - Heap_Free(graphicsMan->pageGraphics); - graphicsMan->state++; - break; - case 4: - return 1; - default: - break; - } - - return 0; -} - -static void ov21_021DE9A4(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, enum HeapID heapID) -{ - ov21_021DEF08(param1, param2, heapID); - ov21_021DEF54(param1, param2); - ov21_021DEFA8(param0, param1, heapID); - ov21_021DF214(param0, param1, param2, heapID); - ov21_021DEA44(param1, heapID); - ov21_021DEB58(param1, param2, heapID); - - if (PokedexSort_CurrentCaughtStatus(param2->unk_04) == 2) { - ov21_021DED24(param0, param1, param2, heapID); - ov21_021DF098(param0, param1, param2, heapID); - } -} - -static void ov21_021DEA0C(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1) -{ - ov21_021DF35C(param0); - - Window_FillTilemap(&(*param1)->window, 0); - - ov21_021DED68(param0, param1); - ov21_021DF1F8(param0); - ov21_021DF054(param0, param1); - - Bg_ClearTilemap((*param1)->bgConfig, 1); -} - -static void ov21_021DEA44(PokedexGraphicData **param0, enum HeapID heapID) -{ - void *v0; - NNSG2dScreenData *v1; - - PokedexGraphics_LoadGraphicNarcCharacterData(*param0, entry_main_NCGR_lz, (*param0)->bgConfig, 3, 0, 0, TRUE, heapID); - - v0 = PokedexGraphics_GetGraphicNarcTilemapData(*param0, info_main_NSCR_lz, TRUE, &v1, heapID); - Bg_LoadToTilemapRect((*param0)->bgConfig, 3, v1->rawData, 0, 0, v1->screenWidth / 8, v1->screenHeight / 8); - Heap_Free(v0); - - v0 = PokedexGraphics_GetGraphicNarcTilemapData(*param0, info_species_window_NSCR_lz, TRUE, &v1, heapID); - Bg_LoadToTilemapRect((*param0)->bgConfig, 3, v1->rawData, 0, 3, v1->screenWidth / 8, v1->screenHeight / 8); - Heap_Free(v0); - - v0 = PokedexGraphics_GetGraphicNarcTilemapData(*param0, info_footprint_window_NSCR_lz, TRUE, &v1, heapID); - Bg_LoadToTilemapRect((*param0)->bgConfig, 3, v1->rawData, 12, 8, v1->screenWidth / 8, v1->screenHeight / 8); - Heap_Free(v0); - - v0 = PokedexGraphics_GetGraphicNarcTilemapData(*param0, info_entry_window_NSCR_lz, TRUE, &v1, heapID); - Bg_LoadToTilemapRect((*param0)->bgConfig, 3, v1->rawData, 0, 16, v1->screenWidth / 8, v1->screenHeight / 8); - Heap_Free(v0); - Bg_ScheduleTilemapTransfer((*param0)->bgConfig, 3); -} - -static void ov21_021DEB58(PokedexGraphicData **param0, const UnkStruct_ov21_021DE6D4 *param1, int param2) -{ - int species = PokedexSort_CurrentSpecies(param1->unk_04); - - if (PokedexSort_CurrentCaughtStatus(param1->unk_04) != 2) { - species = 0; - } - - ov21_021DEB8C(&(*param0)->window, species, param2, param1->unk_18, TEXT_COLOR(2, 1, 0)); -} - -void ov21_021DEB8C(Window *param0, int param1, enum HeapID heapID, int param3, u32 param4) -{ - String *v0 = String_Init(64, heapID); - MessageLoader *pokedexMessageBank = MessageLoader_Init(MSG_LOADER_PRELOAD_ENTIRE_BANK, NARC_INDEX_MSGDATA__PL_MSG, TEXT_BANK_POKEDEX, heapID); - - MessageLoader_GetString(pokedexMessageBank, pl_msg_pokedex_ht, v0); - Text_AddPrinterWithParamsAndColor(param0, FONT_SYSTEM, v0, 152, 88, TEXT_SPEED_INSTANT, param4, NULL); - - MessageLoader_GetString(pokedexMessageBank, pl_msg_pokedex_wt, v0); - Text_AddPrinterWithParamsAndColor(param0, FONT_SYSTEM, v0, 152, 104, TEXT_SPEED_INSTANT, param4, NULL); - String_Free(v0); - MessageLoader_Free(pokedexMessageBank); - - ov21_021DEC2C(param0, heapID, param1, param4); - ov21_021DEC80(param0, heapID, param1, param4); - ov21_021DECD4(param0, heapID, param1, param3, param4); -} - -static void ov21_021DEC2C(Window *param0, enum HeapID heapID, int param2, u32 param3) -{ - String *v0 = String_Init(64, heapID); - - int heightMessageBankIndex = Height_Message_Bank_Index(); - MessageLoader *v1 = MessageLoader_Init(MSG_LOADER_PRELOAD_ENTIRE_BANK, NARC_INDEX_MSGDATA__PL_MSG, heightMessageBankIndex, heapID); - - MessageLoader_GetString(v1, param2, v0); - Text_AddPrinterWithParamsAndColor(param0, FONT_SYSTEM, v0, 184, 88, TEXT_SPEED_INSTANT, param3, NULL); - String_Free(v0); - MessageLoader_Free(v1); -} - -static void ov21_021DEC80(Window *param0, enum HeapID heapID, int param2, u32 param3) -{ - String *v0 = String_Init(64, heapID); - - int weightMessageBankIndex = Weight_Message_Bank_Index(); - MessageLoader *v1 = MessageLoader_Init(MSG_LOADER_PRELOAD_ENTIRE_BANK, NARC_INDEX_MSGDATA__PL_MSG, weightMessageBankIndex, heapID); - - MessageLoader_GetString(v1, param2, v0); - Text_AddPrinterWithParamsAndColor(param0, FONT_SYSTEM, v0, 184, 104, TEXT_SPEED_INSTANT, param3, NULL); - String_Free(v0); - MessageLoader_Free(v1); -} - -static void ov21_021DECD4(Window *param0, enum HeapID heapID, int param2, int param3, u32 param4) -{ - String *v0 = PokedexText_DexEntry(param2, GAME_LANGUAGE, param3, heapID); - u32 v1 = Font_CalcMaxLineWidth(FONT_SYSTEM, v0, 0); - u32 v2 = (v1 < 240) ? 128 - v1 / 2 : 8; - - Text_AddPrinterWithParamsAndColor(param0, FONT_SYSTEM, v0, v2, 136, TEXT_SPEED_INSTANT, param4, NULL); - PokedexText_Free(v0); -} - -static void ov21_021DED24(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, int param3) -{ - int species = PokedexSort_CurrentSpecies(param2->unk_04); - int form = PokedexSort_DefaultForm(param2->unk_04, species); - - if ((species == SPECIES_GIRATINA) && (form > 0)) { - species = 11; - } - - ov21_021DED7C(param0, param1, param3, species); - ov21_021DEE80(param0, param1, param3); -} - -static void ov21_021DED68(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1) -{ - ov21_021DEEF8(param0); - ov21_021DEE38(param0, param1); -} - -static void ov21_021DED7C(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, int param2, int param3) -{ - PokedexGraphicData *v0 = *param1; - int v1 = GetPokedexFootprintsNarcID(); - int v2 = GetSpeciesFootprintTiles(param3); - int v3 = GetSharedFootprintPalette(); - int v4 = GetSharedFootprintCells(); - int v5 = GetSharedFootprintAnims(); - - param0->unk_24[0] = SpriteResourceCollection_AddTiles(v0->spriteResourceCollection[0], v1, v2, TRUE, 4000, NNS_G2D_VRAM_TYPE_2DMAIN, param2); - - SpriteTransfer_RequestCharAtEnd(param0->unk_24[0]); - SpriteResource_ReleaseData(param0->unk_24[0]); - - param0->unk_24[1] = SpriteResourceCollection_AddPalette(v0->spriteResourceCollection[1], v1, v3, FALSE, 4000, NNS_G2D_VRAM_TYPE_2DMAIN, 1, param2); - - SpriteTransfer_RequestPlttFreeSpace(param0->unk_24[1]); - SpriteResource_ReleaseData(param0->unk_24[1]); - - param0->unk_24[2] = SpriteResourceCollection_Add(v0->spriteResourceCollection[2], v1, v4, TRUE, 4000, 2, param2); - param0->unk_24[3] = SpriteResourceCollection_Add(v0->spriteResourceCollection[3], v1, v5, TRUE, 4000, 3, param2); -} - -static void ov21_021DEE38(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1) -{ - PokedexGraphicData *v0 = *param1; - - if (param0->unk_24[0] == NULL) { - return; - } - - SpriteTransfer_ResetCharTransfer(param0->unk_24[0]); - SpriteTransfer_ResetPlttTransfer(param0->unk_24[1]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[0], param0->unk_24[0]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[1], param0->unk_24[1]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[2], param0->unk_24[2]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[3], param0->unk_24[3]); -} - -static void ov21_021DEE80(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, int param2) -{ - SpriteResourcesHeader v0; - SpriteListTemplate v1; - PokedexGraphicData *v2 = *param1; - - SpriteResourcesHeader_Init(&v0, 4000, 4000, 4000, 4000, 0xffffffff, 0xffffffff, FALSE, 0, v2->spriteResourceCollection[0], v2->spriteResourceCollection[1], v2->spriteResourceCollection[2], v2->spriteResourceCollection[3], NULL, NULL); - - v1.list = v2->spriteList; - v1.resourceData = &v0; - v1.priority = 32; - v1.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; - v1.heapID = param2; - v1.position.y = (88 * FX32_ONE); - v1.position.x = (120 * FX32_ONE); - - param0->unk_00[0] = SpriteList_Add(&v1); -} - -static void ov21_021DEEF8(UnkStruct_ov21_021DF374 *param0) -{ - if (param0->unk_00[0]) { - Sprite_Delete(param0->unk_00[0]); - } -} - -static void ov21_021DEF08(PokedexGraphicData **param0, const UnkStruct_ov21_021DE6D4 *param1, int param2) -{ - PokedexMain_EntryNameNumber(*param0, param1->unk_04, param2, PokedexSort_CurrentStatusIndex(param1->unk_04), (172 * FX32_ONE), (32 * FX32_ONE)); - PokedexGraphics_SetSpeciesLabelPriority(*param0, 0); -} - -static void ov21_021DEF3C(PokedexGraphicData **param0) -{ - PokedexGraphics_SetPokedexSpeciesLabelDraw(*param0, 0); - PokedexGraphics_SetSpeciesLabelGXOamMode(*param0, GX_OAM_MODE_NORMAL); -} - -static void ov21_021DEF54(PokedexGraphicData **param0, const UnkStruct_ov21_021DE6D4 *param1) -{ - PokemonSprite *v0 = PokemonGraphics_GetPokemonChar(*param0); - int species = PokedexSort_CurrentSpecies(param1->unk_04); - - PokedexMain_DisplayPokemonSprite(*param0, param1->unk_04, species, 2, 48, 72); - PokemonSprite_SetAttribute(v0, MON_SPRITE_HIDE, 0); -} - -static void ov21_021DEF8C(PokedexGraphicData **param0) -{ - PokemonSprite *v0 = PokemonGraphics_GetPokemonChar(*param0); - - PokemonSprite_SetAttribute(v0, MON_SPRITE_HIDE, 1); - PokemonSprite_ClearFade(v0); -} - -static void ov21_021DEFA8(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, int param2) -{ - PokedexGraphicData *v0 = *param1; - NARC *v1 = PokedexGraphics_GetNARC(*param1); - - param0->unk_14[0] = SpriteResourceCollection_AddTilesFrom(v0->spriteResourceCollection[0], v1, type_icons_NCGR_lz, TRUE, type_icons_NCGR_lz + 4000, NNS_G2D_VRAM_TYPE_2DMAIN, param2); - - SpriteTransfer_RequestCharAtEnd(param0->unk_14[0]); - SpriteResource_ReleaseData(param0->unk_14[0]); - - param0->unk_14[1] = SpriteResourceCollection_AddPaletteFrom(v0->spriteResourceCollection[1], v1, type_icons_NCLR, FALSE, type_icons_NCLR + 4000, NNS_G2D_VRAM_TYPE_2DMAIN, 5, param2); - - SpriteTransfer_RequestPlttFreeSpace(param0->unk_14[1]); - SpriteResource_ReleaseData(param0->unk_14[1]); - - param0->unk_14[2] = SpriteResourceCollection_AddFrom(v0->spriteResourceCollection[2], v1, type_icons_cell_NCER_lz, TRUE, type_icons_cell_NCER_lz + 4000, 2, param2); - param0->unk_14[3] = SpriteResourceCollection_AddFrom(v0->spriteResourceCollection[3], v1, type_icons_anim_NANR_lz, TRUE, type_icons_anim_NANR_lz + 4000, 3, param2); -} - -static void ov21_021DF054(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1) -{ - PokedexGraphicData *v0 = *param1; - - SpriteTransfer_ResetCharTransfer(param0->unk_14[0]); - SpriteTransfer_ResetPlttTransfer(param0->unk_14[1]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[0], param0->unk_14[0]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[1], param0->unk_14[1]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[2], param0->unk_14[2]); - SpriteResourceCollection_Remove(v0->spriteResourceCollection[3], param0->unk_14[3]); -} - -static void ov21_021DF098(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, int param3) -{ - SpriteResourcesHeader v0; - SpriteListTemplate v1; - PokedexGraphicData *v2 = *param1; - int species = PokedexSort_CurrentSpecies(param2->unk_04); - int type1, type2; - int v6 = PokedexSort_DefaultForm(param2->unk_04, species); - - type1 = SpeciesData_GetFormValue(species, v6, SPECIES_DATA_TYPE_1); - type2 = SpeciesData_GetFormValue(species, v6, SPECIES_DATA_TYPE_2); - type1 = PokedexGraphics_GetAnimIDfromType(type1); - type2 = PokedexGraphics_GetAnimIDfromType(type2); - - SpriteResourcesHeader_Init(&v0, type_icons_NCGR_lz + 4000, type_icons_NCLR + 4000, type_icons_cell_NCER_lz + 4000, type_icons_anim_NANR_lz + 4000, 0xffffffff, 0xffffffff, FALSE, 0, v2->spriteResourceCollection[0], v2->spriteResourceCollection[1], v2->spriteResourceCollection[2], v2->spriteResourceCollection[3], NULL, NULL); - - v1.list = v2->spriteList; - v1.resourceData = &v0; - v1.priority = 32; - v1.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; - v1.heapID = param3; - v1.position.x = (170 * FX32_ONE); - v1.position.y = (72 * FX32_ONE); - - param0->unk_00[1] = SpriteList_Add(&v1); - - Sprite_SetAnim(param0->unk_00[1], 0 + type1); - - if (type1 != type2) { - v1.position.x = (220 * FX32_ONE); - v1.position.y = (72 * FX32_ONE); - param0->unk_00[2] = SpriteList_Add(&v1); - Sprite_SetAnim(param0->unk_00[2], 0 + type2); - } else { - param0->unk_00[2] = NULL; - } -} - -// This maps the type to an animation ID used in the Pokedex graphics. See zukan.narc -> files type_icons_cell_NCER_lz, type_icons_anim_NANR_lz, type_icons_NCGR_lz -int PokedexGraphics_GetAnimIDfromType(int monType) -{ - int animID; - - switch (monType) { - case TYPE_NORMAL: - animID = 0x0; - break; - case TYPE_FIGHTING: - animID = 0x6; - break; - case TYPE_FLYING: - animID = 0xe; - break; - case TYPE_POISON: - animID = 0xa; - break; - case TYPE_GROUND: - animID = 0x8; - break; - case TYPE_ROCK: - animID = 0x5; - break; - case TYPE_BUG: - animID = 0xb; - break; - case TYPE_GHOST: - case TYPE_MYSTERY: - animID = 0x7; - break; - case TYPE_STEEL: - animID = 0x9; - break; - case TYPE_FIRE: - animID = 0x1; - break; - case TYPE_WATER: - animID = 0x3; - break; - case TYPE_GRASS: - animID = 0x2; - break; - case TYPE_ELECTRIC: - animID = 0x4; - break; - case TYPE_PSYCHIC: - animID = 0xf; - break; - case TYPE_ICE: - animID = 0xd; - break; - case TYPE_DRAGON: - animID = 0x10; - break; - case TYPE_DARK: - animID = 0xc; - break; - } - - return animID; -} - -static void ov21_021DF1F8(UnkStruct_ov21_021DF374 *param0) -{ - if (param0->unk_00[1]) { - Sprite_Delete(param0->unk_00[1]); - } - - if (param0->unk_00[2]) { - Sprite_Delete(param0->unk_00[2]); - } -} - -static void ov21_021DF214(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, int param3) -{ - SpriteResourcesHeader v0; - SpriteListTemplate v1; - PokedexGraphicData *v2 = *param1; - int species = PokedexSort_CurrentSpecies(param2->unk_04); - Window *v4; - PokedexDisplayBox displayBox; - SpriteResource *v6; - - SpriteResourcesHeader_Init(&v0, type_icons_NCGR_lz + 4000, type_icons_NCLR + 4000, type_icons_cell_NCER_lz + 4000, type_icons_anim_NANR_lz + 4000, 0xffffffff, 0xffffffff, FALSE, 0, v2->spriteResourceCollection[0], v2->spriteResourceCollection[1], v2->spriteResourceCollection[2], v2->spriteResourceCollection[3], NULL, NULL); - - v1.list = v2->spriteList; - v1.resourceData = &v0; - v1.priority = 32; - v1.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; - v1.heapID = param3; - v1.position.x = (192 * FX32_ONE); - v1.position.y = (52 * FX32_ONE); - - param0->unk_0C = SpriteList_Add(&v1); - - Sprite_SetAnim(param0->unk_0C, 0x11); - - if (PokedexSort_CurrentCaughtStatus(param2->unk_04) != 2) { - species = 0; - } - - v4 = ov21_021DF30C((*param1)->textMan, species, param3); - v6 = PokedexGraphics_GetSpeciesLabelSpriteResource(*param1, 1); - - displayBox.textMan = (*param1)->textMan; - displayBox.paletteProxy = SpriteTransfer_GetPaletteProxy(v6, NULL); - displayBox.sprite = param0->unk_0C; - displayBox.x = -78; - displayBox.y = -8; - displayBox.spriteResourcePriority = 0; - displayBox.spriteListPriority = 32 - 1; - displayBox.vramType = NNS_G2D_VRAM_TYPE_2DMAIN; - displayBox.heapID = param3; - displayBox.window = v4; - - param0->unk_10 = PokedexTextManager_NextTextData(&displayBox); - - PokedexTextManager_FreeWindow(v4); -} - -Window *ov21_021DF30C(PokedexTextManager *textMan, int param1, int param2) -{ - Window *v0 = PokedexTextManager_NewWindow(textMan, 18, 2); - String *v1 = PokedexText_Category(param1, GAME_LANGUAGE, param2); - - { - u32 v2 = Font_CalcStringWidth(FONT_SUBSCREEN, v1, 0); - u32 v3 = (v2 < 136) ? (136 - v2) / 2 : 0; - - PokedexTextManager_DisplayString(textMan, v0, v1, v3, 0); - } - - PokedexText_Free(v1); - - return v0; -} - -static void ov21_021DF35C(UnkStruct_ov21_021DF374 *param0) -{ - Sprite_Delete(param0->unk_0C); - param0->unk_0C = NULL; - PokedexTextManager_FreeTextData(param0->unk_10); -} - -static void ov21_021DF374(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3) -{ - PokedexGraphics_SetSpeciesLabelGXOamMode(*param1, GX_OAM_MODE_XLU); - ov21_021DF64C(param0); - - if (ov21_021E2A54(param2->unk_10)) { - if (param3) { - PokedexGraphics_InitBlendTransition(&(*param1)->blendMain, 1, -16, 0, 0, 16, (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), GX_BLEND_PLANEMASK_BG3, 0); - } else { - PokedexGraphics_InitBlendTransition(&(*param1)->blendMain, 1, 0, -16, 16, 0, (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), GX_BLEND_PLANEMASK_BG3, 0); - } - } - - ov21_021DF6B4(param1); -} - -static BOOL ov21_021DF3F0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3) -{ - BOOL v0; - - if (ov21_021E2A54(param2->unk_10)) { - v0 = PokedexGraphics_TakeBlendTransitionStep(&(*param1)->blendMain); - } else { - v0 = PokedexGraphics_BlendTransitionComplete(&(*param1)->blendMain); - } - - if (v0 == 1) { - if (param3 == 1) { - ov21_021DF680(param0); - PokedexGraphics_SetSpeciesLabelGXOamMode(*param1, GX_OAM_MODE_NORMAL); - } else { - ov21_021DEF8C(param1); - ov21_021DEF3C(param1); - } - } else { - ov21_021DF6B4(param1); - } - - return v0; -} - -static void ov21_021DF44C(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3) -{ - ov21_021DF64C(param0); - - if (param3 == 0) { - ov21_021DF6C4(param0, param2->unk_08, param2->unk_0C, 4); - ov21_021DF6FC(param0); - } - - if (ov21_021E2A54(param2->unk_10)) { - if (param3) { - PokedexGraphics_InitBlendTransition(&(*param1)->blendMain, 4, -16, 0, 0, 16, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); - } else { - PokedexGraphics_InitBlendTransition(&(*param1)->blendMain, 4, 0, -16, 16, 0, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); - } - } -} - -static BOOL ov21_021DF4D0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3) -{ - BOOL v0[3]; - int v1; - - if (param3 == 0) { - v0[0] = ov21_021DF6E0(param0, param1); - v0[1] = ov21_021DF718(param0, param1); - } else { - v0[0] = 1; - v0[1] = 1; - } - - if (ov21_021E2A54(param2->unk_10)) { - v0[2] = PokedexGraphics_TakeBlendTransitionStep(&(*param1)->blendMain); - } else { - v0[2] = PokedexGraphics_BlendTransitionComplete(&(*param1)->blendMain); - } - - for (v1 = 0; v1 < 3; v1++) { - if (v0[v1] == 0) { - break; - } - } - - if (v1 == 3) { - if (param3 == 1) { - ov21_021DF680(param0); - } - - return 1; - } - - return 0; -} - -static void ov21_021DF548(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3) -{ - ov21_021DF64C(param0); - PokedexGraphics_SetSpeciesLabelGXOamMode(*param1, GX_OAM_MODE_XLU); - - if (param3 == 0) { - ov21_021DF6C4(param0, param2->unk_08, param2->unk_0C, 1); - } - - if (ov21_021E2A54(param2->unk_10)) { - if (param3) { - PokedexGraphics_InitBlendTransition(&(*param1)->blendMain, 1, -16, 0, 0, 16, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); - } else { - PokedexGraphics_InitBlendTransition(&(*param1)->blendMain, 1, 0, -16, 16, 0, (GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), (GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_BD), 0); - } - } -} - -static BOOL ov21_021DF5D0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1, const UnkStruct_ov21_021DE6D4 *param2, BOOL param3) -{ - BOOL v0[2]; - int v1; - - if (param3 == 0) { - v0[0] = ov21_021DF6E0(param0, param1); - } else { - v0[0] = 1; - } - - if (ov21_021E2A54(param2->unk_10)) { - v0[1] = PokedexGraphics_TakeBlendTransitionStep(&(*param1)->blendMain); - } else { - v0[1] = PokedexGraphics_BlendTransitionComplete(&(*param1)->blendMain); - } - - for (v1 = 0; v1 < 2; v1++) { - if (v0[v1] == 0) { - break; - } - } - - if (v1 == 2) { - if (param3 == 1) { - ov21_021DF680(param0); - PokedexGraphics_SetSpeciesLabelGXOamMode(*param1, GX_OAM_MODE_NORMAL); - } else { - ov21_021DEF3C(param1); - } - - return 1; - } - - return 0; -} - -static void ov21_021DF64C(UnkStruct_ov21_021DF374 *param0) -{ - int v0; - - for (v0 = 0; v0 < 3; v0++) { - if (param0->unk_00[v0]) { - Sprite_SetExplicitOAMMode(param0->unk_00[v0], GX_OAM_MODE_XLU); - } - } - - Sprite_SetExplicitOAMMode(param0->unk_0C, GX_OAM_MODE_XLU); - sub_02012AF0(param0->unk_10->fontOAM, GX_OAM_MODE_XLU); -} - -static void ov21_021DF680(UnkStruct_ov21_021DF374 *param0) -{ - int v0; - - for (v0 = 0; v0 < 3; v0++) { - if (param0->unk_00[v0]) { - Sprite_SetExplicitOAMMode(param0->unk_00[v0], GX_OAM_MODE_NORMAL); - } - } - - Sprite_SetExplicitOAMMode(param0->unk_0C, GX_OAM_MODE_NORMAL); - sub_02012AF0(param0->unk_10->fontOAM, GX_OAM_MODE_NORMAL); -} - -static void ov21_021DF6B4(PokedexGraphicData **param0) -{ - PokedexGraphics_BlendPokemonChar(*param0, &(*param0)->blendMain); -} - -static void ov21_021DF6C4(UnkStruct_ov21_021DF374 *param0, int param1, int param2, int param3) -{ - PokedexGraphics_InitTransformation(¶m0->unk_34, 48, param1, 72, param2, param3); -} - -static BOOL ov21_021DF6E0(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1) -{ - BOOL v0 = PokedexGraphics_TakeTransformStep(¶m0->unk_34); - PokemonGraphics_SetCharCenterXY(*param1, param0->unk_34.currentX, param0->unk_34.currentY); - - return v0; -} - -static void ov21_021DF6FC(UnkStruct_ov21_021DF374 *param0) -{ - PokedexGraphics_InitTransformation(¶m0->unk_54, 172, 170, 32, 82, 4); -} - -static BOOL ov21_021DF718(UnkStruct_ov21_021DF374 *param0, PokedexGraphicData **param1) -{ - BOOL v0 = PokedexGraphics_TakeTransformStep(¶m0->unk_54); - ov21_021D1848(*param1, param0->unk_54.currentX, param0->unk_54.currentY); - - return v0; -} diff --git a/src/applications/pokedex/ov21_021E1924.c b/src/applications/pokedex/ov21_021E1924.c index 4d14397cd3..d09ab200fa 100644 --- a/src/applications/pokedex/ov21_021E1924.c +++ b/src/applications/pokedex/ov21_021E1924.c @@ -3,9 +3,9 @@ #include #include +#include "applications/pokedex/infomain.h" #include "applications/pokedex/infomain_foreign.h" #include "applications/pokedex/ov21_021D4340.h" -#include "applications/pokedex/ov21_021DE668.h" #include "applications/pokedex/ov21_021E29DC.h" #include "applications/pokedex/pokedex_app.h" #include "applications/pokedex/pokedex_data_manager.h" @@ -17,7 +17,6 @@ #include "applications/pokedex/pokedex_text.h" #include "applications/pokedex/pokedex_text_manager.h" #include "applications/pokedex/struct_ov21_021D4660.h" -#include "applications/pokedex/struct_ov21_021DE6D4.h" #include "applications/pokedex/struct_ov21_021E68F4.h" #include "bg_window.h" @@ -42,7 +41,7 @@ typedef struct { int *unk_00; PokedexSortData *unk_04; - UnkStruct_ov21_021DE6D4 *unk_08; + InfoMainState *unk_08; PokedexScreenManager *unk_0C; PokedexScreenManager *unk_10; const PokedexScreenManager *unk_14; @@ -511,9 +510,9 @@ static void ov21_021E1E8C(u32 param0, enum TouchScreenButtonState param1, void * case 2: if (v2->unk_38 & 1) { if (v2->unk_10 == 0) { - v3 = ov21_021DE6D4(v1->unk_08, 1); + v3 = InfoMain_SetDisplayPosition(v1->unk_08, 1); } else { - ov21_021DE6D8(v1->unk_08, 0); + InfoMain_SetEntryOffset(v1->unk_08, 0); v3 = 1; } @@ -961,20 +960,20 @@ static void ov21_021E275C(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A { int v0, v1; - param1->unk_08->unk_1C = 1; + param1->unk_08->playCry = 1; *param1->unk_00 |= (1 << 2); param0->unk_10 = 0; v0 = 48; v1 = 72; - param1->unk_08->unk_14 = 2; + param1->unk_08->animationMode = 2; switch (param2) { case 0: - param1->unk_08->unk_08 = v0; - param1->unk_08->unk_0C = v1; - param1->unk_08->unk_14 = 1; + param1->unk_08->displayPositionX = v0; + param1->unk_08->displayPositionY = v1; + param1->unk_08->animationMode = 1; break; case 1: case 2: @@ -982,7 +981,7 @@ static void ov21_021E275C(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A case 4: case 5: InfoMainForeign_SetDisplayPosition(param1->unk_10, v0, v1); - InfoMainForeign_SetAnimationMode(param1->unk_10, ANIM_MODE_BLEND); + InfoMainForeign_SetAnimationMode(param1->unk_10, ANIM_BLEND); break; default: break; @@ -1000,7 +999,7 @@ static void ov21_021E27C0(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A param0->unk_10 = 0; v0 = 48; v1 = 72; - param1->unk_08->unk_14 = 2; + param1->unk_08->animationMode = 2; break; case 1: case 2: @@ -1012,7 +1011,7 @@ static void ov21_021E27C0(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A v0 = 48; v1 = 72; - InfoMainForeign_SetAnimationMode(param1->unk_10, ANIM_MODE_POSITION); + InfoMainForeign_SetAnimationMode(param1->unk_10, ANIM_POSITION); v2 = PokedexText_ForeignLanguage(param3 - 1); InfoMainForeign_SetLanguage(param1->unk_10, v2); break; @@ -1022,9 +1021,9 @@ static void ov21_021E27C0(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A switch (param2) { case 0: - param1->unk_08->unk_08 = v0; - param1->unk_08->unk_0C = v1; - param1->unk_08->unk_14 = 2; + param1->unk_08->displayPositionX = v0; + param1->unk_08->displayPositionY = v1; + param1->unk_08->animationMode = 2; break; case 1: case 2: @@ -1032,7 +1031,7 @@ static void ov21_021E27C0(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A case 4: case 5: InfoMainForeign_SetDisplayPosition(param1->unk_10, v0, v1); - InfoMainForeign_SetAnimationMode(param1->unk_10, ANIM_MODE_POSITION); + InfoMainForeign_SetAnimationMode(param1->unk_10, ANIM_POSITION); break; default: break; diff --git a/src/applications/pokedex/ov21_021E29DC.c b/src/applications/pokedex/ov21_021E29DC.c index f3748f7bfa..a4a370149a 100644 --- a/src/applications/pokedex/ov21_021E29DC.c +++ b/src/applications/pokedex/ov21_021E29DC.c @@ -3,6 +3,7 @@ #include #include +#include "applications/pokedex/infomain.h" #include "applications/pokedex/infomain_foreign.h" #include "applications/pokedex/ov21_021D4340.h" #include "applications/pokedex/ov21_021DC9BC.h" @@ -18,7 +19,6 @@ #include "applications/pokedex/pokedex_text_manager.h" #include "applications/pokedex/struct_ov21_021D4660.h" #include "applications/pokedex/struct_ov21_021D5B68.h" -#include "applications/pokedex/struct_ov21_021DE6D4.h" #include "applications/pokedex/struct_ov21_021E68F4.h" #include "bg_window.h" @@ -44,7 +44,7 @@ typedef struct { PokedexSortData *unk_04; int unk_08; UnkStruct_ov21_021D5B68 *unk_0C; - UnkStruct_ov21_021DE6D4 *unk_10; + InfoMainState *unk_10; PokedexScreenManager *unk_14; PokedexScreenManager *unk_18; PokedexScreenManager *unk_1C; @@ -315,7 +315,7 @@ static int ov21_021E2C24(PokedexDataManager *dataMan, void *data) { UnkStruct_ov21_021E2BA8 *v0 = data; - v0->unk_10->unk_1C = 1; + v0->unk_10->playCry = 1; return 1; } @@ -450,14 +450,14 @@ static void ov21_021E2E10(UnkStruct_ov21_021E2BA8 *param0) { *param0->unk_00 |= (0x1 << 1); param0->unk_28 = 0; - param0->unk_10->unk_14 = 0; + param0->unk_10->animationMode = 0; - InfoMainForeign_SetAnimationMode(param0->unk_18, ANIM_MODE_POSITION_BLEND); + InfoMainForeign_SetAnimationMode(param0->unk_18, ANIM_POSITION_BLEND); switch (param0->unk_08) { case 0: - param0->unk_10->unk_08 = 56; - param0->unk_10->unk_0C = 80; + param0->unk_10->displayPositionX = 56; + param0->unk_10->displayPositionY = 80; InfoMainForeign_SetDisplayPosition(param0->unk_18, 56, 80); param0->unk_0C->unk_14 = 1; param0->unk_2C = 1; @@ -502,9 +502,9 @@ static BOOL ov21_021E2EC4(UnkStruct_ov21_021E2BA8 *param0, int param1, int param switch (param1) { case 0: if (ov21_021E2EC0(param2)) { - param0->unk_10->unk_14 = 2; + param0->unk_10->animationMode = 2; } else { - param0->unk_10->unk_14 = 1; + param0->unk_10->animationMode = 1; } *param0->unk_00 |= (0x1 << 2); @@ -562,15 +562,15 @@ static BOOL ov21_021E2EC4(UnkStruct_ov21_021E2BA8 *param0, int param1, int param switch (param2) { case 0: if (ov21_021E2EC0(param1)) { - param0->unk_10->unk_14 = 2; - InfoMainForeign_SetAnimationMode(param0->unk_18, ANIM_MODE_POSITION); + param0->unk_10->animationMode = 2; + InfoMainForeign_SetAnimationMode(param0->unk_18, ANIM_POSITION); } else { - param0->unk_10->unk_14 = 1; - InfoMainForeign_SetAnimationMode(param0->unk_18, ANIM_MODE_BLEND); + param0->unk_10->animationMode = 1; + InfoMainForeign_SetAnimationMode(param0->unk_18, ANIM_BLEND); } - param0->unk_10->unk_08 = v0; - param0->unk_10->unk_0C = v1; + param0->unk_10->displayPositionX = v0; + param0->unk_10->displayPositionY = v1; InfoMainForeign_SetDisplayPosition(param0->unk_18, v0, v1); break; case 1: @@ -737,7 +737,7 @@ static void ov21_021E331C(UnkStruct_ov21_021E326C *param0, int param1) static void ov21_021E3320(UnkStruct_ov21_021E2BA8 *param0) { param0->unk_28 = 1; - param0->unk_10->unk_14 = 1; + param0->unk_10->animationMode = 1; } void ov21_021E332C(PokedexScreenManager *screenMan, PokedexApp *param1, enum HeapID heapID) diff --git a/src/applications/pokedex/ov21_021E8D48.c b/src/applications/pokedex/ov21_021E8D48.c index 8d39d4446d..bb49a5040e 100644 --- a/src/applications/pokedex/ov21_021E8D48.c +++ b/src/applications/pokedex/ov21_021E8D48.c @@ -4,7 +4,7 @@ #include #include "applications/pokedex/footprint.h" -#include "applications/pokedex/ov21_021DE668.h" +#include "applications/pokedex/infomain.h" #include "applications/pokedex/pokedex_graphics.h" #include "applications/pokedex/pokedex_main.h" #include "applications/pokedex/pokedex_text_manager.h" @@ -536,7 +536,7 @@ static void ov21_021E9560(UnkStruct_ov21_021E95B0 *param0, PokedexTextManager *t Window *v0; PokedexDisplayBox displayBox; - v0 = ov21_021DF30C(textMan, param3, param2); + v0 = InfoMain_CreateCategoryWindow(textMan, param3, param2); displayBox.textMan = textMan; displayBox.paletteProxy = SpriteTransfer_GetPaletteProxy(param4, NULL); @@ -724,7 +724,7 @@ static BOOL ov21_021E9948(PaletteData *param0, PokemonSprite *param1) static void ov21_021E9968(Window *param0, int param1, int param2) { - ov21_021DEB8C(param0, param2, param1, 0, TEXT_COLOR(2, 1, 0)); + InfoMain_RenderHeightWeightEntry(param0, param2, param1, 0, TEXT_COLOR(2, 1, 0)); ov21_021E998C(param0, param1); } diff --git a/src/applications/pokedex/pokedex_main.c b/src/applications/pokedex/pokedex_main.c index 8bfa9b346b..3161026341 100644 --- a/src/applications/pokedex/pokedex_main.c +++ b/src/applications/pokedex/pokedex_main.c @@ -9,6 +9,7 @@ #include "applications/pokedex/formsub.h" #include "applications/pokedex/funcptr_ov21_021E9B74.h" #include "applications/pokedex/funcptr_ov21_021E9B9C.h" +#include "applications/pokedex/infomain.h" #include "applications/pokedex/infomain_foreign.h" #include "applications/pokedex/ov21_021D423C.h" #include "applications/pokedex/ov21_021D4340.h" @@ -17,7 +18,6 @@ #include "applications/pokedex/ov21_021D94BC.h" #include "applications/pokedex/ov21_021DC9BC.h" #include "applications/pokedex/ov21_021DDD2C.h" -#include "applications/pokedex/ov21_021DE668.h" #include "applications/pokedex/ov21_021E1924.h" #include "applications/pokedex/ov21_021E29DC.h" #include "applications/pokedex/ov21_021E3FFC.h" @@ -202,7 +202,7 @@ static BOOL TransitionComplete(PokedexApp **appPtr) const static UnkFuncPtr_ov21_021E9B74 Unk_ov21_021E9B74[10] = { ov21_021D5AEC, PokedexSearch_TransitionFunctions, - ov21_021DE668, + InfoMain_InitScreen, FormMain_Init, InfoMainForeign_InitScreen, ov21_021E29DC, @@ -226,7 +226,7 @@ const static UnkFuncPtr_ov21_021E9B74 Unk_ov21_021E9B34[8] = { const static UnkFuncPtr_ov21_021E9B9C Unk_ov21_021E9B9C[10] = { ov21_021D5B50, PokedexSearch_FreeData, - ov21_021DE6C0, + InfoMain_FreeScreen, FormMain_Free, InfoMainForeign_FreeScreen, ov21_021E2A3C, diff --git a/src/meson.build b/src/meson.build index 906a7e0eec..2aaa8734ca 100644 --- a/src/meson.build +++ b/src/meson.build @@ -606,7 +606,7 @@ pokeplatinum_c = files( 'applications/pokedex/ov21_021D94BC.c', 'applications/pokedex/ov21_021DC9BC.c', 'applications/pokedex/ov21_021DDD2C.c', - 'applications/pokedex/ov21_021DE668.c', + 'applications/pokedex/infomain.c', 'applications/pokedex/formmain.c', 'applications/pokedex/infomain_foreign.c', 'applications/pokedex/ov21_021E1924.c',