diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pokemon/pokemon_storage_system.c | 1553 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system_2.c | 1566 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system_3.c | 16 | ||||
-rw-r--r-- | src/pokemon/pokemon_summary_screen.c | 29 | ||||
-rw-r--r-- | src/pokenav_before.c | 1 |
5 files changed, 1596 insertions, 1569 deletions
diff --git a/src/pokemon/pokemon_storage_system.c b/src/pokemon/pokemon_storage_system.c index 5fd43cfb8..c91e45d7a 100644 --- a/src/pokemon/pokemon_storage_system.c +++ b/src/pokemon/pokemon_storage_system.c @@ -3,123 +3,16 @@ #include "constants/songs.h" #include "sound.h" #include "field_weather.h" -#include "mon_markings.h" #include "overworld.h" -#include "mail_data.h" #include "field_fadetransition.h" #include "menu.h" #include "main.h" #include "strings.h" #include "string_util.h" #include "event_data.h" -#include "ewram.h" #include "script.h" -#include "pokemon_summary_screen.h" -#include "pc_screen_effect.h" -#include "naming_screen.h" #include "pokemon_storage_system.h" -enum { - PC_TEXT_EXIT_BOX, - PC_TEXT_WHAT_YOU_DO, - PC_TEXT_PICK_A_THEME, - PC_TEXT_PICK_A_WALLPAPER, - PC_TEXT_IS_SELECTED, - PC_TEXT_JUMP_TO_WHICH_BOX, - PC_TEXT_DEPOSIT_IN_WHICH_BOX, - PC_TEXT_WAS_DEPOSITED, - PC_TEXT_BOX_IS_FULL, - PC_TEXT_RELEASE_POKE, - PC_TEXT_WAS_RELEASED, - PC_TEXT_BYE_BYE, - PC_TEXT_MARK_POKE, - PC_TEXT_LAST_POKE, - PC_TEXT_PARTY_FULL, - PC_TEXT_HOLDING_POKE, - PC_TEXT_WHICH_ONE_WILL_TAKE, - PC_TEXT_CANT_RELEASE_EGG, - PC_TEXT_CONTINUE_BOX, - PC_TEXT_CAME_BACK, - PC_TEXT_WORRIED, - PC_TEXT_SURPRISE, - PC_TEXT_PLEASE_REMOVE_MAIL -}; - -enum { - PC_TEXT_FMT_NORMAL, - PC_TEXT_FMT_MON_NAME, - PC_TEXT_FMT_UNK_02, - PC_TEXT_FMT_UNK_03, - PC_TEXT_FMT_MON_NAME_2, - PC_TEXT_FMT_UNK_05, - PC_TEXT_FMT_MON_NAME_AFTER_EXCL_MARK -}; - -struct StorageAction { - u8 *text; - u8 format; -}; - -struct PSS_MenuStringPtrs { - const u8 *text; - const u8 *desc; -}; - -struct UnkStruct_2000020 { - struct UnkStruct_2000020 *unk_00; - u8 unk_04; - u8 unk_05; -}; - -struct UnkPSSStruct_2002370 { - struct Sprite *unk_0000; - struct Sprite *unk_0004[4]; - u32 unk_0014[3]; - struct Sprite *unk_0020[2]; - u8 filler_0028[0x214]; - u8 curBox; - u8 unk_023d; - u8 unk_023e; - u16 unk_0240; - u16 unk_0242; -}; // 0244 - -struct PokemonStorageSystemData { - void (*unk_0000)(void); - u8 unk_0004; - u8 unk_0005; - u8 unk_0006; - u8 unk_0007; - u16 unk_0008; - u16 unk_000a; - struct PCScreenEffectStruct unk_000c; - struct UnkStruct_2000020 unk_0020[274]; // refine size later - u8 filler_08b0[2]; - s16 unk_08b2; - u16 unk_08b4; - u8 filler_08b6[0x4a8]; - s16 unk_0d5e; - s16 unk_0d60; - u8 filler_0d62[0x490]; - u16 unk_11f2; - u8 filler_11f4[2]; - u8 unk_11f6; - u8 unk_11f7; - u8 unk_11f8; - u8 unk_11f9; - u8 unk_11fa[0xc2]; - struct PokemonMarkMenu unk_12bc; - struct UnkPSSStruct_2002370 unk_2370; - u8 filler_25b4[0xd8]; - u8 unk_268c; - u8 unk_268d; - u8 unk_268e; - struct Pokemon *unk_2690; - u8 unk_2694[18]; - u8 unk_26a6[62]; - u8 unk_26e4[80]; -}; - void StorageSystemCreatePrimaryMenu(u8 whichMenu); void sub_80963D0(u8 curBox); void sub_809658C(void); @@ -128,95 +21,6 @@ void sub_809662C(void); void sub_809665C(void); void sub_80966F4(const u8 *sourceString, u16 x, u16 y); void sub_8096784(struct Sprite *sprite); -void task_intro_29(u8 whichMenu); -void sub_8096884(void); -void sub_8096AFC(void); -void sub_8096B38(void); -void SetPSSCallback(void (*func)(void)); -void sub_8096BF0(void); -void sub_8096C68(void); -void sub_8096C84(void); -void sub_8096FC8(void); -void sub_8097004(void); -void sub_8097078(void); -void sub_80972A8(void); -void sub_80972FC(void); -void c3_0808DC50(void); -void sub_8097390(void); -void sub_809746C(void); -void sub_8097594(void); -void sub_8097788(void); -void sub_80977E4(void); -void sub_8097858(void); -void sub_809789C(void); -void sub_8097974(void); -void sub_8097A64(void); -void sub_8097B44(void); -void sub_8097BA0(void); -void sub_8097CC0(void); -void sub_8097DE0(void); -void sub_8097E44(void); -void sub_8097E70(void); -void BoxSetMosaic(void); -void sub_809801C(void); -void sub_8098400(void); -void add_to_c3_somehow(void); -bool8 sub_80985CC(void); -void sub_80986E8(void); -void sub_8098710(void); -void sub_8098734(void); -void sub_80987DC(void); -void sub_809880C(void); -bool8 sub_8098830(void); -void PrintStorageActionText(u8 index); -void sub_8098A38(u8); -void sub_8098A5C(void); -void sub_8098A80(void); -void sub_8098AA8(u8 a0); -void sub_8098B48(void); -void sub_8099310(void); -bool8 sub_8099374(void); -void sub_8099958(void); -bool8 sub_8099990(void); -void sub_809BB90(void); -void sub_8099BF8(u8 a0); -void sub_8099C70(u8 whichBox); -bool8 sub_8099D34(void); -void sub_8099DCC(u8 a0); -bool8 sub_8099E08(void); -void sub_809A860(u8 a0); -struct Sprite *sub_809A9A0(u16 a0, u16 a1, u8 a2, u8 a3, u8 a4); -void sub_809AA24(void); -void sub_809AA98(void); -bool8 sub_809AC00(void); -void sub_809B0C0(u8 a0); -void sub_809B0D4(void); -void sub_809B0E0(void); -u8 sub_809B0F4(void); -void sub_809B100(u8 a0); -bool8 sub_809B130(void); -void sub_809B440(void); -bool8 sub_809B62C(u8); -void sub_809B6BC(void); -void sub_809B6DC(void); -bool8 sub_809B734(void); -void sub_809B760(void); -void sub_809B7AC(void); -void sub_809B7D4(void); -s8 sub_809B960(void); -void sub_809BBC0(void); -void sub_809BC18(void); -void sub_809BD14(void); -void sub_809BDD8(u8 markings); -bool8 sub_809BE80(void); -bool8 sub_809BEBC(void); -bool8 sub_809BF20(void); -bool8 sub_809BF48(void); -u8 sub_809CA40(void); -void sub_809CE84(void); -s16 sub_809CF30(void); -void sub_809CFDC(struct UnkStruct_2000020 *a0, struct UnkStruct_2000020 *a1, u8 a2); -void sub_809CFF0(void); const struct PSS_MenuStringPtrs gUnknown_083B600C[] = { {PCText_WithdrawPoke, PCText_MovePokeToParty}, @@ -267,73 +71,11 @@ const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/b const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); -const u16 gPokemonStorageScrollingBGPalette[] = INCBIN_U16("graphics/pokemon_storage/scrolling_bg.gbapal"); - -const u16 gPokemonStorageScrollingBGTile[] = INCBIN_U16("graphics/pokemon_storage/scrolling_bg.4bpp"); - -const u8 gPokemonStorageScrollingBGTilemap[] = INCBIN_U8("graphics/pokemon_storage/scrolling_bg_map.bin.lz"); - -const u16 sUnknownTilemap[] = { - 0x1281, - 0x1282, - 0x1283, - 0x1284, - 0x1285, - 0x1286, - 0x1287, - 0x1288, - 0x128C, - 0x128D, - 0x128E, - 0x128F, - 0x1290, - 0x1291, - 0x1292, - 0x1293, - 0x0281, - 0x0282, - 0x0283, - 0x0284, - 0x0285, - 0x0286, - 0x0287, - 0x0288, - 0x028C, - 0x028D, - 0x028E, - 0x028F, - 0x0290, - 0x0291, - 0x0292, - 0x0293, - 0x12AD, - 0x12AE, - 0x12A8, - 0x12A8 -}; - -extern const struct StorageAction gPCStorageActionTexts[]; -extern const struct PokemonStorageSystemData *gPokemonStorageSystemPtr; -extern u8 *const gUnknown_083B6DB8; - EWRAM_DATA struct PokemonStorage gPokemonStorage = {0}; EWRAM_DATA u8 gUnknown_02038470[3] = {}; EWRAM_DATA u8 gUnknown_02038473 = 0; EWRAM_DATA u8 gUnknown_02038474 = 0; EWRAM_DATA struct UnkPSSStruct_2002370 *gUnknown_02038478 = NULL; -EWRAM_DATA u8 gUnknown_0203847C = 0; -EWRAM_DATA u8 gUnknown_0203847D = 0; -EWRAM_DATA u8 gUnknown_0203847E = 0; -EWRAM_DATA u8 gUnknown_0203847F = 0; -EWRAM_DATA struct Pokemon gUnknown_02038480 = {}; -EWRAM_DATA u8 gUnknown_020384E4 = 0; -EWRAM_DATA u8 gUnknown_020384E5 = 0; -EWRAM_DATA u8 gUnknown_020384E6 = 0; -EWRAM_DATA u8 gUnknown_020384E7 = 0; -EWRAM_DATA u8 gUnknown_020384E8 = 0; -EWRAM_DATA u8 gUnknown_020384E9 = 0; -EWRAM_DATA u16 gUnknown_020384EA = 0; -EWRAM_DATA u32 gUnknown_020384EC = 0; static u8 CountPokemonInBoxN(u8 boxId) { @@ -967,1298 +709,3 @@ void sub_8096784(struct Sprite *sprite) } } } - -void task_intro_29(u8 whichMenu) -{ - gUnknown_0203847D = whichMenu; - ePokemonStorageSystem.unk_0005 = whichMenu; - SetMainCallback2(sub_8096884); -} - -void sub_80967DC(void) -{ - REG_BG0HOFS = 0; - REG_BG0VOFS = 0; - REG_BG1HOFS = 0; - REG_BG1VOFS = 0; - REG_BG2VOFS = 0; - REG_BG2HOFS = 0; - REG_BG3HOFS = 0; - REG_BG3VOFS = 0; -} - -void sub_8096804(void) -{ - ResetPaletteFade(); - ResetSpriteData(); - FreeSpriteTileRanges(); - FreeAllSpritePalettes(); - ResetTasks(); - gReservedSpriteTileCount = 0x280; - sub_809CFDC(ePokemonStorageSystem.unk_0020, ePokemonStorageSystem.unk_0020 + 1, 8); - gKeyRepeatStartDelay = 20; -} - -void sub_8096848(void) -{ - sub_809B0D4(); - gUnknown_0203847C = (ePokemonStorageSystem.unk_0005 == 1 ? 1 : 0); - gUnknown_0203847E = 0; -} - -void sub_8096874(void) -{ - REG_DISPCNT = DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON; -} - -void sub_8096884(void) -{ - switch (gMain.state) - { - case 0: - SetVBlankCallback(NULL); - REG_DISPCNT = 0; - sub_8096804(); - gMain.state++; - break; - case 1: - SetUpWindowConfig(&gWindowConfig_81E6D00); - gMain.state++; - break; - case 2: - InitMenuWindow(&gWindowConfig_81E6D00); - MenuZeroFillScreen(); - gMain.state++; - break; - case 3: - sub_80967DC(); - sub_8096848(); - gMain.state++; - break; - case 4: - sub_8098B48(); - sub_809AA24(); - gMain.state++; - break; - case 5: - sub_8097DE0(); - gMain.state++; - break; - case 6: - sub_8097E70(); - gMain.state++; - break; - case 7: - sub_8098400(); - gMain.state++; - break; - case 8: - sub_8099BF8(gPokemonStorage.currentBox); - ePokemonStorageSystem.unk_12bc.baseTileTag = 0x000a; - ePokemonStorageSystem.unk_12bc.basePaletteTag = 0xdacb; - sub_80F727C(&ePokemonStorageSystem.unk_12bc); - sub_80F7404(); - gMain.state++; - break; - case 9: - sub_8096874(); - SetPSSCallback(sub_8096BF0); - SetMainCallback2(sub_8096B38); - SetVBlankCallback(sub_8096AFC); - gMain.state++; - break; - } -} - -void sub_80969A0(void) -{ - switch (gMain.state) - { - case 0: - SetVBlankCallback(NULL); - REG_DISPCNT = 0x0000; - ePokemonStorageSystem.unk_0005 = gUnknown_0203847D; - sub_8096804(); - if (gUnknown_0203847F == 1) - sub_809BBC0(); - if (gUnknown_0203847F == 0) - sub_809BD14(); - gMain.state++; - break; - case 1: - SetUpWindowConfig(&gWindowConfig_81E6D00); - gMain.state++; - break; - case 2: - InitMenuWindow(&gWindowConfig_81E6D00); - MenuZeroFillScreen(); - gMain.state++; - break; - case 3: - sub_80967DC(); - gMain.state++; - break; - case 4: - sub_8098B48(); - sub_809AA98(); - gMain.state++; - break; - case 5: - sub_8097DE0(); - gMain.state++; - break; - case 6: - sub_8097E70(); - gMain.state++; - break; - case 7: - sub_8098400(); - gMain.state++; - break; - case 8: - sub_8099BF8(gPokemonStorage.currentBox); - ePokemonStorageSystem.unk_12bc.baseTileTag = 0x000a; - ePokemonStorageSystem.unk_12bc.basePaletteTag = 0xdacb; - sub_80F727C(&ePokemonStorageSystem.unk_12bc); - sub_80F7404(); - gMain.state++; - break; - case 9: - BeginNormalPaletteFade(0xffffffff, 0, 16, 0, 0); - SetVBlankCallback(sub_8096AFC); - gMain.state++; - break; - case 10: - sub_8096874(); - SetPSSCallback(sub_8096C68); - SetMainCallback2(sub_8096B38); - gMain.state++; - break; - } -} - -void sub_8096AFC(void) -{ - REG_BG2HOFS = ePokemonStorageSystem.unk_08b4; - REG_BG3HOFS = ePokemonStorageSystem.unk_000a; - REG_BG3VOFS = ePokemonStorageSystem.unk_0008; - LoadOam(); - ProcessSpriteCopyRequests(); - sub_809CFF0(); - TransferPlttBuffer(); -} - -void sub_8096B38(void) -{ - ePokemonStorageSystem.unk_0000(); - sub_8097E44(); - sub_8098734(); - AnimateSprites(); - BuildOamBuffer(); -} - -void sub_8096B5C(void) -{ - switch (ePokemonStorageSystem.unk_0006) - { - case 0: - ShowPokemonSummaryScreen(ePokemonStorageSystem.unk_2690, ePokemonStorageSystem.unk_268d, ePokemonStorageSystem.unk_268c, sub_80969A0, ePokemonStorageSystem.unk_268e); - break; - case 1: - DoNamingScreen(1, gPokemonStorage.boxNames[gPokemonStorage.currentBox], 0, 0, 0, sub_80969A0); - break; - } -} - -void SetPSSCallback(void (*func)(void)) -{ - ePokemonStorageSystem.unk_0000 = func; - ePokemonStorageSystem.unk_0004 = 0; -} - -void sub_8096BF0(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - BlendPalettes(0xffffffff, 16, 0); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - PlaySE(SE_PC_LOGON); - ePokemonStorageSystem.unk_000c.tileTag = 14; - ePokemonStorageSystem.unk_000c.paletteTag = 0xdad0; - ePokemonStorageSystem.unk_000c.unk04 = 0; - ePokemonStorageSystem.unk_000c.unk06 = 0; - sub_80C5CD4(&ePokemonStorageSystem.unk_000c); - BlendPalettes(0xffffffff, 0, 0); - ePokemonStorageSystem.unk_0004++; - break; - case 2: - if (sub_80C5DCC()) - SetPSSCallback(sub_8096C84); - break; - } -} - -void sub_8096C68(void) -{ - if (!UpdatePaletteFade()) - SetPSSCallback(sub_8096C84); -} - -void sub_8096C84(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - switch (sub_809CA40()) - { - case 1: - PlaySE(SE_SELECT); - ePokemonStorageSystem.unk_0004 = 1; - break; - case 5: - if (ePokemonStorageSystem.unk_0005 != 2) - { - PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); - ePokemonStorageSystem.unk_0004 = 3; - } - else - { - sub_809B0D4(); - SetPSSCallback(sub_8096FC8); - } - break; - case 6: - if (ePokemonStorageSystem.unk_0005 == 2) - { - if (sub_809BF20() && ItemIsMail(ePokemonStorageSystem.unk_11f2)) - { - ePokemonStorageSystem.unk_0004 = 5; - } - else - { - SetPSSCallback(sub_8097004); - } - } - break; - case 4: - SetPSSCallback(sub_8097BA0); - break; - case 16: - SetPSSCallback(sub_8097CC0); - break; - case 7: - PlaySE(SE_SELECT); - SetPSSCallback(sub_809789C); - break; - case 8: - PlaySE(SE_SELECT); - SetPSSCallback(sub_8097078); - break; - case 9: - PlaySE(SE_SELECT); - ePokemonStorageSystem.unk_08b2 = gPokemonStorage.currentBox + 1; - if (ePokemonStorageSystem.unk_08b2 > 13) - ePokemonStorageSystem.unk_08b2 = 0; - sub_8099C70(ePokemonStorageSystem.unk_08b2); - ePokemonStorageSystem.unk_0004 = 2; - break; - case 10: - PlaySE(SE_SELECT); - ePokemonStorageSystem.unk_08b2 = gPokemonStorage.currentBox - 1; - if (ePokemonStorageSystem.unk_08b2 < 0) - ePokemonStorageSystem.unk_08b2 = 13; - sub_8099C70(ePokemonStorageSystem.unk_08b2); - ePokemonStorageSystem.unk_0004 = 2; - break; - case 11: - if (!sub_809BE80()) - { - if (ItemIsMail(ePokemonStorageSystem.unk_11f2)) - { - ePokemonStorageSystem.unk_0004 = 5; - } - else - { - PlaySE(SE_SELECT); - SetPSSCallback(sub_809746C); - } - } - else - { - ePokemonStorageSystem.unk_0004 = 4; - } - break; - case 13: - if (sub_809BE80()) - { - ePokemonStorageSystem.unk_0004 = 4; - } - else - { - PlaySE(SE_SELECT); - SetPSSCallback(sub_80972A8); - } - break; - case 14: - if (!sub_809BEBC()) - { - ePokemonStorageSystem.unk_0004 = 4; - } - else - { - PlaySE(SE_SELECT); - SetPSSCallback(c3_0808DC50); - } - break; - case 12: - PlaySE(SE_SELECT); - SetPSSCallback(sub_8097390); - break; - case 15: - PlaySE(SE_SELECT); - SetPSSCallback(sub_80972FC); - break; - } - break; - case 1: - if (!sub_809AC00()) - { - if (sub_809BF48()) - sub_80986E8(); - else - sub_8098710(); - if (ePokemonStorageSystem.unk_11f6) - BoxSetMosaic(); - ePokemonStorageSystem.unk_0004 = 0; - } - break; - case 2: - if (!sub_8099D34()) - { - gPokemonStorage.currentBox = ePokemonStorageSystem.unk_08b2; - if (!gUnknown_0203847C && !sub_809BF20()) - { - sub_809B440(); - BoxSetMosaic(); - } - ePokemonStorageSystem.unk_0004 = 0; - } - break; - case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) - { - sub_8098A5C(); - ePokemonStorageSystem.unk_0004 = 0; - } - break; - case 4: - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_LAST_POKE); - ePokemonStorageSystem.unk_0004 = 6; - break; - case 5: - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); - ePokemonStorageSystem.unk_0004 = 6; - break; - case 6: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) - { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8096FC8(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_809880C(); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_8098830()) - SetPSSCallback(sub_8096C84); - break; - } -} - -void sub_8097004(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PlaySE(SE_SELECT); - add_to_c3_somehow(); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_80985CC()) - { - sub_809B0C0(sub_809B0F4()); - ePokemonStorageSystem.unk_0004++; - } - break; - case 2: - if (!sub_809AC00()) - { - if (ePokemonStorageSystem.unk_11f6) - BoxSetMosaic(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8097078(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PrintStorageActionText(PC_TEXT_IS_SELECTED); - sub_809CE84(); - ePokemonStorageSystem.unk_0004 = 1; - break; - case 1: - switch (sub_809CF30()) - { - case -1: - case 0: - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - break; - case 3: - if (sub_809BE80()) - { - ePokemonStorageSystem.unk_0004 = 2; - } - else - { - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(sub_80972A8); - } - break; - case 5: - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(sub_80972FC); - break; - case 4: - if (!sub_809BEBC()) - { - ePokemonStorageSystem.unk_0004 = 2; - } - else - { - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(c3_0808DC50); - } - break; - case 2: - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(sub_8097390); - break; - case 1: - if (sub_809BE80()) - { - ePokemonStorageSystem.unk_0004 = 2; - } - else if (ItemIsMail(ePokemonStorageSystem.unk_11f2)) - { - ePokemonStorageSystem.unk_0004 = 3; - } - else - { - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(sub_809746C); - } - break; - case 7: - if (sub_809BE80()) - { - ePokemonStorageSystem.unk_0004 = 2; - } - else if (ePokemonStorageSystem.unk_11f9) - { - ePokemonStorageSystem.unk_0004 = 4; - } - else if (ItemIsMail(ePokemonStorageSystem.unk_11f2)) - { - ePokemonStorageSystem.unk_0004 = 3; - } - else - { - PlaySE(SE_SELECT); - SetPSSCallback(sub_8097594); - } - break; - case 6: - PlaySE(SE_SELECT); - SetPSSCallback(sub_8097788); - break; - case 8: - PlaySE(SE_SELECT); - SetPSSCallback(sub_80977E4); - break; - } - break; - case 2: - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_LAST_POKE); - ePokemonStorageSystem.unk_0004 = 5; - break; - case 4: - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_CANT_RELEASE_EGG); - ePokemonStorageSystem.unk_0004 = 5; - break; - case 3: - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); - ePokemonStorageSystem.unk_0004 = 5; - break; - case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) - { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_80972A8(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_809B100(0); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_809B130()) - { - if (gUnknown_0203847C) - SetPSSCallback(sub_8097858); - else - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_80972FC(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_809B100(1); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_809B130()) - { - if (gUnknown_0203847C) - SetPSSCallback(sub_8097858); - else - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void c3_0808DC50(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_809B100(2); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_809B130()) - { - BoxSetMosaic(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8097390(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - if (CalculatePlayerPartyCount() == 6) - { - PrintStorageActionText(PC_TEXT_PARTY_FULL); - ePokemonStorageSystem.unk_0004 = 1; - } - else - { - sub_809B0E0(); - sub_809B100(0); - ePokemonStorageSystem.unk_0004 = 2; - } - break; - case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) - { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - } - break; - case 2: - if (!sub_809B130()) - { - sub_809880C(); - ePokemonStorageSystem.unk_0004++; - } - break; - case 3: - if (!sub_8098830()) - { - sub_809B100(1); - ePokemonStorageSystem.unk_0004++; - } - break; - case 4: - if (!sub_809B130()) - { - sub_80987DC(); - ePokemonStorageSystem.unk_0004++; - } - break; - case 5: - SetPSSCallback(sub_8097004); - break; - } -} - -void sub_809746C(void) -{ - u8 r4; - - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); - sub_8096264(&ePokemonStorageSystem.unk_2370, 0x0007, 0xdaca, 3); - sub_809634C(gUnknown_0203847E); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - r4 = sub_8096368(); - if (r4 == 200); - else if (r4 == 201) - { - sub_8098A5C(); - sub_809635C(); - sub_8096310(); - SetPSSCallback(sub_8096C84); - } - else - { - if (sub_809B62C(r4)) - { - sub_8098A5C(); - sub_809635C(); - sub_8096310(); - ePokemonStorageSystem.unk_0004 = 2; - } - else - { - PrintStorageActionText(PC_TEXT_BOX_IS_FULL); - ePokemonStorageSystem.unk_0004 = 4; - } - gUnknown_0203847E = r4; - } - break; - case 2: - party_compaction(); - sub_8099310(); - ePokemonStorageSystem.unk_0004++; - break; - case 3: - if (!sub_8099374()) - { - sub_809B6BC(); - BoxSetMosaic(); - sub_80987DC(); - SetPSSCallback(sub_8096C84); - } - break; - case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); - ePokemonStorageSystem.unk_0004 = 1; - } - break; - } -} - -void sub_8097594(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PrintStorageActionText(PC_TEXT_RELEASE_POKE); - sub_8098A38(1); - ePokemonStorageSystem.unk_0004++; - // fallthrough - case 1: - switch (ProcessMenuInputNoWrap()) - { - case -1: - case 1: - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - break; - case 0: - sub_8098A5C(); - sub_809B7D4(); - sub_809B6DC(); - ePokemonStorageSystem.unk_0004++; - break; - } - break; - case 2: - sub_809B960(); - if (!sub_809B734()) - { - while (1) - { - s8 r0 = sub_809B960(); - if (r0 == 1) - { - ePokemonStorageSystem.unk_0004++; - break; - } - if (r0 == 0) - { - ePokemonStorageSystem.unk_0004 = 8; - break; - } - } - } - break; - case 3: - sub_809B760(); - sub_809801C(); - PrintStorageActionText(PC_TEXT_WAS_RELEASED); - ePokemonStorageSystem.unk_0004++; - break; - case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - PrintStorageActionText(PC_TEXT_BYE_BYE); - ePokemonStorageSystem.unk_0004++; - } - break; - case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - sub_8098A5C(); - if (gUnknown_0203847C) - { - party_compaction(); - sub_8099310(); - ePokemonStorageSystem.unk_0004++; - } - else - { - ePokemonStorageSystem.unk_0004 = 7; - } - } - break; - case 6: - if (!sub_8099374()) - { - sub_809B440(); - BoxSetMosaic(); - sub_80987DC(); - ePokemonStorageSystem.unk_0004++; - } - break; - case 7: - SetPSSCallback(sub_8096C84); - break; - case 8: - PrintStorageActionText(PC_TEXT_WAS_RELEASED); - ePokemonStorageSystem.unk_0004++; - break; - case 9: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - PrintStorageActionText(PC_TEXT_SURPRISE); - ePokemonStorageSystem.unk_0004++; - } - break; - case 10: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - sub_8098A5C(); - sub_8099958(); - ePokemonStorageSystem.unk_0004++; - } - break; - case 11: - if (!sub_8099990()) - { - sub_809B7AC(); - PrintStorageActionText(PC_TEXT_CAME_BACK); - ePokemonStorageSystem.unk_0004++; - } - break; - case 12: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - PrintStorageActionText(PC_TEXT_WORRIED); - ePokemonStorageSystem.unk_0004++; - } - break; - case 13: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8097788(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_809BC18(); - BeginNormalPaletteFade(0xffffffff, 0, 0, 16, 0); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!UpdatePaletteFade()) - { - gUnknown_0203847F = 0; - ePokemonStorageSystem.unk_0006 = 0; - SetMainCallback2(sub_8096B5C); - } - break; - } -} - -void sub_80977E4(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PrintStorageActionText(PC_TEXT_MARK_POKE); - ePokemonStorageSystem.unk_12bc.markings = ePokemonStorageSystem.unk_11f7; - sub_80F7418(ePokemonStorageSystem.unk_11f7, 0xb0, 0x10); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_80F7500()) - { - sub_80F7470(); - sub_8098A5C(); - sub_809BDD8(ePokemonStorageSystem.unk_12bc.markings); - sub_809801C(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8097858(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - party_compaction(); - sub_8099310(); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!sub_8099374()) - { - sub_80987DC(); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_809789C(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); - sub_809CE84(); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - switch (sub_809CF30()) - { - case -1: - case 0: - sub_809A860(1); - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - break; - case 11: - PlaySE(SE_SELECT); - SetPSSCallback(sub_8097B44); - break; - case 10: - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(sub_8097974); - break; - case 9: - PlaySE(SE_SELECT); - sub_8098A5C(); - SetPSSCallback(sub_8097A64); - break; - } - break; - } -} - -void sub_8097974(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_8098A80(); - PrintStorageActionText(PC_TEXT_PICK_A_THEME); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - ePokemonStorageSystem.unk_0d5e = sub_809CF30(); - switch (ePokemonStorageSystem.unk_0d5e) - { - case -1: - sub_809A860(1); - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - break; - case 12 ... 15: - PlaySE(SE_SELECT); - ePokemonStorageSystem.unk_0d5e -= 12; - sub_8098AA8(ePokemonStorageSystem.unk_0d5e); - PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); - ePokemonStorageSystem.unk_0004++; - break; - } - break; - case 2: - ePokemonStorageSystem.unk_0d60 = sub_809CF30(); - switch (ePokemonStorageSystem.unk_0d60) - { - case -1: - sub_8098A5C(); - ePokemonStorageSystem.unk_0004 = 0; - break; - case -2: - break; - default: - PlaySE(SE_SELECT); - sub_8098A5C(); - ePokemonStorageSystem.unk_0d60 -= 16; - sub_8099DCC(ePokemonStorageSystem.unk_0d60); - ePokemonStorageSystem.unk_0004++; - break; - } - break; - case 3: - if (!sub_8099E08()) - { - sub_809A860(1); - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8097A64(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX); - sub_8096264(&ePokemonStorageSystem.unk_2370, 0x0007, 0xdaca, 3); - sub_809634C(gPokemonStorage.currentBox); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - ePokemonStorageSystem.unk_08b2 = sub_8096368(); - switch (ePokemonStorageSystem.unk_08b2) - { - case 200: - break; - default: - sub_8098A5C(); - sub_809635C(); - sub_8096310(); - if (ePokemonStorageSystem.unk_08b2 == 201 || ePokemonStorageSystem.unk_08b2 == gPokemonStorage.currentBox) - { - sub_809A860(1); - SetPSSCallback(sub_8096C84); - } - else - { - ePokemonStorageSystem.unk_0004++; - } - break; - } - break; - case 2: - sub_8099C70(ePokemonStorageSystem.unk_08b2); - ePokemonStorageSystem.unk_0004++; - break; - case 3: - if (!sub_8099D34()) - { - gPokemonStorage.currentBox = ePokemonStorageSystem.unk_08b2; - SetPSSCallback(sub_8096C84); - } - break; - } -} - -void sub_8097B44(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - sub_809BB90(); - BeginNormalPaletteFade(0xffffffff, 0, 0, 16, 0); - ePokemonStorageSystem.unk_0004++; - break; - case 1: - if (!UpdatePaletteFade()) - { - gUnknown_0203847F = 1; - ePokemonStorageSystem.unk_0006 = 1; - SetMainCallback2(sub_8096B5C); - } - break; - } -} - -void sub_8097BA0(void) -{ - switch (ePokemonStorageSystem.unk_0004) - { - case 0: - if (sub_809BF20()) - { - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_HOLDING_POKE); - ePokemonStorageSystem.unk_0004 = 1; - } - else - { - PlaySE(SE_SELECT); - PrintStorageActionText(PC_TEXT_EXIT_BOX); - sub_8098A38(0); - ePokemonStorageSystem.unk_0004 = 2; - } - break; - case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) - { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - } - break; - case 2: - switch (ProcessMenuInputNoWrap()) - { - case 1: - case -1: - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - break; - case 0: - PlaySE(SE_PC_OFF); - sub_8098A5C(); - ePokemonStorageSystem.unk_0004++; - break; - } - break; - case 3: - ePokemonStorageSystem.unk_000c.tileTag = 0x000e; - ePokemonStorageSystem.unk_000c.paletteTag = 0xdad0; - ePokemonStorageSystem.unk_000c.unk04 = 20; - ePokemonStorageSystem.unk_000c.unk06 = 0; - sub_80C5E38(&ePokemonStorageSystem.unk_000c); - ePokemonStorageSystem.unk_0004++; - break; - case 4: - if (sub_80C5F98()) - { - gPlayerPartyCount = CalculatePlayerPartyCount(); - SetMainCallback2(sub_80961A8); - } - break; - } -} - -void sub_8097CC0(void) { - switch (ePokemonStorageSystem.unk_0004) { - case 0: - if (sub_809BF20()) { - PlaySE(SE_HAZURE); - PrintStorageActionText(PC_TEXT_HOLDING_POKE); - ePokemonStorageSystem.unk_0004 = 1; - } - else { - PlaySE(SE_SELECT); - PrintStorageActionText(PC_TEXT_CONTINUE_BOX); - sub_8098A38(0); - ePokemonStorageSystem.unk_0004 = 2; - } - break; - case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - } - break; - case 2: - switch (ProcessMenuInputNoWrap()) { - case 0: - sub_8098A5C(); - SetPSSCallback(sub_8096C84); - break; - case -1: - case 1: - PlaySE(SE_PC_OFF); - sub_8098A5C(); - ePokemonStorageSystem.unk_0004++; - break; - } - break; - case 3: - ePokemonStorageSystem.unk_000c.tileTag = 0x000e; - ePokemonStorageSystem.unk_000c.paletteTag = 0xdad0; - ePokemonStorageSystem.unk_000c.unk04 = 20; - ePokemonStorageSystem.unk_000c.unk06 = 0; - sub_80C5E38(&ePokemonStorageSystem.unk_000c); - ePokemonStorageSystem.unk_0004++; - break; - case 4: - if (sub_80C5F98()) { - gPlayerPartyCount = CalculatePlayerPartyCount(); - SetMainCallback2(sub_80961A8); - } - break; - } -} - -void sub_8097DE0(void) -{ - ePokemonStorageSystem.unk_0007 = 0; - ePokemonStorageSystem.unk_0008 = 0; - ePokemonStorageSystem.unk_000a = 0; - REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_SCREENBASE(30); - DmaCopy16Defvars(3, gPokemonStorageScrollingBGTile, BG_SCREEN_ADDR(28), sizeof gPokemonStorageScrollingBGTile); - LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, BG_SCREEN_ADDR(30)); - LoadPalette(gPokemonStorageScrollingBGPalette, 0xd0, 0x10); -} - -asm(".section .text.8098898"); - -void PrintStorageActionText(u8 index) { - u8 *ptr; - - MenuDrawTextWindow(10, 16, 29, 19); - - switch (gPCStorageActionTexts[index].format) - { - - case PC_TEXT_FMT_UNK_02: - ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); - ptr = StringCopy(ptr, ePokemonStorageSystem.unk_11fa); - break; - - case PC_TEXT_FMT_UNK_05: - ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); - ptr = StringCopy(ptr, ePokemonStorageSystem.unk_26e4); - break; - - case PC_TEXT_FMT_MON_NAME: - // {var} + " is selected." - ptr = StringCopy(ePokemonStorageSystem.unk_2694, ePokemonStorageSystem.unk_11fa); - ptr = StringCopy(ptr, gPCStorageActionTexts[index].text); - break; - - case PC_TEXT_FMT_MON_NAME_2: - // {var} + " was released." - ptr = StringCopy(ePokemonStorageSystem.unk_2694, ePokemonStorageSystem.unk_26e4); -#if ENGLISH - ptr = StringCopy(ptr, gPCStorageActionTexts[index].text); -#elif GERMAN - ptr = de_sub_8073174(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); -#endif - break; - - case PC_TEXT_FMT_UNK_03: - { - u8 *stringLength; - u8 *text; - - text = gPCStorageActionTexts[index].text; - stringLength = &text[StringLength(text)] + 1; - - ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); - ptr = StringCopy(ptr, ePokemonStorageSystem.unk_11fa); - ptr = StringCopy(ptr, stringLength); - } - break; - - case PC_TEXT_FMT_MON_NAME_AFTER_EXCL_MARK: - // "Bye-bye, ".substr(0, -1) + {var} + "Bye-bye, !".substr(-1, 1) - { - u8 *stringLength; - u8 *text; - - text = gPCStorageActionTexts[index].text; - stringLength = &text[StringLength(text)] - 1; - - ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); - ptr = StringCopy(ptr - 1, ePokemonStorageSystem.unk_26e4); - ptr = StringCopy(ptr, stringLength); - } - break; - - case PC_TEXT_FMT_NORMAL: - default: - ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); - break; - } - - while (ptr < ePokemonStorageSystem.unk_26a6) - { - ptr[0] = CHAR_SPACE; - ptr++; - } - - ptr[0] = EOS; - MenuPrint(ePokemonStorageSystem.unk_2694, 11, 17); -} diff --git a/src/pokemon/pokemon_storage_system_2.c b/src/pokemon/pokemon_storage_system_2.c new file mode 100644 index 000000000..5c72d02e9 --- /dev/null +++ b/src/pokemon/pokemon_storage_system_2.c @@ -0,0 +1,1566 @@ + +// Includes +#include "global.h" +#include "constants/songs.h" +#include "sound.h" +#include "ewram.h" +#include "task.h" +#include "main.h" +#include "palette.h" +#include "menu.h" +#include "graphics.h" +#include "strings.h" +#include "string_util.h" +#include "pokemon_summary_screen.h" +#include "mail_data.h" +#include "naming_screen.h" +#include "pokemon_storage_system.h" + +// Static type declarations + +// Static RAM declarations + +EWRAM_DATA u8 gUnknown_0203847C = 0; +EWRAM_DATA u8 gUnknown_0203847D = 0; +EWRAM_DATA u8 gUnknown_0203847E = 0; +EWRAM_DATA u8 gUnknown_0203847F = 0; +EWRAM_DATA struct Pokemon gUnknown_02038480 = {}; +EWRAM_DATA u8 gUnknown_020384E4 = 0; +EWRAM_DATA u8 gUnknown_020384E5 = 0; +EWRAM_DATA u8 gUnknown_020384E6 = 0; +EWRAM_DATA u8 gUnknown_020384E7 = 0; +EWRAM_DATA u8 gUnknown_020384E8 = 0; +EWRAM_DATA u8 gUnknown_020384E9 = 0; +EWRAM_DATA u16 gUnknown_020384EA = 0; +EWRAM_DATA u32 gUnknown_020384EC = 0; + +// Static ROM declarations + +void sub_8096884(void); +void sub_8096AFC(void); +void sub_8096B38(void); +void SetPSSCallback(void (*func)(void)); +void sub_8096BF0(void); +void sub_8096C68(void); +void sub_8096C84(void); +void sub_8096FC8(void); +void sub_8097004(void); +void sub_8097078(void); +void sub_80972A8(void); +void sub_80972FC(void); +void c3_0808DC50(void); +void sub_8097390(void); +void sub_809746C(void); +void sub_8097594(void); +void sub_8097788(void); +void sub_80977E4(void); +void sub_8097858(void); +void sub_809789C(void); +void sub_8097974(void); +void sub_8097A64(void); +void sub_8097B44(void); +void sub_8097BA0(void); +void sub_8097CC0(void); +void sub_8097DE0(void); +void sub_8097E44(void); +void sub_8097E70(void); +void sub_8097F58(void); +void sub_8097FB8(void); +void BoxSetMosaic(void); +void sub_809801C(void); +void sub_80980D4(void); +void sub_8098400(void); +void add_to_c3_somehow(void); +bool8 sub_80985CC(void); +void sub_80986E8(void); +void sub_8098710(void); +void sub_8098734(void); +void sub_80987DC(void); +void sub_809880C(void); +bool8 sub_8098830(void); +void PrintStorageActionText(u8 index); +void sub_8098A38(u8); +void sub_8098A5C(void); +void sub_8098A80(void); +void sub_8098AA8(u8 a0); +void sub_8098B48(void); +void sub_8099310(void); +bool8 sub_8099374(void); +void sub_8099958(void); +bool8 sub_8099990(void); +void sub_809BB90(void); +void sub_8099BF8(u8 a0); +void sub_8099C70(u8 whichBox); +bool8 sub_8099D34(void); +void sub_8099DCC(u8 a0); +bool8 sub_8099E08(void); +void sub_809A860(u8 a0); +void sub_809AA24(void); +void sub_809AA98(void); +bool8 sub_809AC00(void); +void sub_809B0C0(u8 a0); +void sub_809B0D4(void); +void sub_809B0E0(void); +u8 sub_809B0F4(void); +void sub_809B100(u8 a0); +bool8 sub_809B130(void); +void sub_809B440(void); +bool8 sub_809B62C(u8); +void sub_809B6BC(void); +void sub_809B6DC(void); +bool8 sub_809B734(void); +void sub_809B760(void); +void sub_809B7AC(void); +void sub_809B7D4(void); +s8 sub_809B960(void); +void sub_809BBC0(void); +void sub_809BC18(void); +void sub_809BD14(void); +void sub_809BDD8(u8 markings); +bool8 sub_809BE80(void); +bool8 sub_809BEBC(void); +bool8 sub_809BF20(void); +bool8 sub_809BF48(void); +u8 sub_809CA40(void); +void sub_809CE84(void); +s16 sub_809CF30(void); +void sub_809CFDC(struct UnkStruct_2000020 *a0, struct UnkStruct_2000020 *a1, u8 a2); +void sub_809CFF0(void); +void sub_809D034(void *dest, u16 dLeft, u16 dTop, const void *src, u16 sLeft, u16 sTop, u16 width, u16 height); + +// .rodata + +const u16 gPokemonStorageScrollingBGPalette[] = INCBIN_U16("graphics/pokemon_storage/scrolling_bg.gbapal"); + +const u16 gPokemonStorageScrollingBGTile[] = INCBIN_U16("graphics/pokemon_storage/scrolling_bg.4bpp"); + +const u8 gPokemonStorageScrollingBGTilemap[] = INCBIN_U8("graphics/pokemon_storage/scrolling_bg_map.bin.lz"); + +const u16 sUnknownTilemap[] = { + 0x1281, + 0x1282, + 0x1283, + 0x1284, + 0x1285, + 0x1286, + 0x1287, + 0x1288, + 0x128C, + 0x128D, + 0x128E, + 0x128F, + 0x1290, + 0x1291, + 0x1292, + 0x1293, + 0x0281, + 0x0282, + 0x0283, + 0x0284, + 0x0285, + 0x0286, + 0x0287, + 0x0288, + 0x028C, + 0x028D, + 0x028E, + 0x028F, + 0x0290, + 0x0291, + 0x0292, + 0x0293, + 0x12AD, + 0x12AE, + 0x12A8, + 0x12A8 +}; + +const u16 WaveformPalette[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal"); + +const u8 WaveformTiles[] = INCBIN_U8("graphics/pokemon_storage/waveform.4bpp"); + +const u16 gUnknown_083B6D74[] = INCBIN_U16("graphics/pokemon_storage/83B6D74.gbapal"); + +const u16 gUnknown_083B6D94[] = INCBIN_U16("graphics/pokemon_storage/83B6D94.gbapal"); + +struct PokemonStorageSystemData *const gPokemonStorageSystemPtr = &ePokemonStorageSystem; + +u8 *const gUnknown_083B6DB8 = gTileBuffer; + +const struct SpritePalette gWaveformSpritePalette = { + WaveformPalette, 0xdacd +}; + +const struct SpriteSheet gWaveformSpriteSheet = { + WaveformTiles, 0x1c0, 0x0005 +}; + +const struct SpriteSheet gUnknown_083B6DCC = { + ePokemonStorageSystem.unk_2784, 0x800, 0x0002 +}; + +const struct SpritePalette gUnknown_083B6DD4 = { + ePokemonStorageSystem.unk_2704, 0xdac7 +}; + +const struct OamData gOamData_83B6EAC; + +const struct SpriteTemplate gSpriteTemplate_83B6DDC = { + 0x0002, 0xdac7, &gOamData_83B6EAC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +}; + +const struct StorageAction gPCStorageActionTexts[] = { + {PCText_ExitBox, 0}, + {PCText_WhatYouDo, 0}, + {PCText_PickATheme, 0}, + {PCText_PickAWallpaper, 0}, + {PCText_IsSelected, 1}, + {PCText_JumpToWhichBox, 0}, + {PCText_DepositInWhichBox, 0}, + {PCText_WasDeposited, 1}, + {PCText_BoxIsFull, 0}, + {PCText_ReleasePoke, 0}, + {PCText_WasReleased, 4}, + {PCText_ByeBye, 6}, + {PCText_MarkPoke, 0}, + {PCText_LastPoke, 0}, + {PCText_PartyFull, 0}, + {PCText_HoldingPoke, 0}, + {PCText_WhichOneWillTake, 0}, + {PCText_CantReleaseEgg, 0}, + {PCText_ContinueBox, 0}, + {PCText_CameBack, 1}, + {PCText_Worried, 0}, + {PCText_Surprise, 0}, + {PCText_PleaseRemoveMail, 0} +}; + +// .text + + +void task_intro_29(u8 whichMenu) +{ + gUnknown_0203847D = whichMenu; + gPokemonStorageSystemPtr->unk_0005 = whichMenu; + SetMainCallback2(sub_8096884); +} + +void sub_80967DC(void) +{ + REG_BG0HOFS = 0; + REG_BG0VOFS = 0; + REG_BG1HOFS = 0; + REG_BG1VOFS = 0; + REG_BG2VOFS = 0; + REG_BG2HOFS = 0; + REG_BG3HOFS = 0; + REG_BG3VOFS = 0; +} + +void sub_8096804(void) +{ + ResetPaletteFade(); + ResetSpriteData(); + FreeSpriteTileRanges(); + FreeAllSpritePalettes(); + ResetTasks(); + gReservedSpriteTileCount = 0x280; + sub_809CFDC(gPokemonStorageSystemPtr->unk_0020, gPokemonStorageSystemPtr->unk_0020 + 1, 8); + gKeyRepeatStartDelay = 20; +} + +void sub_8096848(void) +{ + sub_809B0D4(); + gUnknown_0203847C = (gPokemonStorageSystemPtr->unk_0005 == 1 ? 1 : 0); + gUnknown_0203847E = 0; +} + +void sub_8096874(void) +{ + REG_DISPCNT = DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON; +} + +void sub_8096884(void) +{ + switch (gMain.state) + { + case 0: + SetVBlankCallback(NULL); + REG_DISPCNT = 0; + sub_8096804(); + gMain.state++; + break; + case 1: + SetUpWindowConfig(&gWindowConfig_81E6D00); + gMain.state++; + break; + case 2: + InitMenuWindow(&gWindowConfig_81E6D00); + MenuZeroFillScreen(); + gMain.state++; + break; + case 3: + sub_80967DC(); + sub_8096848(); + gMain.state++; + break; + case 4: + sub_8098B48(); + sub_809AA24(); + gMain.state++; + break; + case 5: + sub_8097DE0(); + gMain.state++; + break; + case 6: + sub_8097E70(); + gMain.state++; + break; + case 7: + sub_8098400(); + gMain.state++; + break; + case 8: + sub_8099BF8(gPokemonStorage.currentBox); + gPokemonStorageSystemPtr->unk_12bc.baseTileTag = 0x000a; + gPokemonStorageSystemPtr->unk_12bc.basePaletteTag = 0xdacb; + sub_80F727C(&gPokemonStorageSystemPtr->unk_12bc); + sub_80F7404(); + gMain.state++; + break; + case 9: + sub_8096874(); + SetPSSCallback(sub_8096BF0); + SetMainCallback2(sub_8096B38); + SetVBlankCallback(sub_8096AFC); + gMain.state++; + break; + } +} + +void sub_80969A0(void) +{ + switch (gMain.state) + { + case 0: + SetVBlankCallback(NULL); + REG_DISPCNT = 0x0000; + gPokemonStorageSystemPtr->unk_0005 = gUnknown_0203847D; + sub_8096804(); + if (gUnknown_0203847F == 1) + sub_809BBC0(); + if (gUnknown_0203847F == 0) + sub_809BD14(); + gMain.state++; + break; + case 1: + SetUpWindowConfig(&gWindowConfig_81E6D00); + gMain.state++; + break; + case 2: + InitMenuWindow(&gWindowConfig_81E6D00); + MenuZeroFillScreen(); + gMain.state++; + break; + case 3: + sub_80967DC(); + gMain.state++; + break; + case 4: + sub_8098B48(); + sub_809AA98(); + gMain.state++; + break; + case 5: + sub_8097DE0(); + gMain.state++; + break; + case 6: + sub_8097E70(); + gMain.state++; + break; + case 7: + sub_8098400(); + gMain.state++; + break; + case 8: + sub_8099BF8(gPokemonStorage.currentBox); + gPokemonStorageSystemPtr->unk_12bc.baseTileTag = 0x000a; + gPokemonStorageSystemPtr->unk_12bc.basePaletteTag = 0xdacb; + sub_80F727C(&gPokemonStorageSystemPtr->unk_12bc); + sub_80F7404(); + gMain.state++; + break; + case 9: + BeginNormalPaletteFade(0xffffffff, 0, 16, 0, 0); + SetVBlankCallback(sub_8096AFC); + gMain.state++; + break; + case 10: + sub_8096874(); + SetPSSCallback(sub_8096C68); + SetMainCallback2(sub_8096B38); + gMain.state++; + break; + } +} + +void sub_8096AFC(void) +{ + REG_BG2HOFS = gPokemonStorageSystemPtr->unk_08b4; + REG_BG3HOFS = gPokemonStorageSystemPtr->unk_000a; + REG_BG3VOFS = gPokemonStorageSystemPtr->unk_0008; + LoadOam(); + ProcessSpriteCopyRequests(); + sub_809CFF0(); + TransferPlttBuffer(); +} + +void sub_8096B38(void) +{ + gPokemonStorageSystemPtr->unk_0000(); + sub_8097E44(); + sub_8098734(); + AnimateSprites(); + BuildOamBuffer(); +} + +void sub_8096B5C(void) +{ + switch (gPokemonStorageSystemPtr->unk_0006) + { + case 0: + ShowPokemonSummaryScreen(gPokemonStorageSystemPtr->unk_2690, gPokemonStorageSystemPtr->unk_268d, gPokemonStorageSystemPtr->unk_268c, sub_80969A0, gPokemonStorageSystemPtr->unk_268e); + break; + case 1: + DoNamingScreen(1, gPokemonStorage.boxNames[gPokemonStorage.currentBox], 0, 0, 0, sub_80969A0); + break; + } +} + +void SetPSSCallback(void (*func)(void)) +{ + gPokemonStorageSystemPtr->unk_0000 = func; + gPokemonStorageSystemPtr->unk_0004 = 0; +} + +void sub_8096BF0(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + BlendPalettes(0xffffffff, 16, 0); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + PlaySE(SE_PC_LOGON); + gPokemonStorageSystemPtr->unk_000c.tileTag = 14; + gPokemonStorageSystemPtr->unk_000c.paletteTag = 0xdad0; + gPokemonStorageSystemPtr->unk_000c.unk04 = 0; + gPokemonStorageSystemPtr->unk_000c.unk06 = 0; + sub_80C5CD4(&gPokemonStorageSystemPtr->unk_000c); + BlendPalettes(0xffffffff, 0, 0); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 2: + if (sub_80C5DCC()) + SetPSSCallback(sub_8096C84); + break; + } +} + +void sub_8096C68(void) +{ + if (!UpdatePaletteFade()) + SetPSSCallback(sub_8096C84); +} + +void sub_8096C84(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + switch (sub_809CA40()) + { + case 1: + PlaySE(SE_SELECT); + gPokemonStorageSystemPtr->unk_0004 = 1; + break; + case 5: + if (gPokemonStorageSystemPtr->unk_0005 != 2) + { + PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); + gPokemonStorageSystemPtr->unk_0004 = 3; + } + else + { + sub_809B0D4(); + SetPSSCallback(sub_8096FC8); + } + break; + case 6: + if (gPokemonStorageSystemPtr->unk_0005 == 2) + { + if (sub_809BF20() && ItemIsMail(gPokemonStorageSystemPtr->unk_11f2)) + { + gPokemonStorageSystemPtr->unk_0004 = 5; + } + else + { + SetPSSCallback(sub_8097004); + } + } + break; + case 4: + SetPSSCallback(sub_8097BA0); + break; + case 16: + SetPSSCallback(sub_8097CC0); + break; + case 7: + PlaySE(SE_SELECT); + SetPSSCallback(sub_809789C); + break; + case 8: + PlaySE(SE_SELECT); + SetPSSCallback(sub_8097078); + break; + case 9: + PlaySE(SE_SELECT); + gPokemonStorageSystemPtr->unk_08b2 = gPokemonStorage.currentBox + 1; + if (gPokemonStorageSystemPtr->unk_08b2 > 13) + gPokemonStorageSystemPtr->unk_08b2 = 0; + sub_8099C70(gPokemonStorageSystemPtr->unk_08b2); + gPokemonStorageSystemPtr->unk_0004 = 2; + break; + case 10: + PlaySE(SE_SELECT); + gPokemonStorageSystemPtr->unk_08b2 = gPokemonStorage.currentBox - 1; + if (gPokemonStorageSystemPtr->unk_08b2 < 0) + gPokemonStorageSystemPtr->unk_08b2 = 13; + sub_8099C70(gPokemonStorageSystemPtr->unk_08b2); + gPokemonStorageSystemPtr->unk_0004 = 2; + break; + case 11: + if (!sub_809BE80()) + { + if (ItemIsMail(gPokemonStorageSystemPtr->unk_11f2)) + { + gPokemonStorageSystemPtr->unk_0004 = 5; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(sub_809746C); + } + } + else + { + gPokemonStorageSystemPtr->unk_0004 = 4; + } + break; + case 13: + if (sub_809BE80()) + { + gPokemonStorageSystemPtr->unk_0004 = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(sub_80972A8); + } + break; + case 14: + if (!sub_809BEBC()) + { + gPokemonStorageSystemPtr->unk_0004 = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(c3_0808DC50); + } + break; + case 12: + PlaySE(SE_SELECT); + SetPSSCallback(sub_8097390); + break; + case 15: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80972FC); + break; + } + break; + case 1: + if (!sub_809AC00()) + { + if (sub_809BF48()) + sub_80986E8(); + else + sub_8098710(); + if (gPokemonStorageSystemPtr->unk_11f6) + BoxSetMosaic(); + gPokemonStorageSystemPtr->unk_0004 = 0; + } + break; + case 2: + if (!sub_8099D34()) + { + gPokemonStorage.currentBox = gPokemonStorageSystemPtr->unk_08b2; + if (!gUnknown_0203847C && !sub_809BF20()) + { + sub_809B440(); + BoxSetMosaic(); + } + gPokemonStorageSystemPtr->unk_0004 = 0; + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + sub_8098A5C(); + gPokemonStorageSystemPtr->unk_0004 = 0; + } + break; + case 4: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_LAST_POKE); + gPokemonStorageSystemPtr->unk_0004 = 6; + break; + case 5: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); + gPokemonStorageSystemPtr->unk_0004 = 6; + break; + case 6: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8096FC8(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_809880C(); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_8098830()) + SetPSSCallback(sub_8096C84); + break; + } +} + +void sub_8097004(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PlaySE(SE_SELECT); + add_to_c3_somehow(); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_80985CC()) + { + sub_809B0C0(sub_809B0F4()); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 2: + if (!sub_809AC00()) + { + if (gPokemonStorageSystemPtr->unk_11f6) + BoxSetMosaic(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8097078(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PrintStorageActionText(PC_TEXT_IS_SELECTED); + sub_809CE84(); + gPokemonStorageSystemPtr->unk_0004 = 1; + break; + case 1: + switch (sub_809CF30()) + { + case -1: + case 0: + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case 3: + if (sub_809BE80()) + { + gPokemonStorageSystemPtr->unk_0004 = 2; + } + else + { + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(sub_80972A8); + } + break; + case 5: + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(sub_80972FC); + break; + case 4: + if (!sub_809BEBC()) + { + gPokemonStorageSystemPtr->unk_0004 = 2; + } + else + { + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(c3_0808DC50); + } + break; + case 2: + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(sub_8097390); + break; + case 1: + if (sub_809BE80()) + { + gPokemonStorageSystemPtr->unk_0004 = 2; + } + else if (ItemIsMail(gPokemonStorageSystemPtr->unk_11f2)) + { + gPokemonStorageSystemPtr->unk_0004 = 3; + } + else + { + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(sub_809746C); + } + break; + case 7: + if (sub_809BE80()) + { + gPokemonStorageSystemPtr->unk_0004 = 2; + } + else if (gPokemonStorageSystemPtr->unk_11f9) + { + gPokemonStorageSystemPtr->unk_0004 = 4; + } + else if (ItemIsMail(gPokemonStorageSystemPtr->unk_11f2)) + { + gPokemonStorageSystemPtr->unk_0004 = 3; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(sub_8097594); + } + break; + case 6: + PlaySE(SE_SELECT); + SetPSSCallback(sub_8097788); + break; + case 8: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80977E4); + break; + } + break; + case 2: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_LAST_POKE); + gPokemonStorageSystemPtr->unk_0004 = 5; + break; + case 4: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_CANT_RELEASE_EGG); + gPokemonStorageSystemPtr->unk_0004 = 5; + break; + case 3: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); + gPokemonStorageSystemPtr->unk_0004 = 5; + break; + case 5: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_80972A8(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_809B100(0); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_809B130()) + { + if (gUnknown_0203847C) + SetPSSCallback(sub_8097858); + else + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_80972FC(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_809B100(1); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_809B130()) + { + if (gUnknown_0203847C) + SetPSSCallback(sub_8097858); + else + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void c3_0808DC50(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_809B100(2); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_809B130()) + { + BoxSetMosaic(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8097390(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + if (CalculatePlayerPartyCount() == 6) + { + PrintStorageActionText(PC_TEXT_PARTY_FULL); + gPokemonStorageSystemPtr->unk_0004 = 1; + } + else + { + sub_809B0E0(); + sub_809B100(0); + gPokemonStorageSystemPtr->unk_0004 = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + case 2: + if (!sub_809B130()) + { + sub_809880C(); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 3: + if (!sub_8098830()) + { + sub_809B100(1); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 4: + if (!sub_809B130()) + { + sub_80987DC(); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 5: + SetPSSCallback(sub_8097004); + break; + } +} + +void sub_809746C(void) +{ + u8 r4; + + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); + sub_8096264(&gPokemonStorageSystemPtr->unk_2370, 0x0007, 0xdaca, 3); + sub_809634C(gUnknown_0203847E); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + r4 = sub_8096368(); + if (r4 == 200); + else if (r4 == 201) + { + sub_8098A5C(); + sub_809635C(); + sub_8096310(); + SetPSSCallback(sub_8096C84); + } + else + { + if (sub_809B62C(r4)) + { + sub_8098A5C(); + sub_809635C(); + sub_8096310(); + gPokemonStorageSystemPtr->unk_0004 = 2; + } + else + { + PrintStorageActionText(PC_TEXT_BOX_IS_FULL); + gPokemonStorageSystemPtr->unk_0004 = 4; + } + gUnknown_0203847E = r4; + } + break; + case 2: + party_compaction(); + sub_8099310(); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 3: + if (!sub_8099374()) + { + sub_809B6BC(); + BoxSetMosaic(); + sub_80987DC(); + SetPSSCallback(sub_8096C84); + } + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); + gPokemonStorageSystemPtr->unk_0004 = 1; + } + break; + } +} + +void sub_8097594(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PrintStorageActionText(PC_TEXT_RELEASE_POKE); + sub_8098A38(1); + gPokemonStorageSystemPtr->unk_0004++; + // fallthrough + case 1: + switch (ProcessMenuInputNoWrap()) + { + case -1: + case 1: + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case 0: + sub_8098A5C(); + sub_809B7D4(); + sub_809B6DC(); + gPokemonStorageSystemPtr->unk_0004++; + break; + } + break; + case 2: + sub_809B960(); + if (!sub_809B734()) + { + while (1) + { + s8 r0 = sub_809B960(); + if (r0 == 1) + { + gPokemonStorageSystemPtr->unk_0004++; + break; + } + if (r0 == 0) + { + gPokemonStorageSystemPtr->unk_0004 = 8; + break; + } + } + } + break; + case 3: + sub_809B760(); + sub_809801C(); + PrintStorageActionText(PC_TEXT_WAS_RELEASED); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PrintStorageActionText(PC_TEXT_BYE_BYE); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 5: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_8098A5C(); + if (gUnknown_0203847C) + { + party_compaction(); + sub_8099310(); + gPokemonStorageSystemPtr->unk_0004++; + } + else + { + gPokemonStorageSystemPtr->unk_0004 = 7; + } + } + break; + case 6: + if (!sub_8099374()) + { + sub_809B440(); + BoxSetMosaic(); + sub_80987DC(); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 7: + SetPSSCallback(sub_8096C84); + break; + case 8: + PrintStorageActionText(PC_TEXT_WAS_RELEASED); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 9: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PrintStorageActionText(PC_TEXT_SURPRISE); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 10: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_8098A5C(); + sub_8099958(); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 11: + if (!sub_8099990()) + { + sub_809B7AC(); + PrintStorageActionText(PC_TEXT_CAME_BACK); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 12: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PrintStorageActionText(PC_TEXT_WORRIED); + gPokemonStorageSystemPtr->unk_0004++; + } + break; + case 13: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8097788(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_809BC18(); + BeginNormalPaletteFade(0xffffffff, 0, 0, 16, 0); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!UpdatePaletteFade()) + { + gUnknown_0203847F = 0; + gPokemonStorageSystemPtr->unk_0006 = 0; + SetMainCallback2(sub_8096B5C); + } + break; + } +} + +void sub_80977E4(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PrintStorageActionText(PC_TEXT_MARK_POKE); + gPokemonStorageSystemPtr->unk_12bc.markings = gPokemonStorageSystemPtr->unk_11f7; + sub_80F7418(gPokemonStorageSystemPtr->unk_11f7, 0xb0, 0x10); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_80F7500()) + { + sub_80F7470(); + sub_8098A5C(); + sub_809BDD8(gPokemonStorageSystemPtr->unk_12bc.markings); + sub_809801C(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8097858(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + party_compaction(); + sub_8099310(); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!sub_8099374()) + { + sub_80987DC(); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_809789C(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); + sub_809CE84(); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + switch (sub_809CF30()) + { + case -1: + case 0: + sub_809A860(1); + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case 11: + PlaySE(SE_SELECT); + SetPSSCallback(sub_8097B44); + break; + case 10: + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(sub_8097974); + break; + case 9: + PlaySE(SE_SELECT); + sub_8098A5C(); + SetPSSCallback(sub_8097A64); + break; + } + break; + } +} + +void sub_8097974(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_8098A80(); + PrintStorageActionText(PC_TEXT_PICK_A_THEME); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + gPokemonStorageSystemPtr->unk_0d5e = sub_809CF30(); + switch (gPokemonStorageSystemPtr->unk_0d5e) + { + case -1: + sub_809A860(1); + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case 12 ... 15: + PlaySE(SE_SELECT); + gPokemonStorageSystemPtr->unk_0d5e -= 12; + sub_8098AA8(gPokemonStorageSystemPtr->unk_0d5e); + PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); + gPokemonStorageSystemPtr->unk_0004++; + break; + } + break; + case 2: + gPokemonStorageSystemPtr->unk_0d60 = sub_809CF30(); + switch (gPokemonStorageSystemPtr->unk_0d60) + { + case -1: + sub_8098A5C(); + gPokemonStorageSystemPtr->unk_0004 = 0; + break; + case -2: + break; + default: + PlaySE(SE_SELECT); + sub_8098A5C(); + gPokemonStorageSystemPtr->unk_0d60 -= 16; + sub_8099DCC(gPokemonStorageSystemPtr->unk_0d60); + gPokemonStorageSystemPtr->unk_0004++; + break; + } + break; + case 3: + if (!sub_8099E08()) + { + sub_809A860(1); + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8097A64(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX); + sub_8096264(&gPokemonStorageSystemPtr->unk_2370, 0x0007, 0xdaca, 3); + sub_809634C(gPokemonStorage.currentBox); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + gPokemonStorageSystemPtr->unk_08b2 = sub_8096368(); + switch (gPokemonStorageSystemPtr->unk_08b2) + { + case 200: + break; + default: + sub_8098A5C(); + sub_809635C(); + sub_8096310(); + if (gPokemonStorageSystemPtr->unk_08b2 == 201 || gPokemonStorageSystemPtr->unk_08b2 == gPokemonStorage.currentBox) + { + sub_809A860(1); + SetPSSCallback(sub_8096C84); + } + else + { + gPokemonStorageSystemPtr->unk_0004++; + } + break; + } + break; + case 2: + sub_8099C70(gPokemonStorageSystemPtr->unk_08b2); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 3: + if (!sub_8099D34()) + { + gPokemonStorage.currentBox = gPokemonStorageSystemPtr->unk_08b2; + SetPSSCallback(sub_8096C84); + } + break; + } +} + +void sub_8097B44(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + sub_809BB90(); + BeginNormalPaletteFade(0xffffffff, 0, 0, 16, 0); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 1: + if (!UpdatePaletteFade()) + { + gUnknown_0203847F = 1; + gPokemonStorageSystemPtr->unk_0006 = 1; + SetMainCallback2(sub_8096B5C); + } + break; + } +} + +void sub_8097BA0(void) +{ + switch (gPokemonStorageSystemPtr->unk_0004) + { + case 0: + if (sub_809BF20()) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + gPokemonStorageSystemPtr->unk_0004 = 1; + } + else + { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_EXIT_BOX); + sub_8098A38(0); + gPokemonStorageSystemPtr->unk_0004 = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + case 2: + switch (ProcessMenuInputNoWrap()) + { + case 1: + case -1: + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case 0: + PlaySE(SE_PC_OFF); + sub_8098A5C(); + gPokemonStorageSystemPtr->unk_0004++; + break; + } + break; + case 3: + gPokemonStorageSystemPtr->unk_000c.tileTag = 0x000e; + gPokemonStorageSystemPtr->unk_000c.paletteTag = 0xdad0; + gPokemonStorageSystemPtr->unk_000c.unk04 = 20; + gPokemonStorageSystemPtr->unk_000c.unk06 = 0; + sub_80C5E38(&gPokemonStorageSystemPtr->unk_000c); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 4: + if (sub_80C5F98()) + { + gPlayerPartyCount = CalculatePlayerPartyCount(); + SetMainCallback2(sub_80961A8); + } + break; + } +} + +void sub_8097CC0(void) { + switch (gPokemonStorageSystemPtr->unk_0004) { + case 0: + if (sub_809BF20()) { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + gPokemonStorageSystemPtr->unk_0004 = 1; + } + else { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_CONTINUE_BOX); + sub_8098A38(0); + gPokemonStorageSystemPtr->unk_0004 = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + case 2: + switch (ProcessMenuInputNoWrap()) { + case 0: + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case -1: + case 1: + PlaySE(SE_PC_OFF); + sub_8098A5C(); + gPokemonStorageSystemPtr->unk_0004++; + break; + } + break; + case 3: + gPokemonStorageSystemPtr->unk_000c.tileTag = 0x000e; + gPokemonStorageSystemPtr->unk_000c.paletteTag = 0xdad0; + gPokemonStorageSystemPtr->unk_000c.unk04 = 20; + gPokemonStorageSystemPtr->unk_000c.unk06 = 0; + sub_80C5E38(&gPokemonStorageSystemPtr->unk_000c); + gPokemonStorageSystemPtr->unk_0004++; + break; + case 4: + if (sub_80C5F98()) { + gPlayerPartyCount = CalculatePlayerPartyCount(); + SetMainCallback2(sub_80961A8); + } + break; + } +} + +void sub_8097DE0(void) +{ + gPokemonStorageSystemPtr->unk_0007 = 0; + gPokemonStorageSystemPtr->unk_0008 = 0; + gPokemonStorageSystemPtr->unk_000a = 0; + REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_SCREENBASE(30); + DmaCopy16Defvars(3, gPokemonStorageScrollingBGTile, BG_SCREEN_ADDR(28), sizeof gPokemonStorageScrollingBGTile); + LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, BG_SCREEN_ADDR(30)); + LoadPalette(gPokemonStorageScrollingBGPalette, 0xd0, 0x10); +} + +void sub_8097E44(void) +{ + if (++gPokemonStorageSystemPtr->unk_0007 >= 2) + { + gPokemonStorageSystemPtr->unk_0007 = 0; + gPokemonStorageSystemPtr->unk_0008--; + gPokemonStorageSystemPtr->unk_000a++; + } +} + +void sub_8097E70(void) +{ + LZ77UnCompVram(gPSSMenuHeader_Gfx, BG_SCREEN_ADDR(10)); + LZ77UnCompWram(gPSSMenuHeader_Tilemap, gUnknown_02039760); + sub_809D034(BG_SCREEN_ADDR(15), 0, 0, gUnknown_02039760, 0, 0, 10, 20); + LoadPalette(gPSSMenu1_Pal, 0x10, 0x20); + LoadPalette(gPSSMenu2_Pal, 0x00, 0x20); + LoadPalette(gUnknown_083B6D74, 0xB0, 0x20); + LoadPalette(gUnknown_083B6D94, 0xC0, 0x20); + LoadPalette(gUnknownPalette_81E6692 + 1, 0xF1, 0x02); + LoadPalette(gUnknownPalette_81E6692 + 1, 0xF2, 0x02); + LoadPalette(gUnknownPalette_81E6692 + 5, 0xF3, 0x02); + LoadPalette(gUnknownPalette_81E6692 + 12, 0xF4, 0x04); + LoadPalette(gUnknownPalette_81E6692 + 10, 0xF6, 0x04); + LoadPalette(gUnknownPalette_81E6692 + 2, 0xFF, 0x02); + LoadSpritePalette(&gWaveformSpritePalette); + sub_80980D4(); + sub_8097F58(); + sub_8097FB8(); + sub_809801C(); +} + +asm(".section .text.8098898"); + +void PrintStorageActionText(u8 index) { + u8 *ptr; + + MenuDrawTextWindow(10, 16, 29, 19); + + switch (gPCStorageActionTexts[index].format) + { + + case PC_TEXT_FMT_UNK_02: + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr, gPokemonStorageSystemPtr->unk_11fa); + break; + + case PC_TEXT_FMT_UNK_05: + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr, gPokemonStorageSystemPtr->unk_26e4); + break; + + case PC_TEXT_FMT_MON_NAME: + // {var} + " is selected." + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPokemonStorageSystemPtr->unk_11fa); + ptr = StringCopy(ptr, gPCStorageActionTexts[index].text); + break; + + case PC_TEXT_FMT_MON_NAME_2: + // {var} + " was released." + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPokemonStorageSystemPtr->unk_26e4); +#if ENGLISH + ptr = StringCopy(ptr, gPCStorageActionTexts[index].text); +#elif GERMAN + ptr = de_sub_8073174(gPokemonStorageSystemPtr->unk_2694, gPCStorageActionTexts[index].text); +#endif + break; + + case PC_TEXT_FMT_UNK_03: + { + const u8 *stringLength; + const u8 *text; + + text = gPCStorageActionTexts[index].text; + stringLength = &text[StringLength(text)] + 1; + + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr, gPokemonStorageSystemPtr->unk_11fa); + ptr = StringCopy(ptr, stringLength); + } + break; + + case PC_TEXT_FMT_MON_NAME_AFTER_EXCL_MARK: + // "Bye-bye, ".substr(0, -1) + {var} + "Bye-bye, !".substr(-1, 1) + { + const u8 *stringLength; + const u8 *text; + + text = gPCStorageActionTexts[index].text; + stringLength = &text[StringLength(text)] - 1; + + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr - 1, gPokemonStorageSystemPtr->unk_26e4); + ptr = StringCopy(ptr, stringLength); + } + break; + + case PC_TEXT_FMT_NORMAL: + default: + ptr = StringCopy(gPokemonStorageSystemPtr->unk_2694, gPCStorageActionTexts[index].text); + break; + } + + while (ptr < gPokemonStorageSystemPtr->unk_26a6) + { + ptr[0] = CHAR_SPACE; + ptr++; + } + + ptr[0] = EOS; + MenuPrint(gPokemonStorageSystemPtr->unk_2694, 11, 17); +} diff --git a/src/pokemon/pokemon_storage_system_3.c b/src/pokemon/pokemon_storage_system_3.c new file mode 100644 index 000000000..9e0052b89 --- /dev/null +++ b/src/pokemon/pokemon_storage_system_3.c @@ -0,0 +1,16 @@ + +// Includes +#include "global.h" +#include "pokemon_storage_system.h" + +// Static type declarations + +// Static RAM declarations + +EWRAM_DATA u16 gUnknown_02039760[0x600] = {}; + +// Static ROM declarations + +// .rodata + +// .text diff --git a/src/pokemon/pokemon_summary_screen.c b/src/pokemon/pokemon_summary_screen.c index 9563bc08f..fb8363569 100644 --- a/src/pokemon/pokemon_summary_screen.c +++ b/src/pokemon/pokemon_summary_screen.c @@ -146,7 +146,6 @@ extern const u8 gUnknown_08E74E88[]; extern const u8 gUnknown_08E73508[]; extern const u8 gStatusScreen_Gfx[]; extern const u8 gFontDefaultPalette[]; -extern const u8 gUnknownPalette_81E6692[]; extern const u8 gAbilityNames[][13]; extern const u8 * const gAbilityDescriptions[]; extern const u8 * const gContestEffectStrings[]; @@ -940,21 +939,21 @@ static bool8 LoadPokemonSummaryScreenGraphics(void) static void sub_809E044(void) { - LoadPalette(&gUnknownPalette_81E6692[28], 129, 2); - LoadPalette(&gUnknownPalette_81E6692[30], 136, 2); - LoadPalette(&gUnknownPalette_81E6692[28], 143, 2); - LoadPalette(&gUnknownPalette_81E6692[30], 137, 2); - LoadPalette(&gUnknownPalette_81E6692[12], 209, 4); - LoadPalette(&gUnknownPalette_81E6692[20], 211, 4); - LoadPalette(&gUnknownPalette_81E6692[28], 213, 4); - LoadPalette(&gUnknownPalette_81E6692[12], 215, 4); - LoadPalette(&gUnknownPalette_81E6692[8], 217, 4); - LoadPalette(&gUnknownPalette_81E6692[16], 219, 4); - LoadPalette(&gUnknownPalette_81E6692[4], 221, 2); - LoadPalette(&gUnknownPalette_81E6692[6], 222, 2); - LoadPalette(&gUnknownPalette_81E6692[2], 223, 2); + LoadPalette(gUnknownPalette_81E6692 + 14, 129, 2); + LoadPalette(gUnknownPalette_81E6692 + 15, 136, 2); + LoadPalette(gUnknownPalette_81E6692 + 14, 143, 2); + LoadPalette(gUnknownPalette_81E6692 + 15, 137, 2); + LoadPalette(gUnknownPalette_81E6692 + 6, 209, 4); + LoadPalette(gUnknownPalette_81E6692 + 10, 211, 4); + LoadPalette(gUnknownPalette_81E6692 + 14, 213, 4); + LoadPalette(gUnknownPalette_81E6692 + 6, 215, 4); + LoadPalette(gUnknownPalette_81E6692 + 4, 217, 4); + LoadPalette(gUnknownPalette_81E6692 + 8, 219, 4); + LoadPalette(gUnknownPalette_81E6692 + 2, 221, 2); + LoadPalette(gUnknownPalette_81E6692 + 3, 222, 2); + LoadPalette(gUnknownPalette_81E6692 + 1, 223, 2); LoadPalette(gFontDefaultPalette, 240, 32); - LoadPalette(&gUnknownPalette_81E6692[6], 249, 2); + LoadPalette(gUnknownPalette_81E6692 + 3, 249, 2); } static void SummaryScreenExit(u8 taskId) diff --git a/src/pokenav_before.c b/src/pokenav_before.c index 8a67390ad..ee5bdb1cb 100644 --- a/src/pokenav_before.c +++ b/src/pokenav_before.c @@ -102,7 +102,6 @@ extern const u16 gPokenavConditionSearch2_Pal[]; extern const u8 gUnknown_083E0334[]; extern const u16 gUnknown_083E02B4[]; extern const u8 gPokenavConditionSearch2_Gfx[]; -extern const u8 gUnknownPalette_81E6692[]; extern const u8 gUnknown_083E0254[]; extern const u8 gUnknown_08E9FEB4[]; extern const u8 gUnknown_083E01AC[]; |