diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-14 18:21:22 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-14 18:21:22 -0500 |
commit | e8daaa0f3ef2d97f7afe378494f33037f5bc8ee9 (patch) | |
tree | 3ba62feb895ef59b0d15e16b4fac8f2cdcf832d0 | |
parent | e86234ff99ffa4b60df180d462c2af0f1ed4d447 (diff) |
sub_809A3D0
-rw-r--r-- | asm/pokemon_storage_system.s | 213 | ||||
-rw-r--r-- | include/pokemon_storage_system.h | 3 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system_4.c | 44 |
3 files changed, 46 insertions, 214 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 81e0729a1..57cacbff3 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5,219 +5,6 @@ .text - thumb_func_start sub_809A3D0 -sub_809A3D0: @ 809A3D0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - ldr r3, _0809A43C @ =gPokemonStorageSystemPtr - ldr r5, [r3] - ldr r1, _0809A440 @ =0x000008ca - adds r0, r5, r1 - str r0, [sp, 0x18] - add r2, sp, 0x18 - ldr r4, _0809A444 @ =0x0000ffff - mov r9, r4 - movs r6, 0xC0 - lsls r6, 10 - mov r8, r6 - ldr r0, _0809A448 @ =0x00030200 - str r0, [r2, 0x4] - mov r1, sp - ldr r0, _0809A44C @ =gSpriteTemplate_83BB2B8 - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - movs r1, 0 - ldr r7, _0809A450 @ =0x00000cca - adds r4, r5, r7 - ldrb r0, [r4] - adds r6, r2, 0 - cmp r0, 0 - bne _0809A41E - movs r1, 0x1 -_0809A41E: - strb r1, [r4] - cmp r1, 0 - bne _0809A458 - ldr r0, [r6, 0x4] - mov r1, r9 - ands r0, r1 - mov r4, r8 - orrs r0, r4 - str r0, [r6, 0x4] - ldr r7, _0809A454 @ =0x00000cec - adds r0, r5, r7 - ldrh r0, [r0] - mov r8, r0 - b _0809A478 - .align 2, 0 -_0809A43C: .4byte gPokemonStorageSystemPtr -_0809A440: .4byte 0x000008ca -_0809A444: .4byte 0x0000ffff -_0809A448: .4byte 0x00030200 -_0809A44C: .4byte gSpriteTemplate_83BB2B8 -_0809A450: .4byte 0x00000cca -_0809A454: .4byte 0x00000cec -_0809A458: - ldr r0, [r6, 0x4] - mov r1, r9 - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - orrs r0, r1 - str r0, [r6, 0x4] - ldr r4, _0809A570 @ =0x00000cec - adds r0, r5, r4 - ldrh r0, [r0] - mov r8, r0 - mov r1, sp - movs r0, 0x4 - strh r0, [r1] - ldr r0, _0809A574 @ =0x0000dac9 - strh r0, [r1, 0x2] -_0809A478: - ldr r0, [r3] - ldr r7, _0809A578 @ =0x000008ca - adds r0, r7 - ldr r1, [sp, 0x28] - lsls r5, r1, 3 - adds r5, r1 - ldr r4, _0809A57C @ =gPokemonStorage + 0x8344 - adds r5, r4 - adds r1, r5, 0 - bl sub_809A1BC - adds r0, r6, 0 - bl LoadSpriteSheet - adds r4, 0x7E - ldr r3, [sp, 0x28] - adds r4, r3, r4 - ldrb r0, [r4] - lsls r0, 2 - ldr r1, _0809A580 @ =gUnknown_083BB0A8 - adds r0, r1 - mov r1, r8 - movs r2, 0x4 - bl LoadPalette - adds r0, r5, 0 - bl sub_8072CA4 - lsls r0, 24 - lsrs r0, 24 - bl sub_809A6D0 - lsls r0, 16 - mov r4, r10 - lsls r2, r4, 24 - asrs r2, 24 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 6 - lsrs r6, r0, 16 - str r6, [sp, 0x20] - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x24] - movs r7, 0 - negs r2, r2 - mov r9, r2 - movs r0, 0x1 - mov r10, r0 -_0809A4DE: - lsls r1, r7, 5 - mov r8, r1 - ldr r3, [sp, 0x24] - lsls r1, r3, 16 - asrs r1, 16 - add r1, r8 - lsls r1, 16 - asrs r1, 16 - mov r0, sp - movs r2, 0x1C - movs r3, 0x17 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, _0809A584 @ =gPokemonStorageSystemPtr - ldr r4, [r1] - lsls r6, r7, 2 - ldr r1, _0809A588 @ =0x00000cf8 - adds r2, r4, r1 - adds r2, r6 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, _0809A58C @ =gSprites - adds r1, r0 - str r1, [r2] - mov r3, r9 - lsls r5, r3, 1 - add r5, r9 - lsls r5, 1 - strh r5, [r1, 0x2E] - ldr r1, [r2] - ldr r3, [sp, 0x20] - lsls r0, r3, 16 - asrs r0, 16 - add r0, r8 - strh r0, [r1, 0x30] - ldr r0, [r2] - mov r1, r10 - strh r1, [r0, 0x32] - ldr r0, [r2] - ldr r1, _0809A590 @ =sub_809A5E8 - str r1, [r0, 0x1C] - lsls r1, r7, 24 - lsrs r1, 24 - bl StartSpriteAnim - movs r3, 0xCF - lsls r3, 4 - adds r4, r3 - adds r4, r6 - ldr r0, [r4] - strh r5, [r0, 0x2E] - ldr r0, [r4] - mov r6, r10 - strh r6, [r0, 0x30] - ldr r1, [r4] - ldr r0, _0809A594 @ =sub_809A61C - str r0, [r1, 0x1C] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x1 - bls _0809A4DE - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0809A570: .4byte 0x00000cec -_0809A574: .4byte 0x0000dac9 -_0809A578: .4byte 0x000008ca -_0809A57C: .4byte gPokemonStorage + 0x8344 -_0809A580: .4byte gUnknown_083BB0A8 -_0809A584: .4byte gPokemonStorageSystemPtr -_0809A588: .4byte 0x00000cf8 -_0809A58C: .4byte gSprites -_0809A590: .4byte sub_809A5E8 -_0809A594: .4byte sub_809A61C - thumb_func_end sub_809A3D0 - thumb_func_start sub_809A598 sub_809A598: @ 809A598 push {lr} diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 62014e62c..85ffeaefe 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -116,7 +116,8 @@ struct PokemonStorageSystemData { u16 unk_0cec; u16 unk_0cee; struct Sprite *unk_0cf0[2]; - u8 filler_0cf8[16]; + struct Sprite *unk_0cf8[2]; + u8 filler_0cd0[8]; u32 unk_0d08; u8 filler_0d0c[0x50]; u16 unk_0d5c; diff --git a/src/pokemon/pokemon_storage_system_4.c b/src/pokemon/pokemon_storage_system_4.c index 836a3433f..b0378a254 100644 --- a/src/pokemon/pokemon_storage_system_4.c +++ b/src/pokemon/pokemon_storage_system_4.c @@ -36,11 +36,14 @@ void sub_809A14C(u16 *vdest); void sub_809A23C(u8 boxId); void sub_809A3D0(u8 boxId, s8 a1); void sub_809A598(void); +void sub_809A5E8(struct Sprite *sprite); +void sub_809A61C(struct Sprite *sprite); void sub_809A654(void); s16 sub_809A6D0(u8 width); void sub_809A6DC(void); void sub_809A774(s8 a0); void sub_809A810(void); +void sub_809A8C8(struct Sprite *sprite); // .rodata @@ -810,6 +813,47 @@ void sub_809A23C(u8 boxId) gPokemonStorageSystemPtr->unk_0cca = 0; } +void sub_809A3D0(u8 boxId, s8 a1) +{ + u16 r8; + s16 x; + s16 x2; + u16 i; + struct SpriteSheet spriteSheet = {gPokemonStorageSystemPtr->unk_08ca, 0x200, 3}; + struct SpriteTemplate template = gSpriteTemplate_83BB2B8; + + gPokemonStorageSystemPtr->unk_0cca = gPokemonStorageSystemPtr->unk_0cca ? FALSE : TRUE; + if (gPokemonStorageSystemPtr->unk_0cca == 0) + { + spriteSheet.tag = 3; + r8 = gPokemonStorageSystemPtr->unk_0cec; + } + else + { + spriteSheet.tag = 4; + r8 = gPokemonStorageSystemPtr->unk_0cec; + template.tileTag = 4; + template.paletteTag = 0xdac9; + } + sub_809A1BC(gPokemonStorageSystemPtr->unk_08ca, gPokemonStorage.boxNames[boxId]); + LoadSpriteSheet(&spriteSheet); + LoadPalette(gUnknown_083BB0A8[gPokemonStorage.wallpaper[boxId]], r8, 0x04); + x = sub_809A6D0(sub_8072CA4(gPokemonStorage.boxNames[boxId])); + x2 = x + a1 * 192; + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&template, i * 32 + x2, 0x1c, 23); + gPokemonStorageSystemPtr->unk_0cf8[i] = gSprites + spriteId; + gPokemonStorageSystemPtr->unk_0cf8[i]->data[0] = (-a1) * 6; + gPokemonStorageSystemPtr->unk_0cf8[i]->data[1] = i * 32 + x; + gPokemonStorageSystemPtr->unk_0cf8[i]->data[2] = 1; + gPokemonStorageSystemPtr->unk_0cf8[i]->callback = sub_809A5E8; + StartSpriteAnim(gPokemonStorageSystemPtr->unk_0cf8[i], i); + gPokemonStorageSystemPtr->unk_0cf0[i]->data[0] = (-a1) * 6; + gPokemonStorageSystemPtr->unk_0cf0[i]->data[1] = 1; + gPokemonStorageSystemPtr->unk_0cf0[i]->callback = sub_809A61C; + } +} const u16 PCPal_Arrow[] = INCBIN_U16("graphics/pokemon_storage/arrow.gbapal"); const u8 PCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); |