diff --git a/asm/dodrio_berry_picking.s b/asm/dodrio_berry_picking.s index 7155edf1b4..225bbad62f 100755 --- a/asm/dodrio_berry_picking.s +++ b/asm/dodrio_berry_picking.s @@ -5,214 +5,6 @@ .text - thumb_func_start sub_8024D4C -sub_8024D4C: @ 8024D4C - push {lr} - bl sub_8025D04 - ldr r1, =gUnknown_082F7AC4 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - ldrb r0, [r0, 0x18] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gUnknown_03000DB0 - ldr r0, [r0] - cmp r0, 0 - bne _08024D70 - bl sub_8026AF4 -_08024D70: - bl sub_8025D50 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024D4C - - thumb_func_start sub_8024D84 -sub_8024D84: @ 8024D84 - push {lr} - bl sub_8025E0C - ldr r1, =gUnknown_082F7AF4 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - ldrb r0, [r0, 0x18] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gUnknown_03000DB0 - ldr r0, [r0] - cmp r0, 0 - bne _08024DA8 - bl sub_8026B28 -_08024DA8: - bl sub_8025ED8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024D84 - - thumb_func_start sub_8024DBC -sub_8024DBC: @ 8024DBC - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - ldrb r0, [r0, 0x10] - cmp r0, 0 - beq _08024DD4 - cmp r0, 0x1 - beq _08024DEA - b _08024DF8 - .pool -_08024DD4: - movs r0, 0x1 - bl sub_8028504 - movs r0, 0x1 - bl sub_80292E0 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08024DF8 -_08024DEA: - bl sub_802A770 - cmp r0, 0 - bne _08024DF8 - movs r0, 0x1 - bl sub_8026240 -_08024DF8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024DBC - - thumb_func_start sub_8024E00 -sub_8024E00: @ 8024E00 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - cmp r0, 0 - bne _08024E20 - bl sub_80262C0 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08024E30 - .pool -_08024E20: - movs r0, 0x8C - lsls r0, 1 - adds r1, r0 - movs r0, 0x1 - str r0, [r1] - movs r0, 0x2 - bl sub_8026240 -_08024E30: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024E00 - - thumb_func_start sub_8024E38 -sub_8024E38: @ 8024E38 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - ldrb r0, [r0, 0x10] - adds r4, r1, 0 - cmp r0, 0x5 - bhi _08024F08 - lsls r0, 2 - ldr r1, =_08024E5C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08024E5C: - .4byte _08024E74 - .4byte _08024E90 - .4byte _08024EA0 - .4byte _08024EC4 - .4byte _08024ED8 - .4byte _08024EF8 -_08024E74: - movs r0, 0 - str r0, [sp] - movs r0, 0x7 - movs r1, 0x8 - movs r2, 0x78 - movs r3, 0x50 - bl sub_802EB24 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08024EF0 - .pool -_08024E90: - bl sub_8010434 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08024EF0 - .pool -_08024EA0: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _08024F08 - ldr r2, =gUnknown_02022C98 - ldr r1, [r2] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - movs r3, 0 - strb r0, [r1, 0x10] - ldr r0, [r2] - adds r0, 0x30 - strb r3, [r0] - b _08024F08 - .pool -_08024EC4: - bl sub_802EB84 - cmp r0, 0 - bne _08024F08 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08024EF0 - .pool -_08024ED8: - ldr r1, [r4] - adds r1, 0x30 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _08024F08 - bl sub_8010434 - ldr r1, [r4] -_08024EF0: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08024F08 -_08024EF8: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _08024F08 - movs r0, 0x3 - bl sub_8026240 -_08024F08: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024E38 - thumb_func_start sub_8024F10 sub_8024F10: @ 8024F10 push {lr} diff --git a/include/pokemon_jump.h b/include/pokemon_jump.h new file mode 100644 index 0000000000..f54e0d4605 --- /dev/null +++ b/include/pokemon_jump.h @@ -0,0 +1,7 @@ +#ifndef GUARD_POKEMON_JUMP_H +#define GUARD_POKEMON_JUMP_H + +void sub_802EB24(u8, u8, u8, u8, u8); +bool32 sub_802EB84(void); + +#endif //GUARD_POKEMON_JUMP_H diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index eef4ec2628..bc461b0d8b 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -7,6 +7,7 @@ #include "main.h" #include "constants/songs.h" #include "sound.h" +#include "pokemon_jump.h" struct DodrioBerryPickingSubstruct_0160 { @@ -83,7 +84,8 @@ struct DodrioBerryPickingStruct /*0x00F4*/ u8 unk_00F4[11][2]; /*0x010A*/ u8 filler_010A[2]; /*0x010C*/ u8 unk_010C[5]; - /*0x0111*/ u8 filler_0111[11]; + /*0x0111*/ u8 filler_0111[7]; + /*0x0118*/ u32 unk_0118; /*0x011C*/ u32 unk_011C; /*0x0120*/ u32 unk_0120; /*0x0124*/ u8 filler_0124[8]; @@ -110,24 +112,52 @@ IWRAM_DATA bool32 gUnknown_03000DB0; void sub_8024A1C(void); void sub_8024A30(struct DodrioBerryPickingStruct *); void sub_8024BC8(u8 taskId); -void sub_80261F8(struct DodrioBerryPickingSubstruct_318C *, struct Pokemon *); +void sub_8024DBC(void); +void sub_8024E00(void); +void sub_8024E38(void); +void sub_8024F10(void); +void sub_8024F38(void); +void sub_8024FFC(void); +void sub_80250D4(void); +void sub_8025198(void); +void sub_8025230(void); +void sub_8025324(void); +void sub_8025470(void); +void sub_8025644(void); +void sub_80256AC(void); +void sub_8025758(void); +void sub_8025158(void); +void sub_802589C(u8 taskId); +void sub_8025910(u8 taskId); +void sub_8025D04(void); +void sub_8025D50(void); +void sub_8025E0C(void); +void sub_8025ED8(void); void sub_80261CC(void); +void sub_80261E4(void); +void sub_80261F8(struct DodrioBerryPickingSubstruct_318C *, struct Pokemon *); +void sub_802620C(TaskFunc, u8); +void sub_802621C(TaskFunc); +void sub_8026240(u8); +void sub_80262C0(void); +void sub_8026AF4(void); +void sub_8026B28(void); void sub_8026B5C(u8, u8*, u8*); void sub_80273F0(void); -void sub_8029274(struct DodrioBerryPickingSubstruct_0160 *); -void sub_8025910(u8 taskId); -void sub_802620C(TaskFunc, u8); -bool32 sub_802A770(void); void sub_80283A8(void); void sub_8028408(struct DodrioBerryPickingSubstruct_318C *, u8, u8, u8); +void sub_8028504(u8); void sub_802868C(u8, u8); +void sub_8028734(void); void sub_8028A34(void); void sub_8028A88(void); void sub_8028D44(void); -void sub_8028734(void); -void sub_80261E4(void); -void sub_802621C(TaskFunc); -void sub_802589C(u8 taskId); +void sub_8029274(struct DodrioBerryPickingSubstruct_0160 *); +void sub_80292E0(u8); +bool32 sub_802A770(void); + +extern void (*const gUnknown_082F7AC4[])(void); +extern void (*const gUnknown_082F7AF4[])(void); void sub_802493C(u16 a0, void (*a1)(void)) { @@ -288,3 +318,96 @@ void sub_8024BC8(u8 taskId) break; } } + +void sub_8024D4C(void) +{ + sub_8025D04(); + gUnknown_082F7AC4[gUnknown_02022C98->unk_0018](); + if (gUnknown_03000DB0 == FALSE) + { + sub_8026AF4(); + } + sub_8025D50(); +} + +void sub_8024D84(void) +{ + sub_8025E0C(); + gUnknown_082F7AF4[gUnknown_02022C98->unk_0018](); + if (gUnknown_03000DB0 == FALSE) + { + sub_8026B28(); + } + sub_8025ED8(); +} + +void sub_8024DBC(void) +{ + switch (gUnknown_02022C98->unk_0010) + { + case 0: + sub_8028504(1); + sub_80292E0(1); + gUnknown_02022C98->unk_0010++; + break; + case 1: + if (!sub_802A770()) + sub_8026240(1); + break; + } +} + +void sub_8024E00(void) +{ + if (gUnknown_02022C98->unk_0010 == 0) + { + sub_80262C0(); + gUnknown_02022C98->unk_0010++; + } + else + { + gUnknown_02022C98->unk_0118 = 1; + sub_8026240(2); + } +} + +void sub_8024E38(void) +{ + switch (gUnknown_02022C98->unk_0010) + { + case 0: + sub_802EB24(7, 8, 120, 80, 0); + gUnknown_02022C98->unk_0010++; + break; + case 1: + sub_8010434(); + gUnknown_02022C98->unk_0010++; + break; + case 2: + if (IsLinkTaskFinished()) + { + gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk_0030 = 0; + } + break; + case 3: + if (!sub_802EB84()) + { + gUnknown_02022C98->unk_0010++; + } + break; + case 4: + if (++gUnknown_02022C98->unk_0030 > 5) + { + sub_8010434(); + gUnknown_02022C98->unk_0010++; + } + break; + case 5: + if (IsLinkTaskFinished()) + { + sub_8026240(3); + } + break; + } +}