diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-12 08:53:01 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-12 08:53:01 -0500 |
commit | 7a65953ccc2313db6de0ec061220b1a5f8751b36 (patch) | |
tree | 6d608cc9d8c5826a1a9472df03444d42e955c2fc | |
parent | a1ccd03edd90601759a04f223c9558181a657728 (diff) |
through sub_80999C4
-rw-r--r-- | asm/pokemon_storage_system.s | 248 | ||||
-rw-r--r-- | data/pokemon_storage_system.s | 16 | ||||
-rw-r--r-- | include/pokemon_storage_system.h | 4 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system_3.c | 86 |
4 files changed, 89 insertions, 265 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 8767808fc..0a3f44372 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5,254 +5,6 @@ .text - thumb_func_start sub_809981C -sub_809981C: @ 809981C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r0, 0x1 - beq _08099858 - cmp r0, 0x1 - bgt _08099836 - cmp r0, 0 - beq _0809983C - b _080998C0 -_08099836: - cmp r2, 0x2 - beq _0809987C - b _080998C0 -_0809983C: - ldr r3, _0809984C @ =gPokemonStorageSystemPtr - ldr r1, [r3] - ldr r0, _08099850 @ =0x000010cc - adds r2, r1, r0 - lsls r0, r4, 2 - ldr r4, _08099854 @ =0x00001038 - b _08099864 - .align 2, 0 -_0809984C: .4byte gPokemonStorageSystemPtr -_08099850: .4byte 0x000010cc -_08099854: .4byte 0x00001038 -_08099858: - ldr r3, _08099870 @ =gPokemonStorageSystemPtr - ldr r1, [r3] - ldr r0, _08099874 @ =0x000010cc - adds r2, r1, r0 - lsls r0, r4, 2 - ldr r4, _08099878 @ =0x00001050 -_08099864: - adds r0, r4 - adds r1, r0 - str r1, [r2] - adds r0, r3, 0 - b _0809988A - .align 2, 0 -_08099870: .4byte gPokemonStorageSystemPtr -_08099874: .4byte 0x000010cc -_08099878: .4byte 0x00001050 -_0809987C: - ldr r0, _080998C8 @ =gPokemonStorageSystemPtr - ldr r1, [r0] - ldr r3, _080998CC @ =0x000010cc - adds r2, r1, r3 - ldr r4, _080998D0 @ =0x00001034 - adds r1, r4 - str r1, [r2] -_0809988A: - ldr r0, [r0] - ldr r1, _080998CC @ =0x000010cc - adds r4, r0, r1 - ldr r0, [r4] - ldr r0, [r0] - cmp r0, 0 - beq _080998C0 - bl InitSpriteAffineAnim - ldr r0, [r4] - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldr r0, [r4] - ldr r1, [r0] - ldr r0, _080998D4 @ =gSpriteAffineAnimTable_83B6F5C - str r0, [r1, 0x10] - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAffineAnim -_080998C0: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080998C8: .4byte gPokemonStorageSystemPtr -_080998CC: .4byte 0x000010cc -_080998D0: .4byte 0x00001034 -_080998D4: .4byte gSpriteAffineAnimTable_83B6F5C - thumb_func_end sub_809981C - - thumb_func_start sub_80998D8 -sub_80998D8: @ 80998D8 - push {lr} - ldr r0, _080998FC @ =gPokemonStorageSystemPtr - ldr r0, [r0] - ldr r1, _08099900 @ =0x000010cc - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0] - cmp r1, 0 - beq _080998F8 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r2, [r3] - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _08099904 -_080998F8: - movs r0, 0 - b _0809991A - .align 2, 0 -_080998FC: .4byte gPokemonStorageSystemPtr -_08099900: .4byte 0x000010cc -_08099904: - adds r0, r1, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08099918 - movs r0, 0x4 - orrs r0, r2 - strb r0, [r3] -_08099918: - movs r0, 0x1 -_0809991A: - pop {r1} - bx r1 - thumb_func_end sub_80998D8 - - thumb_func_start sub_8099920 -sub_8099920: @ 8099920 - push {r4,lr} - ldr r0, _08099950 @ =gPokemonStorageSystemPtr - ldr r0, [r0] - ldr r1, _08099954 @ =0x000010cc - adds r4, r0, r1 - ldr r0, [r4] - ldr r0, [r0] - cmp r0, 0 - beq _0809994A - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldr r0, [r4] - ldr r0, [r0] - bl sub_8099BE0 - ldr r1, [r4] - movs r0, 0 - str r0, [r1] -_0809994A: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08099950: .4byte gPokemonStorageSystemPtr -_08099954: .4byte 0x000010cc - thumb_func_end sub_8099920 - - thumb_func_start sub_8099958 -sub_8099958: @ 8099958 - push {lr} - ldr r0, _08099988 @ =gPokemonStorageSystemPtr - ldr r0, [r0] - ldr r1, _0809998C @ =0x000010cc - adds r3, r0, r1 - ldr r0, [r3] - ldr r0, [r0] - cmp r0, 0 - beq _08099982 - adds r2, r0, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAffineAnim -_08099982: - pop {r0} - bx r0 - .align 2, 0 -_08099988: .4byte gPokemonStorageSystemPtr -_0809998C: .4byte 0x000010cc - thumb_func_end sub_8099958 - - thumb_func_start sub_8099990 -sub_8099990: @ 8099990 - push {lr} - ldr r0, _080999A4 @ =gPokemonStorageSystemPtr - ldr r0, [r0] - ldr r1, _080999A8 @ =0x000010cc - adds r2, r0, r1 - ldr r0, [r2] - cmp r0, 0 - bne _080999AC - movs r0, 0 - b _080999C0 - .align 2, 0 -_080999A4: .4byte gPokemonStorageSystemPtr -_080999A8: .4byte 0x000010cc -_080999AC: - ldr r0, [r0] - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080999BE - movs r0, 0 - str r0, [r2] -_080999BE: - movs r0, 0x1 -_080999C0: - pop {r1} - bx r1 - thumb_func_end sub_8099990 - - thumb_func_start sub_80999C4 -sub_80999C4: @ 80999C4 - ldr r1, _080999E4 @ =gPokemonStorageSystemPtr - ldr r1, [r1] - movs r2, 0x8E - lsls r2, 5 - adds r1, r2 - ldr r2, [r1] - ldrh r2, [r2, 0x20] - strh r2, [r0, 0x20] - ldr r2, [r1] - ldrh r1, [r2, 0x26] - ldrh r2, [r2, 0x22] - adds r1, r2 - adds r1, 0x4 - strh r1, [r0, 0x22] - bx lr - .align 2, 0 -_080999E4: .4byte gPokemonStorageSystemPtr - thumb_func_end sub_80999C4 - thumb_func_start sub_80999E8 sub_80999E8: @ 80999E8 push {r4-r6,lr} diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index 66cc84000..b4da5c331 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -4,22 +4,6 @@ .section .rodata .align 2 -gSpriteAffineAnim_83B6F34:: @ 83B6F34 - obj_rot_scal_anim_frame 0xFFFE, 0xFFFE, 0, 120 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_83B6F44:: @ 83B6F44 - obj_rot_scal_anim_frame 0x10, 0x10, 0, 0 - obj_rot_scal_anim_frame 0x10, 0x10, 0, 15 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_83B6F5C:: @ 83B6F5C - .4byte gSpriteAffineAnim_83B6F34 - .4byte gSpriteAffineAnim_83B6F44 - - .align 2 gWallpaperPalettes_Forest: @ 83B6F64 .incbin "graphics/pokemon_storage/box_bg1.gbapal" .incbin "graphics/pokemon_storage/forest_frame.gbapal" diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 438af769b..129202934 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -121,7 +121,9 @@ struct PokemonStorageSystemData { s8 unk_117b; u8 unk_117c; u8 unk_117d; - u8 filler_117e[0x6a]; + u8 filler_117e[0x42]; + struct Sprite *unk_11c0; + u8 filler_11c4[0x24]; u8 *unk_11e8; u32 unk_11ec; u16 unk_11f0; diff --git a/src/pokemon/pokemon_storage_system_3.c b/src/pokemon/pokemon_storage_system_3.c index 7f5c84b49..2af88e8cd 100644 --- a/src/pokemon/pokemon_storage_system_3.c +++ b/src/pokemon/pokemon_storage_system_3.c @@ -494,3 +494,89 @@ bool8 sub_809971C(void) } return TRUE; } + +const union AffineAnimCmd gSpriteAffineAnim_83B6F34[] = { + AFFINEANIMCMD_FRAME(-2, -2, 0, 120), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gSpriteAffineAnim_83B6F44[] = { + AFFINEANIMCMD_FRAME(16, 16, 0, 0), + AFFINEANIMCMD_FRAME(16, 16, 0, 15), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_83B6F5C[] = { + gSpriteAffineAnim_83B6F34, + gSpriteAffineAnim_83B6F44 +}; + +void sub_809981C(u8 mode, u8 idx) +{ + switch (mode) + { + case 0: + gPokemonStorageSystemPtr->unk_10cc = gPokemonStorageSystemPtr->unk_1038 + idx; + break; + case 1: + gPokemonStorageSystemPtr->unk_10cc = gPokemonStorageSystemPtr->unk_1050 + idx; + break; + case 2: + gPokemonStorageSystemPtr->unk_10cc = &gPokemonStorageSystemPtr->unk_1034; + break; + default: + return; + } + if (*gPokemonStorageSystemPtr->unk_10cc) + { + InitSpriteAffineAnim(*gPokemonStorageSystemPtr->unk_10cc); + (*gPokemonStorageSystemPtr->unk_10cc)->oam.affineMode = ST_OAM_AFFINE_NORMAL; + (*gPokemonStorageSystemPtr->unk_10cc)->affineAnims = gSpriteAffineAnimTable_83B6F5C; + StartSpriteAffineAnim(*gPokemonStorageSystemPtr->unk_10cc, 0); + } +} + +bool8 sub_80998D8(void) +{ + if (*gPokemonStorageSystemPtr->unk_10cc == NULL || (*gPokemonStorageSystemPtr->unk_10cc)->invisible) + return FALSE; + if ((*gPokemonStorageSystemPtr->unk_10cc)->affineAnimEnded) + { + (*gPokemonStorageSystemPtr->unk_10cc)->invisible = TRUE; + } + return TRUE; +} + +void sub_8099920(void) +{ + if (*gPokemonStorageSystemPtr->unk_10cc) + { + FreeOamMatrix((*gPokemonStorageSystemPtr->unk_10cc)->oam.matrixNum); + sub_8099BE0(*gPokemonStorageSystemPtr->unk_10cc); + *gPokemonStorageSystemPtr->unk_10cc = NULL; + } +} + +void sub_8099958(void) +{ + if (*gPokemonStorageSystemPtr->unk_10cc) + { + (*gPokemonStorageSystemPtr->unk_10cc)->invisible = FALSE; + StartSpriteAffineAnim(*gPokemonStorageSystemPtr->unk_10cc, 1); + } +} + +bool8 sub_8099990(void) +{ + if (gPokemonStorageSystemPtr->unk_10cc == NULL) + return FALSE; + if ((*gPokemonStorageSystemPtr->unk_10cc)->affineAnimEnded) + gPokemonStorageSystemPtr->unk_10cc = NULL; + return TRUE; +} + +void sub_80999C4(struct Sprite *sprite) +{ + sprite->pos1.x = gPokemonStorageSystemPtr->unk_11c0->pos1.x; + sprite->pos1.y = gPokemonStorageSystemPtr->unk_11c0->pos1.y + gPokemonStorageSystemPtr->unk_11c0->pos2.y + 4; +} |