diff --git a/asm/friend_rescue.s b/asm/friend_rescue.s deleted file mode 100644 index 5388c763..00000000 --- a/asm/friend_rescue.s +++ /dev/null @@ -1,1914 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_8032828 -sub_8032828: - push {r4-r6,lr} - sub sp, 0x68 - ldr r1, _08032848 - ldr r0, [r1] - ldr r0, [r0] - adds r6, r1, 0 - cmp r0, 0x7D - bls _0803283C - bl _080338B4 -_0803283C: - lsls r0, 2 - ldr r1, _0803284C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08032848: .4byte gUnknown_203B33C -_0803284C: .4byte _08032850 - .align 2, 0 -_08032850: - .4byte _08032A48 - .4byte _08032AD0 - .4byte _080338B4 - .4byte _08032B80 - .4byte _08032BC4 - .4byte _08032FD0 - .4byte _080338B4 - .4byte _08032FF0 - .4byte _080338B4 - .4byte _080338B4 - .4byte _08032FD8 - .4byte _08032FE0 - .4byte _08032FE8 - .4byte _0803356C - .4byte _08032C50 - .4byte _08033200 - .4byte _080331CC - .4byte _080331D4 - .4byte _080331DC - .4byte _080336B2 - .4byte _080338B4 - .4byte _080331F8 - .4byte _08033208 - .4byte _080338B4 - .4byte _08033234 - .4byte _0803323C - .4byte _08033244 - .4byte _080338B4 - .4byte _08032F8C - .4byte _08032F98 - .4byte _080336B2 - .4byte _080338B4 - .4byte _08032FB6 - .4byte _08032EB8 - .4byte _08032FC4 - .4byte _08032EAC - .4byte _08032F54 - .4byte _08032EE0 - .4byte _08032EEC - .4byte _08032F16 - .4byte _080338B4 - .4byte _08032F7C - .4byte _08032E60 - .4byte _08032E6C - .4byte _08032EA0 - .4byte _08032E48 - .4byte _0803341C - .4byte _08032E54 - .4byte _08032D84 - .4byte _08032D90 - .4byte _08032D9C - .4byte _080336B2 - .4byte _080338B4 - .4byte _08032DBC - .4byte _080338B4 - .4byte _08032DCC - .4byte _08032E00 - .4byte _08032E3C - .4byte _08032E0C - .4byte _08032E30 - .4byte _08032D04 - .4byte _08032D10 - .4byte _08032D2C - .4byte _08032D38 - .4byte _08032D44 - .4byte _080338B4 - .4byte _08032D78 - .4byte _08032D20 - .4byte _08033720 - .4byte _08033728 - .4byte _08033684 - .4byte _0803368C - .4byte _080336B2 - .4byte _080338B4 - .4byte _080336F8 - .4byte _080338B4 - .4byte _08032FD8 - .4byte _08032FE0 - .4byte _08032FE8 - .4byte _080338B4 - .4byte _08033468 - .4byte _08033730 - .4byte _08033738 - .4byte _0803366C - .4byte _08033674 - .4byte _08033644 - .4byte _0803361C - .4byte _08033614 - .4byte _080335F4 - .4byte _080335C0 - .4byte _0803324E - .4byte _0803325C - .4byte _0803368C - .4byte _08033264 - .4byte _080338B4 - .4byte _08033288 - .4byte _080332B8 - .4byte _080338B4 - .4byte _0803356C - .4byte _080335B0 - .4byte _08033584 - .4byte _080338B4 - .4byte _08033412 - .4byte _0803341C - .4byte _08033448 - .4byte _080335B8 - .4byte _080332F4 - .4byte _080338B4 - .4byte _08033460 - .4byte _08033470 - .4byte _0803349C - .4byte _08033450 - .4byte _08033458 - .4byte _080338B4 - .4byte _080333E4 - .4byte _080333EC - .4byte _080338B4 - .4byte _08033604 - .4byte _0803360C - .4byte _080338B4 - .4byte _0803384C - .4byte _0803387C - .4byte _080337D4 - .4byte _080337F0 - .4byte _08033770 - .4byte _0803378C -_08032A48: - movs r0, 0x1 - bl CountMailType - cmp r0, 0 - bne _08032A9C - movs r0, 0x5 - bl CountMailType - adds r4, r0, 0 - cmp r4, 0 - bne _08032A9C - ldr r0, _08032A7C - ldr r0, [r0] - ldr r1, _08032A80 - adds r0, r1 - ldrb r2, [r0] - cmp r2, 0 - beq _08032A8C - ldr r0, _08032A84 - ldr r3, _08032A88 - str r4, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - b _08032B66 - .align 2, 0 -_08032A7C: .4byte gUnknown_203B33C -_08032A80: .4byte 0x0000052c -_08032A84: .4byte gUnknown_80E25F4 -_08032A88: .4byte gUnknown_80E2108 -_08032A8C: - ldr r0, _08032A94 - ldr r3, _08032A98 - b _08032B5C - .align 2, 0 -_08032A94: .4byte gUnknown_80E25F4 -_08032A98: .4byte gUnknown_80E20B8 -_08032A9C: - ldr r0, _08032AC0 - ldr r0, [r0] - ldr r2, _08032AC4 - adds r0, r2 - ldrb r2, [r0] - cmp r2, 0 - beq _08032B58 - ldr r0, _08032AC8 - ldr r3, _08032ACC - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - bl _08033864 - .align 2, 0 -_08032AC0: .4byte gUnknown_203B33C -_08032AC4: .4byte 0x0000052c -_08032AC8: .4byte gUnknown_80E25F4 -_08032ACC: .4byte gUnknown_80E20E0 -_08032AD0: - movs r0, 0x1 - bl CountMailType - cmp r0, 0 - bne _08032B24 - movs r0, 0x5 - bl CountMailType - adds r4, r0, 0 - cmp r4, 0 - bne _08032B24 - ldr r0, _08032B04 - ldr r0, [r0] - ldr r3, _08032B08 - adds r0, r3 - ldrb r2, [r0] - cmp r2, 0 - beq _08032B14 - ldr r0, _08032B0C - ldr r3, _08032B10 - str r4, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - b _08032B66 - .align 2, 0 -_08032B04: .4byte gUnknown_203B33C -_08032B08: .4byte 0x0000052c -_08032B0C: .4byte gUnknown_80E25F4 -_08032B10: .4byte gUnknown_80E2108 -_08032B14: - ldr r0, _08032B1C - ldr r3, _08032B20 - b _08032B5C - .align 2, 0 -_08032B1C: .4byte gUnknown_80E25F4 -_08032B20: .4byte gUnknown_80E20B8 -_08032B24: - ldr r0, _08032B48 - ldr r0, [r0] - ldr r4, _08032B4C - adds r0, r4 - ldrb r2, [r0] - cmp r2, 0 - beq _08032B58 - ldr r0, _08032B50 - ldr r3, _08032B54 - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - bl _08033864 - .align 2, 0 -_08032B48: .4byte gUnknown_203B33C -_08032B4C: .4byte 0x0000052c -_08032B50: .4byte gUnknown_80E25F4 -_08032B54: .4byte gUnknown_80E20E0 -_08032B58: - ldr r0, _08032B78 - ldr r3, _08032B7C -_08032B5C: - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] -_08032B66: - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0 - bl sub_8014248 - bl _080338B4 - .align 2, 0 -_08032B78: .4byte gUnknown_80E25F4 -_08032B7C: .4byte gUnknown_80E2068 -_08032B80: - movs r0, 0x4 - bl CountMailType - adds r2, r0, 0 - cmp r2, 0 - beq _08032B9C - ldr r0, _08032B94 - ldr r3, _08032B98 - movs r2, 0 - b _08032BA0 - .align 2, 0 -_08032B94: .4byte gUnknown_80E25F4 -_08032B98: .4byte gUnknown_80E2130 -_08032B9C: - ldr r0, _08032BBC - ldr r3, _08032BC0 -_08032BA0: - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0x3 - bl sub_8014248 - bl _080338B4 - .align 2, 0 -_08032BBC: .4byte gUnknown_80E25F4 -_08032BC0: .4byte gUnknown_80E2190 -_08032BC4: - movs r0, 0x1 - bl CountMailType - adds r4, r0, 0 - cmp r4, 0 - bne _08032C0C - movs r0, 0x5 - bl CountMailType - cmp r0, 0 - bne _08032BF4 - ldr r0, _08032BEC - ldr r3, _08032BF0 - str r4, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - b _08032C38 - .align 2, 0 -_08032BEC: .4byte gUnknown_80E25F4 -_08032BF0: .4byte gUnknown_80E2268 -_08032BF4: - ldr r0, _08032C04 - ldr r3, _08032C08 - str r4, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - b _08032C38 - .align 2, 0 -_08032C04: .4byte gUnknown_80E25F4 -_08032C08: .4byte gUnknown_80E2218 -_08032C0C: - movs r0, 0x5 - bl CountMailType - adds r2, r0, 0 - cmp r2, 0 - bne _08032C28 - ldr r0, _08032C20 - ldr r3, _08032C24 - b _08032C2E - .align 2, 0 -_08032C20: .4byte gUnknown_80E25F4 -_08032C24: .4byte gUnknown_80E2240 -_08032C28: - ldr r0, _08032C48 - ldr r3, _08032C4C - movs r2, 0 -_08032C2E: - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] -_08032C38: - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0x11 - bl sub_8014248 - bl _080338B4 - .align 2, 0 -_08032C48: .4byte gUnknown_80E25F4 -_08032C4C: .4byte gUnknown_80E21B8 -_08032C50: - ldr r0, [r6] - movs r5, 0xA5 - lsls r5, 3 - adds r0, r5 - ldr r0, [r0] - subs r0, 0x3 - cmp r0, 0x11 - bls _08032C64 - bl _080338B4 -_08032C64: - lsls r0, 2 - ldr r1, _08032C70 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08032C70: .4byte _08032C74 - .align 2, 0 -_08032C74: - .4byte _08032CC8 - .4byte _08032CD4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _080338B4 - .4byte _08032CBC - .4byte _08032CE0 - .4byte _08032CEC - .4byte _08032CF8 -_08032CBC: - ldr r0, _08032CC4 - bl _0803374A - .align 2, 0 -_08032CC4: .4byte gUnknown_80E2610 -_08032CC8: - ldr r0, _08032CD0 - bl _0803374A - .align 2, 0 -_08032CD0: .4byte gUnknown_80E2640 -_08032CD4: - ldr r0, _08032CDC - bl _0803374A - .align 2, 0 -_08032CDC: .4byte gUnknown_80E2680 -_08032CE0: - ldr r0, _08032CE8 - bl _0803374A - .align 2, 0 -_08032CE8: .4byte gUnknown_80E26B0 -_08032CEC: - ldr r0, _08032CF4 - bl _0803374A - .align 2, 0 -_08032CF4: .4byte gUnknown_80E26F0 -_08032CF8: - ldr r0, _08032D00 - bl _0803374A - .align 2, 0 -_08032D00: .4byte gUnknown_80E2728 -_08032D04: - ldr r0, _08032D0C - bl _0803388E - .align 2, 0 -_08032D0C: .4byte gUnknown_80E276C -_08032D10: - ldr r0, _08032D18 - ldr r3, _08032D1C - bl _080336FC - .align 2, 0 -_08032D18: .4byte gUnknown_80E27A4 -_08032D1C: .4byte gUnknown_80E2458 -_08032D20: - ldr r0, _08032D28 - bl _0803388E - .align 2, 0 -_08032D28: .4byte gUnknown_80E2814 -_08032D2C: - ldr r0, _08032D34 - bl _0803388E - .align 2, 0 -_08032D34: .4byte gUnknown_80E2840 -_08032D38: - ldr r0, _08032D40 - bl _0803388E - .align 2, 0 -_08032D40: .4byte gUnknown_80E2874 -_08032D44: - ldr r0, [r6] - ldr r1, _08032D60 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0xC - bne _08032D54 - bl _080338B4 -_08032D54: - cmp r0, 0xC - bhi _08032D64 - cmp r0, 0xB - beq _08032D6C - bl _080338B4 - .align 2, 0 -_08032D60: .4byte 0x00000524 -_08032D64: - cmp r0, 0xE - bls _08032D6C - bl _080338B4 -_08032D6C: - ldr r0, _08032D74 - bl _0803388E - .align 2, 0 -_08032D74: .4byte gUnknown_80E2898 -_08032D78: - ldr r0, _08032D80 - bl _0803388E - .align 2, 0 -_08032D80: .4byte gUnknown_80E28D8 -_08032D84: - ldr r0, _08032D8C - bl _0803388E - .align 2, 0 -_08032D8C: .4byte gUnknown_80E2904 -_08032D90: - ldr r0, _08032D98 - bl _0803388E - .align 2, 0 -_08032D98: .4byte gUnknown_80E296C -_08032D9C: - bl sub_8030894 - cmp r0, 0 - beq _08032DA8 - bl _080338B4 -_08032DA8: - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - movs r0, 0x1 - bl _080336A6 -_08032DBC: - ldr r0, _08032DC4 - ldr r3, _08032DC8 - bl _080336FC - .align 2, 0 -_08032DC4: .4byte gUnknown_80E29A0 -_08032DC8: .4byte gUnknown_80E22B4 -_08032DCC: - ldr r0, [r6] - ldr r2, _08032DE8 - adds r0, r2 - ldr r0, [r0] - cmp r0, 0xC - bne _08032DDC - bl _080338B4 -_08032DDC: - cmp r0, 0xC - bhi _08032DEC - cmp r0, 0xB - beq _08032DF4 - bl _080338B4 - .align 2, 0 -_08032DE8: .4byte 0x00000524 -_08032DEC: - cmp r0, 0xE - bls _08032DF4 - bl _080338B4 -_08032DF4: - ldr r0, _08032DFC - bl _0803388E - .align 2, 0 -_08032DFC: .4byte gUnknown_80E29D0 -_08032E00: - ldr r0, _08032E08 - bl _0803388E - .align 2, 0 -_08032E08: .4byte gUnknown_80E2A0C -_08032E0C: - ldr r0, [r6] - movs r3, 0xEF - lsls r3, 2 - adds r0, r3 - bl sub_8006518 - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - ldr r0, [r6] - movs r4, 0x86 - lsls r4, 2 - adds r0, r4 - b _0803343E -_08032E30: - ldr r0, _08032E38 - bl _0803388E - .align 2, 0 -_08032E38: .4byte gUnknown_80E2A1C -_08032E3C: - ldr r0, _08032E44 - bl _0803388E - .align 2, 0 -_08032E44: .4byte gUnknown_80E2A5C -_08032E48: - ldr r0, _08032E50 - bl _0803388E - .align 2, 0 -_08032E50: .4byte gUnknown_80E2A80 -_08032E54: - ldr r0, _08032E5C - bl _0803388E - .align 2, 0 -_08032E5C: .4byte gUnknown_80E2AA8 -_08032E60: - ldr r0, _08032E68 - bl _0803388E - .align 2, 0 -_08032E68: .4byte gUnknown_80E2AE4 -_08032E6C: - ldr r0, [r6] - ldr r2, _08032E88 - adds r0, r2 - ldr r0, [r0] - cmp r0, 0xC - bne _08032E7C - bl _080338B4 -_08032E7C: - cmp r0, 0xC - bhi _08032E8C - cmp r0, 0xB - beq _08032E94 - bl _080338B4 - .align 2, 0 -_08032E88: .4byte 0x00000524 -_08032E8C: - cmp r0, 0xE - bls _08032E94 - bl _080338B4 -_08032E94: - ldr r0, _08032E9C - bl _0803388E - .align 2, 0 -_08032E9C: .4byte gUnknown_80E2B54 -_08032EA0: - ldr r0, _08032EA8 - bl _0803388E - .align 2, 0 -_08032EA8: .4byte gUnknown_80E2A0C -_08032EAC: - ldr r0, _08032EB4 - bl _0803388E - .align 2, 0 -_08032EB4: .4byte gUnknown_80E2B90 -_08032EB8: - ldr r0, _08032ED8 - ldr r3, _08032EDC - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0xF - bl sub_8014248 - bl _080338B4 - .align 2, 0 -_08032ED8: .4byte gUnknown_80E2BE0 -_08032EDC: .4byte gUnknown_80E23A8 -_08032EE0: - ldr r0, _08032EE8 - bl _0803388E - .align 2, 0 -_08032EE8: .4byte gUnknown_80E2C48 -_08032EEC: - bl sub_8023CE8 - cmp r0, 0 - beq _08032EF8 - bl sub_8023C60 -_08032EF8: - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0x9 - bl sub_8023868 - bl _080338B4 -_08032F16: - ldr r0, [r6] - movs r4, 0xD7 - lsls r4, 2 - adds r0, r4 - bl sub_8006518 - ldr r1, [r6] - movs r5, 0x87 - lsls r5, 2 - adds r0, r1, r5 - adds r1, r4 - ldr r3, _08032F4C - ldr r2, _08032F50 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0 - str r2, [sp, 0x8] - str r2, [sp, 0xC] - movs r2, 0x3 - bl SetMenuItems - bl sub_8023DA4 - bl _080336E2 - .align 2, 0 -_08032F4C: .4byte gUnknown_80E2334 -_08032F50: .4byte gUnknown_80E234C -_08032F54: - ldr r0, _08032F74 - ldr r3, _08032F78 - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0x10 - bl sub_8014248 - bl _080338B4 - .align 2, 0 -_08032F74: .4byte gUnknown_80E2C94 -_08032F78: .4byte gUnknown_80E22F0 -_08032F7C: - ldr r0, _08032F84 - ldr r3, _08032F88 - bl _080336FC - .align 2, 0 -_08032F84: .4byte gUnknown_80E2CD4 -_08032F88: .4byte gUnknown_80E22D0 -_08032F8C: - ldr r0, _08032F94 - bl _0803388E - .align 2, 0 -_08032F94: .4byte gUnknown_80E2CE8 -_08032F98: - bl sub_8030894 - cmp r0, 0 - beq _08032FA4 - bl _080338B4 -_08032FA4: - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - movs r0, 0x4 - b _080336A6 -_08032FB6: - ldr r0, _08032FBC - ldr r3, _08032FC0 - b _080336FC - .align 2, 0 -_08032FBC: .4byte gUnknown_80E2D30 -_08032FC0: .4byte gUnknown_80E22B4 -_08032FC4: - ldr r0, _08032FCC - bl _0803388E - .align 2, 0 -_08032FCC: .4byte gUnknown_80E2D60 -_08032FD0: - ldr r0, _08032FD4 - b _080336FA - .align 2, 0 -_08032FD4: .4byte gUnknown_80E2D7C -_08032FD8: - ldr r0, _08032FDC - b _080336FA - .align 2, 0 -_08032FDC: .4byte gUnknown_80E2E20 -_08032FE0: - ldr r0, _08032FE4 - b _08033574 - .align 2, 0 -_08032FE4: .4byte gUnknown_80E2E54 -_08032FE8: - ldr r0, _08032FEC - b _08033574 - .align 2, 0 -_08032FEC: .4byte gUnknown_80E2EB4 -_08032FF0: - ldr r1, [r6] - movs r0, 0 - str r0, [r1, 0x44] - bl sub_8011830 - ldr r0, [r6] - ldr r0, [r0, 0x40] - bl sub_8037B28 - adds r4, r0, 0 - ldr r0, [r6] - str r4, [r0, 0x44] - cmp r4, 0 - beq _0803300E - b _080333DE -_0803300E: - ldr r1, [r0, 0x40] - cmp r1, 0x3 - beq _08033028 - cmp r1, 0x3 - bhi _0803301E - cmp r1, 0x2 - beq _0803304A - b _0803313C -_0803301E: - cmp r1, 0x4 - beq _080330B4 - cmp r1, 0x5 - beq _0803308E - b _0803313C -_08033028: - adds r0, 0x48 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r0, [r6] - adds r0, 0x78 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r2, [r6] - ldr r0, [r2, 0x40] - adds r1, r2, 0 - adds r1, 0x48 - adds r2, 0x78 - b _08033134 -_0803304A: - adds r0, 0x48 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r0, [r6] - adds r0, 0x78 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r0, [r6] - movs r3, 0x86 - lsls r3, 2 - adds r0, r3 - ldrb r0, [r0] - bl GetMailatIndex - ldr r1, [r6] - adds r1, 0x48 - ldm r0!, {r2,r4,r5} - stm r1!, {r2,r4,r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r2, [r6] - ldr r0, [r2, 0x40] - adds r1, r2, 0 - adds r1, 0x48 - adds r2, 0x78 - b _08033134 -_0803308E: - adds r0, 0xA8 - movs r1, 0 - movs r2, 0x88 - bl MemoryFill8 - ldr r0, [r6] - movs r4, 0x98 - lsls r4, 1 - adds r0, r4 - movs r1, 0 - movs r2, 0x88 - bl MemoryFill8 - ldr r2, [r6] - ldr r0, [r2, 0x40] - adds r1, r2, 0 - adds r1, 0xA8 - adds r2, r4 - b _08033134 -_080330B4: - adds r0, 0xA8 - movs r1, 0 - movs r2, 0x88 - bl MemoryFill8 - ldr r0, [r6] - movs r5, 0x98 - lsls r5, 1 - adds r0, r5 - movs r1, 0 - movs r2, 0x88 - bl MemoryFill8 - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0xE0 - strh r4, [r0] - movs r2, 0xB4 - lsls r2, 1 - adds r0, r1, r2 - strh r4, [r0] - movs r3, 0x86 - lsls r3, 2 - adds r0, r1, r3 - ldrb r0, [r0] - bl GetMailatIndex - ldr r1, [r6] - adds r1, 0xA8 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r2, [r6] - movs r4, 0xA7 - lsls r4, 3 - adds r3, r2, r4 - movs r0, 0 - ldrsh r1, [r3, r0] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0803312A - adds r0, r2, 0 - adds r0, 0xD8 - ldr r1, _08033188 - ldr r1, [r1] - movs r2, 0 - ldrsh r3, [r3, r2] - movs r2, 0x58 - muls r2, r3 - adds r1, r2 - movs r2, 0x58 - bl memcpy -_0803312A: - ldr r2, [r6] - ldr r0, [r2, 0x40] - adds r1, r2, 0 - adds r1, 0xA8 - adds r2, r5 -_08033134: - bl sub_8037D64 - ldr r1, [r6] - str r0, [r1, 0x44] -_0803313C: - ldr r4, _0803318C - ldr r2, [r4] - ldr r0, [r2, 0x44] - cmp r0, 0 - beq _08033148 - b _080333DE -_08033148: - ldr r0, [r2, 0x40] - cmp r0, 0x2 - bcs _08033150 - b _080333DE -_08033150: - cmp r0, 0x3 - bls _08033190 - cmp r0, 0x5 - bls _0803315A - b _080333DE -_0803315A: - adds r1, r2, 0 - adds r1, 0xA8 - movs r3, 0x98 - lsls r3, 1 - adds r2, r3 - bl sub_80381F4 - ldr r1, [r4] - str r0, [r1, 0x44] - bl sub_800D588 - lsls r0, 24 - cmp r0, 0 - beq _080331C0 - ldr r0, [r4] - movs r4, 0x84 - lsls r4, 3 - adds r1, r0, r4 - movs r5, 0xA0 - lsls r5, 1 - adds r0, r5 - b _080333DA - .align 2, 0 -_08033188: .4byte gRecruitedPokemonRef -_0803318C: .4byte gUnknown_203B33C -_08033190: - adds r1, r2, 0 - adds r1, 0x48 - adds r2, 0x78 - bl sub_80381F4 - ldr r1, [r4] - str r0, [r1, 0x44] - bl sub_800D588 - lsls r0, 24 - cmp r0, 0 - beq _080331B4 - ldr r0, [r4] - movs r2, 0x84 - lsls r2, 3 - adds r1, r0, r2 - adds r0, 0x88 - b _080333DA -_080331B4: - ldr r0, [r4] - movs r3, 0x84 - lsls r3, 3 - adds r1, r0, r3 - ldr r0, [r0, 0x58] - b _080333DC -_080331C0: - ldr r0, [r4] - movs r4, 0x84 - lsls r4, 3 - adds r1, r0, r4 - adds r0, 0xB8 - b _080333DA -_080331CC: - ldr r0, _080331D0 - b _0803388E - .align 2, 0 -_080331D0: .4byte gUnknown_80E2F14 -_080331D4: - ldr r0, _080331D8 - b _0803388E - .align 2, 0 -_080331D8: .4byte gUnknown_80E2F44 -_080331DC: - bl sub_8030894 - cmp r0, 0 - beq _080331E6 - b _080338B4 -_080331E6: - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - movs r0, 0x1 - b _080336A6 -_080331F8: - ldr r0, _080331FC - b _080336FA - .align 2, 0 -_080331FC: .4byte gUnknown_80E2F78 -_08033200: - ldr r0, _08033204 - b _0803388E - .align 2, 0 -_08033204: .4byte gUnknown_80E2FA0 -_08033208: - ldr r0, [r6] - ldr r5, _08033220 - adds r0, r5 - ldr r0, [r0] - cmp r0, 0xC - bne _08033216 - b _080338B4 -_08033216: - cmp r0, 0xC - bhi _08033224 - cmp r0, 0xB - beq _0803322A - b _080338B4 - .align 2, 0 -_08033220: .4byte 0x00000524 -_08033224: - cmp r0, 0xE - bls _0803322A - b _080338B4 -_0803322A: - ldr r0, _08033230 - b _0803388E - .align 2, 0 -_08033230: .4byte gUnknown_80E2FEC -_08033234: - ldr r0, _08033238 - b _0803388E - .align 2, 0 -_08033238: .4byte gUnknown_80E3030 -_0803323C: - ldr r0, _08033240 - b _0803388E - .align 2, 0 -_08033240: .4byte gUnknown_80E3078 -_08033244: - ldr r0, [r6] - movs r1, 0xEF - lsls r1, 2 - adds r0, r1 - b _080333F4 -_0803324E: - ldr r0, _08033254 - ldr r3, _08033258 - b _080336FC - .align 2, 0 -_08033254: .4byte gUnknown_80E30A4 -_08033258: .4byte gUnknown_80E2458 -_0803325C: - ldr r0, _08033260 - b _0803388E - .align 2, 0 -_08033260: .4byte gUnknown_80E30D0 -_08033264: - ldr r0, [r6] - movs r4, 0xD7 - lsls r4, 2 - adds r0, r4 - bl sub_8006518 - ldr r1, [r6] - movs r5, 0x87 - lsls r5, 2 - adds r0, r1, r5 - adds r1, r4 - ldr r3, _08033280 - ldr r2, _08033284 - b _080336CC - .align 2, 0 -_08033280: .4byte gUnknown_80E231C -_08033284: .4byte gUnknown_80E2408 -_08033288: - bl sub_801D008 - cmp r0, 0 - beq _08033292 - b _080338B4 -_08033292: - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - ldr r0, _080332B4 - str r0, [sp, 0x64] - add r2, sp, 0x64 - movs r0, 0 - movs r1, 0x1 - movs r3, 0x9 - bl sub_801C8C4 - b _080338B4 - .align 2, 0 -_080332B4: .4byte 0x00020003 -_080332B8: - ldr r0, [r6] - movs r4, 0xD7 - lsls r4, 2 - adds r0, r4 - bl sub_8006518 - ldr r1, [r6] - movs r5, 0x87 - lsls r5, 2 - adds r0, r1, r5 - adds r1, r4 - ldr r3, _080332EC - ldr r2, _080332F0 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0 - str r2, [sp, 0x8] - str r2, [sp, 0xC] - movs r2, 0x3 - bl SetMenuItems - bl sub_801CCD8 - b _080336E2 - .align 2, 0 -_080332EC: .4byte gUnknown_80E23F0 -_080332F0: .4byte gUnknown_80E2408 -_080332F4: - ldr r1, [r6] - movs r0, 0 - str r0, [r1, 0x44] - bl sub_8011830 - ldr r0, [r6] - ldr r0, [r0, 0x40] - bl sub_8037B28 - ldr r1, [r6] - str r0, [r1, 0x44] - cmp r0, 0 - bne _080333DE - ldr r0, [r1, 0x40] - cmp r0, 0x6 - beq _0803331A - cmp r0, 0x7 - beq _08033358 - b _08033388 -_0803331A: - movs r4, 0xDC - lsls r4, 1 - adds r0, r1, r4 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r0, [r6] - movs r2, 0x86 - lsls r2, 2 - adds r0, r2 - ldrb r0, [r0] - bl GetMailatIndex - ldr r1, [r6] - adds r1, r4 - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r2, [r6] - ldr r0, [r2, 0x40] - adds r4, r2, r4 - movs r3, 0xF4 - lsls r3, 1 - adds r2, r3 - b _0803337E -_08033358: - movs r4, 0xDC - lsls r4, 1 - adds r0, r1, r4 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r0, [r6] - movs r5, 0xF4 - lsls r5, 1 - adds r0, r5 - movs r1, 0 - movs r2, 0x30 - bl MemoryFill8 - ldr r2, [r6] - ldr r0, [r2, 0x40] - adds r4, r2, r4 - adds r2, r5 -_0803337E: - adds r1, r4, 0 - bl sub_8037D64 - ldr r1, [r6] - str r0, [r1, 0x44] -_08033388: - ldr r4, _080333C8 - ldr r2, [r4] - ldr r0, [r2, 0x44] - cmp r0, 0 - bne _080333DE - ldr r0, [r2, 0x40] - cmp r0, 0x7 - bhi _080333DE - cmp r0, 0x6 - bcc _080333DE - movs r5, 0xDC - lsls r5, 1 - adds r1, r2, r5 - movs r3, 0xF4 - lsls r3, 1 - adds r2, r3 - bl sub_80381F4 - ldr r1, [r4] - str r0, [r1, 0x44] - bl sub_800D588 - lsls r0, 24 - cmp r0, 0 - beq _080333CC - ldr r0, [r4] - movs r4, 0x84 - lsls r4, 3 - adds r1, r0, r4 - adds r5, 0x40 - adds r0, r5 - b _080333DA - .align 2, 0 -_080333C8: .4byte gUnknown_203B33C -_080333CC: - ldr r0, [r4] - movs r2, 0x84 - lsls r2, 3 - adds r1, r0, r2 - movs r3, 0xE4 - lsls r3, 1 - adds r0, r3 -_080333DA: - ldr r0, [r0] -_080333DC: - str r0, [r1] -_080333DE: - bl xxx_call_start_bg_music - b _080338B4 -_080333E4: - ldr r0, _080333E8 - b _0803388E - .align 2, 0 -_080333E8: .4byte gUnknown_80E311C -_080333EC: - ldr r0, [r6] - movs r4, 0xEF - lsls r4, 2 - adds r0, r4 -_080333F4: - bl sub_8006518 - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - ldr r1, [r6] - adds r1, 0x8 - movs r0, 0x4 - bl sub_80151C0 - b _080338B4 -_08033412: - ldr r0, _08033418 - b _0803388E - .align 2, 0 -_08033418: .4byte gUnknown_80E314C -_0803341C: - ldr r0, [r6] - movs r5, 0xEF - lsls r5, 2 - adds r0, r5 - bl sub_8006518 - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - ldr r0, [r6] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 -_0803343E: - ldrb r0, [r0] - movs r1, 0 - bl sub_8031D70 - b _080338B4 -_08033448: - ldr r0, _0803344C - b _0803388E - .align 2, 0 -_0803344C: .4byte gUnknown_80E317C -_08033450: - ldr r0, _08033454 - b _0803388E - .align 2, 0 -_08033454: .4byte gUnknown_80E319C -_08033458: - ldr r0, _0803345C - b _0803388E - .align 2, 0 -_0803345C: .4byte gUnknown_80E317C -_08033460: - ldr r0, _08033464 - b _0803388E - .align 2, 0 -_08033464: .4byte gUnknown_80E31D8 -_08033468: - ldr r0, _0803346C - b _0803388E - .align 2, 0 -_0803346C: .4byte gUnknown_80E31FC -_08033470: - ldr r0, [r6] - ldr r2, _08033488 - adds r0, r2 - ldr r0, [r0] - cmp r0, 0xC - bne _0803347E - b _080338B4 -_0803347E: - cmp r0, 0xC - bhi _0803348C - cmp r0, 0xB - beq _08033492 - b _080338B4 - .align 2, 0 -_08033488: .4byte 0x00000524 -_0803348C: - cmp r0, 0xE - bls _08033492 - b _080338B4 -_08033492: - ldr r0, _08033498 - b _0803388E - .align 2, 0 -_08033498: .4byte gUnknown_80E3220 -_0803349C: - movs r0, 0x98 - lsls r0, 1 - bl GetMonSpecies - adds r1, r0, 0 - ldr r4, _080334F8 - ldr r0, [r4] - ldr r3, _080334FC - adds r0, r3 - bl strcpy - ldr r1, [r4] - movs r5, 0xAA - lsls r5, 3 - adds r0, r1, r5 - movs r2, 0 - strh r2, [r0] - ldr r0, _08033500 - adds r1, r0 - movs r0, 0x2 - strb r0, [r1] - ldr r0, [r4] - ldr r3, _08033504 - adds r1, r0, r3 - str r2, [r1] - movs r5, 0x84 - lsls r5, 3 - adds r0, r5 - ldr r1, [r0] - movs r0, 0x6 - bl GetMailIndex - lsls r0, 24 - lsrs r0, 24 - bl GetMailatIndex - adds r2, r0, 0 - adds r0, 0x22 - ldrb r1, [r0] - cmp r1, 0 - beq _08033508 - ldr r0, [r4] - movs r3, 0xAB - lsls r3, 3 - adds r0, r3 - b _08033512 - .align 2, 0 -_080334F8: .4byte gUnknown_203B33C -_080334FC: .4byte 0x0000053c -_08033500: .4byte 0x00000552 -_08033504: .4byte 0x00000554 -_08033508: - ldr r0, [r4] - movs r4, 0xAB - lsls r4, 3 - adds r0, r4 - movs r1, 0 -_08033512: - strb r1, [r0] - ldr r4, _08033558 - ldr r0, [r4] - ldr r5, _0803355C - adds r0, r5 - movs r5, 0 - movs r1, 0x1 - strb r1, [r0] - adds r0, r2, 0x4 - movs r1, 0 - bl GetDungeonTeamRankPts - ldr r1, [r4] - movs r3, 0xAC - lsls r3, 3 - adds r2, r1, r3 - str r0, [r2] - ldr r0, _08033560 - adds r1, r0 - strb r5, [r1] - ldr r0, [r4] - ldr r1, _08033564 - adds r0, r1 - strb r5, [r0] - ldr r0, [r4] - ldr r2, _08033568 - adds r0, r2 - strb r5, [r0] - ldr r0, [r4] - subs r3, 0x24 - adds r0, r3 - movs r1, 0 - bl sub_802F204 - b _080338B4 - .align 2, 0 -_08033558: .4byte gUnknown_203B33C -_0803355C: .4byte 0x0000055b -_08033560: .4byte 0x00000559 -_08033564: .4byte 0x0000055a -_08033568: .4byte 0x0000055c -_0803356C: - movs r0, 0 - bl nullsub_23 - ldr r0, _08033580 -_08033574: - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_80141B4 - b _080338B4 - .align 2, 0 -_08033580: .4byte gUnknown_80E2DD0 -_08033584: - ldr r0, [r6] - ldr r4, _0803359C - adds r0, r4 - ldr r0, [r0] - cmp r0, 0xC - bne _08033592 - b _080338B4 -_08033592: - cmp r0, 0xC - bhi _080335A0 - cmp r0, 0xB - beq _080335A6 - b _080338B4 - .align 2, 0 -_0803359C: .4byte 0x00000524 -_080335A0: - cmp r0, 0xE - bls _080335A6 - b _080338B4 -_080335A6: - ldr r0, _080335AC - b _0803388E - .align 2, 0 -_080335AC: .4byte gUnknown_80E3248 -_080335B0: - ldr r0, _080335B4 - b _0803388E - .align 2, 0 -_080335B4: .4byte gUnknown_80E3288 -_080335B8: - ldr r0, _080335BC - b _080336FA - .align 2, 0 -_080335BC: .4byte gUnknown_80E2D7C -_080335C0: - bl GetPlayerPokemonStruct - adds r1, r0, 0 - adds r1, 0x4C - add r0, sp, 0x14 - movs r2, 0xA - bl sub_80922B4 - ldr r5, _080335E8 - ldr r0, [r5] - ldr r4, _080335EC - adds r0, r4 - ldr r1, _080335F0 - add r2, sp, 0x14 - bl sprintfStatic - ldr r0, [r5] - adds r0, r4 - b _0803388E - .align 2, 0 -_080335E8: .4byte gUnknown_203B33C -_080335EC: .4byte 0x00000424 -_080335F0: .4byte gUnknown_80E32C4 -_080335F4: - ldr r0, _080335FC - ldr r3, _08033600 - b _080336FC - .align 2, 0 -_080335FC: .4byte gUnknown_80E331C -_08033600: .4byte gUnknown_80E24D8 -_08033604: - ldr r0, _08033608 - b _0803388E - .align 2, 0 -_08033608: .4byte gUnknown_80E317C -_0803360C: - ldr r0, _08033610 - b _0803388E - .align 2, 0 -_08033610: .4byte gUnknown_80E2A0C -_08033614: - ldr r0, _08033618 - b _0803388E - .align 2, 0 -_08033618: .4byte gUnknown_80E3378 -_0803361C: - ldr r0, _0803363C - ldr r3, _08033640 - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0x16 - bl sub_8014248 - b _080338B4 - .align 2, 0 -_0803363C: .4byte gUnknown_80E339C -_08033640: .4byte gUnknown_80E24B0 -_08033644: - ldr r0, _08033664 - ldr r3, _08033668 - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0x15 - bl sub_8014248 - b _080338B4 - .align 2, 0 -_08033664: .4byte gUnknown_80E33D8 -_08033668: .4byte gUnknown_80E2470 -_0803366C: - ldr r0, _08033670 - b _0803388E - .align 2, 0 -_08033670: .4byte gUnknown_80E3430 -_08033674: - ldr r0, _0803367C - ldr r3, _08033680 - b _080336FC - .align 2, 0 -_0803367C: .4byte gUnknown_80E34B0 -_08033680: .4byte gUnknown_80E2440 -_08033684: - ldr r0, _08033688 - b _0803388E - .align 2, 0 -_08033688: .4byte gUnknown_80E34F0 -_0803368C: - bl sub_8030894 - cmp r0, 0 - beq _08033696 - b _080338B4 -_08033696: - bl ResetUnusedInputStruct - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - movs r0, 0x5 -_080336A6: - movs r1, 0 - movs r2, 0 - movs r3, 0x6 - bl sub_80306A8 - b _080338B4 -_080336B2: - ldr r0, [r6] - movs r4, 0xD7 - lsls r4, 2 - adds r0, r4 - bl sub_8006518 - ldr r1, [r6] - movs r5, 0x87 - lsls r5, 2 - adds r0, r1, r5 - adds r1, r4 - ldr r3, _080336F0 - ldr r2, _080336F4 -_080336CC: - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0 - str r2, [sp, 0x8] - str r2, [sp, 0xC] - movs r2, 0x3 - bl SetMenuItems - bl sub_803092C -_080336E2: - ldr r0, [r6] - adds r0, r5 - movs r1, 0x3 - movs r2, 0x1 - bl sub_8035CF4 - b _080338B4 - .align 2, 0 -_080336F0: .4byte gUnknown_80E231C -_080336F4: .4byte gUnknown_80E234C -_080336F8: - ldr r0, _08033718 -_080336FA: - ldr r3, _0803371C -_080336FC: - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0x6 - bl sub_8014248 - b _080338B4 - .align 2, 0 -_08033718: .4byte gUnknown_80E352C -_0803371C: .4byte gUnknown_80E2290 -_08033720: - ldr r0, _08033724 - b _0803388E - .align 2, 0 -_08033724: .4byte gUnknown_80E355C -_08033728: - ldr r0, _0803372C - b _0803388E - .align 2, 0 -_0803372C: .4byte gUnknown_80E35AC -_08033730: - ldr r0, _08033734 - b _0803388E - .align 2, 0 -_08033734: .4byte gUnknown_80E35E8 -_08033738: - ldr r0, [r6] - ldr r0, [r0, 0x40] - cmp r0, 0x6 - bne _08033748 - ldr r0, _08033744 - b _0803374A - .align 2, 0 -_08033744: .4byte gUnknown_80E360C -_08033748: - ldr r0, _08033768 -_0803374A: - ldr r3, _0803376C - movs r2, 0 - str r2, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r2, [sp, 0xC] - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - movs r2, 0xB - bl sub_8014248 - b _080338B4 - .align 2, 0 -_08033768: .4byte gUnknown_80E3644 -_0803376C: .4byte gUnknown_80E236C -_08033770: - ldr r0, _08033780 - ldr r1, [r6] - ldr r5, _08033784 - adds r1, r5 - ldr r2, [r1] - ldr r3, _08033788 - b _08033858 - .align 2, 0 -_08033780: .4byte gUnknown_80E367C -_08033784: .4byte 0x00000564 -_08033788: .4byte gUnknown_80E25B4 -_0803378C: - ldr r0, [r6] - ldr r1, _080337A4 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0x24 - beq _080337BC - cmp r0, 0x24 - bgt _080337A8 - cmp r0, 0x23 - beq _080337B2 - b _080338B4 - .align 2, 0 -_080337A4: .4byte 0x00000564 -_080337A8: - cmp r0, 0x25 - beq _080337C4 - cmp r0, 0x26 - beq _080337CC - b _080338B4 -_080337B2: - ldr r0, _080337B8 - b _0803388E - .align 2, 0 -_080337B8: .4byte gUnknown_80E3690 -_080337BC: - ldr r0, _080337C0 - b _0803388E - .align 2, 0 -_080337C0: .4byte gUnknown_80E3818 -_080337C4: - ldr r0, _080337C8 - b _0803388E - .align 2, 0 -_080337C8: .4byte gUnknown_80E3998 -_080337CC: - ldr r0, _080337D0 - b _0803388E - .align 2, 0 -_080337D0: .4byte gUnknown_80E3B1C -_080337D4: - ldr r0, _080337E4 - ldr r1, [r6] - ldr r2, _080337E8 - adds r1, r2 - ldr r2, [r1] - ldr r3, _080337EC - b _08033858 - .align 2, 0 -_080337E4: .4byte gUnknown_80E367C -_080337E8: .4byte 0x00000564 -_080337EC: .4byte gUnknown_80E2554 -_080337F0: - ldr r0, [r6] - ldr r3, _08033808 - adds r0, r3 - ldr r0, [r0] - subs r0, 0x1E - cmp r0, 0x4 - bhi _080338B4 - lsls r0, 2 - ldr r1, _0803380C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08033808: .4byte 0x00000564 -_0803380C: .4byte _08033810 - .align 2, 0 -_08033810: - .4byte _08033824 - .4byte _0803382C - .4byte _0803383C - .4byte _08033834 - .4byte _08033844 -_08033824: - ldr r0, _08033828 - b _0803388E - .align 2, 0 -_08033828: .4byte gUnknown_80E3BF8 -_0803382C: - ldr r0, _08033830 - b _0803388E - .align 2, 0 -_08033830: .4byte gUnknown_80E3DE4 -_08033834: - ldr r0, _08033838 - b _0803388E - .align 2, 0 -_08033838: .4byte gUnknown_80E3E98 -_0803383C: - ldr r0, _08033840 - b _0803388E - .align 2, 0 -_08033840: .4byte gUnknown_80E4014 -_08033844: - ldr r0, _08033848 - b _0803388E - .align 2, 0 -_08033848: .4byte gUnknown_80E4130 -_0803384C: - ldr r0, _08033870 - ldr r1, [r6] - ldr r4, _08033874 - adds r1, r4 - ldr r2, [r1] - ldr r3, _08033878 -_08033858: - movs r4, 0 - str r4, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] -_08033864: - adds r1, 0xFD - str r1, [sp, 0x10] - movs r1, 0 - bl sub_8014248 - b _080338B4 - .align 2, 0 -_08033870: .4byte gUnknown_80E367C -_08033874: .4byte 0x00000564 -_08033878: .4byte gUnknown_80E24F8 -_0803387C: - ldr r0, [r6] - ldr r5, _0803389C - adds r0, r5 - ldr r0, [r0] - cmp r0, 0x1A - beq _080338A8 - cmp r0, 0x1D - bne _080338B4 - ldr r0, _080338A0 -_0803388E: - ldr r3, _080338A4 - movs r1, 0 - movs r2, 0 - bl sub_80141B4 - b _080338B4 - .align 2, 0 -_0803389C: .4byte 0x00000564 -_080338A0: .4byte gUnknown_80E41DC -_080338A4: .4byte 0x00000101 -_080338A8: - ldr r0, _080338BC - ldr r3, _080338C0 - movs r1, 0 - movs r2, 0 - bl sub_80141B4 -_080338B4: - add sp, 0x68 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_080338BC: .4byte gUnknown_80E4314 -_080338C0: .4byte 0x00000101 - thumb_func_end sub_8032828 - - .align 2,0 diff --git a/ld_script.txt b/ld_script.txt index 34c71d1a..c588775c 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -152,8 +152,6 @@ SECTIONS { src/code_8031D70.o(.text); src/adventure_log.o(.text); src/friend_rescue.o(.text); - asm/friend_rescue.o(.text); - src/friend_rescue_1.o(.text); asm/credits.o(.text); src/credits.o(.text); src/main_menu.o(.text); diff --git a/src/friend_rescue.c b/src/friend_rescue.c index 6854dd46..dcad3b62 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -1,18 +1,167 @@ #include "global.h" +#include "constants/communication_error_codes.h" +#include "constants/monster.h" +#include "constants/wonder_mail.h" #include "text.h" #include "input.h" #include "item.h" +#include "team_inventory.h" #include "pokemon.h" #include "friend_rescue.h" #include "memory.h" +#include "save.h" +#include "menu.h" +#include "rescue_password_menu.h" +#include "menu_input.h" +#include "code_8094F88.h" extern void SetFriendRescueMenuState(u32); +extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern s32 sub_80144A4(s32 *); extern void sub_802F2C0(); extern u32 sub_802F298(); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; +extern struct TeamInventory *gTeamInventory_203B460; + +extern u8 gUnknown_80E44A4[]; +extern u8 gUnknown_80E4500[]; +extern u8 gUnknown_80E4550[]; +extern u8 gUnknown_80E45B4[]; +extern u8 gUnknown_80E460C[]; +extern u8 gUnknown_80E4650[]; +extern u8 gUnknown_80E468C[]; +extern u8 gUnknown_80E46C8[]; +extern u8 gUnknown_80E4704[]; +extern u8 gUnknown_80E4744[]; +extern u8 gUnknown_80E4788[]; +extern u8 gUnknown_80E47D8[]; +extern u8 gUnknown_80E4480[]; +extern u8 gUnknown_80E482C[]; +extern u8 gUnknown_80E25F4[]; +extern u8 gUnknown_80E2D7C[]; +extern u8 gUnknown_80E2E20[]; +extern u8 gUnknown_80E319C[]; +extern u8 gUnknown_80E311C[]; +extern u8 gUnknown_80E32C4[]; +extern u8 gUnknown_80E4314[]; +extern u8 gUnknown_80E41DC[]; +extern u8 gUnknown_80E2FEC[]; +extern u8 gUnknown_80E2898[]; +extern u8 gUnknown_80E2B54[]; +extern u8 gUnknown_80E29D0[]; +extern u8 gUnknown_80E3220[]; +extern u8 gUnknown_80E2A0C[]; +extern u8 gUnknown_80E2610[]; +extern u8 gUnknown_80E2640[]; +extern u8 gUnknown_80E2680[]; +extern u8 gUnknown_80E26B0[]; +extern u8 gUnknown_80E26F0[]; +extern u8 gUnknown_80E2728[]; +extern u8 gUnknown_80E3690[]; +extern u8 gUnknown_80E3818[]; +extern u8 gUnknown_80E3998[]; +extern u8 gUnknown_80E3B1C[]; +extern u8 gUnknown_80E367C[]; +extern u8 gUnknown_80E3BF8[]; +extern u8 gUnknown_80E3DE4[]; +extern u8 gUnknown_80E4014[]; +extern u8 gUnknown_80E3E98[]; +extern u8 gUnknown_80E4130[]; +extern u8 gUnknown_80E2E54[]; +extern u8 gUnknown_80E2EB4[]; +extern u8 gUnknown_80E2DD0[]; +extern u8 gUnknown_80E2FA0[]; +extern u8 gUnknown_80E2F14[]; +extern u8 gUnknown_80E2F44[]; +extern u8 gUnknown_80E30A4[]; +extern u8 gUnknown_80E2F78[]; +extern u8 gUnknown_80E360C[]; +extern u8 gUnknown_80E3644[]; +extern u8 gUnknown_80E35E8[]; +extern u8 gUnknown_80E35AC[]; +extern u8 gUnknown_80E355C[]; +extern u8 gUnknown_80E352C[]; +extern u8 gUnknown_80E34F0[]; +extern u8 gUnknown_80E34B0[]; +extern u8 gUnknown_80E3430[]; +extern u8 gUnknown_80E33D8[]; +extern u8 gUnknown_80E339C[]; +extern u8 gUnknown_80E3378[]; +extern u8 gUnknown_80E331C[]; +extern u8 gUnknown_80E3288[]; +extern u8 gUnknown_80E3248[]; +extern u8 gUnknown_80E31FC[]; +extern u8 gUnknown_80E276C[]; +extern u8 gUnknown_80E27A4[]; +extern u8 gUnknown_80E2CD4[]; +extern u8 gUnknown_80E3030[]; +extern u8 gUnknown_80E3078[]; +extern u8 gUnknown_80E31D8[]; +extern u8 gUnknown_80E2CE8[]; +extern u8 gUnknown_80E2B90[]; +extern u8 gUnknown_80E2AE4[]; +extern u8 gUnknown_80E2A80[]; +extern u8 gUnknown_80E2AA8[]; +extern u8 gUnknown_80E2D60[]; +extern u8 gUnknown_80E2BE0[]; +extern u8 gUnknown_80E2C48[]; +extern u8 gUnknown_80E29A0[]; +extern u8 gUnknown_80E2A5C[]; +extern u8 gUnknown_80E2904[]; +extern u8 gUnknown_80E2C94[]; +extern u8 gUnknown_80E2D30[]; +extern u8 gUnknown_80E296C[]; +extern u8 gUnknown_80E314C[]; +extern u8 gUnknown_80E2A1C[]; +extern u8 gUnknown_80E2840[]; +extern u8 gUnknown_80E2874[]; +extern u8 gUnknown_80E317C[]; +extern u8 gUnknown_80E28D8[]; +extern u8 gUnknown_80E2814[]; +extern u8 gUnknown_80E30D0[]; +extern u8 gUnknown_80E48A8[]; +extern u8 gUnknown_80E49C4[]; +extern u8 gUnknown_80E4704[]; +extern u8 gUnknown_80E48E8[]; +extern u8 gUnknown_80E4928[]; +extern u8 gUnknown_80E4964[]; +extern u8 gUnknown_80E499C[]; +extern u8 gUnknown_80E460C[]; +extern u8 gUnknown_80E31FC[]; + +extern struct MenuItem gUnknown_80E20B8; +extern struct MenuItem gUnknown_80E2108; +extern struct MenuItem gUnknown_80E20E0; +extern struct MenuItem gUnknown_80E2068; +extern struct MenuItem gUnknown_80E24F8; +extern struct MenuItem gUnknown_80E2554; +extern struct MenuItem gUnknown_80E22F0; +extern struct MenuItem gUnknown_80E236C; +extern struct MenuItem gUnknown_80E2440; +extern struct MenuItem gUnknown_80E2470; +extern struct MenuItem gUnknown_80E24B0; +extern struct MenuItem gUnknown_80E2130; +extern struct MenuItem gUnknown_80E2190; +extern struct MenuItem gUnknown_80E21B8; +extern struct MenuItem gUnknown_80E2268; +extern struct MenuItem gUnknown_80E2218; +extern struct MenuItem gUnknown_80E2240; +extern struct MenuItem gUnknown_80E2290; +extern struct MenuItem gUnknown_80E22D0; +extern struct MenuItem gUnknown_80E234C; +extern struct MenuItem gUnknown_80E24D8; +extern struct MenuItem gUnknown_80E2458; +extern struct MenuItem gUnknown_80E2408; +extern struct MenuItem gUnknown_80E23A8; +extern struct MenuItem gUnknown_80E22B4; + +extern struct UnkTextStruct2 gUnknown_80E231C; +extern struct UnkTextStruct2 gUnknown_80E23F0; +extern struct UnkTextStruct2 gUnknown_80E2334; + +extern struct MenuItem gUnknown_80E25B4; EWRAM_DATA_2 struct WonderMailStruct_203B33C *gUnknown_203B33C = {0}; @@ -99,6 +248,42 @@ extern void sub_8035210(void); extern void sub_8035430(void); extern void sub_8034848(void); +extern u32 sub_80154F0(); +extern void sub_80155F0(); +extern u32 sub_801CA08(u32); +extern void sub_801CBB8(void); +extern void sub_801CB5C(u32); +extern void sub_8035CC0(struct UnkTextStruct2 *, u32); +extern void sub_801B3C0(struct Item *); +extern u32 sub_801B410(void); +extern void sub_801B450(void); +extern void sub_8035CF4(struct MenuStruct *, u32, u32); +extern u8 sub_801CB24(void); +extern u32 sub_8030DA0(void); +extern void sub_8030DE4(void); +extern void sub_803092C(void); +extern u32 sub_8030768(u32); +extern void sub_803084C(void); +extern void sub_8030D40(u8, u32); +extern void sub_8030810(u32); +extern u8 sub_80307EC(void); +extern u32 sub_8031DCC(void); +extern void sub_8031E10(void); +extern void sub_8031E00(void); +extern u8 sub_8024108(u32); +extern void sub_802452C(void); +extern u32 sub_80244E4(void); +extern void sub_802453C(void); +extern void sub_8023B7C(u32); +extern u32 sub_8023A94(u32); +extern void sub_8023C60(void); +extern void sub_8024458(s16, u32); +extern void sub_8023DA4(void); +extern void sub_8035D1C(void); +extern u16 sub_8023B44(void); +extern u32 sub_8039068(u32, u8 *passwordBuffer, struct unkStruct_203B480 *r0); +extern bool8 sub_801CF14(s32); + extern void sub_803084C(void); extern void sub_8031E10(void); extern void sub_8023C60(void); @@ -108,6 +293,43 @@ extern void sub_802F2C0(void); extern void sub_8030DE4(void); extern void sub_802453C(void); extern void sub_801B450(void); +extern void sub_800641C(struct UnkTextStruct2 *a0, u8 a1, u8 a2); +extern void sub_8006518(struct UnkTextStruct2 *); +extern u8 sub_800D588(void); +extern void sub_8011830(void); +extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); +extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); +extern void sub_80151C0(u32, u8 *); +extern void sub_801C8C4(u32, u32, s32 * , u32); +extern void sub_801CCD8(void); +extern u32 sub_801D008(void); +extern void sub_8023868(u32, u32, u32, u32); +extern void sub_8023C60(void); +extern u32 sub_8023CE8(void); +extern void sub_8023DA4(void); +extern void sub_802F204(struct unkStruct_802F204 *, u32); +extern u32 sub_80306A8(u32 wonderMailType, u32, struct UnkTextStruct2_sub *, u32); +extern u32 sub_8030894(void); +extern void sub_803092C(void); +extern bool8 sub_8031D70(u32 mailIndex, s32); +extern void sub_8035CF4(struct MenuStruct *, u32, u32); +extern s32 sub_8037B28(u32); +extern s32 sub_8037D64(u32, void *, void *); +extern s32 sub_80381F4(u32, void *, void *); +extern void sub_80922B4(u8 *buffer, u8 *string, s32 size); + +extern s32 CountMailType(u8 mailType); +extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); +struct unkStruct_203B480 * GetMailatIndex(u8 index); +extern s32 GetMailIndex(u8 mailType, u32 param_2); +extern char * GetMonSpecies(s16 index); +extern struct PokemonStruct *GetPlayerPokemonStruct(void); +extern void MemoryFill8(u8 *dest, u8 value, s32 size); +extern void nullsub_23(u32); +extern void ResetUnusedInputStruct(void); +extern void SetMenuItems(struct MenuStruct *param_1, struct UnkTextStruct2 *unkData, s32 index, const struct UnkTextStruct2 *param_4, const struct MenuItem *menuItems, u8 param_6, u32 menuAction, u32 unused_8); +extern void sprintfStatic(char *buffer, const char *text, ...); +extern void xxx_call_start_bg_music(void); u32 CreateFriendRescueMenu(void) @@ -501,3 +723,2315 @@ void CleanFriendRescueMenu(void) void nullsub_40(void) { } + +void sub_8032828(void) +{ + + struct unkStruct_203B480 *mail; + u32 temp; + u8 buffer [80]; + struct PokemonStruct *pokeStruct1; + struct PokemonStruct *pokeStruct2; + char *monName; + + switch (gUnknown_203B33C->state) { + case 0x0: + if (CountMailType(WONDER_MAIL_TYPE_SOS) == 0 && CountMailType(WONDER_MAIL_TYPE_THANK_YOU) == 0) { + if (gUnknown_203B33C->unk52C != 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E2108, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E20B8, NULL, 4, 0, NULL, 0x101); + } + else { + if (gUnknown_203B33C->unk52C != 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E20E0, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E2068, NULL, 4, 0, NULL, 0x101); + } + break; + case 0x1: + if (CountMailType(WONDER_MAIL_TYPE_SOS) == 0 && CountMailType(WONDER_MAIL_TYPE_THANK_YOU) == 0) { + if (gUnknown_203B33C->unk52C != 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E2108, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E20B8, NULL, 4, 0, NULL, 0x101); + } + else { + if (gUnknown_203B33C->unk52C != 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E20E0, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 0, &gUnknown_80E2068, NULL, 4, 0, NULL, 0x101); + } + break; + case 0x3: + if (CountMailType(WONDER_MAIL_TYPE_AOK) != 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 3, &gUnknown_80E2130, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 3, &gUnknown_80E2190, NULL, 4, 0, NULL, 0x101); + break; + case 0x4: + if (CountMailType(WONDER_MAIL_TYPE_SOS) == 0) { + if (CountMailType(WONDER_MAIL_TYPE_THANK_YOU) == 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 17, &gUnknown_80E2268, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 17, &gUnknown_80E2218, NULL, 4, 0, NULL, 0x101); + } + else { + if (CountMailType(WONDER_MAIL_TYPE_THANK_YOU) == 0) + sub_8014248(&gUnknown_80E25F4[0], 0, 17, &gUnknown_80E2240, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E25F4[0], 0, 17, &gUnknown_80E21B8, NULL, 4, 0, NULL, 0x101); + } + break; + case 0xE: + switch(gUnknown_203B33C->unk528) { + case 0x11: + sub_8014248(&gUnknown_80E2610[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + case 0x3: + sub_8014248(&gUnknown_80E2640[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + case 0x4: + sub_8014248(&gUnknown_80E2680[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + case 0x12: + sub_8014248(&gUnknown_80E26B0[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + case 0x13: + sub_8014248(&gUnknown_80E26F0[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + case 0x14: + sub_8014248(&gUnknown_80E2728[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + } + break; + case 0x3C: + sub_80141B4(&gUnknown_80E276C[0], 0, 0, 0x101); + break; + case 0x3D: + sub_8014248(&gUnknown_80E27A4[0], 0, 6, &gUnknown_80E2458, NULL, 4, 0, NULL, 0x101); + break; + case 0x43: + sub_80141B4(&gUnknown_80E2814[0], 0, 0, 0x101); + break; + case 0x3E: + sub_80141B4(&gUnknown_80E2840[0], 0, 0, 0x101); + break; + case 0x3F: + sub_80141B4(&gUnknown_80E2874[0], 0, 0, 0x101); + break; + case 0x40: + switch ((u32)gUnknown_203B33C->unk524) { + case 0xB: + case 0xD: + case 0xE: + sub_80141B4(&gUnknown_80E2898[0], 0, 0, 0x101); + break; + case 0xC: + break; + } + break; + case 0x42: + sub_80141B4(&gUnknown_80E28D8[0], 0, 0, 0x101); + break; + case 0x30: + sub_80141B4(&gUnknown_80E2904[0], 0, 0, 0x101); + break; + case 0x31: + sub_80141B4(&gUnknown_80E296C[0], 0, 0, 0x101); + break; + case 0x32: + if (sub_8030894() == 0) { + ResetUnusedInputStruct(); + sub_800641C(NULL, 1, 1); + sub_80306A8(1, 0, NULL, 6); + } + break; + case 0x35: + sub_8014248(&gUnknown_80E29A0[0], 0, 6, &gUnknown_80E22B4, NULL, 4, 0, NULL, 0x101); + break; + case 0x37: + switch ((u32)gUnknown_203B33C->unk524) { + case 0xC: + break; + case 0xB: + case 0xD: + case 0xE: + sub_80141B4(&gUnknown_80E29D0[0], 0, 0, 0x101); + break; + } + break; + case 0x38: + sub_80141B4(&gUnknown_80E2A0C[0], 0, 0, 0x101); + break; + case 0x3A: + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8031D70(gUnknown_203B33C->unk218, 0); + break; + case 0x3B: + sub_80141B4(&gUnknown_80E2A1C[0], 0, 0, 0x101); + break; + case 0x39: + sub_80141B4(&gUnknown_80E2A5C[0], 0, 0, 0x101); + break; + case 0x2D: + sub_80141B4(&gUnknown_80E2A80[0], 0, 0, 0x101); + break; + case 0x2F: + sub_80141B4(&gUnknown_80E2AA8[0], 0, 0, 0x101); + break; + case 0x2A: + sub_80141B4(&gUnknown_80E2AE4[0], 0, 0, 0x101); + break; + case 0x2B: + #ifndef NONMATCHING + gUnknown_203B33C->unk52C = gUnknown_203B33C->unk52C; + gUnknown_80E2BE0[0] = gUnknown_80E2BE0[0]; + #endif //NONMATCHING + switch ((u32)gUnknown_203B33C->unk524) { + case 0xC: + break; + case 0xB: + case 0xD: + case 0xE: + #ifndef NONMATCHING + gUnknown_80E2BE0[0] = gUnknown_80E2BE0[0]; + #endif //NONMATCHING + sub_80141B4(&gUnknown_80E2B54[0], 0, 0, 0x101); + break; + } + break; + case 0x2C: + sub_80141B4(&gUnknown_80E2A0C[0], 0, 0, 0x101); + break; + case 0x23: + sub_80141B4(&gUnknown_80E2B90[0], 0, 0, 0x101); + break; + case 0x21: + sub_8014248(&gUnknown_80E2BE0[0], 0, 15, &gUnknown_80E23A8, NULL, 4, 0, NULL, 0x101); + break; + case 0x25: + sub_80141B4(&gUnknown_80E2C48[0], 0, 0, 0x101); + break; + case 0x26: + if (sub_8023CE8() != 0) + sub_8023C60(); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8023868(3, 0, 0, 9); + break; + case 0x27: + sub_8006518(gUnknown_203B33C->unk35C); + SetMenuItems(gUnknown_203B33C->unk21C, gUnknown_203B33C->unk35C, 3, &gUnknown_80E2334, &gUnknown_80E234C, 1, 0, 0); + sub_8023DA4(); + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + break; + case 0x24: + sub_8014248(&gUnknown_80E2C94[0], 0, 16, &gUnknown_80E22F0, NULL, 4, 0, NULL, 0x101); + break; + case 0x29: + sub_8014248(&gUnknown_80E2CD4[0], 0, 6, &gUnknown_80E22D0, NULL, 4, 0, NULL, 0x101); + break; + case 0x1C: + sub_80141B4(&gUnknown_80E2CE8[0], 0, 0, 0x101); + break; + case 0x1D: + if (sub_8030894() == 0) { + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_80306A8(4, 0, NULL, 6); + } + break; + case 0x20: + sub_8014248(&gUnknown_80E2D30[0], 0, 6, &gUnknown_80E22B4, NULL, 4, 0, NULL, 0x101); + break; + case 0x22: + sub_80141B4(&gUnknown_80E2D60[0], 0, 0, 0x101); + break; + case 0x5: + sub_8014248(&gUnknown_80E2D7C[0], 0, 6, &gUnknown_80E2290, NULL, 4, 0, NULL, 0x101); + break; + case 0xA: + case 0x4C: + sub_8014248(&gUnknown_80E2E20[0], 0, 6, &gUnknown_80E2290, NULL, 4, 0, NULL, 0x101); + break; + case 0xB: + case 0x4D: + sub_80141B4(&gUnknown_80E2E54[0], 0, NULL, 0); + break; + case 0xC: + case 0x4E: + sub_80141B4(&gUnknown_80E2EB4[0], 0, NULL, 0); + break; + case 0x7: + gUnknown_203B33C->status = 0; + sub_8011830(); + gUnknown_203B33C->status = sub_8037B28(gUnknown_203B33C->unk40); + if (gUnknown_203B33C->status == 0) { + #ifndef NONMATCHING + u8 *u8ptr; + #endif //NONMATCHING + switch (gUnknown_203B33C->unk40) { + case 0x3: + MemoryFill8((u8*)&gUnknown_203B33C->unk48, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8*)&gUnknown_203B33C->unk78, 0, sizeof(struct unkStruct_203B480)); + gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk48, &gUnknown_203B33C->unk78); + break; + case 0x2: + MemoryFill8((u8*)&gUnknown_203B33C->unk48, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8*)&gUnknown_203B33C->unk78, 0, sizeof(struct unkStruct_203B480)); + #ifdef NONMATCHING + // Regswaps + gUnknown_203B33C->unk48 = *GetMailatIndex(gUnknown_203B33C->unk218); + #else + gUnknown_80E2BE0[0] = gUnknown_80E2BE0[0]; + u8ptr = &gUnknown_203B33C->unk218; + gUnknown_80E2BE0[0] = gUnknown_80E2BE0[0]; + gUnknown_203B33C->unk48 = *GetMailatIndex(*u8ptr); + #endif //NONMATCHING + gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk48, &gUnknown_203B33C->unk78); + break; + case 0x5: + MemoryFill8((u8*)&gUnknown_203B33C->unkA8, 0, sizeof(struct WonderMailStruct_203B2C0_sub)); + MemoryFill8((u8*)&gUnknown_203B33C->unk130, 0, sizeof(struct WonderMailStruct_203B2C0_sub)); + gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unkA8, &gUnknown_203B33C->unk130); + break; + case 0x4: + MemoryFill8((u8*)&gUnknown_203B33C->unkA8, 0, sizeof(struct WonderMailStruct_203B2C0_sub)); + MemoryFill8((u8*)&gUnknown_203B33C->unk130, 0, sizeof(struct WonderMailStruct_203B2C0_sub)); + gUnknown_203B33C->unkA8.pokemon.speciesNum = 0; + gUnknown_203B33C->unk130.pokemon.speciesNum = 0; + gUnknown_203B33C->unkA8.mail = *GetMailatIndex(gUnknown_203B33C->unk218); + if (gUnknown_203B33C->speciesNum != -1) { + pokeStruct1 = &gUnknown_203B33C->unkA8.pokemon; + pokeStruct2 = gRecruitedPokemonRef->pokemon; + pokeStruct2 += gUnknown_203B33C->speciesNum; + memcpy(pokeStruct1, pokeStruct2, sizeof(struct PokemonStruct)); + } + gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unkA8, &gUnknown_203B33C->unk130); + break; + } + + if (gUnknown_203B33C->status == 0) { + switch (gUnknown_203B33C->unk40) { + case 2: + case 3: + gUnknown_203B33C->status = sub_80381F4(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk48, &gUnknown_203B33C->unk78); + if (sub_800D588() != 0) + gUnknown_203B33C->unk420 = gUnknown_203B33C->unk78.unk10.unk10; + else + gUnknown_203B33C->unk420 = gUnknown_203B33C->unk48.unk10.unk10; + break; + case 4: + case 5: + gUnknown_203B33C->status = sub_80381F4(gUnknown_203B33C->unk40, &gUnknown_203B33C->unkA8, &gUnknown_203B33C->unk130); + if (sub_800D588() != 0) + gUnknown_203B33C->unk420 = gUnknown_203B33C->unk130.mail.unk10.unk10; + else + gUnknown_203B33C->unk420 = gUnknown_203B33C->unkA8.mail.unk10.unk10; + break; + } + } + } + xxx_call_start_bg_music(); + break; + case 0x10: + sub_80141B4(&gUnknown_80E2F14[0], 0, 0, 0x101); + break; + case 0x11: + sub_80141B4(&gUnknown_80E2F44[0], 0, 0, 0x101); + break; + case 0x12: + if (sub_8030894() != 0) + break; + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_80306A8(1, 0, NULL, 6); + break; + case 0x15: + sub_8014248(&gUnknown_80E2F78[0], 0, 6, &gUnknown_80E2290, NULL, 4, 0, NULL, 0x101); + break; + case 0xF: + sub_80141B4(&gUnknown_80E2FA0[0], 0, 0, 0x101); + break; + case 0x16: + switch ((u32)gUnknown_203B33C->unk524) { + case 0xC: + break; + case 0xB: + case 0xD: + case 0xE: + sub_80141B4(&gUnknown_80E2FEC[0], 0, 0, 0x101); + break; + } + break; + case 0x18: + sub_80141B4(&gUnknown_80E3030[0], 0, 0, 0x101); + break; + case 0x19: + sub_80141B4(&gUnknown_80E3078[0], 0, 0, 0x101); + break; + case 0x1A: + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_80151C0(4, gUnknown_203B33C->passwordBuffer); + break; + case 0x5A: + sub_8014248(&gUnknown_80E30A4[0], 0, 6, &gUnknown_80E2458, NULL, 4, 0, NULL, 0x101); + break; + case 0x5B: + sub_80141B4(gUnknown_80E30D0, 0, 0, 0x101); + break; + case 0x5D: + sub_8006518(gUnknown_203B33C->unk35C); + SetMenuItems(gUnknown_203B33C->unk21C, gUnknown_203B33C->unk35C, 3, &gUnknown_80E231C, &gUnknown_80E2408, 1, 0, 0); + sub_803092C(); + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + break; + case 0x5F: + if (sub_801D008() == 0) { + ResetUnusedInputStruct(); + sub_800641C(0,1,1); + { + struct {u16 a; u16 b;} local_x = {3, 2}; + sub_801C8C4(0, 1, (s32 *)&local_x, 9); + } + } + break; + case 0x60: + sub_8006518(gUnknown_203B33C->unk35C); + SetMenuItems(gUnknown_203B33C->unk21C, gUnknown_203B33C->unk35C, 3, &gUnknown_80E23F0, &gUnknown_80E2408, 1, 0, 0); + sub_801CCD8(); + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + break; + case 0x6A: + gUnknown_203B33C->status = 0; + sub_8011830(); + gUnknown_203B33C->status = sub_8037B28(gUnknown_203B33C->unk40); + if (gUnknown_203B33C->status == 0) { + switch (gUnknown_203B33C->unk40) { + case 0x6: + MemoryFill8((u8*)&gUnknown_203B33C->unk1B8, 0, 0x30); + gUnknown_203B33C->unk1B8 = *GetMailatIndex(gUnknown_203B33C->unk218); + gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk1B8, &gUnknown_203B33C->unk1E8); + break; + case 0x7: + MemoryFill8((u8*)&gUnknown_203B33C->unk1B8, 0, 0x30); + MemoryFill8((u8*)&gUnknown_203B33C->unk1E8, 0, 0x30); + gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk1B8, &gUnknown_203B33C->unk1E8); + break; + } + temp = 6; + if (gUnknown_203B33C->status == 0 && gUnknown_203B33C->unk40 <= 7 && gUnknown_203B33C->unk40 >= temp) { + gUnknown_203B33C->status = sub_80381F4(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk1B8, &gUnknown_203B33C->unk1E8); + if (sub_800D588() != 0) + gUnknown_203B33C->unk420 = gUnknown_203B33C->unk1E8.unk10.unk10; + else + gUnknown_203B33C->unk420 = gUnknown_203B33C->unk1B8.unk10.unk10; + } + } + xxx_call_start_bg_music(); + break; + case 0x72: + sub_80141B4(gUnknown_80E311C, 0, 0, 0x101); + break; + case 0x73: + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_80151C0(4, gUnknown_203B33C->passwordBuffer); + break; + case 0x66: + sub_80141B4(gUnknown_80E314C, 0, 0, 0x101); + break; + case 0x67: + case 0x2E: + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8031D70(gUnknown_203B33C->unk218, 0); + break; + case 0x68: + sub_80141B4(gUnknown_80E317C, 0, 0, 0x101); + break; + case 0x6F: + sub_80141B4(gUnknown_80E319C, 0, 0, 0x101); + break; + case 0x70: // Yes we need duplicates in order to match :) - Kermalis + sub_80141B4(gUnknown_80E317C, 0, 0, 0x101); + break; + case 0x6C: + sub_80141B4(gUnknown_80E31D8, 0, 0, 0x101); + break; + case 0x50: + sub_80141B4(&gUnknown_80E31FC[0], 0, 0, 0x101); + break; + case 0x6D: + switch ((u32)gUnknown_203B33C->unk524) { + case 0xC: + break; + case 0xB: + case 0xD: + case 0xE: + sub_80141B4(&gUnknown_80E3220[0], 0, 0, 0x101); + break; + } + break; + case 0x6E: + monName = GetMonSpecies(MONSTER_PELIPPER); + strcpy(gUnknown_203B33C->unk53C.clientName, monName); + gUnknown_203B33C->unk53C.clientSpecies = 0; + gUnknown_203B33C->unk53C.unk16 = 2; + gUnknown_203B33C->unk53C.moneyReward = 0; + mail = GetMailatIndex(GetMailIndex(6, gUnknown_203B33C->unk420)); + // ABSOLUTELY GENIUS + if (mail->unk20.id != ITEM_NOTHING) + gUnknown_203B33C->unk53C.itemRewards[0] = mail->unk20.id; + else + gUnknown_203B33C->unk53C.itemRewards[0] = ITEM_NOTHING; + gUnknown_203B33C->unk53C.quantity = 1; + gUnknown_203B33C->unk53C.teamRankPtsReward = GetDungeonTeamRankPts(&mail->dungeon, 0); + gUnknown_203B33C->unk53C.itemRewards[1] = 0; + gUnknown_203B33C->unk53C.itemRewards[2] = 0; + gUnknown_203B33C->unk53C.friendAreaReward = 0; + sub_802F204(&gUnknown_203B33C->unk53C, 0); + break; + case 0xD: + case 0x62: + nullsub_23(0); + sub_80141B4(&gUnknown_80E2DD0[0], 0, NULL, 0); + break; + case 0x64: + switch ((u32)gUnknown_203B33C->unk524) { + case 0xC: + break; + case 0xB: + case 0xD: + case 0xE: + sub_80141B4(gUnknown_80E3248, 0, 0, 0x101); + break; + } + break; + case 0x63: + sub_80141B4(gUnknown_80E3288, 0, 0, 0x101); + break; + case 0x69: + sub_8014248(&gUnknown_80E2D7C[0], 0, 6, &gUnknown_80E2290, NULL, 4, 0, NULL, 0x101); + break; + case 0x59: + sub_80922B4(buffer, GetPlayerPokemonStruct()->name, POKEMON_NAME_LENGTH); + sprintfStatic(gUnknown_203B33C->unk424, gUnknown_80E32C4, buffer); + sub_80141B4(gUnknown_203B33C->unk424, 0, 0, 0x101); + break; + case 0x58: + sub_8014248(&gUnknown_80E331C[0], 0, 6, &gUnknown_80E24D8, NULL, 4, 0, NULL, 0x101); + break; + case 0x75: + sub_80141B4(gUnknown_80E317C, 0, 0, 0x101); + break; + case 0x76: + sub_80141B4(gUnknown_80E2A0C, 0, 0, 0x101); + break; + case 0x57: + sub_80141B4(&gUnknown_80E3378[0], 0, 0, 0x101); + break; + case 0x56: + sub_8014248(&gUnknown_80E339C[0], 0, 22, &gUnknown_80E24B0, NULL, 4, 0, NULL, 0x101); + break; + case 0x55: + sub_8014248(&gUnknown_80E33D8[0], 0, 21, &gUnknown_80E2470, NULL, 4, 0, NULL, 0x101); + break; + case 0x53: + sub_80141B4(&gUnknown_80E3430[0], 0, 0, 0x101); + break; + case 0x54: + sub_8014248(&gUnknown_80E34B0[0], 0, 6, &gUnknown_80E2440, NULL, 4, 0, NULL, 0x101); + break; + case 0x46: + sub_80141B4(&gUnknown_80E34F0[0], 0, 0, 0x101); + break; + case 0x47: + case 0x5C: + if (sub_8030894() == 0) { + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_80306A8(5, 0, 0, 6); + } + break; + case 0x48: + case 0x13: + case 0x1E: + case 0x33: + sub_8006518(gUnknown_203B33C->unk35C); + SetMenuItems(gUnknown_203B33C->unk21C, gUnknown_203B33C->unk35C, 3, &gUnknown_80E231C, &gUnknown_80E234C, 1, 0, 0); + sub_803092C(); + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + break; + case 0x4A: + sub_8014248(&gUnknown_80E352C[0], 0, 6, &gUnknown_80E2290, NULL, 4, 0, NULL, 0x101); + break; + case 0x44: + sub_80141B4(&gUnknown_80E355C[0], 0, 0, 0x101); + break; + case 0x45: + sub_80141B4(&gUnknown_80E35AC[0], 0, 0, 0x101); + break; + case 0x51: + sub_80141B4(&gUnknown_80E35E8[0], 0, 0, 0x101); + break; + case 0x52: + if (gUnknown_203B33C->unk40 == 6) + sub_8014248(&gUnknown_80E360C[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + else + sub_8014248(&gUnknown_80E3644[0], 0, 11, &gUnknown_80E236C, NULL, 4, 0, NULL, 0x101); + break; + case 0x7C: + sub_8014248(&gUnknown_80E367C[0], 0, gUnknown_203B33C->unk564, &gUnknown_80E25B4, 0, 4, 0, 0, 0x101); + break; + case 0x7D: + switch (gUnknown_203B33C->unk564) { + case 0x23: + sub_80141B4(&gUnknown_80E3690[0], 0, 0, 0x101); + break; + case 0x24: + sub_80141B4(&gUnknown_80E3818[0], 0, 0, 0x101); + break; + case 0x25: + sub_80141B4(&gUnknown_80E3998[0], 0, 0, 0x101); + break; + case 0x26: + sub_80141B4(&gUnknown_80E3B1C[0], 0, 0, 0x101); + break; + } + break; + case 0x7A: + sub_8014248(&gUnknown_80E367C[0], 0, gUnknown_203B33C->unk564, &gUnknown_80E2554, 0, 4, 0, 0, 0x101); + break; + case 0x7B: + switch (gUnknown_203B33C->unk564) { + case 0x1E: + sub_80141B4(&gUnknown_80E3BF8[0], 0, 0, 0x101); + break; + case 0x1F: + sub_80141B4(&gUnknown_80E3DE4[0], 0, 0, 0x101); + break; + case 0x21: + sub_80141B4(&gUnknown_80E3E98[0], 0, 0, 0x101); + break; + case 0x20: + sub_80141B4(&gUnknown_80E4014[0], 0, 0, 0x101); + break; + case 0x22: + sub_80141B4(&gUnknown_80E4130[0], 0, 0, 0x101); + break; + } + break; + case 0x78: + sub_8014248(&gUnknown_80E367C[0], 0, gUnknown_203B33C->unk564, &gUnknown_80E24F8, 0, 4, 0, 0, 0x101); + break; + case 0x79: + switch (gUnknown_203B33C->unk564) { + case 0x1D: + sub_80141B4(&gUnknown_80E41DC[0], 0, 0, 0x101); + break; + case 0x1A: + sub_80141B4(&gUnknown_80E4314[0], 0, 0, 0x101); + break; + } + break; + } +} + + +void SetFriendRescueMenuState(u32 newState) +{ + gUnknown_203B33C->state = newState; + nullsub_40(); + sub_8032828(); +} + +void PrintFriendRescueError(u32 status) +{ + switch(status) + { + case COMMS_GOOD: + break; + case COMMS_INCORRECT_NUM_SYSTEMS: + sub_80141B4(gUnknown_80E44A4, 0, 0, 0x101); + break; + case COMMS_NO_RESPONSE: + sub_80141B4(gUnknown_80E4500, 0, 0, 0x101); + break; + case COMMS_DIFFERENT_MODES: + sub_80141B4(gUnknown_80E4550, 0, 0, 0x101); + break; + case COMMS_NO_ROOM_STORAGE: + sub_80141B4(gUnknown_80E45B4, 0, 0, 0x101); + break; + case COMMS_DUPLICATE_MAIL: + sub_80141B4(gUnknown_80E460C, 0, 0, 0x101); + break; + case COMMS_MAIL_SENT_ALREADY: + sub_80141B4(gUnknown_80E4650, 0, 0, 0x101); + break; + case COMMS_NOT_ELIGIBLE_1: + sub_80141B4(gUnknown_80E468C, 0, 0, 0x101); + break; + case COMMS_FRIEND_NOT_ELIGIBLE: + sub_80141B4(gUnknown_80E46C8, 0, 0, 0x101); + break; + case COMMS_NOT_ELIGIBLE_2: + sub_80141B4(gUnknown_80E4704, 0, 0, 0x101); + break; + case COMMS_FRIEND_NOT_ELIGIBLE_2: + sub_80141B4(gUnknown_80E4744, 0, 0, 0x101); + break; + case 16: + sub_80141B4(gUnknown_80E4788, 0, 0, 0x101); + break; + case COMMS_NO_ROOM_MAIL: + sub_80141B4(gUnknown_80E47D8, 0, 0, 0x101); + break; + case 1: + case 5: + case 14: + sub_80141B4(gUnknown_80E4480, 0, 0, 0x101); + break; + case COMMS_NOT_READY: + sub_80141B4(gUnknown_80E482C, 0, 0, 0x101); + break; + } +} + +void sub_80339C8(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + gUnknown_203B33C->speciesNum = -1; + switch(menuAction) + { + case 0: + SetFriendRescueMenuState(3); + break; + case 1: + SetFriendRescueMenuState(4); + break; + case 0x17: + SetFriendRescueMenuState(0x78); + break; + case 0x8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); + break; + } + } +} + +void sub_8033A2C(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + gUnknown_203B33C->unk40 = 8; + switch(menuAction) + { + case 0x11: + gUnknown_203B33C->unk40 = 2; + gUnknown_203B33C->unk528 = 0x11; + if(CountMailType(WONDER_MAIL_TYPE_SOS) != 0) + SetFriendRescueMenuState(0x31); + else + SetFriendRescueMenuState(0x22); + break; + case 3: + gUnknown_203B33C->unk40 = 3; + gUnknown_203B33C->unk528 = 3; + if(FindOpenMailSlot() == -1) + SetFriendRescueMenuState(0xF); + else + SetFriendRescueMenuState(0xE); + break; + case 4: + gUnknown_203B33C->unk40 = 4; + gUnknown_203B33C->unk528 = 4; + if(CountMailType(WONDER_MAIL_TYPE_AOK) != 0) + SetFriendRescueMenuState(0x1C); + else + SetFriendRescueMenuState(0x22); + break; + case 0x12: + gUnknown_203B33C->unk40 = 5; + gUnknown_203B33C->unk528 = 0x12; + if(CountMailType(5) != 0) + SetFriendRescueMenuState(0x3D); + else + SetFriendRescueMenuState(0xE); + break; + case 0x13: + gUnknown_203B33C->unk40 = 6; + gUnknown_203B33C->unk528 = 0x13; + if(CountMailType(5) == 0) + SetFriendRescueMenuState(0x51); + else + SetFriendRescueMenuState(0x5B); + break; + case 0x14: + gUnknown_203B33C->unk40 = 7; + gUnknown_203B33C->unk528 = 0x14; + SetFriendRescueMenuState(0x52); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_8033B8C(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 0xB: + case 0xC: + gUnknown_203B33C->unk524 = 0xB; + switch(gUnknown_203B33C->unk528) + { + case 3: + case 0x11: + case 0x12: + SetFriendRescueMenuState(5); + break; + case 4: + SetFriendRescueMenuState(0x23); + break; + default: + break; + } + break; + case 0xD: + gUnknown_203B33C->unk524 = 0xD; + switch(gUnknown_203B33C->unk528) + { + case 3: + SetFriendRescueMenuState(0x19); + break; + case 0x11: + SetFriendRescueMenuState(0x39); + break; + case 0x12: + SetFriendRescueMenuState(0x43); + break; + case 4: + SetFriendRescueMenuState(0x2D); + break; + default: + break; + } + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_8033C54(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + switch(gUnknown_203B33C->unk528) + { + // NOTE: Each case has to be defined to match + case 3: + SetFriendRescueMenuState(0xD); + break; + case 4: + SetFriendRescueMenuState(0xD); + break; + case 0x11: + SetFriendRescueMenuState(0xD); + break; + case 0x12: + SetFriendRescueMenuState(0xD); + break; + default: + break; + } + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void nullsub_41(void) +{ +} + +void sub_8033CAC(void) +{ + s32 temp; + u32 speciesNum; + if(sub_80144A4(&temp) == 0) + { + if(gUnknown_203B33C->status == COMMS_GOOD) + { + switch(gUnknown_203B33C->unk528) + { + case 3: + SetFriendRescueMenuState(0x16); + break; + case 0x11: + SetFriendRescueMenuState(0x37); + break; + case 0x12: + if(sub_800D588() != 0) + speciesNum = gUnknown_203B33C->unk130.pokemon.speciesNum; + else + speciesNum = gUnknown_203B33C->unkA8.pokemon.speciesNum; + if(speciesNum != MONSTER_NONE) + SetFriendRescueMenuState(0x3F); + else + SetFriendRescueMenuState(0x40); + break; + case 4: + SetFriendRescueMenuState(0x2B); + break; + + } + } + else + { + PrintFriendRescueError(gUnknown_203B33C->status); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); + } + } +} + +void sub_8033D48(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + } +} + +void nullsub_42(void) +{ +} + +void nullsub_43(void) +{ +} + +void nullsub_44(void) +{ +} + +void nullsub_45(void) +{ +} + +void sub_8033D74(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x17); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8033D94(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()) + { + FinishWriteSavePak(); + SetFriendRescueMenuState(0x18); + } + } +} + +void sub_8033DBC(void) +{ + u32 return_var; + u32 mailMode; + struct unkStruct_203B480 mail; + struct unkStruct_203B480 *mail2; + + return_var = sub_80154F0(); + MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); + switch(return_var) + { + case 3: + mailMode = 0xffdc; + switch(gUnknown_203B33C->unk528) + { + case 3: + mailMode = PASSWORD_ENTRY_SOS_MAIL_MODE; + break; + case 0x12: + mailMode = PASSWORD_ENTRY_AOK_MAIL_MODE; + break; + default: + break; + } + switch(sub_8039068(mailMode, gUnknown_203B33C->passwordBuffer, &mail)) + { + case PASSWORD_ENTRY_INCORRECT_PASSWORD: + sub_8014248(gUnknown_80E48A8, 0, 6, &gUnknown_80E2290, 0, 4, 0, 0, 0x101); + SetFriendRescueMenuState(0x1B); + break; + case PASSWORD_ENTRY_NOT_SOS_MAIL: + sub_80141B4(gUnknown_80E48E8, 0, 0, 0x101); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); + break; + case PASSWORD_ENTRY_DUPLICATE_SOS_MAIL: + sub_80141B4(gUnknown_80E460C, 0, 0, 0x101); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); + break; + case PASSWORD_ENTRY_SOS_MAIL_SUCCESS: + sub_8095274(mail.unk10.unk10); + mail.mailType = 2; + sub_80951BC(&mail); + sub_80141B4(gUnknown_80E4928, 0, 0, 0x101); + SetFriendRescueMenuState(0x16); + break; + case PASSWORD_ENTRY_NOT_AOK_MAIL: + sub_80141B4(gUnknown_80E4964, 0, 0, 0x101); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); + break; + case PASSWORD_ENTRY_DUPLICATE_AOK_MAIL: + sub_80141B4(gUnknown_80E499C, 0, 0, 0x101); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); + break; + case PASSWORD_ENTRY_AOK_MAIL_SUCCESS: + mail.mailType = 5; + sub_80951FC(&mail); + mail2 = GetMailatIndex(GetMailIndex(1, mail.unk10.unk10)); + mail2->mailType = 7; + MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); + SetFriendRescueMenuState(0x40); + break; + case 24: + default: + break; + } + sub_80155F0(); + break; + case 2: + sub_80155F0(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } +} + +void sub_8033F64(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + switch(gUnknown_203B33C->unk528) + { + case 3: + SetFriendRescueMenuState(0x19); + break; + case 0x12: + SetFriendRescueMenuState(0x43); + break; + } + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_8033FB4(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + switch(temp) + { + case 6: + SetFriendRescueMenuState(0xE); + break; + case 7: + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_8033FE4(void) +{ + switch(sub_8030768(1)) + { + case 2: + sub_803084C(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + case 3: + gUnknown_203B33C->unk218 = sub_80307EC(); + SetFriendRescueMenuState(0x1E); + break; + case 4: + gUnknown_203B33C->fallbackState = 0x1D; + gUnknown_203B33C->unk218 = sub_80307EC(); + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8030D40(gUnknown_203B33C->unk218, 0); + SetFriendRescueMenuState(0x1F); + break; + } +} + +void sub_8034074(void) +{ + s32 menuAction; + + menuAction = -1; + sub_8030768(0); + if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) + sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); + switch(menuAction) + { + case 9: + sub_803084C(); + SetFriendRescueMenuState(0x20); + break; + case 10: + gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8030D40(gUnknown_203B33C->unk218, 0); + SetFriendRescueMenuState(0x1F); + break; + case 5: + case 8: + sub_8035CC0(gUnknown_203B33C->unk35C, 2); + sub_8030810(0x1); + SetFriendRescueMenuState(0x1D); + break; + } +} + +void sub_8034130(void) +{ + switch(sub_8030DA0()) + { + case 2: + case 3: + sub_8030DE4(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_803092C(); + if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) + { + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + SetFriendRescueMenuState(0x1E); + } + else + SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); + break; + default: + break; + } +} + +void sub_803418C(void) +{ + switch(sub_8023A94(1)) + { + case 2: + sub_8023C60(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + sub_8035D1C(); + gUnknown_203B33C->speciesNum = -1; + break; + case 3: + gUnknown_203B33C->speciesNum = sub_8023B44(); + if(gUnknown_203B33C->unk524 == 0xE) + SetFriendRescueMenuState(9); + else + SetFriendRescueMenuState(0x27); + break; + case 4: + gUnknown_203B33C->fallbackState = 0x26; + gUnknown_203B33C->speciesNum = sub_8023B44(); + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8024458(gUnknown_203B33C->speciesNum, 0); + SetFriendRescueMenuState(0x28); + break; + } +} + +void sub_8034254(void) +{ + s32 menuAction; + menuAction = -1; + + sub_8023A94(0); + if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) + sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); + switch(menuAction) + { + case 9: + sub_8023C60(); + SetFriendRescueMenuState(0x29); + break; + case 10: + gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8024458(gUnknown_203B33C->speciesNum, 0); + SetFriendRescueMenuState(0x28); + break; + case 5: + case 8: + sub_8035CC0(gUnknown_203B33C->unk35C, 3); + sub_8023DA4(); + SetFriendRescueMenuState(0x26); + break; + } +} + +void sub_8034310(void) +{ + switch(sub_80244E4()) + { + case 1: + sub_802452C(); + break; + case 2: + case 3: + sub_802453C(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_8023B7C(1); + if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) + { + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + SetFriendRescueMenuState(0x27); + } + else + SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); + break; + default: + break; + } +} + +void sub_8034378(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 0x10: + if(gUnknown_203B33C->unk524 == 0xE) + SetFriendRescueMenuState(0x9); + else + SetFriendRescueMenuState(0x5); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_80343C4(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + SetFriendRescueMenuState(0x5); + break; + case 7: + SetFriendRescueMenuState(0x25); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_8034404(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 0xF: + if(sub_8024108(3)) + SetFriendRescueMenuState(0x24); + else + SetFriendRescueMenuState(0x25); + break; + case 0x10: + if(gUnknown_203B33C->unk524 == 0xE) + SetFriendRescueMenuState(0x9); + else + SetFriendRescueMenuState(0x5); + break; + case 0x8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_8034478(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()) + { + FinishWriteSavePak(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); + } + } +} + +void sub_80344A0(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x2C); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_80344C0(void) +{ + switch(sub_8031DCC()) + { + case 2: + case 3: + sub_8031E10(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + SetFriendRescueMenuState(0x2F); + break; + case 1: + sub_8031E00(); + break; + case 0: + break; + } +} + +void sub_8034500(void) +{ + switch(sub_8030768(1)) + { + case 2: + sub_803084C(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + case 3: + gUnknown_203B33C->unk218 = sub_80307EC(); + SetFriendRescueMenuState(0x33); + break; + case 4: + gUnknown_203B33C->fallbackState = 0x32; + gUnknown_203B33C->unk218 = sub_80307EC(); + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8030D40(gUnknown_203B33C->unk218, 0); + SetFriendRescueMenuState(0x34); + break; + } +} + +void sub_8034590(void) +{ + s32 menuAction; + menuAction = -1; + + sub_8030768(0); + if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) + sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); + switch(menuAction) + { + case 9: + sub_803084C(); + SetFriendRescueMenuState(0x35); + break; + case 10: + gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8030D40(gUnknown_203B33C->unk218, 0); + SetFriendRescueMenuState(0x34); + break; + case 5: + case 8: + sub_8035CC0(gUnknown_203B33C->unk35C, 2); + sub_8030810(0x1); + SetFriendRescueMenuState(0x32); + break; + } +} + +void sub_803464C(void) +{ + switch(sub_8030DA0()) + { + case 2: + case 3: + sub_8030DE4(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_803092C(); + if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) + { + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + SetFriendRescueMenuState(0x33); + } + else + SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); + break; + default: + break; + } +} + +void sub_80346A8(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + SetFriendRescueMenuState(0xE); + break; + case 7: + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_80346D8(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()) + { + FinishWriteSavePak(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); + } + } +} + +void sub_8034700(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x38); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8034720(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x3A); + } +} + +void sub_803473C(void) +{ + switch(sub_8031DCC()) + { + case 2: + case 3: + sub_8031E10(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + SetFriendRescueMenuState(0x3B); + break; + case 1: + sub_8031E00(); + break; + case 0: + break; + } +} + +void sub_803477C(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + SetFriendRescueMenuState(0xE); + break; + case 7: + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_80347AC(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0xD); + } +} + +void sub_80347C8(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x40); + } +} + +void sub_80347E4(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x41); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8034804(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()) + { + FinishWriteSavePak(); + SetFriendRescueMenuState(0x42); + } + } +} + +void sub_803482C(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + } +} + +void sub_8034848(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(struct Item)); + gUnknown_203B33C->item.id = ITEM_NOTHING; + gUnknown_203B33C->item.quantity = 1; + gUnknown_203B33C->item.flags = 0; + + if(gUnknown_203B33C->status == COMMS_GOOD) + { + switch(gUnknown_203B33C->unk40) + { + case 7: + SetFriendRescueMenuState(0x6D); + break; + case 6: + SetFriendRescueMenuState(0x50); + break; + } + } + else + { + PrintFriendRescueError(gUnknown_203B33C->status); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); + } + } +} + +void sub_80348C4(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(struct Item)); + gUnknown_203B33C->item.id = ITEM_NOTHING; + gUnknown_203B33C->item.quantity = 1; + gUnknown_203B33C->item.flags = 0; + + if(gUnknown_203B33C->status == COMMS_GOOD) + { + switch(gUnknown_203B33C->unk40) + { + case 6: + switch((u32)gUnknown_203B33C->unk524) + { + case 0xB: + case 0xD: + case 0xE: + sub_80141B4(gUnknown_80E31FC, 0, 0, 0x101); + SetFriendRescueMenuState(0x77); + break; + case 0xC: + default: + SetFriendRescueMenuState(0x77); + break; + } + break; + case 7: + SetFriendRescueMenuState(0x6D); + break; + } + } + else + { + PrintFriendRescueError(gUnknown_203B33C->status); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); + } + } +} + +void sub_8034970(void) +{ + switch(sub_8031DCC()) + { + case 2: + case 3: + sub_8031E10(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + SetFriendRescueMenuState(0x68); + break; + case 1: + sub_8031E00(); + break; + case 0: + break; + } +} + +void sub_80349B0(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + SetFriendRescueMenuState(0x52); + break; + case 7: + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_80349E0(void) +{ + switch(sub_8030768(1)) + { + case 2: + sub_803084C(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + case 3: + gUnknown_203B33C->unk218 = sub_80307EC(); + SetFriendRescueMenuState(0x5D); + break; + case 4: + gUnknown_203B33C->fallbackState = 0x5C; + gUnknown_203B33C->unk218 = sub_80307EC(); + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8030D40(gUnknown_203B33C->unk218, 0); + SetFriendRescueMenuState(0x5E); + break; + } +} + +void sub_8034A70(void) +{ + s32 menuAction; + + menuAction = -1; + sub_8030768(0); + if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) + sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); + switch(menuAction) + { + case 9: + sub_803084C(); + SetFriendRescueMenuState(0x5A); + break; + case 10: + gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_8030D40(gUnknown_203B33C->unk218, 0); + SetFriendRescueMenuState(0x5E); + break; + case 5: + case 8: + sub_8035CC0(gUnknown_203B33C->unk35C, 2); + sub_8030810(0x1); + SetFriendRescueMenuState(0x5C); + break; + } +} + +void sub_8034B2C(void) +{ + switch(sub_8030DA0()) + { + case 2: + case 3: + sub_8030DE4(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_803092C(); + if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) + { + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + SetFriendRescueMenuState(0x5D); + } + else + SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); + break; + default: + break; + } +} + +void sub_8034B88(void) +{ + gUnknown_203B33C->item.id = ITEM_NOTHING; + gUnknown_203B33C->item.quantity = 1; + gUnknown_203B33C->item.flags = 0; + switch(sub_801CA08(1)) + { + case 2: + sub_801CBB8(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + case 3: + gUnknown_203B33C->item.id = sub_801CB24(); + SetFriendRescueMenuState(0x60); + break; + case 4: + gUnknown_203B33C->fallbackState = 0x5F; + gUnknown_203B33C->item.id = sub_801CB24(); + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_801B3C0(&gUnknown_203B33C->item); + SetFriendRescueMenuState(0x61); + break; + } +} + +void sub_8034C38(void) +{ + switch(sub_801B410()) + { + case 2: + case 3: + sub_801B450(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_801CB5C(1); + if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) + { + sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); + SetFriendRescueMenuState(0x60); + } + else + SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); + break; + default: + case 1: + break; + } +} + +void sub_8034C98(void) +{ + s32 menuAction; + + menuAction = -1; + sub_801CA08(0); + if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) + sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); + switch(menuAction) + { + case 9: + sub_801CBB8(); + SetFriendRescueMenuState(0x58); + break; + case 10: + gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; + sub_8006518(gUnknown_203B33C->unk3BC); + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sub_801B3C0(&gUnknown_203B33C->item); + SetFriendRescueMenuState(0x61); + break; + case 5: + case 8: + sub_8035CC0(gUnknown_203B33C->unk35C, 3); + sub_801CB5C(0x1); + SetFriendRescueMenuState(0x5F); + break; + } +} + +void sub_8034D54(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x65); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8034D74(void) +{ + u32 return_var; + struct unkStruct_203B480 mail; + struct unkStruct_203B480 *mail2; + + return_var = sub_80154F0(); + MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); + switch(return_var) + { + case 3: + switch(sub_8039068(PASSWORD_ENTRY_THANK_YOU_MAIL_MODE, gUnknown_203B33C->passwordBuffer, &mail)) + { + case PASSWORD_ENTRY_INCORRECT_PASSWORD: + sub_8014248(gUnknown_80E48A8, 0, 6, &gUnknown_80E2440, 0, 4, 0, 0, 0x101); + SetFriendRescueMenuState(0x74); + break; + case PASSWORD_ENTRY_NOT_THANK_YOU_MAIL: + sub_80141B4(gUnknown_80E49C4, 0, 0, 0x101); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); + break; + case PASSWORD_ENTRY_DUPLICATE_THANK_YOU_MAIL: + sub_80141B4(gUnknown_80E4704, 0, 0, 0x101); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); + break; + case PASSWORD_ENTRY_THANK_YOU_MAIL_SUCCESS: + mail2 = GetMailatIndex(GetMailIndex(4, mail.unk10.unk10)); + *mail2 = mail; + mail2->mailType = 6; + gUnknown_203B33C->unk420 = mail.unk10.unk10; + SetFriendRescueMenuState(0x6D); + break; + case 7: + default: + break; + } + sub_80155F0(); + break; + case 2: + sub_80155F0(); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } +} + +void sub_8034EC8(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()) + { + FinishWriteSavePak(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); + } + } +} + +void sub_8034EF0(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()) + { + FinishWriteSavePak(); + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); + } + } +} + +void sub_8034F18(void) +{ + s32 temp; + + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x65); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8034F38(void) +{ + s32 temp; + + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x71); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8034F58(void) +{ + s32 temp; + + if(sub_80144A4(&temp) == 0) + { + switch(temp) + { + case 6: + SetFriendRescueMenuState(0x62); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_8034F88(void) +{ + s32 menuAction; + struct unkStruct_203B480 *mail; + + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + mail = GetMailatIndex(gUnknown_203B33C->unk218); + if(gUnknown_203B33C->item.id != ITEM_NOTHING) + mail->unk20 = gUnknown_203B33C->item; + gTeamInventory_203B460->teamStorage[gUnknown_203B33C->item.id]--; + SetFriendRescueMenuState(0x75); + break; + case 7: + SetFriendRescueMenuState(0x57); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + } + } +} + +void sub_8035018(void) +{ + s32 temp; + + if(sub_80144A4(&temp) == 0) + { + SetFriendRescueMenuState(0x76); + PrepareSavePakWrite(MONSTER_NONE); + } +} + +void sub_8035038(void) +{ + s32 temp; + + if(sub_80144A4(&temp) == 0) + { + if(!WriteSavePak()){ + FinishWriteSavePak(); + // Dumb cast to get unsigned switch + switch((u32)gUnknown_203B33C->unk524) + { + default: + break; + case 0xB: + case 0xC: + SetFriendRescueMenuState(0x69); + break; + case 0xD: + SetFriendRescueMenuState(0x66); + break; + case 0xE: + SetFriendRescueMenuState(0x4B); + break; + } + } + } +} + +void sub_8035094(void) +{ + s32 menuAction; + + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 0x16: + // Dumb cast to get unsigned switch + switch((u32)gUnknown_203B33C->unk524) + { + default: + break; + case 0xB: + case 0xC: + SetFriendRescueMenuState(0x69); + break; + case 0xD: + SetFriendRescueMenuState(0x66); + break; + case 0xE: + SetFriendRescueMenuState(0x4B); + break; + } + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_80350F4(void) +{ + s32 menuAction; + + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 0x15: + if(sub_801CF14(0) != 0) + SetFriendRescueMenuState(0x56); + else + SetFriendRescueMenuState(0x57); + break; + case 0x16: + // Dumb cast to get unsigned switch + switch((u32)gUnknown_203B33C->unk524) + { + default: + break; + case 0xB: + case 0xC: + SetFriendRescueMenuState(0x69); + break; + case 0xD: + SetFriendRescueMenuState(0x66); + break; + case 0xE: + SetFriendRescueMenuState(0x4B); + break; + } + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_803517C(void) +{ + s32 menuAction; + + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + // Dumb cast to get unsigned switch + switch((u32)gUnknown_203B33C->unk524) + { + default: + break; + case 0xB: + case 0xC: + SetFriendRescueMenuState(0x69); + break; + case 0xD: + SetFriendRescueMenuState(0x66); + break; + case 0xE: + SetFriendRescueMenuState(0x4B); + break; + } + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_80351E0(void) +{ + s32 menuAction; + + if(sub_80144A4(&menuAction) == 0) + { + switch(menuAction) + { + case 6: + SetFriendRescueMenuState(0x72); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + default: + break; + } + } +} + +void sub_8035210(void) +{ + s32 menuAction; + struct unkStruct_203B480 *mail; + + if(sub_80144A4(&menuAction) == 0) + { + // NOTE: this is why unk524 can't be changed to u32.. + gUnknown_203B33C->unk524 = menuAction; + switch(gUnknown_203B33C->unk524) + { + case 0xB: + case 0xC: + case 0xD: + if(gUnknown_203B33C->unk528 == 0x13) + { + mail = GetMailatIndex(GetFirstIndexofMailType(5)); + if(mail->unk20.id != ITEM_NOTHING) + SetFriendRescueMenuState(0x53); + else + SetFriendRescueMenuState(0x55); + } + else if(gUnknown_203B33C->unk524 != 0xD) + SetFriendRescueMenuState(0x69); + else + SetFriendRescueMenuState(0x72); + break; + case 8: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + case 0xE: + default: + break; + } + } +} + +void nullsub_46(void) +{ +} + +void nullsub_47(void) +{ +} + +void nullsub_48(void) +{ +} + +void nullsub_49(void) +{ +} + +void sub_80352A4(void) +{ + u8 mailIndex; + char *monName; + + if ( sub_802F298() == 3) { + sub_802F2C0(); + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_PELIPPER); + monName = GetMonSpecies(MONSTER_PELIPPER); + strcpy(gAvailablePokemonNames, monName); + mailIndex = GetMailIndex(6, gUnknown_203B33C->unk420); + DeleteMailAtIndex(mailIndex); + SetFriendRescueMenuState(0x70); + } +} + +void sub_8035300(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) != 0) + return; + switch(menuAction) + { + case 0x19: + SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); + break; + case 0x1B: + SetFriendRescueMenuState(0x7A); + break; + case 0x1C: + SetFriendRescueMenuState(0x7C); + break; + case 0x1A: + case 0x1D: + gUnknown_203B33C->unk564 = menuAction; + SetFriendRescueMenuState(0x79); + break; + } +} + +void sub_8035374(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) != 0) + return; + switch(menuAction) + { + case 0x19: + SetFriendRescueMenuState(0x78); + break; + case 0x1E: + case 0x1F: + case 0x20: + case 0x21: + case 0x22: + gUnknown_203B33C->unk564 = menuAction; + SetFriendRescueMenuState(0x7B); + break; + } +} + +void sub_80353BC(void) +{ + s32 menuAction; + if(sub_80144A4(&menuAction) != 0) + return; + switch(menuAction) + { + case 0x19: + SetFriendRescueMenuState(0x78); + break; + case 0x23: + case 0x24: + case 0x25: + case 0x26: + gUnknown_203B33C->unk564 = menuAction; + SetFriendRescueMenuState(0x7D); + break; + } +} + +void QueueNextFriendRescueState(u32 nextState) +{ + s32 iVar1; + + if(sub_80144A4(&iVar1) == 0){ + SetFriendRescueMenuState(nextState); + } +} + +void sub_8035424(void) +{ + SetFriendRescueMenuState(6); +} + +void sub_8035430(void) +{ + SetFriendRescueMenuState(0x4F); +} + +void nullsub_50(void) +{ +} + +void nullsub_51(void) +{ +} \ No newline at end of file diff --git a/src/friend_rescue_1.c b/src/friend_rescue_1.c deleted file mode 100644 index e12a1f0b..00000000 --- a/src/friend_rescue_1.c +++ /dev/null @@ -1,2036 +0,0 @@ -#include "global.h" -#include "constants/communication_error_codes.h" -#include "constants/monster.h" -#include "constants/wonder_mail.h" -#include "text.h" -#include "input.h" -#include "item.h" -#include "team_inventory.h" -#include "pokemon.h" -#include "friend_rescue.h" -#include "memory.h" -#include "save.h" -#include "menu.h" -#include "rescue_password_menu.h" -#include "menu_input.h" -#include "code_8094F88.h" - - -extern struct TeamInventory *gTeamInventory_203B460; - -extern void SetFriendRescueMenuState(u32); -extern s32 sub_80144A4(s32 *); -extern void sub_802F2C0(); -extern u32 sub_802F298(); - -extern char gUnknown_202E5D8[0x50]; -extern char gAvailablePokemonNames[0x50]; - -extern struct WonderMailStruct_203B33C *gUnknown_203B33C; - -extern u8 sub_801CF14(u32); - -extern u8 gUnknown_80E48A8[]; -extern u8 gUnknown_80E49C4[]; -extern u8 gUnknown_80E4704[]; -extern u8 gUnknown_80E48E8[]; -extern u8 gUnknown_80E4928[]; -extern u8 gUnknown_80E4964[]; -extern u8 gUnknown_80E499C[]; -extern u8 gUnknown_80E460C[]; -extern u8 gUnknown_80E31FC[]; - - -extern u32 sub_80154F0(); -extern void sub_80155F0(); -extern void sub_80141B4(u8 *r0, u32, u32 *r1, u32); -extern void sub_8014248(const char *r0, u32, u32, struct MenuItem *r4, u32, u32, u32, u32 *r5, u32); - -extern u32 sub_801CA08(u32); -extern void sub_801CBB8(void); -extern void sub_801CB5C(u32); -extern void sub_8035CC0(struct UnkTextStruct2 *, u32); -extern void sub_801B3C0(struct Item *); -extern u32 sub_801B410(void); -extern void sub_801B450(void); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern u8 sub_801CB24(void); -extern u32 sub_8030DA0(void); -extern void sub_8030DE4(void); -extern void sub_803092C(void); -extern u32 sub_8030768(u32); -extern void sub_803084C(void); -extern void sub_8030D40(u8, u32); -extern void sub_8030810(u32); -extern u8 sub_80307EC(void); - -extern u32 sub_8031DCC(void); -extern void sub_8031E10(void); -extern void sub_8031E00(void); -extern u8 sub_8024108(u32); -extern void sub_802452C(void); -extern u32 sub_80244E4(void); -extern void sub_802453C(void); -extern void sub_8023B7C(u32); -extern u32 sub_8023A94(u32); -extern void sub_8023C60(void); -extern void sub_8024458(s16, u32); -extern void sub_8023DA4(void); -extern void sub_8035D1C(void); -extern u16 sub_8023B44(void); - -extern u32 sub_8039068(u32, u8 *r1, struct unkStruct_203B480 *r0); -extern void sub_8095274(u32); -extern u8 sub_800D588(void); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); - -extern u8 gUnknown_80E44A4[]; -extern u8 gUnknown_80E4500[]; -extern u8 gUnknown_80E4550[]; -extern u8 gUnknown_80E45B4[]; -extern u8 gUnknown_80E460C[]; -extern u8 gUnknown_80E4650[]; -extern u8 gUnknown_80E468C[]; -extern u8 gUnknown_80E46C8[]; -extern u8 gUnknown_80E4704[]; -extern u8 gUnknown_80E4744[]; -extern u8 gUnknown_80E4788[]; -extern u8 gUnknown_80E47D8[]; -extern u8 gUnknown_80E4480[]; -extern u8 gUnknown_80E482C[]; -extern u8 gUnknown_80E25F4[]; -extern u8 gUnknown_80E2D7C[]; -extern u8 gUnknown_80E2E20[]; -extern u8 gUnknown_80E319C[]; -extern u8 gUnknown_80E311C[]; -extern u8 gUnknown_80E32C4[]; -extern u8 gUnknown_80E4314[]; -extern u8 gUnknown_80E41DC[]; -extern u8 gUnknown_80E2FEC[]; -extern u8 gUnknown_80E2898[]; -extern u8 gUnknown_80E2B54[]; -extern u8 gUnknown_80E29D0[]; -extern u8 gUnknown_80E3220[]; -extern u8 gUnknown_80E2A0C[]; -extern u8 gUnknown_80E2610[]; -extern u8 gUnknown_80E2640[]; -extern u8 gUnknown_80E2680[]; -extern u8 gUnknown_80E26B0[]; -extern u8 gUnknown_80E26F0[]; -extern u8 gUnknown_80E2728[]; -extern u8 gUnknown_80E3690[]; -extern u8 gUnknown_80E3818[]; -extern u8 gUnknown_80E3998[]; -extern u8 gUnknown_80E3B1C[]; -extern u8 gUnknown_80E367C[]; -extern u8 gUnknown_80E3BF8[]; -extern u8 gUnknown_80E3DE4[]; -extern u8 gUnknown_80E4014[]; -extern u8 gUnknown_80E3E98[]; -extern u8 gUnknown_80E4130[]; -extern u8 gUnknown_80E2E54[]; -extern u8 gUnknown_80E2EB4[]; -extern u8 gUnknown_80E2DD0[]; -extern u8 gUnknown_80E2FA0[]; -extern u8 gUnknown_80E2F14[]; -extern u8 gUnknown_80E2F44[]; -extern u8 gUnknown_80E30A4[]; -extern u8 gUnknown_80E2F78[]; -extern u8 gUnknown_80E360C[]; -extern u8 gUnknown_80E3644[]; -extern u8 gUnknown_80E35E8[]; -extern u8 gUnknown_80E35AC[]; -extern u8 gUnknown_80E355C[]; -extern u8 gUnknown_80E352C[]; -extern u8 gUnknown_80E34F0[]; -extern u8 gUnknown_80E34B0[]; -extern u8 gUnknown_80E3430[]; -extern u8 gUnknown_80E33D8[]; -extern u8 gUnknown_80E339C[]; -extern u8 gUnknown_80E3378[]; -extern u8 gUnknown_80E331C[]; -extern u8 gUnknown_80E3288[]; -extern u8 gUnknown_80E3248[]; -extern u8 gUnknown_80E31FC[]; -extern u8 gUnknown_80E276C[]; -extern u8 gUnknown_80E27A4[]; -extern u8 gUnknown_80E2CD4[]; -extern u8 gUnknown_80E3030[]; -extern u8 gUnknown_80E3078[]; -extern u8 gUnknown_80E31D8[]; -extern u8 gUnknown_80E2CE8[]; -extern u8 gUnknown_80E2B90[]; -extern u8 gUnknown_80E2AE4[]; -extern u8 gUnknown_80E2A80[]; -extern u8 gUnknown_80E2AA8[]; -extern u8 gUnknown_80E2D60[]; -extern u8 gUnknown_80E2BE0[]; -extern u8 gUnknown_80E2C48[]; -extern u8 gUnknown_80E29A0[]; -extern u8 gUnknown_80E2A5C[]; -extern u8 gUnknown_80E2904[]; -extern u8 gUnknown_80E2C94[]; -extern u8 gUnknown_80E2D30[]; -extern u8 gUnknown_80E296C[]; -extern u8 gUnknown_80E314C[]; -extern u8 gUnknown_80E2A1C[]; -extern u8 gUnknown_80E2840[]; -extern u8 gUnknown_80E2874[]; -extern u8 gUnknown_80E317C[]; -extern u8 gUnknown_80E28D8[]; -extern u8 gUnknown_80E2814[]; -extern u8 gUnknown_80E30D0[]; - -extern struct MenuItem gUnknown_80E20B8; -extern struct MenuItem gUnknown_80E2108; -extern struct MenuItem gUnknown_80E20E0; -extern struct MenuItem gUnknown_80E2068; -extern struct MenuItem gUnknown_80E24F8; -extern struct MenuItem gUnknown_80E2554; -extern struct MenuItem gUnknown_80E22F0; -extern struct MenuItem gUnknown_80E236C; -extern struct MenuItem gUnknown_80E2440; -extern struct MenuItem gUnknown_80E2470; -extern struct MenuItem gUnknown_80E24B0; -extern struct MenuItem gUnknown_80E2130; -extern struct MenuItem gUnknown_80E2190; -extern struct MenuItem gUnknown_80E21B8; -extern struct MenuItem gUnknown_80E2268; -extern struct MenuItem gUnknown_80E2218; -extern struct MenuItem gUnknown_80E2240; -extern struct MenuItem gUnknown_80E2290; -extern struct MenuItem gUnknown_80E22D0; -extern struct MenuItem gUnknown_80E234C; -extern struct MenuItem gUnknown_80E24D8; -extern struct MenuItem gUnknown_80E2458; -extern struct MenuItem gUnknown_80E2408; -extern struct MenuItem gUnknown_80E23A8; -extern struct MenuItem gUnknown_80E22B4; - -extern struct UnkTextStruct2 gUnknown_80E231C; -extern struct UnkTextStruct2 gUnknown_80E23F0; -extern struct UnkTextStruct2 gUnknown_80E2334; - -extern struct MenuItem gUnknown_80E25B4; - -extern void nullsub_40(); -extern void sub_8032828(); - -extern u8 sub_800D588(void); -extern void sub_8011830(void); -extern u32 sub_8030894(void); -extern void sub_8031D70(u32, u32); -extern u32 sub_8023CE8(void); -extern void sub_80922B4(u8 *buffer, u8 *string, s32 size); -extern void sub_80306A8(u32, u32, u32, u32); -extern void sub_8023868(u32, u32, u32, u32); -extern u32 sub_801D008(void); -extern void sub_8023DA4(void); -extern void sub_8023C60(void); -extern s32 sub_8037B28(u32); -extern void sub_803092C(void); -extern void sub_801CCD8(void); -extern void sub_80151C0(u32, u8 *); -extern void sub_801C8C4(u32, u32, s32 * , u32); -extern void xxx_call_start_bg_music(void); -extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); -extern void sub_802F204(struct unkStruct_802F204 *, u32); -extern void nullsub_23(u32); -extern s32 sub_8037D64(u32, void *, void *); -extern s32 sub_80381F4(u32, void *, void *); -void sprintfStatic(char *buffer, const char *text, ...); - -extern void SetFriendRescueMenuState(u32); -extern s32 sub_80144A4(s32 *); -extern void sub_802F2C0(); -extern u32 sub_802F298(); - -extern char gUnknown_202E5D8[0x50]; -extern char gAvailablePokemonNames[0x50]; - -extern struct WonderMailStruct_203B33C *gUnknown_203B33C; - -extern u8 sub_8039880(void); - -extern void sub_8035300(void); -extern void QueueNextFriendRescueState(u32); -extern void nullsub_41(void); -extern void nullsub_42(void); -extern void nullsub_43(void); -extern void nullsub_44(void); -extern void nullsub_45(void); -extern void nullsub_46(void); -extern void nullsub_47(void); -extern void nullsub_48(void); -extern void nullsub_49(void); -extern void nullsub_50(void); -extern void nullsub_51(void); -extern void sub_8035374(void); -extern void sub_80353BC(void); -extern void sub_8033A2C(void); -extern void sub_803477C(void); -extern void sub_80347AC(void); -extern void sub_80347C8(void); -extern void sub_80347E4(void); -extern void sub_8034804(void); -extern void sub_80344C0(void); -extern void sub_8034478(void); -extern void sub_80344A0(void); -extern void sub_803418C(void); -extern void sub_8034254(void); -extern void sub_8034310(void); -extern void sub_8034378(void); -extern void sub_80343C4(void); -extern void sub_8034404(void); -extern void sub_8034500(void); -extern void sub_8034590(void); -extern void sub_803464C(void); -extern void sub_80346A8(void); -extern void sub_80346D8(void); -extern void sub_8034700(void); -extern void sub_8034720(void); -extern void sub_803473C(void); -extern void sub_8033FB4(void); -extern void sub_8034074(void); -extern void sub_8034130(void); -extern void sub_8033FE4(void); -extern void sub_8033D74(void); -extern void sub_8033D94(void); -extern void sub_8033DBC(void); -extern void sub_8033F64(void); -extern void sub_8033C54(void); -extern void sub_8033CAC(void); -extern void sub_8033D48(void); -extern void sub_8035424(void); -extern void sub_8034970(void); -extern void sub_80351E0(void); -extern void sub_8034D74(void); -extern void sub_8034EF0(void); -extern void sub_8034F38(void); -extern void sub_80352A4(void); -extern void sub_8034EC8(void); -extern void sub_8033B8C(void); -extern void sub_80339C8(void); -extern void sub_80348C4(void); -extern void sub_803482C(void); -extern void sub_80349B0(void); -extern void sub_8034A70(void); -extern void sub_8034B2C(void); -extern void sub_80349E0(void); -extern void sub_8034B88(void); -extern void sub_8034C98(void); -extern void sub_8034C38(void); -extern void sub_8034D54(void); -extern void sub_8034F18(void); -extern void sub_8034F58(void); -extern void sub_8034F88(void); -extern void sub_8035018(void); -extern void sub_8035038(void); -extern void sub_8035094(void); -extern void sub_80350F4(void); -extern void sub_803517C(void); -extern void sub_8035210(void); -extern void sub_8035430(void); -extern void sub_8034848(void); - -extern void sub_803084C(void); -extern void sub_8031E10(void); -extern void sub_8023C60(void); -extern void sub_80155F0(void); -extern void sub_801CBB8(void); -extern void sub_802F2C0(void); -extern void sub_8030DE4(void); -extern void sub_802453C(void); -extern void sub_801B450(void); - - -void SetFriendRescueMenuState(u32 newState) -{ - gUnknown_203B33C->state = newState; - nullsub_40(); - sub_8032828(); -} - -void PrintFriendRescueError(u32 status) -{ - switch(status) - { - case COMMS_GOOD: - break; - case COMMS_INCORRECT_NUM_SYSTEMS: - sub_80141B4(gUnknown_80E44A4, 0, 0, 0x101); - break; - case COMMS_NO_RESPONSE: - sub_80141B4(gUnknown_80E4500, 0, 0, 0x101); - break; - case COMMS_DIFFERENT_MODES: - sub_80141B4(gUnknown_80E4550, 0, 0, 0x101); - break; - case COMMS_NO_ROOM_STORAGE: - sub_80141B4(gUnknown_80E45B4, 0, 0, 0x101); - break; - case COMMS_DUPLICATE_MAIL: - sub_80141B4(gUnknown_80E460C, 0, 0, 0x101); - break; - case COMMS_MAIL_SENT_ALREADY: - sub_80141B4(gUnknown_80E4650, 0, 0, 0x101); - break; - case COMMS_NOT_ELIGIBLE_1: - sub_80141B4(gUnknown_80E468C, 0, 0, 0x101); - break; - case COMMS_FRIEND_NOT_ELIGIBLE: - sub_80141B4(gUnknown_80E46C8, 0, 0, 0x101); - break; - case COMMS_NOT_ELIGIBLE_2: - sub_80141B4(gUnknown_80E4704, 0, 0, 0x101); - break; - case COMMS_FRIEND_NOT_ELIGIBLE_2: - sub_80141B4(gUnknown_80E4744, 0, 0, 0x101); - break; - case 16: - sub_80141B4(gUnknown_80E4788, 0, 0, 0x101); - break; - case COMMS_NO_ROOM_MAIL: - sub_80141B4(gUnknown_80E47D8, 0, 0, 0x101); - break; - case 1: - case 5: - case 14: - sub_80141B4(gUnknown_80E4480, 0, 0, 0x101); - break; - case COMMS_NOT_READY: - sub_80141B4(gUnknown_80E482C, 0, 0, 0x101); - break; - } -} - -void sub_80339C8(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - gUnknown_203B33C->speciesNum = -1; - switch(menuAction) - { - case 0: - SetFriendRescueMenuState(3); - break; - case 1: - SetFriendRescueMenuState(4); - break; - case 0x17: - SetFriendRescueMenuState(0x78); - break; - case 0x8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); - break; - } - } -} - -void sub_8033A2C(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - gUnknown_203B33C->unk40 = 8; - switch(menuAction) - { - case 0x11: - gUnknown_203B33C->unk40 = 2; - gUnknown_203B33C->unk528 = 0x11; - if(CountMailType(WONDER_MAIL_TYPE_SOS) != 0) - SetFriendRescueMenuState(0x31); - else - SetFriendRescueMenuState(0x22); - break; - case 3: - gUnknown_203B33C->unk40 = 3; - gUnknown_203B33C->unk528 = 3; - if(FindOpenMailSlot() == -1) - SetFriendRescueMenuState(0xF); - else - SetFriendRescueMenuState(0xE); - break; - case 4: - gUnknown_203B33C->unk40 = 4; - gUnknown_203B33C->unk528 = 4; - if(CountMailType(WONDER_MAIL_TYPE_AOK) != 0) - SetFriendRescueMenuState(0x1C); - else - SetFriendRescueMenuState(0x22); - break; - case 0x12: - gUnknown_203B33C->unk40 = 5; - gUnknown_203B33C->unk528 = 0x12; - if(CountMailType(5) != 0) - SetFriendRescueMenuState(0x3D); - else - SetFriendRescueMenuState(0xE); - break; - case 0x13: - gUnknown_203B33C->unk40 = 6; - gUnknown_203B33C->unk528 = 0x13; - if(CountMailType(5) == 0) - SetFriendRescueMenuState(0x51); - else - SetFriendRescueMenuState(0x5B); - break; - case 0x14: - gUnknown_203B33C->unk40 = 7; - gUnknown_203B33C->unk528 = 0x14; - SetFriendRescueMenuState(0x52); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_8033B8C(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 0xB: - case 0xC: - gUnknown_203B33C->unk524 = 0xB; - switch(gUnknown_203B33C->unk528) - { - case 3: - case 0x11: - case 0x12: - SetFriendRescueMenuState(5); - break; - case 4: - SetFriendRescueMenuState(0x23); - break; - default: - break; - } - break; - case 0xD: - gUnknown_203B33C->unk524 = 0xD; - switch(gUnknown_203B33C->unk528) - { - case 3: - SetFriendRescueMenuState(0x19); - break; - case 0x11: - SetFriendRescueMenuState(0x39); - break; - case 0x12: - SetFriendRescueMenuState(0x43); - break; - case 4: - SetFriendRescueMenuState(0x2D); - break; - default: - break; - } - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_8033C54(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - switch(gUnknown_203B33C->unk528) - { - // NOTE: Each case has to be defined to match - case 3: - SetFriendRescueMenuState(0xD); - break; - case 4: - SetFriendRescueMenuState(0xD); - break; - case 0x11: - SetFriendRescueMenuState(0xD); - break; - case 0x12: - SetFriendRescueMenuState(0xD); - break; - default: - break; - } - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void nullsub_41(void) -{ -} - -void sub_8033CAC(void) -{ - s32 temp; - u32 speciesNum; - if(sub_80144A4(&temp) == 0) - { - if(gUnknown_203B33C->status == COMMS_GOOD) - { - switch(gUnknown_203B33C->unk528) - { - case 3: - SetFriendRescueMenuState(0x16); - break; - case 0x11: - SetFriendRescueMenuState(0x37); - break; - case 0x12: - if(sub_800D588() != 0) - speciesNum = gUnknown_203B33C->unk130.pokemon.speciesNum; - else - speciesNum = gUnknown_203B33C->unkA8.pokemon.speciesNum; - if(speciesNum != MONSTER_NONE) - SetFriendRescueMenuState(0x3F); - else - SetFriendRescueMenuState(0x40); - break; - case 4: - SetFriendRescueMenuState(0x2B); - break; - - } - } - else - { - PrintFriendRescueError(gUnknown_203B33C->status); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); - } - } -} - -void sub_8033D48(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - } -} - -void nullsub_42(void) -{ -} - -void nullsub_43(void) -{ -} - -void nullsub_44(void) -{ -} - -void nullsub_45(void) -{ -} - -void sub_8033D74(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x17); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8033D94(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()) - { - FinishWriteSavePak(); - SetFriendRescueMenuState(0x18); - } - } -} - -void sub_8033DBC(void) -{ - u32 return_var; - u32 mailMode; - struct unkStruct_203B480 mail; - struct unkStruct_203B480 *mail2; - - return_var = sub_80154F0(); - MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); - switch(return_var) - { - case 3: - mailMode = 0xffdc; - switch(gUnknown_203B33C->unk528) - { - case 3: - mailMode = PASSWORD_ENTRY_SOS_MAIL_MODE; - break; - case 0x12: - mailMode = PASSWORD_ENTRY_AOK_MAIL_MODE; - break; - default: - break; - } - switch(sub_8039068(mailMode, gUnknown_203B33C->passwordBuffer, &mail)) - { - case PASSWORD_ENTRY_INCORRECT_PASSWORD: - sub_8014248(gUnknown_80E48A8, 0, 6, &gUnknown_80E2290, 0, 4, 0, 0, 0x101); - SetFriendRescueMenuState(0x1B); - break; - case PASSWORD_ENTRY_NOT_SOS_MAIL: - sub_80141B4(gUnknown_80E48E8, 0, 0, 0x101); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); - break; - case PASSWORD_ENTRY_DUPLICATE_SOS_MAIL: - sub_80141B4(gUnknown_80E460C, 0, 0, 0x101); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); - break; - case PASSWORD_ENTRY_SOS_MAIL_SUCCESS: - sub_8095274(mail.unk10.unk10); - mail.mailType = 2; - sub_80951BC(&mail); - sub_80141B4(gUnknown_80E4928, 0, 0, 0x101); - SetFriendRescueMenuState(0x16); - break; - case PASSWORD_ENTRY_NOT_AOK_MAIL: - sub_80141B4(gUnknown_80E4964, 0, 0, 0x101); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); - break; - case PASSWORD_ENTRY_DUPLICATE_AOK_MAIL: - sub_80141B4(gUnknown_80E499C, 0, 0, 0x101); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR); - break; - case PASSWORD_ENTRY_AOK_MAIL_SUCCESS: - mail.mailType = 5; - sub_80951FC(&mail); - mail2 = GetMailatIndex(GetMailIndex(1, mail.unk10.unk10)); - mail2->mailType = 7; - MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); - SetFriendRescueMenuState(0x40); - break; - case 24: - default: - break; - } - sub_80155F0(); - break; - case 2: - sub_80155F0(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } -} - -void sub_8033F64(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - switch(gUnknown_203B33C->unk528) - { - case 3: - SetFriendRescueMenuState(0x19); - break; - case 0x12: - SetFriendRescueMenuState(0x43); - break; - } - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_8033FB4(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - switch(temp) - { - case 6: - SetFriendRescueMenuState(0xE); - break; - case 7: - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_8033FE4(void) -{ - switch(sub_8030768(1)) - { - case 2: - sub_803084C(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - case 3: - gUnknown_203B33C->unk218 = sub_80307EC(); - SetFriendRescueMenuState(0x1E); - break; - case 4: - gUnknown_203B33C->fallbackState = 0x1D; - gUnknown_203B33C->unk218 = sub_80307EC(); - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8030D40(gUnknown_203B33C->unk218, 0); - SetFriendRescueMenuState(0x1F); - break; - } -} - -void sub_8034074(void) -{ - s32 menuAction; - - menuAction = -1; - sub_8030768(0); - if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) - sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); - switch(menuAction) - { - case 9: - sub_803084C(); - SetFriendRescueMenuState(0x20); - break; - case 10: - gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8030D40(gUnknown_203B33C->unk218, 0); - SetFriendRescueMenuState(0x1F); - break; - case 5: - case 8: - sub_8035CC0(gUnknown_203B33C->unk35C, 2); - sub_8030810(0x1); - SetFriendRescueMenuState(0x1D); - break; - } -} - -void sub_8034130(void) -{ - switch(sub_8030DA0()) - { - case 2: - case 3: - sub_8030DE4(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - sub_803092C(); - if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) - { - sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); - SetFriendRescueMenuState(0x1E); - } - else - SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); - break; - default: - break; - } -} - -void sub_803418C(void) -{ - switch(sub_8023A94(1)) - { - case 2: - sub_8023C60(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - sub_8035D1C(); - gUnknown_203B33C->speciesNum = -1; - break; - case 3: - gUnknown_203B33C->speciesNum = sub_8023B44(); - if(gUnknown_203B33C->unk524 == 0xE) - SetFriendRescueMenuState(9); - else - SetFriendRescueMenuState(0x27); - break; - case 4: - gUnknown_203B33C->fallbackState = 0x26; - gUnknown_203B33C->speciesNum = sub_8023B44(); - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8024458(gUnknown_203B33C->speciesNum, 0); - SetFriendRescueMenuState(0x28); - break; - } -} - -void sub_8034254(void) -{ - s32 menuAction; - menuAction = -1; - - sub_8023A94(0); - if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) - sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); - switch(menuAction) - { - case 9: - sub_8023C60(); - SetFriendRescueMenuState(0x29); - break; - case 10: - gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8024458(gUnknown_203B33C->speciesNum, 0); - SetFriendRescueMenuState(0x28); - break; - case 5: - case 8: - sub_8035CC0(gUnknown_203B33C->unk35C, 3); - sub_8023DA4(); - SetFriendRescueMenuState(0x26); - break; - } -} - -void sub_8034310(void) -{ - switch(sub_80244E4()) - { - case 1: - sub_802452C(); - break; - case 2: - case 3: - sub_802453C(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - sub_8023B7C(1); - if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) - { - sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); - SetFriendRescueMenuState(0x27); - } - else - SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); - break; - default: - break; - } -} - -void sub_8034378(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 0x10: - if(gUnknown_203B33C->unk524 == 0xE) - SetFriendRescueMenuState(0x9); - else - SetFriendRescueMenuState(0x5); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_80343C4(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - SetFriendRescueMenuState(0x5); - break; - case 7: - SetFriendRescueMenuState(0x25); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_8034404(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 0xF: - if(sub_8024108(3)) - SetFriendRescueMenuState(0x24); - else - SetFriendRescueMenuState(0x25); - break; - case 0x10: - if(gUnknown_203B33C->unk524 == 0xE) - SetFriendRescueMenuState(0x9); - else - SetFriendRescueMenuState(0x5); - break; - case 0x8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_8034478(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()) - { - FinishWriteSavePak(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); - } - } -} - -void sub_80344A0(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x2C); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_80344C0(void) -{ - switch(sub_8031DCC()) - { - case 2: - case 3: - sub_8031E10(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - SetFriendRescueMenuState(0x2F); - break; - case 1: - sub_8031E00(); - break; - case 0: - break; - } -} - -void sub_8034500(void) -{ - switch(sub_8030768(1)) - { - case 2: - sub_803084C(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - case 3: - gUnknown_203B33C->unk218 = sub_80307EC(); - SetFriendRescueMenuState(0x33); - break; - case 4: - gUnknown_203B33C->fallbackState = 0x32; - gUnknown_203B33C->unk218 = sub_80307EC(); - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8030D40(gUnknown_203B33C->unk218, 0); - SetFriendRescueMenuState(0x34); - break; - } -} - -void sub_8034590(void) -{ - s32 menuAction; - menuAction = -1; - - sub_8030768(0); - if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) - sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); - switch(menuAction) - { - case 9: - sub_803084C(); - SetFriendRescueMenuState(0x35); - break; - case 10: - gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8030D40(gUnknown_203B33C->unk218, 0); - SetFriendRescueMenuState(0x34); - break; - case 5: - case 8: - sub_8035CC0(gUnknown_203B33C->unk35C, 2); - sub_8030810(0x1); - SetFriendRescueMenuState(0x32); - break; - } -} - -void sub_803464C(void) -{ - switch(sub_8030DA0()) - { - case 2: - case 3: - sub_8030DE4(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - sub_803092C(); - if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) - { - sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); - SetFriendRescueMenuState(0x33); - } - else - SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); - break; - default: - break; - } -} - -void sub_80346A8(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - SetFriendRescueMenuState(0xE); - break; - case 7: - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_80346D8(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()) - { - FinishWriteSavePak(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); - } - } -} - -void sub_8034700(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x38); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8034720(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x3A); - } -} - -void sub_803473C(void) -{ - switch(sub_8031DCC()) - { - case 2: - case 3: - sub_8031E10(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - SetFriendRescueMenuState(0x3B); - break; - case 1: - sub_8031E00(); - break; - case 0: - break; - } -} - -void sub_803477C(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - SetFriendRescueMenuState(0xE); - break; - case 7: - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_80347AC(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0xD); - } -} - -void sub_80347C8(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x40); - } -} - -void sub_80347E4(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x41); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8034804(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()) - { - FinishWriteSavePak(); - SetFriendRescueMenuState(0x42); - } - } -} - -void sub_803482C(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - } -} - - -void sub_8034848(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(struct Item)); - gUnknown_203B33C->item.id = ITEM_NOTHING; - gUnknown_203B33C->item.quantity = 1; - gUnknown_203B33C->item.flags = 0; - - if(gUnknown_203B33C->status == COMMS_GOOD) - { - switch(gUnknown_203B33C->unk40) - { - case 7: - SetFriendRescueMenuState(0x6D); - break; - case 6: - SetFriendRescueMenuState(0x50); - break; - } - } - else - { - PrintFriendRescueError(gUnknown_203B33C->status); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); - } - } -} - -void sub_80348C4(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(struct Item)); - gUnknown_203B33C->item.id = ITEM_NOTHING; - gUnknown_203B33C->item.quantity = 1; - gUnknown_203B33C->item.flags = 0; - - if(gUnknown_203B33C->status == COMMS_GOOD) - { - switch(gUnknown_203B33C->unk40) - { - case 6: - switch((u32)gUnknown_203B33C->unk524) - { - case 0xB: - case 0xD: - case 0xE: - sub_80141B4(gUnknown_80E31FC, 0, 0, 0x101); - SetFriendRescueMenuState(0x77); - break; - case 0xC: - default: - SetFriendRescueMenuState(0x77); - break; - } - break; - case 7: - SetFriendRescueMenuState(0x6D); - break; - } - } - else - { - PrintFriendRescueError(gUnknown_203B33C->status); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); - } - } -} - -void sub_8034970(void) -{ - switch(sub_8031DCC()) - { - case 2: - case 3: - sub_8031E10(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - SetFriendRescueMenuState(0x68); - break; - case 1: - sub_8031E00(); - break; - case 0: - break; - } -} - -void sub_80349B0(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - SetFriendRescueMenuState(0x52); - break; - case 7: - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_80349E0(void) -{ - switch(sub_8030768(1)) - { - case 2: - sub_803084C(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - case 3: - gUnknown_203B33C->unk218 = sub_80307EC(); - SetFriendRescueMenuState(0x5D); - break; - case 4: - gUnknown_203B33C->fallbackState = 0x5C; - gUnknown_203B33C->unk218 = sub_80307EC(); - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8030D40(gUnknown_203B33C->unk218, 0); - SetFriendRescueMenuState(0x5E); - break; - } -} - -void sub_8034A70(void) -{ - s32 menuAction; - - menuAction = -1; - sub_8030768(0); - if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) - sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); - switch(menuAction) - { - case 9: - sub_803084C(); - SetFriendRescueMenuState(0x5A); - break; - case 10: - gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_8030D40(gUnknown_203B33C->unk218, 0); - SetFriendRescueMenuState(0x5E); - break; - case 5: - case 8: - sub_8035CC0(gUnknown_203B33C->unk35C, 2); - sub_8030810(0x1); - SetFriendRescueMenuState(0x5C); - break; - } -} - -void sub_8034B2C(void) -{ - switch(sub_8030DA0()) - { - case 2: - case 3: - sub_8030DE4(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - sub_803092C(); - if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) - { - sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); - SetFriendRescueMenuState(0x5D); - } - else - SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); - break; - default: - break; - } -} - -void sub_8034B88(void) -{ - gUnknown_203B33C->item.id = ITEM_NOTHING; - gUnknown_203B33C->item.quantity = 1; - gUnknown_203B33C->item.flags = 0; - switch(sub_801CA08(1)) - { - case 2: - sub_801CBB8(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - case 3: - gUnknown_203B33C->item.id = sub_801CB24(); - SetFriendRescueMenuState(0x60); - break; - case 4: - gUnknown_203B33C->fallbackState = 0x5F; - gUnknown_203B33C->item.id = sub_801CB24(); - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_801B3C0(&gUnknown_203B33C->item); - SetFriendRescueMenuState(0x61); - break; - } -} - -void sub_8034C38(void) -{ - switch(sub_801B410()) - { - case 2: - case 3: - sub_801B450(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - sub_801CB5C(1); - if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) - { - sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); - SetFriendRescueMenuState(0x60); - } - else - SetFriendRescueMenuState(gUnknown_203B33C->fallbackState); - break; - default: - case 1: - break; - } -} - -void sub_8034C98(void) -{ - s32 menuAction; - - menuAction = -1; - sub_801CA08(0); - if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) - sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); - switch(menuAction) - { - case 9: - sub_801CBB8(); - SetFriendRescueMenuState(0x58); - break; - case 10: - gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; - sub_8006518(gUnknown_203B33C->unk3BC); - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sub_801B3C0(&gUnknown_203B33C->item); - SetFriendRescueMenuState(0x61); - break; - case 5: - case 8: - sub_8035CC0(gUnknown_203B33C->unk35C, 3); - sub_801CB5C(0x1); - SetFriendRescueMenuState(0x5F); - break; - } -} - -void sub_8034D54(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x65); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8034D74(void) -{ - u32 return_var; - struct unkStruct_203B480 mail; - struct unkStruct_203B480 *mail2; - - return_var = sub_80154F0(); - MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); - switch(return_var) - { - case 3: - switch(sub_8039068(PASSWORD_ENTRY_THANK_YOU_MAIL_MODE, gUnknown_203B33C->passwordBuffer, &mail)) - { - case PASSWORD_ENTRY_INCORRECT_PASSWORD: - sub_8014248(gUnknown_80E48A8, 0, 6, &gUnknown_80E2440, 0, 4, 0, 0, 0x101); - SetFriendRescueMenuState(0x74); - break; - case PASSWORD_ENTRY_NOT_THANK_YOU_MAIL: - sub_80141B4(gUnknown_80E49C4, 0, 0, 0x101); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); - break; - case PASSWORD_ENTRY_DUPLICATE_THANK_YOU_MAIL: - sub_80141B4(gUnknown_80E4704, 0, 0, 0x101); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_ERROR_2); - break; - case PASSWORD_ENTRY_THANK_YOU_MAIL_SUCCESS: - mail2 = GetMailatIndex(GetMailIndex(4, mail.unk10.unk10)); - *mail2 = mail; - mail2->mailType = 6; - gUnknown_203B33C->unk420 = mail.unk10.unk10; - SetFriendRescueMenuState(0x6D); - break; - case 7: - default: - break; - } - sub_80155F0(); - break; - case 2: - sub_80155F0(); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } -} - -void sub_8034EC8(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()) - { - FinishWriteSavePak(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); - } - } -} - -void sub_8034EF0(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()) - { - FinishWriteSavePak(); - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_EXIT); - } - } -} - -void sub_8034F18(void) -{ - s32 temp; - - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x65); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8034F38(void) -{ - s32 temp; - - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x71); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8034F58(void) -{ - s32 temp; - - if(sub_80144A4(&temp) == 0) - { - switch(temp) - { - case 6: - SetFriendRescueMenuState(0x62); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_8034F88(void) -{ - s32 menuAction; - struct unkStruct_203B480 *mail; - - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - mail = GetMailatIndex(gUnknown_203B33C->unk218); - if(gUnknown_203B33C->item.id != ITEM_NOTHING) - mail->unk20 = gUnknown_203B33C->item; - gTeamInventory_203B460->teamStorage[gUnknown_203B33C->item.id]--; - SetFriendRescueMenuState(0x75); - break; - case 7: - SetFriendRescueMenuState(0x57); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - } - } -} - -void sub_8035018(void) -{ - s32 temp; - - if(sub_80144A4(&temp) == 0) - { - SetFriendRescueMenuState(0x76); - PrepareSavePakWrite(MONSTER_NONE); - } -} - -void sub_8035038(void) -{ - s32 temp; - - if(sub_80144A4(&temp) == 0) - { - if(!WriteSavePak()){ - FinishWriteSavePak(); - // Dumb cast to get unsigned switch - switch((u32)gUnknown_203B33C->unk524) - { - default: - break; - case 0xB: - case 0xC: - SetFriendRescueMenuState(0x69); - break; - case 0xD: - SetFriendRescueMenuState(0x66); - break; - case 0xE: - SetFriendRescueMenuState(0x4B); - break; - } - } - } -} - -void sub_8035094(void) -{ - s32 menuAction; - - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 0x16: - // Dumb cast to get unsigned switch - switch((u32)gUnknown_203B33C->unk524) - { - default: - break; - case 0xB: - case 0xC: - SetFriendRescueMenuState(0x69); - break; - case 0xD: - SetFriendRescueMenuState(0x66); - break; - case 0xE: - SetFriendRescueMenuState(0x4B); - break; - } - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_80350F4(void) -{ - s32 menuAction; - - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 0x15: - if(sub_801CF14(0) != 0) - SetFriendRescueMenuState(0x56); - else - SetFriendRescueMenuState(0x57); - break; - case 0x16: - // Dumb cast to get unsigned switch - switch((u32)gUnknown_203B33C->unk524) - { - default: - break; - case 0xB: - case 0xC: - SetFriendRescueMenuState(0x69); - break; - case 0xD: - SetFriendRescueMenuState(0x66); - break; - case 0xE: - SetFriendRescueMenuState(0x4B); - break; - } - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_803517C(void) -{ - s32 menuAction; - - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - // Dumb cast to get unsigned switch - switch((u32)gUnknown_203B33C->unk524) - { - default: - break; - case 0xB: - case 0xC: - SetFriendRescueMenuState(0x69); - break; - case 0xD: - SetFriendRescueMenuState(0x66); - break; - case 0xE: - SetFriendRescueMenuState(0x4B); - break; - } - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_80351E0(void) -{ - s32 menuAction; - - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 6: - SetFriendRescueMenuState(0x72); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - default: - break; - } - } -} - -void sub_8035210(void) -{ - s32 menuAction; - struct unkStruct_203B480 *mail; - - if(sub_80144A4(&menuAction) == 0) - { - // NOTE: this is why unk524 can't be changed to u32.. - gUnknown_203B33C->unk524 = menuAction; - switch(gUnknown_203B33C->unk524) - { - case 0xB: - case 0xC: - case 0xD: - if(gUnknown_203B33C->unk528 == 0x13) - { - mail = GetMailatIndex(GetFirstIndexofMailType(5)); - if(mail->unk20.id != ITEM_NOTHING) - SetFriendRescueMenuState(0x53); - else - SetFriendRescueMenuState(0x55); - } - else if(gUnknown_203B33C->unk524 != 0xD) - SetFriendRescueMenuState(0x69); - else - SetFriendRescueMenuState(0x72); - break; - case 8: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - case 0xE: - default: - break; - } - } -} - -void nullsub_46(void) -{ -} - -void nullsub_47(void) -{ -} - -void nullsub_48(void) -{ -} - -void nullsub_49(void) -{ -} - -void sub_80352A4(void) -{ - u8 mailIndex; - char *monName; - - if ( sub_802F298() == 3) { - sub_802F2C0(); - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_PELIPPER); - monName = GetMonSpecies(MONSTER_PELIPPER); - strcpy(gAvailablePokemonNames, monName); - mailIndex = GetMailIndex(6, gUnknown_203B33C->unk420); - DeleteMailAtIndex(mailIndex); - SetFriendRescueMenuState(0x70); - } -} - -void sub_8035300(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) != 0) - return; - switch(menuAction) - { - case 0x19: - SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); - break; - case 0x1B: - SetFriendRescueMenuState(0x7A); - break; - case 0x1C: - SetFriendRescueMenuState(0x7C); - break; - case 0x1A: - case 0x1D: - gUnknown_203B33C->unk564 = menuAction; - SetFriendRescueMenuState(0x79); - break; - } -} - -void sub_8035374(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) != 0) - return; - switch(menuAction) - { - case 0x19: - SetFriendRescueMenuState(0x78); - break; - case 0x1E: - case 0x1F: - case 0x20: - case 0x21: - case 0x22: - gUnknown_203B33C->unk564 = menuAction; - SetFriendRescueMenuState(0x7B); - break; - } -} - -void sub_80353BC(void) -{ - s32 menuAction; - if(sub_80144A4(&menuAction) != 0) - return; - switch(menuAction) - { - case 0x19: - SetFriendRescueMenuState(0x78); - break; - case 0x23: - case 0x24: - case 0x25: - case 0x26: - gUnknown_203B33C->unk564 = menuAction; - SetFriendRescueMenuState(0x7D); - break; - } -} - -void QueueNextFriendRescueState(u32 nextState) -{ - s32 iVar1; - - if(sub_80144A4(&iVar1) == 0){ - SetFriendRescueMenuState(nextState); - } -} - -void sub_8035424(void) -{ - SetFriendRescueMenuState(6); -} - -void sub_8035430(void) -{ - SetFriendRescueMenuState(0x4F); -} - -void nullsub_50(void) -{ -} - -void nullsub_51(void) -{ -}