summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-01-14 18:37:27 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-01-14 18:37:27 -0500
commitf33a73ed931885507b1a5f199044d85255078bc2 (patch)
treeb265d67c587f21361f06e06c81011683a50b6c0c
parente8daaa0f3ef2d97f7afe378494f33037f5bc8ee9 (diff)
through sub_809A6D0
-rw-r--r--asm/pokemon_storage_system.s174
-rw-r--r--src/pokemon/pokemon_storage_system_4.c46
2 files changed, 46 insertions, 174 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s
index 57cacbff3..dafd8ce71 100644
--- a/asm/pokemon_storage_system.s
+++ b/asm/pokemon_storage_system.s
@@ -5,180 +5,6 @@
.text
- thumb_func_start sub_809A598
-sub_809A598: @ 809A598
- push {lr}
- ldr r0, _0809A5B0 @ =gPokemonStorageSystemPtr
- ldr r0, [r0]
- ldr r1, _0809A5B4 @ =0x00000cca
- adds r0, r1
- ldrb r0, [r0]
- cmp r0, 0
- bne _0809A5B8
- movs r0, 0x4
- bl FreeSpriteTilesByTag
- b _0809A5BE
- .align 2, 0
-_0809A5B0: .4byte gPokemonStorageSystemPtr
-_0809A5B4: .4byte 0x00000cca
-_0809A5B8:
- movs r0, 0x3
- bl FreeSpriteTilesByTag
-_0809A5BE:
- ldr r0, _0809A5E0 @ =gPokemonStorageSystemPtr
- ldr r0, [r0]
- movs r3, 0xCF
- lsls r3, 4
- adds r2, r0, r3
- adds r3, 0x8
- adds r1, r0, r3
- ldr r1, [r1]
- str r1, [r2]
- ldr r2, _0809A5E4 @ =0x00000cf4
- adds r1, r0, r2
- adds r3, 0x4
- adds r0, r3
- ldr r0, [r0]
- str r0, [r1]
- pop {r0}
- bx r0
- .align 2, 0
-_0809A5E0: .4byte gPokemonStorageSystemPtr
-_0809A5E4: .4byte 0x00000cf4
- thumb_func_end sub_809A598
-
- thumb_func_start sub_809A5E8
-sub_809A5E8: @ 809A5E8
- push {lr}
- adds r2, r0, 0
- ldrh r1, [r2, 0x32]
- movs r3, 0x32
- ldrsh r0, [r2, r3]
- cmp r0, 0
- beq _0809A5FC
- subs r0, r1, 0x1
- strh r0, [r2, 0x32]
- b _0809A614
-_0809A5FC:
- ldrh r0, [r2, 0x2E]
- ldrh r1, [r2, 0x20]
- adds r0, r1
- strh r0, [r2, 0x20]
- lsls r0, 16
- asrs r0, 16
- movs r3, 0x30
- ldrsh r1, [r2, r3]
- cmp r0, r1
- bne _0809A614
- ldr r0, _0809A618 @ =SpriteCallbackDummy
- str r0, [r2, 0x1C]
-_0809A614:
- pop {r0}
- bx r0
- .align 2, 0
-_0809A618: .4byte SpriteCallbackDummy
- thumb_func_end sub_809A5E8
-
- thumb_func_start sub_809A61C
-sub_809A61C: @ 809A61C
- push {lr}
- adds r2, r0, 0
- ldrh r1, [r2, 0x30]
- movs r3, 0x30
- ldrsh r0, [r2, r3]
- cmp r0, 0
- beq _0809A630
- subs r0, r1, 0x1
- strh r0, [r2, 0x30]
- b _0809A64E
-_0809A630:
- ldrh r0, [r2, 0x2E]
- ldrh r1, [r2, 0x20]
- adds r0, r1
- strh r0, [r2, 0x20]
- ldrh r1, [r2, 0x24]
- adds r0, r1
- strh r0, [r2, 0x32]
- subs r0, 0x40
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0xC0
- bls _0809A64E
- adds r0, r2, 0
- bl DestroySprite
-_0809A64E:
- pop {r0}
- bx r0
- thumb_func_end sub_809A61C
-
- thumb_func_start sub_809A654
-sub_809A654: @ 809A654
- push {lr}
- bl get_preferred_box
- lsls r0, 24
- lsrs r0, 24
- ldr r1, _0809A690 @ =gPokemonStorage
- ldr r2, _0809A694 @ =0x000083c2
- adds r1, r2
- adds r0, r1
- ldrb r1, [r0]
- ldr r0, _0809A698 @ =gPokemonStorageSystemPtr
- ldr r2, [r0]
- ldr r3, _0809A69C @ =0x00000cca
- adds r0, r2, r3
- ldrb r0, [r0]
- cmp r0, 0
- bne _0809A6A8
- lsls r0, r1, 2
- ldr r1, _0809A6A0 @ =gUnknown_083BB0A8
- adds r0, r1
- adds r3, 0x22
- adds r1, r2, r3
- ldrh r1, [r1]
- lsls r1, 1
- ldr r2, _0809A6A4 @ =gPlttBufferUnfaded
- adds r1, r2
- movs r2, 0x2
- bl CpuSet
- b _0809A6C0
- .align 2, 0
-_0809A690: .4byte gPokemonStorage
-_0809A694: .4byte 0x000083c2
-_0809A698: .4byte gPokemonStorageSystemPtr
-_0809A69C: .4byte 0x00000cca
-_0809A6A0: .4byte gUnknown_083BB0A8
-_0809A6A4: .4byte gPlttBufferUnfaded
-_0809A6A8:
- lsls r0, r1, 2
- ldr r1, _0809A6C4 @ =gUnknown_083BB0A8
- adds r0, r1
- ldr r3, _0809A6C8 @ =0x00000cee
- adds r1, r2, r3
- ldrh r1, [r1]
- lsls r1, 1
- ldr r2, _0809A6CC @ =gPlttBufferUnfaded
- adds r1, r2
- movs r2, 0x2
- bl CpuSet
-_0809A6C0:
- pop {r0}
- bx r0
- .align 2, 0
-_0809A6C4: .4byte gUnknown_083BB0A8
-_0809A6C8: .4byte 0x00000cee
-_0809A6CC: .4byte gPlttBufferUnfaded
- thumb_func_end sub_809A654
-
- thumb_func_start sub_809A6D0
-sub_809A6D0: @ 809A6D0
- adds r1, r0, 0
- lsls r1, 24
- lsrs r1, 25
- movs r0, 0xB0
- subs r0, r1
- bx lr
- thumb_func_end sub_809A6D0
-
thumb_func_start sub_809A6DC
sub_809A6DC: @ 809A6DC
push {r4,r5,lr}
diff --git a/src/pokemon/pokemon_storage_system_4.c b/src/pokemon/pokemon_storage_system_4.c
index b0378a254..b48b20d5c 100644
--- a/src/pokemon/pokemon_storage_system_4.c
+++ b/src/pokemon/pokemon_storage_system_4.c
@@ -891,3 +891,49 @@ const struct SpriteTemplate gSpriteTemplate_83BB2B8 = {
gDummySpriteAffineAnimTable,
SpriteCallbackDummy
};
+
+void sub_809A598(void)
+{
+ if (gPokemonStorageSystemPtr->unk_0cca == 0)
+ FreeSpriteTilesByTag(4);
+ else
+ FreeSpriteTilesByTag(3);
+ gPokemonStorageSystemPtr->unk_0cf0[0] = gPokemonStorageSystemPtr->unk_0cf8[0];
+ gPokemonStorageSystemPtr->unk_0cf0[1] = gPokemonStorageSystemPtr->unk_0cf8[1];
+}
+
+void sub_809A5E8(struct Sprite *sprite)
+{
+ if (sprite->data[2])
+ sprite->data[2]--;
+ else if ((sprite->pos1.x += sprite->data[0]) == sprite->data[1])
+ sprite->callback = SpriteCallbackDummy;
+}
+
+void sub_809A61C(struct Sprite *sprite)
+{
+ if (sprite->data[1])
+ sprite->data[1]--;
+ else
+ {
+ sprite->pos1.x += sprite->data[0];
+ sprite->data[2] = sprite->pos1.x + sprite->pos2.x;
+ if (sprite->data[2] < 0x40 || sprite->data[2] > 0x100)
+ DestroySprite(sprite);
+ }
+}
+
+void sub_809A654(void)
+{
+ u8 boxId = get_preferred_box();
+ u8 wallpaperId = gPokemonStorage.wallpaper[boxId];
+ if (gPokemonStorageSystemPtr->unk_0cca == 0)
+ CpuCopy16(gUnknown_083BB0A8[wallpaperId], gPlttBufferUnfaded + gPokemonStorageSystemPtr->unk_0cec, 4);
+ else
+ CpuCopy16(gUnknown_083BB0A8[wallpaperId], gPlttBufferUnfaded + gPokemonStorageSystemPtr->unk_0cee, 4);
+}
+
+s16 sub_809A6D0(u8 width)
+{
+ return 0xb0 - width / 2;
+}