summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/pokemon_storage_system.s222
-rw-r--r--data/pokemon_storage_system.s22
-rw-r--r--include/pokemon_storage_system.h4
-rw-r--r--ld_script.txt2
-rw-r--r--src/pokemon/pokemon_storage_system_4.c85
-rw-r--r--src/pokemon/pokemon_storage_system_6.c14
6 files changed, 88 insertions, 261 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s
index 835a87f5f..5a1853361 100644
--- a/asm/pokemon_storage_system.s
+++ b/asm/pokemon_storage_system.s
@@ -5,226 +5,6 @@
.text
- thumb_func_start sub_809AFB8
-sub_809AFB8: @ 809AFB8
- push {r4,r5,lr}
- ldr r5, _0809B000 @ =gUnknown_020384E4
- ldr r0, _0809B004 @ =gPokemonStorageSystemPtr
- ldr r4, [r0]
- movs r1, 0x8F
- lsls r1, 5
- adds r0, r4, r1
- ldrb r0, [r0]
- strb r0, [r5]
- ldr r1, _0809B008 @ =gUnknown_020384E5
- ldr r2, _0809B00C @ =0x000011e1
- adds r0, r4, r2
- ldrb r0, [r0]
- strb r0, [r1]
- ldr r0, _0809B010 @ =gUnknown_020384E6
- ldrb r0, [r0]
- cmp r0, 0
- bne _0809AFEA
- movs r1, 0x8E
- lsls r1, 5
- adds r0, r4, r1
- ldr r0, [r0]
- movs r1, 0
- bl StartSpriteAnim
-_0809AFEA:
- bl sub_809BF74
- movs r0, 0
- ldrsb r0, [r5, r0]
- cmp r0, 0x1
- beq _0809B020
- cmp r0, 0x1
- bgt _0809B014
- cmp r0, 0
- beq _0809B034
- b _0809B05E
- .align 2, 0
-_0809B000: .4byte gUnknown_020384E4
-_0809B004: .4byte gPokemonStorageSystemPtr
-_0809B008: .4byte gUnknown_020384E5
-_0809B00C: .4byte 0x000011e1
-_0809B010: .4byte gUnknown_020384E6
-_0809B014:
- cmp r0, 0x2
- bne _0809B05E
- movs r0, 0x1
- bl sub_809A860
- b _0809B05E
-_0809B020:
- ldr r2, _0809B030 @ =0x000011c4
- adds r0, r4, r2
- ldr r0, [r0]
- adds r0, 0x43
- movs r1, 0xC
- strb r1, [r0]
- b _0809B05E
- .align 2, 0
-_0809B030: .4byte 0x000011c4
-_0809B034:
- ldr r0, _0809B064 @ =0x000011c4
- adds r2, r4, r0
- ldr r3, [r2]
- ldrb r1, [r3, 0x5]
- movs r0, 0xD
- negs r0, r0
- ands r0, r1
- movs r1, 0x8
- orrs r0, r1
- strb r0, [r3, 0x5]
- ldr r0, [r2]
- adds r0, 0x43
- movs r1, 0x14
- strb r1, [r0]
- ldr r1, [r2]
- adds r1, 0x3E
- ldrb r2, [r1]
- movs r0, 0x5
- negs r0, r0
- ands r0, r2
- strb r0, [r1]
-_0809B05E:
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_0809B064: .4byte 0x000011c4
- thumb_func_end sub_809AFB8
-
- thumb_func_start sub_809B068
-sub_809B068: @ 809B068
- push {lr}
- ldr r0, _0809B078 @ =gUnknown_020384E6
- ldrb r0, [r0]
- cmp r0, 0
- bne _0809B07C
- movs r3, 0
- b _0809B08A
- .align 2, 0
-_0809B078: .4byte gUnknown_020384E6
-_0809B07C:
- bl CalculatePlayerPartyCount
- lsls r0, 24
- lsrs r3, r0, 24
- cmp r3, 0x5
- bls _0809B08A
- movs r3, 0x5
-_0809B08A:
- ldr r0, _0809B0B8 @ =gPokemonStorageSystemPtr
- ldr r2, [r0]
- movs r1, 0x8E
- lsls r1, 5
- adds r0, r2, r1
- ldr r0, [r0]
- adds r0, 0x3F
- ldrb r1, [r0]
- movs r0, 0x2
- ands r0, r1
- cmp r0, 0
- beq _0809B0AA
- ldr r0, _0809B0BC @ =0x000011e3
- adds r1, r2, r0
- movs r0, 0x1
- strb r0, [r1]
-_0809B0AA:
- movs r0, 0x1
- adds r1, r3, 0
- bl sub_809AF18
- pop {r0}
- bx r0
- .align 2, 0
-_0809B0B8: .4byte gPokemonStorageSystemPtr
-_0809B0BC: .4byte 0x000011e3
- thumb_func_end sub_809B068
-
- thumb_func_start sub_809B0C0
-sub_809B0C0: @ 809B0C0
- push {lr}
- adds r1, r0, 0
- lsls r1, 24
- lsrs r1, 24
- movs r0, 0
- bl sub_809AF18
- pop {r0}
- bx r0
- thumb_func_end sub_809B0C0
-
- thumb_func_start sub_809B0D4
-sub_809B0D4: @ 809B0D4
- ldr r1, _0809B0DC @ =gUnknown_020384EA
- movs r0, 0
- strb r0, [r1]
- bx lr
- .align 2, 0
-_0809B0DC: .4byte gUnknown_020384EA
- thumb_func_end sub_809B0D4
-
- thumb_func_start sub_809B0E0
-sub_809B0E0: @ 809B0E0
- ldr r0, _0809B0EC @ =gUnknown_020384EA
- ldr r1, _0809B0F0 @ =gUnknown_020384E5
- ldrb r1, [r1]
- strb r1, [r0]
- bx lr
- .align 2, 0
-_0809B0EC: .4byte gUnknown_020384EA
-_0809B0F0: .4byte gUnknown_020384E5
- thumb_func_end sub_809B0E0
-
- thumb_func_start sub_809B0F4
-sub_809B0F4: @ 809B0F4
- ldr r0, _0809B0FC @ =gUnknown_020384EA
- ldrb r0, [r0]
- bx lr
- .align 2, 0
-_0809B0FC: .4byte gUnknown_020384EA
- thumb_func_end sub_809B0F4
-
- thumb_func_start sub_809B100
-sub_809B100: @ 809B100
- lsls r0, 24
- ldr r1, _0809B120 @ =gPokemonStorageSystemPtr
- ldr r1, [r1]
- ldr r2, _0809B124 @ =0x000012a4
- adds r3, r1, r2
- ldr r2, _0809B128 @ =gUnknown_083BBBC8
- lsrs r0, 22
- adds r0, r2
- ldr r0, [r0]
- str r0, [r3]
- ldr r0, _0809B12C @ =0x000012a8
- adds r1, r0
- movs r0, 0
- strb r0, [r1]
- bx lr
- .align 2, 0
-_0809B120: .4byte gPokemonStorageSystemPtr
-_0809B124: .4byte 0x000012a4
-_0809B128: .4byte gUnknown_083BBBC8
-_0809B12C: .4byte 0x000012a8
- thumb_func_end sub_809B100
-
- thumb_func_start sub_809B130
-sub_809B130: @ 809B130
- push {lr}
- ldr r0, _0809B148 @ =gPokemonStorageSystemPtr
- ldr r0, [r0]
- ldr r1, _0809B14C @ =0x000012a4
- adds r0, r1
- ldr r0, [r0]
- bl _call_via_r0
- lsls r0, 24
- lsrs r0, 24
- pop {r1}
- bx r1
- .align 2, 0
-_0809B148: .4byte gPokemonStorageSystemPtr
-_0809B14C: .4byte 0x000012a4
- thumb_func_end sub_809B130
-
thumb_func_start sub_809B150
sub_809B150: @ 809B150
push {r4,r5,lr}
@@ -1526,8 +1306,6 @@ _0809BB88: .4byte gPokemonStorageSystemPtr
_0809BB8C: .4byte 0x0000267d
thumb_func_end sub_809B960
-// file boundary at or before here
-
thumb_func_start sub_809BB90
sub_809BB90: @ 809BB90
push {lr}
diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s
index 2af123090..4c988286d 100644
--- a/data/pokemon_storage_system.s
+++ b/data/pokemon_storage_system.s
@@ -4,28 +4,6 @@
.section .rodata
.align 2
-HandCursorPalette: @ 83BB308
- .incbin "graphics/pokemon_storage/hand_cursor_pal.bin"
-
- .align 2
-HandCursorAltPalette: @ 83BB328
- .incbin "graphics/pokemon_storage/hand_cursor_alt_pal.bin"
-
- .align 2
-HandCursorTiles: @ 83BB348
- .incbin "graphics/pokemon_storage/hand_cursor.4bpp"
-
- .align 2
-HandCursorShadowTiles: @ 83BBB48
- .incbin "graphics/pokemon_storage/hand_cursor_shadow.4bpp"
-
- .align 2
-gUnknown_083BBBC8:: @ 83BBBC8
- .4byte sub_809B150
- .4byte sub_809B1D8
- .4byte sub_809B24C
-
- .align 2
gUnknown_083BBBD4:: @ 83BBBD4
.4byte sub_809C464, 0
.4byte sub_809C664, 1
diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h
index e911664de..3191b841c 100644
--- a/include/pokemon_storage_system.h
+++ b/include/pokemon_storage_system.h
@@ -172,7 +172,9 @@ struct PokemonStorageSystemData {
u8 unk_120f[0x25];
u8 unk_1234[0x25];
u8 unk_1259[0x21];
- u8 unk_127a[0x32];
+ u8 unk_127a[0x2a];
+ bool8 (*unk_12a4)(void);
+ u8 unk_12a8;
struct Sprite *unk_12ac;
struct Sprite *unk_12b0[2];
u16 *unk_12b8;
diff --git a/ld_script.txt b/ld_script.txt
index 9bdc64fdb..d925d5c14 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -133,7 +133,6 @@ SECTIONS {
src/pokemon/pokemon_storage_system_3.o(.text);
src/pokemon/pokemon_storage_system_4.o(.text);
src/pokemon/pokemon_storage_system_5.o(.text);
- src/pokemon/pokemon_storage_system_6.o(.text);
asm/pokemon_storage_system.o(.text);
src/pokemon/pokemon_icon.o(.text);
src/pokemon/pokemon_summary_screen.o(.text);
@@ -555,6 +554,7 @@ SECTIONS {
src/pokemon/pokemon_storage_system_2.o(.rodata);
src/pokemon/pokemon_storage_system_3.o(.rodata);
src/pokemon/pokemon_storage_system_4.o(.rodata);
+ src/pokemon/pokemon_storage_system_5.o(.rodata);
data/pokemon_storage_system.o(.rodata);
src/pokemon/pokemon_icon.o(.rodata);
src/pokemon/pokemon_summary_screen.o(.rodata);
diff --git a/src/pokemon/pokemon_storage_system_4.c b/src/pokemon/pokemon_storage_system_4.c
index 06c2eeff5..2f2091259 100644
--- a/src/pokemon/pokemon_storage_system_4.c
+++ b/src/pokemon/pokemon_storage_system_4.c
@@ -25,7 +25,7 @@ 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 u8 gUnknown_020384EA = 0;
// Static ROM declarations
@@ -46,6 +46,9 @@ void sub_809A774(s8 a0);
void sub_809A810(void);
void sub_809AFB8(void);
void sub_809A8C8(struct Sprite *sprite);
+bool8 sub_809B150(void);
+bool8 sub_809B1D8(void);
+bool8 sub_809B24C(void);
bool8 sub_809BF2C(void);
void sub_809BF74(void);
void sub_809C028(void);
@@ -289,6 +292,16 @@ const struct SpriteTemplate gSpriteTemplate_83BB2F0 = {
sub_809A8C8
};
+const u16 HandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_cursor_pal.bin");
+const u16 HandCursorAltPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_cursor_alt_pal.bin");
+const u8 HandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp");
+const u8 HandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp");
+
+bool8 (*const gUnknown_083BBBC8[])(void) = {
+ sub_809B150,
+ sub_809B1D8,
+ sub_809B24C
+};
// .text
void sub_8099BF8(u8 boxId)
@@ -1306,3 +1319,73 @@ void sub_809AF18(u8 a0, u8 a1)
break;
}
}
+
+void sub_809AFB8(void)
+{
+ gUnknown_020384E4 = gPokemonStorageSystemPtr->unk_11e0;
+ gUnknown_020384E5 = gPokemonStorageSystemPtr->unk_11e1;
+ if (gUnknown_020384E6 == 0)
+ StartSpriteAnim(gPokemonStorageSystemPtr->unk_11c0, 0);
+ sub_809BF74();
+ switch (gUnknown_020384E4)
+ {
+ case 2:
+ sub_809A860(TRUE);
+ break;
+ case 1:
+ gPokemonStorageSystemPtr->unk_11c4->subpriority = 12;
+ break;
+ case 0:
+ gPokemonStorageSystemPtr->unk_11c4->oam.priority = 2;
+ gPokemonStorageSystemPtr->unk_11c4->subpriority = 20;
+ gPokemonStorageSystemPtr->unk_11c4->invisible = FALSE;
+ break;
+ }
+}
+
+void sub_809B068(void)
+{
+ u8 partyCount;
+ if (gUnknown_020384E6 == 0)
+ partyCount = 0;
+ else
+ {
+ partyCount = CalculatePlayerPartyCount();
+ if (partyCount > PARTY_SIZE - 1)
+ partyCount = PARTY_SIZE - 1;
+ }
+ if (gPokemonStorageSystemPtr->unk_11c0->vFlip)
+ gPokemonStorageSystemPtr->unk_11e3 = 1;
+ sub_809AF18(1, partyCount);
+}
+
+void sub_809B0C0(u8 a0)
+{
+ sub_809AF18(0, a0);
+}
+
+void sub_809B0D4(void)
+{
+ gUnknown_020384EA = 0;
+}
+
+void sub_809B0E0(void)
+{
+ gUnknown_020384EA = gUnknown_020384E5;
+}
+
+u8 sub_809B0F4(void)
+{
+ return gUnknown_020384EA;
+}
+
+void sub_809B100(u8 a0)
+{
+ gPokemonStorageSystemPtr->unk_12a4 = gUnknown_083BBBC8[a0];
+ gPokemonStorageSystemPtr->unk_12a8 = 0;
+}
+
+bool8 sub_809B130(void)
+{
+ return gPokemonStorageSystemPtr->unk_12a4();
+}
diff --git a/src/pokemon/pokemon_storage_system_6.c b/src/pokemon/pokemon_storage_system_6.c
deleted file mode 100644
index a781c1ed2..000000000
--- a/src/pokemon/pokemon_storage_system_6.c
+++ /dev/null
@@ -1,14 +0,0 @@
-
-// Includes
-#include "global.h"
-#include "pokemon_storage_system.h"
-
-// Static type declarations
-
-// Static RAM declarations
-
-// Static ROM declarations
-
-// .rodata
-
-// .text