From 44f7d49c2e6ee4cb58567c2566e48b859a3e3082 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 Mar 2019 09:54:19 -0400 Subject: [PATCH 01/30] Finish sub_8016CA0 --- asm/union_room.s | 169 ----------------------------------------------- src/union_room.c | 37 ++++++----- 2 files changed, 22 insertions(+), 184 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 576a1a51f..8e4cf9e1d 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,175 +5,6 @@ .text - thumb_func_start sub_8016CA0 -sub_8016CA0: @ 8016CA0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r0, 2 - add r0, r10 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r7, 0 - mov r0, sp - adds r0, 0x10 - str r0, [sp, 0x18] -_08016CC4: - lsls r2, r7, 24 - lsrs r2, 24 - mov r0, sp - ldr r1, [sp, 0x18] - bl sub_800DE7C - lsls r0, 24 - lsrs r4, r0, 24 - mov r0, sp - ldrb r0, [r0, 0xA] - lsls r0, 25 - lsrs r0, 25 - mov r2, r10 - lsls r1, r2, 2 - add r1, r10 - lsls r1, 3 - ldr r3, =gTasks - adds r1, r3 - movs r5, 0x10 - ldrsh r1, [r1, r5] - bl sub_8013D88 - cmp r0, 0 - bne _08016D00 - mov r1, sp - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} -_08016D00: - mov r0, sp - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _08016D18 - mov r1, sp - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} -_08016D18: - cmp r4, 0 - bne _08016D9C - lsls r0, r7, 3 - mov r8, r0 - adds r1, r7, 0x1 - mov r9, r1 - cmp r7, 0 - ble _08016D58 - movs r2, 0 - str r2, [sp, 0x1C] - adds r4, r7, 0 -_08016D2E: - ldr r0, [r6, 0x4] - ldr r3, [sp, 0x1C] - adds r0, r3 - mov r1, sp - bl sub_8017630 - lsls r0, 24 - cmp r0, 0 - bne _08016D4C - mov r1, sp - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} -_08016D4C: - ldr r5, [sp, 0x1C] - adds r5, 0x1C - str r5, [sp, 0x1C] - subs r4, 0x1 - cmp r4, 0 - bne _08016D2E -_08016D58: - ldr r1, [r6, 0x4] - mov r0, r8 - subs r4, r0, r7 - lsls r4, 2 - adds r1, r4 - mov r0, sp - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r6, 0x4] - adds r0, r4 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r6, 0x4] - adds r3, r4 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r4, 0x2 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - b _08016DD4 - .pool -_08016D9C: - ldr r1, [r6] - lsls r4, r7, 3 - subs r4, r7 - lsls r4, 2 - adds r1, r4 - mov r0, sp - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r6] - adds r0, r4 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r6] - adds r3, r4 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r4, 0x2 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - adds r7, 0x1 - mov r9, r7 -_08016DD4: - mov r7, r9 - cmp r7, 0x3 - bgt _08016DDC - b _08016CC4 -_08016DDC: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016CA0 - thumb_func_start sub_8016DF0 sub_8016DF0: @ 8016DF0 push {r4-r6,lr} diff --git a/src/union_room.c b/src/union_room.c index 99ae4b679..b5c0bab80 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -46,7 +46,7 @@ struct UnkStruct_Shared struct UnkStruct_x1C { struct UnkStruct_Shared unk0; - u8 unk18; + u8 unk18:1; }; struct UnkStruct_x20 @@ -3468,33 +3468,40 @@ u8 sub_8016B00(void) return r7; } -/* void sub_8016CA0(u8 taskId) { s32 i, j; - struct UnkLinkRfuStruct_02022B14 sp0; - u8 text[10]; - struct UnkStruct_Main4 *ptr = (void*) gTasks[taskId].data; + struct UnkStruct_Shared sp0; + struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data; + bool8 r4; for (i = 0; i < 4; i++) { - j = sub_800DE7C(&sp0, text, i); - if (!sub_8013D88(sp0.unk_0a_0, gTasks[taskId].data[4])) - sp0 = gUnknown_082F045C.field_0; - if (sp0.unk_00.unk_00_0 == 1) - sp0 = gUnknown_082F045C.field_0; - - if (!j) + r4 = sub_800DE7C(&sp0.field_0, sp0.playerName, i); + if (!sub_8013D88(sp0.field_0.unk_0a_0, gTasks[taskId].data[4])) + { + sp0 = gUnknown_082F045C; + } + if (sp0.field_0.unk_00.unk_00_0 == 1) + { + sp0 = gUnknown_082F045C; + } + if (!r4) { for (j = 0; j < i; j++) { - if (sub_8017630()) + if (!sub_8017630(&ptr[1]->arr[j].unk0, &sp0)) + { + sp0 = gUnknown_082F045C; + } } + ptr[1]->arr[i].unk0 = sp0; + ptr[1]->arr[i].unk18 = sub_8017630(&ptr[1]->arr[i].unk0, &gUnknown_082F045C); } else { - + ptr[0]->arr[i].unk0 = sp0; + ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C); } } } -*/ From 9a8b001ebf66a3c657512fb660b3c4768dabad1c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 Mar 2019 10:44:49 -0400 Subject: [PATCH 02/30] through sub_801704C --- asm/union_room.s | 324 --------------------------------------------- include/link_rfu.h | 1 + include/menu.h | 1 + src/union_room.c | 123 ++++++++++++++++- 4 files changed, 122 insertions(+), 327 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 8e4cf9e1d..b2a2f89ab 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,330 +5,6 @@ .text - thumb_func_start sub_8016DF0 -sub_8016DF0: @ 8016DF0 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r0, =sub_8016CA0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r2, =gTasks + 0x8 - adds r3, r1, r2 - str r4, [r3] - str r5, [r3, 0x4] - adds r2, r1 - strh r6, [r2, 0x8] - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016DF0 - - thumb_func_start sub_8016E24 -sub_8016E24: @ 8016E24 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r0, 2 - add r0, r10 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r3, 0 -_08016E42: - lsls r4, r3, 3 - subs r0, r4, r3 - lsls r5, r0, 2 - ldr r0, [r6] - adds r0, r5 - adds r1, r0, 0 - adds r1, 0x10 - lsls r2, r3, 24 - lsrs r2, 24 - str r3, [sp] - bl sub_800DE7C - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0, 0xA] - lsls r0, 25 - lsrs r0, 25 - mov r2, r10 - lsls r1, r2, 2 - add r1, r10 - lsls r1, 3 - ldr r7, =gTasks - adds r1, r7 - movs r2, 0xC - ldrsh r1, [r1, r2] - bl sub_8013D88 - mov r8, r4 - ldr r3, [sp] - cmp r0, 0 - bne _08016E8E - ldr r1, [r6] - adds r1, r5 - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} -_08016E8E: - adds r4, r3, 0x1 - mov r9, r4 - cmp r3, 0 - ble _08016ED2 - str r5, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - adds r4, r3, 0 -_08016E9E: - ldr r1, [r6] - ldr r7, [sp, 0x8] - adds r0, r1, r7 - ldr r2, [sp, 0x4] - adds r1, r2 - str r3, [sp] - bl sub_8017630 - lsls r0, 24 - ldr r3, [sp] - cmp r0, 0 - bne _08016EC6 - ldr r1, [r6] - ldr r5, [sp, 0x4] - adds r1, r5 - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} -_08016EC6: - ldr r7, [sp, 0x8] - adds r7, 0x1C - str r7, [sp, 0x8] - subs r4, 0x1 - cmp r4, 0 - bne _08016E9E -_08016ED2: - mov r0, r8 - subs r4, r0, r3 - lsls r4, 2 - ldr r0, [r6] - adds r0, r4 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r6] - adds r3, r4 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r4, 0x2 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - mov r3, r9 - cmp r3, 0x3 - ble _08016E42 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016E24 - - thumb_func_start sub_8016F1C -sub_8016F1C: @ 8016F1C - push {lr} - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x7 - bne _08016F2C - ldrb r1, [r0] - movs r0, 0x20 - b _08016F34 -_08016F2C: - cmp r1, 0x8 - bne _08016F3E - ldrb r1, [r0] - movs r0, 0x10 -_08016F34: - ands r0, r1 - cmp r0, 0 - beq _08016F3E - movs r0, 0x1 - b _08016F40 -_08016F3E: - movs r0, 0 -_08016F40: - pop {r1} - bx r1 - thumb_func_end sub_8016F1C - - thumb_func_start sub_8016F44 -sub_8016F44: @ 8016F44 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r6, 0 - subs r0, 0x8 - movs r5, 0 - adds r1, r0 - mov r8, r1 -_08016F62: - ldr r0, [r4] - adds r0, r5 - adds r1, r0, 0 - adds r1, 0x10 - lsls r2, r6, 24 - lsrs r2, 24 - bl sub_800DF34 - lsls r0, 24 - cmp r0, 0 - beq _08016F86 - ldr r0, [r4] - adds r0, r5 - mov r2, r8 - movs r3, 0xC - ldrsh r1, [r2, r3] - bl sub_8016F1C -_08016F86: - ldr r0, [r4] - adds r0, r5 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r4] - adds r3, r5 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r7, 0x2 - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _08016F62 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016F44 - - thumb_func_start sub_8016FC0 -sub_8016FC0: @ 8016FC0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r0, =sub_8016E24 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - ldr r1, =gTasks + 0x8 - adds r3, r2, r1 - str r4, [r3] - adds r1, r2 - strh r5, [r1, 0x4] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016FC0 - - thumb_func_start sub_8016FF0 -sub_8016FF0: @ 8016FF0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r0, =sub_8016F44 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - ldr r1, =gTasks + 0x8 - adds r3, r2, r1 - str r4, [r3] - adds r1, r2 - strh r5, [r1, 0x4] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016FF0 - - thumb_func_start sub_8017020 -sub_8017020: @ 8017020 - push {r4,lr} - adds r4, r0, 0 - bl sub_81973A4 - movs r0, 0 - movs r1, 0x1 - bl DrawDialogueFrame - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterWithCustomSpeedForMessage - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017020 - - thumb_func_start sub_801704C -sub_801704C: @ 801704C - push {lr} - bl RunTextPrintersAndIsPrinter0Active - lsls r0, 16 - cmp r0, 0 - beq _0801705C - movs r0, 0 - b _0801705E -_0801705C: - movs r0, 0x1 -_0801705E: - pop {r1} - bx r1 - thumb_func_end sub_801704C - thumb_func_start PrintOnTextbox PrintOnTextbox: @ 8017064 push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 5b8ccd9fb..199df27aa 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -281,6 +281,7 @@ void sub_8011DE0(u32 arg0); u8 sub_801100C(int a0); void sub_800EF7C(void); bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); +bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); s32 sub_800E87C(u8 idx); void sub_8011BA4(void); void sub_8010198(void); diff --git a/include/menu.h b/include/menu.h index e236ffcfa..ffa2a0b7f 100644 --- a/include/menu.h +++ b/include/menu.h @@ -99,5 +99,6 @@ void sub_8199CBC(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height); u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile); void sub_8198314(void); void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram); +void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed); #endif // GUARD_MENU_H diff --git a/src/union_room.c b/src/union_room.c index b5c0bab80..817f6b237 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -241,7 +241,7 @@ void sub_8018784(u8 windowId); void sub_8018884(const u8 *src); bool32 mevent_0814257C(u8 *textState, const u8 *str); s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); -bool32 sub_8016F1C(struct UnkStruct_x20 *arg0, s16 arg1); +bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); void sub_8019F2C(void); void sub_8019E70(u8 *arg0, s32 arg1); @@ -274,7 +274,7 @@ void sub_8019F04(u8 *spriteIds); void sub_8019E3C(void); void sub_80173B0(void); s32 sub_8017D04(u32 type, u32 species); -void sub_8017020(const u8 *src); +bool32 sub_8017020(const u8 *src); void sub_8019BA8(void *); s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3); void sub_801697C(u8 taskId); @@ -2340,7 +2340,7 @@ void sub_80152F4(u8 taskId) { if (data->field_0->arr[0].field_1A_0 == 1 && !data->field_0->arr[0].unk.field_0.unk_0a_7) { - if (sub_8016F1C(&data->field_0->arr[0], data->field_12 + 7)) + if (sub_8016F1C(&data->field_0->arr[0].unk.field_0, data->field_12 + 7)) { data->field_F = 0; data->field_14 = 0; @@ -3505,3 +3505,120 @@ void sub_8016CA0(u8 taskId) } } } + +u8 sub_8016DF0(struct UnkStruct_Main4 * a0, struct UnkStruct_Main4 * a1, u32 a2) +{ + u8 taskId = CreateTask(sub_8016CA0, 0); + struct UnkStruct_Main4 ** data = (void *)gTasks[taskId].data; + data[0] = a0; + data[1] = a1; + gTasks[taskId].data[4] = a2; + return taskId; +} + +void sub_8016E24(u8 taskId) +{ + s32 i, j; + struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data; + + for (i = 0; i < 4; i++) + { + sub_800DE7C(&ptr[0]->arr[i].unk0.field_0, ptr[0]->arr[i].unk0.playerName, i); + if (!sub_8013D88(ptr[0]->arr[i].unk0.field_0.unk_0a_0, gTasks[taskId].data[2])) + { + ptr[0]->arr[i].unk0 = gUnknown_082F045C; + } + for (j = 0; j < i; j++) + { + if (!sub_8017630(&ptr[0]->arr[j].unk0, &ptr[0]->arr[i].unk0)) + { + ptr[0]->arr[i].unk0 = gUnknown_082F045C; + } + } + ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C); + } +} + +bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1) +{ + if (arg1 == 7) + { + if (!arg0->unk_00.unk_00_5) + { + return FALSE; + } + else + { + return TRUE; + } + } + else if (arg1 == 8) + { + if (!arg0->unk_00.unk_00_4) + { + return FALSE; + } + else + { + return TRUE; + } + } + else + { + return FALSE; + } +} + +void sub_8016F44(u8 taskId) +{ + s32 i; + struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data; + + for (i = 0; i < 4; i++) + { + if (sub_800DF34(&ptr[0]->arr[i].unk0.field_0, ptr[0]->arr[i].unk0.playerName, i)) + { + sub_8016F1C(&ptr[0]->arr[i].unk0.field_0, gTasks[taskId].data[2]); + } + ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C); + } +} + +u8 sub_8016FC0(struct UnkStruct_Main4 * a0, u32 a1) +{ + u8 taskId = CreateTask(sub_8016E24, 0); + struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data; + ptr[0] = a0; + gTasks[taskId].data[2] = a1; + return taskId; +} + +u8 sub_8016FF0(struct UnkStruct_Main4 * a0, u32 a1) +{ + u8 taskId = CreateTask(sub_8016F44, 0); + struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data; + ptr[0] = a0; + gTasks[taskId].data[2] = a1; + return taskId; +} + +bool32 sub_8017020(const u8 *src) +{ + sub_81973A4(); + DrawDialogueFrame(0, 1); + StringExpandPlaceholders(gStringVar4, src); + AddTextPrinterWithCustomSpeedForMessage(FALSE, 1); + return FALSE; +} + +bool32 sub_801704C(void) +{ + if (!RunTextPrintersAndIsPrinter0Active()) + { + return TRUE; + } + else + { + return FALSE; + } +} From 8e0773675c63cdc1b51f6fcc3db3ca367bf4654b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 Mar 2019 13:16:10 -0400 Subject: [PATCH 03/30] through sub_8017168 --- asm/union_room.s | 143 ----------------------------------------------- include/menu.h | 1 + src/union_room.c | 71 +++++++++++++++++++++++ 3 files changed, 72 insertions(+), 143 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index b2a2f89ab..6aefe7ce3 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,149 +5,6 @@ .text - thumb_func_start PrintOnTextbox -PrintOnTextbox: @ 8017064 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _08017076 - cmp r0, 0x1 - beq _0801709C - b _080170AE -_08017076: - bl sub_81973A4 - movs r0, 0 - movs r1, 0x1 - bl DrawDialogueFrame - ldr r0, =gStringVar4 - adds r1, r5, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - bl AddTextPrinterForMessage_2 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _080170AE - .pool -_0801709C: - bl RunTextPrintersAndIsPrinter0Active - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080170AE - strb r0, [r4] - movs r0, 0x1 - b _080170B0 -_080170AE: - movs r0, 0 -_080170B0: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end PrintOnTextbox - - thumb_func_start sub_80170B8 -sub_80170B8: @ 80170B8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _080170CA - cmp r0, 0x1 - beq _080170E0 - b _0801710C -_080170CA: - cmp r5, 0 - beq _080170D4 - movs r0, 0x3 - negs r0, r0 - b _08017110 -_080170D4: - bl DisplayYesNoMenuDefaultYes - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801710C -_080170E0: - cmp r5, 0 - beq _080170F2 - bl sub_8198C78 - movs r0, 0 - strb r0, [r4] - movs r0, 0x3 - negs r0, r0 - b _08017110 -_080170F2: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0801710C - strb r5, [r4] - adds r0, r1, 0 - b _08017110 -_0801710C: - movs r0, 0x2 - negs r0, r0 -_08017110: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80170B8 - - thumb_func_start sub_8017118 -sub_8017118: @ 8017118 - push {r4,lr} - sub sp, 0x8 - bl AddWindow - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl DrawStdWindowFrame - adds r0, r4, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - ldr r2, =gUnknown_082EFD94 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x6 - str r0, [sp, 0x4] - adds r0, r4, 0 - movs r1, 0x1 - movs r3, 0x8 - bl sub_80173E0 - adds r0, r4, 0 - movs r1, 0x2 - bl CopyWindowToVram - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017118 - - thumb_func_start sub_8017168 -sub_8017168: @ 8017168 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - pop {r0} - bx r0 - thumb_func_end sub_8017168 - thumb_func_start sub_8017178 sub_8017178: @ 8017178 push {r4-r7,lr} diff --git a/include/menu.h b/include/menu.h index ffa2a0b7f..a119b4a07 100644 --- a/include/menu.h +++ b/include/menu.h @@ -100,5 +100,6 @@ u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile); void sub_8198314(void); void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram); void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed); +void sub_8198C78(void); #endif // GUARD_MENU_H diff --git a/src/union_room.c b/src/union_room.c index 817f6b237..0eb419401 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -331,6 +331,7 @@ extern const u8 gUnknown_082EF298[]; extern const u8 gUnknown_082EF65C[]; extern const u8 gUnknown_082EF6E4[]; extern const u8 gUnknown_082EF718[]; +extern const u8 gUnknown_082EFD94[]; extern const u32 gUnknown_082F00C4[]; @@ -3622,3 +3623,73 @@ bool32 sub_801704C(void) return FALSE; } } + +bool8 PrintOnTextbox(u8 *textState, const u8 *str) +{ + switch (*textState) + { + case 0: + sub_81973A4(); + DrawDialogueFrame(0, 1); + StringExpandPlaceholders(gStringVar4, str); + AddTextPrinterForMessage_2(TRUE); + (*textState)++; + break; + case 1: + if (!RunTextPrintersAndIsPrinter0Active()) + { + *textState = 0; + return TRUE; + } + break; + } + return FALSE; +} + +s8 sub_80170B8(u8 *arg0, bool32 arg1) +{ + s8 r1; + + switch (*arg0) + { + case 0: + if (arg1) + { + return -3; + } + DisplayYesNoMenuDefaultYes(); + (*arg0)++; + break; + case 1: + if (arg1) + { + sub_8198C78(); + *arg0 = 0; + return -3; + } + r1 = Menu_ProcessInputNoWrapClearOnChoose(); + if (r1 == -1 || r1 == 0 || r1 == 1) + { + *arg0 = 0; + return r1; + } + break; + } + return -2; +} + +u8 sub_8017118(struct WindowTemplate * template) +{ + u8 windowId = AddWindow(template); + DrawStdWindowFrame(windowId, FALSE); + FillWindowPixelBuffer(windowId, 0xFF); + sub_80173E0(windowId, 1, gUnknown_082EFD94, 8, 1, 6); + CopyWindowToVram(windowId, 2); + PutWindowTilemap(windowId); + return windowId; +} + +void sub_8017168(u8 windowId) +{ + RemoveWindow(windowId); +} From 51d2131dc268ba760e0d5790d747213eb0a12b2b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 Mar 2019 16:57:34 -0400 Subject: [PATCH 04/30] through (nearly-matching) sub_80172A0 --- asm/union_room.s | 269 ----------------------------------------------- src/union_room.c | 243 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 242 insertions(+), 270 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 6aefe7ce3..e227323e1 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,275 +5,6 @@ .text - thumb_func_start sub_8017178 -sub_8017178: @ 8017178 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r7, r0, 0 - adds r5, r1, 0 - mov r9, r2 - ldrb r4, [r7] - cmp r4, 0 - beq _08017194 - cmp r4, 0x1 - beq _08017228 - b _0801728E -_08017194: - ldr r0, [r3] - ldr r1, [r3, 0x4] - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [sp, 0x24] - bl sub_81DB41C - adds r1, r0, 0 - ldr r2, [sp] - lsrs r0, r2, 24 - cmp r0, r1 - ble _080171B6 - lsls r1, 24 - ldr r0, =0x00ffffff - ands r0, r2 - orrs r0, r1 - str r0, [sp] -_080171B6: - ldr r2, [sp] - lsrs r0, r2, 8 - lsls r0, 24 - lsrs r0, 24 - lsrs r1, r2, 24 - adds r0, r1 - cmp r0, 0x1D - ble _080171DC - movs r0, 0x1D - subs r0, r1 - cmp r0, 0 - bge _080171D0 - movs r0, 0 -_080171D0: - lsls r1, r0, 24 - lsrs r1, 16 - ldr r0, =0xffff00ff - ands r0, r2 - orrs r0, r1 - str r0, [sp] -_080171DC: - mov r0, sp - bl AddWindow - strb r0, [r5] - ldrb r0, [r5] - movs r1, 0 - bl DrawStdWindowFrame - ldr r0, =gMultiuseListMenuTemplate - adds r2, r0, 0 - ldr r1, [sp, 0x24] - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldrb r1, [r5] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - mov r1, r9 - strb r0, [r1] - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r7] - adds r0, 0x1 - strb r0, [r7] - b _0801728E - .pool -_08017228: - mov r3, r9 - ldrb r0, [r3] - bl ListMenu_ProcessInput - mov r8, r0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - ands r4, r1 - cmp r4, 0 - beq _08017264 - mov r4, r9 - ldrb r0, [r4] - movs r1, 0 - movs r2, 0 - bl DestroyListMenuTask - ldrb r0, [r5] - movs r1, 0x1 - bl ClearStdWindowAndFrame - ldrb r0, [r5] - bl RemoveWindow - movs r0, 0 - strb r0, [r7] - mov r0, r8 - b _08017292 - .pool -_08017264: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0801728E - mov r6, r9 - ldrb r0, [r6] - movs r1, 0 - movs r2, 0 - bl DestroyListMenuTask - ldrb r0, [r5] - movs r1, 0x1 - bl ClearStdWindowAndFrame - ldrb r0, [r5] - bl RemoveWindow - strb r4, [r7] - movs r0, 0x2 - negs r0, r0 - b _08017292 -_0801728E: - movs r0, 0x1 - negs r0, r0 -_08017292: - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8017178 - - thumb_func_start sub_80172A0 -sub_80172A0: @ 80172A0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r5, r0, 0 - adds r6, r1, 0 - mov r10, r2 - mov r9, r3 - ldrb r4, [r5] - cmp r4, 0x1 - beq _0801730C - cmp r4, 0x1 - bgt _080172C2 - cmp r4, 0 - beq _080172C8 - b _0801739C -_080172C2: - cmp r4, 0x2 - beq _0801731C - b _0801739C -_080172C8: - ldr r0, =gUnknown_082F0344 - bl sub_8017118 - mov r1, r9 - strb r0, [r1] - ldr r0, [sp, 0x20] - bl AddWindow - strb r0, [r6] - ldrb r0, [r6] - movs r1, 0 - bl DrawStdWindowFrame - ldr r0, =gMultiuseListMenuTemplate - adds r2, r0, 0 - ldr r1, [sp, 0x24] - ldm r1!, {r3,r4,r7} - stm r2!, {r3,r4,r7} - ldm r1!, {r3,r4,r7} - stm r2!, {r3,r4,r7} - ldrb r1, [r6] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0x1 - bl ListMenuInit - mov r1, r10 - strb r0, [r1] - b _08017314 - .pool -_0801730C: - ldrb r0, [r6] - movs r1, 0x1 - bl CopyWindowToVram -_08017314: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _0801739C -_0801731C: - mov r3, r10 - ldrb r0, [r3] - bl ListMenu_ProcessInput - adds r1, r0, 0 - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - movs r0, 0x3 - ands r0, r2 - cmp r0, 0 - beq _0801739C - cmp r1, 0x8 - beq _0801733E - ands r4, r2 - mov r8, r4 - cmp r4, 0 - beq _08017368 -_0801733E: - mov r4, r10 - ldrb r0, [r4] - movs r1, 0 - movs r2, 0 - bl DestroyListMenuTask - ldrb r0, [r6] - bl RemoveWindow - mov r7, r9 - ldrb r0, [r7] - bl sub_8017168 - movs r0, 0 - strb r0, [r5] - movs r0, 0x2 - negs r0, r0 - b _080173A0 - .pool -_08017368: - ldr r0, [sp, 0x28] - bl sub_8017CB0 - adds r4, r0, 0 - cmp r4, 0 - blt _08017396 - mov r1, r10 - ldrb r0, [r1] - movs r1, 0 - movs r2, 0 - bl DestroyListMenuTask - ldrb r0, [r6] - bl RemoveWindow - mov r3, r9 - ldrb r0, [r3] - bl sub_8017168 - mov r7, r8 - strb r7, [r5] - adds r0, r4, 0 - b _080173A0 -_08017396: - movs r0, 0x7 - bl PlaySE -_0801739C: - movs r0, 0x1 - negs r0, r0 -_080173A0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80172A0 - thumb_func_start sub_80173B0 sub_80173B0: @ 80173B0 push {lr} diff --git a/src/union_room.c b/src/union_room.c index 0eb419401..90631dab4 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -34,6 +34,7 @@ #include "data2.h" #include "field_screen_effect.h" #include "script_pokemon_util_80F87D8.h" +#include "international_string_util.h" #include "mevent.h" struct UnkStruct_Shared @@ -264,6 +265,7 @@ void sub_801818C(bool32 arg0); void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate); s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6); +s32 sub_8017CB0(struct UnkStruct_Main0 * arg); bool32 sub_8018024(void); u32 sub_8017984(u32 arg0); void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); @@ -346,6 +348,7 @@ extern const struct WindowTemplate gUnknown_082F017C; extern const struct WindowTemplate gUnknown_082F021C; extern const struct WindowTemplate gUnknown_082F025C; extern const struct WindowTemplate gUnknown_082F0294; +extern const struct WindowTemplate gUnknown_082F0344; extern const struct WindowTemplate gUnknown_082F034C; extern const struct ListMenuTemplate gUnknown_082F015C; @@ -3678,7 +3681,7 @@ s8 sub_80170B8(u8 *arg0, bool32 arg1) return -2; } -u8 sub_8017118(struct WindowTemplate * template) +u8 sub_8017118(const struct WindowTemplate * template) { u8 windowId = AddWindow(template); DrawStdWindowFrame(windowId, FALSE); @@ -3693,3 +3696,241 @@ void sub_8017168(u8 windowId) { RemoveWindow(windowId); } + +s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate) +{ + s32 r1, r8; + struct WindowTemplate winTemplateCopy; + + switch (*arg0) + { + case 0: + winTemplateCopy = *winTemplate; + r1 = sub_81DB41C(menuTemplate); + if (winTemplateCopy.width > r1) + { + winTemplateCopy.width = r1; + } + if (winTemplateCopy.tilemapLeft + winTemplateCopy.width > 29) + { + winTemplateCopy.tilemapLeft = max(29 - winTemplateCopy.width, 0); + } + *arg1 = AddWindow(&winTemplateCopy); + DrawStdWindowFrame(*arg1, FALSE); + gMultiuseListMenuTemplate = *menuTemplate; + gMultiuseListMenuTemplate.windowId = *arg1; + *arg2 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); + CopyWindowToVram(*arg1, TRUE); + (*arg0)++; + break; + case 1: + r8 = ListMenu_ProcessInput(*arg2); + if (({gMain.newKeys & A_BUTTON;})) + { + DestroyListMenuTask(*arg2, NULL, NULL); + ClearStdWindowAndFrame(*arg1, TRUE); + RemoveWindow(*arg1); + *arg0 = 0; + return r8; + } + else if (({gMain.newKeys & B_BUTTON;})) + { + DestroyListMenuTask(*arg2, NULL, NULL); + ClearStdWindowAndFrame(*arg1, TRUE); + RemoveWindow(*arg1); + *arg0 = 0; + return -2; + } + break; + } + + return -1; +} + +#ifdef NONMATCHING +s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6) +{ + s32 input; + s32 r4; + + switch (*arg0) + { + case 0: + *arg3 = sub_8017118(&gUnknown_082F0344); + *arg1 = AddWindow(winTemplate); + DrawStdWindowFrame(*arg1, FALSE); + gMultiuseListMenuTemplate = *menuTemplate; + gMultiuseListMenuTemplate.windowId = *arg1; + *arg2 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 1); + (*arg0)++; + break; + case 1: + CopyWindowToVram(*arg1, TRUE); + (*arg0)++; + break; + case 2: + // Register swap r1 <---> r2 + input = ListMenu_ProcessInput(*arg2); + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + if (input == 8 || ({gMain.newKeys & B_BUTTON;})) + { + DestroyListMenuTask(*arg2, NULL, NULL); + RemoveWindow(*arg1); + sub_8017168(*arg3); + *arg0 = 0; + return -2; + } + else + { + r4 = sub_8017CB0(arg6); + if (r4 >= 0) + { + DestroyListMenuTask(*arg2, NULL, NULL); + RemoveWindow(*arg1); + sub_8017168(*arg3); + *arg0 = 0; + return r4; + } + else + { + PlaySE(SE_WALL_HIT); + } + } + } + break; + } + + return -1; +} +#else +NAKED +s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tadds r5, r0, 0\n" + "\tadds r6, r1, 0\n" + "\tmov r10, r2\n" + "\tmov r9, r3\n" + "\tldrb r4, [r5]\n" + "\tcmp r4, 0x1\n" + "\tbeq _0801730C\n" + "\tcmp r4, 0x1\n" + "\tbgt _080172C2\n" + "\tcmp r4, 0\n" + "\tbeq _080172C8\n" + "\tb _0801739C\n" + "_080172C2:\n" + "\tcmp r4, 0x2\n" + "\tbeq _0801731C\n" + "\tb _0801739C\n" + "_080172C8:\n" + "\tldr r0, =gUnknown_082F0344\n" + "\tbl sub_8017118\n" + "\tmov r1, r9\n" + "\tstrb r0, [r1]\n" + "\tldr r0, [sp, 0x20]\n" + "\tbl AddWindow\n" + "\tstrb r0, [r6]\n" + "\tldrb r0, [r6]\n" + "\tmovs r1, 0\n" + "\tbl DrawStdWindowFrame\n" + "\tldr r0, =gMultiuseListMenuTemplate\n" + "\tadds r2, r0, 0\n" + "\tldr r1, [sp, 0x24]\n" + "\tldm r1!, {r3,r4,r7}\n" + "\tstm r2!, {r3,r4,r7}\n" + "\tldm r1!, {r3,r4,r7}\n" + "\tstm r2!, {r3,r4,r7}\n" + "\tldrb r1, [r6]\n" + "\tstrb r1, [r0, 0x10]\n" + "\tmovs r1, 0\n" + "\tmovs r2, 0x1\n" + "\tbl ListMenuInit\n" + "\tmov r1, r10\n" + "\tstrb r0, [r1]\n" + "\tb _08017314\n" + "\t.pool\n" + "_0801730C:\n" + "\tldrb r0, [r6]\n" + "\tmovs r1, 0x1\n" + "\tbl CopyWindowToVram\n" + "_08017314:\n" + "\tldrb r0, [r5]\n" + "\tadds r0, 0x1\n" + "\tstrb r0, [r5]\n" + "\tb _0801739C\n" + "_0801731C:\n" + "\tmov r3, r10\n" + "\tldrb r0, [r3]\n" + "\tbl ListMenu_ProcessInput\n" + "\tadds r1, r0, 0\n" + "\tldr r0, =gMain\n" + "\tldrh r2, [r0, 0x2E]\n" + "\tmovs r0, 0x3\n" + "\tands r0, r2\n" + "\tcmp r0, 0\n" + "\tbeq _0801739C\n" + "\tcmp r1, 0x8\n" + "\tbeq _0801733E\n" + "\tands r4, r2\n" + "\tmov r8, r4\n" + "\tcmp r4, 0\n" + "\tbeq _08017368\n" + "_0801733E:\n" + "\tmov r4, r10\n" + "\tldrb r0, [r4]\n" + "\tmovs r1, 0\n" + "\tmovs r2, 0\n" + "\tbl DestroyListMenuTask\n" + "\tldrb r0, [r6]\n" + "\tbl RemoveWindow\n" + "\tmov r7, r9\n" + "\tldrb r0, [r7]\n" + "\tbl sub_8017168\n" + "\tmovs r0, 0\n" + "\tstrb r0, [r5]\n" + "\tmovs r0, 0x2\n" + "\tnegs r0, r0\n" + "\tb _080173A0\n" + "\t.pool\n" + "_08017368:\n" + "\tldr r0, [sp, 0x28]\n" + "\tbl sub_8017CB0\n" + "\tadds r4, r0, 0\n" + "\tcmp r4, 0\n" + "\tblt _08017396\n" + "\tmov r1, r10\n" + "\tldrb r0, [r1]\n" + "\tmovs r1, 0\n" + "\tmovs r2, 0\n" + "\tbl DestroyListMenuTask\n" + "\tldrb r0, [r6]\n" + "\tbl RemoveWindow\n" + "\tmov r3, r9\n" + "\tldrb r0, [r3]\n" + "\tbl sub_8017168\n" + "\tmov r7, r8\n" + "\tstrb r7, [r5]\n" + "\tadds r0, r4, 0\n" + "\tb _080173A0\n" + "_08017396:\n" + "\tmovs r0, 0x7\n" + "\tbl PlaySE\n" + "_0801739C:\n" + "\tmovs r0, 0x1\n" + "\tnegs r0, r0\n" + "_080173A0:\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r1}\n" + "\tbx r1"); +} +#endif From 9538855d9a532c9839b962c755640829d9432cea Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 28 Mar 2019 08:42:35 -0400 Subject: [PATCH 05/30] Through sub_80173D4 --- asm/union_room.s | 28 ---------------------------- src/union_room.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index e227323e1..79bd7d96f 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,34 +5,6 @@ .text - thumb_func_start sub_80173B0 -sub_80173B0: @ 80173B0 - push {lr} - sub sp, 0xC - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_80173B0 - - thumb_func_start sub_80173D4 -sub_80173D4: @ 80173D4 - push {lr} - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_80173D4 - thumb_func_start sub_80173E0 sub_80173E0: @ 80173E0 push {r4,r5,lr} diff --git a/src/union_room.c b/src/union_room.c index 90631dab4..f153801a2 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3934,3 +3934,31 @@ s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTempl "\tbx r1"); } #endif + +void sub_80173B0(void) +{ + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0); + CopyBgTilemapBufferToVram(0); +} + +void sub_80173D4(void) +{ + EnableBothScriptContexts(); +} + +/* +void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5) +{ + struct TextPrinterTemplate sp0 = { + .currentChar = str, + .windowId = windowId, + .fontId = arg1, + .x = arg3, + .y = arg4, + .currentX = arg3, + .currentY = arg4 + }; + + // to be continued +} +*/ From 963dcfb84d0877eb33edc2f41e18cd8076f95739 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 28 Mar 2019 09:59:08 -0400 Subject: [PATCH 06/30] sub_80173E0 --- asm/union_room.s | 214 ----------------------------------------------- src/union_room.c | 77 ++++++++++++++--- 2 files changed, 65 insertions(+), 226 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 79bd7d96f..a310dcaa6 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,220 +5,6 @@ .text - thumb_func_start sub_80173E0 -sub_80173E0: @ 80173E0 - push {r4,r5,lr} - sub sp, 0x10 - ldr r5, [sp, 0x1C] - ldr r4, [sp, 0x20] - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r4, 24 - lsrs r4, 24 - str r2, [sp] - mov r2, sp - strb r0, [r2, 0x4] - mov r0, sp - strb r1, [r0, 0x5] - strb r3, [r0, 0x6] - strb r5, [r0, 0x7] - strb r3, [r0, 0x8] - strb r5, [r0, 0x9] - ldrb r1, [r2, 0xC] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0xC] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - cmp r4, 0x6 - bls _08017422 - b _0801756E -_08017422: - lsls r0, r4, 2 - ldr r1, =_08017434 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08017434: - .4byte _08017450 - .4byte _0801747C - .4byte _080174A8 - .4byte _080174D4 - .4byte _08017500 - .4byte _0801752C - .4byte _08017544 -_08017450: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x20 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_0801747C: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x50 - b _0801756A -_080174A8: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x60 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x70 - b _0801756A -_080174D4: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_08017500: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_0801752C: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r4, 0xF - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x70 - b _0801755A -_08017544: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r4, 0xF - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0xE0 -_0801755A: - orrs r0, r1 - strb r0, [r2, 0xC] - mov r1, sp - ldrb r0, [r1, 0xD] - orrs r0, r4 - strb r0, [r1, 0xD] - ands r0, r3 - movs r1, 0x90 -_0801756A: - orrs r0, r1 - strb r0, [r2, 0xD] -_0801756E: - mov r0, sp - movs r1, 0xFF - movs r2, 0 - bl AddTextPrinter - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80173E0 - thumb_func_start sub_8017580 sub_8017580: @ 8017580 push {r4-r7,lr} diff --git a/src/union_room.c b/src/union_room.c index f153801a2..7a45724e5 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3946,19 +3946,72 @@ void sub_80173D4(void) EnableBothScriptContexts(); } -/* void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5) { - struct TextPrinterTemplate sp0 = { - .currentChar = str, - .windowId = windowId, - .fontId = arg1, - .x = arg3, - .y = arg4, - .currentX = arg3, - .currentY = arg4 - }; + struct TextPrinterTemplate sp0; - // to be continued + sp0.currentChar = str; + sp0.windowId = windowId; + sp0.fontId = arg1; + sp0.x = arg3; + sp0.y = arg4; + sp0.currentX = arg3; + sp0.currentY = arg4; + sp0.unk = 0; + + gTextFlags.useAlternateDownArrow = FALSE; + switch (arg5) + { + case 0: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 2; + sp0.bgColor = 1; + sp0.shadowColor = 3; + break; + case 1: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 4; + sp0.bgColor = 1; + sp0.shadowColor = 5; + break; + case 2: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 6; + sp0.bgColor = 1; + sp0.shadowColor = 7; + break; + case 3: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 1; + sp0.bgColor = 1; + sp0.shadowColor = 3; + break; + case 4: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 1; + sp0.bgColor = 2; + sp0.shadowColor = 3; + break; + case 5: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 7; + sp0.bgColor = 15; + sp0.shadowColor = 9; + break; + case 6: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 14; + sp0.bgColor = 15; + sp0.shadowColor = 9; + break; + } + + AddTextPrinter(&sp0, 0xFF, NULL); } -*/ From 86f7691146ab6fa7aba6e077930b5677bb75b701 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 28 Mar 2019 10:24:31 -0400 Subject: [PATCH 07/30] Through sub_80176E4 --- asm/union_room.s | 244 ----------------------------------------------- src/union_room.c | 106 +++++++++++++++++++- 2 files changed, 103 insertions(+), 247 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index a310dcaa6..ec5d82918 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,250 +5,6 @@ .text - thumb_func_start sub_8017580 -sub_8017580: @ 8017580 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0 - beq _080175D8 - ldr r2, =gUnknown_082F045C - mov r8, r2 - movs r5, 0 - mov r9, r5 - movs r6, 0x4 - negs r6, r6 - mov r12, r6 - adds r2, r0, 0 - adds r2, 0x18 - adds r4, r0, 0 - movs r7, 0xFF - mov r10, r7 - adds r3, r1, 0 -_080175AC: - adds r1, r4, 0 - mov r0, r8 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - mov r0, r10 - strh r0, [r2] - ldrb r1, [r2, 0x2] - mov r0, r12 - ands r0, r1 - movs r1, 0x5 - negs r1, r1 - ands r0, r1 - strb r0, [r2, 0x2] - mov r5, r9 - strb r5, [r2, 0x3] - adds r2, 0x20 - adds r4, 0x20 - subs r3, 0x1 - cmp r3, 0 - bne _080175AC -_080175D8: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017580 - - thumb_func_start sub_80175EC -sub_80175EC: @ 80175EC - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r1, =gUnknown_082F045C - mov r12, r1 - movs r5, 0x2 - negs r5, r5 - mov r8, r5 - adds r2, r0, 0 - adds r2, 0x18 - adds r3, r0, 0 - movs r4, 0x3 -_08017604: - adds r1, r3, 0 - mov r0, r12 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldrb r1, [r2] - mov r0, r8 - ands r0, r1 - strb r0, [r2] - adds r2, 0x1C - adds r3, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _08017604 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80175EC - - thumb_func_start sub_8017630 -sub_8017630: @ 8017630 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r2, 0 - adds r4, r5, 0x2 - adds r3, r6, 0x2 -_0801763C: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _08017664 - adds r2, 0x1 - cmp r2, 0x1 - ble _0801763C - movs r2, 0 - adds r4, r5, 0 - adds r4, 0x10 - adds r3, r6, 0 - adds r3, 0x10 -_08017658: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _08017668 -_08017664: - movs r0, 0x1 - b _08017670 -_08017668: - adds r2, 0x1 - cmp r2, 0x7 - ble _08017658 - movs r0, 0 -_08017670: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8017630 - - thumb_func_start sub_8017678 -sub_8017678: @ 8017678 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldrb r3, [r5, 0xA] - movs r0, 0x7F - ldrb r2, [r6, 0xA] - adds r1, r0, 0 - ands r1, r3 - ands r0, r2 - cmp r1, r0 - bne _080176DC - movs r0, 0x80 - adds r1, r0, 0 - ands r1, r3 - ands r0, r2 - cmp r1, r0 - bne _080176DC - movs r2, 0 - adds r4, r5, 0x4 - adds r3, r6, 0x4 -_080176A0: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _080176DC - adds r2, 0x1 - cmp r2, 0x3 - ble _080176A0 - ldrh r2, [r5, 0x8] - ldr r0, =0x000003ff - ldrh r3, [r6, 0x8] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _080176DC - ldrb r2, [r5, 0x9] - movs r0, 0xFC - ldrb r3, [r6, 0x9] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _080176DC - movs r0, 0 - b _080176DE - .pool -_080176DC: - movs r0, 0x1 -_080176DE: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8017678 - - thumb_func_start sub_80176E4 -sub_80176E4: @ 80176E4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r0 - movs r7, 0xFF - movs r6, 0 - adds r4, r1, 0 - adds r4, 0x18 - adds r5, r1, 0 -_080176F6: - ldrb r1, [r4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801771E - mov r0, r8 - adds r1, r5, 0 - bl sub_8017630 - lsls r0, 24 - cmp r0, 0 - bne _0801771E - lsls r0, r6, 24 - lsrs r7, r0, 24 - ldrb r0, [r4] - movs r2, 0x2 - negs r2, r2 - adds r1, r2, 0 - ands r0, r1 - strb r0, [r4] -_0801771E: - adds r4, 0x1C - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _080176F6 - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80176E4 - thumb_func_start sub_8017734 sub_8017734: @ 8017734 push {r4-r7,lr} diff --git a/src/union_room.c b/src/union_room.c index 7a45724e5..620a13e58 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -228,7 +228,7 @@ u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id); void sub_8013BD8(struct UnkStruct_Group *arg0, s32 id); void sub_80173D4(void); void sub_80177B8(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id); -bool32 sub_8017678(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1); +bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1); u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId); void sub_801807C(struct TradeUnkStruct *arg0); void sub_801AC54(void); @@ -1456,7 +1456,7 @@ u8 sub_8013E44(void) { if (data->field_0->arr[i].field_1A_0 == 1) { - if (sub_8017678(&data->field_0->arr[i], &data->field_4->arr[id])) + if (sub_8017678(&data->field_0->arr[i].unk, &data->field_4->arr[id].unk0)) { data->field_0->arr[i].unk = data->field_4->arr[id].unk0; data->field_0->arr[i].field_1B = 0x40; @@ -3423,7 +3423,7 @@ u8 sub_8016B00(void) { if (structPtr->field_0->arr[j].field_1A_0 == 1) { - if (sub_8017678(&structPtr->field_0->arr[j], &structPtr->field_4->arr[i])) + if (sub_8017678(&structPtr->field_0->arr[j].unk, &structPtr->field_4->arr[i].unk0)) { structPtr->field_0->arr[j].unk = structPtr->field_4->arr[i].unk0; structPtr->field_0->arr[j].field_1B = 0x40; @@ -4015,3 +4015,103 @@ void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5) AddTextPrinter(&sp0, 0xFF, NULL); } + +void sub_8017580(struct UnkStruct_x20 *arg0, u8 count) +{ + s32 i; + + for (i = 0; i < count; i++) + { + arg0[i].unk = gUnknown_082F045C; + arg0[i].field_18 = 0xFF; + arg0[i].field_1A_0 = 0; + arg0[i].field_1A_1 = 0; + arg0[i].field_1B = 0; + } +} + +void sub_80175EC(struct UnkStruct_Main4 *arg0, u8 count) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + arg0->arr[i].unk0 = gUnknown_082F045C; + arg0->arr[i].unk18 = 0; + } +} + +bool8 sub_8017630(struct UnkStruct_Shared* arg0, const struct UnkStruct_Shared* arg1) +{ + s32 i; + + for (i = 0; i < 2; i++) + { + if (arg0->field_0.unk_00.playerTrainerId[i] != arg1->field_0.unk_00.playerTrainerId[i]) + { + return TRUE; + } + } + + for (i = 0; i < 8; i++) + { + if (arg0->playerName[i] != arg1->playerName[i]) + { + return TRUE; + } + } + + return FALSE; +} + +bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1) +{ + s32 i; + + if (arg0->field_0.unk_0a_0 != arg1->field_0.unk_0a_0) + { + return TRUE; + } + + if (arg0->field_0.unk_0a_7 != arg1->field_0.unk_0a_7) + { + return TRUE; + } + + for (i = 0; i < 4; i++) + { + if (arg0->field_0.unk_04[i] != arg1->field_0.unk_04[i]) + { + return TRUE; + } + } + + if (arg0->field_0.species != arg1->field_0.species) + { + return TRUE; + } + + if (arg0->field_0.type != arg1->field_0.type) + { + return TRUE; + } + + return FALSE; +} + +u32 sub_80176E4(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1) +{ + u8 result = 0xFF; + s32 i; + + for (i = 0; i < 4; i++) + { + if (arg1[i].unk18 && !sub_8017630(&arg0->unk, &arg1[i].unk0)) + { + result = i; + arg1[i].unk18 = FALSE; + } + } + + return result; +} From 030fb4d89881082eaa2c54a4da150e0abf3f6a8a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 28 Mar 2019 11:24:50 -0400 Subject: [PATCH 08/30] through sub_80179AC --- asm/union_room.s | 339 ----------------------------------------------- src/union_room.c | 115 +++++++++++++++- 2 files changed, 110 insertions(+), 344 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index ec5d82918..2b1092c34 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,345 +5,6 @@ .text - thumb_func_start sub_8017734 -sub_8017734: @ 8017734 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r3, r0, 0 - mov r8, r1 - lsls r2, 24 - lsrs r6, r2, 24 - ldrb r1, [r1, 0x18] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080177A8 - movs r5, 0 - cmp r5, r6 - bge _080177A8 - movs r0, 0x4 - negs r0, r0 - mov r9, r0 - movs r1, 0x2 - negs r1, r1 - mov r12, r1 - adds r2, r3, 0 - adds r2, 0x18 - adds r1, r3, 0 -_08017766: - ldrb r0, [r2, 0x2] - movs r3, 0x3 - ands r3, r0 - cmp r3, 0 - bne _0801779E - mov r0, r8 - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - strh r3, [r2] - ldrb r1, [r2, 0x2] - mov r0, r9 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x2] - movs r0, 0x40 - strb r0, [r2, 0x3] - mov r0, r8 - ldrb r1, [r0, 0x18] - mov r0, r12 - ands r0, r1 - mov r1, r8 - strb r0, [r1, 0x18] - lsls r0, r5, 24 - lsrs r0, 24 - b _080177AA -_0801779E: - adds r2, 0x20 - adds r1, 0x20 - adds r5, 0x1 - cmp r5, r6 - blt _08017766 -_080177A8: - movs r0, 0xFF -_080177AA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8017734 - - thumb_func_start sub_80177B8 -sub_80177B8: @ 80177B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r4, r1, 0 - adds r6, r3, 0 - ldr r3, [sp, 0x2C] - ldr r1, [sp, 0x30] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - lsls r1, 24 - lsrs r1, 24 - ldr r5, =gStringVar4 - adds r1, 0x1 - adds r0, r5, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r1, =gText_Colon - adds r0, r5, 0 - bl StringAppend - str r7, [sp] - movs r0, 0 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_80173E0 - adds r4, 0x12 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6, 0xA] - lsls r0, 25 - lsrs r2, r0, 25 - ldrb r1, [r6, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _08017884 - movs r0, 0x40 - ands r2, r0 - cmp r2, 0 - bne _08017884 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_8018404 - str r7, [sp] - mov r0, r9 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_80173E0 - ldrb r1, [r6, 0x2] - ldrb r0, [r6, 0x3] - lsls r0, 8 - orrs r1, r0 - add r0, sp, 0x8 - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r1, =gText_UnkCtrlCodeF907 - adds r0, r5, 0 - bl StringCopy - adds r0, r5, 0 - add r1, sp, 0x8 - bl StringAppend - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x88 - bl GetStringRightAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - str r7, [sp] - mov r0, r9 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0x1 - adds r2, r5, 0 - bl sub_80173E0 -_08017884: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80177B8 - - thumb_func_start sub_80178A0 -sub_80178A0: @ 80178A0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r5, r3, 0 - ldr r3, [sp, 0x2C] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r7, r3, 24 - ldrb r1, [r5, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801792A - ldr r4, =gStringVar4 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8018404 - mov r0, r8 - str r0, [sp] - str r7, [sp, 0x4] - mov r0, r9 - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r6, 0 - bl sub_80173E0 - ldrb r1, [r5, 0x2] - ldrb r0, [r5, 0x3] - lsls r0, 8 - orrs r1, r0 - add r0, sp, 0x8 - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r1, =gText_UnkCtrlCodeF907 - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - add r1, sp, 0x8 - bl StringAppend - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x68 - bl GetStringRightAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - str r0, [sp] - str r7, [sp, 0x4] - mov r0, r9 - movs r1, 0x1 - adds r2, r4, 0 - bl sub_80173E0 -_0801792A: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80178A0 - - thumb_func_start sub_8017940 -sub_8017940: @ 8017940 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x9 - bne _08017978 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - bne _08017978 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x3] - cmp r0, 0x2 - beq _0801796E - cmp r0, 0 - bne _08017978 -_0801796E: - movs r0, 0x1 - b _0801797A - .pool -_08017978: - movs r0, 0 -_0801797A: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8017940 - - thumb_func_start sub_8017984 -sub_8017984: @ 8017984 - push {lr} - cmp r0, 0x4 - beq _0801799C - cmp r0, 0x4 - ble _080179A4 - cmp r0, 0x5 - beq _08017998 - cmp r0, 0x8 - beq _080179A0 - b _080179A4 -_08017998: - movs r0, 0x1 - b _080179A6 -_0801799C: - movs r0, 0x2 - b _080179A6 -_080179A0: - movs r0, 0x3 - b _080179A6 -_080179A4: - movs r0, 0 -_080179A6: - pop {r1} - bx r1 - thumb_func_end sub_8017984 - - thumb_func_start sub_80179AC -sub_80179AC: @ 80179AC - push {r4,lr} - sub sp, 0x20 - adds r4, r0, 0 - mov r0, sp - adds r1, r4, 0 - bl sub_8018404 - adds r4, 0x2 - adds r0, r4, 0 - bl ReadAsU16 - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - bl sub_800E540 - add sp, 0x20 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80179AC - thumb_func_start sub_80179D4 sub_80179D4: @ 80179D4 push {r4-r6,lr} diff --git a/src/union_room.c b/src/union_room.c index 620a13e58..4c9cb3886 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -35,6 +35,7 @@ #include "field_screen_effect.h" #include "script_pokemon_util_80F87D8.h" #include "international_string_util.h" +#include "field_player_avatar.h" #include "mevent.h" struct UnkStruct_Shared @@ -222,7 +223,7 @@ void sub_80149C4(void); u8 sub_80132D4(struct UnkStruct_Main0 *arg0); void sub_80178A0(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id); u32 sub_80176E4(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1); -u8 sub_8017734(struct UnkStruct_x20 *arg0, struct UnkStruct_Shared *arg1, u8 arg2); +u8 sub_8017734(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1, u8 arg2); u8 sub_8013E44(void); u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id); void sub_8013BD8(struct UnkStruct_Group *arg0, s32 id); @@ -267,7 +268,7 @@ s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTe s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6); s32 sub_8017CB0(struct UnkStruct_Main0 * arg); bool32 sub_8018024(void); -u32 sub_8017984(u32 arg0); +u32 sub_8017984(s32 arg0); void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); void sub_8017D9C(u8 *dst, u32 arg1, u32 playerGender); u32 sub_80179AC(struct UnkStruct_x20 *arg0); @@ -380,6 +381,8 @@ extern const struct UnkStruct_Shared gUnknown_082F045C; extern const u8 *const gUnknown_082F04D8[22]; +extern const u8 gText_Colon[]; + // code void nullsub_89(void) { @@ -973,7 +976,7 @@ u8 sub_80132D4(struct UnkStruct_Main0 *arg0) } for (id = 0; id < 4; id++) - sub_8017734(data->field_0->arr, &data->field_4->arr[id].unk0, 5); + sub_8017734(data->field_0->arr, &data->field_4->arr[id], 5); if (ret != 2) { @@ -1498,7 +1501,7 @@ u8 sub_8013E44(void) for (id = 0; id < 4; id++) { - if (sub_8017734(data->field_0->arr, &data->field_4->arr[id].unk0, 16) != 0xFF) + if (sub_8017734(data->field_0->arr, &data->field_4->arr[id], 16) != 0xFF) ret = 1; } @@ -3465,7 +3468,7 @@ u8 sub_8016B00(void) } for (i = 0; i < 4; i++) { - if (sub_8017734(&structPtr->field_0->arr[0], &structPtr->field_4->arr[i].unk0, 8) != 0xFF) + if (sub_8017734(&structPtr->field_0->arr[0], &structPtr->field_4->arr[i], 8) != 0xFF) r7 = 1; } @@ -4115,3 +4118,105 @@ u32 sub_80176E4(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1) return result; } + +u8 sub_8017734(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1, u8 arg2) +{ + s32 i; + + if (arg1->unk18) + { + for (i = 0; i < arg2; i++) + { + if (arg0[i].field_1A_0 == 0) + { + arg0[i].unk = arg1->unk0; + arg0[i].field_18 = 0; + arg0[i].field_1A_0 = 1; + arg0[i].field_1B = 64; + arg1->unk18 = FALSE; + return i; + } + } + } + + return 0xFF; +} + +void sub_80177B8(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id) +{ + u8 r2; + u8 sp0[6]; + + ConvertIntToDecimalStringN(gStringVar4, id + 1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringAppend(gStringVar4, gText_Colon); + sub_80173E0(arg0, 1, gStringVar4, arg1, arg2, 0); + arg1 += 18; + r2 = arg3->unk.field_0.unk_0a_0; + if (arg3->field_1A_0 == 1 && !(r2 & 0x40)) + { + sub_8018404(gStringVar4, arg3); + sub_80173E0(arg0, 1, gStringVar4, arg1, arg2, arg4); + ConvertIntToDecimalStringN(sp0, arg3->unk.field_0.unk_00.playerTrainerId[0] | (arg3->unk.field_0.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5); + StringCopy(gStringVar4, gText_UnkCtrlCodeF907); + StringAppend(gStringVar4, sp0); + sub_80173E0(arg0, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x88), arg2, arg4); + } +} + +void sub_80178A0(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id) +{ + u8 sp0[6]; + + if (arg3->field_1A_0 == 1) + { + sub_8018404(gStringVar4, arg3); + sub_80173E0(arg0, 1, gStringVar4, arg1, arg2, arg4); + ConvertIntToDecimalStringN(sp0, arg3->unk.field_0.unk_00.playerTrainerId[0] | (arg3->unk.field_0.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5); + StringCopy(gStringVar4, gText_UnkCtrlCodeF907); + StringAppend(gStringVar4, sp0); + sub_80173E0(arg0, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x68), arg2, arg4); + } +} + +bool32 sub_8017940(void) +{ + s16 x, y; + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + if (x != 9) + { + return FALSE; + } + if (y != 8) + { + return FALSE; + } + if (gPlayerAvatar.tileTransitionState == 2 || gPlayerAvatar.tileTransitionState == 0) + { + return TRUE; + } + + return FALSE; +} + +u32 sub_8017984(s32 arg0) +{ + switch (arg0) + { + case 5: + return 1; + case 4: + return 2; + case 8: + return 3; + case 3: + default: + return 0; + } +} + +u32 sub_80179AC(struct UnkStruct_x20 *arg0) +{ + u8 sp0[30]; + sub_8018404(sp0, arg0); + return sub_800E540(ReadAsU16(arg0->unk.field_0.unk_00.playerTrainerId), sp0); +} From ae0e70d7bb17bd7da4e72e2133bad79ab59fa5e7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Mar 2019 11:57:03 -0400 Subject: [PATCH 09/30] sub_80179D4 and rodata --- asm/union_room.s | 157 ----- data/union_room.s | 1562 --------------------------------------------- src/link_rfu.c | 20 +- src/union_room.c | 1170 ++++++++++++++++++++++++++++++--- 4 files changed, 1097 insertions(+), 1812 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 2b1092c34..446a62391 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,163 +5,6 @@ .text - thumb_func_start sub_80179D4 -sub_80179D4: @ 80179D4 - push {r4-r6,lr} - adds r6, r3, 0 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r2, 24 - lsrs r2, 19 - adds r5, r0, r2 - ldrb r1, [r5, 0xA] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08017A4C - cmp r4, 0 - bne _08017A4C - ldr r4, =gStringVar1 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8018404 - adds r0, r5, 0x2 - bl ReadAsU16 - lsls r0, 16 - lsrs r0, 16 - adds r1, r4, 0 - bl sub_800E540 - adds r2, r0, 0 - ldrb r1, [r5, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - bne _08017A38 - ldr r0, =gStringVar4 - ldr r3, =gUnknown_082EE6B8 - lsls r1, r6, 2 - lsls r2, 3 - adds r1, r2 - adds r1, r3 - ldr r1, [r1] - bl StringExpandPlaceholders - movs r0, 0x2 - b _08017B2A - .pool -_08017A38: - ldr r0, =gUnknown_082EE17C - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_8017020 - movs r0, 0x1 - b _08017B2A - .pool -_08017A4C: - ldr r0, =gStringVar1 - adds r1, r5, 0 - bl sub_8018404 - cmp r4, 0 - beq _08017A62 - adds r0, r5, r4 - ldrb r0, [r0, 0x3] - lsrs r6, r0, 3 - movs r0, 0x1 - ands r6, r0 -_08017A62: - ldrb r0, [r5, 0xA] - lsls r0, 25 - lsrs r0, 25 - movs r1, 0x3F - ands r1, r0 - cmp r1, 0x4 - beq _08017AB0 - cmp r1, 0x4 - bgt _08017A80 - cmp r1, 0x1 - beq _08017A8A - b _08017B20 - .pool -_08017A80: - cmp r1, 0x5 - beq _08017AD0 - cmp r1, 0x8 - beq _08017AF4 - b _08017B20 -_08017A8A: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EEEAC - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r1, 14 - lsls r0, r6, 4 - adds r1, r0 - adds r1, r4 - ldr r1, [r1] - b _08017B0E - .pool -_08017AB0: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EF1CC - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - lsls r1, r6, 4 - b _08017B08 - .pool -_08017AD0: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EF010 - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r1, 14 - lsls r0, r6, 4 - adds r1, r0 - adds r1, r4 - ldr r1, [r1] - b _08017B0E - .pool -_08017AF4: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EF100 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - lsls r1, r6, 3 -_08017B08: - adds r0, r1 - adds r0, r4 - ldr r1, [r0] -_08017B0E: - adds r0, r5, 0 - bl StringExpandPlaceholders - b _08017B28 - .pool -_08017B20: - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EE6C8 - bl StringExpandPlaceholders -_08017B28: - movs r0, 0 -_08017B2A: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80179D4 - thumb_func_start nullsub_14 nullsub_14: @ 8017B38 bx lr diff --git a/data/union_room.s b/data/union_room.s index 3213301fb..6934f0fd8 100755 --- a/data/union_room.s +++ b/data/union_room.s @@ -3,1568 +3,6 @@ .section .rodata - .align 2 - -gUnknown_082ED82C:: @ 82ED82C - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 - -gUnknown_082ED84B:: @ 82ED84B - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 - -gUnknown_082ED85B:: @ 82ED85B - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x00, 0x20, 0x00, 0x2a, 0x00 - -gUnknown_082ED868:: @ 82ED868 - .asciz "NOWSLOT" - - .asciz " " - - .asciz "CLOCK DRIFT" - - .asciz "BUSY SEND " - - .asciz "CMD REJECT " - - .asciz "CLOCK SLAVE" - - .ascii "CHILD " - - .align 2 - .ascii "PARENT" - - .align 2 - .ascii "SEARCH" - - .align 2 -gText_EmptyString:: @ 82ED8C4 - .string "$" - - .align 2 -gText_Colon:: @ 82ED8C8 - .string ":$" - - .align 2 -gText_UnkCtrlCodeF907:: @ 82ED8CC - .string "{ID}$" - - .align 2 -gText_PleaseStartOver:: @ 82ED8D0 - .string "Please start over from the beginning.$" - - .align 2 -gText_WirelessSearchCanceled:: @ 82ED8F8 - .string "The WIRELESS COMMUNICATION\nSYSTEM search has been canceled.$" - - .align 2 - .string "Awaiting communication\nfrom another player.$" - - .align 2 -gText_AwaitingCommunication:: @ 82ED960 - .string "{STR_VAR_1}! Awaiting\ncommunication from another player.$" - -gText_AwaitingLink:: @ 82ED990 - .string "{STR_VAR_1}! Awaiting link!\nPress START when everyone's ready.$" - - .align 2 -gJPText_SingleBattle:: @ 82ED9C8 - .string "シングルバトルを かいさいする$" @ "shingurubatoruwo kaisaisuru" ("hold a single battle" in Japanese) - - .align 2 -gJPText_DoubleBattle:: @ 82ED9D8 - .string "ダブルバトルを かいさいする$" @ "daburubatoruwo kaisaisuru" ("hold a double battle" in Japanese) - - .align 2 -gJPText_MultiBattle:: @ 82ED9E8 - .string "マルチバトルを かいさいする$" @ "maruchibatoruwo kaisaisuru" ("hold a multi battle" in Japanese) - - .align 2 -gJPText_TradePokemon:: @ 82ED9F8 - .string "ポケモンこうかんを かいさいする$" @ "pokemonkoukanwo kaisaisuru" ("trade Pokémon" in Japanese) - - .align 2 -gJPText_Chat:: @ 82EDA0C - .string "チャットを かいさいする$" @ "chattowo kaisaisuru" ("chat" in Japanese) - - .align 2 -gJPText_DistWonderCard:: @ 82EDA1C - .string "ふしぎなカードをくばる$" @ "fushiginakaadowokubaru" ("distribute Wonder Card" in Japanese) - - .align 2 -gJPText_DistWonderNews:: @ 82EDA28 - .string "ふしぎなニュースをくばる$" @ "fushiginanyuusuwokubaru" ("distribute Wonder News" in Japanese) - - .align 2 - .string "ふしぎなできごとを かいさいする$" @ "fushiginadekigotowo kaisaisuru" ("hold a session of Mystery Event" in Japanese) - - .align 2 -gJPText_HoldPokemonJump:: @ 82EDA4C - .string "なわとびを かいさいする$" @ "nawatobiwo kaisaisuru" ("hold a session of Jump" in Japanese) - - .align 2 -gJPText_HoldBerryCrush:: @ 82EDA5C - .string "きのみマッシャーを かいさいする$" @ "kinomimassha-wo kaisaisuru" ("hold a session of Berry Masher" in Japanese) - - .align 2 -gJPText_HoldBerryPicking:: @ 82EDA70 - .string "きのみどりを かいさいする$" @ "kinomidoriwo kaisaisuru" ("hold a session of Berry Picking" in Japanese) - - .align 2 -gJPText_HoldSpinTrade:: @ 82EDA80 - .string "ぐるぐるこうかんを かいさいする$" @ "gurugurukoukanwo kaisaisuru" ("hold a session of Spin Trade" in Japanese) - - .align 2 -gJPText_HoldSpinShop:: @ 82EDA94 - .string "ぐるぐるショップを かいさいする$" @ "gurugurushoppuwo kaisaisuru" ("hold a session of Spin Shop" in Japanese) - - .align 2 - .4byte gJPText_SingleBattle - .4byte gJPText_DoubleBattle - .4byte gJPText_MultiBattle - .4byte gJPText_TradePokemon - .4byte gJPText_Chat - .4byte gJPText_DistWonderCard - .4byte gJPText_DistWonderNews - .4byte gJPText_DistWonderCard - .4byte gJPText_HoldPokemonJump - .4byte gJPText_HoldBerryCrush - .4byte gJPText_HoldBerryPicking - .4byte gJPText_HoldBerryPicking - .4byte gJPText_HoldSpinTrade - .4byte gJPText_HoldSpinShop - -gText_1PlayerNeeded:: @ 82EDAE0 - .string "1 player\nneeded.$" - -gText_2PlayersNeeded:: @ 82EDAF1 - .string "2 players\nneeded.$" - -gText_3PlayersNeeded:: @ 82EDB03 - .string "3 players\nneeded.$" - -gText_4PlayersNeeded:: @ 82EDB15 - .string "4 players\nneeded.$" - -gText_2PlayerMode:: @ 82EDB27 - .string "2-PLAYER\nMODE$" - -gText_3PlayerMode:: @ 82EDB35 - .string "3-PLAYER\nMODE$" - -gText_4PlayerMode:: @ 82EDB43 - .string "4-PLAYER\nMODE$" - -gText_5PlayerMode:: @ 82EDB51 - .string "5-PLAYER\nMODE$" - - .align 2 -gUnknown_082EDB60:: @ 82EDB60 - .4byte gText_1PlayerNeeded - .4byte gText_2PlayerMode - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gText_3PlayersNeeded - .4byte gText_2PlayersNeeded - .4byte gText_1PlayerNeeded - .4byte gText_4PlayerMode - .4byte NULL - .4byte gText_1PlayerNeeded - .4byte gText_2PlayerMode - .4byte gText_3PlayerMode - .4byte gText_4PlayerMode - .4byte gText_5PlayerMode - .4byte gText_2PlayersNeeded - .4byte gText_1PlayerNeeded - .4byte gText_3PlayerMode - .4byte gText_4PlayerMode - .4byte gText_5PlayerMode - .4byte gText_1PlayerNeeded - .4byte gText_2PlayerMode - .4byte gText_3PlayerMode - .4byte gText_4PlayerMode - .4byte NULL - - .align 2 -gUnknown_082EDBC4:: @ 82EDBC4 - .string "{B_BUTTON}CANCEL$" - - .align 2 - .string "ため\nさんかしゃ ぼしゅうちゅう です!$" @ "tame\nsankasha boshuuchuu desu!" - - .align 2 -gUnknown_082EDBE8:: @ 82EDBE8 - .string "{STR_VAR_2} contacted you for\n{STR_VAR_1}. Accept?$" - - .align 2 -gUnknown_082EDC0C:: @ 82EDC0C - .string "{STR_VAR_2} contacted you.\nWill you share {STR_VAR_1}?$" - - .align 2 -gUnknown_082EDC34:: @ 82EDC34 - .string "{STR_VAR_2} contacted you.\nAdd to the members?$" - - .align 2 -gUnknown_082EDC5C:: @ 82EDC5C - .string "{STR_VAR_1}!\nAre these members OK?$" - - .align 2 -gUnknown_082EDC78:: @ 82EDC78 - .string "Cancel {STR_VAR_1} MODE\nwith these members?$" - - .align 2 -gUnknown_082EDC9C:: @ 82EDC9C - .string "An “OK” was sent\nto {STR_VAR_1}.$" - - .align 2 -gUnknown_082EDCB4:: @ 82EDCB4 - .string "The other TRAINER doesn't appear\nto be available now…\p$" - - .align 2 -gUnknown_082EDCEC:: @ 82EDCEC - .string "You can't transmit with a TRAINER\nwho is too far away.\p$" - - .align 2 -gUnknown_082EDD24:: @ 82EDD24 - .string "The other TRAINER(S) is/are not\nready yet.\p$" - - .align 2 -gUnknown_082EDD50:: @ 82EDD50 - .4byte gUnknown_082EDCEC - .4byte gUnknown_082EDD24 - - .align 2 -gUnknown_082EDD58:: @ 82EDD58 - .string "The {STR_VAR_1} MODE with\nthese members will be canceled.{PAUSE 60}$" - - .align 2 -gUnknown_082EDD8C:: @ 82EDD8C - .string "There is a member who can no\nlonger remain available.\p$" - - .align 2 -gUnknown_082EDDC4:: @ 82EDDC4 - .4byte gUnknown_082EDCB4 - .4byte gUnknown_082EDD8C - - .align 2 -gUnknown_082EDDCC:: @ 82EDDCC - .string "The other TRAINER appears\nunavailable…\p$" - - .align 2 -gUnknown_082EDDF4:: @ 82EDDF4 - .string "{STR_VAR_1} sent back an “OK”!$" - - .align 2 -gUnknown_082EDE0C:: @ 82EDE0C - .string "{STR_VAR_1} OK'd your registration as\na member.$" - - .align 2 -gUnknown_082EDE34:: @ 82EDE34 - .string "{STR_VAR_1} replied, “No…”\p$" - - .align 2 -gUnknown_082EDE48:: @ 82EDE48 - .string "{STR_VAR_1}!\nAwaiting other members!$" - - .align 2 -gUnknown_082EDE64:: @ 82EDE64 - .string "Quit being a member?$" - - .align 2 -gUnknown_082EDE7C:: @ 82EDE7C - .string "You stopped being a member.\p$" - - .align 2 -gUnknown_082EDE9C:: @ 82EDE9C - .4byte NULL - .4byte gUnknown_082EDD8C - .4byte gUnknown_082EDDCC - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gUnknown_082EDE34 - .4byte NULL - .4byte NULL - .4byte gUnknown_082EDE7C - - .align 2 -gUnknown_082EDEC4:: @ 82EDEC4 - .string "The WIRELESS COMMUNICATION\nSYSTEM link has been established.$" - - .align 2 -gUnknown_082EDF04:: @ 82EDF04 - .string "The WIRELESS COMMUNICATION\nSYSTEM link has been dropped…$" - - .align 2 -gUnknown_082EDF40:: @ 82EDF40 - .string "The link with your friend has been\ndropped…$" - - .align 2 -gUnknown_082EDF6C:: @ 82EDF6C - .string "{STR_VAR_1} replied, “No…”$" - - .align 2 -gUnknown_082EDF80:: @ 82EDF80 - .4byte NULL - .4byte gUnknown_082EDF40 - .4byte gUnknown_082EDF40 - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gUnknown_082EDF6C - .4byte NULL - .4byte NULL - .4byte NULL - - .align 2 -gUnknown_082EDFA8:: @ 82EDF80 - .string "Do you want the {STR_VAR_2}\nMODE?$" - - .align 2 -gUnknown_082EDFC4:: @ 82EDFC4 - .string "Do you want the {STR_VAR_2}\nMODE?$" - - .align 2 - .4byte gUnknown_082EDFA8 - .4byte gUnknown_082EDFC4 - - .align 2 - .string "Communicating…\nPlease wait.$" - - .align 2 -gUnknown_082EE004:: @ 82EE004 - .string "Awaiting {STR_VAR_1}'s response about\nthe trade…$" - - .align 2 -gUnknown_082EE02C:: @ 82EE02C - .string "Communicating{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" - - .align 2 -gUnknown_082EE098:: @ 82EE098 - .string "Communicating with {STR_VAR_1}{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" - - .align 2 -gUnknown_082EE104:: @ 82EE104 - .string "Please wait a while{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" - - .align 2 -gUnknown_082EE17C:: @ 82EE17C - .4byte gUnknown_082EE02C - .4byte gUnknown_082EE098 - .4byte gUnknown_082EE104 - - .align 2 -gUnknown_082EE188:: @ 82EE188 - .string "Hiya! Is there something that you\nwanted to do?$" - - .align 2 -gUnknown_082EE1B8:: @ 82EE1B8 - .string "Hello!\nWould you like to do something?$" - - .align 2 -gUnknown_082EE1E0:: @ 82EE1E0 - .string "{STR_VAR_1}: Hiya, we meet again!\nWhat are you up for this time?$" - - .align 2 -gUnknown_082EE218:: @ 82EE218 - .string "{STR_VAR_1}: Oh! {PLAYER}, hello!\nWould you like to do something?$" - - .align 2 -gUnknown_082EE24C:: @ 82EE24C - .4byte gUnknown_082EE188 - .4byte gUnknown_082EE1B8 - .4byte gUnknown_082EE1E0 - .4byte gUnknown_082EE218 - - .align 2 -gUnknown_082EE25C:: @ 82EE25C - .string "Want to do something?$" - - .align 2 -gUnknown_082EE274:: @ 82EE274 - .string "Would you like to do something?$" - - .align 2 -gUnknown_082EE294:: @ 82EE294 - .string "{STR_VAR_1}: What would you like to\ndo now?$" - - .align 2 - .string "{STR_VAR_1}: Want to do anything else?$" - - .align 2 - .4byte gUnknown_082EE25C - .4byte gUnknown_082EE274 - .4byte gUnknown_082EE294 - .4byte gUnknown_082EE294 - - .align 2 -gUnknown_082EE2E8:: @ 82EE2E8 - .string "Somebody has contacted you.{PAUSE 60}$" - - .align 2 -gUnknown_082EE308:: @ 82EE308 - .string "{STR_VAR_1} has contacted you.{PAUSE 60}$" - - .align 2 -gUnknown_082EE324:: @ 82EE324 - .4byte gUnknown_082EE2E8 - .4byte gUnknown_082EE308 - - .align 2 -gUnknown_082EE32C:: @ 82EE32C - .string "Awaiting a response from\nthe other TRAINER…$" - - .align 2 -gUnknown_082EE358:: @ 82EE358 - .string "Awaiting a response from\n{STR_VAR_1}…$" - - .align 2 -gUnknown_082EE378:: @ 82EE378 - .4byte gUnknown_082EE32C - .4byte gUnknown_082EE358 - - .align 2 -gUnknown_082EE380:: @ 82EE380 - .string "The other TRAINER showed\nyou their TRAINER CARD.\pWould you like to show your\nTRAINER CARD?$" - - .align 2 -gUnknown_082EE3DC:: @ 82EE3DC - .string "The other TRAINER challenges you\nto battle.\pWill you accept the battle\nchallenge?$" - - .align 2 -gUnknown_082EE430:: @ 82EE430 - .string "The other TRAINER invites you\nto chat.\pWill you accept the chat\ninvitation?$" - - .align 2 -gUnknown_082EE47C:: @ 82EE47C - .string "There is an offer to trade your\nregistered Lv. {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}\pin exchange for a\nLv. {SPECIAL_F7 0x02} {SPECIAL_F7 0x03}.\pWill you accept this trade\noffer?$" - - .align 2 -gUnknown_082EE4F0:: @ 82EE4F0 - .string "There is an offer to trade your\nregistered EGG.\lWill you accept this trade offer?$" - - .align 2 -gUnknown_082EE544:: @ 82EE544 - .string "The chat has been dropped.\p$" - - .align 2 -gUnknown_082EE560:: @ 82EE560 - .string "You declined the offer.\p$" - - .align 2 -gUnknown_082EE57C:: @ 82EE57C - .string "You declined the offer.\p$" - - .align 2 -gUnknown_082EE598:: @ 82EE598 - .string "The chat was ended.\p$" - - .align 2 - .4byte gUnknown_082EE380 - .4byte gUnknown_082EE3DC - .4byte gUnknown_082EE430 - .4byte gUnknown_082EE47C - - .align 2 -gUnknown_082EE5C0:: @ 82EE5C0 - .string "Oh, hey! We're in a chat right now.\nWant to join us?$" - - .align 2 -gUnknown_082EE5F8:: @ 82EE5F8 - .string "{STR_VAR_1}: Hey, {PLAYER}!\nWe're having a chat right now.\lWant to join us?$" - - .align 2 -gUnknown_082EE638:: @ 82EE638 - .string "Oh, hi! We're having a chat now.\nWould you like to join us?$" - - .align 2 -gUnknown_082EE674:: @ 82EE674 - .string "{STR_VAR_1}: Oh, hi, {PLAYER}!\nWe're having a chat now.\lWould you like to join us?$" - - .align 2 -gUnknown_082EE6B8:: @ 82EE6B8 - .4byte gUnknown_082EE5C0 - .4byte gUnknown_082EE638 - .4byte gUnknown_082EE5F8 - .4byte gUnknown_082EE674 - - .align 2 -gUnknown_082EE6C8:: @ 82EE6C8 - .string "……\nThe TRAINER appears to be busy…\p$" - - .align 2 -gUnknown_082EE6EC:: @ 82EE6EC - .string "A battle, huh?\nAll right, just give me some time.$" - - .align 2 -gUnknown_082EE720:: @ 82EE720 - .string "You want to chat, huh?\nSure, just wait a little.$" - - .align 2 -gUnknown_082EE754:: @ 82EE754 - .string "Sure thing! As my “Greetings,”\nhere's my TRAINER CARD.$" - - .align 2 -gUnknown_082EE78C:: @ 82EE78C - .string "A battle? Of course, but I need\ntime to get ready.$" - - .align 2 -gUnknown_082EE7C0:: @ 82EE7C0 - .string "Did you want to chat?\nOkay, but please wait a moment.$" - - .align 2 -gUnknown_082EE7F8:: @ 82EE7F8 - .string "As my introduction, I'll show you\nmy TRAINER CARD.$" - - .align 2 -gUnknown_082EE82C:: @ 82EE82C - .4byte gUnknown_082EE6EC - .4byte gUnknown_082EE720 - .4byte NULL - .4byte gUnknown_082EE754 - .4byte gUnknown_082EE78C - .4byte gUnknown_082EE7C0 - .4byte NULL - .4byte gUnknown_082EE7F8 - - .align 2 - .string "You want to chat, huh?\nSure, just wait a little.$" - - .align 2 -gUnknown_082EE880:: @ 82EE880 - .string "Thanks for waiting!\nLet's get our battle started!{PAUSE 60}$" - - .align 2 -gUnknown_082EE8B8:: @ 82EE880 - .string "All right!\nLet's chat!{PAUSE 60}$" - - .align 2 -gUnknown_082EE8D4:: @ 82EE8D4 - .string "Sorry I made you wait!\nLet's get started!{PAUSE 60}$" - - .align 2 -gUnknown_082EE904:: @ 82EE904 - .string "Sorry I made you wait!\nLet's chat.{PAUSE 60}$" - - .align 2 -gUnknown_082EE92C:: @ 82EE92C - .string "The trade will be started.{PAUSE 60}$" - - .align 2 -gUnknown_082EE94C:: @ 82EE94C - .string "The battle will be started.{PAUSE 60}$" - - .align 2 -gUnknown_082EE96C:: @ 82EE96C - .string "Entering the chat…{PAUSE 60}$" - - .align 2 -gUnknown_082EE984:: @ 82EE984 - .4byte gUnknown_082EE94C - .4byte gUnknown_082EE96C - .4byte gUnknown_082EE92C - .4byte gUnknown_082EE94C - .4byte gUnknown_082EE96C - .4byte gUnknown_082EE92C - .4byte gUnknown_082EE880 - .4byte gUnknown_082EE8B8 - .4byte gUnknown_082EE92C - .4byte gUnknown_082EE8D4 - .4byte gUnknown_082EE904 - .4byte gUnknown_082EE92C - - .align 2 -gUnknown_082EE9B4:: @ 82EE9B4 - .string "Sorry! My POKéMON don't seem to\nbe feeling too well right now.\lLet me battle you another time.\p$" - - .align 2 -gUnknown_082EEA14:: @ 82EEA14 - .string "I'm terribly sorry, but my POKéMON\naren't feeling well…\pLet's battle another time.\p$" - - .align 2 -gUnknown_082EEA68:: @ 82EEA68 - .4byte gUnknown_082EE9B4 - .4byte gUnknown_082EEA14 - - .align 2 -gUnknown_082EEA70:: @ 82EEA70 - .string "Huh? My TRAINER CARD…\nWhere'd it go now?\lSorry! I'll show you another time!\p$" - - .align 2 -gUnknown_082EEAC0:: @ 82EEAC0 - .string "Oh? Now where did I put my\nTRAINER CARD?…\lSorry! I'll show you later!\p$" - - .align 2 -gUnknown_082EEB08:: @ 82EEB08 - .4byte gUnknown_082EEA70 - .4byte gUnknown_082EEAC0 - - .align 2 -gUnknown_082EEB10:: @ 82EEB10 - .string "If you want to do something with\nme, just give me a shout!\p$" - - .align 2 -gUnknown_082EEB4C:: @ 82EEB4C - .string "If you want to do something with\nme, don't be shy.\p$" - - .align 2 -gUnknown_082EEB80:: @ 82EEB80 - .4byte gUnknown_082EEB10 - .4byte gUnknown_082EEB4C - - .align 2 -gUnknown_082EEB88:: @ 82EEB88 - .string "Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p$" - - .align 2 -gUnknown_082EEBD0:: @ 82EEBD0 - .string "If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p$" - - .align 2 -gUnknown_082EEC14:: @ 82EEC14 - .string "For a battle, you need two\nPOKéMON that are below Lv. 30.\p$" - - .align 2 -gUnknown_082EEC50:: @ 82EEC50 - .string "Oh, all right.\nCome see me anytime, okay?\p$" - - .align 2 -gUnknown_082EEC7C:: @ 82EEC7C - .string "Oh…\nPlease come by anytime.\p$" - - .align 2 -gUnknown_082EEC9C:: @ 82EEC9C - .4byte gUnknown_082EEC50 - .4byte gUnknown_082EEC7C - - .align 2 -gUnknown_082EECA4:: @ 82EECA4 - .string "Oh, sorry!\nI just can't right this instant.\lLet's chat another time.\p$" - - .align 2 -gUnknown_082EECEC:: @ 82EECEC - .string "Oh, I'm sorry.\nI have too much to do right now.\lLet's chat some other time.\p$" - - .align 2 -gUnknown_082EED3C:: @ 82EED3C - .4byte gUnknown_082EECA4 - .4byte gUnknown_082EECEC - - .align 2 -gUnknown_082EED44:: @ 82EED3C - .string "Whoa!\nI can tell you're pretty tough!\p$" - - .align 2 -gUnknown_082EED6C:: @ 82EED6C - .string "You used that move?\nThat's good strategy!\p$" - - .align 2 -gUnknown_082EED98:: @ 82EED98 - .string "Way to go!\nThat was an eye-opener!\p$" - - .align 2 -gUnknown_082EEDBC:: @ 82EEDBC - .string "Oh! How could you use that\nPOKéMON in that situation?\p$" - - .align 2 -gUnknown_082EEDF4:: @ 82EEDF4 - .string "That POKéMON…\nIt's been raised really well!\p$" - - .align 2 -gUnknown_082EEE24:: @ 82EEE24 - .string "That's it!\nThis is the right move now!\p$" - - .align 2 -gUnknown_082EEE4C:: @ 82EEE4C - .string "That's awesome!\nYou can battle that way?\p$" - - .align 2 -gUnknown_082EEE78:: @ 82EEE78 - .string "You have exquisite timing for\nswitching POKéMON!\p$" - - .align 2 -gUnknown_082EEEAC:: @ 82EEEAC - .4byte gUnknown_082EED44 - .4byte gUnknown_082EED6C - .4byte gUnknown_082EED98 - .4byte gUnknown_082EEDBC - .4byte gUnknown_082EEDF4 - .4byte gUnknown_082EEE24 - .4byte gUnknown_082EEE4C - .4byte gUnknown_082EEE78 - - .align 2 -gUnknown_082EEECC:: @ 82EEECC - .string "Oh, I see!\nThis is educational!\p$" - - .align 2 -gUnknown_082EEEF0:: @ 82EEEF0 - .string "Don't say anything funny anymore!\nI'm sore from laughing!\p$" - - .align 2 -gUnknown_082EEF2C:: @ 82EEF2C - .string "Oh?\nSomething like that happened.\p$" - - .align 2 -gUnknown_082EEF50:: @ 82EEF50 - .string "Hmhm… What?\nSo is this what you're saying?\p$" - - .align 2 -gUnknown_082EEF7C:: @ 82EEF7C - .string "Is that right?\nI didn't know that.\p$" - - .align 2 -gUnknown_082EEFA0:: @ 82EEFA0 - .string "Ahaha!\nWhat is that about?\p$" - - .align 2 -gUnknown_082EEFBC:: @ 82EEFBC - .string "Yes, that's exactly it!\nThat's what I meant.\p$" - - .align 2 -gUnknown_082EEFEC:: @ 82EEFEC - .string "In other words…\nYes! That's right!\p$" - - .align 2 -gUnknown_082EF010:: @ 82EF010 - .4byte gUnknown_082EEECC - .4byte gUnknown_082EEEF0 - .4byte gUnknown_082EEF2C - .4byte gUnknown_082EEF50 - .4byte gUnknown_082EEF7C - .4byte gUnknown_082EEFA0 - .4byte gUnknown_082EEFBC - .4byte gUnknown_082EEFEC - - .align 2 -gUnknown_082EF030:: @ 82EF030 - .string "I'm just showing my TRAINER CARD\nas my way of greeting.\p$" - - .align 2 -gUnknown_082EF06C:: @ 82EF06C - .string "I hope I get to know you better!\p$" - - .align 2 -gUnknown_082EF090:: @ 82EF010 - .string "We're showing each other our\nTRAINER CARDS to get acquainted.\p$" - - .align 2 -gUnknown_082EF0D0:: @ 82EF0D0 - .string "Glad to meet you.\nPlease don't be a stranger!\p$" - - .align 2 -gUnknown_082EF100:: @ 82EF100 - .4byte gUnknown_082EF030 - .4byte gUnknown_082EF06C - .4byte gUnknown_082EF090 - .4byte gUnknown_082EF0D0 - - .align 2 -gUnknown_082EF110:: @ 82EF110 - .string "Yeahah!\nI really wanted this POKéMON!\p$" - - .align 2 -gUnknown_082EF138:: @ 82EF138 - .string "Finally, a trade got me that\nPOKéMON I'd wanted a long time.\p$" - - .align 2 -gUnknown_082EF178:: @ 82EF178 - .string "I'm trading POKéMON right now.\p$" - - .align 2 -gUnknown_082EF198:: @ 82EF198 - .string "I finally got that POKéMON I\nwanted in a trade!\p$" - - .align 2 -gUnknown_082EF1CC:: @ 82EF1CC - .4byte gUnknown_082EF110 - .4byte gUnknown_082EF138 - .4byte NULL - .4byte NULL - .4byte gUnknown_082EF178 - .4byte gUnknown_082EF198 - .4byte NULL - .4byte NULL - - .align 2 -gUnknown_082EF1EC:: @ 82EF1EC - .string "{STR_VAR_1} checked the\nTRADING BOARD.\p$" - - .align 2 -gUnknown_082EF20C:: @ 82EF20C - .string "Welcome to the TRADING BOARD.\pYou may register your POKéMON\nand offer it up for a trade.\pWould you like to register one of\nyour POKéMON?$" - - .align 2 -gUnknown_082EF298:: @ 82EF298 - .string "This TRADING BOARD is used for\noffering a POKéMON for a trade.\pAll you need to do is register a\nPOKéMON for a trade.\pAnother TRAINER may offer a party\nPOKéMON in return for the trade.\pWe hope you will register POKéMON\nand trade them with many, many\lother TRAINERS.\pWould you like to register one of\nyour POKéMON?$" - - .align 2 - .string "We have registered your POKéMON for\ntrade on the TRADING BOARD.\pThank you for using this service!\p$" - - .align 2 - .string "Nobody has registered any POKéMON\nfor trade on the TRADING BOARD.\p\n$" - - .align 2 -gUnknown_082EF47C:: @ 82EF47C - .string "Please choose the type of POKéMON\nthat you would like in the trade.\n$" - - .align 2 -gUnknown_082EF4C4:: @ 82EF4C4 - .string "Which of your party POKéMON will\nyou offer in trade?\p$" - - .align 2 -gUnknown_082EF4FC:: @ 82EF4FC - .string "Registration has been canceled.\p$" - - .align 2 -gUnknown_082EF520:: @ 82EF520 - .string "Registration has been completed.\p$" - - .align 2 -gUnknown_082EF544:: @ 82EF544 - .string "The trade has been canceled.\p$" - - .align 2 -gUnknown_082EF564:: @ 82EF564 - .string "Cancel the registration of your\nLv. {STR_VAR_2} {STR_VAR_1}?$" - - .align 2 -gUnknown_082EF590:: @ 82EF590 - .string "Cancel the registration of your\nEGG?$" - - .align 2 -gUnknown_082EF5B8:: @ 82EF5B8 - .string "The registration has been canceled.\p$" - - .align 2 - .string "TRAINERS wishing to make a trade\nwill be listed.$" - - .align 2 - .string "Please choose the TRAINER with whom\nyou would like to trade POKéMON.$" - - .align 2 -gUnknown_082EF65C:: @ 82EF65C - .string "Would you like to ask {STR_VAR_1} to\nmake a trade?$" - - .align 2 - .string "Awaiting a response from\nthe other TRAINER…$" - - .align 2 - .string "You have not registered a POKéMON\nfor trading.\p$" - - .align 2 -gUnknown_082EF6E4:: @ 82EF6E4 - .string "You don't have a {STR_VAR_2}-type\nPOKéMON that {STR_VAR_1} wants.\p$" - - .align 2 -gUnknown_082EF718:: @ 82EF718 - .string "You don't have an EGG that\n{STR_VAR_1} wants.\p$" - - .align 2 -gUnknown_082EF740:: @ 82EF740 - .string "{STR_VAR_1} can't make a trade for\nyour POKéMON right now.\p$" - - .align 2 -gUnknown_082EF774:: @ 82EF774 - .string "You can't make a trade for\n{STR_VAR_1}'s POKéMON right now.\p$" - - .align 2 - .4byte gUnknown_082EF740 - .4byte gUnknown_082EF774 - - .align 2 -gUnknown_082EF7B0:: @ 82EF7B0 - .string "Your trade offer was rejected.\p$" - - .align 2 -gUnknown_082EF7D0:: @ 82EF7D0 - .string "EGG TRADE$" - - .align 2 -gUnknown_082EF7DC:: @ 82EF7DC - .string "{DPAD_UPDOWN}CHOOSE {A_BUTTON}JOIN {B_BUTTON}CANCEL$" - - .align 2 -gUnknown_082EF7F8:: @ 82EF7F8 - .string "Please choose a TRAINER.$" - - .align 2 -gUnknown_082EF814:: @ 82EF814 - .string "Please choose a TRAINER for\na SINGLE BATTLE.$" - - .align 2 -gUnknown_082EF844:: @ 82EF844 - .string "Please choose a TRAINER for\na DOUBLE BATTLE.$" - - .align 2 -gUnknown_082EF874:: @ 82EF874 - .string "Please choose the LEADER\nfor a MULTI BATTLE.$" - - .align 2 -gUnknown_082EF8A4:: @ 82EF8A4 - .string "Please choose the TRAINER to\ntrade with.$" - - .align 2 -gUnknown_082EF8D0:: @ 82EF8D0 - .string "Please choose the TRAINER who is\nsharing WONDER CARDS.$" - - .align 2 -gUnknown_082EF908:: @ 82EF908 - .string "Please choose the TRAINER who is\nsharing WONDER NEWS.$" - - .align 2 -gUnknown_082EF940:: @ 82EF940 - .string "Jump with mini POKéMON!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF974:: @ 82EF974 - .string "BERRY CRUSH!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF99C:: @ 82EF974 - .string "DODRIO BERRY-PICKING!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF9CC:: @ 82EF9CC - .string "BERRY BLENDER!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF9F8:: @ 82EF9F8 - .string "RECORD CORNER!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFA24:: @ 82EFA24 - .string "COOLNESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFA50:: @ 82EFA50 - .string "BEAUTY CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFA7C:: @ 82EFA7C - .string "CUTENESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFAA8:: @ 82EFAA8 - .string "SMARTNESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFAD8:: @ 82EFAD8 - .string "TOUGHNESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFB08:: @ 82EFB08 - .string "BATTLE TOWER LEVEL 50!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFB3C:: @ 82EFB3C - .string "BATTLE TOWER OPEN LEVEL!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFB70:: @ 82EFB70 - .4byte gUnknown_082EF814 - .4byte gUnknown_082EF844 - .4byte gUnknown_082EF874 - .4byte gUnknown_082EF8A4 - .4byte gUnknown_082EF940 - .4byte gUnknown_082EF974 - .4byte gUnknown_082EF99C - .4byte gUnknown_082EF8D0 - .4byte gUnknown_082EF908 - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gUnknown_082EF9F8 - .4byte gUnknown_082EF9CC - .4byte NULL - .4byte gUnknown_082EFA24 - .4byte gUnknown_082EFA50 - .4byte gUnknown_082EFA7C - .4byte gUnknown_082EFAA8 - .4byte gUnknown_082EFAD8 - .4byte gUnknown_082EFB08 - .4byte gUnknown_082EFB3C - - .align 2 -gUnknown_082EFBC8:: @ 82EFBC8 - .string "Searching for a WIRELESS\nCOMMUNICATION SYSTEM. Wait...$" - - .align 2 - .string "For a DOUBLE BATTLE, you must have\nat least two POKéMON.\p$" - - .align 2 -gUnknown_082EFC3C:: @ 82EFC3C - .string "Awaiting {STR_VAR_1}'s response…$" - - .align 2 -gUnknown_082EFC54:: @ 82EFC54 - .string "{STR_VAR_1} has been asked to register\nyou as a member. Please wait.$" - - .align 2 -gUnknown_082EFC90:: @ 82EFC90 - .string "Awaiting a response from the\nWIRELESS COMMUNICATION SYSTEM.$" - - .align 2 - .string "Please wait for other TRAINERS to\ngather and get ready.$" - - .align 2 -gUnknown_082EFD04:: @ 82EFD04 - .string "No CARDS appear to be shared \nright now.$" - - .align 2 -gUnknown_082EFD30:: @ 82EFD30 - .string "No NEWS appears to be shared\nright now.$" - - .align 2 -gUnknown_082EFD58:: @ 82EFD58 - .4byte gUnknown_082EFD04 - .4byte gUnknown_082EFD30 - - .align 2 -gUnknown_082EFD60:: @ 82EFD60 - .string "BATTLE$" - - .align 2 -gUnknown_082EFD68:: @ 82EFD68 - .string "CHAT$" - - .align 2 -gUnknown_082EFD70:: @ 82EFD70 - .string "GREETINGS$" - - .align 2 -gUnknown_082EFD7C:: @ 82EFD7C - .string "EXIT$" - - .align 2 -gUnknown_082EFD84:: @ 82EFD84 - .string "EXIT$" - - .align 2 -gUnknown_082EFD8C:: @ 82EFD8C - .string "INFO$" - - .align 2 -gUnknown_082EFD94:: @ 82EFD94 - .string "NAME{CLEAR_TO 0x3C}WANTED{CLEAR_TO 0x6E}OFFER{CLEAR_TO 0xC6}LV.$" - - .align 2 -gUnknown_082EFDB0:: @ 82EFDB0 - .string "SINGLE BATTLE$" - - .align 2 -gUnknown_082EFDC0:: @ 82EFDC0 - .string "DOUBLE BATTLE$" - - .align 2 -gUnknown_082EFDD0:: @ 82EFDD0 - .string "MULTI BATTLE$" - - .align 2 -gUnknown_082EFDE0:: @ 82EFDE0 - .string "POKéMON TRADES$" - - .align 2 -gUnknown_082EFDF0:: @ 82EFDF0 - .string "CHAT$" - - .align 2 -gUnknown_082EFDF8:: @ 82EFDF8 - .string "CARDS$" - - .align 2 -gUnknown_082EFE00:: @ 82EFE00 - .string "WONDER CARDS$" - - .align 2 -gUnknown_082EFE10:: @ 82EFE10 - .string "WONDER NEWS$" - - .align 2 -gUnknown_082EFE1C:: @ 82EFE1C - .string "POKéMON JUMP$" - - .align 2 -gUnknown_082EFE2C:: @ 82EFE2C - .string "BERRY CRUSH$" - - .align 2 -gUnknown_082EFE38:: @ 82EFE38 - .string "BERRY-PICKING$" - - .align 2 -gUnknown_082EFE48:: @ 82EFE48 - .string "SEARCH$" - - .align 2 -gUnknown_082EFE50:: @ 82EFE50 - .string "BERRY BLENDER$" - - .align 2 -gUnknown_082EFE60:: @ 82EFE60 - .string "RECORD CORNER$" - - .align 2 -gUnknown_082EFE70:: @ 82EFE70 - .string "COOL CONTEST$" - - .align 2 -gUnknown_082EFE80:: @ 82EFE80 - .string "BEAUTY CONTEST$" - - .align 2 -gUnknown_082EFE90:: @ 82EFE90 - .string "CUTE CONTEST$" - - .align 2 -gUnknown_082EFEA0:: @ 82EFEA0 - .string "SMART CONTEST$" - - .align 2 -gUnknown_082EFEB0:: @ 82EFEB0 - .string "TOUGH CONTEST$" - - .align 2 -gUnknown_082EFEC0:: @ 82EFEC0 - .string "BATTLE TOWER LV. 50$" - - .align 2 -gUnknown_082EFED4:: @ 82EFED4 - .string "BATTLE TOWER OPEN LEVEL$" - - .align 2 -gUnknown_082EFEEC:: @ 82EFEEC - .string "It's a NORMAL CARD.$" - - .align 2 -gUnknown_082EFF00:: @ 82EFF00 - .string "It's a BRONZE CARD!$" - - .align 2 -gUnknown_082EFF14:: @ 82EFF14 - .string "It's a COPPER CARD!$" - - .align 2 -gUnknown_082EFF28:: @ 82EFF28 - .string "It's a SILVER CARD!$" - - .align 2 -gUnknown_082EFF3C:: @ 82EFF3C - .string "It's a GOLD CARD!$" - - .align 2 -gUnknown_082EFF50:: @ 82EFF50 - .4byte gUnknown_082EFEEC - .4byte gUnknown_082EFF00 - .4byte gUnknown_082EFF14 - .4byte gUnknown_082EFF28 - .4byte gUnknown_082EFF3C - -gUnknown_082EFF64:: @ 82EFF64 - .string "This is {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}'s\nTRAINER CARD…\l{SPECIAL_F7 0x02}\pPOKéDEX: {SPECIAL_F7 0x03}\nTIME: {SPECIAL_F7 0x04}:{SPECIAL_F7 0x05}\p$" - - .align 2 -gUnknown_082EFFA4:: @ 82EFFA4 - .string "BATTLES: WINS: {SPECIAL_F7 0x00} LOSSES: {SPECIAL_F7 0x02}\nTRADES: {SPECIAL_F7 0x03}\p“{SPECIAL_F7 0x04} {SPECIAL_F7 0x05}\n{SPECIAL_F7 0x06} {SPECIAL_F7 0x07}”\p$" - - .align 2 -gUnknown_082EFFDC:: @ 82EFFDC - .string "{SPECIAL_F7 0x01}: Glad to have met you!{PAUSE 60}$" - - .align 2 -gUnknown_082EFFFC:: @ 82EFFFC - .string "{SPECIAL_F7 0x01}: Glad to meet you!{PAUSE 60}$" - - .align 2 -gUnknown_082F0018:: @ 82F0018 - .4byte gUnknown_082EFFDC - .4byte gUnknown_082EFFFC - - .align 2 -gUnknown_082F0020:: @ 82F0020 - .string "Finished checking {SPECIAL_F7 0x01}'s\nTRAINER CARD.{PAUSE 60}$" - - .align 2 -gUnknown_082F0048:: @ 82F0048 - .4byte gText_EmptyString - .4byte gUnknown_082EFDB0 - .4byte gUnknown_082EFDC0 - .4byte gUnknown_082EFDD0 - .4byte gUnknown_082EFDE0 - .4byte gUnknown_082EFDF0 - .4byte gUnknown_082EFE00 - .4byte gUnknown_082EFE10 - .4byte gUnknown_082EFDF8 - .4byte gUnknown_082EFE1C - .4byte gUnknown_082EFE2C - .4byte gUnknown_082EFE38 - .4byte gUnknown_082EFE48 - .4byte gText_EmptyString - .4byte gUnknown_082EFED4 - .4byte gUnknown_082EFE60 - .4byte gUnknown_082EFE50 - .4byte gText_EmptyString - .4byte gText_EmptyString - .4byte gText_EmptyString - .4byte gText_EmptyString - .4byte gUnknown_082EFE00 - .4byte gUnknown_082EFE10 - .4byte gUnknown_082EFE70 - .4byte gUnknown_082EFE80 - .4byte gUnknown_082EFE90 - .4byte gUnknown_082EFEA0 - .4byte gUnknown_082EFEB0 - .4byte gUnknown_082EFEC0 - - .align 2 -gUnknown_082F00BC:: @ 82F00BC - window_template 0x00, 0x00, 0x00, 0x1E, 0x02, 0x0F, 0x0008 - - .align 2 -gUnknown_082F00C4:: @ 82F00C4 - .byte 0x01, 0x02, 0x00, 0x00 - .byte 0x02, 0x02, 0x00, 0x00 - .byte 0x03, 0x04, 0x00, 0x00 - .byte 0x04, 0x02, 0x00, 0x00 - .byte 0x09, 0x25, 0x00, 0x00 - .byte 0x0a, 0x25, 0x00, 0x00 - .byte 0x0b, 0x35, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x0f, 0x24, 0x00, 0x00 - .byte 0x10, 0x24, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x17, 0x24, 0x00, 0x00 - .byte 0x18, 0x24, 0x00, 0x00 - .byte 0x19, 0x24, 0x00, 0x00 - .byte 0x1a, 0x24, 0x00, 0x00 - .byte 0x1b, 0x24, 0x00, 0x00 - .byte 0x1c, 0x02, 0x00, 0x00 - .byte 0x0e, 0x02, 0x00, 0x00 - - .align 2 -gUnknown_082F011C:: @ 82F011C - window_template 0x00, 0x01, 0x03, 0x0d, 0x08, 0x0f, 0x0044 - - .align 2 -gUnknown_082F0124:: @ 82F0124 - window_template 0x00, 0x01, 0x03, 0x0d, 0x0a, 0x0f, 0x0044 - - .align 2 -gUnknown_082F012C:: @ 82F012C - window_template 0x00, 0x10, 0x03, 0x07, 0x04, 0x0f, 0x00c6 - - .align 2 -gUnknown_082F0134:: @ 82F0134 - .4byte gText_EmptyString - .4byte 0x00000000 - .4byte gText_EmptyString - .4byte 0x00000001 - .4byte gText_EmptyString - .4byte 0x00000002 - .4byte gText_EmptyString - .4byte 0x00000003 - .4byte gText_EmptyString - .4byte 0x00000004 - - .align 2 -gUnknown_082F015C:: @ 82F015C struct ListMenuTemplate - .4byte gUnknown_082F0134 - .4byte NULL - .4byte sub_8013278 - .byte 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x21, 0x31, 0x00, 0x41 - - .align 2 -gUnknown_082F0174:: @ 82F0174 - window_template 0x00, 0x01, 0x03, 0x11, 0x0a, 0x0f, 0x0044 - - .align 2 -gUnknown_082F017C:: @ 82F017C - window_template 0x00, 0x14, 0x03, 0x07, 0x04, 0x0f, 0x00ee - - .align 2 -gUnknown_082F0184:: @ 82F0184 - .4byte gText_EmptyString, 0x00000000 - .4byte gText_EmptyString, 0x00000001 - .4byte gText_EmptyString, 0x00000002 - .4byte gText_EmptyString, 0x00000003 - .4byte gText_EmptyString, 0x00000004 - .4byte gText_EmptyString, 0x00000005 - .4byte gText_EmptyString, 0x00000006 - .4byte gText_EmptyString, 0x00000007 - .4byte gText_EmptyString, 0x00000008 - .4byte gText_EmptyString, 0x00000009 - .4byte gText_EmptyString, 0x0000000a - .4byte gText_EmptyString, 0x0000000b - .4byte gText_EmptyString, 0x0000000c - .4byte gText_EmptyString, 0x0000000d - .4byte gText_EmptyString, 0x0000000e - .4byte gText_EmptyString, 0x0000000f - - .align 2 -gUnknown_082F0204:: @ 82F0204 struct ListMenuTemplate - .4byte gUnknown_082F0184 - .4byte ListMenuDefaultCursorMoveFunc - .4byte sub_8013DF4 - .byte 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x40, 0x01 - - .align 2 -gUnknown_082F021C:: @ 82F021C - window_template 0x00, 0x14, 0x05, 0x10, 0x08, 0x0f, 0x0001 - - .align 2 -gUnknown_082F0224:: @ 82F0224 - .4byte gUnknown_082EFD70, 0x00000208 - .4byte gUnknown_082EFD60, 0x00000241 - .4byte gUnknown_082EFD68, 0x00000245 - .4byte gUnknown_082EFD7C, 0x00000040 - - .align 2 -gUnknown_082F0244:: @ 82F0244 struct ListMenuTemplate - .4byte gUnknown_082F0224 - .byte 0x79, 0xf0, 0x1a, 0x08 - .4byte NULL - .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F025C:: @ 82F025C - window_template 0x00, 0x12, 0x07, 0x10, 0x06, 0x0f, 0x0001 - -gUnknown_082F0264:: @ 82F0264 - .4byte gText_Register, 0x00000001 - .4byte gUnknown_082EFD8C, 0x00000002 - .4byte gUnknown_082EFD7C, 0x00000003 - - .align 2 -gUnknown_082F027C:: @ 82F027C - .4byte gUnknown_082F0264 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0294:: @ 82F0294 - window_template 0x00, 0x14, 0x01, 0x10, 0x0c, 0x0f, 0x0001 - - .align 2 -gUnknown_082F029C:: @ 82F029C - .4byte gTypeNames, 0x00000000 @ NORMAL - .4byte gTypeNames+0x46, 0x0000000a @ FIRE - .4byte gTypeNames+0x4D, 0x0000000b @ WATER - .4byte gTypeNames+0x5B, 0x0000000d @ ELECTR - .4byte gTypeNames+0x54, 0x0000000c @ GRASS - .4byte gTypeNames+0x69, 0x0000000f @ ICE - .4byte gTypeNames+0x1C, 0x00000004 @ GROUND - .4byte gTypeNames+0x23, 0x00000005 @ ROCK - .4byte gTypeNames+0x0E, 0x00000002 @ FLYING - .4byte gTypeNames+0x62, 0x0000000e @ PSYCHC - .4byte gTypeNames+0x07, 0x00000001 @ FIGHT - .4byte gTypeNames+0x15, 0x00000003 @ POISON - .4byte gTypeNames+0x2A, 0x00000006 @ BUG - .4byte gTypeNames+0x31, 0x00000007 @ GHOST - .4byte gTypeNames+0x70, 0x00000010 @ DRAGON - .4byte gTypeNames+0x38, 0x00000008 @ STEEL - .4byte gTypeNames+0x77, 0x00000011 @ DARK - .4byte gUnknown_082EFD7C, 0x00000012 @ EXIT - - .align 2 -gUnknown_082F032C:: @ 82F032C - .4byte gUnknown_082F029C - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x12, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0344:: @ 82F0344 - window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0001 - - .align 2 -gUnknown_082F034C:: @ 82F034C - window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039 - - .align 2 -gUnknown_082F0354:: @ 82F0354 - .4byte gText_EmptyString, 0xfffffffd - .4byte gText_EmptyString, 0x00000000 - .4byte gText_EmptyString, 0x00000001 - .4byte gText_EmptyString, 0x00000002 - .4byte gText_EmptyString, 0x00000003 - .4byte gText_EmptyString, 0x00000004 - .4byte gText_EmptyString, 0x00000005 - .4byte gText_EmptyString, 0x00000006 - .4byte gText_EmptyString, 0x00000007 - .4byte gUnknown_082EFD84, 0x00000008 - - .align 2 -gUnknown_082F03A4:: @ 82F03A4 - .4byte gUnknown_082F0354 - .4byte ListMenuDefaultCursorMoveFunc - .4byte sub_8017BE8 - .byte 0x0a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0xe1, 0xdf, 0x00, 0x01 - - .align 2 - window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039 - - .align 2 -gUnknown_082F03C4:: @ 82F03C4 - .4byte gText_EmptyString, 0x00000000 - .4byte gText_EmptyString, 0x00000001 - .4byte gText_EmptyString, 0x00000002 - .4byte gText_EmptyString, 0x00000003 - .4byte gText_EmptyString, 0x00000004 - .4byte gText_EmptyString, 0x00000005 - .4byte gText_EmptyString, 0x00000006 - .4byte gText_EmptyString, 0x00000007 - .4byte gText_EmptyString, 0x00000008 - .4byte gText_EmptyString, 0x00000009 - .4byte gText_EmptyString, 0x0000000a - .4byte gText_EmptyString, 0x0000000b - .4byte gText_EmptyString, 0x0000000c - .4byte gText_EmptyString, 0x0000000d - .4byte gText_EmptyString, 0x0000000e - .4byte gText_EmptyString, 0x0000000f - - .align 2 - .4byte gUnknown_082F03C4 - .4byte ListMenuDefaultCursorMoveFunc - .4byte nullsub_14 - .byte 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x40, 0x01 - - .align 2 -gUnknown_082F045C:: @ 82F045C - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F0474:: @ 82F0474 - .byte 0x01, 0xff - - .align 2 -gUnknown_082F0478:: @ 82F0478 - .byte 0x02, 0xff - - .align 2 -gUnknown_082F047C:: @ 82F047C - .byte 0x03, 0xff - - .align 2 -gUnknown_082F0480:: @ 82F0480 - .byte 0x04, 0xff - - .align 2 -gUnknown_082F0484:: @ 82F0484 - .byte 0x09, 0xff - - .align 2 -gUnknown_082F0488:: @ 82F0488 - .byte 0x0a, 0xff - - .align 2 -gUnknown_082F048C:: @ 82F048C - .byte 0x0b, 0xff - - .align 2 -gUnknown_082F0490:: @ 82F0490 - .byte 0x15, 0xff - - .align 2 -gUnknown_082F0494:: @ 82F0494 - .byte 0x16, 0xff - - .align 2 -gUnknown_082F0498:: @ 82F0498 - .byte 0x40, 0x41, 0x44, 0x45, 0x48, 0x51, 0x52, 0x53, 0x54, 0xff - - .align 2 -gUnknown_082F04A4:: @ 82F04A4 - .byte 0x0c, 0xff - - .align 2 -gUnknown_082F04A8:: @ 82F04A8 - .byte 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, 0x16, 0x0d, 0xff - - .align 2 -gUnknown_082F04B4:: @ 82F04B4 - .byte 0x0f, 0xff - - .align 2 -gUnknown_082F04B8:: @ 82F04B8 - .byte 0x10, 0xff - - .align 2 -gUnknown_082F04BC:: @ 82F04BC - .byte 0x17, 0xff - - .align 2 -gUnknown_082F04C0:: @ 82F04C0 - .byte 0x18, 0xff - - .align 2 -gUnknown_082F04C4:: @ 82F04C4 - .byte 0x19, 0xff - - .align 2 -gUnknown_082F04C8:: @ 82F04C8 - .byte 0x1a, 0xff - - .align 2 -gUnknown_082F04CC:: @ 82F04CC - .byte 0x1b, 0xff - - .align 2 -gUnknown_082F04D0:: @ 82F04D0 - .byte 0x1c, 0xff - - .align 2 -gUnknown_082F04D4:: @ 82F04D4 - .byte 0x0e, 0xff - - .align 2 -gUnknown_082F04D8:: @ 82F04D8 - .4byte gUnknown_082F0474 - .4byte gUnknown_082F0478 - .4byte gUnknown_082F047C - .4byte gUnknown_082F0480 - .4byte gUnknown_082F0484 - .4byte gUnknown_082F0488 - .4byte gUnknown_082F048C - .4byte gUnknown_082F0490 - .4byte gUnknown_082F0494 - .4byte gUnknown_082F0498 - .4byte gUnknown_082F04A4 - .4byte gUnknown_082F04A8 - .4byte gUnknown_082F04B4 - .4byte gUnknown_082F04B8 - .4byte NULL - .4byte gUnknown_082F04BC - .4byte gUnknown_082F04C0 - .4byte gUnknown_082F04C4 - .4byte gUnknown_082F04C8 - .4byte gUnknown_082F04CC - .4byte gUnknown_082F04D0 - .4byte gUnknown_082F04D4 - - .align 2 -gUnknown_082F0530:: @ 82F0530 - .byte 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15 - .byte 0x16, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x00, 0x17 - .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x0e, 0x00, 0x00 - .align 2 gUnkTextboxBorderPal:: @ 82F0548 .incbin "graphics/interface/unk_textbox_border.gbapal" diff --git a/src/link_rfu.c b/src/link_rfu.c index a557397f0..07fa04dd2 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -310,10 +310,22 @@ const char gUnknown_082ED7EC[] = "PokemonSioInfo"; const char gUnknown_082ED7FC[] = "LINK LOSS DISCONNECT!"; const char gUnknown_082ED814[] = "LINK LOSS RECOVERY NOW"; -extern const char gUnknown_082ED82C[]; -extern const char gUnknown_082ED84B[]; -extern const char gUnknown_082ED85B[]; -extern const char gUnknown_082ED868[]; +ALIGNED(4) const char gUnknown_082ED82C[31] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0x00}; +const char gUnknown_082ED84B[16] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0x00}; +const char gUnknown_082ED85B[9] = {' ',' ',' ',' ',' ',' ',' ',' ',0x00}; +ALIGNED(4) const char gUnknown_082ED864[2] = {' ',0x00}; +const char gUnknown_082ED866[2] = {'*',0x00}; +const char gUnknown_082ED868[8] = "NOWSLOT"; +const char gUnknown_082ED870[12] = " "; +const char gUnknown_082ED87C[12] = "CLOCK DRIFT"; +const char gUnknown_082ED888[12] = "BUSY SEND "; +const char gUnknown_082ED894[12] = "CMD REJECT "; +const char gUnknown_082ED8A0[12] = "CLOCK SLAVE"; +const char gUnknown_082ED8A8[3][8] = { + "CHILD ", + "PARENT", + "SEARCH" +}; // .text diff --git a/src/union_room.c b/src/union_room.c index 4c9cb3886..a4a728a3b 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -1,6 +1,7 @@ #include "global.h" #include "window.h" #include "bg.h" +#include "random.h" #include "string_util.h" #include "task.h" #include "event_data.h" @@ -36,6 +37,7 @@ #include "script_pokemon_util_80F87D8.h" #include "international_string_util.h" #include "field_player_avatar.h" +#include "strings.h" #include "mevent.h" struct UnkStruct_Shared @@ -282,106 +284,1046 @@ void sub_8019BA8(void *); s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3); void sub_801697C(u8 taskId); bool8 sub_8017630(struct UnkStruct_Shared* arg0, const struct UnkStruct_Shared* arg1); +void sub_8013278(u8 windowId, s32 itemId, u8 y); +void sub_8013DF4(u8 windowId, s32 itemId, u8 y); +void sub_8017BE8(u8 windowId, s32 itemId, u8 y); +void nullsub_14(u8 windowId, s32 itemId, u8 y); // const rom data -extern const u8 *const gUnknown_082EDB60[][5]; -extern const u8 gText_UnkCtrlCodeF907[]; -extern const u8 gUnknown_082EDBC4[]; -extern const u8 gText_AwaitingCommunication[]; -extern const u8 gText_AwaitingLink[]; -extern const u8 gUnknown_082EDC5C[]; -extern const u8 gUnknown_082EDC9C[]; -extern const u8 gUnknown_082EDC78[]; -extern const u8 gUnknown_082EDD58[]; -extern const u8 gUnknown_082EDBE8[]; -extern const u8 gUnknown_082EDC0C[]; -extern const u8 gUnknown_082EDC34[]; -extern const u8 gUnknown_082EE560[]; -extern const u8 gUnknown_082EE57C[]; -extern const u8 gUnknown_082EFC54[]; -extern const u8 gUnknown_082EFC3C[]; -extern const u8 gUnknown_082EDE0C[]; -extern const u8 gUnknown_082EDDF4[]; -extern const u8 gUnknown_082EF7DC[]; -extern const u8 gUnknown_082EDE48[]; -extern const u8 gUnknown_082EDE64[]; -extern const u8 gUnknown_082EDF40[]; -extern const u8 gText_PleaseStartOver[]; -extern const u8 gUnknown_082EF7F8[]; -extern const u8 gUnknown_082EFBC8[]; -extern const u8 gUnknown_082EFC90[]; -extern const u8 gUnknown_082EDEC4[]; -extern const u8 gUnknown_082EDF04[]; -extern const u8 gText_WirelessSearchCanceled[]; -extern const u8 gUnknown_082EF4FC[]; -extern const u8 gUnknown_082EF520[]; -extern const u8 gUnknown_082EF5B8[]; -extern const u8 gUnknown_082EF1EC[]; -extern const u8 gUnknown_082EF544[]; -extern const u8 gUnknown_082EF47C[]; -extern const u8 gUnknown_082EE6C8[]; -extern const u8 gUnknown_082EE004[]; -extern const u8 gUnknown_082EEBD0[]; -extern const u8 gUnknown_082EEB88[]; -extern const u8 gUnknown_082EE598[]; -extern const u8 gUnknown_082EEC14[]; -extern const u8 gUnknown_082EF590[]; -extern const u8 gUnknown_082EF20C[]; -extern const u8 gUnknown_082EF564[]; -extern const u8 gUnknown_082EF4C4[]; -extern const u8 gUnknown_082EF298[]; -extern const u8 gUnknown_082EF65C[]; -extern const u8 gUnknown_082EF6E4[]; -extern const u8 gUnknown_082EF718[]; -extern const u8 gUnknown_082EFD94[]; +ALIGNED(4) const u8 gText_EmptyString[] = _(""); +ALIGNED(4) const u8 gText_Colon[] = _(":"); +ALIGNED(4) const u8 gText_UnkCtrlCodeF907[] = _("{ID}"); +ALIGNED(4) const u8 gText_PleaseStartOver[] = _("Please start over from the beginning."); +ALIGNED(4) const u8 gText_WirelessSearchCanceled[] = _("The WIRELESS COMMUNICATION\nSYSTEM search has been canceled."); +ALIGNED(4) const u8 unref_text_union_room_0[] = _("Awaiting communication\nfrom another player."); +ALIGNED(4) const u8 gText_AwaitingCommunication[] = _("{STR_VAR_1}! Awaiting\ncommunication from another player."); +ALIGNED(4) const u8 gText_AwaitingLink[] = _("{STR_VAR_1}! Awaiting link!\nPress START when everyone's ready."); +ALIGNED(4) const u8 gJPText_SingleBattle[] = _("シングルバトルを かいさいする"); +ALIGNED(4) const u8 gJPText_DoubleBattle[] = _("ダブルバトルを かいさいする"); +ALIGNED(4) const u8 gJPText_MultiBattle[] = _("マルチバトルを かいさいする"); +ALIGNED(4) const u8 gJPText_TradePokemon[] = _("ポケモンこうかんを かいさいする"); +ALIGNED(4) const u8 gJPText_Chat[] = _("チャットを かいさいする"); +ALIGNED(4) const u8 gJPText_DistWonderCard[] = _("ふしぎなカードをくばる"); +ALIGNED(4) const u8 gJPText_DistWonderNews[] = _("ふしぎなニュースをくばる"); +ALIGNED(4) const u8 unref_text_union_room_1[] = _("ふしぎなできごとを かいさいする"); +ALIGNED(4) const u8 gJPText_HoldPokemonJump[] = _("なわとびを かいさいする"); +ALIGNED(4) const u8 gJPText_HoldBerryCrush[] = _("きのみマッシャーを かいさいする"); +ALIGNED(4) const u8 gJPText_HoldBerryPicking[] = _("きのみどりを かいさいする"); +ALIGNED(4) const u8 gJPText_HoldSpinTrade[] = _("ぐるぐるこうかんを かいさいする"); +ALIGNED(4) const u8 gJPText_HoldSpinShop[] = _("ぐるぐるショップを かいさいする"); -extern const u32 gUnknown_082F00C4[]; +const u8 *const unref_text_ptrs_union_room_0[] = { + gJPText_SingleBattle, + gJPText_DoubleBattle, + gJPText_MultiBattle, + gJPText_TradePokemon, + gJPText_Chat, + gJPText_DistWonderCard, + gJPText_DistWonderNews, + gJPText_DistWonderCard, + gJPText_HoldPokemonJump, + gJPText_HoldBerryCrush, + gJPText_HoldBerryPicking, + gJPText_HoldBerryPicking, + gJPText_HoldSpinTrade, + gJPText_HoldSpinShop +}; -extern const u8 gUnknown_082F0530[]; +const u8 gText_1PlayerNeeded[] = _("1 player\nneeded."); +const u8 gText_2PlayersNeeded[] = _("2 players\nneeded."); +const u8 gText_3PlayersNeeded[] = _("3 players\nneeded."); +const u8 gText_4PlayersNeeded[] = _("4 players\nneeded."); +const u8 gText_2PlayerMode[] = _("2-PLAYER\nMODE"); +const u8 gText_3PlayerMode[] = _("3-PLAYER\nMODE"); +const u8 gText_4PlayerMode[] = _("4-PLAYER\nMODE"); +const u8 gText_5PlayerMode[] = _("5-PLAYER\nMODE"); -extern const struct WindowTemplate gUnknown_082F00BC; -extern const struct WindowTemplate gUnknown_082F0124; -extern const struct WindowTemplate gUnknown_082F012C; -extern const struct WindowTemplate gUnknown_082F011C; -extern const struct WindowTemplate gUnknown_082F0174; -extern const struct WindowTemplate gUnknown_082F017C; -extern const struct WindowTemplate gUnknown_082F021C; -extern const struct WindowTemplate gUnknown_082F025C; -extern const struct WindowTemplate gUnknown_082F0294; -extern const struct WindowTemplate gUnknown_082F0344; -extern const struct WindowTemplate gUnknown_082F034C; +const u8 *const gUnknown_082EDB60[][5] = { + { + gText_1PlayerNeeded, + gText_2PlayerMode, + NULL, + NULL, + NULL + }, { + gText_3PlayersNeeded, + gText_2PlayersNeeded, + gText_1PlayerNeeded, + gText_4PlayerMode, + NULL + }, { + gText_1PlayerNeeded, + gText_2PlayerMode, + gText_3PlayerMode, + gText_4PlayerMode, + gText_5PlayerMode + }, { + gText_2PlayersNeeded, + gText_1PlayerNeeded, + gText_3PlayerMode, + gText_4PlayerMode, + gText_5PlayerMode + }, { + gText_1PlayerNeeded, + gText_2PlayerMode, + gText_3PlayerMode, + gText_4PlayerMode, + NULL + } +}; -extern const struct ListMenuTemplate gUnknown_082F015C; -extern const struct ListMenuTemplate gUnknown_082F0204; -extern const struct ListMenuTemplate gUnknown_082F0244; -extern const struct ListMenuTemplate gUnknown_082F027C; -extern const struct ListMenuTemplate gUnknown_082F032C; -extern const struct ListMenuTemplate gUnknown_082F03A4; +ALIGNED(4) const u8 gUnknown_082EDBC4[] = _("{B_BUTTON}CANCEL"); +ALIGNED(4) const u8 unref_text_union_room_2[] = _("ため\nさんかしゃ ぼしゅうちゅう です!"); +ALIGNED(4) const u8 gUnknown_082EDBE8[] = _("{STR_VAR_2} contacted you for\n{STR_VAR_1}. Accept?"); +ALIGNED(4) const u8 gUnknown_082EDC0C[] = _("{STR_VAR_2} contacted you.\nWill you share {STR_VAR_1}?"); +ALIGNED(4) const u8 gUnknown_082EDC34[] = _("{STR_VAR_2} contacted you.\nAdd to the members?"); +ALIGNED(4) const u8 gUnknown_082EDC5C[] = _("{STR_VAR_1}!\nAre these members OK?"); +ALIGNED(4) const u8 gUnknown_082EDC78[] = _("Cancel {STR_VAR_1} MODE\nwith these members?"); +ALIGNED(4) const u8 gUnknown_082EDC9C[] = _("An “OK” was sent\nto {STR_VAR_1}."); +ALIGNED(4) const u8 gUnknown_082EDCB4[] = _("The other TRAINER doesn't appear\nto be available now…\p"); +ALIGNED(4) const u8 gUnknown_082EDCEC[] = _("You can't transmit with a TRAINER\nwho is too far away.\p"); +ALIGNED(4) const u8 gUnknown_082EDD24[] = _("The other TRAINER(S) is/are not\nready yet.\p"); -extern const u8 *const gUnknown_082F0048[]; -extern const u8 *const gUnknown_082EDDC4[]; -extern const u8 *const gUnknown_082EFB70[]; -extern const u8 *const gUnknown_082EDD50[]; -extern const u8 *const gUnknown_082EDE9C[]; -extern const u8 *const gUnknown_082EDF80[]; -extern const u8 *const gUnknown_082EFD58[]; -extern const u8 *const gUnknown_082EEB80[]; -extern const u8 *const gUnknown_082EE378[]; -extern const u8 *const gUnknown_082EEC9C[]; -extern const u8 *const gUnknown_082EED3C[]; -extern const u8 *const gUnknown_082EE324[]; -extern const u8 *const gUnknown_082EE17C[]; +const u8 *const gUnknown_082EDD50[] = { + gUnknown_082EDCEC, + gUnknown_082EDD24 +}; -extern const u8 *const gUnknown_082EE82C[][4]; +ALIGNED(4) const u8 gUnknown_082EDD58[] = _("The {STR_VAR_1} MODE with\nthese members will be canceled.{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EDD8C[] = _("There is a member who can no\nlonger remain available.\p"); -extern const u8 *const gUnknown_082EE24C[][2]; +const u8 *const gUnknown_082EDDC4[] = { + gUnknown_082EDCB4, + gUnknown_082EDD8C +}; -extern const struct UnkStruct_Shared gUnknown_082F045C; +ALIGNED(4) const u8 gUnknown_082EDDCC[] = _("The other TRAINER appears\nunavailable…\p"); +ALIGNED(4) const u8 gUnknown_082EDDF4[] = _("{STR_VAR_1} sent back an “OK”!"); +ALIGNED(4) const u8 gUnknown_082EDE0C[] = _("{STR_VAR_1} OK'd your registration as\na member."); +ALIGNED(4) const u8 gUnknown_082EDE34[] = _("{STR_VAR_1} replied, “No…”\p"); +ALIGNED(4) const u8 gUnknown_082EDE48[] = _("{STR_VAR_1}!\nAwaiting other members!"); +ALIGNED(4) const u8 gUnknown_082EDE64[] = _("Quit being a member?"); +ALIGNED(4) const u8 gUnknown_082EDE7C[] = _("You stopped being a member.\p"); -extern const u8 *const gUnknown_082F04D8[22]; +const u8 *const gUnknown_082EDE9C[] = { + NULL, + gUnknown_082EDD8C, + gUnknown_082EDDCC, + NULL, + NULL, + NULL, + gUnknown_082EDE34, + NULL, + NULL, + gUnknown_082EDE7C +}; -extern const u8 gText_Colon[]; +ALIGNED(4) const u8 gUnknown_082EDEC4[] = _("The WIRELESS COMMUNICATION\nSYSTEM link has been established."); +ALIGNED(4) const u8 gUnknown_082EDF04[] = _("The WIRELESS COMMUNICATION\nSYSTEM link has been dropped…"); +ALIGNED(4) const u8 gUnknown_082EDF40[] = _("The link with your friend has been\ndropped…"); +ALIGNED(4) const u8 gUnknown_082EDF6C[] = _("{STR_VAR_1} replied, “No…”"); + +const u8 *const gUnknown_082EDF80[] = { + NULL, + gUnknown_082EDF40, + gUnknown_082EDF40, + NULL, + NULL, + NULL, + gUnknown_082EDF6C, + NULL, + NULL, + NULL +}; + +ALIGNED(4) const u8 gUnknown_082EDFA8[] = _("Do you want the {STR_VAR_2}\nMODE?"); +ALIGNED(4) const u8 gUnknown_082EDFC4[] = _("Do you want the {STR_VAR_2}\nMODE?"); + +const u8 *const unref_text_ptrs_union_room_1[] = { + gUnknown_082EDFA8, + gUnknown_082EDFC4 +}; + +ALIGNED(4) const u8 unref_text_union_room_3[] = _("Communicating…\nPlease wait."); +ALIGNED(4) const u8 gUnknown_082EE004[] = _("Awaiting {STR_VAR_1}'s response about\nthe trade…"); +ALIGNED(4) const u8 gUnknown_082EE02C[] = _("Communicating{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}."); +ALIGNED(4) const u8 gUnknown_082EE098[] = _("Communicating with {STR_VAR_1}{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}."); +ALIGNED(4) const u8 gUnknown_082EE104[] = _("Please wait a while{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}."); + +const u8 *const gUnknown_082EE17C[] = { + gUnknown_082EE02C, + gUnknown_082EE098, + gUnknown_082EE104 +}; + +ALIGNED(4) const u8 gUnknown_082EE188[] = _("Hiya! Is there something that you\nwanted to do?"); +ALIGNED(4) const u8 gUnknown_082EE1B8[] = _("Hello!\nWould you like to do something?"); +ALIGNED(4) const u8 gUnknown_082EE1E0[] = _("{STR_VAR_1}: Hiya, we meet again!\nWhat are you up for this time?"); +ALIGNED(4) const u8 gUnknown_082EE218[] = _("{STR_VAR_1}: Oh! {PLAYER}, hello!\nWould you like to do something?"); + +const u8 *const gUnknown_082EE24C[][2] = { + { + gUnknown_082EE188, + gUnknown_082EE1B8 + }, { + gUnknown_082EE1E0, + gUnknown_082EE218 + } +}; + +ALIGNED(4) const u8 gUnknown_082EE25C[] = _("Want to do something?"); +ALIGNED(4) const u8 gUnknown_082EE274[] = _("Would you like to do something?"); +ALIGNED(4) const u8 gUnknown_082EE294[] = _("{STR_VAR_1}: What would you like to\ndo now?"); +ALIGNED(4) const u8 unref_text_union_room_4[] = _("{STR_VAR_1}: Want to do anything else?"); + +const u8 *const unref_text_ptrs_union_room_2[][2] = { + { + gUnknown_082EE25C, + gUnknown_082EE274 + }, { + gUnknown_082EE294, + gUnknown_082EE294 + } +}; + +ALIGNED(4) const u8 gUnknown_082EE2E8[] = _("Somebody has contacted you.{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE308[] = _("{STR_VAR_1} has contacted you.{PAUSE 60}"); + +const u8 *const gUnknown_082EE324[] = { + gUnknown_082EE2E8, + gUnknown_082EE308 +}; + +ALIGNED(4) const u8 gUnknown_082EE32C[] = _("Awaiting a response from\nthe other TRAINER…"); +ALIGNED(4) const u8 gUnknown_082EE358[] = _("Awaiting a response from\n{STR_VAR_1}…"); + +const u8 *const gUnknown_082EE378[] = { + gUnknown_082EE32C, + gUnknown_082EE358 +}; + +ALIGNED(4) const u8 gUnknown_082EE380[] = _("The other TRAINER showed\nyou their TRAINER CARD.\pWould you like to show your\nTRAINER CARD?"); +ALIGNED(4) const u8 gUnknown_082EE3DC[] = _("The other TRAINER challenges you\nto battle.\pWill you accept the battle\nchallenge?"); +ALIGNED(4) const u8 gUnknown_082EE430[] = _("The other TRAINER invites you\nto chat.\pWill you accept the chat\ninvitation?"); +ALIGNED(4) const u8 gUnknown_082EE47C[] = _("There is an offer to trade your\nregistered Lv. {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}\pin exchange for a\nLv. {SPECIAL_F7 0x02} {SPECIAL_F7 0x03}.\pWill you accept this trade\noffer?"); +ALIGNED(4) const u8 gUnknown_082EE4F0[] = _("There is an offer to trade your\nregistered EGG.\lWill you accept this trade offer?"); +ALIGNED(4) const u8 gUnknown_082EE544[] = _("The chat has been dropped.\p"); +ALIGNED(4) const u8 gUnknown_082EE560[] = _("You declined the offer.\p"); +ALIGNED(4) const u8 gUnknown_082EE57C[] = _("You declined the offer.\p"); +ALIGNED(4) const u8 gUnknown_082EE598[] = _("The chat was ended.\p"); + +const u8 *const unref_text_ptrs_union_room_3[] = { + gUnknown_082EE380, + gUnknown_082EE3DC, + gUnknown_082EE430, + gUnknown_082EE47C +}; + +ALIGNED(4) const u8 gUnknown_082EE5C0[] = _("Oh, hey! We're in a chat right now.\nWant to join us?"); +ALIGNED(4) const u8 gUnknown_082EE5F8[] = _("{STR_VAR_1}: Hey, {PLAYER}!\nWe're having a chat right now.\lWant to join us?"); +ALIGNED(4) const u8 gUnknown_082EE638[] = _("Oh, hi! We're having a chat now.\nWould you like to join us?"); +ALIGNED(4) const u8 gUnknown_082EE674[] = _("{STR_VAR_1}: Oh, hi, {PLAYER}!\nWe're having a chat now.\lWould you like to join us?"); + +const u8 *const gUnknown_082EE6B8[][2] = { + { + gUnknown_082EE5C0, + gUnknown_082EE638 + }, { + gUnknown_082EE5F8, + gUnknown_082EE674 + } +}; + +ALIGNED(4) const u8 gUnknown_082EE6C8[] = _("……\nThe TRAINER appears to be busy…\p"); +ALIGNED(4) const u8 gUnknown_082EE6EC[] = _("A battle, huh?\nAll right, just give me some time."); +ALIGNED(4) const u8 gUnknown_082EE720[] = _("You want to chat, huh?\nSure, just wait a little."); +ALIGNED(4) const u8 gUnknown_082EE754[] = _("Sure thing! As my “Greetings,”\nhere's my TRAINER CARD."); +ALIGNED(4) const u8 gUnknown_082EE78C[] = _("A battle? Of course, but I need\ntime to get ready."); +ALIGNED(4) const u8 gUnknown_082EE7C0[] = _("Did you want to chat?\nOkay, but please wait a moment."); +ALIGNED(4) const u8 gUnknown_082EE7F8[] = _("As my introduction, I'll show you\nmy TRAINER CARD."); + +const u8 *const gUnknown_082EE82C[][4] = { + { + gUnknown_082EE6EC, + gUnknown_082EE720, + NULL, + gUnknown_082EE754 + }, { + gUnknown_082EE78C, + gUnknown_082EE7C0, + NULL, + gUnknown_082EE7F8 + } +}; + +ALIGNED(4) const u8 unref_text_union_room_5[] = _("You want to chat, huh?\nSure, just wait a little."); +ALIGNED(4) const u8 gUnknown_082EE880[] = _("Thanks for waiting!\nLet's get our battle started!{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE8B8[] = _("All right!\nLet's chat!{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE8D4[] = _("Sorry I made you wait!\nLet's get started!{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE904[] = _("Sorry I made you wait!\nLet's chat.{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE92C[] = _("The trade will be started.{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE94C[] = _("The battle will be started.{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EE96C[] = _("Entering the chat…{PAUSE 60}"); + +const u8 *const gUnknown_082EE984[][3] = { + { + gUnknown_082EE94C, + gUnknown_082EE96C, + gUnknown_082EE92C + }, { + gUnknown_082EE94C, + gUnknown_082EE96C, + gUnknown_082EE92C + }, { + gUnknown_082EE880, + gUnknown_082EE8B8, + gUnknown_082EE92C + }, { + gUnknown_082EE8D4, + gUnknown_082EE904, + gUnknown_082EE92C + } +}; + +ALIGNED(4) const u8 gUnknown_082EE9B4[] = _("Sorry! My POKéMON don't seem to\nbe feeling too well right now.\lLet me battle you another time.\p"); +ALIGNED(4) const u8 gUnknown_082EEA14[] = _("I'm terribly sorry, but my POKéMON\naren't feeling well…\pLet's battle another time.\p"); + +const u8 *const gUnknown_082EEA68[] = { + gUnknown_082EE9B4, + gUnknown_082EEA14 +}; + +ALIGNED(4) const u8 gUnknown_082EEA70[] = _("Huh? My TRAINER CARD…\nWhere'd it go now?\lSorry! I'll show you another time!\p"); +ALIGNED(4) const u8 gUnknown_082EEAC0[] = _("Oh? Now where did I put my\nTRAINER CARD?…\lSorry! I'll show you later!\p"); + +const u8 *const gUnknown_082EEB08[] = { + gUnknown_082EEA70, + gUnknown_082EEAC0 +}; + +ALIGNED(4) const u8 gUnknown_082EEB10[] = _("If you want to do something with\nme, just give me a shout!\p"); +ALIGNED(4) const u8 gUnknown_082EEB4C[] = _("If you want to do something with\nme, don't be shy.\p"); + +const u8 *const gUnknown_082EEB80[] = { + gUnknown_082EEB10, + gUnknown_082EEB4C +}; + +ALIGNED(4) const u8 gUnknown_082EEB88[] = _("Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p"); +ALIGNED(4) const u8 gUnknown_082EEBD0[] = _("If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p"); +ALIGNED(4) const u8 gUnknown_082EEC14[] = _("For a battle, you need two\nPOKéMON that are below Lv. 30.\p"); +ALIGNED(4) const u8 gUnknown_082EEC50[] = _("Oh, all right.\nCome see me anytime, okay?\p"); +ALIGNED(4) const u8 gUnknown_082EEC7C[] = _("Oh…\nPlease come by anytime.\p"); + +const u8 *const gUnknown_082EEC9C[] = { + gUnknown_082EEC50, + gUnknown_082EEC7C +}; + +ALIGNED(4) const u8 gUnknown_082EECA4[] = _("Oh, sorry!\nI just can't right this instant.\lLet's chat another time.\p"); +ALIGNED(4) const u8 gUnknown_082EECEC[] = _("Oh, I'm sorry.\nI have too much to do right now.\lLet's chat some other time.\p"); + +const u8 *const gUnknown_082EED3C[] = { + gUnknown_082EECA4, + gUnknown_082EECEC +}; + +ALIGNED(4) const u8 gUnknown_082EED44[] = _("Whoa!\nI can tell you're pretty tough!\p"); +ALIGNED(4) const u8 gUnknown_082EED6C[] = _("You used that move?\nThat's good strategy!\p"); +ALIGNED(4) const u8 gUnknown_082EED98[] = _("Way to go!\nThat was an eye-opener!\p"); +ALIGNED(4) const u8 gUnknown_082EEDBC[] = _("Oh! How could you use that\nPOKéMON in that situation?\p"); +ALIGNED(4) const u8 gUnknown_082EEDF4[] = _("That POKéMON…\nIt's been raised really well!\p"); +ALIGNED(4) const u8 gUnknown_082EEE24[] = _("That's it!\nThis is the right move now!\p"); +ALIGNED(4) const u8 gUnknown_082EEE4C[] = _("That's awesome!\nYou can battle that way?\p"); +ALIGNED(4) const u8 gUnknown_082EEE78[] = _("You have exquisite timing for\nswitching POKéMON!\p"); + +const u8 *const gUnknown_082EEEAC[][4] = { + { + gUnknown_082EED44, + gUnknown_082EED6C, + gUnknown_082EED98, + gUnknown_082EEDBC + }, { + gUnknown_082EEDF4, + gUnknown_082EEE24, + gUnknown_082EEE4C, + gUnknown_082EEE78 + } +}; + +ALIGNED(4) const u8 gUnknown_082EEECC[] = _("Oh, I see!\nThis is educational!\p"); +ALIGNED(4) const u8 gUnknown_082EEEF0[] = _("Don't say anything funny anymore!\nI'm sore from laughing!\p"); +ALIGNED(4) const u8 gUnknown_082EEF2C[] = _("Oh?\nSomething like that happened.\p"); +ALIGNED(4) const u8 gUnknown_082EEF50[] = _("Hmhm… What?\nSo is this what you're saying?\p"); +ALIGNED(4) const u8 gUnknown_082EEF7C[] = _("Is that right?\nI didn't know that.\p"); +ALIGNED(4) const u8 gUnknown_082EEFA0[] = _("Ahaha!\nWhat is that about?\p"); +ALIGNED(4) const u8 gUnknown_082EEFBC[] = _("Yes, that's exactly it!\nThat's what I meant.\p"); +ALIGNED(4) const u8 gUnknown_082EEFEC[] = _("In other words…\nYes! That's right!\p"); + +const u8 *const gUnknown_082EF010[][4] = { + { + gUnknown_082EEECC, + gUnknown_082EEEF0, + gUnknown_082EEF2C, + gUnknown_082EEF50 + }, { + gUnknown_082EEF7C, + gUnknown_082EEFA0, + gUnknown_082EEFBC, + gUnknown_082EEFEC + } +}; + +ALIGNED(4) const u8 gUnknown_082EF030[] = _("I'm just showing my TRAINER CARD\nas my way of greeting.\p"); +ALIGNED(4) const u8 gUnknown_082EF06C[] = _("I hope I get to know you better!\p"); +ALIGNED(4) const u8 gUnknown_082EF090[] = _("We're showing each other our\nTRAINER CARDS to get acquainted.\p"); +ALIGNED(4) const u8 gUnknown_082EF0D0[] = _("Glad to meet you.\nPlease don't be a stranger!\p"); + +const u8 *const gUnknown_082EF100[][2] = { + { + gUnknown_082EF030, + gUnknown_082EF06C + }, { + gUnknown_082EF090, + gUnknown_082EF0D0 + } +}; + +ALIGNED(4) const u8 gUnknown_082EF110[] = _("Yeahah!\nI really wanted this POKéMON!\p"); +ALIGNED(4) const u8 gUnknown_082EF138[] = _("Finally, a trade got me that\nPOKéMON I'd wanted a long time.\p"); +ALIGNED(4) const u8 gUnknown_082EF178[] = _("I'm trading POKéMON right now.\p"); +ALIGNED(4) const u8 gUnknown_082EF198[] = _("I finally got that POKéMON I\nwanted in a trade!\p"); + +const u8 *const gUnknown_082EF1CC[][4] = { + { + gUnknown_082EF110, + gUnknown_082EF138, + NULL, + NULL + }, { + gUnknown_082EF178, + gUnknown_082EF198, + NULL, + NULL + } +}; + +ALIGNED(4) const u8 gUnknown_082EF1EC[] = _("{STR_VAR_1} checked the\nTRADING BOARD.\p"); +ALIGNED(4) const u8 gUnknown_082EF20C[] = _("Welcome to the TRADING BOARD.\pYou may register your POKéMON\nand offer it up for a trade.\pWould you like to register one of\nyour POKéMON?"); +ALIGNED(4) const u8 gUnknown_082EF298[] = _("This TRADING BOARD is used for\noffering a POKéMON for a trade.\pAll you need to do is register a\nPOKéMON for a trade.\pAnother TRAINER may offer a party\nPOKéMON in return for the trade.\pWe hope you will register POKéMON\nand trade them with many, many\lother TRAINERS.\pWould you like to register one of\nyour POKéMON?"); +ALIGNED(4) const u8 unref_text_union_room_6[] = _("We have registered your POKéMON for\ntrade on the TRADING BOARD.\pThank you for using this service!\p"); +ALIGNED(4) const u8 unref_text_union_room_7[] = _("Nobody has registered any POKéMON\nfor trade on the TRADING BOARD.\p\n"); +ALIGNED(4) const u8 gUnknown_082EF47C[] = _("Please choose the type of POKéMON\nthat you would like in the trade.\n"); +ALIGNED(4) const u8 gUnknown_082EF4C4[] = _("Which of your party POKéMON will\nyou offer in trade?\p"); +ALIGNED(4) const u8 gUnknown_082EF4FC[] = _("Registration has been canceled.\p"); +ALIGNED(4) const u8 gUnknown_082EF520[] = _("Registration has been completed.\p"); +ALIGNED(4) const u8 gUnknown_082EF544[] = _("The trade has been canceled.\p"); +ALIGNED(4) const u8 gUnknown_082EF564[] = _("Cancel the registration of your\nLv. {STR_VAR_2} {STR_VAR_1}?"); +ALIGNED(4) const u8 gUnknown_082EF590[] = _("Cancel the registration of your\nEGG?"); +ALIGNED(4) const u8 gUnknown_082EF5B8[] = _("The registration has been canceled.\p"); +ALIGNED(4) const u8 unref_text_union_room_8[] = _("TRAINERS wishing to make a trade\nwill be listed."); +ALIGNED(4) const u8 unref_text_union_room_9[] = _("Please choose the TRAINER with whom\nyou would like to trade POKéMON."); +ALIGNED(4) const u8 gUnknown_082EF65C[] = _("Would you like to ask {STR_VAR_1} to\nmake a trade?"); +ALIGNED(4) const u8 unref_text_union_room_10[] = _("Awaiting a response from\nthe other TRAINER…"); +ALIGNED(4) const u8 unref_text_union_room_11[] = _("You have not registered a POKéMON\nfor trading.\p"); +ALIGNED(4) const u8 gUnknown_082EF6E4[] = _("You don't have a {STR_VAR_2}-type\nPOKéMON that {STR_VAR_1} wants.\p"); +ALIGNED(4) const u8 gUnknown_082EF718[] = _("You don't have an EGG that\n{STR_VAR_1} wants.\p"); +ALIGNED(4) const u8 gUnknown_082EF740[] = _("{STR_VAR_1} can't make a trade for\nyour POKéMON right now.\p"); +ALIGNED(4) const u8 gUnknown_082EF774[] = _("You can't make a trade for\n{STR_VAR_1}'s POKéMON right now.\p"); + +const u8 *const unref_text_ptrs_union_room_4[] = { + gUnknown_082EF740, + gUnknown_082EF774 +}; + +ALIGNED(4) const u8 gUnknown_082EF7B0[] = _("Your trade offer was rejected.\p"); +ALIGNED(4) const u8 gUnknown_082EF7D0[] = _("EGG TRADE"); +ALIGNED(4) const u8 gUnknown_082EF7DC[] = _("{DPAD_UPDOWN}CHOOSE {A_BUTTON}JOIN {B_BUTTON}CANCEL"); +ALIGNED(4) const u8 gUnknown_082EF7F8[] = _("Please choose a TRAINER."); +ALIGNED(4) const u8 gUnknown_082EF814[] = _("Please choose a TRAINER for\na SINGLE BATTLE."); +ALIGNED(4) const u8 gUnknown_082EF844[] = _("Please choose a TRAINER for\na DOUBLE BATTLE."); +ALIGNED(4) const u8 gUnknown_082EF874[] = _("Please choose the LEADER\nfor a MULTI BATTLE."); +ALIGNED(4) const u8 gUnknown_082EF8A4[] = _("Please choose the TRAINER to\ntrade with."); +ALIGNED(4) const u8 gUnknown_082EF8D0[] = _("Please choose the TRAINER who is\nsharing WONDER CARDS."); +ALIGNED(4) const u8 gUnknown_082EF908[] = _("Please choose the TRAINER who is\nsharing WONDER NEWS."); +ALIGNED(4) const u8 gUnknown_082EF940[] = _("Jump with mini POKéMON!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EF974[] = _("BERRY CRUSH!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EF99C[] = _("DODRIO BERRY-PICKING!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EF9CC[] = _("BERRY BLENDER!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EF9F8[] = _("RECORD CORNER!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFA24[] = _("COOLNESS CONTEST!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFA50[] = _("BEAUTY CONTEST!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFA7C[] = _("CUTENESS CONTEST!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFAA8[] = _("SMARTNESS CONTEST!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFAD8[] = _("TOUGHNESS CONTEST!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFB08[] = _("BATTLE TOWER LEVEL 50!\nPlease choose the LEADER."); +ALIGNED(4) const u8 gUnknown_082EFB3C[] = _("BATTLE TOWER OPEN LEVEL!\nPlease choose the LEADER."); + +const u8 *const gUnknown_082EFB70[] = { + gUnknown_082EF814, + gUnknown_082EF844, + gUnknown_082EF874, + gUnknown_082EF8A4, + gUnknown_082EF940, + gUnknown_082EF974, + gUnknown_082EF99C, + gUnknown_082EF8D0, + gUnknown_082EF908, + NULL, + NULL, + NULL, + gUnknown_082EF9F8, + gUnknown_082EF9CC, + NULL, + gUnknown_082EFA24, + gUnknown_082EFA50, + gUnknown_082EFA7C, + gUnknown_082EFAA8, + gUnknown_082EFAD8, + gUnknown_082EFB08, + gUnknown_082EFB3C +}; + +ALIGNED(4) const u8 gUnknown_082EFBC8[] = _("Searching for a WIRELESS\nCOMMUNICATION SYSTEM. Wait..."); +ALIGNED(4) const u8 unref_text_union_room_12[] = _("For a DOUBLE BATTLE, you must have\nat least two POKéMON.\p"); +ALIGNED(4) const u8 gUnknown_082EFC3C[] = _("Awaiting {STR_VAR_1}'s response…"); +ALIGNED(4) const u8 gUnknown_082EFC54[] = _("{STR_VAR_1} has been asked to register\nyou as a member. Please wait."); +ALIGNED(4) const u8 gUnknown_082EFC90[] = _("Awaiting a response from the\nWIRELESS COMMUNICATION SYSTEM."); +ALIGNED(4) const u8 unref_text_union_room_13[] = _("Please wait for other TRAINERS to\ngather and get ready."); +ALIGNED(4) const u8 gUnknown_082EFD04[] = _("No CARDS appear to be shared \nright now."); +ALIGNED(4) const u8 gUnknown_082EFD30[] = _("No NEWS appears to be shared\nright now."); + +const u8 *const gUnknown_082EFD58[] = { + gUnknown_082EFD04, + gUnknown_082EFD30 +}; + +ALIGNED(4) const u8 gUnknown_082EFD60[] = _("BATTLE"); +ALIGNED(4) const u8 gUnknown_082EFD68[] = _("CHAT"); +ALIGNED(4) const u8 gUnknown_082EFD70[] = _("GREETINGS"); +ALIGNED(4) const u8 gUnknown_082EFD7C[] = _("EXIT"); +ALIGNED(4) const u8 gUnknown_082EFD84[] = _("EXIT"); +ALIGNED(4) const u8 gUnknown_082EFD8C[] = _("INFO"); +ALIGNED(4) const u8 gUnknown_082EFD94[] = _("NAME{CLEAR_TO 0x3C}WANTED{CLEAR_TO 0x6E}OFFER{CLEAR_TO 0xC6}LV."); +ALIGNED(4) const u8 gUnknown_082EFDB0[] = _("SINGLE BATTLE"); +ALIGNED(4) const u8 gUnknown_082EFDC0[] = _("DOUBLE BATTLE"); +ALIGNED(4) const u8 gUnknown_082EFDD0[] = _("MULTI BATTLE"); +ALIGNED(4) const u8 gUnknown_082EFDE0[] = _("POKéMON TRADES"); +ALIGNED(4) const u8 gUnknown_082EFDF0[] = _("CHAT"); +ALIGNED(4) const u8 gUnknown_082EFDF8[] = _("CARDS"); +ALIGNED(4) const u8 gUnknown_082EFE00[] = _("WONDER CARDS"); +ALIGNED(4) const u8 gUnknown_082EFE10[] = _("WONDER NEWS"); +ALIGNED(4) const u8 gUnknown_082EFE1C[] = _("POKéMON JUMP"); +ALIGNED(4) const u8 gUnknown_082EFE2C[] = _("BERRY CRUSH"); +ALIGNED(4) const u8 gUnknown_082EFE38[] = _("BERRY-PICKING"); +ALIGNED(4) const u8 gUnknown_082EFE48[] = _("SEARCH"); +ALIGNED(4) const u8 gUnknown_082EFE50[] = _("BERRY BLENDER"); +ALIGNED(4) const u8 gUnknown_082EFE60[] = _("RECORD CORNER"); +ALIGNED(4) const u8 gUnknown_082EFE70[] = _("COOL CONTEST"); +ALIGNED(4) const u8 gUnknown_082EFE80[] = _("BEAUTY CONTEST"); +ALIGNED(4) const u8 gUnknown_082EFE90[] = _("CUTE CONTEST"); +ALIGNED(4) const u8 gUnknown_082EFEA0[] = _("SMART CONTEST"); +ALIGNED(4) const u8 gUnknown_082EFEB0[] = _("TOUGH CONTEST"); +ALIGNED(4) const u8 gUnknown_082EFEC0[] = _("BATTLE TOWER LV. 50"); +ALIGNED(4) const u8 gUnknown_082EFED4[] = _("BATTLE TOWER OPEN LEVEL"); +ALIGNED(4) const u8 gUnknown_082EFEEC[] = _("It's a NORMAL CARD."); +ALIGNED(4) const u8 gUnknown_082EFF00[] = _("It's a BRONZE CARD!"); +ALIGNED(4) const u8 gUnknown_082EFF14[] = _("It's a COPPER CARD!"); +ALIGNED(4) const u8 gUnknown_082EFF28[] = _("It's a SILVER CARD!"); +ALIGNED(4) const u8 gUnknown_082EFF3C[] = _("It's a GOLD CARD!"); + +const u8 *const gUnknown_082EFF50[] = { + gUnknown_082EFEEC, + gUnknown_082EFF00, + gUnknown_082EFF14, + gUnknown_082EFF28, + gUnknown_082EFF3C +}; + +ALIGNED(4) const u8 gUnknown_082EFF64[] = _("This is {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}'s\nTRAINER CARD…\l{SPECIAL_F7 0x02}\pPOKéDEX: {SPECIAL_F7 0x03}\nTIME: {SPECIAL_F7 0x04}:{SPECIAL_F7 0x05}\p"); +ALIGNED(4) const u8 gUnknown_082EFFA4[] = _("BATTLES: WINS: {SPECIAL_F7 0x00} LOSSES: {SPECIAL_F7 0x02}\nTRADES: {SPECIAL_F7 0x03}\p“{SPECIAL_F7 0x04} {SPECIAL_F7 0x05}\n{SPECIAL_F7 0x06} {SPECIAL_F7 0x07}”\p"); +ALIGNED(4) const u8 gUnknown_082EFFDC[] = _("{SPECIAL_F7 0x01}: Glad to have met you!{PAUSE 60}"); +ALIGNED(4) const u8 gUnknown_082EFFFC[] = _("{SPECIAL_F7 0x01}: Glad to meet you!{PAUSE 60}"); + +const u8 *const gUnknown_082F0018[] = { + gUnknown_082EFFDC, + gUnknown_082EFFFC +}; + +ALIGNED(4) const u8 gUnknown_082F0020[] = _("Finished checking {SPECIAL_F7 0x01}'s\nTRAINER CARD.{PAUSE 60}"); + +const u8 *const gUnknown_082F0048[] = { + gText_EmptyString, + gUnknown_082EFDB0, + gUnknown_082EFDC0, + gUnknown_082EFDD0, + gUnknown_082EFDE0, + gUnknown_082EFDF0, + gUnknown_082EFE00, + gUnknown_082EFE10, + gUnknown_082EFDF8, + gUnknown_082EFE1C, + gUnknown_082EFE2C, + gUnknown_082EFE38, + gUnknown_082EFE48, + gText_EmptyString, + gUnknown_082EFED4, + gUnknown_082EFE60, + gUnknown_082EFE50, + gText_EmptyString, + gText_EmptyString, + gText_EmptyString, + gText_EmptyString, + gUnknown_082EFE00, + gUnknown_082EFE10, + gUnknown_082EFE70, + gUnknown_082EFE80, + gUnknown_082EFE90, + gUnknown_082EFEA0, + gUnknown_082EFEB0, + gUnknown_082EFEC0 +}; + +const struct WindowTemplate gUnknown_082F00BC = { + .bg = 0x00, + .tilemapLeft = 0x00, + .tilemapTop = 0x00, + .width = 0x1E, + .height = 0x02, + .paletteNum = 0x0F, + .baseBlock = 0x0008 +}; + +const u32 gUnknown_082F00C4[] = { + 0x0201, + 0x0202, + 0x0403, + 0x0204, + 0x2509, + 0x250a, + 0x350b, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x240f, + 0x2410, + 0x0000, + 0x2417, + 0x2418, + 0x2419, + 0x241a, + 0x241b, + 0x021c, + 0x020e +}; + +const struct WindowTemplate gUnknown_082F011C = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x03, + .width = 0x0d, + .height = 0x08, + .paletteNum = 0x0f, + .baseBlock = 0x0044 +}; + +const struct WindowTemplate gUnknown_082F0124 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x03, + .width = 0x0d, + .height = 0x0a, + .paletteNum = 0x0f, + .baseBlock = 0x0044 +}; + +const struct WindowTemplate gUnknown_082F012C = { + .bg = 0x00, + .tilemapLeft = 0x10, + .tilemapTop = 0x03, + .width = 0x07, + .height = 0x04, + .paletteNum = 0x0f, + .baseBlock = 0x00c6 +}; + +const struct ListMenuItem gUnknown_082F0134[] = { + { gText_EmptyString, 0 }, + { gText_EmptyString, 1 }, + { gText_EmptyString, 2 }, + { gText_EmptyString, 3 }, + { gText_EmptyString, 4 } +}; + +const struct ListMenuTemplate gUnknown_082F015C = { + .items = gUnknown_082F0134, + .moveCursorFunc = NULL, + .itemPrintFunc = sub_8013278, + .totalItems = 5, + .maxShowed = 5, + .windowId = 0, + .header_X = 0, + .item_X = 0, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 1 +}; + +const struct WindowTemplate gUnknown_082F0174 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x03, + .width = 0x11, + .height = 0x0a, + .paletteNum = 0x0f, + .baseBlock = 0x0044 +}; + +const struct WindowTemplate gUnknown_082F017C = { + .bg = 0x00, + .tilemapLeft = 0x14, + .tilemapTop = 0x03, + .width = 0x07, + .height = 0x04, + .paletteNum = 0x0f, + .baseBlock = 0x00ee +}; + +const struct ListMenuItem gUnknown_082F0184[] = { + { gText_EmptyString, 0 }, + { gText_EmptyString, 1 }, + { gText_EmptyString, 2 }, + { gText_EmptyString, 3 }, + { gText_EmptyString, 4 }, + { gText_EmptyString, 5 }, + { gText_EmptyString, 6 }, + { gText_EmptyString, 7 }, + { gText_EmptyString, 8 }, + { gText_EmptyString, 9 }, + { gText_EmptyString, 10 }, + { gText_EmptyString, 11 }, + { gText_EmptyString, 12 }, + { gText_EmptyString, 13 }, + { gText_EmptyString, 14 }, + { gText_EmptyString, 15 } +}; + +const struct ListMenuTemplate gUnknown_082F0204 = { + .items = gUnknown_082F0184, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = sub_8013DF4, + .totalItems = 16, + .maxShowed = 5, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 1, + .fontId = 1, + .cursorKind = 0 +}; + +const struct WindowTemplate gUnknown_082F021C = { + .bg = 0x00, + .tilemapLeft = 0x14, + .tilemapTop = 0x05, + .width = 0x10, + .height = 0x08, + .paletteNum = 0x0f, + .baseBlock = 0x0001 +}; + +const struct ListMenuItem gUnknown_082F0224[] = { + { gUnknown_082EFD70, 0x208 }, + { gUnknown_082EFD60, 0x241 }, + { gUnknown_082EFD68, 0x245 }, + { gUnknown_082EFD7C, 0x040 } +}; + +const struct ListMenuTemplate gUnknown_082F0244 = { + .items = gUnknown_082F0224, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 4, + .maxShowed = 4, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct WindowTemplate gUnknown_082F025C = { + .bg = 0x00, + .tilemapLeft = 0x12, + .tilemapTop = 0x07, + .width = 0x10, + .height = 0x06, + .paletteNum = 0x0f, + .baseBlock = 0x0001 +}; + +const struct ListMenuItem gUnknown_082F0264[] = { + { gText_Register, 1 }, + { gUnknown_082EFD8C, 2 }, + { gUnknown_082EFD7C, 3 } +}; + +const struct ListMenuTemplate gUnknown_082F027C = { + .items = gUnknown_082F0264, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct WindowTemplate gUnknown_082F0294 = { + .bg = 0x00, + .tilemapLeft = 0x14, + .tilemapTop = 0x01, + .width = 0x10, + .height = 0x0c, + .paletteNum = 0x0f, + .baseBlock = 0x0001 +}; + +const struct ListMenuItem gUnknown_082F029C[] = { + { gTypeNames[TYPE_NORMAL], TYPE_NORMAL }, + { gTypeNames[TYPE_FIRE], TYPE_FIRE }, + { gTypeNames[TYPE_WATER], TYPE_WATER }, + { gTypeNames[TYPE_ELECTRIC], TYPE_ELECTRIC }, + { gTypeNames[TYPE_GRASS], TYPE_GRASS }, + { gTypeNames[TYPE_ICE], TYPE_ICE }, + { gTypeNames[TYPE_GROUND], TYPE_GROUND }, + { gTypeNames[TYPE_ROCK], TYPE_ROCK }, + { gTypeNames[TYPE_FLYING], TYPE_FLYING }, + { gTypeNames[TYPE_PSYCHIC], TYPE_PSYCHIC }, + { gTypeNames[TYPE_FIGHTING], TYPE_FIGHTING }, + { gTypeNames[TYPE_POISON], TYPE_POISON }, + { gTypeNames[TYPE_BUG], TYPE_BUG }, + { gTypeNames[TYPE_GHOST], TYPE_GHOST }, + { gTypeNames[TYPE_DRAGON], TYPE_DRAGON }, + { gTypeNames[TYPE_STEEL], TYPE_STEEL }, + { gTypeNames[TYPE_DARK], TYPE_DARK }, + { gUnknown_082EFD7C, NUMBER_OF_MON_TYPES } +}; + +const struct ListMenuTemplate gUnknown_082F032C = { + .items = gUnknown_082F029C, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = NUMBER_OF_MON_TYPES, + .maxShowed = 6, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct WindowTemplate gUnknown_082F0344 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x01, + .width = 0x1c, + .height = 0x02, + .paletteNum = 0x0d, + .baseBlock = 0x0001 +}; + +const struct WindowTemplate gUnknown_082F034C = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x05, + .width = 0x1c, + .height = 0x0c, + .paletteNum = 0x0d, + .baseBlock = 0x0039 +}; + +const struct ListMenuItem gUnknown_082F0354[] = { + { gText_EmptyString, -3 }, + { gText_EmptyString, 0 }, + { gText_EmptyString, 1 }, + { gText_EmptyString, 2 }, + { gText_EmptyString, 3 }, + { gText_EmptyString, 4 }, + { gText_EmptyString, 5 }, + { gText_EmptyString, 6 }, + { gText_EmptyString, 7 }, + { gUnknown_082EFD84, 8 } +}; + +const struct ListMenuTemplate gUnknown_082F03A4 = { + .items = gUnknown_082F0354, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = sub_8017BE8, + .totalItems = 10, + .maxShowed = 6, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 14, + .fillValue = 15, + .cursorShadowPal = 13, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct WindowTemplate UnrefWindowTemplate_082F03B4 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x05, + .width = 0x1c, + .height = 0x0c, + .paletteNum = 0x0d, + .baseBlock = 0x0039 +}; + +const struct ListMenuItem gUnknown_082F03C4[] = { + { gText_EmptyString, 0 }, + { gText_EmptyString, 1 }, + { gText_EmptyString, 2 }, + { gText_EmptyString, 3 }, + { gText_EmptyString, 4 }, + { gText_EmptyString, 5 }, + { gText_EmptyString, 6 }, + { gText_EmptyString, 7 }, + { gText_EmptyString, 8 }, + { gText_EmptyString, 9 }, + { gText_EmptyString, 10 }, + { gText_EmptyString, 11 }, + { gText_EmptyString, 12 }, + { gText_EmptyString, 13 }, + { gText_EmptyString, 14 }, + { gText_EmptyString, 15 } +}; + +const struct ListMenuTemplate UnrefListMenuTemplate_082F0444 = { + .items = gUnknown_082F03C4, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = nullsub_14, + .totalItems = 16, + .maxShowed = 4, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 1, + .fontId = 1, + .cursorKind = 0 +}; + +const struct UnkStruct_Shared gUnknown_082F045C = {0}; + +ALIGNED(4) const u8 gUnknown_082F0474[] = {0x01, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0478[] = {0x02, 0xff}; +ALIGNED(4) const u8 gUnknown_082F047C[] = {0x03, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0480[] = {0x04, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0484[] = {0x09, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0488[] = {0x0a, 0xff}; +ALIGNED(4) const u8 gUnknown_082F048C[] = {0x0b, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0490[] = {0x15, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0494[] = {0x16, 0xff}; +ALIGNED(4) const u8 gUnknown_082F0498[] = {0x40, 0x41, 0x44, 0x45, 0x48, 0x51, 0x52, 0x53, 0x54, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04A4[] = {0x0c, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04A8[] = {0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, 0x16, 0x0d, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04B4[] = {0x0f, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04B8[] = {0x10, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04BC[] = {0x17, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04C0[] = {0x18, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04C4[] = {0x19, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04C8[] = {0x1a, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04CC[] = {0x1b, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04D0[] = {0x1c, 0xff}; +ALIGNED(4) const u8 gUnknown_082F04D4[] = {0x0e, 0xff}; + +const u8 *const gUnknown_082F04D8[] = { + gUnknown_082F0474, + gUnknown_082F0478, + gUnknown_082F047C, + gUnknown_082F0480, + gUnknown_082F0484, + gUnknown_082F0488, + gUnknown_082F048C, + gUnknown_082F0490, + gUnknown_082F0494, + gUnknown_082F0498, + gUnknown_082F04A4, + gUnknown_082F04A8, + gUnknown_082F04B4, + gUnknown_082F04B8, + NULL, + gUnknown_082F04BC, + gUnknown_082F04C0, + gUnknown_082F04C4, + gUnknown_082F04C8, + gUnknown_082F04CC, + gUnknown_082F04D0, + gUnknown_082F04D4 +}; + +const u8 gUnknown_082F0530[] = { + 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, + 0x16, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x00, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x0e, 0x00, 0x00 +}; // code void nullsub_89(void) @@ -930,7 +1872,7 @@ bool8 sub_801320C(struct UnkStruct_Leader *data, u32 arg1, u32 arg2) return FALSE; } -void sub_8013278(u8 arg0, u32 id, u8 arg2) +void sub_8013278(u8 arg0, s32 id, u8 arg2) { struct UnkStruct_Leader *data = gUnknown_02022C30.leader; u8 var = 0; @@ -1435,7 +2377,7 @@ u8 sub_8013DBC(struct UnkStruct_Group *data, u32 id) return 0; } -void sub_8013DF4(u8 arg0, u32 id, u8 arg2) +void sub_8013DF4(u8 arg0, s32 id, u8 arg2) { struct UnkStruct_Group *data = gUnknown_02022C30.group; u8 var = sub_8013DBC(data, id); @@ -4220,3 +5162,53 @@ u32 sub_80179AC(struct UnkStruct_x20 *arg0) sub_8018404(sp0, arg0); return sub_800E540(ReadAsU16(arg0->unk.field_0.unk_00.playerTrainerId), sp0); } + +s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender) +{ + bool32 r2; + + struct UnkStruct_x20 * r5 = &arg0->arr[arg2]; + + if (!r5->unk.field_0.unk_0a_7 && arg1 == 0) + { + sub_8018404(gStringVar1, r5); + r2 = sub_800E540(ReadAsU16(r5->unk.field_0.unk_00.playerTrainerId), gStringVar1); + if (r5->unk.field_0.unk_0a_0 == 0x45) + { + StringExpandPlaceholders(gStringVar4, gUnknown_082EE6B8[r2][playerGender]); + return 2; + } + else + { + sub_8017020(gUnknown_082EE17C[r2]); + return 1; + } + } + else + { + sub_8018404(gStringVar1, r5); + if (arg1 != 0) + { + playerGender = (r5->unk.field_0.unk_00.playerTrainerId[arg1 + 1] >> 3) & 1; + } + switch (r5->unk.field_0.unk_0a_0 & 0x3F) + { + case 1: + StringExpandPlaceholders(gStringVar4, gUnknown_082EEEAC[playerGender][Random() % 4]); + break; + case 4: + StringExpandPlaceholders(gStringVar4, gUnknown_082EF1CC[playerGender][Random() % 2]); + break; + case 5: + StringExpandPlaceholders(gStringVar4, gUnknown_082EF010[playerGender][Random() % 4]); + break; + case 8: + StringExpandPlaceholders(gStringVar4, gUnknown_082EF100[playerGender][Random() % 2]); + break; + default: + StringExpandPlaceholders(gStringVar4, gUnknown_082EE6C8); + break; + } + return 0; + } +} From 8fc51b045941324c210096ccdbd385f7bfb0f6a6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Mar 2019 15:50:04 -0400 Subject: [PATCH 10/30] through sub_8017CB0 --- asm/union_room.s | 227 +------------------------ include/rom_8011DC0.h | 146 ++++++++++++++++ src/union_room.c | 382 ++++++++++-------------------------------- sym_ewram.txt | 25 +-- 4 files changed, 242 insertions(+), 538 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 446a62391..a8cbeeae2 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,231 +5,6 @@ .text - thumb_func_start nullsub_14 -nullsub_14: @ 8017B38 - bx lr - thumb_func_end nullsub_14 - - thumb_func_start sub_8017B3C -sub_8017B3C: @ 8017B3C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - ldr r4, [sp, 0x28] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r4, 24 - lsrs r4, 24 - ldrh r0, [r2, 0x8] - lsls r0, 22 - lsrs r0, 22 - mov r8, r0 - ldrb r0, [r2, 0x9] - lsrs r7, r0, 2 - ldrb r0, [r2, 0xB] - lsrs r0, 1 - mov r9, r0 - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - adds r2, r3, 0 - movs r3, 0x8 - bl sub_80173E0 - movs r0, 0xCE - lsls r0, 1 - cmp r8, r0 - bne _08017B94 - ldr r2, =gUnknown_082EF7D0 - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0x44 - bl sub_80173E0 - b _08017BD4 - .pool -_08017B94: - adds r1, r7, 0x1 - adds r0, r6, 0 - movs r2, 0x44 - adds r3, r5, 0 - bl blit_move_info_icon - movs r0, 0xB - mov r2, r8 - muls r2, r0 - ldr r0, =gSpeciesNames - adds r2, r0 - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0x76 - bl sub_80173E0 - add r0, sp, 0x8 - mov r1, r9 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - add r2, sp, 0x8 - movs r3, 0xC6 - bl sub_80173E0 -_08017BD4: - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017B3C - - thumb_func_start sub_8017BE8 -sub_8017BE8: @ 8017BE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r2, 24 - lsrs r7, r2, 24 - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - mov r8, r0 - movs r0, 0x3 - negs r0, r0 - cmp r4, r0 - bne _08017C6C - ldr r0, =gUnknown_082F03A4 - ldrb r0, [r0, 0x14] - lsls r0, 28 - lsrs r0, 28 - cmp r7, r0 - bne _08017C6C - bl sub_800F7DC - adds r2, r0, 0 - ldrh r1, [r2, 0x8] - ldr r0, =0x000003ff - ands r0, r1 - cmp r0, 0 - beq _08017CA0 - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - movs r0, 0x5 - str r0, [sp] - mov r0, r9 - adds r1, r7, 0 - bl sub_8017B3C - b _08017CA0 - .pool -_08017C4C: - mov r0, r12 - adds r1, r0, r4 - add r0, sp, 0x4 - bl sub_8018404 - mov r0, r8 - ldr r2, [r0] - adds r2, r4 - movs r0, 0x6 - str r0, [sp] - mov r0, r9 - adds r1, r7, 0 - add r3, sp, 0x4 - bl sub_8017B3C - b _08017CA0 -_08017C6C: - movs r5, 0 - movs r1, 0 - mov r2, r8 - ldr r2, [r2] - mov r12, r2 - adds r2, 0x8 - movs r3, 0 - adds r6, r4, 0x1 -_08017C7C: - ldrb r0, [r2, 0x12] - lsls r0, 30 - lsrs r0, 30 - adds r4, r3, 0 - cmp r0, 0x1 - bne _08017C92 - ldrh r0, [r2] - lsls r0, 22 - cmp r0, 0 - beq _08017C92 - adds r5, 0x1 -_08017C92: - cmp r5, r6 - beq _08017C4C - adds r2, 0x20 - adds r3, 0x20 - adds r1, 0x1 - cmp r1, 0x7 - ble _08017C7C -_08017CA0: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8017BE8 - - thumb_func_start sub_8017CB0 -sub_8017CB0: @ 8017CB0 - push {r4-r7,lr} - movs r4, 0 - movs r3, 0 - movs r7, 0x3 - ldr r6, =0x000003ff - adds r2, r0, 0 - adds r2, 0x8 - adds r5, r1, 0x1 -_08017CC0: - ldrb r1, [r2, 0x12] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x1 - bne _08017CD6 - ldrh r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08017CD6 - adds r4, 0x1 -_08017CD6: - cmp r4, r5 - bne _08017CE4 - adds r0, r3, 0 - b _08017CF0 - .pool -_08017CE4: - adds r2, 0x20 - adds r3, 0x1 - cmp r3, 0x7 - ble _08017CC0 - movs r0, 0x1 - negs r0, r0 -_08017CF0: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8017CB0 - thumb_func_start sub_8017CF8 sub_8017CF8: @ 8017CF8 lsls r0, 5 @@ -1124,6 +899,8 @@ sub_8018404: @ 8018404 bx r0 thumb_func_end sub_8018404 + @ file boundary? + thumb_func_start sub_8018424 sub_8018424: @ 8018424 push {lr} diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index 8376d1bc6..4341185a3 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -1,12 +1,158 @@ #ifndef GUARD_rom_8011DC0_H #define GUARD_rom_8011DC0_H +#include "librfu.h" + // Exported type declarations +struct UnkStruct_Shared +{ + struct UnkLinkRfuStruct_02022B14 field_0; + u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; +}; + +struct UnkStruct_x1C +{ + struct UnkStruct_Shared unk0; + u8 unk18:1; +}; + +struct UnkStruct_x20 +{ + struct UnkStruct_Shared unk; + u16 field_18; + u8 field_1A_0:2; + u8 field_1A_1:1; + u8 field_1B; + u8 field_1D; + u8 field_1E; + u8 field_1F; +}; + +struct UnkStruct_Main0 +{ + struct UnkStruct_x20 arr[8]; +}; + +struct UnkStruct_Main4 +{ + struct UnkStruct_x1C arr[5]; +}; + +struct UnkStruct_Main8 +{ + struct UnkStruct_x20 arr[5]; +}; + +struct UnkStruct_Leader +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main8 *field_8; + u8 state; + u8 textState; + u8 field_E; + u8 listWindowId; + u8 field_10; + u8 field_11; + u8 listTaskId; + u8 field_13; + u8 field_14; + u8 field_15; + u8 field_16; + u8 field_17; + u8 field_18; + u8 field_19; + u16 field_1A; +}; + +struct UnkStruct_Group +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + u8 state; + u8 textState; + u8 field_A; + u8 listWindowId; + u8 field_C; + u8 field_D; + u8 listTaskId; + u8 field_F; + u8 field_10; + u8 field_11; + u8 field_12; + u8 field_13; + u8 field_14; + u8 field_15; +}; + +struct UnkStruct_8019BA8 +{ + u8 field_0; + u8 field_1; + u8 field_2; + u8 field_3; +}; + +struct UnkStruct_URoom +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main0 *field_8; + struct UnkStruct_Main4 *field_C; + u16 field_10; + u16 field_12; + u8 state; + u8 stateAfterPrint; + u8 textState; + u8 field_17; + u8 field_18; + u8 field_19; + u8 field_1A; + u8 field_1B; + u8 field_1C; + u8 field_1D; + u8 field_1E; + u8 field_1F; + u8 field_20; + u8 spriteIds[40]; + u8 field_49; + u8 field_4A; + u16 field_4C[6]; + u8 field_58[0x98 - 0x58]; + u16 field_98; + u16 field_9A[3]; + struct UnkStruct_8019BA8 field_A0[8]; +}; + +union UnkUnion_Main +{ + struct UnkStruct_Leader *leader; + struct UnkStruct_Group *group; + struct UnkStruct_URoom *uRoom; +}; + +struct TradeUnkStruct +{ + u16 field_0; + u16 field_2; + u32 field_4; + u8 field_8; + u8 field_9; + u16 field_A; + u16 field_C; + u16 species; + u16 level; + u16 field_12; + u32 personality; +}; + // Exported RAM declarations extern u8 gUnknown_02022C2C; +extern union UnkUnion_Main gUnknown_02022C30; extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; + extern u16 gUnknown_02022C3C; extern u8 gUnknown_02022C3E; diff --git a/src/union_room.c b/src/union_room.c index a4a728a3b..fdd76221f 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -39,160 +39,17 @@ #include "field_player_avatar.h" #include "strings.h" #include "mevent.h" +#include "rom_8011DC0.h" -struct UnkStruct_Shared -{ - struct UnkLinkRfuStruct_02022B14 field_0; - u8 needingPadding[2]; - u8 playerName[PLAYER_NAME_LENGTH + 1]; -}; - -struct UnkStruct_x1C -{ - struct UnkStruct_Shared unk0; - u8 unk18:1; -}; - -struct UnkStruct_x20 -{ - struct UnkStruct_Shared unk; - u16 field_18; - u8 field_1A_0:2; - u8 field_1A_1:1; - u8 field_1B; - u8 field_1D; - u8 field_1E; - u8 field_1F; -}; - -struct UnkStruct_Main0 -{ - struct UnkStruct_x20 arr[8]; -}; - -struct UnkStruct_Main4 -{ - struct UnkStruct_x1C arr[5]; -}; - -struct UnkStruct_Main8 -{ - struct UnkStruct_x20 arr[5]; -}; - -struct UnkStruct_Leader -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main8 *field_8; - u8 state; - u8 textState; - u8 field_E; - u8 listWindowId; - u8 field_10; - u8 field_11; - u8 listTaskId; - u8 field_13; - u8 field_14; - u8 field_15; - u8 field_16; - u8 field_17; - u8 field_18; - u8 field_19; - u16 field_1A; -}; - -struct UnkStruct_Group -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - u8 state; - u8 textState; - u8 field_A; - u8 listWindowId; - u8 field_C; - u8 field_D; - u8 listTaskId; - u8 field_F; - u8 field_10; - u8 field_11; - u8 field_12; - u8 field_13; - u8 field_14; - u8 field_15; -}; - -struct UnkStruct_8019BA8 -{ - u8 field_0; - u8 field_1; - u8 field_2; - u8 field_3; -}; - -struct UnkStruct_URoom -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main0 *field_8; - struct UnkStruct_Main4 *field_C; - u16 field_10; - u16 field_12; - u8 state; - u8 stateAfterPrint; - u8 textState; - u8 field_17; - u8 field_18; - u8 field_19; - u8 field_1A; - u8 field_1B; - u8 field_1C; - u8 field_1D; - u8 field_1E; - u8 field_1F; - u8 field_20; - u8 spriteIds[40]; - u8 field_49; - u8 field_4A; - u16 field_4C[6]; - u8 field_58[0x98 - 0x58]; - u16 field_98; - u16 field_9A[3]; - struct UnkStruct_8019BA8 field_A0[8]; -}; - -union UnkUnion_Main -{ - struct UnkStruct_Leader *leader; - struct UnkStruct_Group *group; - struct UnkStruct_URoom *uRoom; -}; - -struct TradeUnkStruct -{ - u16 field_0; - u16 field_2; - u32 field_4; - u8 field_8; - u8 field_9; - u16 field_A; - u16 field_C; - u16 species; - u16 level; - u16 field_12; - u32 personality; -}; - -extern struct TradeUnkStruct gUnknown_02022C40; -extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; -extern union UnkUnion_Main gUnknown_02022C30; -extern u8 gUnknown_02022C2C; -extern u8 gUnknown_02022C2D; -extern u8 gUnknown_02022C3E; -extern u16 gUnknown_02022C3C; -extern u8 gUnknown_02022C20[]; -extern u8 gFieldLinkPlayerCount; -extern u8 gLocalLinkPlayerId; +EWRAM_DATA u8 gUnknown_02022C20[12] = {}; +EWRAM_DATA u8 gUnknown_02022C2C = 0; +EWRAM_DATA u8 gUnknown_02022C2D = 0; +EWRAM_DATA union UnkUnion_Main gUnknown_02022C30 = {}; +EWRAM_DATA u32 gFiller_02022C34 = 0; +EWRAM_DATA struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38 = {}; +EWRAM_DATA u16 gUnknown_02022C3C = 0; +EWRAM_DATA u8 gUnknown_02022C3E = 0; +EWRAM_DATA struct TradeUnkStruct gUnknown_02022C40 = {}; // IWRAM vars IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0; @@ -268,7 +125,7 @@ void sub_801818C(bool32 arg0); void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate); s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6); -s32 sub_8017CB0(struct UnkStruct_Main0 * arg); +s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1); bool32 sub_8018024(void); u32 sub_8017984(s32 arg0); void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); @@ -1326,7 +1183,7 @@ const u8 gUnknown_082F0530[] = { }; // code -void nullsub_89(void) +void nullsub_89(u8 taskId) { } @@ -4692,7 +4549,6 @@ s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTe return -1; } -#ifdef NONMATCHING s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6) { s32 input; @@ -4728,7 +4584,7 @@ s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTempl } else { - r4 = sub_8017CB0(arg6); + r4 = sub_8017CB0(arg6->arr, input); if (r4 >= 0) { DestroyListMenuTask(*arg2, NULL, NULL); @@ -4748,138 +4604,6 @@ s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTempl return -1; } -#else -NAKED -s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6) -{ - asm_unified("\tpush {r4-r7,lr}\n" - "\tmov r7, r10\n" - "\tmov r6, r9\n" - "\tmov r5, r8\n" - "\tpush {r5-r7}\n" - "\tadds r5, r0, 0\n" - "\tadds r6, r1, 0\n" - "\tmov r10, r2\n" - "\tmov r9, r3\n" - "\tldrb r4, [r5]\n" - "\tcmp r4, 0x1\n" - "\tbeq _0801730C\n" - "\tcmp r4, 0x1\n" - "\tbgt _080172C2\n" - "\tcmp r4, 0\n" - "\tbeq _080172C8\n" - "\tb _0801739C\n" - "_080172C2:\n" - "\tcmp r4, 0x2\n" - "\tbeq _0801731C\n" - "\tb _0801739C\n" - "_080172C8:\n" - "\tldr r0, =gUnknown_082F0344\n" - "\tbl sub_8017118\n" - "\tmov r1, r9\n" - "\tstrb r0, [r1]\n" - "\tldr r0, [sp, 0x20]\n" - "\tbl AddWindow\n" - "\tstrb r0, [r6]\n" - "\tldrb r0, [r6]\n" - "\tmovs r1, 0\n" - "\tbl DrawStdWindowFrame\n" - "\tldr r0, =gMultiuseListMenuTemplate\n" - "\tadds r2, r0, 0\n" - "\tldr r1, [sp, 0x24]\n" - "\tldm r1!, {r3,r4,r7}\n" - "\tstm r2!, {r3,r4,r7}\n" - "\tldm r1!, {r3,r4,r7}\n" - "\tstm r2!, {r3,r4,r7}\n" - "\tldrb r1, [r6]\n" - "\tstrb r1, [r0, 0x10]\n" - "\tmovs r1, 0\n" - "\tmovs r2, 0x1\n" - "\tbl ListMenuInit\n" - "\tmov r1, r10\n" - "\tstrb r0, [r1]\n" - "\tb _08017314\n" - "\t.pool\n" - "_0801730C:\n" - "\tldrb r0, [r6]\n" - "\tmovs r1, 0x1\n" - "\tbl CopyWindowToVram\n" - "_08017314:\n" - "\tldrb r0, [r5]\n" - "\tadds r0, 0x1\n" - "\tstrb r0, [r5]\n" - "\tb _0801739C\n" - "_0801731C:\n" - "\tmov r3, r10\n" - "\tldrb r0, [r3]\n" - "\tbl ListMenu_ProcessInput\n" - "\tadds r1, r0, 0\n" - "\tldr r0, =gMain\n" - "\tldrh r2, [r0, 0x2E]\n" - "\tmovs r0, 0x3\n" - "\tands r0, r2\n" - "\tcmp r0, 0\n" - "\tbeq _0801739C\n" - "\tcmp r1, 0x8\n" - "\tbeq _0801733E\n" - "\tands r4, r2\n" - "\tmov r8, r4\n" - "\tcmp r4, 0\n" - "\tbeq _08017368\n" - "_0801733E:\n" - "\tmov r4, r10\n" - "\tldrb r0, [r4]\n" - "\tmovs r1, 0\n" - "\tmovs r2, 0\n" - "\tbl DestroyListMenuTask\n" - "\tldrb r0, [r6]\n" - "\tbl RemoveWindow\n" - "\tmov r7, r9\n" - "\tldrb r0, [r7]\n" - "\tbl sub_8017168\n" - "\tmovs r0, 0\n" - "\tstrb r0, [r5]\n" - "\tmovs r0, 0x2\n" - "\tnegs r0, r0\n" - "\tb _080173A0\n" - "\t.pool\n" - "_08017368:\n" - "\tldr r0, [sp, 0x28]\n" - "\tbl sub_8017CB0\n" - "\tadds r4, r0, 0\n" - "\tcmp r4, 0\n" - "\tblt _08017396\n" - "\tmov r1, r10\n" - "\tldrb r0, [r1]\n" - "\tmovs r1, 0\n" - "\tmovs r2, 0\n" - "\tbl DestroyListMenuTask\n" - "\tldrb r0, [r6]\n" - "\tbl RemoveWindow\n" - "\tmov r3, r9\n" - "\tldrb r0, [r3]\n" - "\tbl sub_8017168\n" - "\tmov r7, r8\n" - "\tstrb r7, [r5]\n" - "\tadds r0, r4, 0\n" - "\tb _080173A0\n" - "_08017396:\n" - "\tmovs r0, 0x7\n" - "\tbl PlaySE\n" - "_0801739C:\n" - "\tmovs r0, 0x1\n" - "\tnegs r0, r0\n" - "_080173A0:\n" - "\tpop {r3-r5}\n" - "\tmov r8, r3\n" - "\tmov r9, r4\n" - "\tmov r10, r5\n" - "\tpop {r4-r7}\n" - "\tpop {r1}\n" - "\tbx r1"); -} -#endif - void sub_80173B0(void) { FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0); @@ -5212,3 +4936,83 @@ s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender return 0; } } + +void nullsub_14(u8 windowId, s32 itemId, u8 y) +{ + +} + +void sub_8017B3C(u8 arg0, u8 arg1, struct UnkLinkRfuStruct_02022B14 * arg2, const u8 * str, u8 arg4) +{ + u8 sp8[4]; + u16 r8 = arg2->species; + u8 r7 = arg2->type; + u8 r9 = arg2->unk_0b_1; + + sub_80173E0(arg0, 1, str, 8, arg1, arg4); + if (r8 == SPECIES_EGG) + { + sub_80173E0(arg0, 1, gUnknown_082EF7D0, 0x44, arg1, arg4); + } + else + { + blit_move_info_icon(arg0, r7 + 1, 0x44, arg1); + sub_80173E0(arg0, 1, gSpeciesNames[r8], 0x76, arg1, arg4); + ConvertIntToDecimalStringN(sp8, r9, STR_CONV_MODE_RIGHT_ALIGN, 3); + sub_80173E0(arg0, 1, sp8, 0xC6, arg1, arg4); + } +} + +void sub_8017BE8(u8 windowId, s32 itemId, u8 y) +{ + struct UnkStruct_Leader *leader = gUnknown_02022C30.leader; + struct UnkLinkRfuStruct_02022B14 *rfu; + s32 i, j; + u8 sp4[11]; + + if (itemId == -3 && y == gUnknown_082F03A4.upText_Y) + { + rfu = sub_800F7DC(); + if (rfu->species != SPECIES_NONE) + { + sub_8017B3C(windowId, y, rfu, gSaveBlock2Ptr->playerName, 5); + } + } + else + { + j = 0; + for (i = 0; i < 8; i++) + { + if (leader->field_0->arr[i].field_1A_0 == 1 && leader->field_0->arr[i].unk.field_0.species != SPECIES_NONE) + { + j++; + } + if (j == itemId + 1) + { + sub_8018404(sp4, &leader->field_0->arr[i]); + sub_8017B3C(windowId, y, &leader->field_0->arr[i].unk.field_0, sp4, 6); + break; + } + } + } +} + +s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1) +{ + s32 i; + s32 j = 0; + + for (i = 0; i < 8; i++) + { + if (arg[i].field_1A_0 == 1 && arg[i].unk.field_0.species != SPECIES_NONE) + { + j++; + } + if (j == arg1 + 1) + { + return i; + } + } + + return -1; +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 0cc9b7744..8aea7124c 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -6,30 +6,7 @@ .include "src/string_util.o" .include "src/link.o" .include "src/link_rfu.o" - -gUnknown_02022C20: @ 2022C20 - .space 0xC - -gUnknown_02022C2C: @ 2022C2C - .space 0x1 - -gUnknown_02022C2D: @ 2022C2D - .space 0x3 - -gUnknown_02022C30: @ 2022C30 - .space 0x8 - -gUnknown_02022C38: @ 2022C38 - .space 0x4 - -gUnknown_02022C3C: @ 2022C3C - .space 0x2 - -gUnknown_02022C3E: @ 2022C3E - .space 0x2 - -gUnknown_02022C40: @ 2022C40 - .space 0x18 + .include "src/union_room.o" gUnknown_02022C58: @ 2022C58 .space 0x8 From bf4a73a67cca44a01b8449aafb0d717551415a6b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Mar 2019 16:24:48 -0400 Subject: [PATCH 11/30] through sub_8017E00 --- asm/union_room.s | 216 ----------------------------------------------- src/union_room.c | 109 ++++++++++++++++++++---- 2 files changed, 93 insertions(+), 232 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index a8cbeeae2..4c68877a2 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,222 +5,6 @@ .text - thumb_func_start sub_8017CF8 -sub_8017CF8: @ 8017CF8 - lsls r0, 5 - adds r0, r1 - ldrb r0, [r0, 0xB] - lsls r0, 31 - lsrs r0, 31 - bx lr - thumb_func_end sub_8017CF8 - - thumb_func_start sub_8017D04 -sub_8017D04: @ 8017D04 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _08017D44 - movs r4, 0 - b _08017D2E -_08017D14: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - bl GetMonData - adds r1, r0, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _08017D74 - adds r4, 0x1 -_08017D2E: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - blt _08017D14 - movs r0, 0x2 - b _08017D90 - .pool -_08017D44: - movs r4, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bge _08017D8E - ldr r6, =gBaseStats -_08017D50: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - bl GetMonData - adds r1, r0, 0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r1, r0, r6 - ldrb r0, [r1, 0x6] - cmp r0, r5 - beq _08017D74 - ldrb r0, [r1, 0x7] - cmp r0, r5 - bne _08017D84 -_08017D74: - movs r0, 0 - b _08017D90 - .pool -_08017D84: - adds r4, 0x1 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - blt _08017D50 -_08017D8E: - movs r0, 0x1 -_08017D90: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017D04 - - thumb_func_start sub_8017D9C -sub_8017D9C: @ 8017D9C - push {lr} - adds r3, r0, 0 - cmp r1, 0x44 - beq _08017DD8 - cmp r1, 0x44 - bgt _08017DAE - cmp r1, 0x41 - beq _08017DB8 - b _08017DF6 -_08017DAE: - cmp r1, 0x45 - beq _08017DC8 - cmp r1, 0x48 - beq _08017DE8 - b _08017DF6 -_08017DB8: - ldr r0, =gUnknown_082EEA68 - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - b _08017DDA - .pool -_08017DC8: - ldr r0, =gUnknown_082EED3C - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - b _08017DDA - .pool -_08017DD8: - ldr r1, =gUnknown_082EF7B0 -_08017DDA: - adds r0, r3, 0 - bl StringExpandPlaceholders - b _08017DF6 - .pool -_08017DE8: - ldr r0, =gUnknown_082EEB08 - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - adds r0, r3, 0 - bl StringExpandPlaceholders -_08017DF6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017D9C - - thumb_func_start sub_8017E00 -sub_8017E00: @ 8017E00 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - adds r6, r4, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gLinkPlayers - movs r0, 0x1 - adds r1, r3, 0 - eors r1, r0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x13] - cmp r4, 0x44 - beq _08017E54 - cmp r4, 0x44 - bgt _08017E38 - cmp r4, 0x41 - beq _08017E3E - b _08017E94 - .pool -_08017E38: - cmp r6, 0x45 - beq _08017E78 - b _08017E94 -_08017E3E: - ldr r2, =gUnknown_082EE984 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r1, r0 - b _08017E66 - .pool -_08017E54: - ldr r2, =gUnknown_082EE984 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r1, r0 - adds r2, 0x8 -_08017E66: - adds r1, r2 - ldr r1, [r1] - adds r0, r5, 0 - bl StringCopy - b _08017E94 - .pool -_08017E78: - ldr r2, =gUnknown_082EE984 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r1, r0 - adds r2, 0x4 - adds r1, r2 - ldr r1, [r1] - adds r0, r5, 0 - bl StringCopy -_08017E94: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017E00 - thumb_func_start sub_8017EA0 sub_8017EA0: @ 8017EA0 push {r4-r7,lr} diff --git a/src/union_room.c b/src/union_room.c index fdd76221f..078bf9887 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -129,7 +129,7 @@ s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1); bool32 sub_8018024(void); u32 sub_8017984(s32 arg0); void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); -void sub_8017D9C(u8 *dst, u32 arg1, u32 playerGender); +void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender); u32 sub_80179AC(struct UnkStruct_x20 *arg0); void sub_8017E00(u8 *dst, u8 arg1); void sub_8019F04(u8 *spriteIds); @@ -423,23 +423,27 @@ ALIGNED(4) const u8 gUnknown_082EE92C[] = _("The trade will be started.{PAUSE 60 ALIGNED(4) const u8 gUnknown_082EE94C[] = _("The battle will be started.{PAUSE 60}"); ALIGNED(4) const u8 gUnknown_082EE96C[] = _("Entering the chat…{PAUSE 60}"); -const u8 *const gUnknown_082EE984[][3] = { +const u8 *const gUnknown_082EE984[][2][3] = { { - gUnknown_082EE94C, - gUnknown_082EE96C, - gUnknown_082EE92C + { + gUnknown_082EE94C, + gUnknown_082EE96C, + gUnknown_082EE92C + }, { + gUnknown_082EE94C, + gUnknown_082EE96C, + gUnknown_082EE92C + } }, { - gUnknown_082EE94C, - gUnknown_082EE96C, - gUnknown_082EE92C - }, { - gUnknown_082EE880, - gUnknown_082EE8B8, - gUnknown_082EE92C - }, { - gUnknown_082EE8D4, - gUnknown_082EE904, - gUnknown_082EE92C + { + gUnknown_082EE880, + gUnknown_082EE8B8, + gUnknown_082EE92C + }, { + gUnknown_082EE8D4, + gUnknown_082EE904, + gUnknown_082EE92C + } } }; @@ -5016,3 +5020,76 @@ s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1) return -1; } + +s32 sub_8017CF8(s32 arg1, struct UnkStruct_Main0 *arg0) +{ + return arg0->arr[arg1].unk.field_0.playerGender; +} + +s32 sub_8017D04(u32 type, u32 species) +{ + s32 i; + + if (species == SPECIES_EGG) + { + for (i = 0; i < gPlayerPartyCount; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + if (species == SPECIES_EGG) + { + return 0; + } + } + return 2; + } + else + { + for (i = 0; i < gPlayerPartyCount; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + if (gBaseStats[species].type1 == type || gBaseStats[species].type2 == type) + { + return 0; + } + } + return 1; + } +} + +void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender) +{ + switch (arg1) + { + case 0x41: + StringExpandPlaceholders(dst, gUnknown_082EEA68[playerGender]); + break; + case 0x45: + StringExpandPlaceholders(dst, gUnknown_082EED3C[playerGender]); + break; + case 0x44: + StringExpandPlaceholders(dst, gUnknown_082EF7B0); + break; + case 0x48: + StringExpandPlaceholders(dst, gUnknown_082EEB08[playerGender]); + break; + } +} + +void sub_8017E00(u8 *dst, u8 arg1) +{ + u8 mpId = GetMultiplayerId(); + u8 gender = gLinkPlayers[mpId ^ 1].gender; + + switch (arg1) + { + case 0x41: + StringCopy(dst, gUnknown_082EE984[mpId][gender][0]); + break; + case 0x44: + StringCopy(dst, gUnknown_082EE984[mpId][gender][2]); + break; + case 0x45: + StringCopy(dst, gUnknown_082EE984[mpId][gender][1]); + break; + } +} From 8d75dc1982010cedfa0b378f1a6be5805981da5c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Mar 2019 17:19:29 -0400 Subject: [PATCH 12/30] sub_8017EA0 --- asm/union_room.s | 140 ----------------------------------------------- src/union_room.c | 57 +++++++++++++++++++ 2 files changed, 57 insertions(+), 140 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 4c68877a2..6a2fa91e1 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,146 +5,6 @@ .text - thumb_func_start sub_8017EA0 -sub_8017EA0: @ 8017EA0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - adds r5, r2, 0 - adds r6, r3, 0 - movs r2, 0 - mov r8, r2 - ldrh r0, [r5] - subs r0, 0x40 - cmp r0, 0x8 - bls _08017EBA - b _08017FC6 -_08017EBA: - lsls r0, 2 - ldr r1, =_08017EC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08017EC8: - .4byte _08017FBC - .4byte _08017EEC - .4byte _08017FC6 - .4byte _08017FC6 - .4byte _08017EFC - .4byte _08017EF4 - .4byte _08017FC6 - .4byte _08017FC6 - .4byte _08017FAC -_08017EEC: - ldr r1, =gUnknown_082EE3DC - b _08017FAE - .pool -_08017EF4: - ldr r1, =gUnknown_082EE430 - b _08017FAE - .pool -_08017EFC: - adds r0, r6, 0 - adds r0, 0x58 - ldr r4, =gUnknown_02022C40 - ldrh r1, [r4, 0xC] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - adds r0, 0x68 - ldrh r2, [r4, 0xA] - movs r1, 0xB - muls r1, r2 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - movs r4, 0 - b _08017F2E - .pool -_08017F2C: - adds r4, 0x1 -_08017F2E: - cmp r4, 0x3 - bgt _08017F64 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r4, 5 - adds r0, r1 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bne _08017F2C - ldrh r1, [r5, 0x4] - adds r0, r6, 0 - adds r0, 0x78 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldrh r1, [r5, 0x2] - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r6, 0 - adds r0, 0x88 - bl StringCopy - ldrh r5, [r5, 0x2] - mov r8, r5 -_08017F64: - movs r0, 0xCE - lsls r0, 1 - cmp r8, r0 - bne _08017F84 - ldr r1, =gUnknown_082EE4F0 - adds r0, r7, 0 - bl StringCopy - b _08017FB4 - .pool -_08017F84: - movs r4, 0 - adds r5, r6, 0 - adds r5, 0x58 -_08017F8A: - lsls r0, r4, 24 - lsrs r0, 24 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - adds r5, 0x10 - adds r4, 0x1 - cmp r4, 0x3 - ble _08017F8A - ldr r1, =gUnknown_082EE47C - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - b _08017FB4 - .pool -_08017FAC: - ldr r1, =gUnknown_082EE380 -_08017FAE: - adds r0, r7, 0 - bl StringExpandPlaceholders -_08017FB4: - movs r2, 0x1 - b _08017FC6 - .pool -_08017FBC: - ldr r1, =gUnknown_082EE544 - adds r0, r7, 0 - bl StringExpandPlaceholders - movs r2, 0x2 -_08017FC6: - adds r0, r2, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017EA0 - thumb_func_start sub_8017FD8 sub_8017FD8: @ 8017FD8 push {lr} diff --git a/src/union_room.c b/src/union_room.c index 078bf9887..a1002b9b5 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -39,6 +39,7 @@ #include "field_player_avatar.h" #include "strings.h" #include "mevent.h" +#include "dynamic_placeholder_text_util.h" #include "rom_8011DC0.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; @@ -5093,3 +5094,59 @@ void sub_8017E00(u8 *dst, u8 arg1) break; } } + +s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3) +{ + s32 result = 0; + u16 species = SPECIES_NONE; + s32 i; + + switch (arg2[0]) + { + case 0x41: + StringExpandPlaceholders(dst, gUnknown_082EE3DC); + result = 1; + break; + case 0x45: + StringExpandPlaceholders(dst, gUnknown_082EE430); + result = 1; + break; + case 0x44: + ConvertIntToDecimalStringN(arg3->field_58 + 0x00, gUnknown_02022C40.field_C, STR_CONV_MODE_LEFT_ALIGN, 3); + StringCopy(arg3->field_58 + 0x10, gSpeciesNames[gUnknown_02022C40.field_A]); + for (i = 0; i < 4; i++) + { + if (gUnknown_03007890->unk_14[i].unk_04 == 2) + { + ConvertIntToDecimalStringN(arg3->field_58 + 0x20, arg2[2], STR_CONV_MODE_LEFT_ALIGN, 3); + StringCopy(arg3->field_58 + 0x30, gSpeciesNames[arg2[1]]); + species = arg2[1]; + break; + } + } + if (species == SPECIES_EGG) + { + StringCopy(dst, gUnknown_082EE4F0); + } + else + { + for (i = 0; i < 4; i++) + { + DynamicPlaceholderTextUtil_SetPlaceholderPtr(i, arg3->field_58 + 0x10 * i); + } + DynamicPlaceholderTextUtil_ExpandPlaceholders(dst, gUnknown_082EE47C); + } + result = 1; + break; + case 0x48: + StringExpandPlaceholders(dst, gUnknown_082EE380); + result = 1; + break; + case 0x40: + StringExpandPlaceholders(dst, gUnknown_082EE544); + result = 2; + break; + } + + return result; +} From 6b6c98e7d0d1f0095bd1a62f1d5855b460b49f5c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Mar 2019 19:41:32 -0400 Subject: [PATCH 13/30] through sub_80180E8 --- asm/union_room.s | 180 ----------------------------------------------- src/union_room.c | 92 +++++++++++++++++++++++- 2 files changed, 90 insertions(+), 182 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 6a2fa91e1..9bbbf52e5 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,186 +5,6 @@ .text - thumb_func_start sub_8017FD8 -sub_8017FD8: @ 8017FD8 - push {lr} - adds r2, r0, 0 - ldr r0, =gRecvCmds - ldrh r1, [r0, 0x2] - cmp r1, 0 - beq _08017FFC - cmp r1, 0x51 - beq _08017FEC - cmp r1, 0x52 - bne _08017FFC -_08017FEC: - adds r0, r2, 0 - adds r0, 0x98 - strh r1, [r0] - movs r0, 0x1 - b _08017FFE - .pool -_08017FFC: - movs r0, 0 -_08017FFE: - pop {r1} - bx r1 - thumb_func_end sub_8017FD8 - - thumb_func_start InUnionRoom -InUnionRoom: @ 8018004 - push {lr} - movs r2, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x00003c19 - cmp r1, r0 - bne _08018016 - movs r2, 0x1 -_08018016: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end InUnionRoom - - thumb_func_start sub_8018024 -sub_8018024: @ 8018024 - push {r4-r6,lr} - movs r6, 0 - movs r5, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r6, r0 - bge _08018064 -_08018032: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x1E - bhi _0801805A - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - beq _0801805A - adds r6, 0x1 -_0801805A: - adds r5, 0x1 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - blt _08018032 -_08018064: - cmp r6, 0x1 - bgt _08018074 - movs r0, 0 - b _08018076 - .pool -_08018074: - movs r0, 0x1 -_08018076: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018024 - - thumb_func_start sub_801807C -sub_801807C: @ 801807C - movs r1, 0 - strh r1, [r0] - strh r1, [r0, 0x2] - str r1, [r0, 0x4] - strh r1, [r0, 0xA] - strh r1, [r0, 0xC] - strh r1, [r0, 0xE] - strh r1, [r0, 0x10] - str r1, [r0, 0x14] - bx lr - thumb_func_end sub_801807C - - thumb_func_start sub_8018090 -sub_8018090: @ 8018090 - push {lr} - ldr r0, =gUnknown_02022C40 - bl sub_801807C - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018090 - - thumb_func_start sub_80180A0 -sub_80180A0: @ 80180A0 - push {r4,r5,lr} - adds r5, r1, 0 - movs r1, 0x64 - adds r4, r0, 0 - muls r4, r1 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - strh r0, [r5, 0xA] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - strh r0, [r5, 0xC] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [r5, 0x4] - ldrh r1, [r5, 0xA] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _080180E0 - movs r0, 0 - b _080180E2 - .pool -_080180E0: - movs r0, 0x1 -_080180E2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80180A0 - - thumb_func_start sub_80180E8 -sub_80180E8: @ 80180E8 - push {r4,r5,lr} - adds r5, r1, 0 - movs r1, 0x64 - adds r4, r0, 0 - muls r4, r1 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - strh r0, [r5, 0xE] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - strh r0, [r5, 0x10] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [r5, 0x14] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80180E8 - thumb_func_start sub_8018120 sub_8018120: @ 8018120 push {r4-r7,lr} diff --git a/src/union_room.c b/src/union_room.c index a1002b9b5..d3a9c95a0 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -107,8 +107,8 @@ bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); void sub_8019F2C(void); void sub_8019E70(u8 *arg0, s32 arg1); -bool32 sub_80180A0(u8 monId, struct TradeUnkStruct *arg1); -void sub_80180E8(u8 monId, struct TradeUnkStruct *arg1); +bool32 sub_80180A0(u32 monId, struct TradeUnkStruct *arg1); +void sub_80180E8(u32 monId, struct TradeUnkStruct *arg1); bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3); void sub_80181CC(void); bool32 sub_8017940(void); @@ -5150,3 +5150,91 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3) return result; } + +bool32 sub_8017FD8(struct UnkStruct_URoom *arg0) +{ + if (gRecvCmds[0][1] != 0) + { + if (gRecvCmds[0][1] == 0x51) + { + arg0->field_98 = 0x51; + return TRUE; + } + else if (gRecvCmds[0][1] == 0x52) + { + arg0->field_98 = 0x52; + return TRUE; + } + } + return FALSE; +} + +bool32 InUnionRoom(void) +{ + return gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNION_ROOM) + && gSaveBlock1Ptr->location.mapNum == MAP_NUM(UNION_ROOM) + ? TRUE : FALSE; +} + +bool32 sub_8018024(void) +{ + s32 i; + s32 count = 0; + + for (i = 0; i < gPlayerPartyCount; i++) + { + if ( GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) <= 30 + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG) + { + count++; + } + } + + if (count > 1) + { + return TRUE; + } + else + { + return FALSE; + } +} + +void sub_801807C(struct TradeUnkStruct *arg0) +{ + arg0->field_0 = 0; + arg0->field_2 = 0; + arg0->field_4 = 0; + arg0->field_A = 0; + arg0->field_C = 0; + arg0->species = 0; + arg0->level = 0; + arg0->personality = 0; +} + +void sub_8018090(void) +{ + sub_801807C(&gUnknown_02022C40); +} + +bool32 sub_80180A0(u32 monId, struct TradeUnkStruct *arg1) +{ + arg1->field_A = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); + arg1->field_C = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + arg1->field_4 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + if (arg1->field_A == SPECIES_EGG) + { + return TRUE; + } + else + { + return FALSE; + } +} + +void sub_80180E8(u32 monId, struct TradeUnkStruct *arg1) +{ + arg1->species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); + arg1->level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + arg1->personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); +} From 2e588fd4d73a123ec41c92f2d7d3e70225c31c9d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Mar 2019 22:22:26 -0400 Subject: [PATCH 14/30] through sub_80181DC --- asm/union_room.s | 136 --------------------------------------- include/event_obj_lock.h | 1 + include/rom_8011DC0.h | 8 +-- src/union_room.c | 103 +++++++++++++++++++++++++---- 4 files changed, 95 insertions(+), 153 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 9bbbf52e5..a83ae2d30 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,142 +5,6 @@ .text - thumb_func_start sub_8018120 -sub_8018120: @ 8018120 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r1, 24 - movs r2, 0 - mov r8, r2 - cmp r1, 0 - bne _0801813E - ldrh r7, [r0, 0xA] - ldr r6, [r0, 0x4] - b _08018142 -_08018136: - lsls r0, r5, 16 - lsrs r0, 16 - mov r8, r0 - b _08018176 -_0801813E: - ldrh r7, [r0, 0xE] - ldr r6, [r0, 0x14] -_08018142: - movs r5, 0 - b _0801816E -_08018146: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - cmp r0, r6 - bne _0801816C - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - cmp r0, r7 - beq _08018136 -_0801816C: - adds r5, 0x1 -_0801816E: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - blt _08018146 -_08018176: - mov r0, r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018120 - - thumb_func_start sub_801818C -sub_801818C: @ 801818C - push {r4,lr} - adds r4, r0, 0 - bl sub_80173B0 - bl ScriptContext2_Disable - bl sub_8098524 - ldr r1, =gUnknown_02022C2C - movs r0, 0 - strb r0, [r1] - cmp r4, 0 - beq _080181BC - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8011090 -_080181BC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801818C - - thumb_func_start sub_80181CC -sub_80181CC: @ 80181CC - push {lr} - bl ScriptContext2_Enable - bl ScriptFreezeEventObjects - pop {r0} - bx r0 - thumb_func_end sub_80181CC - - thumb_func_start sub_80181DC -sub_80181DC: @ 80181DC - push {r4,lr} - movs r3, 0x80 - movs r2, 0 - ldr r4, [r0, 0xC] -_080181E4: - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r1, r4, r0 - ldrb r0, [r1, 0x18] - lsls r0, 31 - cmp r0, 0 - beq _0801820C - ldrb r0, [r1, 0xB] - lsls r0, 31 - lsrs r0, 31 - lsls r0, 3 - orrs r3, r0 - ldrb r1, [r1, 0x2] - movs r0, 0x7 - ands r0, r1 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 - b _08018216 -_0801820C: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _080181E4 -_08018216: - adds r0, r3, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80181DC - thumb_func_start sub_8018220 sub_8018220: @ 8018220 push {r4-r7,lr} diff --git a/include/event_obj_lock.h b/include/event_obj_lock.h index 2f09ad36a..037c0080d 100644 --- a/include/event_obj_lock.h +++ b/include/event_obj_lock.h @@ -8,5 +8,6 @@ void LockSelectedEventObject(void); void sub_8098630(void); bool8 sub_8098734(void); void ScriptUnfreezeEventObjects(void); +void sub_8098524(void); #endif // GUARD_EVENT_OBJ_LOCK_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index 4341185a3..f994f846e 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -135,12 +135,12 @@ union UnkUnion_Main struct TradeUnkStruct { u16 field_0; - u16 field_2; - u32 field_4; + u16 type; + u32 playerPersonality; u8 field_8; u8 field_9; - u16 field_A; - u16 field_C; + u16 playerSpecies; + u16 playerLevel; u16 species; u16 level; u16 field_12; diff --git a/src/union_room.c b/src/union_room.c index d3a9c95a0..59b38e6cd 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -41,6 +41,7 @@ #include "mevent.h" #include "dynamic_placeholder_text_util.h" #include "rom_8011DC0.h" +#include "event_obj_lock.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -3341,7 +3342,7 @@ void sub_80156E0(u8 taskId) break; case 2: sub_8010F84(0x40, 0, 0); - sub_8010FCC(gUnknown_02022C40.field_2, gUnknown_02022C40.field_A, gUnknown_02022C40.field_C); + sub_8010FCC(gUnknown_02022C40.type, gUnknown_02022C40.playerSpecies, gUnknown_02022C40.playerLevel); sub_800B488(); OpenLink(); sub_8011C84(); @@ -3936,14 +3937,14 @@ void sub_80156E0(u8 taskId) sub_801568C(gUnknown_082EF4FC); break; default: - gUnknown_02022C40.field_2 = var5; + gUnknown_02022C40.type = var5; data->state = 55; break; } } break; case 55: - sub_8010FCC(gUnknown_02022C40.field_2, gUnknown_02022C40.field_A, gUnknown_02022C40.field_C); + sub_8010FCC(gUnknown_02022C40.type, gUnknown_02022C40.playerSpecies, gUnknown_02022C40.playerLevel); sub_801568C(gUnknown_082EF520); break; case 44: @@ -5112,8 +5113,8 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3) result = 1; break; case 0x44: - ConvertIntToDecimalStringN(arg3->field_58 + 0x00, gUnknown_02022C40.field_C, STR_CONV_MODE_LEFT_ALIGN, 3); - StringCopy(arg3->field_58 + 0x10, gSpeciesNames[gUnknown_02022C40.field_A]); + ConvertIntToDecimalStringN(arg3->field_58 + 0x00, gUnknown_02022C40.playerLevel, STR_CONV_MODE_LEFT_ALIGN, 3); + StringCopy(arg3->field_58 + 0x10, gSpeciesNames[gUnknown_02022C40.playerSpecies]); for (i = 0; i < 4; i++) { if (gUnknown_03007890->unk_14[i].unk_04 == 2) @@ -5203,10 +5204,10 @@ bool32 sub_8018024(void) void sub_801807C(struct TradeUnkStruct *arg0) { arg0->field_0 = 0; - arg0->field_2 = 0; - arg0->field_4 = 0; - arg0->field_A = 0; - arg0->field_C = 0; + arg0->type = 0; + arg0->playerPersonality = 0; + arg0->playerSpecies = 0; + arg0->playerLevel = 0; arg0->species = 0; arg0->level = 0; arg0->personality = 0; @@ -5219,10 +5220,10 @@ void sub_8018090(void) bool32 sub_80180A0(u32 monId, struct TradeUnkStruct *arg1) { - arg1->field_A = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); - arg1->field_C = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - arg1->field_4 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - if (arg1->field_A == SPECIES_EGG) + arg1->playerSpecies = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); + arg1->playerLevel = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + arg1->playerPersonality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + if (arg1->playerSpecies == SPECIES_EGG) { return TRUE; } @@ -5238,3 +5239,79 @@ void sub_80180E8(u32 monId, struct TradeUnkStruct *arg1) arg1->level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); arg1->personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); } + +u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId) +{ + u16 response = 0; + u16 species; + u32 personality; + u32 cur_personality; + u16 cur_species; + s32 i; + + if (multiplayerId == 0) + { + species = arg0->playerSpecies; + personality = arg0->playerPersonality; + } + else + { + species = arg0->species; + personality = arg0->personality; + } + + for (i = 0; i < gPlayerPartyCount; i++) + { + cur_personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); + if (cur_personality != personality) + { + continue; + } + cur_species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + if (cur_species != species) + { + continue; + } + response = i; + break; + } + + return response; +} + +void sub_801818C(bool32 arg0) +{ + sub_80173B0(); + ScriptContext2_Disable(); + sub_8098524(); + gUnknown_02022C2C = 0; + if (arg0) + { + sub_8010FCC(gUnknown_02022C40.type, gUnknown_02022C40.playerSpecies, gUnknown_02022C40.playerLevel); + sub_8011090(0x40, 0, 0); + } +} + +void sub_80181CC(void) +{ + ScriptContext2_Enable(); + ScriptFreezeEventObjects(); +} + +u8 sub_80181DC(struct UnkStruct_URoom *arg0) +{ + u8 retVal = 0x80; + u8 i; + + for (i = 0; i < 4; i++) + { + if (arg0->field_C->arr[i].unk18) + { + retVal |= arg0->field_C->arr[i].unk0.field_0.playerGender << 3; + retVal |= arg0->field_C->arr[i].unk0.field_0.unk_00.playerTrainerId[0] & 7; + break; + } + } + + return retVal; +} From 2f57d6bc0f822fb5f6b6dd681de7cab252626144 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 09:18:58 -0400 Subject: [PATCH 15/30] sub_8018220 --- asm/union_room.s | 205 ------------------------------------------ include/battle.h | 1 + include/rom_8011DC0.h | 3 + src/union_room.c | 70 ++++++++++++++- 4 files changed, 73 insertions(+), 206 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index a83ae2d30..fda2ebffe 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,211 +5,6 @@ .text - thumb_func_start sub_8018220 -sub_8018220: @ 8018220 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r9, r1 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp] - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r1, r0 - ldr r0, =gTrainerCards - adds r1, r0 - mov r8, r1 - bl DynamicPlaceholderTextUtil_Reset - mov r6, r9 - adds r6, 0xC0 - bl sub_8068BB0 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xD - muls r1, r0 - ldr r0, =gTrainerClassNames - adds r1, r0 - adds r0, r6, 0 - bl StringCopy - movs r0, 0 - adds r1, r6, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - mov r1, r8 - adds r1, 0x30 - movs r0, 0x1 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r4, 0xBA - lsls r4, 1 - add r4, r9 - ldr r1, =gUnknown_082EFF50 - mov r2, r8 - ldrb r0, [r2, 0x1] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringCopy - movs r0, 0x2 - adds r1, r4, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - mov r5, r9 - adds r5, 0xDE - mov r0, r8 - ldrh r1, [r0, 0xC] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r0, 0x3 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r2, 0xED - add r2, r9 - mov r10, r2 - mov r0, r8 - ldrh r1, [r0, 0x10] - mov r0, r10 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - mov r4, r9 - adds r4, 0xFC - mov r2, r8 - ldrh r1, [r2, 0x12] - adds r0, r4, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r0, 0x4 - mov r1, r10 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r0, 0x5 - adds r1, r4, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r4, 0xD2 - lsls r4, 1 - add r4, r9 - ldr r1, =gUnknown_082EFF64 - adds r0, r4, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl StringCopy - mov r0, r8 - ldrh r1, [r0, 0x14] - ldr r4, =0x0000270f - cmp r1, r4 - ble _0801830C - adds r1, r4, 0 -_0801830C: - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0 - adds r1, r6, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - mov r2, r8 - ldrh r1, [r2, 0x16] - cmp r1, r4 - ble _08018328 - adds r1, r4, 0 -_08018328: - mov r4, r9 - adds r4, 0xCF - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0x2 - adds r1, r4, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - mov r0, r8 - ldrh r1, [r0, 0x20] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - movs r0, 0x3 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r7, 0 - movs r6, 0x80 - lsls r6, 19 - mov r5, r8 - adds r5, 0x28 - mov r4, r10 -_08018360: - ldrh r1, [r5] - adds r0, r4, 0 - bl CopyEasyChatWord - lsrs r0, r6, 24 - adds r1, r4, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r2, 0x80 - lsls r2, 17 - adds r6, r2 - adds r5, 0x2 - adds r4, 0xF - adds r7, 0x1 - cmp r7, 0x3 - ble _08018360 - movs r4, 0xD2 - lsls r4, 1 - add r4, r9 - ldr r1, =gUnknown_082EFFA4 - adds r0, r4, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - ldr r5, =gStringVar4 - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend - ldr r0, [sp] - cmp r0, 0x1 - bne _080183D0 - ldr r1, =gUnknown_082F0020 - adds r0, r4, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend - b _080183F0 - .pool -_080183D0: - ldr r2, [sp] - cmp r2, 0 - bne _080183F0 - ldr r0, =gUnknown_082F0018 - mov r2, r8 - ldrb r1, [r2] - lsls r1, 2 - adds r1, r0 - ldr r1, [r1] - adds r0, r4, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend -_080183F0: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018220 - thumb_func_start sub_8018404 sub_8018404: @ 8018404 push {r4,r5,lr} diff --git a/include/battle.h b/include/battle.h index d155ca5a0..38bce0e61 100644 --- a/include/battle.h +++ b/include/battle.h @@ -776,5 +776,6 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gMultiUsePlayerCursor; extern u8 gNumberOfMovesToChoose; extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; +extern const u8 gTrainerClassNames[][13]; #endif // GUARD_BATTLE_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index f994f846e..fa54fca66 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -123,6 +123,9 @@ struct UnkStruct_URoom u16 field_98; u16 field_9A[3]; struct UnkStruct_8019BA8 field_A0[8]; + u8 field_C0[12][15]; + u8 field_174[48]; + u8 field_1A4[200]; }; union UnkUnion_Main diff --git a/src/union_room.c b/src/union_room.c index 59b38e6cd..9483a2828 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -41,6 +41,7 @@ #include "mevent.h" #include "dynamic_placeholder_text_util.h" #include "rom_8011DC0.h" +#include "easy_chat.h" #include "event_obj_lock.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; @@ -3266,7 +3267,7 @@ void UnionRoomSpecial(void) // dumb line needed to match gUnknown_02022C30.uRoom = gUnknown_02022C30.uRoom; - dataPtr = AllocZeroed(0x26C); + dataPtr = AllocZeroed(sizeof(*gUnknown_02022C30.uRoom)); gUnknown_02022C30.uRoom = dataPtr; gUnknown_03000DA8 = dataPtr; @@ -5315,3 +5316,70 @@ u8 sub_80181DC(struct UnkStruct_URoom *arg0) return retVal; } + +void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2) +{ + struct TrainerCard *trainerCard = &gTrainerCards[GetMultiplayerId() ^ 1]; + s32 i; + s32 n; + + DynamicPlaceholderTextUtil_Reset(); + + StringCopy(arg1->field_C0[0], gTrainerClassNames[sub_8068BB0()]); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, arg1->field_C0[0]); + + DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, trainerCard->playerName); + + StringCopy(arg1->field_174, gUnknown_082EFF50[trainerCard->stars]); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, arg1->field_174); + + ConvertIntToDecimalStringN(arg1->field_C0[2], trainerCard->caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, arg1->field_C0[2]); + + ConvertIntToDecimalStringN(arg1->field_C0[3], trainerCard->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(arg1->field_C0[4], trainerCard->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, arg1->field_C0[3]); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, arg1->field_C0[4]); + + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082EFF64); + StringCopy(gStringVar4, arg1->field_1A4); + + n = trainerCard->linkBattleWins; + if (n > 9999) + { + n = 9999; + } + ConvertIntToDecimalStringN(arg1->field_C0[0], n, STR_CONV_MODE_LEFT_ALIGN, 4); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, arg1->field_C0[0]); + + n = trainerCard->linkBattleLosses; + if (n > 9999) + { + n = 9999; + } + ConvertIntToDecimalStringN(arg1->field_C0[1], n, STR_CONV_MODE_LEFT_ALIGN, 4); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, arg1->field_C0[1]); + + ConvertIntToDecimalStringN(arg1->field_C0[2], trainerCard->pokemonTrades, STR_CONV_MODE_LEFT_ALIGN, 5); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, arg1->field_C0[2]); + + for (i = 0; i < 4; i++) + { + CopyEasyChatWord(arg1->field_C0[i + 3], trainerCard->var_28[i]); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(i + 4, arg1->field_C0[i + 3]); + } + + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082EFFA4); + StringAppend(gStringVar4, arg1->field_1A4); + + if (arg2 == TRUE) + { + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082F0020); + StringAppend(gStringVar4, arg1->field_1A4); + } + else if (arg2 == FALSE) + { + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082F0018[trainerCard->gender]); + StringAppend(gStringVar4, arg1->field_1A4); + } +} From 3b9275b133c875bda4f8d43fe300394d9c4cbb2a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 09:23:47 -0400 Subject: [PATCH 16/30] sub_8018404 --- asm/union_room.s | 17 ----------------- src/union_room.c | 6 ++++++ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index fda2ebffe..b83d579c7 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,23 +5,6 @@ .text - thumb_func_start sub_8018404 -sub_8018404: @ 8018404 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r1, 0x10 - bl StringCopy7 - ldrb r1, [r4] - lsls r1, 28 - lsrs r1, 28 - adds r0, r5, 0 - bl ConvertInternationalString - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8018404 - @ file boundary? thumb_func_start sub_8018424 diff --git a/src/union_room.c b/src/union_room.c index 9483a2828..6928f13d6 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -5383,3 +5383,9 @@ void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2) StringAppend(gStringVar4, arg1->field_1A4); } } + +void sub_8018404(u8 *dest, struct UnkStruct_x20 *arg1) +{ + StringCopy7(dest, arg1->unk.playerName); + ConvertInternationalString(dest, arg1->unk.field_0.unk_00.unk_00_0); +} From aa7f69f067a83a651c84c1feb9a874858c3adf82 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 31 Mar 2019 12:59:01 +0200 Subject: [PATCH 17/30] Begin use pokeblock and menu specialised --- asm/menu_specialized.s | 846 --------------------------------- asm/pokenav.s | 28 +- data/menu_specialized.s | 76 --- include/graphics.h | 4 + include/menu_specialized.h | 20 +- include/pokenav.h | 2 - include/strings.h | 1 + src/menu_specialized.c | 376 +++++++++++++++ src/use_pokeblock.c | 928 +++++++++++-------------------------- 9 files changed, 693 insertions(+), 1588 deletions(-) diff --git a/asm/menu_specialized.s b/asm/menu_specialized.s index a08d72aa5..b09ab4c44 100644 --- a/asm/menu_specialized.s +++ b/asm/menu_specialized.s @@ -6,857 +6,11 @@ .text - thumb_func_start sub_81D2C68 -sub_81D2C68: @ 81D2C68 - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - cmp r0, 0xE - bne _081D2CA8 - cmp r2, 0x2 - beq _081D2C7E - cmp r2, 0x7 - bne _081D2C94 -_081D2C7E: - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r2, 0 - adds r2, r3, 0 - bl GetMonData - b _081D2CCA - .pool -_081D2C94: - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r2, 0 - bl GetMonData - b _081D2CCA - .pool -_081D2CA8: - cmp r2, 0x2 - beq _081D2CB0 - cmp r2, 0x7 - bne _081D2CBE -_081D2CB0: - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - bl GetAndCopyBoxMonDataAt - b _081D2CCA -_081D2CBE: - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - bl GetBoxMonDataAt -_081D2CCA: - pop {r1} - bx r1 - thumb_func_end sub_81D2C68 - thumb_func_start sub_81D2CD0 -sub_81D2CD0: @ 81D2CD0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 16 - lsrs r6, r2, 16 - movs r0, 0xFC - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x4 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x8 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x9 - strb r0, [r5] - adds r5, 0x1 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x2D - movs r3, 0 - bl sub_81D2C68 - cmp r0, 0 - beq _081D2D20 - ldr r1, =gText_EggNickname - adds r0, r5, 0 - movs r2, 0 - movs r3, 0xC - bl StringCopyPadded - b _081D2E70 - .pool -_081D2D20: - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x2 - adds r3, r5, 0 - bl sub_81D2C68 - adds r0, r5, 0 - bl StringGetEnd10 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0xB - movs r3, 0 - bl sub_81D2C68 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r4, 0xE - bne _081D2D70 - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r4, 0 - bl GetMonGender - lsls r0, 24 - lsrs r6, r0, 24 - b _081D2D92 - .pool -_081D2D70: - lsls r0, r4, 24 - lsrs r0, 24 - lsls r1, r6, 24 - lsrs r1, 24 - bl GetBoxedMonPtr - adds r4, r0, 0 - bl GetBoxMonGender - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r4, 0 - bl GetLevelFromBoxMonExp - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 -_081D2D92: - cmp r7, 0x1D - beq _081D2D9A - cmp r7, 0x20 - bne _081D2DB0 -_081D2D9A: - movs r0, 0xB - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r5, 0 - bl StringCompare - cmp r0, 0 - bne _081D2DB0 - movs r6, 0xFF -_081D2DB0: - adds r3, r5, 0 - b _081D2DBA - .pool -_081D2DB8: - adds r3, 0x1 -_081D2DBA: - ldrb r0, [r3] - cmp r0, 0xFF - bne _081D2DB8 - movs r1, 0xFC - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x12 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x3C - strb r0, [r3] - adds r3, 0x1 - cmp r6, 0 - beq _081D2DDE - cmp r6, 0xFE - beq _081D2E02 - movs r0, 0 - b _081D2E24 -_081D2DDE: - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x1 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x4 - strb r0, [r3] - adds r3, 0x1 - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x3 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x5 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xB5 - b _081D2E24 -_081D2E02: - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x1 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x6 - strb r0, [r3] - adds r3, 0x1 - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x3 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x7 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xB6 -_081D2E24: - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xFC - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x4 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x8 - strb r0, [r3] - adds r3, 0x1 - movs r4, 0 - strb r4, [r3] - adds r3, 0x1 - movs r0, 0x9 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xBA - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xF9 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x5 - strb r0, [r3] - adds r3, 0x1 - adds r0, r3, 0 - mov r1, r8 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r3, r0, 0 - strb r4, [r3] - adds r3, 0x1 - movs r0, 0xFF - strb r0, [r3] - adds r0, r3, 0 -_081D2E70: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D2CD0 - thumb_func_start sub_81D2E7C -sub_81D2E7C: @ 81D2E7C - push {r4,lr} - adds r4, r0, 0 - lsls r2, 16 - lsrs r2, 16 - b _081D2E94 -_081D2E86: - strb r3, [r4] - adds r1, 0x1 - adds r4, 0x1 - lsls r0, r2, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 -_081D2E94: - ldrb r3, [r1] - adds r0, r3, 0 - cmp r0, 0xFF - bne _081D2E86 - adds r1, r2, 0 - lsls r0, r1, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 - lsls r1, 16 - cmp r1, 0 - ble _081D2EC2 - movs r3, 0 -_081D2EAE: - strb r3, [r4] - adds r4, 0x1 - adds r1, r2, 0 - lsls r0, r1, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 - lsls r1, 16 - cmp r1, 0 - bgt _081D2EAE -_081D2EC2: - movs r0, 0xFF - strb r0, [r4] - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D2E7C - thumb_func_start sub_81D2ED4 -sub_81D2ED4: @ 81D2ED4 - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r0, [sp, 0x14] - ldr r1, [sp, 0x18] - ldr r4, [sp, 0x1C] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r0, r1, 16 - lsls r4, 24 - cmp r4, 0 - bne _081D2EFC - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 -_081D2EFC: - cmp r2, r0 - beq _081D2F42 - adds r0, r6, 0 - adds r1, r7, 0 - adds r2, r3, 0 - bl sub_81D2CD0 - movs r0, 0xFC - strb r0, [r5] - movs r0, 0x4 - strb r0, [r5, 0x1] - movs r0, 0x8 - strb r0, [r5, 0x2] - movs r0, 0 - strb r0, [r5, 0x3] - movs r0, 0x9 - strb r0, [r5, 0x4] - cmp r7, 0xE - bne _081D2F2C - adds r0, r5, 0x5 - ldr r1, =gText_InParty - b _081D2F3A - .pool -_081D2F2C: - adds r4, r5, 0x5 - lsls r0, r7, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 -_081D2F3A: - movs r2, 0x8 - bl sub_81D2E7C - b _081D2F72 -_081D2F42: - movs r1, 0 - movs r2, 0 -_081D2F46: - adds r0, r6, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xB - bls _081D2F46 - adds r1, r6, r1 - movs r0, 0xFF - strb r0, [r1] - movs r1, 0 - movs r2, 0 -_081D2F5E: - adds r0, r5, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x7 - bls _081D2F5E - adds r1, r5, r1 - movs r0, 0xFF - strb r0, [r1] -_081D2F72: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D2ED4 - thumb_func_start sub_81D2F78 -sub_81D2F78: @ 81D2F78 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - mov r10, r1 - ldr r0, [sp, 0x20] - ldr r1, [sp, 0x24] - ldr r4, [sp, 0x28] - ldr r5, [sp, 0x2C] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r6, r3, 16 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - lsls r4, 16 - lsrs r0, r4, 16 - lsls r5, 24 - cmp r5, 0 - bne _081D2FB0 - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 -_081D2FB0: - cmp r2, r0 - beq _081D305C - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x16 - movs r3, 0 - bl sub_81D2C68 - mov r1, r9 - lsls r5, r1, 2 - adds r4, r5, r1 - mov r2, r8 - adds r1, r2, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x2F - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x1 - adds r1, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x21 - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x2 - adds r1, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x18 - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x3 - adds r1, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x17 - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x4 - adds r1, r4 - strb r0, [r1] - mov r4, r10 - add r4, r9 - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x30 - movs r3, 0 - bl sub_81D2C68 - cmp r0, 0xFF - beq _081D3044 - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x30 - movs r3, 0 - bl sub_81D2C68 - movs r1, 0x1D - bl __udivsi3 - b _081D3046 -_081D3044: - movs r0, 0x9 -_081D3046: - strb r0, [r4] - mov r0, r9 - adds r1, r5, r0 - mov r2, r8 - adds r0, r2, r1 - lsls r1, 2 - adds r1, 0x14 - add r1, r8 - bl sub_81D2754 - b _081D3086 -_081D305C: - movs r2, 0 - mov r0, r9 - lsls r5, r0, 2 - adds r1, r5, r0 - movs r6, 0 - lsls r3, r1, 2 - movs r5, 0x9B - movs r4, 0x5B -_081D306C: - adds r0, r2, r1 - add r0, r8 - strb r6, [r0] - lsls r0, r2, 2 - adds r0, r3 - add r0, r8 - strh r5, [r0, 0x14] - strh r4, [r0, 0x16] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x4 - bls _081D306C -_081D3086: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D2F78 - thumb_func_start sub_81D3094 -sub_81D3094: @ 81D3094 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - mov r8, r0 - mov r9, r1 - ldr r0, [sp, 0x20] - ldr r1, [sp, 0x24] - ldr r4, [sp, 0x28] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r5, r3, 16 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r0, r1, 16 - lsls r4, 24 - cmp r4, 0 - bne _081D30C4 - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 -_081D30C4: - cmp r2, r0 - beq _081D311A - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0x41 - movs r3, 0 - bl sub_81D2C68 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0 - bl sub_81D2C68 - adds r6, r0, 0 - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl sub_81D2C68 - adds r5, r0, 0 - lsls r0, r4, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - movs r1, 0x1 - str r1, [sp] - mov r1, r8 - adds r2, r4, 0 - adds r3, r5, 0 - bl LoadSpecialPokePic - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl GetFrontSpritePalFromSpeciesAndPersonality - mov r1, r9 - bl LZ77UnCompWram -_081D311A: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3094 - - thumb_func_start sub_81D312C -sub_81D312C: @ 81D312C - push {lr} - adds r1, r0, 0 - ldrh r0, [r1] - adds r0, 0x18 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - ble _081D3140 - movs r0, 0 - strh r0, [r1] -_081D3140: - movs r0, 0 - ldrsh r1, [r1, r0] - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - pop {r1} - bx r1 - thumb_func_end sub_81D312C - - thumb_func_start sub_81D3150 -sub_81D3150: @ 81D3150 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1] - subs r0, 0x18 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x50 - negs r2, r2 - cmp r0, r2 - bge _081D3168 - strh r2, [r1] -_081D3168: - movs r0, 0 - ldrsh r1, [r1, r0] - eors r1, r2 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - pop {r1} - bx r1 - thumb_func_end sub_81D3150 - - thumb_func_start sub_81D3178 -sub_81D3178: @ 81D3178 - push {r4,r5,lr} - adds r5, r1, 0 - bl sub_81D2074 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - bl sub_81D312C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - cmp r4, 0 - bne _081D319A - cmp r0, 0 - beq _081D319C -_081D319A: - movs r1, 0x1 -_081D319C: - adds r0, r1, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3178 - - thumb_func_start sub_81D31A4 -sub_81D31A4: @ 81D31A4 - push {r4,r5,lr} - adds r5, r1, 0 - bl sub_81D2074 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - bl sub_81D3150 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - cmp r4, 0 - bne _081D31C6 - cmp r0, 0 - beq _081D31C8 -_081D31C6: - movs r1, 0x1 -_081D31C8: - adds r0, r1, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D31A4 - - thumb_func_start sub_81D31D0 -sub_81D31D0: @ 81D31D0 - push {r4-r7,lr} - sub sp, 0x20 - ldr r3, =gUnknown_08625A48 - ldr r4, [r3] - ldr r5, [r3, 0x4] - str r4, [sp, 0x18] - str r5, [sp, 0x1C] - mov r4, sp - ldr r3, =gUnknown_08625A50 - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - ldr r3, =gUnknown_08625A68 - ldr r4, [r3, 0x4] - ldr r3, [r3] - ldr r5, [sp, 0x18] - ldr r6, [sp, 0x1C] - str r5, [r0] - str r6, [r0, 0x4] - mov r0, sp - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - str r3, [r2] - str r4, [r2, 0x4] - add sp, 0x20 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D31D0 - - thumb_func_start sub_81D321C -sub_81D321C: @ 81D321C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x50 - adds r5, r0, 0 - mov r12, r1 - mov r8, r2 - mov r1, sp - ldr r0, =gUnknown_08625A70 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldm r0!, {r3,r4} - stm r1!, {r3,r4} - add r3, sp, 0x20 - adds r1, r3, 0 - ldr r0, =gUnknown_08625A90 - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - add r2, sp, 0x38 - adds r1, r2, 0 - ldr r0, =gUnknown_08625AA8 - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - movs r4, 0 -_081D3258: - lsls r0, r4, 3 - add r0, sp - ldr r1, [r0, 0x4] - ldr r0, [r0] - stm r5!, {r0,r1} - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081D3258 - mov r1, r12 - adds r0, r2, 0 - ldm r0!, {r2,r4,r5} - stm r1!, {r2,r4,r5} - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - movs r4, 0 -_081D327A: - lsls r0, r4, 3 - adds r0, r3, r0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - mov r5, r8 - adds r5, 0x8 - mov r8, r5 - subs r5, 0x8 - stm r5!, {r0,r1} - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _081D327A - add sp, 0x50 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D321C - - thumb_func_start sub_81D32B0 -sub_81D32B0: @ 81D32B0 - push {r4,r5,lr} - ldr r2, =gUnknown_08625AC0 - ldr r4, [r2] - ldr r5, [r2, 0x4] - ldr r2, =gUnknown_08625AC8 - ldr r3, [r2, 0x4] - ldr r2, [r2] - str r4, [r0] - str r5, [r0, 0x4] - str r2, [r1] - str r3, [r1, 0x4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D32B0 thumb_func_start sub_81D32D4 sub_81D32D4: @ 81D32D4 diff --git a/asm/pokenav.s b/asm/pokenav.s index d568f4281..f575c9aa8 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -10839,7 +10839,7 @@ sub_81CD624: @ 81CD624 adds r1, r6, 0 movs r2, 0x2D movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData cmp r0, 0 beq _081CD690 ldr r1, =gText_EggNickname @@ -10854,14 +10854,14 @@ _081CD690: adds r1, r6, 0 movs r2, 0x2 adds r3, r5, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData adds r0, r5, 0 bl StringGetEnd10 adds r0, r4, 0 adds r1, r6, 0 movs r2, 0xB movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData lsls r0, 16 lsrs r7, r0, 16 cmp r4, 0xE @@ -11328,7 +11328,7 @@ _081CDA5A: adds r1, r7, 0 movs r2, 0x16 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData mov r1, r9 lsls r5, r1, 2 adds r4, r5, r1 @@ -11340,7 +11340,7 @@ _081CDA5A: adds r1, r7, 0 movs r2, 0x2F movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData ldr r1, =0x00006429 add r1, r8 adds r1, r4 @@ -11349,7 +11349,7 @@ _081CDA5A: adds r1, r7, 0 movs r2, 0x21 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData ldr r1, =0x0000642a add r1, r8 adds r1, r4 @@ -11358,7 +11358,7 @@ _081CDA5A: adds r1, r7, 0 movs r2, 0x18 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData ldr r1, =0x0000642b add r1, r8 adds r1, r4 @@ -11367,7 +11367,7 @@ _081CDA5A: adds r1, r7, 0 movs r2, 0x17 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData ldr r1, =0x0000642c add r1, r8 adds r1, r4 @@ -11381,14 +11381,14 @@ _081CDA5A: adds r1, r7, 0 movs r2, 0x30 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData cmp r0, 0xFF beq _081CDB10 adds r0, r6, 0 adds r1, r7, 0 movs r2, 0x30 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData movs r1, 0x1D bl __udivsi3 b _081CDB12 @@ -11401,7 +11401,7 @@ _081CDB12: adds r1, r7, 0 movs r2, 0x8 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData ldr r1, =0x00006783 add r1, r8 add r1, r9 @@ -11498,7 +11498,7 @@ _081CDBD0: adds r1, r6, 0 movs r2, 0x41 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData adds r4, r0, 0 lsls r4, 16 lsrs r4, 16 @@ -11506,13 +11506,13 @@ _081CDBD0: adds r1, r6, 0 movs r2, 0x1 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData mov r8, r0 adds r0, r5, 0 adds r1, r6, 0 movs r2, 0 movs r3, 0 - bl sub_81D2C68 + bl GetBoxOrPartyMonData adds r5, r0, 0 lsls r0, r4, 3 ldr r1, =gMonFrontPicTable diff --git a/data/menu_specialized.s b/data/menu_specialized.s index e88a68fcc..2005d5bf6 100644 --- a/data/menu_specialized.s +++ b/data/menu_specialized.s @@ -3,84 +3,8 @@ .section .rodata -gUnknown_08625560:: @ 8625560 - .incbin "graphics/pokenav/pokeball.4bpp" -gUnknown_08625660:: @ 8625660 - .incbin "graphics/pokenav/pokeball_placeholder.4bpp" - -gUnknown_08625680:: @ 8625680 - .incbin "graphics/pokenav/sparkle.gbapal" - -gUnknown_086256A0:: @ 86255A0 - .incbin "graphics/pokenav/sparkle.4bpp" - -gUnknown_08625A20:: @ 8625A20 - .2byte 0 - .2byte 0xC000 - .2byte 0x400 - .2byte 0 - -gUnknown_08625A28:: @ 8625A28 - .2byte 0 - .2byte 0x4000 - .2byte 0x800 - .2byte 0 - -gUnknown_08625A30:: @ 8625A30 - .2byte 0 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_08625A38:: @ 8625A38 - .2byte 4 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_08625A40:: @ 8625A40 - .4byte gUnknown_08625A30 - .4byte gUnknown_08625A38 -gUnknown_08625A48:: @ 8625A48 - .4byte NULL - .4byte 0x640800 - -gUnknown_08625A50:: @ 8625A50 - spr_template 0x64, 0x64, gUnknown_08625A20, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_08625A68:: @ 8625A68 - .4byte NULL - .4byte 0x64 - -gUnknown_08625A70:: @ 8625A70 - .4byte gUnknown_08625560 - .byte 0, 1, 0x65, 0 - .4byte gUnknown_08625660 - .2byte 0x20, 0x67 - .4byte gPokenavConditionCancel_Gfx - .byte 0, 1, 0x66, 0 - .4byte NULL, NULL - -gUnknown_08625A90:: @ 8625A90 - .4byte gPokenavConditionCancel_Pal + 0x0 - .byte 0x65, 0, 0, 0 - .4byte gPokenavConditionCancel_Pal + 0x20 - .byte 0x66, 0, 0, 0 - .4byte NULL, NULL - -gUnknown_08625AA8:: @ 8625AA8 - spr_template 0x65, 0x65, gUnknown_08625A28, gUnknown_08625A40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_08625AC0:: @ 8625AC0 - .4byte gUnknown_086256A0 - .byte 0x80, 3, 0x68, 0 - -gUnknown_08625AC8:: @ 8625AC8 - .4byte gUnknown_08625680 - .byte 0x68, 0, 0, 0 - gUnknown_08625AD0:: @ 8625AD0 .2byte 0 .2byte 0x4000 diff --git a/include/graphics.h b/include/graphics.h index b49b2a661..7833d4f7d 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4917,4 +4917,8 @@ extern const u16 gLinkMiscMenu_Pal[]; extern const u32 gLinkMiscMenu_Gfx[]; extern const u32 gLinkMiscMenu_Tilemap[]; +// Pokeblock +extern const u8 gPokenavConditionCancel_Gfx[]; +extern const u16 gPokenavConditionCancel_Pal[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/menu_specialized.h b/include/menu_specialized.h index a629ab014..90623a888 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -26,6 +26,12 @@ struct UnknownStruct_81D1ED4 /*0x355*/ u8 unk355; }; +struct Unk81D2F78_Struct +{ + u8 contestStats[4][5]; + struct UnknownSubStruct_81D1ED4 field_20[4][5]; +}; + bool8 sub_81D1C44(u8 count); u8 sub_81D1C84(u8 a0); u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); @@ -43,10 +49,7 @@ bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0); void sub_81D354C(struct Sprite **); void sub_81D3464(struct Sprite **arg0); void sub_81D3480(struct Sprite **arg0, u8 arg1, u8 arg2); -u8 sub_81D3178(struct UnknownStruct_81D1ED4*, u16*); -u8 sub_81D31A4(struct UnknownStruct_81D1ED4*, u16*); bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0); -u8 sub_81D3150(u16 *arg0); void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1); void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2); void MoveRelearnerPrintText(u8 *str); @@ -55,5 +58,16 @@ void MoveRelearnerCreateYesNoMenu(void); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); void InitMoveRelearnerWindows(bool8 useContextWindow); void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation); +s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); +void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); +void sub_81D2F78(struct Unk81D2F78_Struct *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); +void sub_81D3094(u8 *tilesDst, u8 *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); +bool8 sub_81D312C(s16 *var); +bool8 sub_81D3150(s16 *var); +bool8 sub_81D3178(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1); +bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1); +void sub_81D31D0(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal); +void sub_81D321C(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals); +void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal); #endif // GUARD_MENU_SPECIALIZED_H diff --git a/include/pokenav.h b/include/pokenav.h index 13cb0babf..4e1648c93 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -1,8 +1,6 @@ #ifndef GUARD_POKENAV_H #define GUARD_POKENAV_H -#include "list_menu.h" -bool8 sub_81D312C(void *arg0); void CB2_InitPokeNav(void); #endif //GUARD_POKENAV_H diff --git a/include/strings.h b/include/strings.h index 4a65e6875..c762ebd45 100644 --- a/include/strings.h +++ b/include/strings.h @@ -194,6 +194,7 @@ extern const u8 gText_SeeYaDescription[]; extern const u8 gText_EggNickname[]; extern const u8 gText_Pokemon[]; +extern const u8 gText_InParty[]; extern const u8 gText_InGameClockUsable[]; // reset rtc screen texts diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 3dadc7f80..ae150dcb4 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -2,7 +2,10 @@ #include "alloc.h" #include "battle_main.h" #include "contest_effect.h" +#include "data2.h" +#include "decompress.h" #include "gpu_regs.h" +#include "graphics.h" #include "menu.h" #include "international_string_util.h" #include "menu.h" @@ -11,16 +14,21 @@ #include "palette.h" #include "player_pc.h" #include "pokemon_summary_screen.h" +#include "pokemon_storage_system.h" #include "scanline_effect.h" #include "sound.h" #include "strings.h" #include "string_util.h" +#include "text.h" #include "text_window.h" #include "trig.h" #include "window.h" #include "constants/songs.h" +#include "constants/species.h" #include "gba/io_reg.h" +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; + EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0}; EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL; @@ -1075,3 +1083,371 @@ void MoveRelearnerCreateYesNoMenu(void) { CreateYesNoMenu(&sMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0); } + +s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst) +{ + s32 ret; + + if (boxId == TOTAL_BOXES_COUNT) // Party mon. + { + if (request == MON_DATA_NICKNAME || request == MON_DATA_OT_NAME) + ret = GetMonData(&gPlayerParty[monId], request, dst); + else + ret = GetMonData(&gPlayerParty[monId], request); + } + else + { + if (request == MON_DATA_NICKNAME || request == MON_DATA_OT_NAME) + ret = GetAndCopyBoxMonDataAt(boxId, monId, request, dst); + else + ret = GetBoxMonDataAt(boxId, monId, request); + } + + return ret; +} + +static u8 *sub_81D2CD0(u8 *dst, u16 boxId, u16 monId) +{ + u16 species, level, gender; + struct BoxPokemon *boxMon; + u8 *str; + + *(dst++) = EXT_CTRL_CODE_BEGIN; + *(dst++) = 4; + *(dst++) = 8; + *(dst++) = 0; + *(dst++) = 9; + if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL)) + { + return StringCopyPadded(dst, gText_EggNickname, 0, 12); + } + else + { + GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, dst); + StringGetEnd10(dst); + species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL); + if (boxId == TOTAL_BOXES_COUNT) // Party mon. + { + level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + gender = GetMonGender(&gPlayerParty[monId]); + } + else + { + // Needed to match, feel free to remove. + boxId++;boxId--; + monId++;monId--; + + boxMon = GetBoxedMonPtr(boxId, monId); + gender = GetBoxMonGender(boxMon); + level = GetLevelFromBoxMonExp(boxMon); + } + + if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, gSpeciesNames[species])) + gender = MON_GENDERLESS; + + for (str = dst; *str != EOS; str++) + ; + + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = 0x12; + *(str++) = 0x3C; + + switch (gender) + { + default: + *(str++) = CHAR_SPACE; + break; + case MON_MALE: + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = EXT_CTRL_CODE_COLOR; + *(str++) = 4; + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = 3; + *(str++) = 5; + *(str++) = CHAR_MALE; + break; + case MON_FEMALE: + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = EXT_CTRL_CODE_COLOR; + *(str++) = 6; + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = 3; + *(str++) = 7; + *(str++) = CHAR_FEMALE; + break; + } + + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = 4; + *(str++) = 8; + *(str++) = 0; + *(str++) = 9; + *(str++) = CHAR_SLASH; + *(str++) = CHAR_SPECIAL_F9; + *(str++) = 5; + str = ConvertIntToDecimalStringN(str, level, STR_CONV_MODE_LEFT_ALIGN, 3); + *(str++) = CHAR_SPACE; + *str = EOS; + + return str; + } +} + +static u8 *sub_81D2E7C(u8 *dst, const u8 *src, s16 n) +{ + while (*src != EOS) + { + *(dst++) = *(src++); + n--; + } + while (n-- > 0) + *(dst++) = CHAR_SPACE; + + *dst = EOS; + return dst; +} + +void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7) +{ + u16 i; + + if (!arg7) + arg6--; + + if (arg5 != arg6) + { + sub_81D2CD0(nameDst, boxId, monId); + dst[0] = EXT_CTRL_CODE_BEGIN; + dst[1] = 4; + dst[2] = 8; + dst[3] = 0; + dst[4] = 9; + if (boxId == TOTAL_BOXES_COUNT) // Party mon. + { + sub_81D2E7C(dst + 5, gText_InParty, 8); + } + else + { + boxId++;boxId--; // Again...Someone fix this maybe? + sub_81D2E7C(dst + 5, GetBoxNamePtr(boxId), 8); + } + } + else + { + for (i = 0; i < 12; i++) + nameDst[i] = CHAR_SPACE; + nameDst[i] = EOS; + for (i = 0; i < 8; i++) + dst[i] = CHAR_SPACE; + dst[i] = EOS; + } +} + +void sub_81D2F78(struct Unk81D2F78_Struct *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8) +{ + u16 i; + + if (!arg8) + arg7--; + + if (arg5 != arg7) + { + arg0->contestStats[id][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL); + arg0->contestStats[id][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL); + arg0->contestStats[id][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL); + arg0->contestStats[id][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL); + arg0->contestStats[id][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL); + + sheen[id] = (GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) != 0xFF) + ? GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) / 29u + : 9; + + sub_81D2754(arg0->contestStats[id], arg0->field_20[id]); + } + else + { + for (i = 0; i < 5; i++) + { + arg0->contestStats[id][i] = 0; + arg0->field_20[id][i].unk0 = 155; + arg0->field_20[id][i].unk2 = 91; + } + } +} + +void sub_81D3094(u8 *tilesDst, u8 *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7) +{ + if (!arg7) + arg6--; + + if (arg5 != arg6) + { + u16 species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL); + u32 trainerId = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL); + u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL); + + LoadSpecialPokePic(&gMonFrontPicTable[species], tilesDst, species, personality, TRUE); + LZ77UnCompWram(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst); + } +} + +bool8 sub_81D312C(s16 *var) +{ + *var += 24; + if (*var > 0) + *var = 0; + + return (*var != 0); +} + +bool8 sub_81D3150(s16 *var) +{ + *var -= 24; + if (*var < -80) + *var = -80; + + return (*var != -80); +} + +bool8 sub_81D3178(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1) +{ + bool8 var1 = sub_81D2074(arg0); + bool8 var2 = sub_81D312C(arg1); + + return ((var1 != 0) || (var2 != 0)); +} + +bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1) +{ + bool8 var1 = sub_81D2074(arg0); + bool8 var2 = sub_81D3150(arg1); + + return ((var1 != 0) || (var2 != 0)); +} + +const u32 gUnknown_08625560[] = INCBIN_U32("graphics/pokenav/pokeball.4bpp"); +const u32 gUnknown_08625660[] = INCBIN_U32("graphics/pokenav/pokeball_placeholder.4bpp"); +const u16 gUnknown_08625680[] = INCBIN_U16("graphics/pokenav/sparkle.gbapal"); +const u32 gUnknown_086256A0[] = INCBIN_U32("graphics/pokenav/sparkle.4bpp"); + +static const struct OamData sOamData_8625A20 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0 +}; + +const struct OamData sOamData_8625A28 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_8625A30[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8625A38[] = +{ + ANIMCMD_FRAME(4, 5), + ANIMCMD_END +}; + +const union AnimCmd *const sSpriteAnimTable_8625A40[] = +{ + sSpriteAnim_8625A30, + sSpriteAnim_8625A38 +}; + +void sub_81D31D0(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal) +{ + struct SpriteSheet dataSheet = {NULL, 0x800, 100}; + + struct SpriteTemplate dataTemplate = + { + .tileTag = 100, + .paletteTag = 100, + .oam = &sOamData_8625A20, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + + struct SpritePalette dataPal = {NULL, 100}; + + *sheet = dataSheet; + *template = dataTemplate; + *pal = dataPal; +} + +void sub_81D321C(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals) +{ + u8 i; + + struct SpriteSheet dataSheets[] = + { + {gUnknown_08625560, 0x100, 101}, + {gUnknown_08625660, 0x20, 103}, + {gPokenavConditionCancel_Gfx, 0x100, 102}, + {}, + }; + + struct SpritePalette dataPals[] = + { + {gPokenavConditionCancel_Pal, 101}, + {gPokenavConditionCancel_Pal + 16, 102}, + {}, + }; + + struct SpriteTemplate dataTemplate = + { + .tileTag = 101, + .paletteTag = 101, + .oam = &sOamData_8625A28, + .anims = sSpriteAnimTable_8625A40, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + + for (i = 0; i < ARRAY_COUNT(dataSheets); i++) + *(sheets++) = dataSheets[i]; + + *template = dataTemplate; + + for (i = 0; i < ARRAY_COUNT(dataPals); i++) + *(pals++) = dataPals[i]; +} + +void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal) +{ + struct SpriteSheet dataSheet = {gUnknown_086256A0, 0x380, 104}; + struct SpritePalette dataPal = {gUnknown_08625680, 104}; + + *sheet = dataSheet; + *pal = dataPal; +} diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 9b02eeb72..d78132585 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -27,7 +27,7 @@ struct UsePokeblockSubStruct /*0x00*/ void (*field_0)(void); /*0x04*/ void (*callback)(void); /*0x08*/ struct Pokeblock *pokeblock; - /*0x0C*/ struct Pokemon *pokemon; + /*0x0C*/ struct Pokemon *mon; /*0x10*/ u8 stringBuffer[0x40]; /*0x50*/ u8 field_50; /*0x51*/ u8 field_51; @@ -57,11 +57,17 @@ struct Unk7FB8 struct UsePokeblockStruct { - /*0x0000*/ u8 field_0[0x7B06]; + /*0x0000*/ u8 field_0[4]; + /*0x0000*/ u16 field_4[3][0x40]; + /*0x0184*/ u8 field_184[0x304 - 0x184]; + /*0x0304*/ u8 field_304[3][0x2000]; + /*0x6304*/ u8 field_6304[0x7b06 - 0x6304]; /*0x7B06*/ u8 field_7B06[7]; - /*0x7B0E*/ u16 field_7B0E; + /*0x7B0E*/ s16 field_7B0E; /*0x7B10*/ u8 field_7B10; - /*0x7B11*/ u8 field_7B11[0xB]; + /*0x7B12*/ u16 field_7B12; + /*0x7B12*/ u16 field_7B14; + /*0x7B12*/ u8 *field_7B18; /*0x7B1C*/ struct Sprite *field_7B1C[10]; /*0x7B44*/ struct Sprite *field_7B44[2]; /*0x7B4C*/ u8 field_7B4C; @@ -80,6 +86,8 @@ struct UsePokeblockStruct extern u16 gKeyRepeatStartDelay; +extern void sub_81D21DC(u8); + // this file's functions void sub_816636C(void (*func)(void)); void sub_8166380(void); @@ -100,7 +108,7 @@ static void sub_8167CA0(bool8); void sub_8166BEC(void); void sub_8166D44(void); s8 sub_8166DE4(void); -bool8 sub_8167268(void); +bool8 IsSheenMaxed(void); void sub_8166F50(void); void sub_816681C(void); void sub_8166F94(void); @@ -114,22 +122,15 @@ bool8 sub_8166EDC(void); void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statID, s16 a2); void Pokeblock_MenuWindowTextPrint(const u8 *message); void sub_8167184(struct Pokeblock *, struct Pokemon *); -extern u32 sub_81D2C68(s32, s32, s32, u8 *); void sub_81673DC(struct Sprite *sprite); void sub_81674BC(void); void sub_816753C(s16, u8); static u8 sub_8167EA4(void); static u8 sub_8167FA4(void); static u8 sub_8168048(void); -extern void sub_81D2ED4(u8, u8, u16, u8, u8, u8, u8); -extern void sub_81D2F78(u8, u8, s16, u16, u8, u8, u8, u8); -extern void sub_81D3094(u8, u8, s16, u16, u8, u8, u8); -extern void sub_81D31D0(struct SpritePalette *, struct SpritePalette *, struct SpritePalette *); -extern void sub_81D321C(struct SpriteSheet *, struct SpriteTemplate *, struct SpritePalette*); void sub_8168180(struct Sprite *sprite); void sub_81681B4(struct Sprite *sprite); -extern void sub_81D32B0(struct SpriteSheet *, struct SpritePalette*); -extern void sub_81D21DC(u8); +void sub_8168168(struct Sprite *sprite); extern const struct BgTemplate gUnknown_085DFCCC[4]; extern const struct WindowTemplate gUnknown_085DFCDC[]; @@ -160,9 +161,9 @@ EWRAM_DATA void (*gUnknown_0203BC94)(void) = NULL; EWRAM_DATA struct Pokeblock *gUnknown_0203BC98 = NULL; EWRAM_DATA u8 gPokeblockMonId = 0; EWRAM_DATA s16 gPokeblockGain = 0; -EWRAM_DATA void *gUnknown_0203BCA0 = NULL; -EWRAM_DATA void *gUnknown_0203BCA4 = NULL; -EWRAM_DATA void *gUnknown_0203BCA8 = NULL; +EWRAM_DATA u8 *gUnknown_0203BCA0 = NULL; +EWRAM_DATA u8 *gUnknown_0203BCA4 = NULL; +EWRAM_DATA u8 *gUnknown_0203BCA8 = NULL; EWRAM_DATA struct UsePokeblockStruct *gUnknown_0203BCAC = NULL; // const rom data @@ -349,8 +350,9 @@ void sub_8166564(void) } void sub_8166634(void) -{ +{ u8 var; + switch (gUnknown_0203BC90->field_50) { case 0: @@ -384,9 +386,9 @@ void sub_8166634(void) break; case 1: var = gUnknown_0203BCAC->info.unk74(); - if(!var) + if (!var) gUnknown_0203BC90->field_50 = var; - break; + break; case 2: break; case 3: @@ -406,7 +408,7 @@ void sub_8166634(void) gUnknown_0203BC90->field_50 = 0; break; case 0: - if (sub_8167268()) + if (IsSheenMaxed()) { sub_8166F50(); gUnknown_0203BC90->field_50 = 7; @@ -443,14 +445,10 @@ void sub_816681C(void) if (!gPaletteFade.active) { SetVBlankCallback(NULL); - Free(gUnknown_0203BCA0); - gUnknown_0203BCA0 = NULL; - Free(gUnknown_0203BCA4); - gUnknown_0203BCA4 = NULL; - Free(gUnknown_0203BCA8); - gUnknown_0203BCA8 = NULL; - Free(gUnknown_0203BCAC); - gUnknown_0203BCAC = NULL; + FREE_AND_SET_NULL(gUnknown_0203BCA0); + FREE_AND_SET_NULL(gUnknown_0203BCA4); + FREE_AND_SET_NULL(gUnknown_0203BCA8); + FREE_AND_SET_NULL(gUnknown_0203BCAC); FreeAllWindowBuffers(); gMain.savedCallback = CB2_ReturnAndChooseMonToGivePokeblock; CB2_PreparePokeblockFeedScene(); @@ -462,6 +460,7 @@ void sub_816681C(void) void sub_81668F8(void) { u16 var; + switch (gUnknown_0203BC90->field_50) { case 0: @@ -511,65 +510,65 @@ void sub_81668F8(void) void sub_8166A34(void) { + u8 var; + switch (gUnknown_0203BC90->field_50) { - u8 var; - case 0: - gUnknown_0203BC90->pokemon = gPlayerParty; - gUnknown_0203BC90->pokemon += gUnknown_0203BCAC->field_7FB8[gUnknown_0203BCAC->info.field_71].unk1; - sub_81D3520(gUnknown_0203BCAC->field_7B1C); + case 0: + gUnknown_0203BC90->mon = gPlayerParty; + gUnknown_0203BC90->mon += gUnknown_0203BCAC->field_7FB8[gUnknown_0203BCAC->info.field_71].unk1; + sub_81D3520(gUnknown_0203BCAC->field_7B1C); + gUnknown_0203BC90->field_50++; + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) gUnknown_0203BC90->field_50++; - break; - case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - gUnknown_0203BC90->field_50++; - break; - case 2: - sub_8167104(); - sub_81D2754(gUnknown_0203BC90->field_5c, gUnknown_0203BCAC->field_7C58.unk14[3]); - sub_81D1F84(&gUnknown_0203BCAC->field_7C58, gUnknown_0203BCAC->field_7C58.unk14[gUnknown_0203BCAC->field_7FB3], gUnknown_0203BCAC->field_7C58.unk14[3]); - sub_8167338(); - gUnknown_0203BC90->field_50++; - break; - case 3: - var = sub_81D2074(&gUnknown_0203BCAC->field_7C58); - if(var) - return; - + break; + case 2: + sub_8167104(); + sub_81D2754(gUnknown_0203BC90->field_5c, gUnknown_0203BCAC->field_7C58.unk14[3]); + sub_81D1F84(&gUnknown_0203BCAC->field_7C58, gUnknown_0203BCAC->field_7C58.unk14[gUnknown_0203BCAC->field_7FB3], gUnknown_0203BCAC->field_7C58.unk14[3]); + sub_8167338(); + gUnknown_0203BC90->field_50++; + break; + case 3: + var = sub_81D2074(&gUnknown_0203BCAC->field_7C58); + if (!var) + { sub_81681F4(sub_81672A4(gUnknown_0203BCAC->info.field_71)); - if (gUnknown_0203BCAC->info.field_71 != gUnknown_0203BCAC->info.field_70 - 1) { u8 var0 = gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->field_7FB3]; sub_81D3480(gUnknown_0203BCAC->field_7B1C, gUnknown_0203BCAC->field_7B10, var0); } - + gUnknown_0203BC90->field_52 = 0; - gUnknown_0203BC90->field_50++; - break; - case 4: - if ((++gUnknown_0203BC90->field_52) > 16) - { - sub_8166E24(); - gUnknown_0203BC90->field_50++; - } - break; - case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON) && !sub_8166EDC()) - { - TryClearPokeblock((u8)gSpecialVar_ItemId); - sub_816636C(sub_8166BEC); - } - break; + gUnknown_0203BC90->field_50++; + } + break; + case 4: + if (++gUnknown_0203BC90->field_52 > 16) + { + sub_8166E24(); + gUnknown_0203BC90->field_50++; + } + break; + case 5: + if (gMain.newKeys & (A_BUTTON | B_BUTTON) && !sub_8166EDC()) + { + TryClearPokeblock((u8)gSpecialVar_ItemId); + sub_816636C(sub_8166BEC); + } + break; } } void sub_8166BEC(void) { - u8 i; - u8 var; + u8 i, var; + switch (gUnknown_0203BC90->field_50) - { + { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); gUnknown_0203BC90->field_50++; @@ -588,18 +587,18 @@ void sub_8166BEC(void) sub_81D354C(gUnknown_0203BCAC->field_7B1C); for (i = 0; i < 7; i++) DestroySprite(&gSprites[gUnknown_0203BCAC->field_7B06[i]]); - + FreeSpriteTilesByTag(0); FreeSpriteTilesByTag(1); FreeSpritePaletteByTag(0); FreeSpritePaletteByTag(1); - + for (i = 0; i < 2; i++) DestroySprite(gUnknown_0203BCAC->field_7B44[i]); - + if (gUnknown_0203BCAC->field_7B10 != 0xFF) DestroySprite(&gSprites[gUnknown_0203BCAC->field_7B10]); - + SetVBlankCallback(NULL); FREE_AND_SET_NULL(gUnknown_0203BCA0); FREE_AND_SET_NULL(gUnknown_0203BCA4); @@ -613,6 +612,7 @@ void sub_8166BEC(void) void sub_8166D44(void) { u8 stringBuffer[0x40]; + GetMonData(&gPlayerParty[sub_81672A4(gUnknown_0203BCAC->info.field_71)], MON_DATA_NICKNAME, stringBuffer); StringGetEnd10(stringBuffer); StringAppend(stringBuffer, gText_GetsAPokeBlockQuestion); @@ -627,19 +627,21 @@ void sub_8166D44(void) s8 sub_8166DE4(void) { - s8 retval = Menu_ProcessInputNoWrapClearOnChoose(); - switch(retval) + s8 menuItem = Menu_ProcessInputNoWrapClearOnChoose(); + + switch (menuItem) { case 0: break; - case -1: + case MENU_B_PRESSED: case 1: PlaySE(SE_SELECT); rbox_fill_rectangle(2); ClearWindowTilemap(2); break; } - return retval; + + return menuItem; } void sub_8166E24(void) @@ -647,13 +649,17 @@ void sub_8166E24(void) sub_8098858(2, 151, 14); FillWindowPixelBuffer(2, 17); - for (gUnknown_0203BC90->field_53 = 0; gUnknown_0203BC90->field_53 < 5 && gUnknown_0203BC90->field_61[gUnknown_0203BC90->field_53] == 0; gUnknown_0203BC90->field_53++); - + for (gUnknown_0203BC90->field_53 = 0; gUnknown_0203BC90->field_53 < 5; gUnknown_0203BC90->field_53++) + { + if (gUnknown_0203BC90->field_61[gUnknown_0203BC90->field_53] != 0) + break; + } + if (gUnknown_0203BC90->field_53 < 5) Pokeblock_BufferEnhancedStatText(gStringVar4, gUnknown_0203BC90->field_53, gUnknown_0203BC90->field_61[gUnknown_0203BC90->field_53]); else Pokeblock_BufferEnhancedStatText(gStringVar4, gUnknown_0203BC90->field_53, 0); - + Pokeblock_MenuWindowTextPrint(gStringVar4); PutWindowTilemap(2); CopyWindowToVram(2, 3); @@ -662,7 +668,7 @@ void sub_8166E24(void) bool8 sub_8166EDC(void) { FillWindowPixelBuffer(2, 17); - + while (1) { gUnknown_0203BC90->field_53++; @@ -677,11 +683,11 @@ bool8 sub_8166EDC(void) return FALSE; } } - + Pokeblock_BufferEnhancedStatText(gStringVar4, gUnknown_0203BC90->field_53, gUnknown_0203BC90->field_61[gUnknown_0203BC90->field_53]); Pokeblock_MenuWindowTextPrint(gStringVar4); CopyWindowToVram(2, 2); - + return TRUE; } @@ -765,70 +771,67 @@ _08167018:\n\ } #endif -void Pokeblock_GetMonContestStats(struct Pokemon *pokemon, u8 *data) +void Pokeblock_GetMonContestStats(struct Pokemon *mon, u8 *data) { u16 i; for (i = 0; i < 5; i++) - data[i] = GetMonData(pokemon, gUnknown_085DFCB0[i]); + data[i] = GetMonData(mon, gUnknown_085DFCB0[i]); } -void sub_8167054(struct Pokeblock *pokeblock, struct Pokemon *pokemon) +void sub_8167054(struct Pokeblock *pokeblock, struct Pokemon *mon) { u16 i; s16 cstat; u8 data; - if (GetMonData(pokemon, MON_DATA_SHEEN) != 255) + + if (GetMonData(mon, MON_DATA_SHEEN) != 255) { - sub_8167184(pokeblock, pokemon); + sub_8167184(pokeblock, mon); for (i = 0; i < 5; i++) { - data = GetMonData(pokemon, gUnknown_085DFCB0[i]); + data = GetMonData(mon, gUnknown_085DFCB0[i]); cstat = data + gUnknown_0203BC90->field_66[i]; if (cstat < 0) cstat = 0; if (cstat > 255) cstat = 255; data = cstat; - SetMonData(pokemon, gUnknown_085DFCB0[i], &data); + SetMonData(mon, gUnknown_085DFCB0[i], &data); } - cstat = (u8)GetMonData(pokemon, MON_DATA_SHEEN); - cstat = cstat + pokeblock->feel; + cstat = (u8)(GetMonData(mon, MON_DATA_SHEEN)) + pokeblock->feel; if (cstat > 255) cstat = 255; data = cstat; - SetMonData(pokemon, MON_DATA_SHEEN, &data); + SetMonData(mon, MON_DATA_SHEEN, &data); } } void sub_8167104(void) { u16 i; - struct Pokemon *pokemon = gPlayerParty; - pokemon += gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->info.field_71 * 4 + 9]; - Pokeblock_GetMonContestStats(pokemon, gUnknown_0203BC90->field_57); - sub_8167054(gUnknown_0203BC90->pokeblock, pokemon); - Pokeblock_GetMonContestStats(pokemon, gUnknown_0203BC90->field_5c); - for (i=0; i<5; i++) - { + struct Pokemon *mon = gPlayerParty; + mon += gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->info.field_71 * 4 + 9]; + + Pokeblock_GetMonContestStats(mon, gUnknown_0203BC90->field_57); + sub_8167054(gUnknown_0203BC90->pokeblock, mon); + Pokeblock_GetMonContestStats(mon, gUnknown_0203BC90->field_5c); + for (i = 0; i < 5; i++) gUnknown_0203BC90->field_61[i] = gUnknown_0203BC90->field_5c[i] - gUnknown_0203BC90->field_57[i]; - } } -void sub_8167184(struct Pokeblock *pokeblock, struct Pokemon *pokemon) +void sub_8167184(struct Pokeblock *pokeblock, struct Pokemon *mon) { - s8 direction; - s8 i; - s16 amount; - s8 boost; - s8 taste; + s8 i, direction, taste; + gUnknown_0203BC90->field_66[0] = pokeblock->spicy; gUnknown_0203BC90->field_66[1] = pokeblock->sour; gUnknown_0203BC90->field_66[2] = pokeblock->bitter; gUnknown_0203BC90->field_66[3] = pokeblock->sweet; gUnknown_0203BC90->field_66[4] = pokeblock->dry; + if (gPokeblockGain > 0) direction = 1; else if (gPokeblockGain < 0) @@ -838,39 +841,43 @@ void sub_8167184(struct Pokeblock *pokeblock, struct Pokemon *pokemon) for (i = 0; i < 5; i++) { - amount = gUnknown_0203BC90->field_66[i]; - boost = amount / 10; + s16 amount = gUnknown_0203BC90->field_66[i]; + s8 boost = amount / 10; + if (amount % 10 >= 5) // round to the nearest boost++; - taste = GetMonFlavorRelation(pokemon, gUnknown_085DFCC4[i]); + taste = GetMonFlavorRelation(mon, gUnknown_085DFCC4[i]); if (taste == direction) gUnknown_0203BC90->field_66[i] += boost * taste; } } -bool8 sub_8167268(void) +bool8 IsSheenMaxed(void) { - u8 *mon; - mon = (u8 *) &gUnknown_0203BCAC->field_0[gUnknown_0203BCAC->info.field_71 * 4]; - if (sub_81D2C68(*(mon + 864 + 0x7C58), *(mon + 865 + 0x7C58), MON_DATA_SHEEN, 0) == 255) + if (GetBoxOrPartyMonData(gUnknown_0203BCAC->field_7FB8[gUnknown_0203BCAC->info.field_71].unk0, + gUnknown_0203BCAC->field_7FB8[gUnknown_0203BCAC->info.field_71].unk1, + MON_DATA_SHEEN, + NULL) == 255) return TRUE; - return FALSE; + else + return FALSE; } u8 sub_81672A4(u8 a0) { u8 i; + for (i = 0; i < PARTY_SIZE; i++) { if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) { if (a0 == 0) return i; - a0--; } } + return 0; } @@ -894,20 +901,21 @@ u8 sub_8167324(u8 a0) void sub_8167338(void) { - u16 flavor; - u8 spriteidx; + u16 i, spriteId; + LoadSpriteSheet(&gSpriteSheet_ConditionUpDown); LoadSpritePalette(&gSpritePalette_ConditionUpDown); gUnknown_0203BC90->field_54 = 0; - for (flavor = 0; flavor < 5; flavor++) + + for (i = 0; i < 5; i++) { - if (gUnknown_0203BC90->field_61[flavor] != 0) + if (gUnknown_0203BC90->field_61[i] != 0) { - spriteidx = CreateSprite(&gSpriteTemplate_085DFD5C, gUnknown_085DFD28[flavor][0], gUnknown_085DFD28[flavor][1], 0); - if (spriteidx != MAX_SPRITES) + spriteId = CreateSprite(&gSpriteTemplate_085DFD5C, gUnknown_085DFD28[i][0], gUnknown_085DFD28[i][1], 0); + if (spriteId != MAX_SPRITES) { - if (gUnknown_0203BC90->field_61[flavor] != 0) - gSprites[spriteidx].callback = sub_81673DC; + if (gUnknown_0203BC90->field_61[i] != 0) + gSprites[spriteId].callback = sub_81673DC; gUnknown_0203BC90->field_54++; } @@ -933,8 +941,8 @@ void sub_8167420(void) { u16 i; u16 numMons; - - for (i = 0, numMons = 0; i < CalculatePlayerPartyCount(); i++) + + for (i = 0, numMons = 0; i < CalculatePlayerPartyCount(); i++) { if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) { @@ -952,21 +960,21 @@ void sub_8167420(void) void sub_81674BC(void) { - s16 var; - s16 var2; - + s16 var, var2; + sub_816753C(gUnknown_0203BCAC->info.field_71, 0); gUnknown_0203BCAC->field_7FB3 = 0; gUnknown_0203BCAC->field_7FB4 = 1; gUnknown_0203BCAC->field_7FB5 = 2; + var = gUnknown_0203BCAC->info.field_71 + 1; if (var >= gUnknown_0203BCAC->info.field_70) var = 0; - + var2 = gUnknown_0203BCAC->info.field_71 - 1; if (var2 < 0) var2 = gUnknown_0203BCAC->info.field_70 - 1; - + sub_816753C(var, 1); sub_816753C(var2, 2); } @@ -977,11 +985,11 @@ void sub_816753C(s16 a1, u8 a2) u8 *v3; int v5; int v6; - + v3 = &gUnknown_0203BCAC->field_0[a1 << 16 >> 14]; v5 = *(0x7FB8 + v3); v6 = *(0x7FB9 + v3); - + sub_81D2ED4(gUnknown_0203BCAC->field_0[0x7B4D + 24 * a2], gUnknown_0203BCAC->field_0[0x7B95 + 64 * a2], v5, v6, a1, gUnknown_0203BCAC->info.field_70, 0); sub_81D2F78(gUnknown_0203BCAC->field_7C58[0], gUnknown_0203BCAC->field_0[0x7FB0], v5, v6, a1, a2, gUnknown_0203BCAC->info.field_70, 0); sub_81D3094(gUnknown_0203BCAC->field_0[(a2 << 13) + 0x304], gUnknown_0203BCAC->field_0[(a2 << 7) + 4], v5, v6, a1, gUnknown_0203BCAC->info.field_70, 0); @@ -1082,547 +1090,173 @@ void sub_816753C(s16 a1, u8 a2) } #endif -#ifdef NONMATCHING void sub_8167608(u8 arg0) { - u8 v4; - u8 *v5; - u8 *v6; - u32 v7; - struct SpritePalette array[5]; - if(gUnknown_0203BCAC->field_0[0x7B10] == 255) + u8 spriteId; + struct SpriteTemplate spriteTemplate; + struct SpriteSheet spriteSheet; + struct SpritePalette spritePal; + + if (gUnknown_0203BCAC->field_7B10 == 0xFF) { - sub_81D31D0(&array[3], &array[0], &array[4]); - array[1] = (struct SpritePallete *) ((u32) gUnknown_0203BCAC->field_0[(arg0 << 13) + 772]); - array[2] = (struct SpritePallete *) ((u32) gUnknown_0203BCAC->field_0[(arg0 << 7) + 4]); - gUnknown_0203BCAC->field_0[0x7B12] = LoadSpritePalette(&array[3]); - gUnknown_0203BCAC->field_0[0x7B14] = LoadSpritePalette(&array[4]); - v4 = CreateSprite(array[0], 38, 104, 0); - gUnknown_0203BCAC->field_0[0x7B10] = v4; - if(v4 == 64) + sub_81D31D0(&spriteSheet, &spriteTemplate, &spritePal); + spriteSheet.data = gUnknown_0203BCAC->field_304[arg0]; + spritePal.data = gUnknown_0203BCAC->field_4[arg0]; + gUnknown_0203BCAC->field_7B12 = LoadSpritePalette(&spritePal); + gUnknown_0203BCAC->field_7B14 = LoadSpriteSheet(&spriteSheet); + spriteId = CreateSprite(&spriteTemplate, 38, 104, 0); + gUnknown_0203BCAC->field_7B10 = spriteId; + if (spriteId == MAX_SPRITES) { FreeSpriteTilesByTag(100); FreeSpritePaletteByTag(100); - gUnknown_0203BCAC->field_0[0x7B10] = 255; + gUnknown_0203BCAC->field_7B10 = 0xFF; } else { - gUnknown_0203BCAC->field_0[0x7B10] = v4; - v5 = &gUnknown_0203BCAC->field_0[0]; - v6 = &gUnknown_0203BCAC->field_0[0x7B10]; - gSprites[v6].callback = sub_8168168; - gSprites[v6].pos2.y -= 32; - *(v5+0x7B18) = 32 * *(v5+0x7B14) + 0x06010000; - *(v5+0x7B12) = 16 * *(v5+0x7B12) + 0x100; + gUnknown_0203BCAC->field_7B10 = spriteId; + gSprites[gUnknown_0203BCAC->field_7B10].callback = sub_8168168; + gSprites[gUnknown_0203BCAC->field_7B10].pos2.y -= 34; + gUnknown_0203BCAC->field_7B18 = (void*)(OBJ_VRAM0 + (gUnknown_0203BCAC->field_7B14 * 32)); + gUnknown_0203BCAC->field_7B12 = (gUnknown_0203BCAC->field_7B12 * 16) + 0x100; } } else { - v7 = gUnknown_0203BCAC->field_0[0x7B18]; - REG_ADDR_DMA3SAD = gUnknown_0203BCAC->field_0[(arg0 << 13) + 772]; - REG_ADDR_DMA3DAD = v7; - REG_ADDR_DMA3CNT = 0x80000400; - LoadPalette(gUnknown_0203BCAC->field_0[arg0 << 7) + 4), gUnknown_0203BCAC->field_0[0x7B12], 32); + do {} while(0); // Surprised to see something like this? It's a very neat trick for generating the same assembly. It has no practical purpose, feel free to remove it. + DmaCopy16Defvars(3, gUnknown_0203BCAC->field_304[arg0], gUnknown_0203BCAC->field_7B18, 0x800); + LoadPalette(gUnknown_0203BCAC->field_4[arg0], gUnknown_0203BCAC->field_7B12, 32); } } -#else -NAKED -void sub_8167608(u8 arg0) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r8\n\ - push {r7}\n\ - sub sp, 0x28\n\ - lsls r0, 24\n\ - lsrs r6, r0, 24\n\ - ldr r1, =gUnknown_0203BCAC\n\ - ldr r3, [r1]\n\ - ldr r0, =0x00007b10\n\ - mov r8, r0\n\ - adds r0, r3, r0\n\ - ldrb r0, [r0]\n\ - adds r7, r1, 0\n\ - cmp r0, 0xFF\n\ - bne _08167714\n\ - add r5, sp, 0x18\n\ - add r4, sp, 0x20\n\ - adds r0, r5, 0\n\ - mov r1, sp\n\ - adds r2, r4, 0\n\ - bl sub_81D31D0\n\ - lsls r0, r6, 13\n\ - movs r1, 0xC1\n\ - lsls r1, 2\n\ - adds r0, r1\n\ - ldr r1, [r7]\n\ - adds r0, r1, r0\n\ - str r0, [sp, 0x18]\n\ - lsls r0, r6, 7\n\ - adds r0, 0x4\n\ - adds r1, r0\n\ - str r1, [sp, 0x20]\n\ - adds r0, r4, 0\n\ - bl LoadSpritePalette\n\ - ldr r1, [r7]\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - ldr r2, =0x00007b12\n\ - adds r1, r2\n\ - strh r0, [r1]\n\ - adds r0, r5, 0\n\ - bl LoadSpriteSheet\n\ - ldr r1, [r7]\n\ - ldr r3, =0x00007b14\n\ - adds r1, r3\n\ - strh r0, [r1]\n\ - mov r0, sp\n\ - movs r1, 0x26\n\ - movs r2, 0x68\n\ - movs r3, 0\n\ - bl CreateSprite\n\ - lsls r0, 24\n\ - lsrs r1, r0, 24\n\ - ldr r0, [r7]\n\ - ldr r2, =0x00007b10\n\ - adds r0, r2\n\ - strb r1, [r0]\n\ - cmp r1, 0x40\n\ - bne _081676AC\n\ - movs r0, 0x64\n\ - bl FreeSpriteTilesByTag\n\ - movs r0, 0x64\n\ - bl FreeSpritePaletteByTag\n\ - ldr r0, [r7]\n\ - add r0, r8\n\ - movs r1, 0xFF\n\ - strb r1, [r0]\n\ - b _08167742\n\ - .pool\n\ -_081676AC:\n\ - ldr r0, [r7]\n\ - add r0, r8\n\ - strb r1, [r0]\n\ - ldr r4, =gSprites\n\ - ldr r2, [r7]\n\ - mov r0, r8\n\ - adds r3, r2, r0\n\ - ldrb r1, [r3]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r1, r4, 0\n\ - adds r1, 0x1C\n\ - adds r0, r1\n\ - ldr r1, =sub_8168168\n\ - str r1, [r0]\n\ - ldrb r1, [r3]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r4\n\ - ldrh r1, [r0, 0x26]\n\ - subs r1, 0x22\n\ - strh r1, [r0, 0x26]\n\ - ldr r3, =0x00007b18\n\ - adds r1, r2, r3\n\ - subs r3, 0x4\n\ - adds r0, r2, r3\n\ - ldrh r0, [r0]\n\ - lsls r0, 5\n\ - ldr r3, =0x06010000\n\ - adds r0, r3\n\ - str r0, [r1]\n\ - ldr r0, =0x00007b12\n\ - adds r2, r0\n\ - ldrh r0, [r2]\n\ - lsls r0, 4\n\ - movs r1, 0x80\n\ - lsls r1, 1\n\ - adds r0, r1\n\ - strh r0, [r2]\n\ - b _08167742\n\ - .pool\n\ -_08167714:\n\ - lsls r1, r6, 13\n\ - movs r0, 0xC1\n\ - lsls r0, 2\n\ - adds r1, r0\n\ - adds r1, r3, r1\n\ - ldr r2, =0x00007b18\n\ - adds r0, r3, r2\n\ - ldr r2, [r0]\n\ - ldr r0, =0x040000d4\n\ - str r1, [r0]\n\ - str r2, [r0, 0x4]\n\ - ldr r1, =0x80000400\n\ - str r1, [r0, 0x8]\n\ - ldr r0, [r0, 0x8]\n\ - lsls r0, r6, 7\n\ - adds r0, 0x4\n\ - adds r0, r3, r0\n\ - ldr r2, =0x00007b12\n\ - adds r1, r3, r2\n\ - ldrh r1, [r1]\n\ - movs r2, 0x20\n\ - bl LoadPalette\n\ -_08167742:\n\ - add sp, 0x28\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif -#ifdef NONMATCHING void sub_8167760(void) { - s32 i; - u8 v1; - u8 v2; - u8 v3; - u32 v4; - struct SpriteSheet *v6; - struct SpriteTemplate *v7; - void (*funcCB) (void); - struct SpritePalette *v9; - struct SpriteSheet *v10; - struct SpritePalette *v11; - - sub_81D321C(v6, v7, v9); - LoadSpriteSheets(v6); - LoadSpritePalettes(v9); - for(i = 0; i < gUnknown_0203BCAC->info.field_70 - 1; i++) + u16 i, spriteId; + struct SpriteSheet spriteSheets[4]; + struct SpriteTemplate spriteTemplate; + struct SpritePalette spritePals[3]; + struct SpriteSheet spriteSheet2; + struct SpritePalette spritePal2; + + sub_81D321C(spriteSheets, &spriteTemplate, spritePals); + LoadSpriteSheets(spriteSheets); + LoadSpritePalettes(spritePals); + + for (i = 0; i < gUnknown_0203BCAC->info.field_70 - 1; i++) { - v1 = CreateSprite(v7, 226, (0x140000 * i + 0x80000) >> 16, 0); - if(v1 == 64) + spriteId = CreateSprite(&spriteTemplate, 226, (i * 20) + 8, 0); + if (spriteId != MAX_SPRITES) { - gUnknown_0203BCAC->field_0[0x7B06 + i] = -1; + gUnknown_0203BCAC->field_7B06[i] = spriteId; + gSprites[spriteId].data[0] = i; + gSprites[spriteId].callback = sub_8168180; } else { - gUnknown_0203BCAC->field_0[0x7B06 + i] = v1; - gSprites[v1].data[0] = i; - gSprites[v1].callback = (SpriteCallback) sub_8168180; + gUnknown_0203BCAC->field_7B06[i] = -1; } } - for(v7->tileTag = 103; i <= 5; i++) + + spriteTemplate.tileTag = 103; + for (; i < 6; i++) { - v2 = CreateSprite(v7, 230, (0x140000 * i + 0x80000) >> 16, 0); - if(v2 == 64 ) + spriteId = CreateSprite(&spriteTemplate, 230, (i * 20) + 8, 0); + if (spriteId != MAX_SPRITES) { - gUnknown_0203BCAC->field_0[0x7B06 + i] = -1; + gUnknown_0203BCAC->field_7B06[i] = spriteId; + gSprites[spriteId].oam.size = 0; } else { - gUnknown_0203BCAC->field_0[0x7B06 + i] = v2; - gSprites[v2].oam.tileNum &= 0x3F; + gUnknown_0203BCAC->field_7B06[i] = -1; } } - v7->tileTag = 102; - funcCB = sub_81681B4; - v3 = CreateSprite(v7, 222, (0x140000 * i + 0x80000) >> 16, 0); - if(v3 == 64) + + spriteTemplate.tileTag = 102; + spriteTemplate.callback = sub_81681B4; + spriteId = CreateSprite(&spriteTemplate, 222, (i * 20) + 8, 0); + if (spriteId != MAX_SPRITES) { - gUnknown_0203BCAC->field_0[0x7B06 + i] = -1; - } - else - { - gUnknown_0203BCAC->field_0[0x7B06 + i] = v3; - v4 = 68 * v3 + 0x2020630; - (v4 + 1) = gSprites[v2].oam.affineMode & (0x3F | 0x40); - (v4 + 3) = (v4 + 3) & (0x3F | 0x80); + gUnknown_0203BCAC->field_7B06[i] = spriteId; + gSprites[spriteId].oam.shape = 1; + gSprites[spriteId].oam.size = 2; } - sub_81D32B0(v10, v11); - LoadSpriteSheet(v10); - LoadSpritePalette(v11); + else + { + gUnknown_0203BCAC->field_7B06[i] = -1; + } + + sub_81D32B0(&spriteSheet2, &spritePal2); + LoadSpriteSheet(&spriteSheet2); + LoadSpritePalette(&spritePal2); } -#else -NAKED -void sub_8167760(void) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x60\n\ - add r5, sp, 0x20\n\ - add r4, sp, 0x38\n\ - mov r0, sp\n\ - adds r1, r5, 0\n\ - adds r2, r4, 0\n\ - bl sub_81D321C\n\ - mov r0, sp\n\ - bl LoadSpriteSheets\n\ - adds r0, r4, 0\n\ - bl LoadSpritePalettes\n\ - movs r4, 0\n\ - ldr r1, =gUnknown_0203BCAC\n\ - ldr r0, [r1]\n\ - ldr r2, =0x00008040\n\ - adds r0, r2\n\ - ldrb r0, [r0]\n\ - subs r0, 0x1\n\ - adds r6, r5, 0\n\ - add r2, sp, 0x50\n\ - mov r9, r2\n\ - add r2, sp, 0x58\n\ - mov r10, r2\n\ - cmp r4, r0\n\ - bge _0816781C\n\ - adds r5, r1, 0\n\ - ldr r7, =gSprites\n\ - movs r0, 0x1C\n\ - adds r0, r7\n\ - mov r8, r0\n\ -_081677AC:\n\ - lsls r2, r4, 2\n\ - adds r2, r4\n\ - lsls r2, 18\n\ - movs r1, 0x80\n\ - lsls r1, 12\n\ - adds r2, r1\n\ - asrs r2, 16\n\ - adds r0, r6, 0\n\ - movs r1, 0xE2\n\ - movs r3, 0\n\ - bl CreateSprite\n\ - lsls r0, 24\n\ - lsrs r3, r0, 24\n\ - cmp r3, 0x40\n\ - beq _081677FC\n\ - ldr r0, [r5]\n\ - ldr r2, =0x00007b06\n\ - adds r0, r2\n\ - adds r0, r4\n\ - strb r3, [r0]\n\ - lsls r0, r3, 4\n\ - adds r0, r3\n\ - lsls r0, 2\n\ - adds r1, r0, r7\n\ - strh r4, [r1, 0x2E]\n\ - add r0, r8\n\ - ldr r1, =sub_8168180\n\ - str r1, [r0]\n\ - b _08167808\n\ - .pool\n\ -_081677FC:\n\ - ldr r0, [r5]\n\ - ldr r1, =0x00007b06\n\ - adds r0, r1\n\ - adds r0, r4\n\ - movs r1, 0xFF\n\ - strb r1, [r0]\n\ -_08167808:\n\ - adds r0, r4, 0x1\n\ - lsls r0, 16\n\ - lsrs r4, r0, 16\n\ - ldr r0, [r5]\n\ - ldr r2, =0x00008040\n\ - adds r0, r2\n\ - ldrb r0, [r0]\n\ - subs r0, 0x1\n\ - cmp r4, r0\n\ - blt _081677AC\n\ -_0816781C:\n\ - movs r0, 0x67\n\ - strh r0, [r6]\n\ - cmp r4, 0x5\n\ - bhi _0816788A\n\ - ldr r5, =gUnknown_0203BCAC\n\ - ldr r7, =gSprites\n\ -_08167828:\n\ - lsls r2, r4, 2\n\ - adds r2, r4\n\ - lsls r2, 18\n\ - movs r0, 0x80\n\ - lsls r0, 12\n\ - adds r2, r0\n\ - asrs r2, 16\n\ - adds r0, r6, 0\n\ - movs r1, 0xE6\n\ - movs r3, 0\n\ - bl CreateSprite\n\ - lsls r0, 24\n\ - lsrs r3, r0, 24\n\ - cmp r3, 0x40\n\ - beq _08167874\n\ - ldr r0, [r5]\n\ - ldr r1, =0x00007b06\n\ - adds r0, r1\n\ - adds r0, r4\n\ - strb r3, [r0]\n\ - lsls r1, r3, 4\n\ - adds r1, r3\n\ - lsls r1, 2\n\ - adds r1, r7\n\ - ldrb r2, [r1, 0x3]\n\ - movs r0, 0x3F\n\ - ands r0, r2\n\ - strb r0, [r1, 0x3]\n\ - b _08167880\n\ - .pool\n\ -_08167874:\n\ - ldr r0, [r5]\n\ - ldr r2, =0x00007b06\n\ - adds r0, r2\n\ - adds r0, r4\n\ - movs r1, 0xFF\n\ - strb r1, [r0]\n\ -_08167880:\n\ - adds r0, r4, 0x1\n\ - lsls r0, 16\n\ - lsrs r4, r0, 16\n\ - cmp r4, 0x5\n\ - bls _08167828\n\ -_0816788A:\n\ - movs r0, 0x66\n\ - strh r0, [r6]\n\ - ldr r0, =sub_81681B4\n\ - str r0, [r6, 0x14]\n\ - lsls r2, r4, 2\n\ - adds r2, r4\n\ - lsls r2, 18\n\ - movs r0, 0x80\n\ - lsls r0, 12\n\ - adds r2, r0\n\ - asrs r2, 16\n\ - adds r0, r6, 0\n\ - movs r1, 0xDE\n\ - movs r3, 0\n\ - bl CreateSprite\n\ - lsls r0, 24\n\ - lsrs r3, r0, 24\n\ - cmp r3, 0x40\n\ - beq _081678F4\n\ - ldr r0, =gUnknown_0203BCAC\n\ - ldr r0, [r0]\n\ - ldr r1, =0x00007b06\n\ - adds r0, r1\n\ - adds r0, r4\n\ - strb r3, [r0]\n\ - ldr r0, =gSprites\n\ - lsls r2, r3, 4\n\ - adds r2, r3\n\ - lsls r2, 2\n\ - adds r2, r0\n\ - ldrb r3, [r2, 0x1]\n\ - movs r1, 0x3F\n\ - adds r0, r1, 0\n\ - ands r0, r3\n\ - movs r3, 0x40\n\ - orrs r0, r3\n\ - strb r0, [r2, 0x1]\n\ - ldrb r0, [r2, 0x3]\n\ - ands r1, r0\n\ - movs r0, 0x80\n\ - orrs r1, r0\n\ - strb r1, [r2, 0x3]\n\ - b _08167902\n\ - .pool\n\ -_081678F4:\n\ - ldr r0, =gUnknown_0203BCAC\n\ - ldr r0, [r0]\n\ - ldr r2, =0x00007b06\n\ - adds r0, r2\n\ - adds r0, r4\n\ - movs r1, 0xFF\n\ - strb r1, [r0]\n\ -_08167902:\n\ - mov r0, r9\n\ - mov r1, r10\n\ - bl sub_81D32B0\n\ - mov r0, r9\n\ - bl LoadSpriteSheet\n\ - mov r0, r10\n\ - bl LoadSpritePalette\n\ - add sp, 0x60\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif bool8 sub_8167930(void) { - bool8 retvalue; - switch(gUnknown_0203BCAC->info.unk78) - { - case 0: - ChangeBgX(0, 0, 0); - ChangeBgY(0, 0, 0); - ChangeBgX(1, 0, 0); - ChangeBgY(1, 0, 0); - ChangeBgX(2, 0, 0); - ChangeBgY(2, 0, 0); - ChangeBgX(3, 0, 0); - ChangeBgY(3, 136 << 6, 0); - SetGpuReg(REG_OFFSET_DISPCNT, 28736); - SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2|BLDCNT_EFFECT_BLEND|BLDCNT_TGT2_BG1); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4)); - break; - case 1: - (u32 *) gUnknown_0203BCA4 = Alloc(6656); - (u32 *) gUnknown_0203BCA0 = Alloc(1280); - (u32 *) gUnknown_0203BCA8 = Alloc(1280); - break; - case 2: - LZ77UnCompVram(gUnknown_085DFB60, gUnknown_0203BCA8); - break; - case 3: - LoadBgTiles(3, gUnknown_085DFA80, 224, 0); - break; - case 4: - LoadBgTilemap(3, gUnknown_0203BCA8, 1280, 0); - break; - case 5: - LoadPalette(gUnknown_085DFA60, 208, 32); - gUnknown_0203BCAC->field_7B0E = 0xFFB0; - break; - case 6: - LZ77UnCompVram(gUsePokeblockGraph_Gfx, gUnknown_0203BCA4); - break; - case 7: - LZ77UnCompVram(gUsePokeblockGraph_Tilemap, gUnknown_0203BCA0); - LoadPalette(gUsePokeblockGraph_Pal, 32, 32); - break; - case 8: - LoadBgTiles(1, gUnknown_0203BCA4, 6656, 160 << 2); - break; - case 9: - SetBgTilemapBuffer(1, gUnknown_0203BCA0); - CopyToBgTilemapBufferRect(1, gUsePokeblockNatureWin_Pal, 0, 13, 12, 4); - CopyBgTilemapBufferToVram(1); - break; - case 10: - LZ77UnCompVram(gUnknown_085DFC0C, &gUnknown_0203BCAC->field_0[0x7304]); - break; - case 11: - LoadBgTilemap(2, &gUnknown_0203BCAC->field_0[0x7304], 1280, 0); - LoadPalette(gUnknown_086231E8, 48, 32); - LoadPalette(gUnknown_08623208, 240, 32); - sub_81D21DC(2); - break; - default: - gUnknown_0203BCAC->info.unk78 = 0; - retvalue = 0; - return retvalue; - } - gUnknown_0203BCAC->info.unk78++; - retvalue = 1; - return retvalue; + switch (gUnknown_0203BCAC->info.unk78) + { + case 0: + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 136 << 6, 0); + SetGpuReg(REG_OFFSET_DISPCNT, 28736); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2|BLDCNT_EFFECT_BLEND|BLDCNT_TGT2_BG1); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4)); + break; + case 1: + gUnknown_0203BCA4 = Alloc(6656); + gUnknown_0203BCA0 = Alloc(1280); + gUnknown_0203BCA8 = Alloc(1280); + break; + case 2: + LZ77UnCompVram(gUnknown_085DFB60, gUnknown_0203BCA8); + break; + case 3: + LoadBgTiles(3, gUnknown_085DFA80, 224, 0); + break; + case 4: + LoadBgTilemap(3, gUnknown_0203BCA8, 1280, 0); + break; + case 5: + LoadPalette(gUnknown_085DFA60, 208, 32); + gUnknown_0203BCAC->field_7B0E = 0xFFB0; + break; + case 6: + LZ77UnCompVram(gUsePokeblockGraph_Gfx, gUnknown_0203BCA4); + break; + case 7: + LZ77UnCompVram(gUsePokeblockGraph_Tilemap, gUnknown_0203BCA0); + LoadPalette(gUsePokeblockGraph_Pal, 32, 32); + break; + case 8: + LoadBgTiles(1, gUnknown_0203BCA4, 6656, 160 << 2); + break; + case 9: + SetBgTilemapBuffer(1, gUnknown_0203BCA0); + CopyToBgTilemapBufferRect(1, gUsePokeblockNatureWin_Pal, 0, 13, 12, 4); + CopyBgTilemapBufferToVram(1); + break; + case 10: + LZ77UnCompVram(gUnknown_085DFC0C, &gUnknown_0203BCAC->field_0[0x7304]); + break; + case 11: + LoadBgTilemap(2, &gUnknown_0203BCAC->field_0[0x7304], 1280, 0); + LoadPalette(gUnknown_086231E8, 48, 32); + LoadPalette(gUnknown_08623208, 240, 32); + sub_81D21DC(2); + break; + default: + gUnknown_0203BCAC->info.unk78 = 0; + return FALSE; + } + + gUnknown_0203BCAC->info.unk78++; + return TRUE; } void sub_8167BA0(u16 arg0, u8 copyToVramMode) @@ -1658,9 +1292,7 @@ void sub_8167BA0(u16 arg0, u8 copyToVramMode) static void sub_8167CA0(bool8 arg0) { u16 var0; - int var1; - int r8; - int r4; + bool32 r8, r4; if (arg0) var0 = gUnknown_0203BCAC->field_7FB5; @@ -1680,11 +1312,11 @@ static void sub_8167CA0(bool8 arg0) gUnknown_0203BCAC->field_7FB3 = var0; gUnknown_0203BCAC->field_7FB6 = gUnknown_0203BCAC->field_7FB5; - gUnknown_0203BCAC->info.field_71 = gUnknown_0203BCAC->info.field_71 == 0 + gUnknown_0203BCAC->info.field_71 = (gUnknown_0203BCAC->info.field_71 == 0) ? gUnknown_0203BCAC->info.field_70 - 1 : gUnknown_0203BCAC->info.field_71 - 1; - gUnknown_0203BCAC->field_7B4C = gUnknown_0203BCAC->info.field_71 == 0 + gUnknown_0203BCAC->field_7B4C = (gUnknown_0203BCAC->info.field_71 == 0) ? gUnknown_0203BCAC->info.field_70 - 1 : gUnknown_0203BCAC->info.field_71 - 1; } @@ -1695,11 +1327,11 @@ static void sub_8167CA0(bool8 arg0) gUnknown_0203BCAC->field_7FB3 = var0; gUnknown_0203BCAC->field_7FB6 = gUnknown_0203BCAC->field_7FB4; - gUnknown_0203BCAC->info.field_71 = gUnknown_0203BCAC->info.field_71 < gUnknown_0203BCAC->info.field_70 - 1 + gUnknown_0203BCAC->info.field_71 = (gUnknown_0203BCAC->info.field_71 < gUnknown_0203BCAC->info.field_70 - 1) ? gUnknown_0203BCAC->info.field_71 + 1 : 0; - gUnknown_0203BCAC->field_7B4C = gUnknown_0203BCAC->info.field_71 < gUnknown_0203BCAC->info.field_70 - 1 + gUnknown_0203BCAC->field_7B4C = (gUnknown_0203BCAC->info.field_71 < gUnknown_0203BCAC->info.field_70 - 1) ? gUnknown_0203BCAC->info.field_71 + 1 : 0; } @@ -1835,7 +1467,8 @@ void sub_81681B4(struct Sprite *sprite) void sub_81681F4(u8 monIndex) { u8 sheen = GetMonData(&gPlayerParty[monIndex], MON_DATA_SHEEN); - gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->field_7FB3] = sheen != 255 + + gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->field_7FB3] = (sheen != 255) ? sheen / 29 : 9; } @@ -1868,7 +1501,7 @@ static void sub_8168294(void) if (spriteId != MAX_SPRITES) { gSprites[spriteId].data[0] = var; - gSprites[spriteId].data[1] = (i * xDiff) | 32; + gSprites[spriteId].data[1] = (i * xDiff) | 0x20; gSprites[spriteId].data[2] = i; StartSpriteAnim(&gSprites[spriteId], i); sprites[i] = &gSprites[spriteId]; @@ -1896,6 +1529,7 @@ static bool8 sub_8168328(void) void sub_8168374(struct Sprite *sprite) { s16 prevX = sprite->pos1.x; + sprite->pos1.x += sprite->data[0]; if ((prevX <= sprite->data[1] && sprite->pos1.x >= sprite->data[1]) || (prevX >= sprite->data[1] && sprite->pos1.x <= sprite->data[1])) From e3c07c83f2bb8ce91d96f4bb39110fae18eccdc1 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 31 Mar 2019 14:32:26 +0200 Subject: [PATCH 18/30] More work on use pokeblock --- asm/menu_specialized.s | 472 ------------------------------------- include/menu_specialized.h | 18 +- src/menu_specialized.c | 222 +++++++++++++++-- src/use_pokeblock.c | 142 ++--------- 4 files changed, 231 insertions(+), 623 deletions(-) diff --git a/asm/menu_specialized.s b/asm/menu_specialized.s index b09ab4c44..36db0f865 100644 --- a/asm/menu_specialized.s +++ b/asm/menu_specialized.s @@ -9,478 +9,6 @@ - - - - thumb_func_start sub_81D32D4 -sub_81D32D4: @ 81D32D4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - adds r0, 0x1 - strh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - ble _081D32F0 - movs r0, 0 - strh r0, [r1, 0x30] - adds r0, r1, 0 - bl sub_81D3408 -_081D32F0: - pop {r0} - bx r0 - thumb_func_end sub_81D32D4 - - thumb_func_start sub_81D32F4 -sub_81D32F4: @ 81D32F4 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081D330C - movs r0, 0 - strh r0, [r2, 0x30] - ldr r0, =sub_81D32D4 - str r0, [r2, 0x1C] -_081D330C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D32F4 - - thumb_func_start sub_81D3314 -sub_81D3314: @ 81D3314 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x36 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r3, r1, r0 - cmp r3, 0 - beq _081D3360 - ldrh r1, [r3, 0x24] - ldrh r2, [r3, 0x20] - adds r1, r2 - ldr r2, =gUnknown_08625B2C - movs r5, 0x2E - ldrsh r0, [r4, r5] - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r1, [r3, 0x26] - ldrh r3, [r3, 0x22] - adds r1, r3 - movs r3, 0x2E - ldrsh r0, [r4, r3] - lsls r0, 2 - adds r2, 0x2 - adds r0, r2 - ldrh r0, [r0] - adds r0, r1 - b _081D337E - .pool -_081D3360: - ldr r1, =gUnknown_08625B2C - movs r5, 0x2E - ldrsh r0, [r4, r5] - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x28 - strh r0, [r4, 0x20] - movs r2, 0x2E - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r1, 0x2 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x68 -_081D337E: - strh r0, [r4, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3314 - - thumb_func_start sub_81D338C -sub_81D338C: @ 81D338C - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r2 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - movs r5, 0 -_081D339E: - lsls r0, r5, 2 - mov r1, r8 - adds r4, r0, r1 - ldr r0, [r4] - cmp r0, 0 - beq _081D33F0 - strh r5, [r0, 0x2E] - ldr r1, [r4] - lsls r0, r5, 4 - adds r0, 0x1 - strh r0, [r1, 0x30] - ldr r0, [r4] - strh r6, [r0, 0x32] - ldr r0, [r4] - strh r5, [r0, 0x34] - cmp r7, 0 - beq _081D33C4 - cmp r6, 0x9 - beq _081D33D0 -_081D33C4: - ldr r1, [r4] - ldr r0, =sub_81D3564 - str r0, [r1, 0x1C] - b _081D33F0 - .pool -_081D33D0: - ldr r0, [r4] - bl sub_81D3314 - ldr r0, [r4] - bl sub_81D35E8 - ldr r2, [r4] - ldr r0, =sub_81D32F4 - str r0, [r2, 0x1C] - adds r2, 0x3E - ldrb r0, [r2] - movs r3, 0x5 - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - strb r0, [r2] -_081D33F0: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x9 - bls _081D339E - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D338C - - thumb_func_start sub_81D3408 -sub_81D3408: @ 81D3408 - push {r4-r7,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x38] - lsls r0, 24 - lsrs r2, r0, 24 - movs r3, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - adds r0, 0x1 - cmp r3, r0 - bge _081D3454 - ldr r5, =gSprites - movs r7, 0x1C - adds r7, r5 - mov r12, r7 - ldr r6, =sub_81D3564 -_081D3428: - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r2, r1, r5 - movs r7, 0x2E - ldrsh r0, [r2, r7] - lsls r0, 4 - adds r0, 0x1 - strh r0, [r2, 0x30] - add r1, r12 - str r6, [r1] - ldrh r0, [r2, 0x38] - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - movs r1, 0x32 - ldrsh r0, [r4, r1] - adds r0, 0x1 - cmp r3, r0 - blt _081D3428 -_081D3454: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3408 - - thumb_func_start sub_81D3464 -sub_81D3464: @ 81D3464 - push {lr} - adds r2, r0, 0 - movs r1, 0 - movs r3, 0 -_081D346C: - lsls r0, r1, 2 - adds r0, r2 - str r3, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x9 - bls _081D346C - pop {r0} - bx r0 - thumb_func_end sub_81D3464 - - thumb_func_start sub_81D3480 -sub_81D3480: @ 81D3480 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - movs r0, 0 - mov r9, r0 - lsrs r7, r2, 24 - movs r5, 0 - adds r0, r7, 0x1 - cmp r9, r0 - bge _081D34FE -_081D34A2: - ldr r0, =gUnknown_08625B14 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - adds r6, r3, 0 - cmp r3, 0x40 - beq _081D34FE - lsls r0, r5, 2 - mov r1, r8 - adds r4, r0, r1 - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r4] - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r4] - mov r1, r10 - strh r1, [r0, 0x36] - cmp r5, 0 - beq _081D34F0 - subs r0, r4, 0x4 - ldr r0, [r0] - strh r3, [r0, 0x38] - b _081D34F2 - .pool -_081D34F0: - mov r9, r6 -_081D34F2: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r7, 0x1 - cmp r5, r0 - blt _081D34A2 -_081D34FE: - lsls r0, r7, 2 - add r0, r8 - ldr r0, [r0] - mov r1, r9 - strh r1, [r0, 0x38] - adds r0, r7, 0 - movs r1, 0x1 - mov r2, r8 - bl sub_81D338C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D3480 - - thumb_func_start sub_81D3520 -sub_81D3520: @ 81D3520 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 -_081D3526: - cmp r5, 0x9 - bhi _081D3544 - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - cmp r0, 0 - beq _081D3544 - bl DestroySprite - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - b _081D3526 -_081D3544: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81D3520 - - thumb_func_start sub_81D354C -sub_81D354C: @ 81D354C - push {lr} - bl sub_81D3520 - movs r0, 0x68 - bl FreeSpriteTilesByTag - movs r0, 0x68 - bl FreeSpritePaletteByTag - pop {r0} - bx r0 - thumb_func_end sub_81D354C - - thumb_func_start sub_81D3564 -sub_81D3564: @ 81D3564 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _081D3592 - subs r0, r1, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - bne _081D35DC - adds r0, r4, 0 - movs r1, 0 - bl SeekSpriteAnim - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_081D3592: - adds r0, r4, 0 - bl sub_81D3314 - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081D35DC - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _081D35D8 - cmp r1, 0x9 - bne _081D35D0 - adds r0, r4, 0 - bl sub_81D35E8 - ldr r0, =sub_81D32F4 - b _081D35DA - .pool -_081D35D0: - ldr r0, =sub_81D32D4 - b _081D35DA - .pool -_081D35D8: - ldr r0, =SpriteCallbackDummy -_081D35DA: - str r0, [r4, 0x1C] -_081D35DC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3564 - - thumb_func_start sub_81D35E8 -sub_81D35E8: @ 81D35E8 - push {r4-r7,lr} - adds r6, r0, 0 - ldrh r0, [r6, 0x38] - lsls r0, 24 - lsrs r1, r0, 24 - movs r5, 0 - movs r2, 0x32 - ldrsh r0, [r6, r2] - adds r0, 0x1 - cmp r5, r0 - bge _081D3636 - movs r0, 0x5 - negs r0, r0 - adds r7, r0, 0 -_081D3604: - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r4, 0 - movs r1, 0 - bl SeekSpriteAnim - adds r1, r4, 0 - adds r1, 0x3E - ldrb r0, [r1] - ands r0, r7 - strb r0, [r1] - ldrh r0, [r4, 0x38] - lsls r0, 24 - lsrs r1, r0, 24 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0x32 - ldrsh r0, [r6, r2] - adds r0, 0x1 - cmp r5, r0 - blt _081D3604 -_081D3636: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D35E8 - thumb_func_start DrawLevelUpWindowPg1 DrawLevelUpWindowPg1: @ 81D3640 push {r4-r7,lr} diff --git a/include/menu_specialized.h b/include/menu_specialized.h index 90623a888..d29ac5751 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -26,12 +26,6 @@ struct UnknownStruct_81D1ED4 /*0x355*/ u8 unk355; }; -struct Unk81D2F78_Struct -{ - u8 contestStats[4][5]; - struct UnknownSubStruct_81D1ED4 field_20[4][5]; -}; - bool8 sub_81D1C44(u8 count); u8 sub_81D1C84(u8 a0); u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); @@ -44,11 +38,7 @@ void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0); -void sub_81D3520(struct Sprite **); bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0); -void sub_81D354C(struct Sprite **); -void sub_81D3464(struct Sprite **arg0); -void sub_81D3480(struct Sprite **arg0, u8 arg1, u8 arg2); bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0); void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1); void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2); @@ -60,8 +50,8 @@ void InitMoveRelearnerWindows(bool8 useContextWindow); void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); -void sub_81D2F78(struct Unk81D2F78_Struct *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); -void sub_81D3094(u8 *tilesDst, u8 *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); +void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); +void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); bool8 sub_81D312C(s16 *var); bool8 sub_81D3150(s16 *var); bool8 sub_81D3178(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1); @@ -69,5 +59,9 @@ bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1); void sub_81D31D0(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal); void sub_81D321C(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals); void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal); +void sub_81D3464(struct Sprite **sprites); +void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2); +void sub_81D3520(struct Sprite **sprites); +void sub_81D354C(struct Sprite **sprites); #endif // GUARD_MENU_SPECIALIZED_H diff --git a/src/menu_specialized.c b/src/menu_specialized.c index ae150dcb4..f21f4e51a 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -37,6 +37,9 @@ static void sub_81D24A4(struct UnknownStruct_81D1ED4 *a0); static void sub_81D2634(struct UnknownStruct_81D1ED4 *a0); static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list); static void nullsub_79(void); +static void sub_81D3408(struct Sprite *sprite); +/*static*/ void sub_81D3564(struct Sprite *sprite); +static void sub_81D35E8(struct Sprite *sprite); static const struct WindowTemplate sUnknown_086253E8[] = { @@ -1243,7 +1246,7 @@ void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, } } -void sub_81D2F78(struct Unk81D2F78_Struct *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8) +void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8) { u16 i; @@ -1252,30 +1255,30 @@ void sub_81D2F78(struct Unk81D2F78_Struct *arg0, u8 *sheen, u16 boxId, u16 monId if (arg5 != arg7) { - arg0->contestStats[id][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL); - arg0->contestStats[id][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL); - arg0->contestStats[id][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL); - arg0->contestStats[id][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL); - arg0->contestStats[id][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL); + arg0->unk0[id][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL); + arg0->unk0[id][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL); + arg0->unk0[id][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL); + arg0->unk0[id][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL); + arg0->unk0[id][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL); sheen[id] = (GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) != 0xFF) ? GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) / 29u : 9; - sub_81D2754(arg0->contestStats[id], arg0->field_20[id]); + sub_81D2754(arg0->unk0[id], arg0->unk14[id]); } else { for (i = 0; i < 5; i++) { - arg0->contestStats[id][i] = 0; - arg0->field_20[id][i].unk0 = 155; - arg0->field_20[id][i].unk2 = 91; + arg0->unk0[id][i] = 0; + arg0->unk14[id][i].unk0 = 155; + arg0->unk14[id][i].unk2 = 91; } } } -void sub_81D3094(u8 *tilesDst, u8 *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7) +void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7) { if (!arg7) arg6--; @@ -1325,10 +1328,10 @@ bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1) return ((var1 != 0) || (var2 != 0)); } -const u32 gUnknown_08625560[] = INCBIN_U32("graphics/pokenav/pokeball.4bpp"); -const u32 gUnknown_08625660[] = INCBIN_U32("graphics/pokenav/pokeball_placeholder.4bpp"); -const u16 gUnknown_08625680[] = INCBIN_U16("graphics/pokenav/sparkle.gbapal"); -const u32 gUnknown_086256A0[] = INCBIN_U32("graphics/pokenav/sparkle.4bpp"); +static const u32 gUnknown_08625560[] = INCBIN_U32("graphics/pokenav/pokeball.4bpp"); +static const u32 gUnknown_08625660[] = INCBIN_U32("graphics/pokenav/pokeball_placeholder.4bpp"); +static const u16 gUnknown_08625680[] = INCBIN_U16("graphics/pokenav/sparkle.gbapal"); +static const u32 gUnknown_086256A0[] = INCBIN_U32("graphics/pokenav/sparkle.4bpp"); static const struct OamData sOamData_8625A20 = { @@ -1347,7 +1350,7 @@ static const struct OamData sOamData_8625A20 = .affineParam = 0 }; -const struct OamData sOamData_8625A28 = +static const struct OamData sOamData_8625A28 = { .y = 0, .affineMode = 0, @@ -1376,7 +1379,7 @@ static const union AnimCmd sSpriteAnim_8625A38[] = ANIMCMD_END }; -const union AnimCmd *const sSpriteAnimTable_8625A40[] = +static const union AnimCmd *const sSpriteAnimTable_8625A40[] = { sSpriteAnim_8625A30, sSpriteAnim_8625A38 @@ -1451,3 +1454,188 @@ void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal) *sheet = dataSheet; *pal = dataPal; } + +static void sub_81D32D4(struct Sprite *sprite) +{ + if (++sprite->data[1] > 60) + { + sprite->data[1] = 0; + sub_81D3408(sprite); + } +} + +static void sub_81D32F4(struct Sprite *sprite) +{ + if (sprite->animEnded) + { + sprite->data[1] = 0; + sprite->callback = sub_81D32D4; + } +} + +// Todo: Move these variables to C. +extern const s16 gUnknown_08625B2C[][2]; +extern const struct SpriteTemplate gUnknown_08625B14; + +void sub_81D3314(struct Sprite *sprite) +{ + struct Sprite *sprite2 = &gSprites[sprite->data[4]]; + + if (sprite2 != NULL) + { + sprite->pos1.x = sprite2->pos1.x + sprite2->pos2.x + gUnknown_08625B2C[sprite->data[0]][0]; + sprite->pos1.y = sprite2->pos1.y + sprite2->pos2.y + gUnknown_08625B2C[sprite->data[0]][1]; + } + else + { + sprite->pos1.x = gUnknown_08625B2C[sprite->data[0]][0] + 40; + sprite->pos1.y = gUnknown_08625B2C[sprite->data[0]][1] + 104; + } +} + +void sub_81D338C(u8 arg0, u8 arg1, struct Sprite **sprites) +{ + u16 i; + + for (i = 0; i < 10; i++) + { + if (sprites[i] != NULL) + { + sprites[i]->data[0] = i; + sprites[i]->data[1] = (i * 16) + 1; + sprites[i]->data[2] = arg0; + sprites[i]->data[3] = i; + if (arg1 == 0 || arg0 != 9) + { + sprites[i]->callback = sub_81D3564; + } + else + { + sub_81D3314(sprites[i]); + sub_81D35E8(sprites[i]); + sprites[i]->callback = sub_81D32F4; + sprites[i]->invisible = FALSE; + } + } + } +} + +static void sub_81D3408(struct Sprite *sprite) +{ + u16 i; + u8 id = sprite->data[5]; + + for (i = 0; i < sprite->data[2] + 1; i++) + { + gSprites[id].data[1] = (gSprites[id].data[0] * 16) + 1; + gSprites[id].callback = sub_81D3564; + id = gSprites[id].data[5]; + } +} + +void sub_81D3464(struct Sprite **sprites) +{ + u8 i; + + for (i = 0; i < 10; i++) + sprites[i] = NULL; +} + +void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2) +{ + u16 i, spriteId, firstSpriteId = 0; + u8 count = arg2; + + for (i = 0; i < count + 1; i++) + { + spriteId = CreateSprite(&gUnknown_08625B14, 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + sprites[i] = &gSprites[spriteId]; + sprites[i]->invisible = TRUE; + sprites[i]->data[4] = arg1; + if (i != 0) + sprites[i - 1]->data[5] = spriteId; + else + firstSpriteId = spriteId; + } + else + { + break; + } + } + + sprites[count]->data[5] = firstSpriteId; + sub_81D338C(count, 1, sprites); +} + +void sub_81D3520(struct Sprite **sprites) +{ + u16 i; + + for (i = 0; i < 10; i++) + { + if (sprites[i] != NULL) + { + DestroySprite(sprites[i]); + sprites[i] = NULL; + } + else + { + break; + } + } +} + +void sub_81D354C(struct Sprite **sprites) +{ + sub_81D3520(sprites); + FreeSpriteTilesByTag(104); + FreeSpritePaletteByTag(104); +} + +/*static*/ void sub_81D3564(struct Sprite *sprite) +{ + if (sprite->data[1] != 0) + { + if (--sprite->data[1] != 0) + return; + + SeekSpriteAnim(sprite, 0); + sprite->invisible = FALSE; + } + + sub_81D3314(sprite); + if (sprite->animEnded) + { + sprite->invisible = TRUE; + if (sprite->data[3] == sprite->data[2]) + { + if (sprite->data[3] == 9) + { + sub_81D35E8(sprite); + sprite->callback = sub_81D32F4; + } + else + { + sprite->callback = sub_81D32D4; + } + } + else + { + sprite->callback = SpriteCallbackDummy; + } + } +} + +static void sub_81D35E8(struct Sprite *sprite) +{ + u8 i, id = sprite->data[5]; + + for (i = 0; i < sprite->data[2] + 1; i++) + { + SeekSpriteAnim(&gSprites[id], 0); + gSprites[id].invisible = FALSE; + id = gSprites[id].data[5]; + } +} diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index d78132585..6df826214 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -57,11 +57,11 @@ struct Unk7FB8 struct UsePokeblockStruct { - /*0x0000*/ u8 field_0[4]; - /*0x0000*/ u16 field_4[3][0x40]; - /*0x0184*/ u8 field_184[0x304 - 0x184]; + /*0x0000*/ u8 filler0[4]; + /*0x0000*/ u16 field_4[6][0x40]; /*0x0304*/ u8 field_304[3][0x2000]; - /*0x6304*/ u8 field_6304[0x7b06 - 0x6304]; + /*0x6304*/ u8 filler_6304[0x1000]; + /*0x7304*/ u8 tilemapBuffer[BG_SCREEN_SIZE + 2]; /*0x7B06*/ u8 field_7B06[7]; /*0x7B0E*/ s16 field_7B0E; /*0x7B10*/ u8 field_7B10; @@ -71,8 +71,7 @@ struct UsePokeblockStruct /*0x7B1C*/ struct Sprite *field_7B1C[10]; /*0x7B44*/ struct Sprite *field_7B44[2]; /*0x7B4C*/ u8 field_7B4C; - /*0x7B4D*/ u8 filler7B4D[0x47]; - /*0x7B94*/ u8 filler7B94; + /*0x7B4D*/ u8 field_7B4D[3][24]; /*0x7B95*/ u8 field_7B95[3][64]; /*0x7C58*/ struct UnknownStruct_81D1ED4 field_7C58; /*0x7FB0*/ u8 unk7FB0[3]; @@ -119,7 +118,7 @@ void sub_8167338(void); void sub_81681F4(u8); void sub_8166E24(void); bool8 sub_8166EDC(void); -void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statID, s16 a2); +void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statId, s16 a2); void Pokeblock_MenuWindowTextPrint(const u8 *message); void sub_8167184(struct Pokeblock *, struct Pokemon *); void sub_81673DC(struct Sprite *sprite); @@ -712,15 +711,13 @@ void Pokeblock_MenuWindowTextPrint(const u8 *message) AddTextPrinterParameterized(2, 1, gStringVar4, 0, 1, 0, NULL); } +// This function is a joke. #ifdef NONMATCHING -void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statID, s16 a2) +void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statId, s16 a2) { if (a2 != 0) { - if (a2 > 0) - a2 = 0; - - StringCopy(dest, sContestStatNames[statID]); + StringCopy(dest, sContestStatNames[statId]); StringAppend(dest, gText_WasEnhanced); } else @@ -730,7 +727,7 @@ void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statID, s16 a2) } #else NAKED -void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statID, s16 a2) +void Pokeblock_BufferEnhancedStatText(u8 *dest, u8 statId, s16 a2) { asm(".syntax unified\n\ push {r4,lr}\n\ @@ -979,116 +976,17 @@ void sub_81674BC(void) sub_816753C(var2, 2); } -#ifdef NONMATCHING -void sub_816753C(s16 a1, u8 a2) +void sub_816753C(s16 id1, u8 id2) { - u8 *v3; - int v5; - int v6; + u8 boxId = gUnknown_0203BCAC->field_7FB8[id1].unk0; + u8 monId = gUnknown_0203BCAC->field_7FB8[id1].unk1; + u8 r6 = gUnknown_0203BCAC->info.field_70; + bool8 r8 = FALSE; - v3 = &gUnknown_0203BCAC->field_0[a1 << 16 >> 14]; - v5 = *(0x7FB8 + v3); - v6 = *(0x7FB9 + v3); - - sub_81D2ED4(gUnknown_0203BCAC->field_0[0x7B4D + 24 * a2], gUnknown_0203BCAC->field_0[0x7B95 + 64 * a2], v5, v6, a1, gUnknown_0203BCAC->info.field_70, 0); - sub_81D2F78(gUnknown_0203BCAC->field_7C58[0], gUnknown_0203BCAC->field_0[0x7FB0], v5, v6, a1, a2, gUnknown_0203BCAC->info.field_70, 0); - sub_81D3094(gUnknown_0203BCAC->field_0[(a2 << 13) + 0x304], gUnknown_0203BCAC->field_0[(a2 << 7) + 4], v5, v6, a1, gUnknown_0203BCAC->info.field_70, 0); - //gUnknown_0203BCAC->field_0[0x7B4D + a1 * 40], gUnknown_0203BCAC->field_7FB8, gUnknown_0203BCAC->field_7FB9, gUnknown_203BCAC->field_0[0], gUnknown_203BCAC->info.field_70, 0) + sub_81D2ED4(gUnknown_0203BCAC->field_7B4D[id2], gUnknown_0203BCAC->field_7B95[id2], boxId, monId, id1, r6, r8); + sub_81D2F78(&gUnknown_0203BCAC->field_7C58, gUnknown_0203BCAC->unk7FB0, boxId, monId, id1, id2, r6, r8); + sub_81D3094(gUnknown_0203BCAC->field_304[id2], gUnknown_0203BCAC->field_4[id2], boxId, monId, id1, r6, r8); } -#else -NAKED -void sub_816753C(s16 a1, u8 a2) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x10\n\ - adds r5, r0, 0\n\ - adds r4, r1, 0\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - ldr r0, =gUnknown_0203BCAC\n\ - mov r9, r0\n\ - ldr r1, [r0]\n\ - lsls r5, 16\n\ - asrs r0, r5, 14\n\ - adds r0, r1, r0\n\ - ldr r3, =0x00007fb8\n\ - adds r2, r0, r3\n\ - ldrb r7, [r2]\n\ - ldr r2, =0x00007fb9\n\ - adds r0, r2\n\ - ldrb r0, [r0]\n\ - mov r10, r0\n\ - adds r3, 0x88\n\ - adds r0, r1, r3\n\ - ldrb r6, [r0]\n\ - movs r0, 0\n\ - mov r8, r0\n\ - lsls r0, r4, 1\n\ - adds r0, r4\n\ - lsls r0, 3\n\ - ldr r2, =0x00007b4d\n\ - adds r0, r2\n\ - adds r0, r1, r0\n\ - lsls r2, r4, 6\n\ - ldr r3, =0x00007b95\n\ - adds r2, r3\n\ - adds r1, r2\n\ - lsrs r5, 16\n\ - str r5, [sp]\n\ - str r6, [sp, 0x4]\n\ - mov r2, r8\n\ - str r2, [sp, 0x8]\n\ - adds r2, r7, 0\n\ - mov r3, r10\n\ - bl sub_81D2ED4\n\ - mov r3, r9\n\ - ldr r1, [r3]\n\ - ldr r2, =0x00007c58\n\ - adds r0, r1, r2\n\ - ldr r3, =0x00007fb0\n\ - adds r1, r3\n\ - str r5, [sp]\n\ - str r4, [sp, 0x4]\n\ - str r6, [sp, 0x8]\n\ - mov r2, r8\n\ - str r2, [sp, 0xC]\n\ - adds r2, r7, 0\n\ - mov r3, r10\n\ - bl sub_81D2F78\n\ - lsls r0, r4, 13\n\ - movs r1, 0xC1\n\ - lsls r1, 2\n\ - adds r0, r1\n\ - mov r3, r9\n\ - ldr r1, [r3]\n\ - adds r0, r1, r0\n\ - lsls r4, 7\n\ - adds r4, 0x4\n\ - adds r1, r4\n\ - str r5, [sp]\n\ - str r6, [sp, 0x4]\n\ - mov r2, r8\n\ - str r2, [sp, 0x8]\n\ - adds r2, r7, 0\n\ - mov r3, r10\n\ - bl sub_81D3094\n\ - add sp, 0x10\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif void sub_8167608(u8 arg0) { @@ -1242,10 +1140,10 @@ bool8 sub_8167930(void) CopyBgTilemapBufferToVram(1); break; case 10: - LZ77UnCompVram(gUnknown_085DFC0C, &gUnknown_0203BCAC->field_0[0x7304]); + LZ77UnCompVram(gUnknown_085DFC0C, gUnknown_0203BCAC->tilemapBuffer); break; case 11: - LoadBgTilemap(2, &gUnknown_0203BCAC->field_0[0x7304], 1280, 0); + LoadBgTilemap(2, gUnknown_0203BCAC->tilemapBuffer, 1280, 0); LoadPalette(gUnknown_086231E8, 48, 32); LoadPalette(gUnknown_08623208, 240, 32); sub_81D21DC(2); From 500d009b5c52345afce3dfd103113cfa77e7b262 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 31 Mar 2019 09:05:32 -0500 Subject: [PATCH 19/30] Start decompiling berry_crush.c --- asm/berry_crush.s | 1285 ----------------------------------------- data/berry_crush.s | 20 +- include/berry_crush.h | 6 + include/graphics.h | 6 +- include/item_icon.h | 2 +- ld_script.txt | 1 + src/berry_crush.c | 775 +++++++++++++++++++++++++ src/item_icon.c | 2 +- src/union_room.c | 2 +- 9 files changed, 806 insertions(+), 1293 deletions(-) create mode 100755 include/berry_crush.h create mode 100755 src/berry_crush.c diff --git a/asm/berry_crush.s b/asm/berry_crush.s index 9286a9b4f..00bff2b56 100755 --- a/asm/berry_crush.s +++ b/asm/berry_crush.s @@ -5,1291 +5,6 @@ .text - thumb_func_start sub_8020C00 -sub_8020C00: @ 8020C00 - ldr r0, =gUnknown_02022C90 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_8020C00 - - thumb_func_start sub_8020C0C -sub_8020C0C: @ 8020C0C - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_02022C90 - ldr r0, [r5] - cmp r0, 0 - bne _08020C20 - movs r0, 0x2 - b _08020C5C - .pool -_08020C20: - cmp r4, 0 - bne _08020C26 - ldr r4, [r0] -_08020C26: - ldrb r0, [r0, 0xA] - bl DestroyTask - ldr r0, [r5] - bl Free - movs r0, 0 - str r0, [r5] - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =CB2_ReturnToField - cmp r4, r0 - bne _08020C5A - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0xC8 - lsls r0, 1 - bl PlayNewMapMusic - ldr r0, =CB1_Overworld - bl SetMainCallback1 -_08020C5A: - movs r0, 0 -_08020C5C: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8020C0C - - thumb_func_start sub_8020C70 -sub_8020C70: @ 8020C70 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - mov r8, r0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08020C8E - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - bne _08020CAC -_08020C8E: - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gUnknown_03005000 - mov r1, r8 - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - b _08020CF8 - .pool -_08020CAC: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r7, r0, 24 - mov r0, r8 - cmp r0, 0x1 - bls _08020CC8 - cmp r7, r8 - bcc _08020CDC -_08020CC8: - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gUnknown_03005000 - movs r1, 0 - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - b _08020CF8 - .pool -_08020CDC: - ldr r6, =gUnknown_02022C90 - ldr r0, =0x000041c0 - bl AllocZeroed - adds r5, r0, 0 - str r5, [r6] - cmp r5, 0 - bne _08020D10 - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gUnknown_03005000 - strh r5, [r0, 0x10] - strh r5, [r0, 0x12] -_08020CF8: - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] - b _08020D74 - .pool -_08020D10: - str r4, [r5] - movs r4, 0 - strb r7, [r5, 0x8] - ldr r0, [r6] - mov r1, r8 - strb r1, [r0, 0x9] - ldr r0, [r6] - bl sub_8020FC4 - ldr r1, [r6] - movs r2, 0x1 - movs r0, 0x1 - strh r0, [r1, 0x12] - strb r2, [r1, 0xE] - ldr r1, [r6] - movs r0, 0x6 - strb r0, [r1, 0xF] - ldr r0, [r6] - adds r0, 0x36 - movs r2, 0x1 - negs r2, r2 - movs r1, 0x10 - str r1, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl sub_8024604 - ldr r2, [r6] - adds r2, 0x36 - movs r0, 0x4 - movs r1, 0x1 - bl sub_8022BEC - ldr r0, =sub_8020F88 - bl SetMainCallback2 - ldr r0, =sub_8020FA0 - movs r1, 0x8 - bl CreateTask - ldr r1, [r6] - strb r0, [r1, 0xA] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_08020D74: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020C70 - - thumb_func_start sub_8020D8C -sub_8020D8C: @ 8020D8C - push {r4,lr} - sub sp, 0xC - ldr r1, =gSpecialVar_ItemId - ldrh r0, [r1] - subs r0, 0x85 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2B - bls _08020DA8 - movs r0, 0x85 - strh r0, [r1] - b _08020DB0 - .pool -_08020DA8: - ldrh r0, [r1] - movs r1, 0x1 - bl RemoveBagItem -_08020DB0: - ldr r4, =gUnknown_02022C90 - ldr r2, [r4] - ldrb r0, [r2, 0x8] - lsls r0, 5 - adds r0, r2, r0 - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - subs r1, 0x85 - adds r0, 0xA4 - movs r3, 0 - strh r1, [r0] - movs r0, 0x1 - strb r0, [r2, 0xE] - ldr r1, [r4] - movs r0, 0x9 - strb r0, [r1, 0xF] - ldr r0, [r4] - adds r0, 0x36 - movs r2, 0x1 - negs r2, r2 - movs r1, 0x10 - str r1, [sp] - str r3, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0 - bl sub_8024604 - ldr r2, [r4] - adds r2, 0x36 - movs r0, 0x4 - movs r1, 0x1 - bl sub_8022BEC - ldr r0, =sub_8020FA0 - movs r1, 0x8 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0xA] - ldr r0, =sub_8020F88 - bl SetMainCallback2 - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020D8C - - thumb_func_start sub_8020E1C -sub_8020E1C: @ 8020E1C - push {lr} - ldr r0, =gUnknown_02022C90 - ldr r0, [r0] - ldrb r0, [r0, 0xA] - bl DestroyTask - ldr r0, =sub_8020D8C - bl sub_81AABF0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020E1C - - thumb_func_start sub_8020E3C -sub_8020E3C: @ 8020E3C - push {lr} - ldr r0, =sub_8020F74 - bl SetVBlankCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020E3C - - thumb_func_start sub_8020E4C -sub_8020E4C: @ 8020E4C - push {lr} - movs r0, 0 - bl SetVBlankCallback - pop {r0} - bx r0 - thumb_func_end sub_8020E4C - - thumb_func_start sub_8020E58 -sub_8020E58: @ 8020E58 - push {r4-r6,lr} - ldr r4, =gUnknown_02022C90 - ldr r0, [r4] - adds r0, 0x6C - ldrh r2, [r0] - lsls r2, 8 - movs r1, 0xF0 - lsls r1, 6 - adds r0, r2, 0 - bl sub_81515FC - adds r2, r0, 0 - ldr r0, [r4] - adds r0, 0x72 - ldrh r3, [r0] - lsls r3, 8 - adds r0, r3, 0 - adds r1, r2, 0 - bl sub_81515FC - adds r3, r0, 0 - ldr r0, =0x0000ffff - ands r3, r0 - ldr r2, [r4] - strh r3, [r2, 0x16] - ldrb r0, [r2, 0x9] - cmp r0, 0x3 - beq _08020EDC - cmp r0, 0x3 - bgt _08020EA4 - cmp r0, 0x2 - beq _08020EAE - b _08020F48 - .pool -_08020EA4: - cmp r0, 0x4 - beq _08020EEC - cmp r0, 0x5 - beq _08020F20 - b _08020F48 -_08020EAE: - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - movs r0, 0xF6 - lsls r0, 1 - adds r1, r0 - lsls r0, r3, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bls _08020F48 - adds r2, 0x25 - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r5] - ldr r1, [r4] - ldrh r1, [r1, 0x16] - movs r2, 0xF6 - lsls r2, 1 - b _08020F14 - .pool -_08020EDC: - ldr r5, =gSaveBlock2Ptr - ldr r0, [r5] - movs r6, 0xF7 - lsls r6, 1 - b _08020F28 - .pool -_08020EEC: - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - movs r0, 0xF8 - lsls r0, 1 - adds r1, r0 - lsls r0, r3, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bls _08020F48 - adds r2, 0x25 - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r5] - ldr r1, [r4] - ldrh r1, [r1, 0x16] - movs r2, 0xF8 - lsls r2, 1 -_08020F14: - adds r0, r2 - strh r1, [r0] - b _08020F48 - .pool -_08020F20: - ldr r5, =gSaveBlock2Ptr - ldr r0, [r5] - movs r6, 0xF9 - lsls r6, 1 -_08020F28: - adds r1, r0, r6 - lsls r0, r3, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bls _08020F48 - adds r2, 0x25 - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r1, [r5] - ldr r0, [r4] - ldrh r0, [r0, 0x16] - adds r1, r6 - strh r0, [r1] -_08020F48: - ldr r4, =gUnknown_02022C90 - ldr r1, [r4] - ldr r0, [r1, 0x68] - str r0, [r1, 0x1C] - bl GiveBerryPowder - lsls r0, 24 - cmp r0, 0 - bne _08020F66 - ldr r0, [r4] - adds r0, 0x25 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] -_08020F66: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020E58 - - thumb_func_start sub_8020F74 -sub_8020F74: @ 8020F74 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - pop {r0} - bx r0 - thumb_func_end sub_8020F74 - - thumb_func_start sub_8020F88 -sub_8020F88: @ 8020F88 - push {lr} - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r0} - bx r0 - thumb_func_end sub_8020F88 - - thumb_func_start sub_8020FA0 -sub_8020FA0: @ 8020FA0 - push {r4,lr} - ldr r4, =gUnknown_02022C90 - ldr r0, [r4] - ldr r2, [r0, 0x4] - cmp r2, 0 - beq _08020FB4 - adds r1, r0, 0 - adds r1, 0x36 - bl _call_via_r2 -_08020FB4: - ldr r0, [r4] - bl sub_8021450 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020FA0 - - thumb_func_start sub_8020FC4 -sub_8020FC4: @ 8020FC4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - b _08020FE6 -_08020FCC: - lsls r0, r5, 5 - adds r0, 0x98 - adds r0, r6, r0 - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - ldr r2, =gLinkPlayers + 8 - adds r1, r2 - bl StringCopy - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08020FE6: - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcc _08020FCC - cmp r5, 0x4 - bhi _08021012 -_08020FF0: - lsls r4, r5, 5 - adds r0, r4, 0 - adds r0, 0x98 - adds r0, r6, r0 - movs r1, 0x1 - movs r2, 0x7 - bl memset - adds r4, r6, r4 - adds r4, 0x9F - movs r0, 0xFF - strb r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _08020FF0 -_08021012: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsls r0, 29 - lsrs r0, 29 - cmp r0, 0x1 - beq _0802103E - cmp r0, 0x1 - bgt _08021034 - cmp r0, 0 - beq _0802103A - b _08021046 - .pool -_08021034: - cmp r0, 0x2 - beq _08021042 - b _08021046 -_0802103A: - movs r0, 0x8 - b _08021044 -_0802103E: - movs r0, 0x4 - b _08021044 -_08021042: - movs r0, 0x1 -_08021044: - strb r0, [r6, 0xB] -_08021046: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8020FC4 - - thumb_func_start sub_802104C -sub_802104C: @ 802104C - push {r4,r5,lr} - sub sp, 0xC - bl sub_8020C00 - adds r5, r0, 0 - cmp r5, 0 - bne _08021060 - movs r0, 0x1 - negs r0, r0 - b _08021304 -_08021060: - ldrb r0, [r5, 0xC] - cmp r0, 0x9 - bls _08021068 - b _080212FC -_08021068: - lsls r0, 2 - ldr r1, =_08021078 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08021078: - .4byte _080210A0 - .4byte _080210BE - .4byte _080210E4 - .4byte _080210F2 - .4byte _08021178 - .4byte _080211BE - .4byte _080211EC - .4byte _0802121C - .4byte _08021278 - .4byte _080212B4 -_080210A0: - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - movs r1, 0 - bl SetGpuReg - bl ScanlineEffect_Stop - bl reset_temp_tile_data_buffers - b _080212FC -_080210BE: - add r0, sp, 0x8 - movs r4, 0 - strh r4, [r0] - movs r1, 0xE0 - lsls r1, 19 - ldr r2, =0x01000200 - bl CpuSet - ldr r0, =gReservedSpritePaletteCount - strb r4, [r0] - movs r0, 0x3 - bl sub_8034C54 - b _080212FC - .pool -_080210E4: - bl ResetPaletteFade - bl ResetSpriteData - bl FreeAllSpritePalettes - b _080212FC -_080210F2: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F32C8 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0xE0 - lsls r0, 1 - adds r1, r5, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - movs r0, 0x87 - lsls r0, 6 - adds r1, r5, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r0, 0xC7 - lsls r0, 6 - adds r1, r5, r0 - movs r0, 0x3 - bl SetBgTilemapBuffer - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - b _080212FC - .pool -_08021178: - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - movs r0, 0x40 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - b _080212FC -_080211BE: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r1, =gUnknown_08DE34B8 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _080212FC - .pool -_080211EC: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _080211F8 - b _08021302 -_080211F8: - bl InitStandardTextBoxWindows - bl sub_8197200 - adds r0, r5, 0 - bl sub_8022588 - adds r0, r5, 0 - bl sub_8022600 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x8] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x8] - b _080212FC - .pool -_0802121C: - ldr r0, =gUnknown_08DE3398 - movs r2, 0xC0 - lsls r2, 1 - movs r1, 0 - bl LoadPalette - ldr r1, =gBerryCrushGrinderTopTilemap - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gBerryCrushContainerCapTilemap - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gBerryCrushBackgroundTilemap - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - adds r0, r5, 0 - bl sub_80226D0 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _080212FC - .pool -_08021278: - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl CreateWirelessStatusIndicatorSprite - adds r0, r5, 0 - bl sub_8022730 - ldr r0, =gSpriteCoordOffsetY - ldrh r1, [r0] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x16 - bl SetGpuReg - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - b _080212FC - .pool -_080212B4: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuRegBits - bl sub_8020E3C - movs r0, 0 - strb r0, [r5, 0xC] - movs r0, 0x1 - b _08021304 - .pool -_080212FC: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_08021302: - movs r0, 0 -_08021304: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802104C - - thumb_func_start sub_802130C -sub_802130C: @ 802130C - push {r4,r5,lr} - sub sp, 0x8 - bl sub_8020C00 - adds r5, r0, 0 - cmp r5, 0 - bne _08021320 - movs r0, 0x1 - negs r0, r0 - b _08021446 -_08021320: - ldrb r0, [r5, 0xC] - cmp r0, 0x7 - bls _08021328 - b _0802143E -_08021328: - lsls r0, 2 - ldr r1, =_08021338 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08021338: - .4byte _08021358 - .4byte _0802135E - .4byte _08021368 - .4byte _0802137E - .4byte _0802138A - .4byte _080213E6 - .4byte _08021426 - .4byte _08021436 -_08021358: - bl sub_8010434 - b _0802143E -_0802135E: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _08021444 -_08021368: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _0802143E -_0802137E: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0802143E - b _08021444 -_0802138A: - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _0802143E -_080213E6: - bl FreeAllWindowBuffers - movs r0, 0 - bl HideBg - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl HideBg - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0x2 - bl HideBg - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0x3 - bl HideBg - movs r0, 0x3 - bl UnsetBgTilemapBuffer - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl ClearGpuRegBits - b _0802143E -_08021426: - bl sub_800E084 - adds r0, r5, 0 - bl sub_8022960 - bl sub_8034CC8 - b _0802143E -_08021436: - movs r0, 0 - strb r0, [r5, 0xC] - movs r0, 0x1 - b _08021446 -_0802143E: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_08021444: - movs r0, 0 -_08021446: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802130C - - thumb_func_start sub_8021450 -sub_8021450: @ 8021450 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gSpriteCoordOffsetY - ldrh r1, [r4, 0x2C] - ldrh r2, [r4, 0x2A] - adds r1, r2 - strh r1, [r0] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x16 - bl SetGpuReg - ldrh r0, [r4, 0x12] - cmp r0, 0x7 - bne _0802147C - movs r1, 0x9C - lsls r1, 1 - adds r0, r4, r1 - ldrh r1, [r4, 0x28] - bl sub_8022524 -_0802147C: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8021450 - - thumb_func_start sub_8021488 -sub_8021488: @ 8021488 - movs r1, 0 - ldr r2, =0x0000ff98 - strh r2, [r0, 0x2A] - strh r1, [r0, 0x2C] - ldr r0, =gSpriteCoordOffsetX - strh r1, [r0] - ldr r0, =gSpriteCoordOffsetY - strh r2, [r0] - bx lr - .pool - thumb_func_end sub_8021488 - - thumb_func_start sub_80214A8 -sub_80214A8: @ 80214A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r10, r0 - str r1, [sp] - movs r0, 0 - mov r9, r0 - mov r1, r10 - ldrb r1, [r1, 0x9] - cmp r9, r1 - bcc _080214C6 - b _080215E4 -_080214C6: - ldr r1, =gUnknown_082F41E8 - mov r2, r9 - lsls r0, r2, 1 - adds r0, r1 - ldrh r2, [r0] - mov r1, r9 - lsls r0, r1, 5 - add r0, r10 - adds r0, 0xA4 - ldrh r3, [r0] - adds r3, 0x85 - lsls r3, 16 - lsrs r3, 16 - ldr r0, =gUnknown_082F436C - adds r1, r2, 0 - bl AddCustomItemIconSprite - lsls r0, 24 - lsrs r0, 24 - mov r2, r9 - lsls r3, r2, 2 - ldr r1, [sp] - adds r1, 0x38 - adds r6, r1, r3 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r6] - ldrb r0, [r1, 0x5] - movs r2, 0xC - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r2, [r6] - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldr r1, [r6] - ldr r0, [sp] - adds r0, 0xC - adds r0, r3 - mov r8, r0 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - adds r0, 0x78 - strh r0, [r1, 0x20] - ldr r1, [r6] - ldr r0, =0x0000fff0 - strh r0, [r1, 0x22] - ldr r3, [r6] - adds r5, r3, 0 - adds r5, 0x2E - movs r0, 0x80 - lsls r0, 2 - strh r0, [r5, 0x2] - movs r0, 0x20 - strh r0, [r5, 0x4] - movs r0, 0x70 - strh r0, [r5, 0xE] - mov r2, r8 - ldr r1, [r2] - ldrh r0, [r1, 0xA] - ldrh r1, [r1, 0x8] - subs r0, r1 - lsls r0, 16 - asrs r1, r0, 16 - adds r0, r1, 0 - cmp r1, 0 - bge _08021558 - adds r0, r1, 0x3 -_08021558: - asrs r0, 2 - strh r0, [r5, 0xC] - lsls r0, r1, 23 - lsrs r7, r0, 16 - movs r2, 0x80 - lsls r2, 2 - adds r2, 0x20 - lsrs r2, 1 - movs r0, 0x7 - movs r1, 0xFE - lsls r1, 6 - str r3, [sp, 0x4] - bl sub_81515D4 - adds r4, r0, 0 - ldr r0, [r6] - ldrh r0, [r0, 0x20] - lsls r0, 7 - ldr r3, [sp, 0x4] - strh r0, [r3, 0x2E] - lsls r1, r7, 16 - asrs r1, 16 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x7 - adds r2, r4, 0 - bl sub_81515D4 - strh r0, [r5, 0x6] - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x55 - bl sub_8151550 - adds r2, r0, 0 - movs r0, 0 - strh r0, [r5, 0x8] - lsls r2, 16 - asrs r2, 16 - movs r0, 0x7 - movs r1, 0xFE - lsls r1, 6 - bl sub_81515D4 - strh r0, [r5, 0xA] - ldrh r0, [r5, 0xE] - ldr r2, =0xffff8000 - adds r1, r2, 0 - orrs r0, r1 - strh r0, [r5, 0xE] - mov r1, r8 - ldr r0, [r1] - movs r2, 0x8 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _080215D0 - ldr r0, [r6] - movs r1, 0x1 - bl StartSpriteAffineAnim -_080215D0: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r0, r10 - ldrb r0, [r0, 0x9] - cmp r9, r0 - bcs _080215E4 - b _080214C6 -_080215E4: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80214A8 - - thumb_func_start sub_8021608 -sub_8021608: @ 8021608 - push {r4-r6,lr} - adds r5, r0, 0 - adds r4, r5, 0 - adds r4, 0x2E - ldrh r0, [r4, 0x4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 24 - ldrh r2, [r5, 0x26] - adds r0, r2 - strh r0, [r5, 0x26] - movs r1, 0xE - ldrsh r0, [r4, r1] - movs r6, 0x80 - lsls r6, 8 - ands r0, r6 - cmp r0, 0 - beq _0802166E - ldrh r0, [r4, 0x6] - ldrh r2, [r5, 0x2E] - adds r0, r2 - strh r0, [r5, 0x2E] - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 23 - movs r2, 0xC - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r5, 0x24] - movs r1, 0xE - ldrsh r0, [r4, r1] - ands r0, r6 - cmp r0, 0 - beq _0802166E - ldrh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 23 - cmp r0, 0x7E - ble _0802166E - movs r0, 0 - strh r0, [r5, 0x24] - ldrh r1, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xE] -_0802166E: - ldrh r0, [r4] - lsls r0, 16 - asrs r0, 23 - strh r0, [r5, 0x20] - movs r2, 0x22 - ldrsh r1, [r5, r2] - movs r2, 0x26 - ldrsh r0, [r5, r2] - adds r1, r0 - ldrh r2, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r2 - cmp r1, r0 - blt _0802169A - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] - adds r0, r5, 0 - bl FreeSpriteOamMatrix - adds r0, r5, 0 - bl DestroySprite -_0802169A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8021608 - - thumb_func_start sub_80216A8 -sub_80216A8: @ 80216A8 - push {r4-r7,lr} - adds r6, r0, 0 - movs r5, 0 - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcs _080216D4 - ldr r7, =gUnknown_082F41E8 -_080216B6: - lsls r0, r5, 1 - adds r0, r7 - ldrh r4, [r0] - adds r0, r4, 0 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcc _080216B6 -_080216D4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80216A8 - thumb_func_start sub_80216E0 sub_80216E0: @ 80216E0 push {r4-r7,lr} diff --git a/data/berry_crush.s b/data/berry_crush.s index 4e3c77292..6535cd558 100755 --- a/data/berry_crush.s +++ b/data/berry_crush.s @@ -151,10 +151,22 @@ gUnknown_082F4190:: @ 82F4190 .align 2 gUnknown_082F41CC:: @ 82F41CC - .byte 0x00, 0x00, 0xff, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0xf0, 0xfc, 0x10, 0xfc, 0xf8, 0xfe, 0x08, 0xfe - .byte 0xe8, 0xf8, 0x18, 0xf8, 0xe0, 0xf4, 0x20, 0xf4 - .byte 0xd8, 0xf0, 0x28, 0xf0 + .byte 0x00, 0x00 + .byte 0xff, 0x00 + .byte 0x01, 0x01 + +gUnknown_082F41D2:: + .byte 0x00, 0x00 + .byte 0xf0, 0xfc + .byte 0x10, 0xfc + .byte 0xf8, 0xfe + .byte 0x08, 0xfe + .byte 0xe8, 0xf8 + .byte 0x18, 0xf8 + .byte 0xe0, 0xf4 + .byte 0x20, 0xf4 + .byte 0xd8, 0xf0 + .byte 0x28, 0xf0 .align 2 gUnknown_082F41E8:: @ 82F41E8 diff --git a/include/berry_crush.h b/include/berry_crush.h new file mode 100755 index 000000000..101450a33 --- /dev/null +++ b/include/berry_crush.h @@ -0,0 +1,6 @@ +#ifndef GUARD_BERRY_CRUSH_H +#define GUARD_BERRY_CRUSH_H + +void sub_8020C70(MainCallback callback); + +#endif // GUARD_BERRY_CRUSH_H diff --git a/include/graphics.h b/include/graphics.h index 7833d4f7d..e6d6ae350 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4917,8 +4917,12 @@ extern const u16 gLinkMiscMenu_Pal[]; extern const u32 gLinkMiscMenu_Gfx[]; extern const u32 gLinkMiscMenu_Tilemap[]; -// Pokeblock +// Use Pokeblock extern const u8 gPokenavConditionCancel_Gfx[]; extern const u16 gPokenavConditionCancel_Pal[]; +// Berry Crush +extern const u32 gUnknown_08DE34B8[]; +extern const u16 gUnknown_08DE3398[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/item_icon.h b/include/item_icon.h index b702b2045..af03473fb 100644 --- a/include/item_icon.h +++ b/include/item_icon.h @@ -10,7 +10,7 @@ bool8 AllocItemIconTemporaryBuffers(void); void FreeItemIconTemporaryBuffers(void); void CopyItemIconPicTo4x4Buffer(const void *src, void *dest); u8 AddItemIconSprite(u16 tilesTag, u16 paletteTag, u16 itemId); -u8 AddCustomItemIconSprite(struct SpriteTemplate *customSpriteTemplate, u16 tilesTag, u16 paletteTag, u16 itemId); +u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u16 tilesTag, u16 paletteTag, u16 itemId); const void *GetItemIconPicOrPalette(u16 itemId, u8 which); #endif //GUARD_ITEM_ICON_H diff --git a/ld_script.txt b/ld_script.txt index f1ed87a04..97eb046b9 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -63,6 +63,7 @@ SECTIONS { asm/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); + src/berry_crush.o(.text); asm/berry_crush.o(.text); src/berry_powder.o(.text); asm/dodrio_berry_picking.o(.text); diff --git a/src/berry_crush.c b/src/berry_crush.c new file mode 100755 index 000000000..dc4c546b0 --- /dev/null +++ b/src/berry_crush.c @@ -0,0 +1,775 @@ +#include "global.h" +#include "alloc.h" +#include "berry_powder.h" +#include "bg.h" +#include "event_data.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "item_icon.h" +#include "item_menu.h" +#include "link.h" +#include "link_rfu.h" +#include "main.h" +#include "math_util.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "rom_8034C54.h" +#include "scanline_effect.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "task.h" +#include "text.h" +#include "trig.h" +#include "window.h" +#include "constants/items.h" +#include "constants/rgb.h" +#include "constants/songs.h" + +struct BerryCrushGame_Player +{ + u16 unk0; + u8 filler2[0x12]; + u8 unk14[0xC]; +}; + +struct BerryCrushGame_PlayersSeparate +{ + struct BerryCrushGame_Player player; + struct BerryCrushGame_Player others[4]; +}; + +typedef union BerryCrushGame_Players +{ + struct BerryCrushGame_Player players[5]; + struct BerryCrushGame_PlayersSeparate separate; +} BerryCrushGame_Players; + +struct BerryCrushGame_138_C +{ + u8 filler0[0x8]; + s16 unk8; + u16 unkA; +}; + +struct BerryCrushGame_138 +{ + u8 filler0[0xC]; + struct BerryCrushGame_138_C *unkC[5]; + u8 filler1C[0x4]; + struct Sprite *unk24[5]; + struct Sprite *unk38[5]; + struct Sprite *unk4C[5]; + struct Sprite *unk60[5]; + struct Sprite *unk74[5]; +}; + +struct BerryCrushGame_4E +{ + u8 filler0[0x4]; + u8 unk4; + u8 filler5[0x5]; + u16 unkA; + u16 unkC; +}; + +struct __attribute__((packed)) BerryCrushGame_40 +{ + u8 filler0[0xE]; + struct BerryCrushGame_4E unkE; +}; + +struct BerryCrushGame +{ + MainCallback unk0; + void (* unk4)(struct BerryCrushGame *, u8 *); + u8 unk8; + u8 unk9; + u8 unkA; + u8 unkB; + u8 unkC; + u8 fillerD[0x1]; + u8 unkE; + u8 unkF; + u8 filler10[0x2]; + u16 unk12; + u8 filler14[0x2]; + u16 unk16; + u8 filler18[0x4]; + int unk1C; + u8 filler20[0x5]; + u8 unk25_0:1; + u8 unk25_1:1; + u8 unk25_2:1; + u8 filler26[0x2]; + u16 unk28; + u16 unk2A; + u16 unk2C; + u8 filler2E[0x8]; + u8 unk36[0xA]; + struct BerryCrushGame_40 unk40; + u8 filler60[0x8]; + int unk68; + u16 unk6C; + u8 filler6E[0x4]; + u16 unk72; + u8 filler74[0x10]; + BerryCrushGame_Players unk84; + u8 filler124[0x14]; + struct BerryCrushGame_138 unk138; + u8 unk1C0[0x1000]; + u8 unk11C0[0x1000]; + u8 unk21C0[0x1000]; + u8 unk31C0[0x1000]; +}; + +static void sub_8020F74(void); +static void sub_8020F88(void); +static void sub_8020FA0(u8); +void sub_8020FC4(struct BerryCrushGame *); +void sub_8022BEC(u16, u8, u8 *); +void sub_8024604(u8 *, u8, s8, u8, u8, u8, u8); +static int sub_8021450(struct BerryCrushGame *); +void sub_8022588(struct BerryCrushGame *); +void sub_8022600(struct BerryCrushGame *); +void sub_80226D0(struct BerryCrushGame *); +void sub_8022730(struct BerryCrushGame *); +void sub_8022960(struct BerryCrushGame *); +void sub_8022524(struct BerryCrushGame_138 *, u16); +void sub_8022B28(struct Sprite *); + +extern struct BerryCrushGame *gUnknown_02022C90; + +extern const struct BgTemplate gUnknown_082F32C8[4]; +extern const u8 gBerryCrushGrinderTopTilemap[]; +extern const u8 gBerryCrushContainerCapTilemap[]; +extern const u8 gBerryCrushBackgroundTilemap[]; +extern const struct SpriteTemplate gUnknown_082F436C; +extern const u16 gUnknown_082F41E8[]; +extern const s8 gUnknown_082F41CC[][2]; +extern const s8 gUnknown_082F41D2[][2]; + +struct BerryCrushGame *sub_8020C00(void) +{ + return gUnknown_02022C90; +} + +int sub_8020C0C(MainCallback callback) +{ + if (!gUnknown_02022C90) + return 2; + + if (!callback) + callback = gUnknown_02022C90->unk0; + + DestroyTask(gUnknown_02022C90->unkA); + FREE_AND_SET_NULL(gUnknown_02022C90); + SetMainCallback2(callback); + if (callback == CB2_ReturnToField) + { + gTextFlags.autoScroll = 1; + PlayNewMapMusic(MUS_POKECEN); + SetMainCallback1(CB1_Overworld); + } + + return 0; +} + +void sub_8020C70(MainCallback callback) +{ + u8 playerCount = 0; + u8 multiplayerId; + + if (!gReceivedRemoteLinkPlayers || gWirelessCommType == 0) + { + SetMainCallback2(callback); + gUnknown_03005000.unk_10 = 0; + gUnknown_03005000.unk_12 = 0; + gUnknown_03005000.unk_ee = 1; + return; + } + + playerCount = GetLinkPlayerCount(); + multiplayerId = GetMultiplayerId(); + if (playerCount < 2 || multiplayerId >= playerCount) + { + SetMainCallback2(callback); + gUnknown_03005000.unk_10 = 0; + gUnknown_03005000.unk_12 = 0; + gUnknown_03005000.unk_ee = 1; + return; + } + + gUnknown_02022C90 = AllocZeroed(sizeof(*gUnknown_02022C90)); + if (!gUnknown_02022C90) + { + SetMainCallback2(callback); + gUnknown_03005000.unk_10 = 0; + gUnknown_03005000.unk_12 = 0; + gUnknown_03005000.unk_ee = 1; + return; + } + + gUnknown_02022C90->unk0 = callback; + gUnknown_02022C90->unk8 = multiplayerId; + gUnknown_02022C90->unk9 = playerCount; + sub_8020FC4(gUnknown_02022C90); + gUnknown_02022C90->unk12 = 1; + gUnknown_02022C90->unkE = 1; + gUnknown_02022C90->unkF = 6; + sub_8024604(gUnknown_02022C90->unk36, 1, -1, 0, 16, 0, 0); + sub_8022BEC(4, 1, gUnknown_02022C90->unk36); + SetMainCallback2(sub_8020F88); + gUnknown_02022C90->unkA = CreateTask(sub_8020FA0, 8); + gTextFlags.autoScroll = 0; +} + +static void sub_8020D8C(void) +{ + if (gSpecialVar_ItemId < FIRST_BERRY_INDEX || gSpecialVar_ItemId > LAST_BERRY_INDEX + 1) + gSpecialVar_ItemId = ITEM_CHERI_BERRY; + else + RemoveBagItem(gSpecialVar_ItemId, 1); + + gUnknown_02022C90->unk84.separate.others[gUnknown_02022C90->unk8].unk0 = gSpecialVar_ItemId - FIRST_BERRY_INDEX; + gUnknown_02022C90->unkE = 1; + gUnknown_02022C90->unkF = 9; + sub_8024604(gUnknown_02022C90->unk36, 0, -1, 0, 16, 0, 0); + sub_8022BEC(4, 1, gUnknown_02022C90->unk36); + gUnknown_02022C90->unkA = CreateTask(sub_8020FA0, 8); + SetMainCallback2(sub_8020F88); +} + +void sub_8020E1C(void) +{ + DestroyTask(gUnknown_02022C90->unkA); + sub_81AABF0(sub_8020D8C); +} + +static void sub_8020E3C(void) +{ + SetVBlankCallback(sub_8020F74); +} + +void sub_8020E4C(void) +{ + SetVBlankCallback(NULL); +} + +void sub_8020E58(void) +{ + u32 var0, var1; + + var0 = gUnknown_02022C90->unk6C; + var0 <<= 8; + var0 = sub_81515FC(var0, 60 << 8); + var1 = gUnknown_02022C90->unk72; + var1 <<= 8; + var1 = sub_81515FC(var1, var0) & 0xFFFF; + gUnknown_02022C90->unk16 = var1; + switch (gUnknown_02022C90->unk9) + { + case 2: + if (gUnknown_02022C90->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[0]) + { + gUnknown_02022C90->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[0] = gUnknown_02022C90->unk16; + } + break; + case 3: + if (gUnknown_02022C90->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[1]) + { + gUnknown_02022C90->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[1] = gUnknown_02022C90->unk16; + } + break; + case 4: + if (gUnknown_02022C90->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[2]) + { + gUnknown_02022C90->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[2] = gUnknown_02022C90->unk16; + } + break; + case 5: + if (gUnknown_02022C90->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[3]) + { + gUnknown_02022C90->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[3] = gUnknown_02022C90->unk16; + } + break; + } + + gUnknown_02022C90->unk1C = gUnknown_02022C90->unk68; + if (GiveBerryPowder(gUnknown_02022C90->unk1C)) + return; + + gUnknown_02022C90->unk25_0 = 1; +} + +static void sub_8020F74(void) +{ + TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); +} + +static void sub_8020F88(void) +{ + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); +} + +static void sub_8020FA0(u8 taskId) +{ + if (gUnknown_02022C90->unk4) + gUnknown_02022C90->unk4(gUnknown_02022C90, gUnknown_02022C90->unk36); + + sub_8021450(gUnknown_02022C90); +} + +#ifdef NONMATCHING +void sub_8020FC4(struct BerryCrushGame *arg0) +{ + u8 i; + + for (i = 0; i < arg0->unk9; i++) + StringCopy(arg0->unk84.players[i].unk14, gLinkPlayers[i].name); + + for (; i < 5; i++) + { + memset(arg0->unk84.players[i].unk14, 1, PLAYER_NAME_LENGTH); + arg0->unk84.players[i].unk14[PLAYER_NAME_LENGTH] = EOS; + } + + switch (gSaveBlock2Ptr->optionsTextSpeed) + { + case OPTIONS_TEXT_SPEED_SLOW: + arg0->unkB = 8; + break; + case OPTIONS_TEXT_SPEED_MID: + arg0->unkB = 4; + break; + case OPTIONS_TEXT_SPEED_FAST: + arg0->unkB = 1; + break; + } +} +#else +NAKED +void sub_8020FC4(struct BerryCrushGame *arg0) +{ + asm_unified("\n\ + push {r4-r6,lr}\n\ + adds r6, r0, 0\n\ + movs r5, 0\n\ + b _08020FE6\n\ +LOOP_1:\n\ + lsls r0, r5, 5\n\ + adds r0, 0x98\n\ + adds r0, r6, r0\n\ + lsls r1, r5, 3\n\ + subs r1, r5\n\ + lsls r1, 2\n\ + ldr r2, =gLinkPlayers + 8\n\ + adds r1, r2\n\ + bl StringCopy\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ +_08020FE6:\n\ + ldrb r0, [r6, 0x9]\n\ + cmp r5, r0\n\ + bcc LOOP_1\n\ + cmp r5, 0x4\n\ + bhi _08021012\n\ +_08020FF0:\n\ + lsls r4, r5, 5\n\ + adds r0, r4, 0\n\ + adds r0, 0x98\n\ + adds r0, r6, r0\n\ + movs r1, 0x1\n\ + movs r2, 0x7\n\ + bl memset\n\ + adds r4, r6, r4\n\ + adds r4, 0x9F\n\ + movs r0, 0xFF\n\ + strb r0, [r4]\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x4\n\ + bls _08020FF0\n\ +_08021012:\n\ + ldr r0, =gSaveBlock2Ptr\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x14]\n\ + lsls r0, 29\n\ + lsrs r0, 29\n\ + cmp r0, 0x1\n\ + beq _0802103E\n\ + cmp r0, 0x1\n\ + bgt _08021034\n\ + cmp r0, 0\n\ + beq _0802103A\n\ + b _08021046\n\ + .pool\n\ +_08021034:\n\ + cmp r0, 0x2\n\ + beq _08021042\n\ + b _08021046\n\ +_0802103A:\n\ + movs r0, 0x8\n\ + b _08021044\n\ +_0802103E:\n\ + movs r0, 0x4\n\ + b _08021044\n\ +_08021042:\n\ + movs r0, 0x1\n\ +_08021044:\n\ + strb r0, [r6, 0xB]\n\ +_08021046:\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0"); +} +#endif // NONMATCHING + +int sub_802104C(void) +{ + struct BerryCrushGame *var0 = sub_8020C00(); + if (!var0) + return -1; + + switch (var0->unkC) + { + case 0: + SetVBlankCallback(NULL); + SetHBlankCallback(NULL); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ScanlineEffect_Stop(); + reset_temp_tile_data_buffers(); + break; + case 1: + CpuFill16(0, (void *)OAM, OAM_SIZE); + gReservedSpritePaletteCount = 0; + sub_8034C54(3); + break; + case 2: + ResetPaletteFade(); + ResetSpriteData(); + FreeAllSpritePalettes(); + break; + case 3: + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082F32C8, ARRAY_COUNT(gUnknown_082F32C8)); + SetBgTilemapBuffer(1, var0->unk1C0); + SetBgTilemapBuffer(2, var0->unk21C0); + SetBgTilemapBuffer(3, var0->unk31C0); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + break; + case 4: + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 64); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 32, 32); + break; + case 5: + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + decompress_and_copy_tile_data_to_vram(1, gUnknown_08DE34B8, 0, 0, 0); + break; + case 6: + if (free_temp_tile_data_buffers_if_possible()) + return 0; + + InitStandardTextBoxWindows(); + sub_8197200(); + sub_8022588(var0); + sub_8022600(var0); + gPaletteFade.bufferTransferDisabled = 1; + break; + case 7: + LoadPalette(gUnknown_08DE3398, 0, 0x180); + CopyToBgTilemapBuffer(1, gBerryCrushGrinderTopTilemap, 0, 0); + CopyToBgTilemapBuffer(2, gBerryCrushContainerCapTilemap, 0, 0); + CopyToBgTilemapBuffer(3, gBerryCrushBackgroundTilemap, 0, 0); + sub_80226D0(var0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + break; + case 8: + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(0, 0); + sub_8022730(var0); + SetGpuReg(REG_OFFSET_BG1VOFS, -gSpriteCoordOffsetY); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + break; + case 9: + gPaletteFade.bufferTransferDisabled = 0; + BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + sub_8020E3C(); + var0->unkC = 0; + return 1; + } + + var0->unkC++; + return 0; +} + +int sub_802130C(void) +{ + struct BerryCrushGame *var0 = sub_8020C00(); + if (!var0) + return -1; + + switch (var0->unkC) + { + case 0: + sub_8010434(); + break; + case 1: + if (!IsLinkTaskFinished()) + return 0; + // fall through. The original author forgot to use "break" here + // because this will call BeginNormalPaletteFade() twice. + case 2: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + UpdatePaletteFade(); + break; + case 3: + if (UpdatePaletteFade()) + return 0; + break; + case 4: + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 32, 32); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + break; + case 5: + FreeAllWindowBuffers(); + HideBg(0); + UnsetBgTilemapBuffer(0); + HideBg(1); + UnsetBgTilemapBuffer(1); + HideBg(2); + UnsetBgTilemapBuffer(2); + HideBg(3); + UnsetBgTilemapBuffer(3); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + break; + case 6: + sub_800E084(); + sub_8022960(var0); + sub_8034CC8(); + break; + case 7: + var0->unkC = 0; + return 1; + } + + var0->unkC++; + return 0; +} + +static int sub_8021450(struct BerryCrushGame *arg0) +{ + gSpriteCoordOffsetY = arg0->unk2A + arg0->unk2C; + SetGpuReg(REG_OFFSET_BG1VOFS, -gSpriteCoordOffsetY); + if (arg0->unk12 == 7) + { + sub_8022524(&arg0->unk138, arg0->unk28); + } + + return 0; +} + +void sub_8021488(struct BerryCrushGame *arg0) +{ + arg0->unk2A = -104; + arg0->unk2C = 0; + gSpriteCoordOffsetX = 0; + gSpriteCoordOffsetY = -104; +} + +void sub_80214A8(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) +{ + u8 i; + u8 spriteId; + s16 var0, var1; + s16 *data; + int var3; + s16 var5; + u32 var6; + + for (i = 0; i < arg0->unk9; i++) + { + spriteId = AddCustomItemIconSprite( + &gUnknown_082F436C, + gUnknown_082F41E8[i], + gUnknown_082F41E8[i], + arg0->unk84.separate.others[i].unk0 + 133); + arg1->unk38[i] = &gSprites[spriteId]; + arg1->unk38[i]->oam.priority = 3; + arg1->unk38[i]->affineAnimPaused = 1; + arg1->unk38[i]->pos1.x = arg1->unkC[i]->unk8 + 120; + arg1->unk38[i]->pos1.y = -16; + data = arg1->unk38[i]->data; + var5 = 512; + data[1] = var5; + data[2] = 32; + data[7] = 112; + var0 = arg1->unkC[i]->unkA - arg1->unkC[i]->unk8; + var3 = var0; + if (var0 < 0) + var3 += 3; + + data[6] = var3 >> 2; + var0 *= 128; + var6 = var5 + 32; + var6 = var6 / 2; + var1 = sub_81515D4(7, 0x3F80, var6); + data[0] = (u16)arg1->unk38[i]->pos1.x * 128; + data[3] = sub_81515D4(7, var0, var1); + var1 = sub_8151550(7, var1, 85); + data[4] = 0; + data[5] = sub_81515D4(7, 0x3F80, var1); + data[7] |= 0x8000; + if (arg1->unkC[i]->unk8 < 0) + StartSpriteAffineAnim(arg1->unk38[i], 1); + } +} + +void sub_8021608(struct Sprite *sprite) +{ + s16 *data = sprite->data; + + data[1] += data[2]; + sprite->pos2.y += data[1] >> 8; + if (data[7] & 0x8000) + { + sprite->data[0] += data[3]; + data[4] += data[5]; + sprite->pos2.x = Sin(data[4] >> 7, data[6]); + if ((data[7] & 0x8000) && (data[4] >> 7) > 126) + { + sprite->pos2.x = 0; + data[7] &= 0x7FFF; + } + } + + sprite->pos1.x = data[0] >> 7; + if (sprite->pos1.y + sprite->pos2.y >= (data[7] & 0x7FFF)) + { + sprite->callback = SpriteCallbackDummy; + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } +} + +void sub_80216A8(struct BerryCrushGame *arg0) +{ + u8 i; + for (i = 0; i < arg0->unk9; i++) + { + FreeSpritePaletteByTag(gUnknown_082F41E8[i]); + FreeSpriteTilesByTag(gUnknown_082F41E8[i]); + } +} + +// void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) +// { +// u8 sp4; +// struct BerryCrushGame_4E *var4E; +// u8 i; +// u16 var0; + +// sp4 = 0; +// var4E = &arg0->unk40.unkE; +// for (i = 0; i < arg0->unk9; i++) +// { +// var0 = var4E->unkA >> (i * 3); +// var0 &= 7; +// if (var0) +// { +// int offset; +// sp4++; +// if (var0 & 0x4) +// StartSpriteAnim(arg1->unk24[i], 1); +// else +// StartSpriteAnim(arg1->unk24[i], 0); + +// arg1->unk24[i]->invisible = 0; +// arg1->unk24[i]->animPaused = 0; +// offset = (var0 % 4) - 1; +// arg1->unk24[i]->pos2.x = gUnknown_082F41CC[offset][0]; +// arg1->unk24[i]->pos2.y = gUnknown_082F41CC[offset][1]; +// } +// } + +// if (sp4 == 0) +// { +// arg0->unk25_2 = 0; +// } +// else +// { +// u8 var3 = arg0->unk28 % 3; +// u16 var2 = var3; +// for (i = 0; i < var4E->unkC * 2 + 3; i++) +// { +// if (arg1->unk4C[i]->invisible) +// { +// arg1->unk4C[i]->callback = sub_8022B28; +// arg1->unk4C[i]->pos1.x = gUnknown_082F41D2[i][0] + 120; +// arg1->unk4C[i]->pos1.y = gUnknown_082F41D2[i][1] + (136 - var2 * 4); +// arg1->unk4C[i]->pos2.x = gUnknown_082F41D2[i][0] / (var3 * 4); +// arg1->unk4C[i]->pos2.y = gUnknown_082F41D2[i][1]; +// if (var4E->unk4 & 0x2) +// StartSpriteAnim(arg1->unk4C[i], 1); +// else +// StartSpriteAnim(arg1->unk4C[i], 0); + +// var2++; +// if (var2 > 3) +// var2 = 0; +// } +// } + +// if (arg0->unk25_2) +// { +// arg0->unk25_2 = 0; +// } +// else +// { +// if (sp4 == 1) +// PlaySE(SE_TOY_DANGO); +// else +// PlaySE(SE_TOY_KABE); + +// arg0->unk25_2 = 1; +// } +// } +// } diff --git a/src/item_icon.c b/src/item_icon.c index 7bf1a29ca..91c32951a 100644 --- a/src/item_icon.c +++ b/src/item_icon.c @@ -122,7 +122,7 @@ u8 AddItemIconSprite(u16 tilesTag, u16 paletteTag, u16 itemId) } } -u8 AddCustomItemIconSprite(struct SpriteTemplate *customSpriteTemplate, u16 tilesTag, u16 paletteTag, u16 itemId) +u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u16 tilesTag, u16 paletteTag, u16 itemId) { if (!AllocItemIconTemporaryBuffers()) { diff --git a/src/union_room.c b/src/union_room.c index 338063ef1..5050b04f1 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -44,6 +44,7 @@ #include "easy_chat.h" #include "event_obj_lock.h" #include "union_room_chat.h" +#include "berry_crush.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -98,7 +99,6 @@ void sub_801807C(struct TradeUnkStruct *arg0); void sub_801AC54(void); void sub_802A9A8(u8 monId, MainCallback callback); void sub_802493C(u8 monId, MainCallback callback); -void sub_8020C70(MainCallback callback); void sub_80149D8(void); u16 sub_8019930(void); void sub_8018784(u8 windowId); From 462b196abc126cd8c2a06434f9b3b9c25a0d4327 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 31 Mar 2019 12:15:39 -0500 Subject: [PATCH 20/30] Give battle_anim files appropriate names --- ..._anim_8170478.txt => battle_anim_special.txt} | 0 include/battle.h | 4 +--- include/battle_anim.h | 13 +++++++------ ld_script.txt | 16 ++++++++-------- src/battle_ai_script_commands.c | 1 + src/battle_ai_switch_items.c | 1 + ...anim_80D51AC.c => battle_anim_mon_movement.c} | 0 ...{battle_anim_80A5C6C.c => battle_anim_mons.c} | 0 ...ttle_anim_8170478.c => battle_anim_special.c} | 0 ...im_80A9C70.c => battle_anim_status_effects.c} | 0 src/battle_main.c | 1 + src/battle_message.c | 1 + src/battle_tv.c | 1 + src/battle_util.c | 1 + src/battle_util2.c | 1 + src/pokemon.c | 1 + src/recorded_battle.c | 1 + sym_common.txt | 2 +- sym_ewram.txt | 2 +- 19 files changed, 27 insertions(+), 19 deletions(-) rename common_syms/{battle_anim_8170478.txt => battle_anim_special.txt} (100%) rename src/{battle_anim_80D51AC.c => battle_anim_mon_movement.c} (100%) rename src/{battle_anim_80A5C6C.c => battle_anim_mons.c} (100%) rename src/{battle_anim_8170478.c => battle_anim_special.c} (100%) rename src/{battle_anim_80A9C70.c => battle_anim_status_effects.c} (100%) diff --git a/common_syms/battle_anim_8170478.txt b/common_syms/battle_anim_special.txt similarity index 100% rename from common_syms/battle_anim_8170478.txt rename to common_syms/battle_anim_special.txt diff --git a/include/battle.h b/include/battle.h index 38bce0e61..13c1851cf 100644 --- a/include/battle.h +++ b/include/battle.h @@ -564,9 +564,7 @@ struct BattleScripting }; // rom_80A5C6C -u8 GetBattlerSide(u8 battler); -u8 GetBattlerPosition(u8 battler); -u8 GetBattlerAtPosition(u8 position); + struct BattleSpriteInfo { diff --git a/include/battle_anim.h b/include/battle_anim.h index b3350f893..949bc236b 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -73,7 +73,7 @@ void sub_8118FBC(int bgId, u8 arg1, u8 arg2, u8 battlerPosition, u8 arg4, u8 *ar void HandleIntroSlide(u8 terrainId); int GetAnimBgAttribute(u8 bgId, u8 attributeId); -// battle_anim_80A5C6C.s +// battle_anim_mons.s void TranslateSpriteInEllipseOverDuration(struct Sprite *sprite); void sub_80A8AEC(struct Sprite *sprite); void sub_80A8A6C(struct Sprite *sprite); @@ -155,6 +155,9 @@ void sub_80A6DEC(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); void DestroySpriteAndFreeResources_(struct Sprite *sprite); void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId); +u8 GetBattlerSide(u8 battler); +u8 GetBattlerPosition(u8 battler); +u8 GetBattlerAtPosition(u8 position); enum { @@ -193,7 +196,7 @@ u8 GetSubstituteSpriteDefault_Y(u8 battlerId); void sub_80A64EC(struct Sprite *sprite); void sub_80A718C(struct Sprite *sprite); -// battle_anim_80A9C70.s +// battle_anim_status_effects.s #define STAT_ANIM_PLUS1 15 #define STAT_ANIM_PLUS2 39 #define STAT_ANIM_MINUS1 22 @@ -204,13 +207,11 @@ void sub_80A718C(struct Sprite *sprite); #define STAT_ANIM_MULTIPLE_MINUS2 58 void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId); -// battle_anim_8170478.c -void sub_8172EF0(u8 battler, struct Pokemon *mon); - // ground.c void sub_81152DC(u8 taskId); -// battle_anim_8170478.s +// battle_anim_special.c +void sub_8172EF0(u8 battler, struct Pokemon *mon); u8 ItemIdToBallId(u16 itemId); u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId); u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, u8 ballId); diff --git a/ld_script.txt b/ld_script.txt index 97eb046b9..746fd4bd0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -120,10 +120,10 @@ SECTIONS { src/palette.o(.text); src/sound.o(.text); src/battle_anim.o(.text); - src/battle_anim_80A5C6C.o(.text); + src/battle_anim_mons.o(.text); src/task.o(.text); src/reshow_battle_screen.o(.text); - src/battle_anim_80A9C70.o(.text); + src/battle_anim_status_effects.o(.text); src/title_screen.o(.text); src/field_weather.o(.text); src/field_weather_effect.o(.text); @@ -145,7 +145,7 @@ SECTIONS { src/mail_data.o(.text); src/map_name_popup.o(.text); src/item_menu_icons.o(.text); - src/battle_anim_80D51AC.o(.text); + src/battle_anim_mon_movement.o(.text); src/item.o(.text); src/contest.o(.text); src/shop.o(.text); @@ -247,7 +247,7 @@ SECTIONS { src/intro.o(.text); src/reset_save_heap.o(.text); src/field_region_map.o(.text); - src/battle_anim_8170478.o(.text); + src/battle_anim_special.o(.text); src/hall_of_fame.o(.text); src/credits.o(.text); src/lottery_corner.o(.text); @@ -461,9 +461,9 @@ SECTIONS { src/palette.o(.rodata); src/sound.o(.rodata); src/battle_anim.o(.rodata); - src/battle_anim_80A5C6C.o(.rodata); + src/battle_anim_mons.o(.rodata); data/map_events.o(.rodata); - src/battle_anim_80A9C70.o(.rodata); + src/battle_anim_status_effects.o(.rodata); src/title_screen.o(.rodata); src/field_weather.o(.rodata); src/field_weather_effect.o(.rodata); @@ -482,7 +482,7 @@ SECTIONS { src/fldeff_cut.o(.rodata); src/map_name_popup.o(.rodata); src/item_menu_icons.o(.rodata); - src/battle_anim_80D51AC.o(.rodata); + src/battle_anim_mon_movement.o(.rodata); src/item.o(.rodata); data/contest.o(.rodata); src/shop.o(.rodata); @@ -566,7 +566,7 @@ SECTIONS { src/player_pc.o(.rodata); src/intro.o(.rodata); src/field_region_map.o(.rodata); - src/battle_anim_8170478.o(.rodata); + src/battle_anim_special.o(.rodata); src/hall_of_fame.o(.rodata); src/credits.o(.rodata); src/lottery_corner.o(.rodata); diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 6098e2d3a..61876e0de 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "battle_ai_script_commands.h" #include "battle_factory.h" #include "battle_setup.h" diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index a5958ebc6..2d67fda99 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "battle_controllers.h" #include "pokemon.h" #include "random.h" diff --git a/src/battle_anim_80D51AC.c b/src/battle_anim_mon_movement.c similarity index 100% rename from src/battle_anim_80D51AC.c rename to src/battle_anim_mon_movement.c diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_mons.c similarity index 100% rename from src/battle_anim_80A5C6C.c rename to src/battle_anim_mons.c diff --git a/src/battle_anim_8170478.c b/src/battle_anim_special.c similarity index 100% rename from src/battle_anim_8170478.c rename to src/battle_anim_special.c diff --git a/src/battle_anim_80A9C70.c b/src/battle_anim_status_effects.c similarity index 100% rename from src/battle_anim_80A9C70.c rename to src/battle_anim_status_effects.c diff --git a/src/battle_main.c b/src/battle_main.c index 0f593fef6..19fd01e3c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "battle_ai_script_commands.h" #include "battle_arena.h" #include "battle_controllers.h" diff --git a/src/battle_message.c b/src/battle_message.c index 6762cd416..f93765b89 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "battle_controllers.h" #include "battle_message.h" #include "battle_setup.h" diff --git a/src/battle_tv.c b/src/battle_tv.c index d3ca9b61f..26df08786 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -1,6 +1,7 @@ #include "global.h" #include "pokemon.h" #include "battle.h" +#include "battle_anim.h" #include "battle_tv.h" #include "constants/battle_string_ids.h" #include "constants/battle_anim.h" diff --git a/src/battle_util.c b/src/battle_util.c index aa88cf952..a7962b7f7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "constants/battle_script_commands.h" #include "constants/abilities.h" #include "constants/moves.h" diff --git a/src/battle_util2.c b/src/battle_util2.c index 9c0d55a57..5ef969fd5 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "battle_controllers.h" #include "alloc.h" #include "pokemon.h" diff --git a/src/pokemon.c b/src/pokemon.c index 1ee9c4cff..7c26b4c22 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "apprentice.h" #include "battle.h" +#include "battle_anim.h" #include "battle_controllers.h" #include "battle_message.h" #include "battle_pike.h" diff --git a/src/recorded_battle.c b/src/recorded_battle.c index c11dc55e7..acd4c2ce6 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "recorded_battle.h" #include "main.h" #include "pokemon.h" diff --git a/sym_common.txt b/sym_common.txt index 414d223e9..17dbf5c41 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -34,7 +34,7 @@ .include "save.o" .include "battle_tower.o" .include "intro.o" - .include "battle_anim_8170478.o" + .include "battle_anim_special.o" .include "battle_factory_screen.o" .include "apprentice.o" diff --git a/sym_ewram.txt b/sym_ewram.txt index 8aea7124c..6878e1bd1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -104,7 +104,7 @@ gUnknown_02022D00: @ 2022D00 .include "src/palette.o" .include "src/sound.o" .include "src/battle_anim.o" - .include "src/battle_anim_80A5C6C.o" + .include "src/battle_anim_mons.o" .space 0xC .include "src/field_weather.o" From f34cda3b5209735fbf276b0f23e29549b1a1a3d9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 13:14:00 -0400 Subject: [PATCH 21/30] Start decompiling mystery gift --- asm/{union_room.s => mystery_gift.s} | 230 ----------------------- data/{union_room.s => mystery_gift.s} | 54 ------ include/mystery_gift.h | 4 + ld_script.txt | 6 +- src/mystery_gift.c | 253 ++++++++++++++++++++++++++ 5 files changed, 261 insertions(+), 286 deletions(-) rename asm/{union_room.s => mystery_gift.s} (95%) rename data/{union_room.s => mystery_gift.s} (78%) create mode 100644 include/mystery_gift.h create mode 100644 src/mystery_gift.c diff --git a/asm/union_room.s b/asm/mystery_gift.s similarity index 95% rename from asm/union_room.s rename to asm/mystery_gift.s index ca5ad6853..63fd80389 100755 --- a/asm/union_room.s +++ b/asm/mystery_gift.s @@ -5,236 +5,6 @@ .text - thumb_func_start sub_8018424 -sub_8018424: @ 8018424 - push {lr} - bl ProcessSpriteCopyRequests - bl LoadOam - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8018424 - - thumb_func_start sub_8018438 -sub_8018438: @ 8018438 - push {lr} - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r0} - bx r0 - thumb_func_end sub_8018438 - - thumb_func_start sub_8018450 -sub_8018450: @ 8018450 - push {r4-r7,lr} - sub sp, 0xC - adds r7, r0, 0 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r6, r0, r1 - ldrb r0, [r6] - cmp r0, 0x1 - bne _08018466 - b _08018574 -_08018466: - cmp r0, 0x1 - bgt _08018474 - cmp r0, 0 - beq _08018482 - b _08018644 - .pool -_08018474: - cmp r0, 0x2 - bne _0801847A - b _080185F8 -_0801847A: - cmp r0, 0x3 - bne _08018480 - b _08018618 -_08018480: - b _08018644 -_08018482: - movs r0, 0 - bl SetVBlankCallback - bl ResetPaletteFade - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl ScanlineEffect_Stop - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0598 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r4, 0x80 - lsls r4, 4 - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x3 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x2 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0 - bl SetBgTilemapBuffer - movs r0, 0x3 - bl bgid_upload_textbox_1 - ldr r0, =gUnknown_082F05A8 - bl InitWindows - bl DeactivateAllTextPrinters - movs r1, 0xC0 - lsls r1, 7 - movs r0, 0 - bl ClearGpuRegBits - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - b _08018610 - .pool -_08018574: - ldr r0, =gUnkTextboxBorderPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0x2 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0xC0 - bl sub_81978B0 - movs r0, 0 - movs r1, 0xA - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - movs r0, 0 - movs r1, 0x1 - movs r2, 0xF0 - bl LoadUserWindowBorderGfx_ - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x3 - bl sub_8018798 - lsls r0, r7, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80186EC - b _08018610 - .pool -_080185F8: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram -_08018610: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08018644 -_08018618: - movs r0, 0 - bl ShowBg - movs r0, 0x3 - bl ShowBg - ldr r0, =0x0000021d - bl PlayBGM - ldr r0, =sub_8018424 - bl SetVBlankCallback - movs r0, 0xC5 - bl EnableInterrupts - movs r0, 0x1 - b _08018646 - .pool -_08018644: - movs r0, 0 -_08018646: - add sp, 0xC - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8018450 - thumb_func_start c2_mystery_gift c2_mystery_gift: @ 8018650 push {lr} diff --git a/data/union_room.s b/data/mystery_gift.s similarity index 78% rename from data/union_room.s rename to data/mystery_gift.s index 6934f0fd8..cfca73479 100755 --- a/data/union_room.s +++ b/data/mystery_gift.s @@ -3,60 +3,6 @@ .section .rodata - .align 2 -gUnkTextboxBorderPal:: @ 82F0548 - .incbin "graphics/interface/unk_textbox_border.gbapal" - - .align 2 -gUnkTextboxBorderGfx:: @ 82F0568 - .incbin "graphics/interface/unk_textbox_border.4bpp.lz" - - .align 2 -gUnknown_082F0598:: @ 82F0598 struct BgTemplate - .4byte 0x000000f8 - .4byte 0x000010e1 - .4byte 0x000020d2 - .4byte 0x000030c3 - - .align 2 -gUnknown_082F05A8:: @ 82F05A8 - window_template 0x00, 0x00, 0x00, 0x1e, 0x02, 0x0c, 0x0013 - window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x004f - window_template 0x00, 0x00, 0x0f, 0x1e, 0x05, 0x0d, 0x004f - null_window_template - - .align 2 -gUnknown_082F05C8:: @ 82F05C8 - window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05D0:: @ 82F05D0 - window_template 0x00, 0x01, 0x0f, 0x14, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05D8:: @ 82F05D8 - window_template 0x00, 0x01, 0x0f, 0x13, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05E0:: @ 82F05E0 - window_template 0x00, 0x08, 0x06, 0x0e, 0x06, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05E8:: @ 82F05E8 - window_template 0x00, 0x17, 0x0f, 0x06, 0x04, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05F0:: @ 82F05F0 - window_template 0x00, 0x16, 0x0b, 0x07, 0x08, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05F8:: @ 82F05F8 - window_template 0x00, 0x16, 0x0d, 0x07, 0x06, 0x0c, 0x0155 - - .align 2 -gUnknown_082F0600:: @ 82F0600 - window_template 0x00, 0x16, 0x0f, 0x07, 0x04, 0x0c, 0x0155 - .align 2 gUnknown_082F0608:: @ 82F0608 .4byte gText_WonderCards, 0x00000000 diff --git a/include/mystery_gift.h b/include/mystery_gift.h new file mode 100644 index 000000000..b83239bc7 --- /dev/null +++ b/include/mystery_gift.h @@ -0,0 +1,4 @@ +#ifndef GUARD_MYSTERY_GIFT_H +#define GUARD_MYSTERY_GIFT_H + +#endif //GUARD_MYSTERY_GIFT_H diff --git a/ld_script.txt b/ld_script.txt index 746fd4bd0..4f4bc55d7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -55,7 +55,8 @@ SECTIONS { src/link.o(.text); src/link_rfu.o(.text); src/union_room.o(.text); - asm/union_room.o(.text); + src/mystery_gift.o(.text); + asm/mystery_gift.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -409,7 +410,8 @@ SECTIONS { src/link.o(.rodata); src/link_rfu.o(.rodata); src/union_room.o(.rodata); - data/union_room.o(.rodata); + src/mystery_gift.o(.rodata); + data/mystery_gift.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); diff --git a/src/mystery_gift.c b/src/mystery_gift.c new file mode 100644 index 000000000..b6c317281 --- /dev/null +++ b/src/mystery_gift.c @@ -0,0 +1,253 @@ +#include "global.h" +#include "main.h" +#include "text.h" +#include "task.h" +#include "alloc.h" +#include "gpu_regs.h" +#include "scanline_effect.h" +#include "text_window.h" +#include "bg.h" +#include "window.h" +#include "text_window.h" +#include "menu.h" +#include "palette.h" +#include "constants/songs.h" +#include "sound.h" +#include "mystery_gift.h" + +void bgid_upload_textbox_1(u8 bgId); +void sub_8018798(u8); +void sub_80186EC(u8, u8); + +const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); +const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); + +const struct BgTemplate gUnknown_082F0598[] = { + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0x000 + }, { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 14, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0x000 + }, { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 13, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0x000 + }, { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 12, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0x000 + } +}; + +const struct WindowTemplate gUnknown_082F05A8[] = { + { + .bg = 0x00, + .tilemapLeft = 0x00, + .tilemapTop = 0x00, + .width = 0x1e, + .height = 0x02, + .paletteNum = 0x0c, + .baseBlock = 0x0013 + }, { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x1c, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x004f + }, { + .bg = 0x00, + .tilemapLeft = 0x00, + .tilemapTop = 0x0f, + .width = 0x1e, + .height = 0x05, + .paletteNum = 0x0d, + .baseBlock = 0x004f + }, { + 0xFF + } +}; + +const struct WindowTemplate gUnknown_082F05C8 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x1c, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x00e5 +}; + +const struct WindowTemplate gUnknown_082F05D0 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x14, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x00e5 +}; + +const struct WindowTemplate gUnknown_082F05D8 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x13, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x00e5 +}; + +const struct WindowTemplate gUnknown_082F05E0 = { + .bg = 0x00, + .tilemapLeft = 0x08, + .tilemapTop = 0x06, + .width = 0x0e, + .height = 0x06, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F05E8 = { + .bg = 0x00, + .tilemapLeft = 0x17, + .tilemapTop = 0x0f, + .width = 0x06, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F05F0 = { + .bg = 0x00, + .tilemapLeft = 0x16, + .tilemapTop = 0x0b, + .width = 0x07, + .height = 0x08, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F05F8 = { + .bg = 0x00, + .tilemapLeft = 0x16, + .tilemapTop = 0x0d, + .width = 0x07, + .height = 0x06, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F0600 = { + .bg = 0x00, + .tilemapLeft = 0x16, + .tilemapTop = 0x0f, + .width = 0x07, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +void sub_8018424(void) +{ + ProcessSpriteCopyRequests(); + LoadOam(); + TransferPlttBuffer(); +} + +void sub_8018438(void) +{ + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); +} + +bool32 sub_8018450(s32 arg) +{ + switch (gMain.state) + { + case 0: + SetVBlankCallback(NULL); + ResetPaletteFade(); + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + ScanlineEffect_Stop(); + ResetBgsAndClearDma3BusyFlags(0); + + InitBgsFromTemplates(0, gUnknown_082F0598, ARRAY_COUNT(gUnknown_082F0598)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + + SetBgTilemapBuffer(3, Alloc(0x800)); + SetBgTilemapBuffer(2, Alloc(0x800)); + SetBgTilemapBuffer(1, Alloc(0x800)); + SetBgTilemapBuffer(0, Alloc(0x800)); + + bgid_upload_textbox_1(3); + InitWindows(gUnknown_082F05A8); + DeactivateAllTextPrinters(); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + gMain.state++; + break; + case 1: + LoadPalette(gUnkTextboxBorderPal, 0, 0x20); + LoadPalette(stdpal_get(2), 0xd0, 0x20); + sub_81978B0(0xC0); + LoadUserWindowBorderGfx(0, 0xA, 0xE0); + LoadUserWindowBorderGfx_(0, 0x1, 0xF0); + FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11); + FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11); + FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11); + sub_8018798(3); + sub_80186EC(arg, 0); + gMain.state++; + break; + case 2: + CopyBgTilemapBufferToVram(3); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(0); + gMain.state++; + break; + case 3: + ShowBg(0); + ShowBg(3); + PlayBGM(MUS_RG_OKURIMONO); + SetVBlankCallback(sub_8018424); + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + return TRUE; + } + + return FALSE; +} From aafe9df454f42c77146d76676cc477e876d6540b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 14:36:52 -0400 Subject: [PATCH 22/30] through sub_8018798 --- asm/mystery_gift.s | 227 -------------------------------------- data/mystery_gift.s | 93 ---------------- include/mevent2.h | 6 + include/mystery_gift.h | 4 + include/rom_8011DC0.h | 171 ---------------------------- include/strings.h | 20 ++++ include/union_room.h | 172 ++++++++++++++++++++++++++++- src/cable_club.c | 3 +- src/ereader_helpers.c | 2 +- src/ereader_screen.c | 2 +- src/link_rfu.c | 4 +- src/mevent_801BAAC.c | 1 + src/mystery_gift.c | 245 ++++++++++++++++++++++++++++++++++++++++- src/party_menu.c | 2 +- src/start_menu.c | 1 + src/trade.c | 3 + src/union_room.c | 4 +- sym_ewram.txt | 5 +- 18 files changed, 457 insertions(+), 508 deletions(-) create mode 100644 include/mevent2.h diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 63fd80389..08866a85d 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,233 +5,6 @@ .text - thumb_func_start c2_mystery_gift -c2_mystery_gift: @ 8018650 - push {lr} - movs r0, 0 - bl sub_8018450 - cmp r0, 0 - beq _0801866C - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl task_add_00_mystery_gift -_0801866C: - bl RunTasks - pop {r0} - bx r0 - .pool - thumb_func_end c2_mystery_gift - - thumb_func_start sub_801867C -sub_801867C: @ 801867C - push {lr} - movs r0, 0x1 - bl sub_8018450 - cmp r0, 0 - beq _08018698 - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0x1 - strb r0, [r1] - bl sub_81D5014 -_08018698: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801867C - - thumb_func_start sub_80186A4 -sub_80186A4: @ 80186A4 - push {lr} - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl FreeAllWindowBuffers - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x2 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - ldr r0, =CB2_InitTitleScreen - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186A4 - - thumb_func_start sub_80186EC -sub_80186EC: @ 80186EC - push {r4-r7,lr} - sub sp, 0x14 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0 - bne _0801871C - ldr r0, =gText_MysteryGift - ldr r7, =gText_PickOKCancel - cmp r5, 0 - bne _08018720 - ldr r7, =gText_PickOKExit - b _08018720 - .pool -_0801871C: - ldr r0, =gJPText_MysteryGift - ldr r7, =gJPText_DecideStop -_08018720: - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - ldr r6, =gUnknown_082F0720 - str r6, [sp, 0x8] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0 - adds r1, r7, 0 - movs r2, 0xDE - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - str r5, [sp, 0xC] - str r7, [sp, 0x10] - movs r0, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl PutWindowTilemap - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186EC - - thumb_func_start sub_8018784 -sub_8018784: @ 8018784 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - pop {r0} - bx r0 - thumb_func_end sub_8018784 - - thumb_func_start sub_8018798 -sub_8018798: @ 8018798 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - mov r9, r0 - lsls r4, 24 - lsrs r0, r4, 24 - movs r1, 0x20 - str r1, [sp] - movs r1, 0x2 - str r1, [sp, 0x4] - movs r1, 0x11 - str r1, [sp, 0x8] - movs r1, 0x3 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - mov r8, r4 - movs r4, 0x1 -_080187C8: - movs r7, 0 - mov r0, r9 - adds r0, 0x2 - movs r1, 0x1 - add r1, r9 - mov r10, r1 - lsls r5, r0, 24 - movs r6, 0 -_080187D8: - mov r1, r9 - ands r1, r4 - adds r0, r7, 0 - ands r0, r4 - cmp r1, r0 - beq _080187FC - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x1 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect - b _08018812 -_080187FC: - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x2 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect -_08018812: - movs r0, 0x80 - lsls r0, 17 - adds r6, r0 - adds r7, 0x1 - cmp r7, 0x1F - ble _080187D8 - mov r9, r10 - mov r1, r9 - cmp r1, 0x11 - ble _080187C8 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8018798 - thumb_func_start sub_8018838 sub_8018838: @ 8018838 push {lr} diff --git a/data/mystery_gift.s b/data/mystery_gift.s index cfca73479..5f86ab4d2 100755 --- a/data/mystery_gift.s +++ b/data/mystery_gift.s @@ -3,99 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F0608:: @ 82F0608 - .4byte gText_WonderCards, 0x00000000 - .4byte gText_WonderNews, 0x00000001 - .4byte gText_Exit3, 0xfffffffe - - .align 2 -gUnknown_082F0620:: @ 82F0620 - .4byte gText_WirelessCommunication, 0x00000000 - .4byte gText_Friend2, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0638:: @ 82F0638 struct ListMenuTemplate - .4byte NULL - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0650:: @ 82F0650 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0670:: @ 82F0670 - .4byte gText_Receive, 0x00000000 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0688:: @ 82F0688 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06A0:: @ 82F06A0 - .4byte gText_Receive, 0x00000000 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06B0:: @ 82F06B0 struct ListMenuTemplate - .4byte gUnknown_082F0650 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06C8:: @ 82F06C8 - .4byte gUnknown_082F0670 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06E0:: @ 82F06E0 - .4byte gUnknown_082F0688 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06F8:: @ 82F06F8 - .4byte gUnknown_082F06A0 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 - .4byte gText_VarietyOfEventsImportedWireless - .4byte gText_WonderCardsInPossession - .4byte gText_ReadNewsThatArrived - .4byte gText_ReturnToTitle - - .align 2 -gUnknown_082F0720:: @ 82F0720 - .byte 0x00, 0x01, 0x02 - - .align 2 - .byte 0x00, 0x01, 0x02 - - .align 2 -gUnknown_082F0728:: @ 82F0728 - .byte 0x01, 0x02, 0x03 - .align 2 gUnknown_082F072C:: @ 82F072C .byte 0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42 diff --git a/include/mevent2.h b/include/mevent2.h new file mode 100644 index 000000000..80b1fd51b --- /dev/null +++ b/include/mevent2.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MEVENT2_H +#define GUARD_MEVENT2_H + +void sub_801B990(u32, u32); + +#endif //GUARD_MEVENT2_H diff --git a/include/mystery_gift.h b/include/mystery_gift.h index b83239bc7..b43fbe9a9 100644 --- a/include/mystery_gift.h +++ b/include/mystery_gift.h @@ -1,4 +1,8 @@ #ifndef GUARD_MYSTERY_GIFT_H #define GUARD_MYSTERY_GIFT_H +void sub_8018438(void); +void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel); +void sub_8018798(u32 bg); + #endif //GUARD_MYSTERY_GIFT_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index fa54fca66..ee7397320 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -1,175 +1,4 @@ #ifndef GUARD_rom_8011DC0_H #define GUARD_rom_8011DC0_H -#include "librfu.h" - -// Exported type declarations - -struct UnkStruct_Shared -{ - struct UnkLinkRfuStruct_02022B14 field_0; - u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; -}; - -struct UnkStruct_x1C -{ - struct UnkStruct_Shared unk0; - u8 unk18:1; -}; - -struct UnkStruct_x20 -{ - struct UnkStruct_Shared unk; - u16 field_18; - u8 field_1A_0:2; - u8 field_1A_1:1; - u8 field_1B; - u8 field_1D; - u8 field_1E; - u8 field_1F; -}; - -struct UnkStruct_Main0 -{ - struct UnkStruct_x20 arr[8]; -}; - -struct UnkStruct_Main4 -{ - struct UnkStruct_x1C arr[5]; -}; - -struct UnkStruct_Main8 -{ - struct UnkStruct_x20 arr[5]; -}; - -struct UnkStruct_Leader -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main8 *field_8; - u8 state; - u8 textState; - u8 field_E; - u8 listWindowId; - u8 field_10; - u8 field_11; - u8 listTaskId; - u8 field_13; - u8 field_14; - u8 field_15; - u8 field_16; - u8 field_17; - u8 field_18; - u8 field_19; - u16 field_1A; -}; - -struct UnkStruct_Group -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - u8 state; - u8 textState; - u8 field_A; - u8 listWindowId; - u8 field_C; - u8 field_D; - u8 listTaskId; - u8 field_F; - u8 field_10; - u8 field_11; - u8 field_12; - u8 field_13; - u8 field_14; - u8 field_15; -}; - -struct UnkStruct_8019BA8 -{ - u8 field_0; - u8 field_1; - u8 field_2; - u8 field_3; -}; - -struct UnkStruct_URoom -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main0 *field_8; - struct UnkStruct_Main4 *field_C; - u16 field_10; - u16 field_12; - u8 state; - u8 stateAfterPrint; - u8 textState; - u8 field_17; - u8 field_18; - u8 field_19; - u8 field_1A; - u8 field_1B; - u8 field_1C; - u8 field_1D; - u8 field_1E; - u8 field_1F; - u8 field_20; - u8 spriteIds[40]; - u8 field_49; - u8 field_4A; - u16 field_4C[6]; - u8 field_58[0x98 - 0x58]; - u16 field_98; - u16 field_9A[3]; - struct UnkStruct_8019BA8 field_A0[8]; - u8 field_C0[12][15]; - u8 field_174[48]; - u8 field_1A4[200]; -}; - -union UnkUnion_Main -{ - struct UnkStruct_Leader *leader; - struct UnkStruct_Group *group; - struct UnkStruct_URoom *uRoom; -}; - -struct TradeUnkStruct -{ - u16 field_0; - u16 type; - u32 playerPersonality; - u8 field_8; - u8 field_9; - u16 playerSpecies; - u16 playerLevel; - u16 species; - u16 level; - u16 field_12; - u32 personality; -}; - -// Exported RAM declarations - -extern u8 gUnknown_02022C2C; -extern union UnkUnion_Main gUnknown_02022C30; -extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; - -extern u16 gUnknown_02022C3C; -extern u8 gUnknown_02022C3E; - -// Exported ROM declarations - -void sub_8018438(void); -void sub_801B990(u32, u32); -u8 sub_8013F78(void); -bool32 sub_802C908(u16); -void nullsub_89(u8 taskId); -void var_800D_set_xB(void); - -bool32 mevent_0814257C(u8 *textState, const u8 *str); -void sub_8018884(const u8 *src); -void sub_80186A4(void); - #endif //GUARD_rom_8011DC0_H diff --git a/include/strings.h b/include/strings.h index c762ebd45..2f9a64af1 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2607,4 +2607,24 @@ extern const u8 gText_YayUnkF9F9[]; extern const u8 gText_ThankYou[]; extern const u8 gText_ByeBye[]; +// Mystery Gift +extern const u8 gText_MysteryGift[]; +extern const u8 gText_PickOKCancel[]; +extern const u8 gText_PickOKExit[]; +extern const u8 gJPText_MysteryGift[]; +extern const u8 gJPText_DecideStop[]; +extern const u8 gText_WonderCards[]; +extern const u8 gText_WonderNews[]; +extern const u8 gText_Exit3[]; +extern const u8 gText_WirelessCommunication[]; +extern const u8 gText_Friend2[]; +extern const u8 gText_Cancel2[]; +extern const u8 gText_Receive[]; +extern const u8 gText_Send[]; +extern const u8 gText_Toss[]; +extern const u8 gText_VarietyOfEventsImportedWireless[]; +extern const u8 gText_WonderCardsInPossession[]; +extern const u8 gText_ReadNewsThatArrived[]; +extern const u8 gText_ReturnToTitle[]; + #endif // GUARD_STRINGS_H diff --git a/include/union_room.h b/include/union_room.h index 7634e4763..84a7f1f2b 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -1,9 +1,175 @@ #ifndef GUARD_UNION_ROOM_H #define GUARD_UNION_ROOM_H +#include "librfu.h" + +// Exported type declarations + +struct UnkStruct_Shared +{ + struct UnkLinkRfuStruct_02022B14 field_0; + u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; +}; + +struct UnkStruct_x1C +{ + struct UnkStruct_Shared unk0; + u8 unk18:1; +}; + +struct UnkStruct_x20 +{ + struct UnkStruct_Shared unk; + u16 field_18; + u8 field_1A_0:2; + u8 field_1A_1:1; + u8 field_1B; + u8 field_1D; + u8 field_1E; + u8 field_1F; +}; + +struct UnkStruct_Main0 +{ + struct UnkStruct_x20 arr[8]; +}; + +struct UnkStruct_Main4 +{ + struct UnkStruct_x1C arr[5]; +}; + +struct UnkStruct_Main8 +{ + struct UnkStruct_x20 arr[5]; +}; + +struct UnkStruct_Leader +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main8 *field_8; + u8 state; + u8 textState; + u8 field_E; + u8 listWindowId; + u8 field_10; + u8 field_11; + u8 listTaskId; + u8 field_13; + u8 field_14; + u8 field_15; + u8 field_16; + u8 field_17; + u8 field_18; + u8 field_19; + u16 field_1A; +}; + +struct UnkStruct_Group +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + u8 state; + u8 textState; + u8 field_A; + u8 listWindowId; + u8 field_C; + u8 field_D; + u8 listTaskId; + u8 field_F; + u8 field_10; + u8 field_11; + u8 field_12; + u8 field_13; + u8 field_14; + u8 field_15; +}; + +struct UnkStruct_8019BA8 +{ + u8 field_0; + u8 field_1; + u8 field_2; + u8 field_3; +}; + +struct UnkStruct_URoom +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main0 *field_8; + struct UnkStruct_Main4 *field_C; + u16 field_10; + u16 field_12; + u8 state; + u8 stateAfterPrint; + u8 textState; + u8 field_17; + u8 field_18; + u8 field_19; + u8 field_1A; + u8 field_1B; + u8 field_1C; + u8 field_1D; + u8 field_1E; + u8 field_1F; + u8 field_20; + u8 spriteIds[40]; + u8 field_49; + u8 field_4A; + u16 field_4C[6]; + u8 field_58[0x98 - 0x58]; + u16 field_98; + u16 field_9A[3]; + struct UnkStruct_8019BA8 field_A0[8]; + u8 field_C0[12][15]; + u8 field_174[48]; + u8 field_1A4[200]; +}; + +union UnkUnion_Main +{ + struct UnkStruct_Leader *leader; + struct UnkStruct_Group *group; + struct UnkStruct_URoom *uRoom; +}; + +struct TradeUnkStruct +{ + u16 field_0; + u16 type; + u32 playerPersonality; + u8 field_8; + u8 field_9; + u16 playerSpecies; + u16 playerLevel; + u16 species; + u16 level; + u16 field_12; + u32 personality; +}; + +// Exported RAM declarations + +extern u8 gUnknown_02022C2C; +extern union UnkUnion_Main gUnknown_02022C30; +extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; + +extern u16 gUnknown_02022C3C; +extern u8 gUnknown_02022C3E; + +// Exported ROM declarations + +u8 sub_8013F78(void); +bool32 sub_802C908(u16); +void nullsub_89(u8 taskId); +void var_800D_set_xB(void); + +bool32 mevent_0814257C(u8 *textState, const u8 *str); +void sub_8018884(const u8 *src); +void sub_80186A4(void); + extern bool8 gUnknown_02022C60; -void sub_8018798(u8); -void sub_80186EC(bool8, bool32); - #endif //GUARD_UNION_ROOM_H diff --git a/src/cable_club.c b/src/cable_club.c index b80e76e99..fab187b07 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -17,7 +17,8 @@ #include "menu.h" #include "overworld.h" #include "palette.h" -#include "rom_8011DC0.h" +#include "union_room.h" +#include "mevent2.h" #include "script.h" #include "script_pokemon_util_80F87D8.h" #include "sound.h" diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 6c92b676f..cdb829ac8 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "save.h" #include "sprite.h" #include "task.h" diff --git a/src/ereader_screen.c b/src/ereader_screen.c index b15c1fd0c..10a23e251 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "save.h" #include "sound.h" #include "sprite.h" diff --git a/src/link_rfu.c b/src/link_rfu.c index 945806459..43d19be03 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -11,13 +11,13 @@ #include "overworld.h" #include "random.h" #include "palette.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "string_util.h" #include "task.h" #include "text.h" #include "constants/species.h" #include "save.h" -#include "rom_8011DC0.h" +#include "mystery_gift.h" extern u16 gHeldKeyCodeToSend; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index 857ca3fde..d69ab0495 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -13,6 +13,7 @@ #include "string_util.h" #include "link_rfu.h" #include "mevent.h" +#include "mystery_gift.h" struct UnkStruct_8467FB8 { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index b6c317281..3fbe11378 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -8,16 +8,24 @@ #include "text_window.h" #include "bg.h" #include "window.h" +#include "strings.h" #include "text_window.h" #include "menu.h" #include "palette.h" #include "constants/songs.h" #include "sound.h" #include "mystery_gift.h" +#include "union_room.h" +#include "title_screen.h" +#include "ereader_screen.h" +#include "international_string_util.h" +#include "list_menu.h" void bgid_upload_textbox_1(u8 bgId); -void sub_8018798(u8); -void sub_80186EC(u8, u8); +void task_add_00_mystery_gift(void); + +EWRAM_DATA u8 gUnknown_02022C58 = 0; +EWRAM_DATA u8 gUnknown_02022C59 = 0; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); @@ -168,6 +176,158 @@ const struct WindowTemplate gUnknown_082F0600 = { .baseBlock = 0x0155 }; +const struct ListMenuItem gUnknown_082F0608[] = { + { gText_WonderCards, 0 }, + { gText_WonderNews, 1 }, + { gText_Exit3, -2 } +}; + +const struct ListMenuItem gUnknown_082F0620[] = { + { gText_WirelessCommunication, 0 }, + { gText_Friend2, 1 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuTemplate gUnknown_082F0638 = { + .items = NULL, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuItem gUnknown_082F0650[] = { + { gText_Receive, 0 }, + { gText_Send, 1 }, + { gText_Toss, 2 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F0670[] = { + { gText_Receive, 0 }, + { gText_Toss, 2 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F0688[] = { + { gText_Receive, 0 }, + { gText_Send, 1 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F06A0[] = { + { gText_Receive, 0 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuTemplate gUnknown_082F06B0 = { + .items = gUnknown_082F0650, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 4, + .maxShowed = 4, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06C8 = { + .items = gUnknown_082F0670, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06E0 = { + .items = gUnknown_082F0688, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06F8 = { + .items = gUnknown_082F06A0, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 2, + .maxShowed = 2, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const u8 *const Unref_082F0710[] = { + gText_VarietyOfEventsImportedWireless, + gText_WonderCardsInPossession, + gText_ReadNewsThatArrived, + gText_ReturnToTitle +}; + +ALIGNED(2) const u8 gUnknown_082F0720[] = { 0, 1, 2 }; +ALIGNED(2) const u8 gUnknown_082F0724[] = { 0, 1, 2 }; +ALIGNED(2) const u8 gUnknown_082F0728[] = { 1, 2, 3 }; + void sub_8018424(void) { ProcessSpriteCopyRequests(); @@ -251,3 +411,84 @@ bool32 sub_8018450(s32 arg) return FALSE; } + +void c2_mystery_gift(void) +{ + if (sub_8018450(0)) + { + SetMainCallback2(sub_8018438); + gUnknown_02022C60 = FALSE; + task_add_00_mystery_gift(); + } + RunTasks(); +} + +void sub_801867C(void) +{ + if (sub_8018450(1)) + { + SetMainCallback2(sub_8018438); + gUnknown_02022C60 = TRUE; + sub_81D5014(); + } +} + +void sub_80186A4(void) +{ + gUnknown_02022C60 = FALSE; + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(0)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(2)); + Free(GetBgTilemapBuffer(3)); + SetMainCallback2(CB2_InitTitleScreen); +} + +void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel) +{ + const u8 * header; + const u8 * options; + FillWindowPixelBuffer(0, 0); + if (!isJapanese) + { + header = gText_MysteryGift; + options = !usePickOkCancel ? gText_PickOKExit : gText_PickOKCancel; + } + else + { + header = gJPText_MysteryGift; + options = gJPText_DecideStop; + } + + AddTextPrinterParameterized4(0, 1, 4, 1, 0, 0, gUnknown_082F0720, -1, header); + AddTextPrinterParameterized4(0, 0, GetStringRightAlignXOffset(0, options, 0xDE), 1, 0, 0, gUnknown_082F0720, -1, options); + CopyWindowToVram(0, 2); + PutWindowTilemap(0); +} + +void sub_8018784(u8 windowId) +{ + sub_8098858(windowId, 0x01, 0xF); +} + +void sub_8018798(u32 bg) +{ + s32 i = 0, j; + + FillBgTilemapBufferRect(bg, 0x003, 0, 0, 32, 2, 0x11); + + for (i = 0; i < 18; i++) + { + for (j = 0; j < 32; j++) + { + if ((i & 1) != (j & 1)) + { + FillBgTilemapBufferRect(bg, 1, j, i + 2, 1, 1, 0x11); + } + else + { + FillBgTilemapBufferRect(bg, 2, j, i + 2, 1, 1, 0x11); + } + } + } +} diff --git a/src/party_menu.c b/src/party_menu.c index 7db24b6ca..6233558ff 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -49,7 +49,7 @@ #include "pokemon_summary_screen.h" #include "region_map.h" #include "reshow_battle_screen.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "scanline_effect.h" #include "script.h" #include "sound.h" diff --git a/src/start_menu.c b/src/start_menu.c index 4822c12e6..f573f9bdf 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -44,6 +44,7 @@ #include "window.h" #include "constants/songs.h" #include "rom_8011DC0.h" +#include "union_room.h" // Menu actions enum diff --git a/src/trade.c b/src/trade.c index df8f493f1..34f49060f 100644 --- a/src/trade.c +++ b/src/trade.c @@ -19,6 +19,8 @@ #include "load_save.h" #include "mail.h" #include "main.h" +#include "mevent2.h" +#include "mystery_gift.h" #include "overworld.h" #include "palette.h" #include "party_menu.h" @@ -39,6 +41,7 @@ #include "text_window.h" #include "trainer_card.h" #include "trade.h" +#include "union_room.h" #include "util.h" #include "window.h" #include "constants/easy_chat.h" diff --git a/src/union_room.c b/src/union_room.c index 5050b04f1..df0137379 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -40,7 +40,7 @@ #include "strings.h" #include "mevent.h" #include "dynamic_placeholder_text_util.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "easy_chat.h" #include "event_obj_lock.h" #include "union_room_chat.h" @@ -102,8 +102,6 @@ void sub_802493C(u8 monId, MainCallback callback); void sub_80149D8(void); u16 sub_8019930(void); void sub_8018784(u8 windowId); -void sub_8018884(const u8 *src); -bool32 mevent_0814257C(u8 *textState, const u8 *str); s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); diff --git a/sym_ewram.txt b/sym_ewram.txt index 6878e1bd1..0715de97a 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -7,10 +7,9 @@ .include "src/link.o" .include "src/link_rfu.o" .include "src/union_room.o" + .include "src/mystery_gift.o" -gUnknown_02022C58: @ 2022C58 - .space 0x8 - + .align 3 gUnknown_02022C60: @ 2022C60 .space 0x4 From 82a3f29b880037f1e06e26e10f53ecc0c045ec00 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 20:04:30 -0400 Subject: [PATCH 23/30] through sub_8018A50 --- asm/mystery_gift.s | 366 --------------------------------------------- src/mystery_gift.c | 147 +++++++++++++++++- 2 files changed, 145 insertions(+), 368 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 08866a85d..6f2ecd8ce 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,372 +5,6 @@ .text - thumb_func_start sub_8018838 -sub_8018838: @ 8018838 - push {lr} - sub sp, 0xC - cmp r0, 0 - beq _08018846 - cmp r0, 0x1 - beq _0801885E - b _08018876 -_08018846: - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - b _08018876 -_0801885E: - movs r0, 0x20 - str r0, [sp] - movs r0, 0x1E - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x2 - bl FillBgTilemapBufferRect -_08018876: - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_8018838 - - thumb_func_start sub_8018884 -sub_8018884: @ 8018884 - push {r4,lr} - sub sp, 0x14 - adds r1, r0, 0 - ldr r4, =gStringVar4 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - ldr r0, =gUnknown_082F0728 - str r0, [sp, 0x8] - str r1, [sp, 0xC] - str r4, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018884 - - thumb_func_start sub_80188DC -sub_80188DC: @ 80188DC - push {lr} - movs r0, 0x1 - bl rbox_fill_rectangle - movs r0, 0x1 - bl ClearWindowTilemap - movs r0, 0x1 - movs r1, 0x1 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_80188DC - - thumb_func_start mevent_0814257C -mevent_0814257C: @ 80188F8 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r0, r1, 0 - ldrb r2, [r4] - cmp r2, 0x1 - beq _08018920 - cmp r2, 0x1 - bgt _08018910 - cmp r2, 0 - beq _0801891A - b _08018980 -_08018910: - cmp r2, 0x2 - beq _08018954 - cmp r2, 0xFF - beq _0801897C - b _08018980 -_0801891A: - bl sub_8018884 - b _08018944 -_08018920: - movs r0, 0 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018980 -_08018944: - ldrb r0, [r4] - adds r0, 0x1 - b _0801897E - .pool -_08018954: - movs r0, 0x1 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 - b _08018982 - .pool -_0801897C: - movs r0, 0x2 -_0801897E: - strb r0, [r4] -_08018980: - movs r0, 0 -_08018982: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end mevent_0814257C - - thumb_func_start sub_801898C -sub_801898C: @ 801898C - push {lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_801898C - - thumb_func_start sub_80189B4 -sub_80189B4: @ 80189B4 - push {lr} - sub sp, 0xC - movs r0, 0x1 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80189B4 - - thumb_func_start sub_80189DC -sub_80189DC: @ 80189DC - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _080189EC - cmp r0, 0x1 - beq _08018A08 - b _08018A14 -_080189EC: - bl sub_801898C - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018A14 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08018A14 - .pool -_08018A08: - bl sub_80189B4 - movs r0, 0 - strb r0, [r4] - movs r0, 0x1 - b _08018A16 -_08018A14: - movs r0, 0 -_08018A16: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80189DC - - thumb_func_start sub_8018A1C -sub_8018A1C: @ 8018A1C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - bne _08018A2C - adds r0, r1, 0 - bl sub_8018884 -_08018A2C: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x78 - bhi _08018A3E - movs r0, 0 - b _08018A48 -_08018A3E: - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 -_08018A48: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8018A1C - - thumb_func_start sub_8018A50 -sub_8018A50: @ 8018A50 - push {r4,r5,lr} - sub sp, 0x24 - lsls r2, 24 - add r1, sp, 0x4 - ldr r0, =gUnknown_082F0638 - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, =gUnknown_082F05E0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x1C] - str r1, [sp, 0x20] - cmp r2, 0 - bne _08018A80 - ldr r0, =gUnknown_082F0608 - b _08018A82 - .pool -_08018A80: - ldr r0, =gUnknown_082F0620 -_08018A82: - str r0, [sp, 0x4] - add r0, sp, 0x4 - bl sub_81DB41C - adds r3, r0, 0 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _08018A96 - adds r3, 0x1 -_08018A96: - lsls r1, r3, 24 - ldr r0, =0x00ffffff - ldr r2, [sp, 0x1C] - ands r2, r0 - orrs r2, r1 - str r2, [sp, 0x1C] - cmp r3, 0x1D - bgt _08018ACC - movs r0, 0x1E - subs r0, r3 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - lsls r0, 24 - lsrs r0, 16 - ldr r1, =0xffff00ff - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0x1C] - b _08018AD2 - .pool -_08018ACC: - ldr r0, =0xffff00ff - ands r2, r0 - str r2, [sp, 0x1C] -_08018AD2: - add r0, sp, 0x1C - movs r1, 0xE0 - str r1, [sp] - add r1, sp, 0x4 - movs r2, 0x1 - movs r3, 0xA - bl DoMysteryGiftListMenu - adds r4, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08018AFA - movs r0, 0x2 - bl ClearWindowTilemap - movs r0, 0x2 - movs r1, 0x1 - bl CopyWindowToVram -_08018AFA: - adds r0, r4, 0 - add sp, 0x24 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018A50 - thumb_func_start sub_8018B08 sub_8018B08: @ 8018B08 push {r4-r6,lr} diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 3fbe11378..7c686964d 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -20,12 +20,12 @@ #include "ereader_screen.h" #include "international_string_util.h" #include "list_menu.h" +#include "string_util.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); -EWRAM_DATA u8 gUnknown_02022C58 = 0; -EWRAM_DATA u8 gUnknown_02022C59 = 0; +EWRAM_DATA u8 gUnknown_02022C58[2] = {}; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); @@ -492,3 +492,146 @@ void sub_8018798(u32 bg) } } } + +void sub_8018838(bool32 arg) +{ + switch (arg) + { + case 0: + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11); + break; + case 1: + FillBgTilemapBufferRect(0, 0, 0, 2, 32, 30, 0x11); + break; + } + CopyBgTilemapBufferToVram(0); +} + +void sub_8018884(const u8 *str) +{ + StringExpandPlaceholders(gStringVar4, str); + FillWindowPixelBuffer(1, 0x11); + AddTextPrinterParameterized4(1, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); + sub_8098858(1, 0x001, 0xF); + PutWindowTilemap(1); + CopyWindowToVram(1, 3); +} + +void sub_80188DC(void) +{ + rbox_fill_rectangle(1); + ClearWindowTilemap(1); + CopyWindowToVram(1, 1); +} + +bool32 mevent_0814257C(u8 *textState, const u8 *str) +{ + switch (*textState) + { + case 0: + sub_8018884(str); + goto inc; + case 1: + DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + inc: + (*textState)++; + } + break; + case 2: + DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + *textState = 0; + sub_80188DC(); + return TRUE; + case 0xFF: + *textState = 2; + break; + } + return FALSE; +} + +void sub_801898C(void) +{ + DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); +} + +void sub_80189B4(void) +{ + DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); +} + +bool32 sub_80189DC(u8 * textState) +{ + switch (*textState) + { + case 0: + sub_801898C(); + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + (*textState)++; + } + break; + case 1: + sub_80189B4(); + *textState = 0; + return TRUE; + } + return FALSE; +} + +bool32 sub_8018A1C(u8 * counter, const u8 * str) +{ + if (*counter == 0) + { + sub_8018884(str); + } + if (++(*counter) > 120) + { + *counter = 0; + sub_80188DC(); + return TRUE; + } + else + { + return FALSE; + } +} + +s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2) +{ + struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; + struct WindowTemplate windowTemplate = gUnknown_082F05E0; + s32 r3; + s32 r4; + + if (r2 == FALSE) + { + listMenuTemplate.items = gUnknown_082F0608; + } + else + { + listMenuTemplate.items = gUnknown_082F0620; + } + r3 = sub_81DB41C(&listMenuTemplate); + if (r3 & 1) + { + r3++; + } + windowTemplate.width = r3; + if (r3 < 30) + { + windowTemplate.tilemapLeft = (30 - r3) / 2; + } + else + { + windowTemplate.tilemapLeft = 0; + } + r4 = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, 0x00A, 0xE0); + if (r4 != -1) + { + ClearWindowTilemap(2); + CopyWindowToVram(2, 1); + } + return r4; +} From 608a2172403abdae4ceba7f56ab78120dd0b9f1f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 10:33:27 -0400 Subject: [PATCH 24/30] sub_8018B08 --- asm/mystery_gift.s | 145 --------------------------------------------- src/mystery_gift.c | 63 +++++++++++++++++++- 2 files changed, 62 insertions(+), 146 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 6f2ecd8ce..6fec153ca 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,151 +5,6 @@ .text - thumb_func_start sub_8018B08 -sub_8018B08: @ 8018B08 - push {r4-r6,lr} - sub sp, 0x1C - adds r5, r0, 0 - adds r4, r1, 0 - adds r1, r3, 0 - lsls r2, 24 - lsrs r6, r2, 24 - ldrb r0, [r5] - cmp r0, 0x1 - beq _08018B98 - cmp r0, 0x1 - bgt _08018B26 - cmp r0, 0 - beq _08018B30 - b _08018C3E -_08018B26: - cmp r0, 0x2 - beq _08018BE4 - cmp r0, 0xFF - beq _08018C1A - b _08018C3E -_08018B30: - ldr r0, =gStringVar4 - bl StringExpandPlaceholders - cmp r6, 0 - bne _08018B48 - ldr r0, =gUnknown_082F05C8 - b _08018B4A - .pool -_08018B48: - ldr r0, =gUnknown_082F05D0 -_08018B4A: - bl AddWindow - strh r0, [r4] - ldrb r0, [r4] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r4] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =gUnknown_082F0728 - str r1, [sp, 0x8] - str r2, [sp, 0xC] - ldr r1, =gStringVar4 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - ldrb r0, [r4] - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - ldrb r0, [r4] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r4] - bl PutWindowTilemap - b _08018BD6 - .pool -_08018B98: - ldr r0, =gUnknown_082F05E8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x14] - str r1, [sp, 0x18] - cmp r6, 0 - bne _08018BBC - ldr r0, =0xff00ffff - ldr r1, [sp, 0x14] - ands r1, r0 - movs r0, 0x90 - lsls r0, 12 - b _08018BC6 - .pool -_08018BBC: - ldr r0, =0xff00ffff - ldr r1, [sp, 0x14] - ands r1, r0 - movs r0, 0xF0 - lsls r0, 12 -_08018BC6: - orrs r1, r0 - str r1, [sp, 0x14] - add r0, sp, 0x14 - movs r1, 0xA - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu -_08018BD6: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08018C3E - .pool -_08018BE4: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r6, r0, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x2 - bhi _08018C3E - movs r0, 0 - strb r0, [r5] - ldrb r0, [r4] - bl rbox_fill_rectangle - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - adds r0, r6, 0 - b _08018C42 -_08018C1A: - movs r0, 0 - strb r0, [r5] - ldrb r0, [r4] - bl rbox_fill_rectangle - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0x1 - negs r0, r0 - b _08018C42 -_08018C3E: - movs r0, 0x2 - negs r0, r0 -_08018C42: - add sp, 0x1C - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018B08 - thumb_func_start sub_8018C4C sub_8018C4C: @ 8018C4C push {r4-r6,lr} diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 7c686964d..da2a3bcc0 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -598,7 +598,7 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str) } } -s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2) +s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2) { struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; struct WindowTemplate windowTemplate = gUnknown_082F05E0; @@ -635,3 +635,64 @@ s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2) } return r4; } + +s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) +{ + struct WindowTemplate windowTemplate; + s8 input; + + switch (*textState) + { + case 0: + StringExpandPlaceholders(gStringVar4, str); + if (r6 == 0) + { + *windowId = AddWindow(&gUnknown_082F05C8); + } + else + { + *windowId = AddWindow(&gUnknown_082F05D0); + } + FillWindowPixelBuffer(*windowId, 0x11); + AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); + sub_8098858(*windowId, 0x001, 0x0F); + CopyWindowToVram(*windowId, 2); + PutWindowTilemap(*windowId); + (*textState)++; + break; + case 1: + windowTemplate = gUnknown_082F05E8; + if (r6 == 0) + { + windowTemplate.tilemapTop = 9; + } + else + { + windowTemplate.tilemapTop = 15; + } + CreateYesNoMenu(&windowTemplate, 10, 14, 0); + (*textState)++; + break; + case 2: + input = Menu_ProcessInputNoWrapClearOnChoose(); + if (input == -1 || input == 0 || input == 1) + { + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return input; + } + break; + case 0xFF: + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return -1; + } + + return -2; +} From f88f815cff272f4cd19759f2df24f85bc5f02ae1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 11:16:19 -0400 Subject: [PATCH 25/30] WIP sub_8018DAC --- asm/mystery_gift.s | 154 --------------------------------------- include/list_menu.h | 2 +- include/mevent_801BAAC.h | 9 +++ include/strings.h | 2 + src/list_menu.c | 2 +- src/mystery_gift.c | 120 ++++++++++++++++++++++++++++++ 6 files changed, 133 insertions(+), 156 deletions(-) create mode 100644 include/mevent_801BAAC.h diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 6fec153ca..6fc9c31d5 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,160 +5,6 @@ .text - thumb_func_start sub_8018C4C -sub_8018C4C: @ 8018C4C - push {r4-r6,lr} - sub sp, 0x14 - adds r6, r0, 0 - adds r5, r1, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _08018CE8 - cmp r0, 0x1 - bgt _08018C64 - cmp r0, 0 - beq _08018C6C - b _08018D8C -_08018C64: - cmp r0, 0xFF - bne _08018C6A - b _08018D68 -_08018C6A: - b _08018D8C -_08018C6C: - cmp r2, 0 - bne _08018C84 - ldr r0, =gStringVar4 - ldr r1, =gText_WhatToDoWithCards - bl StringExpandPlaceholders - b _08018C8C - .pool -_08018C84: - ldr r0, =gStringVar4 - ldr r1, =gText_WhatToDoWithNews - bl StringExpandPlaceholders -_08018C8C: - ldr r0, =gUnknown_082F05D8 - bl AddWindow - strh r0, [r5] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r5] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =gUnknown_082F0728 - str r1, [sp, 0x8] - str r2, [sp, 0xC] - ldr r1, =gStringVar4 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - ldrb r0, [r5] - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - ldrb r0, [r5] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08018D8C - .pool -_08018CE8: - cmp r3, 0 - beq _08018D10 - cmp r2, 0 - bne _08018D00 - ldr r0, =gUnknown_082F05F8 - ldr r1, =gUnknown_082F06C8 - b _08018D28 - .pool -_08018D00: - ldr r0, =gUnknown_082F0600 - ldr r1, =gUnknown_082F06F8 - b _08018D28 - .pool -_08018D10: - cmp r2, 0 - bne _08018D24 - ldr r0, =gUnknown_082F05F0 - ldr r1, =gUnknown_082F06B0 - b _08018D28 - .pool -_08018D24: - ldr r0, =gUnknown_082F05F8 - ldr r1, =gUnknown_082F06E0 -_08018D28: - movs r2, 0xE0 - str r2, [sp] - movs r2, 0x1 - movs r3, 0xA - bl DoMysteryGiftListMenu - adds r4, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08018D8C - movs r0, 0 - strb r0, [r6] - ldrb r0, [r5] - bl rbox_fill_rectangle - ldrb r0, [r5] - bl ClearWindowTilemap - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r5] - bl RemoveWindow - adds r0, r4, 0 - b _08018D90 - .pool -_08018D68: - movs r0, 0 - strb r0, [r6] - ldrb r0, [r5] - bl rbox_fill_rectangle - ldrb r0, [r5] - bl ClearWindowTilemap - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r5] - bl RemoveWindow - movs r0, 0x2 - negs r0, r0 - b _08018D90 -_08018D8C: - movs r0, 0x1 - negs r0, r0 -_08018D90: - add sp, 0x14 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018C4C - - thumb_func_start sub_8018D98 -sub_8018D98: @ 8018D98 - push {lr} - cmp r0, 0 - beq _08018DA4 - bl sub_801B0CC - b _08018DA8 -_08018DA4: - bl sub_801B27C -_08018DA8: - pop {r1} - bx r1 - thumb_func_end sub_8018D98 - thumb_func_start sub_8018DAC sub_8018DAC: @ 8018DAC push {r4,r5,lr} diff --git a/include/list_menu.h b/include/list_menu.h index a301e5b32..0a54a069a 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -98,7 +98,7 @@ struct CursorStruct extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate; -s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); s32 ListMenu_ProcessInput(u8 listTaskId); diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h new file mode 100644 index 000000000..db1bb0571 --- /dev/null +++ b/include/mevent_801BAAC.h @@ -0,0 +1,9 @@ +#ifndef GUARD_MEVENT_801BAAC_H +#define GUARD_MEVENT_801BAAC_H + +bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6); +bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0); +s32 sub_801BB74(void); +s32 sub_801C758(void); + +#endif //GUARD_MEVENT_801BAAC_H diff --git a/include/strings.h b/include/strings.h index 2f9a64af1..2ef8411c7 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2626,5 +2626,7 @@ extern const u8 gText_VarietyOfEventsImportedWireless[]; extern const u8 gText_WonderCardsInPossession[]; extern const u8 gText_ReadNewsThatArrived[]; extern const u8 gText_ReturnToTitle[]; +extern const u8 gText_WhatToDoWithCards[]; +extern const u8 gText_WhatToDoWithNews[]; #endif // GUARD_STRINGS_H diff --git a/src/list_menu.c b/src/list_menu.c index 57bcc5c4f..3bcd3073d 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -312,7 +312,7 @@ static void ListMenuDummyTask(u8 taskId) } -s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) { switch (sMysteryGiftLinkMenu.state) { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index da2a3bcc0..9561fbbeb 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -21,6 +21,8 @@ #include "international_string_util.h" #include "list_menu.h" #include "string_util.h" +#include "mevent.h" +#include "mevent_801BAAC.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); @@ -696,3 +698,121 @@ s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) return -2; } + +s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3) +{ + struct WindowTemplate windowTemplate; + s32 input; + + switch (*textState) + { + case 0: + if (r2 == 0) + { + StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithCards); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithNews); + } + *windowId = AddWindow(&gUnknown_082F05D8); + FillWindowPixelBuffer(*windowId, 0x11); + AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); + sub_8098858(*windowId, 0x001, 0x0F); + CopyWindowToVram(*windowId, 2); + PutWindowTilemap(*windowId); + (*textState)++; + break; + case 1: + windowTemplate = gUnknown_082F05E8; + if (r3) + { + if (r2 == 0) + { + input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06C8, 1, 0x00A, 0xE0); + } + else + { + input = DoMysteryGiftListMenu(&gUnknown_082F0600, &gUnknown_082F06F8, 1, 0x00A, 0xE0); + } + } + else + { + if (r2 == 0) + { + input = DoMysteryGiftListMenu(&gUnknown_082F05F0, &gUnknown_082F06B0, 1, 0x00A, 0xE0); + } + else + { + input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06E0, 1, 0x00A, 0xE0); + } + } + if (input != -1) + { + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return input; + } + break; + case 0xFF: + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return -2; + } + + return -1; +} + +s32 sub_8018D98(bool32 a0) +{ + if (a0 == 0) + { + return sub_801B27C(); + } + else + { + return sub_801B0CC(); + } +} + +/*bool32 sub_8018DAC(u8 * state, bool32 arg1) +{ + switch (*state) + { + case 0: + if (arg1 == 0) + { + sub_801BAAC(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2()); + } + else + { + sub_801C6C8(sub_801B00C()); + } + (*state)++; + case 1: + if (arg1 == 0) + { + if (sub_801BB74() == 0) + { + break; + } + } + else + { + if (sub_801C758() == 0) + { + break; + } + } + *state = 0; + return TRUE; + } + + return FALSE; +}*/ From 813de11154ac9ac6d561ef820d2a13995ce5bb35 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:27:36 -0400 Subject: [PATCH 26/30] Through mevent_save_game --- asm/mystery_gift.s | 193 --------------------------------------- include/mevent_801BAAC.h | 4 + include/strings.h | 6 ++ src/mystery_gift.c | 118 ++++++++++++++++++++++-- 4 files changed, 120 insertions(+), 201 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 6fc9c31d5..f4a999bc1 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,199 +5,6 @@ .text - thumb_func_start sub_8018DAC -sub_8018DAC: @ 8018DAC - push {r4,r5,lr} - adds r5, r0, 0 - ldrb r0, [r5] - cmp r0, 0 - beq _08018DBC - cmp r0, 0x1 - beq _08018DE4 - b _08018E00 -_08018DBC: - cmp r1, 0 - bne _08018DD4 - bl sav1_get_mevent_buffer_1 - adds r4, r0, 0 - bl sav1_get_mevent_buffer_2 - adds r1, r0, 0 - adds r0, r4, 0 - bl sub_801BAAC - b _08018DDC -_08018DD4: - bl sub_801B00C - bl sub_801C6C8 -_08018DDC: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08018E00 -_08018DE4: - cmp r1, 0 - bne _08018DF2 - bl sub_801BB74 -_08018DEC: - cmp r0, 0 - bne _08018DF8 - b _08018E00 -_08018DF2: - bl sub_801C758 - b _08018DEC -_08018DF8: - movs r0, 0 - strb r0, [r5] - movs r0, 0x1 - b _08018E02 -_08018E00: - movs r0, 0 -_08018E02: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8018DAC - - thumb_func_start sub_8018E08 -sub_8018E08: @ 8018E08 - push {lr} - cmp r0, 0 - bne _08018E14 - bl sub_801B1E8 - b _08018E18 -_08018E14: - bl sub_801B06C -_08018E18: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_8018E08 - - thumb_func_start sub_8018E20 -sub_8018E20: @ 8018E20 - push {lr} - cmp r0, 0 - bne _08018E36 - adds r0, r1, 0 - bl sub_801BDA4 - cmp r0, 0 - beq _08018E40 - bl sub_801BB48 - b _08018E48 -_08018E36: - adds r0, r1, 0 - bl sub_801CA50 - cmp r0, 0 - bne _08018E44 -_08018E40: - movs r0, 0 - b _08018E4A -_08018E44: - bl sub_801C72C -_08018E48: - movs r0, 0x1 -_08018E4A: - pop {r1} - bx r1 - thumb_func_end sub_8018E20 - - thumb_func_start sub_8018E50 -sub_8018E50: @ 8018E50 - push {lr} - cmp r2, 0 - beq _08018E60 - ldr r3, =gText_OkayToDiscardNews - b _08018E62 - .pool -_08018E60: - ldr r3, =gText_IfThrowAwayCardEventWontHappen -_08018E62: - movs r2, 0x1 - bl sub_8018B08 - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018E50 - - thumb_func_start mevent_message_was_thrown_away -mevent_message_was_thrown_away: @ 8018E74 - push {lr} - cmp r1, 0 - beq _08018E84 - ldr r1, =gText_WonderNewsThrownAway - b _08018E86 - .pool -_08018E84: - ldr r1, =gText_WonderCardThrownAway -_08018E86: - bl mevent_0814257C - pop {r1} - bx r1 - .pool - thumb_func_end mevent_message_was_thrown_away - - thumb_func_start mevent_save_game -mevent_save_game: @ 8018E94 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x4 - bhi _08018F04 - lsls r0, 2 - ldr r1, =_08018EAC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018EAC: - .4byte _08018EC0 - .4byte _08018ECC - .4byte _08018ED4 - .4byte _08018EE0 - .4byte _08018EF8 -_08018EC0: - ldr r0, =gText_DataWillBeSaved - bl sub_8018884 - b _08018EEC - .pool -_08018ECC: - movs r0, 0 - bl TrySavingData - b _08018EEC -_08018ED4: - ldr r0, =gText_SaveCompletedPressA - bl sub_8018884 - b _08018EEC - .pool -_08018EE0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018F04 -_08018EEC: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08018F04 - .pool -_08018EF8: - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 - b _08018F06 -_08018F04: - movs r0, 0 -_08018F06: - pop {r4} - pop {r1} - bx r1 - thumb_func_end mevent_save_game - thumb_func_start mevent_message mevent_message: @ 8018F0C push {r4-r6,lr} diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index db1bb0571..d747b389c 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -5,5 +5,9 @@ bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_S bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0); s32 sub_801BB74(void); s32 sub_801C758(void); +s32 sub_801BDA4(bool32 flag); +void sub_801BB48(void); +s32 sub_801CA50(bool32 flag); +void sub_801C72C(void); #endif //GUARD_MEVENT_801BAAC_H diff --git a/include/strings.h b/include/strings.h index 2ef8411c7..36c4e36d9 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2628,5 +2628,11 @@ extern const u8 gText_ReadNewsThatArrived[]; extern const u8 gText_ReturnToTitle[]; extern const u8 gText_WhatToDoWithCards[]; extern const u8 gText_WhatToDoWithNews[]; +extern const u8 gText_IfThrowAwayCardEventWontHappen[]; +extern const u8 gText_OkayToDiscardNews[]; +extern const u8 gText_WonderNewsThrownAway[]; +extern const u8 gText_WonderCardThrownAway[]; +extern const u8 gText_DataWillBeSaved[]; +extern const u8 gText_SaveCompletedPressA[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 9561fbbeb..206a9e50b 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -23,6 +23,7 @@ #include "string_util.h" #include "mevent.h" #include "mevent_801BAAC.h" +#include "save.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); @@ -781,8 +782,10 @@ s32 sub_8018D98(bool32 a0) } } -/*bool32 sub_8018DAC(u8 * state, bool32 arg1) +bool32 sub_8018DAC(u8 * state, bool32 arg1) { + s32 v0; + switch (*state) { case 0: @@ -795,24 +798,123 @@ s32 sub_8018D98(bool32 a0) sub_801C6C8(sub_801B00C()); } (*state)++; + break; case 1: if (arg1 == 0) { - if (sub_801BB74() == 0) + v0 = sub_801BB74(); + check: + if (v0 != 0) { - break; + goto done; } + break; } else { - if (sub_801C758() == 0) - { - break; - } + v0 = sub_801C758(); + goto check; } + done: *state = 0; return TRUE; } return FALSE; -}*/ +} + +bool32 sub_8018E08(bool32 arg0) +{ + if (arg0 == 0) + { + sub_801B1E8(); + } + else + { + sub_801B06C(); + } + return TRUE; +} + +bool32 sub_8018E20(bool32 arg0, bool32 arg1) +{ + if (arg0 == 0) + { + if (sub_801BDA4(arg1) != 0) + { + sub_801BB48(); + return TRUE; + } + else + { + return FALSE; + } + } + else + { + if (sub_801CA50(arg1) != 0) + { + sub_801C72C(); + return TRUE; + } + else + { + return FALSE; + } + } +} + +s8 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) +{ + if (r2 == 0) + { + return sub_8018B08(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen); + } + else + { + return sub_8018B08(textState, windowId, TRUE, gText_OkayToDiscardNews); + } +} + +bool32 mevent_message_was_thrown_away(u8 * textState, bool32 r1) +{ + if (r1 == 0) + { + return mevent_0814257C(textState, gText_WonderCardThrownAway); + } + else + { + return mevent_0814257C(textState, gText_WonderNewsThrownAway); + } +} + +bool32 mevent_save_game(u8 * state) +{ + switch (*state) + { + case 0: + sub_8018884(gText_DataWillBeSaved); + (*state)++; + break; + case 1: + TrySavingData(0); + (*state)++; + break; + case 2: + sub_8018884(gText_SaveCompletedPressA); + (*state)++; + break; + case 3: + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + (*state)++; + } + break; + case 4: + *state = 0; + sub_80188DC(); + return TRUE; + } + + return FALSE; +} From fb5c19a33bf314f4976ae56ce13f4dc9d9ed0fe0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:36:48 -0400 Subject: [PATCH 27/30] through mevent_message --- asm/mystery_gift.s | 138 --------------------------------------------- include/strings.h | 16 ++++++ src/mystery_gift.c | 70 +++++++++++++++++++++++ 3 files changed, 86 insertions(+), 138 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index f4a999bc1..ab25f5dbf 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,144 +5,6 @@ .text - thumb_func_start mevent_message -mevent_message: @ 8018F0C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r2, 0 - str r2, [r4] - cmp r3, 0xE - bls _08018F22 - b _08019034 -_08018F22: - lsls r0, r3, 2 - ldr r1, =_08018F30 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018F30: - .4byte _08018F6C - .4byte _08018F78 - .4byte _08018F84 - .4byte _08018F9C - .4byte _08018FB4 - .4byte _08018FC0 - .4byte _08018FCC - .4byte _08018FD8 - .4byte _08018FE4 - .4byte _08018FF0 - .4byte _08018FFC - .4byte _08019014 - .4byte _08019020 - .4byte _0801902C - .4byte _08019030 -_08018F6C: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NothingSentOver - b _08019034 - .pool -_08018F78: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_RecordUploadedViaWireless - b _08019034 - .pool -_08018F84: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderCardReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderCardReceived - b _08019034 - .pool -_08018F9C: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderNewsReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderNewsReceived - b _08019034 - .pool -_08018FB4: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewStampReceived - b _08019034 - .pool -_08018FC0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadCard - b _08019034 - .pool -_08018FCC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadStamp - b _08019034 - .pool -_08018FD8: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadNews - b _08019034 - .pool -_08018FE4: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NoMoreRoomForStamps - b _08019034 - .pool -_08018FF0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationCanceled - b _08019034 - .pool -_08018FFC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CantAcceptNewsFromTrainer - cmp r6, 0 - bne _08019034 - ldr r2, =gText_CantAcceptCardFromTrainer - b _08019034 - .pool -_08019014: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationError - b _08019034 - .pool -_08019020: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewTrainerReceived - b _08019034 - .pool -_0801902C: - movs r0, 0x1 - b _08019032 -_08019030: - movs r0, 0 -_08019032: - str r0, [r4] -_08019034: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_message - thumb_func_start mevent_08142CE8 mevent_08142CE8: @ 801903C push {r4-r6,lr} diff --git a/include/strings.h b/include/strings.h index 36c4e36d9..4a07d4efb 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2634,5 +2634,21 @@ extern const u8 gText_WonderNewsThrownAway[]; extern const u8 gText_WonderCardThrownAway[]; extern const u8 gText_DataWillBeSaved[]; extern const u8 gText_SaveCompletedPressA[]; +extern const u8 gText_NothingSentOver[]; +extern const u8 gText_RecordUploadedViaWireless[]; +extern const u8 gText_WonderCardReceivedFrom[]; +extern const u8 gText_WonderCardReceived[]; +extern const u8 gText_WonderNewsReceivedFrom[]; +extern const u8 gText_WonderNewsReceived[]; +extern const u8 gText_NewStampReceived[]; +extern const u8 gText_AlreadyHadCard[]; +extern const u8 gText_AlreadyHadStamp[]; +extern const u8 gText_AlreadyHadNews[]; +extern const u8 gText_NoMoreRoomForStamps[]; +extern const u8 gText_CommunicationCanceled[]; +extern const u8 gText_CantAcceptNewsFromTrainer[]; +extern const u8 gText_CantAcceptCardFromTrainer[]; +extern const u8 gText_CommunicationError[]; +extern const u8 gText_NewTrainerReceived[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 206a9e50b..c8a507355 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -918,3 +918,73 @@ bool32 mevent_save_game(u8 * state) return FALSE; } + +const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) +{ + const u8 * msg = NULL; + *a0 = 0; + + switch (a3) + { + case 0: + *a0 = 0; + msg = gText_NothingSentOver; + break; + case 1: + *a0 = 0; + msg = gText_RecordUploadedViaWireless; + break; + case 2: + *a0 = 1; + msg = a2 == 0 ? gText_WonderCardReceived : gText_WonderCardReceivedFrom; + break; + case 3: + *a0 = 1; + msg = a2 == 0 ? gText_WonderNewsReceived : gText_WonderNewsReceivedFrom; + break; + case 4: + *a0 = 1; + msg = gText_NewStampReceived; + break; + case 5: + *a0 = 0; + msg = gText_AlreadyHadCard; + break; + case 6: + *a0 = 0; + msg = gText_AlreadyHadStamp; + break; + case 7: + *a0 = 0; + msg = gText_AlreadyHadNews; + break; + case 8: + *a0 = 0; + msg = gText_NoMoreRoomForStamps; + break; + case 9: + *a0 = 0; + msg = gText_CommunicationCanceled; + break; + case 10: + *a0 = 0; + msg = a1 == 0 ? gText_CantAcceptCardFromTrainer : gText_CantAcceptNewsFromTrainer; + break; + case 11: + *a0 = 0; + msg = gText_CommunicationError; + break; + case 12: + *a0 = 1; + msg = gText_NewTrainerReceived; + break; + case 13: + *a0 = 1; + break; + case 14: + *a0 = 0; + break; + } + + return msg; +} From 90fb329b70433e75cfd571d8b33df2593d2b7656 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:55:27 -0400 Subject: [PATCH 28/30] through task_add_00_mystery_gift --- asm/mystery_gift.s | 217 --------------------------------------------- include/strings.h | 11 +++ src/mystery_gift.c | 142 +++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 217 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index ab25f5dbf..bf298a4d3 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,223 +5,6 @@ .text - thumb_func_start mevent_08142CE8 -mevent_08142CE8: @ 801903C - push {r4-r6,lr} - adds r6, r0, 0 - adds r0, r1, 0 - adds r5, r2, 0 - ldrb r4, [r6] - cmp r4, 0x1 - beq _0801906E - cmp r4, 0x1 - bgt _08019054 - cmp r4, 0 - beq _0801905A - b _0801909A -_08019054: - cmp r4, 0x2 - beq _08019084 - b _0801909A -_0801905A: - cmp r0, 0 - beq _08019062 - bl sub_8018884 -_08019062: - movs r0, 0xB9 - lsls r0, 1 - bl PlayFanfare - strh r4, [r5] - b _0801907C -_0801906E: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xF0 - bls _0801909A -_0801907C: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _0801909A -_08019084: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _0801909A - movs r0, 0 - strb r0, [r6] - bl sub_80188DC - movs r0, 0x1 - b _0801909C -_0801909A: - movs r0, 0 -_0801909C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_08142CE8 - - thumb_func_start mevent_message_stamp_card_etc_send_status -mevent_message_stamp_card_etc_send_status: @ 80190A4 - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gText_CommunicationError - movs r0, 0 - str r0, [r3] - adds r4, r1, 0 - cmp r2, 0xE - bhi _08019166 - lsls r0, r2, 2 - ldr r1, =_080190C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080190C8: - .4byte _08019104 - .4byte _0801910C - .4byte _08019114 - .4byte _0801911C - .4byte _08019128 - .4byte _08019130 - .4byte _08019138 - .4byte _08019140 - .4byte _08019148 - .4byte _08019150 - .4byte _08019164 - .4byte _08019158 - .4byte _0801915C - .4byte _0801915C - .4byte _08019164 -_08019104: - ldr r1, =gText_NothingSentOver - b _08019166 - .pool -_0801910C: - ldr r1, =gText_RecordUploadedViaWireless - b _08019166 - .pool -_08019114: - ldr r1, =gText_WonderCardSentTo - b _0801911E - .pool -_0801911C: - ldr r1, =gText_WonderNewsSentTo -_0801911E: - movs r0, 0x1 - str r0, [r3] - b _08019166 - .pool -_08019128: - ldr r1, =gText_StampSentTo - b _08019166 - .pool -_08019130: - ldr r1, =gText_OtherTrainerHasCard - b _08019166 - .pool -_08019138: - ldr r1, =gText_OtherTrainerHasStamp - b _08019166 - .pool -_08019140: - ldr r1, =gText_OtherTrainerHasNews - b _08019166 - .pool -_08019148: - ldr r1, =gText_NoMoreRoomForStamps - b _08019166 - .pool -_08019150: - ldr r1, =gText_OtherTrainerCanceled - b _08019166 - .pool -_08019158: - adds r1, r4, 0 - b _08019166 -_0801915C: - ldr r1, =gText_GiftSentTo - b _08019166 - .pool -_08019164: - ldr r1, =gText_CantSendGiftToTrainer -_08019166: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end mevent_message_stamp_card_etc_send_status - - thumb_func_start sub_8019174 -sub_8019174: @ 8019174 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - adds r1, r2, 0 - adds r2, r3, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - bl mevent_message_stamp_card_etc_send_status - adds r1, r0, 0 - ldr r0, [sp] - cmp r0, 0 - bne _0801919A - adds r0, r4, 0 - bl mevent_0814257C - b _080191A2 -_0801919A: - adds r0, r4, 0 - adds r2, r5, 0 - bl mevent_08142CE8 -_080191A2: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8019174 - - thumb_func_start task_add_00_mystery_gift -task_add_00_mystery_gift: @ 80191AC - push {r4,lr} - ldr r0, =task00_mystery_gift - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r0, 0 - strb r0, [r4, 0x8] - strb r0, [r4, 0x9] - strb r0, [r4, 0xA] - strb r0, [r4, 0xB] - strb r0, [r4, 0xC] - strb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4] - strh r0, [r4, 0x2] - strh r0, [r4, 0x4] - strh r0, [r4, 0x6] - strb r1, [r4, 0xE] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_add_00_mystery_gift - thumb_func_start task00_mystery_gift task00_mystery_gift: @ 80191F4 push {r4,r5,lr} diff --git a/include/strings.h b/include/strings.h index 4a07d4efb..0e6b2f31c 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2650,5 +2650,16 @@ extern const u8 gText_CantAcceptNewsFromTrainer[]; extern const u8 gText_CantAcceptCardFromTrainer[]; extern const u8 gText_CommunicationError[]; extern const u8 gText_NewTrainerReceived[]; +extern const u8 gText_RecordUploadedViaWireless[]; +extern const u8 gText_WonderCardSentTo[]; +extern const u8 gText_WonderNewsSentTo[]; +extern const u8 gText_StampSentTo[]; +extern const u8 gText_OtherTrainerHasCard[]; +extern const u8 gText_OtherTrainerHasStamp[]; +extern const u8 gText_OtherTrainerHasNews[]; +extern const u8 gText_NoMoreRoomForStamps[]; +extern const u8 gText_OtherTrainerCanceled[]; +extern const u8 gText_GiftSentTo[]; +extern const u8 gText_CantSendGiftToTrainer[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index c8a507355..30aa6f323 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -27,12 +27,34 @@ void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); +void task00_mystery_gift(u8 taskId); EWRAM_DATA u8 gUnknown_02022C58[2] = {}; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); +struct MysteryGiftExtraData +{ + u8 filler_00[0x40]; +}; + +struct MysteryGiftTaskData +{ + u16 unk0; + u16 unk2; + u16 unk4; + u16 unk6; + u8 unk8; + u8 unk9; + u8 unkA; + u8 unkB; + u8 unkC; + u8 unkD; + u8 unkE; + struct MysteryGiftExtraData * unk10; +}; + const struct BgTemplate gUnknown_082F0598[] = { { .bg = 0, @@ -988,3 +1010,123 @@ const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) return msg; } + +bool32 mevent_08142CE8(u8 * state, const u8 * arg1, u16 * arg2) +{ + switch (*state) + { + case 0: + if (arg1 != NULL) + { + sub_8018884(arg1); + } + PlayFanfare(MUS_FANFA4); + *arg2 = 0; + (*state)++; + break; + case 1: + if (++(*arg2) > 0xF0) + { + (*state)++; + } + break; + case 2: + if (IsFanfareTaskInactive()) + { + *state = 0; + sub_80188DC(); + return TRUE; + } + break; + } + return FALSE; +} + +const u8 * mevent_message_stamp_card_etc_send_status(u32 * a0, u8 unused, u32 state) +{ + const u8 * result = gText_CommunicationError; + *a0 = 0; + switch (state) + { + case 0: + result = gText_NothingSentOver; + break; + case 1: + result = gText_RecordUploadedViaWireless; + break; + case 2: + result = gText_WonderCardSentTo; + *a0 = 1; + break; + case 3: + result = gText_WonderNewsSentTo; + *a0 = 1; + break; + case 4: + result = gText_StampSentTo; + break; + case 5: + result = gText_OtherTrainerHasCard; + break; + case 6: + result = gText_OtherTrainerHasStamp; + break; + case 7: + result = gText_OtherTrainerHasNews; + break; + case 8: + result = gText_NoMoreRoomForStamps; + break; + case 9: + result = gText_OtherTrainerCanceled; + break; + case 10: + result = gText_CantSendGiftToTrainer; + break; + case 11: + result = gText_CommunicationError; + break; + case 12: + result = gText_GiftSentTo; + break; + case 13: + result = gText_GiftSentTo; + break; + case 14: + result = gText_CantSendGiftToTrainer; + break; + } + return result; +} + +bool32 sub_8019174(u8 * state_p, u16 * arg1, u8 arg2, u32 state) +{ + u32 flag; + const u8 * str = mevent_message_stamp_card_etc_send_status(&flag, arg2, state); + if (flag) + { + return mevent_08142CE8(state_p, str, arg1); + } + else + { + return mevent_0814257C(state_p, str); + } +} + +void task_add_00_mystery_gift(void) +{ + u8 taskId = CreateTask(task00_mystery_gift, 0); + struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; + data->unk8 = 0; + data->unk9 = 0; + data->unkA = 0; + data->unkB = 0; + data->unkC = 0; + data->unkD = 0; + data->unk0 = 0; + data->unk2 = 0; + data->unk4 = 0; + data->unk6 = 0; + data->unkE = 0; + data->unk10 = AllocZeroed(sizeof(*data->unk10)); +} From 0a8427c8effeefc58c542f249d7384648585ff4a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 15:50:25 -0400 Subject: [PATCH 29/30] fakematching task00_mystery_gift --- asm/mystery_gift.s | 864 ------------------------------------ include/mevent_801BAAC.h | 3 + include/mevent_news.h | 1 + include/mevent_server.h | 8 + include/mevent_server_ish.h | 10 + include/strings.h | 11 + include/union_room.h | 3 + src/mevent_801BAAC.c | 2 +- src/mystery_gift.c | 580 +++++++++++++++++++++++- 9 files changed, 607 insertions(+), 875 deletions(-) create mode 100644 include/mevent_server.h create mode 100644 include/mevent_server_ish.h diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index bf298a4d3..db75b6f45 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,870 +5,6 @@ .text - thumb_func_start task00_mystery_gift -task00_mystery_gift: @ 80191F4 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrb r0, [r5, 0x8] - cmp r0, 0x25 - bls _0801920E - b _08019922 -_0801920E: - lsls r0, 2 - ldr r1, =_08019220 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08019220: - .4byte _080192B8 - .4byte _080192BE - .4byte _08019300 - .4byte _08019338 - .4byte _0801935C - .4byte _080193AC - .4byte _0801940C - .4byte _08019444 - .4byte _08019454 - .4byte _080194CC - .4byte _080194F0 - .4byte _08019508 - .4byte _08019538 - .4byte _08019574 - .4byte _0801958C - .4byte _080195BC - .4byte _080198EC - .4byte _0801961A - .4byte _0801962A - .4byte _08019922 - .4byte _0801963C - .4byte _08019688 - .4byte _080196FE - .4byte _0801972E - .4byte _08019764 - .4byte _0801977E - .4byte _08019792 - .4byte _0801979E - .4byte _080197B2 - .4byte _080197C6 - .4byte _080197F8 - .4byte _0801982C - .4byte _08019870 - .4byte _08019884 - .4byte _080198A0 - .4byte _080198B8 - .4byte _080198EC - .4byte _0801990C -_080192B8: - movs r0, 0x1 - strb r0, [r5, 0x8] - b _08019922 -_080192BE: - adds r0, r5, 0 - adds r0, 0x9 - adds r1, r5, 0 - movs r2, 0 - bl sub_8018A50 - adds r1, r0, 0 - cmp r1, 0x1 - beq _080192E8 - cmp r1, 0x1 - bcc _080192DE - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080192FA - b _08019922 -_080192DE: - movs r0, 0 - strb r0, [r5, 0xC] - bl sub_801B27C - b _080192EE -_080192E8: - strb r1, [r5, 0xC] - bl sub_801B0CC -_080192EE: - cmp r0, 0x1 - bne _080192F4 - b _08019820 -_080192F4: - movs r0, 0x2 - strb r0, [r5, 0x8] - b _08019922 -_080192FA: - movs r0, 0x25 - strb r0, [r5, 0x8] - b _08019922 -_08019300: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019314 - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_DontHaveCardNewOneInput - b _0801931A - .pool -_08019314: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_DontHaveNewsNewOneInput -_0801931A: - bl mevent_0814257C - cmp r0, 0 - bne _08019324 - b _08019922 -_08019324: - movs r0, 0x3 - strb r0, [r5, 0x8] - movs r0, 0 - movs r1, 0x1 - bl sub_80186EC - b _08019922 - .pool -_08019338: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _0801934C - ldr r0, =gText_WhereShouldCardBeAccessed - bl sub_8018884 - b _08019352 - .pool -_0801934C: - ldr r0, =gText_WhereShouldNewsBeAccessed - bl sub_8018884 -_08019352: - movs r0, 0x4 - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801935C: - adds r0, r5, 0 - adds r0, 0x9 - adds r1, r5, 0 - movs r2, 0x1 - bl sub_8018A50 - adds r4, r0, 0 - cmp r4, 0x1 - beq _0801938A - cmp r4, 0x1 - bcc _0801937C - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _08019396 - b _08019922 -_0801937C: - bl sub_80188DC - movs r1, 0 - movs r0, 0x5 - strb r0, [r5, 0x8] - strb r1, [r5, 0xD] - b _08019922 -_0801938A: - bl sub_80188DC - movs r0, 0x5 - strb r0, [r5, 0x8] - strb r4, [r5, 0xD] - b _08019922 -_08019396: - bl sub_80188DC - ldrb r0, [r5, 0xC] - bl sub_8018D98 - cmp r0, 0 - beq _080193A6 - b _08019820 -_080193A6: - strb r0, [r5, 0x8] - movs r0, 0 - b _080198FE -_080193AC: - ldr r0, =gStringVar1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gStringVar2 - strb r1, [r0] - ldr r0, =gStringVar3 - strb r1, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0 - beq _080193D4 - cmp r0, 0x1 - beq _080193EE - b _08019406 - .pool -_080193D4: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080193E2 - movs r0, 0x15 - bl sub_8014EFC - b _08019406 -_080193E2: - cmp r0, 0 - bne _08019406 - movs r0, 0x15 - bl sub_80152A8 - b _08019406 -_080193EE: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080193FC - movs r0, 0x16 - bl sub_8014EFC - b _08019406 -_080193FC: - cmp r0, 0 - bne _08019406 - movs r0, 0x16 - bl sub_80152A8 -_08019406: - movs r0, 0x6 - strb r0, [r5, 0x8] - b _08019922 -_0801940C: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801942C - movs r0, 0x1 - bl sub_8018838 - movs r0, 0x7 - strb r0, [r5, 0x8] - ldrb r0, [r5, 0xC] - bl sub_801D484 - b _08019922 - .pool -_0801942C: - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x5 - beq _08019436 - b _08019922 -_08019436: - movs r0, 0x1 - bl sub_8018838 - b _080197C0 - .pool -_08019444: - ldr r0, =gText_Communicating - bl sub_8018884 - movs r0, 0x8 - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019454: - adds r0, r5, 0 - bl sub_801D4A8 - subs r0, 0x2 - cmp r0, 0x4 - bls _08019462 - b _08019922 -_08019462: - lsls r0, 2 - ldr r1, =_08019470 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08019470: - .4byte _080194AE - .4byte _080194A8 - .4byte _080194B4 - .4byte _08019492 - .4byte _08019484 -_08019484: - bl task_add_05_task_del_08FA224_when_no_RfuFunc - ldrh r0, [r5] - strb r0, [r5, 0xE] - movs r0, 0xD - strb r0, [r5, 0x8] - b _08019922 -_08019492: - ldr r4, [r5, 0x10] - bl sub_801D4F4 - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0x40 - bl memcpy - bl sub_801D4E4 - b _08019922 -_080194A8: - movs r0, 0xA - strb r0, [r5, 0x8] - b _08019922 -_080194AE: - movs r0, 0x9 - strb r0, [r5, 0x8] - b _08019922 -_080194B4: - movs r0, 0xB - strb r0, [r5, 0x8] - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 8 - bl StringCopy - b _08019922 - .pool -_080194CC: - adds r4, r5, 0 - adds r4, 0x9 - bl sub_801D4F4 - adds r3, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcs _08019552 - movs r0, 0 - b _08019566 -_080194F0: - adds r4, r5, 0 - adds r4, 0x9 - bl sub_801D4F4 - adds r1, r0, 0 - adds r0, r4, 0 - bl mevent_0814257C - cmp r0, 0 - bne _08019506 - b _08019922 -_08019506: - b _0801956A -_08019508: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_ThrowAwayWonderCard - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcs _08019552 - bl sub_801B3F8 - cmp r0, 0x1 - bne _08019534 - movs r0, 0xC - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019534: - movs r0, 0 - b _08019566 -_08019538: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_HaventReceivedCardsGift - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcc _08019560 -_08019552: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08019564 - b _08019922 - .pool -_08019560: - movs r0, 0 - b _08019566 -_08019564: - movs r0, 0x1 -_08019566: - bl sub_801D500 -_0801956A: - bl sub_801D4E4 - movs r0, 0x7 - strb r0, [r5, 0x8] - b _08019922 -_08019574: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801957E - b _08019922 -_0801957E: - bl sub_800E084 - movs r0, 0xE - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801958C: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_CommunicationCompleted - bl sub_8018A1C - cmp r0, 0 - bne _0801959C - b _08019922 -_0801959C: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080195AA - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 8 - bl StringCopy -_080195AA: - movs r0, 0xF - strb r0, [r5, 0x8] - b _08019922 - .pool -_080195BC: - ldrb r1, [r5, 0xC] - ldrb r2, [r5, 0xD] - ldrb r3, [r5, 0xE] - mov r0, sp - bl mevent_message - adds r1, r0, 0 - cmp r1, 0 - bne _080195D0 - ldr r1, [r5, 0x10] -_080195D0: - ldr r0, [sp] - cmp r0, 0 - beq _080195E2 - adds r0, r5, 0 - adds r0, 0x9 - adds r2, r5, 0 - bl mevent_08142CE8 - b _080195EA -_080195E2: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_0814257C -_080195EA: - adds r1, r0, 0 - cmp r1, 0 - bne _080195F2 - b _08019922 -_080195F2: - ldrb r0, [r5, 0xE] - cmp r0, 0x3 - bne _0801960C - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _08019606 - movs r0, 0x1 - bl sub_801DB68 - b _0801960C -_08019606: - movs r0, 0x2 - bl sub_801DB68 -_0801960C: - ldr r0, [sp] - cmp r0, 0 - beq _08019614 - b _080198DC -_08019614: - strb r0, [r5, 0x8] - movs r0, 0 - b _080198FE -_0801961A: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_save_game - cmp r0, 0 - bne _08019628 - b _08019922 -_08019628: - b _08019820 -_0801962A: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r1, [r5, 0xC] - bl sub_8018DAC - cmp r0, 0 - bne _0801963A - b _08019922 -_0801963A: - b _080196F8 -_0801963C: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019664 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08019652 - movs r0, 0x15 - strb r0, [r5, 0x8] -_08019652: - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0801965E - b _08019922 -_0801965E: - b _08019682 - .pool -_08019664: - ldr r0, =gMain - ldrh r0, [r0, 0x2E] - bl sub_801CCD0 - cmp r0, 0 - beq _0801967C - cmp r0, 0x1 - beq _08019682 - b _08019922 - .pool -_0801967C: - bl sub_801CC38 - b _0801975E -_08019682: - movs r0, 0x1B - strb r0, [r5, 0x8] - b _08019922 -_08019688: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _080196A2 - bl sub_801B308 - cmp r0, 0 - beq _080196B6 - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0 - b _080196C0 -_080196A2: - bl sub_801B128 - cmp r0, 0 - beq _080196B6 - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0 - b _080196C0 -_080196B6: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0x1 -_080196C0: - bl sub_8018C4C - adds r1, r0, 0 - cmp r1, 0x1 - beq _080196E2 - cmp r1, 0x1 - bcc _080196DC - cmp r1, 0x2 - beq _080196E8 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080196EE - b _08019922 -_080196DC: - movs r0, 0x1C - strb r0, [r5, 0x8] - b _08019922 -_080196E2: - movs r0, 0x1D - strb r0, [r5, 0x8] - b _08019922 -_080196E8: - movs r0, 0x16 - strb r0, [r5, 0x8] - b _08019922 -_080196EE: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _080196F8 - bl sub_801CC80 -_080196F8: - movs r0, 0x14 - strb r0, [r5, 0x8] - b _08019922 -_080196FE: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - bl sub_8018E50 - adds r1, r0, 0 - cmp r1, 0 - beq _0801971A - cmp r1, 0 - ble _08019748 - cmp r1, 0x1 - beq _0801975E - b _08019922 -_0801971A: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019758 - bl sub_801B3F8 - cmp r0, 0x1 - bne _08019758 - movs r0, 0x17 - strb r0, [r5, 0x8] - b _08019922 -_0801972E: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_HaventReceivedGiftOkayToDiscard - adds r1, r5, 0 - movs r2, 0x1 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _0801975E - cmp r1, 0x1 - bcc _08019758 -_08019748: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801975E - b _08019922 - .pool -_08019758: - movs r0, 0x18 - strb r0, [r5, 0x8] - b _08019922 -_0801975E: - movs r0, 0x15 - strb r0, [r5, 0x8] - b _08019922 -_08019764: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _08019772 - b _08019922 -_08019772: - ldrb r0, [r5, 0xC] - bl sub_8018E08 - movs r0, 0x19 - strb r0, [r5, 0x8] - b _08019922 -_0801977E: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_save_game - cmp r0, 0 - bne _0801978C - b _08019922 -_0801978C: - movs r0, 0x1A - strb r0, [r5, 0x8] - b _08019922 -_08019792: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r1, [r5, 0xC] - bl mevent_message_was_thrown_away - b _080198F6 -_0801979E: - ldrb r0, [r5, 0xC] - movs r1, 0 - bl sub_8018E20 - cmp r0, 0 - bne _080197AC - b _08019922 -_080197AC: - movs r0, 0 - strb r0, [r5, 0x8] - b _08019922 -_080197B2: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _080197C0 - b _08019922 -_080197C0: - movs r0, 0x3 - strb r0, [r5, 0x8] - b _08019922 -_080197C6: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _080197D4 - b _08019922 -_080197D4: - ldrb r0, [r5, 0xC] - cmp r0, 0 - beq _080197E0 - cmp r0, 0x1 - beq _080197E8 - b _080197EE -_080197E0: - movs r0, 0x15 - bl sub_8014A00 - b _080197EE -_080197E8: - movs r0, 0x16 - bl sub_8014A00 -_080197EE: - movs r0, 0x1 - strb r0, [r5, 0xD] - movs r0, 0x1E - strb r0, [r5, 0x8] - b _08019922 -_080197F8: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08019810 - movs r0, 0x1 - bl sub_8018838 - movs r0, 0x1F - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019810: - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x5 - beq _0801981A - b _08019922 -_0801981A: - movs r0, 0x1 - bl sub_8018838 -_08019820: - movs r0, 0x12 - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801982C: - ldr r0, =gStringVar1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gStringVar2 - strb r1, [r0] - ldr r0, =gStringVar3 - strb r1, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _0801985C - ldr r0, =gText_SendingWonderCard - bl sub_8018884 - bl mevent_srv_new_wcard - b _08019866 - .pool -_0801985C: - ldr r0, =gText_SendingWonderNews - bl sub_8018884 - bl mevent_srv_init_wnews -_08019866: - movs r0, 0x20 - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019870: - adds r0, r5, 0 - bl sub_801D0C4 - cmp r0, 0x3 - bne _08019922 - ldrh r0, [r5] - strb r0, [r5, 0xE] - movs r0, 0x21 - strb r0, [r5, 0x8] - b _08019922 -_08019884: - bl task_add_05_task_del_08FA224_when_no_RfuFunc - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name - bl StringCopy - movs r0, 0x22 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198A0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08019922 - bl sub_800E084 - movs r0, 0x23 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198B8: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xD] - ldrb r3, [r5, 0xE] - adds r1, r5, 0 - bl sub_8019174 - cmp r0, 0 - beq _08019922 - ldr r0, [r5, 0xC] - ldr r1, =0x00ffff00 - ands r0, r1 - ldr r1, =0x00030100 - cmp r0, r1 - bne _080198FA - movs r0, 0x3 - bl sub_801DB68 -_080198DC: - movs r0, 0x11 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198EC: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_CommunicationError - bl mevent_0814257C -_080198F6: - cmp r0, 0 - beq _08019922 -_080198FA: - movs r0, 0 - strb r0, [r5, 0x8] -_080198FE: - movs r1, 0 - bl sub_80186EC - b _08019922 - .pool -_0801990C: - bl CloseLink - ldr r0, [r5, 0x10] - bl Free - adds r0, r4, 0 - bl DestroyTask - ldr r0, =sub_80186A4 - bl SetMainCallback2 -_08019922: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task00_mystery_gift - thumb_func_start sub_8019930 sub_8019930: @ 8019930 ldr r0, =0x000001a9 diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index d747b389c..2259d3b6d 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -9,5 +9,8 @@ s32 sub_801BDA4(bool32 flag); void sub_801BB48(void); s32 sub_801CA50(bool32 flag); void sub_801C72C(void); +u32 sub_801CCD0(u16 input); +void sub_801CC80(void); +void sub_801CC38(void); #endif //GUARD_MEVENT_801BAAC_H diff --git a/include/mevent_news.h b/include/mevent_news.h index 698d7148c..4632edd38 100755 --- a/include/mevent_news.h +++ b/include/mevent_news.h @@ -2,5 +2,6 @@ #define GUARD_MEVENT_NEWS_H void sub_801DBC0(void); +void sub_801DB68(u32 a0); #endif //GUARD_MEVENT_NEWS_H diff --git a/include/mevent_server.h b/include/mevent_server.h new file mode 100644 index 000000000..ca3b7091b --- /dev/null +++ b/include/mevent_server.h @@ -0,0 +1,8 @@ +#ifndef GUARD_MEVENT_SERVER_H +#define GUARD_MEVENT_SERVER_H + +void mevent_srv_new_wcard(); +void mevent_srv_init_wnews(); +u32 sub_801D0C4(u16 * a0); + +#endif //GUARD_MEVENT_SERVER_H diff --git a/include/mevent_server_ish.h b/include/mevent_server_ish.h new file mode 100644 index 000000000..76f5080dc --- /dev/null +++ b/include/mevent_server_ish.h @@ -0,0 +1,10 @@ +#ifndef GUARD_MEVENT_SERVER_ISH_H +#define GUARD_MEVENT_SERVER_ISH_H + +void sub_801D484(u32 arg); +u32 sub_801D4A8(u16 * a0); +void sub_801D4E4(void); +void * sub_801D4F4(void); +void sub_801D500(u32 a0); + +#endif //GUARD_MEVENT_SERVER_ISH_H diff --git a/include/strings.h b/include/strings.h index 0e6b2f31c..1561da26d 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2661,5 +2661,16 @@ extern const u8 gText_NoMoreRoomForStamps[]; extern const u8 gText_OtherTrainerCanceled[]; extern const u8 gText_GiftSentTo[]; extern const u8 gText_CantSendGiftToTrainer[]; +extern const u8 gText_DontHaveCardNewOneInput[]; +extern const u8 gText_DontHaveNewsNewOneInput[]; +extern const u8 gText_WhereShouldCardBeAccessed[]; +extern const u8 gText_WhereShouldNewsBeAccessed[]; +extern const u8 gText_Communicating[]; +extern const u8 gText_ThrowAwayWonderCard[]; +extern const u8 gText_HaventReceivedCardsGift[]; +extern const u8 gText_CommunicationCompleted[]; +extern const u8 gText_HaventReceivedGiftOkayToDiscard[]; +extern const u8 gText_SendingWonderCard[]; +extern const u8 gText_SendingWonderNews[]; #endif // GUARD_STRINGS_H diff --git a/include/union_room.h b/include/union_room.h index 84a7f1f2b..3d60e1432 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -169,6 +169,9 @@ void var_800D_set_xB(void); bool32 mevent_0814257C(u8 *textState, const u8 *str); void sub_8018884(const u8 *src); void sub_80186A4(void); +void sub_8014EFC(u32 arg0); +void sub_80152A8(u32 arg0); +void sub_8014A00(u32 arg0); extern bool8 gUnknown_02022C60; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index d69ab0495..b9931a682 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -724,7 +724,7 @@ void sub_801CC80(void) } } -u8 sub_801CCD0(u16 input) +u32 sub_801CCD0(u16 input) { if (gUnknown_02022C78->unk_01C2_0) { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 30aa6f323..5e000a249 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -24,6 +24,12 @@ #include "mevent.h" #include "mevent_801BAAC.h" #include "save.h" +#include "link.h" +#include "mevent_server_ish.h" +#include "event_data.h" +#include "link_rfu.h" +#include "mevent_news.h" +#include "mevent_server.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); @@ -34,11 +40,6 @@ EWRAM_DATA u8 gUnknown_02022C58[2] = {}; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); -struct MysteryGiftExtraData -{ - u8 filler_00[0x40]; -}; - struct MysteryGiftTaskData { u16 unk0; @@ -52,7 +53,7 @@ struct MysteryGiftTaskData u8 unkC; u8 unkD; u8 unkE; - struct MysteryGiftExtraData * unk10; + u8 * unk10; }; const struct BgTemplate gUnknown_082F0598[] = { @@ -623,7 +624,7 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str) } } -s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2) +u32 sub_8018A50(u8 * unused0, u16 * unused1, bool8 r2) { struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; struct WindowTemplate windowTemplate = gUnknown_082F05E0; @@ -661,7 +662,7 @@ s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2) return r4; } -s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) +s8 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) { struct WindowTemplate windowTemplate; s8 input; @@ -886,7 +887,7 @@ bool32 sub_8018E20(bool32 arg0, bool32 arg1) } } -s8 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) +s32 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) { if (r2 == 0) { @@ -1128,5 +1129,564 @@ void task_add_00_mystery_gift(void) data->unk4 = 0; data->unk6 = 0; data->unkE = 0; - data->unk10 = AllocZeroed(sizeof(*data->unk10)); + data->unk10 = AllocZeroed(0x40); +} + +void task00_mystery_gift(u8 taskId) +{ + struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; + u32 sp0; + const u8 * r1; + + switch (data->unk8) + { + case 0: + data->unk8 = 1; + break; + case 1: + switch (sub_8018A50(&data->unk9, &data->unk0, FALSE)) + { + case 0: + data->unkC = 0; + if (sub_801B27C() == TRUE) + { + data->unk8 = 18; + } + else + { + data->unk8 = 2; + } + break; + case 1: + data->unkC = 1; + if (sub_801B0CC() == TRUE) + { + data->unk8 = 18; + } + else + { + data->unk8 = 2; + } + break; + case -2u: + data->unk8 = 37; + break; + } + break; + case 2: + { + if (data->unkC == 0) + { + if (mevent_0814257C(&data->unk9, gText_DontHaveCardNewOneInput)) + { + data->unk8 = 3; + sub_80186EC(0, 1); + } + } + else + { + if (mevent_0814257C(&data->unk9, gText_DontHaveNewsNewOneInput)) + { + data->unk8 = 3; + sub_80186EC(0, 1); + } + } + break; + } + case 3: + if (data->unkC == 0) + { + sub_8018884(gText_WhereShouldCardBeAccessed); + } + else + { + sub_8018884(gText_WhereShouldNewsBeAccessed); + } + data->unk8 = 4; + break; + case 4: + switch (sub_8018A50(&data->unk9, &data->unk0, TRUE)) + { + case 0: + sub_80188DC(); + data->unk8 = 5; + data->unkD = 0; + break; + case 1: + sub_80188DC(); + data->unk8 = 5; + data->unkD = 1; + break; + case -2u: + sub_80188DC(); + if (sub_8018D98(data->unkC)) + { + data->unk8 = 18; + } + else + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + } + break; + case 5: + { + register u8 eos asm("r1"); + gStringVar1[0] = (eos = EOS); + gStringVar2[0] = eos; + gStringVar3[0] = eos; + } + switch (data->unkC) + { + case 0: + if (data->unkD == 1) + { + sub_8014EFC(0x15); + } + else if (data->unkD == 0) + { + sub_80152A8(0x15); + } + break; + case 1: + if (data->unkD == 1) + { + sub_8014EFC(0x16); + } + else if (data->unkD == 0) + { + sub_80152A8(0x16); + } + break; + } + data->unk8 = 6; + break; + case 6: + if (gReceivedRemoteLinkPlayers != 0) + { + sub_8018838(TRUE); + data->unk8 = 7; + sub_801D484(data->unkC); + } + else if (gSpecialVar_Result == 5) + { + sub_8018838(TRUE); + data->unk8 = 3; + } + break; + case 7: + sub_8018884(gText_Communicating); + data->unk8 = 8; + break; + case 8: + switch (sub_801D4A8(&data->unk0)) + { + case 6: + task_add_05_task_del_08FA224_when_no_RfuFunc(); + data->unkE = data->unk0; + data->unk8 = 13; + break; + case 5: + memcpy(data->unk10, sub_801D4F4(), 0x40); + sub_801D4E4(); + break; + case 3: + data->unk8 = 10; + break; + case 2: + data->unk8 = 9; + break; + case 4: + data->unk8 = 11; + StringCopy(gStringVar1, gLinkPlayers[0].name); + break; + } + break; + case 9: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, sub_801D4F4())) + { + case 0: + sub_801D500(0); + sub_801D4E4(); + data->unk8 = 7; + break; + case 1: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + case -1u: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + } + break; + case 10: + if (mevent_0814257C(&data->unk9, sub_801D4F4())) + { + sub_801D4E4(); + data->unk8 = 7; + } + break; + case 11: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_ThrowAwayWonderCard)) + { + case 0: + if (sub_801B3F8() == TRUE) + { + data->unk8 = 12; + } + else + { + sub_801D500(0); + sub_801D4E4(); + data->unk8 = 7; + } + break; + case 1: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + case -1u: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + } + break; + case 12: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_HaventReceivedCardsGift)) + { + case 0: + sub_801D500(0); + sub_801D4E4(); + data->unk8 = 7; + break; + case 1: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + case -1u: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + } + break; + case 13: + if (gReceivedRemoteLinkPlayers == 0) + { + sub_800E084(); + data->unk8 = 14; + } + break; + case 14: + if (sub_8018A1C(&data->unk9, gText_CommunicationCompleted)) + { + if (data->unkD == 1) + { + StringCopy(gStringVar1, gLinkPlayers[0].name); + } + data->unk8 = 15; + } + break; + case 15: + { + register bool32 flag asm("r1"); + r1 = mevent_message(&sp0, data->unkC, data->unkD, data->unkE); + if (r1 == NULL) + { + r1 = data->unk10; + } + if (sp0) + { + flag = mevent_08142CE8(&data->unk9, r1, &data->unk0); + } + else + { + flag = mevent_0814257C(&data->unk9, r1); + } + if (flag) + { + if (data->unkE == 3) + { + if (data->unkD == 1) + { + sub_801DB68(1); + } + else + { + sub_801DB68(2); + } + } + if (sp0 == 0) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + else + { + data->unk8 = 17; + } + } + break; + } + case 16: + if (mevent_0814257C(&data->unk9, gText_CommunicationError)) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + case 17: + if (mevent_save_game(&data->unk9)) + { + data->unk8 = 18; + } + break; + case 18: + if (sub_8018DAC(&data->unk9, data->unkC)) + { + data->unk8 = 20; + } + break; + case 20: + if (data->unkC == 0) + { + if (({gMain.newKeys & A_BUTTON;})) + { + data->unk8 = 21; + } + if (({gMain.newKeys & B_BUTTON;})) + { + data->unk8 = 27; + } + } + else + { + switch (sub_801CCD0(gMain.newKeys)) + { + case 0: + sub_801CC38(); + data->unk8 = 21; + break; + case 1: + data->unk8 = 27; + break; + } + } + break; + case 21: + { + u32 result; + if (data->unkC == 0) + { + if (sub_801B308()) + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE); + } + else + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE); + } + } + else + { + if (sub_801B128()) + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE); + } + else + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE); + } + } + switch (result) + { + case 0: + data->unk8 = 28; + break; + case 1: + data->unk8 = 29; + break; + case 2: + data->unk8 = 22; + break; + case -2u: + if (data->unkC == 1) + { + sub_801CC80(); + } + data->unk8 = 20; + break; + } + break; + } + case 22: + switch (sub_8018E50(&data->unk9, &data->unk0, data->unkC)) + { + case 0: + if (data->unkC == 0 && sub_801B3F8() == TRUE) + { + data->unk8 = 23; + } + else + { + data->unk8 = 24; + } + break; + case 1: + data->unk8 = 21; + break; + case -1: + data->unk8 = 21; + break; + } + break; + case 23: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, TRUE, gText_HaventReceivedGiftOkayToDiscard)) + { + case 0: + data->unk8 = 24; + break; + case 1: + data->unk8 = 21; + break; + case -1u: + data->unk8 = 21; + break; + } + break; + case 24: + if (sub_8018E20(data->unkC, 1)) + { + sub_8018E08(data->unkC); + data->unk8 = 25; + } + break; + case 25: + if (mevent_save_game(&data->unk9)) + { + data->unk8 = 26; + } + break; + case 26: + if (mevent_message_was_thrown_away(&data->unk9, data->unkC)) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + case 27: + if (sub_8018E20(data->unkC, 0)) + { + data->unk8 = 0; + } + break; + case 28: + if (sub_8018E20(data->unkC, 1)) + { + data->unk8 = 3; + } + break; + case 29: + if (sub_8018E20(data->unkC, 1)) + { + switch (data->unkC) + { + case 0: + sub_8014A00(21); + break; + case 1: + sub_8014A00(22); + break; + } + data->unkD = 1; + data->unk8 = 30; + } + break; + case 30: + if (gReceivedRemoteLinkPlayers != 0) + { + sub_8018838(1); + data->unk8 = 31; + } + else if (gSpecialVar_Result == 5) + { + sub_8018838(1); + data->unk8 = 18; + } + break; + case 31: + { + register u8 eos asm("r1"); + gStringVar1[0] = (eos = EOS); + gStringVar2[0] = eos; + gStringVar3[0] = eos; + } + if (data->unkC == 0) + { + sub_8018884(gText_SendingWonderCard); + mevent_srv_new_wcard(); + } + else + { + sub_8018884(gText_SendingWonderNews); + mevent_srv_init_wnews(); + } + data->unk8 = 32; + break; + case 32: + if (sub_801D0C4(&data->unk0) == 3) + { + data->unkE = data->unk0; + data->unk8 = 33; + } + break; + case 33: + task_add_05_task_del_08FA224_when_no_RfuFunc(); + StringCopy(gStringVar1, gLinkPlayers[1].name); + data->unk8 = 34; + break; + case 34: + if (gReceivedRemoteLinkPlayers == 0) + { + sub_800E084(); + data->unk8 = 35; + } + break; + case 35: + if (sub_8019174(&data->unk9, &data->unk0, data->unkD, data->unkE)) + { + if (data->unkD == 1 && data->unkE == 3) + { + sub_801DB68(3); + data->unk8 = 17; + } + else + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + } + break; + case 36: + if (mevent_0814257C(&data->unk9, gText_CommunicationError)) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + case 37: + CloseLink(); + Free(data->unk10); + DestroyTask(taskId); + SetMainCallback2(sub_80186A4); + break; + } } From 93c4e35d844046d12c7d8bcc64e8fc3e03e85e0d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 15:53:38 -0400 Subject: [PATCH 30/30] infer additional file split after task00_mystery_gift --- asm/{mystery_gift.s => union_room_player_avatar.s} | 0 data/{mystery_gift.s => union_room_player_avatar.s} | 0 ld_script.txt | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename asm/{mystery_gift.s => union_room_player_avatar.s} (100%) rename data/{mystery_gift.s => union_room_player_avatar.s} (100%) diff --git a/asm/mystery_gift.s b/asm/union_room_player_avatar.s similarity index 100% rename from asm/mystery_gift.s rename to asm/union_room_player_avatar.s diff --git a/data/mystery_gift.s b/data/union_room_player_avatar.s similarity index 100% rename from data/mystery_gift.s rename to data/union_room_player_avatar.s diff --git a/ld_script.txt b/ld_script.txt index 4f4bc55d7..fd9d02848 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -56,7 +56,7 @@ SECTIONS { src/link_rfu.o(.text); src/union_room.o(.text); src/mystery_gift.o(.text); - asm/mystery_gift.o(.text); + asm/union_room_player_avatar.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -411,7 +411,7 @@ SECTIONS { src/link_rfu.o(.rodata); src/union_room.o(.rodata); src/mystery_gift.o(.rodata); - data/mystery_gift.o(.rodata); + data/union_room_player_avatar.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata);