summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/pokemon_storage_system.s186
-rw-r--r--include/pokemon_storage_system.h3
-rw-r--r--src/pokemon/pokemon_storage_system_3.c41
3 files changed, 43 insertions, 187 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s
index 2f7caa703..8767808fc 100644
--- a/asm/pokemon_storage_system.s
+++ b/asm/pokemon_storage_system.s
@@ -5,192 +5,6 @@
.text
- thumb_func_start sub_80996B0
-sub_80996B0: @ 80996B0
- push {r4,lr}
- lsls r0, 24
- lsrs r0, 24
- lsls r1, 24
- lsrs r4, r1, 24
- cmp r0, 0xE
- bne _080996D8
- ldr r3, _080996CC @ =gPokemonStorageSystemPtr
- ldr r1, [r3]
- ldr r0, _080996D0 @ =0x000010c8
- adds r2, r1, r0
- lsls r0, r4, 2
- ldr r4, _080996D4 @ =0x00001038
- b _080996E4
- .align 2, 0
-_080996CC: .4byte gPokemonStorageSystemPtr
-_080996D0: .4byte 0x000010c8
-_080996D4: .4byte 0x00001038
-_080996D8:
- ldr r3, _08099704 @ =gPokemonStorageSystemPtr
- ldr r1, [r3]
- ldr r0, _08099708 @ =0x000010c8
- adds r2, r1, r0
- lsls r0, r4, 2
- ldr r4, _0809970C @ =0x00001050
-_080996E4:
- adds r0, r4
- adds r1, r0
- str r1, [r2]
- ldr r1, [r3]
- ldr r2, _08099710 @ =0x00001034
- adds r0, r1, r2
- ldr r2, [r0]
- ldr r0, _08099714 @ =SpriteCallbackDummy
- str r0, [r2, 0x1C]
- ldr r4, _08099718 @ =0x00001170
- adds r1, r4
- movs r0, 0
- strb r0, [r1]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_08099704: .4byte gPokemonStorageSystemPtr
-_08099708: .4byte 0x000010c8
-_0809970C: .4byte 0x00001050
-_08099710: .4byte 0x00001034
-_08099714: .4byte SpriteCallbackDummy
-_08099718: .4byte 0x00001170
- thumb_func_end sub_80996B0
-
- thumb_func_start sub_809971C
-sub_809971C: @ 809971C
- push {r4-r7,lr}
- ldr r0, _08099730 @ =gPokemonStorageSystemPtr
- ldr r2, [r0]
- ldr r0, _08099734 @ =0x00001170
- adds r7, r2, r0
- ldrb r0, [r7]
- cmp r0, 0x10
- bne _08099738
- movs r0, 0
- b _08099800
- .align 2, 0
-_08099730: .4byte gPokemonStorageSystemPtr
-_08099734: .4byte 0x00001170
-_08099738:
- adds r0, 0x1
- strb r0, [r7]
- movs r1, 0x1
- ands r0, r1
- cmp r0, 0
- beq _0809975E
- ldr r1, _08099808 @ =0x000010c8
- adds r0, r2, r1
- ldr r0, [r0]
- ldr r1, [r0]
- ldrh r0, [r1, 0x22]
- subs r0, 0x1
- strh r0, [r1, 0x22]
- ldr r4, _0809980C @ =0x00001034
- adds r0, r2, r4
- ldr r1, [r0]
- ldrh r0, [r1, 0x22]
- adds r0, 0x1
- strh r0, [r1, 0x22]
-_0809975E:
- ldr r0, _08099808 @ =0x000010c8
- adds r5, r2, r0
- ldr r0, [r5]
- ldr r1, [r0]
- ldr r3, _08099810 @ =gSineTable
- ldrb r0, [r7]
- lsls r0, 4
- adds r0, r3
- movs r4, 0
- ldrsh r0, [r0, r4]
- cmp r0, 0
- bge _08099778
- adds r0, 0xF
-_08099778:
- asrs r0, 4
- strh r0, [r1, 0x24]
- ldr r0, _0809980C @ =0x00001034
- adds r6, r2, r0
- ldr r1, [r6]
- ldrb r0, [r7]
- lsls r0, 4
- adds r0, r3
- movs r2, 0
- ldrsh r0, [r0, r2]
- cmp r0, 0
- bge _08099792
- adds r0, 0xF
-_08099792:
- asrs r0, 4
- negs r0, r0
- strh r0, [r1, 0x24]
- ldrb r0, [r7]
- cmp r0, 0x8
- bne _080997DE
- ldr r4, [r6]
- ldr r0, [r5]
- ldr r0, [r0]
- ldrb r0, [r0, 0x5]
- movs r2, 0xC
- ands r2, r0
- ldrb r3, [r4, 0x5]
- movs r1, 0xD
- negs r1, r1
- adds r0, r1, 0
- ands r0, r3
- orrs r0, r2
- strb r0, [r4, 0x5]
- ldr r2, [r6]
- ldr r0, [r5]
- ldr r0, [r0]
- adds r0, 0x43
- ldrb r0, [r0]
- adds r2, 0x43
- strb r0, [r2]
- ldr r0, [r5]
- ldr r2, [r0]
- ldrb r0, [r2, 0x5]
- ands r1, r0
- movs r0, 0x4
- orrs r1, r0
- strb r1, [r2, 0x5]
- ldr r0, [r5]
- ldr r0, [r0]
- adds r0, 0x43
- movs r1, 0x7
- strb r1, [r0]
-_080997DE:
- ldrb r0, [r7]
- cmp r0, 0x10
- bne _080997FE
- ldr r1, [r6]
- ldr r0, [r5]
- ldr r0, [r0]
- str r0, [r6]
- ldr r0, [r5]
- str r1, [r0]
- ldr r1, [r6]
- ldr r0, _08099814 @ =sub_80999C4
- str r0, [r1, 0x1C]
- ldr r0, [r5]
- ldr r1, [r0]
- ldr r0, _08099818 @ =SpriteCallbackDummy
- str r0, [r1, 0x1C]
-_080997FE:
- movs r0, 0x1
-_08099800:
- pop {r4-r7}
- pop {r1}
- bx r1
- .align 2, 0
-_08099808: .4byte 0x000010c8
-_0809980C: .4byte 0x00001034
-_08099810: .4byte gSineTable
-_08099814: .4byte sub_80999C4
-_08099818: .4byte SpriteCallbackDummy
- thumb_func_end sub_809971C
-
thumb_func_start sub_809981C
sub_809981C: @ 809981C
push {r4,lr}
diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h
index 6040e31be..38a81c2a9 100644
--- a/include/pokemon_storage_system.h
+++ b/include/pokemon_storage_system.h
@@ -98,7 +98,8 @@ struct PokemonStorageSystemData {
struct Sprite *unk_1034;
struct Sprite *unk_1038[6]; // party
struct Sprite *unk_1050[30]; // box
- u8 filler_10c8[8];
+ struct Sprite **unk_10c8;
+ u8 filler_10cc[4];
u16 unk_10d0[40];
u16 unk_1120[40];
u8 unk_1170;
diff --git a/src/pokemon/pokemon_storage_system_3.c b/src/pokemon/pokemon_storage_system_3.c
index 28b9e2655..7f5c84b49 100644
--- a/src/pokemon/pokemon_storage_system_3.c
+++ b/src/pokemon/pokemon_storage_system_3.c
@@ -3,6 +3,7 @@
#include "global.h"
#include "constants/species.h"
#include "sprite.h"
+#include "trig.h"
#include "pokemon_icon.h"
#include "pokemon_storage_system.h"
@@ -453,3 +454,43 @@ void sub_809960C(u8 a0, u8 a1)
gPokemonStorageSystemPtr->unk_1034->callback = SpriteCallbackDummy;
gPokemonStorageSystemPtr->unk_1034 = NULL;
}
+
+void sub_80996B0(u8 a0, u8 a1)
+{
+ if (a0 == 14)
+ gPokemonStorageSystemPtr->unk_10c8 = gPokemonStorageSystemPtr->unk_1038 + a1;
+ else
+ gPokemonStorageSystemPtr->unk_10c8 = gPokemonStorageSystemPtr->unk_1050 + a1;
+ gPokemonStorageSystemPtr->unk_1034->callback = SpriteCallbackDummy;
+ gPokemonStorageSystemPtr->unk_1170 = 0;
+}
+
+bool8 sub_809971C(void)
+{
+ if (gPokemonStorageSystemPtr->unk_1170 == 16)
+ return FALSE;
+ gPokemonStorageSystemPtr->unk_1170++;
+ if (gPokemonStorageSystemPtr->unk_1170 & 1)
+ {
+ (*gPokemonStorageSystemPtr->unk_10c8)->pos1.y--;
+ gPokemonStorageSystemPtr->unk_1034->pos1.y++;
+ }
+ (*gPokemonStorageSystemPtr->unk_10c8)->pos2.x = gSineTable[gPokemonStorageSystemPtr->unk_1170 * 8] / 16;
+ gPokemonStorageSystemPtr->unk_1034->pos2.x = -(gSineTable[gPokemonStorageSystemPtr->unk_1170 * 8] / 16);
+ if (gPokemonStorageSystemPtr->unk_1170 == 8)
+ {
+ gPokemonStorageSystemPtr->unk_1034->oam.priority = (*gPokemonStorageSystemPtr->unk_10c8)->oam.priority;
+ gPokemonStorageSystemPtr->unk_1034->subpriority = (*gPokemonStorageSystemPtr->unk_10c8)->subpriority;
+ (*gPokemonStorageSystemPtr->unk_10c8)->oam.priority = 1;
+ (*gPokemonStorageSystemPtr->unk_10c8)->subpriority = 7;
+ }
+ if (gPokemonStorageSystemPtr->unk_1170 == 16)
+ {
+ struct Sprite *sprite = gPokemonStorageSystemPtr->unk_1034;
+ gPokemonStorageSystemPtr->unk_1034 = *(gPokemonStorageSystemPtr->unk_10c8);
+ (*gPokemonStorageSystemPtr->unk_10c8) = sprite;
+ gPokemonStorageSystemPtr->unk_1034->callback = sub_80999C4;
+ (*gPokemonStorageSystemPtr->unk_10c8)->callback = SpriteCallbackDummy;
+ }
+ return TRUE;
+}