summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-01-10 20:20:16 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-01-10 20:20:16 -0500
commite0726bf8d6af39f287c65ad22ce192988e8468bb (patch)
tree2200ce00c31c356b5bddeb5d619691de44f5e44f
parentcb28e3a679841c01191f19cb7e7f0da28f0bf160 (diff)
through sub_8099374
-rw-r--r--asm/pokemon_storage_system.s371
-rw-r--r--include/pokemon_storage_system.h13
-rw-r--r--src/pokemon/pokemon_storage_system_2.c4
-rw-r--r--src/pokemon/pokemon_storage_system_3.c101
4 files changed, 110 insertions, 379 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s
index 3c4a03ad5..a794269eb 100644
--- a/asm/pokemon_storage_system.s
+++ b/asm/pokemon_storage_system.s
@@ -5,377 +5,6 @@
.text
- thumb_func_start sub_80990AC
-sub_80990AC: @ 80990AC
- push {r4-r6,lr}
- ldr r0, _080990D4 @ =gPokemonStorageSystemPtr
- ldr r4, [r0]
- ldr r0, _080990D8 @ =0x00001172
- adds r3, r4, r0
- ldrh r0, [r3]
- cmp r0, 0
- beq _080990C0
- subs r0, 0x1
- strh r0, [r3]
-_080990C0:
- ldr r1, _080990DC @ =0x0000117c
- adds r6, r4, r1
- ldrb r0, [r6]
- cmp r0, 0x1
- beq _08099138
- cmp r0, 0x1
- bgt _080990E0
- cmp r0, 0
- beq _080990E8
- b _080991F0
- .align 2, 0
-_080990D4: .4byte gPokemonStorageSystemPtr
-_080990D8: .4byte 0x00001172
-_080990DC: .4byte 0x0000117c
-_080990E0:
- cmp r0, 0x2
- bne _080990E6
- b _080991E0
-_080990E6:
- b _080991F0
-_080990E8:
- ldr r2, _0809912C @ =0x00001174
- adds r5, r4, r2
- ldr r3, _08099130 @ =0x00001176
- adds r0, r4, r3
- ldrh r0, [r0]
- ldrh r1, [r5]
- adds r0, r1
- strh r0, [r5]
- subs r0, 0x41
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0xBA
- bhi _08099104
- b _080991F8
-_08099104:
- adds r2, 0x6
- adds r0, r4, r2
- ldrb r0, [r0]
- bl sub_8098EA0
- ldr r3, _08099134 @ =0x0000117b
- adds r0, r4, r3
- movs r1, 0
- ldrsb r1, [r0, r1]
- lsls r0, r1, 1
- adds r0, r1
- lsls r0, 3
- ldrh r1, [r5]
- adds r0, r1
- strh r0, [r5]
- ldrb r0, [r6]
- adds r0, 0x1
- strb r0, [r6]
- b _080991F8
- .align 2, 0
-_0809912C: .4byte 0x00001174
-_08099130: .4byte 0x00001176
-_08099134: .4byte 0x0000117b
-_08099138:
- ldr r2, _08099194 @ =0x00001174
- adds r1, r4, r2
- ldr r5, _08099198 @ =0x00001176
- adds r2, r4, r5
- ldrh r0, [r2]
- ldrh r5, [r1]
- adds r0, r5
- strh r0, [r1]
- ldr r0, _0809919C @ =0x0000117a
- adds r5, r4, r0
- ldrb r0, [r5]
- ldrh r1, [r3]
- movs r3, 0
- ldrsh r2, [r2, r3]
- bl sub_8098EE0
- ldr r2, _080991A0 @ =0x00001178
- adds r1, r4, r2
- lsls r0, 24
- lsrs r0, 24
- ldrh r3, [r1]
- adds r0, r3
- strh r0, [r1]
- ldr r1, _080991A4 @ =0x0000117b
- adds r0, r4, r1
- movs r1, 0
- ldrsb r1, [r0, r1]
- cmp r1, 0
- ble _08099178
- ldrb r0, [r5]
- cmp r0, 0x5
- beq _08099182
-_08099178:
- cmp r1, 0
- bge _080991B0
- ldrb r0, [r5]
- cmp r0, 0
- bne _080991B0
-_08099182:
- ldr r0, _080991A8 @ =gPokemonStorageSystemPtr
- ldr r1, [r0]
- ldr r2, _080991AC @ =0x0000117c
- adds r1, r2
- ldrb r0, [r1]
- adds r0, 0x1
- strb r0, [r1]
- b _080991F8
- .align 2, 0
-_08099194: .4byte 0x00001174
-_08099198: .4byte 0x00001176
-_0809919C: .4byte 0x0000117a
-_080991A0: .4byte 0x00001178
-_080991A4: .4byte 0x0000117b
-_080991A8: .4byte gPokemonStorageSystemPtr
-_080991AC: .4byte 0x0000117c
-_080991B0:
- ldr r0, _080991D0 @ =gPokemonStorageSystemPtr
- ldr r1, [r0]
- ldr r5, _080991D4 @ =0x0000117a
- adds r3, r1, r5
- ldr r2, _080991D8 @ =0x0000117b
- adds r0, r1, r2
- ldrb r0, [r0]
- ldrb r5, [r3]
- adds r0, r5
- movs r2, 0
- strb r0, [r3]
- ldr r0, _080991DC @ =0x0000117c
- adds r1, r0
- strb r2, [r1]
- b _080991F8
- .align 2, 0
-_080991D0: .4byte gPokemonStorageSystemPtr
-_080991D4: .4byte 0x0000117a
-_080991D8: .4byte 0x0000117b
-_080991DC: .4byte 0x0000117c
-_080991E0:
- ldr r1, _080991F4 @ =0x00001178
- adds r0, r4, r1
- ldrh r0, [r0]
- cmp r0, 0
- bne _080991F8
- ldrh r0, [r3]
- adds r0, 0x1
- strh r0, [r3]
-_080991F0:
- movs r0, 0
- b _080991FA
- .align 2, 0
-_080991F4: .4byte 0x00001178
-_080991F8:
- movs r0, 0x1
-_080991FA:
- pop {r4-r6}
- pop {r1}
- bx r1
- thumb_func_end sub_80990AC
-
- thumb_func_start sub_8099200
-sub_8099200: @ 8099200
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- sub sp, 0x8
- lsls r0, 24
- lsrs r0, 24
- mov r8, r0
- ldr r4, _080992A0 @ =gPlayerParty
- adds r0, r4, 0
- movs r1, 0x41
- bl GetMonData
- lsls r0, 16
- lsrs r5, r0, 16
- adds r0, r4, 0
- movs r1, 0
- bl GetMonData
- adds r1, r0, 0
- movs r0, 0x1
- str r0, [sp]
- movs r0, 0xB
- str r0, [sp, 0x4]
- adds r0, r5, 0
- movs r2, 0x68
- movs r3, 0x40
- bl PSS_SpawnMonIconSprite
- ldr r1, _080992A4 @ =gPokemonStorageSystemPtr
- ldr r1, [r1]
- ldr r2, _080992A8 @ =0x00001038
- adds r1, r2
- str r0, [r1]
- movs r7, 0x1
- movs r6, 0x1
-_08099246:
- movs r0, 0x64
- adds r1, r6, 0
- muls r1, r0
- ldr r0, _080992A0 @ =gPlayerParty
- adds r4, r1, r0
- adds r0, r4, 0
- movs r1, 0x41
- bl GetMonData
- lsls r0, 16
- lsrs r5, r0, 16
- cmp r5, 0
- beq _080992AC
- adds r0, r4, 0
- movs r1, 0
- bl GetMonData
- adds r1, r0, 0
- subs r0, r6, 0x1
- lsls r3, r0, 1
- adds r3, r0
- lsls r3, 19
- movs r0, 0x80
- lsls r0, 13
- adds r3, r0
- asrs r3, 16
- movs r0, 0x1
- str r0, [sp]
- movs r0, 0xB
- str r0, [sp, 0x4]
- adds r0, r5, 0
- movs r2, 0x98
- bl PSS_SpawnMonIconSprite
- ldr r1, _080992A4 @ =gPokemonStorageSystemPtr
- ldr r1, [r1]
- lsls r2, r6, 2
- ldr r3, _080992A8 @ =0x00001038
- adds r1, r3
- adds r1, r2
- str r0, [r1]
- adds r0, r7, 0x1
- lsls r0, 16
- lsrs r7, r0, 16
- b _080992BA
- .align 2, 0
-_080992A0: .4byte gPlayerParty
-_080992A4: .4byte gPokemonStorageSystemPtr
-_080992A8: .4byte 0x00001038
-_080992AC:
- ldr r0, _08099308 @ =gPokemonStorageSystemPtr
- ldr r0, [r0]
- lsls r1, r6, 2
- ldr r2, _0809930C @ =0x00001038
- adds r0, r2
- adds r0, r1
- str r5, [r0]
-_080992BA:
- adds r0, r6, 0x1
- lsls r0, 16
- lsrs r6, r0, 16
- cmp r6, 0x5
- bls _08099246
- mov r3, r8
- cmp r3, 0
- bne _080992FA
- movs r6, 0
- cmp r6, r7
- bcs _080992FA
- ldr r0, _08099308 @ =gPokemonStorageSystemPtr
- ldr r0, [r0]
- ldr r1, _0809930C @ =0x00001038
- adds r3, r0, r1
- movs r4, 0x4
-_080992DA:
- lsls r1, r6, 2
- adds r1, r3, r1
- ldr r2, [r1]
- ldrh r0, [r2, 0x22]
- subs r0, 0xA0
- strh r0, [r2, 0x22]
- ldr r1, [r1]
- adds r1, 0x3E
- ldrb r0, [r1]
- orrs r0, r4
- strb r0, [r1]
- adds r0, r6, 0x1
- lsls r0, 16
- lsrs r6, r0, 16
- cmp r6, r7
- bcc _080992DA
-_080992FA:
- add sp, 0x8
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_08099308: .4byte gPokemonStorageSystemPtr
-_0809930C: .4byte 0x00001038
- thumb_func_end sub_8099200
-
- thumb_func_start sub_8099310
-sub_8099310: @ 8099310
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- ldr r0, _08099368 @ =gPokemonStorageSystemPtr
- ldr r2, [r0]
- ldr r0, _0809936C @ =0x00001171
- adds r1, r2, r0
- movs r0, 0
- strb r0, [r1]
- movs r5, 0
- movs r6, 0
- mov r8, r2
- ldr r7, _0809936C @ =0x00001171
- add r7, r8
-_0809932C:
- lsls r1, r5, 2
- ldr r0, _08099370 @ =0x00001038
- add r0, r8
- adds r4, r0, r1
- ldr r0, [r4]
- cmp r0, 0
- beq _08099354
- cmp r5, r6
- beq _0809934E
- adds r1, r6, 0
- bl sub_8099388
- movs r0, 0
- str r0, [r4]
- ldrb r0, [r7]
- adds r0, 0x1
- strb r0, [r7]
-_0809934E:
- adds r0, r6, 0x1
- lsls r0, 16
- lsrs r6, r0, 16
-_08099354:
- adds r0, r5, 0x1
- lsls r0, 16
- lsrs r5, r0, 16
- cmp r5, 0x5
- bls _0809932C
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_08099368: .4byte gPokemonStorageSystemPtr
-_0809936C: .4byte 0x00001171
-_08099370: .4byte 0x00001038
- thumb_func_end sub_8099310
-
- thumb_func_start sub_8099374
-sub_8099374: @ 8099374
- ldr r0, _08099380 @ =gPokemonStorageSystemPtr
- ldr r0, [r0]
- ldr r1, _08099384 @ =0x00001171
- adds r0, r1
- ldrb r0, [r0]
- bx lr
- .align 2, 0
-_08099380: .4byte gPokemonStorageSystemPtr
-_08099384: .4byte 0x00001171
- thumb_func_end sub_8099374
-
thumb_func_start sub_8099388
sub_8099388: @ 8099388
push {r4,lr}
diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h
index 0f20bfa16..6040e31be 100644
--- a/include/pokemon_storage_system.h
+++ b/include/pokemon_storage_system.h
@@ -96,18 +96,19 @@ struct PokemonStorageSystemData {
s16 unk_0d60;
u8 filler_0d62[0x2d2];
struct Sprite *unk_1034;
- struct Sprite *unk_1038[6];
- struct Sprite *unk_1050[30];
+ struct Sprite *unk_1038[6]; // party
+ struct Sprite *unk_1050[30]; // box
u8 filler_10c8[8];
u16 unk_10d0[40];
u16 unk_1120[40];
- u8 filler_1170[2];
+ u8 unk_1170;
+ u8 unk_1171;
u16 unk_1172;
- u16 unk_1174;
+ s16 unk_1174;
s16 unk_1176;
u16 unk_1178;
u8 unk_117a;
- u8 unk_117b;
+ s8 unk_117b;
u8 unk_117c;
u8 unk_117d;
u8 filler_117e[0x6a];
@@ -164,7 +165,7 @@ void sub_80961A8(void);
void task_intro_29(u8 whichMenu);
void ResetPokemonStorageSystem(void);
void ResetPSSMonIconSprites(void);
-void sub_8099200(u8 a0);
+void sub_8099200(bool8 a0);
void sub_8099310(void);
bool8 sub_8099374(void);
void sub_80994A8(s16 a0);
diff --git a/src/pokemon/pokemon_storage_system_2.c b/src/pokemon/pokemon_storage_system_2.c
index dbb1cf992..a158b29a9 100644
--- a/src/pokemon/pokemon_storage_system_2.c
+++ b/src/pokemon/pokemon_storage_system_2.c
@@ -1703,7 +1703,7 @@ void sub_8098400(void)
if (gUnknown_0203847C)
{
sub_8098690(TRUE);
- sub_8099200(1);
+ sub_8099200(TRUE);
sub_809D034(BG_SCREEN_ADDR(15), 10, 0, gPokemonStorageSystemPtr->unk_00a8, 0, 0, 12, 22);
}
else
@@ -1719,7 +1719,7 @@ void sub_80984E8(void)
gPokemonStorageSystemPtr->unk_08a8 = 20;
gPokemonStorageSystemPtr->unk_08aa = 2;
gPokemonStorageSystemPtr->unk_08ad = 0;
- sub_8099200(0);
+ sub_8099200(FALSE);
}
bool8 sub_8098520(void)
diff --git a/src/pokemon/pokemon_storage_system_3.c b/src/pokemon/pokemon_storage_system_3.c
index af050d324..230e9445b 100644
--- a/src/pokemon/pokemon_storage_system_3.c
+++ b/src/pokemon/pokemon_storage_system_3.c
@@ -13,6 +13,7 @@
// Static ROM declarations
void sub_8098E68(struct Sprite *sprite);
+void sub_8099388(struct Sprite *sprite, u16 a0);
void sub_80999C4(struct Sprite *sprite);
struct Sprite *PSS_SpawnMonIconSprite(u16 species, u32 personality, s16 a2, s16 a3, u8 a4, u8 a5);
void sub_8099BE0(struct Sprite *sprite);
@@ -209,3 +210,103 @@ void sub_809900C(u8 a0, s8 a1)
gPokemonStorageSystemPtr->unk_1174 = 24 * gPokemonStorageSystemPtr->unk_117a + 0x64;
sub_8098DE0(gPokemonStorageSystemPtr->unk_1176);
}
+
+bool8 sub_80990AC(void)
+{
+ if (gPokemonStorageSystemPtr->unk_1172)
+ gPokemonStorageSystemPtr->unk_1172--;
+ switch (gPokemonStorageSystemPtr->unk_117c)
+ {
+ case 0:
+ gPokemonStorageSystemPtr->unk_1174 += gPokemonStorageSystemPtr->unk_1176;
+ if (gPokemonStorageSystemPtr->unk_1174 < 0x41 || gPokemonStorageSystemPtr->unk_1174 > 0xfb)
+ {
+ sub_8098EA0(gPokemonStorageSystemPtr->unk_117a);
+ gPokemonStorageSystemPtr->unk_1174 += 24 * gPokemonStorageSystemPtr->unk_117b;
+ gPokemonStorageSystemPtr->unk_117c++;
+ }
+ break;
+ case 1:
+ gPokemonStorageSystemPtr->unk_1174 += gPokemonStorageSystemPtr->unk_1176;
+ gPokemonStorageSystemPtr->unk_1178 += sub_8098EE0(gPokemonStorageSystemPtr->unk_117a, gPokemonStorageSystemPtr->unk_1172, gPokemonStorageSystemPtr->unk_1176);
+ if ((gPokemonStorageSystemPtr->unk_117b > 0 && gPokemonStorageSystemPtr->unk_117a == 5) || (gPokemonStorageSystemPtr->unk_117b < 0 && gPokemonStorageSystemPtr->unk_117a == 0))
+ {
+ gPokemonStorageSystemPtr->unk_117c++;
+ }
+ else
+ {
+ gPokemonStorageSystemPtr->unk_117a += gPokemonStorageSystemPtr->unk_117b;
+ gPokemonStorageSystemPtr->unk_117c = 0;
+ }
+ break;
+ case 2:
+ if (gPokemonStorageSystemPtr->unk_1178 == 0)
+ {
+ gPokemonStorageSystemPtr->unk_1172++;
+ return FALSE;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void sub_8099200(bool8 a0)
+{
+ u16 count;
+ u16 i;
+ u16 species = GetMonData(gPlayerParty + 0, MON_DATA_SPECIES2);
+ u32 personality = GetMonData(gPlayerParty + 0, MON_DATA_PERSONALITY);
+ gPokemonStorageSystemPtr->unk_1038[0] = PSS_SpawnMonIconSprite(species, personality, 0x68, 0x40, 1, 11);
+ count = 1;
+ for (i = 1; i < PARTY_SIZE; i++)
+ {
+ species = GetMonData(gPlayerParty + i, MON_DATA_SPECIES2);
+ if (species != SPECIES_NONE)
+ {
+ personality = GetMonData(gPlayerParty + i, MON_DATA_PERSONALITY);
+ gPokemonStorageSystemPtr->unk_1038[i] = PSS_SpawnMonIconSprite(species, personality, 0x98, (i - 1) * 24 + 0x10, 1, 11);
+ count++;
+ }
+ else
+ {
+ gPokemonStorageSystemPtr->unk_1038[i] = NULL;
+ }
+ }
+ if (!a0)
+ {
+ for (i = 0; i < count; i++)
+ {
+ // this routine assumes party_compaction has been called
+ gPokemonStorageSystemPtr->unk_1038[i]->pos1.y -= 0xa0;
+ gPokemonStorageSystemPtr->unk_1038[i]->invisible = TRUE;
+ }
+ }
+}
+
+void sub_8099310(void)
+{
+ u16 i;
+ u16 count;
+
+ gPokemonStorageSystemPtr->unk_1171 = 0;
+ for (i = 0, count = 0; i < PARTY_SIZE; i++)
+ {
+ if (gPokemonStorageSystemPtr->unk_1038[i])
+ {
+ if (i != count)
+ {
+ sub_8099388(gPokemonStorageSystemPtr->unk_1038[i], count);
+ gPokemonStorageSystemPtr->unk_1038[i] = NULL;
+ gPokemonStorageSystemPtr->unk_1171++;
+ }
+ count++;
+ }
+ }
+}
+
+u8 sub_8099374(void)
+{
+ return gPokemonStorageSystemPtr->unk_1171;
+}