summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/pokemon_storage_system.s179
-rw-r--r--include/decoration.h1
-rw-r--r--include/pokemon.h2
-rw-r--r--src/pokemon/pokemon_storage_system.c65
4 files changed, 65 insertions, 182 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s
index 8fc6cfdb2..0f7180cc2 100644
--- a/asm/pokemon_storage_system.s
+++ b/asm/pokemon_storage_system.s
@@ -5,185 +5,6 @@
.text
- thumb_func_start ShowPokemonStorageSystem
-ShowPokemonStorageSystem: @ 8096100
- push {lr}
- ldr r0, _08096128 @ =Task_PokemonStorageSystem
- movs r1, 0x50
- bl CreateTask
- lsls r0, 24
- lsrs r0, 24
- ldr r2, _0809612C @ =gTasks
- lsls r1, r0, 2
- adds r1, r0
- lsls r1, 3
- adds r1, r2
- movs r0, 0
- strh r0, [r1, 0x8]
- strh r0, [r1, 0xA]
- bl ScriptContext2_Enable
- pop {r0}
- bx r0
- .align 2, 0
-_08096128: .4byte Task_PokemonStorageSystem
-_0809612C: .4byte gTasks
- thumb_func_end ShowPokemonStorageSystem
-
- thumb_func_start sub_8096130
-sub_8096130: @ 8096130
- push {lr}
- ldr r0, _0809615C @ =Task_PokemonStorageSystem
- movs r1, 0x50
- bl CreateTask
- lsls r0, 24
- lsrs r0, 24
- ldr r2, _08096160 @ =gTasks
- lsls r1, r0, 2
- adds r1, r0
- lsls r1, 3
- adds r1, r2
- movs r0, 0
- strh r0, [r1, 0x8]
- ldr r0, _08096164 @ =gUnknown_02038474
- ldrb r0, [r0]
- strh r0, [r1, 0xA]
- bl pal_fill_black
- pop {r0}
- bx r0
- .align 2, 0
-_0809615C: .4byte Task_PokemonStorageSystem
-_08096160: .4byte gTasks
-_08096164: .4byte gUnknown_02038474
- thumb_func_end sub_8096130
-
- thumb_func_start StorageSystemCreatePrimaryMenu
-StorageSystemCreatePrimaryMenu: @ 8096168
- push {r4,lr}
- sub sp, 0x8
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- movs r0, 0
- movs r1, 0
- movs r2, 0xD
- movs r3, 0x9
- bl MenuDrawTextWindow
- ldr r3, _080961A4 @ =gUnknown_083B600C
- movs r0, 0x1
- movs r1, 0x1
- movs r2, 0x4
- bl PrintMenuItems
- str r4, [sp]
- movs r0, 0xC
- str r0, [sp, 0x4]
- movs r0, 0
- movs r1, 0x1
- movs r2, 0x1
- movs r3, 0x4
- bl InitMenu
- add sp, 0x8
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_080961A4: .4byte gUnknown_083B600C
- thumb_func_end StorageSystemCreatePrimaryMenu
-
- thumb_func_start sub_80961A8
-sub_80961A8: @ 80961A8
- push {lr}
- ldr r1, _080961C4 @ =gUnknown_02038474
- ldr r0, _080961C8 @ =gUnknown_083B6DB4
- ldr r0, [r0]
- ldrb r0, [r0, 0x5]
- strb r0, [r1]
- ldr r1, _080961CC @ =gFieldCallback
- ldr r0, _080961D0 @ =sub_8096130
- str r0, [r1]
- ldr r0, _080961D4 @ =c2_exit_to_overworld_2_switch
- bl SetMainCallback2
- pop {r0}
- bx r0
- .align 2, 0
-_080961C4: .4byte gUnknown_02038474
-_080961C8: .4byte gUnknown_083B6DB4
-_080961CC: .4byte gFieldCallback
-_080961D0: .4byte sub_8096130
-_080961D4: .4byte c2_exit_to_overworld_2_switch
- thumb_func_end sub_80961A8
-
- thumb_func_start ResetPokemonStorageSystem
-ResetPokemonStorageSystem: @ 80961D8
- push {r4-r7,lr}
- ldr r1, _08096258 @ =gPokemonStorage
- movs r0, 0
- strb r0, [r1]
- movs r5, 0
- adds r7, r1, 0x4
-_080961E4:
- movs r4, 0
- lsls r1, r5, 2
- adds r1, r5
- lsls r0, r1, 4
- subs r0, r1
- lsls r6, r0, 5
-_080961F0:
- lsls r0, r4, 2
- adds r0, r4
- lsls r0, 4
- adds r0, r7
- adds r0, r6, r0
- bl ZeroBoxMonData
- adds r0, r4, 0x1
- lsls r0, 16
- lsrs r4, r0, 16
- cmp r4, 0x1D
- bls _080961F0
- adds r0, r5, 0x1
- lsls r0, 16
- lsrs r5, r0, 16
- cmp r5, 0xD
- bls _080961E4
- movs r5, 0
-_08096214:
- lsls r0, r5, 3
- adds r0, r5
- ldr r6, _0809625C @ =gPokemonStorage + 0x8344
- adds r0, r6
- ldr r1, _08096260 @ =gPCText_BOX
- bl StringCopy
- adds r4, r5, 0x1
- adds r1, r4, 0
- movs r2, 0
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- lsls r4, 16
- lsrs r5, r4, 16
- cmp r5, 0xD
- bls _08096214
- movs r5, 0
- adds r3, r6, 0
- adds r3, 0x7E
- movs r2, 0x3
-_0809623E:
- adds r0, r5, r3
- adds r1, r5, 0
- ands r1, r2
- strb r1, [r0]
- adds r0, r5, 0x1
- lsls r0, 16
- lsrs r5, r0, 16
- cmp r5, 0xD
- bls _0809623E
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_08096258: .4byte gPokemonStorage
-_0809625C: .4byte gPokemonStorage + 0x8344
-_08096260: .4byte gPCText_BOX
- thumb_func_end ResetPokemonStorageSystem
-
thumb_func_start sub_8096264
sub_8096264: @ 8096264
push {r4-r6,lr}
diff --git a/include/decoration.h b/include/decoration.h
index 3d619a598..4ac26998e 100644
--- a/include/decoration.h
+++ b/include/decoration.h
@@ -133,7 +133,6 @@ extern u8 gUnknown_020391A8;
extern u8 gUnknown_020391A9;
extern u8 gUnknown_020391AA;
extern u8 gUnknown_02039234;
-extern void (*gFieldCallback)(void);
extern const struct YesNoFuncTable gUnknown_083EC96C[];
extern struct UnkStruct_020391B4 gUnknown_020391B4[16];
diff --git a/include/pokemon.h b/include/pokemon.h
index 89599d994..7edd3395f 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -421,7 +421,7 @@ struct PokemonStorage
/*0x0000*/ u8 currentBox;
/*0x0004*/ struct BoxPokemon boxes[14][30];
/*0x8344*/ u8 boxNames[14][9];
- /*0x83c2*/ u8 unkArray[14];
+ /*0x83c2*/ u8 wallpaper[14];
};
struct SpindaSpot
diff --git a/src/pokemon/pokemon_storage_system.c b/src/pokemon/pokemon_storage_system.c
index a5a3bdcd8..8f0753a2d 100644
--- a/src/pokemon/pokemon_storage_system.c
+++ b/src/pokemon/pokemon_storage_system.c
@@ -1,6 +1,8 @@
#include "global.h"
#include "palette.h"
#include "field_weather.h"
+#include "overworld.h"
+#include "field_fadetransition.h"
#include "menu.h"
#include "main.h"
#include "strings.h"
@@ -20,14 +22,21 @@ struct ReverseMenuAction {
u8 *text;
};
+struct PokemonStorageSystemData {
+ u8 filler_0000[5];
+ u8 unk_0005;
+};
+
+const struct PokemonStorageSystemData *gUnknown_083B6DB4;
+
void StorageSystemCreatePrimaryMenu(u8 whichMenu);
void task_intro_29(u8 whichMenu);
extern const struct StorageAction gUnknown_083B6DF4[];
-
extern const struct ReverseMenuAction gUnknown_083B600C[];
EWRAM_DATA struct PokemonStorage gPokemonStorage = {0};
+EWRAM_DATA u8 gUnknown_02038474;
u8 sub_8095ADC(u8 boxId)
{
@@ -403,6 +412,60 @@ void Task_PokemonStorageSystem(u8 taskId)
}
}
+void ShowPokemonStorageSystem(void)
+{
+ u8 taskId = CreateTask(Task_PokemonStorageSystem, 80);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[1] = 0;
+ ScriptContext2_Enable();
+}
+
+void sub_8096130(void)
+{
+ u8 taskId = CreateTask(Task_PokemonStorageSystem, 80);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[1] = gUnknown_02038474;
+ pal_fill_black();
+}
+
+void StorageSystemCreatePrimaryMenu(u8 a0)
+{
+ MenuDrawTextWindow(0, 0, 13, 9);
+ PrintMenuItems(1, 1, 4, (const struct MenuAction *)gUnknown_083B600C);
+ InitMenu(0, 1, 1, 4, a0, 12);
+}
+
+void sub_80961A8(void)
+{
+ gUnknown_02038474 = gUnknown_083B6DB4->unk_0005;
+ gFieldCallback = sub_8096130;
+ SetMainCallback2(c2_exit_to_overworld_2_switch);
+}
+
+void ResetPokemonStorageSystem(void)
+{
+ u16 boxId;
+ u16 boxMon;
+
+ gPokemonStorage.currentBox = 0;
+ for (boxId = 0; boxId < 14; boxId++)
+ {
+ for (boxMon = 0; boxMon < 30; boxMon++)
+ {
+ ZeroBoxMonData(gPokemonStorage.boxes[boxId] + boxMon);
+ }
+ }
+ for (boxId = 0; boxId < 14; boxId++)
+ {
+ u8 *dest = StringCopy(gPokemonStorage.boxNames[boxId], gPCText_BOX);
+ ConvertIntToDecimalStringN(dest, boxId + 1, STR_CONV_MODE_LEFT_ALIGN, 2);
+ }
+ for (boxId = 0; boxId < 14; boxId++)
+ {
+ gPokemonStorage.wallpaper[boxId] = boxId & 0x03;
+ }
+}
+
asm(".section .text.8098898");
void sub_8098898(u8 index) {