summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2017-06-28 19:09:19 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2017-06-28 21:40:36 -0400
commit5c8320f9e1f8735272e2b8239fbba3b2b6eb69c4 (patch)
tree2b9ec9eb9ed92e4b3e204d4a10bdaa384971193f
parentea9652139728e41317b900f0aba5f50478643fc5 (diff)
sub_81369CC
-rw-r--r--asm/use_pokeblock.s170
-rwxr-xr-x[-rw-r--r--]include/pokenav.h30
-rwxr-xr-x[-rw-r--r--]src/use_pokeblock.c57
3 files changed, 79 insertions, 178 deletions
diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s
index 2cb9110dd..a2c16bc16 100644
--- a/asm/use_pokeblock.s
+++ b/asm/use_pokeblock.s
@@ -6,176 +6,6 @@
.text
- thumb_func_start sub_81369CC
-sub_81369CC: @ 81369CC
- push {r4-r6,lr}
- ldr r1, _081369E8 @ =gUnknown_02039304
- ldr r0, [r1]
- adds r0, 0x50
- ldrb r0, [r0]
- adds r4, r1, 0
- cmp r0, 0x5
- bls _081369DE
- b _08136B32
-_081369DE:
- lsls r0, 2
- ldr r1, _081369EC @ =_081369F0
- adds r0, r1
- ldr r0, [r0]
- mov pc, r0
- .align 2, 0
-_081369E8: .4byte gUnknown_02039304
-_081369EC: .4byte _081369F0
- .align 2, 0
-_081369F0:
- .4byte _08136A08
- .4byte _08136A48
- .4byte _08136A5C
- .4byte _08136AAC
- .4byte _08136AEC
- .4byte _08136B0E
-_08136A08:
- ldr r3, [r4]
- ldr r2, _08136A38 @ =gPlayerParty
- str r2, [r3, 0xC]
- ldr r0, _08136A3C @ =gUnknown_083DFEC4
- ldr r1, [r0]
- ldr r5, _08136A40 @ =0x000087dc
- adds r0, r1, r5
- movs r5, 0
- ldrsh r0, [r0, r5]
- lsls r0, 2
- adds r1, r0
- ldr r0, _08136A44 @ =0x0000893e
- adds r1, r0
- ldrb r0, [r1]
- lsls r0, 27
- lsrs r0, 27
- movs r1, 0x64
- muls r0, r1
- adds r0, r2
- str r0, [r3, 0xC]
- bl move_anim_execute
- b _08136B02
- .align 2, 0
-_08136A38: .4byte gPlayerParty
-_08136A3C: .4byte gUnknown_083DFEC4
-_08136A40: .4byte 0x000087dc
-_08136A44: .4byte 0x0000893e
-_08136A48:
- ldr r0, _08136A58 @ =gMain
- ldrh r1, [r0, 0x2E]
- movs r0, 0x3
- ands r0, r1
- cmp r0, 0
- beq _08136B32
- b _08136B02
- .align 2, 0
-_08136A58: .4byte gMain
-_08136A5C:
- bl sub_8136EF0
- ldr r6, _08136A98 @ =gUnknown_02039304
- ldr r0, [r6]
- adds r0, 0x5C
- ldr r1, _08136A9C @ =gUnknown_083DFEC4
- ldr r4, [r1]
- ldr r1, _08136AA0 @ =0x00009040
- adds r5, r4, r1
- adds r1, r5, 0
- bl sub_80F567C
- ldr r1, _08136AA4 @ =0x00008fe9
- adds r0, r4, r1
- movs r1, 0
- ldrsb r1, [r0, r1]
- lsls r0, r1, 2
- adds r0, r1
- lsls r0, 2
- ldr r1, _08136AA8 @ =0x00009004
- adds r0, r1
- adds r4, r0
- adds r0, r4, 0
- adds r1, r5, 0
- bl sub_80F5550
- bl sub_8137138
- ldr r1, [r6]
- b _08136B04
- .align 2, 0
-_08136A98: .4byte gUnknown_02039304
-_08136A9C: .4byte gUnknown_083DFEC4
-_08136AA0: .4byte 0x00009040
-_08136AA4: .4byte 0x00008fe9
-_08136AA8: .4byte 0x00009004
-_08136AAC:
- bl sub_80F555C
- lsls r0, 24
- lsrs r4, r0, 24
- cmp r4, 0
- bne _08136B32
- ldr r0, _08136AE0 @ =gUnknown_083DFEC4
- ldr r0, [r0]
- ldr r5, _08136AE4 @ =0x000087dc
- adds r0, r5
- ldrb r0, [r0]
- bl sub_81370A4
- lsls r0, 24
- lsrs r0, 24
- bl sub_80F7224
- bl sub_80F3D00
- ldr r1, _08136AE8 @ =gUnknown_02039304
- ldr r0, [r1]
- adds r0, 0x52
- strb r4, [r0]
- ldr r1, [r1]
- b _08136B04
- .align 2, 0
-_08136AE0: .4byte gUnknown_083DFEC4
-_08136AE4: .4byte 0x000087dc
-_08136AE8: .4byte gUnknown_02039304
-_08136AEC:
- ldr r1, [r4]
- adds r1, 0x52
- ldrb r0, [r1]
- adds r0, 0x1
- strb r0, [r1]
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x10
- bls _08136B32
- bl sub_8136C6C
-_08136B02:
- ldr r1, [r4]
-_08136B04:
- adds r1, 0x50
- ldrb r0, [r1]
- adds r0, 0x1
- strb r0, [r1]
- b _08136B32
-_08136B0E:
- ldr r0, _08136B38 @ =gMain
- ldrh r1, [r0, 0x2E]
- movs r0, 0x3
- ands r0, r1
- cmp r0, 0
- beq _08136B32
- bl sub_8136D00
- lsls r0, 24
- cmp r0, 0
- bne _08136B32
- ldr r0, _08136B3C @ =gScriptItemId
- ldrb r0, [r0]
- bl sub_810CA6C
- ldr r0, _08136B40 @ =sub_8136B44
- bl launch_c3_walk_stairs_and_run_once
-_08136B32:
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_08136B38: .4byte gMain
-_08136B3C: .4byte gScriptItemId
-_08136B40: .4byte sub_8136B44
- thumb_func_end sub_81369CC
-
thumb_func_start sub_8136B44
sub_8136B44: @ 8136B44
push {r4,lr}
diff --git a/include/pokenav.h b/include/pokenav.h
index 5fffc91fb..a35bd3117 100644..100755
--- a/include/pokenav.h
+++ b/include/pokenav.h
@@ -10,11 +10,17 @@ struct UnkPokenavStruct_Sub1 {
/*0x00*/ void (*unk0)(void);
/*0x04*/ MainCallback callback;
/*0x08*/ struct Pokeblock *pokeblock;
- /*0x0C*/ u8 fillerC[0x44];
+ /*0x0C*/ struct Pokemon *pokemon;
+ /*0x10*/ u8 fillerC[0x40];
/*0x50*/ u8 unk50;
- /*0x51*/ u8 unk51[4];
- /*0x56*/ u8 unk55;
+ /*0x51*/ u8 unk51;
+ /*0x52*/ u8 unk52;
+ /*0x53*/ u8 unk53;
+ /*0x54*/ u8 unk54;
+ /*0x55*/ u8 unk55;
/*0x56*/ u8 unk56;
+ /*0x57*/ u8 fil57[5];
+ /*0x5c*/ u8 unk5c[1];
};
struct UnkPokenavStruct_Sub2 {
@@ -22,6 +28,11 @@ struct UnkPokenavStruct_Sub2 {
/*0x26*/ u16 unk26;
};
+struct UnkUsePokeblockSub {
+ /*0*/ u8 fil0[2];
+ /*2*/ u8 partyIdx:5;
+};
+
struct UnkPokenavStruct {
/*0x0000*/ u8 filler0000[0x30c];
/*0x0000*/ u16 unk030C;
@@ -38,11 +49,15 @@ struct UnkPokenavStruct {
/*0x87E0*/ void *unk87E0;
/*0x87E4*/ u8 filler87E4[0x44];
/*0x8828*/ u8 unk8828;
- /*0x8829*/ u8 filler8829[0x7c7];
+ /*0x8829*/ u8 filler8829[0x113];
+ /*0x893C*/ struct UnkUsePokeblockSub unk893c[0x1ab];
+ /*0x8fe8*/ u8 fil8fe8[1];
+ /*0x8fe9*/ s8 unk8fe9;
+ /*0x8fea*/ u8 fil8fea[6];
/*0x8ff0*/ u8 unk8ff0;
/*0x8ff1*/ u8 filler8ff1[0x13];
- /*0x9004*/ u8 unk9004;
- /*0x9005*/ u8 filler9005[0x33f];
+ /*0x9004*/ u8 unk9004[3][20];
+ /*0x9040*/ u8 unk9040[0x304];
/*0x9344*/ u8 unk9344;
/*0x9345*/ u8 filler9345[0x3ba3];
/*0xCEE8*/ struct UnkPokenavStruct_Sub unkCEE8[78];
@@ -76,5 +91,8 @@ void sub_80EBA5C(void);
void sub_80F5060(bool8);
void move_anim_execute(void);
bool8 gpu_sync_bg_show(void);
+void sub_80F5550(void *, void *);
+bool8 sub_80F555C(void);
+void sub_80F7224(u8);
#endif // GUARD_POKENAV_H
diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c
index f84ecad08..861a3efcd 100644..100755
--- a/src/use_pokeblock.c
+++ b/src/use_pokeblock.c
@@ -12,6 +12,7 @@
#include "menu.h"
#include "sound.h"
#include "songs.h"
+#include "pokeblock.h"
#include "pokeblock_feed.h"
#include "use_pokeblock.h"
@@ -24,6 +25,7 @@ u8 gUnknown_02039310;
extern struct UnkPokenavStruct_Sub1 *gUnknown_02039304;
extern u16 gKeyRepeatStartDelay;
+extern u16 gScriptItemId; // remove after merge of #349 Pokeblock
void launch_c3_walk_stairs_and_run_once(void (*const)(void));
void sub_81361E4(void);
@@ -46,6 +48,10 @@ void sub_8136808(void);
void sub_8136D8C(void);
u8 sub_81370A4(u8);
void sub_81369CC(void);
+void sub_8136EF0(void);
+void sub_8137138(void);
+void sub_8136C6C(void);
+bool8 sub_8136D00(void);
void sub_8136130(struct Pokeblock *pokeblock, MainCallback callback)
{
@@ -217,7 +223,7 @@ void sub_8136294(void)
gUnknown_02039304->unk50++;
break;
case 17:
- sub_80F567C(&gUnknown_083DFEC4->unk8ff0, &gUnknown_083DFEC4->unk9004);
+ sub_80F567C(&gUnknown_083DFEC4->unk8ff0, gUnknown_083DFEC4->unk9004);
sub_80F5B38();
gUnknown_02039304->unk50++;
break;
@@ -228,7 +234,7 @@ void sub_8136294(void)
}
break;
case 19:
- sub_80F556C(&gUnknown_083DFEC4->unk9004);
+ sub_80F556C(gUnknown_083DFEC4->unk9004);
gUnknown_02039304->unk50++;
break;
case 20:
@@ -443,3 +449,50 @@ void sub_81368A4(void)
break;
}
}
+
+void sub_81369CC(void)
+{
+ switch (gUnknown_02039304->unk50)
+ {
+ case 0:
+ gUnknown_02039304->pokemon = &gPlayerParty[0];
+ gUnknown_02039304->pokemon = &gPlayerParty[gUnknown_083DFEC4->unk893c[gUnknown_083DFEC4->unk87DC].partyIdx];
+ move_anim_execute();
+ gUnknown_02039304->unk50++;
+ break;
+ case 1:
+ if (gMain.newKeys & (A_BUTTON | B_BUTTON))
+ gUnknown_02039304->unk50++;
+ break;
+ case 2:
+ sub_8136EF0();
+ sub_80F567C(gUnknown_02039304->unk5c, gUnknown_083DFEC4->unk9040);
+ sub_80F5550(gUnknown_083DFEC4->unk9004[gUnknown_083DFEC4->unk8fe9], gUnknown_083DFEC4->unk9040);
+ sub_8137138();
+ gUnknown_02039304->unk50++;
+ break;
+ case 3:
+ if (!sub_80F555C())
+ {
+ sub_80F7224(sub_81370A4(gUnknown_083DFEC4->unk87DC));
+ sub_80F3D00();
+ gUnknown_02039304->unk52 = 0;
+ gUnknown_02039304->unk50++;
+ }
+ break;
+ case 4:
+ if ((++gUnknown_02039304->unk52) > 16)
+ {
+ sub_8136C6C();
+ gUnknown_02039304->unk50++;
+ }
+ break;
+ case 5:
+ if (gMain.newKeys & (A_BUTTON | B_BUTTON) && !sub_8136D00())
+ {
+ sub_810CA6C((u8)gScriptItemId);
+ launch_c3_walk_stairs_and_run_once(sub_8136B44);
+ }
+ break;
+ }
+}