diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-08 14:57:26 -0700 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-08 14:57:26 -0700 |
commit | 78df16e7989be5142ed0d1fd01c4ece6483f0571 (patch) | |
tree | 91eece8d4d3d45eb284afa00dac175ece512ae8e | |
parent | 673d64c35b21ebb8f3c6fc8b547c7f736fa4f593 (diff) |
Through sub_809746C; enums for PC storage actions
-rw-r--r-- | asm/pokemon_storage_system.s | 153 | ||||
-rw-r--r-- | data/pokemon_storage_system.s | 2 | ||||
-rwxr-xr-x | include/ewram.h | 4 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system.c | 182 |
4 files changed, 156 insertions, 185 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 245a69131..2622e7d84 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5,137 +5,6 @@ .text - thumb_func_start sub_809746C -sub_809746C: @ 809746C - push {r4,lr} - ldr r0, _08097484 @ =gSharedMem - ldrb r0, [r0, 0x4] - cmp r0, 0x4 - bls _08097478 - b _08097584 -_08097478: - lsls r0, 2 - ldr r1, _08097488 @ =_0809748C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08097484: .4byte gSharedMem -_08097488: .4byte _0809748C - .align 2, 0 -_0809748C: - .4byte _080974A0 - .4byte _080974D8 - .4byte _08097534 - .4byte _08097548 - .4byte _0809756C -_080974A0: - movs r0, 0x6 - bl sub_8098898 - ldr r4, _080974C8 @ =gSharedMem + 0x2370 - ldr r2, _080974CC @ =0x0000daca - adds r0, r4, 0 - movs r1, 0x7 - movs r3, 0x3 - bl sub_8096264 - ldr r0, _080974D0 @ =gUnknown_0203847E - ldrb r0, [r0] - bl sub_809634C - ldr r0, _080974D4 @ =0xffffdc90 - adds r4, r0 - ldrb r0, [r4, 0x4] - adds r0, 0x1 - strb r0, [r4, 0x4] - b _08097584 - .align 2, 0 -_080974C8: .4byte gSharedMem + 0x2370 -_080974CC: .4byte 0x0000daca -_080974D0: .4byte gUnknown_0203847E -_080974D4: .4byte 0xffffdc90 -_080974D8: - bl sub_8096368 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xC8 - beq _08097584 - cmp r4, 0xC9 - bne _080974F6 - bl sub_8098A5C - bl sub_809635C - bl sub_8096310 - b _0809755E -_080974F6: - adds r0, r4, 0 - bl sub_809B62C - lsls r0, 24 - cmp r0, 0 - beq _08097518 - bl sub_8098A5C - bl sub_809635C - bl sub_8096310 - ldr r1, _08097514 @ =gSharedMem - movs r0, 0x2 - b _08097522 - .align 2, 0 -_08097514: .4byte gSharedMem -_08097518: - movs r0, 0x8 - bl sub_8098898 - ldr r1, _0809752C @ =gSharedMem - movs r0, 0x4 -_08097522: - strb r0, [r1, 0x4] - ldr r0, _08097530 @ =gUnknown_0203847E - strb r4, [r0] - b _08097584 - .align 2, 0 -_0809752C: .4byte gSharedMem -_08097530: .4byte gUnknown_0203847E -_08097534: - bl party_compaction - bl sub_8099310 - ldr r1, _08097544 @ =gSharedMem - ldrb r0, [r1, 0x4] - adds r0, 0x1 - b _08097582 - .align 2, 0 -_08097544: .4byte gSharedMem -_08097548: - bl sub_8099374 - lsls r0, 24 - cmp r0, 0 - bne _08097584 - bl sub_809B6BC - bl BoxSetMosaic - bl sub_80987DC -_0809755E: - ldr r0, _08097568 @ =sub_8096C84 - bl SetPSSCallback - b _08097584 - .align 2, 0 -_08097568: .4byte sub_8096C84 -_0809756C: - ldr r0, _0809758C @ =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08097584 - movs r0, 0x6 - bl sub_8098898 - ldr r1, _08097590 @ =gSharedMem - movs r0, 0x1 -_08097582: - strb r0, [r1, 0x4] -_08097584: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0809758C: .4byte gMain -_08097590: .4byte gSharedMem - thumb_func_end sub_809746C - thumb_func_start sub_8097594 sub_8097594: @ 8097594 push {r4,lr} @@ -171,7 +40,7 @@ _080975B4: .4byte _08097764 _080975EC: movs r0, 0x9 - bl sub_8098898 + bl PrintStorageActionText movs r0, 0x1 bl sub_8098A38 ldr r1, _0809761C @ =gSharedMem @@ -332,7 +201,7 @@ _08097732: beq _0809777A movs r0, 0x14 _08097740: - bl sub_8098898 + bl PrintStorageActionText _08097744: ldr r1, _08097754 @ =gSharedMem ldrb r0, [r1, 0x4] @@ -429,7 +298,7 @@ sub_80977E4: @ 80977E4 _080977F4: .4byte gSharedMem _080977F8: movs r0, 0xC - bl sub_8098898 + bl PrintStorageActionText ldr r0, _08097820 @ =0x000011f7 adds r2, r4, r0 ldrb r1, [r2] @@ -519,7 +388,7 @@ sub_809789C: @ 809789C _080978AC: .4byte gSharedMem _080978B0: movs r0, 0x1 - bl sub_8098898 + bl PrintStorageActionText bl sub_809CE84 ldrb r0, [r4, 0x4] adds r0, 0x1 @@ -617,7 +486,7 @@ _0809798C: _08097996: bl sub_8098A80 movs r0, 0x2 - bl sub_8098898 + bl PrintStorageActionText b _08097A3C _080979A2: bl sub_809CF30 @@ -655,7 +524,7 @@ _080979D4: lsrs r0, 24 bl sub_8098AA8 movs r0, 0x3 - bl sub_8098898 + bl PrintStorageActionText b _08097A3C _080979FC: bl sub_809CF30 @@ -730,7 +599,7 @@ _08097A7C: b _08097B32 _08097A86: movs r0, 0x5 - bl sub_8098898 + bl PrintStorageActionText ldr r1, _08097AA4 @ =0x00002370 adds r0, r5, r1 ldr r2, _08097AA8 @ =0x0000daca @@ -891,7 +760,7 @@ _08097BD4: movs r0, 0x20 bl PlaySE movs r0, 0xF - bl sub_8098898 + bl PrintStorageActionText ldr r1, _08097BF4 @ =gSharedMem movs r0, 0x1 strb r0, [r1, 0x4] @@ -902,7 +771,7 @@ _08097BF8: movs r0, 0x5 bl PlaySE movs r0, 0 - bl sub_8098898 + bl PrintStorageActionText movs r0, 0 bl sub_8098A38 ldr r1, _08097C14 @ =gSharedMem @@ -1025,7 +894,7 @@ _08097CF4: movs r0, 0x20 bl PlaySE movs r0, 0xF - bl sub_8098898 + bl PrintStorageActionText ldr r1, _08097D14 @ =gSharedMem movs r0, 0x1 strb r0, [r1, 0x4] @@ -1036,7 +905,7 @@ _08097D18: movs r0, 0x5 bl PlaySE movs r0, 0x12 - bl sub_8098898 + bl PrintStorageActionText movs r0, 0 bl sub_8098A38 ldr r1, _08097D34 @ =gSharedMem diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index b9b18e707..4340301ba 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -98,7 +98,7 @@ gSpriteTemplate_83B6DDC:: @ 83B6DDC spr_template 2, 56007, gOamData_83B6EAC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy .align 2 -gUnknown_083B6DF4:: @ 83B6DF4 +gPCStorageActionTexts:: @ 83B6DF4 .4byte PCText_ExitBox, 0 .4byte PCText_WhatYouDo, 0 .4byte PCText_PickATheme, 0 diff --git a/include/ewram.h b/include/ewram.h index 19e05134f..d8ebd71ec 100755 --- a/include/ewram.h +++ b/include/ewram.h @@ -39,10 +39,6 @@ extern u8 gSharedMem[]; #define ewram01000 (*(struct Unk2001000 *)(gSharedMem + 0x1000)) #define ewramBerryPicTemp (gSharedMem + 0x1000) #define EWRAM_1000 (*(struct Struct2001000 *)(gSharedMem + 0x1000)) -#define gUnk20011fa (u8 *)(&gSharedMem[0x11FA]) -#define gUnk2002694 (u8 *)(&gSharedMem[0x2694]) -#define gUnk20026A6 (u8 *)(&gSharedMem[0x26A6]) -#define gUnk20026e4 (u8 *)(&gSharedMem[0x26E4]) #define ewram4000 (gSharedMem + 0x4000) #define gUnknown_02007000 (*(ewramStruct_02007000 *)(gSharedMem + 0x7000)) #define ARRAY_2007800 ((struct EasyChatPair *)(gSharedMem + 0x7800)) diff --git a/src/pokemon/pokemon_storage_system.c b/src/pokemon/pokemon_storage_system.c index 6f51b823e..916dc411a 100644 --- a/src/pokemon/pokemon_storage_system.c +++ b/src/pokemon/pokemon_storage_system.c @@ -19,6 +19,42 @@ #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; @@ -66,7 +102,7 @@ struct PokemonStorageSystemData { u8 unk_11f6; u8 filler_11f7[2]; u8 unk_11f9; - u8 filler_11fa[0xc2]; + u8 unk_11fa[0xc2]; struct PokemonMarkMenu unk_12bc; struct UnkPSSStruct_2002370 unk_2370; u8 filler_25b4[0xd8]; @@ -74,6 +110,9 @@ struct PokemonStorageSystemData { 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); @@ -120,11 +159,13 @@ void sub_8098734(void); void sub_80987DC(void); void sub_809880C(void); bool8 sub_8098830(void); -void sub_8098898(u8 index); +void PrintStorageActionText(u8 index); void sub_8098A5C(void); void sub_809B100(u8 a0); bool8 sub_809B130(void); void sub_8098B48(void); +void sub_8099310(void); +bool8 sub_8099374(void); void sub_8099BF8(u8 a0); void sub_8099C70(u8 whichBox); bool8 sub_8099D34(void); @@ -137,6 +178,8 @@ void sub_809B0D4(void); void sub_809B0E0(void); u8 sub_809B0F4(void); void sub_809B440(void); +bool8 sub_809B62C(u8); +void sub_809B6BC(void); void sub_809BBC0(void); void sub_809BD14(void); bool8 sub_809BE80(void); @@ -198,7 +241,7 @@ const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/b const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); -extern const struct StorageAction gUnknown_083B6DF4[]; +extern const struct StorageAction gPCStorageActionTexts[]; extern const struct PokemonStorageSystemData *gPokemonStorageSystemPtr; extern u8 *const gUnknown_083B6DB8; @@ -1107,7 +1150,7 @@ void sub_8096C84(void) case 5: if (ePokemonStorageSystem.unk_0005 != 2) { - sub_8098898(16); + PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); ePokemonStorageSystem.unk_0004 = 3; } else @@ -1242,12 +1285,12 @@ void sub_8096C84(void) break; case 4: PlaySE(SE_HAZURE); - sub_8098898(13); + PrintStorageActionText(PC_TEXT_LAST_POKE); ePokemonStorageSystem.unk_0004 = 6; break; case 5: PlaySE(SE_HAZURE); - sub_8098898(22); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); ePokemonStorageSystem.unk_0004 = 6; break; case 6: @@ -1307,7 +1350,7 @@ void sub_8097078(void) switch (ePokemonStorageSystem.unk_0004) { case 0: - sub_8098898(4); + PrintStorageActionText(PC_TEXT_IS_SELECTED); sub_809CE84(); ePokemonStorageSystem.unk_0004 = 1; break; @@ -1400,17 +1443,17 @@ void sub_8097078(void) break; case 2: PlaySE(SE_HAZURE); - sub_8098898(13); + PrintStorageActionText(PC_TEXT_LAST_POKE); ePokemonStorageSystem.unk_0004 = 5; break; case 4: PlaySE(SE_HAZURE); - sub_8098898(17); + PrintStorageActionText(PC_TEXT_CANT_RELEASE_EGG); ePokemonStorageSystem.unk_0004 = 5; break; case 3: PlaySE(SE_HAZURE); - sub_8098898(22); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); ePokemonStorageSystem.unk_0004 = 5; break; case 5: @@ -1488,7 +1531,7 @@ void sub_8097390(void) case 0: if (CalculatePlayerPartyCount() == 6) { - sub_8098898(14); + PrintStorageActionText(PC_TEXT_PARTY_FULL); ePokemonStorageSystem.unk_0004 = 1; } else @@ -1532,83 +1575,146 @@ void sub_8097390(void) } } +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; + } +} + asm(".section .text.8098898"); -void sub_8098898(u8 index) { +void PrintStorageActionText(u8 index) { u8 *ptr; MenuDrawTextWindow(10, 16, 29, 19); - switch (gUnknown_083B6DF4[index].format) + switch (gPCStorageActionTexts[index].format) { - case 2: - ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text); - ptr = StringCopy(ptr, gUnk20011fa); + case PC_TEXT_FMT_UNK_02: + ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr, ePokemonStorageSystem.unk_11fa); break; - case 5: - ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text); - ptr = StringCopy(ptr, gUnk20026e4); + case PC_TEXT_FMT_UNK_05: + ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr, ePokemonStorageSystem.unk_26e4); break; - case 1: + case PC_TEXT_FMT_MON_NAME: // {var} + " is selected." - ptr = StringCopy(gUnk2002694, gUnk20011fa); - ptr = StringCopy(ptr, gUnknown_083B6DF4[index].text); + ptr = StringCopy(ePokemonStorageSystem.unk_2694, ePokemonStorageSystem.unk_11fa); + ptr = StringCopy(ptr, gPCStorageActionTexts[index].text); break; - case 4: + case PC_TEXT_FMT_MON_NAME_2: // {var} + " was released." - ptr = StringCopy(gUnk2002694, gUnk20026e4); + ptr = StringCopy(ePokemonStorageSystem.unk_2694, ePokemonStorageSystem.unk_26e4); #if ENGLISH - ptr = StringCopy(ptr, gUnknown_083B6DF4[index].text); + ptr = StringCopy(ptr, gPCStorageActionTexts[index].text); #elif GERMAN - ptr = de_sub_8073174(gUnk2002694, gUnknown_083B6DF4[index].text); + ptr = de_sub_8073174(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); #endif break; - case 3: + case PC_TEXT_FMT_UNK_03: { u8 *stringLength; u8 *text; - text = gUnknown_083B6DF4[index].text; + text = gPCStorageActionTexts[index].text; stringLength = &text[StringLength(text)] + 1; - ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text); - ptr = StringCopy(ptr, gUnk20011fa); + ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr, ePokemonStorageSystem.unk_11fa); ptr = StringCopy(ptr, stringLength); } break; - case 6: + 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 = gUnknown_083B6DF4[index].text; + text = gPCStorageActionTexts[index].text; stringLength = &text[StringLength(text)] - 1; - ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text); - ptr = StringCopy(ptr - 1, gUnk20026e4); + ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); + ptr = StringCopy(ptr - 1, ePokemonStorageSystem.unk_26e4); ptr = StringCopy(ptr, stringLength); } break; - case 0: + case PC_TEXT_FMT_NORMAL: default: - ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text); + ptr = StringCopy(ePokemonStorageSystem.unk_2694, gPCStorageActionTexts[index].text); break; } - while (ptr < gUnk20026A6) + while (ptr < ePokemonStorageSystem.unk_26a6) { ptr[0] = CHAR_SPACE; ptr++; } ptr[0] = EOS; - MenuPrint(gUnk2002694, 11, 17); + MenuPrint(ePokemonStorageSystem.unk_2694, 11, 17); } |